@unbrained/pm-cli 2026.10.28 → 2026.10.31

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 (278) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +50 -0
  3. package/dist/cli/commander-usage.js +2 -2
  4. package/dist/cli/commands/lifecycle/append.d.ts +4 -0
  5. package/dist/cli/commands/lifecycle/append.js +1 -1
  6. package/dist/cli/commands/lifecycle/create.d.ts +4 -0
  7. package/dist/cli/commands/lifecycle/create.js +1 -1
  8. package/dist/cli/commands/lifecycle/plan.d.ts +3 -0
  9. package/dist/cli/commands/lifecycle/plan.js +1 -1
  10. package/dist/cli/commands/lifecycle/update-many.d.ts +4 -0
  11. package/dist/cli/commands/lifecycle/update-many.js +1 -1
  12. package/dist/cli/commands/lifecycle/update.d.ts +4 -0
  13. package/dist/cli/commands/lifecycle/update.js +1 -1
  14. package/dist/cli/error-guidance.d.ts +45 -5
  15. package/dist/cli/error-guidance.js +5 -3
  16. package/dist/cli/extension-command-help.d.ts +1 -0
  17. package/dist/cli/extension-command-help.js +2 -2
  18. package/dist/cli/help-content.js +2 -2
  19. package/dist/cli/main.d.ts +1 -5
  20. package/dist/cli/main.js +5 -5
  21. package/dist/cli/migration-gates.d.ts +1 -1
  22. package/dist/cli/migration-gates.js +1 -1
  23. package/dist/cli/preflight-warnings.d.ts +11 -0
  24. package/dist/cli/preflight-warnings.js +4 -0
  25. package/dist/cli/register-list-query.js +3 -3
  26. package/dist/cli/register-mutation.js +2 -2
  27. package/dist/cli-bundle/bundle-manifest.json +1 -1
  28. package/dist/cli-bundle/chunks/chunk-24J6TNYE.js +8 -0
  29. package/dist/cli-bundle/chunks/{chunk-YYD5MNAV.js → chunk-2AHSPMKJ.js} +2 -2
  30. package/dist/cli-bundle/chunks/chunk-35Q2B2GJ.js +2 -0
  31. package/dist/cli-bundle/chunks/chunk-43R7UTWV.js +2 -0
  32. package/dist/cli-bundle/chunks/chunk-6PSDQ7T7.js +8 -0
  33. package/dist/cli-bundle/chunks/{chunk-YUBUNECD.js → chunk-BS2KXT24.js} +84 -84
  34. package/dist/cli-bundle/chunks/{chunk-D3AIQZXF.js → chunk-GMBDZID5.js} +3 -3
  35. package/dist/cli-bundle/chunks/chunk-HSBTITO4.js +3 -0
  36. package/dist/cli-bundle/chunks/{chunk-LWW4F4G2.js → chunk-MRUA2Z43.js} +2 -2
  37. package/dist/cli-bundle/chunks/chunk-P3LNMWL2.js +2 -0
  38. package/dist/cli-bundle/chunks/chunk-PT7TS6E7.js +2 -0
  39. package/dist/cli-bundle/chunks/{chunk-TH5KPAN4.js → chunk-SBVX5CMV.js} +2 -2
  40. package/dist/cli-bundle/chunks/{chunk-D6P6IBPN.js → chunk-TL3O5GZA.js} +45 -45
  41. package/dist/cli-bundle/chunks/chunk-U7JXZMU5.js +6 -0
  42. package/dist/cli-bundle/chunks/{chunk-DM3PICGU.js → chunk-V6EWBTNH.js} +2 -2
  43. package/dist/cli-bundle/chunks/chunk-VC7TA67O.js +20 -0
  44. package/dist/cli-bundle/chunks/chunk-WNF6FOL7.js +31 -0
  45. package/dist/cli-bundle/chunks/chunk-WRXQAW7Q.js +114 -0
  46. package/dist/cli-bundle/chunks/{chunk-RZQNFHXO.js → chunk-WX25MU4N.js} +3 -3
  47. package/dist/cli-bundle/chunks/chunk-XDDPSWIW.js +2 -0
  48. package/dist/cli-bundle/chunks/chunk-YT5D5HNG.js +2 -0
  49. package/dist/cli-bundle/chunks/chunk-ZTJVOBDU.js +128 -0
  50. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-LHLE7PSG.js → indexed-receipt-blobs-KGMJVFH2.js} +2 -2
  51. package/dist/cli-bundle/chunks/item-transaction-UWV6UNSV.js +2 -0
  52. package/dist/cli-bundle/chunks/{mutation-admission-GKDKHRTZ.js → mutation-admission-I4RHIT3Q.js} +2 -2
  53. package/dist/cli-bundle/chunks/{register-list-query-MHJJUM6M.js → register-list-query-MVDL5EXG.js} +6 -6
  54. package/dist/cli-bundle/chunks/register-mutation-GAF7LXRB.js +20 -0
  55. package/dist/cli-bundle/chunks/register-operations-JLFRL36Q.js +2 -0
  56. package/dist/cli-bundle/chunks/{register-setup-WUZ2ZSMY.js → register-setup-MZN6ONB3.js} +2 -2
  57. package/dist/cli-bundle/chunks/{settlement-hook-MN3Y7LVX.js → settlement-hook-YWSWFOZY.js} +2 -2
  58. package/dist/cli-bundle/chunks/{stage-2FYJGGG3.js → stage-2ZORTOF6.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{chunk-4GN2ZPT5.js → chunk-2J7T2UCH.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-YLVHHWHN.js → chunk-4PW5XWVI.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/chunk-4QPGJO2G.js +26 -0
  62. package/dist/cli-bundle/focused-chunks/{chunk-IQKLJFJE.js → chunk-57HPXGOQ.js} +18 -18
  63. package/dist/cli-bundle/focused-chunks/chunk-5MCGYBOQ.js +91 -0
  64. package/dist/cli-bundle/focused-chunks/chunk-6F6APBCX.js +3 -0
  65. package/dist/cli-bundle/focused-chunks/chunk-AFVN2KCP.js +44 -0
  66. package/dist/cli-bundle/focused-chunks/{chunk-ON5WFDCG.js → chunk-DFUTCKUF.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/chunk-EA65HVBO.js +12 -0
  68. package/dist/cli-bundle/focused-chunks/chunk-GP2WU43K.js +26 -0
  69. package/dist/cli-bundle/focused-chunks/{chunk-C2GLO7HU.js → chunk-HPWT3RBG.js} +54 -54
  70. package/dist/cli-bundle/focused-chunks/chunk-HSAEEWSI.js +2 -0
  71. package/dist/cli-bundle/focused-chunks/{chunk-7SZPZOIC.js → chunk-JLXGRDTG.js} +3 -3
  72. package/dist/cli-bundle/focused-chunks/chunk-JNKRUCVZ.js +2 -0
  73. package/dist/cli-bundle/focused-chunks/{chunk-JTCGDODH.js → chunk-KH5QJXY7.js} +2 -2
  74. package/dist/cli-bundle/focused-chunks/chunk-KKRIFBSL.js +2 -0
  75. package/dist/cli-bundle/focused-chunks/{chunk-TUN4M757.js → chunk-MW77Q3AQ.js} +2 -2
  76. package/dist/cli-bundle/focused-chunks/chunk-NOKG4RFN.js +22 -0
  77. package/dist/cli-bundle/focused-chunks/{chunk-DRN4W3YJ.js → chunk-NRBUMDLF.js} +2 -2
  78. package/dist/cli-bundle/focused-chunks/{chunk-ML5JIUM6.js → chunk-PC3R5CJV.js} +2 -2
  79. package/dist/cli-bundle/focused-chunks/chunk-PFBQOZPK.js +2 -0
  80. package/dist/cli-bundle/focused-chunks/{chunk-R3EA3SDW.js → chunk-QFMJGQGO.js} +3 -3
  81. package/dist/cli-bundle/focused-chunks/{chunk-I4X6AKOO.js → chunk-SFQKCA5K.js} +2 -2
  82. package/dist/cli-bundle/focused-chunks/chunk-WHIE2C6Q.js +2 -0
  83. package/dist/cli-bundle/focused-chunks/chunk-Y6UYRMVG.js +6 -0
  84. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-5H6RMRTK.js → indexed-receipt-blobs-KHWT44EK.js} +2 -2
  85. package/dist/cli-bundle/focused-chunks/item-transaction-LU75EG7D.js +2 -0
  86. package/dist/cli-bundle/focused-chunks/{mutation-admission-TM3SVU2O.js → mutation-admission-KDJ7SCPA.js} +2 -2
  87. package/dist/cli-bundle/focused-chunks/{settlement-hook-LBVWWSCF.js → settlement-hook-SJV52ZTV.js} +2 -2
  88. package/dist/cli-bundle/focused-chunks/{stage-7ZBRX2Q2.js → stage-R4KEBO37.js} +2 -2
  89. package/dist/cli-bundle/main.js +26 -22
  90. package/dist/cli-bundle/sdk-authoring.js +1 -1
  91. package/dist/cli-bundle/sdk-contracts.js +4 -4
  92. package/dist/cli-bundle/sdk-core.js +1 -43
  93. package/dist/cli-bundle/sdk-governance.js +1 -1
  94. package/dist/cli-bundle/sdk-graph.js +1 -1
  95. package/dist/cli-bundle/sdk-merge.js +61 -61
  96. package/dist/cli-bundle/sdk-query.js +1 -1
  97. package/dist/cli-bundle/sdk-runtime.js +1 -1
  98. package/dist/cli-bundle/sdk-testing.js +1 -1
  99. package/dist/cli-bundle/sdk.js +11 -11
  100. package/dist/core/config/nested-settings.js +1 -1
  101. package/dist/core/extensions/extension-hook-runtime.js +1 -1
  102. package/dist/core/extensions/extension-types.d.ts +4 -0
  103. package/dist/core/extensions/extension-types.js +1 -1
  104. package/dist/core/extensions/loader.js +1 -1
  105. package/dist/core/history/operation-contract.d.ts +2 -2
  106. package/dist/core/history/operation-contract.js +1 -1
  107. package/dist/core/item/literal-mutation-input.d.ts +12 -0
  108. package/dist/core/item/literal-mutation-input.js +2 -0
  109. package/dist/core/item/parse.d.ts +2 -0
  110. package/dist/core/item/parse.js +2 -2
  111. package/dist/core/lock/lock.js +4 -4
  112. package/dist/core/output/output.js +3 -3
  113. package/dist/core/schema/fields-file.js +1 -1
  114. package/dist/core/sentry/helpers.d.ts +6 -0
  115. package/dist/core/sentry/helpers.js +1 -1
  116. package/dist/core/sentry/instrument.d.ts +1 -1
  117. package/dist/core/sentry/instrument.js +1 -1
  118. package/dist/core/shared/constants.js +1 -1
  119. package/dist/core/shared/errors.d.ts +6 -0
  120. package/dist/core/shared/errors.js +1 -1
  121. package/dist/core/shared/output-unicode.d.ts +10 -0
  122. package/dist/core/shared/output-unicode.js +2 -0
  123. package/dist/core/store/item-store.js +1 -1
  124. package/dist/core/store/settings-validator.d.ts +1 -0
  125. package/dist/core/store/settings-validator.js +1 -1
  126. package/dist/core/store/settings.js +1 -1
  127. package/dist/core/telemetry/policy.d.ts +8 -0
  128. package/dist/core/telemetry/policy.js +1 -1
  129. package/dist/core/telemetry/runtime.js +3 -3
  130. package/dist/sdk/agent/command-recovery.d.ts +15 -0
  131. package/dist/sdk/agent/command-recovery.js +1 -1
  132. package/dist/sdk/cli-bootstrap.js +1 -1
  133. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +28 -0
  134. package/dist/sdk/cli-contracts/agent-output-contracts.js +2 -2
  135. package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
  136. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  137. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  138. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  139. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
  140. package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
  141. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  142. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  143. package/dist/sdk/cli-contracts.d.ts +1 -1
  144. package/dist/sdk/cli-contracts.js +1 -1
  145. package/dist/sdk/completion/fish.js +4 -4
  146. package/dist/sdk/completion/zsh.js +3 -3
  147. package/dist/sdk/config.d.ts +1 -0
  148. package/dist/sdk/config.js +1 -1
  149. package/dist/sdk/core.d.ts +1 -0
  150. package/dist/sdk/core.js +1 -1
  151. package/dist/sdk/error-runtime.d.ts +9 -0
  152. package/dist/sdk/error-runtime.js +1 -1
  153. package/dist/sdk/errors.js +1 -1
  154. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  155. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  156. package/dist/sdk/index.d.ts +2 -2
  157. package/dist/sdk/index.js +1 -1
  158. package/dist/sdk/item-transaction.d.ts +33 -2
  159. package/dist/sdk/item-transaction.js +1 -1
  160. package/dist/sdk/lifecycle/append.js +1 -1
  161. package/dist/sdk/lifecycle/claim.js +1 -1
  162. package/dist/sdk/lifecycle/cli-input.d.ts +4 -0
  163. package/dist/sdk/lifecycle/cli-input.js +2 -0
  164. package/dist/sdk/lifecycle/close.js +1 -1
  165. package/dist/sdk/lifecycle/create.js +1 -1
  166. package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -1
  167. package/dist/sdk/lifecycle/plan.d.ts +2 -3
  168. package/dist/sdk/lifecycle/plan.js +1 -1
  169. package/dist/sdk/lifecycle/reopen.js +1 -1
  170. package/dist/sdk/lifecycle/repeated-terminal-state.d.ts +45 -0
  171. package/dist/sdk/lifecycle/repeated-terminal-state.js +2 -0
  172. package/dist/sdk/lifecycle/shared-unset-fields.d.ts +9 -0
  173. package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
  174. package/dist/sdk/lifecycle/update-many.d.ts +0 -1
  175. package/dist/sdk/lifecycle/update-many.js +1 -1
  176. package/dist/sdk/lifecycle/update.d.ts +29 -1
  177. package/dist/sdk/lifecycle/update.js +2 -2
  178. package/dist/sdk/output/table-rows.d.ts +15 -1
  179. package/dist/sdk/output/table-rows.js +1 -1
  180. package/dist/sdk/output.d.ts +1 -0
  181. package/dist/sdk/output.js +2 -2
  182. package/dist/sdk/ownership-source.d.ts +18 -0
  183. package/dist/sdk/ownership-source.js +1 -1
  184. package/dist/sdk/public-surface.json +1 -1
  185. package/dist/sdk/query/get.d.ts +1 -1
  186. package/dist/sdk/query/get.js +1 -1
  187. package/dist/sdk/query/history.d.ts +2 -0
  188. package/dist/sdk/query/history.js +1 -1
  189. package/dist/sdk/query/next-ranking-policy.d.ts +35 -0
  190. package/dist/sdk/query/next-ranking-policy.js +2 -0
  191. package/dist/sdk/query/next.d.ts +12 -2
  192. package/dist/sdk/query/next.js +2 -2
  193. package/dist/sdk/query/projection-contracts.d.ts +4 -0
  194. package/dist/sdk/query/projection-contracts.js +1 -1
  195. package/dist/sdk/read-output/surfaces.d.ts +27 -0
  196. package/dist/sdk/read-output/surfaces.js +2 -0
  197. package/dist/sdk/read-output-contracts.js +1 -1
  198. package/dist/sdk/runtime/mutation-value-validation.d.ts +16 -0
  199. package/dist/sdk/runtime/mutation-value-validation.js +2 -0
  200. package/dist/sdk/runtime-input.js +1 -1
  201. package/dist/sdk/runtime-primitives.d.ts +2 -0
  202. package/dist/sdk/runtime-primitives.js +1 -1
  203. package/dist/sdk/runtime.d.ts +14 -0
  204. package/dist/sdk/runtime.js +1 -1
  205. package/dist/sdk/structured-mutations.js +1 -1
  206. package/dist/sdk/test/execution-receipts.d.ts +25 -0
  207. package/dist/sdk/test/execution-receipts.js +2 -2
  208. package/dist/sdk/test/execution.d.ts +5 -0
  209. package/dist/sdk/test/execution.js +2 -2
  210. package/dist/sdk/workspace-transaction-gc.js +1 -1
  211. package/dist/sdk/workspace-transaction.d.ts +54 -0
  212. package/dist/sdk/workspace-transaction.js +2 -2
  213. package/dist/types.d.ts +2 -0
  214. package/dist/types.js +1 -1
  215. package/docs/AGENT_GUIDE.md +1 -1
  216. package/docs/AGENT_OUTPUT_ENCODINGS.md +12 -0
  217. package/docs/AGENT_UX_CONTRACTS.md +2 -1
  218. package/docs/COMMANDS.md +73 -15
  219. package/docs/CONFIGURATION.md +48 -1
  220. package/docs/DEVELOPMENT_DEPENDENCY_SECURITY.md +26 -0
  221. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +24 -2
  222. package/docs/PACKED_FIRST_RUN.md +2 -1
  223. package/docs/READ_OUTPUT_CONTRACTS.md +24 -6
  224. package/docs/SDK.md +207 -11
  225. package/docs/TESTING.md +46 -2
  226. package/docs/agent-task-token-baseline.json +1 -1
  227. package/docs/generated/FLAG_LEXICON_BUDGETS.md +1 -1
  228. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +6 -3
  229. package/marketplace.json +1 -1
  230. package/package.json +1 -1
  231. package/packages/pm-beads/package.json +1 -1
  232. package/packages/pm-calendar/extensions/calendar/index.ts +1 -0
  233. package/packages/pm-calendar/package.json +1 -1
  234. package/packages/pm-command-kit/package.json +1 -1
  235. package/packages/pm-digital-twin/package.json +1 -1
  236. package/packages/pm-governance-audit/package.json +1 -1
  237. package/packages/pm-guide-shell/package.json +1 -1
  238. package/packages/pm-kanban/package.json +1 -1
  239. package/packages/pm-lifecycle-hooks/package.json +1 -1
  240. package/packages/pm-linked-test-adapters/package.json +1 -1
  241. package/packages/pm-search-advanced/package.json +1 -1
  242. package/packages/pm-templates/package.json +1 -1
  243. package/packages/pm-todos/package.json +1 -1
  244. package/packages/pm-vcs/package.json +1 -1
  245. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  246. package/plugins/pm-claude/package.json +1 -1
  247. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  248. package/plugins/pm-codex/package.json +1 -1
  249. package/plugins/pm-codex/plugin.json +1 -1
  250. package/runtime-dependencies.json +1 -1
  251. package/dist/cli-bundle/chunks/chunk-2J7I54MQ.js +0 -2
  252. package/dist/cli-bundle/chunks/chunk-3KMYHYJV.js +0 -2
  253. package/dist/cli-bundle/chunks/chunk-4D25HF3V.js +0 -2
  254. package/dist/cli-bundle/chunks/chunk-7V37RC2L.js +0 -114
  255. package/dist/cli-bundle/chunks/chunk-AHVN4GHF.js +0 -31
  256. package/dist/cli-bundle/chunks/chunk-CS7QDSUX.js +0 -128
  257. package/dist/cli-bundle/chunks/chunk-CXUQEZDX.js +0 -8
  258. package/dist/cli-bundle/chunks/chunk-DKLEDWVW.js +0 -3
  259. package/dist/cli-bundle/chunks/chunk-E5QBZ4HI.js +0 -8
  260. package/dist/cli-bundle/chunks/chunk-JESLOJD7.js +0 -2
  261. package/dist/cli-bundle/chunks/chunk-PQLRKFPZ.js +0 -20
  262. package/dist/cli-bundle/chunks/chunk-SGFQQXFD.js +0 -2
  263. package/dist/cli-bundle/chunks/chunk-XHONSCLJ.js +0 -6
  264. package/dist/cli-bundle/chunks/chunk-ZX3XMTZG.js +0 -2
  265. package/dist/cli-bundle/chunks/register-mutation-SN425O3R.js +0 -20
  266. package/dist/cli-bundle/chunks/register-operations-EYUIUGPW.js +0 -2
  267. package/dist/cli-bundle/focused-chunks/chunk-3EHVI673.js +0 -2
  268. package/dist/cli-bundle/focused-chunks/chunk-46WLWK73.js +0 -2
  269. package/dist/cli-bundle/focused-chunks/chunk-6L4KKRK7.js +0 -26
  270. package/dist/cli-bundle/focused-chunks/chunk-6VDRAJYX.js +0 -2
  271. package/dist/cli-bundle/focused-chunks/chunk-B4ZQJEMT.js +0 -6
  272. package/dist/cli-bundle/focused-chunks/chunk-BZSACRVX.js +0 -91
  273. package/dist/cli-bundle/focused-chunks/chunk-F6UQJJYB.js +0 -2
  274. package/dist/cli-bundle/focused-chunks/chunk-L5GX2FGZ.js +0 -2
  275. package/dist/cli-bundle/focused-chunks/chunk-LPWZERVD.js +0 -12
  276. package/dist/cli-bundle/focused-chunks/chunk-OASYSUOH.js +0 -22
  277. package/dist/cli-bundle/focused-chunks/chunk-QUPGBO2L.js +0 -26
  278. package/dist/cli-bundle/focused-chunks/chunk-Z26ZPQH6.js +0 -3
@@ -0,0 +1,2 @@
1
+ import{B as ke,C as Me,E as W,H as Re,J as Ie,K as Ce,M as Ne,a as Oe,p as J}from"./chunk-AFVN2KCP.js";import"./chunk-4QPGJO2G.js";import"./chunk-WHIE2C6Q.js";import{A as Ae,B as L,C as Te,y as k,z as K}from"./chunk-HPWT3RBG.js";import"./chunk-QFMJGQGO.js";import"./chunk-DFUTCKUF.js";import"./chunk-JNKRUCVZ.js";import"./chunk-Y6UYRMVG.js";import"./chunk-SVOOGGAK.js";import"./chunk-KH5QJXY7.js";import{N as we,Q as ge}from"./chunk-6F6APBCX.js";import"./chunk-NRBUMDLF.js";import"./chunk-SFQKCA5K.js";import{Ea as $e}from"./chunk-EA65HVBO.js";import"./chunk-PFBQOZPK.js";import{v as x}from"./chunk-NOKG4RFN.js";import"./chunk-2J7T2UCH.js";import{fa as pe,la as le}from"./chunk-HSAEEWSI.js";import"./chunk-KKRIFBSL.js";import"./chunk-GHQVM6K6.js";import{J as Ee,h as q,t as $}from"./chunk-5MCGYBOQ.js";import{$a as be,E as ve,Sa as _e,Wa as Se,da as S,oa as T,sa as G}from"./chunk-57HPXGOQ.js";import"./chunk-PC3R5CJV.js";import{c as me,e as F,f as fe,i as he}from"./chunk-MW77Q3AQ.js";import"./chunk-4PW5XWVI.js";import"./chunk-AK2CI2GI.js";import{Fa as ue,qa as D,rc as ye,sc as P,xa as de}from"./chunk-GP2WU43K.js";import"./chunk-EGN2HFRU.js";import"./chunk-FOA7XKWP.js";import{A as l,E as j,G as ce,H as O,l as oe,q as E,s as ae,x as se,z as m}from"./chunk-JLXGRDTG.js";import X from"node:crypto";import{constants as V}from"node:fs";import{cp as nt,lstat as Fe,mkdir as rt,mkdtemp as Pe,open as it,readdir as ot,realpath as xe,rm as Ge,stat as Z,writeFile as qe}from"node:fs/promises";import{tmpdir as Ke}from"node:os";import d from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="01728cbc-2037-50d2-8318-5f106714b8da")}catch{}})();var He=new Set(["id","title","description","type","status","priority","tags","body","deadline","estimated_minutes","acceptance_criteria","definition_of_ready","order","rank","assignee",...oe,"affected_version","fixed_version","component","regression","customer_impact","close_reason","completed_at","dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"]);(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6456f85b-e076-5048-9c21-03d477267259")}catch{}})();function z(e,t,r){let n=e?.estimatedMinutes;if(!(n===void 0||typeof n=="string"))throw new l(`Mutation ${r+1} ${t} option "estimatedMinutes" must be a string.`,m.USAGE,{code:"mutation_option_value_invalid",required:'Pass estimatedMinutes as a string, for example "45", in raw mutation options.',why:"Raw options use the create/update command option types; item documents accept numeric estimated_minutes instead.",nextSteps:["Quote the estimatedMinutes value or use an item document with numeric estimated_minutes, then retry the transaction."]})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9261d364-cb6c-5442-9ad0-41d0aefa8184")}catch{}})();var Xe=["op","id","reason","options","unique","match"],Ze=[...Xe,"ref"],en=[...Ze,"item"];var je="[a-z][a-z0-9._-]{0,63}",tn=new RegExp(`^${je}$`,"u"),nn=new RegExp(`(^|,)id=@(${je})(?=,|$)`,"gu"),Ue=e=>e.slice(2).replaceAll(/-([a-z])/gu,(t,r)=>r.toUpperCase());var Qe=new Set(["created_at","updated_at","closed_at","version","format_version","path","author","collection_counts","notes_count","tests_count"]),rn=new Set([...Qe,"completed_at","id"]),on={create:we.map(e=>e.target),update:ge.map(e=>e.target),close:pe.map(e=>Ue(e.flag)).filter(e=>e!=="reason"),release:le.map(e=>Ue(e.flag))};function et(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function tt(e,t){return e<t?-1:+(e!==t)}function B(e){return Array.isArray(e)?e.map(B):et(e)?Object.fromEntries(Object.entries(e).sort(([t],[r])=>tt(t,r)).map(([t,r])=>[t,B(r)])):e}function v(e){return typeof e=="string"?e.trim():JSON.stringify(B(e))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="49806fc6-ff49-5b67-9b3f-c182ace00c20")}catch{}})();async function at(e,t){if(!Se(e))return{schema:F(t.schema),typeDefinitionsFromFile:[]};let r=await gt(e,t.schema);return{schema:r.schema,typeDefinitionsFromFile:r.type_definitions_from_file??[]}}async function st(e,t,r,n){let i=D({...t,item_types:{...t.item_types,definitions:[...t.item_types?.definitions??[],...r.typeDefinitionsFromFile]}},P());return(await Ee(e,t.item_format,i.type_to_folder,void 0,r.schema)).flatMap(a=>{let o=a[n];return o==null?[]:[{id:a.id,value:o}]})}function Q(e){let t=new Map,r=async n=>{let i=await be(e),a=await at(e,i),o=new Map;for(let s of await st(e,i,a,n)){let c=v(s.value);o.set(c,[...o.get(c)??[],s.id])}return o};return{lookup(n){let i=t.get(n)??r(n);return t.set(n,i),i},async recordCreate(n){for(let[i,a]of t){let o=n[i];if(o==null)continue;let s=await a,c=v(o);s.set(c,[...s.get(c)??[],String(n.id)])}},invalidate(){t.clear()}}}async function ct(e,t){let r=v(t.value),n=(await e.lookup(t.key)).get(r)??[];if(n.length!==0)throw new l(`Upsert key "${t.key}" value ${JSON.stringify(r)} now matches existing item ${n.join(", ")}; the plan was resolved before it existed.`,m.CONFLICT,{code:"upsert_key_conflict",required:"Re-plan the document so the row updates the existing item instead of creating a duplicate.",why:"Keyed upsert is resolved before the writer lock, so every remaining create is re-checked under the lock; concurrent imports therefore cannot create two items for one key value.",nextSteps:["Re-run pm item mutate with the same document and --upsert-key; the re-plan turns the row into an update of the existing item.","Inspect the existing item first when its content should win over the document row."]})}function dt(e,t,r){let n=e.metadata[r.key],i=v(r.value);if(v(n)!==i)throw new l(`Item ${t} no longer carries upsert key "${r.key}" value ${JSON.stringify(i)}; the plan selected it before the key changed.`,m.CONFLICT,{code:"upsert_match_changed",required:"Re-plan the document so the row is resolved against the current key values.",why:"Keyed upsert selects its target before the writer lock, so the update re-reads the key under the lock instead of updating a mismatched item blindly.",nextSteps:["Re-run pm item mutate with the same document and --upsert-key; the re-plan creates or re-targets the row from the current key values."]})}function De(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.key=="string"&&t.key.trim().length>0&&t.value!==void 0&&t.value!==null}function C(e,t){let r={...e,...t};return e===void 0?r:x(e,r)}async function g(e,t){try{let r=(await J(t,{},{pmRoot:e})).item;return{id:r.id,closedAt:r.closed_at,updatedAt:r.updated_at,assignee:r.assignee,claimPrincipal:r.claim_principal}}catch(r){if(r instanceof l&&r.exitCode===m.NOT_FOUND)return;throw r}}function ee(e,t){let r=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_"),n=X.createHash("sha256").update(ue(e)).digest("hex").slice(0,12);return`${t+1}-${e.op}-${r}-${n}`}function ut(e,t){let r=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_");return`${t+1}-${e.op}-${r}`}function h(e,t,r){return`bulk-item-transaction ${e} ${t} ${r}`}async function A(e,t,r,n){let i=await S(d.join(e,"history",`${t}.jsonl`),t),a=h(r,n,"apply"),o=h(r,n,"compensate");for(let s=i.length-1;s>=0;s-=1){let c=i[s].message;if(c===a)return!0;if(c===o)return!1}return!1}async function te(e,t){let r=await g(e,t.id);if(r?.updatedAt===void 0)throw new l(`Bulk ${t.op} target ${t.id} does not exist or has no restorable version`,m.NOT_FOUND);let n=await S(d.join(e,"history",`${r.id}.jsonl`),r.id);if(n.length===0)throw new l(`Bulk ${t.op} target ${t.id} has no restorable history`,m.NOT_FOUND);return{target_updated_at:r.updatedAt,target_version:String(q(n)+n.length),target_history_hash:T(n),target_history_length:n.length}}function b(e,t,r){return new l(`Transaction ${e.transactionId} cannot safely compensate incomplete step ${r}; review item ${t} history before recovery.`,m.CONFLICT,{code:"transaction_partial_mutation",item_id:t,required:"Reconcile the item's partial or intervening changes before resuming this transaction.",why:"The retained history does not prove exclusive ownership of the changes to undo. The journal remains compensating instead of claiming a rollback or overwriting another writer.",nextSteps:[`Run pm history ${t} and inspect this transaction's retained compensation data before explicitly restoring or reconciling the item.`]})}function Le(e,t){let r=`bulk-item-transaction ${t} `;return[e.message,e.context?.item_transaction_step].some(n=>typeof n=="string"&&n.startsWith(r))}function pt(e,t,r){let{expectedHistory:n,length:i,version:a}=t;if(T(e)===n)return!1;if(typeof i!="number"||!Number.isSafeInteger(i)||i<1||T(e.slice(0,i))!==n||a!==String(q(e)+i))throw b(r,r.itemId,r.stepId);let o=h(r.transactionId,r.stepId,"apply"),s=e.slice(i),c=p=>p.message===o||p.context?.item_transaction_step===o,u=h(r.transactionId,r.stepId,"compensate");if(s.filter(p=>c(p)||p.message===u).at(-1)?.message===u)return!1;let f=s.filter(c);if(f.length===0)return!1;let _=e.at(-1).after_hash===f.at(-1).after_hash&&s.every(p=>Le(p,r.transactionId));if(f.length!==s.length&&!_)throw b(r,r.itemId,r.stepId);return!0}async function N(e,t,r,n){let i=n!==null&&typeof n=="object"&&!Array.isArray(n)?n:void 0;if(i===void 0||typeof i.target_updated_at!="string")return;let a=i.target_updated_at,o=await g(e.pmRoot,t);if(o===void 0)return;let s=await S(d.join(e.pmRoot,"history",`${o.id}.jsonl`),o.id),c=i.target_history_hash;if(typeof c=="string"){if(!pt(s,{expectedHistory:c,length:i.target_history_length,version:i.target_version},{...e,itemId:o.id,stepId:r}))return}else{if(o.updatedAt===a)return;if(!await A(e.pmRoot,o.id,e.transactionId,r))throw b(e,o.id,r)}let u=()=>Ce(t,typeof i.target_version=="string"?i.target_version:a,{force:!0,author:e.author,message:h(e.transactionId,r,"compensate")},{pmRoot:e.pmRoot});await $({pmRoot:e.pmRoot,id:o.id,validate:f=>{if(G(f)!==s.at(-1).after_hash)throw b(e,o.id,r)}},u)}function Je(e,t,r){return{id:r,async inspect(){let n=await g(e.pmRoot,t.id);if(n===void 0)return{state:"pending"};if(n.closedAt!==void 0){let i=await S(d.join(e.pmRoot,"history",`${n.id}.jsonl`),n.id),a=`Compensated: interrupted bulk transaction ${e.transactionId}`;if(i.filter(o=>o.op==="close").at(-1)?.patch.some(o=>o.op==="add"||o.op==="replace"?o.path==="/metadata/close_reason"&&o.value===a:!1)??!1)throw new l(`Created item ${n.id} remains closed by transaction compensation; explicitly reopen or reconcile it before retrying.`,m.CONFLICT,{code:"transaction_create_compensated",item_id:n.id,required:"Review the compensated item and explicitly reopen it before retrying the same document.",why:"This item's latest closure belongs to transaction compensation. Automatically reopening it could overwrite later lifecycle decisions.",nextSteps:[`Run pm item reopen ${n.id} "Retry compensated creation" after reviewing its history, then retry the transaction.`]})}return{state:"applied",result:{id:n.id,op:"create"}}},async apply(){t.unique!==void 0&&await ct(e.uniqueIndex,t.unique);let n=await ke(C(t.options,{author:e.author,id:t.id,message:h(e.transactionId,r,"apply")}),{pmRoot:e.pmRoot}),i=n.item;return e.onCreateWarnings?.(String(i.id),n.warnings),await e.uniqueIndex.recordCreate(i),{id:String(i.id),op:"create"}},async compensate(){await lt(e,t.id,r)}}}async function lt(e,t,r){let n=await g(e.pmRoot,t);if(n===void 0||e.createCompensation==="close"&&n.closedAt!==void 0)return;let i=await S(d.join(e.pmRoot,"history",`${n.id}.jsonl`),n.id),a=h(e.transactionId,r,"apply"),o=h(e.transactionId,r,"compensate"),s=i.filter(c=>c.message===a||c.message===o).at(-1);if(s?.message!==o){if(s===void 0||!i.every(c=>Le(c,e.transactionId)))throw b(e,n.id,r);await $({pmRoot:e.pmRoot,id:n.id,validate:c=>{if(G(c)!==i.at(-1).after_hash)throw b(e,n.id,r)}},async()=>{let c={force:!0,author:e.author,message:o};e.createCompensation==="delete"?await Ie(t,c,{pmRoot:e.pmRoot}):await W(t,`Compensated: interrupted bulk transaction ${e.transactionId}`,c,{pmRoot:e.pmRoot})})}}function mt(e,t,r){return{id:r,compensatePending:!0,async inspect(){let n=await g(e.pmRoot,t.id);return n===void 0?{state:"pending"}:await A(e.pmRoot,n.id,e.transactionId,r)?{state:"applied",result:{id:n.id,op:"update"}}:{state:"pending"}},async prepareCompensation(){return te(e.pmRoot,t)},async apply(){let n=()=>Me(t.id,C(t.options,{author:e.author,message:h(e.transactionId,r,"apply")}),{pmRoot:e.pmRoot}),i=t.match,a=i,o=(await $({pmRoot:e.pmRoot,id:String((await J(t.id,{},{pmRoot:e.pmRoot})).item.id),validate:s=>{a!==void 0&&dt(s,t.id,a)},committed:s=>{i!==void 0&&(a={key:i.key,value:structuredClone(s.metadata[i.key])})},historyContext:{item_transaction_step:h(e.transactionId,r,"apply")}},n)).item;return e.uniqueIndex.invalidate(),{id:String(o.id),op:"update"}},async compensate(n){await N(e,t.id,r,n)}}}function ft(e,t,r){return{id:r,async inspect(){let n=await g(e.pmRoot,t.id);return n===void 0?{state:"pending"}:await A(e.pmRoot,n.id,e.transactionId,r)?{state:"applied",result:{id:n.id,op:"close"}}:n.closedAt===void 0?{state:"pending"}:{state:"applied",result:{id:n.id,op:"close"}}},async prepareCompensation(){return te(e.pmRoot,t)},async apply(){let n=(await W(t.id,t.reason,C(t.options,{author:e.author,message:h(e.transactionId,r,"apply")}),{pmRoot:e.pmRoot})).item;return e.uniqueIndex.invalidate(),{id:String(n.id),op:"close"}},async compensate(n){await N(e,t.id,r,n)}}}function ht(e,t,r){return{id:r,async inspect(){let n=await g(e.pmRoot,t.id);return n===void 0?{state:"pending"}:await A(e.pmRoot,n.id,e.transactionId,r)?{state:"applied",result:{id:n.id,op:"release"}}:n.assignee!==void 0||n.claimPrincipal!==void 0?{state:"pending"}:{state:"applied",result:{id:n.id,op:"release"}}},async prepareCompensation(){return te(e.pmRoot,t)},async apply(){let n=(await Re(t.id,C(t.options,{author:e.author,message:h(e.transactionId,r,"apply")}),{pmRoot:e.pmRoot})).item;return e.uniqueIndex.invalidate(),{id:String(n.id),op:"release"}},async compensate(n){await N(e,t.id,r,n)}}}function ne(e,t,r){let n=ee(t,r);switch(t.op){case"create":return Je(e,t,n);case"update":return mt(e,t,n);case"close":return ft(e,t,n);case"release":return ht(e,t,n)}}function yt(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`Bulk mutation ${t+1} must be an object`);if(!["create","update","close","release"].includes(e.op))throw new TypeError(`Bulk mutation ${t+1} op must be create, update, close, or release`);if(typeof e.id!="string"||e.id.trim().length===0)throw new TypeError(`Bulk mutation ${t+1} requires a non-empty id`);if(e.op==="close"&&(typeof e.reason!="string"||e.reason.trim().length===0))throw new TypeError(`Bulk close mutation ${t+1} requires a non-empty reason`);if(e.op==="create"&&e.unique!==void 0&&!De(e.unique))throw new TypeError(`Bulk create mutation ${t+1} unique must be an object with a non-empty key and a value`);if(e.op==="update"&&e.match!==void 0&&!De(e.match))throw new TypeError(`Bulk update mutation ${t+1} match must be an object with a non-empty key and a value`);z(e.options,e.op,t)}function We(e){if(e.length===0)throw new TypeError("Bulk item transaction requires at least one mutation");let t=new Map;for(let[r,n]of e.entries()){if(yt(n,r),n.op!=="create"||n.unique===void 0)continue;let{key:i,value:a}=n.unique,o=t.get(i)??new Map,s=v(a),c=o.get(s);if(c!==void 0)throw new l(`Bulk create mutations ${c+1} and ${r+1} share the upsert key value ${JSON.stringify(s)} for "${i}".`,m.USAGE,{code:"upsert_key_duplicate",required:"Each create must carry a distinct unique key value within one batch.",why:"Direct SDK batches must preserve the same uniqueness invariant as planned document rows."});o.set(s,r),t.set(i,o)}}function ze(e){let t=[...e];return We(t),t.map(r=>{let n=structuredClone(r);return r.options!==void 0&&n.options!==void 0&&x(r.options,n.options),n})}function Be(e,t=""){return e===null||typeof e!="object"?[]:Object.entries(e).flatMap(([r,n])=>{let i=`${t}/${r.replaceAll("~","~0").replaceAll("/","~1")}`;return/^(created_at|updated_at|closed_at|completed_at|timestamp)$/u.test(r)?[i]:Be(n,i)})}async function Y(e,t,r){try{return await r()}catch(n){throw n instanceof l?new l(n.message,n.exitCode,{...n.context,transaction_operation:{index:t,op:e.op,id:e.id}}):n}}function Ve(e,t,r,n){let i=d.relative(e,t),a=i.split(d.sep);return a[0]==="extensions"&&a[2]==="node_modules"&&!n.some(o=>i===o||i.startsWith(`${o}${d.sep}`)||o.startsWith(`${i}${d.sep}`))?!1:["locks","runtime","search"].includes(i.split(d.sep)[0])?n.some(o=>i===o||i.startsWith(`${o}${d.sep}`)||o.startsWith(`${i}${d.sep}`)):i===""||r===void 0||r.some(o=>i===o||i.startsWith(`${o}${d.sep}`)||o.startsWith(`${i}${d.sep}`))}async function R(e,t){let r=await Fe(t);if(r.isSymbolicLink())await Z(t);else if(r.isDirectory()||r.isFile())return r;throw O(d.relative(e,t))}async function wt(e,t){let r=await it(t,V.O_RDONLY|V.O_NOFOLLOW|V.O_NONBLOCK);try{let n=await r.stat();if(!n.isFile())throw O(d.relative(e,t));let i=X.createHash("sha256");if(n.size>0)for await(let a of r.createReadStream({highWaterMark:64*1024,end:n.size-1,autoClose:!1}))i.update(a);return i.digest()}finally{await r.close()}}async function H(e,t,r){let n=X.createHash("sha256");async function i(a){for(let o of(await ot(a)).sort()){let s=d.join(a,o);Ve(e,s,t,r)&&((await R(e,s)).isDirectory()?await i(s):(n.update(JSON.stringify(d.relative(e,s))),n.update(await wt(e,s))))}}return await i(e),n.digest("hex")}function M(){return new l("Tracker changed while preparing the transaction preview; retry against stable state.",m.CONFLICT,{code:"transaction_preview_snapshot_changed"})}async function re(e){if(!j(e))return!1;let t=e.path;if(typeof t!="string")return!1;let r=d.resolve(t),n=r;for(;;)try{let i=await Fe(n);return n!==r&&i.isDirectory()}catch(i){if(!j(i))return!1;let a=d.dirname(n);if(a===n)return!1;n=a}}async function I(e,t){let r=d.join(e,t);try{let n=e;for(let i of t.split(d.sep).slice(0,-1))n=d.join(n,i),await R(e,n);if(!(await R(e,r)).isFile())throw O(t);return await ce(r,O(t))}catch(n){if(await re(n))return;throw n}}async function Ye(e,t,r,n){let i=F(r);for(let[a,o]of Object.entries(i.files)){let s=d.relative(e,fe(e,o,me[a]));if(s===""||!d.resolve(e,s).startsWith(d.join(e,d.sep)))throw new l("Transaction preview requires schema files inside the selected tracker root; relocate the configured schema file before retrying.",m.USAGE,{code:"transaction_preview_external_schema",field:`schema.files.${a}`});i.files[a]=s;let c=await I(e,s);if(n?.set(s,c),c!==void 0){let u=d.join(t,s);await rt(d.dirname(u),{recursive:!0}),await qe(u,c)}}return he(t,i)}async function gt(e,t){await Z(e);let r=await Pe(d.join(Ke(),"pm-schema-plan-"));try{let n=await xe(e);return await Ye(n,d.join(r,"configuration"),t)}catch(n){throw await re(n)?M():n}finally{await Ge(r,{recursive:!0,force:!0})}}async function vt(e,t,r){let n=new Map,i=await I(e,E);n.set(E,i);let a;try{a=JSON.parse(i??"null")}catch{a=null}let o=_e(a),s=o.success?o.data:void 0,c=await Ye(e,t,s?.schema,n),u=c.schema,f=d.relative(e,ve(e));n.set(f,await I(e,f));let _=D({...se,item_types:{definitions:[...s?.item_types?.definitions??[],...c.type_definitions_from_file??[]]}},r),p=de(e)===e?[...ae.filter(Boolean),E,Oe,"transactions",..._.folders,...n.keys()].map(w=>d.normalize(w)):void 0,y=s===void 0?void 0:JSON.stringify({...a,schema:{...s.schema,files:u.files}});return{configuration:n,ownedPaths:p,stagedSettings:y,registryFolders:_.folders}}async function _t(e,t,r){await Z(e);try{let n=await xe(e),i=await vt(n,d.join(d.dirname(t),"configuration"),r),a=[...i.configuration.keys(),...i.registryFolders].map(u=>d.normalize(u)),o=await H(n,i.ownedPaths,a);await nt(n,t,{recursive:!0,dereference:!1,filter:async u=>Ve(n,u,i.ownedPaths,a)?(await R(n,u),!0):!1});let[s,c]=await Promise.all([H(n,i.ownedPaths,a),H(t,i.ownedPaths,a)]);if(o!==s||o!==c)throw M();for(let[u,f]of i.configuration)if(await I(t,u)!==f)throw M();i.stagedSettings!==void 0&&await qe(d.join(t,E),i.stagedSettings)}catch(n){throw await re(n)?M():n}}async function jn(e){let t=k(e),r=ze(e.mutations),n=P(),i=await Pe(d.join(Ke(),"pm-transaction-preview-")),a=d.join(i,"tracker");try{await _t(t.pmRoot,a,n);let o=!1,s=[],c=[],u=new Set;return await Ne({path:a,noExtensions:!0},async()=>{ye(n);let f={...t,pmRoot:a,createCompensation:"close",uniqueIndex:Q(a)},_=r.map((p,y)=>{let w=ne({...f,onCreateWarnings:(U,ie)=>{ie.length>0&&s.push({index:y,id:U,op:"create",warnings:ie})}},p,y);return{...w,inspect:()=>Y(p,y,()=>w.inspect()),prepareCompensation:()=>Y(p,y,async()=>w.prepareCompensation?.()),apply:()=>Y(p,y,async()=>{let U=await w.apply();return u.add(y),U})}});if(await K({...t,pmRoot:a,steps:_,onTransition:({transition:p})=>{p==="committed"&&(o=!0)}}),o)for(let[p,y]of r.entries()){let w=(await $e(y.id,{path:a},{full:!0})).item;c.push({index:p,id:String(w.id),op:y.op,execution:u.has(p)?"applied":"adopted",item:w,commit_time_fields:Be(w)})}}),{records:c,validated:o,state:o?"staged_snapshot":"replayed_committed_plan",warnings:s,unresolved_commit_constraints:["concurrent_tracker_changes","extension_mutation_guards_and_hooks","derived_extension_dependencies_excluded","generated_timestamps_and_provenance"]}}finally{await Ge(i,{recursive:!0,force:!0})}}async function St(e){let t=k(e),r=ze(e.mutations),n=e.createCompensation??"close";if(!["close","delete"].includes(n))throw new TypeError("Bulk item transaction createCompensation must be close or delete");let i={...t,createCompensation:n,uniqueIndex:Q(t.pmRoot)},a=await K({...t,steps:r.map((s,c)=>ne(i,s,c)),recoveryData:JSON.parse(JSON.stringify({kind:"item-mutations-v1",mutations:r,createCompensation:n})),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}}),o={};for(let[s,c]of r.entries()){let u=ee(c,s),f=a.results[u];o[ut(c,s)]=f}return{transactionId:a.transactionId,status:"committed",recovered:a.recovered,results:o}}function bt(e){let t=[];return e.evidence!==void 0&&Object.keys(e.evidence).length>0&&t.push({op:"update",id:e.id,options:e.evidence}),t.push({op:"close",id:e.id,reason:e.reason,...e.closeOptions===void 0?{}:{options:e.closeOptions}},{op:"release",id:e.id,...e.releaseOptions===void 0?{}:{options:e.releaseOptions}}),t}function Dn(e){return St({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,mutations:bt(e),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}})}var Fn={buildCreateStep:Je,bulkHistoryMarker:h,compensateByRestore:N,deriveStepId:ee,isUpdateMarkerApplied:A,readItemSnapshot:g};async function Pn(e,t){let r=await Ae(e,t);return r===void 0?void 0:{journal:r,planDigest:L(r)}}function Et(e,t){let r=t.recoveryData;if(r===null||typeof r!="object"||Array.isArray(r)||r.kind!=="item-mutations-v1"||!Array.isArray(r.mutations)||!["close","delete"].includes(String(r.createCompensation)))throw new l("Transaction has no supported item recovery plan",m.CONFLICT,{code:"transaction_recovery_plan_missing",required:"Resume with the original plan and its original adapter.",why:"Legacy or foreign journals cannot safely reconstruct item compensation."});let n=r.mutations;We(n);let i={...e,createCompensation:r.createCompensation,uniqueIndex:Q(e.pmRoot)};return n.map((a,o)=>ne(i,a,o))}async function xn(e){let t=k(e),r=await Te({...e,...t,resolveSteps:n=>Et({...e,...t},n)});return{journal:r,planDigest:L(r)}}export{Fn as _testOnlyItemTransaction,xn as abandonItemTransaction,bt as buildItemCompletionMutations,Dn as commitItemCompletion,St as commitItemMutations,st as listUpsertKeyCandidates,gt as loadGuardedRuntimeSchema,jn as previewItemMutations,Pn as readItemTransaction,at as resolveTransactionSchema};
2
+ //# sourceMappingURL=item-transaction-LU75EG7D.js.map
@@ -1,2 +1,2 @@
1
- import{b as E,g as N}from"./chunk-L5GX2FGZ.js";import"./chunk-JTCGDODH.js";import{N as y,Q as C}from"./chunk-Z26ZPQH6.js";import"./chunk-OASYSUOH.js";import"./chunk-4GN2ZPT5.js";import{Ca as h,Ia as w}from"./chunk-46WLWK73.js";import"./chunk-BZSACRVX.js";import{_a as A,g as R}from"./chunk-IQKLJFJE.js";import"./chunk-ML5JIUM6.js";import{l as T,m as O}from"./chunk-TUN4M757.js";import"./chunk-YLVHHWHN.js";import"./chunk-AK2CI2GI.js";import{a as g,wa as _}from"./chunk-6L4KKRK7.js";import{z as f}from"./chunk-7SZPZOIC.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="d19ff816-7570-5e8a-a4de-ad2ca48f0df0")}catch{}})();function b(t,o,r,a=!1){let d=[...r].map(n=>({candidate:n,distance:g(o,n,3)})).filter(n=>n.distance!==null).sort((n,i)=>n.distance-i.distance||n.candidate.localeCompare(i.candidate))[0]?.candidate,s=a?`Put mutation fields under options (options.${o}).`:d?`Did you mean "${d}"?`:"Use the declared command options or the field option for registered item fields.";throw new f(`Unknown ${t} ${a?"argument":"option"} "${o}". ${s} No changes were made.`,2,{code:"invalid_argument_value",reason:"unknown_mutation_option",changed:!1,field:o,required:s,nextSteps:[s]})}async function j(t,o,r,a,d){if(E(o))return;let s=t==="create"?y:C,n=(t==="create"?h:w).map(({flag:e})=>e.slice(2).replace(/-([a-z])/gu,(m,v)=>v.toUpperCase())),i=new Set([...s.flatMap(e=>[e.target,...e.keys]),...n]),l=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];for(let e of["author","message","force","fullChangedFields","idOnly",...l])i.add(e);let S=new Set(["action","options","path","cwd","author","force","noExtensions","no_extensions","fullChangedFields","idOnly",...l,...d,...t==="update"?["id"]:[]]);for(let e of Object.keys(o))S.has(e)||b(t,e,i,i.has(e));let u=o.options;if(u!==void 0&&!N(u))throw new f("Mutation options must be an object. No changes were made.",2,{code:"invalid_argument_value",changed:!1});let c=[...new Set([...Object.keys(u??{}),...Object.keys(r)])].filter(e=>!i.has(e));if(c.length===0)return;let p=T((await A(_(process.cwd(),a))).schema).command_to_fields.get(t)??[];for(let e of p)i.add(O(e));for(let e of c)p.some(m=>R({[e]:!0},m)===!0)||b(t,e,i)}export{j as assertNativeMutationOptions};
2
- //# sourceMappingURL=mutation-admission-TM3SVU2O.js.map
1
+ import{g as E,l as N}from"./chunk-JNKRUCVZ.js";import"./chunk-KH5QJXY7.js";import{N as y,Q as C}from"./chunk-6F6APBCX.js";import"./chunk-NOKG4RFN.js";import"./chunk-2J7T2UCH.js";import{Ca as h,Ia as w}from"./chunk-HSAEEWSI.js";import"./chunk-5MCGYBOQ.js";import{$a as A,g as R}from"./chunk-57HPXGOQ.js";import"./chunk-PC3R5CJV.js";import{l as T,m as O}from"./chunk-MW77Q3AQ.js";import"./chunk-4PW5XWVI.js";import"./chunk-AK2CI2GI.js";import{a as g,wa as _}from"./chunk-GP2WU43K.js";import{A as f}from"./chunk-JLXGRDTG.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="d19ff816-7570-5e8a-a4de-ad2ca48f0df0")}catch{}})();function b(t,o,r,a=!1){let d=[...r].map(n=>({candidate:n,distance:g(o,n,3)})).filter(n=>n.distance!==null).sort((n,i)=>n.distance-i.distance||n.candidate.localeCompare(i.candidate))[0]?.candidate,s=a?`Put mutation fields under options (options.${o}).`:d?`Did you mean "${d}"?`:"Use the declared command options or the field option for registered item fields.";throw new f(`Unknown ${t} ${a?"argument":"option"} "${o}". ${s} No changes were made.`,2,{code:"invalid_argument_value",reason:"unknown_mutation_option",changed:!1,field:o,required:s,nextSteps:[s]})}async function j(t,o,r,a,d){if(E(o))return;let s=t==="create"?y:C,n=(t==="create"?h:w).map(({flag:e})=>e.slice(2).replace(/-([a-z])/gu,(m,v)=>v.toUpperCase())),i=new Set([...s.flatMap(e=>[e.target,...e.keys]),...n]),l=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];for(let e of["author","message","force","fullChangedFields","idOnly",...l])i.add(e);let S=new Set(["action","options","path","cwd","author","force","noExtensions","no_extensions","fullChangedFields","idOnly",...l,...d,...t==="update"?["id"]:[]]);for(let e of Object.keys(o))S.has(e)||b(t,e,i,i.has(e));let u=o.options;if(u!==void 0&&!N(u))throw new f("Mutation options must be an object. No changes were made.",2,{code:"invalid_argument_value",changed:!1});let c=[...new Set([...Object.keys(u??{}),...Object.keys(r)])].filter(e=>!i.has(e));if(c.length===0)return;let p=T((await A(_(process.cwd(),a))).schema).command_to_fields.get(t)??[];for(let e of p)i.add(O(e));for(let e of c)p.some(m=>R({[e]:!0},m)===!0)||b(t,e,i)}export{j as assertNativeMutationOptions};
2
+ //# sourceMappingURL=mutation-admission-KDJ7SCPA.js.map
@@ -1,7 +1,7 @@
1
- import{b as d}from"./chunk-EGN2HFRU.js";import{b as l}from"./chunk-FOA7XKWP.js";import{D as c,H as p,y as s,z as m}from"./chunk-7SZPZOIC.js";import{execFile as f}from"node:child_process";import{chmod as h,lstat as u}from"node:fs/promises";import{promisify as w}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5b6eab08-f707-586f-bb05-484bd9160551")}catch{}})();var y=w(f),g=`#!/bin/sh
1
+ import{b as d}from"./chunk-EGN2HFRU.js";import{b as l}from"./chunk-FOA7XKWP.js";import{A as m,E as c,I as p,z as s}from"./chunk-JLXGRDTG.js";import{execFile as f}from"node:child_process";import{chmod as h,lstat as u}from"node:fs/promises";import{promisify as w}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5b6eab08-f707-586f-bb05-484bd9160551")}catch{}})();var y=w(f),g=`#!/bin/sh
2
2
  # pm-cli:lossless-merge-settlement:v1
