@unbrained/pm-cli 2026.8.4 → 2026.8.5

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 (214) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +39 -13
  3. package/dist/cli/error-guidance.js +4 -4
  4. package/dist/cli/register-structured-mutation.d.ts +2 -0
  5. package/dist/cli/register-structured-mutation.js +124 -12
  6. package/dist/cli-bundle/bundle-manifest.json +407 -407
  7. package/dist/cli-bundle/chunks/append-VXXGOXSG.js +2 -0
  8. package/dist/cli-bundle/chunks/{chunk-QVO3VTA4.js → chunk-2WFXWAYX.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-NM5G7RLU.js → chunk-3FTILRJ2.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-VH2EAGUG.js → chunk-42E7YPLG.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-RB65T4RX.js → chunk-43HQQI6S.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-J4EPW4GT.js → chunk-45G53IU4.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-PQXEB7W4.js → chunk-4VN6GS4U.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-4YUBDMQM.js +2 -0
  15. package/dist/cli-bundle/chunks/{chunk-D2MBVMVE.js → chunk-54FNT7U2.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-NRDKVOUE.js → chunk-5ZBOIPGP.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-3XZYTRPC.js → chunk-6MSQJOTG.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-GOICHIX4.js → chunk-7A5OT5J2.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-HTYC76A4.js → chunk-7C4PTJG6.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-BKMZTZYL.js → chunk-A62CYISG.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-5H47J5FG.js → chunk-BPELKUQD.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-HE3DZFN4.js → chunk-BXQLRKWF.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-BLINBTMX.js → chunk-CSI3WS5I.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-KH4GVBMC.js → chunk-DXDREUXT.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-KIKLF2W4.js → chunk-E2RKBKWB.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-377OOXUF.js → chunk-EGJ4JTUG.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-SULWTPQO.js → chunk-FPBQHMFT.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-V5K52PYW.js → chunk-GE4KCSZP.js} +35 -35
  29. package/dist/cli-bundle/chunks/{chunk-NPUJ7OLK.js → chunk-HNFD72UK.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-QMWUL66F.js → chunk-HWRRMBJO.js} +5 -5
  31. package/dist/cli-bundle/chunks/chunk-L3AZOELJ.js +2 -0
  32. package/dist/cli-bundle/chunks/{chunk-CGY5I2GO.js → chunk-LKDGK44W.js} +2 -2
  33. package/dist/cli-bundle/chunks/chunk-LN2WFEU4.js +2 -0
  34. package/dist/cli-bundle/chunks/{chunk-ZSH4GNBH.js → chunk-M72BKL5Q.js} +2 -2
  35. package/dist/cli-bundle/chunks/{chunk-HQ2WU7OY.js → chunk-MHK6LIWE.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-H6FITE7D.js → chunk-NE5VRDAI.js} +2 -2
  37. package/dist/cli-bundle/chunks/chunk-NY4T3JWN.js +2 -0
  38. package/dist/cli-bundle/chunks/{chunk-DCJ6CM6F.js → chunk-OMXVBQ2N.js} +2 -2
  39. package/dist/cli-bundle/chunks/chunk-OPVH7SKD.js +8 -0
  40. package/dist/cli-bundle/chunks/{chunk-CU5ENFNP.js → chunk-OTHLDSFP.js} +2 -2
  41. package/dist/cli-bundle/chunks/{chunk-NH35JNK5.js → chunk-PMXJEU3F.js} +2 -2
  42. package/dist/cli-bundle/chunks/{chunk-SVDH5CHC.js → chunk-Q35VBGOQ.js} +4 -4
  43. package/dist/cli-bundle/chunks/{chunk-5PZGZMPG.js → chunk-R546TPDE.js} +2 -2
  44. package/dist/cli-bundle/chunks/{chunk-Q5F6OI7C.js → chunk-RKAVWO3O.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-JMKVCQSE.js → chunk-SSF4PIUR.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-PA5XRN2A.js → chunk-UN66FZRO.js} +3 -3
  47. package/dist/cli-bundle/chunks/{chunk-FQ4EFFDU.js → chunk-UP7DTVMD.js} +2 -2
  48. package/dist/cli-bundle/chunks/{chunk-NFF3JAQR.js → chunk-UZBWIUYD.js} +2 -2
  49. package/dist/cli-bundle/chunks/{chunk-2POYGY53.js → chunk-V3774P7D.js} +2 -2
  50. package/dist/cli-bundle/chunks/{chunk-B5ZLCD5Z.js → chunk-V3EUXXOF.js} +2 -2
  51. package/dist/cli-bundle/chunks/{chunk-6S7I3UKV.js → chunk-VCKLFEUN.js} +19 -19
  52. package/dist/cli-bundle/chunks/{chunk-PYYPQLHC.js → chunk-VN5VITU3.js} +2 -2
  53. package/dist/cli-bundle/chunks/chunk-WRL4KNDL.js +20 -0
  54. package/dist/cli-bundle/chunks/{chunk-UJHUR3LZ.js → chunk-XCEZYMNI.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-JDPKBV5P.js → chunk-YEWNL576.js} +2 -2
  56. package/dist/cli-bundle/chunks/{chunk-OB7TRZ2G.js → chunk-YSO3YFZ4.js} +2 -2
  57. package/dist/cli-bundle/chunks/{chunk-UVZREFZU.js → chunk-ZYHOB3SN.js} +2 -2
  58. package/dist/cli-bundle/chunks/close-VZ3OQPN5.js +2 -0
  59. package/dist/cli-bundle/chunks/close-many-SB4TI27P.js +2 -0
  60. package/dist/cli-bundle/chunks/comments-BIF3Q4KY.js +2 -0
  61. package/dist/cli-bundle/chunks/copy-6AI5Z57X.js +2 -0
  62. package/dist/cli-bundle/chunks/{create-RLLCBCXM.js → create-XLKTXTUF.js} +2 -2
  63. package/dist/cli-bundle/chunks/delete-ZY2VHQTP.js +2 -0
  64. package/dist/cli-bundle/chunks/{deps-J4ONTF4X.js → deps-ITTY3GIC.js} +2 -2
  65. package/dist/cli-bundle/chunks/{docs-YL2DJ4WD.js → docs-W4OSRTYR.js} +2 -2
  66. package/dist/cli-bundle/chunks/{files-NGNAIYKK.js → files-EOK4AZI4.js} +2 -2
  67. package/dist/cli-bundle/chunks/focus-DLBNWL7L.js +2 -0
  68. package/dist/cli-bundle/chunks/{history-compact-HW62K5XP.js → history-compact-7UGTMLL3.js} +2 -2
  69. package/dist/cli-bundle/chunks/{history-redact-HVBKUJOW.js → history-redact-4DZRMD6Z.js} +2 -2
  70. package/dist/cli-bundle/chunks/{history-repair-OPNBH5JJ.js → history-repair-UPOSZW5R.js} +2 -2
  71. package/dist/cli-bundle/chunks/{learnings-F36PZXT6.js → learnings-GMRNCBS3.js} +2 -2
  72. package/dist/cli-bundle/chunks/{profile-N3XMWBM7.js → profile-2MUUMHRE.js} +2 -2
  73. package/dist/cli-bundle/chunks/{register-list-query-BKGHBI7Y.js → register-list-query-LR3SQ5ZF.js} +2 -2
  74. package/dist/cli-bundle/chunks/register-mutation-SUOHFVWM.js +20 -0
  75. package/dist/cli-bundle/chunks/register-operations-ARRRKOVN.js +2 -0
  76. package/dist/cli-bundle/chunks/{register-setup-KWV6UD77.js → register-setup-O6AYP6NP.js} +2 -2
  77. package/dist/cli-bundle/chunks/restore-ZVCVHTB5.js +2 -0
  78. package/dist/cli-bundle/chunks/{schema-4PJQMGUY.js → schema-FJ4EA3XF.js} +2 -2
  79. package/dist/cli-bundle/chunks/update-YHV52CSS.js +2 -0
  80. package/dist/cli-bundle/chunks/update-many-M6YHVNXM.js +2 -0
  81. package/dist/cli-bundle/focused-chunks/chunk-7J5TUBUJ.js +153 -0
  82. package/dist/cli-bundle/focused-chunks/{chunk-ONIX2KKW.js → chunk-A7BJ5SS6.js} +2 -2
  83. package/dist/cli-bundle/focused-chunks/chunk-B7LJWAZE.js +2 -0
  84. package/dist/cli-bundle/focused-chunks/{chunk-QM2BIVK7.js → chunk-BIMTMOS7.js} +3 -3
  85. package/dist/cli-bundle/focused-chunks/{chunk-BOGRY7M6.js → chunk-FGKY4MBE.js} +10 -10
  86. package/dist/cli-bundle/focused-chunks/chunk-G6ETT4QK.js +2 -0
  87. package/dist/cli-bundle/focused-chunks/{chunk-C2QSL62X.js → chunk-GJ2TG2CW.js} +2 -2
  88. package/dist/cli-bundle/focused-chunks/{chunk-RO5BQFG3.js → chunk-IPWSFADF.js} +2 -2
  89. package/dist/cli-bundle/focused-chunks/{chunk-UFCPSWIL.js → chunk-MJ7HWSFK.js} +2 -2
  90. package/dist/cli-bundle/focused-chunks/{chunk-2VIIXOAD.js → chunk-N5XU5UVK.js} +2 -2
  91. package/dist/cli-bundle/focused-chunks/chunk-PG2RIZBX.js +2 -0
  92. package/dist/cli-bundle/focused-chunks/{chunk-OYTK4VNH.js → chunk-PIMMYG7Q.js} +2 -2
  93. package/dist/cli-bundle/focused-chunks/{chunk-K37BB4JL.js → chunk-QVHKCI4T.js} +2 -2
  94. package/dist/cli-bundle/focused-chunks/{chunk-SQXVGHMH.js → chunk-RUR5I3TK.js} +2 -2
  95. package/dist/cli-bundle/focused-chunks/chunk-SV3O7TSH.js +8 -0
  96. package/dist/cli-bundle/focused-chunks/{chunk-L6A4NVQC.js → chunk-UIL2M2NA.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-WVGJAD7L.js → chunk-VLYOEYML.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/chunk-W7BJEWHX.js +2 -0
  99. package/dist/cli-bundle/focused-chunks/{chunk-DQ4PLKEE.js → chunk-WEM2E2PE.js} +2 -2
  100. package/dist/cli-bundle/focused-chunks/chunk-WVIVUWVL.js +5 -0
  101. package/dist/cli-bundle/focused-chunks/chunk-Y4LDYLLT.js +2 -0
  102. package/dist/cli-bundle/main.js +4 -4
  103. package/dist/cli-bundle/sdk-authoring.js +1 -1
  104. package/dist/cli-bundle/sdk-contracts.js +1 -1
  105. package/dist/cli-bundle/sdk-core.js +28 -28
  106. package/dist/cli-bundle/sdk-governance.js +1 -1
  107. package/dist/cli-bundle/sdk-graph.js +1 -1
  108. package/dist/cli-bundle/sdk-merge.js +1 -1
  109. package/dist/cli-bundle/sdk-query.js +1 -1
  110. package/dist/cli-bundle/sdk-runtime.js +1 -1
  111. package/dist/cli-bundle/sdk-testing.js +1 -1
  112. package/dist/cli-bundle/sdk.js +1 -1
  113. package/dist/core/extensions/loader.js +5 -2
  114. package/dist/core/item/item-format.js +14 -20
  115. package/dist/core/shared/constants.js +3 -2
  116. package/dist/core/store/item-store.js +2 -2
  117. package/dist/core/store/settings.js +2 -2
  118. package/dist/mcp/server.js +12 -6
  119. package/dist/mcp/tool-definitions.js +14 -7
  120. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +18 -18
  121. package/dist/sdk/cli-contracts/agent-output-contracts.js +51 -23
  122. package/dist/sdk/cli-contracts/commander-mutation-options.js +26 -2
  123. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  124. package/dist/sdk/cli-contracts/flag-contracts.js +28 -2
  125. package/dist/sdk/cli-contracts/registration-helpers.js +4 -2
  126. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +10 -2
  127. package/dist/sdk/cli-contracts/runtime-contracts.js +20 -5
  128. package/dist/sdk/cli-contracts/tool-schema.js +4 -2
  129. package/dist/sdk/cli-contracts.d.ts +2 -2
  130. package/dist/sdk/cli-contracts.js +4 -4
  131. package/dist/sdk/cli-program.js +3 -3
  132. package/dist/sdk/contracts.d.ts +1 -0
  133. package/dist/sdk/contracts.js +3 -2
  134. package/dist/sdk/dependency-provenance.d.ts +2 -0
  135. package/dist/sdk/dependency-provenance.js +7 -3
  136. package/dist/sdk/error-code-catalog.d.ts +23 -0
  137. package/dist/sdk/error-code-catalog.js +25 -5
  138. package/dist/sdk/generated-error-code-catalog.js +499 -3
  139. package/dist/sdk/graph/governance.js +3 -3
  140. package/dist/sdk/graph/remediation.js +3 -3
  141. package/dist/sdk/graph/run.js +4 -8
  142. package/dist/sdk/index.d.ts +2 -1
  143. package/dist/sdk/index.js +4 -3
  144. package/dist/sdk/item-transaction.d.ts +51 -6
  145. package/dist/sdk/item-transaction.js +132 -22
  146. package/dist/sdk/lifecycle/create.d.ts +4 -0
  147. package/dist/sdk/lifecycle/create.js +26 -10
  148. package/dist/sdk/lifecycle-policy.d.ts +9 -0
  149. package/dist/sdk/lifecycle-policy.js +22 -9
  150. package/dist/sdk/merge/driver.js +6 -3
  151. package/dist/sdk/output-contracts.d.ts +67 -0
  152. package/dist/sdk/output-contracts.js +173 -0
  153. package/dist/sdk/package-import-adapters.js +2 -2
  154. package/dist/sdk/structured-mutations.d.ts +23 -0
  155. package/dist/sdk/structured-mutations.js +219 -10
  156. package/dist/sdk/workspace-snapshot.js +58 -12
  157. package/dist/sdk/workspace.js +30 -4
  158. package/docs/COMMANDS.md +40 -10
  159. package/docs/EXTENSIONS.md +1 -1
  160. package/docs/MERGE_SAFETY.md +2 -0
  161. package/docs/PR_REVIEW_LOOP.md +10 -4
  162. package/docs/README.md +22 -22
  163. package/docs/RELEASING.md +3 -3
  164. package/docs/SCRIPTING.md +32 -9
  165. package/docs/SDK.md +91 -11
  166. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  167. package/docs/TESTING.md +25 -0
  168. package/docs/examples/sdk-contract-consumer/README.md +11 -1
  169. package/docs/examples/sdk-contract-consumer/package.json +2 -1
  170. package/docs/examples/sdk-contract-consumer/parse-receipt.mjs +22 -0
  171. package/marketplace.json +2 -2
  172. package/package.json +3 -2
  173. package/packages/pm-beads/package.json +1 -1
  174. package/packages/pm-calendar/package.json +1 -1
  175. package/packages/pm-command-kit/package.json +1 -1
  176. package/packages/pm-digital-twin/package.json +1 -1
  177. package/packages/pm-governance-audit/package.json +1 -1
  178. package/packages/pm-guide-shell/package.json +1 -1
  179. package/packages/pm-kanban/package.json +1 -1
  180. package/packages/pm-lifecycle-hooks/package.json +1 -1
  181. package/packages/pm-linked-test-adapters/package.json +1 -1
  182. package/packages/pm-search-advanced/package.json +1 -1
  183. package/packages/pm-templates/package.json +1 -1
  184. package/packages/pm-todos/package.json +1 -1
  185. package/packages/pm-vcs/package.json +1 -1
  186. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  187. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  188. package/sdk/public-surface.json +292 -14
  189. package/dist/cli-bundle/chunks/append-DHBRLHHS.js +0 -2
  190. package/dist/cli-bundle/chunks/chunk-2INN52SU.js +0 -8
  191. package/dist/cli-bundle/chunks/chunk-6RSK4IFN.js +0 -20
  192. package/dist/cli-bundle/chunks/chunk-ASJJKA57.js +0 -2
  193. package/dist/cli-bundle/chunks/chunk-IYAVULRN.js +0 -2
  194. package/dist/cli-bundle/chunks/chunk-RRQBHQOV.js +0 -2
  195. package/dist/cli-bundle/chunks/chunk-XBLOD5TZ.js +0 -2
  196. package/dist/cli-bundle/chunks/close-VLHNN6YB.js +0 -2
  197. package/dist/cli-bundle/chunks/close-many-LSJNZKU6.js +0 -2
  198. package/dist/cli-bundle/chunks/comments-AAIA6A6X.js +0 -2
  199. package/dist/cli-bundle/chunks/copy-Z7YMLEHN.js +0 -2
  200. package/dist/cli-bundle/chunks/delete-KNOHHQJM.js +0 -2
  201. package/dist/cli-bundle/chunks/focus-LFRCGALV.js +0 -2
  202. package/dist/cli-bundle/chunks/register-mutation-GU3DCECN.js +0 -20
  203. package/dist/cli-bundle/chunks/register-operations-PTWH727R.js +0 -2
  204. package/dist/cli-bundle/chunks/restore-4HZSLILR.js +0 -2
  205. package/dist/cli-bundle/chunks/update-E6LPS5IV.js +0 -2
  206. package/dist/cli-bundle/chunks/update-many-OSIC6KRO.js +0 -2
  207. package/dist/cli-bundle/focused-chunks/chunk-5MTKO7TV.js +0 -153
  208. package/dist/cli-bundle/focused-chunks/chunk-6GIZK7VQ.js +0 -2
  209. package/dist/cli-bundle/focused-chunks/chunk-AOP2WIZZ.js +0 -2
  210. package/dist/cli-bundle/focused-chunks/chunk-CL75YW32.js +0 -2
  211. package/dist/cli-bundle/focused-chunks/chunk-E7OFMWGT.js +0 -8
  212. package/dist/cli-bundle/focused-chunks/chunk-I5F5UK3Q.js +0 -2
  213. package/dist/cli-bundle/focused-chunks/chunk-T5TSY36R.js +0 -5
  214. package/dist/cli-bundle/focused-chunks/chunk-VT6BF2IX.js +0 -2
@@ -0,0 +1,2 @@
1
+ import{F as O}from"./chunk-VLYOEYML.js";import{Ia as p}from"./chunk-N5XU5UVK.js";import{oa as d,xa as A,za as m}from"./chunk-Y4LDYLLT.js";(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]="940f11a8-f40d-5169-ba74-e91920d32c4a")}catch{}})();var g={fetch:"get",read:"get",show:"get",view:"get",comment:"comments",note:"notes",learning:"learnings"};(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]="b0f52c3d-091d-51db-a4c1-bb177414dd7f")}catch{}})();var c=[{target:"title",keys:["title"],option:"--title, -t <value>",description:"Item title [required] (or pass title as the first positional argument)"},{target:"id",keys:["id"],option:"--id <value>",description:"Explicit item id (normalized with the configured id_prefix)"},{target:"description",keys:["description"],option:"--description, -d <value>",description:"Item description (allow empty string)"},{target:"type",keys:["type"],option:"--type <value>",description:"Item type (built-ins plus any configured custom types)"},{target:"template",keys:["template"],option:"--template <value>",description:"Apply named create template defaults before explicit flags"},{target:"createMode",keys:["createMode","create_mode"],option:"--create-mode <value>",description:"Create required-option policy mode: strict|progressive",aliasOptions:[{option:"--create_mode <value>",description:"Alias for --create-mode"}]},{target:"schedulePreset",keys:["schedulePreset","schedule_preset"],option:"--schedule-preset <value>",description:"Scheduling preset for Reminder|Meeting|Event: lightweight",aliasOptions:[{option:"--schedule_preset <value>",description:"Alias for --schedule-preset"}]},{target:"status",keys:["status"],option:"--status, -s <value>",description:"Item status"},{target:"closeReason",keys:["closeReason","close_reason"],option:"--close-reason <value>",description:"Close reason when creating directly in a terminal status",aliasOptions:[{option:"--close_reason <value>",description:"Alias for --close-reason"}]},{target:"completedAt",keys:["completedAt","completed_at"],option:"--completed-at <value>",description:"Actual completion time for a terminal imported item",aliasOptions:[{option:"--completed_at <value>",description:"Alias for --completed-at"}]},{target:"priority",keys:["priority"],option:"--priority, -p <value>",description:"Priority 0..4"},{target:"tags",keys:["tags"],option:"--tags <value>",description:"Comma-separated tags"},{target:"addTags",keys:["addTags","add_tags"],option:"--add-tags <value>",description:"Add tags additively on top of --tags (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--add_tags <value>",description:"Alias for --add-tags"}]},{target:"body",keys:["body"],option:"--body, -b <value>",description:"Item markdown body (allow empty string)"},{target:"deadline",keys:["deadline"],option:"--deadline <value>",description:"Deadline (ISO/date string or relative +6h/+1d/+2w/+6m)"},{target:"estimatedMinutes",keys:["estimate","estimatedMinutes","estimated_minutes"],option:"--estimate, --estimated-minutes <value>",description:"Estimated minutes",aliasOptions:[{option:"--estimated_minutes <value>",description:"Alias for --estimated-minutes"}]},{target:"acceptanceCriteria",keys:["acceptanceCriteria","acceptance_criteria","ac"],option:"--acceptance-criteria <value>",description:"Acceptance criteria (repeatable; values join with '; '; allow empty string)",repeatable:!0,aliasOptions:[{option:"--acceptance_criteria <value>",description:"Alias for --acceptance-criteria"},{option:"--ac <value>",description:"Alias for --acceptance-criteria"}]},{target:"definitionOfReady",keys:["definitionOfReady","definition_of_ready"],option:"--definition-of-ready <value>",description:"Definition of ready (allow empty string)",aliasOptions:[{option:"--definition_of_ready <value>",description:"Alias for --definition-of-ready"}]},{target:"order",keys:["order"],option:"--order <value>",description:"Planning order/rank integer"},{target:"rank",keys:["rank"],option:"--rank <value>",description:"Alias for --order"},{target:"goal",keys:["goal"],option:"--goal <value>",description:"Goal identifier"},{target:"objective",keys:["objective"],option:"--objective <value>",description:"Objective identifier"},{target:"value",keys:["value"],option:"--value <value>",description:"Business value summary"},{target:"impact",keys:["impact"],option:"--impact <value>",description:"Business impact summary"},{target:"outcome",keys:["outcome"],option:"--outcome <value>",description:"Expected outcome summary"},{target:"whyNow",keys:["whyNow","why_now"],option:"--why-now <value>",description:"Why-now rationale",aliasOptions:[{option:"--why_now <value>",description:"Alias for --why-now"}]},{target:"author",keys:["author"],option:"--author <value>",description:"Mutation author"},{target:"message",keys:["message"],option:"--message <value>",description:"History message (allow empty string)"},{target:"assignee",keys:["assignee"],option:"--assignee <value>",description:"Item assignee"},{target:"parent",keys:["parent"],option:"--parent <value>",description:"Parent item ID"},{target:"allowMissingParent",keys:["allowMissingParent","allow_missing_parent"],option:"--allow-missing-parent",description:"Allow creating with an unresolved parent reference and emit a validation warning"},{target:"reviewer",keys:["reviewer"],option:"--reviewer <value>",description:"Reviewer"},{target:"risk",keys:["risk"],option:"--risk <value>",description:"Risk level: low|med|medium|high|critical (med persists as medium)"},{target:"confidence",keys:["confidence"],option:"--confidence <value>",description:"Confidence level: 0..100|low|med|medium|high (med persists as medium)"},{target:"sprint",keys:["sprint"],option:"--sprint <value>",description:"Sprint identifier"},{target:"release",keys:["release"],option:"--release <value>",description:"Release identifier"},{target:"blockedBy",keys:["blockedBy","blocked_by"],option:"--blocked-by <value>",description:"Set latest blocked-by item ID or reason; resolved item IDs append a blocked_by dependency edge",aliasOptions:[{option:"--blocked_by <value>",description:"Alias for --blocked-by"}]},{target:"blockedReason",keys:["blockedReason","blocked_reason"],option:"--blocked-reason <value>",description:"Blocked reason",aliasOptions:[{option:"--blocked_reason <value>",description:"Alias for --blocked-reason"}]},{target:"unblockNote",keys:["unblockNote","unblock_note"],option:"--unblock-note <value>",description:"Unblock rationale note",aliasOptions:[{option:"--unblock_note <value>",description:"Alias for --unblock-note"}]},{target:"reporter",keys:["reporter"],option:"--reporter <value>",description:"Issue reporter"},{target:"severity",keys:["severity"],option:"--severity <value>",description:"Issue severity: low|med|medium|high|critical (med persists as medium)"},{target:"environment",keys:["environment"],option:"--environment <value>",description:"Issue environment context"},{target:"reproSteps",keys:["reproSteps","repro_steps"],option:"--repro-steps <value>",description:"Issue reproduction steps",aliasOptions:[{option:"--repro_steps <value>",description:"Alias for --repro-steps"}]},{target:"resolution",keys:["resolution"],option:"--resolution <value>",description:"Issue resolution summary"},{target:"expectedResult",keys:["expectedResult","expected_result","expected"],option:"--expected-result <value>",description:"Issue expected behavior",aliasOptions:[{option:"--expected_result <value>",description:"Alias for --expected-result"},{option:"--expected <value>",description:"Short alias for --expected-result"}]},{target:"actualResult",keys:["actualResult","actual_result","actual"],option:"--actual-result <value>",description:"Issue observed behavior",aliasOptions:[{option:"--actual_result <value>",description:"Alias for --actual-result"},{option:"--actual <value>",description:"Short alias for --actual-result"}]},{target:"affectedVersion",keys:["affectedVersion","affected_version"],option:"--affected-version <value>",description:"Affected version identifier",aliasOptions:[{option:"--affected_version <value>",description:"Alias for --affected-version"}]},{target:"fixedVersion",keys:["fixedVersion","fixed_version"],option:"--fixed-version <value>",description:"Fixed version identifier",aliasOptions:[{option:"--fixed_version <value>",description:"Alias for --fixed-version"}]},{target:"component",keys:["component"],option:"--component <value>",description:"Issue component ownership"},{target:"regression",keys:["regression"],option:"--regression [value]",description:"Regression marker; bare flag means true, or pass true|false|1|0"},{target:"customerImpact",keys:["customerImpact","customer_impact"],option:"--customer-impact <value>",description:"Customer impact summary",aliasOptions:[{option:"--customer_impact <value>",description:"Alias for --customer-impact"}]},{target:"dep",keys:["dep"],option:"--dep <value>",description:"Seed dependency entry (key=value CSV, markdown key:value lines, or - for stdin; repeatable)",repeatable:!0},{target:"typeOption",keys:["typeOption","type_option"],option:"--type-option <value>",description:"Type option key=value or key=<name>,value=<value> (also accepts key:value and markdown pairs; use - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--type_option <value>",description:"Alias for --type-option"}]},{target:"field",keys:["field"],option:"--field <name=value>",description:"Set a field declared by an active extension registerItemFields registration (repeatable)",repeatable:!0},{target:"unset",keys:["unset"],option:"--unset <field>",description:"Clear scalar metadata field by name (repeatable)",repeatable:!0},{target:"reminder",keys:["reminder"],option:"--reminder <value>",description:"Seed reminder entry at=<iso|relative>,text=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"event",keys:["event"],option:"--event <value>",description:"Seed event entry start=<iso|relative>,end=<iso|relative>,duration=<relative|30min|PT30M>,title=<text>,all_day=<true|false>,recur_* fields (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"comment",keys:["comment"],option:"--comment <value>",description:"Seed comment entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"note",keys:["note"],option:"--note <value>",description:"Seed note entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"learning",keys:["learning"],option:"--learning <value>",description:"Seed learning entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"file",keys:["file"],option:"--file <value>",description:"Seed linked file entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"test",keys:["test"],option:"--test <value>",description:"Seed linked test entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"doc",keys:["doc"],option:"--doc <value>",description:"Seed linked doc entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0}],f=c.filter(e=>e.repeatable!==!0).map(e=>({target:e.target,keys:e.keys})),v=c.filter(e=>e.repeatable===!0).map(e=>({target:e.target,keys:e.keys})),u=[{target:"title",keys:["title"],option:"--title, -t <value>",description:"Set title"},{target:"description",keys:["description"],option:"--description, -d <value>",description:"Set description"},{target:"body",keys:["body"],option:"--body, -b <value>",description:"Set body (allow empty string)"},{target:"status",keys:["status"],option:"--status, -s <value>",description:"Set status (use close command for closed)"},{target:"closeReason",keys:["closeReason","close_reason"],option:"--close-reason <value>",description:"Set close reason",aliasOptions:[{option:"--close_reason <value>",description:"Alias for --close-reason"}]},{target:"priority",keys:["priority"],option:"--priority, -p <value>",description:"Set priority"},{target:"type",keys:["type"],option:"--type <value>",description:"Set type"},{target:"tags",keys:["tags"],option:"--tags <value>",description:"Set comma-separated tags (replaces existing). Use --add-tags / --remove-tags to mutate additively."},{target:"addTags",keys:["addTags","add_tags"],option:"--add-tags <value>",description:"Add tags to the existing list without replacing it (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--add_tags <value>",description:"Alias for --add-tags"}]},{target:"removeTags",keys:["removeTags","remove_tags"],option:"--remove-tags <value>",description:"Remove tags from the existing list (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--remove_tags <value>",description:"Alias for --remove-tags"}]},{target:"deadline",keys:["deadline"],option:"--deadline <value>",description:"Set deadline (ISO/date string or relative)"},{target:"estimatedMinutes",keys:["estimate","estimatedMinutes","estimated_minutes"],option:"--estimate, --estimated-minutes <value>",description:"Set estimated minutes",aliasOptions:[{option:"--estimated_minutes <value>",description:"Alias for --estimated-minutes"}]},{target:"acceptanceCriteria",keys:["acceptanceCriteria","acceptance_criteria","ac"],option:"--acceptance-criteria <value>",description:"Set acceptance criteria (repeatable; values join with '; ')",repeatable:!0,aliasOptions:[{option:"--acceptance_criteria <value>",description:"Alias for --acceptance-criteria"},{option:"--ac <value>",description:"Alias for --acceptance-criteria"}]},{target:"addAc",keys:["addAc","add_ac"],option:"--add-ac <value>",description:"Add one semicolon-free acceptance criterion without replacing the existing list (repeatable)",repeatable:!0,aliasOptions:[{option:"--add_ac <value>",description:"Alias for --add-ac"}]},{target:"removeAc",keys:["removeAc","remove_ac"],option:"--remove-ac <value>",description:"Remove one semicolon-free acceptance criterion by exact text match (repeatable)",repeatable:!0,aliasOptions:[{option:"--remove_ac <value>",description:"Alias for --remove-ac"}]},{target:"definitionOfReady",keys:["definitionOfReady","definition_of_ready"],option:"--definition-of-ready <value>",description:"Set definition of ready",aliasOptions:[{option:"--definition_of_ready <value>",description:"Alias for --definition-of-ready"}]},{target:"order",keys:["order"],option:"--order <value>",description:"Set planning order/rank integer"},{target:"rank",keys:["rank"],option:"--rank <value>",description:"Alias for --order"},{target:"goal",keys:["goal"],option:"--goal <value>",description:"Set goal identifier"},{target:"objective",keys:["objective"],option:"--objective <value>",description:"Set objective identifier"},{target:"value",keys:["value"],option:"--value <value>",description:"Set business value summary"},{target:"impact",keys:["impact"],option:"--impact <value>",description:"Set business impact summary"},{target:"outcome",keys:["outcome"],option:"--outcome <value>",description:"Set expected outcome summary"},{target:"whyNow",keys:["whyNow","why_now"],option:"--why-now <value>",description:"Set why-now rationale",aliasOptions:[{option:"--why_now <value>",description:"Alias for --why-now"}]},{target:"author",keys:["author"],option:"--author <value>",description:"Mutation author"},{target:"message",keys:["message"],option:"--message <value>",description:"Mutation message"},{target:"assignee",keys:["assignee"],option:"--assignee <value>",description:"Set assignee"},{target:"parent",keys:["parent"],option:"--parent <value>",description:"Set parent item ID"},{target:"allowMissingParent",keys:["allowMissingParent","allow_missing_parent"],option:"--allow-missing-parent",description:"Allow updating to an unresolved parent reference and emit a validation warning"},{target:"completedAt",keys:["completedAt","completed_at"],option:"--completed-at <value>",description:"Correct the actual completion timestamp on a terminal item"},{target:"reviewer",keys:["reviewer"],option:"--reviewer <value>",description:"Set reviewer"},{target:"risk",keys:["risk"],option:"--risk <value>",description:"Set risk level: low|med|medium|high|critical (med persists as medium)"},{target:"confidence",keys:["confidence"],option:"--confidence <value>",description:"Set confidence level: 0..100|low|med|medium|high (med persists as medium)"},{target:"sprint",keys:["sprint"],option:"--sprint <value>",description:"Set sprint identifier"},{target:"release",keys:["release"],option:"--release <value>",description:"Set release identifier"},{target:"blockedBy",keys:["blockedBy","blocked_by"],option:"--blocked-by <value>",description:"Set latest blocked-by item ID or reason; resolved item IDs append a blocked_by dependency edge",aliasOptions:[{option:"--blocked_by <value>",description:"Alias for --blocked-by"}]},{target:"blockedReason",keys:["blockedReason","blocked_reason"],option:"--blocked-reason <value>",description:"Set blocked reason",aliasOptions:[{option:"--blocked_reason <value>",description:"Alias for --blocked-reason"}]},{target:"unblockNote",keys:["unblockNote","unblock_note"],option:"--unblock-note <value>",description:"Set unblock rationale note",aliasOptions:[{option:"--unblock_note <value>",description:"Alias for --unblock-note"}]},{target:"reporter",keys:["reporter"],option:"--reporter <value>",description:"Set issue reporter"},{target:"severity",keys:["severity"],option:"--severity <value>",description:"Set issue severity: low|med|medium|high|critical (med persists as medium)"},{target:"environment",keys:["environment"],option:"--environment <value>",description:"Set issue environment context"},{target:"reproSteps",keys:["reproSteps","repro_steps"],option:"--repro-steps <value>",description:"Set issue reproduction steps",aliasOptions:[{option:"--repro_steps <value>",description:"Alias for --repro-steps"}]},{target:"resolution",keys:["resolution"],option:"--resolution <value>",description:"Set issue resolution summary"},{target:"expectedResult",keys:["expectedResult","expected_result","expected"],option:"--expected-result <value>",description:"Set issue expected behavior",aliasOptions:[{option:"--expected_result <value>",description:"Alias for --expected-result"},{option:"--expected <value>",description:"Short alias for --expected-result"}]},{target:"actualResult",keys:["actualResult","actual_result","actual"],option:"--actual-result <value>",description:"Set issue observed behavior",aliasOptions:[{option:"--actual_result <value>",description:"Alias for --actual-result"},{option:"--actual <value>",description:"Short alias for --actual-result"}]},{target:"affectedVersion",keys:["affectedVersion","affected_version"],option:"--affected-version <value>",description:"Set affected version identifier",aliasOptions:[{option:"--affected_version <value>",description:"Alias for --affected-version"}]},{target:"fixedVersion",keys:["fixedVersion","fixed_version"],option:"--fixed-version <value>",description:"Set fixed version identifier",aliasOptions:[{option:"--fixed_version <value>",description:"Alias for --fixed-version"}]},{target:"component",keys:["component"],option:"--component <value>",description:"Set issue component ownership"},{target:"regression",keys:["regression"],option:"--regression [value]",description:"Set regression marker; bare flag means true, or pass true|false|1|0"},{target:"customerImpact",keys:["customerImpact","customer_impact"],option:"--customer-impact <value>",description:"Set customer impact summary",aliasOptions:[{option:"--customer_impact <value>",description:"Alias for --customer-impact"}]},{target:"dep",keys:["dep"],option:"--dep <value>",description:"Add dependency entries id=<id>,kind=<value>,author=<value>,created_at=<iso|now>,source_kind=<value> (repeatable)",repeatable:!0},{target:"depRemove",keys:["depRemove","dep_remove"],option:"--dep-remove <value>",description:"Remove dependencies by id or id=<id>,kind=<value>,source_kind=<value> selectors (repeatable)",repeatable:!0,aliasOptions:[{option:"--dep_remove <value>",description:"Alias for --dep-remove"}]},{target:"comment",keys:["comment"],option:"--comment <value>",description:"Append comment seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"note",keys:["note"],option:"--note <value>",description:"Append note seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"learning",keys:["learning"],option:"--learning <value>",description:"Append learning seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"file",keys:["file"],option:"--file <value>",description:"Append linked file path=<value>,scope=<project|global>,note=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"test",keys:["test"],option:"--test <value>",description:"Append linked test command=<value>,path=<value>,scope=<project|global>,timeout_seconds=<n>,pm_context_mode=<schema|tracker|auto> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"doc",keys:["doc"],option:"--doc <value>",description:"Append linked doc path=<value>,scope=<project|global>,note=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"reminder",keys:["reminder"],option:"--reminder <value>",description:"Set reminders at=<iso|relative>,text=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"event",keys:["event"],option:"--event <value>",description:"Set events start=<iso|relative>,end=<iso|relative>,duration=<relative|30min|PT30M>,title=<text>,all_day=<true|false>,recur_* fields (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"typeOption",keys:["typeOption","type_option"],option:"--type-option <value>",description:"Set type options key=value or key=<name>,value=<value> (also accepts key:value and markdown pairs; use - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--type_option <value>",description:"Alias for --type-option"}]},{target:"field",keys:["field"],option:"--field <name=value>",description:"Set a field declared by an active extension registerItemFields registration (repeatable)",repeatable:!0},{target:"unset",keys:["unset"],option:"--unset <field>",description:"Clear scalar metadata field by name (repeatable)",repeatable:!0}],y=u.filter(e=>e.repeatable!==!0).map(e=>({target:e.target,keys:e.keys})),N=u.filter(e=>e.repeatable===!0).map(e=>({target:e.target,keys:e.keys}));(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]="5f5b9bd3-1b92-5fb2-b649-6eb942a7a3c4")}catch{}})();var R=new Set(["--author","--follow","--help","--lean","--token-accounting","--output-include","--output-limit","--output-budget","--output-format","--no-changed-fields","--no-extensions","--no-pager","--pm-path","--profile","--quiet","--interval-ms"]),E=new Set(A),k=new Set(["--brief","--format","--full","--full-changed-fields","--id-only","--no-truncate","--stream"]),b=new Set(["--body-file","--file","--stdin-json"]),I=new Set(["--global","--local","--project"]),L=new Set(["--activity-limit","--default-depth","--section-activity","--section-blockers","--section-files","--section-hierarchy","--section-progress","--section-staleness","--section-tests","--section-workload","--stale-threshold-days"]),h=new Set(["action","path","pmExecutable","timeoutMs"]),P=new Set(["configAction","id","name","query","reason","subcommand","target","text"]),w={event:{title:"<title>"},files:{lookupPath:"lookup <path...>"},meet:{title:"<title>"},merge:{subcommand:"<subcommand>"},remind:{title:"<title>"},workspace:{name:"<name>",subcommand:"snapshot",snapshotAction:"<snapshot-action>",target:"<target>"}},G={init:{"--id-prefix":"idPrefix","--no-merge-fence":"mergeFence","--workspace":"workspace"},create:{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},update:{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},"update-many":{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},files:{"--note":"addNote"},docs:{"--note":"addNote"},notes:{"--file":"text"},gc:{"--scope":"gcScope"},contracts:{"--action":"contractAction"},schema:{"--no-allow-unset":"allowUnset","--type":"fieldTypeScope"},"history-author-acknowledge":{"--event":"historyEvent","--all-actionable":"allActionable"},"extension-init":{"--capability":"capability"},"package-init":{"--capability":"capability"},"extension-install":{"--gh":"github"},"package-install":{"--gh":"github"},"extension-adopt":{"--gh":"github"},"package-adopt":{"--gh":"github"},extension:{"--gh":"github","--scaffold":"init"},package:{"--gh":"github","--scaffold":"init"},install:{"--gh":"github"}};function M(e){return e.startsWith("extension-")?`extension ${e.slice(10)}`:e.startsWith("package-")?`package ${e.slice(8)}`:e}function C(e,t){let i=G[e]?.[t];return i!==void 0?i:t.replace(/^--/,"").replaceAll("_","-").replace(/-([a-z])/g,(r,o)=>o.toUpperCase())}function F(e){let t=new Set;return e.filter(({flag:i})=>!i.startsWith("--")||t.has(i)?!1:(t.add(i),!0))}function D(e,t){return t.find(({aliases:i})=>i?.includes(e))?.flag}function x(e,t,i,r){let o=C(e,t.flag);if(r.has(o))return{surface:"cli",input:t.flag,counterpart:o,disposition:"shared",reason:"The CLI flag maps directly to a strict SDK action parameter."};let n=D(t.flag,i);if(n!==void 0){let a=C(e,n);if(r.has(a))return{surface:"cli",input:t.flag,counterpart:a,disposition:"compatibility_alias",reason:`Compatibility spelling for ${n}.`}}return R.has(t.flag)?{surface:"cli",input:t.flag,disposition:"cli_transport",reason:"CLI process transport is supplied by the in-process SDK host."}:k.has(t.flag)?{surface:"cli",input:t.flag,disposition:"cli_presentation",reason:"CLI rendering or mutation projection does not alter the SDK result envelope."}:b.has(t.flag)?{surface:"cli",input:t.flag,disposition:"cli_adapter",reason:"Local file or stdin adaptation is a CLI boundary concern."}:L.has(t.flag)?{surface:"cli",input:t.flag,counterpart:"key",disposition:"compatibility_alias",reason:"CLI config shorthand normalizes to the SDK configAction/key/value contract."}:I.has(t.flag)?{surface:"cli",input:t.flag,counterpart:"scope",disposition:"cli_scope_selector",reason:"Mutually exclusive CLI scope switches normalize to the SDK scope parameter."}:{surface:"cli",input:t.flag,counterpart:o,disposition:"unclassified",reason:"The CLI flag has no strict SDK parameter or approved boundary classification."}}function U(e,t,i){let r=i.find(({counterpart:n,disposition:a})=>n===t&&(a==="shared"||a==="compatibility_alias"||a==="cli_scope_selector"));if(r!==void 0)return{surface:"sdk",input:t,counterpart:r.input,disposition:"shared",reason:"The strict SDK parameter is reachable from the CLI contract."};let o=w[e]?.[t];return o!==void 0?{surface:"sdk",input:t,counterpart:o,disposition:"shared",reason:"The strict SDK parameter maps to a canonical CLI positional argument."}:h.has(t)?{surface:"sdk",input:t,disposition:"sdk_transport",reason:"The SDK host supplies in-process transport and workspace selection."}:P.has(t)?{surface:"sdk",input:t,disposition:"cli_positional",reason:"The CLI accepts this SDK parameter as a positional command argument."}:{surface:"sdk",input:t,disposition:"sdk_native",reason:"The typed SDK exposes this structured input without a canonical CLI long flag."}}function V(e={}){let t=e.actions??d,i=e.resolveFlags??p,r=e.resolveParameters??O;return t.map(o=>{let n=M(o),a=F(i(n)).filter(({flag:s})=>m(o)!==void 0||!E.has(s)),_=new Set(r(o)??[]),l=a.map(s=>x(o,s,a,_)),T=[..._].sort((s,S)=>s.localeCompare(S)).map(s=>U(o,s,l));return{action:o,command:n,cli:l,sdk:T,unclassified:[...l,...T].filter(({disposition:s})=>s==="unclassified")}})}(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]="93c3ffe8-6735-5139-b91f-59002f74a670")}catch{}})();export{g as a,c as b,f as c,v as d,u as e,y as f,N as g,V as h};
2
+ //# sourceMappingURL=chunk-W7BJEWHX.js.map
@@ -1,2 +1,2 @@
1
- import{$a as P,Ba as tt,Ia as et,K as V,Ka as rt,L as S,P as W,Pa as nt,Qa as ot,Xa as it,Za as st,ab as D,ea as Y,fa as X,ga as J,k as z,ma as p,n as C,pa as K,ra as _,ta as d,ua as L,ya as Q,za as Z}from"./chunk-5MTKO7TV.js";import{D as M,J as G,M as B,N as q,P as j,p as k,q as H,r as m}from"./chunk-QM2BIVK7.js";import{Y as c,Z as l}from"./chunk-CL75YW32.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="47c087c2-124a-58b7-a5c9-09403235f4a2")}catch{}})();function yt(t,e){let n=-1;return t.forEach((r,o)=>{let i=Date.parse(r.ts);if(!Number.isFinite(i))throw new l(`History for this item contains invalid timestamp at entry ${o+1}.`,c.GENERIC_FAILURE);i<=e&&(n=o)}),n}function wt(t){let e=t[0]?.ts??null,n=t.at(-1)?.ts??null,r={code:"history_target_out_of_range",required:"Choose a target within the available item history.",why:"Point-in-time reads and restores can only reconstruct recorded versions.",examples:[],nextSteps:["Run pm history <id> to inspect available versions and timestamps."],valid_range:{first_version:null,last_version:null,first_timestamp:e,last_timestamp:n}};return n!==null&&(r.examples=["1",String(t.length),n],r.valid_range.first_version=1,r.valid_range.last_version=t.length),{guidance:r,lastTimestamp:n}}function pt(t,e){let n={};if(e instanceof Error&&e.message.trim().length>0&&(n.reason=e.message.trim()),typeof e!="object"||e===null)return n;let r=e;if(typeof r.index=="number"&&Number.isInteger(r.index)&&r.index>=0&&(n.patchIndex=r.index),typeof r.operation=="object"&&r.operation!==null){let o=r.operation;Object.assign(n,Object.fromEntries(["op","path","from"].flatMap(i=>{let s=o[i];return typeof s=="string"?[[i,s]]:[]})))}if(n.patchIndex!==void 0){let o=t[n.patchIndex];o&&(n.op??=o.op,n.path??=o.path,n.from??=o.from)}return n}function Mt(t,e,n={}){let r=t.trim(),o=n.errorSubject??"history",i=o==="restore"?"Restore":"History",{guidance:s,lastTimestamp:a}=wt(e);if(!r)throw new l(`Missing ${o} target. Use a timestamp or version number.`,c.USAGE,s);if(/^\d+$/.test(r)){let u=Number(r);if(!Number.isSafeInteger(u)||u<1||u>e.length)throw new l(`${i} version must be between 1 and ${e.length} for this item.`,c.USAGE,s);return{kind:"version",raw:r,historyIndex:u-1}}let h=Date.parse(r);if(!Number.isFinite(h))throw new l(`Invalid ${o} target "${t}". Use a positive version number or ISO timestamp.`,c.USAGE,s);let f=yt(e,h);if(f<0||n.allowFutureTimestamp!==!0&&h>Date.parse(a))throw new l(o==="restore"?`No history entries exist at or before timestamp ${r}.`:`No history entry exists at timestamp ${r}.`,c.USAGE,s);return{kind:"timestamp",raw:r,historyIndex:f}}function A(t,e,n,r){let o=Q(t,e);if(o.ok)return o.document;let i=pt(e,o.error),s=[`history_op=${r}`,i.patchIndex===void 0?null:`patch_index=${i.patchIndex}`,i.op?`op=${i.op}`:null,i.path?`path=${i.path}`:null,i.from?`from=${i.from}`:null].filter(a=>a!==null);throw new l(`Failed to apply history patch at entry ${n} (${s.join(", ")}). ${i.reason??String(o.error)}`,c.GENERIC_FAILURE)}function Gt(t,e){let n=structuredClone(_);for(let r=0;r<=e;r+=1){let o=t[r];if(!o)throw new l(`History target entry ${r+1} does not exist.`,c.USAGE);if(d(n)!==o.before_hash)throw new l(`History hash mismatch before replay at entry ${r+1}.`,c.GENERIC_FAILURE);if(n=A(n,o.patch,r+1,o.op),d(n)!==o.after_hash)throw new l(`History hash mismatch after replay at entry ${r+1}.`,c.GENERIC_FAILURE)}return n}function Bt(t,e){if(Object.keys(t.metadata).length>0)return t;throw new l(`History target ${e.raw} resolves to a deleted state; choose a version or timestamp where the item exists.`,c.USAGE)}import U from"node:fs/promises";import gt from"node:fs/promises";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="a2ec9f1a-aae2-59d5-8c9a-7acd8bf5a7a2")}catch{}})();function It(t){if(!t.itemDocument)return[];let e=t.itemDocument.metadata?.assignee?.trim();if(!e||e===t.author||t.force)return[];let n=et(t.settings);if(n.ownership_enforcement==="strict")throw new l(`Item ${t.subjectId} is assigned to ${e}. Use --force to override.`,c.CONFLICT);return n.ownership_enforcement==="warn"?[`ownership_warning:assignee_conflict:${t.subjectId}:${e}`]:[]}async function _t(t){let e=await H(t.subject.historyPath);if(e!==t.historyRawBeforeLock)throw new l(`History for ${t.subject.id} changed while waiting for lock; retry ${t.operation}.`,c.CONFLICT);let n=await P(t.pmRoot,t.subject.id,t.settings.id_prefix,t.settings.item_format,t.typeRegistry.type_to_folder),r=n?await D(n,{schema:t.settings.schema}):null;if((r?.raw??null)!==(t.currentItemRawBeforeLock??null))throw new l(`Item ${t.subject.id} changed while waiting for lock; retry ${t.operation}.`,c.CONFLICT);return{historyRawUnderLock:e,locatedUnderLock:n,loadedItemUnderLock:r}}async function Zt(t){let e=t.writeHistoryRaw??m;try{await e(t.historyPath,t.nextHistoryRaw),await p(t.historyPath)}catch(n){try{t.historyRawUnderLock===null?await gt.rm(t.historyPath,{force:!0}):await e(t.historyPath,t.historyRawUnderLock),await p(t.historyPath)}catch(r){throw new AggregateError([n,r],`History rewrite failed and rollback also failed: ${String(n)}`)}throw n}}async function at(t){let e=[...It({itemDocument:t.itemDocument,subjectId:t.subject.id,author:t.author,force:t.force,settings:t.settings})],n=await W(t.pmRoot,t.subject.id,t.settings.locks.ttl_seconds,t.author,!!t.force,t.settings.governance.force_required_for_stale_lock,t.settings.locks.wait_ms);try{let r=await _t({pmRoot:t.pmRoot,subject:t.subject,settings:t.settings,typeRegistry:t.typeRegistry,historyRawBeforeLock:t.historyRawBeforeLock,currentItemRawBeforeLock:t.currentItemRawBeforeLock,operation:t.operation});return await t.applyRewrite(r),t.applyPostRewrite&&e.push(...await t.applyPostRewrite(r)),e}finally{await n()}}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="cd2a27ec-0f12-591d-ab34-529ddda05063")}catch{}})();function ct(t){return Array.isArray(t)?t:typeof t=="string"?[t]:[]}function xt(t){let e=[];for(let n of t)e.includes(n)||e.push(n);return e.includes("g")||e.push("g"),e.join("")}function bt(t){let e=t.trim();if(e.length===0)throw new l("history-redact --regex requires a non-empty pattern.",c.USAGE);let n=e,r="g";if(e.startsWith("/")&&e.length>1){let o=e.lastIndexOf("/");o>0&&(n=e.slice(1,o),r=xt(e.slice(o+1)))}if(n.length===0)throw new l("history-redact --regex cannot use an empty pattern.",c.USAGE);try{new RegExp(n,r)}catch{throw new l("Invalid --regex value; provide a valid JavaScript regular expression.",c.USAGE)}return{kind:"regex",source:n,flags:r}}function Rt(t,e){let n=[...new Set(ct(t).map(i=>i.trim()))].filter(i=>i.length>0).map(i=>({kind:"literal",value:i})),r=[...new Set(ct(e).map(i=>i.trim()))].filter(i=>i.length>0).map(bt),o=[...n,...r];if(o.length===0)throw new l("history-redact requires at least one matcher via --literal or --regex.",c.USAGE,{code:"missing_required_argument",required:"Provide --literal <value> and/or --regex <pattern>.",examples:['pm history-redact pm-a1b2 --literal "[redacted_path_prefix]/private"','pm history-redact pm-a1b2 --regex "/192\\\\.168\\\\.[0-9.]+/g" --replacement "[scrubbed_ip]"']});return o}function Et(t,e,n){if(e.length===0)return{value:t,replacements:0};let r=0,o=0;for(;r<=t.length;){let i=t.indexOf(e,r);if(i===-1)break;o+=1,r=i+Math.max(1,e.length)}return o===0?{value:t,replacements:0}:{value:t.split(e).join(n),replacements:o}}function vt(t,e,n){let r=new RegExp(e.source,e.flags),o=[...t.matchAll(r)];return o.length===0?{value:t,replacements:0}:{value:t.replace(r,n),replacements:o.length}}function lt(t,e,n){let r=t,o=0;for(let i of e){let s=i.kind==="literal"?Et(r,i.value,n):vt(r,i,n);r=s.value,o+=s.replacements}return{value:r,replacements:o}}function F(t,e,n){if(typeof t=="string")return lt(t,e,n);if(Array.isArray(t)){let r=0;return{value:t.map(i=>{let s=F(i,e,n);return r+=s.replacements,s.value}),replacements:r}}if(typeof t=="object"&&t!==null){let r=0,o={};for(let[i,s]of Object.entries(t)){let a=F(s,e,n);r+=a.replacements,o[i]=a.value}return{value:o,replacements:r}}return{value:t,replacements:0}}function kt(t){let e=structuredClone(_),n=0,r=0;for(let o=0;o<t.length;o+=1){let i=t[o];d(e)!==i.before_hash&&(n+=1),e=A(e,i.patch,o+1,i.op),d(e)!==i.after_hash&&(r+=1)}return{hashMismatchesBefore:n,hashMismatchesAfter:r,finalDocument:e}}function Ht(t,e,n){let r=0,o=!1,i=t.message;if(typeof t.message=="string"){let a=lt(t.message,e,n);i=a.value,r+=a.replacements,a.replacements>0&&(o=!0)}let s=t.patch.map(a=>{if(!Object.prototype.hasOwnProperty.call(a,"value"))return a;let h=F(a.value,e,n);return r+=h.replacements,h.replacements>0?(o=!0,{...a,value:h.value}):a});return{entry:{...t,message:i,patch:s},replacements:r,changed:o}}function Pt(t,e,n){let r=structuredClone(_),o=0,i=0,s=[];for(let a=0;a<t.length;a+=1){let h=Ht(t[a],e,n);i+=h.replacements,h.changed&&(o+=1);let f=d(r);r=A(r,h.entry.patch,a+1,h.entry.op);let u=d(r);s.push({...h.entry,before_hash:f,after_hash:u})}return{entries:s,finalDocument:r,entriesChanged:o,replacements:i}}function Dt(t){return Object.keys(t.metadata).length>0}async function At(t,e){let n=t.located?.itemPath??null;if(!t.located)return{raw:null,path:n,document:null};let r=await D(t.located,{schema:e.schema});return{raw:r.raw,path:n,document:r.document}}function Tt(t){if(!Dt(t.finalDocument))return{raw:null,path:null,document:null};let e=X(L(t.finalDocument),{schema:t.settings.schema});if(e.metadata.id!==t.subject.id)throw new l("history-redact would change the item id; narrow your patterns.",c.USAGE);return{document:e,path:q(t.pmRoot,e.metadata.type,t.subject.id,"toon",t.typeToFolder),raw:Y(e,{format:"toon",schema:t.settings.schema})}}function $t(t,e){return typeof t.message=="string"&&t.message.trim().length>0?t.message:`history-redact replaced ${e.replacements} match(es) across ${e.entriesChanged} entr${e.entriesChanged===1?"y":"ies"}.`}function jt(t){let e=[...t.rewritten.entries];if(t.dryRun||!t.changed)return{rewrittenEntries:e,auditEntryAdded:!1};let n=t.nextItemDocument??L(t.rewritten.finalDocument);return e.push(K({nowIso:S(),author:t.author,op:"history_redact",before:n,after:n,message:t.message})),{rewrittenEntries:e,auditEntryAdded:!0}}async function Ct(t){let e=[];return at({pmRoot:t.pmRoot,subject:t.subject,settings:t.settings,typeRegistry:t.typeRegistry,historyRawBeforeLock:t.historyRawBeforeLock,currentItemRawBeforeLock:t.currentItem.raw,operation:"history-redact",author:t.author,force:t.force,itemDocument:t.currentItem.document,applyRewrite:async({historyRawUnderLock:n})=>{let r=await it(t.pmRoot,t.author),o=new Set;t.currentItem.path&&o.add(t.currentItem.path),t.nextItem.path&&o.add(t.nextItem.path);let i=new Map;t.currentItem.path&&t.currentItem.raw!==null&&i.set(t.currentItem.path,t.currentItem.raw);let s=()=>{};try{try{t.nextItem.path&&t.nextItem.raw!==null&&t.nextItem.raw!==t.currentItem.raw&&await m(t.nextItem.path,t.nextItem.raw),t.currentItem.path&&(!t.nextItem.path||t.nextItem.path!==t.currentItem.path)&&await U.rm(t.currentItem.path,{force:!0}),await m(t.subject.historyPath,tt(t.rewrittenEntries))}catch(h){try{await St(t.subject.historyPath,n,o,i)}finally{await p(t.subject.historyPath)}throw h}await p(t.subject.historyPath);let a=t.nextItem.path??t.currentItem.path;a&&(e=await st({pmRoot:t.pmRoot,preferredFormat:t.settings.item_format,typeToFolder:t.typeRegistry.type_to_folder,schema:t.settings.schema,itemPath:a,...t.currentItem.path?{previousItemPath:t.currentItem.path}:{},document:t.nextItem.document}))}finally{await r().catch(a=>{s=()=>{throw a}})}s()},applyPostRewrite:async()=>[...e,...await Lt(t.subject.historyPath,[t.nextItem.path,t.currentItem.path])]})}async function St(t,e,n,r){e===null?await U.rm(t,{force:!0}):await m(t,e);for(let o of n){let i=r.get(o);i===void 0?await U.rm(o,{force:!0}):await m(o,i)}}async function Lt(t,e){let n=[],r=new Set(e.filter(o=>o!==null));for(let o of r)n.push(...await C({path:o,scope:"project",op:"history_redact"}));return n.push(...await C({path:t,scope:"project",op:"history_redact:history"})),n}async function Ut(t,e,n,r){let o=await P(t,e,n.id_prefix,n.item_format,r);if(o)return{id:o.id,historyPath:j(t,o.id),located:o};let i=ot(e,n.id_prefix),s=nt(e),a=i===s?[i]:[i,s];for(let h of a){let f=j(t,h);if(await k(f))return{id:h,historyPath:f,located:null}}throw new l(`Item ${e} not found`,c.NOT_FOUND)}async function xe(t,e,n){let r=G(process.cwd(),n.path);if(!await k(B(r)))throw new l(`Tracker is not initialized at ${r}. Run pm init first.`,c.NOT_FOUND);let o=await rt(r),i=M(o,z()),s=e.replacement??"",a=s.length===0,h=a?"[redacted]":s,f=Rt(e.literal,e.regex),u=await Ut(r,t,o,i.type_to_folder);if(!await k(u.historyPath))throw new l(`No history stream exists for ${u.id}.`,c.NOT_FOUND);let ht=await H(u.historyPath),x=await J(u.historyPath,u.id);if(x.length===0)throw new l(`No history entries exist for ${u.id}; nothing to redact.`,c.USAGE);let b=kt(x),y=Pt(x,f,h),T=b.hashMismatchesBefore+b.hashMismatchesAfter,$=!!e.dryRun,R=y.replacements>0,E=[];T>0&&E.push(`history_redact_preexisting_hash_mismatches:${T}`),R||E.push("history_redact_no_matches");let g=await At(u,o),w=Tt({pmRoot:r,subject:u,settings:o,typeToFolder:i.type_to_folder,finalDocument:y.finalDocument}),ut=(g.path??null)!==(w.path??null)||(g.raw??null)!==(w.raw??null),N=V(e.author,o.author_default),ft=$t(e,y),{rewrittenEntries:O,auditEntryAdded:dt}=jt({rewritten:y,dryRun:$,changed:R,nextItemDocument:w.document,author:N,message:ft}),v=Z(O);if(!v.ok)throw new l(`history-redact produced an invalid rewritten chain (${v.errors.join(", ")}).`,c.GENERIC_FAILURE);return!$&&R&&E.push(...await Ct({pmRoot:r,subject:u,settings:o,typeRegistry:i,historyRawBeforeLock:ht,currentItem:g,nextItem:w,author:N,force:e.force,rewrittenEntries:O})),{id:u.id,dry_run:$,changed:R,patterns:{literal_count:f.filter(I=>I.kind==="literal").length,regex_count:f.filter(I=>I.kind==="regex").length,total_count:f.length,replacement_is_default:a},history:{path:u.historyPath,entries_scanned:x.length,entries_changed:y.entriesChanged,replacements:y.replacements,hash_mismatches_before:b.hashMismatchesBefore,hash_mismatches_after:b.hashMismatchesAfter,preexisting_hash_mismatches:T,audit_entry_added:dt,verify_ok:v.ok,verify_errors:v.errors},item:{existed_before:g.path!==null,exists_after:w.path!==null,path_before:g.path,path_after:w.path,changed:ut},warnings:[...new Set(E)].sort((I,mt)=>I.localeCompare(mt)),generated_at:S()}}export{Mt as a,A as b,Gt as c,Bt as d,Zt as e,at as f,Ut as g,xe as h};
2
- //# sourceMappingURL=chunk-DQ4PLKEE.js.map
1
+ import{$a as P,Ba as tt,Ia as et,K as V,Ka as rt,L as S,P as W,Pa as nt,Qa as ot,Xa as it,Za as st,ab as D,ea as Y,fa as X,ga as J,k as z,ma as p,n as C,pa as K,ra as _,ta as d,ua as L,ya as Q,za as Z}from"./chunk-7J5TUBUJ.js";import{D as M,J as G,M as B,N as q,P as j,p as k,q as H,r as m}from"./chunk-BIMTMOS7.js";import{Y as c,Z as l}from"./chunk-Y4LDYLLT.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="47c087c2-124a-58b7-a5c9-09403235f4a2")}catch{}})();function yt(t,e){let n=-1;return t.forEach((r,o)=>{let i=Date.parse(r.ts);if(!Number.isFinite(i))throw new l(`History for this item contains invalid timestamp at entry ${o+1}.`,c.GENERIC_FAILURE);i<=e&&(n=o)}),n}function wt(t){let e=t[0]?.ts??null,n=t.at(-1)?.ts??null,r={code:"history_target_out_of_range",required:"Choose a target within the available item history.",why:"Point-in-time reads and restores can only reconstruct recorded versions.",examples:[],nextSteps:["Run pm history <id> to inspect available versions and timestamps."],valid_range:{first_version:null,last_version:null,first_timestamp:e,last_timestamp:n}};return n!==null&&(r.examples=["1",String(t.length),n],r.valid_range.first_version=1,r.valid_range.last_version=t.length),{guidance:r,lastTimestamp:n}}function pt(t,e){let n={};if(e instanceof Error&&e.message.trim().length>0&&(n.reason=e.message.trim()),typeof e!="object"||e===null)return n;let r=e;if(typeof r.index=="number"&&Number.isInteger(r.index)&&r.index>=0&&(n.patchIndex=r.index),typeof r.operation=="object"&&r.operation!==null){let o=r.operation;Object.assign(n,Object.fromEntries(["op","path","from"].flatMap(i=>{let s=o[i];return typeof s=="string"?[[i,s]]:[]})))}if(n.patchIndex!==void 0){let o=t[n.patchIndex];o&&(n.op??=o.op,n.path??=o.path,n.from??=o.from)}return n}function Mt(t,e,n={}){let r=t.trim(),o=n.errorSubject??"history",i=o==="restore"?"Restore":"History",{guidance:s,lastTimestamp:a}=wt(e);if(!r)throw new l(`Missing ${o} target. Use a timestamp or version number.`,c.USAGE,s);if(/^\d+$/.test(r)){let u=Number(r);if(!Number.isSafeInteger(u)||u<1||u>e.length)throw new l(`${i} version must be between 1 and ${e.length} for this item.`,c.USAGE,s);return{kind:"version",raw:r,historyIndex:u-1}}let h=Date.parse(r);if(!Number.isFinite(h))throw new l(`Invalid ${o} target "${t}". Use a positive version number or ISO timestamp.`,c.USAGE,s);let f=yt(e,h);if(f<0||n.allowFutureTimestamp!==!0&&h>Date.parse(a))throw new l(o==="restore"?`No history entries exist at or before timestamp ${r}.`:`No history entry exists at timestamp ${r}.`,c.USAGE,s);return{kind:"timestamp",raw:r,historyIndex:f}}function A(t,e,n,r){let o=Q(t,e);if(o.ok)return o.document;let i=pt(e,o.error),s=[`history_op=${r}`,i.patchIndex===void 0?null:`patch_index=${i.patchIndex}`,i.op?`op=${i.op}`:null,i.path?`path=${i.path}`:null,i.from?`from=${i.from}`:null].filter(a=>a!==null);throw new l(`Failed to apply history patch at entry ${n} (${s.join(", ")}). ${i.reason??String(o.error)}`,c.GENERIC_FAILURE)}function Gt(t,e){let n=structuredClone(_);for(let r=0;r<=e;r+=1){let o=t[r];if(!o)throw new l(`History target entry ${r+1} does not exist.`,c.USAGE);if(d(n)!==o.before_hash)throw new l(`History hash mismatch before replay at entry ${r+1}.`,c.GENERIC_FAILURE);if(n=A(n,o.patch,r+1,o.op),d(n)!==o.after_hash)throw new l(`History hash mismatch after replay at entry ${r+1}.`,c.GENERIC_FAILURE)}return n}function Bt(t,e){if(Object.keys(t.metadata).length>0)return t;throw new l(`History target ${e.raw} resolves to a deleted state; choose a version or timestamp where the item exists.`,c.USAGE)}import U from"node:fs/promises";import gt from"node:fs/promises";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="a2ec9f1a-aae2-59d5-8c9a-7acd8bf5a7a2")}catch{}})();function It(t){if(!t.itemDocument)return[];let e=t.itemDocument.metadata?.assignee?.trim();if(!e||e===t.author||t.force)return[];let n=et(t.settings);if(n.ownership_enforcement==="strict")throw new l(`Item ${t.subjectId} is assigned to ${e}. Use --force to override.`,c.CONFLICT);return n.ownership_enforcement==="warn"?[`ownership_warning:assignee_conflict:${t.subjectId}:${e}`]:[]}async function _t(t){let e=await H(t.subject.historyPath);if(e!==t.historyRawBeforeLock)throw new l(`History for ${t.subject.id} changed while waiting for lock; retry ${t.operation}.`,c.CONFLICT);let n=await P(t.pmRoot,t.subject.id,t.settings.id_prefix,t.settings.item_format,t.typeRegistry.type_to_folder),r=n?await D(n,{schema:t.settings.schema}):null;if((r?.raw??null)!==(t.currentItemRawBeforeLock??null))throw new l(`Item ${t.subject.id} changed while waiting for lock; retry ${t.operation}.`,c.CONFLICT);return{historyRawUnderLock:e,locatedUnderLock:n,loadedItemUnderLock:r}}async function Zt(t){let e=t.writeHistoryRaw??m;try{await e(t.historyPath,t.nextHistoryRaw),await p(t.historyPath)}catch(n){try{t.historyRawUnderLock===null?await gt.rm(t.historyPath,{force:!0}):await e(t.historyPath,t.historyRawUnderLock),await p(t.historyPath)}catch(r){throw new AggregateError([n,r],`History rewrite failed and rollback also failed: ${String(n)}`)}throw n}}async function at(t){let e=[...It({itemDocument:t.itemDocument,subjectId:t.subject.id,author:t.author,force:t.force,settings:t.settings})],n=await W(t.pmRoot,t.subject.id,t.settings.locks.ttl_seconds,t.author,!!t.force,t.settings.governance.force_required_for_stale_lock,t.settings.locks.wait_ms);try{let r=await _t({pmRoot:t.pmRoot,subject:t.subject,settings:t.settings,typeRegistry:t.typeRegistry,historyRawBeforeLock:t.historyRawBeforeLock,currentItemRawBeforeLock:t.currentItemRawBeforeLock,operation:t.operation});return await t.applyRewrite(r),t.applyPostRewrite&&e.push(...await t.applyPostRewrite(r)),e}finally{await n()}}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="cd2a27ec-0f12-591d-ab34-529ddda05063")}catch{}})();function ct(t){return Array.isArray(t)?t:typeof t=="string"?[t]:[]}function xt(t){let e=[];for(let n of t)e.includes(n)||e.push(n);return e.includes("g")||e.push("g"),e.join("")}function bt(t){let e=t.trim();if(e.length===0)throw new l("history-redact --regex requires a non-empty pattern.",c.USAGE);let n=e,r="g";if(e.startsWith("/")&&e.length>1){let o=e.lastIndexOf("/");o>0&&(n=e.slice(1,o),r=xt(e.slice(o+1)))}if(n.length===0)throw new l("history-redact --regex cannot use an empty pattern.",c.USAGE);try{new RegExp(n,r)}catch{throw new l("Invalid --regex value; provide a valid JavaScript regular expression.",c.USAGE)}return{kind:"regex",source:n,flags:r}}function Rt(t,e){let n=[...new Set(ct(t).map(i=>i.trim()))].filter(i=>i.length>0).map(i=>({kind:"literal",value:i})),r=[...new Set(ct(e).map(i=>i.trim()))].filter(i=>i.length>0).map(bt),o=[...n,...r];if(o.length===0)throw new l("history-redact requires at least one matcher via --literal or --regex.",c.USAGE,{code:"missing_required_argument",required:"Provide --literal <value> and/or --regex <pattern>.",examples:['pm history-redact pm-a1b2 --literal "[redacted_path_prefix]/private"','pm history-redact pm-a1b2 --regex "/192\\\\.168\\\\.[0-9.]+/g" --replacement "[scrubbed_ip]"']});return o}function Et(t,e,n){if(e.length===0)return{value:t,replacements:0};let r=0,o=0;for(;r<=t.length;){let i=t.indexOf(e,r);if(i===-1)break;o+=1,r=i+Math.max(1,e.length)}return o===0?{value:t,replacements:0}:{value:t.split(e).join(n),replacements:o}}function vt(t,e,n){let r=new RegExp(e.source,e.flags),o=[...t.matchAll(r)];return o.length===0?{value:t,replacements:0}:{value:t.replace(r,n),replacements:o.length}}function lt(t,e,n){let r=t,o=0;for(let i of e){let s=i.kind==="literal"?Et(r,i.value,n):vt(r,i,n);r=s.value,o+=s.replacements}return{value:r,replacements:o}}function F(t,e,n){if(typeof t=="string")return lt(t,e,n);if(Array.isArray(t)){let r=0;return{value:t.map(i=>{let s=F(i,e,n);return r+=s.replacements,s.value}),replacements:r}}if(typeof t=="object"&&t!==null){let r=0,o={};for(let[i,s]of Object.entries(t)){let a=F(s,e,n);r+=a.replacements,o[i]=a.value}return{value:o,replacements:r}}return{value:t,replacements:0}}function kt(t){let e=structuredClone(_),n=0,r=0;for(let o=0;o<t.length;o+=1){let i=t[o];d(e)!==i.before_hash&&(n+=1),e=A(e,i.patch,o+1,i.op),d(e)!==i.after_hash&&(r+=1)}return{hashMismatchesBefore:n,hashMismatchesAfter:r,finalDocument:e}}function Ht(t,e,n){let r=0,o=!1,i=t.message;if(typeof t.message=="string"){let a=lt(t.message,e,n);i=a.value,r+=a.replacements,a.replacements>0&&(o=!0)}let s=t.patch.map(a=>{if(!Object.prototype.hasOwnProperty.call(a,"value"))return a;let h=F(a.value,e,n);return r+=h.replacements,h.replacements>0?(o=!0,{...a,value:h.value}):a});return{entry:{...t,message:i,patch:s},replacements:r,changed:o}}function Pt(t,e,n){let r=structuredClone(_),o=0,i=0,s=[];for(let a=0;a<t.length;a+=1){let h=Ht(t[a],e,n);i+=h.replacements,h.changed&&(o+=1);let f=d(r);r=A(r,h.entry.patch,a+1,h.entry.op);let u=d(r);s.push({...h.entry,before_hash:f,after_hash:u})}return{entries:s,finalDocument:r,entriesChanged:o,replacements:i}}function Dt(t){return Object.keys(t.metadata).length>0}async function At(t,e){let n=t.located?.itemPath??null;if(!t.located)return{raw:null,path:n,document:null};let r=await D(t.located,{schema:e.schema});return{raw:r.raw,path:n,document:r.document}}function Tt(t){if(!Dt(t.finalDocument))return{raw:null,path:null,document:null};let e=X(L(t.finalDocument),{schema:t.settings.schema});if(e.metadata.id!==t.subject.id)throw new l("history-redact would change the item id; narrow your patterns.",c.USAGE);return{document:e,path:q(t.pmRoot,e.metadata.type,t.subject.id,"toon",t.typeToFolder),raw:Y(e,{format:"toon",schema:t.settings.schema})}}function $t(t,e){return typeof t.message=="string"&&t.message.trim().length>0?t.message:`history-redact replaced ${e.replacements} match(es) across ${e.entriesChanged} entr${e.entriesChanged===1?"y":"ies"}.`}function jt(t){let e=[...t.rewritten.entries];if(t.dryRun||!t.changed)return{rewrittenEntries:e,auditEntryAdded:!1};let n=t.nextItemDocument??L(t.rewritten.finalDocument);return e.push(K({nowIso:S(),author:t.author,op:"history_redact",before:n,after:n,message:t.message})),{rewrittenEntries:e,auditEntryAdded:!0}}async function Ct(t){let e=[];return at({pmRoot:t.pmRoot,subject:t.subject,settings:t.settings,typeRegistry:t.typeRegistry,historyRawBeforeLock:t.historyRawBeforeLock,currentItemRawBeforeLock:t.currentItem.raw,operation:"history-redact",author:t.author,force:t.force,itemDocument:t.currentItem.document,applyRewrite:async({historyRawUnderLock:n})=>{let r=await it(t.pmRoot,t.author),o=new Set;t.currentItem.path&&o.add(t.currentItem.path),t.nextItem.path&&o.add(t.nextItem.path);let i=new Map;t.currentItem.path&&t.currentItem.raw!==null&&i.set(t.currentItem.path,t.currentItem.raw);let s=()=>{};try{try{t.nextItem.path&&t.nextItem.raw!==null&&t.nextItem.raw!==t.currentItem.raw&&await m(t.nextItem.path,t.nextItem.raw),t.currentItem.path&&(!t.nextItem.path||t.nextItem.path!==t.currentItem.path)&&await U.rm(t.currentItem.path,{force:!0}),await m(t.subject.historyPath,tt(t.rewrittenEntries))}catch(h){try{await St(t.subject.historyPath,n,o,i)}finally{await p(t.subject.historyPath)}throw h}await p(t.subject.historyPath);let a=t.nextItem.path??t.currentItem.path;a&&(e=await st({pmRoot:t.pmRoot,preferredFormat:t.settings.item_format,typeToFolder:t.typeRegistry.type_to_folder,schema:t.settings.schema,itemPath:a,...t.currentItem.path?{previousItemPath:t.currentItem.path}:{},document:t.nextItem.document}))}finally{await r().catch(a=>{s=()=>{throw a}})}s()},applyPostRewrite:async()=>[...e,...await Lt(t.subject.historyPath,[t.nextItem.path,t.currentItem.path])]})}async function St(t,e,n,r){e===null?await U.rm(t,{force:!0}):await m(t,e);for(let o of n){let i=r.get(o);i===void 0?await U.rm(o,{force:!0}):await m(o,i)}}async function Lt(t,e){let n=[],r=new Set(e.filter(o=>o!==null));for(let o of r)n.push(...await C({path:o,scope:"project",op:"history_redact"}));return n.push(...await C({path:t,scope:"project",op:"history_redact:history"})),n}async function Ut(t,e,n,r){let o=await P(t,e,n.id_prefix,n.item_format,r);if(o)return{id:o.id,historyPath:j(t,o.id),located:o};let i=ot(e,n.id_prefix),s=nt(e),a=i===s?[i]:[i,s];for(let h of a){let f=j(t,h);if(await k(f))return{id:h,historyPath:f,located:null}}throw new l(`Item ${e} not found`,c.NOT_FOUND)}async function xe(t,e,n){let r=G(process.cwd(),n.path);if(!await k(B(r)))throw new l(`Tracker is not initialized at ${r}. Run pm init first.`,c.NOT_FOUND);let o=await rt(r),i=M(o,z()),s=e.replacement??"",a=s.length===0,h=a?"[redacted]":s,f=Rt(e.literal,e.regex),u=await Ut(r,t,o,i.type_to_folder);if(!await k(u.historyPath))throw new l(`No history stream exists for ${u.id}.`,c.NOT_FOUND);let ht=await H(u.historyPath),x=await J(u.historyPath,u.id);if(x.length===0)throw new l(`No history entries exist for ${u.id}; nothing to redact.`,c.USAGE);let b=kt(x),y=Pt(x,f,h),T=b.hashMismatchesBefore+b.hashMismatchesAfter,$=!!e.dryRun,R=y.replacements>0,E=[];T>0&&E.push(`history_redact_preexisting_hash_mismatches:${T}`),R||E.push("history_redact_no_matches");let g=await At(u,o),w=Tt({pmRoot:r,subject:u,settings:o,typeToFolder:i.type_to_folder,finalDocument:y.finalDocument}),ut=(g.path??null)!==(w.path??null)||(g.raw??null)!==(w.raw??null),N=V(e.author,o.author_default),ft=$t(e,y),{rewrittenEntries:O,auditEntryAdded:dt}=jt({rewritten:y,dryRun:$,changed:R,nextItemDocument:w.document,author:N,message:ft}),v=Z(O);if(!v.ok)throw new l(`history-redact produced an invalid rewritten chain (${v.errors.join(", ")}).`,c.GENERIC_FAILURE);return!$&&R&&E.push(...await Ct({pmRoot:r,subject:u,settings:o,typeRegistry:i,historyRawBeforeLock:ht,currentItem:g,nextItem:w,author:N,force:e.force,rewrittenEntries:O})),{id:u.id,dry_run:$,changed:R,patterns:{literal_count:f.filter(I=>I.kind==="literal").length,regex_count:f.filter(I=>I.kind==="regex").length,total_count:f.length,replacement_is_default:a},history:{path:u.historyPath,entries_scanned:x.length,entries_changed:y.entriesChanged,replacements:y.replacements,hash_mismatches_before:b.hashMismatchesBefore,hash_mismatches_after:b.hashMismatchesAfter,preexisting_hash_mismatches:T,audit_entry_added:dt,verify_ok:v.ok,verify_errors:v.errors},item:{existed_before:g.path!==null,exists_after:w.path!==null,path_before:g.path,path_after:w.path,changed:ut},warnings:[...new Set(E)].sort((I,mt)=>I.localeCompare(mt)),generated_at:S()}}export{Mt as a,A as b,Gt as c,Bt as d,Zt as e,at as f,Ut as g,xe as h};
2
+ //# sourceMappingURL=chunk-WEM2E2PE.js.map
@@ -0,0 +1,5 @@
1
+ import{X as we,l as pe,t as T,u as ye,v as ge,w as _e}from"./chunk-FGKY4MBE.js";import{e as fe,f as me,g as he}from"./chunk-WEM2E2PE.js";import{a as M}from"./chunk-PIMMYG7Q.js";import{Aa as j,Ba as I,K as re,Ka as x,L as S,M as P,ab as ue,ba as D,da as ne,db as le,ea as ie,fa as oe,ga as se,k as F,la as ae,n as te,ta as O,wa as ce,xa as de,za as B}from"./chunk-7J5TUBUJ.js";import{D as L,J as C,M as k,h as Z,p as E,q as ee}from"./chunk-BIMTMOS7.js";import{Y as y,Z as g,aa as w}from"./chunk-Y4LDYLLT.js";(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]="582576df-8dbe-5f93-890b-5d872669dfe8")}catch{}})();function U(e,t){let n=D(e);if(n)throw new g(`History merge input (${t}) contains unresolved conflict markers at line ${n.line}. Merge drivers must receive clean per-side versions.`,y.GENERIC_FAILURE);let r=[];for(let[o,a]of e.split(/\r?\n/).entries()){let i=a.trim();if(i)try{let d=JSON.parse(i);if(typeof d!="object"||d===null||Array.isArray(d))throw new TypeError("history entry must be an object");r.push(d)}catch{throw new g(`History merge input (${t}) contains invalid JSON at line ${o+1}.`,y.GENERIC_FAILURE)}}return r}function v(e){return w({ts:e.ts,author:e.author,op:e.op,patch:e.patch,message:e.message??null})}function Ne(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&v(e[r])===v(t[r]);)r+=1;return r}function Re(e,t,n){U(e,"base");let r=U(t,"ours"),o=U(n,"theirs"),a=Ne(r,o);if(a===r.length&&a===o.length)return{merged:I(r),strategy:"identical",common_entries:a,entries_from_ours:0,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(a===o.length)return{merged:I(r),strategy:"fast_forward_ours",common_entries:a,entries_from_ours:r.length-a,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(a===r.length)return{merged:I(o),strategy:"fast_forward_theirs",common_entries:a,entries_from_ours:0,entries_from_theirs:o.length-a,entries_total:o.length,reanchored:!1};let i=r.slice(a),d=new Set(i.map(v)),c=o.slice(a).filter(u=>!d.has(v(u))),m=[...i,...c].sort((u,f)=>{let l=P(u.ts,f.ts);if(l!==0)return l;let h=d.has(v(u)),p=d.has(v(f));return h!==p?Number(p)-Number(h):v(u).localeCompare(v(f))}),s=j([...r.slice(0,a),...m]);return{merged:I(s.entries),strategy:"union_reanchor",common_entries:a,entries_from_ours:i.length,entries_from_theirs:c.length,entries_total:s.entries.length,reanchored:!0}}function J(e,t){let n=D(e);if(n)throw new g(`Relationship merge input (${t}) contains unresolved conflict markers at line ${n.line}. Merge drivers must receive clean per-side versions.`,y.GENERIC_FAILURE);let r=[];for(let[o,a]of e.split(/\r?\n/).entries()){let i=a.trim();if(!i)continue;let d;try{d=JSON.parse(i)}catch{throw new g(`Relationship merge input (${t}) contains invalid JSON at line ${o+1}.`,y.GENERIC_FAILURE)}if(typeof d!="object"||d===null||Array.isArray(d)||typeof d.eventId!="string"||typeof d.sequence!="number")throw new g(`Relationship merge input (${t}) line ${o+1} is not a relationship event (eventId + sequence required).`,y.GENERIC_FAILURE);r.push(d)}return r}function H(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
2
+ `)}
3
+ `}function $e(e){return e.map((t,n)=>({...t,sequence:n+1}))}function ve(e,t,n){J(e,"base");let r=J(t,"ours"),o=J(n,"theirs"),a=Math.min(r.length,o.length),i=0;for(;i<a&&r[i].eventId===o[i].eventId;)i+=1;if(i===r.length&&i===o.length)return{merged:H(r),strategy:"identical",common_entries:i,entries_from_ours:0,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(i===o.length)return{merged:H(r),strategy:"fast_forward_ours",common_entries:i,entries_from_ours:r.length-i,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(i===r.length)return{merged:H(o),strategy:"fast_forward_theirs",common_entries:i,entries_from_ours:0,entries_from_theirs:o.length-i,entries_total:o.length,reanchored:!1};let d=r.slice(i),c=new Set(d.map(f=>f.eventId)),m=o.slice(i).filter(f=>!c.has(f.eventId)),s=[...d,...m].sort((f,l)=>{if(f.timestamp!==void 0&&l.timestamp!==void 0){let _=P(f.timestamp,l.timestamp);if(_!==0)return _}else{if(f.timestamp===void 0&&l.timestamp!==void 0)return 1;if(f.timestamp!==void 0)return-1}let h=c.has(f.eventId),p=c.has(l.eventId);return h!==p?Number(p)-Number(h):0}),u=$e([...r.slice(0,i),...s]);return{merged:H(u),strategy:"union_reanchor",common_entries:i,entries_from_ours:d.length,entries_from_theirs:m.length,entries_total:u.length,reanchored:!0}}var Pe=["tags","dependencies","comments","notes","learnings","files","tests","test_runs","docs","reminders","events"],De=["updated_at"];function b(e,t){return w(e??null)===w(t??null)}function je(e,t,n){let r=s=>Array.isArray(s)?s:[],o=new Set(r(e).map(s=>w(s))),a=r(t),i=new Set(a.map(s=>w(s))),d=r(n),c=new Set(d.map(s=>w(s))),m=a.filter(s=>{let u=w(s);return!o.has(u)||c.has(u)});for(let s of d){let u=w(s);!i.has(u)&&!o.has(u)&&m.push(s)}return m}function Me(e,t){return P(String(e),String(t))>=0?e:t}function q(e,t,n,r){return b(t,n)?{value:t,from_theirs:!1,conflict:!1}:b(e,t)?{value:n,from_theirs:!0,conflict:!1}:b(e,n)?{value:t,from_theirs:!1,conflict:!1}:{value:r==="theirs"?n:t,from_theirs:r==="theirs",conflict:!0}}function G(e){return{...e.metadata}}function z(e,t,n){try{return oe(ne(e,n),n)}catch(r){throw new g(`Item merge input (${t}) is not a readable item document: ${String(r)}`,y.GENERIC_FAILURE)}}function He(e,t,n,r){let o=new Set(Pe),a=new Set(De),i=[...new Set([...Object.keys(t),...Object.keys(n)])].sort((c,m)=>c.localeCompare(m)),d={merged:{},conflictFields:[],fieldsFromTheirs:[],unionFields:[],conflictDecisions:[]};for(let c of i){let m=e[c],s=t[c],u=n[c];if(o.has(c)){let l=je(m,s,u);d.merged[c]=l,b(l,s)||d.unionFields.push(c);continue}if(a.has(c)){d.merged[c]=Me(s,u);continue}let f=q(m,s,u,r);f.value!==void 0&&(d.merged[c]=f.value),f.conflict?(d.conflictFields.push(c),d.conflictDecisions.push({field:c,base:m,ours:s,theirs:u,retained:f.value,discarded:r==="theirs"?s:u})):f.from_theirs&&d.fieldsFromTheirs.push(c)}return d}function Ie(e,t,n,r={}){let o=r.preferred??"ours",a=e.trim().length>0,i=z(t,"ours",r),d=z(n,"theirs",r),c=a?z(e,"base",r):i,m=a?G(c):{},s=G(i),u=G(d),{merged:f,conflictFields:l,fieldsFromTheirs:h,unionFields:p,conflictDecisions:_}=He(m,s,u,o),R=q(a?c.body:"",i.body,d.body,o);return R.conflict?(l.push("body"),_.push({field:"body",base:a?c.body:"",ours:i.body,theirs:d.body,retained:R.value,discarded:o==="theirs"?i.body:d.body})):R.from_theirs&&h.push("body"),{merged:ie({metadata:f,body:R.value},r),conflict_fields:l,fields_from_theirs:h,union_fields:p,conflict_decisions:_,preferred:o}}function V(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function W(e,t){let n=D(e);if(n)throw new g(`JSON merge input (${t}) contains unresolved conflict markers at line ${n.line}.`,y.GENERIC_FAILURE);if(e.trim().length!==0)try{return JSON.parse(e)}catch{throw new g(`JSON merge input (${t}) is not valid JSON.`,y.GENERIC_FAILURE)}}function Le(e,t,n){if(!Array.isArray(e)||!Array.isArray(t)||!Array.isArray(n))return null;let r=m=>{let s=new Map;for(let u of m){let f=w(u);s.set(f,(s.get(f)??0)+1)}return s},o=r(e),a=r(t),i=r(n);for(let[m,s]of o)if((a.get(m)??0)<s||(i.get(m)??0)<s)return null;let d=new Map(a),c=[];for(let m of n){let s=w(m),u=d.get(s)??0;u>0?d.set(s,u-1):c.push(m)}return{merged:[...t,...c],acceptedTheirs:c.length>0}}function Be(e,t,n,r,o,a,i){if(!V(t)||!V(n))return null;let d=V(e)?e:{},c={},m=[...new Set([...Object.keys(t),...Object.keys(n)])].sort((s,u)=>s.localeCompare(u));for(let s of m){let u=o.length>0?`${o}.${s}`:s,f=Ue(d,t,n,s,r,u,a,i);f!==void 0&&(c[s]=f)}return c}function be(e,t,n,r,o,a,i){if(b(t,n))return t;let d=Le(e,t,n);if(d!==null)return d.acceptedTheirs&&i.push(o),d.merged;let c=Be(e,t,n,r,o,a,i);if(c!==null)return c;let m=q(e,t,n,r);return m.conflict?a.push(o):m.from_theirs&&i.push(o),m.value}function Ue(e,t,n,r,o,a,i,d){let c=Object.prototype.hasOwnProperty.call(t,r),m=Object.prototype.hasOwnProperty.call(n,r),s=Object.prototype.hasOwnProperty.call(e,r);if(c&&m)return be(e[r],t[r],n[r],o,a,i,d);if(c){if(s&&b(e[r],t[r])){d.push(a);return}return s?(i.push(a),o==="theirs"?void 0:t[r]):t[r]}if(!(s&&b(e[r],n[r])))return s?(i.push(a),o==="theirs"?n[r]:void 0):(d.push(a),n[r])}function Ee(e,t,n,r={}){let o=r.preferred??"ours",a=W(e,"base"),i=W(t,"ours"),d=W(n,"theirs"),c=[],m=[],s=be(a,i,d,o,"",c,m);return{merged:`${JSON.stringify(s??null,null,2)}
4
+ `,conflict_paths:c,paths_from_theirs:m,preferred:o}}import{readFile as Je,writeFile as Ge}from"node:fs/promises";import ze 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]="182fee45-4de8-502d-8aec-84b5b8e4aecb")}catch{}})();var Se=["item","history","relationship","json"];function Ve(e){let t=e.trim().toLowerCase();if(Se.includes(t))return t;throw new g(`Unknown merge artifact "${e}". Supported values: ${Se.join(", ")}.`,y.USAGE)}function We(e){if(e===void 0)return"ours";let t=e.trim().toLowerCase();if(t==="ours"||t==="theirs")return t;throw new g(`Unknown --prefer value "${e}". Supported values: ours, theirs.`,y.USAGE)}async function X(e,t){try{return await Je(e,"utf8")}catch{throw new g(`Cannot read merge ${t} file at ${e}.`,y.NOT_FOUND)}}async function qe(e){let t=C(process.cwd(),e.path);return await E(k(t))?x(t):null}function Xe(e,t){return e.endsWith(".md")?"json_markdown":e.endsWith(".toon")?"toon":t?.item_format??"toon"}async function It(e,t){let n=Ve(e.artifact),r=We(e.prefer),o=ze.resolve(e.outputPath??e.oursPath),[a,i,d]=await Promise.all([X(e.basePath,"base"),X(e.oursPath,"ours"),X(e.theirsPath,"theirs")]),c,m,s=[],u={};if(n==="history"){let l=Re(a,i,d);c=l.merged,u.history={strategy:l.strategy,common_entries:l.common_entries,entries_from_ours:l.entries_from_ours,entries_from_theirs:l.entries_from_theirs,entries_total:l.entries_total,reanchored:l.reanchored}}else if(n==="relationship"){let l=ve(a,i,d);c=l.merged,u.relationship={strategy:l.strategy,common_entries:l.common_entries,entries_from_ours:l.entries_from_ours,entries_from_theirs:l.entries_from_theirs,entries_total:l.entries_total,reanchored:l.reanchored}}else if(n==="item"){let l=await qe(t),h=Ie(a,i,d,{format:Xe(e.itemPath??o,l),schema:l?.schema,extensionFieldNames:Z(F()),preferred:r});c=h.merged,s.push(...h.conflict_fields),u.item={fields_from_theirs:h.fields_from_theirs,union_fields:h.union_fields},e.itemPath!==void 0&&(m={cwd:process.cwd(),itemPath:e.itemPath,preferred:r,fieldsFromTheirs:h.fields_from_theirs,unionFields:h.union_fields,decisions:h.conflict_decisions})}else{let l=Ee(a,i,d,{preferred:r});c=l.merged,s.push(...l.conflict_paths),u.json={paths_from_theirs:l.paths_from_theirs}}if(await Ge(o,c,"utf8"),m!==void 0){let l=await ye(m);l!==null&&(u.receipt=T(l))}let f=[];if(s.length>0){let l=u.receipt===void 0?'Run "pm merge report" to inspect clone-local merge evidence.':`Run "pm merge report" and correlate receipt ${u.receipt.receipt_id} with item ${u.receipt.item_id}; clone-local discarded values are never copied into this result.`;f.push(`Both branches changed ${s.join(", ")}; the ${r} value was kept. ${l} Review the merged file, re-apply the losing change if needed, then "git add" it.`)}return n==="history"&&u.history?.reanchored&&f.push('The merged history chain was re-anchored. Run "pm validate --check-history-drift" and "pm history-repair --all" after the merge to reconcile item state with merged history.'),{ok:s.length===0,artifact:n,output_path:o,preferred:r,conflicts:s,...u,guidance:f,generated_at:S()}}import Ce from"fast-json-patch";(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]="dd5ab9c3-bc6f-59f1-be89-ad0ab2abe7b5")}catch{}})();function Oe(e,t){return t==="body"?e.body:e.metadata[t]}function K(e,t){if(e===void 0||Object.is(e,t))return!0;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let r=new Set;return e.every(o=>{let a=t.findIndex((i,d)=>!r.has(d)&&K(o,i));return a<0?!1:(r.add(a),!0)})}if(e===null||t===null||typeof e!="object"||typeof t!="object"||Array.isArray(t))return!1;let n=t;return Object.entries(e).every(([r,o])=>Object.hasOwn(n,r)&&K(o,n[r]))}function Ae(e,t){let n=new Set(t),r=[];for(let o=e.length-1;o>=0&&n.size>0;o-=1){let a=e[o],i=new Set;for(let c of de(a.patch))i.add(M(c.path)),c.from&&i.add(M(c.from));let d=[...n].filter(c=>i.has(c));if(d.length!==0){for(let c of d)n.delete(c);r.push({index:o+1,ts:a.ts,author:a.author,op:a.op,fields:d.sort((c,m)=>c.localeCompare(m))})}}return r.reverse()}function Ke(e,t,n){let r=Ce.compare(t,n);if(r.length===0)return;let o=new Set;for(let h of r)o.add(M(h.path));let a=new Set([...o].filter(h=>K(Oe(t,h),Oe(n,h)))),i=new Set([...o].filter(h=>!a.has(h))),d=Ae(e,i),c=Ae(e,a),m=[...o].sort((h,p)=>h.localeCompare(p)),s=[...i].sort((h,p)=>h.localeCompare(p)),u=[...a].sort((h,p)=>h.localeCompare(p)),f=[...new Set(d.map(h=>h.author))].sort((h,p)=>h.localeCompare(p)),l=[...new Set(c.map(h=>h.author))].sort((h,p)=>h.localeCompare(p));return{reconciled_field_count:o.size,reconciled_fields:m,reverted_field_count:i.size,reverted_fields:s,discarded_events:d,discarded_authors:f,preserved_field_count:a.size,preserved_fields:u,preserved_events:c,preserved_authors:l,recovery_hint:d.length>0?"Reconciliation keeps the on-disk item and overwrites these replayed mutations. To recover one, inspect it with pm history <id> --diff --field <field>, then re-apply the lost value with pm update.":null}}async function Qe(e,t,n){let r=e.located?.itemPath??null,o=e.located?await ue(e.located,{schema:t.schema}):null;if(!o)return{currentItemReplay:null,currentItemPath:r,matchedChainBefore:null,currentItemRawBeforeLock:null,loadedItem:null};let a=ce(o.document),i=n[n.length-1]?.after_hash;return{currentItemReplay:a,currentItemPath:r,matchedChainBefore:O(a)===i,currentItemRawBeforeLock:o.raw,loadedItem:o}}function Ye(e){return typeof e.message=="string"&&e.message.trim().length>0?e.message:`history-repair re-anchored ${e.entriesRehashed} entr${e.entriesRehashed===1?"y":"ies"}${e.entriesPatchRepaired>0?`, repaired ${e.entriesPatchRepaired} patch(es)`:""}${e.reconcileNeeded?", reconciled chain with on-disk item":""}.`}function Ze(e){let t=[...e.reanchorEntries];if(!e.changed)return{rewrittenEntries:t,auditEntryAdded:!1};let n=e.reconcileNeeded&&e.currentItemReplay?e.currentItemReplay:e.finalReplay;return t.push({ts:S(),author:e.author,op:e.auditOperation,patch:e.reconcileNeeded&&e.currentItemReplay?Ce.compare(e.finalReplay,e.currentItemReplay):[],before_hash:O(e.finalReplay),after_hash:O(n),message:e.message,...e.auditContext===void 0?{}:{context:e.auditContext}}),{rewrittenEntries:t,auditEntryAdded:!0}}function et(e,t){let n=[];return e||n.push("history_repair_no_changes"),t>0&&n.push(`history_repair_skipped_unresolvable_ops:${t}`),n}async function tt(e){return me({pmRoot:e.pmRoot,subject:e.subject,settings:e.settings,typeRegistry:e.typeRegistry,historyRawBeforeLock:e.historyRawBeforeLock,currentItemRawBeforeLock:e.currentItemRawBeforeLock,operation:"history-repair",author:e.author,force:e.force,itemDocument:e.loadedItem?.document??null,applyRewrite:async({historyRawUnderLock:t})=>fe({historyPath:e.historyPath,nextHistoryRaw:I(e.rewrittenEntries),historyRawUnderLock:t}),applyPostRewrite:async()=>te({path:e.historyPath,scope:"project",op:"history_repair:history"})})}async function Q(e,t,n){let r=C(process.cwd(),n.path);if(!await E(k(r)))throw new g(`Tracker is not initialized at ${r}. Run pm init first.`,y.NOT_FOUND);let o=await x(r),a=L(o,F()),i=await he(r,e,o,a.type_to_folder);if(!await E(i.historyPath))throw new g(`No history stream exists for ${i.id}.`,y.NOT_FOUND);let d=await ee(i.historyPath),c=await se(i.historyPath,i.id);if(c.length===0)throw new g(`No history entries exist for ${i.id}; nothing to repair.`,y.USAGE);let m=B(c),s=j(c),u=await Qe(i,o,c),f=s.finalDocument,l=u.currentItemReplay!==null&&O(f)!==O(u.currentItemReplay),h=l&&u.currentItemReplay?Ke(s.entries,f,u.currentItemReplay):void 0,p=[s.entriesRehashed>0,s.entriesPatchRepaired>0,l,t.forceAuditEntry===!0].some(Boolean),_=re(t.author,o.author_default),R=!!t.dryRun,A=Ye({message:t.message,entriesRehashed:s.entriesRehashed,entriesPatchRepaired:s.entriesPatchRepaired,reconcileNeeded:l}),{rewrittenEntries:Y,auditEntryAdded:Fe}=Ze({reanchorEntries:s.entries,changed:p,reconcileNeeded:l,currentItemReplay:u.currentItemReplay,finalReplay:f,author:_,message:A,auditOperation:t.auditOperation??"history_repair",auditContext:t.auditContext}),N=B(Y);if(!N.ok)throw new g(`history-repair produced an invalid rewritten chain (${N.errors.join(", ")}).`,y.GENERIC_FAILURE);let $=et(p,s.skippedOps);return h&&h.discarded_events.length>0&&($.push(`history_repair_reconcile_discards_events:${h.discarded_events.length}`),$.push(`history_repair_discarded_authors:${h.discarded_authors.join(",")}`)),p&&!R&&$.push(...await tt({pmRoot:r,subject:i,settings:o,typeRegistry:a,historyRawBeforeLock:d,currentItemRawBeforeLock:u.currentItemRawBeforeLock,author:_,force:t.force,loadedItem:u.loadedItem,historyPath:i.historyPath,rewrittenEntries:Y})),{id:i.id,dry_run:R,changed:p,history:{path:i.historyPath,entries_scanned:c.length,chain_drift_before:!m.ok,entries_rehashed:s.entriesRehashed,entries_patch_repaired:s.entriesPatchRepaired,converted_replace_to_add:s.convertedReplaceToAdd,skipped_ops:s.skippedOps,reconciled_with_item:l,audit_entry_added:Fe,verify_ok:N.ok,verify_errors:N.errors},item:{exists:u.currentItemPath!==null,path:u.currentItemPath,matched_chain_before:u.matchedChainBefore},...h?{reconciliation:h}:{},warnings:[...new Set($)].sort((xe,Te)=>xe.localeCompare(Te)),generated_at:S()}}function Ut(e,t){if(t&&e!==void 0)throw new g("history-repair: <id> and --all are mutually exclusive; pass an item id to repair one stream or --all to repair every drifted stream.",y.USAGE);if(!t&&e===void 0)throw new g("history-repair: provide an item <id> or pass --all to repair every drifted stream.",y.USAGE)}async function ke(e,t){let n=C(process.cwd(),t.path);if(!await E(k(n)))throw new g(`Tracker is not initialized at ${n}. Run pm init first.`,y.NOT_FOUND);let r=await x(n),o=L(r,F()),a=[],i=await le(n,r.item_format,o.type_to_folder,a,r.schema,{forceSourceScan:!0}),d=await pe(n,i),c=[],m=[],s={repaired:0,skipped_clean:0,failed:0};for(let u of d.driftedItems)try{let f=await Q(u,{...e,auditContext:e.auditContextById?.[u],auditContextById:void 0},t),l=f.changed?"repaired":"skipped_clean";s[l]+=1,m.push(...f.warnings.map(h=>`${u}:${h}`)),c.push({id:u,outcome:l,entries_rehashed:f.history.entries_rehashed,entries_patch_repaired:f.history.entries_patch_repaired,reconciled_with_item:f.history.reconciled_with_item,...f.reconciliation?{reconciliation:f.reconciliation}:{},warnings:f.warnings})}catch(f){s.failed+=1,c.push({id:u,outcome:"failed",error:f instanceof Error?f.message:String(f)})}return e.dryRun||await ae(n),{all:!0,dry_run:!!e.dryRun,scanned_streams:i.length,drifted_streams:d.driftedItems.length,streams:c,totals:s,warnings:[...new Set([...a,...m])].sort((u,f)=>u.localeCompare(f)),generated_at:S()}}(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]="b2f34565-7664-5612-815d-949b8b1d4f90")}catch{}})();async function Wt(e,t){let n=e.dryRun===!0,r=await ge(process.cwd()),o=r.reduce((p,_)=>((p[_.item_id]??=[]).push(_),p),{}),a=Object.fromEntries(Object.entries(o).map(([p,_])=>[p,{merge:{receipts:_.map(T)}}])),i=await ke({dryRun:n,author:e.author??t.author,message:e.message??"post-merge reconciliation of field-aware tracker history",force:e.force,auditOperation:"merge_reconcile",auditContextById:a},t),d=new Set(i.streams.map(p=>p.id)),c=Object.keys(o).filter(p=>!d.has(p));(await Promise.allSettled(c.map(p=>Q(p,{dryRun:n,author:e.author??t.author,message:e.message??"record field-aware branch merge provenance",force:e.force,auditOperation:"merge_reconcile",auditContext:a[p],forceAuditEntry:!0},t)))).forEach((p,_)=>{let R=c[_];if(p.status==="fulfilled"){let A=p.value.changed?"repaired":"skipped_clean";i.streams.push({id:R,outcome:A,entries_rehashed:p.value.history.entries_rehashed,entries_patch_repaired:p.value.history.entries_patch_repaired,reconciled_with_item:p.value.history.reconciled_with_item,warnings:p.value.warnings}),i.totals[A]+=1}else i.streams.push({id:R,outcome:"failed",error:p.reason instanceof Error?p.reason.message:String(p.reason)}),i.totals.failed+=1});let s=0;!n&&i.totals.failed===0&&(await Promise.all(r.map(p=>_e(process.cwd(),p))),s=r.length);let u=await we({checkHistoryDrift:!0,checkStorageIntegrity:!0},t),f=u.checks.every(p=>p.status==="ok"),l=i.totals.failed===0&&f,h=n?["Review repair.streams, then rerun pm merge reconcile without --dry-run to apply audited repairs.","No Git hook is installed automatically; invoke this command from an explicit post-merge hook only when your repository policy opts in."]:l?["Reconciliation is complete; commit changed history streams with the merge result.","Rerun pm merge reconcile --dry-run after future tracker-data merges as a non-mutating integrity check."]:["Reconciliation remains incomplete; inspect repair failures and non-green validation checks before retrying.","Do not commit repaired history streams as reconciled until pm merge reconcile returns ok=true."];return{ok:l,dry_run:n,repair:i,receipts:{pending_before:r.length,reconciled:s,summaries:r.map(T)},validation:u,guidance:h,generated_at:u.generated_at}}export{Re as a,ve as b,Pe as c,De as d,Ie as e,Ee as f,Se as g,It as h,Q as i,Ut as j,ke as k,Wt as l};
5
+ //# sourceMappingURL=chunk-WVIVUWVL.js.map
@@ -0,0 +1,2 @@
1
+ (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]="938c39a8-6545-5d8b-b717-69138932d528")}catch{}})();var b=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],W=2,H=Object.freeze({migration:"schema",validation:"schema"}),qe=Object.freeze({version:W,capabilities:[...b],legacy_aliases:{...H}}),T=["off","warn","enforce"],N=["off","warn","enforce"],I=["none","restricted","strict"],ze=["block","warn"],w=["commands.override","commands.handler","hooks.beforecommand","hooks.beforemutation","hooks.aftercommand","hooks.onwrite","hooks.onread","hooks.onindex","schema.flags","schema.itemfields","schema.itemtypes","schema.relationshipkinds","schema.migrations","schema.profiles","parser.override","preflight.override","services.override","renderers.override","importers.importer","importers.exporter","search.provider","search.vectorstore"],x=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function R(){return{mode:"off",trust_mode:"off",require_provenance:!1,trusted_extensions:[],default_sandbox_profile:"none",allowed_extensions:[],blocked_extensions:[],allowed_capabilities:[],blocked_capabilities:[],allowed_surfaces:[],blocked_surfaces:[],allowed_commands:[],blocked_commands:[],allowed_actions:[],blocked_actions:[],allowed_services:[],blocked_services:[],extension_overrides:[]}}(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]="2a2072c1-f4a7-579e-ac11-4c75758d76d3")}catch{}})();var $=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],We=$,He=["draft","open","in_progress","blocked","closed","canceled"],$e=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],Je=["string","number","boolean","string_array","array","object"],Qe=["create","update","update_many","list","search","calendar","context"],Ze=["allow","warn","reject"],et=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","supersedes","task","verifies"],tt=["project","global"],nt=["low","medium","high","critical"],ot=["low","medium","high","critical"],rt=["low","medium","high"];var st=["minimal","default","strict","custom"],it=["none","warn","strict"],at=["progressive","strict"],ct=["off","warn","strict"],dt=["off","warn","strict"];var lt=["daily","weekly","monthly","yearly"],J=["mon","tue","wed","thu","fri","sat","sun"];function ut(e){return J.indexOf(e)}var _t=["draft","research","review","approved","executing","paused","completed","superseded"],ft=["pending","in_progress","completed","blocked","skipped","superseded"],pt=["codex","claude-code","cursor","generic"],mt=["related","blocks","blocked_by","depends_on","discovered_from","implements","verifies","supersedes"],Et=["brief","standard","deep","full"],gt=["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"];(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]="46d7e58b-d1b6-5f9d-86cb-76ca671ed127")}catch{}})();var Q=Object.freeze([{id:"draft",roles:["draft"]},{id:"open",roles:["active","default_open"]},{id:"in_progress",aliases:["in-progress"],roles:["active"]},{id:"blocked",roles:["blocked"]},{id:"closed",roles:["terminal","terminal_done","default_close"]},{id:"canceled",aliases:["cancelled"],roles:["terminal","terminal_canceled","default_cancel"]}]),Z=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),ht=".agents/pm",At="settings.json";var ee=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],te=["decisions","events","reminders","milestones","meetings","plans"],Ot=[...ee,...te],St={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},ne=["goal","objective","value","impact","outcome","why_now","parent","reviewer","risk","confidence","sprint","release","blocked_by","blocked_reason","unblock_note","reporter","severity","environment","repro_steps","resolution","expected_result","actual_result"],Tt=["id","title","description","type","pm_format_version","source_type","type_options","status","priority","tags","created_at","updated_at","deadline","reminders","events","closed_at","completed_at","assignee","claim_principal","source_owner","author","estimated_minutes","acceptance_criteria","design","external_ref","definition_of_ready","order",...ne,"affected_version","fixed_version","component","regression","customer_impact","dependencies","comments","notes","learnings","files","tests","test_runs","docs","close_reason","duplicate_of","plan_mode","plan_scope","plan_harness","plan_resume_context","plan_validation","plan_decisions","plan_discoveries","plan_steps"],oe={minimal:{ownership_enforcement:"none",create_mode_default:"progressive",close_validation_default:"off",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!1,duplicate_detection_mode:"off",duplicate_detection_threshold:.8,duplicate_detection_limit:3},default:{ownership_enforcement:"warn",create_mode_default:"progressive",close_validation_default:"warn",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3},strict:{ownership_enforcement:"strict",create_mode_default:"strict",close_validation_default:"strict",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"strict",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3}},re=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],h={blocked_reason:["no active blocker because work is closed","work is closed"],resolution:["closed with implementation evidence","closed with verification evidence","work completed and recorded","work is closed"],actual_result:["closed and recorded","work completed","work completed and recorded"]};function k(e){return e?[...e]:void 0}var Nt={version:1,id_prefix:"pm-",ids:{token_length:4},author_default:"",agent_identity:{probes_enabled:!0,identity_vocabulary:{version:1,aliases:{}},harness_signals:[]},mutation_guard:{require_attributed_author:!1,secret_guard:"advise",stale_in_progress_hours:72},item_format:"toon",locks:{ttl_seconds:1800,wait_ms:3e3},checkpoints:{retention_days:14},output:{default_format:"toon"},history:{missing_stream:"auto_create",compact_policy:{enabled:!1,max_entries:500,trigger:"health_warn"}},validation:{sprint_release_format:"warn",parent_reference:"warn",metadata_profile:"core",metadata_required_fields:[],lifecycle_stale_blocker_reason_patterns:[...re],lifecycle_closure_like_blocked_reason_patterns:[...h.blocked_reason],lifecycle_closure_like_resolution_patterns:[...h.resolution],lifecycle_closure_like_actual_result_patterns:[...h.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...oe.minimal},workflow:{definition_of_done:[]},testing:{record_results_to_items:!1},telemetry:{enabled:!0,first_run_prompt_completed:!1,capture_level:"redacted",endpoint:"https://pm-cli.unbrained.dev/v1/events",installation_id:"",retention_days:365},agent_guidance:{prompt_completed:!1,declined:!1,declined_at:"",template_version:1,last_checked_files:[]},item_types:{definitions:[]},schema:{version:1,files:{types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"},statuses:Q.map(e=>({...e,aliases:k(e.aliases),roles:k(e.roles)})),fields:[],workflow:{...Z},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:R()},search:{score_threshold:0,hybrid_semantic_weight:.7,max_results:50,embedding_model:"",embedding_batch_size:32,embedding_timeout_ms:3e4,scanner_max_batch_retries:3,provider:"",mutation_refresh_policy:"semantic_configured",query_expansion:{enabled:!1,provider:""},rerank:{enabled:!1,model:"",top_k:20}},providers:{openai:{base_url:"",api_key:"",model:""},ollama:{base_url:"",model:""}},context:{default_depth:"brief",activity_limit:10,stale_threshold_days:7,sections:{hierarchy:!0,activity:!0,progress:!0,recently_created:!0,unparented:!0,blockers:!0,files:!0,workload:!0,staleness:!0,tests:!0}},vector_store:{adapter:"",collection_name:"pm_items",qdrant:{url:"",api_key:""},lancedb:{path:""}}},It={metadata:{},body:""},E={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5},wt=Object.freeze({unknown_command:"usage",unknown_option:"usage",missing_required_option:"usage",missing_required_argument:"usage",invalid_command_usage:"usage",linked_test_value_not_quoted:"usage",invalid_argument_value:"validation",health_findings:"validation",validation_findings:"validation",close_through_update:"validation",no_update_fields:"validation",unsupported_update_option:"validation",tracker_not_initialized:"validation",item_not_found:"validation",ownership_conflict:"conflict",lock_conflict:"conflict",terminal_state_conflict:"conflict",dependency_failed:"runtime",init_gitignore_unwritable:"runtime",merge_git_config_unwritable:"runtime",command_failed:"runtime",unknown_error:"runtime"});(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]="c2c9251e-86bf-5a92-acdb-581e59d269d8")}catch{}})();var l=class extends Error{exitCode;code;context;constructor(t,n,o={}){super(t),this.name="PmCliError",this.exitCode=n,this.context=o,this.code=o.code}};(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]="15daa637-4d30-5794-bdb5-87585d443cd3")}catch{}})();var se=[...b],ie=[...x],ae=[...T],Ct=[...N],vt=[...I],ce=[...w],C=["init","config","extension","package","packages","install","upgrade","create","item","copy","focus","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","aggregate","context","ctx","get","graph","search","duplicates","eval","next","history","events","history-redact","history-repair","history-compact","history-author-acknowledge","merge","schema","profile","activity","restore","update","update-many","close","close-many","delete","append","comments","notes","learnings","files","docs","deps","plan","test","test-all","telemetry","stats","health","validate","gc","workspace","contracts","claim","release","start-task","pause-task","close-task","meet","event","remind","help"],Dt=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],de=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],v={help:"Commander help rendering has no SDK operation result.",item:"The item namespace only groups lifecycle subcommands already exposed as actions.",packages:"The plural package alias only renders package-oriented help."},D=Object.freeze(C.flatMap(e=>e in v?[]:e==="extension"||e==="package"?[...de.map(t=>`${e}-${t}`),e]:[e]));function Lt(e=C,t=D,n=v){let o=new Set(t),r=new Set(e);return{missing_cli_actions:e.filter(s=>!o.has(s)&&n[s]===void 0),waived_cli_actions:e.filter(s=>!o.has(s)&&n[s]!==void 0),stale_waivers:Object.keys(n).filter(s=>!r.has(s)||o.has(s))}}function Ut(e){return D.includes(e)}function Pt(e){return se.includes(e)}function Mt(e){return ie.includes(e)}function Vt(e){return ae.includes(e)}function jt(e){return ce.includes(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]="64c4e6e1-d7c4-50e0-a444-fb2fa3c65443")}catch{}})();var le=8,ue=64;function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function _e(e){let t=e.row_contract;return L(t)&&Array.isArray(t.row_keys)?t.row_keys.filter(n=>typeof n=="string"):Object.entries(e).filter(([,n])=>Array.isArray(n)).map(([n])=>n)}function A(e,t){return typeof e=="string"?e.length<=240?e:(t.compacted=!0,`${e.slice(0,240)}\u2026`):Array.isArray(e)?e.map(n=>A(n,t)):L(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>[n,A(o,t)])):e}function p(e,t){let n=t.estimated_tokens;for(let o=0;o<le;o+=1){t.estimated_tokens=n;let r=Math.ceil(Buffer.byteLength(JSON.stringify(e),"utf8")/4);if(r===n)return;n=r}t.estimated_tokens=n}function fe(e,t,n){let o=_e(e);for(let r=0;r<ue;r+=1){if(p(e,t),t.estimated_tokens<=n)return;let s=o.map(i=>({key:i,rows:Array.isArray(e[i])?e[i]:[]})).filter(({rows:i})=>i.length>1).sort((i,c)=>c.rows.length-i.rows.length||i.key.localeCompare(c.key))[0];if(!s)return;s.rows.splice(-Math.max(1,Math.ceil(s.rows.length/2))),t.rows_compacted=!0,e.has_more=!0,e.truncated=!0,typeof e.count=="number"&&(e.count=o.reduce((i,c)=>i+(Array.isArray(e[c])?e[c].length:0),0))}}function U(e,t,n){let o={compacted:!1},r=A(e,o);return t.strings_compacted=o.compacted,r.read_output=t,fe(r,t,n),p(r,t),r}(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]="27431a6b-6f2e-5020-b4f1-b94cfa8a1c26")}catch{}})();var u=["include","amount","cost","encoding"],F=["list","context","search","get","next","health","deps","graph","history","activity","validate","events","contracts","comments","notes","files","docs","stats","aggregate"],K=["canonical","legacy","intent","default"],S={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"},qt=Object.freeze(u.map(e=>S[e])),pe={list:{include:["--brief","--compact","--fields","--full"],amount:["--after","--limit","--no-truncate"],cost:["--token-budget"],encoding:["--format","--stream"]},context:{include:["--fields","--section"],amount:["--after","--depth","--limit"],cost:["--token-budget"],encoding:["--format"]},search:{include:["--compact","--fields","--full"],amount:["--after","--limit"],cost:["--token-budget"],encoding:["--format"]},get:{include:["--fields","--full"],amount:["--depth"],cost:["--token-budget"],encoding:["--format"]},next:{amount:["--blocked-limit","--limit"],cost:["--token-budget"],encoding:["--format"]},health:{include:["--brief","--check-only","--full","--summary","--verbose"]},deps:{include:["--collapse","--full","--summary"],amount:["--edge-limit","--max-depth","--node-limit"],cost:["--token-budget"],encoding:["--format"]},graph:{include:["--full","--summary"],amount:["--after","--limit","--max-depth","--max-paths"]},history:{include:["--compact","--full"],amount:["--limit"],encoding:["--format"]},activity:{include:["--compact","--full"],amount:["--limit","--unbounded"],encoding:["--stream"]},validate:{include:["--counts","--full","--verbose"]},events:{include:["--full"],amount:["--limit"],encoding:["--follow"]},contracts:{include:["--full","--summary"]},comments:{amount:["--limit"]},notes:{amount:["--limit"]},files:{amount:["--limit","--no-truncate","--offset"]},docs:{},stats:{},aggregate:{}},me=new Set(["--fields","--section"]),Ee=Object.freeze({"--after":"--after retains cursor-position semantics; use --output-limit <n> separately to bound returned rows.","--check-only":"--check-only retains health side-effect semantics; --output-include does not suppress vector refresh.","--depth":"--depth retains traversal or detail-depth semantics; --output-limit does not replace it.","--follow":"--follow retains event-tail semantics; --output-format does not enable following.","--max-depth":"--max-depth retains graph traversal-depth semantics; --output-limit does not replace it.","--max-paths":"--max-paths retains graph path-search semantics; use --output-limit separately to bound returned rows.","--offset":"--offset retains positional pagination semantics; use --output-limit separately to bound returned rows.","--stream":"--stream retains command streaming semantics; --output-format selects only static result encoding."});function Y(e){return e.slice(2).replaceAll("-","_")}function ge(e,t){let n=Ee[e];if(n!==void 0)return n;let o=t==="include"?me.has(e)?"<csv>":Y(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${S[t]} ${o}.`}function ye(e){let t=pe[e],n=Object.freeze(Object.fromEntries(u.map(o=>[o,Object.freeze({dimension:o,canonical_option:S[o],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[o]??[]).map(r=>Object.freeze({flag:r,migration_hint:ge(r,o),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:n,precedence:K})}var be=Object.freeze(F.map(ye)),he=new Map(be.map(e=>[e.command,e]));function X(e){let t=e.trim().toLowerCase().split(/\s+/u)[0],n=t.startsWith("list-")?"list":t==="ctx"?"context":t;return F.includes(n)?n:void 0}var Ae=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format"],Oe={comments:["add","body","stdin","file","edit","delete"],notes:["add","addJson","stdin","file","edit","delete"],files:["add","addGlob","remove","migrate","apply","note"],docs:["add","addGlob","remove","migrate","note"]};function Se(e){return Ae.some(t=>e[t]!==void 0)}var Te=[{keys:["outputInclude","output_include"],valid:e=>O(e)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:e=>e==="unbounded"||_(e)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:e=>_(e)!==void 0,message:"--output-budget must be a positive integer."},{keys:["outputFormat","output_format"],valid:e=>e==="toon"||e==="json",message:"--output-format must be toon or json."}];function zt(e,t){if(!Se(t))return;let n=X(e);if(!n)throw new l(`Universal output controls apply only to read commands; ${e||"this command"} is not a read surface.`,E.USAGE);if((Oe[n]??[]).some(o=>t[o]!==void 0&&t[o]!==!1))throw new l(`Universal output controls cannot be combined with a ${n} mutation.`,E.USAGE);for(let o of Te){let r=o.keys.map(s=>t[s]).find(s=>s!==void 0);if(r!==void 0&&!o.valid(r))throw new l(o.message,E.USAGE)}}function Ne(e){return e.slice(2).replace(/-([a-z])/gu,(t,n)=>n.toUpperCase())}function Ie(e,t){let n=Ne(t);if(Object.hasOwn(e,n))return e[n];let o=t.slice(2).replaceAll("-","_");if(Object.hasOwn(e,o))return e[o];if(t==="--no-truncate"&&e.truncate===!1)return!0}function we(e){return e!==void 0&&e!==!1&&e!==null}function O(e){let n=(Array.isArray(e)?e:[e]).flatMap(o=>typeof o=="string"?o.split(","):[]).map(o=>o.trim()).filter(Boolean);return n.length>0?[...new Set(n)]:void 0}function _(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function xe(e,t,n){for(let o of e.legacy_aliases){let r=Ie(t,o.flag),s={value:r,flag:o.flag};if(we(r)&&n(s))return s}}function P(e,t){let n=O(e);if(n)return{source:"canonical",value:n};if(t)return{source:"legacy",value:O(t.value)??[Y(t.flag)]}}function M(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=_(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;if(t.flag==="--no-truncate"||t.flag==="--unbounded")return{source:"legacy",value:"unbounded"};let o=_(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function V(e,t){let n=_(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;let o=_(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function j(e,t){if(e==="json"||e==="toon")return{source:"canonical",value:e};if(t)return t.flag==="--stream"||t.flag==="--follow"?{source:"legacy",value:"stream"}:t.value==="json"||t.value==="toon"?{source:"legacy",value:t.value}:void 0}function B(e,t){let n=X(e);if(!n)return;let o=he.get(n),r={include:a=>P(void 0,a),amount:a=>M(void 0,a),cost:a=>V(void 0,a),encoding:a=>j(void 0,a)},s=Object.fromEntries(u.map(a=>[a,xe(o.dimensions[a],t,d=>r[a](d)!==void 0)])),i=u.flatMap(a=>{let d=s[a];return d?[d.flag]:[]}),c=u.flatMap(a=>{let d=s[a];return d?[o.dimensions[a].legacy_aliases.find(G=>G.flag===d.flag).migration_hint]:[]});return{command:n,include:P(t.outputInclude??t.output_include,s.include),amount:M(t.outputLimit??t.output_limit,s.amount),cost:V(t.outputBudget??t.output_budget,s.cost),encoding:j(t.outputFormat??t.output_format,s.encoding),legacy_aliases_used:i,migration_hints:c,precedence:K}}function g(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Re=new Set(["applied_bound","applied_limit","completeness","continuation_contract","count","filters","has_more","next_cursor","now","omission_receipt","projection","row_contract","sorting","total","truncated"]);function q(e){let t=e.row_contract;return g(t)&&Array.isArray(t.row_keys)?t.row_keys.filter(n=>typeof n=="string"):Object.entries(e).filter(([,n])=>Array.isArray(n)).map(([n])=>n)}function ke(e,t){let n=new Set(t.map(o=>o.split(".")[0]));return Object.fromEntries(Object.entries(e).filter(([o])=>n.has(o)))}function Ce(e,t){let n=q(e),o=t.some(r=>Object.hasOwn(e,r.split(".")[0]));return n.length>0&&!o?Object.fromEntries(Object.entries(e).map(([r,s])=>[r,n.includes(r)&&Array.isArray(s)?s.map(i=>g(i)?ke(i,t):i):s])):Object.fromEntries(Object.entries(e).filter(([r])=>t.some(s=>s.split(".")[0]===r)||Re.has(r)))}function ve(e,t){if(t==="unbounded")return e;let n=!1,o=q(e),r=new Set(o),s=Object.fromEntries(Object.entries(e).map(([i,c])=>!r.has(i)||!Array.isArray(c)||c.length<=t?[i,c]:(n=!0,[i,c.slice(0,t)])));return n&&(s.has_more=!0,s.truncated=!0,typeof s.count=="number"&&(s.count=o.reduce((i,c)=>i+(Array.isArray(s[c])?s[c].length:0),0)),s.applied_bound={kind:"output_limit",source:"explicit",value:t}),s}function De(e){return u.filter(t=>e[t]!==void 0)}function Gt(e,t,n){let o=B(e,t);if(!o)return n;let r=De(o);if(r.filter(d=>o[d]?.source==="canonical").length===0)return n;let i={...n};o.include?.source==="canonical"&&(i=Ce(i,o.include.value)),o.amount?.source==="canonical"&&(i=ve(i,o.amount.value));let c={contract_version:1,command:o.command,requested_dimensions:r,precedence:o.precedence,legacy_aliases_used:o.legacy_aliases_used,migration_hints:o.migration_hints,estimated_tokens:0,within_budget:!0,strings_compacted:!1,rows_compacted:!1,result_omitted:!1};i.read_output=c,p(i,c);let a=o.cost?.source==="canonical"?o.cost.value:void 0;if(a!==void 0&&c.estimated_tokens>a&&(i=U(i,c,a)),a!==void 0&&c.estimated_tokens>a){let d={contract_version:1,command:o.command,requested_dimensions:r,precedence:o.precedence,legacy_aliases_used:[],migration_hints:[],estimated_tokens:0,within_budget:!1,strings_compacted:!1,rows_compacted:!1,result_omitted:!0},f={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Increase --output-budget or narrow the read."},read_output:d};return p(f,d),f}return i}function Wt(e){return g(e)&&g(e.output_budget_exceeded)&&e.output_budget_exceeded.omitted_result===!0&&e.output_budget_exceeded.reason==="requested_budget_infeasible"}function Ht(e,t){let n=B(e,t)?.encoding;return n?.value==="json"||n?.value==="toon"?n.value:void 0}(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]="f6e82c93-54e8-53a7-94df-10a573aae933")}catch{}})();(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]="875ac35b-c6ce-5690-a05a-8e4d279a49bf")}catch{}})();var Le=Object.freeze([{flag:"--json"},{flag:"--lean"},{flag:"--token-accounting"},{flag:"--output-include",value_name:"fields"},{flag:"--output-limit",value_name:"count"},{flag:"--output-budget",value_name:"tokens"},{flag:"--output-format",value_name:"toon|json"},{flag:"--quiet"},{flag:"--no-changed-fields"},{flag:"--full-changed-fields"},{flag:"--id-only"},{flag:"--pm-path",aliases:["--path"]},{flag:"--no-extensions"},{flag:"--no-pager"},{flag:"--profile"},{flag:"--help"},{flag:"--author",value_name:"id"}]),Zt=new Set(Le.flatMap(e=>[e.flag,...e.aliases??[]]));import Ue from"node:crypto";(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]="83232698-197a-5aef-be7c-aa37f3c56822")}catch{}})();function Pe(e){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return e.toString();if(e===void 0)return"undefined";if(typeof e=="symbol")return e.toString();if(typeof e=="function")return`[function:${e.name||"anonymous"}]`}function Me(e){let t=Object.keys(e).sort(),n={};for(let o of t){let r=e[o];r!==void 0&&(n[o]=y(r))}return n}function y(e){let t=Pe(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(o=>y(o));if(e instanceof Date)return e.toISOString();let n=e;if(typeof n.toJSON=="function"){let o=n.toJSON();if(o!==e)return y(o)}return Me(e)}function nn(e){return JSON.stringify(y(e))}function z(e,t,n,o){for(let r=0;r<t.length;r+=1)if(!n.has(r)&&o(e,t[r]))return n.add(r),!0;return!1}function Ve(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function je(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function Fe(e,t){if(!(e instanceof Set||t instanceof Set))return;if(!(e instanceof Set&&t instanceof Set)||e.size!==t.size)return!1;let n=[...t],o=new Set;for(let r of e)if(!z(r,n,o,m))return!1;return!0}function Ke(e,t){if(!(e instanceof Map||t instanceof Map))return;if(!(e instanceof Map&&t instanceof Map)||e.size!==t.size)return!1;let n=[...t.entries()],o=new Set;for(let[r,s]of e.entries())if(!z([r,s],n,o,([c,a],[d,f])=>m(c,d)&&m(a,f)))return!1;return!0}function Ye(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,o)=>m(n,t[o]))}function Xe(e,t){let n=Object.keys(e).sort((r,s)=>r.localeCompare(s)),o=Object.keys(t).sort((r,s)=>r.localeCompare(s));if(n.length!==o.length)return!1;for(let r=0;r<n.length;r+=1){let s=n[r];if(s!==o[r]||!m(e[s],t[s]))return!1}return!0}var Be=[Ve,je,Fe,Ke,Ye];function m(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;for(let n of Be){let o=n(e,t);if(o!==void 0)return o}return Xe(e,t)}function on(e){return Ue.createHash("sha256").update(e,"utf8").digest("hex")}function rn(e,t){let n={};for(let r of t){let s=e[r];s!==void 0&&(n[r]=s)}let o=Object.keys(e).filter(r=>!t.includes(r)).sort((r,s)=>r.localeCompare(s));for(let r of o){let s=e[r];s!==void 0&&(n[r]=s)}return n}export{b as a,W as b,H as c,qe as d,T as e,N as f,I as g,ze as h,w as i,x as j,R as k,$ as l,We as m,He as n,$e as o,Je as p,Qe as q,Ze as r,et as s,tt as t,nt as u,ot as v,rt as w,st as x,it as y,at as z,ct as A,dt as B,lt as C,J as D,ut as E,_t as F,ft as G,pt as H,mt as I,Et as J,gt as K,Q as L,Z as M,ht as N,At as O,ee as P,Ot as Q,St as R,Tt as S,oe as T,re as U,h as V,Nt as W,It as X,E as Y,l as Z,Le as _,Zt as $,nn as aa,m as ba,on as ca,rn as da,se as ea,ie as fa,ae as ga,Ct as ha,vt as ia,ce as ja,C as ka,Dt as la,de as ma,v as na,D as oa,Lt as pa,Ut as qa,Pt as ra,Mt as sa,Vt as ta,jt as ua,u as va,F as wa,qt as xa,be as ya,X as za,zt as Aa,B as Ba,Gt as Ca,Wt as Da,Ht as Ea};
2
+ //# sourceMappingURL=chunk-Y4LDYLLT.js.map