@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
@@ -1,7 +1,24 @@
1
- import type { TarOptions } from './options.js';
2
- import { Parser } from './parse.js';
3
- export declare const filesFilter: (opt: TarOptions, files: string[]) => void;
4
- export declare const list: import("./make-command.js").TarCommand<Parser, Parser & {
5
- sync: true;
6
- }>;
1
+ import { type WithAliases } from './dealias.js';
2
+ import type { ListOptions, ListOptionsSync } from './options.js';
3
+ import { type WarnOptions } from './warn.js';
4
+ /**
5
+ * Make a filter that passes the entries that `files` lists. An entry
6
+ * passes if `filter` accepts it, and it is in the list or one of its
7
+ * parent directories is. Trailing slashes are ignored.
8
+ *
9
+ * The second item of the result reports each listed path that no
10
+ * entry of the archive matched, as a `TAR_ENTRY_ERROR` warning. An
11
+ * entry that `filter` refuses also matches. Call it when the archive
12
+ * ends.
13
+ */
14
+ export declare const filesFilter: <E>(files: string[], filter?: (path: string, entry: E) => boolean) => [filter: (path: string, entry: E) => boolean, report: (opt: WarnOptions) => void];
15
+ /**
16
+ * Call `opt.onEntry` with each entry of an archive. If `files` is
17
+ * set, only with the entries that it lists, and the entries in the
18
+ * directories that it lists. A listed path that no entry matches is
19
+ * a warning when the archive ends.
20
+ */
21
+ export declare const list: (options: WithAliases<ListOptions>, files?: string[]) => Promise<void>;
22
+ /** The sync form of `list`. */
23
+ export declare const listSync: (options: WithAliases<ListOptionsSync>, files?: string[]) => void;
7
24
  //# sourceMappingURL=list.d.ts.map
@@ -1,153 +1,114 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.list = exports.filesFilter = void 0;
40
- // tar -t
41
- const fsm = __importStar(require("@isaacs/fs-minipass"));
42
- const node_fs_1 = __importDefault(require("node:fs"));
43
- const path_1 = require("path");
44
- const make_command_js_1 = require("./make-command.js");
45
- const parse_js_1 = require("./parse.js");
3
+ exports.listSync = exports.list = exports.filesFilter = void 0;
46
4
  const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js");
