@fnndsc/brasa 0.57.4 → 0.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (512) hide show
  1. package/dist/api/models.d.ts +2 -3
  2. package/dist/api/models.js.map +1 -1
  3. package/dist/buildinfo.json +1 -1
  4. package/dist/builtins/argumentTokens.js +25 -6
  5. package/dist/builtins/argumentTokens.js.map +1 -1
  6. package/dist/builtins/berth/berth.d.ts +0 -14
  7. package/dist/builtins/berth/berth.js +255 -88
  8. package/dist/builtins/berth/berth.js.map +1 -1
  9. package/dist/builtins/berth/berthClose.d.ts +66 -1
  10. package/dist/builtins/berth/berthClose.js +312 -26
  11. package/dist/builtins/berth/berthClose.js.map +1 -1
  12. package/dist/builtins/berth/berthClosed.d.ts +212 -0
  13. package/dist/builtins/berth/berthClosed.js +231 -0
  14. package/dist/builtins/berth/berthClosed.js.map +1 -0
  15. package/dist/builtins/berth/berthCube.js +27 -6
  16. package/dist/builtins/berth/berthCube.js.map +1 -1
  17. package/dist/builtins/berth/berthDisk.js +1 -1
  18. package/dist/builtins/berth/berthDisk.js.map +1 -1
  19. package/dist/builtins/berth/berthProcesses.js +15 -3
  20. package/dist/builtins/berth/berthProcesses.js.map +1 -1
  21. package/dist/builtins/berth/berthRecord.d.ts +14 -2
  22. package/dist/builtins/berth/berthRecord.js +20 -5
  23. package/dist/builtins/berth/berthRecord.js.map +1 -1
  24. package/dist/builtins/berth/berthState.d.ts +26 -6
  25. package/dist/builtins/berth/berthState.js +47 -13
  26. package/dist/builtins/berth/berthState.js.map +1 -1
  27. package/dist/builtins/debug.d.ts +0 -8
  28. package/dist/builtins/debug.js +1 -12
  29. package/dist/builtins/debug.js.map +1 -1
  30. package/dist/builtins/executable.js +102 -75
  31. package/dist/builtins/executable.js.map +1 -1
  32. package/dist/builtins/feedTotals.js +30 -25
  33. package/dist/builtins/feedTotals.js.map +1 -1
  34. package/dist/builtins/fs/acl.args.d.ts +3 -10
  35. package/dist/builtins/fs/acl.args.js +16 -24
  36. package/dist/builtins/fs/acl.args.js.map +1 -1
  37. package/dist/builtins/fs/acl.d.ts +0 -37
  38. package/dist/builtins/fs/acl.js +36 -58
  39. package/dist/builtins/fs/acl.js.map +1 -1
  40. package/dist/builtins/fs/archive.js +4 -7
  41. package/dist/builtins/fs/archive.js.map +1 -1
  42. package/dist/builtins/fs/cat.d.ts +0 -16
  43. package/dist/builtins/fs/cat.js +163 -96
  44. package/dist/builtins/fs/cat.js.map +1 -1
  45. package/dist/builtins/fs/cd.js +23 -5
  46. package/dist/builtins/fs/cd.js.map +1 -1
  47. package/dist/builtins/fs/configWrite.d.ts +0 -8
  48. package/dist/builtins/fs/configWrite.js +33 -46
  49. package/dist/builtins/fs/configWrite.js.map +1 -1
  50. package/dist/builtins/fs/cp.d.ts +6 -10
  51. package/dist/builtins/fs/cp.js +83 -86
  52. package/dist/builtins/fs/cp.js.map +1 -1
  53. package/dist/builtins/fs/deliveryIntent.d.ts +24 -0
  54. package/dist/builtins/fs/deliveryIntent.js +182 -0
  55. package/dist/builtins/fs/deliveryIntent.js.map +1 -0
  56. package/dist/builtins/fs/deliveryMatch.d.ts +138 -0
  57. package/dist/builtins/fs/deliveryMatch.js +135 -0
  58. package/dist/builtins/fs/deliveryMatch.js.map +1 -0
  59. package/dist/builtins/fs/destination.d.ts +37 -1
  60. package/dist/builtins/fs/destination.js +80 -0
  61. package/dist/builtins/fs/destination.js.map +1 -1
  62. package/dist/builtins/fs/download.d.ts +19 -8
  63. package/dist/builtins/fs/download.js +142 -72
  64. package/dist/builtins/fs/download.js.map +1 -1
  65. package/dist/builtins/fs/du.d.ts +0 -8
  66. package/dist/builtins/fs/du.js +23 -20
  67. package/dist/builtins/fs/du.js.map +1 -1
  68. package/dist/builtins/fs/edit.js +117 -50
  69. package/dist/builtins/fs/edit.js.map +1 -1
  70. package/dist/builtins/fs/entries.d.ts +38 -0
  71. package/dist/builtins/fs/entries.js +48 -1
  72. package/dist/builtins/fs/entries.js.map +1 -1
  73. package/dist/builtins/fs/find.d.ts +1 -1
  74. package/dist/builtins/fs/find.js +462 -271
  75. package/dist/builtins/fs/find.js.map +1 -1
  76. package/dist/builtins/fs/ls.d.ts +2 -8
  77. package/dist/builtins/fs/ls.js +144 -93
  78. package/dist/builtins/fs/ls.js.map +1 -1
  79. package/dist/builtins/fs/mkdir.d.ts +2 -7
  80. package/dist/builtins/fs/mkdir.js +110 -58
  81. package/dist/builtins/fs/mkdir.js.map +1 -1
  82. package/dist/builtins/fs/mv.d.ts +7 -10
  83. package/dist/builtins/fs/mv.js +155 -100
  84. package/dist/builtins/fs/mv.js.map +1 -1
  85. package/dist/builtins/fs/pull.js +155 -92
  86. package/dist/builtins/fs/pull.js.map +1 -1
  87. package/dist/builtins/fs/pwd.d.ts +0 -7
  88. package/dist/builtins/fs/pwd.js +0 -12
  89. package/dist/builtins/fs/pwd.js.map +1 -1
  90. package/dist/builtins/fs/rm.d.ts +6 -7
  91. package/dist/builtins/fs/rm.js +364 -174
  92. package/dist/builtins/fs/rm.js.map +1 -1
  93. package/dist/builtins/fs/rmdir.d.ts +0 -7
  94. package/dist/builtins/fs/rmdir.js +40 -21
  95. package/dist/builtins/fs/rmdir.js.map +1 -1
  96. package/dist/builtins/fs/touch.d.ts +0 -7
  97. package/dist/builtins/fs/touch.js +14 -27
  98. package/dist/builtins/fs/touch.js.map +1 -1
  99. package/dist/builtins/fs/transferJobs.d.ts +12 -0
  100. package/dist/builtins/fs/transferJobs.js +19 -0
  101. package/dist/builtins/fs/transferJobs.js.map +1 -1
  102. package/dist/builtins/fs/tree.d.ts +0 -8
  103. package/dist/builtins/fs/tree.js +1 -12
  104. package/dist/builtins/fs/tree.js.map +1 -1
  105. package/dist/builtins/fs/upload.d.ts +0 -8
  106. package/dist/builtins/fs/upload.js +23 -20
  107. package/dist/builtins/fs/upload.js.map +1 -1
  108. package/dist/builtins/fs/url.d.ts +14 -2
  109. package/dist/builtins/fs/url.js +6 -8
  110. package/dist/builtins/fs/url.js.map +1 -1
  111. package/dist/builtins/fs/writeReport.d.ts +40 -0
  112. package/dist/builtins/fs/writeReport.js +71 -0
  113. package/dist/builtins/fs/writeReport.js.map +1 -0
  114. package/dist/builtins/fs/xattr.args.d.ts +14 -13
  115. package/dist/builtins/fs/xattr.args.js +3 -24
  116. package/dist/builtins/fs/xattr.args.js.map +1 -1
  117. package/dist/builtins/fs/xattr.d.ts +0 -25
  118. package/dist/builtins/fs/xattr.js +82 -65
  119. package/dist/builtins/fs/xattr.js.map +1 -1
  120. package/dist/builtins/games/bytes.d.ts +0 -55
  121. package/dist/builtins/games/bytes.js +95 -120
  122. package/dist/builtins/games/bytes.js.map +1 -1
  123. package/dist/builtins/games/chimes.d.ts +0 -36
  124. package/dist/builtins/games/chimes.js +58 -64
  125. package/dist/builtins/games/chimes.js.map +1 -1
  126. package/dist/builtins/games/chrislab.d.ts +0 -12
  127. package/dist/builtins/games/chrislab.js +0 -14
  128. package/dist/builtins/games/chrislab.js.map +1 -1
  129. package/dist/builtins/games/cowsay.d.ts +0 -24
  130. package/dist/builtins/games/cowsay.js +0 -29
  131. package/dist/builtins/games/cowsay.js.map +1 -1
  132. package/dist/builtins/games/figlet.d.ts +0 -24
  133. package/dist/builtins/games/figlet.js +0 -29
  134. package/dist/builtins/games/figlet.js.map +1 -1
  135. package/dist/builtins/games/lab.d.ts +0 -36
  136. package/dist/builtins/games/lab.js +0 -43
  137. package/dist/builtins/games/lab.js.map +1 -1
  138. package/dist/builtins/games/lolcat.d.ts +0 -12
  139. package/dist/builtins/games/lolcat.js +2 -17
  140. package/dist/builtins/games/lolcat.js.map +1 -1
  141. package/dist/builtins/games/numbers.d.ts +0 -60
  142. package/dist/builtins/games/numbers.js +0 -71
  143. package/dist/builtins/games/numbers.js.map +1 -1
  144. package/dist/builtins/games/play.d.ts +0 -36
  145. package/dist/builtins/games/play.js +47 -58
  146. package/dist/builtins/games/play.js.map +1 -1
  147. package/dist/builtins/games/qr.d.ts +0 -12
  148. package/dist/builtins/games/qr.js +189 -68
  149. package/dist/builtins/games/qr.js.map +1 -1
  150. package/dist/builtins/games/show.d.ts +0 -73
  151. package/dist/builtins/games/show.js +0 -85
  152. package/dist/builtins/games/show.js.map +1 -1
  153. package/dist/builtins/games/sky.d.ts +0 -36
  154. package/dist/builtins/games/sky.js +25 -45
  155. package/dist/builtins/games/sky.js.map +1 -1
  156. package/dist/builtins/games/text.d.ts +0 -72
  157. package/dist/builtins/games/text.js +0 -85
  158. package/dist/builtins/games/text.js.map +1 -1
  159. package/dist/builtins/games/trek.d.ts +0 -12
  160. package/dist/builtins/games/trek.js +0 -15
  161. package/dist/builtins/games/trek.js.map +1 -1
  162. package/dist/builtins/games/wtf.d.ts +0 -12
  163. package/dist/builtins/games/wtf.js +0 -15
  164. package/dist/builtins/games/wtf.js.map +1 -1
  165. package/dist/builtins/help.d.ts +0 -19
  166. package/dist/builtins/help.js +56 -39
  167. package/dist/builtins/help.js.map +1 -1
  168. package/dist/builtins/helpSections.js +13 -1
  169. package/dist/builtins/helpSections.js.map +1 -1
  170. package/dist/builtins/index.d.ts +1 -1
  171. package/dist/builtins/index.js +1 -1
  172. package/dist/builtins/index.js.map +1 -1
  173. package/dist/builtins/net/connect.d.ts +1 -8
  174. package/dist/builtins/net/connect.js +2 -13
  175. package/dist/builtins/net/connect.js.map +1 -1
  176. package/dist/builtins/net/cubepath.js +30 -20
  177. package/dist/builtins/net/cubepath.js.map +1 -1
  178. package/dist/builtins/net/logout.d.ts +0 -8
  179. package/dist/builtins/net/logout.js +1 -12
  180. package/dist/builtins/net/logout.js.map +1 -1
  181. package/dist/builtins/net/netstat.d.ts +0 -8
  182. package/dist/builtins/net/netstat.js +1 -12
  183. package/dist/builtins/net/netstat.js.map +1 -1
  184. package/dist/builtins/net/pacs.d.ts +3 -17
  185. package/dist/builtins/net/pacs.js +50 -42
  186. package/dist/builtins/net/pacs.js.map +1 -1
  187. package/dist/builtins/net/pacsUtils.d.ts +0 -2
  188. package/dist/builtins/net/pacsUtils.js +67 -30
  189. package/dist/builtins/net/pacsUtils.js.map +1 -1
  190. package/dist/builtins/net/query.anon.d.ts +61 -0
  191. package/dist/builtins/net/query.anon.js +362 -0
  192. package/dist/builtins/net/query.anon.js.map +1 -0
  193. package/dist/builtins/net/query.args.d.ts +2 -1
  194. package/dist/builtins/net/query.args.js +1 -1
  195. package/dist/builtins/net/query.args.js.map +1 -1
  196. package/dist/builtins/net/query.cohort.d.ts +125 -0
  197. package/dist/builtins/net/query.cohort.js +267 -0
  198. package/dist/builtins/net/query.cohort.js.map +1 -0
  199. package/dist/builtins/net/query.csv.d.ts +26 -5
  200. package/dist/builtins/net/query.csv.js +61 -115
  201. package/dist/builtins/net/query.csv.js.map +1 -1
  202. package/dist/builtins/net/query.d.ts +27 -34
  203. package/dist/builtins/net/query.deliver.d.ts +96 -0
  204. package/dist/builtins/net/query.deliver.js +188 -0
  205. package/dist/builtins/net/query.deliver.js.map +1 -0
  206. package/dist/builtins/net/query.fanout.d.ts +32 -0
  207. package/dist/builtins/net/query.fanout.js +91 -0
  208. package/dist/builtins/net/query.fanout.js.map +1 -1
  209. package/dist/builtins/net/query.held.d.ts +60 -0
  210. package/dist/builtins/net/query.held.js +125 -0
  211. package/dist/builtins/net/query.held.js.map +1 -0
  212. package/dist/builtins/net/query.ignored.d.ts +3 -1
  213. package/dist/builtins/net/query.ignored.js +9 -3
  214. package/dist/builtins/net/query.ignored.js.map +1 -1
  215. package/dist/builtins/net/query.js +360 -634
  216. package/dist/builtins/net/query.js.map +1 -1
  217. package/dist/builtins/net/query.model.d.ts +15 -0
  218. package/dist/builtins/net/query.model.js +109 -46
  219. package/dist/builtins/net/query.model.js.map +1 -1
  220. package/dist/builtins/net/query.view.js +29 -8
  221. package/dist/builtins/net/query.view.js.map +1 -1
  222. package/dist/builtins/operandRuns.js +4 -3
  223. package/dist/builtins/operandRuns.js.map +1 -1
  224. package/dist/builtins/operands.js +97 -39
  225. package/dist/builtins/operands.js.map +1 -1
  226. package/dist/builtins/pluginExecute.js +311 -205
  227. package/dist/builtins/pluginExecute.js.map +1 -1
  228. package/dist/builtins/proc.d.ts +1 -13
  229. package/dist/builtins/proc.helpers.d.ts +0 -7
  230. package/dist/builtins/proc.helpers.js +0 -10
  231. package/dist/builtins/proc.helpers.js.map +1 -1
  232. package/dist/builtins/proc.js +159 -116
  233. package/dist/builtins/proc.js.map +1 -1
  234. package/dist/builtins/procWatch.d.ts +2 -2
  235. package/dist/builtins/procWatch.js +54 -13
  236. package/dist/builtins/procWatch.js.map +1 -1
  237. package/dist/builtins/res/compute.d.ts +0 -13
  238. package/dist/builtins/res/compute.js +0 -16
  239. package/dist/builtins/res/compute.js.map +1 -1
  240. package/dist/builtins/res/diagram.tree.js +36 -12
  241. package/dist/builtins/res/diagram.tree.js.map +1 -1
  242. package/dist/builtins/res/dicom.d.ts +24 -17
  243. package/dist/builtins/res/dicom.js +78 -79
  244. package/dist/builtins/res/dicom.js.map +1 -1
  245. package/dist/builtins/res/expect.d.ts +8 -17
  246. package/dist/builtins/res/expect.js +173 -101
  247. package/dist/builtins/res/expect.js.map +1 -1
  248. package/dist/builtins/res/feed.d.ts +0 -13
  249. package/dist/builtins/res/feed.diagram.js +89 -57
  250. package/dist/builtins/res/feed.diagram.js.map +1 -1
  251. package/dist/builtins/res/feed.js +61 -42
  252. package/dist/builtins/res/feed.js.map +1 -1
  253. package/dist/builtins/res/feed.tree.collapse.d.ts +0 -10
  254. package/dist/builtins/res/feed.tree.collapse.js +12 -5
  255. package/dist/builtins/res/feed.tree.collapse.js.map +1 -1
  256. package/dist/builtins/res/files.d.ts +0 -37
  257. package/dist/builtins/res/files.js +0 -44
  258. package/dist/builtins/res/files.js.map +1 -1
  259. package/dist/builtins/res/gather.d.ts +0 -13
  260. package/dist/builtins/res/gather.facts.js +24 -16
  261. package/dist/builtins/res/gather.facts.js.map +1 -1
  262. package/dist/builtins/res/gather.js +47 -36
  263. package/dist/builtins/res/gather.js.map +1 -1
  264. package/dist/builtins/res/gather.process.js +49 -15
  265. package/dist/builtins/res/gather.process.js.map +1 -1
  266. package/dist/builtins/res/gather.store.d.ts +4 -2
  267. package/dist/builtins/res/gather.store.js +43 -31
  268. package/dist/builtins/res/gather.store.js.map +1 -1
  269. package/dist/builtins/res/group.d.ts +0 -13
  270. package/dist/builtins/res/group.js +78 -40
  271. package/dist/builtins/res/group.js.map +1 -1
  272. package/dist/builtins/res/image.d.ts +0 -13
  273. package/dist/builtins/res/image.js +0 -15
  274. package/dist/builtins/res/image.js.map +1 -1
  275. package/dist/builtins/res/manifestRead.d.ts +65 -0
  276. package/dist/builtins/res/manifestRead.js +161 -0
  277. package/dist/builtins/res/manifestRead.js.map +1 -0
  278. package/dist/builtins/res/pipeline.d.ts +1 -1
  279. package/dist/builtins/res/pipeline.js +152 -103
  280. package/dist/builtins/res/pipeline.js.map +1 -1
  281. package/dist/builtins/res/pipeline.manifest.js +17 -7
  282. package/dist/builtins/res/pipeline.manifest.js.map +1 -1
  283. package/dist/builtins/res/play.d.ts +0 -13
  284. package/dist/builtins/res/play.js +367 -226
  285. package/dist/builtins/res/play.js.map +1 -1
  286. package/dist/builtins/res/plugin.d.ts +1 -13
  287. package/dist/builtins/res/plugin.info.js +36 -14
  288. package/dist/builtins/res/plugin.info.js.map +1 -1
  289. package/dist/builtins/res/plugin.js +1 -17
  290. package/dist/builtins/res/plugin.js.map +1 -1
  291. package/dist/builtins/res/plugin.sync.d.ts +3 -5
  292. package/dist/builtins/res/plugin.sync.js +175 -40
  293. package/dist/builtins/res/plugin.sync.js.map +1 -1
  294. package/dist/builtins/res/plugininstance.d.ts +0 -13
  295. package/dist/builtins/res/plugininstance.js +0 -16
  296. package/dist/builtins/res/plugininstance.js.map +1 -1
  297. package/dist/builtins/res/pluginmeta.d.ts +0 -13
  298. package/dist/builtins/res/pluginmeta.js +0 -16
  299. package/dist/builtins/res/pluginmeta.js.map +1 -1
  300. package/dist/builtins/res/record.d.ts +0 -13
  301. package/dist/builtins/res/record.js +2 -18
  302. package/dist/builtins/res/record.js.map +1 -1
  303. package/dist/builtins/res/runWait.js +32 -8
  304. package/dist/builtins/res/runWait.js.map +1 -1
  305. package/dist/builtins/res/tag.d.ts +0 -13
  306. package/dist/builtins/res/tag.js +0 -16
  307. package/dist/builtins/res/tag.js.map +1 -1
  308. package/dist/builtins/res/thumbnail.js +23 -8
  309. package/dist/builtins/res/thumbnail.js.map +1 -1
  310. package/dist/builtins/res/user.d.ts +0 -12
  311. package/dist/builtins/res/user.js +0 -17
  312. package/dist/builtins/res/user.js.map +1 -1
  313. package/dist/builtins/res/workflow.d.ts +0 -13
  314. package/dist/builtins/res/workflow.js +0 -16
  315. package/dist/builtins/res/workflow.js.map +1 -1
  316. package/dist/builtins/runEcho.js +2 -1
  317. package/dist/builtins/runEcho.js.map +1 -1
  318. package/dist/builtins/store.d.ts +0 -13
  319. package/dist/builtins/store.js +32 -32
  320. package/dist/builtins/store.js.map +1 -1
  321. package/dist/builtins/sys/apropos.d.ts +2 -27
  322. package/dist/builtins/sys/apropos.js +2 -32
  323. package/dist/builtins/sys/apropos.js.map +1 -1
  324. package/dist/builtins/sys/cal.d.ts +0 -12
  325. package/dist/builtins/sys/cal.js +0 -15
  326. package/dist/builtins/sys/cal.js.map +1 -1
  327. package/dist/builtins/sys/command.js +3 -7
  328. package/dist/builtins/sys/command.js.map +1 -1
  329. package/dist/builtins/sys/context.d.ts +0 -8
  330. package/dist/builtins/sys/context.js +1 -12
  331. package/dist/builtins/sys/context.js.map +1 -1
  332. package/dist/builtins/sys/date.d.ts +0 -12
  333. package/dist/builtins/sys/date.js +0 -15
  334. package/dist/builtins/sys/date.js.map +1 -1
  335. package/dist/builtins/sys/echo.d.ts +0 -12
  336. package/dist/builtins/sys/echo.js +54 -49
  337. package/dist/builtins/sys/echo.js.map +1 -1
  338. package/dist/builtins/sys/fortune.d.ts +0 -12
  339. package/dist/builtins/sys/fortune.js +0 -15
  340. package/dist/builtins/sys/fortune.js.map +1 -1
  341. package/dist/builtins/sys/grep.d.ts +14 -18
  342. package/dist/builtins/sys/grep.js +239 -114
  343. package/dist/builtins/sys/grep.js.map +1 -1
  344. package/dist/builtins/sys/hostGrants.d.ts +85 -0
  345. package/dist/builtins/sys/hostGrants.js +207 -0
  346. package/dist/builtins/sys/hostGrants.js.map +1 -0
  347. package/dist/builtins/sys/joblets.d.ts +0 -24
  348. package/dist/builtins/sys/joblets.js +0 -29
  349. package/dist/builtins/sys/joblets.js.map +1 -1
  350. package/dist/builtins/sys/motd.d.ts +0 -12
  351. package/dist/builtins/sys/motd.js +14 -21
  352. package/dist/builtins/sys/motd.js.map +1 -1
  353. package/dist/builtins/sys/notes.js +26 -16
  354. package/dist/builtins/sys/notes.js.map +1 -1
  355. package/dist/builtins/sys/physicalmode.d.ts +0 -8
  356. package/dist/builtins/sys/physicalmode.js +1 -12
  357. package/dist/builtins/sys/physicalmode.js.map +1 -1
  358. package/dist/builtins/sys/tasks.d.ts +0 -24
  359. package/dist/builtins/sys/tasks.js +30 -36
  360. package/dist/builtins/sys/tasks.js.map +1 -1
  361. package/dist/builtins/sys/textFilters.d.ts +0 -84
  362. package/dist/builtins/sys/textFilters.js +33 -110
  363. package/dist/builtins/sys/textFilters.js.map +1 -1
  364. package/dist/builtins/sys/timing.d.ts +0 -8
  365. package/dist/builtins/sys/timing.js +1 -12
  366. package/dist/builtins/sys/timing.js.map +1 -1
  367. package/dist/builtins/sys/variables.d.ts +0 -24
  368. package/dist/builtins/sys/variables.js +0 -29
  369. package/dist/builtins/sys/variables.js.map +1 -1
  370. package/dist/builtins/sys/version.d.ts +0 -12
  371. package/dist/builtins/sys/version.js +0 -15
  372. package/dist/builtins/sys/version.js.map +1 -1
  373. package/dist/builtins/sys/weather.js +46 -27
  374. package/dist/builtins/sys/weather.js.map +1 -1
  375. package/dist/builtins/sys/whoami.d.ts +0 -22
  376. package/dist/builtins/sys/whoami.js +16 -43
  377. package/dist/builtins/sys/whoami.js.map +1 -1
  378. package/dist/builtins/utils.d.ts +4 -39
  379. package/dist/builtins/utils.js +24 -55
  380. package/dist/builtins/utils.js.map +1 -1
  381. package/dist/chris/backend.js +7 -12
  382. package/dist/chris/backend.js.map +1 -1
  383. package/dist/chris/binDeclarations.d.ts +0 -44
  384. package/dist/chris/binDeclarations.js +111 -29
  385. package/dist/chris/binDeclarations.js.map +1 -1
  386. package/dist/chris/binExecutables.js +26 -18
  387. package/dist/chris/binExecutables.js.map +1 -1
  388. package/dist/chris/chiliDelegate.d.ts +104 -0
  389. package/dist/chris/chiliDelegate.js +240 -0
  390. package/dist/chris/chiliDelegate.js.map +1 -1
  391. package/dist/chris/commandFallback.d.ts +2 -2
  392. package/dist/chris/commandFallback.js +107 -50
  393. package/dist/chris/commandFallback.js.map +1 -1
  394. package/dist/chris/completion.d.ts +3 -1
  395. package/dist/chris/completion.js +5 -17
  396. package/dist/chris/completion.js.map +1 -1
  397. package/dist/chris/connect.d.ts +37 -0
  398. package/dist/chris/connect.js +46 -0
  399. package/dist/chris/connect.js.map +1 -1
  400. package/dist/chris/files.js +32 -2
  401. package/dist/chris/files.js.map +1 -1
  402. package/dist/chris/navigation.js +87 -53
  403. package/dist/chris/navigation.js.map +1 -1
  404. package/dist/chris/pacsResources.js +28 -11
  405. package/dist/chris/pacsResources.js.map +1 -1
  406. package/dist/chris/promptContext.js +68 -35
  407. package/dist/chris/promptContext.js.map +1 -1
  408. package/dist/chris/universeLayout.d.ts +8 -2
  409. package/dist/chris/universeLayout.js +40 -11
  410. package/dist/chris/universeLayout.js.map +1 -1
  411. package/dist/chris/warmup.d.ts +140 -0
  412. package/dist/chris/warmup.js +622 -0
  413. package/dist/chris/warmup.js.map +1 -0
  414. package/dist/core/argumentKinds.js +4 -4
  415. package/dist/core/argumentKinds.js.map +1 -1
  416. package/dist/core/assignment.js +8 -6
  417. package/dist/core/assignment.js.map +1 -1
  418. package/dist/core/backend.d.ts +44 -8
  419. package/dist/core/backend.js.map +1 -1
  420. package/dist/core/commandDeclaration.d.ts +8 -0
  421. package/dist/core/commandDeclaration.js.map +1 -1
  422. package/dist/core/commandParse.d.ts +34 -1
  423. package/dist/core/commandParse.js +156 -28
  424. package/dist/core/commandParse.js.map +1 -1
  425. package/dist/core/commandRegistry.d.ts +24 -5
  426. package/dist/core/commandRegistry.js +28 -5
  427. package/dist/core/commandRegistry.js.map +1 -1
  428. package/dist/core/dispatch.d.ts +1 -12
  429. package/dist/core/dispatch.js +12 -16
  430. package/dist/core/dispatch.js.map +1 -1
  431. package/dist/core/elevation.js +30 -5
  432. package/dist/core/elevation.js.map +1 -1
  433. package/dist/core/engine.d.ts +5 -11
  434. package/dist/core/engine.js +126 -50
  435. package/dist/core/engine.js.map +1 -1
  436. package/dist/core/expansion.d.ts +0 -6
  437. package/dist/core/expansion.js +0 -8
  438. package/dist/core/expansion.js.map +1 -1
  439. package/dist/core/filesystem.js +1 -1
  440. package/dist/core/filesystem.js.map +1 -1
  441. package/dist/core/handlerRun.d.ts +13 -0
  442. package/dist/core/handlerRun.js +21 -0
  443. package/dist/core/handlerRun.js.map +1 -1
  444. package/dist/core/holds.js +3 -3
  445. package/dist/core/holds.js.map +1 -1
  446. package/dist/core/hostGate.d.ts +62 -0
  447. package/dist/core/hostGate.js +72 -0
  448. package/dist/core/hostGate.js.map +1 -0
  449. package/dist/core/joblets.js +53 -27
  450. package/dist/core/joblets.js.map +1 -1
  451. package/dist/core/paths.d.ts +3 -5
  452. package/dist/core/paths.js +107 -36
  453. package/dist/core/paths.js.map +1 -1
  454. package/dist/core/preprocess.d.ts +12 -0
  455. package/dist/core/preprocess.js +42 -15
  456. package/dist/core/preprocess.js.map +1 -1
  457. package/dist/core/question.d.ts +27 -3
  458. package/dist/core/question.js +14 -6
  459. package/dist/core/question.js.map +1 -1
  460. package/dist/core/runner.d.ts +31 -7
  461. package/dist/core/runner.js +189 -37
  462. package/dist/core/runner.js.map +1 -1
  463. package/dist/core/sink.d.ts +7 -19
  464. package/dist/core/sink.js +56 -28
  465. package/dist/core/sink.js.map +1 -1
  466. package/dist/core/surface.js +1 -0
  467. package/dist/core/surface.js.map +1 -1
  468. package/dist/core/variables.js +37 -11
  469. package/dist/core/variables.js.map +1 -1
  470. package/dist/core/version.d.ts +0 -20
  471. package/dist/core/version.js +2 -26
  472. package/dist/core/version.js.map +1 -1
  473. package/dist/core/warmupFailures.d.ts +3 -6
  474. package/dist/core/warmupFailures.js.map +1 -1
  475. package/dist/core.d.ts +2 -0
  476. package/dist/core.js +2 -0
  477. package/dist/core.js.map +1 -1
  478. package/dist/index.d.ts +8 -1
  479. package/dist/index.js +8 -1
  480. package/dist/index.js.map +1 -1
  481. package/dist/lib/completer/cfsPaths.js +66 -26
  482. package/dist/lib/completer/cfsPaths.js.map +1 -1
  483. package/dist/lib/completer/declared.js +81 -20
  484. package/dist/lib/completer/declared.js.map +1 -1
  485. package/dist/lib/completer/index.d.ts +3 -0
  486. package/dist/lib/completer/index.js +44 -7
  487. package/dist/lib/completer/index.js.map +1 -1
  488. package/dist/lib/parser.d.ts +0 -16
  489. package/dist/lib/parser.js +223 -135
  490. package/dist/lib/parser.js.map +1 -1
  491. package/dist/lib/vfs/folderListing.d.ts +85 -0
  492. package/dist/lib/vfs/folderListing.js +86 -0
  493. package/dist/lib/vfs/folderListing.js.map +1 -0
  494. package/dist/lib/vfs/vfs.d.ts +37 -9
  495. package/dist/lib/vfs/vfs.js +195 -110
  496. package/dist/lib/vfs/vfs.js.map +1 -1
  497. package/dist/lib/wildcard.d.ts +7 -34
  498. package/dist/lib/wildcard.js +123 -95
  499. package/dist/lib/wildcard.js.map +1 -1
  500. package/dist/notes.json +1 -1
  501. package/dist/session/answerAdapters.js +249 -131
  502. package/dist/session/answerAdapters.js.map +1 -1
  503. package/package.json +12 -10
  504. package/dist/builtins/wildcard.d.ts +0 -8
  505. package/dist/builtins/wildcard.js +0 -9
  506. package/dist/builtins/wildcard.js.map +0 -1
  507. package/dist/lib/quoting.d.ts +0 -40
  508. package/dist/lib/quoting.js +0 -70
  509. package/dist/lib/quoting.js.map +0 -1
  510. package/dist/lib/semicolonParser.d.ts +0 -41
  511. package/dist/lib/semicolonParser.js +0 -93
  512. package/dist/lib/semicolonParser.js.map +0 -1
