@struktoai/mirage-node 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. package/README.md +63 -129
  2. package/dist/aliyun-TMZRUYCG.js +10 -0
  3. package/dist/backblaze-OHW57DLK.js +10 -0
  4. package/dist/box-UXTCAFOZ.js +8 -0
  5. package/dist/ceph-TNN4I2FT.js +10 -0
  6. package/dist/chunk-2CC5VW7K.js +52 -0
  7. package/dist/chunk-2CC5VW7K.js.map +1 -0
  8. package/dist/chunk-3IJSIVKT.js +57 -0
  9. package/dist/chunk-3IJSIVKT.js.map +1 -0
  10. package/dist/chunk-3T3RMDNX.js +57 -0
  11. package/dist/chunk-3T3RMDNX.js.map +1 -0
  12. package/dist/chunk-54NTYJEO.js +13 -0
  13. package/dist/chunk-54NTYJEO.js.map +1 -0
  14. package/dist/{chunk-DCJQ2PIX.js → chunk-5DLOHQJ2.js} +5 -8
  15. package/dist/chunk-5DLOHQJ2.js.map +1 -0
  16. package/dist/chunk-5HCVKTP3.js +2086 -0
  17. package/dist/chunk-5HCVKTP3.js.map +1 -0
  18. package/dist/{chunk-5E6BULAK.js → chunk-5YOCVEUB.js} +5 -8
  19. package/dist/chunk-5YOCVEUB.js.map +1 -0
  20. package/dist/{chunk-6M2NL363.js → chunk-A4Z6DZ22.js} +6 -8
  21. package/dist/chunk-A4Z6DZ22.js.map +1 -0
  22. package/dist/{chunk-NOZZFJEB.js → chunk-A7X4L4JM.js} +5 -8
  23. package/dist/chunk-A7X4L4JM.js.map +1 -0
  24. package/dist/{chunk-GCB4JUF7.js → chunk-ABTEGAFB.js} +5 -8
  25. package/dist/chunk-ABTEGAFB.js.map +1 -0
  26. package/dist/chunk-AJICZLHT.js +57 -0
  27. package/dist/chunk-AJICZLHT.js.map +1 -0
  28. package/dist/{chunk-H74QYTN7.js → chunk-B2ZOKNN4.js} +14 -3
  29. package/dist/chunk-B2ZOKNN4.js.map +1 -0
  30. package/dist/{chunk-ICSS5ETT.js → chunk-B6SXRCBO.js} +8 -18
  31. package/dist/chunk-B6SXRCBO.js.map +1 -0
  32. package/dist/{chunk-HEQL3LPK.js → chunk-BYTU2YC3.js} +8 -18
  33. package/dist/chunk-BYTU2YC3.js.map +1 -0
  34. package/dist/{chunk-V5OLWE7F.js → chunk-C6NHEDHY.js} +5 -8
  35. package/dist/chunk-C6NHEDHY.js.map +1 -0
  36. package/dist/chunk-C6NHFMIP.js +57 -0
  37. package/dist/chunk-C6NHFMIP.js.map +1 -0
  38. package/dist/chunk-CASCUFK2.js +87 -0
  39. package/dist/chunk-CASCUFK2.js.map +1 -0
  40. package/dist/chunk-DNBAMB5J.js +18 -0
  41. package/dist/chunk-DNBAMB5J.js.map +1 -0
  42. package/dist/chunk-DP2PP5V2.js +26 -0
  43. package/dist/chunk-DP2PP5V2.js.map +1 -0
  44. package/dist/{chunk-OYJXYJTE.js → chunk-DTAY7LPC.js} +303 -866
  45. package/dist/chunk-DTAY7LPC.js.map +1 -0
  46. package/dist/chunk-DYXEITK3.js +52 -0
  47. package/dist/chunk-DYXEITK3.js.map +1 -0
  48. package/dist/chunk-E2ISWXLB.js +7 -0
  49. package/dist/chunk-E2ISWXLB.js.map +1 -0
  50. package/dist/{chunk-XDEEOTVK.js → chunk-E7RW3SBV.js} +5 -8
  51. package/dist/chunk-E7RW3SBV.js.map +1 -0
  52. package/dist/chunk-EGB7V74Z.js +76 -0
  53. package/dist/chunk-EGB7V74Z.js.map +1 -0
  54. package/dist/{chunk-LBBM3LKK.js → chunk-ERELJ7BS.js} +5 -8
  55. package/dist/chunk-ERELJ7BS.js.map +1 -0
  56. package/dist/chunk-FXFDBF3P.js +57 -0
  57. package/dist/chunk-FXFDBF3P.js.map +1 -0
  58. package/dist/chunk-G5BZE7UA.js +50 -0
  59. package/dist/chunk-G5BZE7UA.js.map +1 -0
  60. package/dist/chunk-H3BST2LI.js +26 -0
  61. package/dist/chunk-H3BST2LI.js.map +1 -0
  62. package/dist/chunk-H3I2KZIY.js +25 -0
  63. package/dist/chunk-H3I2KZIY.js.map +1 -0
  64. package/dist/{chunk-UWMOTOXA.js → chunk-HEHERHQ5.js} +8 -15
  65. package/dist/chunk-HEHERHQ5.js.map +1 -0
  66. package/dist/chunk-HQ4KWN76.js +57 -0
  67. package/dist/chunk-HQ4KWN76.js.map +1 -0
  68. package/dist/{chunk-MY3NUJJD.js → chunk-IQVNVTOP.js} +8 -18
  69. package/dist/chunk-IQVNVTOP.js.map +1 -0
  70. package/dist/chunk-JALIYI6M.js +55 -0
  71. package/dist/chunk-JALIYI6M.js.map +1 -0
  72. package/dist/chunk-JZQHKDSY.js +216 -0
  73. package/dist/chunk-JZQHKDSY.js.map +1 -0
  74. package/dist/chunk-JZT4QGIP.js +24 -0
  75. package/dist/chunk-JZT4QGIP.js.map +1 -0
  76. package/dist/chunk-KTNDT45N.js +57 -0
  77. package/dist/chunk-KTNDT45N.js.map +1 -0
  78. package/dist/chunk-L6JPBJAS.js +57 -0
  79. package/dist/chunk-L6JPBJAS.js.map +1 -0
  80. package/dist/{chunk-6VKNSO6U.js → chunk-LAJJPLEV.js} +17 -11
  81. package/dist/chunk-LAJJPLEV.js.map +1 -0
  82. package/dist/chunk-LW25LMIH.js +26 -0
  83. package/dist/chunk-LW25LMIH.js.map +1 -0
  84. package/dist/{chunk-WSDQ2MRG.js → chunk-LYDMMNL2.js} +5 -8
  85. package/dist/chunk-LYDMMNL2.js.map +1 -0
  86. package/dist/{chunk-G7O6DAWU.js → chunk-MHCMHKM6.js} +15 -9
  87. package/dist/chunk-MHCMHKM6.js.map +1 -0
  88. package/dist/chunk-N72CAZEH.js +1990 -0
  89. package/dist/chunk-N72CAZEH.js.map +1 -0
  90. package/dist/{chunk-XQUQSNCA.js → chunk-NHS7WLEQ.js} +4 -5
  91. package/dist/chunk-NHS7WLEQ.js.map +1 -0
  92. package/dist/chunk-NJMGCT63.js +54 -0
  93. package/dist/chunk-NJMGCT63.js.map +1 -0
  94. package/dist/chunk-O7ODGJYL.js +57 -0
  95. package/dist/chunk-O7ODGJYL.js.map +1 -0
  96. package/dist/chunk-OHROA3FQ.js +54 -0
  97. package/dist/chunk-OHROA3FQ.js.map +1 -0
  98. package/dist/chunk-OPYQ5KIO.js +52 -0
  99. package/dist/chunk-OPYQ5KIO.js.map +1 -0
  100. package/dist/chunk-OYV2DN66.js +50 -0
  101. package/dist/chunk-OYV2DN66.js.map +1 -0
  102. package/dist/chunk-OZAEWZZ3.js +31 -0
  103. package/dist/chunk-OZAEWZZ3.js.map +1 -0
  104. package/dist/chunk-PBBG7VFT.js +1896 -0
  105. package/dist/chunk-PBBG7VFT.js.map +1 -0
  106. package/dist/{chunk-HXWGG4K7.js → chunk-PJBQKMCD.js} +10 -20
  107. package/dist/chunk-PJBQKMCD.js.map +1 -0
  108. package/dist/chunk-Q2IAILVC.js +26 -0
  109. package/dist/chunk-Q2IAILVC.js.map +1 -0
  110. package/dist/chunk-Q6CDMOM6.js +57 -0
  111. package/dist/chunk-Q6CDMOM6.js.map +1 -0
  112. package/dist/{chunk-ALAMUIGJ.js → chunk-QGRDPSAH.js} +17 -12
  113. package/dist/chunk-QGRDPSAH.js.map +1 -0
  114. package/dist/{chunk-7QXJ4KWQ.js → chunk-RLGWMJD3.js} +63 -9
  115. package/dist/chunk-RLGWMJD3.js.map +1 -0
  116. package/dist/chunk-RO5IQEDQ.js +30 -0
  117. package/dist/chunk-RO5IQEDQ.js.map +1 -0
  118. package/dist/{chunk-ZC4KNEOQ.js → chunk-RQK5UPMP.js} +16 -11
  119. package/dist/chunk-RQK5UPMP.js.map +1 -0
  120. package/dist/chunk-RQYEEA2O.js +50 -0
  121. package/dist/chunk-RQYEEA2O.js.map +1 -0
  122. package/dist/chunk-SFUCUARB.js +21 -0
  123. package/dist/chunk-SFUCUARB.js.map +1 -0
  124. package/dist/{chunk-MVE5VVMQ.js → chunk-TRTUHCS4.js} +5 -8
  125. package/dist/chunk-TRTUHCS4.js.map +1 -0
  126. package/dist/chunk-TWGVQLG2.js +24 -0
  127. package/dist/chunk-TWGVQLG2.js.map +1 -0
  128. package/dist/chunk-UGK4TAVK.js +32 -0
  129. package/dist/chunk-UGK4TAVK.js.map +1 -0
  130. package/dist/{chunk-LPMPTQYP.js → chunk-UT2OPSN4.js} +12 -10
  131. package/dist/chunk-UT2OPSN4.js.map +1 -0
  132. package/dist/chunk-VGLHY6BK.js +31 -0
  133. package/dist/chunk-VGLHY6BK.js.map +1 -0
  134. package/dist/chunk-W7FLHT65.js +26 -0
  135. package/dist/chunk-W7FLHT65.js.map +1 -0
  136. package/dist/chunk-WL7HS7EM.js +50 -0
  137. package/dist/chunk-WL7HS7EM.js.map +1 -0
  138. package/dist/chunk-WSGEIVY3.js +1766 -0
  139. package/dist/chunk-WSGEIVY3.js.map +1 -0
  140. package/dist/{chunk-H3JR7MN3.js → chunk-XGJ2QERC.js} +17 -10
  141. package/dist/chunk-XGJ2QERC.js.map +1 -0
  142. package/dist/chunk-XHCBHYN4.js +54 -0
  143. package/dist/chunk-XHCBHYN4.js.map +1 -0
  144. package/dist/chunk-XLQI4IT2.js +54 -0
  145. package/dist/chunk-XLQI4IT2.js.map +1 -0
  146. package/dist/{chunk-3PBSL7BS.js → chunk-XRU5WXZX.js} +5 -8
  147. package/dist/chunk-XRU5WXZX.js.map +1 -0
  148. package/dist/{chunk-UZZD4MRJ.js → chunk-YAVGCQUP.js} +5 -8
  149. package/dist/chunk-YAVGCQUP.js.map +1 -0
  150. package/dist/chunk-YGZMVNN5.js +54 -0
  151. package/dist/chunk-YGZMVNN5.js.map +1 -0
  152. package/dist/{chunk-PEZYBKZH.js → chunk-YPT4JBUY.js} +10 -24
  153. package/dist/chunk-YPT4JBUY.js.map +1 -0
  154. package/dist/chunk-YUK3X3B4.js +27 -0
  155. package/dist/chunk-YUK3X3B4.js.map +1 -0
  156. package/dist/chunk-ZNWVJ6UW.js +54 -0
  157. package/dist/chunk-ZNWVJ6UW.js.map +1 -0
  158. package/dist/config-34LHOGLM.js +13 -0
  159. package/dist/config-3BBWD5AB.js +11 -0
  160. package/dist/{config-FNR6LJ5H.js → config-3IVQJBNW.js} +4 -2
  161. package/dist/config-4UDVSUQJ.js +11 -0
  162. package/dist/config-CMDBAPDH.js +11 -0
  163. package/dist/config-CVZ2AGCO.js +21 -0
  164. package/dist/config-D3RLSPNF.js +11 -0
  165. package/dist/config-DG65OEG3.js +11 -0
  166. package/dist/{config-HNSDNQZH.js → config-EIHSP5DZ.js} +4 -2
  167. package/dist/config-EO23EY62.js +15 -0
  168. package/dist/config-GCQK6NJY.js +11 -0
  169. package/dist/{config-5ZPGISS6.js → config-GE4W4ZJC.js} +4 -2
  170. package/dist/config-GHRUKEQ6.js +13 -0
  171. package/dist/config-GVH27UPE.js +11 -0
  172. package/dist/config-HKRMKD76.js +15 -0
  173. package/dist/config-HXVYIXP5.js +11 -0
  174. package/dist/config-IDZMEW73.js +11 -0
  175. package/dist/config-IJJXGLBQ.js +11 -0
  176. package/dist/config-IVY5EQQ2.js +15 -0
  177. package/dist/config-KJOLGVB2.js +11 -0
  178. package/dist/{config-S47UDVRZ.js → config-KMVCVBYN.js} +4 -2
  179. package/dist/{config-UKZ72IDO.js → config-KYTRXAB2.js} +4 -2
  180. package/dist/{config-MOLWOSRG.js → config-LHFFXVYI.js} +4 -2
  181. package/dist/config-NV5WXP64.js +11 -0
  182. package/dist/config-OT2TQQCN.js +11 -0
  183. package/dist/config-Q45Y46YT.js +15 -0
  184. package/dist/config-QAA646XB.js +15 -0
  185. package/dist/config-QNMKWJ4M.js +15 -0
  186. package/dist/config-QWCY3LBQ.js +11 -0
  187. package/dist/{config-HIZHA5VD.js → config-VM526IKB.js} +4 -2
  188. package/dist/config-WDAZFXYD.js +15 -0
  189. package/dist/config-ZFJYQZCH.js +13 -0
  190. package/dist/config-ZV6G2ZEC.js +11 -0
  191. package/dist/databricks_volume-HNQ4DJVJ.js +7 -0
  192. package/dist/digitalocean-6SPR4S7V.js +10 -0
  193. package/dist/discord-SAV2RBJV.js +8 -0
  194. package/dist/{disk-C7TJNU2B.js → disk-POACMF4G.js} +2 -2
  195. package/dist/dropbox-CQ7MTYX2.js +8 -0
  196. package/dist/email-KBQ7CXS7.js +8 -0
  197. package/dist/gcs-SMIE4VMT.js +10 -0
  198. package/dist/gdocs-X5Y2SIQX.js +8 -0
  199. package/dist/gdrive-SIQPRIGI.js +8 -0
  200. package/dist/github-KBHWANKQ.js +8 -0
  201. package/dist/github-KBHWANKQ.js.map +1 -0
  202. package/dist/github_ci-HPITNK37.js +8 -0
  203. package/dist/github_ci-HPITNK37.js.map +1 -0
  204. package/dist/gmail-DKHAGJNX.js +8 -0
  205. package/dist/gmail-DKHAGJNX.js.map +1 -0
  206. package/dist/gsheets-ZSUDIWGK.js +8 -0
  207. package/dist/gsheets-ZSUDIWGK.js.map +1 -0
  208. package/dist/gslides-GYXM7IMJ.js +8 -0
  209. package/dist/gslides-GYXM7IMJ.js.map +1 -0
  210. package/dist/hf_buckets-RIOMV7WG.js +10 -0
  211. package/dist/hf_buckets-RIOMV7WG.js.map +1 -0
  212. package/dist/hf_datasets-QF4BQ3OK.js +10 -0
  213. package/dist/hf_datasets-QF4BQ3OK.js.map +1 -0
  214. package/dist/hf_models-62GC2HPZ.js +10 -0
  215. package/dist/hf_models-62GC2HPZ.js.map +1 -0
  216. package/dist/hf_spaces-NVSMUNRM.js +10 -0
  217. package/dist/hf_spaces-NVSMUNRM.js.map +1 -0
  218. package/dist/index.d.ts +722 -277
  219. package/dist/index.js +646 -2268
  220. package/dist/index.js.map +1 -1
  221. package/dist/langfuse-HUAYVPHF.js +8 -0
  222. package/dist/langfuse-HUAYVPHF.js.map +1 -0
  223. package/dist/linear-2MM55KBC.js +8 -0
  224. package/dist/linear-2MM55KBC.js.map +1 -0
  225. package/dist/minio-L3XE6PQS.js +10 -0
  226. package/dist/minio-L3XE6PQS.js.map +1 -0
  227. package/dist/mongodb-ZOX4FRHJ.js +7 -0
  228. package/dist/mongodb-ZOX4FRHJ.js.map +1 -0
  229. package/dist/notion-UK4GTMT4.js +8 -0
  230. package/dist/notion-UK4GTMT4.js.map +1 -0
  231. package/dist/oci-NURLWPL2.js +10 -0
  232. package/dist/oci-NURLWPL2.js.map +1 -0
  233. package/dist/postgres-JNFMPAO2.js +7 -0
  234. package/dist/postgres-JNFMPAO2.js.map +1 -0
  235. package/dist/qingstor-W55D5YFO.js +10 -0
  236. package/dist/qingstor-W55D5YFO.js.map +1 -0
  237. package/dist/r2-FSZK7IFI.js +10 -0
  238. package/dist/r2-FSZK7IFI.js.map +1 -0
  239. package/dist/redis-S6GIPA4Z.js +8 -0
  240. package/dist/redis-S6GIPA4Z.js.map +1 -0
  241. package/dist/s3-GMPUJ65D.js +8 -0
  242. package/dist/s3-GMPUJ65D.js.map +1 -0
  243. package/dist/scaleway-5VM55Y6D.js +10 -0
  244. package/dist/scaleway-5VM55Y6D.js.map +1 -0
  245. package/dist/seaweedfs-J3EPUEPE.js +10 -0
  246. package/dist/seaweedfs-J3EPUEPE.js.map +1 -0
  247. package/dist/slack-FVBXY7KD.js +8 -0
  248. package/dist/slack-FVBXY7KD.js.map +1 -0
  249. package/dist/ssh-GCXETJ3Z.js +9 -0
  250. package/dist/ssh-GCXETJ3Z.js.map +1 -0
  251. package/dist/supabase-HLWNHBBE.js +10 -0
  252. package/dist/supabase-HLWNHBBE.js.map +1 -0
  253. package/dist/tencent-YDO73XBD.js +10 -0
  254. package/dist/tencent-YDO73XBD.js.map +1 -0
  255. package/dist/trello-CQ53BQUL.js +8 -0
  256. package/dist/trello-CQ53BQUL.js.map +1 -0
  257. package/dist/wasabi-SOZKPMRQ.js +10 -0
  258. package/dist/wasabi-SOZKPMRQ.js.map +1 -0
  259. package/package.json +39 -13
  260. package/dist/box-4P7DCJH7.js +0 -8
  261. package/dist/chunk-35PVZRWU.js +0 -24
  262. package/dist/chunk-35PVZRWU.js.map +0 -1
  263. package/dist/chunk-3PBSL7BS.js.map +0 -1
  264. package/dist/chunk-3Y625AUP.js +0 -24
  265. package/dist/chunk-3Y625AUP.js.map +0 -1
  266. package/dist/chunk-5E6BULAK.js.map +0 -1
  267. package/dist/chunk-5ITBZN55.js +0 -24
  268. package/dist/chunk-5ITBZN55.js.map +0 -1
  269. package/dist/chunk-6M2NL363.js.map +0 -1
  270. package/dist/chunk-6M3QVVOH.js +0 -32
  271. package/dist/chunk-6M3QVVOH.js.map +0 -1
  272. package/dist/chunk-6VKNSO6U.js.map +0 -1
  273. package/dist/chunk-6Y6GWMFF.js +0 -24
  274. package/dist/chunk-6Y6GWMFF.js.map +0 -1
  275. package/dist/chunk-7QXJ4KWQ.js.map +0 -1
  276. package/dist/chunk-ALAMUIGJ.js.map +0 -1
  277. package/dist/chunk-DCJQ2PIX.js.map +0 -1
  278. package/dist/chunk-EKPH4MMD.js +0 -27
  279. package/dist/chunk-EKPH4MMD.js.map +0 -1
  280. package/dist/chunk-FZ2GJ4BJ.js +0 -29
  281. package/dist/chunk-FZ2GJ4BJ.js.map +0 -1
  282. package/dist/chunk-G7O6DAWU.js.map +0 -1
  283. package/dist/chunk-GCB4JUF7.js.map +0 -1
  284. package/dist/chunk-GKQNMLQU.js +0 -7757
  285. package/dist/chunk-GKQNMLQU.js.map +0 -1
  286. package/dist/chunk-GO67AOYK.js +0 -24
  287. package/dist/chunk-GO67AOYK.js.map +0 -1
  288. package/dist/chunk-GPF66TH2.js +0 -24
  289. package/dist/chunk-GPF66TH2.js.map +0 -1
  290. package/dist/chunk-H3JR7MN3.js.map +0 -1
  291. package/dist/chunk-H74QYTN7.js.map +0 -1
  292. package/dist/chunk-HEQL3LPK.js.map +0 -1
  293. package/dist/chunk-HXWGG4K7.js.map +0 -1
  294. package/dist/chunk-I4RRGZGB.js +0 -24
  295. package/dist/chunk-I4RRGZGB.js.map +0 -1
  296. package/dist/chunk-ICSS5ETT.js.map +0 -1
  297. package/dist/chunk-KINMBZHC.js +0 -18
  298. package/dist/chunk-KINMBZHC.js.map +0 -1
  299. package/dist/chunk-LBBM3LKK.js.map +0 -1
  300. package/dist/chunk-LPMPTQYP.js.map +0 -1
  301. package/dist/chunk-M42JTWPR.js +0 -2794
  302. package/dist/chunk-M42JTWPR.js.map +0 -1
  303. package/dist/chunk-MVE5VVMQ.js.map +0 -1
  304. package/dist/chunk-MY3NUJJD.js.map +0 -1
  305. package/dist/chunk-NOZZFJEB.js.map +0 -1
  306. package/dist/chunk-OYJXYJTE.js.map +0 -1
  307. package/dist/chunk-PEZYBKZH.js.map +0 -1
  308. package/dist/chunk-QWWOBAYU.js +0 -26
  309. package/dist/chunk-QWWOBAYU.js.map +0 -1
  310. package/dist/chunk-RQYYYBQG.js +0 -24
  311. package/dist/chunk-RQYYYBQG.js.map +0 -1
  312. package/dist/chunk-T2WWAEKH.js +0 -7591
  313. package/dist/chunk-T2WWAEKH.js.map +0 -1
  314. package/dist/chunk-UWMOTOXA.js.map +0 -1
  315. package/dist/chunk-UZZD4MRJ.js.map +0 -1
  316. package/dist/chunk-V5OLWE7F.js.map +0 -1
  317. package/dist/chunk-VCLMTMSO.js +0 -23
  318. package/dist/chunk-VCLMTMSO.js.map +0 -1
  319. package/dist/chunk-WSDQ2MRG.js.map +0 -1
  320. package/dist/chunk-XDEEOTVK.js.map +0 -1
  321. package/dist/chunk-XQUQSNCA.js.map +0 -1
  322. package/dist/chunk-XVYZO2FG.js +0 -14
  323. package/dist/chunk-XVYZO2FG.js.map +0 -1
  324. package/dist/chunk-ZC4KNEOQ.js.map +0 -1
  325. package/dist/config-6HWSKHEU.js +0 -9
  326. package/dist/config-6TNFPYZF.js +0 -9
  327. package/dist/config-BHLXQ3OL.js +0 -9
  328. package/dist/config-E7UOEWEP.js +0 -9
  329. package/dist/config-IXLFUSMQ.js +0 -9
  330. package/dist/config-J3TM7NIS.js +0 -9
  331. package/dist/config-JXLZ4XEW.js +0 -9
  332. package/dist/config-KQCEMLNZ.js +0 -9
  333. package/dist/config-R3XJ5OW4.js +0 -9
  334. package/dist/config-V7XI5UTG.js +0 -9
  335. package/dist/config-YLIX3ZBT.js +0 -9
  336. package/dist/config-Z5JGDOKE.js +0 -9
  337. package/dist/config-ZCZZAH5W.js +0 -9
  338. package/dist/config-ZZGIWDUC.js +0 -9
  339. package/dist/discord-2PWP2MGX.js +0 -8
  340. package/dist/dropbox-L5DPYGKR.js +0 -8
  341. package/dist/email-HASRFBKC.js +0 -8
  342. package/dist/gcs-P5QMKTPR.js +0 -10
  343. package/dist/gdocs-IF2I35HZ.js +0 -8
  344. package/dist/gdrive-TAETVCKP.js +0 -8
  345. package/dist/github-5E6GSCNZ.js +0 -8
  346. package/dist/github_ci-2DSZI3Y7.js +0 -8
  347. package/dist/gmail-F5VYGKOT.js +0 -8
  348. package/dist/gsheets-BAO54CQ7.js +0 -8
  349. package/dist/gslides-A62CEEMR.js +0 -8
  350. package/dist/langfuse-YKBYRQLU.js +0 -8
  351. package/dist/linear-WJDQ6JDE.js +0 -8
  352. package/dist/mongodb-MK4DVSIK.js +0 -7
  353. package/dist/oci-KZ7XFZ2X.js +0 -10
  354. package/dist/postgres-M2N2APFZ.js +0 -7
  355. package/dist/r2-X4DDNSAZ.js +0 -10
  356. package/dist/redis-NVCXUUIO.js +0 -7
  357. package/dist/s3-HVAL7ZX3.js +0 -8
  358. package/dist/slack-GUQMDGLP.js +0 -8
  359. package/dist/ssh-LY6WYVVD.js +0 -9
  360. package/dist/supabase-H3ZP4Y3W.js +0 -10
  361. package/dist/trello-WR6TEDYD.js +0 -8
  362. /package/dist/{box-4P7DCJH7.js.map → aliyun-TMZRUYCG.js.map} +0 -0
  363. /package/dist/{config-5ZPGISS6.js.map → backblaze-OHW57DLK.js.map} +0 -0
  364. /package/dist/{config-6HWSKHEU.js.map → box-UXTCAFOZ.js.map} +0 -0
  365. /package/dist/{config-6TNFPYZF.js.map → ceph-TNN4I2FT.js.map} +0 -0
  366. /package/dist/{config-BHLXQ3OL.js.map → config-34LHOGLM.js.map} +0 -0
  367. /package/dist/{config-E7UOEWEP.js.map → config-3BBWD5AB.js.map} +0 -0
  368. /package/dist/{config-FNR6LJ5H.js.map → config-3IVQJBNW.js.map} +0 -0
  369. /package/dist/{config-HIZHA5VD.js.map → config-4UDVSUQJ.js.map} +0 -0
  370. /package/dist/{config-HNSDNQZH.js.map → config-CMDBAPDH.js.map} +0 -0
  371. /package/dist/{config-IXLFUSMQ.js.map → config-CVZ2AGCO.js.map} +0 -0
  372. /package/dist/{config-J3TM7NIS.js.map → config-D3RLSPNF.js.map} +0 -0
  373. /package/dist/{config-JXLZ4XEW.js.map → config-DG65OEG3.js.map} +0 -0
  374. /package/dist/{config-KQCEMLNZ.js.map → config-EIHSP5DZ.js.map} +0 -0
  375. /package/dist/{config-MOLWOSRG.js.map → config-EO23EY62.js.map} +0 -0
  376. /package/dist/{config-R3XJ5OW4.js.map → config-GCQK6NJY.js.map} +0 -0
  377. /package/dist/{config-S47UDVRZ.js.map → config-GE4W4ZJC.js.map} +0 -0
  378. /package/dist/{config-UKZ72IDO.js.map → config-GHRUKEQ6.js.map} +0 -0
  379. /package/dist/{config-V7XI5UTG.js.map → config-GVH27UPE.js.map} +0 -0
  380. /package/dist/{config-YLIX3ZBT.js.map → config-HKRMKD76.js.map} +0 -0
  381. /package/dist/{config-Z5JGDOKE.js.map → config-HXVYIXP5.js.map} +0 -0
  382. /package/dist/{config-ZCZZAH5W.js.map → config-IDZMEW73.js.map} +0 -0
  383. /package/dist/{config-ZZGIWDUC.js.map → config-IJJXGLBQ.js.map} +0 -0
  384. /package/dist/{discord-2PWP2MGX.js.map → config-IVY5EQQ2.js.map} +0 -0
  385. /package/dist/{disk-C7TJNU2B.js.map → config-KJOLGVB2.js.map} +0 -0
  386. /package/dist/{dropbox-L5DPYGKR.js.map → config-KMVCVBYN.js.map} +0 -0
  387. /package/dist/{email-HASRFBKC.js.map → config-KYTRXAB2.js.map} +0 -0
  388. /package/dist/{gcs-P5QMKTPR.js.map → config-LHFFXVYI.js.map} +0 -0
  389. /package/dist/{gdocs-IF2I35HZ.js.map → config-NV5WXP64.js.map} +0 -0
  390. /package/dist/{gdrive-TAETVCKP.js.map → config-OT2TQQCN.js.map} +0 -0
  391. /package/dist/{github-5E6GSCNZ.js.map → config-Q45Y46YT.js.map} +0 -0
  392. /package/dist/{github_ci-2DSZI3Y7.js.map → config-QAA646XB.js.map} +0 -0
  393. /package/dist/{gmail-F5VYGKOT.js.map → config-QNMKWJ4M.js.map} +0 -0
  394. /package/dist/{gsheets-BAO54CQ7.js.map → config-QWCY3LBQ.js.map} +0 -0
  395. /package/dist/{gslides-A62CEEMR.js.map → config-VM526IKB.js.map} +0 -0
  396. /package/dist/{langfuse-YKBYRQLU.js.map → config-WDAZFXYD.js.map} +0 -0
  397. /package/dist/{linear-WJDQ6JDE.js.map → config-ZFJYQZCH.js.map} +0 -0
  398. /package/dist/{mongodb-MK4DVSIK.js.map → config-ZV6G2ZEC.js.map} +0 -0
  399. /package/dist/{oci-KZ7XFZ2X.js.map → databricks_volume-HNQ4DJVJ.js.map} +0 -0
  400. /package/dist/{postgres-M2N2APFZ.js.map → digitalocean-6SPR4S7V.js.map} +0 -0
  401. /package/dist/{r2-X4DDNSAZ.js.map → discord-SAV2RBJV.js.map} +0 -0
  402. /package/dist/{redis-NVCXUUIO.js.map → disk-POACMF4G.js.map} +0 -0
  403. /package/dist/{s3-HVAL7ZX3.js.map → dropbox-CQ7MTYX2.js.map} +0 -0
  404. /package/dist/{slack-GUQMDGLP.js.map → email-KBQ7CXS7.js.map} +0 -0
  405. /package/dist/{ssh-LY6WYVVD.js.map → gcs-SMIE4VMT.js.map} +0 -0
  406. /package/dist/{supabase-H3ZP4Y3W.js.map → gdocs-X5Y2SIQX.js.map} +0 -0
  407. /package/dist/{trello-WR6TEDYD.js.map → gdrive-SIQPRIGI.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/resource/disk/disk.ts","../src/commands/builtin/disk/awk.ts","../src/core/disk/stream.ts","../src/core/disk/utils.ts","../src/commands/builtin/disk/base64_cmd.ts","../src/commands/builtin/disk/basename.ts","../src/commands/builtin/disk/cat/cat.ts","../src/core/disk/stat.ts","../src/commands/builtin/disk/cat/cat_feather.ts","../src/commands/builtin/disk/cat/cat_hdf5.ts","../src/commands/builtin/disk/cat/cat_parquet.ts","../src/commands/builtin/disk/cmp.ts","../src/commands/builtin/disk/column.ts","../src/commands/builtin/disk/comm.ts","../src/commands/builtin/disk/cp.ts","../src/core/disk/copy.ts","../src/core/disk/find.ts","../src/commands/builtin/disk/csplit.ts","../src/core/disk/write.ts","../src/commands/builtin/disk/cut/cut.ts","../src/commands/builtin/disk/cut/cut_feather.ts","../src/commands/builtin/disk/cut/cut_hdf5.ts","../src/commands/builtin/disk/cut/cut_parquet.ts","../src/commands/builtin/disk/diff.ts","../src/commands/builtin/disk/dirname.ts","../src/commands/builtin/disk/du.ts","../src/core/disk/du.ts","../src/commands/builtin/disk/expand.ts","../src/commands/builtin/disk/file/file.ts","../src/core/disk/read.ts","../src/commands/builtin/disk/file/file_feather.ts","../src/commands/builtin/disk/file/file_hdf5.ts","../src/commands/builtin/disk/file/file_parquet.ts","../src/commands/builtin/disk/find.ts","../src/commands/builtin/disk/fmt.ts","../src/commands/builtin/disk/fold.ts","../src/commands/builtin/disk/grep/grep.ts","../src/commands/builtin/disk/grep/grep_feather.ts","../src/commands/builtin/disk/grep/grep_hdf5.ts","../src/commands/builtin/disk/grep/grep_parquet.ts","../src/commands/builtin/disk/gunzip.ts","../src/core/disk/unlink.ts","../src/commands/builtin/disk/gzip.ts","../src/commands/builtin/disk/head/head.ts","../src/commands/builtin/disk/head/head_feather.ts","../src/commands/builtin/disk/head/head_hdf5.ts","../src/commands/builtin/disk/head/head_parquet.ts","../src/commands/builtin/disk/iconv.ts","../src/commands/builtin/disk/join.ts","../src/commands/builtin/disk/jq.ts","../src/commands/builtin/disk/ln.ts","../src/core/disk/exists.ts","../src/commands/builtin/disk/look.ts","../src/commands/builtin/disk/ls/ls.ts","../src/core/disk/readdir.ts","../src/commands/builtin/disk/ls/ls_feather.ts","../src/commands/builtin/disk/ls/ls_hdf5.ts","../src/commands/builtin/disk/ls/ls_parquet.ts","../src/commands/builtin/disk/md5.ts","../src/commands/builtin/disk/mkdir.ts","../src/core/disk/mkdir.ts","../src/commands/builtin/disk/mktemp.ts","../src/commands/builtin/disk/mv.ts","../src/core/disk/rename.ts","../src/commands/builtin/disk/nl.ts","../src/commands/builtin/disk/paste.ts","../src/commands/builtin/disk/patch.ts","../src/commands/builtin/disk/readlink.ts","../src/commands/builtin/disk/realpath.ts","../src/commands/builtin/disk/rev.ts","../src/commands/builtin/disk/rg.ts","../src/commands/builtin/disk/rm.ts","../src/core/disk/rmdir.ts","../src/core/disk/rm.ts","../src/commands/builtin/disk/sed.ts","../src/commands/builtin/disk/sha256sum.ts","../src/commands/builtin/disk/shuf.ts","../src/commands/builtin/disk/sort.ts","../src/commands/builtin/disk/split.ts","../src/commands/builtin/disk/stat/stat.ts","../src/commands/builtin/disk/stat/stat_feather.ts","../src/commands/builtin/disk/stat/stat_hdf5.ts","../src/commands/builtin/disk/stat/stat_parquet.ts","../src/commands/builtin/disk/strings.ts","../src/commands/builtin/disk/tac.ts","../src/commands/builtin/disk/tail/tail.ts","../src/commands/builtin/disk/tail/tail_feather.ts","../src/commands/builtin/disk/tail/tail_hdf5.ts","../src/commands/builtin/disk/tail/tail_parquet.ts","../src/commands/builtin/disk/tar.ts","../src/commands/builtin/disk/tee.ts","../src/commands/builtin/disk/touch.ts","../src/commands/builtin/disk/tr.ts","../src/commands/builtin/disk/tree.ts","../src/commands/builtin/disk/tsort.ts","../src/commands/builtin/disk/unexpand.ts","../src/commands/builtin/disk/uniq.ts","../src/commands/builtin/disk/unzip.ts","../src/commands/builtin/disk/wc/wc.ts","../src/commands/builtin/disk/wc/wc_feather.ts","../src/commands/builtin/disk/wc/wc_hdf5.ts","../src/commands/builtin/disk/wc/wc_parquet.ts","../src/commands/builtin/disk/xxd.ts","../src/commands/builtin/disk/zcat.ts","../src/commands/builtin/disk/zgrep.ts","../src/commands/builtin/disk/zip_cmd.ts","../src/commands/builtin/disk/index.ts","../src/core/disk/append.ts","../src/core/disk/create.ts","../src/core/disk/glob.ts","../src/core/disk/truncate.ts","../src/accessor/disk.ts","../src/ops/disk/append.ts","../src/ops/disk/create.ts","../src/ops/disk/mkdir.ts","../src/ops/disk/read.ts","../src/ops/disk/read_feather.ts","../src/ops/disk/read_hdf5.ts","../src/ops/disk/read_parquet.ts","../src/ops/disk/readdir.ts","../src/ops/disk/rename.ts","../src/ops/disk/rmdir.ts","../src/ops/disk/stat.ts","../src/ops/disk/truncate.ts","../src/ops/disk/unlink.ts","../src/ops/disk/write.ts","../src/ops/disk/index.ts","../src/resource/disk/prompt.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { mkdir, readdir, readFile, writeFile } from 'node:fs/promises'\nimport path from 'node:path'\nimport {\n type FileStat,\n type FindOptions,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n} from '@struktoai/mirage-core'\nimport { DISK_COMMANDS } from '../../commands/builtin/disk/index.ts'\nimport { appendBytes as appendCore } from '../../core/disk/append.ts'\nimport { copy as copyCore } from '../../core/disk/copy.ts'\nimport { create as createCore } from '../../core/disk/create.ts'\nimport { du as duCore, duAll as duAllCore } from '../../core/disk/du.ts'\nimport { exists as existsCore } from '../../core/disk/exists.ts'\nimport { find as findCore, type FindOptions as DiskFindOptions } from '../../core/disk/find.ts'\nimport { resolveGlob as globCore } from '../../core/disk/glob.ts'\nimport { mkdir as mkdirCore } from '../../core/disk/mkdir.ts'\nimport { read as readCoreFn } from '../../core/disk/read.ts'\nimport { readdir as readdirCore } from '../../core/disk/readdir.ts'\nimport { rename as renameCore } from '../../core/disk/rename.ts'\nimport { rmR as rmRCore } from '../../core/disk/rm.ts'\nimport { rmdir as rmdirCore } from '../../core/disk/rmdir.ts'\nimport { stat as statCore } from '../../core/disk/stat.ts'\nimport { stream as streamCore } from '../../core/disk/stream.ts'\nimport { truncate as truncateCore } from '../../core/disk/truncate.ts'\nimport { unlink as unlinkCore } from '../../core/disk/unlink.ts'\nimport { writeBytes as writeCore } from '../../core/disk/write.ts'\nimport { DiskAccessor } from '../../accessor/disk.ts'\nimport { DISK_OPS } from '../../ops/disk/index.ts'\nimport { DISK_PROMPT } from './prompt.ts'\n\nexport interface DiskResourceOptions {\n root: string\n}\n\nexport interface DiskResourceState {\n type: string\n needsOverride: boolean\n redactedFields: string[]\n files: Record<string, Uint8Array>\n}\n\nasync function walkFiles(root: string, current: string, out: string[]): Promise<void> {\n const entries = await readdir(current, { withFileTypes: true })\n for (const e of entries) {\n const child = path.join(current, e.name)\n if (e.isDirectory()) {\n await walkFiles(root, child, out)\n } else if (e.isFile()) {\n out.push(child)\n }\n }\n}\n\nexport class DiskResource implements Resource {\n readonly kind = ResourceName.DISK\n readonly isRemote: boolean = false\n readonly indexTtl: number = 60\n readonly prompt = DISK_PROMPT\n readonly root: string\n readonly accessor: DiskAccessor\n readonly index: IndexCacheStore\n readonly opsMap: Record<string, unknown> = {\n read_bytes: readCoreFn,\n write: writeCore,\n readdir: readdirCore,\n stat: statCore,\n unlink: unlinkCore,\n rmdir: rmdirCore,\n copy: copyCore,\n rename: renameCore,\n mkdir: mkdirCore,\n read_stream: streamCore,\n rm_recursive: rmRCore,\n du_total: duCore,\n du_all: duAllCore,\n create: createCore,\n truncate: truncateCore,\n exists: existsCore,\n find_flat: findCore,\n append: appendCore,\n }\n\n constructor(options: DiskResourceOptions) {\n this.root = path.resolve(options.root)\n this.accessor = new DiskAccessor(this.root)\n this.index = new RAMIndexCacheStore({ ttl: this.indexTtl })\n }\n\n async open(): Promise<void> {\n await mkdir(this.root, { recursive: true })\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n ops(): readonly RegisteredOp[] {\n return DISK_OPS\n }\n\n commands(): readonly RegisteredCommand[] {\n return DISK_COMMANDS\n }\n\n streamPath(p: PathSpec): AsyncIterable<Uint8Array> {\n return streamCore(this.accessor, p)\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return readCoreFn(this.accessor, p)\n }\n\n writeFile(p: PathSpec, data: Uint8Array): Promise<void> {\n return writeCore(this.accessor, p, data)\n }\n\n appendFile(p: PathSpec, data: Uint8Array): Promise<void> {\n return appendCore(this.accessor, p, data)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return readdirCore(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return statCore(this.accessor, p)\n }\n\n exists(p: PathSpec): Promise<boolean> {\n return existsCore(this.accessor, p)\n }\n\n mkdir(p: PathSpec, options?: { recursive?: boolean }): Promise<void> {\n return mkdirCore(this.accessor, p, options?.recursive === true)\n }\n\n rmdir(p: PathSpec): Promise<void> {\n return rmdirCore(this.accessor, p)\n }\n\n unlink(p: PathSpec): Promise<void> {\n return unlinkCore(this.accessor, p)\n }\n\n rename(src: PathSpec, dst: PathSpec): Promise<void> {\n return renameCore(this.accessor, src, dst)\n }\n\n truncate(p: PathSpec, length: number): Promise<void> {\n return truncateCore(this.accessor, p, length)\n }\n\n copy(src: PathSpec, dst: PathSpec): Promise<void> {\n return copyCore(this.accessor, src, dst)\n }\n\n rmR(p: PathSpec): Promise<void> {\n return rmRCore(this.accessor, p)\n }\n\n du(p: PathSpec): Promise<number> {\n return duCore(this.accessor, p)\n }\n\n find(p: PathSpec, options: FindOptions = {}): Promise<string[]> {\n return findCore(this.accessor, p, options as DiskFindOptions)\n }\n\n async fingerprint(p: PathSpec): Promise<string | null> {\n try {\n const remote = await statCore(this.accessor, p)\n return remote.modified ?? null\n } catch {\n return null\n }\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective = prefix\n ? paths.map((p) =>\n p.prefix\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return globCore(this.accessor, effective, this.index)\n }\n\n async getState(): Promise<DiskResourceState> {\n await mkdir(this.root, { recursive: true })\n const files: Record<string, Uint8Array> = {}\n const fileList: string[] = []\n await walkFiles(this.root, this.root, fileList)\n for (const full of fileList) {\n const rel = path.relative(this.root, full).split(path.sep).join('/')\n const data = await readFile(full)\n files[rel] = new Uint8Array(data.buffer, data.byteOffset, data.byteLength)\n }\n return {\n type: this.kind,\n needsOverride: false,\n redactedFields: [],\n files,\n }\n }\n\n async loadState(state: DiskResourceState): Promise<void> {\n await mkdir(this.root, { recursive: true })\n for (const [rel, data] of Object.entries(state.files)) {\n const full = path.join(this.root, rel)\n await mkdir(path.dirname(full), { recursive: true })\n await writeFile(full, data)\n }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction escapeRegex(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\nfunction splitFields(line: string, fs: string): string[] {\n if (fs === '') return line.split(/\\s+/).filter((s) => s !== '')\n const re = fs.length === 1 ? new RegExp(escapeRegex(fs)) : new RegExp(fs)\n return line.split(re)\n}\n\nfunction parseProgram(program: string): [string, string] {\n const trimmed = program.trim()\n if (trimmed.startsWith('{')) return ['', trimmed.slice(1).replace(/\\}$/, '')]\n if (trimmed.includes('{')) {\n const idx = trimmed.indexOf('{')\n const condition = trimmed.slice(0, idx).trim()\n const action = trimmed\n .slice(idx + 1)\n .replace(/\\}$/, '')\n .trim()\n return [condition, action]\n }\n return ['', trimmed]\n}\n\nfunction evalCondition(condition: string, fieldMap: Record<string, string>): boolean {\n const cond = condition.trim()\n if (cond === 'BEGIN' || cond === 'END') return false\n const patterns = [\n /(\\$\\d+|NR|NF)\\s*==\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*!=\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*>\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*<\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*>=\\s*(.+)/,\n /(\\$\\d+|NR|NF)\\s*<=\\s*(.+)/,\n ]\n for (const pat of patterns) {\n const m = pat.exec(cond)\n if (m !== null) {\n const lhsKey = m[1] ?? ''\n const rhsRaw = (m[2] ?? '').trim().replace(/^\"|\"$/g, '')\n const lhs = fieldMap[lhsKey] ?? ''\n const opMatch = /(==|!=|>=|<=|>|<)/.exec(cond)\n const op = opMatch !== null ? opMatch[1] : ''\n const lhsNum = Number.parseFloat(lhs)\n const rhsNum = Number.parseFloat(rhsRaw)\n if (!Number.isNaN(lhsNum) && !Number.isNaN(rhsNum)) {\n if (op === '==') return lhsNum === rhsNum\n if (op === '!=') return lhsNum !== rhsNum\n if (op === '>') return lhsNum > rhsNum\n if (op === '<') return lhsNum < rhsNum\n if (op === '>=') return lhsNum >= rhsNum\n if (op === '<=') return lhsNum <= rhsNum\n }\n if (op === '==') return lhs === rhsRaw\n if (op === '!=') return lhs !== rhsRaw\n return false\n }\n }\n if (cond.startsWith('/') && cond.endsWith('/')) {\n return new RegExp(cond.slice(1, -1)).test(fieldMap.$0 ?? '')\n }\n return true\n}\n\nfunction evalAction(action: string, fieldMap: Record<string, string>): string {\n const parts: string[] = []\n for (const rawStmt of action.split(';')) {\n const stmt = rawStmt.trim()\n if (stmt === '') continue\n if (stmt.startsWith('print')) {\n const args = stmt.slice(5).trim()\n if (args === '') {\n parts.push(fieldMap.$0 ?? '')\n } else {\n const tokens = args.split(/,\\s*/)\n const vals: string[] = []\n for (const raw of tokens) {\n const tok = raw.trim().replace(/^\"|\"$/g, '')\n vals.push(fieldMap[tok] ?? tok)\n }\n parts.push(vals.join(' '))\n }\n }\n }\n return parts.join('\\n')\n}\n\nfunction awkEvalLine(\n line: string,\n program: string,\n fs: string,\n variables: Record<string, string>,\n nr: number,\n): string | null {\n const fields = splitFields(line, fs)\n const fieldMap: Record<string, string> = {\n $0: line,\n NR: String(nr),\n NF: String(fields.length),\n }\n for (let i = 0; i < fields.length; i++) fieldMap[`$${String(i + 1)}`] = fields[i] ?? ''\n for (const [k, v] of Object.entries(variables)) fieldMap[k] = v\n const [condition, action] = parseProgram(program)\n if (condition !== '' && !evalCondition(condition, fieldMap)) return null\n if (action === '') return line\n return evalAction(action, fieldMap)\n}\n\nfunction parseBlocks(program: string): [string, string, string] {\n let begin = ''\n let end = ''\n let main = program\n const beginMatch = /^BEGIN\\s*\\{([^}]*)\\}\\s*([\\s\\S]*)/.exec(program)\n if (beginMatch !== null) {\n begin = (beginMatch[1] ?? '').trim()\n main = (beginMatch[2] ?? '').trim()\n }\n const endMatch = /END\\s*\\{([^}]*)\\}\\s*$/.exec(main)\n if (endMatch !== null) {\n end = (endMatch[1] ?? '').trim()\n main = main.slice(0, endMatch.index).trim()\n }\n return [begin, main, end]\n}\n\nfunction evalAccumulator(\n action: string,\n fieldMap: Record<string, string>,\n accum: Record<string, number>,\n): void {\n for (const rawStmt of action.split(';')) {\n const stmt = rawStmt.trim()\n const m = /(\\w+)\\s*\\+=\\s*(.+)/.exec(stmt)\n if (m !== null) {\n const variable = m[1] ?? ''\n const expr = (m[2] ?? '').trim()\n const val = fieldMap[expr] ?? expr\n const n = Number.parseFloat(val)\n if (!Number.isNaN(n)) accum[variable] = (accum[variable] ?? 0) + n\n }\n }\n}\n\nfunction evalEndAction(action: string, accum: Record<string, number>): string {\n const parts: string[] = []\n for (const rawStmt of action.split(';')) {\n const stmt = rawStmt.trim()\n if (!stmt.startsWith('print')) continue\n const args = stmt.slice(5).trim()\n if (args === '') continue\n const tokens = args.split(/,\\s*/)\n const vals: string[] = []\n for (const raw of tokens) {\n const tok = raw.trim().replace(/^\"|\"$/g, '')\n if (tok in accum) {\n const v = accum[tok] ?? 0\n vals.push(Number.isInteger(v) ? String(v) : String(v))\n } else {\n vals.push(tok)\n }\n }\n parts.push(vals.join(' '))\n }\n return parts.join('\\n')\n}\n\nasync function* awkStream(\n source: AsyncIterable<Uint8Array>,\n program: string,\n fs: string,\n variables: Record<string, string>,\n): AsyncIterable<Uint8Array> {\n const [, main, end] = parseBlocks(program)\n const accum: Record<string, number> = {}\n let nr = 0\n const iter = new AsyncLineIterator(source)\n for await (const lineBytes of iter) {\n nr += 1\n const line = DEC.decode(lineBytes)\n if (main !== '') {\n const fields = splitFields(line, fs)\n const fieldMap: Record<string, string> = {\n $0: line,\n NR: String(nr),\n NF: String(fields.length),\n }\n for (let i = 0; i < fields.length; i++) fieldMap[`$${String(i + 1)}`] = fields[i] ?? ''\n const [condition, action] = parseProgram(main)\n if (condition !== '' && !evalCondition(condition, fieldMap)) continue\n evalAccumulator(action, fieldMap, accum)\n const result = awkEvalLine(line, main, fs, variables, nr)\n if (result !== null && result !== '') yield ENC.encode(result + '\\n')\n }\n }\n if (end !== '') {\n const result = evalEndAction(end, accum)\n if (result !== '') yield ENC.encode(result + '\\n')\n }\n}\n\nfunction stripMount(virtualPath: string, prefix: string): string {\n if (prefix !== '' && virtualPath.startsWith(prefix + '/')) {\n return '/' + virtualPath.slice(prefix.length).replace(/^\\/+/, '')\n }\n return virtualPath\n}\n\nasync function readFile(accessor: DiskAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(diskStream(accessor, p))\n}\n\nasync function awkCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const fFlag = typeof opts.flags.f === 'string' ? opts.flags.f : null\n let program: string\n let dataPaths: string[]\n if (fFlag !== null) {\n const programPath = fFlag\n const mountPrefix = paths[0]?.prefix ?? opts.mountPrefix ?? ''\n const programSpec = PathSpec.fromStrPath(programPath, mountPrefix)\n try {\n program = DEC.decode(await readFile(accessor, programSpec)).trim()\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n dataPaths = [\n ...texts.map((t) => stripMount(t, mountPrefix)),\n ...paths.map((p) => p.stripPrefix),\n ]\n } else if (texts.length > 0 && texts[0] !== undefined) {\n program = texts[0]\n dataPaths = paths.map((p) => p.stripPrefix)\n } else {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`awk: usage: awk [-F fs] [-v var=val] 'program' [file ...]\\n`),\n }),\n ]\n }\n const fs = typeof opts.flags.F === 'string' ? opts.flags.F : ' '\n const variables: Record<string, string> = {}\n if (typeof opts.flags.v === 'string' && opts.flags.v.includes('=')) {\n const [key, val] = opts.flags.v.split('=', 2)\n if (key !== undefined && val !== undefined) variables[key] = val\n }\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (dataPaths.length > 0) {\n const firstPath = dataPaths[0]\n if (firstPath === undefined) return [null, new IOResult()]\n const spec = PathSpec.fromStrPath(firstPath)\n source = diskStream(accessor, spec)\n cache.push(firstPath)\n } else {\n try {\n source = resolveSource(opts.stdin, 'awk: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n return [awkStream(source, program, fs, variables), new IOResult({ cache })]\n}\n\nexport const DISK_AWK = command({\n name: 'awk',\n resource: ResourceName.DISK,\n spec: specOf('awk'),\n fn: awkCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { createReadStream } from 'node:fs'\nimport { type PathSpec, recordStream, ResourceName } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function* stream(accessor: DiskAccessor, path: PathSpec): AsyncIterable<Uint8Array> {\n const virtual = path.stripPrefix\n const full = resolveSafe(accessor.root, virtual)\n const rec = recordStream('read', virtual, ResourceName.DISK)\n const rs = createReadStream(full, { highWaterMark: 65536 })\n try {\n for await (const chunk of rs) {\n const buf = chunk as Buffer\n const u8 = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength)\n if (rec !== null) rec.bytes += u8.byteLength\n yield u8\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n throw new Error(`file not found: ${virtual}`)\n }\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport path from 'node:path'\n\nexport function resolveSafe(root: string, virtual: string): string {\n const relative = virtual.replace(/^\\/+/, '')\n const resolved = path.resolve(root, relative)\n const rootResolved = path.resolve(root)\n if (resolved !== rootResolved && !resolved.startsWith(rootResolved + path.sep)) {\n throw new Error(`path escapes root: ${virtual}`)\n }\n return resolved\n}\n\nexport function norm(p: string): string {\n return `/${p.replace(/^\\/+|\\/+$/g, '')}`\n}\n\nexport function parent(p: string): string {\n const i = p.lastIndexOf('/')\n if (i <= 0) return '/'\n return p.slice(0, i)\n}\n\nexport function basename(p: string): string {\n const tail = p.split('/').pop()\n return tail !== undefined && tail.length > 0 ? tail : '/'\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n decodeBase64,\n encodeBase64,\n materialize,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function* base64EncodeStream(\n source: AsyncIterable<Uint8Array>,\n wrap: number | null,\n): AsyncIterable<Uint8Array> {\n const buf = await materialize(source)\n const encoded = encodeBase64(buf)\n if (wrap !== null && wrap === 0) {\n yield ENC.encode(encoded + '\\n')\n return\n }\n const lineLen = wrap ?? 76\n const lines: string[] = []\n for (let i = 0; i < encoded.length; i += lineLen) {\n lines.push(encoded.slice(i, i + lineLen))\n }\n yield ENC.encode(lines.join('\\n') + '\\n')\n}\n\nasync function* base64DecodeStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n const buf = await materialize(source)\n const text = DEC.decode(buf).replace(/[\\r\\n ]/g, '')\n yield decodeBase64(text)\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function base64Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const decode = opts.flags.d === true || opts.flags.D === true\n const wrap = typeof opts.flags.w === 'string' ? Number.parseInt(opts.flags.w, 10) : null\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = diskStream(accessor, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'base64: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const out = decode ? base64DecodeStream(source) : base64EncodeStream(source, wrap)\n return [out, new IOResult({ cache })]\n}\n\nexport const RAM_BASE64 = command({\n name: 'base64',\n resource: ResourceName.DISK,\n spec: specOf('base64'),\n fn: base64Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nfunction basenameCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n _opts: CommandOpts,\n): CommandFnResult {\n const arg = texts[0] ?? paths[0]?.original ?? ''\n const stripped = arg.replace(/\\/+$/, '')\n const idx = stripped.lastIndexOf('/')\n const base = idx >= 0 ? stripped.slice(idx + 1) : stripped\n const out: ByteSource = new TextEncoder().encode(`${base}\\n`)\n return [out, new IOResult()]\n}\n\nexport const DISK_BASENAME = command({\n name: 'basename',\n resource: ResourceName.DISK,\n spec: specOf('basename'),\n fn: basenameCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n CachableAsyncIterator,\n IOResult,\n ProvisionResult,\n ResourceName,\n command,\n concatAggregate,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport { stat as diskStat } from '../../../../core/disk/stat.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function* numberLinesStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n let num = 1\n const lineIter = new AsyncLineIterator(source)\n for await (const line of lineIter) {\n yield ENC.encode(` ${String(num)}\\t`)\n yield line\n yield ENC.encode('\\n')\n num += 1\n }\n}\n\nexport async function catProvision(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n const [first] = paths\n if (first === undefined) return new ProvisionResult({ command: 'cat' })\n try {\n const s = await diskStat(accessor, first)\n return new ProvisionResult({\n command: `cat ${first.original}`,\n networkReadLow: s.size ?? 0,\n networkReadHigh: s.size ?? 0,\n readOps: 1,\n })\n } catch {\n return new ProvisionResult({ command: 'cat' })\n }\n}\n\nasync function* chainStreams(\n streams: readonly AsyncIterable<Uint8Array>[],\n): AsyncIterable<Uint8Array> {\n for (const s of streams) {\n for await (const chunk of s) yield chunk\n }\n}\n\nasync function catCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nFlag = opts.flags.n === true\n if (paths.length > 0) {\n for (const p of paths) await diskStat(accessor, p)\n const reads: Record<string, ByteSource> = {}\n const cacheKeys: string[] = []\n const outputs: AsyncIterable<Uint8Array>[] = []\n for (const p of paths) {\n const cachable = new CachableAsyncIterator(diskStream(accessor, p))\n reads[p.stripPrefix] = cachable\n cacheKeys.push(p.stripPrefix)\n outputs.push(cachable)\n }\n const merged = chainStreams(outputs)\n const out: ByteSource = nFlag ? numberLinesStream(merged) : merged\n return [out, new IOResult({ reads, cache: cacheKeys })]\n }\n try {\n const source = resolveSource(opts.stdin, 'cat: missing operand')\n const out: ByteSource = nFlag ? numberLinesStream(source) : source\n return [out, new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const DISK_CAT = command({\n name: 'cat',\n resource: ResourceName.DISK,\n spec: specOf('cat'),\n fn: catCommand,\n provision: catProvision,\n aggregate: concatAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { stat as fsStat } from 'node:fs/promises'\nimport path from 'node:path'\nimport { FileStat, FileType, guessType, type PathSpec } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function stat(accessor: DiskAccessor, p: PathSpec): Promise<FileStat> {\n const virtual = p.stripPrefix\n const full = resolveSafe(accessor.root, virtual)\n let st\n try {\n st = await fsStat(full)\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n throw new Error(`file not found: ${virtual}`)\n }\n throw err\n }\n const modified = st.mtime.toISOString()\n const name = path.basename(full)\n if (st.isDirectory()) {\n return new FileStat({\n name,\n size: null,\n modified,\n type: FileType.DIRECTORY,\n })\n }\n return new FileStat({\n name,\n size: st.size,\n modified,\n fingerprint: modified,\n type: guessType(name),\n })\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n featherCat,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catFeatherCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = featherCat(raw)\n const out: ByteSource = result\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_CAT_FEATHER = command({\n name: 'cat',\n resource: ResourceName.DISK,\n spec: specOf('cat'),\n filetype: '.feather',\n fn: catFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n hdf5Cat,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catHdf5Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await hdf5Cat(raw)\n const out: ByteSource = result\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_CAT_HDF5 = command({\n name: 'cat',\n resource: ResourceName.DISK,\n spec: specOf('cat'),\n filetype: '.h5',\n fn: catHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n parquetCat,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function catParquetCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await parquetCat(raw)\n const out: ByteSource = result\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cat: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_CAT_PARQUET = command({\n name: 'cat',\n resource: ResourceName.DISK,\n spec: specOf('cat'),\n filetype: '.parquet',\n fn: catParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nfunction octal(n: number): string {\n return '0o' + n.toString(8)\n}\n\nfunction arraysEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.byteLength !== b.byteLength) return false\n for (let i = 0; i < a.byteLength; i++) if (a[i] !== b[i]) return false\n return true\n}\n\nasync function cmpCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode('cmp: requires two paths\\n') })]\n }\n const p0 = paths[0]\n const p1 = paths[1]\n if (p0 === undefined || p1 === undefined) return [null, new IOResult()]\n let data1 = await materialize(diskStream(accessor, p0))\n let data2 = await materialize(diskStream(accessor, p1))\n if (typeof opts.flags.i === 'string') {\n const skip = Number.parseInt(opts.flags.i, 10)\n data1 = data1.slice(skip)\n data2 = data2.slice(skip)\n }\n if (typeof opts.flags.n === 'string') {\n const limit = Number.parseInt(opts.flags.n, 10)\n data1 = data1.slice(0, limit)\n data2 = data2.slice(0, limit)\n }\n if (arraysEqual(data1, data2)) return [null, new IOResult()]\n if (opts.flags.s === true) return [null, new IOResult({ exitCode: 1 })]\n if (opts.flags.args_l === true) {\n const outLines: string[] = []\n const limit = Math.min(data1.byteLength, data2.byteLength)\n for (let idx = 0; idx < limit; idx++) {\n if (data1[idx] !== data2[idx]) {\n outLines.push(`${String(idx + 1)} ${octal(data1[idx] ?? 0)} ${octal(data2[idx] ?? 0)}`)\n }\n }\n const out: ByteSource = ENC.encode(outLines.join('\\n'))\n return [out, new IOResult({ exitCode: 1 })]\n }\n const limit = Math.min(data1.byteLength, data2.byteLength)\n for (let idx = 0; idx < limit; idx++) {\n if (data1[idx] !== data2[idx]) {\n let line = 1\n for (let k = 0; k < idx; k++) if (data1[k] === 0x0a) line += 1\n let msg = `${p0.original} ${p1.original} differ: byte ${String(idx + 1)}, line ${String(line)}`\n if (opts.flags.b === true) {\n msg += ` is ${octal(data1[idx] ?? 0)} ${String.fromCharCode(data1[idx] ?? 0)} ${octal(data2[idx] ?? 0)} ${String.fromCharCode(data2[idx] ?? 0)}`\n }\n return [ENC.encode(msg), new IOResult({ exitCode: 1 })]\n }\n }\n const shorter = data1.byteLength < data2.byteLength ? p0 : p1\n return [ENC.encode(`cmp: EOF on ${shorter.original}`), new IOResult({ exitCode: 1 })]\n}\n\nexport const DISK_CMP = command({\n name: 'cmp',\n resource: ResourceName.DISK,\n spec: specOf('cmp'),\n fn: cmpCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction padRight(s: string, width: number): string {\n if (s.length >= width) return s\n return s + ' '.repeat(width - s.length)\n}\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction tableFormat(text: string, separator: string | null, outputSep: string): string {\n const lines = splitLinesNoTrailing(text)\n if (lines.length === 0) return ''\n const rows: string[][] = []\n for (const line of lines) {\n if (separator !== null && separator !== '') {\n rows.push(line.split(separator))\n } else {\n rows.push(line.split(/\\s+/).filter((s) => s !== ''))\n }\n }\n if (rows.length === 0) return ''\n let maxCols = 0\n for (const r of rows) {\n if (r.length > maxCols) maxCols = r.length\n }\n const widths = new Array(maxCols).fill(0) as number[]\n for (const row of rows) {\n for (let idx = 0; idx < row.length; idx++) {\n const cell = row[idx] ?? ''\n if (cell.length > (widths[idx] ?? 0)) widths[idx] = cell.length\n }\n }\n const out: string[] = []\n for (const row of rows) {\n const parts: string[] = []\n for (let idx = 0; idx < row.length; idx++) {\n const cell = row[idx] ?? ''\n if (idx < row.length - 1) parts.push(padRight(cell, widths[idx] ?? 0))\n else parts.push(cell)\n }\n out.push(parts.join(outputSep))\n }\n return out.join('\\n') + '\\n'\n}\n\nasync function columnCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tMode = opts.flags.t === true\n const sFlag = typeof opts.flags.s === 'string' ? opts.flags.s : null\n const oFlag = typeof opts.flags.o === 'string' ? opts.flags.o : ' '\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(diskStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('column: missing input\\n') })]\n }\n raw = stdinData\n }\n const text = DEC.decode(raw)\n const output = tMode ? tableFormat(text, sFlag, oFlag) : text\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult()]\n}\n\nexport const DISK_COLUMN = command({\n name: 'column',\n resource: ResourceName.DISK,\n spec: specOf('column'),\n fn: columnCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\ntype MergeEntry = [number, string]\n\nfunction commMerge(lines1: readonly string[], lines2: readonly string[]): MergeEntry[] {\n const result: MergeEntry[] = []\n let i = 0\n let j = 0\n while (i < lines1.length && j < lines2.length) {\n const a = lines1[i] ?? ''\n const b = lines2[j] ?? ''\n if (a < b) {\n result.push([1, a])\n i += 1\n } else if (a > b) {\n result.push([2, b])\n j += 1\n } else {\n result.push([3, a])\n i += 1\n j += 1\n }\n }\n while (i < lines1.length) {\n result.push([1, lines1[i] ?? ''])\n i += 1\n }\n while (j < lines2.length) {\n result.push([2, lines2[j] ?? ''])\n j += 1\n }\n return result\n}\n\nfunction formatComm(\n merged: readonly MergeEntry[],\n suppress1: boolean,\n suppress2: boolean,\n suppress3: boolean,\n): string {\n const out: string[] = []\n for (const [col, text] of merged) {\n if (col === 1 && !suppress1) {\n out.push(text)\n } else if (col === 2 && !suppress2) {\n const prefix = suppress1 ? '' : '\\t'\n out.push(prefix + text)\n } else if (col === 3 && !suppress3) {\n let prefix = ''\n if (!suppress1) prefix += '\\t'\n if (!suppress2) prefix += '\\t'\n out.push(prefix + text)\n }\n }\n return out.length > 0 ? out.join('\\n') + '\\n' : ''\n}\n\nfunction isSorted(lines: readonly string[]): boolean {\n for (let i = 1; i < lines.length; i++) {\n if ((lines[i - 1] ?? '') > (lines[i] ?? '')) return false\n }\n return true\n}\n\nasync function commCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('comm: requires two paths\\n') })]\n }\n const p1 = paths[0]\n const p2 = paths[1]\n if (p1 === undefined || p2 === undefined) return [null, new IOResult()]\n const data1 = DEC.decode(await materialize(diskStream(accessor, p1)))\n const data2 = DEC.decode(await materialize(diskStream(accessor, p2)))\n const lines1 = splitLinesNoTrailing(data1)\n const lines2 = splitLinesNoTrailing(data2)\n let stderr = ''\n if (opts.flags['check-order'] === true) {\n if (!isSorted(lines1)) stderr = 'comm: file 1 is not in sorted order\\n'\n else if (!isSorted(lines2)) stderr = 'comm: file 2 is not in sorted order\\n'\n }\n const suppress1 = opts.flags['1'] === true\n const suppress2 = opts.flags['2'] === true\n const suppress3 = opts.flags['3'] === true\n const merged = commMerge(lines1, lines2)\n const output = formatComm(merged, suppress1, suppress2, suppress3)\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult({ stderr: stderr !== '' ? ENC.encode(stderr) : null })]\n}\n\nexport const DISK_COMM = command({\n name: 'comm',\n resource: ResourceName.DISK,\n spec: specOf('comm'),\n fn: commCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { copy as diskCopy } from '../../../core/disk/copy.ts'\nimport { find as diskFind } from '../../../core/disk/find.ts'\nimport { stat as diskStat } from '../../../core/disk/stat.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nasync function exists(accessor: DiskAccessor, path: PathSpec): Promise<boolean> {\n try {\n await diskStat(accessor, path)\n return true\n } catch {\n return false\n }\n}\n\nfunction toPathSpec(strPath: string, prefix: string): PathSpec {\n return new PathSpec({\n original: strPath,\n directory: strPath,\n resolved: false,\n prefix,\n })\n}\n\nasync function cpCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('cp: missing operand\\n'),\n }),\n ]\n }\n const recursive = opts.flags.r === true || opts.flags.R === true || opts.flags.a === true\n const noClobber = opts.flags.n === true\n const verbose = opts.flags.v === true\n const dst = paths[paths.length - 1]\n if (dst === undefined) return [null, new IOResult()]\n const lines: string[] = []\n\n if (recursive) {\n const src = paths[0]\n if (src === undefined) return [null, new IOResult()]\n const srcBase = src.stripPrefix.replace(/\\/+$/, '')\n const dstBase = dst.stripPrefix.replace(/\\/+$/, '')\n const entries = await diskFind(accessor, src, { type: 'f' })\n for (const entry of entries) {\n const rel = entry.slice(srcBase.length)\n const dstPath = dstBase + rel\n const dstSpec = toPathSpec(dstPath, dst.prefix)\n if (noClobber && (await exists(accessor, dstSpec))) continue\n const srcSpec = toPathSpec(entry, src.prefix)\n await diskCopy(accessor, srcSpec, dstSpec)\n if (verbose) lines.push(`${entry} -> ${dstPath}`)\n }\n const out = lines.length > 0 ? new TextEncoder().encode(lines.join('\\n') + '\\n') : null\n return [out, new IOResult()]\n }\n\n const sources = paths.slice(0, -1)\n for (const src of sources) {\n if (noClobber && (await exists(accessor, dst))) continue\n await diskCopy(accessor, src, dst)\n if (verbose) lines.push(`${src.original} -> ${dst.original}`)\n }\n const out = lines.length > 0 ? new TextEncoder().encode(lines.join('\\n') + '\\n') : null\n return [out, new IOResult()]\n}\n\nexport const DISK_CP = command({\n name: 'cp',\n resource: ResourceName.DISK,\n spec: specOf('cp'),\n fn: cpCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { copyFile, mkdir } from 'node:fs/promises'\nimport path from 'node:path'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function copy(accessor: DiskAccessor, src: PathSpec, dst: PathSpec): Promise<void> {\n const s = resolveSafe(accessor.root, src.stripPrefix)\n const d = resolveSafe(accessor.root, dst.stripPrefix)\n await mkdir(path.dirname(d), { recursive: true })\n try {\n await copyFile(s, d)\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n throw new Error(`file not found: ${src.stripPrefix}`)\n }\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { readdir, stat } from 'node:fs/promises'\nimport path from 'node:path'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { norm, resolveSafe } from './utils.ts'\n\nexport interface FindOptions {\n name?: string | null\n type?: 'f' | 'd' | null\n minSize?: number | null\n maxSize?: number | null\n maxDepth?: number | null\n minDepth?: number | null\n nameExclude?: string | null\n orNames?: string[] | null\n iname?: string | null\n pathPattern?: string | null\n mtimeMin?: number | null\n mtimeMax?: number | null\n}\n\nfunction fnmatch(name: string, pattern: string): boolean {\n let re = '^'\n for (const ch of pattern) {\n if (ch === '*') re += '.*'\n else if (ch === '?') re += '.'\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += '\\\\' + ch\n else re += ch\n }\n re += '$'\n return new RegExp(re).test(name)\n}\n\ninterface WalkCtx {\n accessor: DiskAccessor\n base: string\n baseDepth: number\n options: FindOptions\n results: string[]\n}\n\nasync function walk(ctx: WalkCtx, full: string, current: string, depth: number): Promise<void> {\n const opts = ctx.options\n if (opts.maxDepth !== null && opts.maxDepth !== undefined && depth > opts.maxDepth) return\n let entries\n try {\n entries = await readdir(full, { withFileTypes: true })\n } catch {\n return\n }\n for (const e of entries) {\n const kind: 'f' | 'd' = e.isDirectory() ? 'd' : 'f'\n if (opts.type === 'f' && kind !== 'f') {\n const childPath = current === '/' ? `/${e.name}` : `${current}/${e.name}`\n await walk(ctx, path.join(full, e.name), childPath, depth + 1)\n continue\n }\n if (opts.type === 'd' && kind !== 'd') continue\n const entryPath = current === '/' ? `/${e.name}` : `${current}/${e.name}`\n const entryName = e.name\n const entrySlashCount = (entryPath.match(/\\//g) ?? []).length\n const entryDepth = entrySlashCount - ctx.baseDepth\n\n let accept = true\n if (opts.orNames !== null && opts.orNames !== undefined && opts.orNames.length > 0) {\n if (!opts.orNames.some((pat) => fnmatch(entryName, pat))) accept = false\n } else if (opts.name !== null && opts.name !== undefined) {\n if (!fnmatch(entryName, opts.name)) accept = false\n }\n if (\n accept &&\n opts.iname !== null &&\n opts.iname !== undefined &&\n !fnmatch(entryName.toLowerCase(), opts.iname.toLowerCase())\n ) {\n accept = false\n }\n if (\n accept &&\n opts.pathPattern !== null &&\n opts.pathPattern !== undefined &&\n !fnmatch(entryPath, opts.pathPattern)\n ) {\n accept = false\n }\n if (\n accept &&\n opts.nameExclude !== null &&\n opts.nameExclude !== undefined &&\n fnmatch(entryName, opts.nameExclude)\n ) {\n accept = false\n }\n if (\n accept &&\n opts.maxDepth !== null &&\n opts.maxDepth !== undefined &&\n entryDepth > opts.maxDepth\n ) {\n accept = false\n }\n if (\n accept &&\n opts.minDepth !== null &&\n opts.minDepth !== undefined &&\n entryDepth < opts.minDepth\n ) {\n accept = false\n }\n\n if (\n accept &&\n kind === 'f' &&\n (opts.minSize !== null ||\n opts.maxSize !== null ||\n opts.mtimeMin !== null ||\n opts.mtimeMax !== null)\n ) {\n try {\n const st = await stat(path.join(full, e.name))\n if (opts.minSize !== null && opts.minSize !== undefined && st.size < opts.minSize)\n accept = false\n if (opts.maxSize !== null && opts.maxSize !== undefined && st.size > opts.maxSize)\n accept = false\n if (accept && (opts.mtimeMin !== undefined || opts.mtimeMax !== undefined)) {\n const mtime = st.mtime.getTime() / 1000\n if (opts.mtimeMin !== null && opts.mtimeMin !== undefined && mtime < opts.mtimeMin)\n accept = false\n if (opts.mtimeMax !== null && opts.mtimeMax !== undefined && mtime > opts.mtimeMax)\n accept = false\n }\n } catch {\n accept = false\n }\n }\n\n if (accept) ctx.results.push(entryPath)\n\n if (kind === 'd') {\n await walk(ctx, path.join(full, e.name), entryPath, depth + 1)\n }\n }\n}\n\nexport async function find(\n accessor: DiskAccessor,\n p: PathSpec,\n options: FindOptions = {},\n): Promise<string[]> {\n const virtual = norm(p.stripPrefix)\n const full = resolveSafe(accessor.root, virtual)\n const baseDepth = (virtual.match(/\\//g) ?? []).length\n const results: string[] = []\n await walk({ accessor, base: virtual, baseDepth, options, results }, full, virtual, 0)\n results.sort()\n return results\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction splitByPatterns(lines: readonly string[], patterns: readonly string[]): string[][] {\n const parts: string[][] = []\n let currentStart = 0\n for (const pat of patterns) {\n if (pat.startsWith('/') && pat.endsWith('/')) {\n const regex = new RegExp(pat.slice(1, -1))\n for (let idx = currentStart; idx < lines.length; idx++) {\n if (regex.test(lines[idx] ?? '')) {\n parts.push(lines.slice(currentStart, idx))\n currentStart = idx\n break\n }\n }\n } else {\n const lineNum = Number.parseInt(pat, 10)\n const splitAt = lineNum - 1\n if (splitAt > currentStart) {\n parts.push(lines.slice(currentStart, splitAt))\n currentStart = splitAt\n }\n }\n }\n if (currentStart < lines.length) {\n parts.push(lines.slice(currentStart))\n }\n return parts\n}\n\nfunction padNum(n: number, digits: number): string {\n const s = String(n)\n return s.length >= digits ? s : '0'.repeat(digits - s.length) + s\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function writePart(\n accessor: DiskAccessor,\n filename: string,\n data: Uint8Array,\n writes: Record<string, Uint8Array>,\n): Promise<void> {\n await diskWrite(accessor, makePathSpec(filename), data)\n writes[filename] = data\n}\n\nasync function csplitCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const prefix = typeof opts.flags.f === 'string' ? opts.flags.f : 'xx'\n const digits = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 2\n const quiet = opts.flags.s === true\n const keep = opts.flags.k === true\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(diskStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('csplit: missing input\\n') })]\n }\n raw = stdinData\n }\n const text = DEC.decode(raw)\n const lines = splitLinesNoTrailing(text)\n const parts = splitByPatterns(lines, texts)\n const writes: Record<string, Uint8Array> = {}\n const sizes: string[] = []\n try {\n for (let idx = 0; idx < parts.length; idx++) {\n const part = parts[idx] ?? []\n const filename = prefix + padNum(idx, digits)\n const data = part.length > 0 ? ENC.encode(part.join('\\n') + '\\n') : new Uint8Array(0)\n await writePart(accessor, filename, data, writes)\n sizes.push(String(data.byteLength))\n }\n } catch (err) {\n if (!keep) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`csplit: ${msg}\\n`) })]\n }\n }\n const output = quiet ? '' : sizes.join('\\n') + '\\n'\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult({ writes })]\n}\n\nexport const DISK_CSPLIT = command({\n name: 'csplit',\n resource: ResourceName.DISK,\n spec: specOf('csplit'),\n fn: csplitCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { mkdir, writeFile } from 'node:fs/promises'\nimport path from 'node:path'\nimport { type PathSpec, record, ResourceName } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function writeBytes(\n accessor: DiskAccessor,\n p: PathSpec,\n data: Uint8Array,\n): Promise<void> {\n const start = performance.now()\n const virtual = p.stripPrefix\n const full = resolveSafe(accessor.root, virtual)\n await mkdir(path.dirname(full), { recursive: true })\n await writeFile(full, data)\n record('write', virtual, ResourceName.DISK, data.byteLength, start)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction parseRangeSpec(spec: string): number[] {\n const out: number[] = []\n for (const part of spec.split(',')) {\n if (part.includes('-')) {\n const [loStr, hiStr] = part.split('-', 2) as [string, string]\n const lo = Number.parseInt(loStr, 10)\n const hi = Number.parseInt(hiStr, 10)\n for (let i = lo; i <= hi; i++) out.push(i)\n } else {\n out.push(Number.parseInt(part, 10))\n }\n }\n return out\n}\n\nfunction parseCharRanges(spec: string): [number, number][] {\n const ranges: [number, number][] = []\n for (const part of spec.split(',')) {\n if (part.includes('-')) {\n const [loStr, hiStr] = part.split('-', 2) as [string, string]\n ranges.push([Number.parseInt(loStr, 10), Number.parseInt(hiStr, 10)])\n } else {\n const val = Number.parseInt(part, 10)\n ranges.push([val, val])\n }\n }\n return ranges\n}\n\nasync function* cutStream(\n source: AsyncIterable<Uint8Array>,\n delimiter: string,\n fields: number[] | null,\n chars: [number, number][] | null,\n complement: boolean,\n zeroTerminated: boolean,\n): AsyncIterable<Uint8Array> {\n const raw = await materialize(source)\n const sep = zeroTerminated ? 0 : 0x0a\n const sepStr = zeroTerminated ? '\\x00' : '\\n'\n // Split raw bytes on sep, drop trailing empty record if present\n const records: Uint8Array[] = []\n let start = 0\n for (let i = 0; i < raw.byteLength; i++) {\n if (raw[i] === sep) {\n records.push(raw.subarray(start, i))\n start = i + 1\n }\n }\n if (start < raw.byteLength) {\n records.push(raw.subarray(start))\n }\n for (const rec of records) {\n const line = DEC.decode(rec)\n if (chars !== null) {\n if (complement) {\n const selectedIndices = new Set<number>()\n for (const [s, e] of chars) {\n for (let i = s - 1; i < e; i++) selectedIndices.add(i)\n }\n const parts: string[] = []\n for (let i = 0; i < line.length; i++) {\n if (!selectedIndices.has(i)) {\n const ch = line.charAt(i)\n if (ch !== '') parts.push(ch)\n }\n }\n yield ENC.encode(parts.join('') + sepStr)\n } else {\n const parts: string[] = []\n for (const [s, e] of chars) {\n parts.push(line.slice(s - 1, e))\n }\n yield ENC.encode(parts.join('') + sepStr)\n }\n } else if (fields !== null && fields.length > 0) {\n const partsF = line.split(delimiter)\n let selected: string[]\n if (complement) {\n const fieldSet = new Set(fields)\n selected = partsF.filter((_, i) => !fieldSet.has(i + 1))\n } else {\n selected = []\n for (const f of fields) {\n const part = partsF[f - 1]\n if (part !== undefined) selected.push(part)\n }\n }\n yield ENC.encode(selected.join(delimiter) + sepStr)\n } else {\n const out = new Uint8Array(rec.byteLength + 1)\n out.set(rec, 0)\n out[rec.byteLength] = sep\n yield out\n }\n }\n}\n\nfunction cutCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): CommandFnResult {\n const f = typeof opts.flags.f === 'string' ? opts.flags.f : null\n const d = typeof opts.flags.d === 'string' ? opts.flags.d : null\n const c = typeof opts.flags.c === 'string' ? opts.flags.c : null\n const complement = opts.flags.complement === true\n const z = opts.flags.z === true\n const fields = f !== null ? parseRangeSpec(f) : null\n const chars = c !== null ? parseCharRanges(c) : null\n const delim = d ?? '\\t'\n\n let source: AsyncIterable<Uint8Array>\n const cache: string[] = []\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = diskStream(accessor, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'cut: missing operand')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const out: ByteSource = cutStream(source, delim, fields, chars, complement, z)\n return [out, new IOResult({ cache })]\n}\n\nexport const DISK_CUT = command({\n name: 'cut',\n resource: ResourceName.DISK,\n spec: specOf('cut'),\n fn: cutCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherCut,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function cutFeatherCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const fSpec = typeof opts.flags.f === 'string' ? opts.flags.f : ''\n const columns = fSpec.split(',').filter((c) => c.length > 0)\n if (columns.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: -f required\\n') })]\n }\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = featherCut(raw, columns)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cut: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_CUT_FEATHER = command({\n name: 'cut',\n resource: ResourceName.DISK,\n spec: specOf('cut'),\n filetype: '.feather',\n fn: cutFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Cut,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function cutHdf5Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const fSpec = typeof opts.flags.f === 'string' ? opts.flags.f : ''\n const columns = fSpec.split(',').filter((c) => c.length > 0)\n if (columns.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: -f required\\n') })]\n }\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await hdf5Cut(raw, columns)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cut: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_CUT_HDF5 = command({\n name: 'cut',\n resource: ResourceName.DISK,\n spec: specOf('cut'),\n filetype: '.h5',\n fn: cutHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetCut,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function cutParquetCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const fSpec = typeof opts.flags.f === 'string' ? opts.flags.f : ''\n const columns = fSpec.split(',').filter((c) => c.length > 0)\n if (columns.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('cut: -f required\\n') })]\n }\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await parquetCut(raw, columns)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`cut: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_CUT_PARQUET = command({\n name: 'cut',\n resource: ResourceName.DISK,\n spec: specOf('cut'),\n filetype: '.parquet',\n fn: cutParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n edScript,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n unifiedDiff,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ninterface DiffFlags {\n i: boolean\n w: boolean\n b: boolean\n e: boolean\n q: boolean\n}\n\nfunction splitLinesKeepEnds(text: string): string[] {\n const lines: string[] = []\n let start = 0\n for (let i = 0; i < text.length; i++) {\n if (text[i] === '\\n') {\n lines.push(text.slice(start, i + 1))\n start = i + 1\n }\n }\n if (start < text.length) lines.push(text.slice(start))\n return lines\n}\n\nasync function readFile(accessor: DiskAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(diskStream(accessor, p))\n}\n\nasync function diffPair(\n accessor: DiskAccessor,\n path1: PathSpec,\n path2: PathSpec,\n flags: DiffFlags,\n): Promise<Uint8Array> {\n const dataA = await readFile(accessor, path1)\n const dataB = await readFile(accessor, path2)\n let textA = DEC.decode(dataA)\n let textB = DEC.decode(dataB)\n if (flags.i) {\n textA = textA.toLowerCase()\n textB = textB.toLowerCase()\n }\n if (flags.w) {\n textA = textA.replace(/\\s+/g, '')\n textB = textB.replace(/\\s+/g, '')\n }\n if (flags.b) {\n textA = textA.replace(/[ \\t]+/g, ' ')\n textB = textB.replace(/[ \\t]+/g, ' ')\n }\n if (flags.q) {\n if (textA !== textB) return ENC.encode(`Files ${path1.original} and ${path2.original} differ\\n`)\n return new Uint8Array(0)\n }\n const aLines = splitLinesKeepEnds(textA)\n const bLines = splitLinesKeepEnds(textB)\n const result = flags.e\n ? edScript(aLines, bLines)\n : unifiedDiff(aLines, bLines, path1.original, path2.original)\n return ENC.encode(result.join(''))\n}\n\nasync function diffCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode('diff: requires two paths\\n') })]\n }\n const flags: DiffFlags = {\n i: opts.flags.i === true,\n w: opts.flags.w === true,\n b: opts.flags.b === true,\n e: opts.flags.e === true,\n q: opts.flags.q === true,\n }\n const p0 = paths[0]\n const p1 = paths[1]\n if (p0 === undefined || p1 === undefined) return [null, new IOResult()]\n const output = await diffPair(accessor, p0, p1, flags)\n const exitCode = output.byteLength > 0 ? 1 : 0\n const out: ByteSource = output\n return [out, new IOResult({ exitCode, cache: [p0.stripPrefix, p1.stripPrefix] })]\n}\n\nexport const DISK_DIFF = command({\n name: 'diff',\n resource: ResourceName.DISK,\n spec: specOf('diff'),\n fn: diffCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nfunction dirnameCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n _opts: CommandOpts,\n): CommandFnResult {\n const arg = texts[0] ?? paths[0]?.original ?? ''\n const stripped = arg.replace(/\\/+$/, '')\n const idx = stripped.lastIndexOf('/')\n const dir = idx > 0 ? stripped.slice(0, idx) : idx === 0 ? '/' : '.'\n const out: ByteSource = new TextEncoder().encode(`${dir}\\n`)\n return [out, new IOResult()]\n}\n\nexport const DISK_DIRNAME = command({\n name: 'dirname',\n resource: ResourceName.DISK,\n spec: specOf('dirname'),\n fn: dirnameCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { du as diskDu, duAll as diskDuAll } from '../../../core/disk/du.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nfunction humanSize(n: number): string {\n const units = ['', 'K', 'M', 'G', 'T']\n let v = n\n let i = 0\n while (v >= 1024 && i < units.length - 1) {\n v /= 1024\n i += 1\n }\n const s = v >= 10 || i === 0 ? Math.round(v).toString() : v.toFixed(1)\n return `${s}${units[i] ?? ''}`\n}\n\nfunction depthOf(entryPath: string, basePath: string): number {\n const base = basePath.replace(/\\/+$/, '')\n const rel = entryPath.replace(/\\/+$/, '').slice(base.length)\n if (!rel) return 0\n return (rel.replace(/^\\/+|\\/+$/g, '').match(/\\//g) ?? []).length + 1\n}\n\nasync function duCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const human = opts.flags.h === true\n const summarize = opts.flags.s === true\n const all = opts.flags.a === true\n const cumulative = opts.flags.c === true\n const maxDepthRaw = opts.flags['max-depth']\n const maxDepth = typeof maxDepthRaw === 'string' ? Number.parseInt(maxDepthRaw, 10) : null\n const fmt = (size: number): string => (human ? humanSize(size) : String(size))\n const targets =\n paths.length > 0 ? paths : [new PathSpec({ original: '/', directory: '/', resolved: false })]\n const path = targets[0]\n if (path === undefined) return [null, new IOResult()]\n\n if (summarize) {\n const total = await diskDu(accessor, path)\n let output = `${fmt(total)}\\t${path.original}`\n if (cumulative) output += `\\n${fmt(total)}\\ttotal`\n return [new TextEncoder().encode(output) as ByteSource, new IOResult()]\n }\n\n const [allEntriesRaw, totalFromAll] = await diskDuAll(accessor, path)\n let entries = allEntriesRaw\n if (entries.length === 0) {\n const total = await diskDu(accessor, path)\n let output = `${fmt(total)}\\t${path.original}`\n if (cumulative) output += `\\n${fmt(total)}\\ttotal`\n return [new TextEncoder().encode(output) as ByteSource, new IOResult()]\n }\n if (!all) {\n entries = entries.filter(([p]) => p === path.original)\n }\n if (maxDepth !== null) {\n entries = entries.filter(([p]) => depthOf(p, path.original) <= maxDepth)\n }\n if (entries.length === 0) {\n const total = totalFromAll !== 0 ? totalFromAll : await diskDu(accessor, path)\n let output = `${fmt(total)}\\t${path.original}`\n if (cumulative) output += `\\n${fmt(total)}\\ttotal`\n return [new TextEncoder().encode(output) as ByteSource, new IOResult()]\n }\n const lines: string[] = entries.map(([p, sz]) => `${fmt(sz)}\\t${p}`)\n if (cumulative) {\n const grand = entries.reduce((acc, [, sz]) => acc + sz, 0)\n lines.push(`${fmt(grand)}\\ttotal`)\n }\n return [new TextEncoder().encode(lines.join('\\n')) as ByteSource, new IOResult()]\n}\n\nexport const DISK_DU = command({\n name: 'du',\n resource: ResourceName.DISK,\n spec: specOf('du'),\n fn: duCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { readdir, stat } from 'node:fs/promises'\nimport path from 'node:path'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { norm, resolveSafe } from './utils.ts'\n\nasync function walkSizes(full: string): Promise<number> {\n let total = 0\n let st\n try {\n st = await stat(full)\n } catch {\n return 0\n }\n if (st.isFile()) return st.size\n if (!st.isDirectory()) return 0\n const entries = await readdir(full, { withFileTypes: true })\n for (const e of entries) {\n const child = path.join(full, e.name)\n if (e.isDirectory()) total += await walkSizes(child)\n else if (e.isFile()) {\n try {\n const cst = await stat(child)\n total += cst.size\n } catch {\n // ignore\n }\n }\n }\n return total\n}\n\nasync function walkAll(\n accessor: DiskAccessor,\n full: string,\n entries: [string, number][],\n): Promise<number> {\n let total = 0\n let st\n try {\n st = await stat(full)\n } catch {\n return 0\n }\n if (st.isFile()) {\n const rel = '/' + path.relative(accessor.root, full).split(path.sep).join('/')\n entries.push([rel, st.size])\n return st.size\n }\n if (!st.isDirectory()) return 0\n const children = await readdir(full, { withFileTypes: true })\n for (const e of children) {\n const child = path.join(full, e.name)\n if (e.isDirectory()) {\n total += await walkAll(accessor, child, entries)\n } else if (e.isFile()) {\n try {\n const cst = await stat(child)\n const rel = '/' + path.relative(accessor.root, child).split(path.sep).join('/')\n entries.push([rel, cst.size])\n total += cst.size\n } catch {\n // ignore\n }\n }\n }\n return total\n}\n\nexport async function du(accessor: DiskAccessor, p: PathSpec): Promise<number> {\n const virtual = p.stripPrefix\n const full = resolveSafe(accessor.root, virtual)\n return walkSizes(full)\n}\n\nexport async function duAll(\n accessor: DiskAccessor,\n p: PathSpec,\n): Promise<[entries: [string, number][], total: number]> {\n const virtual = norm(p.stripPrefix)\n const full = resolveSafe(accessor.root, virtual)\n const entries: [string, number][] = []\n const total = await walkAll(accessor, full, entries)\n entries.sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0))\n return [entries, total]\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction expandTabs(text: string, tabsize: number): string {\n const out: string[] = []\n let col = 0\n for (const ch of text) {\n if (ch === '\\t') {\n const spaces = tabsize - (col % tabsize)\n out.push(' '.repeat(spaces))\n col += spaces\n } else if (ch === '\\n') {\n out.push(ch)\n col = 0\n } else {\n out.push(ch)\n col += 1\n }\n }\n return out.join('')\n}\n\nfunction expandLeadingTabs(text: string, tabsize: number): string {\n const lines = text.split('\\n')\n const result: string[] = []\n for (const line of lines) {\n let i = 0\n while (i < line.length && line[i] === '\\t') i += 1\n if (i === 0) {\n result.push(line)\n } else {\n const leading = line.slice(0, i)\n const rest = line.slice(i)\n result.push(expandTabs(leading, tabsize) + rest)\n }\n }\n return result.join('\\n')\n}\n\nasync function expandCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tabsize = typeof opts.flags.t === 'string' ? Number.parseInt(opts.flags.t, 10) : 8\n const leadingOnly = opts.flags.i === true\n const expander = (txt: string) =>\n leadingOnly ? expandLeadingTabs(txt, tabsize) : expandTabs(txt, tabsize)\n if (paths.length > 0) {\n const parts: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(diskStream(accessor, p)))\n parts.push(expander(data))\n }\n const result: ByteSource = ENC.encode(parts.join(''))\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('expand: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const result: ByteSource = ENC.encode(expander(text))\n return [result, new IOResult()]\n}\n\nexport const DISK_EXPAND = command({\n name: 'expand',\n resource: ResourceName.DISK,\n spec: specOf('expand'),\n fn: expandCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n ResourceName,\n command,\n detectFileType,\n formatFileResult,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stat as diskStat } from '../../../../core/disk/stat.ts'\nimport { read as diskRead } from '../../../../core/disk/read.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const brief = opts.flags.b === true\n const mime = opts.flags.i === true\n const lines: string[] = []\n for (const p of paths) {\n const s = await diskStat(accessor, p)\n if (s.type === FileType.DIRECTORY) {\n lines.push(formatFileResult(p.original, FileType.DIRECTORY, brief, mime))\n continue\n }\n let header: Uint8Array\n try {\n const raw = await diskRead(accessor, p)\n header = raw.subarray(0, 512)\n } catch {\n header = new Uint8Array(0)\n }\n const result = detectFileType(header, s)\n lines.push(formatFileResult(p.original, result, brief, mime))\n }\n const out: ByteSource = ENC.encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const DISK_FILE = command({\n name: 'file',\n resource: ResourceName.DISK,\n spec: specOf('file'),\n fn: fileCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { readFile } from 'node:fs/promises'\nimport { type PathSpec, record, ResourceName } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function read(accessor: DiskAccessor, path: PathSpec): Promise<Uint8Array> {\n const start = performance.now()\n const virtual = path.stripPrefix\n const full = resolveSafe(accessor.root, virtual)\n let data: Buffer\n try {\n data = await readFile(full)\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n throw new Error(`file not found: ${virtual}`)\n }\n throw err\n }\n record('read', virtual, ResourceName.DISK, data.byteLength, start)\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherDescribe,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileFeatherCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = featherDescribe(raw)\n const out: ByteSource = ENC.encode(result)\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`file: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_FILE_FEATHER = command({\n name: 'file',\n resource: ResourceName.DISK,\n spec: specOf('file'),\n filetype: '.feather',\n fn: fileFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Describe,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileHdf5Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await hdf5Describe(raw)\n const out: ByteSource = ENC.encode(result)\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`file: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_FILE_HDF5 = command({\n name: 'file',\n resource: ResourceName.DISK,\n spec: specOf('file'),\n filetype: '.h5',\n fn: fileHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetDescribe,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function fileParquetCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('file: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = parquetDescribe(raw)\n const out: ByteSource = ENC.encode(result)\n return [\n out,\n new IOResult({\n reads: { [first.stripPrefix]: raw },\n cache: [first.stripPrefix],\n }),\n ]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`file: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_FILE_PARQUET = command({\n name: 'file',\n resource: ResourceName.DISK,\n spec: specOf('file'),\n filetype: '.parquet',\n fn: fileParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { find as diskFind } from '../../../core/disk/find.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\n/**\n * Parse a `-size` argument (e.g. `+1M`, `-100c`, `512`) into [min, max] bytes.\n * `+N` → larger than N; `-N` → smaller; bare N → exactly N.\n * Suffixes: c=byte, k=KB, M=MB, G=GB. Mirrors Python `_parse_size`.\n */\nfunction parseSize(spec: string): [number | null, number | null] {\n const suffixes: Record<string, number> = { c: 1, k: 1024, M: 1024 ** 2, G: 1024 ** 3 }\n const sign = spec.startsWith('+') ? '+' : spec.startsWith('-') ? '-' : ''\n const raw = sign === '' ? spec : spec.slice(1)\n const lastChar = raw.slice(-1)\n const mult = suffixes[lastChar] ?? 1\n const numPart = lastChar in suffixes ? raw.slice(0, -1) : raw\n const num = Number.parseInt(numPart, 10) * mult\n if (sign === '+') return [num, null]\n if (sign === '-') return [null, num]\n return [num, num]\n}\n\n/**\n * Parse a `-mtime` argument (e.g. `+7`, `-1`) into [minTimestamp, maxTimestamp].\n * Days are 86400-second buckets relative to now. Mirrors Python `_parse_mtime`.\n */\nfunction parseMtime(spec: string): [number | null, number | null] {\n const now = Date.now() / 1000\n const day = 86_400\n const n = Number.parseInt(spec.replace(/^[+-]/, ''), 10)\n if (spec.startsWith('+')) return [null, now - n * day]\n if (spec.startsWith('-')) return [now - n * day, null]\n return [now - (n + 1) * day, now - n * day]\n}\n\n/**\n * Extract `-not -name PATTERN` from positional args. Mirrors Python\n * `_extract_not_name`.\n */\nfunction extractNotName(texts: readonly string[]): string | null {\n for (let i = 0; i < texts.length; i++) {\n const pat = texts[i + 2]\n if (texts[i] === '-not' && texts[i + 1] === '-name' && pat !== undefined) {\n return pat\n }\n }\n return null\n}\n\n/**\n * Extract `-or -name PATTERN` repeated entries. Mirrors Python\n * `_extract_or_names`. Always includes the primary `-name` if given.\n */\nfunction extractOrNames(name: string | null, texts: readonly string[]): string[] {\n const names: string[] = []\n if (name !== null) names.push(name)\n let i = 0\n while (i < texts.length) {\n const pat = texts[i + 2]\n if (texts[i] === '-or' && texts[i + 1] === '-name' && pat !== undefined) {\n names.push(pat)\n i += 3\n } else {\n i += 1\n }\n }\n return names\n}\n\nasync function findCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nameFlag = typeof opts.flags.name === 'string' ? opts.flags.name : null\n const inameFlag = typeof opts.flags.iname === 'string' ? opts.flags.iname : null\n const typeFlag = typeof opts.flags.type === 'string' ? opts.flags.type : null\n const pathFlag = typeof opts.flags.path === 'string' ? opts.flags.path : null\n const maxDepthFlag = typeof opts.flags.maxdepth === 'string' ? opts.flags.maxdepth : null\n const minDepthFlag = typeof opts.flags.mindepth === 'string' ? opts.flags.mindepth : null\n const sizeFlag = typeof opts.flags.size === 'string' ? opts.flags.size : null\n const mtimeFlag = typeof opts.flags.mtime === 'string' ? opts.flags.mtime : null\n const targets =\n paths.length > 0 ? paths : [new PathSpec({ original: '/', directory: '/', resolved: false })]\n const findType: 'f' | 'd' | null = typeFlag === 'f' ? 'f' : typeFlag === 'd' ? 'd' : null\n const maxDepth = maxDepthFlag !== null ? Number.parseInt(maxDepthFlag, 10) : null\n const minDepth = minDepthFlag !== null ? Number.parseInt(minDepthFlag, 10) : null\n const [minSize, maxSize] = sizeFlag !== null ? parseSize(sizeFlag) : [null, null]\n const [mtimeMin, mtimeMax] = mtimeFlag !== null ? parseMtime(mtimeFlag) : [null, null]\n const nameExclude = extractNotName(texts)\n const orNames = extractOrNames(nameFlag, texts)\n const matches: string[] = []\n for (const root of targets) {\n let keys: string[]\n try {\n keys = await diskFind(accessor, root, {\n name: nameFlag,\n iname: inameFlag,\n type: findType,\n ...(maxDepth !== null ? { maxDepth } : {}),\n ...(minDepth !== null ? { minDepth } : {}),\n ...(minSize !== null ? { minSize } : {}),\n ...(maxSize !== null ? { maxSize } : {}),\n ...(mtimeMin !== null ? { mtimeMin } : {}),\n ...(mtimeMax !== null ? { mtimeMax } : {}),\n ...(nameExclude !== null ? { nameExclude } : {}),\n ...(pathFlag !== null ? { pathPattern: pathFlag } : {}),\n ...(orNames.length > 1 ? { orNames } : {}),\n })\n } catch {\n continue\n }\n const rootKey = root.stripPrefix.replace(/\\/+$/, '') || '/'\n for (const key of keys) {\n const displayPath =\n root.original === '/'\n ? key\n : root.original.replace(/\\/+$/, '') + key.slice(rootKey === '/' ? 0 : rootKey.length)\n matches.push(displayPath)\n }\n }\n matches.sort()\n const out: ByteSource = new TextEncoder().encode(matches.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const DISK_FIND = command({\n name: 'find',\n resource: ResourceName.DISK,\n spec: specOf('find'),\n fn: findCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction wrapText(text: string, width: number): string {\n const words = text.split(/\\s+/).filter((w) => w !== '')\n if (words.length === 0) return ''\n const lines: string[] = []\n let current = ''\n for (const w of words) {\n if (current === '') {\n current = w\n } else if (current.length + 1 + w.length <= width) {\n current = current + ' ' + w\n } else {\n lines.push(current)\n current = w\n }\n }\n if (current !== '') lines.push(current)\n return lines.join('\\n')\n}\n\nfunction fmtText(text: string, width: number): string {\n const paragraphs = text.split('\\n\\n')\n const formatted: string[] = []\n for (const para of paragraphs) {\n const trimmed = para.trim()\n if (trimmed !== '') formatted.push(wrapText(trimmed, width))\n else formatted.push('')\n }\n return formatted.join('\\n\\n') + '\\n'\n}\n\nasync function fmtCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const width = typeof opts.flags.w === 'string' ? Number.parseInt(opts.flags.w, 10) : 75\n if (paths.length > 0) {\n const parts: string[] = []\n for (const p of paths) {\n parts.push(DEC.decode(await materialize(diskStream(accessor, p))))\n }\n const result: ByteSource = ENC.encode(fmtText(parts.join(''), width))\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('fmt: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const result: ByteSource = ENC.encode(fmtText(text, width))\n return [result, new IOResult()]\n}\n\nexport const DISK_FMT = command({\n name: 'fmt',\n resource: ResourceName.DISK,\n spec: specOf('fmt'),\n fn: fmtCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction foldLine(line: string, width: number, breakSpaces: boolean): string {\n if (line.length <= width) return line\n const parts: string[] = []\n let rest = line\n while (rest.length > width) {\n if (breakSpaces) {\n const idx = rest.lastIndexOf(' ', width - 1)\n if (idx > 0) {\n parts.push(rest.slice(0, idx + 1))\n rest = rest.slice(idx + 1)\n } else {\n parts.push(rest.slice(0, width))\n rest = rest.slice(width)\n }\n } else {\n parts.push(rest.slice(0, width))\n rest = rest.slice(width)\n }\n }\n if (rest !== '') parts.push(rest)\n return parts.join('\\n')\n}\n\nasync function foldCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const width = typeof opts.flags.w === 'string' ? Number.parseInt(opts.flags.w, 10) : 80\n const breakSpaces = opts.flags.s === true\n if (paths.length > 0) {\n const allLines: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(diskStream(accessor, p)))\n for (const line of splitLinesNoTrailing(data)) {\n allLines.push(foldLine(line, width, breakSpaces))\n }\n }\n const result: ByteSource = ENC.encode(allLines.join('\\n') + '\\n')\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('fold: missing operand\\n') })]\n }\n const lines = splitLinesNoTrailing(DEC.decode(stdinData))\n const result: ByteSource = ENC.encode(\n lines.map((ln) => foldLine(ln, width, breakSpaces)).join('\\n') + '\\n',\n )\n return [result, new IOResult()]\n}\n\nexport const DISK_FOLD = command({\n name: 'fold',\n resource: ResourceName.DISK,\n spec: specOf('fold'),\n fn: foldCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n compilePattern,\n exitOnEmpty,\n grepLines,\n grepStream,\n materialize,\n prefixAggregate,\n quietMatch,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport { stat as diskStat } from '../../../../core/disk/stat.ts'\nimport { find as diskFind } from '../../../../core/disk/find.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction getPattern(texts: readonly string[], flags: Record<string, string | boolean>): string {\n if (typeof flags.e === 'string') return flags.e\n if (texts.length > 0 && texts[0] !== undefined) return texts[0]\n throw new Error('grep: usage: grep [flags] pattern [path]')\n}\n\ninterface FlagSet {\n ignoreCase: boolean\n invert: boolean\n lineNumbers: boolean\n countOnly: boolean\n filesOnly: boolean\n wholeWord: boolean\n fixedString: boolean\n onlyMatching: boolean\n maxCount: number | null\n quiet: boolean\n afterContext: number\n beforeContext: number\n}\n\nfunction parseFlags(flags: Record<string, string | boolean>): FlagSet {\n const toInt = (v: string | boolean | undefined): number | null =>\n typeof v === 'string' ? Number.parseInt(v, 10) : null\n const aCtx = toInt(flags.A)\n const bCtx = toInt(flags.B)\n const cCtx = toInt(flags.C)\n return {\n ignoreCase: flags.i === true,\n invert: flags.v === true,\n lineNumbers: flags.n === true,\n countOnly: flags.c === true,\n filesOnly: flags.args_l === true || flags.l === true,\n wholeWord: flags.w === true,\n fixedString: flags.F === true,\n onlyMatching: flags.o === true,\n maxCount: toInt(flags.m),\n quiet: flags.q === true,\n afterContext: aCtx ?? cCtx ?? 0,\n beforeContext: bCtx ?? cCtx ?? 0,\n }\n}\n\nasync function readFile(accessor: DiskAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(diskStream(accessor, p))\n}\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nasync function expandRecursive(accessor: DiskAccessor, paths: PathSpec[]): Promise<PathSpec[]> {\n const expanded: PathSpec[] = []\n for (const p of paths) {\n try {\n const st = await diskStat(accessor, p)\n if (st.type === FileType.DIRECTORY) {\n const entries = await diskFind(accessor, p, { type: 'f' })\n for (const entry of entries) {\n expanded.push(\n new PathSpec({\n original: entry,\n directory: entry,\n resolved: false,\n prefix: p.prefix,\n }),\n )\n }\n } else {\n expanded.push(p)\n }\n } catch {\n expanded.push(p)\n }\n }\n return expanded\n}\n\nasync function grepImpl(\n name: string,\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let pattern: string\n try {\n pattern = getPattern(texts, opts.flags)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const f = parseFlags(opts.flags)\n const recursive = opts.flags.r === true || opts.flags.R === true\n\n if (recursive && paths.length > 0) {\n const pat = compilePattern(pattern, f.ignoreCase, f.fixedString, f.wholeWord)\n const expanded = await expandRecursive(accessor, paths)\n const allResults: string[] = []\n for (const p of expanded) {\n const data = splitLinesNoTrailing(DEC.decode(await readFile(accessor, p)))\n const hits = grepLines(p.original, data, pat, f)\n if (f.countOnly) {\n if (hits.length > 0) allResults.push(`${p.original}:${hits[0] ?? ''}`)\n } else if (f.filesOnly) {\n for (const h of hits) allResults.push(h)\n } else {\n for (const h of hits) allResults.push(`${p.original}:${h}`)\n }\n }\n if (allResults.length === 0) return [new Uint8Array(0), new IOResult({ exitCode: 1 })]\n const out: ByteSource = ENC.encode(allResults.join('\\n'))\n return [out, new IOResult()]\n }\n\n if (paths.length > 0) {\n const pat = compilePattern(pattern, f.ignoreCase, f.fixedString, f.wholeWord)\n\n if (paths.length > 1) {\n const allResults: string[] = []\n for (const p of paths) {\n const data = splitLinesNoTrailing(DEC.decode(await readFile(accessor, p)))\n const hits = grepLines(p.original, data, pat, f)\n if (f.countOnly) {\n if (hits.length > 0) allResults.push(`${p.original}:${hits[0] ?? ''}`)\n } else if (f.filesOnly) {\n for (const h of hits) allResults.push(h)\n } else {\n for (const h of hits) allResults.push(`${p.original}:${h}`)\n }\n }\n if (allResults.length === 0) return [new Uint8Array(0), new IOResult({ exitCode: 1 })]\n const out: ByteSource = ENC.encode(allResults.join('\\n'))\n return [out, new IOResult()]\n }\n\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n await diskStat(accessor, first)\n if (f.filesOnly) {\n const data = splitLinesNoTrailing(DEC.decode(await readFile(accessor, first)))\n const hits = grepLines(first.original, data, pat, f)\n if (hits.length === 0) return [new Uint8Array(0), new IOResult({ exitCode: 1 })]\n return [ENC.encode(hits.join('\\n')), new IOResult()]\n }\n const source = diskStream(accessor, first)\n const stream = grepStream(source, pat, f)\n if (f.quiet) {\n const io = new IOResult({ exitCode: 1 })\n return [quietMatch(stream, io), io]\n }\n const io = new IOResult()\n return [exitOnEmpty(stream, io), io]\n }\n\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, `${name}: usage: ${name} [flags] pattern [path]`)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 2, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const pat = compilePattern(pattern, f.ignoreCase, f.fixedString, f.wholeWord)\n const stream = grepStream(source, pat, f)\n if (f.quiet) {\n const io = new IOResult({ exitCode: 1 })\n return [quietMatch(stream, io), io]\n }\n const io = new IOResult()\n return [exitOnEmpty(stream, io), io]\n}\n\nconst grepFn = (\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> => {\n return grepImpl('grep', accessor, paths, texts, opts)\n}\n\nexport const DISK_GREP = command({\n name: 'grep',\n resource: ResourceName.DISK,\n spec: specOf('grep'),\n fn: grepFn,\n aggregate: prefixAggregate,\n})\n\nexport { grepImpl }\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherGrep,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function grepFeatherCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = featherGrep(raw, pattern, ignoreCase)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_GREP_FEATHER = command({\n name: 'grep',\n resource: ResourceName.DISK,\n spec: specOf('grep'),\n filetype: '.feather',\n fn: grepFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Grep,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function grepHdf5Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await hdf5Grep(raw, pattern, ignoreCase)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_GREP_HDF5 = command({\n name: 'grep',\n resource: ResourceName.DISK,\n spec: specOf('grep'),\n filetype: '.h5',\n fn: grepHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetGrep,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function grepParquetCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('grep: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const pattern = texts[0] ?? ''\n const ignoreCase = opts.flags.i === true\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await parquetGrep(raw, pattern, ignoreCase)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`grep: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_GREP_PARQUET = command({\n name: 'grep',\n resource: ResourceName.DISK,\n spec: specOf('grep'),\n filetype: '.parquet',\n fn: grepParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n gunzip,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { unlink as diskUnlink } from '../../../core/disk/unlink.ts'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function gunzipCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const keep = opts.flags.k === true\n const stdoutMode = opts.flags.c === true\n const testMode = opts.flags.t === true\n\n if (paths.length === 0) {\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'gunzip: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const data = await materialize(source)\n const out = await gunzip(data)\n const result: ByteSource = out\n return [result, new IOResult()]\n }\n\n if (testMode) {\n for (const p of paths) {\n const raw = await materialize(diskStream(accessor, p))\n await gunzip(raw)\n }\n return [null, new IOResult()]\n }\n\n if (stdoutMode) {\n const chunks: Uint8Array[] = []\n for (const p of paths) {\n const raw = await materialize(diskStream(accessor, p))\n chunks.push(await gunzip(raw))\n }\n return [concat(chunks), new IOResult()]\n }\n\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const raw = await materialize(diskStream(accessor, p))\n const pStripped = p.stripPrefix\n const outPath = pStripped.endsWith('.gz') ? pStripped.slice(0, -3) : pStripped + '.out'\n const outData = await gunzip(raw)\n await diskWrite(accessor, makePathSpec(outPath), outData)\n writes[outPath] = outData\n if (!keep) await diskUnlink(accessor, p)\n }\n return [null, new IOResult({ writes })]\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nexport const DISK_GUNZIP = command({\n name: 'gunzip',\n resource: ResourceName.DISK,\n spec: specOf('gunzip'),\n fn: gunzipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { unlink as fsUnlink } from 'node:fs/promises'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function unlink(accessor: DiskAccessor, path: PathSpec): Promise<void> {\n const full = resolveSafe(accessor.root, path.stripPrefix)\n try {\n await fsUnlink(full)\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n gunzip,\n gzip,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { unlink as diskUnlink } from '../../../core/disk/unlink.ts'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function gzipCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const decompress = opts.flags.d === true\n const keep = opts.flags.k === true\n const stdoutMode = opts.flags.c === true\n\n if (paths.length === 0) {\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'gzip: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const data = await materialize(source)\n const out = decompress ? await gunzip(data) : await gzip(data)\n const result: ByteSource = out\n return [result, new IOResult()]\n }\n\n if (stdoutMode) {\n const chunks: Uint8Array[] = []\n for (const p of paths) {\n const raw = await materialize(diskStream(accessor, p))\n const out = decompress ? await gunzip(raw) : await gzip(raw)\n chunks.push(out)\n }\n return [concat(chunks), new IOResult()]\n }\n\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const raw = await materialize(diskStream(accessor, p))\n const pStripped = p.stripPrefix\n let outPath: string\n let outData: Uint8Array\n if (decompress) {\n outPath = pStripped.endsWith('.gz') ? pStripped.slice(0, -3) : pStripped + '.out'\n outData = await gunzip(raw)\n } else {\n outPath = pStripped + '.gz'\n outData = await gzip(raw)\n }\n await diskWrite(accessor, makePathSpec(outPath), outData)\n writes[outPath] = outData\n if (!keep) await diskUnlink(accessor, p)\n }\n return [null, new IOResult({ writes })]\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nexport const DISK_GZIP = command({\n name: 'gzip',\n resource: ResourceName.DISK,\n spec: specOf('gzip'),\n fn: gzipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n Precision,\n ProvisionResult,\n ResourceName,\n command,\n headerAggregate,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport { stat as diskStat } from '../../../../core/disk/stat.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function* headStream(\n source: AsyncIterable<Uint8Array>,\n lines: number,\n bytesMode: number | null,\n): AsyncIterable<Uint8Array> {\n if (bytesMode !== null) {\n let remaining = bytesMode\n for await (const chunk of source) {\n if (chunk.byteLength <= remaining) {\n yield chunk\n remaining -= chunk.byteLength\n if (remaining <= 0) return\n } else {\n yield chunk.slice(0, remaining)\n return\n }\n }\n return\n }\n let count = 0\n const lineIter = new AsyncLineIterator(source)\n for await (const line of lineIter) {\n const out = new Uint8Array(line.byteLength + 1)\n out.set(line, 0)\n out[line.byteLength] = 0x0a\n yield out\n count += 1\n if (count >= lines) return\n }\n}\n\nasync function* headMulti(\n accessor: DiskAccessor,\n paths: readonly PathSpec[],\n lines: number,\n bytesMode: number | null,\n): AsyncIterable<Uint8Array> {\n for (let i = 0; i < paths.length; i++) {\n const p = paths[i]\n if (p === undefined) continue\n if (paths.length > 1) {\n const prefix = i > 0 ? '\\n' : ''\n yield ENC.encode(`${prefix}==> ${p.original} <==\\n`)\n }\n const source = diskStream(accessor, p)\n for await (const chunk of headStream(source, lines, bytesMode)) yield chunk\n }\n}\n\nexport async function headProvision(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<ProvisionResult> {\n const [first] = paths\n if (first === undefined) return new ProvisionResult({ command: 'head' })\n try {\n const s = await diskStat(accessor, first)\n const fileSize = s.size ?? 0\n const nFlag = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : null\n const lines = nFlag !== null && Number.isFinite(nFlag) ? nFlag : 10\n const avgLine = 80\n const low = Math.min(lines * avgLine, fileSize)\n return new ProvisionResult({\n command: `head ${first.original}`,\n networkReadLow: low,\n networkReadHigh: fileSize,\n readOps: 1,\n precision: Precision.RANGE,\n })\n } catch {\n return new ProvisionResult({ command: 'head' })\n }\n}\n\nasync function headCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nRaw = typeof opts.flags.n === 'string' ? opts.flags.n : null\n const cRaw = typeof opts.flags.c === 'string' ? opts.flags.c : null\n const lineCount = nRaw !== null ? Number.parseInt(nRaw, 10) : 10\n const byteCount = cRaw !== null ? Number.parseInt(cRaw, 10) : null\n if (paths.length > 0) {\n for (const p of paths) await diskStat(accessor, p)\n return [headMulti(accessor, paths, lineCount, byteCount), new IOResult()]\n }\n try {\n const source = resolveSource(opts.stdin, 'head: missing operand')\n return [headStream(source, lineCount, byteCount), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const DISK_HEAD = command({\n name: 'head',\n resource: ResourceName.DISK,\n spec: specOf('head'),\n fn: headCommand,\n provision: headProvision,\n aggregate: headerAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherHead,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headFeatherCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = featherHead(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_HEAD_FEATHER = command({\n name: 'head',\n resource: ResourceName.DISK,\n spec: specOf('head'),\n filetype: '.feather',\n fn: headFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Head,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headHdf5Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await hdf5Head(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_HEAD_HDF5 = command({\n name: 'head',\n resource: ResourceName.DISK,\n spec: specOf('head'),\n filetype: '.h5',\n fn: headHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetHead,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function headParquetCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('head: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await parquetHead(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`head: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_HEAD_PARQUET = command({\n name: 'head',\n resource: ResourceName.DISK,\n spec: specOf('head'),\n filetype: '.parquet',\n fn: headParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\ntype EncodingId = 'utf-8' | 'utf-16le' | 'utf-16be' | 'latin1' | 'ascii'\n\nconst ENCODING_ALIASES: Record<string, EncodingId> = {\n 'utf-8': 'utf-8',\n utf8: 'utf-8',\n 'utf-16le': 'utf-16le',\n utf16le: 'utf-16le',\n ucs2: 'utf-16le',\n 'ucs-2': 'utf-16le',\n 'utf-16be': 'utf-16be',\n utf16be: 'utf-16be',\n latin1: 'latin1',\n iso88591: 'latin1',\n 'iso-8859-1': 'latin1',\n ascii: 'ascii',\n}\n\nfunction normalizeEncoding(name: string): EncodingId | null {\n const lower = name.toLowerCase().replace(/_/g, '-')\n return ENCODING_ALIASES[lower] ?? ENCODING_ALIASES[lower.replace(/-/g, '')] ?? null\n}\n\nfunction decodeUtf16BE(data: Uint8Array): string {\n const view = new DataView(data.buffer, data.byteOffset, data.byteLength)\n const chars: string[] = []\n for (let i = 0; i + 1 < data.byteLength; i += 2) {\n chars.push(String.fromCharCode(view.getUint16(i, false)))\n }\n return chars.join('')\n}\n\nfunction encodeUtf16BE(text: string): Uint8Array {\n const out = new Uint8Array(text.length * 2)\n const view = new DataView(out.buffer)\n for (let i = 0; i < text.length; i++) {\n view.setUint16(i * 2, text.charCodeAt(i), false)\n }\n return out\n}\n\nfunction decodeLatin1(data: Uint8Array): string {\n let s = ''\n for (let i = 0; i < data.byteLength; i++) s += String.fromCharCode(data[i] ?? 0)\n return s\n}\n\nfunction encodeLatin1(text: string): Uint8Array {\n const out = new Uint8Array(text.length)\n for (let i = 0; i < text.length; i++) out[i] = text.charCodeAt(i) & 0xff\n return out\n}\n\nfunction decodeAscii(data: Uint8Array): string {\n let s = ''\n for (let i = 0; i < data.byteLength; i++) s += String.fromCharCode((data[i] ?? 0) & 0x7f)\n return s\n}\n\nfunction encodeAscii(text: string): Uint8Array {\n const out = new Uint8Array(text.length)\n for (let i = 0; i < text.length; i++) out[i] = text.charCodeAt(i) & 0x7f\n return out\n}\n\nfunction decodeBytes(data: Uint8Array, enc: EncodingId): string {\n if (enc === 'utf-8') return new TextDecoder('utf-8', { fatal: false }).decode(data)\n if (enc === 'utf-16le') return new TextDecoder('utf-16le', { fatal: false }).decode(data)\n if (enc === 'utf-16be') return decodeUtf16BE(data)\n if (enc === 'latin1') return decodeLatin1(data)\n return decodeAscii(data)\n}\n\nfunction encodeText(text: string, enc: EncodingId): Uint8Array {\n if (enc === 'utf-8') return new TextEncoder().encode(text)\n if (enc === 'utf-16le') {\n const out = new Uint8Array(text.length * 2)\n const view = new DataView(out.buffer)\n for (let i = 0; i < text.length; i++) view.setUint16(i * 2, text.charCodeAt(i), true)\n return out\n }\n if (enc === 'utf-16be') return encodeUtf16BE(text)\n if (enc === 'latin1') return encodeLatin1(text)\n return encodeAscii(text)\n}\n\nasync function iconvCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const fromName = typeof opts.flags.f === 'string' ? opts.flags.f : 'utf-8'\n const toName = typeof opts.flags.t === 'string' ? opts.flags.t : 'utf-8'\n const fromEnc = normalizeEncoding(fromName)\n const toEnc = normalizeEncoding(toName)\n if (fromEnc === null) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`iconv: unsupported encoding: ${fromName}\\n`),\n }),\n ]\n }\n if (toEnc === null) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode(`iconv: unsupported encoding: ${toName}\\n`) }),\n ]\n }\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(diskStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('iconv: missing input\\n') })]\n }\n raw = stdinData\n }\n const decoded = decodeBytes(raw, fromEnc)\n const encoded = encodeText(decoded, toEnc)\n const outPath = typeof opts.flags.o === 'string' ? opts.flags.o : null\n if (outPath !== null) {\n const spec = PathSpec.fromStrPath(outPath, opts.mountPrefix ?? '')\n await diskWrite(accessor, spec, encoded)\n return [null, new IOResult({ writes: { [spec.stripPrefix]: encoded } })]\n }\n const result: ByteSource = encoded\n return [result, new IOResult()]\n}\n\nexport const DISK_ICONV = command({\n name: 'iconv',\n resource: ResourceName.DISK,\n spec: specOf('iconv'),\n fn: iconvCommand,\n write: true,\n})\n\nexport type { EncodingId as SupportedEncoding }\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction splitFields(line: string, delimiter: string | null): string[] {\n if (delimiter !== null && delimiter !== '') return line.split(delimiter)\n return line.split(/\\s+/).filter((s) => s !== '')\n}\n\nfunction buildJoinMap(\n lines: readonly string[],\n fieldIdx: number,\n delimiter: string | null,\n): Map<string, string[][]> {\n const result = new Map<string, string[][]>()\n for (const line of lines) {\n const parts = splitFields(line, delimiter)\n if (fieldIdx < parts.length) {\n const key = parts[fieldIdx] ?? ''\n const rest = parts.slice(0, fieldIdx).concat(parts.slice(fieldIdx + 1))\n const list = result.get(key)\n if (list === undefined) result.set(key, [rest])\n else list.push(rest)\n }\n }\n return result\n}\n\nfunction formatRow(\n key: string,\n rest1: readonly string[],\n rest2: readonly string[],\n oFmt: string | null,\n outSep: string,\n): string {\n if (oFmt === null) return [key, ...rest1, ...rest2].join(outSep)\n const fields: string[] = []\n for (const spec of oFmt.split(',')) {\n const trimmed = spec.trim()\n if (trimmed === '0') {\n fields.push(key)\n } else {\n const parts = trimmed.split('.')\n const fileN = Number.parseInt(parts[0] ?? '', 10)\n const fieldM = Number.parseInt(parts[1] ?? '', 10) - 1\n const src = fileN === 1 ? rest1 : rest2\n if (fieldM >= 0 && fieldM < src.length) fields.push(src[fieldM] ?? '')\n else fields.push('')\n }\n }\n return fields.join(outSep)\n}\n\nfunction firstValue<K, V>(map: Map<K, V>): V | undefined {\n for (const v of map.values()) return v\n return undefined\n}\n\nfunction joinLines(\n lines1: readonly string[],\n lines2: readonly string[],\n field1: number,\n field2: number,\n sep: string | null,\n aFlag: string | null,\n vFlag: string | null,\n eFlag: string | null,\n oFlag: string | null,\n): string[] {\n const map1 = buildJoinMap(lines1, field1, sep)\n const map2 = buildJoinMap(lines2, field2, sep)\n const outSep = sep !== null && sep !== '' ? sep : ' '\n const outLines: string[] = []\n const matchedKeys2 = new Set<string>()\n\n for (const line of lines1) {\n const parts = splitFields(line, sep)\n if (field1 >= parts.length) continue\n const key = parts[field1] ?? ''\n const rest1 = parts.slice(0, field1).concat(parts.slice(field1 + 1))\n const hit = map2.get(key)\n if (hit !== undefined) {\n matchedKeys2.add(key)\n if (vFlag === null) {\n for (const rest2 of hit) {\n outLines.push(formatRow(key, rest1, rest2, oFlag, outSep))\n }\n }\n } else {\n if (vFlag === '1' || aFlag === '1') {\n let placeholder: string[] = []\n if (oFlag !== null && eFlag !== null && map2.size > 0) {\n const sample = firstValue(map2)?.[0]\n if (sample !== undefined) placeholder = sample.map(() => eFlag)\n }\n outLines.push(formatRow(key, rest1, placeholder, oFlag, outSep))\n }\n }\n }\n\n if (aFlag === '2' || vFlag === '2') {\n for (const line of lines2) {\n const parts = splitFields(line, sep)\n if (field2 >= parts.length) continue\n const key = parts[field2] ?? ''\n if (!matchedKeys2.has(key)) {\n const rest2 = parts.slice(0, field2).concat(parts.slice(field2 + 1))\n let placeholder: string[] = []\n if (oFlag !== null && eFlag !== null && map1.size > 0) {\n const sample = firstValue(map1)?.[0]\n if (sample !== undefined) placeholder = sample.map(() => eFlag)\n }\n outLines.push(formatRow(key, placeholder, rest2, oFlag, outSep))\n }\n }\n }\n\n return outLines\n}\n\nasync function joinCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('join: requires two paths\\n') })]\n }\n const p1 = paths[0]\n const p2 = paths[1]\n if (p1 === undefined || p2 === undefined) return [null, new IOResult()]\n const field1 =\n (typeof opts.flags['1'] === 'string' ? Number.parseInt(opts.flags['1'], 10) : 1) - 1\n const field2 =\n (typeof opts.flags['2'] === 'string' ? Number.parseInt(opts.flags['2'], 10) : 1) - 1\n const sep = typeof opts.flags.t === 'string' ? opts.flags.t : null\n const aFlag = typeof opts.flags.a === 'string' ? opts.flags.a : null\n const vFlag = typeof opts.flags.v === 'string' ? opts.flags.v : null\n const eFlag = typeof opts.flags.e === 'string' ? opts.flags.e : null\n const oFlag = typeof opts.flags.o === 'string' ? opts.flags.o : null\n const data1 = DEC.decode(await materialize(diskStream(accessor, p1)))\n const data2 = DEC.decode(await materialize(diskStream(accessor, p2)))\n const lines1 = splitLinesNoTrailing(data1)\n const lines2 = splitLinesNoTrailing(data2)\n const out = joinLines(lines1, lines2, field1, field2, sep, aFlag, vFlag, eFlag, oFlag)\n if (out.length === 0) return [null, new IOResult()]\n const result: ByteSource = ENC.encode(out.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const DISK_JOIN = command({\n name: 'join',\n resource: ResourceName.DISK,\n spec: specOf('join'),\n fn: joinCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n Precision,\n ProvisionResult,\n ResourceName,\n command,\n evalJsonlStream,\n isJsonlPath,\n isStreamableJsonlExpr,\n jqEval,\n materialize,\n parseJsonAuto,\n parseJsonPath,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { stat as diskStat } from '../../../core/disk/stat.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nexport async function jqProvision(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n const [first] = paths\n const [expr] = texts\n if (first === undefined || expr === undefined) return new ProvisionResult({ command: 'jq' })\n try {\n const s = await diskStat(accessor, first)\n const fileSize = s.size ?? 0\n if (isJsonlPath(first.original) && isStreamableJsonlExpr(expr)) {\n return new ProvisionResult({\n command: `jq '${expr}' ${first.original}`,\n networkReadLow: 0,\n networkReadHigh: fileSize,\n readOps: 1,\n precision: Precision.RANGE,\n })\n }\n return new ProvisionResult({\n command: `jq '${expr}' ${first.original}`,\n networkReadLow: fileSize,\n networkReadHigh: fileSize,\n readOps: 1,\n precision: Precision.EXACT,\n })\n } catch {\n return new ProvisionResult({ command: 'jq' })\n }\n}\n\nfunction formatResult(result: unknown, raw: boolean, compact: boolean): Uint8Array {\n if (raw && typeof result === 'string') return ENC.encode(result + '\\n')\n const json = compact ? JSON.stringify(result) : JSON.stringify(result, null, 2)\n return ENC.encode(json + '\\n')\n}\n\nfunction formatResults(\n result: unknown,\n raw: boolean,\n compact: boolean,\n spread: boolean,\n): Uint8Array {\n if (spread && Array.isArray(result)) {\n const parts: Uint8Array[] = []\n for (const item of result) parts.push(formatResult(item, raw, compact))\n return concat(parts)\n }\n return formatResult(result, raw, compact)\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nasync function readFile(accessor: DiskAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(diskStream(accessor, p))\n}\n\nasync function jqCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const expression = texts[0]\n if (expression === undefined) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('jq: usage: jq EXPRESSION [path]\\n') }),\n ]\n }\n const raw = opts.flags.r === true\n const compact = opts.flags.c === true\n const slurp = opts.flags.s === true\n\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n if (isJsonlPath(first.original) && isStreamableJsonlExpr(expression)) {\n return [evalJsonlStream(diskStream(accessor, first), expression), new IOResult()]\n }\n const outputs: Uint8Array[] = []\n for (const p of paths) {\n const bytes = await readFile(accessor, p)\n let data = parseJsonPath(bytes, p.original)\n if (slurp) data = Array.isArray(data) ? data : [data]\n const result = await jqEval(data, expression.trim())\n const spread = expression.includes('[]')\n outputs.push(formatResults(result, raw, compact, spread))\n }\n const out: ByteSource = concat(outputs)\n return [out, new IOResult()]\n }\n\n const bytes = await readStdinAsync(opts.stdin)\n if (bytes === null) return [null, new IOResult()]\n let data = parseJsonAuto(bytes)\n if (slurp && !Array.isArray(data)) data = [data]\n const result = await jqEval(data, expression.trim())\n const spread = expression.includes('[]')\n return [formatResults(result, raw, compact, spread), new IOResult()]\n}\n\nexport const DISK_JQ = command({\n name: 'jq',\n resource: ResourceName.DISK,\n spec: specOf('jq'),\n fn: jqCommand,\n provision: jqProvision,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { exists as diskExists } from '../../../core/disk/exists.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lnCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('ln: usage: ln [-s] [-f] source dest\\n') }),\n ]\n }\n const source = paths[0]\n const dest = paths[1]\n if (source === undefined || dest === undefined) return [null, new IOResult()]\n if (opts.flags.n === true && (await diskExists(accessor, dest))) {\n return [null, new IOResult()]\n }\n const data = await materialize(diskStream(accessor, source))\n await diskWrite(accessor, dest, data)\n const out: ByteSource | null =\n opts.flags.v === true ? ENC.encode(`'${source.original}' -> '${dest.original}'\\n`) : null\n return [out, new IOResult({ writes: { [dest.stripPrefix]: data } })]\n}\n\nexport const DISK_LN = command({\n name: 'ln',\n resource: ResourceName.DISK,\n spec: specOf('ln'),\n fn: lnCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { access } from 'node:fs/promises'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function exists(accessor: DiskAccessor, path: PathSpec): Promise<boolean> {\n const full = resolveSafe(accessor.root, path.stripPrefix)\n try {\n await access(full)\n return true\n } catch {\n return false\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nasync function lookCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (texts.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('look: missing prefix\\n') })]\n }\n const prefix = texts[0] ?? ''\n const caseInsensitive = opts.flags.f === true\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(diskStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('look: missing input\\n') })]\n }\n raw = stdinData\n }\n const lines = splitLinesNoTrailing(DEC.decode(raw))\n const cmpPrefix = caseInsensitive ? prefix.toLowerCase() : prefix\n const matched: string[] = []\n for (const line of lines) {\n const cmpLine = caseInsensitive ? line.toLowerCase() : line\n if (cmpLine.startsWith(cmpPrefix)) matched.push(line)\n }\n if (matched.length === 0) return [null, new IOResult({ exitCode: 1 })]\n const result: ByteSource = ENC.encode(matched.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const DISK_LOOK = command({\n name: 'look',\n resource: ResourceName.DISK,\n spec: specOf('look'),\n fn: lookCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type FileStat,\n} from '@struktoai/mirage-core'\nimport { stat as diskStat } from '../../../../core/disk/stat.ts'\nimport { readdir as diskReaddir } from '../../../../core/disk/readdir.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nfunction humanSize(n: number): string {\n const units = ['B', 'K', 'M', 'G', 'T']\n let v = n\n let i = 0\n while (v >= 1024 && i < units.length - 1) {\n v /= 1024\n i += 1\n }\n const s = v >= 10 || i === 0 ? Math.round(v).toString() : v.toFixed(1)\n return `${s}${units[i] ?? ''}`\n}\n\nfunction childSpec(entryPath: string, prefix: string): PathSpec {\n return new PathSpec({\n original: entryPath,\n directory: entryPath,\n resolved: false,\n prefix,\n })\n}\n\nfunction formatEntry(s: FileStat, long: boolean, human: boolean, classify: boolean): string {\n if (long) {\n const size = human ? humanSize(s.size ?? 0) : String(s.size ?? 0)\n return `${s.type ?? '-'}\\t${size}\\t${s.modified ?? ''}\\t${s.name}`\n }\n const suffix = classify && s.type === FileType.DIRECTORY ? '/' : ''\n return `${s.name}${suffix}`\n}\n\nfunction sortStats(\n stats: FileStat[],\n sortBy: 'time' | 'size' | 'name',\n reverse: boolean,\n): FileStat[] {\n const sorted = [...stats].sort((a, b) => {\n if (sortBy === 'time') return (b.modified ?? '').localeCompare(a.modified ?? '')\n if (sortBy === 'size') return (b.size ?? 0) - (a.size ?? 0)\n return a.name.localeCompare(b.name)\n })\n if (reverse) sorted.reverse()\n return sorted\n}\n\nasync function listDir(accessor: DiskAccessor, dir: PathSpec, all: boolean): Promise<FileStat[]> {\n const entries = await diskReaddir(accessor, dir)\n const stats = await Promise.all(entries.map((p) => diskStat(accessor, childSpec(p, dir.prefix))))\n return all ? stats : stats.filter((s) => !s.name.startsWith('.'))\n}\n\ninterface WalkOpts {\n all: boolean\n long: boolean\n human: boolean\n classify: boolean\n sortBy: 'time' | 'size' | 'name'\n reverse: boolean\n}\n\nasync function walkRecursive(\n accessor: DiskAccessor,\n dir: PathSpec,\n opts: WalkOpts,\n header: boolean,\n lines: string[],\n warnings: string[],\n): Promise<void> {\n let stats: FileStat[]\n try {\n stats = await listDir(accessor, dir, opts.all)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n warnings.push(`ls: cannot access '${dir.original}': ${msg}`)\n return\n }\n if (header) lines.push(`${dir.stripPrefix}:`)\n const sorted = sortStats(stats, opts.sortBy, opts.reverse)\n for (const s of sorted) lines.push(formatEntry(s, opts.long, opts.human, opts.classify))\n const subdirs = sorted.filter((s) => s.type === FileType.DIRECTORY)\n for (const sub of subdirs) {\n lines.push('')\n const base = dir.stripPrefix.replace(/\\/+$/, '')\n const childPath = `${base}/${sub.name}`\n await walkRecursive(accessor, childSpec(childPath, dir.prefix), opts, true, lines, warnings)\n }\n}\n\nasync function lsCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const targets: PathSpec[] =\n paths.length > 0\n ? paths\n : [\n new PathSpec({\n original: opts.cwd,\n directory: opts.cwd,\n resolved: false,\n prefix: opts.mountPrefix ?? '',\n }),\n ]\n const long = opts.flags.args_l === true\n const all = opts.flags.a === true || opts.flags.A === true\n const human = opts.flags.h === true\n const reverse = opts.flags.r === true\n const classify = opts.flags.F === true\n const recursive = opts.flags.R === true\n const listDirItself = opts.flags.d === true\n const sortBy: 'time' | 'size' | 'name' =\n opts.flags.t === true ? 'time' : opts.flags.S === true ? 'size' : 'name'\n const warnings: string[] = []\n const lines: string[] = []\n\n if (listDirItself) {\n for (const p of targets) {\n try {\n const s = await diskStat(accessor, p)\n lines.push(formatEntry(s, long, human, classify))\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n warnings.push(`ls: cannot access '${p.original}': ${msg}`)\n }\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n const exitCode = warnings.length > 0 && lines.length === 0 ? 1 : 0\n if (warnings.length > 0) {\n const stderr = new TextEncoder().encode(warnings.join('\\n'))\n return [out, new IOResult({ stderr, exitCode })]\n }\n return [out, new IOResult({ exitCode })]\n }\n\n if (recursive) {\n const walkOpts: WalkOpts = { all, long, human, classify, sortBy, reverse }\n for (let i = 0; i < targets.length; i++) {\n const p = targets[i]\n if (p === undefined) continue\n if (i > 0) lines.push('')\n await walkRecursive(accessor, p, walkOpts, true, lines, warnings)\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n const exitCode = warnings.length > 0 && lines.length === 0 ? 1 : 0\n if (warnings.length > 0) {\n const stderr = new TextEncoder().encode(warnings.join('\\n'))\n return [out, new IOResult({ stderr, exitCode })]\n }\n return [out, new IOResult({ exitCode })]\n }\n\n for (const p of targets) {\n let stats: FileStat[]\n try {\n stats = await listDir(accessor, p, all)\n } catch (err) {\n try {\n stats = [await diskStat(accessor, p)]\n } catch {\n const msg = err instanceof Error ? err.message : String(err)\n warnings.push(`ls: cannot access '${p.original}': ${msg}`)\n continue\n }\n }\n for (const s of sortStats(stats, sortBy, reverse))\n lines.push(formatEntry(s, long, human, classify))\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n const exitCode = warnings.length > 0 && lines.length === 0 ? 1 : 0\n if (warnings.length > 0) {\n const stderr = new TextEncoder().encode(warnings.join('\\n'))\n return [out, new IOResult({ stderr, exitCode })]\n }\n return [out, new IOResult({ exitCode })]\n}\n\nexport const DISK_LS = command({\n name: 'ls',\n resource: ResourceName.DISK,\n spec: specOf('ls'),\n fn: lsCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { readdir as fsReaddir } from 'node:fs/promises'\nimport {\n IndexEntry,\n type IndexCacheStore,\n type PathSpec,\n ResourceType,\n} from '@struktoai/mirage-core'\nimport { norm, resolveSafe } from './utils.ts'\n\nexport async function readdir(\n accessor: DiskAccessor,\n path: PathSpec,\n index?: IndexCacheStore,\n): Promise<string[]> {\n const virtual = path.pattern !== null ? path.directory : path.stripPrefix\n const mountPrefix = path.prefix\n const virtualKey = mountPrefix + virtual\n if (index !== undefined) {\n const cached = await index.listDir(virtualKey)\n if (cached.entries !== undefined && cached.entries !== null) {\n return cached.entries\n }\n }\n const full = resolveSafe(accessor.root, virtual)\n let entries: string[]\n try {\n entries = await fsReaddir(full)\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code\n if (code === 'ENOTDIR') throw new Error(`not a directory: ${virtual}`)\n if (code === 'ENOENT') throw new Error(`not a directory: ${virtual}`)\n throw err\n }\n const base = norm(virtual)\n const dirPrefix = base === '/' ? '/' : `${base}/`\n const sorted = [...entries].sort()\n const virtualEntries = sorted.map((e) => `${mountPrefix}${dirPrefix}${e}`)\n if (index !== undefined) {\n const indexEntries: [string, IndexEntry][] = sorted.map((name) => [\n name,\n new IndexEntry({\n id: `${dirPrefix}${name}`,\n name,\n resourceType: ResourceType.FILE,\n }),\n ])\n await index.setDir(virtualKey, indexEntries)\n }\n return virtualEntries\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n featherLs,\n featherLsFallback,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport { stat as diskStat } from '../../../../core/disk/stat.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lsFeatherCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [first] = paths\n if (first === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('ls: missing operand\\n') })]\n }\n const stat = await diskStat(accessor, first)\n const meta = { size: stat.size ?? 0, modified: stat.modified, name: stat.name }\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = featherLs(raw, meta)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch {\n return [featherLsFallback(meta), new IOResult()]\n }\n}\n\nexport const DISK_LS_FEATHER = [\n ...command({\n name: 'ls',\n resource: ResourceName.DISK,\n spec: specOf('ls'),\n filetype: '.arrow',\n fn: lsFeatherCommand,\n }),\n ...command({\n name: 'ls',\n resource: ResourceName.DISK,\n spec: specOf('ls'),\n filetype: '.ipc',\n fn: lsFeatherCommand,\n }),\n ...command({\n name: 'ls',\n resource: ResourceName.DISK,\n spec: specOf('ls'),\n filetype: '.feather',\n fn: lsFeatherCommand,\n }),\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n hdf5Ls,\n hdf5LsFallback,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport { stat as diskStat } from '../../../../core/disk/stat.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lsHdf5Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [first] = paths\n if (first === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('ls: missing operand\\n') })]\n }\n const stat = await diskStat(accessor, first)\n const meta = { size: stat.size ?? 0, modified: stat.modified, name: stat.name }\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = await hdf5Ls(raw, meta)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch {\n return [hdf5LsFallback(meta), new IOResult()]\n }\n}\n\nexport const RAM_LS_HDF5 = [\n ...command({\n name: 'ls',\n resource: ResourceName.DISK,\n spec: specOf('ls'),\n filetype: '.hdf5',\n fn: lsHdf5Command,\n }),\n ...command({\n name: 'ls',\n resource: ResourceName.DISK,\n spec: specOf('ls'),\n filetype: '.h5',\n fn: lsHdf5Command,\n }),\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n parquetLs,\n parquetLsFallback,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport { stat as diskStat } from '../../../../core/disk/stat.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function lsParquetCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [first] = paths\n if (first === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('ls: missing operand\\n') })]\n }\n const stat = await diskStat(accessor, first)\n const meta = { size: stat.size ?? 0, modified: stat.modified, name: stat.name }\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = parquetLs(raw, meta)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch {\n return [parquetLsFallback(meta), new IOResult()]\n }\n}\n\nexport const DISK_LS_PARQUET = command({\n name: 'ls',\n resource: ResourceName.DISK,\n spec: specOf('ls'),\n filetype: '.parquet',\n fn: lsParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n md5Hex,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { read as diskRead } from '../../../core/disk/read.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nasync function md5Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const lines: string[] = []\n if (paths.length > 0) {\n for (const p of paths) {\n const data = await diskRead(accessor, p)\n lines.push(`${md5Hex(data)} ${p.original}`)\n }\n } else if (opts.stdin !== null) {\n const data = await materialize(opts.stdin)\n lines.push(md5Hex(data))\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const RAM_MD5 = command({\n name: 'md5',\n resource: ResourceName.DISK,\n spec: specOf('md5'),\n fn: md5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { mkdir as diskMkdir } from '../../../core/disk/mkdir.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nasync function mkdirCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const parents = opts.flags.p === true\n const verbose = opts.flags.v === true\n if (paths.length === 0) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('mkdir: missing operand\\n'),\n }),\n ]\n }\n const lines: string[] = []\n for (const p of paths) {\n await diskMkdir(accessor, p, parents)\n if (verbose) lines.push(`mkdir: created directory '${p.original}'`)\n }\n const out = lines.length > 0 ? new TextEncoder().encode(lines.join('\\n') + '\\n') : null\n return [out, new IOResult()]\n}\n\nexport const DISK_MKDIR = command({\n name: 'mkdir',\n resource: ResourceName.DISK,\n spec: specOf('mkdir'),\n fn: mkdirCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { mkdir as fsMkdir } from 'node:fs/promises'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function mkdir(\n accessor: DiskAccessor,\n path: PathSpec,\n parents = false,\n): Promise<void> {\n const full = resolveSafe(accessor.root, path.stripPrefix)\n if (parents) {\n await fsMkdir(full, { recursive: true })\n return\n }\n try {\n await fsMkdir(full)\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code\n if (code === 'EEXIST') return\n if (code === 'ENOENT') {\n throw new Error(`parent directory does not exist: ${path.stripPrefix}`)\n }\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { mkdir as diskMkdir } from '../../../core/disk/mkdir.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nfunction randomSuffix(): string {\n const chars = 'abcdefghijklmnopqrstuvwxyz0123456789'\n let out = ''\n for (let i = 0; i < 8; i++) {\n out += chars[Math.floor(Math.random() * chars.length)] ?? ''\n }\n return out\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function mktempCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tFlag = opts.flags.t === true\n const parent = tFlag ? '/tmp' : typeof opts.flags.p === 'string' ? opts.flags.p : '/tmp'\n const suffix = randomSuffix()\n const templateArg = texts[0]\n const template = templateArg !== undefined && templateArg !== '' ? templateArg : 'tmp.XXXXXXXXXX'\n const xRun = /X+$/.exec(template)\n let name: string\n if (xRun !== null) {\n name = template.slice(0, xRun.index) + suffix\n } else {\n name = `${template}.${suffix}`\n }\n const path = `${parent.replace(/\\/+$/, '')}/${name}`\n await diskMkdir(accessor, makePathSpec(parent), true)\n if (opts.flags.d === true) {\n await diskMkdir(accessor, makePathSpec(path))\n } else {\n await diskWrite(accessor, makePathSpec(path), new Uint8Array(0))\n }\n const result: ByteSource = ENC.encode(path + '\\n')\n return [result, new IOResult()]\n}\n\nexport const DISK_MKTEMP = command({\n name: 'mktemp',\n resource: ResourceName.DISK,\n spec: specOf('mktemp'),\n fn: mktempCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { rename as diskRename } from '../../../core/disk/rename.ts'\nimport { stat as diskStat } from '../../../core/disk/stat.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nasync function exists(accessor: DiskAccessor, path: PathSpec): Promise<boolean> {\n try {\n await diskStat(accessor, path)\n return true\n } catch {\n return false\n }\n}\n\nasync function mvCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('mv: missing operand\\n'),\n }),\n ]\n }\n const noClobber = opts.flags.n === true\n const verbose = opts.flags.v === true\n const sources = paths.slice(0, -1)\n const dst = paths[paths.length - 1]\n if (dst === undefined) return [null, new IOResult()]\n const lines: string[] = []\n for (const src of sources) {\n if (noClobber && (await exists(accessor, dst))) continue\n await diskRename(accessor, src, dst)\n if (verbose) lines.push(`'${src.original}' -> '${dst.original}'`)\n }\n const out = lines.length > 0 ? new TextEncoder().encode(lines.join('\\n') + '\\n') : null\n return [out, new IOResult()]\n}\n\nexport const DISK_MV = command({\n name: 'mv',\n resource: ResourceName.DISK,\n spec: specOf('mv'),\n fn: mvCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { rename as fsRename } from 'node:fs/promises'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function rename(accessor: DiskAccessor, src: PathSpec, dst: PathSpec): Promise<void> {\n const s = resolveSafe(accessor.root, src.stripPrefix)\n const d = resolveSafe(accessor.root, dst.stripPrefix)\n try {\n await fsRename(s, d)\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n throw new Error(`file or directory not found: ${src.stripPrefix}`)\n }\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction shouldNumber(line: string, bodyNumbering: string, pattern: RegExp | null): boolean {\n if (bodyNumbering === 'n') return false\n if (bodyNumbering === 'a') return true\n if (bodyNumbering === 'p' && pattern !== null) return pattern.test(line)\n return line.trim() !== ''\n}\n\nfunction padLeft(value: string, width: number): string {\n return value.length >= width ? value : ' '.repeat(width - value.length) + value\n}\n\ninterface NlOptions {\n bodyNumbering: string\n start: number\n increment: number\n width: number\n separator: string\n pattern: RegExp | null\n}\n\nasync function* nlStream(\n source: AsyncIterable<Uint8Array>,\n opts: NlOptions,\n): AsyncIterable<Uint8Array> {\n let num = opts.start\n const iter = new AsyncLineIterator(source)\n for await (const raw of iter) {\n const line = DEC.decode(raw)\n if (shouldNumber(line, opts.bodyNumbering, opts.pattern)) {\n yield ENC.encode(`${padLeft(String(num), opts.width)}${opts.separator}${line}\\n`)\n num += opts.increment\n } else {\n yield ENC.encode(`${' '.repeat(opts.width)}${opts.separator}${line}\\n`)\n }\n }\n}\n\nasync function* nlMulti(\n accessor: DiskAccessor,\n paths: readonly PathSpec[],\n opts: NlOptions,\n): AsyncIterable<Uint8Array> {\n for (const p of paths) {\n for await (const chunk of nlStream(diskStream(accessor, p), opts)) yield chunk\n }\n}\n\nfunction parseOptions(flags: Record<string, string | boolean>): NlOptions {\n const b = typeof flags.b === 'string' ? flags.b : 't'\n let bodyNumbering = b\n let pattern: RegExp | null = null\n if (b.startsWith('p')) {\n bodyNumbering = 'p'\n pattern = new RegExp(b.slice(1))\n }\n const parseIntFlag = (key: 'v' | 'i' | 'w', fallback: number): number =>\n typeof flags[key] === 'string' ? Number.parseInt(flags[key], 10) : fallback\n return {\n bodyNumbering,\n start: parseIntFlag('v', 1),\n increment: parseIntFlag('i', 1),\n width: parseIntFlag('w', 6),\n separator: typeof flags.s === 'string' ? flags.s : '\\t',\n pattern,\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function nlCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nlOpts = parseOptions(opts.flags)\n if (paths.length > 0) {\n return [nlMulti(accessor, paths, nlOpts), new IOResult()]\n }\n try {\n const source = resolveSource(opts.stdin, 'nl: missing operand')\n return [nlStream(source, nlOpts), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const DISK_NL = command({\n name: 'nl',\n resource: ResourceName.DISK,\n spec: specOf('nl'),\n fn: nlCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoEnds(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nasync function pasteCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const delimiter = typeof opts.flags.d === 'string' ? opts.flags.d : '\\t'\n const serial = opts.flags.s === true\n const fileLines: string[][] = []\n let stdinConsumed = false\n for (const p of paths) {\n if (p.original === '-') {\n const raw = stdinConsumed ? null : await readStdinAsync(opts.stdin)\n stdinConsumed = true\n fileLines.push(splitLinesNoEnds(raw !== null ? DEC.decode(raw) : ''))\n } else {\n const data = await materialize(diskStream(accessor, p))\n fileLines.push(splitLinesNoEnds(DEC.decode(data)))\n }\n }\n if (fileLines.length === 0 && !stdinConsumed) {\n const raw = await readStdinAsync(opts.stdin)\n if (raw !== null) fileLines.push(splitLinesNoEnds(DEC.decode(raw)))\n }\n if (fileLines.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('paste: missing operand\\n') })]\n }\n let outLines: string[]\n if (serial) {\n outLines = fileLines.map((lines) => lines.join(delimiter))\n } else {\n const maxLen = Math.max(...fileLines.map((l) => l.length))\n outLines = []\n for (let i = 0; i < maxLen; i++) {\n outLines.push(fileLines.map((lines) => lines[i] ?? '').join(delimiter))\n }\n }\n const out: ByteSource = ENC.encode(outLines.join('\\n') + '\\n')\n return [out, new IOResult()]\n}\n\nexport const DISK_PASTE = command({\n name: 'paste',\n resource: ResourceName.DISK,\n spec: specOf('paste'),\n fn: pasteCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ntype Hunk = [number, string[]]\n\nfunction stripPath(path: string, stripCount: number): string {\n const parts = path.split('/')\n if (stripCount < parts.length) return parts.slice(stripCount).join('/')\n return parts[parts.length - 1] ?? ''\n}\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nfunction applyHunks(\n originalLines: readonly string[],\n hunks: readonly Hunk[],\n forwardOnly: boolean,\n): string[] {\n // Walk through each hunk in order, tracking the output position as we go.\n // Each hunk's leading context copies lines verbatim from the original;\n // `-` drops a source line; `+` inserts; trailing context copies too.\n const result: string[] = []\n let srcIdx = 0\n for (const [startLine, hunkLines] of hunks) {\n const hunkStart = startLine - 1\n while (srcIdx < hunkStart && srcIdx < originalLines.length) {\n result.push(originalLines[srcIdx] ?? '')\n srcIdx += 1\n }\n if (forwardOnly) {\n const expected: string[] = []\n for (const hl of hunkLines) {\n if (hl.startsWith(' ') || hl.startsWith('-')) expected.push(hl.slice(1))\n }\n const actual = originalLines.slice(srcIdx, srcIdx + expected.length)\n let mismatch = expected.length !== actual.length\n if (!mismatch) {\n for (let i = 0; i < expected.length; i++) {\n if (expected[i] !== actual[i]) {\n mismatch = true\n break\n }\n }\n }\n if (mismatch) {\n // Skip this hunk, copy the lines it expected verbatim\n for (const _ of expected) {\n void _\n if (srcIdx < originalLines.length) {\n result.push(originalLines[srcIdx] ?? '')\n srcIdx += 1\n }\n }\n continue\n }\n }\n for (const hl of hunkLines) {\n if (hl.startsWith(' ')) {\n result.push(hl.slice(1))\n srcIdx += 1\n } else if (hl.startsWith('-')) {\n srcIdx += 1\n } else if (hl.startsWith('+')) {\n result.push(hl.slice(1))\n }\n }\n }\n while (srcIdx < originalLines.length) {\n result.push(originalLines[srcIdx] ?? '')\n srcIdx += 1\n }\n return result\n}\n\nfunction parsePatch(patchText: string, stripCount: number): Map<string, Hunk[]> {\n const files = new Map<string, Hunk[]>()\n let currentFile: string | null = null\n let currentHunks: Hunk[] = []\n let currentHunkLines: string[] = []\n let currentStart = 0\n\n for (const line of patchText.split('\\n')) {\n if (line.startsWith('--- ')) continue\n if (line.startsWith('+++ ')) {\n if (currentFile !== null && currentHunkLines.length > 0) {\n currentHunks.push([currentStart, currentHunkLines])\n }\n if (currentFile !== null) files.set(currentFile, currentHunks)\n const rawPath = (line.slice(4).split('\\t')[0] ?? '').trim()\n currentFile = '/' + stripPath(rawPath, stripCount).replace(/^\\/+/, '')\n currentHunks = []\n currentHunkLines = []\n continue\n }\n const m = /^@@ -(\\d+)/.exec(line)\n if (m !== null) {\n if (currentHunkLines.length > 0) {\n currentHunks.push([currentStart, currentHunkLines])\n }\n currentStart = Number.parseInt(m[1] ?? '0', 10)\n currentHunkLines = []\n continue\n }\n if (\n currentFile !== null &&\n (line.startsWith('+') || line.startsWith('-') || line.startsWith(' '))\n ) {\n currentHunkLines.push(line)\n }\n }\n\n if (currentFile !== null && currentHunkLines.length > 0) {\n currentHunks.push([currentStart, currentHunkLines])\n }\n if (currentFile !== null) files.set(currentFile, currentHunks)\n\n return files\n}\n\nasync function patchCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const stripCount = typeof opts.flags.p === 'string' ? Number.parseInt(opts.flags.p, 10) : 0\n const reverseMode = opts.flags.R === true\n const forwardOnly = opts.flags.N === true\n const iFlag = typeof opts.flags.i === 'string' ? opts.flags.i : null\n const mountPrefix = opts.mountPrefix ?? ''\n const stripMount = (p: string): string =>\n mountPrefix !== '' && p.startsWith(mountPrefix + '/')\n ? p.slice(mountPrefix.length)\n : p === mountPrefix\n ? '/'\n : p\n let patchData: Uint8Array | null = null\n if (iFlag !== null) {\n const resolved = stripMount(iFlag)\n const spec = new PathSpec({\n original: resolved,\n directory: resolved,\n resolved: true,\n prefix: mountPrefix,\n })\n patchData = await materialize(diskStream(accessor, spec))\n } else if (paths.length > 0) {\n const first = paths[0]\n if (first !== undefined) patchData = await materialize(diskStream(accessor, first))\n } else {\n patchData = await readStdinAsync(opts.stdin)\n }\n if (patchData === null || patchData.byteLength === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('patch: missing input\\n') })]\n }\n\n const patchText = DEC.decode(patchData)\n const fileHunks = parsePatch(patchText, stripCount)\n const writes: Record<string, Uint8Array> = {}\n\n for (const [filePath, hunks] of fileHunks) {\n let original = ''\n try {\n const spec = new PathSpec({ original: filePath, directory: filePath, resolved: true })\n original = DEC.decode(await materialize(diskStream(accessor, spec)))\n } catch (err) {\n if (!(err instanceof Error) || !/not found/i.test(err.message)) throw err\n }\n const originalLines = splitLinesNoTrailing(original)\n\n let effective = hunks\n if (reverseMode) {\n const reversed: Hunk[] = []\n for (const [start, hunkLines] of hunks) {\n const reversedLines: string[] = []\n for (const hl of hunkLines) {\n if (hl.startsWith('+')) reversedLines.push('-' + hl.slice(1))\n else if (hl.startsWith('-')) reversedLines.push('+' + hl.slice(1))\n else reversedLines.push(hl)\n }\n reversed.push([start, reversedLines])\n }\n effective = reversed\n }\n\n const patched = applyHunks(originalLines, effective, forwardOnly)\n const patchedData = ENC.encode(patched.join('\\n') + '\\n')\n await diskWrite(accessor, makePathSpec(filePath), patchedData)\n writes[filePath] = patchedData\n }\n\n return [null, new IOResult({ writes })]\n}\n\nexport const DISK_PATCH = command({\n name: 'patch',\n resource: ResourceName.DISK,\n spec: specOf('patch'),\n fn: patchCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type Accessor,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\n\nconst ENC = new TextEncoder()\n\nfunction normPath(p: string): string {\n const parts = p.split('/')\n const out: string[] = []\n for (const seg of parts) {\n if (seg === '' || seg === '.') continue\n if (seg === '..') {\n if (out.length > 0) out.pop()\n continue\n }\n out.push(seg)\n }\n const leading = p.startsWith('/') ? '/' : ''\n return leading + out.join('/') || (leading !== '' ? '/' : '.')\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function readlinkCommand(\n _accessor: Accessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('readlink: missing operand\\n') })]\n }\n const normalize = opts.flags.f === true || opts.flags.e === true || opts.flags.m === true\n const noNewline = opts.flags.n === true\n const results: string[] = []\n for (const p of paths) {\n let vp = p.prefix !== '' ? p.prefix + '/' + p.original.replace(/^\\/+/, '') : p.original\n if (normalize) vp = normPath(vp)\n results.push(vp)\n }\n let text = results.join('\\n')\n if (!noNewline) text += '\\n'\n const out: ByteSource = ENC.encode(text)\n return [out, new IOResult()]\n}\n\nexport const DISK_READLINK = command({\n name: 'readlink',\n resource: ResourceName.DISK,\n spec: specOf('readlink'),\n fn: readlinkCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { stat as diskStat } from '../../../core/disk/stat.ts'\n\nfunction normalize(p: string, cwd: string): string {\n const path = p.startsWith('/') ? p : `${cwd.replace(/\\/+$/, '')}/${p}`\n const parts = path.split('/').filter((s) => s !== '' && s !== '.')\n const out: string[] = []\n for (const part of parts) {\n if (part === '..') out.pop()\n else out.push(part)\n }\n return '/' + out.join('/')\n}\n\nasync function existsDisk(accessor: DiskAccessor, p: PathSpec): Promise<boolean> {\n try {\n await diskStat(accessor, p)\n return true\n } catch {\n return false\n }\n}\n\nasync function realpathCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const requireExists = opts.flags.e === true\n const lines: string[] = []\n if (paths.length > 0) {\n for (const p of paths) {\n if (requireExists && !(await existsDisk(accessor, p))) {\n throw new Error(`realpath: '${p.original}': No such file or directory`)\n }\n lines.push(normalize(p.original, opts.cwd))\n }\n } else {\n for (const t of texts) lines.push(normalize(t, opts.cwd))\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n') + '\\n')\n return [out, new IOResult()]\n}\n\nexport const DISK_REALPATH = command({\n name: 'realpath',\n resource: ResourceName.DISK,\n spec: specOf('realpath'),\n fn: realpathCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction reverseString(s: string): string {\n return Array.from(s).reverse().join('')\n}\n\nasync function* revStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n const iter = new AsyncLineIterator(source)\n for await (const line of iter) {\n yield ENC.encode(reverseString(DEC.decode(line)) + '\\n')\n }\n}\n\nasync function* revMulti(\n accessor: DiskAccessor,\n paths: readonly PathSpec[],\n): AsyncIterable<Uint8Array> {\n for (const p of paths) {\n for await (const chunk of revStream(diskStream(accessor, p))) yield chunk\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function revCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length > 0) {\n return [revMulti(accessor, paths), new IOResult()]\n }\n try {\n const source = resolveSource(opts.stdin, 'rev: missing operand')\n return [revStream(source), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const DISK_REV = command({\n name: 'rev',\n resource: ResourceName.DISK,\n spec: specOf('rev'),\n fn: revCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n compilePattern,\n exitOnEmpty,\n grepStream,\n materialize,\n resolveSource,\n rgFolderFiletype,\n rgFull,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type FileStat,\n} from '@struktoai/mirage-core'\nimport { readdir as diskReaddir } from '../../../core/disk/readdir.ts'\nimport { stat as diskStat } from '../../../core/disk/stat.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { find as diskFind } from '../../../core/disk/find.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\nimport { grepImpl } from './grep/grep.ts'\n\nconst ENC = new TextEncoder()\n\ninterface RgFlags {\n ignoreCase: boolean\n invert: boolean\n lineNumbers: boolean\n countOnly: boolean\n filesOnly: boolean\n wholeWord: boolean\n fixedString: boolean\n onlyMatching: boolean\n maxCount: number | null\n afterContext: number\n beforeContext: number\n fileType: string | null\n globPattern: string | null\n hidden: boolean\n}\n\nfunction parseRgFlags(flags: Record<string, string | boolean>): RgFlags {\n const toInt = (v: string | boolean | undefined): number | null =>\n typeof v === 'string' ? Number.parseInt(v, 10) : null\n const a = toInt(flags.A)\n const b = toInt(flags.B)\n const c = toInt(flags.C)\n return {\n ignoreCase: flags.i === true,\n invert: flags.v === true,\n lineNumbers: flags.n === true,\n countOnly: flags.c === true,\n filesOnly: flags.args_l === true,\n wholeWord: flags.w === true,\n fixedString: flags.F === true,\n onlyMatching: flags.o === true,\n maxCount: toInt(flags.m),\n afterContext: a ?? c ?? 0,\n beforeContext: b ?? c ?? 0,\n fileType: typeof flags.type === 'string' ? flags.type : null,\n globPattern: typeof flags.glob === 'string' ? flags.glob : null,\n hidden: flags.hidden === true,\n }\n}\n\nasync function rgCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const [exprText] = texts\n if (exprText === undefined) {\n return [\n null,\n new IOResult({ exitCode: 2, stderr: ENC.encode('rg: usage: rg [flags] pattern [path]\\n') }),\n ]\n }\n const flags = parseRgFlags(opts.flags)\n const [first] = paths\n\n if (first === undefined) {\n // stdin mode\n const source = resolveSource(opts.stdin, 'rg: usage: rg [flags] pattern [path]')\n const pat = compilePattern(exprText, flags.ignoreCase, flags.fixedString, flags.wholeWord)\n const stream = grepStream(source, pat, {\n invert: flags.invert,\n lineNumbers: flags.lineNumbers,\n countOnly: flags.countOnly,\n onlyMatching: flags.onlyMatching,\n maxCount: flags.maxCount,\n afterContext: flags.afterContext,\n beforeContext: flags.beforeContext,\n })\n const io = new IOResult()\n return [exitOnEmpty(stream, io), io]\n }\n\n // Detect directory vs file\n let isDir = false\n try {\n const s = await diskStat(accessor, first)\n isDir = s.type === FileType.DIRECTORY\n } catch {\n try {\n await diskReaddir(accessor, first)\n isDir = true\n } catch {\n // not readable\n }\n }\n\n if (isDir && opts.filetypeFns !== null && Object.keys(opts.filetypeFns).length > 0) {\n // Directory recursion with filetype-specific extraction\n const readdirFn = async (p: string): Promise<string[]> => {\n const keys = await diskFind(accessor, makeSpec(p, first), { type: null })\n return keys\n }\n const statFn = (p: string): Promise<FileStat> => diskStat(accessor, makeSpec(p, first))\n const readBytesFn = (p: string): Promise<Uint8Array> =>\n materialize(diskStream(accessor, makeSpec(p, first)))\n const warnings: string[] = []\n const results = await rgFolderFiletype(\n readdirFn,\n statFn,\n readBytesFn,\n first.original,\n exprText,\n {},\n {\n ignoreCase: flags.ignoreCase,\n invert: flags.invert,\n lineNumbers: flags.lineNumbers,\n countOnly: flags.countOnly,\n filesOnly: flags.filesOnly,\n onlyMatching: flags.onlyMatching,\n maxCount: flags.maxCount,\n fixedString: flags.fixedString,\n wholeWord: flags.wholeWord,\n fileType: flags.fileType,\n globPattern: flags.globPattern,\n hidden: flags.hidden,\n },\n warnings,\n )\n const stderr = warnings.length > 0 ? ENC.encode(warnings.join('\\n')) : undefined\n if (results.length === 0) {\n const io = new IOResult({ exitCode: 1, ...(stderr !== undefined ? { stderr } : {}) })\n return [new Uint8Array(0), io]\n }\n const out: ByteSource = ENC.encode(results.join('\\n'))\n const io = new IOResult(stderr !== undefined ? { stderr } : {})\n return [out, io]\n }\n\n const needsFull =\n flags.filesOnly ||\n flags.beforeContext > 0 ||\n flags.afterContext > 0 ||\n flags.fileType !== null ||\n flags.globPattern !== null\n if (needsFull) {\n const readdirFn = async (p: string): Promise<string[]> => {\n const keys = await diskFind(accessor, makeSpec(p, first), { type: null })\n return keys\n }\n const statFn = (p: string): Promise<FileStat> => diskStat(accessor, makeSpec(p, first))\n const readBytesFn = (p: string): Promise<Uint8Array> =>\n materialize(diskStream(accessor, makeSpec(p, first)))\n const warnings: string[] = []\n const results = await rgFull(\n readdirFn,\n statFn,\n readBytesFn,\n first.original,\n exprText,\n {\n ignoreCase: flags.ignoreCase,\n invert: flags.invert,\n lineNumbers: flags.lineNumbers,\n countOnly: flags.countOnly,\n filesOnly: flags.filesOnly,\n fixedString: flags.fixedString,\n onlyMatching: flags.onlyMatching,\n maxCount: flags.maxCount,\n wholeWord: flags.wholeWord,\n contextBefore: flags.beforeContext,\n contextAfter: flags.afterContext,\n fileType: flags.fileType,\n globPattern: flags.globPattern,\n hidden: flags.hidden,\n },\n warnings,\n )\n const stderr = warnings.length > 0 ? ENC.encode(warnings.join('\\n')) : undefined\n if (results.length === 0) {\n const io = new IOResult({ exitCode: 1, ...(stderr !== undefined ? { stderr } : {}) })\n return [new Uint8Array(0), io]\n }\n const out: ByteSource = ENC.encode(results.join('\\n'))\n const io = new IOResult(stderr !== undefined ? { stderr } : {})\n return [out, io]\n }\n\n // Fall back to single-file grep semantics for plain file mode.\n return grepImpl('rg', accessor, paths, texts, opts)\n}\n\nfunction makeSpec(path: string, template: PathSpec): PathSpec {\n // Reuse prefix from the first scope so downstream fs helpers treat the\n // absolute path as a normal mount-relative path.\n return new PathSpec({\n original: path,\n directory: path,\n resolved: false,\n prefix: template.prefix,\n })\n}\n\nexport const DISK_RG = command({\n name: 'rg',\n resource: ResourceName.DISK,\n spec: specOf('rg'),\n fn: rgCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { rmdir as diskRmdir } from '../../../core/disk/rmdir.ts'\nimport { stat as diskStat } from '../../../core/disk/stat.ts'\nimport { unlink as diskUnlink } from '../../../core/disk/unlink.ts'\nimport { rmR as diskRmR } from '../../../core/disk/rm.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nasync function rmCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('rm: missing operand\\n'),\n }),\n ]\n }\n const recursive = opts.flags.r === true || opts.flags.R === true\n const force = opts.flags.f === true\n const verbose = opts.flags.v === true\n const lines: string[] = []\n for (const p of paths) {\n let isDir = false\n try {\n const st = await diskStat(accessor, p)\n isDir = st.type === FileType.DIRECTORY\n } catch {\n if (force) continue\n throw new Error(`rm: cannot remove '${p.original}': No such file or directory`)\n }\n if (isDir) {\n if (recursive) {\n await diskRmR(accessor, p)\n } else {\n await diskRmdir(accessor, p)\n }\n } else {\n await diskUnlink(accessor, p)\n }\n if (verbose) lines.push(`removed '${p.original}'`)\n }\n const out = lines.length > 0 ? new TextEncoder().encode(lines.join('\\n')) : null\n return [out, new IOResult()]\n}\n\nexport const DISK_RM = command({\n name: 'rm',\n resource: ResourceName.DISK,\n spec: specOf('rm'),\n fn: rmCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { rmdir as fsRmdir } from 'node:fs/promises'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function rmdir(accessor: DiskAccessor, path: PathSpec): Promise<void> {\n const full = resolveSafe(accessor.root, path.stripPrefix)\n try {\n await fsRmdir(full)\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return\n throw err\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { rm } from 'node:fs/promises'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function rmR(accessor: DiskAccessor, path: PathSpec): Promise<void> {\n const full = resolveSafe(accessor.root, path.stripPrefix)\n await rm(full, { recursive: true, force: true })\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n executeProgram,\n materialize,\n parseOneCommand,\n parseProgram,\n readStdinAsync,\n specOf,\n translateReplacement,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type SedCommand,\n} from '@struktoai/mirage-core'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function readFile(accessor: DiskAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(diskStream(accessor, p))\n}\n\nasync function sedCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const script = texts[0]\n if (script === undefined) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('sed: missing script\\n') })]\n }\n const suppress = opts.flags.n === true\n const inPlace = opts.flags.i === true\n let commands: SedCommand[]\n try {\n if (script.includes(';') || script.includes('{')) {\n commands = parseProgram(script)\n } else {\n commands = [parseOneCommand(script)[0]]\n }\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const first = commands[0]\n const isSimpleSub =\n commands.length === 1 &&\n first?.cmd === 's' &&\n (first.addrStart === null || first.addrStart === undefined) &&\n !suppress\n\n if (paths.length > 0) {\n if (isSimpleSub) {\n const pat = first.pattern ?? ''\n const repl = translateReplacement(first.replacement ?? '')\n const ef = first.exprFlags ?? ''\n const ignoreCase = ef.includes('i')\n const global = ef.includes('g')\n const flags = (ignoreCase ? 'i' : '') + (global ? 'g' : '')\n if (inPlace) {\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const data = await readFile(accessor, p)\n const text = DEC.decode(data)\n const newText = text.replace(new RegExp(pat, flags), repl)\n const newData = ENC.encode(newText)\n await diskWrite(accessor, p, newData)\n writes[p.stripPrefix] = newData\n }\n return [null, new IOResult({ writes, cache: paths.map((p) => p.stripPrefix) })]\n }\n const outputs: string[] = []\n for (const p of paths) {\n const data = await readFile(accessor, p)\n const text = DEC.decode(data)\n outputs.push(text.replace(new RegExp(pat, flags), repl))\n }\n const out: ByteSource = ENC.encode(outputs.join(''))\n return [out, new IOResult({ cache: paths.map((p) => p.stripPrefix) })]\n }\n\n const modifying = inPlace && commands.some((c) => c.cmd === 's' || c.cmd === 'd')\n const allOutputs: string[] = []\n const writes: Record<string, Uint8Array> = {}\n for (const p of paths) {\n const data = await readFile(accessor, p)\n const text = DEC.decode(data)\n const result = executeProgram(text, commands, suppress)\n if (modifying) {\n const newData = ENC.encode(result)\n await diskWrite(accessor, p, newData)\n writes[p.stripPrefix] = newData\n } else {\n allOutputs.push(result)\n }\n }\n if (modifying) {\n return [null, new IOResult({ writes, cache: paths.map((p) => p.stripPrefix) })]\n }\n const out: ByteSource = ENC.encode(allOutputs.join('\\n'))\n return [out, new IOResult()]\n }\n\n const raw = await readStdinAsync(opts.stdin)\n if (raw === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('sed: missing operand\\n') })]\n }\n const text = DEC.decode(raw)\n const result = executeProgram(text, commands, suppress)\n return [ENC.encode(result), new IOResult()]\n}\n\nexport const DISK_SED = command({\n name: 'sed',\n resource: ResourceName.DISK,\n spec: specOf('sed'),\n fn: sedCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n materialize,\n resolveSource,\n sha256Hex,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function hashStream(source: AsyncIterable<Uint8Array>): Promise<string> {\n const data = await materialize(source)\n return sha256Hex(data)\n}\n\nasync function* sha256SingleStream(\n source: AsyncIterable<Uint8Array>,\n label: string,\n): AsyncIterable<Uint8Array> {\n const digest = await hashStream(source)\n yield ENC.encode(`${digest} ${label}\\n`)\n}\n\nasync function* sha256Multi(\n accessor: DiskAccessor,\n paths: readonly PathSpec[],\n): AsyncIterable<Uint8Array> {\n for (const p of paths) {\n const digest = await hashStream(diskStream(accessor, p))\n yield ENC.encode(`${digest} ${p.stripPrefix}\\n`)\n }\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function sha256Check(accessor: DiskAccessor, p: PathSpec): Promise<[Uint8Array, number]> {\n const data = DEC.decode(await materialize(diskStream(accessor, p)))\n const lines: string[] = []\n let failed = false\n for (const line of data.split('\\n')) {\n if (line.trim() === '') continue\n const idx = line.indexOf(' ')\n if (idx < 0) continue\n const expected = line.slice(0, idx)\n const filename = line.slice(idx + 2)\n const digest = await hashStream(diskStream(accessor, makePathSpec(filename)))\n if (digest === expected) lines.push(`${filename}: OK`)\n else {\n lines.push(`${filename}: FAILED`)\n failed = true\n }\n }\n return [ENC.encode(lines.join('\\n') + '\\n'), failed ? 1 : 0]\n}\n\nasync function sha256sumCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const check = opts.flags.c === true\n if (check && paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const [out, exitCode] = await sha256Check(accessor, first)\n const result: ByteSource = out\n return [result, new IOResult({ exitCode })]\n }\n if (paths.length > 0) {\n return [sha256Multi(accessor, paths), new IOResult({ cache: paths.map((p) => p.stripPrefix) })]\n }\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'sha256sum: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n return [sha256SingleStream(source, '-'), new IOResult()]\n}\n\nexport const RAM_SHA256SUM = command({\n name: 'sha256sum',\n resource: ResourceName.DISK,\n spec: specOf('sha256sum'),\n fn: sha256sumCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\nfunction shuffleInPlace(arr: string[]): void {\n for (let i = arr.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1))\n const tmp = arr[i] ?? ''\n arr[i] = arr[j] ?? ''\n arr[j] = tmp\n }\n}\n\nfunction choicesWithReplacement(items: readonly string[], k: number): string[] {\n if (items.length === 0) return []\n const out: string[] = []\n for (let i = 0; i < k; i++) {\n out.push(items[Math.floor(Math.random() * items.length)] ?? '')\n }\n return out\n}\n\nasync function shufCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nFlag = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : null\n const echoMode = opts.flags.e === true\n const zeroSep = opts.flags.z === true\n const repeat = opts.flags.r === true\n const sep = zeroSep ? '\\x00' : '\\n'\n\n const processItems = (items: string[]): string[] => {\n if (repeat) {\n const count = nFlag ?? items.length\n return choicesWithReplacement(items, count)\n }\n shuffleInPlace(items)\n if (nFlag !== null) return items.slice(0, nFlag)\n return items\n }\n\n if (echoMode) {\n const base = paths.length > 0 ? paths.map((p) => p.stripPrefix) : [...texts]\n const out = processItems(base)\n const result: ByteSource = ENC.encode(out.join(sep) + sep)\n return [result, new IOResult()]\n }\n\n if (paths.length > 0) {\n const allLines: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(diskStream(accessor, p)))\n if (zeroSep) for (const l of data.split('\\x00')) allLines.push(l)\n else for (const l of splitLinesNoTrailing(data)) allLines.push(l)\n }\n const out = processItems(allLines)\n const result: ByteSource = ENC.encode(out.join(sep) + sep)\n return [result, new IOResult()]\n }\n\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('shuf: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const lines = zeroSep ? text.split('\\x00') : splitLinesNoTrailing(text)\n const out = processItems(lines)\n const result: ByteSource = ENC.encode(out.join(sep) + sep)\n return [result, new IOResult()]\n}\n\nexport const DISK_SHUF = command({\n name: 'shuf',\n resource: ResourceName.DISK,\n spec: specOf('shuf'),\n fn: shufCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n compareKeys,\n materialize,\n readStdinAsync,\n sortKey,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n type SortKeyOptions,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction parseKeyOptions(flags: Record<string, string | boolean>): SortKeyOptions {\n return {\n keyField: typeof flags.k === 'string' ? Number.parseInt(flags.k, 10) : null,\n fieldSep: typeof flags.t === 'string' ? flags.t : null,\n ignoreCase: flags.f === true,\n numeric: flags.n === true,\n humanNumeric: flags.h === true,\n version: flags.V === true,\n month: flags.M === true,\n }\n}\n\nfunction sortAndDedupe(\n lines: string[],\n opts: SortKeyOptions,\n reverse: boolean,\n unique: boolean,\n): string[] {\n const keyed = lines.map((l) => ({ l, k: sortKey(l, opts) }))\n keyed.sort((a, b) => compareKeys(a.k, b.k))\n let sorted = keyed.map((x) => x.l)\n if (reverse) sorted.reverse()\n if (unique) {\n const seen = new Set<string>()\n sorted = sorted.filter((l) => {\n if (seen.has(l)) return false\n seen.add(l)\n return true\n })\n }\n return sorted\n}\n\nfunction splitLinesNoEnds(text: string): string[] {\n if (text === '') return []\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped.split('\\n')\n}\n\nasync function readFile(accessor: DiskAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(diskStream(accessor, p))\n}\n\nasync function sortCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const keyOpts = parseKeyOptions(opts.flags)\n const reverse = opts.flags.r === true\n const unique = opts.flags.u === true\n let allLines: string[] = []\n if (paths.length > 0) {\n for (const p of paths) {\n const data = DEC.decode(await readFile(accessor, p))\n allLines = allLines.concat(splitLinesNoEnds(data))\n }\n } else {\n const raw = await readStdinAsync(opts.stdin)\n if (raw === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('sort: missing operand\\n') })]\n }\n allLines = splitLinesNoEnds(DEC.decode(raw))\n }\n const sorted = sortAndDedupe(allLines, keyOpts, reverse, unique)\n const output = sorted.join('\\n')\n const out: ByteSource = output === '' ? new Uint8Array(0) : ENC.encode(output + '\\n')\n return [out, new IOResult()]\n}\n\nexport const DISK_SORT = command({\n name: 'sort',\n resource: ResourceName.DISK,\n spec: specOf('sort'),\n fn: sortCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nfunction alphaSuffix(index: number, length: number): string {\n const chars: string[] = []\n let n = index\n for (let i = 0; i < length; i++) {\n chars.push(String.fromCharCode('a'.charCodeAt(0) + (n % 26)))\n n = Math.floor(n / 26)\n }\n return chars.reverse().join('')\n}\n\nfunction numericSuffix(index: number, length: number): string {\n const s = String(index)\n return s.length >= length ? s : '0'.repeat(length - s.length) + s\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function splitCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const prefixPath = paths.length >= 2 && paths[1] !== undefined ? paths[1].stripPrefix : 'x'\n const linesFlag = typeof opts.flags.l === 'string' ? opts.flags.l : null\n const bFlag = typeof opts.flags.b === 'string' ? opts.flags.b : null\n const nFlag = typeof opts.flags.n === 'string' ? opts.flags.n : null\n const aFlag = typeof opts.flags.a === 'string' ? opts.flags.a : null\n const dFlag = opts.flags.d === true\n const linesPerFile =\n linesFlag !== null\n ? Number.parseInt(linesFlag, 10)\n : bFlag === null && nFlag === null\n ? 1000\n : 0\n const byteLimit = bFlag !== null ? Number.parseInt(bFlag, 10) : 0\n const nChunks = nFlag !== null ? Number.parseInt(nFlag, 10) : 0\n const suffixLen = aFlag !== null ? Number.parseInt(aFlag, 10) : 2\n const suffixFn = dFlag ? numericSuffix : alphaSuffix\n\n let source: AsyncIterable<Uint8Array>\n const first = paths[0]\n if (first !== undefined) {\n source = diskStream(accessor, first)\n } else {\n try {\n source = resolveSource(opts.stdin, 'split: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n\n const writes: Record<string, Uint8Array> = {}\n let fileIdx = 0\n\n if (nChunks > 0) {\n const chunks: Uint8Array[] = []\n let total = 0\n for await (const c of source) {\n chunks.push(c)\n total += c.byteLength\n }\n const allData = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n allData.set(c, offset)\n offset += c.byteLength\n }\n const chunkSize = Math.max(1, Math.ceil(total / nChunks))\n offset = 0\n for (let i = 0; i < nChunks; i++) {\n const part = allData.slice(offset, offset + chunkSize)\n if (part.byteLength === 0) break\n const outPath = prefixPath + suffixFn(i, suffixLen)\n await diskWrite(accessor, makePathSpec(outPath), part)\n writes[outPath] = part\n offset += chunkSize\n }\n } else if (byteLimit > 0) {\n let buf = new Uint8Array(0)\n for await (const c of source) {\n const merged = new Uint8Array(buf.byteLength + c.byteLength)\n merged.set(buf, 0)\n merged.set(c, buf.byteLength)\n buf = merged\n while (buf.byteLength >= byteLimit) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n const data = buf.slice(0, byteLimit)\n await diskWrite(accessor, makePathSpec(outPath), data)\n writes[outPath] = data\n buf = buf.slice(byteLimit)\n fileIdx += 1\n }\n }\n if (buf.byteLength > 0) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n await diskWrite(accessor, makePathSpec(outPath), buf)\n writes[outPath] = buf\n }\n } else {\n const lineBuf: Uint8Array[] = []\n const iter = new AsyncLineIterator(source)\n for await (const line of iter) {\n lineBuf.push(line)\n if (lineBuf.length >= linesPerFile) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n const data = joinLines(lineBuf)\n await diskWrite(accessor, makePathSpec(outPath), data)\n writes[outPath] = data\n lineBuf.length = 0\n fileIdx += 1\n }\n }\n if (lineBuf.length > 0) {\n const outPath = prefixPath + suffixFn(fileIdx, suffixLen)\n const data = joinLines(lineBuf)\n await diskWrite(accessor, makePathSpec(outPath), data)\n writes[outPath] = data\n }\n }\n return [null, new IOResult({ writes })]\n}\n\nfunction joinLines(lines: readonly Uint8Array[]): Uint8Array {\n let total = 0\n for (const l of lines) total += l.byteLength + 1\n const out = new Uint8Array(total)\n let offset = 0\n for (const l of lines) {\n out.set(l, offset)\n offset += l.byteLength\n out[offset] = 0x0a\n offset += 1\n }\n return out\n}\n\nexport const DISK_SPLIT = command({\n name: 'split',\n resource: ResourceName.DISK,\n spec: specOf('split'),\n fn: splitCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n ProvisionResult,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type FileStat,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stat as diskStat } from '../../../../core/disk/stat.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst TYPE_LABELS: Record<string, string> = {\n [FileType.DIRECTORY]: 'directory',\n [FileType.TEXT]: 'regular file',\n [FileType.BINARY]: 'regular file',\n [FileType.JSON]: 'regular file',\n [FileType.CSV]: 'regular file',\n}\n\nfunction formatStat(fmt: string, s: FileStat): string {\n return fmt.replace(/%(.)/g, (_, spec: string) => {\n if (spec === 'n') return s.name\n if (spec === 's') return String(s.size ?? 0)\n if (spec === 'F') return s.type ? (TYPE_LABELS[s.type] ?? 'regular file') : 'regular file'\n if (spec === 'y') return s.modified ?? ''\n return '?'\n })\n}\n\nexport function statProvision(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): ProvisionResult {\n const [first] = paths\n return new ProvisionResult({\n command: first !== undefined ? `stat ${first.original}` : 'stat',\n })\n}\n\nasync function statCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: new TextEncoder().encode('stat: missing operand\\n'),\n }),\n ]\n }\n const fmt =\n typeof opts.flags.c === 'string'\n ? opts.flags.c\n : typeof opts.flags.f === 'string'\n ? opts.flags.f\n : null\n const lines: string[] = []\n for (const p of paths) {\n const s = await diskStat(accessor, p)\n if (fmt !== null) {\n lines.push(formatStat(fmt, s))\n } else {\n const sizeStr = s.size === null ? 'None' : String(s.size)\n const modStr = s.modified ?? 'None'\n const typeStr = s.type ?? 'None'\n lines.push(`name=${s.name} size=${sizeStr} modified=${modStr} type=${typeStr}`)\n }\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const DISK_STAT = command({\n name: 'stat',\n resource: ResourceName.DISK,\n spec: specOf('stat'),\n fn: statCommand,\n provision: statProvision,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n featherStat,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statFeatherCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = featherStat(raw)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_STAT_FEATHER = command({\n name: 'stat',\n resource: ResourceName.DISK,\n spec: specOf('stat'),\n filetype: '.feather',\n fn: statFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n hdf5Stat,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statHdf5Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = await hdf5Stat(raw)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_STAT_HDF5 = command({\n name: 'stat',\n resource: ResourceName.DISK,\n spec: specOf('stat'),\n filetype: '.h5',\n fn: statHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n parquetStat,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function statParquetCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('stat: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const out: ByteSource = parquetStat(raw)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`stat: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_STAT_PARQUET = command({\n name: 'stat',\n resource: ResourceName.DISK,\n spec: specOf('stat'),\n filetype: '.parquet',\n fn: statParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nfunction extractStrings(data: Uint8Array, minLen: number): string[] {\n const out: string[] = []\n let current: number[] = []\n for (let i = 0; i < data.byteLength; i++) {\n const b = data[i] ?? 0\n if (b >= 0x20 && b <= 0x7e) {\n current.push(b)\n } else {\n if (current.length >= minLen) {\n out.push(String.fromCharCode(...current))\n }\n current = []\n }\n }\n if (current.length >= minLen) {\n out.push(String.fromCharCode(...current))\n }\n return out\n}\n\nasync function stringsCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const minLen = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 4\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(diskStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('strings: missing input\\n') })]\n }\n raw = stdinData\n }\n const matches = extractStrings(raw, minLen)\n const output = matches.length > 0 ? matches.join('\\n') + '\\n' : ''\n const result: ByteSource = ENC.encode(output)\n return [result, new IOResult()]\n}\n\nexport const DISK_STRINGS = command({\n name: 'strings',\n resource: ResourceName.DISK,\n spec: specOf('strings'),\n fn: stringsCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function collectLines(source: AsyncIterable<Uint8Array>): Promise<Uint8Array[]> {\n const lines: Uint8Array[] = []\n const iter = new AsyncLineIterator(source)\n for await (const line of iter) lines.push(line)\n return lines\n}\n\nasync function tacCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = diskStream(accessor, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'tac: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const lines = await collectLines(source)\n lines.reverse()\n let total = 0\n for (const l of lines) total += l.byteLength + 1\n const out = new Uint8Array(total)\n let offset = 0\n for (const l of lines) {\n out.set(l, offset)\n offset += l.byteLength\n out[offset] = 0x0a\n offset += 1\n }\n const result: ByteSource = out\n return [result, new IOResult({ cache })]\n}\n\nexport const DISK_TAC = command({\n name: 'tac',\n resource: ResourceName.DISK,\n spec: specOf('tac'),\n fn: tacCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n countNewlines,\n headerAggregate,\n materialize,\n parseN,\n readStdinAsync,\n specOf,\n tailBytes,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function readFile(accessor: DiskAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(diskStream(accessor, p))\n}\n\nasync function tailCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const nRaw = typeof opts.flags.n === 'string' ? opts.flags.n : null\n const cRaw = typeof opts.flags.c === 'string' ? opts.flags.c : null\n const qFlag = opts.flags.q === true\n const vFlag = opts.flags.v === true\n const [lines, plusMode] = parseN(nRaw)\n const bytesMode = cRaw !== null ? Number.parseInt(cRaw, 10) : null\n\n if (paths.length > 0) {\n const chunks: Uint8Array[] = []\n const cache: string[] = []\n const showHeaders = (vFlag || paths.length > 1) && !qFlag\n for (let i = 0; i < paths.length; i++) {\n const p = paths[i]\n if (p === undefined) continue\n const raw = await readFile(accessor, p)\n if (showHeaders) {\n const header = i > 0 ? `\\n==> ${p.original} <==\\n` : `==> ${p.original} <==\\n`\n chunks.push(ENC.encode(header))\n }\n if (bytesMode !== null) {\n chunks.push(bytesMode === 0 ? new Uint8Array(0) : raw.slice(-bytesMode))\n if (bytesMode >= raw.byteLength) cache.push(p.original)\n } else {\n chunks.push(tailBytes(raw, lines, null, plusMode))\n if (!plusMode && lines >= countNewlines(raw)) cache.push(p.original)\n }\n }\n const out: ByteSource = concat(chunks)\n return [out, new IOResult({ cache })]\n }\n const raw = await readStdinAsync(opts.stdin)\n if (raw === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n if (bytesMode !== null) {\n const out: ByteSource = bytesMode === 0 ? new Uint8Array(0) : raw.slice(-bytesMode)\n return [out, new IOResult()]\n }\n return [tailBytes(raw, lines, null, plusMode), new IOResult()]\n}\n\nfunction concat(chunks: Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nexport const DISK_TAIL = command({\n name: 'tail',\n resource: ResourceName.DISK,\n spec: specOf('tail'),\n fn: tailCommand,\n aggregate: headerAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n featherTail,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailFeatherCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = featherTail(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_TAIL_FEATHER = command({\n name: 'tail',\n resource: ResourceName.DISK,\n spec: specOf('tail'),\n filetype: '.feather',\n fn: tailFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n hdf5Tail,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailHdf5Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await hdf5Tail(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_TAIL_HDF5 = command({\n name: 'tail',\n resource: ResourceName.DISK,\n spec: specOf('tail'),\n filetype: '.h5',\n fn: tailHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n parquetTail,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function tailParquetCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tail: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const n = typeof opts.flags.n === 'string' ? Number.parseInt(opts.flags.n, 10) : 10\n try {\n const raw = await materialize(diskStream(accessor, first))\n const result = await parquetTail(raw, n)\n const out: ByteSource = result\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`tail: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_TAIL_PARQUET = command({\n name: 'tail',\n resource: ResourceName.DISK,\n spec: specOf('tail'),\n filetype: '.parquet',\n fn: tailParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n gunzip,\n gzip,\n materialize,\n readTar,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type TarEntry,\n writeTar,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { mkdir as diskMkdir } from '../../../core/disk/mkdir.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nfunction makePathSpec(original: string, prefix: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true, prefix })\n}\n\nfunction fnmatch(name: string, pattern: string): boolean {\n let re = '^'\n for (const ch of pattern) {\n if (ch === '*') re += '.*'\n else if (ch === '?') re += '.'\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += '\\\\' + ch\n else re += ch\n }\n re += '$'\n return new RegExp(re).test(name)\n}\n\nfunction hasGzipMagic(data: Uint8Array): boolean {\n return data.byteLength >= 2 && data[0] === 0x1f && data[1] === 0x8b\n}\n\nasync function decompress(data: Uint8Array, z: boolean): Promise<Uint8Array> {\n if (z || hasGzipMagic(data)) return gunzip(data)\n return data\n}\n\nasync function tarCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const create = opts.flags.c === true\n const extract = opts.flags.x === true\n const list = opts.flags.t === true\n const z = opts.flags.z === true\n const verbose = opts.flags.v === true\n // -j (bzip2) / -J (xz) are not supported: Node's stdlib only ships gzip/deflate.\n if (opts.flags.j === true || opts.flags.J === true) {\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tar: bzip2/xz not supported\\n') }),\n ]\n }\n const fFlag = typeof opts.flags.f === 'string' ? opts.flags.f : null\n const CFlag = typeof opts.flags.C === 'string' ? opts.flags.C : null\n const stripN =\n typeof opts.flags.strip_components === 'string'\n ? Number.parseInt(opts.flags.strip_components, 10)\n : 0\n const exclude = typeof opts.flags.exclude === 'string' ? opts.flags.exclude : null\n const mountPrefix = opts.mountPrefix ?? ''\n const archivePath = fFlag\n const destPath = CFlag ?? '/'\n const verboseLines: string[] = []\n\n if (create) {\n if (archivePath === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tar: -f is required\\n') })]\n }\n const filtered =\n exclude !== null\n ? paths.filter((p) => {\n const name = p.original.split('/').pop() ?? ''\n return !fnmatch(name, exclude)\n })\n : paths\n const entries: TarEntry[] = []\n for (const p of filtered) {\n const data = await materialize(diskStream(accessor, p))\n const name = p.original.replace(/^\\/+/, '')\n entries.push({ name, data, isFile: true })\n if (verbose) verboseLines.push(name)\n }\n const raw = writeTar(entries)\n const archive = z ? await gzip(raw) : raw\n await diskWrite(accessor, makePathSpec(archivePath, mountPrefix), archive)\n const stdout = verbose ? ENC.encode(verboseLines.join('\\n') + '\\n') : null\n return [stdout, new IOResult({ writes: { [archivePath]: archive } })]\n }\n\n if (list) {\n if (archivePath === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tar: -f is required\\n') })]\n }\n const raw = await materialize(diskStream(accessor, makePathSpec(archivePath, mountPrefix)))\n const data = await decompress(raw, z)\n const entries = readTar(data)\n const out: ByteSource = ENC.encode(entries.map((e) => e.name).join('\\n') + '\\n')\n return [out, new IOResult()]\n }\n\n if (extract) {\n if (archivePath === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tar: -f is required\\n') })]\n }\n const raw = await materialize(diskStream(accessor, makePathSpec(archivePath, mountPrefix)))\n const data = await decompress(raw, z)\n const writes: Record<string, Uint8Array> = {}\n for (const entry of readTar(data)) {\n if (!entry.isFile) continue\n const nameParts = entry.name.split('/')\n const stripped = stripN > 0 ? nameParts.slice(stripN) : nameParts\n if (stripped.length === 0) continue\n const outPath = destPath.replace(/\\/+$/, '') + '/' + stripped.join('/')\n const parts = outPath.replace(/^\\/+|\\/+$/g, '').split('/')\n for (let pi = 1; pi < parts.length; pi++) {\n const d = '/' + parts.slice(0, pi).join('/')\n try {\n await diskMkdir(accessor, makePathSpec(d, mountPrefix))\n } catch {\n // already exists\n }\n }\n await diskWrite(accessor, makePathSpec(outPath, mountPrefix), entry.data)\n writes[outPath] = entry.data\n if (verbose) verboseLines.push(entry.name)\n }\n const stdout = verbose ? ENC.encode(verboseLines.join('\\n') + '\\n') : null\n return [stdout, new IOResult({ writes })]\n }\n\n return [\n null,\n new IOResult({ exitCode: 1, stderr: ENC.encode('tar: must specify -c, -x, or -t\\n') }),\n ]\n}\n\nexport const DISK_TAR = command({\n name: 'tar',\n resource: ResourceName.DISK,\n spec: specOf('tar'),\n fn: tarCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function teeCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tee: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n const stdinData = await readStdinAsync(opts.stdin)\n const raw: Uint8Array = stdinData ?? ENC.encode(texts.join(' '))\n let writeData = raw\n if (opts.flags.a === true) {\n try {\n const existing = await materialize(diskStream(accessor, first))\n writeData = new Uint8Array(existing.byteLength + raw.byteLength)\n writeData.set(existing, 0)\n writeData.set(raw, existing.byteLength)\n } catch (err) {\n if (!(err instanceof Error) || !/not found/i.test(err.message)) throw err\n }\n }\n await diskWrite(accessor, first, writeData)\n const out: ByteSource = raw\n return [\n out,\n new IOResult({\n writes: { [first.stripPrefix]: writeData },\n cache: [first.stripPrefix],\n }),\n ]\n}\n\nexport const DISK_TEE = command({\n name: 'tee',\n resource: ResourceName.DISK,\n spec: specOf('tee'),\n fn: teeCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { exists as diskExists } from '../../../core/disk/exists.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function touchCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('touch: missing operand\\n') })]\n }\n const createOnly = opts.flags.c === true\n for (const p of paths) {\n if (createOnly) continue\n if (!(await diskExists(accessor, p))) {\n await diskWrite(accessor, p, new Uint8Array(0))\n }\n }\n return [null, new IOResult()]\n}\n\nexport const DISK_TOUCH = command({\n name: 'touch',\n resource: ResourceName.DISK,\n spec: specOf('touch'),\n fn: touchCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n interpretEscapes,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction expandRanges(s: string): string {\n let out = ''\n let i = 0\n while (i < s.length) {\n if (i + 2 < s.length && s[i + 1] === '-') {\n const start = s.charCodeAt(i)\n const end = s.charCodeAt(i + 2)\n for (let c = start; c <= end; c++) out += String.fromCharCode(c)\n i += 3\n } else {\n out += s[i] ?? ''\n i += 1\n }\n }\n return out\n}\n\ninterface TrOptions {\n set1: string\n set2: string\n del: boolean\n squeeze: boolean\n table: Map<string, string> | null\n}\n\nasync function* trStream(\n source: AsyncIterable<Uint8Array>,\n opts: TrOptions,\n): AsyncIterable<Uint8Array> {\n const squeezeSet: Set<string> =\n opts.squeeze && opts.set2 !== ''\n ? new Set(opts.set2)\n : opts.squeeze\n ? new Set(opts.set1)\n : new Set()\n let prevChar = ''\n for await (const chunk of source) {\n const text = DEC.decode(chunk)\n let result: string\n if (opts.del) {\n const set1Set = new Set(opts.set1)\n result = Array.from(text)\n .filter((c) => !set1Set.has(c))\n .join('')\n } else if (opts.table !== null) {\n result = Array.from(text)\n .map((c) => opts.table?.get(c) ?? c)\n .join('')\n } else {\n result = text\n }\n if (squeezeSet.size > 0) {\n const squeezed: string[] = []\n for (const c of result) {\n if (squeezeSet.has(c) && c === prevChar) continue\n squeezed.push(c)\n prevChar = c\n }\n result = squeezed.join('')\n } else if (result.length > 0) {\n prevChar = result[result.length - 1] ?? ''\n }\n yield ENC.encode(result)\n }\n}\n\nfunction buildOptions(\n texts: readonly string[],\n flags: Record<string, string | boolean>,\n): TrOptions {\n if (texts.length === 0) throw new Error('tr: usage: tr [-d] [-s] [-c] set1 [set2] [path]')\n let set1 = expandRanges(interpretEscapes(texts[0] ?? ''))\n if (flags.c === true) {\n let allChars = ''\n for (let i = 0; i < 128; i++) allChars += String.fromCharCode(i)\n const s1 = new Set(set1)\n set1 = Array.from(allChars)\n .filter((c) => !s1.has(c))\n .join('')\n }\n let set2 = texts.length >= 2 ? expandRanges(interpretEscapes(texts[1] ?? '')) : ''\n if (set2 !== '' && set2.length < set1.length) {\n const last = set2[set2.length - 1] ?? ''\n set2 = set2 + last.repeat(set1.length - set2.length)\n }\n const del = flags.d === true\n const squeeze = flags.s === true\n let table: Map<string, string> | null = null\n if (!del && set2 !== '') {\n table = new Map<string, string>()\n for (let i = 0; i < set1.length; i++) {\n const from = set1[i]\n const to = set2[i]\n if (from !== undefined && to !== undefined) table.set(from, to)\n }\n } else if (!del && set2 === '' && !squeeze) {\n throw new Error('tr: usage: tr set1 set2')\n }\n return { set1, set2, del, squeeze, table }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function trCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let trOpts: TrOptions\n try {\n trOpts = buildOptions(texts, opts.flags)\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = diskStream(accessor, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'tr: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n return [trStream(source, trOpts), new IOResult({ cache })]\n}\n\nexport const DISK_TR = command({\n name: 'tr',\n resource: ResourceName.DISK,\n spec: specOf('tr'),\n fn: trCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FileType,\n IOResult,\n PathSpec,\n ResourceName,\n command,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { readdir as diskReaddir } from '../../../core/disk/readdir.ts'\nimport { stat as diskStat } from '../../../core/disk/stat.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\ninterface TreeOpts {\n showHidden: boolean\n maxDepth: number | null\n ignorePattern: string | null\n dirsOnly: boolean\n matchPattern: string | null\n}\n\nfunction fnmatch(name: string, pattern: string): boolean {\n let re = '^'\n for (const ch of pattern) {\n if (ch === '*') re += '.*'\n else if (ch === '?') re += '.'\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += '\\\\' + ch\n else re += ch\n }\n re += '$'\n return new RegExp(re).test(name)\n}\n\nasync function walkTree(\n accessor: DiskAccessor,\n path: PathSpec,\n prefix: string,\n lines: string[],\n treeOpts: TreeOpts,\n depth: number,\n): Promise<void> {\n let entries: string[]\n try {\n entries = await diskReaddir(accessor, path)\n } catch {\n return\n }\n entries.sort()\n const filtered: { spec: PathSpec; name: string; isDir: boolean }[] = []\n for (const childPath of entries) {\n const name = childPath.slice(childPath.lastIndexOf('/') + 1)\n if (!treeOpts.showHidden && name.startsWith('.')) continue\n if (treeOpts.ignorePattern !== null && fnmatch(name, treeOpts.ignorePattern)) continue\n const sub = new PathSpec({\n original: childPath,\n directory: childPath,\n resolved: false,\n prefix: path.prefix,\n })\n let isDir: boolean\n try {\n const s = await diskStat(accessor, sub)\n isDir = s.type === FileType.DIRECTORY\n } catch {\n continue\n }\n if (treeOpts.dirsOnly && !isDir) continue\n if (treeOpts.matchPattern !== null && !isDir && !fnmatch(name, treeOpts.matchPattern)) continue\n filtered.push({ spec: sub, name, isDir })\n }\n for (let i = 0; i < filtered.length; i++) {\n const entry = filtered[i]\n if (entry === undefined) continue\n const last = i === filtered.length - 1\n const connector = last ? '└── ' : '├── '\n lines.push(`${prefix}${connector}${entry.name}`)\n if (entry.isDir) {\n if (treeOpts.maxDepth !== null && depth >= treeOpts.maxDepth) continue\n const nextPrefix = prefix + (last ? ' ' : '│ ')\n await walkTree(accessor, entry.spec, nextPrefix, lines, treeOpts, depth + 1)\n }\n }\n}\n\nasync function treeCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const targets =\n paths.length > 0\n ? paths\n : [\n new PathSpec({\n original: opts.cwd,\n directory: opts.cwd,\n resolved: false,\n prefix: opts.mountPrefix ?? '',\n }),\n ]\n const depthRaw = typeof opts.flags.L === 'string' ? opts.flags.L : null\n const ignoreRaw = typeof opts.flags.args_I === 'string' ? opts.flags.args_I : null\n const matchRaw = typeof opts.flags.P === 'string' ? opts.flags.P : null\n const treeOpts: TreeOpts = {\n showHidden: opts.flags.a === true,\n maxDepth: depthRaw === null ? null : Number.parseInt(depthRaw, 10),\n ignorePattern: ignoreRaw,\n dirsOnly: opts.flags.d === true,\n matchPattern: matchRaw,\n }\n const lines: string[] = []\n for (const p of targets) {\n await walkTree(accessor, p, '', lines, treeOpts, 0)\n }\n const out: ByteSource = new TextEncoder().encode(lines.join('\\n'))\n return [out, new IOResult()]\n}\n\nexport const DISK_TREE = command({\n name: 'tree',\n resource: ResourceName.DISK,\n spec: specOf('tree'),\n fn: treeCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction topologicalSort(pairs: readonly (readonly [string, string])[]): [string[], boolean] {\n const graph = new Map<string, Set<string>>()\n const inDegree = new Map<string, number>()\n const getOrCreate = (node: string): Set<string> => {\n const existing = graph.get(node)\n if (existing !== undefined) return existing\n const created = new Set<string>()\n graph.set(node, created)\n inDegree.set(node, 0)\n return created\n }\n for (const [a, b] of pairs) {\n const adj = getOrCreate(a)\n getOrCreate(b)\n if (!adj.has(b)) {\n adj.add(b)\n inDegree.set(b, (inDegree.get(b) ?? 0) + 1)\n }\n }\n const queue: string[] = []\n for (const [node, deg] of inDegree) {\n if (deg === 0) queue.push(node)\n }\n const result: string[] = []\n let head = 0\n while (head < queue.length) {\n const node = queue[head] ?? ''\n head += 1\n result.push(node)\n const neighbors = [...(graph.get(node) ?? new Set<string>())].sort()\n for (const nb of neighbors) {\n const d = (inDegree.get(nb) ?? 0) - 1\n inDegree.set(nb, d)\n if (d === 0) queue.push(nb)\n }\n }\n const hasCycle = result.length !== graph.size\n return [result, hasCycle]\n}\n\nasync function tsortCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let raw: Uint8Array\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n raw = await materialize(diskStream(accessor, first))\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('tsort: missing input\\n') })]\n }\n raw = stdinData\n }\n const text = DEC.decode(raw)\n const tokens = text.split(/\\s+/).filter((s) => s !== '')\n if (tokens.length % 2 !== 0) {\n const out: ByteSource = ENC.encode('tsort: odd number of tokens\\n')\n return [out, new IOResult({ exitCode: 1 })]\n }\n const pairs: [string, string][] = []\n for (let i = 0; i < tokens.length; i += 2) {\n pairs.push([tokens[i] ?? '', tokens[i + 1] ?? ''])\n }\n const [sorted, hasCycle] = topologicalSort(pairs)\n if (hasCycle) {\n const out: ByteSource = ENC.encode('tsort: cycle detected\\n')\n return [out, new IOResult({ exitCode: 1 })]\n }\n const result: ByteSource = ENC.encode(sorted.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const DISK_TSORT = command({\n name: 'tsort',\n resource: ResourceName.DISK,\n spec: specOf('tsort'),\n fn: tsortCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesKeepEnds(text: string): string[] {\n const lines: string[] = []\n let start = 0\n for (let i = 0; i < text.length; i++) {\n if (text[i] === '\\n') {\n lines.push(text.slice(start, i + 1))\n start = i + 1\n }\n }\n if (start < text.length) lines.push(text.slice(start))\n return lines\n}\n\nfunction unexpandLine(line: string, tabsize: number, allSpaces: boolean): string {\n if (allSpaces) {\n const result: string[] = []\n let i = 0\n while (i < line.length) {\n let count = 0\n while (i + count < line.length && line[i + count] === ' ') count += 1\n if (count >= tabsize) {\n const tabs = Math.floor(count / tabsize)\n const remainder = count % tabsize\n result.push('\\t'.repeat(tabs) + ' '.repeat(remainder))\n i += count\n } else if (count > 0) {\n result.push(' '.repeat(count))\n i += count\n } else {\n result.push(line[i] ?? '')\n i += 1\n }\n }\n return result.join('')\n }\n let leading = 0\n while (leading < line.length && line[leading] === ' ') leading += 1\n if (leading >= tabsize) {\n const tabs = Math.floor(leading / tabsize)\n const remainder = leading % tabsize\n return '\\t'.repeat(tabs) + ' '.repeat(remainder) + line.slice(leading)\n }\n return line\n}\n\nasync function unexpandCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const tabsize = typeof opts.flags.t === 'string' ? Number.parseInt(opts.flags.t, 10) : 8\n const allSpaces = opts.flags.a === true\n if (paths.length > 0) {\n const parts: string[] = []\n for (const p of paths) {\n const data = DEC.decode(await materialize(diskStream(accessor, p)))\n for (const ln of splitLinesKeepEnds(data)) parts.push(unexpandLine(ln, tabsize, allSpaces))\n }\n const result: ByteSource = ENC.encode(parts.join(''))\n return [result, new IOResult()]\n }\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('unexpand: missing operand\\n') })]\n }\n const text = DEC.decode(stdinData)\n const lines = splitLinesKeepEnds(text)\n const result: ByteSource = ENC.encode(\n lines.map((ln) => unexpandLine(ln, tabsize, allSpaces)).join(''),\n )\n return [result, new IOResult()]\n}\n\nexport const DISK_UNEXPAND = command({\n name: 'unexpand',\n resource: ResourceName.DISK,\n spec: specOf('unexpand'),\n fn: unexpandCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n AsyncLineIterator,\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ninterface UniqOptions {\n count: boolean\n duplicatesOnly: boolean\n uniqueOnly: boolean\n skipFields: number\n skipChars: number\n checkChars: number\n ignoreCase: boolean\n}\n\nfunction comparisonKey(line: Uint8Array, opts: UniqOptions): string {\n let text = DEC.decode(line)\n if (opts.skipFields > 0) {\n const parts = text.split(/\\s+/).filter((s) => s !== '')\n const remaining = opts.skipFields < parts.length ? parts.slice(opts.skipFields) : []\n text = remaining.join(' ')\n }\n if (opts.skipChars > 0) text = text.slice(opts.skipChars)\n if (opts.checkChars > 0) text = text.slice(0, opts.checkChars)\n if (opts.ignoreCase) text = text.toLowerCase()\n return text\n}\n\nfunction padLeft(value: string, width: number): string {\n return value.length >= width ? value : ' '.repeat(width - value.length) + value\n}\n\nfunction emitLine(line: Uint8Array, count: number, opts: UniqOptions): Uint8Array | null {\n if (opts.duplicatesOnly && count === 1) return null\n if (opts.uniqueOnly && count > 1) return null\n if (opts.count) {\n const prefix = ENC.encode(`${padLeft(String(count), 7)} `)\n const out = new Uint8Array(prefix.byteLength + line.byteLength + 1)\n out.set(prefix, 0)\n out.set(line, prefix.byteLength)\n out[out.byteLength - 1] = 0x0a\n return out\n }\n const out = new Uint8Array(line.byteLength + 1)\n out.set(line, 0)\n out[line.byteLength] = 0x0a\n return out\n}\n\nasync function* uniqStream(\n source: AsyncIterable<Uint8Array>,\n opts: UniqOptions,\n): AsyncIterable<Uint8Array> {\n let prevLine: Uint8Array | null = null\n let prevKey: string | null = null\n let prevCount = 0\n const iter = new AsyncLineIterator(source)\n for await (const rawLine of iter) {\n const key = comparisonKey(rawLine, opts)\n if (key === prevKey) {\n prevCount += 1\n } else {\n if (prevLine !== null) {\n const chunk = emitLine(prevLine, prevCount, opts)\n if (chunk !== null) yield chunk\n }\n prevLine = rawLine\n prevKey = key\n prevCount = 1\n }\n }\n if (prevLine !== null) {\n const chunk = emitLine(prevLine, prevCount, opts)\n if (chunk !== null) yield chunk\n }\n}\n\nfunction parseOptions(flags: Record<string, string | boolean>): UniqOptions {\n const intFlag = (key: 'f' | 's' | 'w'): number =>\n typeof flags[key] === 'string' ? Number.parseInt(flags[key], 10) : 0\n return {\n count: flags.c === true,\n duplicatesOnly: flags.d === true,\n uniqueOnly: flags.u === true,\n skipFields: intFlag('f'),\n skipChars: intFlag('s'),\n checkChars: intFlag('w'),\n ignoreCase: flags.i === true,\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function uniqCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const uniqOpts = parseOptions(opts.flags)\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n return [\n uniqStream(diskStream(accessor, first), uniqOpts),\n new IOResult({ cache: [first.stripPrefix] }),\n ]\n }\n try {\n const source = resolveSource(opts.stdin, 'uniq: missing operand')\n return [uniqStream(source, uniqOpts), new IOResult()]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n}\n\nexport const DISK_UNIQ = command({\n name: 'uniq',\n resource: ResourceName.DISK,\n spec: specOf('uniq'),\n fn: uniqCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n PathSpec,\n ResourceName,\n command,\n inflateRaw,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { mkdir as diskMkdir } from '../../../core/disk/mkdir.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\ninterface ZipEntry {\n name: string\n size: number\n data: Uint8Array\n}\n\nfunction readU16LE(data: Uint8Array, offset: number): number {\n return (data[offset] ?? 0) | ((data[offset + 1] ?? 0) << 8)\n}\n\nfunction readU32LE(data: Uint8Array, offset: number): number {\n return (\n ((data[offset] ?? 0) |\n ((data[offset + 1] ?? 0) << 8) |\n ((data[offset + 2] ?? 0) << 16) |\n ((data[offset + 3] ?? 0) << 24)) >>>\n 0\n )\n}\n\nasync function readZipEntries(data: Uint8Array): Promise<ZipEntry[]> {\n const entries: ZipEntry[] = []\n let offset = 0\n while (offset + 4 <= data.byteLength) {\n const sig = readU32LE(data, offset)\n if (sig !== 0x04034b50) break\n const compressionMethod = readU16LE(data, offset + 8)\n const compressedSize = readU32LE(data, offset + 18)\n const uncompressedSize = readU32LE(data, offset + 22)\n const nameLen = readU16LE(data, offset + 26)\n const extraLen = readU16LE(data, offset + 28)\n const headerEnd = offset + 30 + nameLen + extraLen\n const nameBytes = data.subarray(offset + 30, offset + 30 + nameLen)\n const name = DEC.decode(nameBytes)\n const body = data.subarray(headerEnd, headerEnd + compressedSize)\n let content: Uint8Array\n if (compressionMethod === 0) {\n content = body.slice()\n } else if (compressionMethod === 8) {\n content = await inflateRaw(body)\n } else {\n throw new Error(`unzip: unsupported compression method: ${String(compressionMethod)}`)\n }\n entries.push({ name, size: uncompressedSize, data: content })\n offset = headerEnd + compressedSize\n }\n return entries\n}\n\nfunction makePathSpec(original: string): PathSpec {\n return new PathSpec({ original, directory: original, resolved: true })\n}\n\nasync function ensureParents(accessor: DiskAccessor, path: string): Promise<void> {\n const idx = path.lastIndexOf('/')\n if (idx <= 0) return\n const dir = path.slice(0, idx)\n if (dir === '' || dir === '/') return\n await diskMkdir(accessor, makePathSpec(dir), true)\n}\n\nasync function unzipCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('unzip: missing operand\\n') })]\n }\n const archivePath = paths[0]\n if (archivePath === undefined) return [null, new IOResult()]\n const data = await materialize(diskStream(accessor, archivePath))\n const entries = await readZipEntries(data)\n\n const listMode = opts.flags.args_l === true\n const testMode = opts.flags.t === true\n const pipeMode = opts.flags.p === true\n const quiet = opts.flags.q === true\n const mountPrefix = archivePath.prefix\n const destRaw = typeof opts.flags.d === 'string' ? opts.flags.d : '/'\n const dest =\n mountPrefix !== '' && destRaw.startsWith(mountPrefix + '/')\n ? destRaw.slice(mountPrefix.length)\n : destRaw === mountPrefix\n ? '/'\n : destRaw\n\n if (listMode) {\n const lines = [' Length Name', '--------- ----']\n for (const e of entries) {\n lines.push(`${String(e.size).padStart(9, ' ')} ${e.name}`)\n }\n const out: ByteSource = ENC.encode(lines.join('\\n') + '\\n')\n return [out, new IOResult()]\n }\n\n if (testMode) {\n const msg = `No errors detected in ${archivePath.original}\\n`\n const out: ByteSource = ENC.encode(msg)\n return [out, new IOResult()]\n }\n\n if (pipeMode) {\n const chunks: Uint8Array[] = []\n for (const e of entries) {\n if (!e.name.endsWith('/')) chunks.push(e.data)\n }\n let total = 0\n for (const c of chunks) total += c.byteLength\n const merged = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n merged.set(c, offset)\n offset += c.byteLength\n }\n const out: ByteSource = merged\n return [out, new IOResult()]\n }\n\n const writes: Record<string, Uint8Array> = {}\n const outputLines: string[] = []\n for (const e of entries) {\n if (e.name.endsWith('/')) continue\n const entryName = e.name.replace(/^\\/+/, '')\n const outPath = dest.replace(/\\/+$/, '') + '/' + entryName\n await ensureParents(accessor, outPath)\n await diskWrite(accessor, makePathSpec(outPath), e.data)\n const reportPath = mountPrefix !== '' ? mountPrefix + outPath : outPath\n writes[reportPath] = e.data\n if (!quiet) outputLines.push(` inflating: ${reportPath}`)\n }\n const stdout: ByteSource | null =\n outputLines.length > 0 ? ENC.encode(outputLines.join('\\n') + '\\n') : null\n return [stdout, new IOResult({ writes })]\n}\n\nexport const DISK_UNZIP = command({\n name: 'unzip',\n resource: ResourceName.DISK,\n spec: specOf('unzip'),\n fn: unzipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n resolveSource,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n wcAggregate,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nasync function* wcLinesStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n let count = 0\n for await (const chunk of source) {\n for (let i = 0; i < chunk.byteLength; i++) if (chunk[i] === 0x0a) count += 1\n }\n yield ENC.encode(String(count))\n}\n\nasync function readStream(accessor: DiskAccessor, p: PathSpec): Promise<Uint8Array> {\n return materialize(diskStream(accessor, p))\n}\n\nasync function wcCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const f = opts.flags\n const lFlag = f.args_l === true\n const wFlag = f.w === true\n const cFlag = f.c === true\n const mFlag = f.m === true\n const LFlag = f.L === true\n if (paths.length > 0) {\n const outputs: string[] = []\n let totalLines = 0\n let totalWords = 0\n let totalBytes = 0\n for (const p of paths) {\n const data = await readStream(accessor, p)\n const text = DEC.decode(data)\n const lineCount = countChar(text, '\\n')\n const wordCount = text.split(/\\s+/).filter((s) => s !== '').length\n const byteCount = data.byteLength\n if (LFlag) {\n const maxLen = text.split(/\\r?\\n/).reduce((m, l) => Math.max(m, l.length), 0)\n outputs.push(`${String(maxLen)}\\t${p.original}`)\n } else if (lFlag) {\n outputs.push(`${String(lineCount)}\\t${p.original}`)\n totalLines += lineCount\n } else if (wFlag) {\n outputs.push(`${String(wordCount)}\\t${p.original}`)\n totalWords += wordCount\n } else if (cFlag) {\n outputs.push(`${String(byteCount)}\\t${p.original}`)\n totalBytes += byteCount\n } else if (mFlag) {\n const charCount = text.length\n outputs.push(`${String(charCount)}\\t${p.original}`)\n totalBytes += charCount\n } else {\n outputs.push(\n `${String(lineCount)}\\t${String(wordCount)}\\t${String(byteCount)}\\t${p.original}`,\n )\n totalLines += lineCount\n totalWords += wordCount\n totalBytes += byteCount\n }\n }\n if (paths.length > 1) {\n if (lFlag) outputs.push(`${String(totalLines)}\\ttotal`)\n else if (wFlag) outputs.push(`${String(totalWords)}\\ttotal`)\n else if (cFlag) outputs.push(`${String(totalBytes)}\\ttotal`)\n else if (mFlag) outputs.push(`${String(totalBytes)}\\ttotal`)\n else\n outputs.push(`${String(totalLines)}\\t${String(totalWords)}\\t${String(totalBytes)}\\ttotal`)\n }\n const out: ByteSource = ENC.encode(outputs.join('\\n'))\n return [out, new IOResult()]\n }\n let source: AsyncIterable<Uint8Array>\n try {\n source = resolveSource(opts.stdin, 'wc: missing operand')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n if (lFlag) return [wcLinesStream(source), new IOResult()]\n const raw = await materialize(source)\n const text = DEC.decode(raw)\n const lc = countChar(text, '\\n')\n const wcVal = text.split(/\\s+/).filter((s) => s !== '').length\n const bc = raw.byteLength\n const cc = text.length\n if (LFlag) {\n const maxLen = text.split(/\\r?\\n/).reduce((m, l) => Math.max(m, l.length), 0)\n return [ENC.encode(String(maxLen)), new IOResult()]\n }\n if (wFlag) return [ENC.encode(String(wcVal)), new IOResult()]\n if (mFlag) return [ENC.encode(String(cc)), new IOResult()]\n if (cFlag) return [ENC.encode(String(bc)), new IOResult()]\n return [ENC.encode(`${String(lc)}\\t${String(wcVal)}\\t${String(bc)}`), new IOResult()]\n}\n\nfunction countChar(text: string, ch: string): number {\n let n = 0\n for (const c of text) if (c === ch) n += 1\n return n\n}\n\nexport const DISK_WC = command({\n name: 'wc',\n resource: ResourceName.DISK,\n spec: specOf('wc'),\n fn: wcCommand,\n aggregate: wcAggregate,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n featherWc,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function wcFeatherCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('wc: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const rows = featherWc(raw)\n const out: ByteSource = ENC.encode(`${String(rows)}\\t${first.original}\\n`)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`wc: ${first.original}: failed to read as feather: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_WC_FEATHER = command({\n name: 'wc',\n resource: ResourceName.DISK,\n spec: specOf('wc'),\n filetype: '.feather',\n fn: wcFeatherCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n hdf5Wc,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function wcHdf5Command(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('wc: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const rows = await hdf5Wc(raw)\n const out: ByteSource = ENC.encode(`${String(rows)}\\t${first.original}\\n`)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`wc: ${first.original}: failed to read as hdf5: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const RAM_WC_HDF5 = command({\n name: 'wc',\n resource: ResourceName.DISK,\n spec: specOf('wc'),\n filetype: '.h5',\n fn: wcHdf5Command,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n parquetWc,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function wcParquetCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length === 0) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('wc: missing operand\\n') })]\n }\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n try {\n const raw = await materialize(diskStream(accessor, first))\n const rows = parquetWc(raw)\n const out: ByteSource = ENC.encode(`${String(rows)}\\t${first.original}\\n`)\n return [out, new IOResult({ cache: [first.stripPrefix] })]\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode(`wc: ${first.original}: failed to read as parquet: ${msg}\\n`),\n }),\n ]\n }\n}\n\nexport const DISK_WC_PARQUET = command({\n name: 'wc',\n resource: ResourceName.DISK,\n spec: specOf('wc'),\n filetype: '.parquet',\n fn: wcParquetCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n resolveSource,\n specOf,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction padLeft(s: string, width: number, ch = ' '): string {\n return s.length >= width ? s : ch.repeat(width - s.length) + s\n}\n\nfunction padRight(s: string, width: number, ch = ' '): string {\n return s.length >= width ? s : s + ch.repeat(width - s.length)\n}\n\nfunction hexByte(b: number, uppercase: boolean): string {\n const h = b.toString(16).padStart(2, '0')\n return uppercase ? h.toUpperCase() : h\n}\n\nfunction hexOffset(offset: number, uppercase: boolean): string {\n const h = offset.toString(16).padStart(8, '0')\n return uppercase ? h.toUpperCase() : h\n}\n\nasync function* xxdDumpStream(\n source: AsyncIterable<Uint8Array>,\n cols: number,\n group: number,\n uppercase: boolean,\n): AsyncIterable<Uint8Array> {\n let offset = 0\n let leftover = new Uint8Array(0)\n const hexColumnWidth = cols * 2 + Math.floor(cols / group) - 1\n const emitRow = (row: Uint8Array): Uint8Array => {\n const hexParts: string[] = []\n for (let g = 0; g < row.byteLength; g += group) {\n let seg = ''\n const end = Math.min(g + group, row.byteLength)\n for (let k = g; k < end; k++) seg += hexByte(row[k] ?? 0, uppercase)\n hexParts.push(seg)\n }\n const hexPart = hexParts.join(' ')\n let asciiPart = ''\n for (const b of row) asciiPart += b >= 32 && b < 127 ? String.fromCharCode(b) : '.'\n const line = `${hexOffset(offset, uppercase)}: ${padRight(hexPart, hexColumnWidth)} ${asciiPart}\\n`\n return ENC.encode(line)\n }\n for await (const chunk of source) {\n const merged = new Uint8Array(leftover.byteLength + chunk.byteLength)\n merged.set(leftover, 0)\n merged.set(chunk, leftover.byteLength)\n let i = 0\n while (i + cols <= merged.byteLength) {\n yield emitRow(merged.subarray(i, i + cols))\n offset += cols\n i += cols\n }\n leftover = merged.subarray(i)\n }\n if (leftover.byteLength > 0) {\n yield emitRow(leftover)\n }\n}\n\nasync function* xxdPlainStream(\n source: AsyncIterable<Uint8Array>,\n uppercase: boolean,\n): AsyncIterable<Uint8Array> {\n for await (const chunk of source) {\n let hex = ''\n for (const b of chunk) hex += hexByte(b, uppercase)\n yield ENC.encode(hex)\n }\n yield ENC.encode('\\n')\n}\n\nasync function* xxdReverseStream(source: AsyncIterable<Uint8Array>): AsyncIterable<Uint8Array> {\n const chunks: Uint8Array[] = []\n for await (const c of source) chunks.push(c)\n let total = 0\n for (const c of chunks) total += c.byteLength\n const buf = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n buf.set(c, offset)\n offset += c.byteLength\n }\n const text = DEC.decode(buf).replace(/[\\n ]/g, '')\n const out = new Uint8Array(text.length / 2)\n for (let i = 0; i < out.byteLength; i++)\n out[i] = Number.parseInt(text.slice(i * 2, i * 2 + 2), 16)\n yield out\n}\n\nasync function* applyLimits(\n source: AsyncIterable<Uint8Array>,\n skip: number,\n limit: number,\n): AsyncIterable<Uint8Array> {\n let pos = 0\n let remaining = limit\n for await (let chunk of source) {\n const len = chunk.byteLength\n if (pos + len <= skip) {\n pos += len\n continue\n }\n if (pos < skip) {\n chunk = chunk.subarray(skip - pos)\n pos = skip\n }\n if (remaining <= 0) break\n if (chunk.byteLength > remaining) chunk = chunk.subarray(0, remaining)\n yield chunk\n remaining -= chunk.byteLength\n pos += chunk.byteLength\n }\n}\n\nvoid padLeft\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function xxdCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const cache: string[] = []\n let source: AsyncIterable<Uint8Array>\n if (paths.length > 0) {\n const first = paths[0]\n if (first === undefined) return [null, new IOResult()]\n source = diskStream(accessor, first)\n cache.push(first.original)\n } else {\n try {\n source = resolveSource(opts.stdin, 'xxd: missing input')\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err)\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode(`${msg}\\n`) })]\n }\n }\n const toInt = (v: string | boolean | undefined): number =>\n typeof v === 'string' ? Number.parseInt(v, 10) : 0\n const skip = toInt(opts.flags.s)\n const limitFlag = toInt(opts.flags.args_l)\n if (skip > 0 || limitFlag > 0) {\n const limit = limitFlag > 0 ? limitFlag : Number.MAX_SAFE_INTEGER\n source = applyLimits(source, skip, limit)\n }\n const uppercase = opts.flags.u === true\n if (opts.flags.r === true) return [xxdReverseStream(source), new IOResult({ cache })]\n if (opts.flags.p === true) return [xxdPlainStream(source, uppercase), new IOResult({ cache })]\n const cols = toInt(opts.flags.c) > 0 ? toInt(opts.flags.c) : 16\n const group = toInt(opts.flags.g) > 0 ? toInt(opts.flags.g) : 2\n return [xxdDumpStream(source, cols, group, uppercase), new IOResult({ cache })]\n}\n\nexport const DISK_XXD = command({\n name: 'xxd',\n resource: ResourceName.DISK,\n spec: specOf('xxd'),\n fn: xxdCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n gunzip,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nasync function zcatCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n let raw: Uint8Array\n if (paths.length > 0 && paths[0] !== undefined) {\n raw = await materialize(diskStream(accessor, paths[0]))\n } else {\n const stdinBytes = await readStdinAsync(opts.stdin)\n if (stdinBytes === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('zcat: missing input\\n') })]\n }\n raw = stdinBytes\n }\n const out = await gunzip(raw)\n const result: ByteSource = out\n return [result, new IOResult()]\n}\n\nexport const DISK_ZCAT = command({\n name: 'zcat',\n resource: ResourceName.DISK,\n spec: specOf('zcat'),\n fn: zcatCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n compilePattern,\n gunzip,\n materialize,\n readStdinAsync,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\nconst DEC = new TextDecoder('utf-8', { fatal: false })\n\nfunction splitLinesNoTrailing(text: string): string[] {\n const stripped = text.endsWith('\\n') ? text.slice(0, -1) : text\n return stripped === '' ? [] : stripped.split('\\n')\n}\n\ninterface ZgrepOpts {\n ignoreCase: boolean\n invert: boolean\n count: boolean\n lineNumbers: boolean\n onlyMatching: boolean\n maxCount: number | null\n}\n\nfunction zgrepSearch(\n data: Uint8Array,\n pattern: RegExp,\n opts: ZgrepOpts,\n filename: string | null,\n): [string[], boolean] {\n const text = DEC.decode(data)\n const lines = splitLinesNoTrailing(text)\n const reGlobal = opts.onlyMatching\n ? new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g')\n : null\n const matched: [number, string][] = []\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i] ?? ''\n if (opts.onlyMatching && !opts.invert && reGlobal !== null) {\n reGlobal.lastIndex = 0\n let m: RegExpExecArray | null\n const hits: RegExpExecArray[] = []\n while ((m = reGlobal.exec(line)) !== null) {\n hits.push(m)\n if (m[0] === '') reGlobal.lastIndex += 1\n }\n if (hits.length > 0) {\n for (const h of hits) {\n matched.push([i + 1, h[0]])\n if (opts.maxCount !== null && matched.length >= opts.maxCount) break\n }\n }\n } else {\n let hit = pattern.test(line)\n if (opts.invert) hit = !hit\n if (hit) matched.push([i + 1, line])\n }\n if (opts.maxCount !== null && matched.length >= opts.maxCount) break\n }\n if (opts.count) return [[String(matched.length)], matched.length > 0]\n const result: string[] = []\n for (const [idx, line] of matched) {\n let prefix = ''\n if (filename !== null) prefix = filename + ':'\n if (opts.lineNumbers) prefix += String(idx) + ':'\n result.push(prefix + line)\n }\n return [result, matched.length > 0]\n}\n\nasync function zgrepCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n const rawPattern =\n typeof opts.flags.e === 'string'\n ? opts.flags.e\n : texts.length > 0 && texts[0] !== undefined\n ? texts[0]\n : ''\n const extendedRegex = opts.flags.E === true\n const fixedString = opts.flags.F === true\n const wholeWord = opts.flags.w === true\n const ignoreCase = opts.flags.i === true\n const invert = opts.flags.v === true\n const countOnly = opts.flags.c === true\n const lineNumbers = opts.flags.n === true\n const onlyMatching = opts.flags.o === true\n const quiet = opts.flags.q === true\n const filesOnly = opts.flags.args_l === true\n const forceH = opts.flags.H === true\n const hideH = opts.flags.h === true\n const maxCount = typeof opts.flags.m === 'string' ? Number.parseInt(opts.flags.m, 10) : null\n void extendedRegex\n const pattern = compilePattern(rawPattern, ignoreCase, fixedString, wholeWord)\n\n const multi = paths.length > 1\n const showFilename = forceH || (multi && !hideH)\n let anyMatch = false\n const allResults: string[] = []\n\n if (paths.length > 0) {\n for (const p of paths) {\n const compressed = await materialize(diskStream(accessor, p))\n const data = await gunzip(compressed)\n const fname = showFilename ? p.original : null\n if (filesOnly) {\n const text = DEC.decode(data)\n const lines = splitLinesNoTrailing(text)\n for (const line of lines) {\n let hit = pattern.test(line)\n if (invert) hit = !hit\n if (hit) {\n allResults.push(p.original)\n anyMatch = true\n break\n }\n }\n } else {\n const [result, hadMatch] = zgrepSearch(\n data,\n pattern,\n {\n ignoreCase,\n invert,\n count: countOnly,\n lineNumbers,\n onlyMatching,\n maxCount,\n },\n fname,\n )\n if (hadMatch) anyMatch = true\n for (const r of result) allResults.push(r)\n }\n }\n } else {\n const stdinData = await readStdinAsync(opts.stdin)\n if (stdinData === null) {\n return [null, new IOResult({ exitCode: 1, stderr: ENC.encode('zgrep: missing input\\n') })]\n }\n const data = await gunzip(stdinData)\n if (filesOnly) {\n const text = DEC.decode(data)\n const lines = splitLinesNoTrailing(text)\n for (const line of lines) {\n let hit = pattern.test(line)\n if (invert) hit = !hit\n if (hit) {\n allResults.push('(standard input)')\n anyMatch = true\n break\n }\n }\n } else {\n const [result, hadMatch] = zgrepSearch(\n data,\n pattern,\n { ignoreCase, invert, count: countOnly, lineNumbers, onlyMatching, maxCount },\n null,\n )\n if (hadMatch) anyMatch = true\n for (const r of result) allResults.push(r)\n }\n }\n\n if (quiet) return [null, new IOResult({ exitCode: anyMatch ? 0 : 1 })]\n if (!anyMatch) return [null, new IOResult({ exitCode: 1 })]\n const result: ByteSource = ENC.encode(allResults.join('\\n') + '\\n')\n return [result, new IOResult()]\n}\n\nexport const DISK_ZGREP = command({\n name: 'zgrep',\n resource: ResourceName.DISK,\n spec: specOf('zgrep'),\n fn: zgrepCommand,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n IOResult,\n ResourceName,\n command,\n deflateRaw,\n materialize,\n specOf,\n type ByteSource,\n type CommandFnResult,\n type CommandOpts,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport { writeBytes as diskWrite } from '../../../core/disk/write.ts'\nimport { stream as diskStream } from '../../../core/disk/stream.ts'\nimport type { DiskAccessor } from '../../../accessor/disk.ts'\n\nconst ENC = new TextEncoder()\n\nconst CRC_TABLE = (() => {\n const table = new Uint32Array(256)\n for (let n = 0; n < 256; n++) {\n let c = n\n for (let k = 0; k < 8; k++) {\n c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1\n }\n table[n] = c >>> 0\n }\n return table\n})()\n\nfunction crc32(data: Uint8Array): number {\n let c = 0xffffffff\n for (let i = 0; i < data.byteLength; i++) {\n c = (CRC_TABLE[((c ^ (data[i] ?? 0)) & 0xff) >>> 0] ?? 0) ^ (c >>> 8)\n }\n return (c ^ 0xffffffff) >>> 0\n}\n\nfunction writeU16LE(buf: Uint8Array, offset: number, value: number): void {\n buf[offset] = value & 0xff\n buf[offset + 1] = (value >>> 8) & 0xff\n}\n\nfunction writeU32LE(buf: Uint8Array, offset: number, value: number): void {\n buf[offset] = value & 0xff\n buf[offset + 1] = (value >>> 8) & 0xff\n buf[offset + 2] = (value >>> 16) & 0xff\n buf[offset + 3] = (value >>> 24) & 0xff\n}\n\ninterface ZipItem {\n name: string\n data: Uint8Array\n compressed: Uint8Array\n crc: number\n method: number\n localOffset: number\n}\n\nfunction basename(path: string): string {\n const idx = path.lastIndexOf('/')\n return idx >= 0 ? path.slice(idx + 1) : path\n}\n\nfunction concat(chunks: readonly Uint8Array[]): Uint8Array {\n let total = 0\n for (const c of chunks) total += c.byteLength\n const out = new Uint8Array(total)\n let offset = 0\n for (const c of chunks) {\n out.set(c, offset)\n offset += c.byteLength\n }\n return out\n}\n\nfunction buildZip(items: ZipItem[]): Uint8Array {\n const parts: Uint8Array[] = []\n let offset = 0\n for (const item of items) {\n item.localOffset = offset\n const nameBytes = ENC.encode(item.name)\n const header = new Uint8Array(30 + nameBytes.byteLength)\n writeU32LE(header, 0, 0x04034b50)\n writeU16LE(header, 4, 20)\n writeU16LE(header, 6, 0)\n writeU16LE(header, 8, item.method)\n writeU16LE(header, 10, 0)\n writeU16LE(header, 12, 0)\n writeU32LE(header, 14, item.crc)\n writeU32LE(header, 18, item.compressed.byteLength)\n writeU32LE(header, 22, item.data.byteLength)\n writeU16LE(header, 26, nameBytes.byteLength)\n writeU16LE(header, 28, 0)\n header.set(nameBytes, 30)\n parts.push(header)\n parts.push(item.compressed)\n offset += header.byteLength + item.compressed.byteLength\n }\n const centralStart = offset\n for (const item of items) {\n const nameBytes = ENC.encode(item.name)\n const central = new Uint8Array(46 + nameBytes.byteLength)\n writeU32LE(central, 0, 0x02014b50)\n writeU16LE(central, 4, 20)\n writeU16LE(central, 6, 20)\n writeU16LE(central, 8, 0)\n writeU16LE(central, 10, item.method)\n writeU16LE(central, 12, 0)\n writeU16LE(central, 14, 0)\n writeU32LE(central, 16, item.crc)\n writeU32LE(central, 20, item.compressed.byteLength)\n writeU32LE(central, 24, item.data.byteLength)\n writeU16LE(central, 28, nameBytes.byteLength)\n writeU16LE(central, 30, 0)\n writeU16LE(central, 32, 0)\n writeU16LE(central, 34, 0)\n writeU16LE(central, 36, 0)\n writeU32LE(central, 38, 0)\n writeU32LE(central, 42, item.localOffset)\n central.set(nameBytes, 46)\n parts.push(central)\n offset += central.byteLength\n }\n const centralSize = offset - centralStart\n const end = new Uint8Array(22)\n writeU32LE(end, 0, 0x06054b50)\n writeU16LE(end, 4, 0)\n writeU16LE(end, 6, 0)\n writeU16LE(end, 8, items.length)\n writeU16LE(end, 10, items.length)\n writeU32LE(end, 12, centralSize)\n writeU32LE(end, 16, centralStart)\n writeU16LE(end, 20, 0)\n parts.push(end)\n return concat(parts)\n}\n\nasync function zipCommand(\n accessor: DiskAccessor,\n paths: PathSpec[],\n texts: string[],\n opts: CommandOpts,\n): Promise<CommandFnResult> {\n if (paths.length < 2) {\n return [\n null,\n new IOResult({\n exitCode: 1,\n stderr: ENC.encode('zip: usage: zip archive.zip file1 [file2 ...]\\n'),\n }),\n ]\n }\n const archivePath = paths[0]\n const filePaths = paths.slice(1)\n if (archivePath === undefined) return [null, new IOResult()]\n const junkPaths = opts.flags.j === true\n const quiet = opts.flags.q === true\n\n const items: ZipItem[] = []\n const outputLines: string[] = []\n for (const p of filePaths) {\n const raw = await materialize(diskStream(accessor, p))\n const data = new Uint8Array(raw.byteLength)\n data.set(raw)\n const arcname = junkPaths ? basename(p.original) : p.original.replace(/^\\/+/, '')\n const compressed = await deflateRaw(data)\n items.push({\n name: arcname,\n data,\n compressed,\n crc: crc32(data),\n method: 8,\n localOffset: 0,\n })\n if (!quiet) outputLines.push(` adding: ${arcname}`)\n }\n const archive = buildZip(items)\n await diskWrite(accessor, archivePath, archive)\n const stdout: ByteSource | null =\n outputLines.length > 0 ? ENC.encode(outputLines.join('\\n') + '\\n') : null\n return [stdout, new IOResult({ writes: { [archivePath.stripPrefix]: archive } })]\n}\n\nexport const DISK_ZIP = command({\n name: 'zip',\n resource: ResourceName.DISK,\n spec: specOf('zip'),\n fn: zipCommand,\n write: true,\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RegisteredCommand } from '@struktoai/mirage-core'\nimport { DISK_AWK } from './awk.ts'\nimport { RAM_BASE64 } from './base64_cmd.ts'\nimport { DISK_BASENAME } from './basename.ts'\nimport { DISK_CAT } from './cat/cat.ts'\nimport { DISK_CAT_FEATHER } from './cat/cat_feather.ts'\nimport { RAM_CAT_HDF5 } from './cat/cat_hdf5.ts'\nimport { DISK_CAT_PARQUET } from './cat/cat_parquet.ts'\nimport { DISK_CMP } from './cmp.ts'\nimport { DISK_COLUMN } from './column.ts'\nimport { DISK_COMM } from './comm.ts'\nimport { DISK_CP } from './cp.ts'\nimport { DISK_CSPLIT } from './csplit.ts'\nimport { DISK_CUT } from './cut/cut.ts'\nimport { DISK_CUT_FEATHER } from './cut/cut_feather.ts'\nimport { RAM_CUT_HDF5 } from './cut/cut_hdf5.ts'\nimport { DISK_CUT_PARQUET } from './cut/cut_parquet.ts'\nimport { DISK_DIFF } from './diff.ts'\nimport { DISK_DIRNAME } from './dirname.ts'\nimport { DISK_DU } from './du.ts'\nimport { DISK_EXPAND } from './expand.ts'\nimport { DISK_FILE } from './file/file.ts'\nimport { DISK_FILE_FEATHER } from './file/file_feather.ts'\nimport { RAM_FILE_HDF5 } from './file/file_hdf5.ts'\nimport { DISK_FILE_PARQUET } from './file/file_parquet.ts'\nimport { DISK_FIND } from './find.ts'\nimport { DISK_FMT } from './fmt.ts'\nimport { DISK_FOLD } from './fold.ts'\nimport { DISK_GREP } from './grep/grep.ts'\nimport { DISK_GREP_FEATHER } from './grep/grep_feather.ts'\nimport { RAM_GREP_HDF5 } from './grep/grep_hdf5.ts'\nimport { DISK_GREP_PARQUET } from './grep/grep_parquet.ts'\nimport { DISK_GUNZIP } from './gunzip.ts'\nimport { DISK_GZIP } from './gzip.ts'\nimport { DISK_HEAD } from './head/head.ts'\nimport { DISK_HEAD_FEATHER } from './head/head_feather.ts'\nimport { RAM_HEAD_HDF5 } from './head/head_hdf5.ts'\nimport { DISK_HEAD_PARQUET } from './head/head_parquet.ts'\nimport { DISK_ICONV } from './iconv.ts'\nimport { DISK_JOIN } from './join.ts'\nimport { DISK_JQ } from './jq.ts'\nimport { DISK_LN } from './ln.ts'\nimport { DISK_LOOK } from './look.ts'\nimport { DISK_LS } from './ls/ls.ts'\nimport { DISK_LS_FEATHER } from './ls/ls_feather.ts'\nimport { RAM_LS_HDF5 } from './ls/ls_hdf5.ts'\nimport { DISK_LS_PARQUET } from './ls/ls_parquet.ts'\nimport { RAM_MD5 } from './md5.ts'\nimport { DISK_MKDIR } from './mkdir.ts'\nimport { DISK_MKTEMP } from './mktemp.ts'\nimport { DISK_MV } from './mv.ts'\nimport { DISK_NL } from './nl.ts'\nimport { DISK_PASTE } from './paste.ts'\nimport { DISK_PATCH } from './patch.ts'\nimport { DISK_READLINK } from './readlink.ts'\nimport { DISK_REALPATH } from './realpath.ts'\nimport { DISK_REV } from './rev.ts'\nimport { DISK_RG } from './rg.ts'\nimport { DISK_RM } from './rm.ts'\nimport { DISK_SED } from './sed.ts'\nimport { RAM_SHA256SUM } from './sha256sum.ts'\nimport { DISK_SHUF } from './shuf.ts'\nimport { DISK_SORT } from './sort.ts'\nimport { DISK_SPLIT } from './split.ts'\nimport { DISK_STAT } from './stat/stat.ts'\nimport { DISK_STAT_FEATHER } from './stat/stat_feather.ts'\nimport { RAM_STAT_HDF5 } from './stat/stat_hdf5.ts'\nimport { DISK_STAT_PARQUET } from './stat/stat_parquet.ts'\nimport { DISK_STRINGS } from './strings.ts'\nimport { DISK_TAC } from './tac.ts'\nimport { DISK_TAIL } from './tail/tail.ts'\nimport { DISK_TAIL_FEATHER } from './tail/tail_feather.ts'\nimport { RAM_TAIL_HDF5 } from './tail/tail_hdf5.ts'\nimport { DISK_TAIL_PARQUET } from './tail/tail_parquet.ts'\nimport { DISK_TAR } from './tar.ts'\nimport { DISK_TEE } from './tee.ts'\nimport { DISK_TOUCH } from './touch.ts'\nimport { DISK_TR } from './tr.ts'\nimport { DISK_TREE } from './tree.ts'\nimport { DISK_TSORT } from './tsort.ts'\nimport { DISK_UNEXPAND } from './unexpand.ts'\nimport { DISK_UNIQ } from './uniq.ts'\nimport { DISK_UNZIP } from './unzip.ts'\nimport { DISK_WC } from './wc/wc.ts'\nimport { DISK_WC_FEATHER } from './wc/wc_feather.ts'\nimport { RAM_WC_HDF5 } from './wc/wc_hdf5.ts'\nimport { DISK_WC_PARQUET } from './wc/wc_parquet.ts'\nimport { DISK_XXD } from './xxd.ts'\nimport { DISK_ZCAT } from './zcat.ts'\nimport { DISK_ZGREP } from './zgrep.ts'\nimport { DISK_ZIP } from './zip_cmd.ts'\n\nexport const DISK_COMMANDS: readonly RegisteredCommand[] = [\n ...DISK_AWK,\n ...RAM_BASE64,\n ...DISK_BASENAME,\n ...DISK_CAT,\n ...DISK_CAT_FEATHER,\n ...RAM_CAT_HDF5,\n ...DISK_CAT_PARQUET,\n ...DISK_CMP,\n ...DISK_COLUMN,\n ...DISK_COMM,\n ...DISK_CP,\n ...DISK_CSPLIT,\n ...DISK_CUT,\n ...DISK_CUT_FEATHER,\n ...RAM_CUT_HDF5,\n ...DISK_CUT_PARQUET,\n ...DISK_DIFF,\n ...DISK_DIRNAME,\n ...DISK_DU,\n ...DISK_EXPAND,\n ...DISK_FILE,\n ...DISK_FILE_FEATHER,\n ...RAM_FILE_HDF5,\n ...DISK_FILE_PARQUET,\n ...DISK_FIND,\n ...DISK_FMT,\n ...DISK_FOLD,\n ...DISK_GREP,\n ...DISK_GREP_FEATHER,\n ...RAM_GREP_HDF5,\n ...DISK_GREP_PARQUET,\n ...DISK_GUNZIP,\n ...DISK_GZIP,\n ...DISK_HEAD,\n ...DISK_HEAD_FEATHER,\n ...RAM_HEAD_HDF5,\n ...DISK_HEAD_PARQUET,\n ...DISK_ICONV,\n ...DISK_JOIN,\n ...DISK_JQ,\n ...DISK_LN,\n ...DISK_LOOK,\n ...DISK_LS,\n ...DISK_LS_FEATHER,\n ...RAM_LS_HDF5,\n ...DISK_LS_PARQUET,\n ...RAM_MD5,\n ...DISK_MKDIR,\n ...DISK_MKTEMP,\n ...DISK_MV,\n ...DISK_NL,\n ...DISK_PASTE,\n ...DISK_PATCH,\n ...DISK_READLINK,\n ...DISK_REALPATH,\n ...DISK_REV,\n ...DISK_RG,\n ...DISK_RM,\n ...DISK_SED,\n ...RAM_SHA256SUM,\n ...DISK_SHUF,\n ...DISK_SORT,\n ...DISK_SPLIT,\n ...DISK_STAT,\n ...DISK_STAT_FEATHER,\n ...RAM_STAT_HDF5,\n ...DISK_STAT_PARQUET,\n ...DISK_STRINGS,\n ...DISK_TAC,\n ...DISK_TAIL,\n ...DISK_TAIL_FEATHER,\n ...RAM_TAIL_HDF5,\n ...DISK_TAIL_PARQUET,\n ...DISK_TAR,\n ...DISK_TEE,\n ...DISK_TOUCH,\n ...DISK_TR,\n ...DISK_TREE,\n ...DISK_TSORT,\n ...DISK_UNEXPAND,\n ...DISK_UNIQ,\n ...DISK_UNZIP,\n ...DISK_WC,\n ...DISK_WC_FEATHER,\n ...RAM_WC_HDF5,\n ...DISK_WC_PARQUET,\n ...DISK_XXD,\n ...DISK_ZCAT,\n ...DISK_ZGREP,\n ...DISK_ZIP,\n]\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { appendFile, mkdir } from 'node:fs/promises'\nimport path from 'node:path'\nimport { type PathSpec, record, ResourceName } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function appendBytes(\n accessor: DiskAccessor,\n p: PathSpec,\n data: Uint8Array,\n): Promise<void> {\n const start = performance.now()\n const virtual = p.stripPrefix\n const full = resolveSafe(accessor.root, virtual)\n await mkdir(path.dirname(full), { recursive: true })\n await appendFile(full, data)\n record('append', virtual, ResourceName.DISK, data.byteLength, start)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { writeBytes } from './write.ts'\n\nexport function create(accessor: DiskAccessor, path: PathSpec): Promise<void> {\n return writeBytes(accessor, path, new Uint8Array())\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { type IndexCacheStore, PathSpec } from '@struktoai/mirage-core'\nimport { SCOPE_ERROR } from './constants.ts'\nimport { readdir } from './readdir.ts'\n\nfunction fnmatch(name: string, pattern: string): boolean {\n let re = '^'\n for (const ch of pattern) {\n if (ch === '*') re += '.*'\n else if (ch === '?') re += '.'\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += '\\\\' + ch\n else re += ch\n }\n re += '$'\n return new RegExp(re).test(name)\n}\n\nfunction basenameOf(p: string): string {\n return p.slice(p.lastIndexOf('/') + 1)\n}\n\nexport async function resolveGlob(\n accessor: DiskAccessor,\n paths: readonly PathSpec[],\n index?: IndexCacheStore,\n): Promise<PathSpec[]> {\n const result: PathSpec[] = []\n for (const p of paths) {\n if (p.resolved) {\n result.push(p)\n } else if (p.pattern !== null) {\n const dirSpec = new PathSpec({\n original: p.directory,\n directory: p.directory,\n resolved: true,\n prefix: p.prefix,\n })\n const entries = await readdir(accessor, dirSpec, index)\n const matched: PathSpec[] = []\n for (const e of entries) {\n if (fnmatch(basenameOf(e), p.pattern)) {\n matched.push(\n new PathSpec({\n original: e,\n directory: p.directory,\n resolved: true,\n prefix: p.prefix,\n }),\n )\n }\n }\n if (matched.length > SCOPE_ERROR) matched.length = SCOPE_ERROR\n result.push(...matched)\n } else {\n result.push(p)\n }\n }\n return result\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { readFile, writeFile } from 'node:fs/promises'\nimport type { PathSpec } from '@struktoai/mirage-core'\nimport { resolveSafe } from './utils.ts'\n\nexport async function truncate(\n accessor: DiskAccessor,\n path: PathSpec,\n length: number,\n): Promise<void> {\n const full = resolveSafe(accessor.root, path.stripPrefix)\n let data: Buffer\n try {\n data = await readFile(full)\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') {\n data = Buffer.alloc(0)\n } else {\n throw err\n }\n }\n const out = new Uint8Array(length)\n out.set(data.subarray(0, Math.min(data.byteLength, length)))\n await writeFile(full, out)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { Accessor } from '@struktoai/mirage-core'\n\nexport class DiskAccessor extends Accessor {\n readonly root: string\n\n constructor(root: string) {\n super()\n this.root = root\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { appendBytes as coreAppend } from '../../core/disk/append.ts'\n\nexport const appendOp: RegisteredOp = {\n name: 'append',\n resource: ResourceName.DISK,\n filetype: null,\n write: true,\n fn: (accessor: DiskAccessor, path: PathSpec, args: readonly unknown[]) => {\n const data = args[0]\n if (!(data instanceof Uint8Array)) {\n throw new TypeError('append op requires a Uint8Array as the first arg')\n }\n return coreAppend(accessor, path, data)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { create as coreCreate } from '../../core/disk/create.ts'\n\nexport const createOp: RegisteredOp = {\n name: 'create',\n resource: ResourceName.DISK,\n filetype: null,\n write: true,\n fn: (accessor: DiskAccessor, path: PathSpec) => {\n return coreCreate(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { mkdir as coreMkdir } from '../../core/disk/mkdir.ts'\n\nexport const mkdirOp: RegisteredOp = {\n name: 'mkdir',\n resource: ResourceName.DISK,\n filetype: null,\n write: true,\n fn: (accessor: DiskAccessor, path: PathSpec) => {\n return coreMkdir(accessor, path, true)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { read as coreRead } from '../../core/disk/read.ts'\n\nexport const readOp: RegisteredOp = {\n name: 'read',\n resource: ResourceName.DISK,\n filetype: null,\n write: false,\n fn: (accessor: DiskAccessor, path: PathSpec) => {\n return coreRead(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { featherCat, type PathSpec, type RegisteredOp, ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { read as coreRead } from '../../core/disk/read.ts'\n\nexport const readFeatherOp: RegisteredOp = {\n name: 'read',\n resource: ResourceName.DISK,\n filetype: '.feather',\n write: false,\n fn: async (accessor: DiskAccessor, path: PathSpec) => {\n const raw = await coreRead(accessor, path)\n return featherCat(raw)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { hdf5Cat, type PathSpec, type RegisteredOp, ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { read as coreRead } from '../../core/disk/read.ts'\n\nexport const readHdf5Op: RegisteredOp = {\n name: 'read',\n resource: ResourceName.DISK,\n filetype: '.hdf5',\n write: false,\n fn: async (accessor: DiskAccessor, path: PathSpec) => {\n const raw = await coreRead(accessor, path)\n return hdf5Cat(raw)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { parquetCat, type PathSpec, type RegisteredOp, ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { read as coreRead } from '../../core/disk/read.ts'\n\nexport const readParquetOp: RegisteredOp = {\n name: 'read',\n resource: ResourceName.DISK,\n filetype: '.parquet',\n write: false,\n fn: async (accessor: DiskAccessor, path: PathSpec) => {\n const raw = await coreRead(accessor, path)\n return parquetCat(raw)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { readdir as coreReaddir } from '../../core/disk/readdir.ts'\n\nexport const readdirOp: RegisteredOp = {\n name: 'readdir',\n resource: ResourceName.DISK,\n filetype: null,\n write: false,\n fn: (accessor: DiskAccessor, path: PathSpec) => {\n return coreReaddir(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { rename as coreRename } from '../../core/disk/rename.ts'\n\nexport const renameOp: RegisteredOp = {\n name: 'rename',\n resource: ResourceName.DISK,\n filetype: null,\n write: true,\n fn: (accessor: DiskAccessor, path: PathSpec, args: readonly unknown[]) => {\n const dst = args[0]\n if (dst === undefined || dst === null || typeof dst !== 'object' || !('original' in dst)) {\n throw new TypeError('rename op requires a PathSpec destination as the first arg')\n }\n return coreRename(accessor, path, dst as PathSpec)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { rmdir as coreRmdir } from '../../core/disk/rmdir.ts'\n\nexport const rmdirOp: RegisteredOp = {\n name: 'rmdir',\n resource: ResourceName.DISK,\n filetype: null,\n write: true,\n fn: (accessor: DiskAccessor, path: PathSpec) => {\n return coreRmdir(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { stat as coreStat } from '../../core/disk/stat.ts'\n\nexport const statOp: RegisteredOp = {\n name: 'stat',\n resource: ResourceName.DISK,\n filetype: null,\n write: false,\n fn: (accessor: DiskAccessor, path: PathSpec) => {\n return coreStat(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { truncate as coreTruncate } from '../../core/disk/truncate.ts'\n\nexport const truncateOp: RegisteredOp = {\n name: 'truncate',\n resource: ResourceName.DISK,\n filetype: null,\n write: true,\n fn: (accessor: DiskAccessor, path: PathSpec, args: readonly unknown[]) => {\n const length = args[0]\n if (typeof length !== 'number') {\n throw new TypeError('truncate op requires a number length as the first arg')\n }\n return coreTruncate(accessor, path, length)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { PathSpec, RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { unlink as coreUnlink } from '../../core/disk/unlink.ts'\n\nexport const unlinkOp: RegisteredOp = {\n name: 'unlink',\n resource: ResourceName.DISK,\n filetype: null,\n write: true,\n fn: (accessor: DiskAccessor, path: PathSpec) => {\n return coreUnlink(accessor, path)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { extractWriteData, type PathSpec, type RegisteredOp } from '@struktoai/mirage-core'\nimport { ResourceName } from '@struktoai/mirage-core'\nimport type { DiskAccessor } from '../../accessor/disk.ts'\nimport { writeBytes } from '../../core/disk/write.ts'\n\nexport const writeOp: RegisteredOp = {\n name: 'write',\n resource: ResourceName.DISK,\n filetype: null,\n write: true,\n fn: (accessor: DiskAccessor, path: PathSpec, args: readonly unknown[]) => {\n const data = extractWriteData(args)\n return writeBytes(accessor, path, data)\n },\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RegisteredOp } from '@struktoai/mirage-core'\nimport { appendOp } from './append.ts'\nimport { createOp } from './create.ts'\nimport { mkdirOp } from './mkdir.ts'\nimport { readOp } from './read.ts'\nimport { readFeatherOp } from './read_feather.ts'\nimport { readHdf5Op } from './read_hdf5.ts'\nimport { readParquetOp } from './read_parquet.ts'\nimport { readdirOp } from './readdir.ts'\nimport { renameOp } from './rename.ts'\nimport { rmdirOp } from './rmdir.ts'\nimport { statOp } from './stat.ts'\nimport { truncateOp } from './truncate.ts'\nimport { unlinkOp } from './unlink.ts'\nimport { writeOp } from './write.ts'\n\nexport const DISK_OPS: readonly RegisteredOp[] = [\n appendOp,\n createOp,\n mkdirOp,\n readOp,\n readFeatherOp,\n readHdf5Op,\n readParquetOp,\n readdirOp,\n renameOp,\n rmdirOp,\n statOp,\n truncateOp,\n unlinkOp,\n writeOp,\n]\n\nexport {\n appendOp,\n createOp,\n mkdirOp,\n readOp,\n readFeatherOp,\n readHdf5Op,\n readParquetOp,\n readdirOp,\n renameOp,\n rmdirOp,\n statOp,\n truncateOp,\n unlinkOp,\n writeOp,\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport const DISK_PROMPT = `{prefix}\n Local disk filesystem. Mirrors the configured root directory.\n Standard commands: ls, cat, head, tail, grep, wc, find, tree, mkdir, touch, cp, mv, rm, tee.`\n"],"mappings":";;;;;AAcA,SAAS,SAAAA,QAAO,WAAAC,UAAS,YAAAC,YAAU,aAAAC,kBAAiB;AACpD,OAAOC,WAAU;AACjB;AAAA,EAIE,YAAAC;AAAA,EACA;AAAA,EAIA,gBAAAC;AAAA,OACK;;;ACZP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;;;ACVP,SAAS,wBAAwB;AACjC,SAAwB,cAAc,oBAAoB;;;ACF1D,OAAO,UAAU;AAEV,SAAS,YAAY,MAAc,SAAyB;AACjE,QAAM,WAAW,QAAQ,QAAQ,QAAQ,EAAE;AAC3C,QAAM,WAAW,KAAK,QAAQ,MAAM,QAAQ;AAC5C,QAAM,eAAe,KAAK,QAAQ,IAAI;AACtC,MAAI,aAAa,gBAAgB,CAAC,SAAS,WAAW,eAAe,KAAK,GAAG,GAAG;AAC9E,UAAM,IAAI,MAAM,sBAAsB,OAAO,EAAE;AAAA,EACjD;AACA,SAAO;AACT;AAEO,SAAS,KAAK,GAAmB;AACtC,SAAO,IAAI,EAAE,QAAQ,cAAc,EAAE,CAAC;AACxC;;;ADTA,gBAAuB,OAAO,UAAwBC,OAA2C;AAC/F,QAAM,UAAUA,MAAK;AACrB,QAAM,OAAO,YAAY,SAAS,MAAM,OAAO;AAC/C,QAAM,MAAM,aAAa,QAAQ,SAAS,aAAa,IAAI;AAC3D,QAAM,KAAK,iBAAiB,MAAM,EAAE,eAAe,MAAM,CAAC;AAC1D,MAAI;AACF,qBAAiB,SAAS,IAAI;AAC5B,YAAM,MAAM;AACZ,YAAM,KAAK,IAAI,WAAW,IAAI,QAAQ,IAAI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CAAC,MACT,EAAE,SACE,IACA,IAAIE,WAAS;AAAA,QACX,UAAU,EAAE;AAAA,QACZ,WAAW,EAAE;AAAA,QACb,GAAI,EAAE,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACP,IACA;AACJ,WAAO,YAAS,KAAK,UAAU,WAAW,KAAK,KAAK;AAAA,EACtD;AAAA,EAEA,MAAM,WAAuC;AAC3C,UAAMF,OAAM,KAAK,MAAM,EAAE,WAAW,KAAK,CAAC;AAC1C,UAAM,QAAoC,CAAC;AAC3C,UAAM,WAAqB,CAAC;AAC5B,UAAM,UAAU,KAAK,MAAM,KAAK,MAAM,QAAQ;AAC9C,eAAW,QAAQ,UAAU;AAC3B,YAAM,MAAMF,MAAK,SAAS,KAAK,MAAM,IAAI,EAAE,MAAMA,MAAK,GAAG,EAAE,KAAK,GAAG;AACnE,YAAM,OAAO,MAAMK,WAAS,IAAI;AAChC,YAAM,GAAG,IAAI,IAAI,WAAW,KAAK,QAAQ,KAAK,YAAY,KAAK,UAAU;AAAA,IAC3E;AACA,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,eAAe;AAAA,MACf,gBAAgB,CAAC;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM,UAAU,OAAyC;AACvD,UAAMH,OAAM,KAAK,MAAM,EAAE,WAAW,KAAK,CAAC;AAC1C,eAAW,CAAC,KAAK,IAAI,KAAK,OAAO,QAAQ,MAAM,KAAK,GAAG;AACrD,YAAM,OAAOF,MAAK,KAAK,KAAK,MAAM,GAAG;AACrC,YAAME,OAAMF,MAAK,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;AACnD,YAAMM,WAAU,MAAM,IAAI;AAAA,IAC5B;AAAA,EACF;AACF;","names":["mkdir","readdir","readFile","writeFile","path","PathSpec","ResourceName","ResourceName","path","ResourceName","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","path","path","ENC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","limit","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","splitLinesNoTrailing","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","specOf","path","path","stat","path","path","stat","path","PathSpec","IOResult","out","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","readStdinAsync","specOf","mkdir","path","ResourceName","mkdir","path","ResourceName","ENC","DEC","splitLinesNoTrailing","PathSpec","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","readFile","materialize","path2","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","IOResult","PathSpec","ResourceName","command","specOf","readdir","stat","path","stat","readdir","path","PathSpec","path","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","FileType","IOResult","ResourceName","command","specOf","readFile","record","ResourceName","path","readFile","record","ResourceName","ENC","IOResult","FileType","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","specOf","PathSpec","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","FileType","IOResult","PathSpec","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","readFile","materialize","splitLinesNoTrailing","FileType","PathSpec","IOResult","pat","source","stream","io","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","resolveSource","specOf","path","ENC","makePathSpec","PathSpec","resolveSource","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","gunzip","materialize","resolveSource","specOf","ENC","makePathSpec","PathSpec","decompress","resolveSource","IOResult","materialize","gunzip","concat","command","ResourceName","specOf","AsyncLineIterator","IOResult","ProvisionResult","ResourceName","command","resolveSource","specOf","ENC","AsyncLineIterator","ProvisionResult","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","readStdinAsync","specOf","ENC","IOResult","materialize","readStdinAsync","PathSpec","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","DEC","splitLinesNoTrailing","splitFields","IOResult","materialize","command","ResourceName","specOf","IOResult","Precision","ProvisionResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","ProvisionResult","Precision","concat","readFile","materialize","IOResult","bytes","data","result","spread","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","exists","path","ENC","IOResult","exists","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","FileType","IOResult","PathSpec","ResourceName","command","specOf","readdir","path","humanSize","PathSpec","FileType","readdir","out","exitCode","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","stat","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","stat","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","stat","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","materialize","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","mkdir","path","IOResult","mkdir","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","specOf","ENC","makePathSpec","PathSpec","path","mkdir","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","exists","path","IOResult","command","ResourceName","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","readStdinAsync","materialize","IOResult","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","path","splitLinesNoTrailing","makePathSpec","PathSpec","stripMount","materialize","readStdinAsync","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","normalize","IOResult","ResourceName","command","specOf","path","IOResult","command","ResourceName","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","FileType","IOResult","PathSpec","ResourceName","command","compilePattern","exitOnEmpty","grepStream","materialize","resolveSource","specOf","ENC","IOResult","resolveSource","compilePattern","stream","grepStream","exitOnEmpty","FileType","readdir","materialize","io","path","PathSpec","command","ResourceName","specOf","FileType","IOResult","ResourceName","command","specOf","path","path","IOResult","FileType","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","parseProgram","readStdinAsync","specOf","ENC","DEC","readFile","materialize","IOResult","parseProgram","writes","text","out","result","readStdinAsync","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","makePathSpec","PathSpec","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","out","result","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoEnds","readFile","materialize","readStdinAsync","IOResult","command","ResourceName","specOf","AsyncLineIterator","IOResult","PathSpec","ResourceName","command","resolveSource","specOf","ENC","makePathSpec","PathSpec","resolveSource","IOResult","AsyncLineIterator","joinLines","command","ResourceName","specOf","FileType","IOResult","ProvisionResult","ResourceName","command","specOf","FileType","ProvisionResult","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","AsyncLineIterator","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","headerAggregate","materialize","readStdinAsync","specOf","ENC","readFile","materialize","raw","concat","IOResult","readStdinAsync","command","ResourceName","specOf","headerAggregate","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","gunzip","gzip","materialize","specOf","ENC","makePathSpec","PathSpec","fnmatch","gunzip","create","IOResult","materialize","gzip","mkdir","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","IOResult","readStdinAsync","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","specOf","ENC","IOResult","exists","command","ResourceName","specOf","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","IOResult","resolveSource","command","ResourceName","specOf","FileType","IOResult","PathSpec","ResourceName","command","specOf","fnmatch","path","readdir","PathSpec","FileType","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","IOResult","materialize","readStdinAsync","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesKeepEnds","materialize","result","IOResult","readStdinAsync","command","ResourceName","specOf","AsyncLineIterator","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","padLeft","out","AsyncLineIterator","parseOptions","IOResult","resolveSource","command","ResourceName","specOf","IOResult","PathSpec","ResourceName","command","materialize","specOf","ENC","DEC","makePathSpec","PathSpec","path","mkdir","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","resolveSource","specOf","ENC","DEC","materialize","text","IOResult","resolveSource","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","IOResult","materialize","command","ResourceName","specOf","IOResult","ResourceName","command","resolveSource","specOf","ENC","DEC","padRight","ENC","DEC","IOResult","resolveSource","ENC","command","ResourceName","specOf","IOResult","ResourceName","command","gunzip","materialize","readStdinAsync","specOf","ENC","materialize","readStdinAsync","IOResult","gunzip","command","ResourceName","specOf","IOResult","ResourceName","command","compilePattern","gunzip","materialize","readStdinAsync","specOf","ENC","DEC","splitLinesNoTrailing","compilePattern","materialize","gunzip","result","readStdinAsync","IOResult","command","ResourceName","specOf","IOResult","ResourceName","command","materialize","specOf","ENC","path","concat","IOResult","materialize","command","ResourceName","specOf","mkdir","path","record","ResourceName","mkdir","path","record","ResourceName","path","PathSpec","fnmatch","PathSpec","readdir","readFile","writeFile","path","readFile","writeFile","ResourceName","ResourceName","path","ResourceName","ResourceName","path","ResourceName","ResourceName","path","mkdir","ResourceName","ResourceName","path","featherCat","ResourceName","ResourceName","path","featherCat","hdf5Cat","ResourceName","ResourceName","path","hdf5Cat","parquetCat","ResourceName","ResourceName","path","parquetCat","ResourceName","ResourceName","path","readdir","ResourceName","ResourceName","path","ResourceName","ResourceName","path","ResourceName","ResourceName","path","ResourceName","ResourceName","path","ResourceName","ResourceName","path","ResourceName","ResourceName","path","readdir","path","ResourceName","mkdir","exists","PathSpec","readFile","writeFile"]}