3
3
  `;async function I(e,t){let r=(await y("git",["rev-parse","--path-format=absolute","--git-path","hooks/pre-commit"],{cwd:e,env:l(),timeout:1e4})).stdout.trim(),o,i=!1;try{o=await d(r,65536)??"",i=process.platform==="win32"||((await u(r)).mode&73)!==0}catch(a){if(!c(a))throw a}if(o!==void 0&&!o.startsWith(g))throw new m("The pre-commit hook already exists and is not owned by pm; it was preserved.",s.CONFLICT,{code:"merge_settlement_hook_conflict",recovery:{suggested_retry:"pm merge install --dry-run"},nextSteps:["Integrate pm merge reconcile --stage into your existing hook after reviewing its policy, or keep manual settlement. pm never replaces an existing unowned hook."]});let n=`${g}merge_head=$(git rev-parse --git-path MERGE_HEAD) || exit 1
4
4
  [ -f "$merge_head" ] || exit 0
5
5
  exec ${t} merge reconcile --stage
6
6
  `;return{path:r,changed:o!==n||!i,content:n}}async function H(e){e.changed&&(await p(e.path,e.content),await h(e.path,493))}export{I as prepareMergeSettlementHook,H as writeMergeSettlementHook};
7
- //# sourceMappingURL=settlement-hook-LBVWWSCF.js.map
7
+ //# sourceMappingURL=settlement-hook-SJV52ZTV.js.map
@@ -1,2 +1,2 @@
1
- import{c as w,j as y}from"./chunk-R3EA3SDW.js";import{b as g}from"./chunk-ON5WFDCG.js";import"./chunk-GHQVM6K6.js";import"./chunk-IQKLJFJE.js";import"./chunk-TUN4M757.js";import"./chunk-YLVHHWHN.js";import{wa as h}from"./chunk-6L4KKRK7.js";import{b as u}from"./chunk-FOA7XKWP.js";import{y as d,z as f}from"./chunk-7SZPZOIC.js";import{execFile as _}from"node:child_process";import{realpath as b}from"node:fs/promises";import l from"node:path";import{promisify as x}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7f4b2fc8-c9c6-51ff-a345-b76b8abdacf4")}catch{}})();var R=x(_);function c(e){return new f(`Automatic merge settlement refused: ${e}`,d.CONFLICT,{code:"merge_settlement_review_required",recovery:{suggested_retry:"pm merge reconcile --dry-run"},nextSteps:["Inspect receipts, repair streams and Git changes. Resolve competing values or unrelated drift explicitly, then run pm merge reconcile and stage the reviewed artifacts manually."]})}async function $(e){let t=process.env.GIT_INDEX_FILE;if(t===void 0)return;let a=(await e(["rev-parse","--path-format=absolute","--git-path","index"])).stdout.trim();if(l.resolve(t)!==l.resolve(a))throw c("an alternate Git index requires explicit manual settlement")}async function I(e,t){if(t.length===0)return[];let a=t.map(s=>`:(literal)${s}`),o=new Set((await e(["ls-files","--cached","-z","--",...a])).stdout.split("\0")),i=t.filter(s=>!o.has(s)).map(s=>`:(literal)${s}`);if(i.length>0&&(await e(["diff","--cached","--name-only","--diff-filter=D","-z","--",...i])).stdout.length>0)throw c("a receipt has a staged deletion that requires explicit review");return i}async function G(e){let{git:t,preview:a,paths:o,newReceiptPathspecs:i}=e,s=!1;try{i.length>0&&(s=!0,await t(["add","--",...i]));let n=await e.apply();if(!n.ok||JSON.stringify(n.receipts.summaries)!==JSON.stringify(a.receipts.summaries)||n.repair.streams.some(p=>!a.repair.streams.some(m=>m.id===p.id)))throw c("reconciliation changed or did not finish; inspect the audit artifacts before staging");return o.length>0&&await t(["add","--",...o.map(p=>`:(literal)${p}`)]),{...n,staged_paths:o,guidance:["Lossless reconciliation artifacts are staged for the merge commit. Review git diff --cached before committing."]}}catch(n){throw s&&await t(["reset","--quiet","--",...i]),n}}function k(e){if(e.repair.totals.failed>0||e.receipts.missing_history_references_after>0||e.receipts.summaries.some(t=>t.conflict_fields.length>0)||e.repair.streams.some(t=>t.merge_receipt_proof?.trusted!==!0)||e.validation.checks.some(t=>t.name!=="history_drift"&&t.status!=="ok"))throw c("only fully authenticated receipt-backed repairs without discarded values can be staged")}async function S(e){try{return{...e,path:await b(h(process.cwd(),e.path))}}catch{throw c("the tracker root cannot be resolved")}}async function F(e){let{preview:t}=e;k(t);let{path:a}=await S(e.global),o=await w(a);if(o===null)throw c("a Git workspace is required");let i=r=>R("git",r,{cwd:o,env:u(),timeout:1e4});if(await $(i),(await i(["ls-files","--unmerged","-z"])).stdout.length>0)throw c("Git still has unresolved paths");let s=[...new Set([...[...new Set([...t.repair.streams.map(r=>r.id),...t.receipts.summaries.map(r=>r.item_id)])].map(r=>l.join(a,"history",`${r}.jsonl`)),...t.receipts.summaries.map(r=>l.join(a,"merge-receipts",`${r.receipt_id}.json`))])].map(r=>l.relative(o,r).replaceAll("\\","/"));if(s.some(g))throw c("reconciliation artifacts must belong to this Git workspace");let n=await y(o,s);if(n.length>0)throw new f(`Automatic merge settlement refused: required artifacts are ignored by Git: ${n.map(r=>`${r.path} (${r.source}:${r.line}: ${r.pattern})`).join(", ")}. Remove or narrow the owning ignore rules because merge receipts must travel with the commit.`,d.CONFLICT,{code:"merge_settlement_review_required",reason:"ignored_merge_artifacts",paths:n.map(r=>r.path),nextSteps:["Remove or narrow the named ignore rules, preserve receipt and history files, then retry pm merge reconcile --stage --dry-run before applying pm merge reconcile --stage. Do not force-add ignored proof as a substitute for fixing the shared policy."]});let p=s.map(r=>`:(literal)${r}`),m=t.receipts.summaries.map(r=>l.relative(o,l.join(a,"merge-receipts",`${r.receipt_id}.json`)).replaceAll("\\","/"));if(p.length>0)try{await i(["diff","--quiet","--",...p])}catch{throw c("reconciliation paths have unstaged edits or Git cannot verify their index state")}let v=await I(i,m);return e.dryRun?{...t,staged_paths:[]}:G({...e,git:i,paths:s,newReceiptPathspecs:v})}export{S as resolveMergeSettlementGlobal,F as stageLosslessMergeReconciliation};
2
- //# sourceMappingURL=stage-7ZBRX2Q2.js.map
1
+ import{c as w,j as y}from"./chunk-QFMJGQGO.js";import{b as g}from"./chunk-DFUTCKUF.js";import"./chunk-GHQVM6K6.js";import"./chunk-57HPXGOQ.js";import"./chunk-MW77Q3AQ.js";import"./chunk-4PW5XWVI.js";import{wa as h}from"./chunk-GP2WU43K.js";import{b as u}from"./chunk-FOA7XKWP.js";import{A as f,z as d}from"./chunk-JLXGRDTG.js";import{execFile as _}from"node:child_process";import{realpath as b}from"node:fs/promises";import l from"node:path";import{promisify as x}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7f4b2fc8-c9c6-51ff-a345-b76b8abdacf4")}catch{}})();var R=x(_);function c(e){return new f(`Automatic merge settlement refused: ${e}`,d.CONFLICT,{code:"merge_settlement_review_required",recovery:{suggested_retry:"pm merge reconcile --dry-run"},nextSteps:["Inspect receipts, repair streams and Git changes. Resolve competing values or unrelated drift explicitly, then run pm merge reconcile and stage the reviewed artifacts manually."]})}async function $(e){let t=process.env.GIT_INDEX_FILE;if(t===void 0)return;let a=(await e(["rev-parse","--path-format=absolute","--git-path","index"])).stdout.trim();if(l.resolve(t)!==l.resolve(a))throw c("an alternate Git index requires explicit manual settlement")}async function I(e,t){if(t.length===0)return[];let a=t.map(s=>`:(literal)${s}`),o=new Set((await e(["ls-files","--cached","-z","--",...a])).stdout.split("\0")),i=t.filter(s=>!o.has(s)).map(s=>`:(literal)${s}`);if(i.length>0&&(await e(["diff","--cached","--name-only","--diff-filter=D","-z","--",...i])).stdout.length>0)throw c("a receipt has a staged deletion that requires explicit review");return i}async function G(e){let{git:t,preview:a,paths:o,newReceiptPathspecs:i}=e,s=!1;try{i.length>0&&(s=!0,await t(["add","--",...i]));let n=await e.apply();if(!n.ok||JSON.stringify(n.receipts.summaries)!==JSON.stringify(a.receipts.summaries)||n.repair.streams.some(p=>!a.repair.streams.some(m=>m.id===p.id)))throw c("reconciliation changed or did not finish; inspect the audit artifacts before staging");return o.length>0&&await t(["add","--",...o.map(p=>`:(literal)${p}`)]),{...n,staged_paths:o,guidance:["Lossless reconciliation artifacts are staged for the merge commit. Review git diff --cached before committing."]}}catch(n){throw s&&await t(["reset","--quiet","--",...i]),n}}function k(e){if(e.repair.totals.failed>0||e.receipts.missing_history_references_after>0||e.receipts.summaries.some(t=>t.conflict_fields.length>0)||e.repair.streams.some(t=>t.merge_receipt_proof?.trusted!==!0)||e.validation.checks.some(t=>t.name!=="history_drift"&&t.status!=="ok"))throw c("only fully authenticated receipt-backed repairs without discarded values can be staged")}async function S(e){try{return{...e,path:await b(h(process.cwd(),e.path))}}catch{throw c("the tracker root cannot be resolved")}}async function F(e){let{preview:t}=e;k(t);let{path:a}=await S(e.global),o=await w(a);if(o===null)throw c("a Git workspace is required");let i=r=>R("git",r,{cwd:o,env:u(),timeout:1e4});if(await $(i),(await i(["ls-files","--unmerged","-z"])).stdout.length>0)throw c("Git still has unresolved paths");let s=[...new Set([...[...new Set([...t.repair.streams.map(r=>r.id),...t.receipts.summaries.map(r=>r.item_id)])].map(r=>l.join(a,"history",`${r}.jsonl`)),...t.receipts.summaries.map(r=>l.join(a,"merge-receipts",`${r.receipt_id}.json`))])].map(r=>l.relative(o,r).replaceAll("\\","/"));if(s.some(g))throw c("reconciliation artifacts must belong to this Git workspace");let n=await y(o,s);if(n.length>0)throw new f(`Automatic merge settlement refused: required artifacts are ignored by Git: ${n.map(r=>`${r.path} (${r.source}:${r.line}: ${r.pattern})`).join(", ")}. Remove or narrow the owning ignore rules because merge receipts must travel with the commit.`,d.CONFLICT,{code:"merge_settlement_review_required",reason:"ignored_merge_artifacts",paths:n.map(r=>r.path),nextSteps:["Remove or narrow the named ignore rules, preserve receipt and history files, then retry pm merge reconcile --stage --dry-run before applying pm merge reconcile --stage. Do not force-add ignored proof as a substitute for fixing the shared policy."]});let p=s.map(r=>`:(literal)${r}`),m=t.receipts.summaries.map(r=>l.relative(o,l.join(a,"merge-receipts",`${r.receipt_id}.json`)).replaceAll("\\","/"));if(p.length>0)try{await i(["diff","--quiet","--",...p])}catch{throw c("reconciliation paths have unstaged edits or Git cannot verify their index state")}let v=await I(i,m);return e.dryRun?{...t,staged_paths:[]}:G({...e,git:i,paths:s,newReceiptPathspecs:v})}export{S as resolveMergeSettlementGlobal,F as stageLosslessMergeReconciliation};
2
+ //# sourceMappingURL=stage-R4KEBO37.js.map