@@ -7,13 +7,11 @@
7
7
  *
8
8
  * Key components:
9
9
  * - rmCommand: the declaration.
10
- * - builtin_rm: the declaration run over words already split.
11
10
  * - rm_run: the typed core behind both, and the typed API.
12
11
  * - rmSummary_format: the line that sums up several removals.
13
12
  *
14
13
  * Typical usage:
15
14
  * ```ts
16
- * await builtin_rm(['-r', 'scratch']);
17
15
  * await rm_run({ recursive: true, force: false, interactive: false, once: false, paths: ['scratch'] });
18
16
  * ```
19
17
  *
@@ -22,29 +20,31 @@
22
20
  *
23
21
  * @module
24
22
  */
25
- import chalk from 'chalk';
26
23
  import path from 'path';
27
- import { path_resolve, storePath_resolve } from '../utils.js';
28
- import { repl_confirm } from '../../core/question.js';
24
+ import { errno_words, rm_render, vfs_fail, vfs_ok, vfsOutcome_isUnconfirmed } from '@fnndsc/fond';
25
+ import { envelope_ok, envelope_error, FS_PROMPT_PURPOSES } from '@fnndsc/menu';
26
+ import chalk from 'chalk';
27
+ import { command_declare } from '../../core/commandDeclaration.js';
29
28
  import { listingCache_get, vfsDispatcher_get } from '../../core/filesystem.js';
