@unbrained/pm-cli 2026.12.1 → 2026.12.3

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 (376) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/commander-usage.js +4 -4
  3. package/dist/cli/expected-revisions.js +1 -1
  4. package/dist/cli/extension-command-help.js +4 -4
  5. package/dist/cli/main.js +5 -5
  6. package/dist/cli/runtime/invocation-rewrites.js +1 -1
  7. package/dist/cli/runtime-field-commands.js +2 -0
  8. package/dist/cli-bundle/bundle-manifest.json +1 -1
  9. package/dist/cli-bundle/chunks/chunk-3ESBFEQC.js +2 -0
  10. package/dist/cli-bundle/chunks/chunk-46AZP5QW.js +2 -0
  11. package/dist/cli-bundle/chunks/{chunk-OBPO6V7H.js → chunk-5WTBF4M4.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-3KEMIPKG.js → chunk-6TOZQ5BQ.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-4YYFY33T.js → chunk-AHVOEE7F.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-CQHB3ZZH.js +2 -0
  15. package/dist/cli-bundle/chunks/chunk-DZPOS3YT.js +2 -0
  16. package/dist/cli-bundle/chunks/{chunk-OKEJ4U2I.js → chunk-E5ADC3HT.js} +65 -65
  17. package/dist/cli-bundle/chunks/{chunk-SY5C3U32.js → chunk-E5HO7HWP.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-3HKPVOAN.js → chunk-EDJ3KR2H.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-XME6GIFQ.js → chunk-FWQNWPIV.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-CWPR234D.js → chunk-H4U3LEOD.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-MZZ4ZJ5Z.js → chunk-HNMED75Y.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-U7RBJGLF.js → chunk-HPCMM74Q.js} +22 -22
  23. package/dist/cli-bundle/chunks/{chunk-WSEIEDEK.js → chunk-ITM4AMVM.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-Q6K7HWZ7.js → chunk-IW4A3I4N.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-4YQMQOUO.js → chunk-JJ73G5UT.js} +52 -52
  26. package/dist/cli-bundle/chunks/chunk-L4HMFRHB.js +2 -0
  27. package/dist/cli-bundle/chunks/{chunk-YSVOXCYH.js → chunk-LTQWPQ7H.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-Q6GLSAJY.js → chunk-MRT3ADO4.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-ZL6J6JYT.js → chunk-PBMLIV74.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-NA6D75V5.js → chunk-PJMGWJKU.js} +2 -2
  31. package/dist/cli-bundle/chunks/chunk-Q2HMDV56.js +9 -0
  32. package/dist/cli-bundle/chunks/{chunk-OXC5KBIQ.js → chunk-RRBNCL63.js} +2 -2
  33. package/dist/cli-bundle/chunks/{chunk-CBUC4X7Q.js → chunk-TDOF7BKO.js} +3 -3
  34. package/dist/cli-bundle/chunks/chunk-UXEZXGAD.js +113 -0
  35. package/dist/cli-bundle/chunks/{chunk-PCDTWL6V.js → chunk-W7HA65EO.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-I4SPJQQI.js → chunk-XGNUDSCG.js} +3 -3
  37. package/dist/cli-bundle/chunks/{chunk-AHV3CSQG.js → chunk-XKJ5NWQ7.js} +2 -2
  38. package/dist/cli-bundle/chunks/{field-option-collisions-BBGTV7AD.js → field-option-collisions-DXKTKW6J.js} +2 -2
  39. package/dist/cli-bundle/chunks/item-revision-DXEF4XBU.js +2 -0
  40. package/dist/cli-bundle/chunks/item-transaction-EANA7V4W.js +2 -0
  41. package/dist/cli-bundle/chunks/{linked-resource-value-list-E2DX52LY.js → linked-resource-value-list-5JRGUDUB.js} +2 -2
  42. package/dist/cli-bundle/chunks/{mutation-actor-NHN33ITJ.js → mutation-actor-S5G7FMNG.js} +2 -2
  43. package/dist/cli-bundle/chunks/{mutation-admission-PGKJTCG6.js → mutation-admission-HQVNPOXV.js} +2 -2
  44. package/dist/cli-bundle/chunks/{register-list-query-7S5QWDTI.js → register-list-query-SQF5PSJ4.js} +2 -2
  45. package/dist/cli-bundle/chunks/{register-mutation-2F6JUBST.js → register-mutation-4AQ4CEBL.js} +2 -2
  46. package/dist/cli-bundle/chunks/{register-operations-ET3UKPYK.js → register-operations-76P7OM4P.js} +2 -2
  47. package/dist/cli-bundle/chunks/{register-setup-I63QTFCU.js → register-setup-T6OEOZK3.js} +2 -2
  48. package/dist/cli-bundle/chunks/{stage-4ZCF74G4.js → stage-KUICZHSF.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-4SCFAWAW.js → chunk-3LHBKFPD.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/chunk-4DDXERKN.js +2 -0
  51. package/dist/cli-bundle/focused-chunks/{chunk-JPZGC3W4.js → chunk-4YU75CWI.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{chunk-TXTPAFHJ.js → chunk-5JQVPQMN.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{chunk-KNBGHCIP.js → chunk-5Z4DXYBZ.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/chunk-7DOP5HEZ.js +44 -0
  55. package/dist/cli-bundle/focused-chunks/{chunk-TR22GU7M.js → chunk-AX4RBJ7B.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-7A6SEZEY.js → chunk-BEHQCHQV.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/chunk-BUIF6CMZ.js +2 -0
  58. package/dist/cli-bundle/focused-chunks/chunk-E2IWEJL5.js +3 -0
  59. package/dist/cli-bundle/focused-chunks/chunk-GBU7GKNJ.js +2 -0
  60. package/dist/cli-bundle/focused-chunks/{chunk-EQCQTYKO.js → chunk-K35KTBDZ.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{chunk-VQIC3UZB.js → chunk-KNST4PGF.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{chunk-P2H3GTJK.js → chunk-L2XJB5PK.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/chunk-L6NOGC4N.js +100 -0
  64. package/dist/cli-bundle/focused-chunks/{chunk-VK3IE3TS.js → chunk-LWIIDPAV.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{chunk-6IY5CVGJ.js → chunk-M54BMYG4.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/{chunk-6BKT6XQN.js → chunk-NEK7RX3N.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/{chunk-BHNBPCHP.js → chunk-OKGWIW6C.js} +2 -2
  68. package/dist/cli-bundle/focused-chunks/{chunk-2DGKVXFT.js → chunk-RFDSSOTZ.js} +2 -2
  69. package/dist/cli-bundle/focused-chunks/chunk-SSX5YBDC.js +2 -0
  70. package/dist/cli-bundle/focused-chunks/{chunk-OG57ESZK.js → chunk-TIEQVIFN.js} +2 -2
  71. package/dist/cli-bundle/focused-chunks/{chunk-SQ72CVUH.js → chunk-VEUBDQDP.js} +54 -54
  72. package/dist/cli-bundle/focused-chunks/{chunk-2UWKU2BQ.js → chunk-WDHNPNHX.js} +3 -3
  73. package/dist/cli-bundle/focused-chunks/{field-option-collisions-2C6DLUC4.js → field-option-collisions-32X7FP3H.js} +2 -2
  74. package/dist/cli-bundle/focused-chunks/item-revision-GUYSVVQD.js +2 -0
  75. package/dist/cli-bundle/focused-chunks/{item-transaction-2K4SFLJ7.js → item-transaction-MLKHZPL7.js} +2 -2
  76. package/dist/cli-bundle/focused-chunks/{mutation-actor-DJMZUIZI.js → mutation-actor-RDZJTRW2.js} +2 -2
  77. package/dist/cli-bundle/focused-chunks/{mutation-admission-SDWQVVHN.js → mutation-admission-IQB6XL75.js} +2 -2
  78. package/dist/cli-bundle/focused-chunks/{stage-QBZIK3T5.js → stage-AA7LORZ2.js} +2 -2
  79. package/dist/cli-bundle/main.js +27 -27
  80. package/dist/cli-bundle/sdk-authoring.js +1 -1
  81. package/dist/cli-bundle/sdk-contracts.js +1 -1
  82. package/dist/cli-bundle/sdk-core.js +1 -1
  83. package/dist/cli-bundle/sdk-governance.js +1 -1
  84. package/dist/cli-bundle/sdk-graph.js +1 -1
  85. package/dist/cli-bundle/sdk-merge.js +63 -63
  86. package/dist/cli-bundle/sdk-query.js +1 -1
  87. package/dist/cli-bundle/sdk-runtime.js +1 -1
  88. package/dist/cli-bundle/sdk-testing.js +1 -1
  89. package/dist/cli-bundle/sdk.js +9 -9
  90. package/dist/core/extensions/loader.d.ts +8 -0
  91. package/dist/core/extensions/loader.js +1 -1
  92. package/dist/core/item/actionability.js +1 -1
  93. package/dist/core/output/output.js +16 -16
  94. package/dist/mcp/server.js +1 -1
  95. package/dist/sdk/cli-contracts/enum-contracts.d.ts +25 -1
  96. package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
  97. package/dist/sdk/cli-contracts/flag-contracts.d.ts +1 -1
  98. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  99. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  100. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  101. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  102. package/dist/sdk/context-intent-contracts.js +1 -1
  103. package/dist/sdk/extension/install-sources.d.ts +2 -2
  104. package/dist/sdk/extension/install-sources.js +5 -5
  105. package/dist/sdk/lifecycle/expect-hash-admission.d.ts +27 -8
  106. package/dist/sdk/lifecycle/expect-hash-admission.js +1 -1
  107. package/dist/sdk/lifecycle/item-revision.d.ts +12 -4
  108. package/dist/sdk/lifecycle/item-revision.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/read-output/surfaces.js +1 -1
  113. package/dist/sdk/runtime/schema.js +1 -1
  114. package/dist/sdk/runtime-input.d.ts +6 -0
  115. package/dist/sdk/runtime-input.js +1 -1
  116. package/dist/sdk/runtime-primitives.d.ts +1 -1
  117. package/dist/sdk/runtime-primitives.js +1 -1
  118. package/dist/sdk/runtime.js +1 -1
  119. package/docs/COMMANDS.md +23 -5
  120. package/docs/EXTENSIONS.md +1 -1
  121. package/docs/SDK.md +15 -2
  122. package/marketplace.json +1 -1
  123. package/node_modules/tar/README.md +1792 -1147
  124. package/node_modules/tar/dist/commonjs/bytes.d.ts +21 -0
  125. package/node_modules/tar/dist/commonjs/bytes.js +83 -0
  126. package/node_modules/tar/dist/commonjs/codec.d.ts +53 -0
  127. package/node_modules/tar/dist/commonjs/codec.js +35 -0
  128. package/node_modules/tar/dist/commonjs/concat.d.ts +3 -0
  129. package/node_modules/tar/dist/commonjs/concat.js +20 -0
  130. package/node_modules/tar/dist/commonjs/create.d.ts +39 -2
  131. package/node_modules/tar/dist/commonjs/create.js +150 -64
  132. package/node_modules/tar/dist/commonjs/dealias.d.ts +79 -0
  133. package/node_modules/tar/dist/commonjs/dealias.js +50 -0
  134. package/node_modules/tar/dist/commonjs/delete.d.ts +19 -0
  135. package/node_modules/tar/dist/commonjs/delete.js +121 -0
  136. package/node_modules/tar/dist/commonjs/entries.d.ts +82 -0
  137. package/node_modules/tar/dist/commonjs/entries.js +398 -0
  138. package/node_modules/tar/dist/commonjs/extract.d.ts +14 -2
  139. package/node_modules/tar/dist/commonjs/extract.js +40 -81
  140. package/node_modules/tar/dist/commonjs/fs.d.ts +201 -0
  141. package/node_modules/tar/dist/commonjs/fs.js +5 -0
  142. package/node_modules/tar/dist/commonjs/header.d.ts +4 -4
  143. package/node_modules/tar/dist/commonjs/header.js +71 -53
  144. package/node_modules/tar/dist/commonjs/index.d.ts +25 -18
  145. package/node_modules/tar/dist/commonjs/index.js +46 -18
  146. package/node_modules/tar/dist/commonjs/index.min.js +2 -3
  147. package/node_modules/tar/dist/commonjs/large-numbers.d.ts +2 -2
  148. package/node_modules/tar/dist/commonjs/large-numbers.js +4 -4
  149. package/node_modules/tar/dist/commonjs/list.d.ts +23 -6
  150. package/node_modules/tar/dist/commonjs/list.js +99 -138
  151. package/node_modules/tar/dist/commonjs/mkdir.d.ts +16 -11
  152. package/node_modules/tar/dist/commonjs/mkdir.js +121 -159
  153. package/node_modules/tar/dist/commonjs/normalize-unicode.js +9 -0
  154. package/node_modules/tar/dist/commonjs/options.d.ts +284 -513
  155. package/node_modules/tar/dist/commonjs/options.js +20 -61
  156. package/node_modules/tar/dist/commonjs/pack.d.ts +150 -96
  157. package/node_modules/tar/dist/commonjs/pack.js +752 -445
  158. package/node_modules/tar/dist/commonjs/parser.d.ts +98 -0
  159. package/node_modules/tar/dist/commonjs/parser.js +452 -0
  160. package/node_modules/tar/dist/commonjs/path-reservations.d.ts +17 -7
  161. package/node_modules/tar/dist/commonjs/path-reservations.js +110 -140
  162. package/node_modules/tar/dist/commonjs/path.d.ts +19 -0
  163. package/node_modules/tar/dist/commonjs/path.js +90 -0
  164. package/node_modules/tar/dist/commonjs/pax.d.ts +3 -1
  165. package/node_modules/tar/dist/commonjs/pax.js +67 -36
  166. package/node_modules/tar/dist/commonjs/read-entry.d.ts +97 -11
  167. package/node_modules/tar/dist/commonjs/read-entry.js +251 -97
  168. package/node_modules/tar/dist/commonjs/read-file.d.ts +22 -0
  169. package/node_modules/tar/dist/commonjs/read-file.js +104 -0
  170. package/node_modules/tar/dist/commonjs/replace.d.ts +45 -1
  171. package/node_modules/tar/dist/commonjs/replace.js +164 -211
  172. package/node_modules/tar/dist/commonjs/server/codecs.d.ts +38 -0
  173. package/node_modules/tar/dist/commonjs/server/codecs.js +252 -0
  174. package/node_modules/tar/dist/commonjs/server/index.d.ts +115 -0
  175. package/node_modules/tar/dist/commonjs/server/index.js +166 -0
  176. package/node_modules/tar/dist/commonjs/server/index.min.js +3 -0
  177. package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +8 -0
  178. package/node_modules/tar/dist/commonjs/strip-absolute-path.js +17 -20
  179. package/node_modules/tar/dist/commonjs/to-stream.d.ts +7 -0
  180. package/node_modules/tar/dist/commonjs/to-stream.js +22 -0
  181. package/node_modules/tar/dist/commonjs/types.d.ts +4 -3
  182. package/node_modules/tar/dist/commonjs/types.js +4 -3
  183. package/node_modules/tar/dist/commonjs/unpack.d.ts +143 -89
  184. package/node_modules/tar/dist/commonjs/unpack.js +780 -725
  185. package/node_modules/tar/dist/commonjs/update.d.ts +11 -1
  186. package/node_modules/tar/dist/commonjs/update.js +37 -28
  187. package/node_modules/tar/dist/commonjs/warn.d.ts +27 -0
  188. package/node_modules/tar/dist/commonjs/warn.js +36 -0
  189. package/node_modules/tar/dist/commonjs/win32-path.d.ts +16 -0
  190. package/node_modules/tar/dist/commonjs/win32-path.js +67 -0
  191. package/node_modules/tar/dist/commonjs/write-entry.d.ts +64 -111
  192. package/node_modules/tar/dist/commonjs/write-entry.js +108 -672
  193. package/node_modules/tar/dist/commonjs/write-flag.d.ts +18 -0
  194. package/node_modules/tar/dist/commonjs/write-flag.js +29 -0
  195. package/node_modules/tar/dist/esm/bytes.d.ts +21 -0
  196. package/node_modules/tar/dist/esm/bytes.js +72 -0
  197. package/node_modules/tar/dist/esm/codec.d.ts +53 -0
  198. package/node_modules/tar/dist/esm/codec.js +32 -0
  199. package/node_modules/tar/dist/esm/concat.d.ts +3 -0
  200. package/node_modules/tar/dist/esm/concat.js +16 -0
  201. package/node_modules/tar/dist/esm/create.d.ts +39 -2
  202. package/node_modules/tar/dist/esm/create.js +144 -61
  203. package/node_modules/tar/dist/esm/dealias.d.ts +79 -0
  204. package/node_modules/tar/dist/esm/dealias.js +46 -0
  205. package/node_modules/tar/dist/esm/delete.d.ts +19 -0
  206. package/node_modules/tar/dist/esm/delete.js +117 -0
  207. package/node_modules/tar/dist/esm/entries.d.ts +82 -0
  208. package/node_modules/tar/dist/esm/entries.js +388 -0
  209. package/node_modules/tar/dist/esm/extract.d.ts +14 -2
  210. package/node_modules/tar/dist/esm/extract.js +37 -44
  211. package/node_modules/tar/dist/esm/fs.d.ts +201 -0
  212. package/node_modules/tar/dist/esm/fs.js +4 -0
  213. package/node_modules/tar/dist/esm/header.d.ts +4 -4
  214. package/node_modules/tar/dist/esm/header.js +71 -53
  215. package/node_modules/tar/dist/esm/index.d.ts +25 -18
  216. package/node_modules/tar/dist/esm/index.js +23 -18
  217. package/node_modules/tar/dist/esm/index.min.js +2 -3
  218. package/node_modules/tar/dist/esm/large-numbers.d.ts +2 -2
  219. package/node_modules/tar/dist/esm/large-numbers.js +4 -4
  220. package/node_modules/tar/dist/esm/list.d.ts +23 -6
  221. package/node_modules/tar/dist/esm/list.js +96 -101
  222. package/node_modules/tar/dist/esm/mkdir.d.ts +16 -11
  223. package/node_modules/tar/dist/esm/mkdir.js +119 -154
  224. package/node_modules/tar/dist/esm/normalize-unicode.js +9 -0
  225. package/node_modules/tar/dist/esm/options.d.ts +284 -513
  226. package/node_modules/tar/dist/esm/options.js +17 -51
  227. package/node_modules/tar/dist/esm/pack.d.ts +150 -96
  228. package/node_modules/tar/dist/esm/pack.js +750 -441
  229. package/node_modules/tar/dist/esm/parser.d.ts +98 -0
  230. package/node_modules/tar/dist/esm/parser.js +448 -0
  231. package/node_modules/tar/dist/esm/path-reservations.d.ts +17 -7
  232. package/node_modules/tar/dist/esm/path-reservations.js +110 -140
  233. package/node_modules/tar/dist/esm/path.d.ts +19 -0
  234. package/node_modules/tar/dist/esm/path.js +80 -0
  235. package/node_modules/tar/dist/esm/pax.d.ts +3 -1
  236. package/node_modules/tar/dist/esm/pax.js +66 -35
  237. package/node_modules/tar/dist/esm/read-entry.d.ts +97 -11
  238. package/node_modules/tar/dist/esm/read-entry.js +248 -96
  239. package/node_modules/tar/dist/esm/read-file.d.ts +22 -0
  240. package/node_modules/tar/dist/esm/read-file.js +99 -0
  241. package/node_modules/tar/dist/esm/replace.d.ts +45 -1
  242. package/node_modules/tar/dist/esm/replace.js +160 -207
  243. package/node_modules/tar/dist/esm/server/codecs.d.ts +38 -0
  244. package/node_modules/tar/dist/esm/server/codecs.js +214 -0
  245. package/node_modules/tar/dist/esm/server/index.d.ts +115 -0
  246. package/node_modules/tar/dist/esm/server/index.js +102 -0
  247. package/node_modules/tar/dist/esm/server/index.min.js +3 -0
  248. package/node_modules/tar/dist/esm/strip-absolute-path.d.ts +8 -0
  249. package/node_modules/tar/dist/esm/strip-absolute-path.js +17 -20
  250. package/node_modules/tar/dist/esm/to-stream.d.ts +7 -0
  251. package/node_modules/tar/dist/esm/to-stream.js +18 -0
  252. package/node_modules/tar/dist/esm/types.d.ts +4 -3
  253. package/node_modules/tar/dist/esm/types.js +4 -3
  254. package/node_modules/tar/dist/esm/unpack.d.ts +143 -89
  255. package/node_modules/tar/dist/esm/unpack.js +776 -719
  256. package/node_modules/tar/dist/esm/update.d.ts +11 -1
  257. package/node_modules/tar/dist/esm/update.js +35 -28
  258. package/node_modules/tar/dist/esm/warn.d.ts +27 -0
  259. package/node_modules/tar/dist/esm/warn.js +31 -0
  260. package/node_modules/tar/dist/esm/win32-path.d.ts +16 -0
  261. package/node_modules/tar/dist/esm/win32-path.js +60 -0
  262. package/node_modules/tar/dist/esm/write-entry.d.ts +64 -111
  263. package/node_modules/tar/dist/esm/write-entry.js +107 -633
  264. package/node_modules/tar/dist/esm/write-flag.d.ts +18 -0
  265. package/node_modules/tar/dist/esm/write-flag.js +25 -0
  266. package/node_modules/tar/package.json +68 -224
  267. package/package.json +2 -2
  268. package/packages/pm-beads/package.json +1 -1
  269. package/packages/pm-calendar/package.json +1 -1
  270. package/packages/pm-command-kit/package.json +1 -1
  271. package/packages/pm-digital-twin/package.json +1 -1
  272. package/packages/pm-governance-audit/package.json +1 -1
  273. package/packages/pm-guide-shell/package.json +1 -1
  274. package/packages/pm-kanban/package.json +1 -1
  275. package/packages/pm-lifecycle-hooks/package.json +1 -1
  276. package/packages/pm-linked-test-adapters/package.json +1 -1
  277. package/packages/pm-search-advanced/package.json +1 -1
  278. package/packages/pm-templates/package.json +1 -1
  279. package/packages/pm-todos/package.json +1 -1
  280. package/packages/pm-vcs/package.json +1 -1
  281. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  282. package/plugins/pm-claude/package.json +1 -1
  283. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  284. package/plugins/pm-codex/package.json +1 -1
  285. package/plugins/pm-codex/plugin.json +1 -1
  286. package/runtime-dependencies.json +1 -1
  287. package/dist/cli-bundle/chunks/chunk-A5ZEMOVR.js +0 -2
  288. package/dist/cli-bundle/chunks/chunk-AJLU6KLW.js +0 -2
  289. package/dist/cli-bundle/chunks/chunk-C6WM6ZN4.js +0 -9
  290. package/dist/cli-bundle/chunks/chunk-HZZLSBIJ.js +0 -2
  291. package/dist/cli-bundle/chunks/chunk-L2ZSSMYY.js +0 -2
  292. package/dist/cli-bundle/chunks/chunk-NRQCBUYD.js +0 -113
  293. package/dist/cli-bundle/chunks/chunk-QDV7S2QS.js +0 -2
  294. package/dist/cli-bundle/chunks/item-revision-3LENTXYF.js +0 -2
  295. package/dist/cli-bundle/chunks/item-transaction-66RDV7PH.js +0 -2
  296. package/dist/cli-bundle/focused-chunks/chunk-HTDYNY4L.js +0 -2
  297. package/dist/cli-bundle/focused-chunks/chunk-N64AC5G6.js +0 -100
  298. package/dist/cli-bundle/focused-chunks/chunk-PT7RT3T6.js +0 -44
  299. package/dist/cli-bundle/focused-chunks/chunk-QZRYGYTI.js +0 -2
  300. package/dist/cli-bundle/focused-chunks/chunk-SQMOF65W.js +0 -2
  301. package/dist/cli-bundle/focused-chunks/chunk-T3ILWAEV.js +0 -2
  302. package/dist/cli-bundle/focused-chunks/chunk-W4JMV7GF.js +0 -3
  303. package/dist/cli-bundle/focused-chunks/item-revision-723XCQPS.js +0 -2
  304. package/node_modules/@isaacs/fs-minipass/LICENSE +0 -15
  305. package/node_modules/@isaacs/fs-minipass/README.md +0 -71
  306. package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts +0 -118
  307. package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +0 -430
  308. package/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +0 -3
  309. package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts +0 -118
  310. package/node_modules/@isaacs/fs-minipass/dist/esm/index.js +0 -420
  311. package/node_modules/@isaacs/fs-minipass/dist/esm/package.json +0 -3
  312. package/node_modules/@isaacs/fs-minipass/package.json +0 -72
  313. package/node_modules/chownr/LICENSE.md +0 -63
  314. package/node_modules/chownr/README.md +0 -3
  315. package/node_modules/chownr/dist/commonjs/index.d.ts +0 -3
  316. package/node_modules/chownr/dist/commonjs/index.js +0 -93
  317. package/node_modules/chownr/dist/commonjs/package.json +0 -3
  318. package/node_modules/chownr/dist/esm/index.d.ts +0 -3
  319. package/node_modules/chownr/dist/esm/index.js +0 -85
  320. package/node_modules/chownr/dist/esm/package.json +0 -3
  321. package/node_modules/chownr/package.json +0 -69
  322. package/node_modules/minipass/LICENSE.md +0 -55
  323. package/node_modules/minipass/README.md +0 -825
  324. package/node_modules/minipass/dist/commonjs/index.d.ts +0 -545
  325. package/node_modules/minipass/dist/commonjs/index.js +0 -1038
  326. package/node_modules/minipass/dist/commonjs/package.json +0 -3
  327. package/node_modules/minipass/dist/esm/index.d.ts +0 -545
  328. package/node_modules/minipass/dist/esm/index.js +0 -1020
  329. package/node_modules/minipass/dist/esm/package.json +0 -3
  330. package/node_modules/minipass/package.json +0 -77
  331. package/node_modules/minizlib/LICENSE +0 -26
  332. package/node_modules/minizlib/README.md +0 -64
  333. package/node_modules/minizlib/dist/commonjs/constants.d.ts +0 -2
  334. package/node_modules/minizlib/dist/commonjs/constants.js +0 -123
  335. package/node_modules/minizlib/dist/commonjs/index.d.ts +0 -99
  336. package/node_modules/minizlib/dist/commonjs/index.js +0 -416
  337. package/node_modules/minizlib/dist/commonjs/package.json +0 -3
  338. package/node_modules/minizlib/dist/esm/constants.d.ts +0 -2
  339. package/node_modules/minizlib/dist/esm/constants.js +0 -117
  340. package/node_modules/minizlib/dist/esm/index.d.ts +0 -99
  341. package/node_modules/minizlib/dist/esm/index.js +0 -363
  342. package/node_modules/minizlib/dist/esm/package.json +0 -3
  343. package/node_modules/minizlib/package.json +0 -80
  344. package/node_modules/tar/dist/commonjs/get-write-flag.d.ts +0 -2
  345. package/node_modules/tar/dist/commonjs/get-write-flag.js +0 -32
  346. package/node_modules/tar/dist/commonjs/make-command.d.ts +0 -49
  347. package/node_modules/tar/dist/commonjs/make-command.js +0 -52
  348. package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +0 -2
  349. package/node_modules/tar/dist/commonjs/normalize-windows-path.js +0 -12
  350. package/node_modules/tar/dist/commonjs/parse.d.ts +0 -92
  351. package/node_modules/tar/dist/commonjs/parse.js +0 -655
  352. package/node_modules/tar/dist/commonjs/process-umask.d.ts +0 -2
  353. package/node_modules/tar/dist/commonjs/process-umask.js +0 -7
  354. package/node_modules/tar/dist/commonjs/warn-method.d.ts +0 -24
  355. package/node_modules/tar/dist/commonjs/warn-method.js +0 -31
  356. package/node_modules/tar/dist/esm/get-write-flag.d.ts +0 -2
  357. package/node_modules/tar/dist/esm/get-write-flag.js +0 -26
  358. package/node_modules/tar/dist/esm/make-command.d.ts +0 -49
  359. package/node_modules/tar/dist/esm/make-command.js +0 -48
  360. package/node_modules/tar/dist/esm/normalize-windows-path.d.ts +0 -2
  361. package/node_modules/tar/dist/esm/normalize-windows-path.js +0 -9
  362. package/node_modules/tar/dist/esm/parse.d.ts +0 -92
  363. package/node_modules/tar/dist/esm/parse.js +0 -651
  364. package/node_modules/tar/dist/esm/process-umask.d.ts +0 -2
  365. package/node_modules/tar/dist/esm/process-umask.js +0 -3
  366. package/node_modules/tar/dist/esm/warn-method.d.ts +0 -24
  367. package/node_modules/tar/dist/esm/warn-method.js +0 -27
  368. package/node_modules/yallist/LICENSE.md +0 -63
  369. package/node_modules/yallist/README.md +0 -205
  370. package/node_modules/yallist/dist/commonjs/index.d.ts +0 -39
  371. package/node_modules/yallist/dist/commonjs/index.js +0 -384
  372. package/node_modules/yallist/dist/commonjs/package.json +0 -3
  373. package/node_modules/yallist/dist/esm/index.d.ts +0 -39
  374. package/node_modules/yallist/dist/esm/index.js +0 -379
  375. package/node_modules/yallist/dist/esm/package.json +0 -3
  376. package/node_modules/yallist/package.json +0 -68
@@ -1,169 +1,139 @@
1
1
  "use strict";
2
- // A path exclusive reservation system
3
- // reserve([list, of, paths], fn)
4
- // When the fn is first in line for all its paths, it
5
- // is called with a cb that clears the reservation.
6
- //
7
- // Used by async unpack to avoid clobbering paths in use,
8
- // while still allowing maximal safe parallelization.
2
+ // The async extraction does several entries at one time. Two entries
3
+ // must not work on the same path at one time: a link needs its
4
+ // target, and an entry can replace an object of a different type.
9
5
  Object.defineProperty(exports, "__esModule", { value: true });
10
6
  exports.PathReservations = void 0;
11
- const node_path_1 = require("node:path");
12
7
  const normalize_unicode_js_1 = require("./normalize-unicode.js");
13
8
  const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js");
14
- const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
15
- const isWindows = platform === 'win32';
16
- // return a set of parent dirs for a given path
17
- // '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d']
18
- const getDirs = (path) => {
19
- const dirs = path
20
- .split('/')
21
- .slice(0, -1)
22
- .reduce((set, path) => {
23
- const s = set.at(-1);
24
- if (s !== undefined) {
25
- path = (0, node_path_1.join)(s, path);
26
- }
27
- set.push(path || '/');
28
- return set;
29
- }, []);
30
- return dirs;
31
- };
9
+ const path_js_1 = require("./path.js");
10
+ /**
11
+ * Gives each task the exclusive use of its paths, and the shared use
12
+ * of their parent directories. A task starts when each task before
13
+ * it that uses one of its paths, or a directory above or below one,
14
+ * is done.
15
+ *
16
+ * Paths that differ only in case or in Unicode form are the same
17
+ * path, because they can be the same file on disk.
18
+ */
32
19
  class PathReservations {
33
- // path => [function or Set]
34
- // A Set object means a directory reservation
35
- // A fn is a direct reservation on that path
36
- #queues = new Map();
37
- // fn => {paths:[path,...], dirs:[path, ...]}
20
+ #root = { queue: [], name: '' };
38
21
  #reservations = new Map();
39
- // functions currently running
40
22
  #running = new Set();
23
+ #win32;
24
+ /** @param win32 run one task at a time */
25
+ constructor(win32 = false) {
26
+ this.#win32 = win32;
27
+ }
28
+ /**
29
+ * Call `fn` when it is first in line for each of its paths. The
30
+ * paths are free again when the promise of `fn` settles. Returns a
31
+ * promise with the result of `fn`.
32
+ */
41
33
  reserve(paths, fn) {
42
- paths =
43
- isWindows ?
44
- ['win32 parallelization disabled']
45
- : paths.map(p => {
46
- // don't need normPath, because we skip this entirely for windows
47
- return (0, strip_trailing_slashes_js_1.stripTrailingSlashes)((0, node_path_1.join)((0, normalize_unicode_js_1.normalizeUnicode)(p)));
34
+ return new Promise((res, rej) => {
35
+ const handler = () => {
36
+ fn().then(() => {
37
+ this.#clear(handler);
38
+ res();
39
+ }, er => {
40
+ this.#clear(handler);
41
+ rej(er);
48
42
  });
49
- const dirs = new Set(paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b)));
50
- this.#reservations.set(fn, { dirs, paths });
51
- for (const p of paths) {
52
- const q = this.#queues.get(p);
53
- if (!q) {
54
- this.#queues.set(p, [fn]);
55
- }
56
- else {
57
- q.push(fn);
58
- }
59
- }
60
- for (const dir of dirs) {
61
- const q = this.#queues.get(dir);
62
- if (!q) {
63
- this.#queues.set(dir, [new Set([fn])]);
64
- }
65
- else {
66
- const l = q.at(-1);
67
- if (l instanceof Set) {
68
- l.add(fn);
69
- }
70
- else {
71
- q.push(new Set([fn]));
72
- }
43
+ };
44
+ this.#add(paths, handler);
45
+ });
46
+ }
47
+ #add(names, fn) {
48
+ const root = this.#root;
49
+ const paths = new Set();
50
+ const dirs = new Set();
51
+ for (const name of this.#win32 ?
52
+ ['win32 parallelization disabled']
53
+ : names) {
54
+ const path = this.#win32 ? name : ((0, strip_trailing_slashes_js_1.stripTrailingSlashes)((0, path_js_1.join)((0, normalize_unicode_js_1.normalizeUnicode)(name))));
55
+ let node = root;
56
+ for (const part of path.split('/')) {
57
+ if (node !== root)
58
+ dirs.add(node);
59
+ const kids = (node.kids ??= new Map());
60
+ let kid = kids.get(part);
61
+ if (!kid)
62
+ kids.set(part, (kid = { queue: [], name: part, up: node }));
63
+ node = kid;
73
64
  }
65
+ paths.add(node);
74
66
  }
75
- return this.#run(fn);
76
- }
77
- // return the queues for each path the function cares about
78
- // fn => {paths, dirs}
79
- #getQueues(fn) {
80
- const res = this.#reservations.get(fn);
81
- /* c8 ignore start */
82
- if (!res) {
83
- throw new Error('function does not have any path reservations');
67
+ // A path of the task is exclusive, so it also covers the use of
68
+ // that path as a parent directory of another path.
69
+ for (const p of paths)
70
+ dirs.delete(p);
71
+ this.#reservations.set(fn, { dirs, paths });
72
+ for (const p of paths)
73
+ p.queue.push(fn);
74
+ for (const { queue } of dirs) {
75
+ const last = queue[queue.length - 1];
76
+ if (last instanceof Set)
77
+ last.add(fn);
78
+ else
79
+ queue.push(new Set([fn]));
84
80
  }
85
- /* c8 ignore stop */
86
- return {
87
- paths: res.paths.map((path) => this.#queues.get(path)),
88
- dirs: [...res.dirs].map(path => this.#queues.get(path)),
89
- };
90
- }
91
- // check if fn is first in line for all its paths, and is
92
- // included in the first set for all its dir queues
93
- check(fn) {
94
- const { paths, dirs } = this.#getQueues(fn);
95
- return (paths.every(q => q && q[0] === fn) &&
96
- dirs.every(q => q && q[0] instanceof Set && q[0].has(fn)));
81
+ this.#run(fn);
97
82
  }
98
- // run the function if it's first in line and not already running
83
+ // Start the task if it is first in line for each path, and in the
84
+ // first set for each directory. A task that waits is never first in
85
+ // line for each of them, so a task starts one time only.
99
86
  #run(fn) {
100
- if (this.#running.has(fn) || !this.check(fn)) {
101
- return false;
87
+ const { paths, dirs } = this.#reservations.get(fn);
88
+ for (const p of paths) {
89
+ if (p.queue[0] !== fn)
90
+ return;
91
+ }
92
+ for (const { queue } of dirs) {
93
+ const first = queue[0];
94
+ if (!(first instanceof Set) || !first.has(fn))
95
+ return;
102
96
  }
103
97
  this.#running.add(fn);
104
- fn(() => this.#clear(fn));
105
- return true;
98
+ fn();
106
99
  }
107
100
  #clear(fn) {
108
- if (!this.#running.has(fn)) {
109
- return false;
110
- }
111
- const res = this.#reservations.get(fn);
112
- /* c8 ignore start */
113
- if (!res) {
114
- throw new Error('invalid reservation');
115
- }
116
- /* c8 ignore stop */
117
- const { paths, dirs } = res;
101
+ const { paths, dirs } = this.#reservations.get(fn);
118
102
  const next = new Set();
119
- for (const path of paths) {
120
- const q = this.#queues.get(path);
121
- /* c8 ignore start */
122
- if (!q || q?.[0] !== fn) {
123
- continue;
124
- }
125
- /* c8 ignore stop */
126
- const q0 = q[1];
127
- if (!q0) {
128
- this.#queues.delete(path);
129
- continue;
130
- }
131
- q.shift();
132
- if (typeof q0 === 'function') {
133
- next.add(q0);
134
- }
135
- else {
136
- for (const f of q0) {
103
+ for (const { queue } of paths) {
104
+ // A running task is first in the queue of each of its paths.
105
+ queue.shift();
106
+ const after = queue[0];
107
+ if (typeof after === 'function')
108
+ next.add(after);
109
+ else if (after)
110
+ for (const f of after)
137
111
  next.add(f);
138
- }
139
- }
140
112
  }
141
- for (const dir of dirs) {
142
- const q = this.#queues.get(dir);
143
- const q0 = q?.[0];
144
- /* c8 ignore next - type safety only */
145
- if (!q || !(q0 instanceof Set))
146
- continue;
147
- if (q0.size === 1 && q.length === 1) {
148
- this.#queues.delete(dir);
149
- continue;
150
- }
151
- else if (q0.size === 1) {
152
- q.shift();
153
- // next one must be a function,
154
- // or else the Set would've been reused
155
- const n = q[0];
156
- if (typeof n === 'function') {
157
- next.add(n);
158
- }
159
- }
113
+ for (const { queue } of dirs) {
114
+ // A running task is in the first set of each of its directories.
115
+ const first = queue[0];
116
+ if (first.size > 1)
117
+ first.delete(fn);
160
118
  else {
161
- q0.delete(fn);
119
+ queue.shift();
120
+ // Two sets in a row would be one set, so this is a function.
121
+ if (queue.length)
122
+ next.add(queue[0]);
123
+ }
124
+ }
125
+ // Remove each node that no task uses. Each directory of the task
126
+ // is above one of its paths.
127
+ for (let node of paths) {
128
+ while (node.up && !node.queue.length && !node.kids?.size) {
129
+ node.up.kids?.delete(node.name);
130
+ node = node.up;
162
131
  }
163
132
  }
164
133
  this.#running.delete(fn);
165
- next.forEach(fn => this.#run(fn));
166
- return true;
134
+ this.#reservations.delete(fn);
135
+ for (const f of next)
136
+ this.#run(f);
167
137
  }
168
138
  }
169
139
  exports.PathReservations = PathReservations;
@@ -0,0 +1,19 @@
1
+ /** Resolve `.` and `..` parts, and remove repeated slashes. */
2
+ export declare const normalize: (path: string) => string;
3
+ /** Join the parts with a slash, then normalize the result. */
4
+ export declare const join: (...parts: string[]) => string;
5
+ /** The path without its last part. */
6
+ export declare const dirname: (path: string) => string;
7
+ /** The last part of the path. */
8
+ export declare const basename: (path: string) => string;
9
+ /** True if the path starts with a slash. */
10
+ export declare const isAbsolute: (path: string) => boolean;
11
+ /**
12
+ * Resolve the parts from right to left, up to the first absolute
13
+ * part. There is no working directory here: if no part is absolute,
14
+ * the result is a relative path.
15
+ */
16
+ export declare const resolve: (...parts: string[]) => string;
17
+ /** The relative path from `from` to `to`. */
18
+ export declare const relative: (from: string, to: string) => string;
19
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ // The POSIX path functions that tar paths need. Each one gives the
3
+ // same result as the function of the same name in `path.posix`.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.relative = exports.resolve = exports.isAbsolute = exports.basename = exports.dirname = exports.join = exports.normalize = void 0;
6
+ /** Resolve `.` and `..` parts, and remove repeated slashes. */
7
+ const normalize = (path) => {
8
+ const absolute = path.charCodeAt(0) === 47;
9
+ const out = [];
10
+ for (const part of path.split('/')) {
11
+ if (part === '' || part === '.')
12
+ continue;
13
+ if (part !== '..')
14
+ out.push(part);
15
+ else if (out.length && out[out.length - 1] !== '..')
16
+ out.pop();
17
+ else if (!absolute)
18
+ out.push(part);
19
+ }
20
+ const trail = out.length && path.charCodeAt(path.length - 1) === 47;
21
+ const res = out.join('/') + (trail ? '/' : '');
22
+ if (absolute)
23
+ return '/' + res;
24
+ return res || (path.endsWith('/') ? './' : '.');
25
+ };
26
+ exports.normalize = normalize;
27
+ /** Join the parts with a slash, then normalize the result. */
28
+ const join = (...parts) => (0, exports.normalize)(parts.filter(p => p).join('/'));
29
+ exports.join = join;
30
+ /** The path without its last part. */
31
+ const dirname = (path) => {
32
+ let end = path.length;
33
+ while (end > 1 && path.charCodeAt(end - 1) === 47)
34
+ end--;
35
+ const slash = path.lastIndexOf('/', end - 1);
36
+ if (slash === -1)
37
+ return '.';
38
+ if (slash === 0)
39
+ return '/';
40
+ if (slash === 1 && path.charCodeAt(0) === 47)
41
+ return '//';
42
+ return path.slice(0, slash);
43
+ };
44
+ exports.dirname = dirname;
45
+ /** The last part of the path. */
46
+ const basename = (path) => {
47
+ let end = path.length;
48
+ while (end > 0 && path.charCodeAt(end - 1) === 47)
49
+ end--;
50
+ return path.slice(path.lastIndexOf('/', end - 1) + 1, end);
51
+ };
52
+ exports.basename = basename;
53
+ /** True if the path starts with a slash. */
54
+ const isAbsolute = (path) => path.charCodeAt(0) === 47;
55
+ exports.isAbsolute = isAbsolute;
56
+ /**
57
+ * Resolve the parts from right to left, up to the first absolute
58
+ * part. There is no working directory here: if no part is absolute,
59
+ * the result is a relative path.
60
+ */
61
+ const resolve = (...parts) => {
62
+ let path = '';
63
+ for (let i = parts.length - 1; i >= 0 && !(0, exports.isAbsolute)(path); i--) {
64
+ const part = parts[i];
65
+ if (part)
66
+ path = path ? part + '/' + path : part;
67
+ }
68
+ const res = (0, exports.normalize)(path);
69
+ return res.length > 1 && res.endsWith('/') ? res.slice(0, -1) : res;
70
+ };
71
+ exports.resolve = resolve;
72
+ /** The relative path from `from` to `to`. */
73
+ const relative = (from, to) => {
74
+ const f = (0, exports.resolve)(from).split('/');
75
+ const t = (0, exports.resolve)(to).split('/');
76
+ // The root gives an empty last part.
77
+ if (!f[f.length - 1])
78
+ f.pop();
79
+ if (!t[t.length - 1])
80
+ t.pop();
81
+ let same = 0;
82
+ while (same < f.length && same < t.length && f[same] === t[same])
83
+ same++;
84
+ return [
85
+ ...Array.from({ length: f.length - same }, () => '..'),
86
+ ...t.slice(same),
87
+ ].join('/');
88
+ };
89
+ exports.relative = relative;
90
+ //# sourceMappingURL=path.js.map
@@ -18,9 +18,11 @@ export declare class Pax implements HeaderData {
18
18
  mode?: number;
19
19
  global: boolean;
20
20
  constructor(obj: HeaderData, global?: boolean);
21
- encode(): Buffer<ArrayBuffer>;
21
+ encode(): Uint8Array<ArrayBuffer>;
22
22
  encodeBody(): string;
23
23
  encodeField(field: keyof Pax): string;
24
24
  static parse(str: string, ex?: HeaderData, g?: boolean): Pax;
25
+ /** Parse the body of a PAX header entry. */
26
+ static parseBytes(buf: Uint8Array, ex?: HeaderData, g?: boolean): Pax;
25
27
  }
26
28
  //# sourceMappingURL=pax.d.ts.map
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Pax = void 0;
4
- const node_path_1 = require("node:path");
5
4
  const header_js_1 = require("./header.js");
5
+ const bytes_js_1 = require("./bytes.js");
6
+ const path_js_1 = require("./path.js");
7
+ const SIMPLE_NUMBER = /^\d+$/;
6
8
  class Pax {
7
9
  atime;
8
10
  mtime;
@@ -42,24 +44,18 @@ class Pax {
42
44
  encode() {
43
45
  const body = this.encodeBody();
44
46
  if (body === '') {
45
- return Buffer.allocUnsafe(0);
47
+ return new Uint8Array(0);
46
48
  }
47
- const bodyLen = Buffer.byteLength(body);
49
+ const bodyLen = (0, bytes_js_1.utf8Length)(body);
48
50
  // round up to 512 bytes
49
51
  // add 512 for header
50
52
  const bufLen = 512 * Math.ceil(1 + bodyLen / 512);
51
- const buf = Buffer.allocUnsafe(bufLen);
52
- // 0-fill the header section, it might not hit every field
53
- for (let i = 0; i < 512; i++) {
54
- buf[i] = 0;
55
- }
53
+ const buf = new Uint8Array(bufLen);
56
54
  new header_js_1.Header({
57
55
  // XXX split the path
58
56
  // then the path should be PaxHeader + basename, but less than 99,
59
57
  // prepend with the dirname
60
- /* c8 ignore start */
61
- path: ('PaxHeader/' + (0, node_path_1.basename)(this.path ?? '')).slice(0, 99),
62
- /* c8 ignore stop */
58
+ path: ('PaxHeader/' + (0, path_js_1.basename)(this.path ?? '')).slice(0, 99),
63
59
  mode: this.mode || 0o644,
64
60
  uid: this.uid,
65
61
  gid: this.gid,
@@ -74,11 +70,7 @@ class Pax {
74
70
  atime: this.atime,
75
71
  ctime: this.ctime,
76
72
  }).encode(buf);
77
- buf.write(body, 512, bodyLen, 'utf8');
78
- // null pad after the body
79
- for (let i = bodyLen + 512; i < buf.length; i++) {
80
- buf[i] = 0;
81
- }
73
+ (0, bytes_js_1.encodeUtf8Into)(body, buf, 512, bodyLen);
82
74
  return buf;
83
75
  }
84
76
  encodeBody() {
@@ -103,7 +95,7 @@ class Pax {
103
95
  return '';
104
96
  }
105
97
  const r = this[field];
106
- const v = r instanceof Date ? r.getTime() / 1000 : r;
98
+ const v = typeof r === 'object' ? r.getTime() / 1000 : r;
107
99
  const s = ' ' +
108
100
  (field === 'dev' || field === 'ino' || field === 'nlink' ?
109
101
  'SCHILY.'
@@ -112,7 +104,7 @@ class Pax {
112
104
  '=' +
113
105
  v +
114
106
  '\n';
115
- const byteLen = Buffer.byteLength(s);
107
+ const byteLen = (0, bytes_js_1.utf8Length)(s);
116
108
  // the digits includes the length of the digits in ascii base-10
117
109
  // so if it's 9 characters, then adding 1 for the 9 makes it 10
118
110
  // which makes it 11 chars.
@@ -124,30 +116,57 @@ class Pax {
124
116
  return len + s;
125
117
  }
126
118
  static parse(str, ex, g = false) {
127
- return new Pax(merge(parseKV(str), ex), g);
119
+ return Pax.parseBytes(new TextEncoder().encode(str), ex, g);
120
+ }
121
+ /** Parse the body of a PAX header entry. */
122
+ static parseBytes(buf, ex, g = false) {
123
+ return new Pax(merge(parseKV(buf), ex), g);
128
124
  }
129
125
  }
130
126
  exports.Pax = Pax;
131
127
  const merge = (a, b) => b ? Object.assign({}, b, a) : a;
132
- const parseKV = (str) => str
133
- .replace(/\n$/, '')
134
- .split('\n')
135
- .reduce(parseKVLine, Object.create(null));
136
- const parseKVLine = (set, line) => {
137
- const n = parseInt(line, 10);
138
- // XXX Values with \n in them will fail this.
139
- // Refactor to not be a naive line-by-line parse.
140
- if (n !== Buffer.byteLength(line) + 1) {
141
- return set;
128
+ // Each record is "<len> <key>=<value>\n". <len> is the byte length of
129
+ // the whole record. A value can contain a newline, so use the length
130
+ // to find the end of the record. A NUL where a record starts is the
131
+ // end of the records, as it is for GNU tar and Python. A record that
132
+ // is not valid is an error, because the records after it can set the
133
+ // size or the name of the entry.
134
+ const parseKV = (buf) => {
135
+ const set = Object.create(null);
136
+ let pos = 0;
137
+ while (pos < buf.length && buf[pos] !== 0) {
138
+ let sp = pos;
139
+ while (sp < buf.length &&
140
+ buf[sp] >= 0x30 &&
141
+ buf[sp] <= 0x39) {
142
+ sp++;
143
+ }
144
+ const end = pos + Number((0, bytes_js_1.decodeUtf8)(buf, pos, sp));
145
+ if (sp === pos ||
146
+ buf[sp] !== 0x20 ||
147
+ end <= sp + 1 ||
148
+ end > buf.length ||
149
+ buf[end - 1] !== 0x0a) {
150
+ throw new Error('invalid PAX record');
151
+ }
152
+ parseKVLine(set, (0, bytes_js_1.decodeUtf8)(buf, sp + 1, end - 1));
153
+ pos = end;
142
154
  }
143
- line = line.slice((n + ' ').length);
155
+ return set;
156
+ };
157
+ const parseKVLine = (set, line) => {
144
158
  const kv = line.split('=');
159
+ if (kv.length === 1)
160
+ throw new Error('invalid PAX record');
145
161
  const r = kv.shift();
146
162
  if (!r) {
147
163
  return set;
148
164
  }
149
165
  const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1');
150
- const v = kv.join('=').replace(/\0.*/, '');
166
+ // The value ends at the first NUL.
167
+ const joined = kv.join('=');
168
+ const nul = joined.indexOf('\0');
169
+ const v = nul === -1 ? joined : joined.slice(0, nul);
151
170
  switch (k) {
152
171
  case 'path':
153
172
  case 'linkpath':
@@ -161,12 +180,18 @@ const parseKVLine = (set, line) => {
161
180
  case 'ctime':
162
181
  case 'atime':
163
182
  case 'mtime':
164
- set[k] = new Date(Number(v) * 1000);
183
+ const d = new Date(Number(v) * 1000);
184
+ if (!isNaN(d.getTime()))
185
+ set[k] = d;
165
186
  break;
166
187
  case 'size':
167
- const s = +v;
168
- if (s >= 0)
169
- set[k] = s;
188
+ // The size sets where the next header is. Other tar programs
189
+ // read a value that is not only decimal digits in different
190
+ // ways, so it is an error.
191
+ if (!SIMPLE_NUMBER.test(joined) || !Number.isSafeInteger(+joined)) {
192
+ throw new Error('invalid PAX size');
193
+ }
194
+ set[k] = +joined;
170
195
  break;
171
196
  case 'gid':
172
197
  case 'uid':
@@ -174,7 +199,13 @@ const parseKVLine = (set, line) => {
174
199
  case 'ino':
175
200
  case 'nlink':
176
201
  case 'mode':
177
- set[k] = +v;
202
+ // value must be a string of decimal digits
203
+ if (!SIMPLE_NUMBER.test(v.trim()))
204
+ break;
205
+ const s = +v;
206
+ if (!Number.isSafeInteger(s))
207
+ break;
208
+ set[k] = s;
178
209
  break;
179
210
  }
180
211
  return set;