@unbrained/pm-cli 2026.11.30 → 2026.12.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 (382) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/commander-usage.js +10 -10
  3. package/dist/cli/error-guidance.js +5 -5
  4. package/dist/cli/extension-command-help.js +6 -6
  5. package/dist/cli/help-json-payload.js +7 -7
  6. package/dist/cli/main.js +5 -5
  7. package/dist/cli/register-list-query.js +10 -10
  8. package/dist/cli/register-mutation.js +3 -3
  9. package/dist/cli/runtime/invocation-command-path.js +2 -0
  10. package/dist/cli/runtime/read-output-mutation-retry.js +1 -1
  11. package/dist/cli-bundle/bundle-manifest.json +1 -1
  12. package/dist/cli-bundle/chunks/{chunk-DCWGM7CY.js → chunk-3HKPVOAN.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-Z7YL2SUM.js → chunk-3KEMIPKG.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-TX74QJ4W.js → chunk-4YYFY33T.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-47ZS6RPL.js → chunk-7NAO7I75.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-IGEFPHV7.js → chunk-7V65VACG.js} +52 -52
  17. package/dist/cli-bundle/chunks/chunk-A5ZEMOVR.js +2 -0
  18. package/dist/cli-bundle/chunks/{chunk-5PNOVDVO.js → chunk-AHV3CSQG.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-KCVSSONY.js → chunk-C6WM6ZN4.js} +3 -3
  20. package/dist/cli-bundle/chunks/chunk-CBUC4X7Q.js +127 -0
  21. package/dist/cli-bundle/chunks/{chunk-CCKM5YQM.js → chunk-G6TARHFK.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-TY55UX6M.js → chunk-GOEQXVOI.js} +2 -2
  23. package/dist/cli-bundle/chunks/chunk-I4SPJQQI.js +3 -0
  24. package/dist/cli-bundle/chunks/{chunk-Q4VZSMUL.js → chunk-L2ZSSMYY.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-NHBG5ET3.js → chunk-MZZ4ZJ5Z.js} +2 -2
  26. package/dist/cli-bundle/chunks/chunk-NRQCBUYD.js +113 -0
  27. package/dist/cli-bundle/chunks/{chunk-YVTALIN3.js → chunk-OBPO6V7H.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-KXTKLDKD.js → chunk-OXC5KBIQ.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-HXQ3OHQR.js → chunk-PCDTWL6V.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-AOTI76Q6.js → chunk-Q6K7HWZ7.js} +2 -2
  31. package/dist/cli-bundle/chunks/chunk-QDV7S2QS.js +2 -0
  32. package/dist/cli-bundle/chunks/{chunk-NZSXWIX7.js → chunk-ROTEELDL.js} +7 -7
  33. package/dist/cli-bundle/chunks/{chunk-WFYE34TO.js → chunk-SDXCJZKB.js} +23 -23
  34. package/dist/cli-bundle/chunks/{chunk-2SBTXR6C.js → chunk-SY5C3U32.js} +3 -3
  35. package/dist/cli-bundle/chunks/{chunk-FR7ULTM4.js → chunk-TKUG2X24.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-FECZV72T.js → chunk-UNBW2LF3.js} +2 -2
  37. package/dist/cli-bundle/chunks/chunk-V2S4XAX3.js +2 -0
  38. package/dist/cli-bundle/chunks/chunk-WSEIEDEK.js +2 -0
  39. package/dist/cli-bundle/chunks/{chunk-ZA5NS3PL.js → chunk-ZL6J6JYT.js} +6 -6
  40. package/dist/cli-bundle/chunks/{field-option-collisions-2F2Z7R7B.js → field-option-collisions-BBGTV7AD.js} +2 -2
  41. package/dist/cli-bundle/chunks/item-revision-3LENTXYF.js +2 -0
  42. package/dist/cli-bundle/chunks/item-transaction-56J5OCHA.js +2 -0
  43. package/dist/cli-bundle/chunks/{linked-resource-value-list-WXPPYUVQ.js → linked-resource-value-list-ZBIY4H23.js} +2 -2
  44. package/dist/cli-bundle/chunks/{mutation-actor-UK3QNEEB.js → mutation-actor-NHN33ITJ.js} +2 -2
  45. package/dist/cli-bundle/chunks/{mutation-admission-UTDYPFWP.js → mutation-admission-PGKJTCG6.js} +2 -2
  46. package/dist/cli-bundle/chunks/{register-list-query-DRA3CWHI.js → register-list-query-7S5QWDTI.js} +11 -11
  47. package/dist/cli-bundle/chunks/{register-mutation-WO74VLEQ.js → register-mutation-EK6DVIQK.js} +5 -5
  48. package/dist/cli-bundle/chunks/{register-operations-CRBKH7WN.js → register-operations-6MURXE4V.js} +2 -2
  49. package/dist/cli-bundle/chunks/{register-setup-6V6NQB5C.js → register-setup-RW26X3GJ.js} +2 -2
  50. package/dist/cli-bundle/chunks/{stage-DYEHGASU.js → stage-4ZCF74G4.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-RQYVX2T6.js → chunk-2DGKVXFT.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/chunk-2UWKU2BQ.js +3 -0
  53. package/dist/cli-bundle/focused-chunks/{chunk-A3DORTXS.js → chunk-3COWDIPX.js} +54 -54
  54. package/dist/cli-bundle/focused-chunks/{chunk-UQJ4PY2Y.js → chunk-4SCFAWAW.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/{chunk-7G7JIXLL.js → chunk-6BKT6XQN.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/chunk-6IY5CVGJ.js +2 -0
  57. package/dist/cli-bundle/focused-chunks/chunk-7A6SEZEY.js +4 -0
  58. package/dist/cli-bundle/focused-chunks/{chunk-IJ3T3W4U.js → chunk-BHNBPCHP.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{chunk-LWBZ7UGG.js → chunk-EQCQTYKO.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-FM5WQ6ZU.js → chunk-HTDYNY4L.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{chunk-TQQO42C2.js → chunk-J72TRWR5.js} +26 -26
  62. package/dist/cli-bundle/focused-chunks/{chunk-L357ZAES.js → chunk-JPZGC3W4.js} +5 -5
  63. package/dist/cli-bundle/focused-chunks/{chunk-62AMZMR4.js → chunk-KNBGHCIP.js} +3 -3
  64. package/dist/cli-bundle/focused-chunks/chunk-N64AC5G6.js +100 -0
  65. package/dist/cli-bundle/focused-chunks/{chunk-IIVDBAJM.js → chunk-OG57ESZK.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/{chunk-MZNV26XE.js → chunk-P2H3GTJK.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/chunk-QZRYGYTI.js +2 -0
  68. package/dist/cli-bundle/focused-chunks/chunk-SQMOF65W.js +2 -0
  69. package/dist/cli-bundle/focused-chunks/chunk-T3ILWAEV.js +2 -0
  70. package/dist/cli-bundle/focused-chunks/{chunk-SXC3NVZI.js → chunk-TR22GU7M.js} +2 -2
  71. package/dist/cli-bundle/focused-chunks/{chunk-M57KDG7I.js → chunk-TXTPAFHJ.js} +2 -2
  72. package/dist/cli-bundle/focused-chunks/chunk-VK3IE3TS.js +29 -0
  73. package/dist/cli-bundle/focused-chunks/{chunk-NJTKGBSK.js → chunk-VQIC3UZB.js} +2 -2
  74. package/dist/cli-bundle/focused-chunks/{chunk-U35K7FSE.js → chunk-W4JMV7GF.js} +2 -2
  75. package/dist/cli-bundle/focused-chunks/{field-option-collisions-7TG7STO7.js → field-option-collisions-2C6DLUC4.js} +2 -2
  76. package/dist/cli-bundle/focused-chunks/item-revision-723XCQPS.js +2 -0
  77. package/dist/cli-bundle/focused-chunks/{item-transaction-2IC2MLML.js → item-transaction-LQLQLZE7.js} +2 -2
  78. package/dist/cli-bundle/focused-chunks/{mutation-actor-LJVF2HVD.js → mutation-actor-DJMZUIZI.js} +2 -2
  79. package/dist/cli-bundle/focused-chunks/mutation-admission-SDWQVVHN.js +2 -0
  80. package/dist/cli-bundle/focused-chunks/{stage-MWR73LTZ.js → stage-QBZIK3T5.js} +2 -2
  81. package/dist/cli-bundle/main.js +27 -27
  82. package/dist/cli-bundle/sdk-authoring.js +1 -1
  83. package/dist/cli-bundle/sdk-contracts.js +1 -1
  84. package/dist/cli-bundle/sdk-core.js +1 -1
  85. package/dist/cli-bundle/sdk-governance.js +1 -1
  86. package/dist/cli-bundle/sdk-graph.js +1 -1
  87. package/dist/cli-bundle/sdk-merge.js +61 -61
  88. package/dist/cli-bundle/sdk-query.js +1 -1
  89. package/dist/cli-bundle/sdk-runtime.js +1 -1
  90. package/dist/cli-bundle/sdk-testing.js +1 -1
  91. package/dist/cli-bundle/sdk.js +2 -2
  92. package/dist/core/extensions/reserved-host-flags.js +1 -1
  93. package/dist/core/shared/secret-rules.d.ts +86 -12
  94. package/dist/core/shared/secret-rules.js +7 -5
  95. package/dist/sdk/cli-bootstrap.js +1 -1
  96. package/dist/sdk/cli-contracts/flag-contracts.d.ts +50 -0
  97. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  98. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
  99. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  100. package/dist/sdk/extension/command-options.js +1 -1
  101. package/dist/sdk/extension/install-sources.d.ts +2 -2
  102. package/dist/sdk/extension/install-sources.js +5 -5
  103. package/dist/sdk/lifecycle/expect-hash-admission.d.ts +15 -0
  104. package/dist/sdk/lifecycle/expect-hash-admission.js +2 -0
  105. package/dist/sdk/lifecycle/item-revision.d.ts +4 -1
  106. package/dist/sdk/lifecycle/item-revision.js +1 -1
  107. package/dist/sdk/mutation-guard.js +1 -1
  108. package/dist/sdk/output-contracts.js +1 -1
  109. package/dist/sdk/output-projection.d.ts +1 -1
  110. package/dist/sdk/output-projection.js +1 -1
  111. package/dist/sdk/public-surface.json +1 -1
  112. package/dist/sdk/query/aggregate.js +1 -1
  113. package/dist/sdk/query/context.js +1 -1
  114. package/dist/sdk/query/list.js +1 -1
  115. package/dist/sdk/query/next.js +1 -1
  116. package/dist/sdk/query/search-contracts.js +1 -1
  117. package/dist/sdk/read-output/surfaces.js +1 -1
  118. package/dist/sdk/read-output-budget.d.ts +1 -1
  119. package/dist/sdk/read-output-budget.js +1 -1
  120. package/dist/sdk/read-output-contracts.js +1 -1
  121. package/dist/sdk/read-output-rows.js +1 -1
  122. package/docs/COMMANDS.md +37 -0
  123. package/docs/MUTATION_INTEGRITY.md +226 -10
  124. package/docs/SDK.md +16 -6
  125. package/docs/agent-task-token-baseline.json +1 -1
  126. package/marketplace.json +1 -1
  127. package/node_modules/tar/README.md +1792 -1147
  128. package/node_modules/tar/dist/commonjs/bytes.d.ts +21 -0
  129. package/node_modules/tar/dist/commonjs/bytes.js +83 -0
  130. package/node_modules/tar/dist/commonjs/codec.d.ts +53 -0
  131. package/node_modules/tar/dist/commonjs/codec.js +35 -0
  132. package/node_modules/tar/dist/commonjs/concat.d.ts +3 -0
  133. package/node_modules/tar/dist/commonjs/concat.js +20 -0
  134. package/node_modules/tar/dist/commonjs/create.d.ts +39 -2
  135. package/node_modules/tar/dist/commonjs/create.js +150 -64
  136. package/node_modules/tar/dist/commonjs/dealias.d.ts +79 -0
  137. package/node_modules/tar/dist/commonjs/dealias.js +50 -0
  138. package/node_modules/tar/dist/commonjs/delete.d.ts +19 -0
  139. package/node_modules/tar/dist/commonjs/delete.js +121 -0
  140. package/node_modules/tar/dist/commonjs/entries.d.ts +82 -0
  141. package/node_modules/tar/dist/commonjs/entries.js +398 -0
  142. package/node_modules/tar/dist/commonjs/extract.d.ts +14 -2
  143. package/node_modules/tar/dist/commonjs/extract.js +40 -81
  144. package/node_modules/tar/dist/commonjs/fs.d.ts +201 -0
  145. package/node_modules/tar/dist/commonjs/fs.js +5 -0
  146. package/node_modules/tar/dist/commonjs/header.d.ts +4 -4
  147. package/node_modules/tar/dist/commonjs/header.js +71 -53
  148. package/node_modules/tar/dist/commonjs/index.d.ts +25 -18
  149. package/node_modules/tar/dist/commonjs/index.js +46 -18
  150. package/node_modules/tar/dist/commonjs/index.min.js +2 -3
  151. package/node_modules/tar/dist/commonjs/large-numbers.d.ts +2 -2
  152. package/node_modules/tar/dist/commonjs/large-numbers.js +4 -4
  153. package/node_modules/tar/dist/commonjs/list.d.ts +23 -6
  154. package/node_modules/tar/dist/commonjs/list.js +99 -138
  155. package/node_modules/tar/dist/commonjs/mkdir.d.ts +16 -11
  156. package/node_modules/tar/dist/commonjs/mkdir.js +121 -159
  157. package/node_modules/tar/dist/commonjs/normalize-unicode.js +9 -0
  158. package/node_modules/tar/dist/commonjs/options.d.ts +284 -513
  159. package/node_modules/tar/dist/commonjs/options.js +20 -61
  160. package/node_modules/tar/dist/commonjs/pack.d.ts +150 -96
  161. package/node_modules/tar/dist/commonjs/pack.js +752 -445
  162. package/node_modules/tar/dist/commonjs/parser.d.ts +98 -0
  163. package/node_modules/tar/dist/commonjs/parser.js +452 -0
  164. package/node_modules/tar/dist/commonjs/path-reservations.d.ts +17 -7
  165. package/node_modules/tar/dist/commonjs/path-reservations.js +110 -140
  166. package/node_modules/tar/dist/commonjs/path.d.ts +19 -0
  167. package/node_modules/tar/dist/commonjs/path.js +90 -0
  168. package/node_modules/tar/dist/commonjs/pax.d.ts +3 -1
  169. package/node_modules/tar/dist/commonjs/pax.js +67 -36
  170. package/node_modules/tar/dist/commonjs/read-entry.d.ts +97 -11
  171. package/node_modules/tar/dist/commonjs/read-entry.js +251 -97
  172. package/node_modules/tar/dist/commonjs/read-file.d.ts +22 -0
  173. package/node_modules/tar/dist/commonjs/read-file.js +104 -0
  174. package/node_modules/tar/dist/commonjs/replace.d.ts +45 -1
  175. package/node_modules/tar/dist/commonjs/replace.js +164 -211
  176. package/node_modules/tar/dist/commonjs/server/codecs.d.ts +38 -0
  177. package/node_modules/tar/dist/commonjs/server/codecs.js +252 -0
  178. package/node_modules/tar/dist/commonjs/server/index.d.ts +115 -0
  179. package/node_modules/tar/dist/commonjs/server/index.js +166 -0
  180. package/node_modules/tar/dist/commonjs/server/index.min.js +3 -0
  181. package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +8 -0
  182. package/node_modules/tar/dist/commonjs/strip-absolute-path.js +17 -20
  183. package/node_modules/tar/dist/commonjs/to-stream.d.ts +7 -0
  184. package/node_modules/tar/dist/commonjs/to-stream.js +22 -0
  185. package/node_modules/tar/dist/commonjs/types.d.ts +4 -3
  186. package/node_modules/tar/dist/commonjs/types.js +4 -3
  187. package/node_modules/tar/dist/commonjs/unpack.d.ts +143 -89
  188. package/node_modules/tar/dist/commonjs/unpack.js +780 -725
  189. package/node_modules/tar/dist/commonjs/update.d.ts +11 -1
  190. package/node_modules/tar/dist/commonjs/update.js +37 -28
  191. package/node_modules/tar/dist/commonjs/warn.d.ts +27 -0
  192. package/node_modules/tar/dist/commonjs/warn.js +36 -0
  193. package/node_modules/tar/dist/commonjs/win32-path.d.ts +16 -0
  194. package/node_modules/tar/dist/commonjs/win32-path.js +67 -0
  195. package/node_modules/tar/dist/commonjs/write-entry.d.ts +64 -111
  196. package/node_modules/tar/dist/commonjs/write-entry.js +108 -672
  197. package/node_modules/tar/dist/commonjs/write-flag.d.ts +18 -0
  198. package/node_modules/tar/dist/commonjs/write-flag.js +29 -0
  199. package/node_modules/tar/dist/esm/bytes.d.ts +21 -0
  200. package/node_modules/tar/dist/esm/bytes.js +72 -0
  201. package/node_modules/tar/dist/esm/codec.d.ts +53 -0
  202. package/node_modules/tar/dist/esm/codec.js +32 -0
  203. package/node_modules/tar/dist/esm/concat.d.ts +3 -0
  204. package/node_modules/tar/dist/esm/concat.js +16 -0
  205. package/node_modules/tar/dist/esm/create.d.ts +39 -2
  206. package/node_modules/tar/dist/esm/create.js +144 -61
  207. package/node_modules/tar/dist/esm/dealias.d.ts +79 -0
  208. package/node_modules/tar/dist/esm/dealias.js +46 -0
  209. package/node_modules/tar/dist/esm/delete.d.ts +19 -0
  210. package/node_modules/tar/dist/esm/delete.js +117 -0
  211. package/node_modules/tar/dist/esm/entries.d.ts +82 -0
  212. package/node_modules/tar/dist/esm/entries.js +388 -0
  213. package/node_modules/tar/dist/esm/extract.d.ts +14 -2
  214. package/node_modules/tar/dist/esm/extract.js +37 -44
  215. package/node_modules/tar/dist/esm/fs.d.ts +201 -0
  216. package/node_modules/tar/dist/esm/fs.js +4 -0
  217. package/node_modules/tar/dist/esm/header.d.ts +4 -4
  218. package/node_modules/tar/dist/esm/header.js +71 -53
  219. package/node_modules/tar/dist/esm/index.d.ts +25 -18
  220. package/node_modules/tar/dist/esm/index.js +23 -18
  221. package/node_modules/tar/dist/esm/index.min.js +2 -3
  222. package/node_modules/tar/dist/esm/large-numbers.d.ts +2 -2
  223. package/node_modules/tar/dist/esm/large-numbers.js +4 -4
  224. package/node_modules/tar/dist/esm/list.d.ts +23 -6
  225. package/node_modules/tar/dist/esm/list.js +96 -101
  226. package/node_modules/tar/dist/esm/mkdir.d.ts +16 -11
  227. package/node_modules/tar/dist/esm/mkdir.js +119 -154
  228. package/node_modules/tar/dist/esm/normalize-unicode.js +9 -0
  229. package/node_modules/tar/dist/esm/options.d.ts +284 -513
  230. package/node_modules/tar/dist/esm/options.js +17 -51
  231. package/node_modules/tar/dist/esm/pack.d.ts +150 -96
  232. package/node_modules/tar/dist/esm/pack.js +750 -441
  233. package/node_modules/tar/dist/esm/parser.d.ts +98 -0
  234. package/node_modules/tar/dist/esm/parser.js +448 -0
  235. package/node_modules/tar/dist/esm/path-reservations.d.ts +17 -7
  236. package/node_modules/tar/dist/esm/path-reservations.js +110 -140
  237. package/node_modules/tar/dist/esm/path.d.ts +19 -0
  238. package/node_modules/tar/dist/esm/path.js +80 -0
  239. package/node_modules/tar/dist/esm/pax.d.ts +3 -1
  240. package/node_modules/tar/dist/esm/pax.js +66 -35
  241. package/node_modules/tar/dist/esm/read-entry.d.ts +97 -11
  242. package/node_modules/tar/dist/esm/read-entry.js +248 -96
  243. package/node_modules/tar/dist/esm/read-file.d.ts +22 -0
  244. package/node_modules/tar/dist/esm/read-file.js +99 -0
  245. package/node_modules/tar/dist/esm/replace.d.ts +45 -1
  246. package/node_modules/tar/dist/esm/replace.js +160 -207
  247. package/node_modules/tar/dist/esm/server/codecs.d.ts +38 -0
  248. package/node_modules/tar/dist/esm/server/codecs.js +214 -0
  249. package/node_modules/tar/dist/esm/server/index.d.ts +115 -0
  250. package/node_modules/tar/dist/esm/server/index.js +102 -0
  251. package/node_modules/tar/dist/esm/server/index.min.js +3 -0
  252. package/node_modules/tar/dist/esm/strip-absolute-path.d.ts +8 -0
  253. package/node_modules/tar/dist/esm/strip-absolute-path.js +17 -20
  254. package/node_modules/tar/dist/esm/to-stream.d.ts +7 -0
  255. package/node_modules/tar/dist/esm/to-stream.js +18 -0
  256. package/node_modules/tar/dist/esm/types.d.ts +4 -3
  257. package/node_modules/tar/dist/esm/types.js +4 -3
  258. package/node_modules/tar/dist/esm/unpack.d.ts +143 -89
  259. package/node_modules/tar/dist/esm/unpack.js +776 -719
  260. package/node_modules/tar/dist/esm/update.d.ts +11 -1
  261. package/node_modules/tar/dist/esm/update.js +35 -28
  262. package/node_modules/tar/dist/esm/warn.d.ts +27 -0
  263. package/node_modules/tar/dist/esm/warn.js +31 -0
  264. package/node_modules/tar/dist/esm/win32-path.d.ts +16 -0
  265. package/node_modules/tar/dist/esm/win32-path.js +60 -0
  266. package/node_modules/tar/dist/esm/write-entry.d.ts +64 -111
  267. package/node_modules/tar/dist/esm/write-entry.js +107 -633
  268. package/node_modules/tar/dist/esm/write-flag.d.ts +18 -0
  269. package/node_modules/tar/dist/esm/write-flag.js +25 -0
  270. package/node_modules/tar/package.json +68 -224
  271. package/package.json +2 -2
  272. package/packages/pm-beads/package.json +1 -1
  273. package/packages/pm-calendar/package.json +1 -1
  274. package/packages/pm-command-kit/package.json +1 -1
  275. package/packages/pm-digital-twin/package.json +1 -1
  276. package/packages/pm-governance-audit/package.json +1 -1
  277. package/packages/pm-guide-shell/package.json +1 -1
  278. package/packages/pm-kanban/package.json +1 -1
  279. package/packages/pm-lifecycle-hooks/package.json +1 -1
  280. package/packages/pm-linked-test-adapters/package.json +1 -1
  281. package/packages/pm-search-advanced/package.json +1 -1
  282. package/packages/pm-templates/package.json +1 -1
  283. package/packages/pm-todos/package.json +1 -1
  284. package/packages/pm-vcs/package.json +1 -1
  285. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  286. package/plugins/pm-claude/package.json +1 -1
  287. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  288. package/plugins/pm-codex/package.json +1 -1
  289. package/plugins/pm-codex/plugin.json +1 -1
  290. package/runtime-dependencies.json +1 -1
  291. package/dist/cli-bundle/chunks/chunk-3TXEWHQX.js +0 -125
  292. package/dist/cli-bundle/chunks/chunk-JPJNJHQW.js +0 -2
  293. package/dist/cli-bundle/chunks/chunk-NVYDPNQP.js +0 -2
  294. package/dist/cli-bundle/chunks/chunk-SJWIPGZW.js +0 -113
  295. package/dist/cli-bundle/chunks/chunk-USBTXMKS.js +0 -2
  296. package/dist/cli-bundle/chunks/chunk-VCXQ6A35.js +0 -3
  297. package/dist/cli-bundle/chunks/chunk-YPMNXG2C.js +0 -2
  298. package/dist/cli-bundle/chunks/item-revision-UAF6L47R.js +0 -2
  299. package/dist/cli-bundle/chunks/item-transaction-RJECL53Y.js +0 -2
  300. package/dist/cli-bundle/focused-chunks/chunk-2UUBS4BG.js +0 -2
  301. package/dist/cli-bundle/focused-chunks/chunk-4ER3VMST.js +0 -2
  302. package/dist/cli-bundle/focused-chunks/chunk-4YBMHMBJ.js +0 -2
  303. package/dist/cli-bundle/focused-chunks/chunk-HXM7K6VH.js +0 -100
  304. package/dist/cli-bundle/focused-chunks/chunk-NGHT2LNG.js +0 -3
  305. package/dist/cli-bundle/focused-chunks/chunk-P55AZPFN.js +0 -2
  306. package/dist/cli-bundle/focused-chunks/chunk-WAP3DF4B.js +0 -27
  307. package/dist/cli-bundle/focused-chunks/chunk-XR745UGE.js +0 -4
  308. package/dist/cli-bundle/focused-chunks/item-revision-J7EUGCHR.js +0 -2
  309. package/dist/cli-bundle/focused-chunks/mutation-admission-SLFAUONA.js +0 -2
  310. package/node_modules/@isaacs/fs-minipass/LICENSE +0 -15
  311. package/node_modules/@isaacs/fs-minipass/README.md +0 -71
  312. package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts +0 -118
  313. package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +0 -430
  314. package/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +0 -3
  315. package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts +0 -118
  316. package/node_modules/@isaacs/fs-minipass/dist/esm/index.js +0 -420
  317. package/node_modules/@isaacs/fs-minipass/dist/esm/package.json +0 -3
  318. package/node_modules/@isaacs/fs-minipass/package.json +0 -72
  319. package/node_modules/chownr/LICENSE.md +0 -63
  320. package/node_modules/chownr/README.md +0 -3
  321. package/node_modules/chownr/dist/commonjs/index.d.ts +0 -3
  322. package/node_modules/chownr/dist/commonjs/index.js +0 -93
  323. package/node_modules/chownr/dist/commonjs/package.json +0 -3
  324. package/node_modules/chownr/dist/esm/index.d.ts +0 -3
  325. package/node_modules/chownr/dist/esm/index.js +0 -85
  326. package/node_modules/chownr/dist/esm/package.json +0 -3
  327. package/node_modules/chownr/package.json +0 -69
  328. package/node_modules/minipass/LICENSE.md +0 -55
  329. package/node_modules/minipass/README.md +0 -825
  330. package/node_modules/minipass/dist/commonjs/index.d.ts +0 -545
  331. package/node_modules/minipass/dist/commonjs/index.js +0 -1038
  332. package/node_modules/minipass/dist/commonjs/package.json +0 -3
  333. package/node_modules/minipass/dist/esm/index.d.ts +0 -545
  334. package/node_modules/minipass/dist/esm/index.js +0 -1020
  335. package/node_modules/minipass/dist/esm/package.json +0 -3
  336. package/node_modules/minipass/package.json +0 -77
  337. package/node_modules/minizlib/LICENSE +0 -26
  338. package/node_modules/minizlib/README.md +0 -64
  339. package/node_modules/minizlib/dist/commonjs/constants.d.ts +0 -2
  340. package/node_modules/minizlib/dist/commonjs/constants.js +0 -123
  341. package/node_modules/minizlib/dist/commonjs/index.d.ts +0 -99
  342. package/node_modules/minizlib/dist/commonjs/index.js +0 -416
  343. package/node_modules/minizlib/dist/commonjs/package.json +0 -3
  344. package/node_modules/minizlib/dist/esm/constants.d.ts +0 -2
  345. package/node_modules/minizlib/dist/esm/constants.js +0 -117
  346. package/node_modules/minizlib/dist/esm/index.d.ts +0 -99
  347. package/node_modules/minizlib/dist/esm/index.js +0 -363
  348. package/node_modules/minizlib/dist/esm/package.json +0 -3
  349. package/node_modules/minizlib/package.json +0 -80
  350. package/node_modules/tar/dist/commonjs/get-write-flag.d.ts +0 -2
  351. package/node_modules/tar/dist/commonjs/get-write-flag.js +0 -32
  352. package/node_modules/tar/dist/commonjs/make-command.d.ts +0 -49
  353. package/node_modules/tar/dist/commonjs/make-command.js +0 -52
  354. package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +0 -2
  355. package/node_modules/tar/dist/commonjs/normalize-windows-path.js +0 -12
  356. package/node_modules/tar/dist/commonjs/parse.d.ts +0 -92
  357. package/node_modules/tar/dist/commonjs/parse.js +0 -655
  358. package/node_modules/tar/dist/commonjs/process-umask.d.ts +0 -2
  359. package/node_modules/tar/dist/commonjs/process-umask.js +0 -7
  360. package/node_modules/tar/dist/commonjs/warn-method.d.ts +0 -24
  361. package/node_modules/tar/dist/commonjs/warn-method.js +0 -31
  362. package/node_modules/tar/dist/esm/get-write-flag.d.ts +0 -2
  363. package/node_modules/tar/dist/esm/get-write-flag.js +0 -26
  364. package/node_modules/tar/dist/esm/make-command.d.ts +0 -49
  365. package/node_modules/tar/dist/esm/make-command.js +0 -48
  366. package/node_modules/tar/dist/esm/normalize-windows-path.d.ts +0 -2
  367. package/node_modules/tar/dist/esm/normalize-windows-path.js +0 -9
  368. package/node_modules/tar/dist/esm/parse.d.ts +0 -92
  369. package/node_modules/tar/dist/esm/parse.js +0 -651
  370. package/node_modules/tar/dist/esm/process-umask.d.ts +0 -2
  371. package/node_modules/tar/dist/esm/process-umask.js +0 -3
  372. package/node_modules/tar/dist/esm/warn-method.d.ts +0 -24
  373. package/node_modules/tar/dist/esm/warn-method.js +0 -27
  374. package/node_modules/yallist/LICENSE.md +0 -63
  375. package/node_modules/yallist/README.md +0 -205
  376. package/node_modules/yallist/dist/commonjs/index.d.ts +0 -39
  377. package/node_modules/yallist/dist/commonjs/index.js +0 -384
  378. package/node_modules/yallist/dist/commonjs/package.json +0 -3
  379. package/node_modules/yallist/dist/esm/index.d.ts +0 -39
  380. package/node_modules/yallist/dist/esm/index.js +0 -379
  381. package/node_modules/yallist/dist/esm/package.json +0 -3
  382. package/node_modules/yallist/package.json +0 -68
@@ -0,0 +1,117 @@
1
+ import { gzip } from './codec.js';
2
+ import { create, createSync } from './create.js';
3
+ import { dealias } from './dealias.js';
4
+ import { findCodec, headLength, TarReader, TarReaderSync, } from './entries.js';
5
+ import { filesFilter } from './list.js';
6
+ import { readFile, readFileSync } from './read-file.js';
7
+ const noop = () => { };
8
+ // The codecs to look for, and the filter and the report of the paths
9
+ // to delete.
10
+ const plan = (opt, files) => {
11
+ if (!opt.file)
12
+ throw new TypeError('file is required');
13
+ if (!opt.fs)
14
+ throw new TypeError('the file option needs the fs option');
15
+ const codecs = [...(opt.codecs ?? []), gzip];
16
+ if (files?.length)
17
+ return [codecs, ...filesFilter(files, opt.filter)];
18
+ if (opt.filter)
19
+ return [codecs, opt.filter];
20
+ throw new TypeError('no paths specified to delete');
21
+ };
22
+ // The path of the new archive, until it gets the path of the old one.
23
+ const tmpName = (file) => `${file}.${Math.random().toString(36).slice(2)}.tmp`;
24
+ /**
25
+ * Remove entries from an archive file. An entry is removed if
26
+ * `files` lists its path or one of its parent directories. With
27
+ * `opt.filter`, only if the filter also returns true. With no
28
+ * `files`, each entry that the filter accepts is removed. A listed
29
+ * path that no entry matches is a warning.
30
+ *
31
+ * The other entries are written to a new file next to the archive,
32
+ * with the compression and the mode of the archive. The new file
33
+ * then gets the path of the archive. The archive does not change if
34
+ * the command fails.
35
+ */
36
+ const del = async (options, files) => {
37
+ const opt = dealias(options);
38
+ const [codecs, remove, report] = plan(opt, files);
39
+ const { fs, file, filter: _, maxReadSize, ...read } = opt;
40
+ const head = new Uint8Array(headLength(codecs));
41
+ let length = 0;
42
+ const handle = await fs.open(file, 'r');
43
+ try {
44
+ for (let n = 1; n > 0 && length < head.length; length += n) {
45
+ n = (await handle.read(head, length, head.length - length, length))
46
+ .bytesRead;
47
+ }
48
+ }
49
+ finally {
50
+ await handle.close();
51
+ }
52
+ const { mode } = await fs.stat(file);
53
+ const tmp = tmpName(file);
54
+ try {
55
+ await create({
56
+ ...read,
57
+ fs,
58
+ file: tmp,
59
+ mode: mode & 0o777,
60
+ compress: findCodec(codecs, head.subarray(0, length), file),
61
+ preservePaths: true,
62
+ filter: (path, entry) => !remove(path, entry),
63
+ }, [new TarReader(readFile(fs, file, maxReadSize), { ...read, file })]);
64
+ report?.(opt);
65
+ await fs.rename(tmp, file);
66
+ }
67
+ catch (er) {
68
+ await fs.unlink(tmp).catch(noop);
69
+ throw er;
70
+ }
71
+ };
72
+ /** The sync form of `delete`. */
73
+ export const deleteSync = (options, files) => {
74
+ const opt = dealias(options);
75
+ const [codecs, remove, report] = plan(opt, files);
76
+ const { fs, file, filter: _, maxReadSize, ...read } = opt;
77
+ const head = new Uint8Array(headLength(codecs));
78
+ let length = 0;
79
+ const fd = fs.openSync(file, 'r');
80
+ try {
81
+ for (let n = 1; n > 0 && length < head.length; length += n) {
82
+ n = fs.readSync(fd, head, length, head.length - length, length);
83
+ }
84
+ }
85
+ finally {
86
+ fs.closeSync(fd);
87
+ }
88
+ const { mode } = fs.statSync(file);
89
+ const tmp = tmpName(file);
90
+ try {
91
+ createSync({
92
+ ...read,
93
+ fs,
94
+ file: tmp,
95
+ mode: mode & 0o777,
96
+ compress: findCodec(codecs, head.subarray(0, length), file),
97
+ preservePaths: true,
98
+ filter: (path, entry) => !remove(path, entry),
99
+ }, [
100
+ new TarReaderSync(readFileSync(fs, file, maxReadSize), {
101
+ ...read,
102
+ file,
103
+ }),
104
+ ]);
105
+ report?.(opt);
106
+ fs.renameSync(tmp, file);
107
+ }
108
+ catch (er) {
109
+ try {
110
+ fs.unlinkSync(tmp);
111
+ }
112
+ catch { }
113
+ throw er;
114
+ }
115
+ };
116
+ export { del as delete };
117
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1,82 @@
1
+ import { type Codec } from './codec.js';
2
+ import { type ReadOptions, type ReadOptionsSync, type TarInput, type TarInputSync } from './options.js';
3
+ import { Parser } from './parser.js';
4
+ import { ReadEntry, ReadEntrySync, type BodySource, type BodySourceSync, type EntryData } from './read-entry.js';
5
+ export declare const headLength: (codecs: Codec[]) => number;
6
+ export declare const findCodec: (codecs: Codec[], head: Uint8Array, file?: string) => Codec | undefined;
7
+ /**
8
+ * Gets entries and the parts of their bodies from a `Parser`. The
9
+ * readers use it. It does not read input.
10
+ */
11
+ export declare class EntryCursor<E extends EntryData> {
12
+ parser: Parser<E>;
13
+ /** The entry that has a body to read now. */
14
+ current?: E;
15
+ /** True after the end of the archive. */
16
+ ended: boolean;
17
+ constructor(parser: Parser<E>);
18
+ /**
19
+ * The next entry that is not ignored. `null` at the end of the
20
+ * archive. `undefined` if the parser needs more input. The rest of
21
+ * the body of the entry before it is skipped.
22
+ */
23
+ entry(): E | null | undefined;
24
+ /**
25
+ * The next part of the body of `entry`. `null` at the end of the
26
+ * body. `undefined` if the parser needs more input.
27
+ */
28
+ body(entry: E): Uint8Array | null | undefined;
29
+ }
30
+ /**
31
+ * Reads the entries of an archive from async input. It is the
32
+ * iterator that `entries()` returns.
33
+ *
34
+ * Input is read only when the consumer asks for the next entry or
35
+ * for more of a body. `poll()` and `fill()` do the same work as
36
+ * `next()`, with no promise for an entry that is in memory.
37
+ */
38
+ export declare class TarReader implements AsyncIterableIterator<ReadEntry, undefined>, BodySource {
39
+ #private;
40
+ parser: Parser<ReadEntry>;
41
+ constructor(input: TarInput, opt?: ReadOptions);
42
+ /**
43
+ * The next entry, if it is in memory. `null` at the end of the
44
+ * archive. `undefined` if more input is needed: then await `fill()`
45
+ * and call this again.
46
+ */
47
+ poll(): ReadEntry | null | undefined;
48
+ readBody(entry: ReadEntry): Uint8Array | null | undefined;
49
+ /** Read one chunk of input, and give it to the parser. */
50
+ fill(): Promise<void>;
51
+ next(): Promise<IteratorResult<ReadEntry, undefined>>;
52
+ /** Stop reading, and release the input. */
53
+ return(): Promise<IteratorResult<ReadEntry, undefined>>;
54
+ [Symbol.asyncIterator](): this;
55
+ }
56
+ /**
57
+ * Reads the entries of an archive from sync input. It is the
58
+ * iterator that `entriesSync()` returns.
59
+ */
60
+ export declare class TarReaderSync implements IterableIterator<ReadEntrySync, undefined>, BodySourceSync {
61
+ #private;
62
+ parser: Parser<ReadEntrySync>;
63
+ constructor(input: TarInputSync, opt?: ReadOptionsSync);
64
+ readBody(entry: ReadEntrySync): Uint8Array | null;
65
+ next(): IteratorResult<ReadEntrySync, undefined>;
66
+ /** Stop reading, and release the input. */
67
+ return(): IteratorResult<ReadEntrySync, undefined>;
68
+ [Symbol.iterator](): this;
69
+ }
70
+ /**
71
+ * Read the entries of an archive. Gzip input is decompressed.
72
+ *
73
+ * Read the body of an entry before the next entry: when the iterator
74
+ * moves on, the rest of the body is skipped.
75
+ */
76
+ export declare const entries: (input: TarInput, opt?: ReadOptions) => AsyncIterableIterator<ReadEntry, undefined>;
77
+ /**
78
+ * Read the entries of an archive with no promises. Compressed input
79
+ * needs a codec with a `decompressSync` function in `opt.codecs`.
80
+ */
81
+ export declare const entriesSync: (input: TarInputSync, opt?: ReadOptionsSync) => IterableIterator<ReadEntrySync, undefined>;
82
+ //# sourceMappingURL=entries.d.ts.map
@@ -0,0 +1,388 @@
1
+ import { isArrayBuffer, isBlob, isReadableStream, isUint8Array, } from './bytes.js';
2
+ import { Header } from './header.js';
3
+ import { gzip } from './codec.js';
4
+ import { concat } from './concat.js';
5
+ import { ownOptions, } from './options.js';
6
+ import { Parser } from './parser.js';
7
+ import { ReadEntry, ReadEntrySync, } from './read-entry.js';
8
+ import { SKIP } from './read-file.js';
9
+ import { tarError } from './warn.js';
10
+ const noop = () => { };
11
+ // The number of bytes to read before the choice of a codec.
12
+ export const headLength = (codecs) => Math.max(512, ...codecs.map(c => c.headLength));
13
+ const isTar = (head) => {
14
+ try {
15
+ const header = new Header(head);
16
+ return header.cksumValid || header.nullBlock;
17
+ }
18
+ catch {
19
+ return false;
20
+ }
21
+ };
22
+ export const findCodec = (codecs, head, file = '') => codecs.find(c => c.detect(head)) ??
23
+ (isTar(head) ? undefined : (codecs.find(c => c.extensions?.some(x => file.endsWith(x)))));
24
+ const maxRatio = (opt) => typeof opt.maxDecompressionRatio === 'number' ?
25
+ opt.maxDecompressionRatio
26
+ : 1000;
27
+ const abort = (opt, er) => tarError(opt, 'TAR_ABORT', er, { recoverable: false });
28
+ const ratioError = (opt, ratio, max) => abort(opt, new Error(`max decompression ratio exceeded: ${ratio.toFixed(2)} > ${max}`));
29
+ const notCurrent = () => new TypeError('The body of an entry cannot be read after a later entry');
30
+ /**
31
+ * Gets entries and the parts of their bodies from a `Parser`. The
32
+ * readers use it. It does not read input.
33
+ */
34
+ export class EntryCursor {
35
+ parser;
36
+ /** The entry that has a body to read now. */
37
+ current;
38
+ /** True after the end of the archive. */
39
+ ended = false;
40
+ constructor(parser) {
41
+ this.parser = parser;
42
+ }
43
+ /**
44
+ * The next entry that is not ignored. `null` at the end of the
45
+ * archive. `undefined` if the parser needs more input. The rest of
46
+ * the body of the entry before it is skipped.
47
+ */
48
+ entry() {
49
+ this.current = undefined;
50
+ if (this.ended)
51
+ return null;
52
+ for (let ev; (ev = this.parser.next());) {
53
+ if (ev.type === 'end') {
54
+ this.ended = true;
55
+ return null;
56
+ }
57
+ if (ev.type === 'entry' && !ev.entry.ignore) {
58
+ return (this.current = ev.entry);
59
+ }
60
+ }
61
+ }
62
+ /**
63
+ * The next part of the body of `entry`. `null` at the end of the
64
+ * body. `undefined` if the parser needs more input.
65
+ */
66
+ body(entry) {
67
+ if (entry !== this.current)
68
+ throw notCurrent();
69
+ const ev = this.parser.next();
70
+ if (!ev)
71
+ return undefined;
72
+ if (ev.type === 'body')
73
+ return ev.data;
74
+ this.current = undefined;
75
+ return null;
76
+ }
77
+ }
78
+ // Skip the rest of a body that no consumer reads, if it is after the
79
+ // input that the parser has, and the source can skip it. The source
80
+ // must be the input of the reader: decompressed data has no place in
81
+ // the input.
82
+ const skipBody = (cursor, source) => {
83
+ if (cursor.current)
84
+ return;
85
+ const n = cursor.parser.bodyRemain;
86
+ if (n && source[SKIP]?.(n))
87
+ cursor.parser.skipBody();
88
+ };
89
+ const toSource = (input) => {
90
+ if (isUint8Array(input))
91
+ return [input].values();
92
+ if (isArrayBuffer(input))
93
+ return [new Uint8Array(input)].values();
94
+ if (isBlob(input))
95
+ input = input.stream();
96
+ if (isReadableStream(input)) {
97
+ const reader = input.getReader();
98
+ return { next: () => reader.read(), return: () => reader.cancel() };
99
+ }
100
+ return Symbol.asyncIterator in input ?
101
+ input[Symbol.asyncIterator]()
102
+ : input[Symbol.iterator]();
103
+ };
104
+ /**
105
+ * Reads the entries of an archive from async input. It is the
106
+ * iterator that `entries()` returns.
107
+ *
108
+ * Input is read only when the consumer asks for the next entry or
109
+ * for more of a body. `poll()` and `fill()` do the same work as
110
+ * `next()`, with no promise for an entry that is in memory.
111
+ */
112
+ export class TarReader {
113
+ parser;
114
+ #cursor;
115
+ #opt;
116
+ #input;
117
+ #source;
118
+ // the first bytes of input that is not compressed
119
+ #head;
120
+ #filling;
121
+ #done = false;
122
+ constructor(input, opt = {}) {
123
+ opt = ownOptions(opt);
124
+ const win32 = opt.platform === 'win32';
125
+ this.parser = new Parser(opt, (header, ex, gex) => new ReadEntry(header, ex, gex, win32, this));
126
+ this.#cursor = new EntryCursor(this.parser);
127
+ this.#opt = opt;
128
+ this.#input = toSource(input);
129
+ }
130
+ /**
131
+ * The next entry, if it is in memory. `null` at the end of the
132
+ * archive. `undefined` if more input is needed: then await `fill()`
133
+ * and call this again.
134
+ */
135
+ poll() {
136
+ return this.#done ? null : this.#cursor.entry();
137
+ }
138
+ readBody(entry) {
139
+ return this.#cursor.body(entry);
140
+ }
141
+ /** Read one chunk of input, and give it to the parser. */
142
+ fill() {
143
+ return (this.#filling ??= this.#fill());
144
+ }
145
+ async #fill() {
146
+ try {
147
+ const source = (this.#source ??= await this.#open(this.#input));
148
+ const head = this.#head;
149
+ this.#head = undefined;
150
+ if (source === this.#input)
151
+ skipBody(this.#cursor, source);
152
+ const res = head ? { value: head, done: false } : await source.next();
153
+ if (res.done)
154
+ this.parser.end();
155
+ else
156
+ this.parser.push(res.value);
157
+ }
158
+ finally {
159
+ this.#filling = undefined;
160
+ }
161
+ }
162
+ // Read the first bytes, and add the decompression if they need it.
163
+ async #open(input) {
164
+ const opt = this.#opt;
165
+ const codecs = [...(opt.codecs ?? []), gzip];
166
+ const need = headLength(codecs);
167
+ let head;
168
+ while (!head || head.length < need) {
169
+ const res = await input.next();
170
+ if (res.done)
171
+ break;
172
+ head = head ? concat([head, res.value]) : res.value;
173
+ }
174
+ const codec = head && findCodec(codecs, head, opt.file);
175
+ if (!codec) {
176
+ this.#head = head;
177
+ return input;
178
+ }
179
+ let compressed = 0;
180
+ let decompressed = 0;
181
+ const { readable, writable } = codec.decompress();
182
+ const writer = writable.getWriter();
183
+ const reader = readable.getReader();
184
+ let stopped = false;
185
+ // Give the input to the codec, as fast as the codec takes it. This
186
+ // loop holds each promise of the writer, so that a write that
187
+ // fails after the consumer stops is not an unhandled rejection.
188
+ const feed = async () => {
189
+ try {
190
+ for (;;) {
191
+ await writer.ready;
192
+ if (stopped)
193
+ return;
194
+ const res = head ? { value: head, done: false } : await input.next();
195
+ head = undefined;
196
+ if (stopped)
197
+ return;
198
+ if (res.done)
199
+ return await writer.close();
200
+ compressed += res.value.length;
201
+ await writer.write(res.value);
202
+ }
203
+ }
204
+ catch (er) {
205
+ // An error of the input goes to the reader of the output. An
206
+ // error of the codec is there already.
207
+ if (!stopped)
208
+ await writer.abort(er).catch(noop);
209
+ }
210
+ };
211
+ void feed();
212
+ const max = maxRatio(opt);
213
+ return {
214
+ next: async () => {
215
+ const res = await reader.read().catch(er => {
216
+ throw abort(opt, er);
217
+ });
218
+ if (!res.done) {
219
+ decompressed += res.value.length;
220
+ const ratio = decompressed / compressed;
221
+ if (ratio > max)
222
+ throw ratioError(opt, ratio, max);
223
+ }
224
+ return res;
225
+ },
226
+ return: async () => {
227
+ stopped = true;
228
+ await reader.cancel().catch(noop);
229
+ await writer.abort().catch(noop);
230
+ await input.return?.();
231
+ return { value: undefined, done: true };
232
+ },
233
+ };
234
+ }
235
+ async next() {
236
+ try {
237
+ for (;;) {
238
+ const entry = this.poll();
239
+ if (entry)
240
+ return { value: entry, done: false };
241
+ if (entry === null)
242
+ break;
243
+ await this.fill();
244
+ }
245
+ }
246
+ catch (er) {
247
+ await this.return();
248
+ throw er;
249
+ }
250
+ return this.return();
251
+ }
252
+ /** Stop reading, and release the input. */
253
+ async return() {
254
+ if (!this.#done) {
255
+ this.#done = true;
256
+ this.#cursor.current = undefined;
257
+ await (this.#source ?? this.#input).return?.();
258
+ }
259
+ return { value: undefined, done: true };
260
+ }
261
+ [Symbol.asyncIterator]() {
262
+ return this;
263
+ }
264
+ }
265
+ /**
266
+ * Reads the entries of an archive from sync input. It is the
267
+ * iterator that `entriesSync()` returns.
268
+ */
269
+ export class TarReaderSync {
270
+ parser;
271
+ #cursor;
272
+ #opt;
273
+ #input;
274
+ #source;
275
+ // the first bytes of input that is not compressed
276
+ #head;
277
+ #done = false;
278
+ constructor(input, opt = {}) {
279
+ opt = ownOptions(opt);
280
+ const win32 = opt.platform === 'win32';
281
+ this.parser = new Parser(opt, (header, ex, gex) => new ReadEntrySync(header, ex, gex, win32, this));
282
+ this.#cursor = new EntryCursor(this.parser);
283
+ this.#opt = opt;
284
+ this.#input =
285
+ isUint8Array(input) ? [input].values()
286
+ : isArrayBuffer(input) ? [new Uint8Array(input)].values()
287
+ : input[Symbol.iterator]();
288
+ }
289
+ readBody(entry) {
290
+ for (;;) {
291
+ const part = this.#cursor.body(entry);
292
+ if (part !== undefined)
293
+ return part;
294
+ this.#fill();
295
+ }
296
+ }
297
+ #fill() {
298
+ const source = (this.#source ??= this.#open(this.#input));
299
+ const head = this.#head;
300
+ this.#head = undefined;
301
+ if (source === this.#input)
302
+ skipBody(this.#cursor, source);
303
+ const res = head ? { value: head, done: false } : source.next();
304
+ if (res.done)
305
+ this.parser.end();
306
+ else
307
+ this.parser.push(res.value);
308
+ }
309
+ // Read the first bytes. If they are compressed, read and decompress
310
+ // all the input.
311
+ #open(input) {
312
+ const opt = this.#opt;
313
+ const codecs = [...(opt.codecs ?? []), gzip];
314
+ const need = headLength(codecs);
315
+ let head;
316
+ let res;
317
+ while ((!head || head.length < need) && !(res = input.next()).done) {
318
+ head = head ? concat([head, res.value]) : res.value;
319
+ }
320
+ const codec = head && findCodec(codecs, head, opt.file);
321
+ if (!head || !codec) {
322
+ this.#head = head;
323
+ return input;
324
+ }
325
+ const { decompressSync } = codec;
326
+ if (!decompressSync) {
327
+ throw abort(opt, new Error(`the ${codec.name} codec has no decompressSync function`));
328
+ }
329
+ const parts = [head];
330
+ while (!(res = input.next()).done)
331
+ parts.push(res.value);
332
+ const data = concat(parts);
333
+ const max = maxRatio(opt);
334
+ let out;
335
+ try {
336
+ out = decompressSync(data, { maxOutputLength: data.length * max });
337
+ }
338
+ catch (er) {
339
+ throw abort(opt, er);
340
+ }
341
+ const ratio = out.length / data.length;
342
+ if (ratio > max)
343
+ throw ratioError(opt, ratio, max);
344
+ return [out].values();
345
+ }
346
+ next() {
347
+ try {
348
+ for (;;) {
349
+ const entry = this.#done ? null : this.#cursor.entry();
350
+ if (entry)
351
+ return { value: entry, done: false };
352
+ if (entry === null)
353
+ break;
354
+ this.#fill();
355
+ }
356
+ }
357
+ catch (er) {
358
+ this.return();
359
+ throw er;
360
+ }
361
+ return this.return();
362
+ }
363
+ /** Stop reading, and release the input. */
364
+ return() {
365
+ if (!this.#done) {
366
+ this.#done = true;
367
+ this.#cursor.current = undefined;
368
+ (this.#source ?? this.#input).return?.();
369
+ }
370
+ return { value: undefined, done: true };
371
+ }
372
+ [Symbol.iterator]() {
373
+ return this;
374
+ }
375
+ }
376
+ /**
377
+ * Read the entries of an archive. Gzip input is decompressed.
378
+ *
379
+ * Read the body of an entry before the next entry: when the iterator
380
+ * moves on, the rest of the body is skipped.
381
+ */
382
+ export const entries = (input, opt) => new TarReader(input, opt);
383
+ /**
384
+ * Read the entries of an archive with no promises. Compressed input
385
+ * needs a codec with a `decompressSync` function in `opt.codecs`.
386
+ */
387
+ export const entriesSync = (input, opt) => new TarReaderSync(input, opt);
388
+ //# sourceMappingURL=entries.js.map
@@ -1,3 +1,15 @@
1
- import { Unpack, UnpackSync } from './unpack.js';
2
- export declare const extract: import("./make-command.js").TarCommand<Unpack, UnpackSync>;
1
+ import { type WithAliases } from './dealias.js';
2
+ import type { ExtractOptions, ExtractOptionsSync } from './options.js';
3
+ /**
4
+ * Extract the entries of an archive into the directory `opt.cwd`.
5
+ * If `files` is set, only the entries that it lists, and the entries
6
+ * in the directories that it lists.
7
+ *
8
+ * A problem with one entry is a warning for `opt.onwarn`, and the
9
+ * extraction continues. A listed path that no entry matches is a
10
+ * warning when the archive ends. With `opt.strict`, each is an error.
11
+ */
12
+ export declare const extract: (options: WithAliases<ExtractOptions>, files?: string[]) => Promise<void>;
13
+ /** The sync form of `extract`. */
14
+ export declare const extractSync: (options: WithAliases<ExtractOptionsSync>, files?: string[]) => void;
3
15
  //# sourceMappingURL=extract.d.ts.map
@@ -1,49 +1,42 @@
1
- // tar -x
2
- import * as fsm from '@isaacs/fs-minipass';
3
- import fs from 'node:fs';
1
+ import { dealias } from './dealias.js';
4
2
  import { filesFilter } from './list.js';
5
- import { makeCommand } from './make-command.js';
3
+ import { readFile, readFileSync } from './read-file.js';
6
4
  import { Unpack, UnpackSync } from './unpack.js';
7
- const extractFileSync = (opt) => {
8
- const u = new UnpackSync(opt);
9
- const file = opt.file;
10
- const stat = fs.statSync(file);
11
- // This trades a zero-byte read() syscall for a stat
12
- // However, it will usually result in less memory allocation
13
- const readSize = opt.maxReadSize || 16 * 1024 * 1024;
14
- const stream = new fsm.ReadStreamSync(file, {
15
- readSize: readSize,
16
- size: stat.size,
17
- });
18
- stream.pipe(u);
5
+ const noInput = () => new TypeError('extract needs input or file');
6
+ /**
7
+ * Extract the entries of an archive into the directory `opt.cwd`.
8
+ * If `files` is set, only the entries that it lists, and the entries
9
+ * in the directories that it lists.
10
+ *
11
+ * A problem with one entry is a warning for `opt.onwarn`, and the
12
+ * extraction continues. A listed path that no entry matches is a
13
+ * warning when the archive ends. With `opt.strict`, each is an error.
14
+ */
15
+ export const extract = async (options, files) => {
16
+ const opt = dealias(options);
17
+ const source = opt.input ??
18
+ (opt.file ? readFile(opt.fs, opt.file, opt.maxReadSize) : undefined);
19
+ if (!source)
20
+ throw noInput();
21
+ const [filter, report] = files?.length ? filesFilter(files, opt.filter) : [];
22
+ if (filter)
23
+ opt.filter = filter;
24
+ await new Unpack(opt).extract(source);
25
+ report?.(opt);
19
26
  };
20
- const extractFile = (opt, _) => {
21
- const u = new Unpack(opt);
22
- const readSize = opt.maxReadSize || 16 * 1024 * 1024;
23
- const file = opt.file;
24
- const p = new Promise((resolve, reject) => {
25
- u.on('error', reject);
26
- u.on('close', resolve);
27
- // This trades a zero-byte read() syscall for a stat
28
- // However, it will usually result in less memory allocation
29
- fs.stat(file, (er, stat) => {
30
- if (er) {
31
- reject(er);
32
- }
33
- else {
34
- const stream = new fsm.ReadStream(file, {
35
- readSize: readSize,
36
- size: stat.size,
37
- });
38
- stream.on('error', reject);
39
- stream.pipe(u);
40
- }
41
- });
42
- });
43
- return p;
27
+ /** The sync form of `extract`. */
28
+ export const extractSync = (options, files) => {
29
+ const opt = dealias(options);
30
+ const source = opt.input ??
31
+ (opt.file ?
32
+ readFileSync(opt.fs, opt.file, opt.maxReadSize)
33
+ : undefined);
34
+ if (!source)
35
+ throw noInput();
36
+ const [filter, report] = files?.length ? filesFilter(files, opt.filter) : [];
37
+ if (filter)
38
+ opt.filter = filter;
39
+ new UnpackSync(opt).extract(source);
40
+ report?.(opt);
44
41
  };
45
- export const extract = makeCommand(extractFileSync, extractFile, opt => new UnpackSync(opt), opt => new Unpack(opt), (opt, files) => {
46
- if (files?.length)
47
- filesFilter(opt, files);
48
- });
49
42
  //# sourceMappingURL=extract.js.map