30
- import { pathEntry_find, entry_isFolder, folderTree_remove } from './entries.js';
31
- import { errno_words, rm_render, vfs_fail, vfs_ok } from '@fnndsc/fond';
29
+ import { repl_confirm } from '../../core/question.js';
32
30
  import { sink_get } from '../../core/sink.js';
33
- import { envelope_ok, envelope_error } from '@fnndsc/menu';
34
- import { command_declare } from '../../core/commandDeclaration.js';
35
- import { declaredCommand_run } from '../../core/commandParse.js';
31
+ import { path_resolve, storePath_resolve } from '../utils.js';
32
+ import { dotOperand_refuse, folderTree_remove, holderKind_isFolder, holders_say } from './entries.js';
36
33
  /**
37
- * Prompts the user for confirmation.
34
+ * Prompts the user for confirmation. The question names what it is for, a
35
+ * removal (`fs.rm`), so a surface draws its destructive control by that,
36
+ * never by its words.
38
37
  *
39
38
  * @param message - The prompt message.
39
+ * @param target - What is to go: a path, or how many.
40
40
  * @returns A Promise resolving to true if user confirms (y/Y), false otherwise.
41
41
  */
42
- async function prompt_confirm(message) {
42
+ async function prompt_confirm(message, target) {
43
43
  // Asked through the SURFACE, never through this process's stdin. Under a
44
44
  // daemon that stdin belongs to whoever started the daemon — not to the
45
45
  // operator running `rm -i` from a browser three rooms away, who would
46
46
  // have waited forever for a question asked of somebody else's terminal.
47
- return repl_confirm(message);
47
+ return repl_confirm(message, { purpose: FS_PROMPT_PURPOSES.remove, subject: { path: target } });
48
48
  }
49
49
  /**
50
50
  * Why a question came back with no answer.
@@ -81,10 +81,11 @@ export function rmSummary_format(successCount, failCount) {
81
81
  return chalk.red(`Failed to remove ${failCount} item${failCount !== 1 ? 's' : ''}`);
82
82
  }
83
83
  /**
84
- * Removes one path. A projection's path is its mount's to remove or refuse
85
- * (a tag names its own verbs). Elsewhere what holds the path decides: a file
86
- * or link is removed, a folder only with `-r` (with all it holds), and
87
- * nothing there is fine under `-f`.
84
+ * Removes one path. A mount with its own verbs and no proof of what holds a
85
+ * path (a tag) removes or refuses for itself. Elsewhere the owning mount's
86
+ * proof decides (`holder_prove`): a file or link is removed, a folder only
87
+ * with `-r` (with all it holds), more than one holder is refused, a proof
88
+ * that failed is an error, and only a proved absence is fine under `-f`.
88
89
  *
89
90
  * @param dispatcher - The session's filesystem.
90
91
  * @param target - The absolute path.
@@ -93,16 +94,21 @@ export function rmSummary_format(successCount, failCount) {
93
94
  * @returns What was removed, and the outcome.
94
95
  */
95
96
  async function entry_remove(dispatcher, target, recursive, force) {
96
- if (dispatcher.path_isVirtual(target)) {
97
+ if (!dispatcher.holderProof_offered(target)) {
97
98
  return { type: null, outcome: recursive ? await dispatcher.rmTree(target) : await dispatcher.rm(target) };
98
99
  }
99
- const entry = await pathEntry_find(dispatcher, target);
100
- if (entry === null)
101
- return { type: null, outcome: force ? vfs_ok(true) : vfs_fail('ENOENT') };
102
- if (entry_isFolder(entry)) {
100
+ const proof = await dispatcher.holder_prove(target, { entry: true });
101
+ if (!proof.ok)
102
+ return { type: null, outcome: proof };
103
+ const held = proof.value;
104
+ if (held.kind === 'absent')
105
+ return { type: null, outcome: force ? vfs_ok(true) : vfs_fail('ENOENT'), absent: true };
106
+ if (held.kind === 'ambiguous')
107
+ return { type: null, outcome: vfs_fail('EPERM', `${holders_say(held.holders)} share ${target}, and neither is removed`) };
108
+ if (holderKind_isFolder(held.holder)) {
103
109
  return { type: 'dir', outcome: recursive ? await folderTree_remove(dispatcher, target) : vfs_fail('EISDIR') };
104
110
  }
105
- return { type: entry.type === 'link' ? 'link' : 'file', outcome: await dispatcher.rm(target) };
111
+ return { type: held.holder === 'link' ? 'link' : 'file', outcome: await dispatcher.rm(target) };
106
112
  }
107
113
  /** What an `rm` line may hold. */
108
114
  const RM_GRAMMAR = {
@@ -152,15 +158,6 @@ export const rmCommand = command_declare({
152
158
  paths: args.operands.paths,
153
159
  }),
154
160
  });
155
- /**
156
- * `rm` over words already split: the declaration's parse and handler.
157
- *
158
- * @param args - The words after `rm`.
159
- * @returns An envelope whose model lists per-target outcomes, or the refusal of a bad line.
160
- */
161
- export async function builtin_rm(args) {
162
- return declaredCommand_run(rmCommand, args);
163
- }
164
161
  /**
165
162
  * Forgets the listings a removal changed: the folder that held the entry and
166
163
  * everything cached beneath it, by the session's path and by the store's.
@@ -178,179 +175,372 @@ function listings_forget(fixed) {
178
175
  }
179
176
  }
180
177
  /**
181
- * Removes files or directories: the shared typed core behind the parsed
182
- * builtin and the typed API.
178
+ * Fixes one operand before any question, as the session names it; where
179
+ * the store keeps it is asked only at its turn, after the removals before
180
+ * it (`rm link link/child` must not reach what the link pointed at). An
181
+ * operand ending in `.` or `..` is refused as written, before it is
182
+ * resolved: resolving it would name the folder before it (`link/.` is not
183
+ * `link`).
183
184
  *
184
- * In interactive mode (-i, -I) output is streamed live through the sink so
185
- * each confirmation prompt appears in sequence with its result; the envelope
186
- * then carries only the model. Otherwise output is buffered into the envelope.
187
- *
188
- * @param runArgs - Flags and target paths.
189
- * @returns An envelope whose model lists per-target outcomes.
185
+ * @param pathArg - The operand as typed.
186
+ * @returns The fixed operand, or the failure to report in its place.
190
187
  */
191
- export async function rm_run(runArgs) {
192
- const { recursive, force, interactive, once, paths } = runArgs;
193
- if (paths.length === 0) {
194
- return envelope_error('', undefined, `${chalk.red('Usage: rm [-rfiI] <path> [path...]')}\n`);
188
+ async function target_fix(pathArg) {
189
+ const dotted = dotOperand_refuse(pathArg);
190
+ if (dotted !== null && !dotted.ok)
191
+ return { failure: new Error(dotted.reason ?? errno_words(dotted.errno)) };
192
+ try {
193
+ return { shown: await path_resolve(pathArg) };
195
194
  }
196
- // Every target is fixed before any question is asked: while a question is
197
- // open the session runs other commands, and a `cd` among them must not
198
- // turn the answer into a removal somewhere else. A path that does not
199
- // resolve keeps its failure, reported in its place below.
200
- const fixed = [];
201
- for (const pathArg of paths) {
202
- try {
203
- fixed.push({ shown: await path_resolve(pathArg), target: await storePath_resolve(pathArg, { entry: true }) });
204
- }
205
- catch (failure) {
206
- fixed.push({ failure });
207
- }
195
+ catch (failure) {
196
+ return { failure };
208
197
  }
209
- // One question for the whole list, asked before anything is removed and
210
- // naming what will go. A refusal removes nothing at all — there is no
211
- // half of a set.
212
- if (once) {
213
- const many = paths.length === 1
214
- ? `'${paths[0]}'`
215
- : `${paths.length} items`;
216
- let agreed = false;
217
- let unanswered = null;
218
- try {
219
- agreed = await prompt_confirm(`rm: remove ${many}? (y/n): `);
220
- }
221
- catch (e) {
222
- // A question with no answer keeps everything, the same as a no. It
223
- // says why, so a surface that has quietly lost its voice is not read
224
- // as an operator who declined.
225
- unanswered = unanswered_reason(e);
226
- }
227
- if (!agreed) {
228
- const why = unanswered === null ? '' : `: ${unanswered}`;
229
- return envelope_ok(`${chalk.gray(`nothing removed (${paths.length} kept)${why}`)}\n`, {
230
- kind: 'fs.rm',
231
- data: paths.map((path) => ({ path, removed: false, skipped: true })),
232
- });
233
- }
198
+ }
199
+ /**
200
+ * What an `rm` line has said and done: each line streamed live when a
201
+ * question is asked (so each prompt appears in sequence with its result),
202
+ * buffered into the envelope otherwise; one outcome per operand.
203
+ */
204
+ class RmReport {
205
+ /** Buffered stdout. */
206
+ rendered = '';
207
+ /** Buffered stderr. */
208
+ renderedErr = '';
209
+ /** One outcome per operand, in order. */
210
+ outcomes = [];
211
+ /** How many were removed. */
212
+ successCount = 0;
213
+ /** How many failed. */
214
+ failCount = 0;
215
+ /** Whether lines stream through the sink (`-i`, `-I`) rather than buffer. */
216
+ live;
217
+ /**
218
+ * Starts an empty report.
219
+ *
220
+ * @param live - True to stream through the sink (`-i`, `-I`).
221
+ */
222
+ constructor(live) {
223
+ this.live = live;
234
224
  }
235
- const dispatcher = vfsDispatcher_get();
236
- let successCount = 0;
237
- let failCount = 0;
238
- let rendered = '';
239
- let renderedErr = '';
240
- const outcomes = [];
241
225
  /**
242
- * Emits one line of stdout output: streamed live in interactive mode,
243
- * buffered into the envelope otherwise.
226
+ * Emits one line of stdout output.
244
227
  *
245
228
  * @param line - The line to emit (without trailing newline).
246
229
  */
247
- const out_emit = (line) => {
248
- if (interactive || once) {
230
+ out_emit(line) {
231
+ if (this.live) {
249
232
  sink_get().data_write(`${line}\n`);
250
233
  }
251
234
  else {
252
- rendered += `${line}\n`;
235
+ this.rendered += `${line}\n`;
253
236
  }
254
- };
237
+ }
255
238
  /**
256
- * Emits one line of error output: streamed live in interactive mode,
257
- * buffered into the envelope otherwise.
239
+ * Emits one line of error output.
258
240
  *
259
241
  * @param line - The line to emit (without trailing newline).
260
242
  */
261
- const err_emit = (line) => {
262
- if (interactive || once) {
243
+ err_emit(line) {
244
+ if (this.live) {
263
245
  sink_get().err_write(`${line}\n`);
264
246
  }
265
247
  else {
266
- renderedErr += `${line}\n`;
248
+ this.renderedErr += `${line}\n`;
249
+ }
250
+ }
251
+ /**
252
+ * Notes an operand the operator did not have removed: a no, or a question
253
+ * left unanswered (with why).
254
+ *
255
+ * @param pathArg - The operand as typed.
256
+ * @param unanswered - Why the question had no answer, or null for a no.
257
+ */
258
+ skip_note(pathArg, unanswered) {
259
+ this.out_emit(chalk.gray(unanswered === null ? `skipped '${pathArg}'` : `skipped '${pathArg}': ${unanswered}`));
260
+ this.outcomes.push({ path: pathArg, removed: false, skipped: true });
261
+ }
262
+ /**
263
+ * Notes an operand that could not be removed.
264
+ *
265
+ * @param pathArg - The operand as typed.
266
+ * @param reason - Why.
267
+ * @param unconfirmed - True when the removal was accepted and not seen done.
268
+ */
269
+ failure_note(pathArg, reason, unconfirmed = false) {
270
+ this.err_emit(chalk.red(`rm: cannot remove '${pathArg}': ${reason}`));
271
+ this.outcomes.push(unconfirmed ? { path: pathArg, removed: false, skipped: false, unconfirmed: true } : { path: pathArg, removed: false, skipped: false });
272
+ this.failCount++;
273
+ }
274
+ /**
275
+ * Notes the operands never asked about once the operator walked away:
276
+ * a set of files silently left alone is worse than a set left alone out loud.
277
+ *
278
+ * @param notAsked - The operands after the abandoned one.
279
+ */
280
+ notAsked_note(notAsked) {
281
+ if (notAsked.length === 0)
282
+ return;
283
+ this.out_emit(chalk.gray(`${notAsked.length} more not asked about, and kept`));
284
+ for (const kept of notAsked) {
285
+ this.outcomes.push({ path: kept, removed: false, skipped: true });
286
+ }
287
+ }
288
+ /**
289
+ * The line's envelope, the outcomes as its model.
290
+ *
291
+ * @param several - True when the line named more than one operand, which earns a summary.
292
+ * @returns An error envelope when any removal failed, ok otherwise.
293
+ */
294
+ envelope_build(several) {
295
+ if (several) {
296
+ const summary = rmSummary_format(this.successCount, this.failCount);
297
+ if (summary) {
298
+ this.out_emit('');
299
+ this.out_emit(summary);
300
+ }
301
+ }
302
+ const model = { kind: 'fs.rm', data: this.outcomes };
303
+ if (this.failCount > 0) {
304
+ const envelope = envelope_error(this.rendered, undefined, this.renderedErr || undefined);
305
+ envelope.model = model;
306
+ return envelope;
307
+ }
308
+ const envelope = envelope_ok(this.rendered, model);
309
+ return envelope;
310
+ }
311
+ }
312
+ /**
313
+ * The answer when the one question for the whole list (`-I`) was not a yes:
314
+ * nothing removed, everything kept, and why when it went unanswered.
315
+ *
316
+ * @param paths - The operands.
317
+ * @param unanswered - Why the question had no answer, or null for a no.
318
+ * @returns The envelope keeping them all.
319
+ */
320
+ function rmKept_answer(paths, unanswered) {
321
+ const why = unanswered === null ? '' : `: ${unanswered}`;
322
+ return envelope_ok(`${chalk.gray(`nothing removed (${paths.length} kept)${why}`)}\n`, {
323
+ kind: 'fs.rm',
324
+ data: paths.map((path) => ({ path, removed: false, skipped: true })),
325
+ });
326
+ }
327
+ /**
328
+ * Records what removing one operand came to: removed, absent under `-f`, or
329
+ * a failure; what is cached of the place is forgotten when it changed.
330
+ *
331
+ * @param report - Where it is said.
332
+ * @param pathArg - The operand as typed.
333
+ * @param resolution - The operand, as shown and in the store.
334
+ * @param removed - What the removal came to.
335
+ * @param several - True when the line named more than one operand.
336
+ */
337
+ function rmRemoval_record(report, pathArg, resolution, removed, several) {
338
+ // Accepted and not seen done is not removed (it fails below), and what
339
+ // is cached of the place is stale all the same.
340
+ if (vfsOutcome_isUnconfirmed(removed.outcome))
341
+ listings_forget(resolution);
342
+ if (removed.outcome.ok && removed.absent === true) {
343
+ // `-f` on something not there: nothing removed, nothing to say.
344
+ report.outcomes.push({ path: pathArg, removed: false, skipped: false });
345
+ return;
346
+ }
347
+ if (removed.outcome.ok) {
348
+ if (several) {
349
+ report.out_emit(chalk.gray(`removed '${pathArg}'`));
350
+ }
351
+ else {
352
+ report.out_emit(rm_render({ success: true, path: resolution.shown, type: removed.type }));
267
353
  }
268
- };
354
+ report.outcomes.push({ path: pathArg, removed: true, skipped: false });
355
+ report.successCount++;
356
+ listings_forget(resolution);
357
+ }
358
+ else {
359
+ report.failure_note(pathArg, removed.outcome.reason ?? errno_words(removed.outcome.errno), vfsOutcome_isUnconfirmed(removed.outcome));
360
+ }
361
+ }
362
+ /**
363
+ * Formats the prompt and target summary for a single `-I` (`once`) confirmation.
364
+ *
365
+ * @param paths - All target paths on the command line.
366
+ * @returns The prompt text and target label.
367
+ */
368
+ function onceQuestion_build(paths) {
369
+ const target = paths.length === 1 ? paths[0] ?? '' : `${String(paths.length)} items`;
370
+ const prompt = `rm: remove ${paths.length === 1 ? `'${target}'` : target}? (y/n): `;
371
+ return { prompt, target };
372
+ }
373
+ /**
374
+ * Extracts a human-readable message from a thrown value.
375
+ *
376
+ * @param error - What was thrown.
377
+ * @returns The error message.
378
+ */
379
+ function thrownError_say(error) {
380
+ return error instanceof Error ? error.message : String(error);
381
+ }
382
+ /**
383
+ * Asks the single `-I` (`once`) confirmation question before any removal.
384
+ *
385
+ * @param paths - All target paths on the command line.
386
+ * @returns The refusal/kept envelope when declined or unanswered, or null when confirmed.
387
+ */
388
+ async function onceConfirmation_ask(paths) {
389
+ let agreed = false;
390
+ let unanswered = null;
391
+ try {
392
+ const { prompt, target } = onceQuestion_build(paths);
393
+ agreed = await prompt_confirm(prompt, target);
394
+ }
395
+ catch (e) {
396
+ // A question with no answer keeps everything, the same as a no. It
397
+ // says why, so a surface that has quietly lost its voice is not read
398
+ // as an operator who declined.
399
+ unanswered = unanswered_reason(e);
400
+ }
401
+ return agreed ? null : rmKept_answer(paths, unanswered);
402
+ }
403
+ /**
404
+ * Extracts the resolved logical path from a fixed operand, throwing its
405
+ * resolution failure when it could not be fixed.
406
+ *
407
+ * @param operand - The fixed operand entry.
408
+ * @returns The resolved logical path.
409
+ * @throws {unknown} When the operand could not be resolved.
410
+ */
411
+ function operandShown_take(operand) {
412
+ if ('failure' in operand)
413
+ throw operand.failure;
414
+ return operand.shown;
415
+ }
416
+ /**
417
+ * Resolves and removes one confirmed operand, recording the outcome on `report`.
418
+ *
419
+ * @param dispatcher - The VFS dispatcher.
420
+ * @param report - The accumulating removal report.
421
+ * @param pathArg - The path as typed.
422
+ * @param shown - The resolved logical path.
423
+ * @param runArgs - Flags and target paths.
424
+ */
425
+ async function confirmedOperand_remove(dispatcher, report, pathArg, shown, runArgs) {
426
+ const resolution = { shown, target: await storePath_resolve(shown, { entry: true }) };
427
+ const removed = await entry_remove(dispatcher, resolution.target, runArgs.recursive, runArgs.force);
428
+ rmRemoval_record(report, pathArg, resolution, removed, runArgs.paths.length > 1);
429
+ }
430
+ /**
431
+ * Creates the `RmReport` for a removal run, streaming when `-i` or `-I` is active.
432
+ *
433
+ * @param interactive - Whether `-i` is active.
434
+ * @param once - Whether `-I` is active.
435
+ * @returns The initialized report.
436
+ */
437
+ function rmReport_create(interactive, once) {
438
+ return new RmReport(interactive || once);
439
+ }
440
+ /**
441
+ * Finalizes the removal report, noting any paths skipped after an abandoned `-i` prompt.
442
+ *
443
+ * @param report - The removal report.
444
+ * @param paths - All target paths on the command line.
445
+ * @param abandonedAt - Index where the operator abandoned `-i`, or null.
446
+ * @returns The completed command envelope.
447
+ */
448
+ function rmReport_finish(report, paths, abandonedAt) {
449
+ if (abandonedAt !== null)
450
+ report.notAsked_note(paths.slice(abandonedAt + 1));
451
+ return report.envelope_build(paths.length > 1);
452
+ }
453
+ /**
454
+ * Prompts for interactive removal of a single operand, keeping the `try/catch`
455
+ * around `prompt_confirm` only so any sink error during `skip_note` propagates
456
+ * to the per-operand error handler.
457
+ *
458
+ * @param report - The removal report.
459
+ * @param pathArg - The operand as typed.
460
+ * @returns `'confirmed'`, `'skipped'`, or `'abandoned'`.
461
+ */
462
+ async function interactiveOperand_confirm(report, pathArg) {
463
+ let confirmed = false;
464
+ try {
465
+ confirmed = await prompt_confirm(`rm: remove '${pathArg}'? (y/n): `, pathArg);
466
+ }
467
+ catch (e) {
468
+ // Abandoning is an answer, and it answers for the rest of the
469
+ // walk: an operator who backed out of this question is not
470
+ // waiting to be asked the next nineteen.
471
+ report.skip_note(pathArg, unanswered_reason(e));
472
+ return 'abandoned';
473
+ }
474
+ if (!confirmed) {
475
+ report.skip_note(pathArg, null);
476
+ return 'skipped';
477
+ }
478
+ return 'confirmed';
479
+ }
480
+ /**
481
+ * Fixes every operand as an absolute logical path before any interactive question is asked.
482
+ *
483
+ * @param paths - All target paths on the command line.
484
+ * @returns Fixed operands or their resolution failures in order.
485
+ */
486
+ async function operands_fix(paths) {
487
+ const fixed = [];
488
+ for (const pathArg of paths)
489
+ fixed.push(await target_fix(pathArg));
490
+ return fixed;
491
+ }
492
+ /**
493
+ * Removes files or directories: the shared typed core behind the parsed
494
+ * builtin and the typed API.
495
+ *
496
+ * In interactive mode (-i, -I) output is streamed live through the sink so
497
+ * each confirmation prompt appears in sequence with its result; the envelope
498
+ * then carries only the model. Otherwise output is buffered into the envelope.
499
+ *
500
+ * @param runArgs - Flags and target paths.
501
+ * @returns An envelope whose model lists per-target outcomes.
502
+ */
503
+ export async function rm_run(runArgs) {
504
+ const { interactive, once, paths } = runArgs;
505
+ if (paths.length === 0) {
506
+ return envelope_error('', undefined, `${chalk.red('Usage: rm [-rfiI] <path> [path...]')}\n`);
507
+ }
508
+ // Every operand is fixed, as an absolute path, before any question is
509
+ // asked: while a question is open the session runs other commands, and a
510
+ // `cd` among them must not turn the answer into a removal somewhere else.
511
+ // Where the store keeps it is asked at its turn, after the removals
512
+ // before it. A path that does not resolve keeps its failure, said below.
513
+ const fixed = await operands_fix(paths);
514
+ // One question for the whole list, asked before anything is removed and
515
+ // naming what will go. A refusal removes nothing at all — there is no
516
+ // half of a set.
517
+ const kept = once ? await onceConfirmation_ask(paths) : null;
518
+ if (kept !== null)
519
+ return kept;
520
+ const dispatcher = vfsDispatcher_get();
521
+ const report = rmReport_create(interactive, once);
269
522
  // Where the operator walked away, when they did: everything after it was
270
- // never put to them, and a set of files silently left alone is worse than
271
- // a set left alone out loud.
523
+ // never put to them.
272
524
  let abandonedAt = null;
273
525
  for (let index = 0; index < paths.length; index++) {
274
526
  const pathArg = paths[index];
275
527
  try {
276
- const resolution = fixed[index];
277
- if ('failure' in resolution)
278
- throw resolution.failure;
279
- const target = resolution.target;
280
- if (interactive) {
281
- let confirmed = false;
282
- try {
283
- confirmed = await prompt_confirm(`rm: remove '${pathArg}'? (y/n): `);
284
- }
285
- catch (e) {
286
- // Abandoning is an answer, and it answers for the rest of the
287
- // walk: an operator who backed out of this question is not
288
- // waiting to be asked the next nineteen.
289
- out_emit(chalk.gray(`skipped '${pathArg}': ${unanswered_reason(e)}`));
290
- outcomes.push({ path: pathArg, removed: false, skipped: true });
291
- abandonedAt = index;
292
- break;
293
- }
294
- if (!confirmed) {
295
- out_emit(chalk.gray(`skipped '${pathArg}'`));
296
- outcomes.push({ path: pathArg, removed: false, skipped: true });
297
- continue;
298
- }
528
+ const shown = operandShown_take(fixed[index]);
529
+ const verdict = interactive
530
+ ? await interactiveOperand_confirm(report, pathArg)
531
+ : 'confirmed';
532
+ if (verdict === 'abandoned') {
533
+ abandonedAt = index;
534
+ break;
299
535
  }
300
- const removed = await entry_remove(dispatcher, target, recursive, force);
301
- if (removed.outcome.ok && removed.type === null && !dispatcher.path_isVirtual(target)) {
302
- // `-f` on something not there: nothing removed, nothing to say.
303
- outcomes.push({ path: pathArg, removed: false, skipped: false });
536
+ if (verdict === 'skipped')
304
537
  continue;
305
- }
306
- if (removed.outcome.ok) {
307
- if (paths.length > 1) {
308
- out_emit(chalk.gray(`removed '${pathArg}'`));
309
- }
310
- else {
311
- out_emit(rm_render({ success: true, path: resolution.shown, type: removed.type }));
312
- }
313
- outcomes.push({ path: pathArg, removed: true, skipped: false });
314
- successCount++;
315
- listings_forget(resolution);
316
- }
317
- else {
318
- const reason = removed.outcome.reason ?? errno_words(removed.outcome.errno);
319
- err_emit(chalk.red(`rm: cannot remove '${pathArg}': ${reason}`));
320
- outcomes.push({ path: pathArg, removed: false, skipped: false });
321
- failCount++;
322
- }
538
+ await confirmedOperand_remove(dispatcher, report, pathArg, shown, runArgs);
323
539
  }
324
540
  catch (e) {
325
- const msg = e instanceof Error ? e.message : String(e);
326
- err_emit(chalk.red(`rm: cannot remove '${pathArg}': ${msg}`));
327
- outcomes.push({ path: pathArg, removed: false, skipped: false });
328
- failCount++;
329
- }
330
- }
331
- if (abandonedAt !== null) {
332
- const notAsked = paths.slice(abandonedAt + 1);
333
- if (notAsked.length > 0) {
334
- out_emit(chalk.gray(`${notAsked.length} more not asked about, and kept`));
335
- for (const kept of notAsked) {
336
- outcomes.push({ path: kept, removed: false, skipped: true });
337
- }
541
+ report.failure_note(pathArg, thrownError_say(e));
338
542
  }
339
543
  }
340
- if (paths.length > 1) {
341
- const summary = rmSummary_format(successCount, failCount);
342
- if (summary) {
343
- out_emit('');
344
- out_emit(summary);
345
- }
346
- }
347
- const model = { kind: 'fs.rm', data: outcomes };
348
- if (failCount > 0) {
349
- const envelope = envelope_error(rendered, undefined, renderedErr || undefined);
350
- envelope.model = model;
351
- return envelope;
352
- }
353
- const envelope = envelope_ok(rendered, model);
354
- return envelope;
544
+ return rmReport_finish(report, paths, abandonedAt);
355
545
  }
356
546
  //# sourceMappingURL=rm.js.map