47
- const onReadEntryFunction = (opt) => {
48
- const onReadEntry = opt.onReadEntry;
49
- opt.onReadEntry =
50
- onReadEntry ?
51
- e => {
52
- onReadEntry(e);
53
- e.resume();
54
- }
55
- : e => e.resume();
56
- };
57
- // construct a filter that limits the file entries listed
58
- // include child entries if a dir is included
59
- const filesFilter = (opt, files) => {
60
- const map = new Map(files.map(f => [(0, strip_trailing_slashes_js_1.stripTrailingSlashes)(f), true]));
61
- const filter = opt.filter;
62
- // limit recursion to 100 levels
63
- const MAX = 100;
64
- const mapHas = (file, r = '', depth = 0) => {
65
- /* c8 ignore start - excessive caution */
66
- if (depth >= MAX) {
67
- map.set(file, false);
68
- return false;
5
+ const dealias_js_1 = require("./dealias.js");
6
+ const entries_js_1 = require("./entries.js");
7
+ const read_file_js_1 = require("./read-file.js");
8
+ const warn_js_1 = require("./warn.js");
9
+ /**
10
+ * Make a filter that passes the entries that `files` lists. An entry
11
+ * passes if `filter` accepts it, and it is in the list or one of its
12
+ * parent directories is. Trailing slashes are ignored.
13
+ *
14
+ * The second item of the result reports each listed path that no
15
+ * entry of the archive matched, as a `TAR_ENTRY_ERROR` warning. An
16
+ * entry that `filter` refuses also matches. Call it when the archive
17
+ * ends.
18
+ */
19
+ const filesFilter = (files, filter) => {
20
+ const set = new Set(files.map(f => (0, strip_trailing_slashes_js_1.stripTrailingSlashes)(f)));
21
+ // The listed paths that no entry matched yet.
22
+ const missing = new Set(set);
23
+ let max = 0;
24
+ for (const f of set)
25
+ max = Math.max(max, f.length);
26
+ const listed = (path) => {
27
+ const p = (0, strip_trailing_slashes_js_1.stripTrailingSlashes)(path);
28
+ const root = p.charAt(0) === '/' ? '/' : '.';
29
+ let found = false;
30
+ // Look at the path, and then at each parent directory. One that
31
+ // is longer than each listed path is not looked up, so the work
32
+ // for a very long path stays small.
33
+ for (let end = p.length; end > 0; end = p.lastIndexOf('/', end - 1)) {
34
+ if (end > max)
35
+ continue;
36
+ const dir = p.slice(0, end);
37
+ if (dir === root || !set.has(dir))
38
+ continue;
39
+ found = true;
40
+ missing.delete(dir);
41
+ // A parent directory can also be in the list.
42
+ if (!missing.size)
43
+ break;
69
44
  }
70
- /* c8 ignore stop */
71
- const root = r || (0, path_1.parse)(file).root || '.';
72
- let ret;
73
- if (file === root)
74
- ret = false;
75
- else {
76
- const m = map.get(file);
77
- ret = m !== undefined ? m : mapHas((0, path_1.dirname)(file), root, depth + 1);
78
- }
79
- map.set(file, ret);
80
- return ret;
45
+ return found;
81
46
  };
82
- opt.filter =
83
- filter ?
84
- (file, entry) => filter(file, entry) && mapHas((0, strip_trailing_slashes_js_1.stripTrailingSlashes)(file))
85
- : file => mapHas((0, strip_trailing_slashes_js_1.stripTrailingSlashes)(file));
47
+ return [
48
+ (path, entry) => {
49
+ // The filter of the caller gets each entry.
50
+ const ok = !filter || filter(path, entry);
51
+ return listed(path) && ok;
52
+ },
53
+ opt => {
54
+ for (const path of missing) {
55
+ (0, warn_js_1.warn)(opt, 'TAR_ENTRY_ERROR', `${path}: not found in archive`, {
56
+ path,
57
+ });
58
+ }
59
+ },
60
+ ];
86
61
  };
87
62
  exports.filesFilter = filesFilter;
88
- const listFileSync = (opt) => {
89
- const p = new parse_js_1.Parser(opt);
90
- const file = opt.file;
91
- let fd;
63
+ const noInput = () => new TypeError('list needs input, or file and fs');
64
+ /**
65
+ * Call `opt.onEntry` with each entry of an archive. If `files` is
66
+ * set, only with the entries that it lists, and the entries in the
67
+ * directories that it lists. A listed path that no entry matches is
68
+ * a warning when the archive ends.
69
+ */
70
+ const list = async (options, files) => {
71
+ const opt = (0, dealias_js_1.dealias)(options);
72
+ const { input, file, fs, onEntry } = opt;
73
+ const source = input ?? (file && fs ? (0, read_file_js_1.readFile)(fs, file, opt.maxReadSize) : undefined);
74
+ if (!source)
75
+ throw noInput();
76
+ const [filter, report] = files?.length ? (0, exports.filesFilter)(files, opt.filter) : [];
77
+ if (filter)
78
+ opt.filter = filter;
79
+ const reader = new entries_js_1.TarReader(source, opt);
92
80
  try {
93
- fd = node_fs_1.default.openSync(file, 'r');
94
- const stat = node_fs_1.default.fstatSync(fd);
95
- const readSize = opt.maxReadSize || 16 * 1024 * 1024;
96
- if (stat.size < readSize) {
97
- const buf = Buffer.allocUnsafe(stat.size);
98
- const read = node_fs_1.default.readSync(fd, buf, 0, stat.size, 0);
99
- p.end(read === buf.byteLength ? buf : buf.subarray(0, read));
100
- }
101
- else {
102
- let pos = 0;
103
- const buf = Buffer.allocUnsafe(readSize);
104
- while (pos < stat.size) {
105
- const bytesRead = node_fs_1.default.readSync(fd, buf, 0, readSize, pos);
106
- if (bytesRead === 0)
107
- break;
108
- pos += bytesRead;
109
- p.write(buf.subarray(0, bytesRead));
110
- }
111
- p.end();
81
+ for (;;) {
82
+ const entry = reader.poll();
83
+ if (entry === null)
84
+ break;
85
+ if (entry === undefined)
86
+ await reader.fill();
87
+ else if (onEntry)
88
+ await onEntry(entry);
112
89
  }
113
90
  }
114
91
  finally {
115
- if (typeof fd === 'number') {
116
- try {
117
- node_fs_1.default.closeSync(fd);
118
- /* c8 ignore next */
119
- }
120
- catch { }
121
- }
92
+ await reader.return();
122
93
  }
94
+ report?.(opt);
123
95
  };
124
- const listFile = (opt, _files) => {
125
- const parse = new parse_js_1.Parser(opt);
126
- const readSize = opt.maxReadSize || 16 * 1024 * 1024;
127
- const file = opt.file;
128
- const p = new Promise((resolve, reject) => {
129
- parse.on('error', reject);
130
- parse.on('end', resolve);
131
- node_fs_1.default.stat(file, (er, stat) => {
132
- if (er) {
133
- reject(er);
134
- }
135
- else {
136
- const stream = new fsm.ReadStream(file, {
137
- readSize: readSize,
138
- size: stat.size,
139
- });
140
- stream.on('error', reject);
141
- stream.pipe(parse);
142
- }
143
- });
144
- });
145
- return p;
96
+ exports.list = list;
97
+ /** The sync form of `list`. */
98
+ const listSync = (options, files) => {
99
+ const opt = (0, dealias_js_1.dealias)(options);
100
+ const { input, file, fs, onEntry } = opt;
101
+ const source = input ??
102
+ (file && fs ? (0, read_file_js_1.readFileSync)(fs, file, opt.maxReadSize) : undefined);
103
+ if (!source)
104
+ throw noInput();
105
+ const [filter, report] = files?.length ? (0, exports.filesFilter)(files, opt.filter) : [];
106
+ if (filter)
107
+ opt.filter = filter;
108
+ const reader = new entries_js_1.TarReaderSync(source, opt);
109
+ for (const entry of reader)
110
+ onEntry?.(entry);
111
+ report?.(opt);
146
112
  };
147
- exports.list = (0, make_command_js_1.makeCommand)(listFileSync, listFile, opt => new parse_js_1.Parser(opt), opt => new parse_js_1.Parser(opt), (opt, files) => {
148
- if (files?.length)
149
- (0, exports.filesFilter)(opt, files);
150
- if (!opt.noResume)
151
- onReadEntryFunction(opt);
152
- });
113
+ exports.listSync = listSync;
153
114
  //# sourceMappingURL=list.js.map
@@ -1,25 +1,30 @@
1
- import { CwdError } from './cwd-error.js';
2
- import { SymlinkError } from './symlink-error.js';
1
+ import type { ExtractFS, ExtractFSSync } from './fs.js';
2
+ /** The options of `mkdir`. Each path has `/` separators. */
3
3
  export type MkdirOptions = {
4
+ /** The owner of each directory that is made, if it has `gid` also. */
4
5
  uid?: number;
5
6
  gid?: number;
6
7
  processUid?: number;
7
8
  processGid?: number;
8
- umask?: number;
9
+ /** If the mode has a bit of this mask, `chmod` sets the mode. */
10
+ umask: number;
11
+ /** Permit a symbolic link in the path. */
9
12
  preserve: boolean;
13
+ /** Remove an object in the path that is not a directory. */
10
14
  unlink: boolean;
15
+ /** The absolute path of the extraction directory. */
11
16
  cwd: string;
12
17
  mode: number;
13
18
  };
14
- export type MkdirError = NodeJS.ErrnoException | CwdError | SymlinkError;
15
19
  /**
16
- * Wrapper around fs/promises.mkdir for tar's needs.
20
+ * Make the directory `dir` and its parents, below `opt.cwd`.
17
21
  *
18
- * The main purpose is to avoid creating directories if we know that
19
- * they already exist (and track which ones exist for this purpose),
20
- * and prevent entries from being extracted into symlinked folders,
21
- * if `preservePaths` is not set.
22
+ * If `opt.preserve` is not set, a symbolic link in the path is an
23
+ * error, so that no entry is extracted through a link. The
24
+ * extraction directory itself is never made: it must be a directory,
25
+ * or the error is a `CwdError`.
22
26
  */
23
- export declare const mkdir: (dir: string, opt: MkdirOptions, cb: (er?: null | MkdirError, made?: string) => void) => void | Promise<void>;
24
- export declare const mkdirSync: (dir: string, opt: MkdirOptions) => void | SymlinkError;
27
+ export declare const mkdir: (fs: ExtractFS, dir: string, opt: MkdirOptions) => Promise<void>;
28
+ /** The sync form of `mkdir`. */
29
+ export declare const mkdirSync: (fs: ExtractFSSync, dir: string, opt: MkdirOptions) => void;
25
30
  //# sourceMappingURL=mkdir.d.ts.map
@@ -1,187 +1,149 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.mkdirSync = exports.mkdir = void 0;
7
- const chownr_1 = require("chownr");
8
- const node_fs_1 = __importDefault(require("node:fs"));
9
- const promises_1 = __importDefault(require("node:fs/promises"));
10
- const node_path_1 = __importDefault(require("node:path"));
11
4
  const cwd_error_js_1 = require("./cwd-error.js");
12
- const normalize_windows_path_js_1 = require("./normalize-windows-path.js");
13
5
  const symlink_error_js_1 = require("./symlink-error.js");
14
- const checkCwd = (dir, cb) => {
15
- node_fs_1.default.stat(dir, (er, st) => {
16
- if (er || !st.isDirectory()) {
17
- er = new cwd_error_js_1.CwdError(dir, er?.code || 'ENOTDIR');
18
- }
19
- cb(er);
20
- });
6
+ const path_js_1 = require("./path.js");
7
+ // The parts of the mkdir options that do not need the file system.
8
+ const plan = (opt) => {
9
+ const mode = opt.mode | 0o700;
10
+ const { uid, gid } = opt;
11
+ return {
12
+ mode,
13
+ // The umask removes bits when the system makes the directory.
14
+ needChmod: (mode & opt.umask) !== 0,
15
+ owner: (typeof uid === 'number' &&
16
+ typeof gid === 'number' &&
17
+ (uid !== opt.processUid || gid !== opt.processGid)) ?
18
+ { uid, gid }
19
+ : undefined,
20
+ };
21
+ };
22
+ const child = (dir, name) => dir.endsWith('/') ? dir + name : dir + '/' + name;
23
+ // The directories that a recursive mkdir made: `dir`, and its parents
24
+ // up to `first`, the one that was made first. On Windows, Node.js
25
+ // gives `first` with `\` separators, after the prefix `\\?\`. So
26
+ // `first` is the parent that it ends with. If it ends with none of
27
+ // them, only `dir` is known.
28
+ const chain = (first, dir) => {
29
+ const end = first.replaceAll('\\', '/');
30
+ const made = [dir];
31
+ for (let i = dir.length; !end.endsWith(dir.slice(0, i));) {
32
+ i = dir.lastIndexOf('/', i - 1);
33
+ if (i <= 0)
34
+ return [dir];
35
+ made.push(dir.slice(0, i));
36
+ }
37
+ return made;
21
38
  };
22
39
  /**
23
- * Wrapper around fs/promises.mkdir for tar's needs.
40
+ * Make the directory `dir` and its parents, below `opt.cwd`.
24
41
  *
25
- * The main purpose is to avoid creating directories if we know that
26
- * they already exist (and track which ones exist for this purpose),
27
- * and prevent entries from being extracted into symlinked folders,
28
- * if `preservePaths` is not set.
42
+ * If `opt.preserve` is not set, a symbolic link in the path is an
43
+ * error, so that no entry is extracted through a link. The
44
+ * extraction directory itself is never made: it must be a directory,
45
+ * or the error is a `CwdError`.
29
46
  */
30
- const mkdir = (dir, opt, cb) => {
31
- dir = (0, normalize_windows_path_js_1.normalizeWindowsPath)(dir);
32
- // if there's any overlap between mask and mode,
33
- // then we'll need an explicit chmod
34
- /* c8 ignore next */
35
- const umask = opt.umask ?? 0o22;
36
- const mode = opt.mode | 0o0700;
37
- const needChmod = (mode & umask) !== 0;
38
- const uid = opt.uid;
39
- const gid = opt.gid;
40
- const doChown = typeof uid === 'number' &&
41
- typeof gid === 'number' &&
42
- (uid !== opt.processUid || gid !== opt.processGid);
43
- const preserve = opt.preserve;
44
- const unlink = opt.unlink;
45
- const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd);
46
- const done = (er, created) => {
47
- if (er) {
48
- cb(er);
49
- }
50
- else {
51
- if (created && doChown) {
52
- (0, chownr_1.chownr)(created, uid, gid, er => done(er));
53
- }
54
- else if (needChmod) {
55
- node_fs_1.default.chmod(dir, mode, cb);
56
- }
57
- else {
58
- cb();
59
- }
60
- }
61
- };
47
+ const mkdir = async (fs, dir, opt) => {
48
+ const { mode, needChmod, owner } = plan(opt);
49
+ const { cwd } = opt;
50
+ let made = [];
62
51
  if (dir === cwd) {
63
- return checkCwd(dir, done);
64
- }
65
- if (preserve) {
66
- return promises_1.default.mkdir(dir, { mode, recursive: true }).then(made => done(null, made ?? undefined), // oh, ts
67
- done);
52
+ let code = 'ENOTDIR';
53
+ const ok = await fs.stat(dir).then(st => st.isDirectory(), (er) => {
54
+ code = er?.code || code;
55
+ return false;
56
+ });
57
+ if (!ok)
58
+ throw new cwd_error_js_1.CwdError(dir, code);
68
59
  }
69
- const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir));
70
- const parts = sub.split('/');
71
- mkdir_(cwd, parts, mode, unlink, cwd, undefined, done);
72
- };
73
- exports.mkdir = mkdir;
74
- const mkdir_ = (base, parts, mode, unlink, cwd, created, cb) => {
75
- if (parts.length === 0) {
76
- return cb(null, created);
60
+ else if (opt.preserve) {
61
+ const first = await fs.mkdir(dir, { mode, recursive: true });
62
+ if (first)
63
+ made = chain(first, dir);
77
64
  }
78
- const p = parts.shift();
79
- const part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(base + '/' + p));
80
- node_fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb));
81
- };
82
- const onmkdir = (part, parts, mode, unlink, cwd, created, cb) => (er) => {
83
- if (er) {
84
- node_fs_1.default.lstat(part, (statEr, st) => {
85
- if (statEr) {
86
- statEr.path = statEr.path && (0, normalize_windows_path_js_1.normalizeWindowsPath)(statEr.path);
87
- cb(statEr);
88
- }
89
- else if (st.isDirectory()) {
90
- mkdir_(part, parts, mode, unlink, cwd, created, cb);
91
- }
92
- else if (unlink) {
93
- node_fs_1.default.unlink(part, er => {
94
- if (er) {
95
- return cb(er);
96
- }
97
- node_fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb));
98
- });
99
- }
100
- else if (st.isSymbolicLink()) {
101
- return cb(new symlink_error_js_1.SymlinkError(part, part + '/' + parts.join('/')));
65
+ else {
66
+ const parts = (0, path_js_1.relative)(cwd, dir).split('/');
67
+ let part = cwd;
68
+ for (let i = 0; i < parts.length; i++) {
69
+ part = child(part, parts[i]);
70
+ try {
71
+ await fs.mkdir(part, { mode });
102
72
  }
103
- else {
104
- cb(er);
73
+ catch (er) {
74
+ const st = await fs.lstat(part);
75
+ if (st.isDirectory())
76
+ continue;
77
+ if (!opt.unlink) {
78
+ throw st.isSymbolicLink() ?
79
+ new symlink_error_js_1.SymlinkError(part, part + '/' + parts.slice(i + 1).join('/'))
80
+ : er;
81
+ }
82
+ await fs.unlink(part);
83
+ await fs.mkdir(part, { mode });
105
84
  }
106
- });
107
- }
108
- else {
109
- created = created || part;
110
- mkdir_(part, parts, mode, unlink, cwd, created, cb);
111
- }
112
- };
113
- const checkCwdSync = (dir) => {
114
- let ok = false;
115
- let code;
116
- try {
117
- ok = node_fs_1.default.statSync(dir).isDirectory();
118
- }
119
- catch (er) {
120
- code = er?.code;
121
- }
122
- finally {
123
- if (!ok) {
124
- throw new cwd_error_js_1.CwdError(dir, code ?? 'ENOTDIR');
85
+ made.push(part);
125
86
  }
126
87
  }
88
+ if (owner) {
89
+ for (const d of made)
90
+ await fs.lchown(d, owner.uid, owner.gid);
91
+ }
92
+ if (needChmod)
93
+ await fs.chmod(dir, mode);
127
94
  };
128
- const mkdirSync = (dir, opt) => {
129
- dir = (0, normalize_windows_path_js_1.normalizeWindowsPath)(dir);
130
- // if there's any overlap between mask and mode,
131
- // then we'll need an explicit chmod
132
- /* c8 ignore next */
133
- const umask = opt.umask ?? 0o22;
134
- const mode = opt.mode | 0o700;
135
- const needChmod = (mode & umask) !== 0;
136
- const uid = opt.uid;
137
- const gid = opt.gid;
138
- const doChown = typeof uid === 'number' &&
139
- typeof gid === 'number' &&
140
- (uid !== opt.processUid || gid !== opt.processGid);
141
- const preserve = opt.preserve;
142
- const unlink = opt.unlink;
143
- const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd);
144
- const done = (created) => {
145
- if (created && doChown) {
146
- (0, chownr_1.chownrSync)(created, uid, gid);
95
+ exports.mkdir = mkdir;
96
+ /** The sync form of `mkdir`. */
97
+ const mkdirSync = (fs, dir, opt) => {
98
+ const { mode, needChmod, owner } = plan(opt);
99
+ const { cwd } = opt;
100
+ let made = [];
101
+ if (dir === cwd) {
102
+ let code = 'ENOTDIR';
103
+ let ok = false;
104
+ try {
105
+ ok = fs.statSync(dir).isDirectory();
147
106
  }
148
- if (needChmod) {
149
- node_fs_1.default.chmodSync(dir, mode);
107
+ catch (er) {
108
+ code = er?.code || code;
150
109
  }
151
- };
152
- if (dir === cwd) {
153
- checkCwdSync(cwd);
154
- return done();
110
+ if (!ok)
111
+ throw new cwd_error_js_1.CwdError(dir, code);
155
112
  }
156
- if (preserve) {
157
- return done(node_fs_1.default.mkdirSync(dir, { mode, recursive: true }) ?? undefined);
113
+ else if (opt.preserve) {
114
+ const first = fs.mkdirSync(dir, { mode, recursive: true });
115
+ if (first)
116
+ made = chain(first, dir);
158
117
  }
159
- const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir));
160
- const parts = sub.split('/');
161
- let created;
162
- for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) {
163
- part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(part));
164
- try {
165
- node_fs_1.default.mkdirSync(part, mode);
166
- created = created || part;
167
- }
168
- catch {
169
- const st = node_fs_1.default.lstatSync(part);
170
- if (st.isDirectory()) {
171
- continue;
172
- }
173
- else if (unlink) {
174
- node_fs_1.default.unlinkSync(part);
175
- node_fs_1.default.mkdirSync(part, mode);
176
- created = created || part;
177
- continue;
118
+ else {
119
+ const parts = (0, path_js_1.relative)(cwd, dir).split('/');
120
+ let part = cwd;
121
+ for (let i = 0; i < parts.length; i++) {
122
+ part = child(part, parts[i]);
123
+ try {
124
+ fs.mkdirSync(part, { mode });
178
125
  }
179
- else if (st.isSymbolicLink()) {
180
- return new symlink_error_js_1.SymlinkError(part, part + '/' + parts.join('/'));
126
+ catch (er) {
127
+ const st = fs.lstatSync(part);
128
+ if (st.isDirectory())
129
+ continue;
130
+ if (!opt.unlink) {
131
+ throw st.isSymbolicLink() ?
132
+ new symlink_error_js_1.SymlinkError(part, part + '/' + parts.slice(i + 1).join('/'))
133
+ : er;
134
+ }
135
+ fs.unlinkSync(part);
136
+ fs.mkdirSync(part, { mode });
181
137
  }
138
+ made.push(part);
182
139
  }
183
140
  }
184
- return done(created);
141
+ if (owner) {
142
+ for (const d of made)
143
+ fs.lchownSync(d, owner.uid, owner.gid);
144
+ }
145
+ if (needChmod)
146
+ fs.chmodSync(dir, mode);
185
147
  };
186
148
  exports.mkdirSync = mkdirSync;
187
149
  //# sourceMappingURL=mkdir.js.map
@@ -9,7 +9,16 @@ const normalizeCache = Object.create(null);
9
9
  // Limit the size of this. Very low-sophistication LRU cache
10
10
  const MAX = 10000;
11
11
  const cache = new Set();
12
+ // A longer string is not cached. Long paths do not repeat, and the
13
+ // cache would keep them for the life of the process.
14
+ const MAX_LENGTH = 256;
12
15
  const normalizeUnicode = (s) => {
16
+ if (s.length > MAX_LENGTH) {
17
+ return s
18
+ .normalize('NFD')
19
+ .toLocaleLowerCase('en')
20
+ .toLocaleUpperCase('en');
21
+ }
13
22
  if (!cache.has(s)) {
14
23
  // shake out identical accents and ligatures
15
24
  normalizeCache[s] = s