@unbrained/pm-cli 2026.7.20 → 2026.7.21

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 (421) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +11 -0
  3. package/dist/cli/commander-usage.d.ts +1 -1
  4. package/dist/cli/commander-usage.js +5 -5
  5. package/dist/cli/commander-usage.js.map +1 -1
  6. package/dist/cli/commands/completion.js +13 -5
  7. package/dist/cli/commands/completion.js.map +1 -1
  8. package/dist/cli/commands/contracts.js +4 -3
  9. package/dist/cli/commands/contracts.js.map +1 -1
  10. package/dist/cli/error-guidance.d.ts +2 -0
  11. package/dist/cli/error-guidance.js +7 -2
  12. package/dist/cli/error-guidance.js.map +1 -1
  13. package/dist/cli/main.d.ts +1 -5
  14. package/dist/cli/main.js +12 -50
  15. package/dist/cli/main.js.map +1 -1
  16. package/dist/cli/register-list-query.js +13 -3
  17. package/dist/cli/register-list-query.js.map +1 -1
  18. package/dist/cli/register-mutation.js +45 -3
  19. package/dist/cli/register-mutation.js.map +1 -1
  20. package/dist/cli/register-structured-mutation.d.ts +14 -0
  21. package/dist/cli/register-structured-mutation.js +62 -0
  22. package/dist/cli/register-structured-mutation.js.map +1 -0
  23. package/dist/cli/registration-helpers.js +5 -3
  24. package/dist/cli/registration-helpers.js.map +1 -1
  25. package/dist/cli-bundle/bundle-manifest.json +280 -296
  26. package/dist/cli-bundle/chunks/{append-E6V54WOQ.js → append-7OVFYR3C.js} +3 -3
  27. package/dist/cli-bundle/chunks/{append-NNJ3EFIT.js → append-DFETHAZL.js} +3 -3
  28. package/dist/cli-bundle/chunks/{chunk-C3KD7U3T.js → chunk-2L6ZP22J.js} +241 -10
  29. package/dist/cli-bundle/chunks/chunk-2L6ZP22J.js.map +7 -0
  30. package/dist/cli-bundle/chunks/{chunk-KZEANWJS.js → chunk-4PUUNQDV.js} +98 -30
  31. package/dist/cli-bundle/chunks/chunk-4PUUNQDV.js.map +7 -0
  32. package/dist/cli-bundle/chunks/{chunk-RDV4ZFYS.js → chunk-4QOB7L7I.js} +7 -9
  33. package/dist/cli-bundle/chunks/{chunk-RDV4ZFYS.js.map → chunk-4QOB7L7I.js.map} +1 -1
  34. package/dist/cli-bundle/chunks/{chunk-3LPFHE3P.js → chunk-4QSQ6XDK.js} +62 -20
  35. package/dist/cli-bundle/chunks/chunk-4QSQ6XDK.js.map +1 -0
  36. package/dist/cli-bundle/chunks/{chunk-QJKL5PHS.js → chunk-7656MAUL.js} +2 -2
  37. package/dist/cli-bundle/chunks/{chunk-3AO5VSDR.js → chunk-7RW4JCU2.js} +328 -6
  38. package/dist/cli-bundle/chunks/chunk-7RW4JCU2.js.map +7 -0
  39. package/dist/cli-bundle/chunks/{chunk-X6K5XTTN.js → chunk-7W2UAXXT.js} +5 -5
  40. package/dist/cli-bundle/chunks/{chunk-SSKOQNMS.js → chunk-ABWCF646.js} +9 -11
  41. package/dist/cli-bundle/chunks/{chunk-SSKOQNMS.js.map → chunk-ABWCF646.js.map} +1 -1
  42. package/dist/cli-bundle/chunks/{chunk-WVA4DVNV.js → chunk-ADBTSVGK.js} +71 -33
  43. package/dist/cli-bundle/chunks/chunk-ADBTSVGK.js.map +7 -0
  44. package/dist/cli-bundle/chunks/{chunk-J4FBIFU6.js → chunk-AELMUANP.js} +12 -6
  45. package/dist/cli-bundle/chunks/chunk-AELMUANP.js.map +1 -0
  46. package/dist/cli-bundle/chunks/{chunk-4F6BWJ4J.js → chunk-AMJPSANK.js} +57 -36
  47. package/dist/cli-bundle/chunks/chunk-AMJPSANK.js.map +7 -0
  48. package/dist/cli-bundle/chunks/{chunk-6VIJ7UA5.js → chunk-AS4SAZ5R.js} +850 -819
  49. package/dist/cli-bundle/chunks/chunk-AS4SAZ5R.js.map +7 -0
  50. package/dist/cli-bundle/chunks/{chunk-SG74J6MV.js → chunk-ATBCUC7Y.js} +574 -5
  51. package/dist/cli-bundle/chunks/chunk-ATBCUC7Y.js.map +1 -0
  52. package/dist/cli-bundle/chunks/{chunk-5OK4UGFV.js → chunk-BXNDKOR2.js} +3 -3
  53. package/dist/cli-bundle/chunks/{chunk-KSPWRNVP.js → chunk-CPX275C6.js} +2 -2
  54. package/dist/cli-bundle/chunks/{chunk-JH2ZSLO3.js → chunk-DZRV2OPA.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-L7BH7IWU.js → chunk-E5XMKOSB.js} +2 -2
  56. package/dist/cli-bundle/chunks/{chunk-CQTQKUUV.js → chunk-EWJWSNRU.js} +3 -3
  57. package/dist/cli-bundle/chunks/{chunk-DAQ45GCS.js → chunk-F2LBF7XJ.js} +22 -15
  58. package/dist/cli-bundle/chunks/chunk-F2LBF7XJ.js.map +7 -0
  59. package/dist/cli-bundle/chunks/{chunk-6XMUURSS.js → chunk-FJIFFBJX.js} +64 -33
  60. package/dist/cli-bundle/chunks/chunk-FJIFFBJX.js.map +1 -0
  61. package/dist/cli-bundle/chunks/{chunk-E7ICD63T.js → chunk-FO6OSVEN.js} +4 -6
  62. package/dist/cli-bundle/chunks/{chunk-E7ICD63T.js.map → chunk-FO6OSVEN.js.map} +1 -1
  63. package/dist/cli-bundle/chunks/{chunk-3MCTMJXI.js → chunk-FPBMLYPI.js} +2 -2
  64. package/dist/cli-bundle/chunks/{chunk-UZDQXNUB.js → chunk-FSE2IKJQ.js} +46 -5
  65. package/dist/cli-bundle/chunks/chunk-FSE2IKJQ.js.map +1 -0
  66. package/dist/cli-bundle/chunks/{chunk-IX677TRO.js → chunk-GKX4NJ7U.js} +8 -10
  67. package/dist/cli-bundle/chunks/{chunk-IX677TRO.js.map → chunk-GKX4NJ7U.js.map} +1 -1
  68. package/dist/cli-bundle/chunks/{chunk-DVDBQA3B.js → chunk-GTK4DTEW.js} +5 -5
  69. package/dist/cli-bundle/chunks/chunk-H7EAER5L.js +974 -0
  70. package/dist/cli-bundle/chunks/chunk-H7EAER5L.js.map +1 -0
  71. package/dist/cli-bundle/chunks/{chunk-5UX66S6U.js → chunk-ICDAQ4TD.js} +316 -8
  72. package/dist/cli-bundle/chunks/chunk-ICDAQ4TD.js.map +1 -0
  73. package/dist/cli-bundle/chunks/{chunk-YQQNAKW3.js → chunk-JFD5LPMI.js} +6 -8
  74. package/dist/cli-bundle/chunks/{chunk-YQQNAKW3.js.map → chunk-JFD5LPMI.js.map} +1 -1
  75. package/dist/cli-bundle/chunks/{chunk-QANSTTC7.js → chunk-JXCW2TI2.js} +6 -8
  76. package/dist/cli-bundle/chunks/{chunk-QANSTTC7.js.map → chunk-JXCW2TI2.js.map} +1 -1
  77. package/dist/cli-bundle/chunks/{chunk-GSJSM5BJ.js → chunk-K36WV5J6.js} +76 -13
  78. package/dist/cli-bundle/chunks/chunk-K36WV5J6.js.map +1 -0
  79. package/dist/cli-bundle/chunks/{chunk-GVI6FAFG.js → chunk-K55VMLSS.js} +7 -5
  80. package/dist/cli-bundle/chunks/chunk-K55VMLSS.js.map +7 -0
  81. package/dist/cli-bundle/chunks/{chunk-GIQSU6S2.js → chunk-KBLZ3AA5.js} +2 -2
  82. package/dist/cli-bundle/chunks/{chunk-XJF7CDNH.js → chunk-KH44WBAT.js} +2 -2
  83. package/dist/cli-bundle/chunks/{chunk-GV2262OF.js → chunk-LAV26CQG.js} +2 -2
  84. package/dist/cli-bundle/chunks/{chunk-VDO2JMD4.js → chunk-LVC72YRD.js} +2 -2
  85. package/dist/cli-bundle/chunks/{chunk-3VY6MIEO.js → chunk-LZYP423P.js} +35 -6
  86. package/dist/cli-bundle/chunks/chunk-LZYP423P.js.map +7 -0
  87. package/dist/cli-bundle/chunks/{chunk-ZYPFOO3L.js → chunk-MATHDCGG.js} +3 -3
  88. package/dist/cli-bundle/chunks/{chunk-OV7MSW3I.js → chunk-MWQ2HC2A.js} +99 -31
  89. package/dist/cli-bundle/chunks/chunk-MWQ2HC2A.js.map +1 -0
  90. package/dist/cli-bundle/chunks/{chunk-NHT3F4WZ.js → chunk-NUF7ROFH.js} +840 -816
  91. package/dist/cli-bundle/chunks/chunk-NUF7ROFH.js.map +1 -0
  92. package/dist/cli-bundle/chunks/{chunk-AOEOYL3S.js → chunk-O4BCOJTZ.js} +3 -3
  93. package/dist/cli-bundle/chunks/{chunk-RJO3YAFM.js → chunk-OCUBRA6D.js} +2 -2
  94. package/dist/cli-bundle/chunks/{chunk-5IZJWSDB.js → chunk-OG5DVFMA.js} +22 -15
  95. package/dist/cli-bundle/chunks/chunk-OG5DVFMA.js.map +1 -0
  96. package/dist/cli-bundle/chunks/{chunk-I577UHC7.js → chunk-OR42SO64.js} +2 -2
  97. package/dist/cli-bundle/chunks/{chunk-ZOJ3LR7O.js → chunk-OY7DMU5P.js} +2 -2
  98. package/dist/cli-bundle/chunks/{chunk-HEWM6CEN.js → chunk-P7MTHPJQ.js} +50 -9
  99. package/dist/cli-bundle/chunks/chunk-P7MTHPJQ.js.map +7 -0
  100. package/dist/cli-bundle/chunks/{chunk-2BO4CA46.js → chunk-PFNHX655.js} +236 -12
  101. package/dist/cli-bundle/chunks/{chunk-2BO4CA46.js.map → chunk-PFNHX655.js.map} +1 -1
  102. package/dist/cli-bundle/chunks/{chunk-ZV2NTVMJ.js → chunk-PONKZPCJ.js} +2 -2
  103. package/dist/cli-bundle/chunks/{chunk-THAOZG4U.js → chunk-PQSEQD6E.js} +8 -6
  104. package/dist/cli-bundle/chunks/chunk-PQSEQD6E.js.map +1 -0
  105. package/dist/cli-bundle/chunks/chunk-PWDEHT3L.js +991 -0
  106. package/dist/cli-bundle/chunks/chunk-PWDEHT3L.js.map +7 -0
  107. package/dist/cli-bundle/chunks/{chunk-UX6SSO2I.js → chunk-PZC2FUOQ.js} +2 -2
  108. package/dist/cli-bundle/chunks/{chunk-WUVEBQW6.js → chunk-QG4GFLQ6.js} +3 -5
  109. package/dist/cli-bundle/chunks/{chunk-WUVEBQW6.js.map → chunk-QG4GFLQ6.js.map} +1 -1
  110. package/dist/cli-bundle/chunks/{chunk-VQIHNHMJ.js → chunk-QIH77CAG.js} +2 -2
  111. package/dist/cli-bundle/chunks/{chunk-R3EWPG4A.js → chunk-QJIKE24M.js} +2 -2
  112. package/dist/cli-bundle/chunks/{chunk-QLZ643FM.js → chunk-QOOTOD3W.js} +10 -12
  113. package/dist/cli-bundle/chunks/{chunk-QLZ643FM.js.map → chunk-QOOTOD3W.js.map} +1 -1
  114. package/dist/cli-bundle/chunks/{chunk-MYSS5H2A.js → chunk-R3P6FZJW.js} +5 -7
  115. package/dist/cli-bundle/chunks/{chunk-MYSS5H2A.js.map → chunk-R3P6FZJW.js.map} +1 -1
  116. package/dist/cli-bundle/chunks/{chunk-G3COA6GS.js → chunk-RNPZYNHS.js} +56 -35
  117. package/dist/cli-bundle/chunks/chunk-RNPZYNHS.js.map +1 -0
  118. package/dist/cli-bundle/chunks/{chunk-T44FMVRL.js → chunk-RPESLSO5.js} +62 -20
  119. package/dist/cli-bundle/chunks/chunk-RPESLSO5.js.map +7 -0
  120. package/dist/cli-bundle/chunks/{chunk-INSTSQNZ.js → chunk-SY4SFZSD.js} +595 -3
  121. package/dist/cli-bundle/chunks/chunk-SY4SFZSD.js.map +7 -0
  122. package/dist/cli-bundle/chunks/{chunk-HB3P4M52.js → chunk-TRSHFPRZ.js} +2 -2
  123. package/dist/cli-bundle/chunks/{chunk-HRW7GF6T.js → chunk-UCBDQI5E.js} +2 -2
  124. package/dist/cli-bundle/chunks/{chunk-4U4Z6AHI.js → chunk-V22ZPOKN.js} +2 -2
  125. package/dist/cli-bundle/chunks/{chunk-JM6YAXTR.js → chunk-VHXHVTUU.js} +2 -2
  126. package/dist/cli-bundle/chunks/{chunk-LPEYZRUR.js → chunk-VJQG4BIM.js} +35 -6
  127. package/dist/cli-bundle/chunks/chunk-VJQG4BIM.js.map +1 -0
  128. package/dist/cli-bundle/chunks/{chunk-D6NXDNP3.js → chunk-VLRGDBLY.js} +2 -2
  129. package/dist/cli-bundle/chunks/{chunk-JAPE62Y5.js → chunk-VNTCM3VW.js} +3 -3
  130. package/dist/cli-bundle/chunks/{chunk-FDHPAVVB.js → chunk-VXOOB6YX.js} +2 -2
  131. package/dist/cli-bundle/chunks/{chunk-GFQP7HAZ.js → chunk-VZIZB6QH.js} +3 -5
  132. package/dist/cli-bundle/chunks/{chunk-GFQP7HAZ.js.map → chunk-VZIZB6QH.js.map} +1 -1
  133. package/dist/cli-bundle/chunks/{chunk-HQ3SB4CN.js → chunk-X3W65QK3.js} +2 -2
  134. package/dist/cli-bundle/chunks/{chunk-RZJLNXFG.js → chunk-XJTABV3X.js} +3 -3
  135. package/dist/cli-bundle/chunks/{chunk-GVT754PX.js → chunk-YCIUJJOD.js} +11 -5
  136. package/dist/cli-bundle/chunks/chunk-YCIUJJOD.js.map +7 -0
  137. package/dist/cli-bundle/chunks/{chunk-IJNK6WW2.js → chunk-Z75ONV25.js} +75 -12
  138. package/dist/cli-bundle/chunks/chunk-Z75ONV25.js.map +7 -0
  139. package/dist/cli-bundle/chunks/{chunk-4L23AGQ7.js → chunk-Z7VWXXJM.js} +5 -7
  140. package/dist/cli-bundle/chunks/{chunk-4L23AGQ7.js.map → chunk-Z7VWXXJM.js.map} +1 -1
  141. package/dist/cli-bundle/chunks/{chunk-YBT7O4KT.js → chunk-ZTVA4KLN.js} +4 -6
  142. package/dist/cli-bundle/chunks/{chunk-YBT7O4KT.js.map → chunk-ZTVA4KLN.js.map} +1 -1
  143. package/dist/cli-bundle/chunks/{chunk-TYHJDFYW.js → chunk-ZVZGXPQ5.js} +2 -2
  144. package/dist/cli-bundle/chunks/{close-many-SDA426VT.js → close-many-5RZXVN4J.js} +5 -6
  145. package/dist/cli-bundle/chunks/{close-many-UTZANOCQ.js → close-many-RZVTUGBG.js} +5 -6
  146. package/dist/cli-bundle/chunks/{comments-LZN6FXXC.js → comments-TPU7QRBL.js} +4 -4
  147. package/dist/cli-bundle/chunks/{comments-VBQ345ND.js → comments-Z4KV6FU3.js} +4 -4
  148. package/dist/cli-bundle/chunks/{create-GG4RBCGC.js → create-EIFBIVNQ.js} +6 -6
  149. package/dist/cli-bundle/chunks/{create-JBC5KUW6.js → create-RGSPN5GD.js} +6 -6
  150. package/dist/cli-bundle/chunks/{deps-FI4O6NQS.js → deps-UH5EQQUY.js} +3 -3
  151. package/dist/cli-bundle/chunks/{deps-DELOO4TL.js → deps-YG7UF3VR.js} +3 -3
  152. package/dist/cli-bundle/chunks/{docs-6Z2MP526.js → docs-G32TK6XS.js} +4 -4
  153. package/dist/cli-bundle/chunks/{docs-2UYBP5D6.js → docs-JWWNRC27.js} +4 -4
  154. package/dist/cli-bundle/chunks/{files-HKEAN5MA.js → files-3H32UQ4K.js} +4 -4
  155. package/dist/cli-bundle/chunks/{files-HEUGSJZL.js → files-4ALMCSKB.js} +4 -4
  156. package/dist/cli-bundle/chunks/{history-compact-7NDVP3PT.js → history-compact-77BT2LUB.js} +3 -4
  157. package/dist/cli-bundle/chunks/{history-compact-65YVN5DB.js → history-compact-VCKGTX64.js} +3 -4
  158. package/dist/cli-bundle/chunks/{history-redact-7YBL4XSG.js → history-redact-LJPZPNFA.js} +2 -3
  159. package/dist/cli-bundle/chunks/{history-redact-IZGNJBU4.js → history-redact-PWTTJ3XS.js} +2 -3
  160. package/dist/cli-bundle/chunks/{history-repair-7M4PYQUH.js → history-repair-I7CBNCV3.js} +5 -6
  161. package/dist/cli-bundle/chunks/{history-repair-GNGETJLI.js → history-repair-YTDZRK5E.js} +5 -6
  162. package/dist/cli-bundle/chunks/{learnings-3YXDRWFT.js → learnings-CYNOICKR.js} +4 -4
  163. package/dist/cli-bundle/chunks/{learnings-ALC6IMNL.js → learnings-KTYW3AL7.js} +4 -4
  164. package/dist/cli-bundle/chunks/{notes-7JMLQ447.js → notes-FGO63FXL.js} +4 -4
  165. package/dist/cli-bundle/chunks/{notes-JFCLTC5C.js → notes-ZERD3KB2.js} +4 -4
  166. package/dist/cli-bundle/chunks/{plan-T3XB3WTK.js → plan-OFJUBIM5.js} +7 -7
  167. package/dist/cli-bundle/chunks/{plan-KOIPWVOZ.js → plan-SGCDDTYR.js} +7 -7
  168. package/dist/cli-bundle/chunks/{profile-OILJHKUW.js → profile-3THJPIQY.js} +4 -5
  169. package/dist/cli-bundle/chunks/{profile-RJXA7PGS.js → profile-XEZAMMBW.js} +4 -5
  170. package/dist/cli-bundle/chunks/{register-list-query-CFVG75P3.js → register-list-query-BR435Q2H.js} +19 -16
  171. package/dist/cli-bundle/chunks/register-list-query-BR435Q2H.js.map +1 -0
  172. package/dist/cli-bundle/chunks/{register-list-query-E7UVY4TN.js → register-list-query-RWTWLOBE.js} +18 -15
  173. package/dist/cli-bundle/chunks/register-list-query-RWTWLOBE.js.map +7 -0
  174. package/dist/cli-bundle/chunks/{register-mutation-IQ55E25C.js → register-mutation-HLWC2WNP.js} +167 -31
  175. package/dist/cli-bundle/chunks/register-mutation-HLWC2WNP.js.map +1 -0
  176. package/dist/cli-bundle/chunks/{register-mutation-4VJTXBZW.js → register-mutation-ZJX5AZM5.js} +173 -30
  177. package/dist/cli-bundle/chunks/register-mutation-ZJX5AZM5.js.map +7 -0
  178. package/dist/cli-bundle/chunks/{register-operations-AR7RMX4W.js → register-operations-744YBJMV.js} +23 -25
  179. package/dist/cli-bundle/chunks/{register-operations-AR7RMX4W.js.map → register-operations-744YBJMV.js.map} +1 -1
  180. package/dist/cli-bundle/chunks/{register-operations-NOLZGORC.js → register-operations-UEBJH6AN.js} +21 -23
  181. package/dist/cli-bundle/chunks/{register-operations-NOLZGORC.js.map → register-operations-UEBJH6AN.js.map} +1 -1
  182. package/dist/cli-bundle/chunks/{register-setup-EYZ7VTPZ.js → register-setup-5DA4UZXI.js} +7 -8
  183. package/dist/cli-bundle/chunks/{register-setup-EYZ7VTPZ.js.map → register-setup-5DA4UZXI.js.map} +1 -1
  184. package/dist/cli-bundle/chunks/{register-setup-BB77VUEE.js → register-setup-6H25M3BH.js} +9 -10
  185. package/dist/cli-bundle/chunks/{register-setup-BB77VUEE.js.map → register-setup-6H25M3BH.js.map} +1 -1
  186. package/dist/cli-bundle/chunks/{restore-ZH65GZFB.js → restore-6TDVSATY.js} +4 -5
  187. package/dist/cli-bundle/chunks/{restore-L6IAGOD7.js → restore-RSL7C7LO.js} +4 -5
  188. package/dist/cli-bundle/chunks/{schema-4ERWM5QJ.js → schema-HFXFSGPG.js} +2 -3
  189. package/dist/cli-bundle/chunks/{schema-55DL3Q52.js → schema-TPVTIJPO.js} +2 -3
  190. package/dist/cli-bundle/chunks/{update-FW6FKDOP.js → update-LJZCL5SI.js} +7 -7
  191. package/dist/cli-bundle/chunks/{update-TJHSPRPT.js → update-SIA7LH5Y.js} +7 -7
  192. package/dist/cli-bundle/chunks/{update-many-PWXX5WHO.js → update-many-BDBZVGQL.js} +11 -12
  193. package/dist/cli-bundle/chunks/{update-many-NNALYQCN.js → update-many-MOY3A5B3.js} +11 -12
  194. package/dist/cli-bundle/main.js +60 -85
  195. package/dist/cli-bundle/main.js.map +2 -2
  196. package/dist/cli-bundle/sdk-runtime.js +37 -37
  197. package/dist/cli-bundle/sdk.js +126 -291
  198. package/dist/cli-bundle/sdk.js.map +4 -4
  199. package/dist/core/item/parse.d.ts +1 -1
  200. package/dist/core/item/parse.js +13 -7
  201. package/dist/core/item/parse.js.map +1 -1
  202. package/dist/core/output/mutation-projection.d.ts +2 -0
  203. package/dist/core/output/mutation-projection.js +33 -2
  204. package/dist/core/output/mutation-projection.js.map +1 -1
  205. package/dist/core/output/output.d.ts +4 -0
  206. package/dist/core/output/output.js +18 -13
  207. package/dist/core/output/output.js.map +1 -1
  208. package/dist/core/shared/command-types.d.ts +4 -0
  209. package/dist/core/shared/command-types.js +2 -2
  210. package/dist/core/shared/command-types.js.map +1 -1
  211. package/dist/mcp/server.js +39 -4
  212. package/dist/mcp/server.js.map +1 -1
  213. package/dist/mcp/tool-definitions.js +45 -4
  214. package/dist/mcp/tool-definitions.js.map +1 -1
  215. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  216. package/dist/sdk/cli-bootstrap.js +20 -27
  217. package/dist/sdk/cli-bootstrap.js.map +1 -1
  218. package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
  219. package/dist/sdk/cli-contracts/enum-contracts.js +7 -2
  220. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  221. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  222. package/dist/sdk/cli-contracts/flag-contracts.js +21 -2
  223. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  224. package/dist/sdk/cli-contracts/tool-option-contracts.js +10 -2
  225. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  226. package/dist/sdk/cli-contracts/tool-parameter-tables.js +16 -3
  227. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  228. package/dist/sdk/cli-contracts/tool-schema.js +6 -2
  229. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  230. package/dist/sdk/cli-contracts.d.ts +1 -1
  231. package/dist/sdk/cli-contracts.js +3 -3
  232. package/dist/sdk/cli-contracts.js.map +1 -1
  233. package/dist/sdk/cli-program.js +4 -2
  234. package/dist/sdk/cli-program.js.map +1 -1
  235. package/dist/sdk/dependencies.d.ts +3 -2
  236. package/dist/sdk/dependencies.js +13 -12
  237. package/dist/sdk/dependencies.js.map +1 -1
  238. package/dist/sdk/error-runtime.d.ts +10 -0
  239. package/dist/sdk/error-runtime.js +59 -0
  240. package/dist/sdk/error-runtime.js.map +1 -0
  241. package/dist/sdk/graph/analytics.d.ts +9 -0
  242. package/dist/sdk/graph/analytics.js +24 -13
  243. package/dist/sdk/graph/analytics.js.map +1 -1
  244. package/dist/sdk/graph/assembly.d.ts +39 -0
  245. package/dist/sdk/graph/assembly.js +92 -12
  246. package/dist/sdk/graph/assembly.js.map +1 -1
  247. package/dist/sdk/graph/cache.d.ts +4 -1
  248. package/dist/sdk/graph/cache.js +17 -4
  249. package/dist/sdk/graph/cache.js.map +1 -1
  250. package/dist/sdk/graph/centrality.d.ts +82 -0
  251. package/dist/sdk/graph/centrality.js +259 -0
  252. package/dist/sdk/graph/centrality.js.map +1 -0
  253. package/dist/sdk/graph/durable-cache.d.ts +71 -0
  254. package/dist/sdk/graph/durable-cache.js +205 -0
  255. package/dist/sdk/graph/durable-cache.js.map +1 -0
  256. package/dist/sdk/graph/governance.d.ts +69 -1
  257. package/dist/sdk/graph/governance.js +143 -35
  258. package/dist/sdk/graph/governance.js.map +1 -1
  259. package/dist/sdk/graph/index.d.ts +7 -4
  260. package/dist/sdk/graph/index.js +8 -5
  261. package/dist/sdk/graph/index.js.map +1 -1
  262. package/dist/sdk/graph/mutation-advisory.d.ts +35 -4
  263. package/dist/sdk/graph/mutation-advisory.js +124 -35
  264. package/dist/sdk/graph/mutation-advisory.js.map +1 -1
  265. package/dist/sdk/graph/remediation.js +12 -2
  266. package/dist/sdk/graph/remediation.js.map +1 -1
  267. package/dist/sdk/graph/run.d.ts +133 -2
  268. package/dist/sdk/graph/run.js +217 -8
  269. package/dist/sdk/graph/run.js.map +1 -1
  270. package/dist/sdk/graph/scheduling.d.ts +59 -0
  271. package/dist/sdk/graph/scheduling.js +125 -0
  272. package/dist/sdk/graph/scheduling.js.map +1 -0
  273. package/dist/sdk/graph/traversal.d.ts +11 -0
  274. package/dist/sdk/graph/traversal.js +16 -2
  275. package/dist/sdk/graph/traversal.js.map +1 -1
  276. package/dist/sdk/index.d.ts +4 -0
  277. package/dist/sdk/index.js +6 -2
  278. package/dist/sdk/index.js.map +1 -1
  279. package/dist/sdk/runtime-input.js +7 -2
  280. package/dist/sdk/runtime-input.js.map +1 -1
  281. package/dist/sdk/runtime-primitives.d.ts +10 -0
  282. package/dist/sdk/runtime-primitives.js +14 -0
  283. package/dist/sdk/runtime-primitives.js.map +1 -0
  284. package/dist/sdk/runtime.d.ts +15 -0
  285. package/dist/sdk/runtime.js +16 -3
  286. package/dist/sdk/runtime.js.map +1 -1
  287. package/dist/sdk/structured-mutations.d.ts +21 -0
  288. package/dist/sdk/structured-mutations.js +375 -0
  289. package/dist/sdk/structured-mutations.js.map +1 -0
  290. package/docs/COMMANDS.md +85 -5
  291. package/docs/RELATIONSHIP_GRAPH.md +48 -7
  292. package/docs/SDK.md +78 -3
  293. package/marketplace.json +2 -2
  294. package/package.json +1 -1
  295. package/packages/pm-beads/package.json +1 -1
  296. package/packages/pm-calendar/package.json +1 -1
  297. package/packages/pm-command-kit/package.json +1 -1
  298. package/packages/pm-governance-audit/package.json +1 -1
  299. package/packages/pm-guide-shell/package.json +1 -1
  300. package/packages/pm-kanban/package.json +1 -1
  301. package/packages/pm-lifecycle-hooks/package.json +1 -1
  302. package/packages/pm-linked-test-adapters/package.json +1 -1
  303. package/packages/pm-search-advanced/package.json +1 -1
  304. package/packages/pm-templates/package.json +1 -1
  305. package/packages/pm-todos/package.json +1 -1
  306. package/packages/pm-vcs/package.json +1 -1
  307. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  308. package/plugins/pm-claude/README.md +5 -3
  309. package/plugins/pm-claude/commands/pm-init.md +1 -1
  310. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  311. package/dist/cli-bundle/chunks/chunk-3AO5VSDR.js.map +0 -7
  312. package/dist/cli-bundle/chunks/chunk-3LPFHE3P.js.map +0 -1
  313. package/dist/cli-bundle/chunks/chunk-3VY6MIEO.js.map +0 -7
  314. package/dist/cli-bundle/chunks/chunk-4F6BWJ4J.js.map +0 -7
  315. package/dist/cli-bundle/chunks/chunk-5IZJWSDB.js.map +0 -1
  316. package/dist/cli-bundle/chunks/chunk-5UX66S6U.js.map +0 -1
  317. package/dist/cli-bundle/chunks/chunk-6C2ZZX5Z.js +0 -286
  318. package/dist/cli-bundle/chunks/chunk-6C2ZZX5Z.js.map +0 -1
  319. package/dist/cli-bundle/chunks/chunk-6VIJ7UA5.js.map +0 -7
  320. package/dist/cli-bundle/chunks/chunk-6XMUURSS.js.map +0 -1
  321. package/dist/cli-bundle/chunks/chunk-C3KD7U3T.js.map +0 -7
  322. package/dist/cli-bundle/chunks/chunk-CFHAODHQ.js +0 -334
  323. package/dist/cli-bundle/chunks/chunk-CFHAODHQ.js.map +0 -1
  324. package/dist/cli-bundle/chunks/chunk-DAQ45GCS.js.map +0 -7
  325. package/dist/cli-bundle/chunks/chunk-E6LEMURX.js +0 -249
  326. package/dist/cli-bundle/chunks/chunk-E6LEMURX.js.map +0 -7
  327. package/dist/cli-bundle/chunks/chunk-G3COA6GS.js.map +0 -1
  328. package/dist/cli-bundle/chunks/chunk-GSJSM5BJ.js.map +0 -1
  329. package/dist/cli-bundle/chunks/chunk-GVI6FAFG.js.map +0 -7
  330. package/dist/cli-bundle/chunks/chunk-GVT754PX.js.map +0 -7
  331. package/dist/cli-bundle/chunks/chunk-HEWM6CEN.js.map +0 -7
  332. package/dist/cli-bundle/chunks/chunk-IJNK6WW2.js.map +0 -7
  333. package/dist/cli-bundle/chunks/chunk-INSTSQNZ.js.map +0 -7
  334. package/dist/cli-bundle/chunks/chunk-J4FBIFU6.js.map +0 -1
  335. package/dist/cli-bundle/chunks/chunk-KZEANWJS.js.map +0 -7
  336. package/dist/cli-bundle/chunks/chunk-LPEYZRUR.js.map +0 -1
  337. package/dist/cli-bundle/chunks/chunk-NHT3F4WZ.js.map +0 -1
  338. package/dist/cli-bundle/chunks/chunk-OV7MSW3I.js.map +0 -1
  339. package/dist/cli-bundle/chunks/chunk-P7JTWYLH.js +0 -246
  340. package/dist/cli-bundle/chunks/chunk-P7JTWYLH.js.map +0 -1
  341. package/dist/cli-bundle/chunks/chunk-R5U2VZ3K.js +0 -344
  342. package/dist/cli-bundle/chunks/chunk-R5U2VZ3K.js.map +0 -7
  343. package/dist/cli-bundle/chunks/chunk-SG74J6MV.js.map +0 -1
  344. package/dist/cli-bundle/chunks/chunk-T44FMVRL.js.map +0 -7
  345. package/dist/cli-bundle/chunks/chunk-THAOZG4U.js.map +0 -1
  346. package/dist/cli-bundle/chunks/chunk-UQLXSG72.js +0 -289
  347. package/dist/cli-bundle/chunks/chunk-UQLXSG72.js.map +0 -7
  348. package/dist/cli-bundle/chunks/chunk-UZDQXNUB.js.map +0 -1
  349. package/dist/cli-bundle/chunks/chunk-WVA4DVNV.js.map +0 -7
  350. package/dist/cli-bundle/chunks/register-list-query-CFVG75P3.js.map +0 -1
  351. package/dist/cli-bundle/chunks/register-list-query-E7UVY4TN.js.map +0 -7
  352. package/dist/cli-bundle/chunks/register-mutation-4VJTXBZW.js.map +0 -7
  353. package/dist/cli-bundle/chunks/register-mutation-IQ55E25C.js.map +0 -1
  354. /package/dist/cli-bundle/chunks/{append-E6V54WOQ.js.map → append-7OVFYR3C.js.map} +0 -0
  355. /package/dist/cli-bundle/chunks/{append-NNJ3EFIT.js.map → append-DFETHAZL.js.map} +0 -0
  356. /package/dist/cli-bundle/chunks/{chunk-QJKL5PHS.js.map → chunk-7656MAUL.js.map} +0 -0
  357. /package/dist/cli-bundle/chunks/{chunk-X6K5XTTN.js.map → chunk-7W2UAXXT.js.map} +0 -0
  358. /package/dist/cli-bundle/chunks/{chunk-5OK4UGFV.js.map → chunk-BXNDKOR2.js.map} +0 -0
  359. /package/dist/cli-bundle/chunks/{chunk-KSPWRNVP.js.map → chunk-CPX275C6.js.map} +0 -0
  360. /package/dist/cli-bundle/chunks/{chunk-JH2ZSLO3.js.map → chunk-DZRV2OPA.js.map} +0 -0
  361. /package/dist/cli-bundle/chunks/{chunk-L7BH7IWU.js.map → chunk-E5XMKOSB.js.map} +0 -0
  362. /package/dist/cli-bundle/chunks/{chunk-CQTQKUUV.js.map → chunk-EWJWSNRU.js.map} +0 -0
  363. /package/dist/cli-bundle/chunks/{chunk-3MCTMJXI.js.map → chunk-FPBMLYPI.js.map} +0 -0
  364. /package/dist/cli-bundle/chunks/{chunk-DVDBQA3B.js.map → chunk-GTK4DTEW.js.map} +0 -0
  365. /package/dist/cli-bundle/chunks/{chunk-GIQSU6S2.js.map → chunk-KBLZ3AA5.js.map} +0 -0
  366. /package/dist/cli-bundle/chunks/{chunk-XJF7CDNH.js.map → chunk-KH44WBAT.js.map} +0 -0
  367. /package/dist/cli-bundle/chunks/{chunk-GV2262OF.js.map → chunk-LAV26CQG.js.map} +0 -0
  368. /package/dist/cli-bundle/chunks/{chunk-VDO2JMD4.js.map → chunk-LVC72YRD.js.map} +0 -0
  369. /package/dist/cli-bundle/chunks/{chunk-ZYPFOO3L.js.map → chunk-MATHDCGG.js.map} +0 -0
  370. /package/dist/cli-bundle/chunks/{chunk-AOEOYL3S.js.map → chunk-O4BCOJTZ.js.map} +0 -0
  371. /package/dist/cli-bundle/chunks/{chunk-RJO3YAFM.js.map → chunk-OCUBRA6D.js.map} +0 -0
  372. /package/dist/cli-bundle/chunks/{chunk-I577UHC7.js.map → chunk-OR42SO64.js.map} +0 -0
  373. /package/dist/cli-bundle/chunks/{chunk-ZOJ3LR7O.js.map → chunk-OY7DMU5P.js.map} +0 -0
  374. /package/dist/cli-bundle/chunks/{chunk-ZV2NTVMJ.js.map → chunk-PONKZPCJ.js.map} +0 -0
  375. /package/dist/cli-bundle/chunks/{chunk-UX6SSO2I.js.map → chunk-PZC2FUOQ.js.map} +0 -0
  376. /package/dist/cli-bundle/chunks/{chunk-VQIHNHMJ.js.map → chunk-QIH77CAG.js.map} +0 -0
  377. /package/dist/cli-bundle/chunks/{chunk-R3EWPG4A.js.map → chunk-QJIKE24M.js.map} +0 -0
  378. /package/dist/cli-bundle/chunks/{chunk-HB3P4M52.js.map → chunk-TRSHFPRZ.js.map} +0 -0
  379. /package/dist/cli-bundle/chunks/{chunk-HRW7GF6T.js.map → chunk-UCBDQI5E.js.map} +0 -0
  380. /package/dist/cli-bundle/chunks/{chunk-4U4Z6AHI.js.map → chunk-V22ZPOKN.js.map} +0 -0
  381. /package/dist/cli-bundle/chunks/{chunk-JM6YAXTR.js.map → chunk-VHXHVTUU.js.map} +0 -0
  382. /package/dist/cli-bundle/chunks/{chunk-D6NXDNP3.js.map → chunk-VLRGDBLY.js.map} +0 -0
  383. /package/dist/cli-bundle/chunks/{chunk-JAPE62Y5.js.map → chunk-VNTCM3VW.js.map} +0 -0
  384. /package/dist/cli-bundle/chunks/{chunk-FDHPAVVB.js.map → chunk-VXOOB6YX.js.map} +0 -0
  385. /package/dist/cli-bundle/chunks/{chunk-HQ3SB4CN.js.map → chunk-X3W65QK3.js.map} +0 -0
  386. /package/dist/cli-bundle/chunks/{chunk-RZJLNXFG.js.map → chunk-XJTABV3X.js.map} +0 -0
  387. /package/dist/cli-bundle/chunks/{chunk-TYHJDFYW.js.map → chunk-ZVZGXPQ5.js.map} +0 -0
  388. /package/dist/cli-bundle/chunks/{close-many-SDA426VT.js.map → close-many-5RZXVN4J.js.map} +0 -0
  389. /package/dist/cli-bundle/chunks/{close-many-UTZANOCQ.js.map → close-many-RZVTUGBG.js.map} +0 -0
  390. /package/dist/cli-bundle/chunks/{comments-LZN6FXXC.js.map → comments-TPU7QRBL.js.map} +0 -0
  391. /package/dist/cli-bundle/chunks/{comments-VBQ345ND.js.map → comments-Z4KV6FU3.js.map} +0 -0
  392. /package/dist/cli-bundle/chunks/{create-GG4RBCGC.js.map → create-EIFBIVNQ.js.map} +0 -0
  393. /package/dist/cli-bundle/chunks/{create-JBC5KUW6.js.map → create-RGSPN5GD.js.map} +0 -0
  394. /package/dist/cli-bundle/chunks/{deps-FI4O6NQS.js.map → deps-UH5EQQUY.js.map} +0 -0
  395. /package/dist/cli-bundle/chunks/{deps-DELOO4TL.js.map → deps-YG7UF3VR.js.map} +0 -0
  396. /package/dist/cli-bundle/chunks/{docs-6Z2MP526.js.map → docs-G32TK6XS.js.map} +0 -0
  397. /package/dist/cli-bundle/chunks/{docs-2UYBP5D6.js.map → docs-JWWNRC27.js.map} +0 -0
  398. /package/dist/cli-bundle/chunks/{files-HKEAN5MA.js.map → files-3H32UQ4K.js.map} +0 -0
  399. /package/dist/cli-bundle/chunks/{files-HEUGSJZL.js.map → files-4ALMCSKB.js.map} +0 -0
  400. /package/dist/cli-bundle/chunks/{history-compact-7NDVP3PT.js.map → history-compact-77BT2LUB.js.map} +0 -0
  401. /package/dist/cli-bundle/chunks/{history-compact-65YVN5DB.js.map → history-compact-VCKGTX64.js.map} +0 -0
  402. /package/dist/cli-bundle/chunks/{history-redact-7YBL4XSG.js.map → history-redact-LJPZPNFA.js.map} +0 -0
  403. /package/dist/cli-bundle/chunks/{history-redact-IZGNJBU4.js.map → history-redact-PWTTJ3XS.js.map} +0 -0
  404. /package/dist/cli-bundle/chunks/{history-repair-7M4PYQUH.js.map → history-repair-I7CBNCV3.js.map} +0 -0
  405. /package/dist/cli-bundle/chunks/{history-repair-GNGETJLI.js.map → history-repair-YTDZRK5E.js.map} +0 -0
  406. /package/dist/cli-bundle/chunks/{learnings-3YXDRWFT.js.map → learnings-CYNOICKR.js.map} +0 -0
  407. /package/dist/cli-bundle/chunks/{learnings-ALC6IMNL.js.map → learnings-KTYW3AL7.js.map} +0 -0
  408. /package/dist/cli-bundle/chunks/{notes-7JMLQ447.js.map → notes-FGO63FXL.js.map} +0 -0
  409. /package/dist/cli-bundle/chunks/{notes-JFCLTC5C.js.map → notes-ZERD3KB2.js.map} +0 -0
  410. /package/dist/cli-bundle/chunks/{plan-T3XB3WTK.js.map → plan-OFJUBIM5.js.map} +0 -0
  411. /package/dist/cli-bundle/chunks/{plan-KOIPWVOZ.js.map → plan-SGCDDTYR.js.map} +0 -0
  412. /package/dist/cli-bundle/chunks/{profile-OILJHKUW.js.map → profile-3THJPIQY.js.map} +0 -0
  413. /package/dist/cli-bundle/chunks/{profile-RJXA7PGS.js.map → profile-XEZAMMBW.js.map} +0 -0
  414. /package/dist/cli-bundle/chunks/{restore-ZH65GZFB.js.map → restore-6TDVSATY.js.map} +0 -0
  415. /package/dist/cli-bundle/chunks/{restore-L6IAGOD7.js.map → restore-RSL7C7LO.js.map} +0 -0
  416. /package/dist/cli-bundle/chunks/{schema-4ERWM5QJ.js.map → schema-HFXFSGPG.js.map} +0 -0
  417. /package/dist/cli-bundle/chunks/{schema-55DL3Q52.js.map → schema-TPVTIJPO.js.map} +0 -0
  418. /package/dist/cli-bundle/chunks/{update-FW6FKDOP.js.map → update-LJZCL5SI.js.map} +0 -0
  419. /package/dist/cli-bundle/chunks/{update-TJHSPRPT.js.map → update-SIA7LH5Y.js.map} +0 -0
  420. /package/dist/cli-bundle/chunks/{update-many-PWXX5WHO.js.map → update-many-BDBZVGQL.js.map} +0 -0
  421. /package/dist/cli-bundle/chunks/{update-many-NNALYQCN.js.map → update-many-MOY3A5B3.js.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../../sdk/graph/assembly.ts"],
4
- "sourcesContent": ["/**\n * @module sdk/graph/assembly\n *\n * Builds the shared workspace relationship graph consumed by dependency\n * queries, bounded context packets, impact analysis, and governance audits.\n * Assembly normalizes hierarchy, legacy scalar blockers, and structured\n * dependency edges into one deterministic {@link RelationshipGraph}, classifies\n * dangling references without mutating their holders, and materializes missing\n * endpoints as placeholder nodes so bounded traversals can explain absent work\n * instead of silently dropping it.\n */\nimport type { Dependency, ItemStatus } from \"../../types/index.js\";\nimport { getActiveExtensionRegistrations } from \"../../core/extensions/index.js\";\nimport {\n RelationshipGraph,\n createRelationshipKindRegistry,\n type RelationshipKindRegistry,\n} from \"../relationships.js\";\n\n/** Minimal item shape inspected by dependency-reference governance. */\nexport interface DependencyReferenceHolder {\n /** Stable item identifier. */\n id: string;\n /** Lifecycle status used to separate actionable work from historical debt. */\n status: ItemStatus;\n /** Optional hierarchy parent reference. */\n parent?: string;\n /** Optional legacy scalar blocker reference. */\n blocked_by?: string;\n /** Structured dependency edges. */\n dependencies?: Dependency[];\n}\n\n/** Storage surface that contributed a normalized dependency reference. */\nexport type DependencyReferenceSource = \"parent\" | \"blocked_by\" | \"dependency\";\n\n/** One normalized dependency reference whose target is absent from the tracker. */\nexport interface DanglingDependencyReference {\n /** Item that owns the reference. */\n holder_id: string;\n /** Missing referenced item id or legacy sentinel. */\n target_id: string;\n /** Relationship field or dependency kind. */\n kind: string;\n /** Storage surface that owns the reference and determines its remediation. */\n source: DependencyReferenceSource;\n /** Current lifecycle status of the holder. */\n holder_status: ItemStatus;\n /** Whether the holder is terminal and therefore historical, non-actionable debt. */\n legacy_terminal: boolean;\n /** Whether the target is the pre-structured-dependency `no-active-blocker` sentinel. */\n no_active_blocker_sentinel: boolean;\n}\n\n/** Actionable and historical partitions returned by dependency-reference governance. */\nexport interface DanglingDependencyReferenceSummary {\n /** Missing references held by active items; these may affect scheduling and should gate validation. */\n active: DanglingDependencyReference[];\n /** Missing references held only by terminal items; retained as informational history debt. */\n legacy_terminal: DanglingDependencyReference[];\n /** Legacy sentinel rows across active and terminal holders, called out separately from typo-like ids. */\n no_active_blocker_sentinels: DanglingDependencyReference[];\n}\n\n/** Normalize a decoded reference target and reject empty legacy placeholders. */\nfunction normalizeDependencyReferenceTarget(\n target: unknown,\n): string | undefined {\n if (typeof target !== \"string\") return undefined;\n const normalized = target.trim();\n if (\n !normalized ||\n [\"none\", \"null\", \"n/a\", \"na\"].includes(normalized.toLowerCase())\n )\n return undefined;\n return normalized;\n}\n\n/** Normalize a graph target while removing the historical no-blocker marker. */\nfunction normalizeDependencyGraphTarget(target: unknown): string | undefined {\n const normalized = normalizeDependencyReferenceTarget(target);\n return normalized?.toLowerCase() === \"no-active-blocker\"\n ? undefined\n : normalized;\n}\n\n/**\n * Classify missing hierarchy and dependency targets without mutating their holders.\n *\n * Consumers provide the workspace's terminal-status predicate so custom lifecycle\n * schemas receive the same active-versus-historical behavior as the built-in\n * closed/canceled statuses.\n */\nexport function collectDanglingDependencyReferences(\n items: readonly DependencyReferenceHolder[],\n isTerminal: (status: ItemStatus) => boolean = (status) =>\n status === \"closed\" || status === \"canceled\",\n): DanglingDependencyReferenceSummary {\n const safeItems = items.filter(\n (item) => typeof item?.id === \"string\" && item.id.trim().length > 0,\n );\n const knownIds = new Set(\n safeItems.map((item) => item.id.trim().toLowerCase()),\n );\n const rows = new Map<string, DanglingDependencyReference>();\n const addReference = (\n item: DependencyReferenceHolder,\n target: unknown,\n kind: string,\n source: DependencyReferenceSource,\n ): void => {\n const normalized = normalizeDependencyReferenceTarget(target);\n if (!normalized || knownIds.has(normalized.toLowerCase())) {\n return;\n }\n const row: DanglingDependencyReference = {\n holder_id: item.id.trim(),\n target_id: normalized,\n kind,\n source,\n holder_status: item.status,\n legacy_terminal: isTerminal(item.status),\n no_active_blocker_sentinel:\n normalized.toLowerCase() === \"no-active-blocker\",\n };\n rows.set(\n `${row.holder_id}::${row.target_id}::${row.kind}::${row.source}`,\n row,\n );\n };\n for (const item of safeItems) {\n addReference(item, item.parent, \"parent\", \"parent\");\n addReference(item, item.blocked_by, \"blocked_by\", \"blocked_by\");\n for (const dependency of item.dependencies ?? []) {\n // Public SDK callers may supply legacy or JSON-decoded payloads that do\n // not yet satisfy the current structured dependency contract.\n if (typeof dependency !== \"object\" || dependency === null) {\n continue;\n }\n const legacyDependency = dependency as Partial<Dependency>;\n addReference(\n item,\n legacyDependency.id,\n typeof legacyDependency.kind === \"string\"\n ? legacyDependency.kind\n : \"related\",\n \"dependency\",\n );\n }\n }\n const sorted = [...rows.values()].sort(\n (left, right) =>\n left.holder_id.localeCompare(right.holder_id) ||\n left.target_id.localeCompare(right.target_id) ||\n left.kind.localeCompare(right.kind) ||\n left.source.localeCompare(right.source),\n );\n const legacyTerminal = sorted.filter((row) => row.legacy_terminal);\n return {\n active: sorted.filter((row) => !row.legacy_terminal),\n legacy_terminal: legacyTerminal,\n no_active_blocker_sentinels: sorted.filter(\n (row) => row.no_active_blocker_sentinel,\n ),\n };\n}\n\n/** Return unique real missing targets while excluding the legacy no-blocker sentinel. */\nexport function collectMissingDependencyTargetIds(\n dangling: DanglingDependencyReferenceSummary,\n): string[] {\n const targets = new Map<string, string>();\n for (const reference of [...dangling.active, ...dangling.legacy_terminal]) {\n if (reference.no_active_blocker_sentinel) continue;\n const target = reference.target_id.trim();\n const key = target.toLowerCase();\n if (!targets.has(key)) targets.set(key, target);\n }\n return [...targets.values()].sort((left, right) => left.localeCompare(right));\n}\n\n/** Item shape accepted by workspace relationship-graph assembly. */\nexport interface WorkspaceRelationshipItem extends DependencyReferenceHolder {\n /** Human-readable title projected into per-node details. */\n title: string;\n}\n\n/** Compact node projection paired with the assembled graph. */\nexport interface WorkspaceRelationshipNodeDetails {\n /** Stable node identifier. */\n id: string;\n /** Human-readable node title, or a `[missing]` marker for absent endpoints. */\n title: string;\n /** Lifecycle status, or the `missing` marker status for absent endpoints. */\n status: string;\n}\n\n/** Assembled workspace relationship graph with governance side-products. */\nexport interface WorkspaceRelationshipAssembly {\n /** Deterministic relationship graph including missing placeholder nodes. */\n graph: RelationshipGraph;\n /** Per-node compact details covering real and missing nodes. */\n details: WorkspaceRelationshipNodeDetails[];\n /** Lowercased identifiers of materialized missing endpoints. */\n missingIdSet: Set<string>;\n /** Dangling-reference classification computed during assembly. */\n dangling: DanglingDependencyReferenceSummary;\n}\n\n/**\n * Build the shared workspace relationship graph including missing placeholder\n * nodes. One assembly serves every bounded query in an invocation — dependency\n * trees, context packets, impact analysis, path enumeration, and governance\n * audits — so the full-workspace normalization cost is paid once instead of\n * once per query surface.\n */\nexport function assembleWorkspaceRelationshipGraph(\n items: readonly WorkspaceRelationshipItem[],\n isTerminal?: (status: ItemStatus) => boolean,\n registry?: RelationshipKindRegistry,\n): WorkspaceRelationshipAssembly {\n const relationshipRegistry = registry ?? createRelationshipKindRegistry();\n if (registry === undefined) {\n // Preserve compatibility with activation payloads produced before this registry existed.\n for (const registration of\n getActiveExtensionRegistrations()?.relationship_kinds ?? []) {\n for (const definition of registration.definitions) {\n relationshipRegistry.register(definition);\n }\n }\n }\n const safeItems = items.filter(\n (item) => typeof item?.id === \"string\" && item.id.trim().length > 0,\n );\n const canonicalIds = new Map(\n safeItems.map((item) => [item.id.trim().toLowerCase(), item.id.trim()]),\n );\n const dangling = collectDanglingDependencyReferences(safeItems, isTerminal);\n const missingIds = collectMissingDependencyTargetIds(dangling);\n for (const id of missingIds) canonicalIds.set(id.toLowerCase(), id);\n const graphItems = safeItems.map((item) => {\n const parent = normalizeDependencyGraphTarget(item.parent);\n const blocker = normalizeDependencyGraphTarget(item.blocked_by);\n const dependencies = (item.dependencies ?? []).flatMap((rawDependency) => {\n if (typeof rawDependency !== \"object\" || rawDependency === null)\n return [];\n const dependency = rawDependency as Partial<Dependency>;\n const target = normalizeDependencyGraphTarget(dependency.id);\n if (!target) return [];\n return [\n {\n id: canonicalIds.get(target.toLowerCase())!,\n kind:\n typeof dependency.kind === \"string\" ? dependency.kind : \"related\",\n },\n ];\n });\n return {\n id: item.id.trim(),\n ...(parent ? { parent: canonicalIds.get(parent.toLowerCase())! } : {}),\n ...(blocker\n ? { blocked_by: canonicalIds.get(blocker.toLowerCase())! }\n : {}),\n dependencies,\n };\n });\n return {\n graph: RelationshipGraph.fromItems(\n [...graphItems, ...missingIds.map((id) => ({ id }))],\n relationshipRegistry,\n ),\n details: [\n ...safeItems.map((item) => ({\n id: item.id.trim(),\n title: item.title,\n status: item.status,\n })),\n ...missingIds.map((id) => ({\n id,\n title: `[missing] ${id}`,\n status: \"missing\",\n })),\n ],\n missingIdSet: new Set(missingIds.map((id) => id.toLowerCase())),\n dangling,\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;AAiEA,SAAS,mCACP,QAAe;AAEf,MAAI,OAAO,WAAW;AAAU,WAAO;AACvC,QAAM,aAAa,OAAO,KAAI;AAC9B,MACE,CAAC,cACD,CAAC,QAAQ,QAAQ,OAAO,IAAI,EAAE,SAAS,WAAW,YAAW,CAAE;AAE/D,WAAO;AACT,SAAO;AACT;AAGA,SAAS,+BAA+B,QAAe;AACrD,QAAM,aAAa,mCAAmC,MAAM;AAC5D,SAAO,YAAY,YAAW,MAAO,sBACjC,SACA;AACN;AASM,SAAU,oCACd,OACA,aAA8C,CAAC,WAC7C,WAAW,YAAY,WAAW,YAAU;AAE9C,QAAM,YAAY,MAAM,OACtB,CAAC,SAAS,OAAO,MAAM,OAAO,YAAY,KAAK,GAAG,KAAI,EAAG,SAAS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AAQ,CAAC,kBAAiB;AACvE,UAAI,OAAO,kBAAkB,YAAY,kBAAkB;AACzD,eAAO,CAAA;AACT,YAAM,aAAa;AACnB,YAAM,SAAS,+BAA+B,WAAW,EAAE;AAC3D,UAAI,CAAC;AAAQ,eAAO,CAAA;AACpB,aAAO;QACL;UACE,IAAI,aAAa,IAAI,OAAO,YAAW,CAAE;UACzC,MACE,OAAO,WAAW,SAAS,WAAW,WAAW,OAAO;;;IAGhE,CAAC;AACD,WAAO;MACL,IAAI,KAAK,GAAG,KAAI;MAChB,GAAI,SAAS,EAAE,QAAQ,aAAa,IAAI,OAAO,YAAW,CAAE,EAAE,IAAK,CAAA;MACnE,GAAI,UACA,EAAE,YAAY,aAAa,IAAI,QAAQ,YAAW,CAAE,EAAE,IACtD,CAAA;MACJ;;EAEJ,CAAC;AACD,SAAO;IACL,OAAO,kBAAkB,UACvB,CAAC,GAAG,YAAY,GAAG,WAAW,IAAI,CAAC,QAAQ,EAAE,GAAE,EAAG,CAAC,GACnD,oBAAoB;IAEtB,SAAS;MACP,GAAG,UAAU,IAAI,CAAC,UAAU;QAC1B,IAAI,KAAK,GAAG,KAAI;QAChB,OAAO,KAAK;QACZ,QAAQ,KAAK;QACb;MACF,GAAG,WAAW,IAAI,CAAC,QAAQ;QACzB;QACA,OAAO,aAAa,EAAE;QACtB,QAAQ;QACR;;IAEJ,cAAc,IAAI,IAAI,WAAW,IAAI,CAAC,OAAO,GAAG,YAAW,CAAE,CAAC;IAC9D;;AAEJ;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../../sdk/merge/three-way.ts", "../../../../../../../../sdk/merge/driver.ts"],
4
- "sourcesContent": ["/**\n * @module sdk/merge/three-way\n *\n * Field-aware three-way merge primitives for every mergeable tracker artifact\n * class: append-only history JSONL streams, item documents (TOON or\n * JSON+Markdown), and key-level JSON configuration/schema files. These\n * primitives are pure (content in, content out) so the CLI merge driver, the\n * MCP surface, and package integrations all share one merge semantics\n * definition for multi-branch agent workflows.\n */\nimport {\n historyEntriesToRaw,\n reanchorHistoryEntries,\n} from \"../../core/history/replay.js\";\nimport {\n canonicalDocument,\n parseItemDocument,\n serializeItemDocument,\n type ItemDocumentFormatOptions,\n} from \"../../core/item/item-format.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { findFirstMergeConflictMarker } from \"../../core/shared/conflict-markers.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { stableStringify } from \"../../core/shared/serialization.js\";\nimport { compareTimestampStrings } from \"../../core/shared/time.js\";\nimport type {\n HistoryEntry,\n ItemDocument,\n ItemMetadata,\n} from \"../../types/index.js\";\n\n/** Restricts which side of a three-way merge wins an unresolvable conflict. */\nexport type MergePreferredSide = \"ours\" | \"theirs\";\n\n/** Restricts the strategy labels reported by the history stream merge. */\nexport type HistoryMergeStrategy =\n | \"identical\"\n | \"fast_forward_ours\"\n | \"fast_forward_theirs\"\n | \"union_reanchor\";\n\n/** Documents the history stream merge result payload exchanged by command, SDK, and package integrations. */\nexport interface HistoryMergeResult {\n /** Merged JSONL content ready to be written as the resolved history stream. */\n merged: string;\n /** Strategy the merge used: identical inputs, one-sided fast-forward, or a deterministic union with a re-anchored hash chain. */\n strategy: HistoryMergeStrategy;\n /** Number of entries shared by both sides before their streams diverged. */\n common_entries: number;\n /** Number of divergent entries contributed by the ours side. */\n entries_from_ours: number;\n /** Number of divergent entries contributed by the theirs side. */\n entries_from_theirs: number;\n /** Total entries in the merged stream. */\n entries_total: number;\n /** Whether the merged chain required hash re-anchoring (true for every union merge). */\n reanchored: boolean;\n}\n\nfunction parseHistoryJsonl(raw: string, label: string): HistoryEntry[] {\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n throw new PmCliError(\n `History merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const entries: HistoryEntry[] = [];\n for (const [index, rawLine] of raw.split(/\\r?\\n/).entries()) {\n const line = rawLine.trim();\n if (!line) {\n continue;\n }\n try {\n const parsed = JSON.parse(line) as unknown;\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n throw new TypeError(\"history entry must be an object\");\n }\n entries.push(parsed as HistoryEntry);\n } catch {\n throw new PmCliError(\n `History merge input (${label}) contains invalid JSON at line ${index + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n }\n return entries;\n}\n\nfunction historyEntryIdentity(entry: HistoryEntry): string {\n return stableStringify({\n ts: entry.ts,\n author: entry.author,\n op: entry.op,\n patch: entry.patch,\n message: entry.message ?? null,\n });\n}\n\nfunction commonHistoryPrefixLength(\n ours: HistoryEntry[],\n theirs: HistoryEntry[],\n): number {\n const limit = Math.min(ours.length, theirs.length);\n let shared = 0;\n while (\n shared < limit &&\n historyEntryIdentity(ours[shared]) === historyEntryIdentity(theirs[shared])\n ) {\n shared += 1;\n }\n return shared;\n}\n\n/**\n * Deterministically merge two diverged versions of one append-only history\n * JSONL stream. Identical streams and one-sided fast-forwards keep the winning\n * side byte-for-byte; genuinely diverged streams are merged as the shared\n * prefix plus both suffixes ordered by timestamp (ours-first on ties), then\n * hash re-anchored so the resulting chain verifies again. No side's events are\n * ever discarded: content divergence is preserved for the post-merge\n * reconciliation pass (`pm validate` + `pm history-repair`) instead of being\n * silently resolved by last-writer-wins.\n */\nexport function mergeHistoryStreams(\n baseRaw: string,\n oursRaw: string,\n theirsRaw: string,\n): HistoryMergeResult {\n parseHistoryJsonl(baseRaw, \"base\");\n const ours = parseHistoryJsonl(oursRaw, \"ours\");\n const theirs = parseHistoryJsonl(theirsRaw, \"theirs\");\n const shared = commonHistoryPrefixLength(ours, theirs);\n\n if (shared === ours.length && shared === theirs.length) {\n return {\n merged: historyEntriesToRaw(ours),\n strategy: \"identical\",\n common_entries: shared,\n entries_from_ours: 0,\n entries_from_theirs: 0,\n entries_total: ours.length,\n reanchored: false,\n };\n }\n if (shared === theirs.length) {\n return {\n merged: historyEntriesToRaw(ours),\n strategy: \"fast_forward_ours\",\n common_entries: shared,\n entries_from_ours: ours.length - shared,\n entries_from_theirs: 0,\n entries_total: ours.length,\n reanchored: false,\n };\n }\n if (shared === ours.length) {\n return {\n merged: historyEntriesToRaw(theirs),\n strategy: \"fast_forward_theirs\",\n common_entries: shared,\n entries_from_ours: 0,\n entries_from_theirs: theirs.length - shared,\n entries_total: theirs.length,\n reanchored: false,\n };\n }\n\n const oursSuffix = ours.slice(shared);\n const seenIdentities = new Set(oursSuffix.map(historyEntryIdentity));\n const theirsSuffix = theirs\n .slice(shared)\n .filter((entry) => !seenIdentities.has(historyEntryIdentity(entry)));\n const mergedSuffix = [...oursSuffix, ...theirsSuffix].sort((left, right) => {\n const byTs = compareTimestampStrings(left.ts, right.ts);\n if (byTs !== 0) {\n return byTs;\n }\n const leftFromOurs = seenIdentities.has(historyEntryIdentity(left));\n const rightFromOurs = seenIdentities.has(historyEntryIdentity(right));\n if (leftFromOurs !== rightFromOurs) {\n return Number(rightFromOurs) - Number(leftFromOurs);\n }\n return historyEntryIdentity(left).localeCompare(historyEntryIdentity(right));\n });\n const reanchored = reanchorHistoryEntries([\n ...ours.slice(0, shared),\n ...mergedSuffix,\n ]);\n return {\n merged: historyEntriesToRaw(reanchored.entries),\n strategy: \"union_reanchor\",\n common_entries: shared,\n entries_from_ours: oursSuffix.length,\n entries_from_theirs: theirsSuffix.length,\n entries_total: reanchored.entries.length,\n reanchored: true,\n };\n}\n\n/** Documents the relationship event stream merge result payload exchanged by command, SDK, and package integrations. */\nexport interface RelationshipStreamMergeResult {\n /** Merged JSONL content with consecutively renumbered `sequence` values, ready to be written as the resolved event store. */\n merged: string;\n /** Strategy the merge used: identical inputs, one-sided fast-forward, or a deterministic union with renumbered sequences. */\n strategy: HistoryMergeStrategy;\n /** Number of events shared by both sides before their streams diverged. */\n common_entries: number;\n /** Number of divergent events contributed by the ours side. */\n entries_from_ours: number;\n /** Number of divergent events contributed by the theirs side. */\n entries_from_theirs: number;\n /** Total events in the merged stream. */\n entries_total: number;\n /** Whether merged events required sequence renumbering (true for every union merge). */\n reanchored: boolean;\n}\n\ninterface RelationshipStreamEvent {\n /** Globally unique event identity used for prefix detection and suffix deduplication. */\n eventId: string;\n /** One-based append sequence; rewritten consecutively in the merged stream. */\n sequence: number;\n /** ISO timestamp used to order divergent suffixes deterministically. */\n timestamp?: string;\n /** Remaining event payload fields, preserved verbatim. */\n [key: string]: unknown;\n}\n\nfunction parseRelationshipJsonl(\n raw: string,\n label: string,\n): RelationshipStreamEvent[] {\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n throw new PmCliError(\n `Relationship merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}. Merge drivers must receive clean per-side versions.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const events: RelationshipStreamEvent[] = [];\n for (const [index, rawLine] of raw.split(/\\r?\\n/).entries()) {\n const line = rawLine.trim();\n if (!line) {\n continue;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(line) as unknown;\n } catch {\n throw new PmCliError(\n `Relationship merge input (${label}) contains invalid JSON at line ${index + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (\n typeof parsed !== \"object\" ||\n parsed === null ||\n Array.isArray(parsed) ||\n typeof (parsed as { eventId?: unknown }).eventId !== \"string\" ||\n typeof (parsed as { sequence?: unknown }).sequence !== \"number\"\n ) {\n throw new PmCliError(\n `Relationship merge input (${label}) line ${index + 1} is not a relationship event (eventId + sequence required).`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n events.push(parsed as RelationshipStreamEvent);\n }\n return events;\n}\n\nfunction relationshipEventsToRaw(events: RelationshipStreamEvent[]): string {\n return events.length === 0\n ? \"\"\n : `${events.map((event) => JSON.stringify(event)).join(\"\\n\")}\\n`;\n}\n\nfunction renumberRelationshipEvents(\n events: RelationshipStreamEvent[],\n): RelationshipStreamEvent[] {\n return events.map((event, index) => ({ ...event, sequence: index + 1 }));\n}\n\n/**\n * Deterministically merge two diverged versions of one append-only\n * relationship event JSONL store. The store's loader enforces strictly\n * consecutive one-based `sequence` values, so a plain text union of two\n * diverged streams is always unreadable; this merge keeps the shared prefix,\n * unions both divergent suffixes by `eventId` (ordered by event timestamp,\n * ours-first on ties), and renumbers every merged sequence consecutively so\n * the resulting stream loads again. No side's events are ever discarded.\n */\nexport function mergeRelationshipEventStreams(\n baseRaw: string,\n oursRaw: string,\n theirsRaw: string,\n): RelationshipStreamMergeResult {\n parseRelationshipJsonl(baseRaw, \"base\");\n const ours = parseRelationshipJsonl(oursRaw, \"ours\");\n const theirs = parseRelationshipJsonl(theirsRaw, \"theirs\");\n const limit = Math.min(ours.length, theirs.length);\n let shared = 0;\n while (shared < limit && ours[shared].eventId === theirs[shared].eventId) {\n shared += 1;\n }\n\n if (shared === ours.length && shared === theirs.length) {\n return {\n merged: relationshipEventsToRaw(ours),\n strategy: \"identical\",\n common_entries: shared,\n entries_from_ours: 0,\n entries_from_theirs: 0,\n entries_total: ours.length,\n reanchored: false,\n };\n }\n if (shared === theirs.length) {\n return {\n merged: relationshipEventsToRaw(ours),\n strategy: \"fast_forward_ours\",\n common_entries: shared,\n entries_from_ours: ours.length - shared,\n entries_from_theirs: 0,\n entries_total: ours.length,\n reanchored: false,\n };\n }\n if (shared === ours.length) {\n return {\n merged: relationshipEventsToRaw(theirs),\n strategy: \"fast_forward_theirs\",\n common_entries: shared,\n entries_from_ours: 0,\n entries_from_theirs: theirs.length - shared,\n entries_total: theirs.length,\n reanchored: false,\n };\n }\n\n const oursSuffix = ours.slice(shared);\n const oursEventIds = new Set(oursSuffix.map((event) => event.eventId));\n const theirsSuffix = theirs\n .slice(shared)\n .filter((event) => !oursEventIds.has(event.eventId));\n const mergedSuffix = [...oursSuffix, ...theirsSuffix].sort((left, right) => {\n if (left.timestamp !== undefined && right.timestamp !== undefined) {\n const byTs = compareTimestampStrings(left.timestamp, right.timestamp);\n if (byTs !== 0) {\n return byTs;\n }\n } else if (left.timestamp === undefined && right.timestamp !== undefined) {\n return 1;\n } else if (left.timestamp !== undefined) {\n return -1;\n }\n const leftFromOurs = oursEventIds.has(left.eventId);\n const rightFromOurs = oursEventIds.has(right.eventId);\n if (leftFromOurs !== rightFromOurs) {\n return Number(rightFromOurs) - Number(leftFromOurs);\n }\n // Array.prototype.sort is stable: returning zero preserves each side's\n // original append order when its events share a timestamp.\n return 0;\n });\n const merged = renumberRelationshipEvents([\n ...ours.slice(0, shared),\n ...mergedSuffix,\n ]);\n return {\n merged: relationshipEventsToRaw(merged),\n strategy: \"union_reanchor\",\n common_entries: shared,\n entries_from_ours: oursSuffix.length,\n entries_from_theirs: theirsSuffix.length,\n entries_total: merged.length,\n reanchored: true,\n };\n}\n\n/**\n * Item metadata collections merged by element-identity set semantics instead\n * of whole-field three-way comparison: concurrent commutative appends from two\n * branches (notes on A, tags on B, a test run on each) must merge cleanly.\n * Element identity is the stable serialization of the normalized element, so\n * an element edited on one side counts as remove-old + add-new and both sides'\n * contributions survive. Plan collections are deliberately excluded: plan\n * steps carry cross-element ordering invariants that set-union would corrupt,\n * so they stay under scalar three-way semantics with explicit conflicts.\n */\nexport const ITEM_UNION_COLLECTION_FIELDS = [\n \"tags\",\n \"dependencies\",\n \"comments\",\n \"notes\",\n \"learnings\",\n \"files\",\n \"tests\",\n \"test_runs\",\n \"docs\",\n \"reminders\",\n \"events\",\n] as const;\n\n/** Item metadata fields resolved by deterministic latest-timestamp-wins instead of three-way conflict, so disjoint-field edits never conflict on the shared freshness scalar every mutation rewrites. */\nexport const ITEM_LATEST_TIMESTAMP_FIELDS = [\"updated_at\"] as const;\n\n/** Documents the item document merge result payload exchanged by command, SDK, and package integrations. */\nexport interface ItemDocumentMergeResult {\n /** Serialized merged item document (always parseable; count headers recomputed by canonical serialization). */\n merged: string;\n /** Metadata fields (plus `body`) where both sides changed to different values; resolved toward the preferred side. */\n conflict_fields: string[];\n /** Fields taken from the theirs side by clean three-way resolution. */\n fields_from_theirs: string[];\n /** Collection fields that merged by element-identity union. */\n union_fields: string[];\n /** Which side unresolvable conflicts were resolved toward. */\n preferred: MergePreferredSide;\n}\n\nfunction jsonEquals(left: unknown, right: unknown): boolean {\n return stableStringify(left ?? null) === stableStringify(right ?? null);\n}\n\nfunction unionCollection(\n base: unknown,\n ours: unknown,\n theirs: unknown,\n): unknown[] {\n const toEntries = (value: unknown): unknown[] =>\n Array.isArray(value) ? value : [];\n const baseIds = new Set(toEntries(base).map((entry) => stableStringify(entry)));\n const oursEntries = toEntries(ours);\n const oursIds = new Set(oursEntries.map((entry) => stableStringify(entry)));\n const theirsEntries = toEntries(theirs);\n const theirsIds = new Set(\n theirsEntries.map((entry) => stableStringify(entry)),\n );\n const merged = oursEntries.filter((entry) => {\n const identity = stableStringify(entry);\n // An element kept by ours survives unless theirs deleted it (present in\n // base, absent from theirs).\n return !baseIds.has(identity) || theirsIds.has(identity);\n });\n for (const entry of theirsEntries) {\n const identity = stableStringify(entry);\n if (!oursIds.has(identity) && !baseIds.has(identity)) {\n merged.push(entry);\n }\n }\n return merged;\n}\n\nfunction latestTimestamp(ours: unknown, theirs: unknown): unknown {\n return compareTimestampStrings(String(ours), String(theirs)) >= 0\n ? ours\n : theirs;\n}\n\ninterface ScalarMergeOutcome {\n value: unknown;\n from_theirs: boolean;\n conflict: boolean;\n}\n\nfunction mergeScalarThreeWay(\n base: unknown,\n ours: unknown,\n theirs: unknown,\n preferred: MergePreferredSide,\n): ScalarMergeOutcome {\n if (jsonEquals(ours, theirs)) {\n return { value: ours, from_theirs: false, conflict: false };\n }\n if (jsonEquals(base, ours)) {\n return { value: theirs, from_theirs: true, conflict: false };\n }\n if (jsonEquals(base, theirs)) {\n return { value: ours, from_theirs: false, conflict: false };\n }\n return {\n value: preferred === \"theirs\" ? theirs : ours,\n from_theirs: preferred === \"theirs\",\n conflict: true,\n };\n}\n\nfunction toMetadataRecord(document: ItemDocument): Record<string, unknown> {\n return { ...(document.metadata as unknown as Record<string, unknown>) };\n}\n\nfunction parseItemMergeSide(\n raw: string,\n label: string,\n options: ItemDocumentFormatOptions,\n): ItemDocument {\n try {\n return canonicalDocument(parseItemDocument(raw, options), options);\n } catch (error) {\n throw new PmCliError(\n `Item merge input (${label}) is not a readable item document: ${String(error)}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n}\n\ninterface ItemMetadataMergeAccumulator {\n /** Merged metadata values keyed by canonical field name. */\n merged: Record<string, unknown>;\n /** Scalar fields where both sides diverged from the base. */\n conflictFields: string[];\n /** Scalar fields cleanly selected from the other branch. */\n fieldsFromTheirs: string[];\n /** Collection fields whose final union differs from ours. */\n unionFields: string[];\n}\n\nfunction mergeItemMetadataRecords(\n baseRecord: Record<string, unknown>,\n oursRecord: Record<string, unknown>,\n theirsRecord: Record<string, unknown>,\n preferred: MergePreferredSide,\n): ItemMetadataMergeAccumulator {\n const unionFieldSet = new Set<string>(ITEM_UNION_COLLECTION_FIELDS);\n const latestFieldSet = new Set<string>(ITEM_LATEST_TIMESTAMP_FIELDS);\n const fieldNames = [\n ...new Set([...Object.keys(oursRecord), ...Object.keys(theirsRecord)]),\n ].sort((left, right) => left.localeCompare(right));\n const accumulator: ItemMetadataMergeAccumulator = {\n merged: {},\n conflictFields: [],\n fieldsFromTheirs: [],\n unionFields: [],\n };\n\n for (const field of fieldNames) {\n const baseValue = baseRecord[field];\n const oursValue = oursRecord[field];\n const theirsValue = theirsRecord[field];\n if (unionFieldSet.has(field)) {\n const union = unionCollection(baseValue, oursValue, theirsValue);\n // `fieldNames` is derived from both records' own keys, so a collection\n // reached here is declared by at least one side. Preserve even an empty\n // result (`tags` is required) so serialization never drops it.\n accumulator.merged[field] = union;\n if (!jsonEquals(union, oursValue)) {\n accumulator.unionFields.push(field);\n }\n continue;\n }\n if (latestFieldSet.has(field)) {\n accumulator.merged[field] = latestTimestamp(oursValue, theirsValue);\n continue;\n }\n const outcome = mergeScalarThreeWay(\n baseValue,\n oursValue,\n theirsValue,\n preferred,\n );\n if (outcome.value !== undefined) {\n accumulator.merged[field] = outcome.value;\n }\n if (outcome.conflict) {\n accumulator.conflictFields.push(field);\n } else if (outcome.from_theirs) {\n accumulator.fieldsFromTheirs.push(field);\n }\n }\n return accumulator;\n}\n\n/**\n * Field-aware three-way merge of one tracker item document. Commutative\n * collections (notes, tags, tests, ...) union by element identity so\n * concurrent appends never conflict; `updated_at` resolves to the latest\n * timestamp so disjoint-field edits never collide on the shared freshness\n * scalar; every other metadata field and the body use classic three-way\n * resolution. Unresolvable both-sides-changed conflicts are resolved toward\n * the preferred side but reported in `conflict_fields`, and the merged output\n * is always canonically serialized — count-prefixed TOON array headers are\n * recomputed, so the hand-resolution corruption class (stale `notes[N]`\n * headers) cannot be produced by this merge.\n */\nexport function mergeItemDocuments(\n baseRaw: string,\n oursRaw: string,\n theirsRaw: string,\n options: ItemDocumentFormatOptions & {\n /** Side that wins unresolvable conflicts (default \"ours\"). */\n preferred?: MergePreferredSide;\n } = {},\n): ItemDocumentMergeResult {\n const preferred: MergePreferredSide = options.preferred ?? \"ours\";\n // An empty base means both branches created the file independently\n // (add/add); three-way falls back to treating every differing field as an\n // ours/theirs decision, which the scalar resolver already models.\n const hasBase = baseRaw.trim().length > 0;\n const ours = parseItemMergeSide(oursRaw, \"ours\", options);\n const theirs = parseItemMergeSide(theirsRaw, \"theirs\", options);\n const base = hasBase ? parseItemMergeSide(baseRaw, \"base\", options) : ours;\n\n const baseRecord = hasBase\n ? toMetadataRecord(base)\n : ({} as Record<string, unknown>);\n const oursRecord = toMetadataRecord(ours);\n const theirsRecord = toMetadataRecord(theirs);\n const { merged, conflictFields, fieldsFromTheirs, unionFields } =\n mergeItemMetadataRecords(baseRecord, oursRecord, theirsRecord, preferred);\n\n const bodyOutcome = mergeScalarThreeWay(\n hasBase ? base.body : \"\",\n ours.body,\n theirs.body,\n preferred,\n );\n if (bodyOutcome.conflict) {\n conflictFields.push(\"body\");\n } else if (bodyOutcome.from_theirs) {\n fieldsFromTheirs.push(\"body\");\n }\n\n const mergedRaw = serializeItemDocument(\n {\n metadata: merged as unknown as ItemMetadata,\n body: bodyOutcome.value as string,\n },\n options,\n );\n return {\n merged: mergedRaw,\n conflict_fields: conflictFields,\n fields_from_theirs: fieldsFromTheirs,\n union_fields: unionFields,\n preferred,\n };\n}\n\n/** Documents the JSON document merge result payload exchanged by command, SDK, and package integrations. */\nexport interface JsonDocumentMergeResult {\n /** Serialized merged JSON document (two-space indent, trailing newline — the tracker's canonical config style). */\n merged: string;\n /** Dotted key paths where both sides changed to different values; resolved toward the preferred side. */\n conflict_paths: string[];\n /** Dotted key paths taken from the theirs side by clean three-way resolution. */\n paths_from_theirs: string[];\n /** Which side unresolvable conflicts were resolved toward. */\n preferred: MergePreferredSide;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value)\n );\n}\n\nfunction parseJsonSide(raw: string, label: string): unknown {\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n throw new PmCliError(\n `JSON merge input (${label}) contains unresolved conflict markers at line ${conflictMarker.line}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (raw.trim().length === 0) {\n return undefined;\n }\n try {\n return JSON.parse(raw) as unknown;\n } catch {\n throw new PmCliError(\n `JSON merge input (${label}) is not valid JSON.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n}\n\nfunction mergeJsonValue(\n base: unknown,\n ours: unknown,\n theirs: unknown,\n preferred: MergePreferredSide,\n pathPrefix: string,\n conflictPaths: string[],\n pathsFromTheirs: string[],\n): unknown {\n if (jsonEquals(ours, theirs)) {\n return ours;\n }\n if (isPlainObject(ours) && isPlainObject(theirs)) {\n const baseObject = isPlainObject(base) ? base : {};\n const merged: Record<string, unknown> = {};\n const keys = [\n ...new Set([...Object.keys(ours), ...Object.keys(theirs)]),\n ].sort((left, right) => left.localeCompare(right));\n for (const key of keys) {\n const childPath = pathPrefix.length > 0 ? `${pathPrefix}.${key}` : key;\n const child = mergeJsonKey(\n baseObject,\n ours,\n theirs,\n key,\n preferred,\n childPath,\n conflictPaths,\n pathsFromTheirs,\n );\n if (child !== undefined) {\n merged[key] = child;\n }\n }\n return merged;\n }\n const outcome = mergeScalarThreeWay(base, ours, theirs, preferred);\n if (outcome.conflict) {\n conflictPaths.push(pathPrefix);\n } else if (outcome.from_theirs) {\n pathsFromTheirs.push(pathPrefix);\n }\n return outcome.value;\n}\n\nfunction mergeJsonKey(\n base: Record<string, unknown>,\n ours: Record<string, unknown>,\n theirs: Record<string, unknown>,\n key: string,\n preferred: MergePreferredSide,\n childPath: string,\n conflictPaths: string[],\n pathsFromTheirs: string[],\n): unknown {\n const inOurs = Object.prototype.hasOwnProperty.call(ours, key);\n const inTheirs = Object.prototype.hasOwnProperty.call(theirs, key);\n const inBase = Object.prototype.hasOwnProperty.call(base, key);\n if (inOurs && inTheirs) {\n return mergeJsonValue(\n base[key],\n ours[key],\n theirs[key],\n preferred,\n childPath,\n conflictPaths,\n pathsFromTheirs,\n );\n }\n if (inOurs) {\n // Present only in ours: either ours added it (keep) or theirs deleted it\n // (honor the delete when ours left it untouched from base).\n if (inBase && jsonEquals(base[key], ours[key])) {\n pathsFromTheirs.push(childPath);\n return undefined;\n }\n if (inBase) {\n conflictPaths.push(childPath);\n return preferred === \"theirs\" ? undefined : ours[key];\n }\n return ours[key];\n }\n // Present only in theirs (mirror of the branch above).\n if (inBase && jsonEquals(base[key], theirs[key])) {\n return undefined;\n }\n if (inBase) {\n conflictPaths.push(childPath);\n return preferred === \"theirs\" ? theirs[key] : undefined;\n }\n pathsFromTheirs.push(childPath);\n return theirs[key];\n}\n\n/**\n * Key-level three-way merge for the tracker's single-file JSON configuration\n * artifacts (`settings.json`, `schema/*.json`). Nested objects merge\n * recursively per key so two branches editing disjoint settings never\n * conflict; both-sides-changed leaf values resolve toward the preferred side\n * and are reported in `conflict_paths`. The output is always valid JSON, so a\n * merged configuration can never regress into the silent-defaults fallback\n * that raw conflict markers cause.\n */\nexport function mergeJsonDocuments(\n baseRaw: string,\n oursRaw: string,\n theirsRaw: string,\n options: {\n /** Side that wins unresolvable conflicts (default \"ours\"). */\n preferred?: MergePreferredSide;\n } = {},\n): JsonDocumentMergeResult {\n const preferred: MergePreferredSide = options.preferred ?? \"ours\";\n const base = parseJsonSide(baseRaw, \"base\");\n const ours = parseJsonSide(oursRaw, \"ours\");\n const theirs = parseJsonSide(theirsRaw, \"theirs\");\n const conflictPaths: string[] = [];\n const pathsFromTheirs: string[] = [];\n const merged = mergeJsonValue(\n base,\n ours,\n theirs,\n preferred,\n \"\",\n conflictPaths,\n pathsFromTheirs,\n );\n return {\n merged: `${JSON.stringify(merged ?? null, null, 2)}\\n`,\n conflict_paths: conflictPaths,\n paths_from_theirs: pathsFromTheirs,\n preferred,\n };\n}\n", "/**\n * @module sdk/merge/driver\n *\n * File-level git merge driver runner for tracker artifacts. Git invokes the\n * driver with the base (%O), ours (%A), and theirs (%B) temporary files; the\n * driver writes the merged content back to the ours path and reports whether\n * unresolvable conflicts remain. Conflicted artifacts are still written as\n * parseable documents (resolved toward the preferred side) so a conflicted\n * merge never corrupts tracker storage the way raw conflict markers do.\n */\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getActiveExtensionRegistrations } from \"../../core/extensions/index.js\";\nimport { collectRegisteredItemFieldNames } from \"../../core/extensions/item-fields.js\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport type { ItemFormat, PmSettings } from \"../../types/index.js\";\nimport {\n mergeHistoryStreams,\n mergeItemDocuments,\n mergeJsonDocuments,\n mergeRelationshipEventStreams,\n type MergePreferredSide,\n} from \"./three-way.js\";\n\n/** Supported values accepted by the merge driver artifact contract across CLI, SDK, and MCP surfaces. */\nexport const MERGE_DRIVER_ARTIFACT_VALUES = [\n \"item\",\n \"history\",\n \"relationship\",\n \"json\",\n] as const;\n/** Restricts merge driver artifact values accepted by command, SDK, and storage contracts. */\nexport type MergeDriverArtifact = (typeof MERGE_DRIVER_ARTIFACT_VALUES)[number];\n\n/** Documents the merge driver options payload exchanged by command, SDK, and package integrations. */\nexport interface MergeDriverOptions {\n /** Artifact class being merged: item document, history JSONL stream, relationship event JSONL store, or key-level JSON config. */\n artifact: string;\n /** Path to the common-ancestor version (git %O). */\n basePath: string;\n /** Path to the current-branch version (git %A); also the default output path per the git merge-driver protocol. */\n oursPath: string;\n /** Path to the other-branch version (git %B). */\n theirsPath: string;\n /** Optional explicit output path overriding the git default of writing to the ours path. */\n outputPath?: string;\n /** Original repository-relative item path supplied by Git as `%P`, used to detect item format when temporary side paths lack extensions. */\n itemPath?: string;\n /** Side that wins unresolvable conflicts (default \"ours\"). */\n prefer?: string;\n}\n\n/** Documents the merge driver result payload exchanged by command, SDK, and package integrations. */\nexport interface MergeDriverResult {\n /** Whether the merge completed without unresolvable conflicts. */\n ok: boolean;\n /** Artifact class that was merged. */\n artifact: MergeDriverArtifact;\n /** Path the merged content was written to. */\n output_path: string;\n /** Side unresolvable conflicts were resolved toward. */\n preferred: MergePreferredSide;\n /** Unresolvable conflict labels: metadata field names (item), dotted key paths (json). Empty for history merges. */\n conflicts: string[];\n /** History-merge strategy and entry accounting; present only for the history artifact. */\n history?: {\n strategy: string;\n common_entries: number;\n entries_from_ours: number;\n entries_from_theirs: number;\n entries_total: number;\n reanchored: boolean;\n };\n /** Relationship-event-merge strategy and accounting; present only for the relationship artifact. */\n relationship?: {\n strategy: string;\n common_entries: number;\n entries_from_ours: number;\n entries_from_theirs: number;\n entries_total: number;\n reanchored: boolean;\n };\n /** Item-merge field accounting; present only for the item artifact. */\n item?: {\n fields_from_theirs: string[];\n union_fields: string[];\n };\n /** JSON-merge key accounting; present only for the json artifact. */\n json?: {\n paths_from_theirs: string[];\n };\n /** Guidance for resolving remaining conflicts or verifying the merged workspace. */\n guidance: string[];\n /** ISO 8601 timestamp recording when generated occurred. */\n generated_at: string;\n}\n\nfunction resolveArtifact(value: string): MergeDriverArtifact {\n const normalized = value.trim().toLowerCase();\n if (\n (MERGE_DRIVER_ARTIFACT_VALUES as readonly string[]).includes(normalized)\n ) {\n return normalized as MergeDriverArtifact;\n }\n throw new PmCliError(\n `Unknown merge artifact \"${value}\". Supported values: ${MERGE_DRIVER_ARTIFACT_VALUES.join(\", \")}.`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction resolvePreferredSide(value: string | undefined): MergePreferredSide {\n if (value === undefined) {\n return \"ours\";\n }\n const normalized = value.trim().toLowerCase();\n if (normalized === \"ours\" || normalized === \"theirs\") {\n return normalized;\n }\n throw new PmCliError(\n `Unknown --prefer value \"${value}\". Supported values: ours, theirs.`,\n EXIT_CODE.USAGE,\n );\n}\n\nasync function readSideFile(filePath: string, label: string): Promise<string> {\n try {\n return await readFile(filePath, \"utf8\");\n } catch {\n throw new PmCliError(\n `Cannot read merge ${label} file at ${filePath}.`,\n EXIT_CODE.NOT_FOUND,\n );\n }\n}\n\n/**\n * Load the workspace settings when a tracker is initialized at the resolved pm\n * root, or fall back to format defaults when the driver runs outside a tracker\n * (git can invoke merge drivers before `pm init`, e.g. while rebasing the\n * commit that introduces the tracker).\n */\nasync function loadOptionalSettings(\n global: GlobalOptions,\n): Promise<PmSettings | null> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n return null;\n }\n return readSettings(pmRoot);\n}\n\nfunction itemFormatForPath(\n filePath: string,\n settings: PmSettings | null,\n): ItemFormat {\n if (filePath.endsWith(\".md\")) {\n return \"json_markdown\";\n }\n if (filePath.endsWith(\".toon\")) {\n return \"toon\";\n }\n return settings?.item_format ?? \"toon\";\n}\n\n/**\n * Execute one git merge-driver invocation for a tracker artifact. Reads the\n * three per-side versions, applies the artifact's field-aware merge semantics,\n * writes the merged content (parseable even when conflicted) to the output\n * path, and reports remaining conflicts so the CLI can exit non-zero and let\n * git mark the path unmerged.\n */\nexport async function runMergeDriver(\n options: MergeDriverOptions,\n global: GlobalOptions,\n): Promise<MergeDriverResult> {\n const artifact = resolveArtifact(options.artifact);\n const preferred = resolvePreferredSide(options.prefer);\n const outputPath = path.resolve(options.outputPath ?? options.oursPath);\n const [baseRaw, oursRaw, theirsRaw] = await Promise.all([\n readSideFile(options.basePath, \"base\"),\n readSideFile(options.oursPath, \"ours\"),\n readSideFile(options.theirsPath, \"theirs\"),\n ]);\n\n let merged: string;\n const conflicts: string[] = [];\n const result: Partial<MergeDriverResult> = {};\n if (artifact === \"history\") {\n const historyMerge = mergeHistoryStreams(baseRaw, oursRaw, theirsRaw);\n merged = historyMerge.merged;\n result.history = {\n strategy: historyMerge.strategy,\n common_entries: historyMerge.common_entries,\n entries_from_ours: historyMerge.entries_from_ours,\n entries_from_theirs: historyMerge.entries_from_theirs,\n entries_total: historyMerge.entries_total,\n reanchored: historyMerge.reanchored,\n };\n } else if (artifact === \"relationship\") {\n const relationshipMerge = mergeRelationshipEventStreams(\n baseRaw,\n oursRaw,\n theirsRaw,\n );\n merged = relationshipMerge.merged;\n result.relationship = {\n strategy: relationshipMerge.strategy,\n common_entries: relationshipMerge.common_entries,\n entries_from_ours: relationshipMerge.entries_from_ours,\n entries_from_theirs: relationshipMerge.entries_from_theirs,\n entries_total: relationshipMerge.entries_total,\n reanchored: relationshipMerge.reanchored,\n };\n } else if (artifact === \"item\") {\n const settings = await loadOptionalSettings(global);\n const itemMerge = mergeItemDocuments(baseRaw, oursRaw, theirsRaw, {\n format: itemFormatForPath(options.itemPath ?? outputPath, settings),\n schema: settings?.schema,\n extensionFieldNames: collectRegisteredItemFieldNames(\n getActiveExtensionRegistrations(),\n ),\n preferred,\n });\n merged = itemMerge.merged;\n conflicts.push(...itemMerge.conflict_fields);\n result.item = {\n fields_from_theirs: itemMerge.fields_from_theirs,\n union_fields: itemMerge.union_fields,\n };\n } else {\n const jsonMerge = mergeJsonDocuments(baseRaw, oursRaw, theirsRaw, {\n preferred,\n });\n merged = jsonMerge.merged;\n conflicts.push(...jsonMerge.conflict_paths);\n result.json = {\n paths_from_theirs: jsonMerge.paths_from_theirs,\n };\n }\n\n await writeFile(outputPath, merged, \"utf8\");\n const guidance: string[] = [];\n if (conflicts.length > 0) {\n guidance.push(\n `Both branches changed ${conflicts.join(\", \")}; the ${preferred} value was kept. Review the merged file, re-apply the losing change if needed, then \"git add\" it.`,\n );\n }\n if (artifact === \"history\" && result.history?.reanchored) {\n guidance.push(\n '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.',\n );\n }\n return {\n ok: conflicts.length === 0,\n artifact,\n output_path: outputPath,\n preferred,\n conflicts,\n ...result,\n guidance,\n generated_at: nowIso(),\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,SAAS,kBAAkB,KAAa,OAAa;AACnD,QAAM,iBAAiB,6BAA6B,GAAG;AACvD,MAAI,gBAAgB;AAClB,UAAM,IAAI,WACR,wBAAwB,KAAK,kDAAkD,eAAe,IAAI,yDAClG,UAAU,eAAe;EAE7B;AACA,QAAM,UAA0B,CAAA;AAChC,aAAW,CAAC,OAAO,OAAO,KAAK,IAAI,MAAM,OAAO,EAAE,QAAO,GAAI;AAC3D,UAAM,OAAO,QAAQ,KAAI;AACzB,QAAI,CAAC,MAAM;AACT;IACF;AACA,QAAI;AACF,YAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,UAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,MAAM,QAAQ,MAAM,GAAG;AAC1E,cAAM,IAAI,UAAU,iCAAiC;MAC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,GAAG;AACxB,aAAS,KACP,yBAAyB,UAAU,KAAK,IAAI,CAAC,SAAS,SAAS,mGAAmG;EAEtK;AACA,MAAI,aAAa,aAAa,OAAO,SAAS,YAAY;AACxD,aAAS,KACP,8KAA8K;EAElL;AACA,SAAO;IACL,IAAI,UAAU,WAAW;IACzB;IACA,aAAa;IACb;IACA;IACA,GAAG;IACH;IACA,cAAc,OAAM;;AAExB;A",
6
- "names": ["global"]
7
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../../core/item/parse.ts"],"sourcesContent":["/**\n * @module core/item/parse\n *\n * Defines item parsing, formatting, and lifecycle helpers for Parse.\n */\nimport { PmCliError } from \"../shared/errors.js\";\nimport { EXIT_CODE } from \"../shared/constants.js\";\n\nconst STDIN_TOKEN = \"-\";\nconst CONTINUABLE_VALUE_KEYS = new Set([\n \"actual_result\",\n \"body\",\n \"cmd\",\n \"command\",\n \"customer_impact\",\n \"description\",\n \"environment\",\n \"expected_result\",\n \"impact\",\n \"location\",\n \"message\",\n \"note\",\n \"outcome\",\n \"repro_steps\",\n \"resolution\",\n \"text\",\n \"title\",\n \"unblock_note\",\n \"value\",\n \"why_now\",\n]);\n\n/** Implements parse tags for the public runtime surface of this module. */\nexport function parseTags(raw: string): string[] {\n const trimmed = raw.trim();\n if (trimmed === \"\") {\n return [];\n }\n const source = coerceJsonTagArray(trimmed) ?? trimmed;\n const tags = source\n .split(\",\")\n .map((tag) => tag.trim())\n .filter(Boolean)\n .map((tag) => tag.toLowerCase());\n return Array.from(new Set(tags)).sort((a, b) => a.localeCompare(b));\n}\n\n/** Merge repeated `--add-tags` / `--remove-tags` values into a single normalized tag list. Each entry can itself be CSV or a JSON array, mirroring the format accepted by `--tags`. Returns a deterministically sorted, deduped list. */\nexport function collectTagFlagValues(\n values: readonly string[] | undefined,\n): string[] {\n if (!Array.isArray(values) || values.length === 0) {\n return [];\n }\n const collected: string[] = [];\n for (const raw of values) {\n if (typeof raw !== \"string\") {\n continue;\n }\n for (const tag of parseTags(raw)) {\n collected.push(tag);\n }\n }\n return Array.from(new Set(collected)).sort((a, b) => a.localeCompare(b));\n}\n\n/** Normalize a base tag list to the canonical form pm stores: trimmed, lowercased, non-empty. Existing item-metadata tags are almost always already canonical (parseTags lowercases on write), but legacy or hand-edited `.toon` files can carry mixed-case entries — normalizing here keeps additive and subtractive mutations case-insensitive (so `--add-tags beta` dedupes against an existing `Beta`, and `--remove-tags alpha` removes an existing `Alpha`). */\nfunction normalizeBaseTags(baseTags: readonly string[]): string[] {\n // Defensive: item-metadata parsed from corrupted/hand-edited `.toon` (or an\n // external SDK caller) could pass a non-array or non-string entries despite\n // the `string[]` type — guard the array and skip non-strings rather than\n // throwing on `.filter`/`.trim()`.\n if (!Array.isArray(baseTags)) {\n return [];\n }\n return baseTags\n .filter((tag): tag is string => typeof tag === \"string\")\n .map((tag) => tag.trim().toLowerCase())\n .filter(Boolean);\n}\n\n/** Split a stored `acceptance_criteria` value into its individual criteria. Criteria are stored as one string joined with `\"; \"` (repeated `--ac` values accumulate that way), so the semicolon is the criterion boundary and cannot appear inside one criterion; entries are trimmed and blanks dropped. Non-string/absent values yield an empty list. */\nexport function splitAcceptanceCriteria(value: unknown): string[] {\n if (typeof value !== \"string\") {\n return [];\n }\n return value\n .split(\";\")\n .map((criterion) => criterion.trim())\n .filter(Boolean);\n}\n\n/** Apply additive/subtractive acceptance-criteria mutations to a base criteria list. Used by `pm update --add-ac/--remove-ac` so individual semicolon-free criteria can be edited without replacing the whole `acceptance_criteria` value (tag-API parity; disjoint additions merge cleanly across branches). Additions append in argv order and dedupe on exact trimmed text; removals match exact trimmed text and report unmatched selectors so a typo never becomes a silent no-op. */\nexport function applyAcceptanceCriteriaMutations(\n baseCriteria: readonly string[],\n add: readonly string[] | undefined,\n remove: readonly string[] | undefined,\n): { criteria: string[]; unmatchedRemovals: string[] } {\n const criteria = baseCriteria\n .map((criterion) => criterion.trim())\n .filter(Boolean);\n for (const raw of add ?? []) {\n const criterion = raw.trim();\n if (criterion.includes(\";\")) {\n throw new PmCliError(\n 'Acceptance criteria added with --add-ac cannot contain \";\" because semicolons delimit stored criteria',\n EXIT_CODE.USAGE,\n {\n code: \"acceptance_criteria_semicolon_forbidden\",\n required: \"Pass one semicolon-free criterion per --add-ac value\",\n why: \"A semicolon inside one criterion would be re-read as multiple criteria\",\n nextSteps: [\n \"Split the text into repeated --add-ac values, or replace the semicolon with punctuation that is not the storage delimiter\",\n ],\n },\n );\n }\n if (criterion.length > 0 && !criteria.includes(criterion)) {\n criteria.push(criterion);\n }\n }\n const unmatchedRemovals: string[] = [];\n let remaining = criteria;\n for (const raw of remove ?? []) {\n const criterion = raw.trim();\n if (criterion.length === 0) {\n continue;\n }\n if (!remaining.includes(criterion)) {\n unmatchedRemovals.push(criterion);\n continue;\n }\n remaining = remaining.filter((entry) => entry !== criterion);\n }\n return { criteria: remaining, unmatchedRemovals };\n}\n\n/** Apply an additive tag mutation to a base tag list. Used by `pm create` and `pm update` so `--add-tags` extends `--tags` (or the existing tags) without replacing them. Output is sorted + deduped lowercase, matching `parseTags`. */\nexport function mergeAdditiveTags(\n baseTags: readonly string[],\n add: readonly string[] | undefined,\n): string[] {\n const normalizedBase = normalizeBaseTags(baseTags);\n if (!add || add.length === 0) {\n return Array.from(new Set(normalizedBase)).sort((a, b) =>\n a.localeCompare(b),\n );\n }\n const merged = new Set<string>(normalizedBase);\n for (const tag of collectTagFlagValues(add)) {\n merged.add(tag);\n }\n return Array.from(merged).sort((a, b) => a.localeCompare(b));\n}\n\n/** Apply a subtractive tag mutation to a base tag list. Used by `pm update` so `--remove-tags x,y` prunes those entries without rewriting the full set. Removal is case-insensitive: both the base list and the removal selectors are normalized to canonical lowercase before matching. */\nexport function applyTagRemovals(\n baseTags: readonly string[],\n remove: readonly string[] | undefined,\n): string[] {\n const normalizedBase = Array.from(new Set(normalizeBaseTags(baseTags))).sort(\n (a, b) => a.localeCompare(b),\n );\n if (!remove || remove.length === 0) {\n return normalizedBase;\n }\n const removeSet = new Set(collectTagFlagValues(remove));\n if (removeSet.size === 0) {\n return normalizedBase;\n }\n return normalizedBase.filter((tag) => !removeSet.has(tag));\n}\n\n// Agents and MCP callers frequently pass --tags as a JSON array (e.g.\n// `--tags '[\"a\",\"b\"]'`). The MCP server normalizes that upstream, but direct\n// CLI invocations used to write the raw bracket string into item metadata,\n// silently corrupting tags. Accept JSON arrays of primitives transparently.\nfunction coerceJsonTagArray(trimmed: string): string | null {\n if (!trimmed.startsWith(\"[\")) {\n return null;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(trimmed);\n } catch {\n return null;\n }\n const parsedArray = parsed as unknown[];\n return parsedArray\n .map((entry) =>\n typeof entry === \"string\" ||\n typeof entry === \"number\" ||\n typeof entry === \"boolean\"\n ? String(entry).replace(/,/g, \" \")\n : \"\",\n )\n .filter((entry) => entry.length > 0)\n .join(\",\");\n}\n\nfunction normalizeLineEndings(value: string): string {\n return value.replace(/\\r\\n/g, \"\\n\");\n}\n\nfunction stripCodeFenceEnvelope(value: string): string {\n const normalized = normalizeLineEndings(value).trim();\n if (!normalized.startsWith(\"```\")) {\n return value;\n }\n const lines = normalized.split(\"\\n\");\n if (lines.length < 2) {\n return value;\n }\n if (lines.at(-1)?.trim() !== \"```\") {\n return value;\n }\n return lines.slice(1, -1).join(\"\\n\");\n}\n\nfunction splitCsvSegments(raw: string): string[] {\n const segments: string[] = [];\n let current = \"\";\n let inQuotes = false;\n let escaped = false;\n\n for (const char of raw) {\n if (escaped) {\n current += char;\n escaped = false;\n continue;\n }\n if (char === \"\\\\\") {\n current += char;\n escaped = true;\n continue;\n }\n if (char === '\"') {\n inQuotes = !inQuotes;\n current += char;\n continue;\n }\n if (char === \",\" && !inQuotes) {\n segments.push(current.trim());\n current = \"\";\n continue;\n }\n current += char;\n }\n if (current.trim()) {\n segments.push(current.trim());\n }\n return segments;\n}\n\nfunction unquoteValue(value: string): string {\n const trimmed = value.trim();\n if (trimmed.startsWith('\"') && trimmed.endsWith('\"')) {\n return trimmed.slice(1, -1).replace(/\\\\\"/g, '\"');\n }\n return value;\n}\n\nfunction findKeyValueDelimiter(segment: string): number {\n const equalsIndex = segment.indexOf(\"=\");\n const colonIndex = segment.indexOf(\":\");\n const hasEquals = equalsIndex > 0;\n const hasColon = colonIndex > 0;\n if (hasEquals && hasColon) {\n return Math.min(equalsIndex, colonIndex);\n }\n if (hasEquals) {\n return equalsIndex;\n }\n if (hasColon) {\n return colonIndex;\n }\n return -1;\n}\n\nfunction buildOptionSpecificKvGuidance(\n raw: string,\n optionName: string,\n): string {\n if (optionName === \"--add\" || optionName === \"--add-glob\") {\n const looksLikePath =\n /[./\\\\]/.test(raw) || /\\.[a-z]{1,6}$/i.test(raw.trim());\n if (looksLikePath) {\n return \"For file/doc paths use: path=<file-path>[,scope=project|global]. The scope field is optional and defaults to project (example: path=src/api.ts or path=README.md,scope=project). \";\n }\n }\n if (optionName !== \"--event\") {\n return \"\";\n }\n const lowered = raw.toLowerCase();\n const recurrenceHint =\n lowered.includes(\"recur_\") || lowered.includes(\"recurrence\")\n ? ' Recurrence list values must stay in one field and use \"|\" delimiters (for example recur_by_weekday=mon|wed or recur_by_month_day=1|15).'\n : \"\";\n const weekdayAliasHint = lowered.includes(\"recur_byweekday\")\n ? \" Use recur_by_weekday (with underscores) for weekday recurrence filters.\"\n : \"\";\n return `${recurrenceHint}${weekdayAliasHint}`;\n}\n\nfunction buildInvalidKvMessage(raw: string, optionName: string): string {\n const condensed = raw.replaceAll(/\\s+/g, \" \").trim();\n const preview =\n condensed.length > 160 ? `${condensed.slice(0, 157)}...` : condensed;\n const optionSpecificGuidance = buildOptionSpecificKvGuidance(raw, optionName);\n return (\n `Invalid ${optionName} value \"${preview}\". Expected key=value entries separated by commas. ` +\n optionSpecificGuidance +\n 'Also accepts markdown-style key/value lines (for example \"- path: README.md\"). ' +\n `Use ${optionName} ${STDIN_TOKEN} to read piped stdin input.`\n );\n}\n\nfunction parseMarkdownKeyValueLines(\n raw: string,\n): Record<string, string> | null {\n const normalized = stripCodeFenceEnvelope(raw).trim();\n if (normalized.length === 0) {\n return null;\n }\n if (\n !normalized.includes(\"\\n\") &&\n !normalized.startsWith(\"-\") &&\n !normalized.startsWith(\"*\") &&\n !normalized.startsWith(\"+\")\n ) {\n return null;\n }\n\n const result: Record<string, string> = {};\n let activeKey: string | undefined;\n const lines = normalizeLineEndings(normalized)\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line.length > 0);\n\n for (const line of lines) {\n const match = line.match(/^(?:[-*+]\\s+)?([a-zA-Z0-9_.-]+)\\s*(=|:)\\s*(.*)$/);\n if (match) {\n const key = match[1].trim();\n result[key] = unquoteValue(match[3].trim());\n activeKey = key;\n continue;\n }\n if (activeKey && CONTINUABLE_VALUE_KEYS.has(activeKey.toLowerCase())) {\n result[activeKey] = `${result[activeKey]}\\n${line}`;\n continue;\n }\n return null;\n }\n\n return result;\n}\n\n/** Implements parse csv kv for the public runtime surface of this module. */\nexport function parseCsvKv(\n raw: string,\n optionName: string,\n): Record<string, string> {\n const trimmed = stripCodeFenceEnvelope(raw).trim();\n if (!trimmed) {\n throw new PmCliError(`${optionName} cannot be empty`, EXIT_CODE.USAGE);\n }\n\n const markdownStyle = parseMarkdownKeyValueLines(trimmed);\n if (markdownStyle) {\n return markdownStyle;\n }\n\n const result: Record<string, string> = {};\n let activeKey: string | undefined;\n const segments = splitCsvSegments(trimmed);\n\n for (const segment of segments) {\n const delimiterIndex = findKeyValueDelimiter(segment);\n if (delimiterIndex > 0) {\n const key = segment.slice(0, delimiterIndex).trim();\n const value = unquoteValue(segment.slice(delimiterIndex + 1).trim());\n result[key] = value;\n activeKey = key;\n continue;\n }\n if (activeKey && CONTINUABLE_VALUE_KEYS.has(activeKey.toLowerCase())) {\n result[activeKey] = `${result[activeKey]},${segment.trim()}`;\n continue;\n }\n throw new PmCliError(\n buildInvalidKvMessage(raw, optionName),\n EXIT_CODE.USAGE,\n );\n }\n\n return result;\n}\n\nconst WINDOWS_ABSOLUTE_PATH_PATTERN = /^[A-Za-z]:[\\\\/]/;\nconst GENERIC_LEADING_KV_KEY_PATTERN =\n /^(?:[-*+]\\s+)?[A-Za-z_][A-Za-z0-9_.-]*\\s*=/;\n\n/**\n * Detect a CSV/markdown entry that opens with a generic `key=` token even when\n * that key is unknown (e.g. a typo like `lable=main,path=README.md`). Callers\n * combine this with their known-key prefix check so a first-key typo is routed\n * through structured parsing and rejected by {@link assertNoUnknownCsvKeys}\n * (GH-258) instead of being silently swallowed as a bare path/value.\n *\n * Windows absolute paths (`C:\\…`) are excluded so a drive-lettered bare path is\n * never misread as a `C=…` key/value entry.\n */\nexport function looksLikeGenericKeyValueEntry(raw: string): boolean {\n const trimmed = raw.trim();\n if (WINDOWS_ABSOLUTE_PATH_PATTERN.test(trimmed)) {\n return false;\n }\n return GENERIC_LEADING_KV_KEY_PATTERN.test(trimmed);\n}\n\n/**\n * Reject any key in a parsed CSV/markdown key/value map that is not part of the\n * caller's allowed-key contract, mirroring the strict `test --add` behavior\n * (see linked-test-parsers). This closes the cross-command consistency defect\n * (GH-258) where structured link/metadata parsers silently DROPPED typoed keys\n * (e.g. `lable=` instead of `label=`), storing data the author never intended.\n *\n * Comparison is case-insensitive so a key the downstream reader would accept\n * (e.g. `Path`) is never falsely rejected; the emitted \"Allowed keys\" list\n * preserves the canonical casing the caller passes in. Recognized keys are then\n * normalized in-place to their lowercase canonical form so downstream readers\n * (`kv.path`, `kv.id`, `kv.at`, …) see the value even when the input used mixed\n * casing — otherwise `Path=README.md` would pass validation yet read back as an\n * undefined `path` and surface a confusing \"requires path\" error. A key that\n * collides with another after normalization (e.g. `path=a,Path=b`) is rejected.\n *\n * Parsers with an intentional plaintext fallback (`--comment`/`--note`/\n * `--learning`, annotation `--add`) deliberately do NOT call this — there an\n * unrecognized key means \"treat the whole entry as plaintext\", not an error.\n */\nexport function assertNoUnknownCsvKeys(\n kv: Record<string, string>,\n optionName: string,\n allowedKeys: readonly string[],\n): void {\n const allowed = new Set(allowedKeys.map((key) => key.toLowerCase()));\n const unknownKeys = Object.keys(kv).filter(\n (key) => !allowed.has(key.toLowerCase()),\n );\n if (unknownKeys.length > 0) {\n throw new PmCliError(\n `${optionName} does not recognize key${unknownKeys.length > 1 ? \"s\" : \"\"} ${unknownKeys\n .map((key) => `\"${key}\"`)\n .join(\", \")}. Allowed keys: ${allowedKeys.join(\", \")}.`,\n EXIT_CODE.USAGE,\n );\n }\n for (const key of Object.keys(kv)) {\n const normalizedKey = key.toLowerCase();\n if (normalizedKey === key) {\n continue;\n }\n if (Object.hasOwn(kv, normalizedKey)) {\n throw new PmCliError(\n `${optionName} provides key \"${key}\" more than once after case normalization.`,\n EXIT_CODE.USAGE,\n );\n }\n kv[normalizedKey] = kv[key];\n delete kv[key];\n }\n}\n\nasync function readStdinText(optionName: string): Promise<string> {\n if (process.stdin.isTTY === true) {\n throw new PmCliError(\n `${optionName} value \"${STDIN_TOKEN}\" requires piped stdin input. Pipe content into the command, or end manual stdin with Ctrl+D (Unix/macOS) or Ctrl+Z then Enter (Windows).`,\n EXIT_CODE.USAGE,\n );\n }\n process.stdin.setEncoding(\"utf8\");\n return await new Promise<string>((resolve, reject) => {\n let input = \"\";\n process.stdin.on(\"data\", (chunk: string) => {\n input += chunk;\n });\n process.stdin.on(\"end\", () => {\n resolve(normalizeLineEndings(input));\n });\n process.stdin.on(\"error\", (error) => {\n reject(error);\n });\n });\n}\n\n/** Documents the stdin token resolver payload exchanged by command, SDK, and package integrations. */\nexport interface StdinTokenResolver {\n /** Value that configures or reports resolve value for this contract. */\n resolveValue(\n value: string | undefined,\n optionName: string,\n ): Promise<string | undefined>;\n /** Value that configures or reports resolve list for this contract. */\n resolveList(\n values: string[] | undefined,\n optionName: string,\n ): Promise<string[] | undefined>;\n}\n\n/** Implements create stdin token resolver for the public runtime surface of this module. */\nexport function createStdinTokenResolver(): StdinTokenResolver {\n let stdinValuePromise: Promise<string> | undefined;\n let stdinConsumerOption: string | undefined;\n\n const consumeStdin = async (optionName: string): Promise<string> => {\n if (stdinConsumerOption && stdinConsumerOption !== optionName) {\n throw new PmCliError(\n `Only one option may use \"${STDIN_TOKEN}\" stdin token per command invocation. Already used by ${stdinConsumerOption}.`,\n EXIT_CODE.USAGE,\n );\n }\n stdinConsumerOption = optionName;\n if (!stdinValuePromise) {\n stdinValuePromise = readStdinText(optionName);\n }\n return await stdinValuePromise;\n };\n\n const resolveValue = async (\n value: string | undefined,\n optionName: string,\n ): Promise<string | undefined> => {\n if (value === undefined) {\n return undefined;\n }\n if (value.trim() !== STDIN_TOKEN) {\n return value;\n }\n return await consumeStdin(optionName);\n };\n\n const resolveList = async (\n values: string[] | undefined,\n optionName: string,\n ): Promise<string[] | undefined> => {\n if (!values) {\n return undefined;\n }\n const tokenIndexes = values\n .map((entry, index) => (entry.trim() === STDIN_TOKEN ? index : -1))\n .filter((index) => index >= 0);\n if (tokenIndexes.length === 0) {\n return values;\n }\n if (tokenIndexes.length > 1) {\n throw new PmCliError(\n `${optionName} accepts \"${STDIN_TOKEN}\" stdin token at most once per command invocation`,\n EXIT_CODE.USAGE,\n );\n }\n const stdinValue = await consumeStdin(optionName);\n const next = [...values];\n next[tokenIndexes[0]] = stdinValue;\n return next;\n };\n\n return {\n resolveValue,\n resolveList,\n };\n}\n\n/** Implements parse optional number for the public runtime surface of this module. */\nexport function parseOptionalNumber(raw: string, optionName: string): number {\n const value = Number(raw);\n if (!Number.isFinite(value)) {\n throw new PmCliError(\n `Invalid ${optionName} value \"${raw}\"`,\n EXIT_CODE.USAGE,\n );\n }\n return value;\n}\n\n/** Parse a non-negative integer option such as an item duration estimate. */\nexport function parseOptionalNonNegativeInteger(\n raw: string,\n optionName: string,\n): number {\n const trimmed = raw.trim();\n const value = Number(trimmed);\n if (trimmed === \"\" || !Number.isInteger(value) || value < 0) {\n throw new PmCliError(\n `Invalid ${optionName} value \"${raw}\". Expected a non-negative integer.`,\n EXIT_CODE.USAGE,\n );\n }\n return value;\n}\n\n/** Public contract for test only, shared by SDK and presentation-layer consumers. */\nexport const _testOnly = {\n coerceJsonTagArray,\n stripCodeFenceEnvelope,\n parseMarkdownKeyValueLines,\n};\n"],"names":[],"mappings":";;;;;;;;AAQA,IAAM,cAAc;AACpB,IAAM,yBAAyB,oBAAI,IAAI;EACrC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;AAGK,SAAU,UAAU,KAAW;AACnC,QAAM,UAAU,IAAI,KAAI;AACxB,MAAI,YAAY,IAAI;AAClB,WAAO,CAAA;EACT;AACA,QAAM,SAAS,mBAAmB,OAAO,KAAK;AAC9C,QAAM,OAAO,OACV,MAAM,GAAG,EACT,IAAI,CAAC,QAAQ,IAAI,KAAI,CAAE,EACvB,OAAO,OAAO,EACd,IAAI,CAAC,QAAQ,IAAI,YAAW,CAAE;AACjC,SAAO,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;AACpE;AAGM,SAAU,qBACd,QAAqC;AAErC,MAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,GAAG;AACjD,WAAO,CAAA;EACT;AACA,QAAM,YAAsB,CAAA;AAC5B,aAAW,OAAO,QAAQ;AACxB,QAAI,OAAO,QAAQ,UAAU;AAC3B;IACF;AACA,eAAW,OAAO,UAAU,GAAG,GAAG;AAChC,gBAAU,KAAK,GAAG;IACpB;EACF;AACA,SAAO,MAAM,KAAK,IAAI,IAAI,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;AACzE;AAGA,SAAS,kBAAkB,UAA2B;AAKpD,MAAI,CAAC,MAAM,QAAQ,QAAQ,GAAG;AAC5B,WAAO,CAAA;EACT;AACA,SAAO,SACJ,OAAO,CAAC,QAAuB,OAAO,QAAQ,QAAQ,EACtD,IAAI,CAAC,QAAQ,IAAI,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