@unbrained/pm-cli 2026.7.14 → 2026.7.16

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 (708) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +54 -0
  3. package/README.md +14 -11
  4. package/dist/cli/argv-utils.d.ts +1 -4
  5. package/dist/cli/argv-utils.js +3 -13
  6. package/dist/cli/argv-utils.js.map +1 -1
  7. package/dist/cli/bootstrap-args.d.ts +6 -4
  8. package/dist/cli/bootstrap-args.js +51 -16
  9. package/dist/cli/bootstrap-args.js.map +1 -1
  10. package/dist/cli/bundle-integrity.d.ts +49 -0
  11. package/dist/cli/bundle-integrity.js +111 -0
  12. package/dist/cli/bundle-integrity.js.map +1 -0
  13. package/dist/cli/commands/completion.js +7 -2
  14. package/dist/cli/commands/completion.js.map +1 -1
  15. package/dist/cli/commands/config.d.ts +6 -163
  16. package/dist/cli/commands/config.js +4 -1133
  17. package/dist/cli/commands/config.js.map +1 -1
  18. package/dist/cli/commands/context.d.ts +2 -4
  19. package/dist/cli/commands/context.js +10 -85
  20. package/dist/cli/commands/context.js.map +1 -1
  21. package/dist/cli/commands/create.d.ts +1 -0
  22. package/dist/cli/commands/create.js +3 -2
  23. package/dist/cli/commands/create.js.map +1 -1
  24. package/dist/cli/commands/extension/describe.d.ts +2 -91
  25. package/dist/cli/commands/extension/describe.js +4 -142
  26. package/dist/cli/commands/extension/describe.js.map +1 -1
  27. package/dist/cli/commands/extension/scaffold.d.ts +2 -36
  28. package/dist/cli/commands/extension/scaffold.js +4 -2435
  29. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  30. package/dist/cli/commands/extension/shared.d.ts +2 -28
  31. package/dist/cli/commands/extension/shared.js +4 -130
  32. package/dist/cli/commands/extension/shared.js.map +1 -1
  33. package/dist/cli/commands/extension.d.ts +3 -400
  34. package/dist/cli/commands/extension.js +4 -2183
  35. package/dist/cli/commands/extension.js.map +1 -1
  36. package/dist/cli/commands/gc.d.ts +6 -56
  37. package/dist/cli/commands/gc.js +4 -270
  38. package/dist/cli/commands/gc.js.map +1 -1
  39. package/dist/cli/commands/get.d.ts +18 -5
  40. package/dist/cli/commands/get.js +117 -58
  41. package/dist/cli/commands/get.js.map +1 -1
  42. package/dist/cli/commands/health.d.ts +6 -184
  43. package/dist/cli/commands/health.js +4 -1747
  44. package/dist/cli/commands/health.js.map +1 -1
  45. package/dist/cli/commands/history-compact.d.ts +4 -139
  46. package/dist/cli/commands/history-compact.js +5 -510
  47. package/dist/cli/commands/history-compact.js.map +1 -1
  48. package/dist/cli/commands/history-redact.d.ts +8 -120
  49. package/dist/cli/commands/history-redact.js +6 -581
  50. package/dist/cli/commands/history-redact.js.map +1 -1
  51. package/dist/cli/commands/history-repair.d.ts +7 -89
  52. package/dist/cli/commands/history-repair.js +5 -257
  53. package/dist/cli/commands/history-repair.js.map +1 -1
  54. package/dist/cli/commands/history.d.ts +1 -2
  55. package/dist/cli/commands/history.js +6 -48
  56. package/dist/cli/commands/history.js.map +1 -1
  57. package/dist/cli/commands/index.d.ts +1 -0
  58. package/dist/cli/commands/index.js +3 -2
  59. package/dist/cli/commands/index.js.map +1 -1
  60. package/dist/cli/commands/init-agent-guidance.d.ts +6 -113
  61. package/dist/cli/commands/init-agent-guidance.js +4 -431
  62. package/dist/cli/commands/init-agent-guidance.js.map +1 -1
  63. package/dist/cli/commands/init.d.ts +6 -181
  64. package/dist/cli/commands/init.js +4 -690
  65. package/dist/cli/commands/init.js.map +1 -1
  66. package/dist/cli/commands/next.js +3 -3
  67. package/dist/cli/commands/next.js.map +1 -1
  68. package/dist/cli/commands/profile.d.ts +4 -174
  69. package/dist/cli/commands/profile.js +4 -425
  70. package/dist/cli/commands/profile.js.map +1 -1
  71. package/dist/cli/commands/restore.d.ts +4 -19
  72. package/dist/cli/commands/restore.js +9 -158
  73. package/dist/cli/commands/restore.js.map +1 -1
  74. package/dist/cli/commands/schema.d.ts +7 -507
  75. package/dist/cli/commands/schema.js +5 -1254
  76. package/dist/cli/commands/schema.js.map +1 -1
  77. package/dist/cli/commands/test.d.ts +2 -4
  78. package/dist/cli/commands/test.js +7 -97
  79. package/dist/cli/commands/test.js.map +1 -1
  80. package/dist/cli/commands/validate.d.ts +9 -249
  81. package/dist/cli/commands/validate.js +9 -2150
  82. package/dist/cli/commands/validate.js.map +1 -1
  83. package/dist/cli/extension-command-help.js +18 -4
  84. package/dist/cli/extension-command-help.js.map +1 -1
  85. package/dist/cli/extension-command-options.js +3 -3
  86. package/dist/cli/extension-command-options.js.map +1 -1
  87. package/dist/cli/help-content.js +7 -3
  88. package/dist/cli/help-content.js.map +1 -1
  89. package/dist/cli/main.js +20 -30
  90. package/dist/cli/main.js.map +1 -1
  91. package/dist/cli/register-list-query.js +4 -2
  92. package/dist/cli/register-list-query.js.map +1 -1
  93. package/dist/cli/register-mutation.js +11 -3
  94. package/dist/cli/register-mutation.js.map +1 -1
  95. package/dist/cli/register-setup.js +4 -2
  96. package/dist/cli/register-setup.js.map +1 -1
  97. package/dist/cli/registration-helpers.js +3 -2
  98. package/dist/cli/registration-helpers.js.map +1 -1
  99. package/dist/cli-bundle/bundle-manifest.json +782 -0
  100. package/dist/cli-bundle/chunks/{append-PVZJDM6J.js → append-OJQFUQ4T.js} +5 -5
  101. package/dist/cli-bundle/chunks/append-UZVHUO74.js +11 -0
  102. package/dist/cli-bundle/chunks/{chunk-MQZ3PLCF.js → chunk-2IFFUZLC.js} +2 -2
  103. package/dist/cli-bundle/chunks/{chunk-P6MYFH6K.js → chunk-2JKGO6QX.js} +4 -4
  104. package/dist/cli-bundle/chunks/{chunk-X3GYR4P2.js → chunk-2NCIPMQP.js} +2 -2
  105. package/dist/cli-bundle/chunks/{chunk-Q7E6OYZK.js → chunk-2VPAVL7O.js} +2 -2
  106. package/dist/cli-bundle/chunks/{chunk-DRNJPEPQ.js → chunk-2WSE6PO2.js} +4 -4
  107. package/dist/cli-bundle/chunks/{chunk-FDSBDNYE.js → chunk-34L5OT3Y.js} +2 -2
  108. package/dist/cli-bundle/chunks/{chunk-TH7U4KLY.js → chunk-3AUGG2DP.js} +3 -3
  109. package/dist/cli-bundle/chunks/{chunk-NKW36AMT.js → chunk-3CLU2XZO.js} +4 -4
  110. package/dist/cli-bundle/chunks/{chunk-N3CMP4NI.js → chunk-3S5QVM5H.js} +43 -7
  111. package/dist/cli-bundle/chunks/chunk-3S5QVM5H.js.map +1 -0
  112. package/dist/cli-bundle/chunks/chunk-3U7ZR6M4.js +64 -0
  113. package/dist/cli-bundle/chunks/chunk-3U7ZR6M4.js.map +7 -0
  114. package/dist/cli-bundle/chunks/{chunk-ABRCOSDC.js → chunk-3WM75PWC.js} +3 -3
  115. package/dist/cli-bundle/chunks/chunk-4223PVZT.js +121 -0
  116. package/dist/cli-bundle/chunks/chunk-4223PVZT.js.map +7 -0
  117. package/dist/cli-bundle/chunks/{chunk-5URI7TPJ.js → chunk-4XQ3BDV4.js} +281 -164
  118. package/dist/cli-bundle/chunks/chunk-4XQ3BDV4.js.map +7 -0
  119. package/dist/cli-bundle/chunks/{chunk-X6BVXQ52.js → chunk-5JLUII3O.js} +13 -13
  120. package/dist/cli-bundle/chunks/{chunk-MKL4CP2I.js → chunk-5ZSLZLDN.js} +631 -246
  121. package/dist/cli-bundle/chunks/chunk-5ZSLZLDN.js.map +1 -0
  122. package/dist/cli-bundle/chunks/{chunk-Q37E63AM.js → chunk-6CFNAVTF.js} +21 -141
  123. package/dist/cli-bundle/chunks/chunk-6CFNAVTF.js.map +7 -0
  124. package/dist/cli-bundle/chunks/{chunk-3TL7WOEF.js → chunk-6N2VXVTQ.js} +2 -2
  125. package/dist/cli-bundle/chunks/{chunk-ERL2YFJ2.js → chunk-6S3YSUYG.js} +3 -3
  126. package/dist/cli-bundle/chunks/{chunk-ZUKSZVBW.js → chunk-7B67ZL4N.js} +8 -7
  127. package/dist/cli-bundle/chunks/chunk-7B67ZL4N.js.map +7 -0
  128. package/dist/cli-bundle/chunks/{chunk-IA3YFTXT.js → chunk-7PIWCHTW.js} +11 -13
  129. package/dist/cli-bundle/chunks/chunk-7PIWCHTW.js.map +1 -0
  130. package/dist/cli-bundle/chunks/{chunk-BPD26E3P.js → chunk-7Z4LKRS4.js} +291 -81
  131. package/dist/cli-bundle/chunks/chunk-7Z4LKRS4.js.map +1 -0
  132. package/dist/cli-bundle/chunks/{chunk-IFZA4VB5.js → chunk-AHVTB5I5.js} +4 -4
  133. package/dist/cli-bundle/chunks/{chunk-DO5RGJXT.js → chunk-APRVSW2O.js} +3 -3
  134. package/dist/cli-bundle/chunks/{chunk-NAQYVWSQ.js → chunk-B7PE22W6.js} +4 -4
  135. package/dist/cli-bundle/chunks/{chunk-MD6ULIPJ.js → chunk-BCOFWYW4.js} +3 -3
  136. package/dist/cli-bundle/chunks/{chunk-KADLSPIU.js → chunk-BEP7WJA2.js} +4 -4
  137. package/dist/cli-bundle/chunks/chunk-BKVG6XOA.js +1114 -0
  138. package/dist/cli-bundle/chunks/chunk-BKVG6XOA.js.map +7 -0
  139. package/dist/cli-bundle/chunks/{chunk-AFWZRL7M.js → chunk-BSEQUTQP.js} +2 -2
  140. package/dist/cli-bundle/chunks/{chunk-AFWZRL7M.js.map → chunk-BSEQUTQP.js.map} +2 -2
  141. package/dist/cli-bundle/chunks/{chunk-OBDLEQG5.js → chunk-CRVF2JDM.js} +10 -10
  142. package/dist/cli-bundle/chunks/{chunk-FJZDA6MS.js → chunk-DM4H7FP4.js} +3 -3
  143. package/dist/cli-bundle/chunks/chunk-DUT67M43.js +5 -0
  144. package/dist/cli-bundle/chunks/{chunk-44LNIULG.js → chunk-DYH63FX7.js} +4 -4
  145. package/dist/cli-bundle/chunks/{chunk-LWTIRS3Y.js → chunk-E2OJMKML.js} +306 -82
  146. package/dist/cli-bundle/chunks/chunk-E2OJMKML.js.map +7 -0
  147. package/dist/cli-bundle/chunks/{chunk-HAMLIWAF.js → chunk-EAB64KLB.js} +4 -4
  148. package/dist/cli-bundle/chunks/{chunk-CIOZ376P.js → chunk-EACOH7AU.js} +10 -10
  149. package/dist/cli-bundle/chunks/{chunk-HL7V2PHX.js → chunk-EH2OPHBI.js} +10 -10
  150. package/dist/cli-bundle/chunks/{chunk-HL7V2PHX.js.map → chunk-EH2OPHBI.js.map} +1 -1
  151. package/dist/cli-bundle/chunks/{chunk-QK2ZN6UL.js → chunk-EJEXHTY5.js} +2 -2
  152. package/dist/cli-bundle/chunks/{chunk-WQUEHPZB.js → chunk-EYLCSJAI.js} +2 -2
  153. package/dist/cli-bundle/chunks/{chunk-655STMGA.js → chunk-FMBNM2EN.js} +2 -2
  154. package/dist/cli-bundle/chunks/{chunk-RMF3IOYQ.js → chunk-FNSPG7MU.js} +12 -12
  155. package/dist/cli-bundle/chunks/{chunk-5CT5BW6E.js → chunk-GM5QHQU6.js} +46 -40
  156. package/dist/cli-bundle/chunks/chunk-GM5QHQU6.js.map +7 -0
  157. package/dist/cli-bundle/chunks/{chunk-FTQLW4JD.js → chunk-GOSLKLFE.js} +418 -24
  158. package/dist/cli-bundle/chunks/chunk-GOSLKLFE.js.map +1 -0
  159. package/dist/cli-bundle/chunks/{chunk-KB726FMH.js → chunk-H2Z3FYXQ.js} +4 -4
  160. package/dist/cli-bundle/chunks/chunk-H3EIEWGR.js +162 -0
  161. package/dist/cli-bundle/chunks/chunk-H3EIEWGR.js.map +1 -0
  162. package/dist/cli-bundle/chunks/{chunk-2QIQGYPW.js → chunk-H5APFTHZ.js} +53 -10
  163. package/dist/cli-bundle/chunks/chunk-H5APFTHZ.js.map +7 -0
  164. package/dist/cli-bundle/chunks/chunk-HDH3JUGG.js +118 -0
  165. package/dist/cli-bundle/chunks/chunk-HDH3JUGG.js.map +1 -0
  166. package/dist/cli-bundle/chunks/{chunk-ZAYYDNB3.js → chunk-HO4KXD6I.js} +22 -142
  167. package/dist/cli-bundle/chunks/chunk-HO4KXD6I.js.map +1 -0
  168. package/dist/cli-bundle/chunks/{chunk-ILLUE5DI.js → chunk-HYB5AZ63.js} +203 -62
  169. package/dist/cli-bundle/chunks/{chunk-ILLUE5DI.js.map → chunk-HYB5AZ63.js.map} +3 -3
  170. package/dist/cli-bundle/chunks/{chunk-BN62TO2S.js → chunk-IA5FKNII.js} +2 -2
  171. package/dist/cli-bundle/chunks/{chunk-JL7WZ4O2.js → chunk-IG3SWA4A.js} +33 -9
  172. package/dist/cli-bundle/chunks/chunk-IG3SWA4A.js.map +7 -0
  173. package/dist/cli-bundle/chunks/{chunk-W6HZ55JO.js → chunk-IJIICKVW.js} +2 -2
  174. package/dist/cli-bundle/chunks/{chunk-IGED7NH2.js → chunk-ILX33QXL.js} +668 -251
  175. package/dist/cli-bundle/chunks/chunk-ILX33QXL.js.map +7 -0
  176. package/dist/cli-bundle/chunks/{chunk-UGTVWL3E.js → chunk-INU6DKT5.js} +47 -41
  177. package/dist/cli-bundle/chunks/chunk-INU6DKT5.js.map +1 -0
  178. package/dist/cli-bundle/chunks/{chunk-UB2QYSTO.js → chunk-J5AOEGDC.js} +26 -18
  179. package/dist/cli-bundle/chunks/chunk-J5AOEGDC.js.map +1 -0
  180. package/dist/cli-bundle/chunks/{chunk-4DY4KPQI.js → chunk-J6364LFM.js} +1330 -937
  181. package/dist/cli-bundle/chunks/chunk-J6364LFM.js.map +7 -0
  182. package/dist/cli-bundle/chunks/{chunk-DVOLZJ3C.js → chunk-J6EY5V4N.js} +1295 -939
  183. package/dist/cli-bundle/chunks/chunk-J6EY5V4N.js.map +1 -0
  184. package/dist/cli-bundle/chunks/chunk-JFTKLTEF.js +1097 -0
  185. package/dist/cli-bundle/chunks/chunk-JFTKLTEF.js.map +1 -0
  186. package/dist/cli-bundle/chunks/{chunk-M7EWN4TF.js → chunk-JOUQZENX.js} +3 -3
  187. package/dist/cli-bundle/chunks/{chunk-J4NZOP3I.js → chunk-JXQUXVMI.js} +9 -8
  188. package/dist/cli-bundle/chunks/chunk-JXQUXVMI.js.map +1 -0
  189. package/dist/cli-bundle/chunks/{chunk-2FNWQXZ2.js → chunk-JYFOV7FC.js} +4 -4
  190. package/dist/cli-bundle/chunks/{chunk-HLHSQ5CA.js → chunk-K2X6U4UA.js} +4 -4
  191. package/dist/cli-bundle/chunks/{chunk-6OTZMORS.js → chunk-K3WII2ME.js} +27 -27
  192. package/dist/cli-bundle/chunks/chunk-K3WII2ME.js.map +7 -0
  193. package/dist/cli-bundle/chunks/{chunk-M6ASXYCU.js → chunk-KG44YSKD.js} +4 -4
  194. package/dist/cli-bundle/chunks/{chunk-YVKE5ZDM.js → chunk-KPMKHGEA.js} +4 -4
  195. package/dist/cli-bundle/chunks/{chunk-QASRVKUQ.js → chunk-LPYWLWDS.js} +257 -163
  196. package/dist/cli-bundle/chunks/chunk-LPYWLWDS.js.map +1 -0
  197. package/dist/cli-bundle/chunks/{chunk-RGXD5JJR.js → chunk-LSG2U345.js} +19 -12
  198. package/dist/cli-bundle/chunks/chunk-LSG2U345.js.map +7 -0
  199. package/dist/cli-bundle/chunks/chunk-MIQDDLB5.js +5 -0
  200. package/dist/cli-bundle/chunks/{chunk-UJ4HJYWL.js → chunk-NLDFBC6J.js} +2 -2
  201. package/dist/cli-bundle/chunks/{chunk-WRKB56FC.js → chunk-NP22ERDF.js} +3 -3
  202. package/dist/cli-bundle/chunks/{chunk-YQYG2V23.js → chunk-NU3IMIEA.js} +2 -2
  203. package/dist/cli-bundle/chunks/{chunk-3I3LRT2G.js → chunk-NVPZIJVR.js} +2 -2
  204. package/dist/cli-bundle/chunks/{chunk-JAF4TUQ7.js → chunk-ODALILG3.js} +2 -2
  205. package/dist/cli-bundle/chunks/{chunk-CDJYP7OQ.js → chunk-ONG5V5CI.js} +190 -63
  206. package/dist/cli-bundle/chunks/chunk-ONG5V5CI.js.map +1 -0
  207. package/dist/cli-bundle/chunks/{chunk-QZ7LT3XE.js → chunk-ONREO4ST.js} +3 -3
  208. package/dist/cli-bundle/chunks/chunk-OW4JWD5M.js +61 -0
  209. package/dist/cli-bundle/chunks/chunk-OW4JWD5M.js.map +1 -0
  210. package/dist/cli-bundle/chunks/{chunk-3CMRNVTO.js → chunk-P74IZQ7A.js} +12 -12
  211. package/dist/cli-bundle/chunks/chunk-PENXZX3U.js +172 -0
  212. package/dist/cli-bundle/chunks/chunk-PENXZX3U.js.map +7 -0
  213. package/dist/cli-bundle/chunks/{chunk-ZTRBSABY.js → chunk-PGY23YTC.js} +3 -3
  214. package/dist/cli-bundle/chunks/{chunk-H2QBAKLQ.js → chunk-PMOSXADO.js} +3 -3
  215. package/dist/cli-bundle/chunks/chunk-PNTULOGU.js +9 -0
  216. package/dist/cli-bundle/chunks/{chunk-GSEADLRH.js → chunk-Q7A43DS4.js} +2 -2
  217. package/dist/cli-bundle/chunks/{chunk-QSPARJWF.js → chunk-QEHQ2GVG.js} +2 -2
  218. package/dist/cli-bundle/chunks/{chunk-VJTAEIPC.js → chunk-QIPLHNP7.js} +7 -7
  219. package/dist/cli-bundle/chunks/{chunk-GXXC7QSK.js → chunk-QKECXBBG.js} +3 -3
  220. package/dist/cli-bundle/chunks/{chunk-GXXC7QSK.js.map → chunk-QKECXBBG.js.map} +1 -1
  221. package/dist/cli-bundle/chunks/{chunk-K7WNZ7KD.js → chunk-QKJGPFAF.js} +3 -3
  222. package/dist/cli-bundle/chunks/{chunk-F7PSHRNO.js → chunk-QKXHFPYM.js} +27 -10
  223. package/dist/cli-bundle/chunks/chunk-QKXHFPYM.js.map +1 -0
  224. package/dist/cli-bundle/chunks/{chunk-ZNP64HOW.js → chunk-RLCHOOHC.js} +2 -2
  225. package/dist/cli-bundle/chunks/{chunk-IAPHYPRL.js → chunk-RMLWNPH2.js} +2 -2
  226. package/dist/cli-bundle/chunks/{chunk-UVBA6F5A.js → chunk-RRM5JYJC.js} +2 -2
  227. package/dist/cli-bundle/chunks/{chunk-6IIVBC56.js → chunk-S6MQESFR.js} +4 -4
  228. package/dist/cli-bundle/chunks/{chunk-QABYZYLU.js → chunk-SDQLJWBO.js} +4 -4
  229. package/dist/cli-bundle/chunks/{chunk-ANSJHDOZ.js → chunk-SELVXEZK.js} +2 -2
  230. package/dist/cli-bundle/chunks/{chunk-DYEX6NFH.js → chunk-TD3LVC7D.js} +438 -23
  231. package/dist/cli-bundle/chunks/chunk-TD3LVC7D.js.map +7 -0
  232. package/dist/cli-bundle/chunks/{chunk-WD6MSYMP.js → chunk-TKOVBP6C.js} +2 -2
  233. package/dist/cli-bundle/chunks/{chunk-TZ2PSLLT.js → chunk-TQSZFPIS.js} +4 -4
  234. package/dist/cli-bundle/chunks/{chunk-WPAWZW7S.js → chunk-TSMHDIW4.js} +2 -2
  235. package/dist/cli-bundle/chunks/{chunk-TZRTLMWM.js → chunk-UFXU44HV.js} +4 -4
  236. package/dist/cli-bundle/chunks/{chunk-TWLDBKQU.js → chunk-ULTHRDBP.js} +3 -3
  237. package/dist/cli-bundle/chunks/{chunk-OI4S4KCI.js → chunk-UMOPHQSU.js} +9 -9
  238. package/dist/cli-bundle/chunks/{chunk-OI4S4KCI.js.map → chunk-UMOPHQSU.js.map} +2 -2
  239. package/dist/cli-bundle/chunks/{chunk-RA5AIAMP.js → chunk-UOHFKBUV.js} +3 -3
  240. package/dist/cli-bundle/chunks/{chunk-PHKP3AGR.js → chunk-UWQHLMEB.js} +35 -18
  241. package/dist/cli-bundle/chunks/chunk-UWQHLMEB.js.map +7 -0
  242. package/dist/cli-bundle/chunks/{chunk-6TTOHMTB.js → chunk-UXONS674.js} +45 -112
  243. package/dist/cli-bundle/chunks/chunk-UXONS674.js.map +1 -0
  244. package/dist/cli-bundle/chunks/{chunk-4RXTMU57.js → chunk-UY2ACEMF.js} +7 -7
  245. package/dist/cli-bundle/chunks/{chunk-6PKA3SJQ.js → chunk-WQPUU7XD.js} +19 -28
  246. package/dist/cli-bundle/chunks/chunk-WQPUU7XD.js.map +1 -0
  247. package/dist/cli-bundle/chunks/{chunk-7TQMR6LK.js → chunk-WT3ZEOGH.js} +70 -20
  248. package/dist/cli-bundle/chunks/chunk-WT3ZEOGH.js.map +7 -0
  249. package/dist/cli-bundle/chunks/{chunk-FIGXOCEQ.js → chunk-WUJQK4YV.js} +4 -4
  250. package/dist/cli-bundle/chunks/{chunk-T4BRCB6Z.js → chunk-XSJUSQAE.js} +2 -2
  251. package/dist/cli-bundle/chunks/{chunk-6MHSBDGD.js → chunk-XXXF6PAQ.js} +50 -117
  252. package/dist/cli-bundle/chunks/chunk-XXXF6PAQ.js.map +7 -0
  253. package/dist/cli-bundle/chunks/{chunk-UKUIIBDW.js → chunk-YAQEBNY7.js} +4 -4
  254. package/dist/cli-bundle/chunks/{chunk-7QDSYUMF.js → chunk-YAROI3PD.js} +44 -21
  255. package/dist/cli-bundle/chunks/chunk-YAROI3PD.js.map +1 -0
  256. package/dist/cli-bundle/chunks/{chunk-E2WC6S4P.js → chunk-YBLZ2VE7.js} +13 -13
  257. package/dist/cli-bundle/chunks/{chunk-Y72FV7RM.js → chunk-YCQET3OT.js} +2 -2
  258. package/dist/cli-bundle/chunks/chunk-YUSOJDWM.js +9 -0
  259. package/dist/cli-bundle/chunks/chunk-YXSHIAUJ.js +58 -0
  260. package/dist/cli-bundle/chunks/chunk-YXSHIAUJ.js.map +1 -0
  261. package/dist/cli-bundle/chunks/{chunk-FS6UM5WH.js → chunk-ZI6VQWQ7.js} +4 -4
  262. package/dist/cli-bundle/chunks/chunk-ZKRZY773.js +68 -0
  263. package/dist/cli-bundle/chunks/chunk-ZKRZY773.js.map +7 -0
  264. package/dist/cli-bundle/chunks/{close-LZECOMHO.js → close-CWODTPKG.js} +5 -5
  265. package/dist/cli-bundle/chunks/close-W6LI2PKM.js +12 -0
  266. package/dist/cli-bundle/chunks/{close-many-ZHI6A5TN.js → close-many-CQFUY7MR.js} +15 -13
  267. package/dist/cli-bundle/chunks/close-many-DLDDVSH5.js +23 -0
  268. package/dist/cli-bundle/chunks/comments-E3TNTK24.js +13 -0
  269. package/dist/cli-bundle/chunks/{comments-AJWRTFZ5.js → comments-WGLHR7LB.js} +7 -7
  270. package/dist/cli-bundle/chunks/{copy-GMXYKBXT.js → copy-LXVDXH7B.js} +4 -4
  271. package/dist/cli-bundle/chunks/copy-Q5ZJPUKR.js +9 -0
  272. package/dist/cli-bundle/chunks/{create-F53OBTOU.js → create-J5U6ND4K.js} +9 -9
  273. package/dist/cli-bundle/chunks/{create-HU4Q7RJX.js → create-LBVCYMEG.js} +9 -9
  274. package/dist/cli-bundle/chunks/{delete-GSDZLTRC.js → delete-PMJBNY5G.js} +4 -4
  275. package/dist/cli-bundle/chunks/delete-WNHB3LYW.js +10 -0
  276. package/dist/cli-bundle/chunks/{deps-WWB7P2GT.js → deps-JZ7TMVCB.js} +7 -4
  277. package/dist/cli-bundle/chunks/{deps-U57I7EAK.js → deps-OA26IS25.js} +7 -4
  278. package/dist/cli-bundle/chunks/{docs-MQIY2ZQS.js → docs-FEWB2DQB.js} +6 -6
  279. package/dist/cli-bundle/chunks/docs-HA2AIDBB.js +14 -0
  280. package/dist/cli-bundle/chunks/{files-TBZD7V6H.js → files-6YFBJRBG.js} +6 -6
  281. package/dist/cli-bundle/chunks/{files-TTY6N2AV.js → files-EFIWKFTM.js} +6 -6
  282. package/dist/cli-bundle/chunks/{focus-XT6YVFFX.js → focus-4QJR7FOQ.js} +5 -5
  283. package/dist/cli-bundle/chunks/focus-POIW5LTJ.js +10 -0
  284. package/dist/cli-bundle/chunks/{history-compact-KKVUWB4V.js → history-compact-CKRPDTJN.js} +6 -10
  285. package/dist/cli-bundle/chunks/history-compact-FWG2C7FZ.js +16 -0
  286. package/dist/cli-bundle/chunks/history-redact-BB3TGDAE.js +15 -0
  287. package/dist/cli-bundle/chunks/{history-redact-3DVZOILD.js → history-redact-D225BHOZ.js} +5 -6
  288. package/dist/cli-bundle/chunks/history-repair-6GEAM7HE.js +16 -0
  289. package/dist/cli-bundle/chunks/{history-repair-ITDUMK4N.js → history-repair-RQXKQHL4.js} +6 -8
  290. package/dist/cli-bundle/chunks/{learnings-FGO3NSFW.js → learnings-JLNLCOL5.js} +7 -7
  291. package/dist/cli-bundle/chunks/learnings-RSNLSWDC.js +13 -0
  292. package/dist/cli-bundle/chunks/notes-2WDH6DXU.js +13 -0
  293. package/dist/cli-bundle/chunks/{notes-NQ6RXVW6.js → notes-GB47XXQQ.js} +7 -7
  294. package/dist/cli-bundle/chunks/plan-DOVI2VMW.js +24 -0
  295. package/dist/cli-bundle/chunks/{plan-2NNEO46V.js → plan-VDCJ2PCN.js} +10 -10
  296. package/dist/cli-bundle/chunks/{profile-AAQUU6T3.js → profile-FAU7NZML.js} +10 -10
  297. package/dist/cli-bundle/chunks/{profile-U725ATWZ.js → profile-IVXQEL3D.js} +10 -10
  298. package/dist/cli-bundle/chunks/{register-list-query-BUWCYHBT.js → register-list-query-DKA3EH5D.js} +22 -19
  299. package/dist/cli-bundle/chunks/register-list-query-DKA3EH5D.js.map +7 -0
  300. package/dist/cli-bundle/chunks/{register-list-query-KTZ6AGE7.js → register-list-query-UL4UKBBN.js} +23 -20
  301. package/dist/cli-bundle/chunks/register-list-query-UL4UKBBN.js.map +1 -0
  302. package/dist/cli-bundle/chunks/{register-mutation-UELYYOR7.js → register-mutation-ARFHRW55.js} +36 -32
  303. package/dist/cli-bundle/chunks/{register-mutation-UELYYOR7.js.map → register-mutation-ARFHRW55.js.map} +2 -2
  304. package/dist/cli-bundle/chunks/{register-mutation-4FMGJJF7.js → register-mutation-RBBJ52DK.js} +37 -33
  305. package/dist/cli-bundle/chunks/register-mutation-RBBJ52DK.js.map +1 -0
  306. package/dist/cli-bundle/chunks/{register-operations-JVW24J2Y.js → register-operations-ZIBBRSED.js} +41 -39
  307. package/dist/cli-bundle/chunks/{register-operations-JVW24J2Y.js.map → register-operations-ZIBBRSED.js.map} +1 -1
  308. package/dist/cli-bundle/chunks/{register-operations-ISUX6LY5.js → register-operations-ZUJ5JWPE.js} +39 -37
  309. package/dist/cli-bundle/chunks/{register-operations-ISUX6LY5.js.map → register-operations-ZUJ5JWPE.js.map} +1 -1
  310. package/dist/cli-bundle/chunks/{register-setup-5XNGKJ22.js → register-setup-BCVLFEYS.js} +29 -17
  311. package/dist/cli-bundle/chunks/{register-setup-5XNGKJ22.js.map → register-setup-BCVLFEYS.js.map} +2 -2
  312. package/dist/cli-bundle/chunks/{register-setup-ZTNY6S7R.js → register-setup-TDCGWIOS.js} +19 -18
  313. package/dist/cli-bundle/chunks/{register-setup-ZTNY6S7R.js.map → register-setup-TDCGWIOS.js.map} +1 -1
  314. package/dist/cli-bundle/chunks/{restore-B3BAB6X2.js → restore-25DLT2Q2.js} +6 -6
  315. package/dist/cli-bundle/chunks/restore-YPMVUUEX.js +14 -0
  316. package/dist/cli-bundle/chunks/{schema-U7IM2DXV.js → schema-FNU3WE4O.js} +7 -6
  317. package/dist/cli-bundle/chunks/{schema-LZNUYHDB.js → schema-NBCM3RAD.js} +7 -6
  318. package/dist/cli-bundle/chunks/update-WWBYOPXO.js +21 -0
  319. package/dist/cli-bundle/chunks/update-WWBYOPXO.js.map +7 -0
  320. package/dist/cli-bundle/chunks/{update-Q3UCILNR.js → update-XHSIAIXE.js} +12 -12
  321. package/dist/cli-bundle/chunks/update-XHSIAIXE.js.map +1 -0
  322. package/dist/cli-bundle/chunks/update-many-OUGIU5SF.js +32 -0
  323. package/dist/cli-bundle/chunks/update-many-OUGIU5SF.js.map +7 -0
  324. package/dist/cli-bundle/chunks/update-many-TA7NGQBO.js +36 -0
  325. package/dist/cli-bundle/chunks/update-many-TA7NGQBO.js.map +1 -0
  326. package/dist/cli-bundle/main.js +826 -43
  327. package/dist/cli-bundle/main.js.map +4 -4
  328. package/dist/cli-bundle/sdk-runtime.js +70 -57
  329. package/dist/cli-bundle/sdk-testing.js +6 -6
  330. package/dist/cli-bundle/sdk.js +876 -74
  331. package/dist/cli-bundle/sdk.js.map +4 -4
  332. package/dist/cli.js +5 -4
  333. package/dist/cli.js.map +1 -1
  334. package/dist/core/diagnostics/remediation.js +12 -2
  335. package/dist/core/diagnostics/remediation.js.map +1 -1
  336. package/dist/core/history/projection.d.ts +39 -0
  337. package/dist/core/history/projection.js +164 -0
  338. package/dist/core/history/projection.js.map +1 -0
  339. package/dist/core/history/read.d.ts +3 -0
  340. package/dist/core/history/read.js +55 -0
  341. package/dist/core/history/read.js.map +1 -0
  342. package/dist/core/output/output-control.d.ts +18 -0
  343. package/dist/core/output/output-control.js +26 -0
  344. package/dist/core/output/output-control.js.map +1 -0
  345. package/dist/core/output/output.js +20 -8
  346. package/dist/core/output/output.js.map +1 -1
  347. package/dist/core/sentry/helpers.js +10 -2
  348. package/dist/core/sentry/helpers.js.map +1 -1
  349. package/dist/core/shared/command-types.d.ts +2 -0
  350. package/dist/core/shared/command-types.js +2 -2
  351. package/dist/core/shared/command-types.js.map +1 -1
  352. package/dist/core/shared/errors.d.ts +11 -0
  353. package/dist/core/shared/errors.js +2 -2
  354. package/dist/core/shared/errors.js.map +1 -1
  355. package/dist/mcp/server.d.ts +2 -2
  356. package/dist/mcp/tool-definitions.js +5 -5
  357. package/dist/mcp/tool-definitions.js.map +1 -1
  358. package/dist/sdk/author-attribution.d.ts +35 -0
  359. package/dist/sdk/author-attribution.js +118 -0
  360. package/dist/sdk/author-attribution.js.map +1 -0
  361. package/dist/sdk/cli-contracts/command-aliases.d.ts +7 -0
  362. package/dist/sdk/cli-contracts/command-aliases.js +17 -0
  363. package/dist/sdk/cli-contracts/command-aliases.js.map +1 -0
  364. package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
  365. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  366. package/dist/sdk/cli-contracts/tool-option-contracts.js +6 -2
  367. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  368. package/dist/sdk/cli-contracts/tool-parameter-tables.js +21 -2
  369. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  370. package/dist/sdk/cli-contracts/tool-schema.js +3 -3
  371. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  372. package/dist/sdk/cli-contracts.d.ts +1 -0
  373. package/dist/sdk/cli-contracts.js +3 -2
  374. package/dist/sdk/cli-contracts.js.map +1 -1
  375. package/dist/sdk/cli-program.d.ts +8 -0
  376. package/dist/sdk/cli-program.js +39 -0
  377. package/dist/sdk/cli-program.js.map +1 -0
  378. package/dist/sdk/command-line.d.ts +11 -0
  379. package/dist/sdk/command-line.js +40 -0
  380. package/dist/sdk/command-line.js.map +1 -0
  381. package/dist/sdk/config.d.ts +163 -0
  382. package/dist/sdk/config.js +1087 -0
  383. package/dist/sdk/config.js.map +1 -0
  384. package/dist/sdk/context-relevance.d.ts +21 -0
  385. package/dist/sdk/context-relevance.js +70 -2
  386. package/dist/sdk/context-relevance.js.map +1 -1
  387. package/dist/sdk/dependencies.d.ts +15 -2
  388. package/dist/sdk/dependencies.js +97 -8
  389. package/dist/sdk/dependencies.js.map +1 -1
  390. package/dist/{cli/commands → sdk}/extension/bundled-catalog.d.ts +1 -1
  391. package/dist/{cli/commands → sdk}/extension/bundled-catalog.js +12 -12
  392. package/dist/sdk/extension/bundled-catalog.js.map +1 -0
  393. package/dist/sdk/extension/concurrency.d.ts +7 -0
  394. package/dist/sdk/extension/concurrency.js +26 -0
  395. package/dist/sdk/extension/concurrency.js.map +1 -0
  396. package/dist/sdk/extension/describe.d.ts +91 -0
  397. package/dist/sdk/extension/describe.js +144 -0
  398. package/dist/sdk/extension/describe.js.map +1 -0
  399. package/dist/{cli/commands → sdk}/extension/doctor.d.ts +3 -3
  400. package/dist/{cli/commands → sdk}/extension/doctor.js +7 -7
  401. package/dist/sdk/extension/doctor.js.map +1 -0
  402. package/dist/sdk/extension/install-runtime.d.ts +26 -0
  403. package/dist/sdk/extension/install-runtime.js +269 -0
  404. package/dist/sdk/extension/install-runtime.js.map +1 -0
  405. package/dist/sdk/extension/install-snapshot.d.ts +23 -0
  406. package/dist/sdk/extension/install-snapshot.js +66 -0
  407. package/dist/sdk/extension/install-snapshot.js.map +1 -0
  408. package/dist/{cli/commands → sdk}/extension/install-sources.d.ts +3 -3
  409. package/dist/{cli/commands → sdk}/extension/install-sources.js +15 -12
  410. package/dist/sdk/extension/install-sources.js.map +1 -0
  411. package/dist/{cli/commands → sdk}/extension/managed-state.js +6 -6
  412. package/dist/sdk/extension/managed-state.js.map +1 -0
  413. package/dist/sdk/extension/scaffold.d.ts +36 -0
  414. package/dist/sdk/extension/scaffold.js +2436 -0
  415. package/dist/sdk/extension/scaffold.js.map +1 -0
  416. package/dist/sdk/extension/shared.d.ts +28 -0
  417. package/dist/sdk/extension/shared.js +140 -0
  418. package/dist/sdk/extension/shared.js.map +1 -0
  419. package/dist/sdk/extension/update-check.d.ts +15 -0
  420. package/dist/sdk/extension/update-check.js +68 -0
  421. package/dist/sdk/extension/update-check.js.map +1 -0
  422. package/dist/sdk/extension.d.ts +367 -0
  423. package/dist/sdk/extension.js +2174 -0
  424. package/dist/sdk/extension.js.map +1 -0
  425. package/dist/sdk/governance/gc.d.ts +56 -0
  426. package/dist/sdk/governance/gc.js +276 -0
  427. package/dist/sdk/governance/gc.js.map +1 -0
  428. package/dist/sdk/governance/health.d.ts +187 -0
  429. package/dist/sdk/governance/health.js +1796 -0
  430. package/dist/sdk/governance/health.js.map +1 -0
  431. package/dist/sdk/governance/validate.d.ts +255 -0
  432. package/dist/sdk/governance/validate.js +2175 -0
  433. package/dist/sdk/governance/validate.js.map +1 -0
  434. package/dist/sdk/history-compact.d.ts +142 -0
  435. package/dist/sdk/history-compact.js +508 -0
  436. package/dist/sdk/history-compact.js.map +1 -0
  437. package/dist/sdk/history-mcp.d.ts +17 -0
  438. package/dist/sdk/history-mcp.js +68 -0
  439. package/dist/sdk/history-mcp.js.map +1 -0
  440. package/dist/sdk/history-read.d.ts +31 -0
  441. package/dist/sdk/history-read.js +58 -0
  442. package/dist/sdk/history-read.js.map +1 -0
  443. package/dist/sdk/history-redact.d.ts +120 -0
  444. package/dist/sdk/history-redact.js +577 -0
  445. package/dist/sdk/history-redact.js.map +1 -0
  446. package/dist/sdk/history-repair.d.ts +89 -0
  447. package/dist/sdk/history-repair.js +263 -0
  448. package/dist/sdk/history-repair.js.map +1 -0
  449. package/dist/sdk/index.d.ts +25 -1
  450. package/dist/sdk/index.js +27 -3
  451. package/dist/sdk/index.js.map +1 -1
  452. package/dist/sdk/init-agent-guidance.d.ts +113 -0
  453. package/dist/sdk/init-agent-guidance.js +437 -0
  454. package/dist/sdk/init-agent-guidance.js.map +1 -0
  455. package/dist/sdk/init.d.ts +186 -0
  456. package/dist/sdk/init.js +733 -0
  457. package/dist/sdk/init.js.map +1 -0
  458. package/dist/sdk/invocation-author.d.ts +2 -0
  459. package/dist/sdk/invocation-author.js +39 -0
  460. package/dist/sdk/invocation-author.js.map +1 -0
  461. package/dist/sdk/item-children.d.ts +45 -0
  462. package/dist/sdk/item-children.js +75 -0
  463. package/dist/sdk/item-children.js.map +1 -0
  464. package/dist/sdk/item-schedule.d.ts +26 -0
  465. package/dist/sdk/item-schedule.js +28 -0
  466. package/dist/sdk/item-schedule.js.map +1 -0
  467. package/dist/sdk/output.d.ts +7 -0
  468. package/dist/sdk/output.js +11 -0
  469. package/dist/sdk/output.js.map +1 -0
  470. package/dist/sdk/pagination.d.ts +4 -1
  471. package/dist/sdk/pagination.js +13 -5
  472. package/dist/sdk/pagination.js.map +1 -1
  473. package/dist/sdk/profile.d.ts +176 -0
  474. package/dist/sdk/profile.js +431 -0
  475. package/dist/sdk/profile.js.map +1 -0
  476. package/dist/sdk/relationship-analytics.d.ts +108 -0
  477. package/dist/sdk/relationship-analytics.js +292 -0
  478. package/dist/sdk/relationship-analytics.js.map +1 -0
  479. package/dist/sdk/relationship-context.d.ts +67 -0
  480. package/dist/sdk/relationship-context.js +207 -0
  481. package/dist/sdk/relationship-context.js.map +1 -0
  482. package/dist/sdk/relationship-history.d.ts +109 -0
  483. package/dist/sdk/relationship-history.js +401 -0
  484. package/dist/sdk/relationship-history.js.map +1 -0
  485. package/dist/sdk/relationships.d.ts +145 -0
  486. package/dist/sdk/relationships.js +551 -0
  487. package/dist/sdk/relationships.js.map +1 -0
  488. package/dist/sdk/runtime-input.d.ts +10 -0
  489. package/dist/sdk/runtime-input.js +60 -0
  490. package/dist/sdk/runtime-input.js.map +1 -0
  491. package/dist/sdk/runtime.d.ts +31 -8
  492. package/dist/sdk/runtime.js +61 -57
  493. package/dist/sdk/runtime.js.map +1 -1
  494. package/dist/sdk/schema.d.ts +507 -0
  495. package/dist/sdk/schema.js +1269 -0
  496. package/dist/sdk/schema.js.map +1 -0
  497. package/dist/{cli/commands → sdk}/templates.d.ts +1 -1
  498. package/dist/{cli/commands → sdk}/templates.js +9 -9
  499. package/dist/sdk/templates.js.map +1 -0
  500. package/dist/{cli/commands → sdk}/test/linked-command-detection.d.ts +10 -2
  501. package/dist/sdk/test/linked-command-detection.js +525 -0
  502. package/dist/sdk/test/linked-command-detection.js.map +1 -0
  503. package/docs/COMMANDS.md +58 -40
  504. package/docs/EXTENSIONS.md +10 -1
  505. package/docs/RELATIONSHIP_GRAPH.md +113 -0
  506. package/docs/RELEASING.md +2 -0
  507. package/docs/SDK.md +156 -9
  508. package/docs/SDK_CUSTOMIZATION_PRIMITIVES.md +79 -0
  509. package/marketplace.json +2 -2
  510. package/package.json +3 -2
  511. package/packages/pm-beads/package.json +1 -1
  512. package/packages/pm-calendar/package.json +1 -1
  513. package/packages/pm-command-kit/package.json +1 -1
  514. package/packages/pm-governance-audit/extensions/governance-audit/runtime-utils.ts +76 -16
  515. package/packages/pm-governance-audit/extensions/governance-audit/sdk.ts +8 -0
  516. package/packages/pm-governance-audit/package.json +1 -1
  517. package/packages/pm-guide-shell/package.json +1 -1
  518. package/packages/pm-kanban/package.json +1 -1
  519. package/packages/pm-lifecycle-hooks/package.json +1 -1
  520. package/packages/pm-linked-test-adapters/package.json +1 -1
  521. package/packages/pm-search-advanced/package.json +1 -1
  522. package/packages/pm-templates/package.json +1 -1
  523. package/packages/pm-todos/package.json +1 -1
  524. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  525. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  526. package/scripts/bundle-cli.mjs +66 -23
  527. package/dist/cli/commands/extension/bundled-catalog.js.map +0 -1
  528. package/dist/cli/commands/extension/doctor.js.map +0 -1
  529. package/dist/cli/commands/extension/install-sources.js.map +0 -1
  530. package/dist/cli/commands/extension/managed-state.js.map +0 -1
  531. package/dist/cli/commands/templates.js.map +0 -1
  532. package/dist/cli/commands/test/linked-command-detection.js +0 -248
  533. package/dist/cli/commands/test/linked-command-detection.js.map +0 -1
  534. package/dist/cli-bundle/chunks/append-DYQWQK2J.js +0 -11
  535. package/dist/cli-bundle/chunks/chunk-2GA3NK35.js +0 -530
  536. package/dist/cli-bundle/chunks/chunk-2GA3NK35.js.map +0 -1
  537. package/dist/cli-bundle/chunks/chunk-2QIQGYPW.js.map +0 -7
  538. package/dist/cli-bundle/chunks/chunk-4DY4KPQI.js.map +0 -7
  539. package/dist/cli-bundle/chunks/chunk-4WREH7RT.js +0 -554
  540. package/dist/cli-bundle/chunks/chunk-4WREH7RT.js.map +0 -7
  541. package/dist/cli-bundle/chunks/chunk-5CT5BW6E.js.map +0 -7
  542. package/dist/cli-bundle/chunks/chunk-5URI7TPJ.js.map +0 -7
  543. package/dist/cli-bundle/chunks/chunk-6MHSBDGD.js.map +0 -7
  544. package/dist/cli-bundle/chunks/chunk-6OTZMORS.js.map +0 -7
  545. package/dist/cli-bundle/chunks/chunk-6PKA3SJQ.js.map +0 -1
  546. package/dist/cli-bundle/chunks/chunk-6TTOHMTB.js.map +0 -1
  547. package/dist/cli-bundle/chunks/chunk-7QDSYUMF.js.map +0 -1
  548. package/dist/cli-bundle/chunks/chunk-7TQMR6LK.js.map +0 -7
  549. package/dist/cli-bundle/chunks/chunk-B5DZYTT3.js +0 -312
  550. package/dist/cli-bundle/chunks/chunk-B5DZYTT3.js.map +0 -7
  551. package/dist/cli-bundle/chunks/chunk-BPD26E3P.js.map +0 -1
  552. package/dist/cli-bundle/chunks/chunk-CDJYP7OQ.js.map +0 -1
  553. package/dist/cli-bundle/chunks/chunk-DBZVUJTK.js +0 -858
  554. package/dist/cli-bundle/chunks/chunk-DBZVUJTK.js.map +0 -1
  555. package/dist/cli-bundle/chunks/chunk-DVOLZJ3C.js.map +0 -1
  556. package/dist/cli-bundle/chunks/chunk-DYEX6NFH.js.map +0 -7
  557. package/dist/cli-bundle/chunks/chunk-F7PSHRNO.js.map +0 -1
  558. package/dist/cli-bundle/chunks/chunk-FO7GMJKG.js +0 -875
  559. package/dist/cli-bundle/chunks/chunk-FO7GMJKG.js.map +0 -7
  560. package/dist/cli-bundle/chunks/chunk-FTQLW4JD.js.map +0 -1
  561. package/dist/cli-bundle/chunks/chunk-IA3YFTXT.js.map +0 -1
  562. package/dist/cli-bundle/chunks/chunk-IGED7NH2.js.map +0 -7
  563. package/dist/cli-bundle/chunks/chunk-J4NZOP3I.js.map +0 -1
  564. package/dist/cli-bundle/chunks/chunk-JL7WZ4O2.js.map +0 -7
  565. package/dist/cli-bundle/chunks/chunk-L24HCJFC.js +0 -309
  566. package/dist/cli-bundle/chunks/chunk-L24HCJFC.js.map +0 -1
  567. package/dist/cli-bundle/chunks/chunk-LWTIRS3Y.js.map +0 -7
  568. package/dist/cli-bundle/chunks/chunk-MKL4CP2I.js.map +0 -1
  569. package/dist/cli-bundle/chunks/chunk-N3CMP4NI.js.map +0 -1
  570. package/dist/cli-bundle/chunks/chunk-PHKP3AGR.js.map +0 -7
  571. package/dist/cli-bundle/chunks/chunk-Q37E63AM.js.map +0 -7
  572. package/dist/cli-bundle/chunks/chunk-QASRVKUQ.js.map +0 -1
  573. package/dist/cli-bundle/chunks/chunk-RGXD5JJR.js.map +0 -7
  574. package/dist/cli-bundle/chunks/chunk-UB2QYSTO.js.map +0 -1
  575. package/dist/cli-bundle/chunks/chunk-UGTVWL3E.js.map +0 -1
  576. package/dist/cli-bundle/chunks/chunk-ZAYYDNB3.js.map +0 -1
  577. package/dist/cli-bundle/chunks/chunk-ZUKSZVBW.js.map +0 -7
  578. package/dist/cli-bundle/chunks/close-RI4JQQHU.js +0 -12
  579. package/dist/cli-bundle/chunks/close-many-LY2XJ52M.js +0 -21
  580. package/dist/cli-bundle/chunks/comments-35M273DN.js +0 -13
  581. package/dist/cli-bundle/chunks/copy-NPYM7M7U.js +0 -9
  582. package/dist/cli-bundle/chunks/delete-ODRWJWAM.js +0 -10
  583. package/dist/cli-bundle/chunks/docs-G7N4E2JO.js +0 -14
  584. package/dist/cli-bundle/chunks/focus-U5TRVCRS.js +0 -10
  585. package/dist/cli-bundle/chunks/history-compact-M7GHYVFN.js +0 -20
  586. package/dist/cli-bundle/chunks/history-redact-JIHZLHDP.js +0 -16
  587. package/dist/cli-bundle/chunks/history-repair-NAFCHLH7.js +0 -18
  588. package/dist/cli-bundle/chunks/learnings-SONGPSHI.js +0 -13
  589. package/dist/cli-bundle/chunks/notes-BSD53H2W.js +0 -13
  590. package/dist/cli-bundle/chunks/plan-AWLYGBNV.js +0 -24
  591. package/dist/cli-bundle/chunks/register-list-query-BUWCYHBT.js.map +0 -7
  592. package/dist/cli-bundle/chunks/register-list-query-KTZ6AGE7.js.map +0 -1
  593. package/dist/cli-bundle/chunks/register-mutation-4FMGJJF7.js.map +0 -1
  594. package/dist/cli-bundle/chunks/restore-66GLMHIX.js +0 -14
  595. package/dist/cli-bundle/chunks/update-2XGHIVQ2.js +0 -21
  596. package/dist/cli-bundle/chunks/update-many-75K57FS3.js +0 -34
  597. package/dist/cli-bundle/chunks/update-many-U42YA445.js +0 -30
  598. /package/dist/cli-bundle/chunks/{append-PVZJDM6J.js.map → append-OJQFUQ4T.js.map} +0 -0
  599. /package/dist/cli-bundle/chunks/{append-DYQWQK2J.js.map → append-UZVHUO74.js.map} +0 -0
  600. /package/dist/cli-bundle/chunks/{chunk-MQZ3PLCF.js.map → chunk-2IFFUZLC.js.map} +0 -0
  601. /package/dist/cli-bundle/chunks/{chunk-P6MYFH6K.js.map → chunk-2JKGO6QX.js.map} +0 -0
  602. /package/dist/cli-bundle/chunks/{chunk-X3GYR4P2.js.map → chunk-2NCIPMQP.js.map} +0 -0
  603. /package/dist/cli-bundle/chunks/{chunk-Q7E6OYZK.js.map → chunk-2VPAVL7O.js.map} +0 -0
  604. /package/dist/cli-bundle/chunks/{chunk-DRNJPEPQ.js.map → chunk-2WSE6PO2.js.map} +0 -0
  605. /package/dist/cli-bundle/chunks/{chunk-FDSBDNYE.js.map → chunk-34L5OT3Y.js.map} +0 -0
  606. /package/dist/cli-bundle/chunks/{chunk-TH7U4KLY.js.map → chunk-3AUGG2DP.js.map} +0 -0
  607. /package/dist/cli-bundle/chunks/{chunk-NKW36AMT.js.map → chunk-3CLU2XZO.js.map} +0 -0
  608. /package/dist/cli-bundle/chunks/{chunk-ABRCOSDC.js.map → chunk-3WM75PWC.js.map} +0 -0
  609. /package/dist/cli-bundle/chunks/{chunk-X6BVXQ52.js.map → chunk-5JLUII3O.js.map} +0 -0
  610. /package/dist/cli-bundle/chunks/{chunk-3TL7WOEF.js.map → chunk-6N2VXVTQ.js.map} +0 -0
  611. /package/dist/cli-bundle/chunks/{chunk-ERL2YFJ2.js.map → chunk-6S3YSUYG.js.map} +0 -0
  612. /package/dist/cli-bundle/chunks/{chunk-IFZA4VB5.js.map → chunk-AHVTB5I5.js.map} +0 -0
  613. /package/dist/cli-bundle/chunks/{chunk-DO5RGJXT.js.map → chunk-APRVSW2O.js.map} +0 -0
  614. /package/dist/cli-bundle/chunks/{chunk-NAQYVWSQ.js.map → chunk-B7PE22W6.js.map} +0 -0
  615. /package/dist/cli-bundle/chunks/{chunk-MD6ULIPJ.js.map → chunk-BCOFWYW4.js.map} +0 -0
  616. /package/dist/cli-bundle/chunks/{chunk-KADLSPIU.js.map → chunk-BEP7WJA2.js.map} +0 -0
  617. /package/dist/cli-bundle/chunks/{chunk-OBDLEQG5.js.map → chunk-CRVF2JDM.js.map} +0 -0
  618. /package/dist/cli-bundle/chunks/{chunk-FJZDA6MS.js.map → chunk-DM4H7FP4.js.map} +0 -0
  619. /package/dist/cli-bundle/chunks/{close-LZECOMHO.js.map → chunk-DUT67M43.js.map} +0 -0
  620. /package/dist/cli-bundle/chunks/{chunk-44LNIULG.js.map → chunk-DYH63FX7.js.map} +0 -0
  621. /package/dist/cli-bundle/chunks/{chunk-HAMLIWAF.js.map → chunk-EAB64KLB.js.map} +0 -0
  622. /package/dist/cli-bundle/chunks/{chunk-CIOZ376P.js.map → chunk-EACOH7AU.js.map} +0 -0
  623. /package/dist/cli-bundle/chunks/{chunk-QK2ZN6UL.js.map → chunk-EJEXHTY5.js.map} +0 -0
  624. /package/dist/cli-bundle/chunks/{chunk-WQUEHPZB.js.map → chunk-EYLCSJAI.js.map} +0 -0
  625. /package/dist/cli-bundle/chunks/{chunk-655STMGA.js.map → chunk-FMBNM2EN.js.map} +0 -0
  626. /package/dist/cli-bundle/chunks/{chunk-RMF3IOYQ.js.map → chunk-FNSPG7MU.js.map} +0 -0
  627. /package/dist/cli-bundle/chunks/{chunk-KB726FMH.js.map → chunk-H2Z3FYXQ.js.map} +0 -0
  628. /package/dist/cli-bundle/chunks/{chunk-BN62TO2S.js.map → chunk-IA5FKNII.js.map} +0 -0
  629. /package/dist/cli-bundle/chunks/{chunk-W6HZ55JO.js.map → chunk-IJIICKVW.js.map} +0 -0
  630. /package/dist/cli-bundle/chunks/{chunk-M7EWN4TF.js.map → chunk-JOUQZENX.js.map} +0 -0
  631. /package/dist/cli-bundle/chunks/{chunk-2FNWQXZ2.js.map → chunk-JYFOV7FC.js.map} +0 -0
  632. /package/dist/cli-bundle/chunks/{chunk-HLHSQ5CA.js.map → chunk-K2X6U4UA.js.map} +0 -0
  633. /package/dist/cli-bundle/chunks/{chunk-M6ASXYCU.js.map → chunk-KG44YSKD.js.map} +0 -0
  634. /package/dist/cli-bundle/chunks/{chunk-YVKE5ZDM.js.map → chunk-KPMKHGEA.js.map} +0 -0
  635. /package/dist/cli-bundle/chunks/{close-many-ZHI6A5TN.js.map → chunk-MIQDDLB5.js.map} +0 -0
  636. /package/dist/cli-bundle/chunks/{chunk-UJ4HJYWL.js.map → chunk-NLDFBC6J.js.map} +0 -0
  637. /package/dist/cli-bundle/chunks/{chunk-WRKB56FC.js.map → chunk-NP22ERDF.js.map} +0 -0
  638. /package/dist/cli-bundle/chunks/{chunk-YQYG2V23.js.map → chunk-NU3IMIEA.js.map} +0 -0
  639. /package/dist/cli-bundle/chunks/{chunk-3I3LRT2G.js.map → chunk-NVPZIJVR.js.map} +0 -0
  640. /package/dist/cli-bundle/chunks/{chunk-JAF4TUQ7.js.map → chunk-ODALILG3.js.map} +0 -0
  641. /package/dist/cli-bundle/chunks/{chunk-QZ7LT3XE.js.map → chunk-ONREO4ST.js.map} +0 -0
  642. /package/dist/cli-bundle/chunks/{chunk-3CMRNVTO.js.map → chunk-P74IZQ7A.js.map} +0 -0
  643. /package/dist/cli-bundle/chunks/{chunk-ZTRBSABY.js.map → chunk-PGY23YTC.js.map} +0 -0
  644. /package/dist/cli-bundle/chunks/{chunk-H2QBAKLQ.js.map → chunk-PMOSXADO.js.map} +0 -0
  645. /package/dist/cli-bundle/chunks/{close-RI4JQQHU.js.map → chunk-PNTULOGU.js.map} +0 -0
  646. /package/dist/cli-bundle/chunks/{chunk-GSEADLRH.js.map → chunk-Q7A43DS4.js.map} +0 -0
  647. /package/dist/cli-bundle/chunks/{chunk-QSPARJWF.js.map → chunk-QEHQ2GVG.js.map} +0 -0
  648. /package/dist/cli-bundle/chunks/{chunk-VJTAEIPC.js.map → chunk-QIPLHNP7.js.map} +0 -0
  649. /package/dist/cli-bundle/chunks/{chunk-K7WNZ7KD.js.map → chunk-QKJGPFAF.js.map} +0 -0
  650. /package/dist/cli-bundle/chunks/{chunk-ZNP64HOW.js.map → chunk-RLCHOOHC.js.map} +0 -0
  651. /package/dist/cli-bundle/chunks/{chunk-IAPHYPRL.js.map → chunk-RMLWNPH2.js.map} +0 -0
  652. /package/dist/cli-bundle/chunks/{chunk-UVBA6F5A.js.map → chunk-RRM5JYJC.js.map} +0 -0
  653. /package/dist/cli-bundle/chunks/{chunk-6IIVBC56.js.map → chunk-S6MQESFR.js.map} +0 -0
  654. /package/dist/cli-bundle/chunks/{chunk-QABYZYLU.js.map → chunk-SDQLJWBO.js.map} +0 -0
  655. /package/dist/cli-bundle/chunks/{chunk-ANSJHDOZ.js.map → chunk-SELVXEZK.js.map} +0 -0
  656. /package/dist/cli-bundle/chunks/{chunk-WD6MSYMP.js.map → chunk-TKOVBP6C.js.map} +0 -0
  657. /package/dist/cli-bundle/chunks/{chunk-TZ2PSLLT.js.map → chunk-TQSZFPIS.js.map} +0 -0
  658. /package/dist/cli-bundle/chunks/{chunk-WPAWZW7S.js.map → chunk-TSMHDIW4.js.map} +0 -0
  659. /package/dist/cli-bundle/chunks/{chunk-TZRTLMWM.js.map → chunk-UFXU44HV.js.map} +0 -0
  660. /package/dist/cli-bundle/chunks/{chunk-TWLDBKQU.js.map → chunk-ULTHRDBP.js.map} +0 -0
  661. /package/dist/cli-bundle/chunks/{chunk-RA5AIAMP.js.map → chunk-UOHFKBUV.js.map} +0 -0
  662. /package/dist/cli-bundle/chunks/{chunk-4RXTMU57.js.map → chunk-UY2ACEMF.js.map} +0 -0
  663. /package/dist/cli-bundle/chunks/{chunk-FIGXOCEQ.js.map → chunk-WUJQK4YV.js.map} +0 -0
  664. /package/dist/cli-bundle/chunks/{chunk-T4BRCB6Z.js.map → chunk-XSJUSQAE.js.map} +0 -0
  665. /package/dist/cli-bundle/chunks/{chunk-UKUIIBDW.js.map → chunk-YAQEBNY7.js.map} +0 -0
  666. /package/dist/cli-bundle/chunks/{chunk-E2WC6S4P.js.map → chunk-YBLZ2VE7.js.map} +0 -0
  667. /package/dist/cli-bundle/chunks/{chunk-Y72FV7RM.js.map → chunk-YCQET3OT.js.map} +0 -0
  668. /package/dist/cli-bundle/chunks/{close-many-LY2XJ52M.js.map → chunk-YUSOJDWM.js.map} +0 -0
  669. /package/dist/cli-bundle/chunks/{chunk-FS6UM5WH.js.map → chunk-ZI6VQWQ7.js.map} +0 -0
  670. /package/dist/cli-bundle/chunks/{comments-AJWRTFZ5.js.map → close-CWODTPKG.js.map} +0 -0
  671. /package/dist/cli-bundle/chunks/{comments-35M273DN.js.map → close-W6LI2PKM.js.map} +0 -0
  672. /package/dist/cli-bundle/chunks/{copy-GMXYKBXT.js.map → close-many-CQFUY7MR.js.map} +0 -0
  673. /package/dist/cli-bundle/chunks/{copy-NPYM7M7U.js.map → close-many-DLDDVSH5.js.map} +0 -0
  674. /package/dist/cli-bundle/chunks/{create-F53OBTOU.js.map → comments-E3TNTK24.js.map} +0 -0
  675. /package/dist/cli-bundle/chunks/{create-HU4Q7RJX.js.map → comments-WGLHR7LB.js.map} +0 -0
  676. /package/dist/cli-bundle/chunks/{delete-GSDZLTRC.js.map → copy-LXVDXH7B.js.map} +0 -0
  677. /package/dist/cli-bundle/chunks/{delete-ODRWJWAM.js.map → copy-Q5ZJPUKR.js.map} +0 -0
  678. /package/dist/cli-bundle/chunks/{deps-U57I7EAK.js.map → create-J5U6ND4K.js.map} +0 -0
  679. /package/dist/cli-bundle/chunks/{deps-WWB7P2GT.js.map → create-LBVCYMEG.js.map} +0 -0
  680. /package/dist/cli-bundle/chunks/{docs-MQIY2ZQS.js.map → delete-PMJBNY5G.js.map} +0 -0
  681. /package/dist/cli-bundle/chunks/{docs-G7N4E2JO.js.map → delete-WNHB3LYW.js.map} +0 -0
  682. /package/dist/cli-bundle/chunks/{files-TTY6N2AV.js.map → deps-JZ7TMVCB.js.map} +0 -0
  683. /package/dist/cli-bundle/chunks/{files-TBZD7V6H.js.map → deps-OA26IS25.js.map} +0 -0
  684. /package/dist/cli-bundle/chunks/{focus-XT6YVFFX.js.map → docs-FEWB2DQB.js.map} +0 -0
  685. /package/dist/cli-bundle/chunks/{focus-U5TRVCRS.js.map → docs-HA2AIDBB.js.map} +0 -0
  686. /package/dist/cli-bundle/chunks/{history-compact-M7GHYVFN.js.map → files-6YFBJRBG.js.map} +0 -0
  687. /package/dist/cli-bundle/chunks/{history-compact-KKVUWB4V.js.map → files-EFIWKFTM.js.map} +0 -0
  688. /package/dist/cli-bundle/chunks/{history-redact-3DVZOILD.js.map → focus-4QJR7FOQ.js.map} +0 -0
  689. /package/dist/cli-bundle/chunks/{history-redact-JIHZLHDP.js.map → focus-POIW5LTJ.js.map} +0 -0
  690. /package/dist/cli-bundle/chunks/{history-repair-ITDUMK4N.js.map → history-compact-CKRPDTJN.js.map} +0 -0
  691. /package/dist/cli-bundle/chunks/{history-repair-NAFCHLH7.js.map → history-compact-FWG2C7FZ.js.map} +0 -0
  692. /package/dist/cli-bundle/chunks/{learnings-SONGPSHI.js.map → history-redact-BB3TGDAE.js.map} +0 -0
  693. /package/dist/cli-bundle/chunks/{learnings-FGO3NSFW.js.map → history-redact-D225BHOZ.js.map} +0 -0
  694. /package/dist/cli-bundle/chunks/{notes-BSD53H2W.js.map → history-repair-6GEAM7HE.js.map} +0 -0
  695. /package/dist/cli-bundle/chunks/{notes-NQ6RXVW6.js.map → history-repair-RQXKQHL4.js.map} +0 -0
  696. /package/dist/cli-bundle/chunks/{plan-2NNEO46V.js.map → learnings-JLNLCOL5.js.map} +0 -0
  697. /package/dist/cli-bundle/chunks/{plan-AWLYGBNV.js.map → learnings-RSNLSWDC.js.map} +0 -0
  698. /package/dist/cli-bundle/chunks/{profile-U725ATWZ.js.map → notes-2WDH6DXU.js.map} +0 -0
  699. /package/dist/cli-bundle/chunks/{profile-AAQUU6T3.js.map → notes-GB47XXQQ.js.map} +0 -0
  700. /package/dist/cli-bundle/chunks/{restore-66GLMHIX.js.map → plan-DOVI2VMW.js.map} +0 -0
  701. /package/dist/cli-bundle/chunks/{restore-B3BAB6X2.js.map → plan-VDCJ2PCN.js.map} +0 -0
  702. /package/dist/cli-bundle/chunks/{schema-U7IM2DXV.js.map → profile-FAU7NZML.js.map} +0 -0
  703. /package/dist/cli-bundle/chunks/{schema-LZNUYHDB.js.map → profile-IVXQEL3D.js.map} +0 -0
  704. /package/dist/cli-bundle/chunks/{update-Q3UCILNR.js.map → restore-25DLT2Q2.js.map} +0 -0
  705. /package/dist/cli-bundle/chunks/{update-2XGHIVQ2.js.map → restore-YPMVUUEX.js.map} +0 -0
  706. /package/dist/cli-bundle/chunks/{update-many-75K57FS3.js.map → schema-FNU3WE4O.js.map} +0 -0
  707. /package/dist/cli-bundle/chunks/{update-many-U42YA445.js.map → schema-NBCM3RAD.js.map} +0 -0
  708. /package/dist/{cli/commands → sdk}/extension/managed-state.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sources":["sdk/init.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/init\n *\n * Implements the pm init command surface and its agent-facing runtime behavior.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport readline from \"node:readline/promises\";\nimport { stdin as input, stdout as output } from \"node:process\";\nimport { hostname, userInfo } from \"node:os\";\nimport {\n getActiveExtensionRegistrations,\n runActiveOnWriteHooks,\n} from \"../core/extensions/index.js\";\nimport {\n pathExists,\n readFileIfExists,\n writeFileAtomic,\n} from \"../core/fs/fs-utils.js\";\nimport { normalizePrefix } from \"../core/item/id.js\";\nimport { resolveItemTypeRegistry } from \"../core/item/type-registry.js\";\nimport {\n DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,\n ensureRuntimeSchemaFileScaffold,\n filePathForSchemaSection,\n normalizeRuntimeSchemaSettings,\n} from \"../core/schema/runtime-schema.js\";\nimport {\n parseItemTypesFile,\n serializeItemTypesFile,\n upsertItemType,\n} from \"../core/schema/item-types-file.js\";\nimport {\n normalizeTypePresetName,\n resolveTypePresetDefinitions,\n TYPE_PRESET_NAMES,\n type TypePresetName,\n} from \"../core/schema/type-presets.js\";\nimport {\n EXIT_CODE,\n GOVERNANCE_PRESET_DEFAULTS,\n PM_REQUIRED_SUBDIRS,\n SETTINGS_DEFAULTS,\n} from \"../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../core/shared/command-types.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport { resolvePmRoot } from \"../core/store/paths.js\";\nimport { readSettings, writeSettings } from \"../core/store/settings.js\";\nimport { ensurePmGitignore } from \"./workspace.js\";\nimport type { GovernancePreset, PmSettings } from \"../types/index.js\";\nimport { renderPmCommand } from \"./command-line.js\";\nimport {\n runExtension,\n type ExtensionCommandResult,\n} from \"./extension.js\";\nimport {\n INIT_AGENT_GUIDANCE_MODE_VALUES,\n runInitAgentGuidance,\n type InitAgentGuidanceMode,\n type InitAgentGuidanceSummary,\n} from \"./init-agent-guidance.js\";\n\n/** Documents the init installed packages summary payload exchanged by command, SDK, and package integrations. */\nexport interface InitInstalledPackagesSummary {\n /** Value that configures or reports installed all for this contract. */\n installed_all: boolean;\n /** Number of installed entries represented by this result. */\n installed_count: number;\n /** Value that configures or reports packages for this contract. */\n packages: Array<{\n alias: string;\n ok: boolean;\n }>;\n}\n\n/** Restricts init type preset name values accepted by command, SDK, and storage contracts. */\nexport type InitTypePresetName = TypePresetName;\n\n/** Documents the init registered type preset summary payload exchanged by command, SDK, and package integrations. */\nexport interface InitRegisteredTypePresetSummary {\n /** Value that configures or reports name for this contract. */\n name: InitTypePresetName;\n /** Value that configures or reports registered for this contract. */\n registered: string[];\n /** Value that configures or reports updated for this contract. */\n updated: string[];\n /** Value that configures or reports file for this contract. */\n file: string;\n}\n\n/** Documents the init agent-guidance summary plus generated next-step hints returned by init. */\nexport type InitAgentGuidanceResult = InitAgentGuidanceSummary & {\n next_steps: string[];\n};\n\n/** Describes how init resolved the tracker and optional workspace target. */\nexport interface InitTargetResolution {\n /** Value that configures or reports mode for this contract. */\n mode: \"workspace-discovery\" | \"tracker-path\" | \"workspace-path\";\n /** Value that configures or reports tracker root for this contract. */\n tracker_root: string;\n /** Value that configures or reports workspace root for this contract. */\n workspace_root?: string;\n}\n\n/** Documents the init result payload exchanged by command, SDK, and package integrations. */\nexport interface InitResult {\n /** Whether the operation completed without a blocking failure. */\n ok: boolean;\n /** Filesystem path used for path resolution. */\n path: string;\n /** Value that configures or reports target for this contract. */\n target: InitTargetResolution;\n /** Value that configures or reports settings for this contract. */\n settings: PmSettings;\n /** Value that configures or reports created dirs for this contract. */\n created_dirs: string[];\n /** Value that configures or reports warnings for this contract. */\n warnings: string[];\n /** Value that configures or reports governance preset for this contract. */\n governance_preset: GovernancePreset;\n /** Value that configures or reports wizard used for this contract. */\n wizard_used: boolean;\n /** Value that configures or reports registered type preset for this contract. */\n registered_type_preset?: InitRegisteredTypePresetSummary;\n /** Value that configures or reports installed packages for this contract. */\n installed_packages?: InitInstalledPackagesSummary;\n /** Value that configures or reports next steps for this contract. */\n next_steps: string[];\n /** Value that configures or reports agent guidance for this contract. */\n agent_guidance: InitAgentGuidanceResult;\n}\n\n/** Documents the init command options payload exchanged by command, SDK, and package integrations. */\nexport interface InitCommandOptions {\n /** Item-id prefix supplied through the flag-oriented SDK/CLI input surface. */\n idPrefix?: string;\n /** Value that configures or reports preset for this contract. */\n preset?: string;\n /** Value that configures or reports defaults for this contract. */\n defaults?: boolean;\n /** Value that configures or reports author for this contract. */\n author?: string;\n /** Value that configures or reports with packages for this contract. */\n withPackages?: boolean;\n /** Value that configures or reports agent guidance for this contract. */\n agentGuidance?: string;\n /** Value that configures or reports type preset for this contract. */\n typePreset?: string;\n /** Value that configures or reports force for this contract. */\n force?: boolean;\n /** Value that configures or reports workspace for this contract. */\n workspace?: string;\n}\n\n/** Concise projection of an InitResult for the default (toon) renderer. It keeps every piece of information that only init can surface — the resolved path, id prefix, governance preset, telemetry capture level, created-directory count, the full warnings list (including `already_exists:` markers), agent-guidance summary, and next steps — but replaces the verbose full settings tree (~190 lines) with a compact `settings` summary. Use --verbose for the full tree. */\nexport interface InitConciseResult {\n /** Whether the operation completed without a blocking failure. */\n ok: boolean;\n /** Filesystem path used for path resolution. */\n path: string;\n /** Value that configures or reports target for this contract. */\n target: InitTargetResolution;\n /** Value that configures or reports id prefix for this contract. */\n id_prefix: string;\n /** Value that configures or reports governance preset for this contract. */\n governance_preset: GovernancePreset;\n /** Value that configures or reports telemetry for this contract. */\n telemetry: {\n enabled: boolean;\n capture_level: string;\n };\n /** Value that configures or reports output format for this contract. */\n output_format: string;\n /** Number of created dirs entries represented by this result. */\n created_dirs_count: number;\n /** Value that configures or reports created dirs for this contract. */\n created_dirs: string[];\n /** Value that configures or reports warnings for this contract. */\n warnings: string[];\n /** Value that configures or reports wizard used for this contract. */\n wizard_used: boolean;\n /** Value that configures or reports registered type preset for this contract. */\n registered_type_preset?: InitRegisteredTypePresetSummary;\n /** Value that configures or reports installed packages for this contract. */\n installed_packages?: InitInstalledPackagesSummary;\n /** Value that configures or reports next steps for this contract. */\n next_steps: string[];\n /** Value that configures or reports agent guidance for this contract. */\n agent_guidance: InitAgentGuidanceResult;\n /** Value that configures or reports hint for this contract. */\n hint: string;\n}\n\n/** Implements summarize init result for the public runtime surface of this module. */\nexport function summarizeInitResult(result: InitResult): InitConciseResult {\n return {\n ok: result.ok,\n path: result.path,\n target: result.target,\n id_prefix: result.settings.id_prefix,\n governance_preset: result.governance_preset,\n telemetry: {\n enabled: result.settings.telemetry.enabled,\n capture_level: result.settings.telemetry.capture_level,\n },\n output_format: result.settings.output.default_format,\n created_dirs_count: result.created_dirs.length,\n created_dirs: result.created_dirs,\n warnings: result.warnings,\n wizard_used: result.wizard_used,\n ...(result.registered_type_preset\n ? { registered_type_preset: result.registered_type_preset }\n : {}),\n ...(result.installed_packages\n ? { installed_packages: result.installed_packages }\n : {}),\n next_steps: result.next_steps,\n agent_guidance: result.agent_guidance,\n hint: \"Re-run with --verbose for the full settings tree.\",\n };\n}\n\n/** Public contract for test only, shared by SDK and presentation-layer consumers. */\nexport const _testOnly = {\n normalizeInitGovernancePreset,\n normalizeInitTypePreset,\n normalizeOptionalInitAuthor,\n normalizeInitAgentGuidanceMode,\n isPathLikeInitTarget,\n resolveInitInvocation,\n resolveInitPrefixInput,\n parseYesNoChoice,\n applyGovernancePreset,\n runInitWizard,\n setInitReadlineFactoryForTests,\n summarizeInstalledPackages,\n buildInitNextSteps,\n registerInitTypePreset,\n assertExplicitTrackerPathIsNotWorkspaceRoot,\n isLikelyWorkspaceRoot,\n};\n\ntype InitReadlineInterface = ReturnType<typeof readline.createInterface>;\nlet createInitReadlineInterface = (): InitReadlineInterface =>\n readline.createInterface({ input, output });\n\ninterface InitNormalizedOptions {\n presetFromOption: BuiltinGovernancePreset | undefined;\n useDefaults: boolean;\n authorFromOption: string | undefined;\n installBundledPackages: boolean;\n agentGuidanceMode: InitAgentGuidanceMode;\n typePreset: InitTypePresetName | undefined;\n}\n\ninterface InitSettingsResolution {\n settings: PmSettings;\n normalizedPrefix: string;\n chosenPreset: BuiltinGovernancePreset | undefined;\n wizardUsed: boolean;\n}\n\nfunction setInitReadlineFactoryForTests(\n factory: (() => InitReadlineInterface) | undefined,\n): void {\n createInitReadlineInterface =\n factory ?? (() => readline.createInterface({ input, output }));\n}\n\nfunction cloneDefaults(): PmSettings {\n return structuredClone(SETTINGS_DEFAULTS);\n}\n\ntype BuiltinGovernancePreset = Exclude<GovernancePreset, \"custom\">;\nconst BUILTIN_GOVERNANCE_PRESETS: BuiltinGovernancePreset[] = [\n \"minimal\",\n \"default\",\n \"strict\",\n];\nfunction normalizeInitGovernancePreset(\n rawValue: string | undefined,\n): BuiltinGovernancePreset | undefined {\n if (rawValue === undefined) {\n return undefined;\n }\n const normalized = rawValue.trim().toLowerCase().replaceAll(\"-\", \"_\");\n if (normalized.length === 0) {\n throw new PmCliError(\"--preset must not be empty\", EXIT_CODE.USAGE);\n }\n if (\n normalized === \"minimal\" ||\n normalized === \"default\" ||\n normalized === \"strict\"\n ) {\n return normalized;\n }\n if (normalized === \"lite\" || normalized === \"minimum\") {\n return \"minimal\";\n }\n throw new PmCliError(\n `Invalid --preset value \"${rawValue}\". Allowed: ${BUILTIN_GOVERNANCE_PRESETS.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction normalizeInitTypePreset(\n rawValue: string | undefined,\n): InitTypePresetName | undefined {\n if (rawValue === undefined) {\n return undefined;\n }\n if (rawValue.trim().length === 0) {\n throw new PmCliError(\"--type-preset must not be empty\", EXIT_CODE.USAGE);\n }\n try {\n // Non-undefined input never returns undefined; the shared normalizer throws\n // a plain Error for empty/unknown values, which we re-map to init's --type-preset\n // PmCliError wording for a consistent CLI surface.\n return normalizeTypePresetName(rawValue) as InitTypePresetName;\n } catch {\n throw new PmCliError(\n `Invalid --type-preset value \"${rawValue}\". Allowed: ${TYPE_PRESET_NAMES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n }\n}\n\nfunction normalizeOptionalInitAuthor(\n rawValue: string | undefined,\n): string | undefined {\n if (rawValue === undefined) {\n return undefined;\n }\n const normalized = rawValue.trim();\n if (normalized.length === 0) {\n throw new PmCliError(\"--author must not be empty\", EXIT_CODE.USAGE);\n }\n return normalized;\n}\n\nfunction isPathLikeInitTarget(rawValue: string | undefined): boolean {\n if (rawValue === undefined) {\n return false;\n }\n const trimmed = rawValue.trim();\n if (trimmed.length === 0) {\n return false;\n }\n return (\n path.isAbsolute(trimmed) ||\n /^[a-z]:/iu.test(trimmed) ||\n trimmed.startsWith(\".\") ||\n trimmed.includes(\"/\") ||\n trimmed.includes(\"\\\\\")\n );\n}\n\nfunction resolveInitInvocation(\n cwd: string,\n global: GlobalOptions,\n prefixArg: string | undefined,\n workspaceArg?: string,\n): {\n pmRoot: string;\n prefixArg: string | undefined;\n target: InitTargetResolution;\n} {\n const normalizedWorkspace = workspaceArg?.trim();\n if (workspaceArg !== undefined && normalizedWorkspace?.length === 0) {\n throw new PmCliError(\"--workspace must not be empty\", EXIT_CODE.USAGE);\n }\n if (normalizedWorkspace !== undefined) {\n if (global.path !== undefined || isPathLikeInitTarget(prefixArg)) {\n throw new PmCliError(\n \"--workspace cannot be combined with --pm-path/--path or a path-like positional target.\",\n EXIT_CODE.USAGE,\n );\n }\n const workspaceRoot = path.resolve(cwd, normalizedWorkspace);\n const pmRoot = path.join(workspaceRoot, \".agents\", \"pm\");\n return {\n pmRoot,\n prefixArg,\n target: {\n mode: \"workspace-path\",\n tracker_root: pmRoot,\n workspace_root: workspaceRoot,\n },\n };\n }\n if (global.path === undefined && isPathLikeInitTarget(prefixArg)) {\n const positionalTarget = path.resolve(cwd, prefixArg!.trim());\n return {\n pmRoot: positionalTarget,\n prefixArg: undefined,\n target: { mode: \"tracker-path\", tracker_root: positionalTarget },\n };\n }\n const pmRoot = resolvePmRoot(cwd, global.path);\n return {\n pmRoot,\n prefixArg,\n target:\n global.path === undefined\n ? {\n mode: \"workspace-discovery\",\n tracker_root: pmRoot,\n workspace_root: cwd,\n }\n : { mode: \"tracker-path\", tracker_root: pmRoot },\n };\n}\n\n/** Resolves the optional positional and flag-oriented id-prefix inputs, accepting equivalent normalized spellings and rejecting ambiguous conflicts. */\nfunction resolveInitPrefixInput(\n positionalPrefix: string | undefined,\n flaggedPrefix: string | undefined,\n): string | undefined {\n if (flaggedPrefix === undefined) {\n return positionalPrefix;\n }\n if (flaggedPrefix.trim().length === 0) {\n throw new PmCliError(\"--id-prefix must not be empty\", EXIT_CODE.USAGE);\n }\n if (isPathLikeInitTarget(flaggedPrefix)) {\n throw new PmCliError(\n `--id-prefix accepts an item ID prefix, not a tracker path: \"${flaggedPrefix}\".`,\n EXIT_CODE.USAGE,\n {\n code: \"init_id_prefix_path_like\",\n required:\n \"Pass the tracker path positionally or with the global --path option.\",\n examples: [\n `pm init ${flaggedPrefix}`,\n `pm --path ${flaggedPrefix} init`,\n ],\n },\n );\n }\n if (\n positionalPrefix !== undefined &&\n normalizePrefix(positionalPrefix) !== normalizePrefix(flaggedPrefix)\n ) {\n throw new PmCliError(\n `Conflicting id prefixes: positional \"${positionalPrefix}\" and --id-prefix \"${flaggedPrefix}\".`,\n EXIT_CODE.USAGE,\n {\n code: \"init_id_prefix_conflict\",\n required:\n \"Use either the positional id prefix or --id-prefix with one value.\",\n examples: [\n `pm init ${normalizePrefix(positionalPrefix)}`,\n `pm init --id-prefix ${normalizePrefix(flaggedPrefix)}`,\n ],\n },\n );\n }\n return flaggedPrefix;\n}\n\nfunction normalizeInitAgentGuidanceMode(\n rawValue: string | undefined,\n): InitAgentGuidanceMode {\n if (rawValue === undefined) {\n return \"ask\";\n }\n const normalized = rawValue.trim().toLowerCase().replaceAll(\"-\", \"_\");\n if (normalized.length === 0) {\n throw new PmCliError(\"--agent-guidance must not be empty\", EXIT_CODE.USAGE);\n }\n if (\n normalized === \"ask\" ||\n normalized === \"add\" ||\n normalized === \"skip\" ||\n normalized === \"status\"\n ) {\n return normalized;\n }\n throw new PmCliError(\n `Invalid --agent-guidance value \"${rawValue}\". Allowed: ${INIT_AGENT_GUIDANCE_MODE_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction parseYesNoChoice(answer: string, currentDefault: boolean): boolean {\n const normalized = answer.trim().toLowerCase();\n if (normalized.length === 0) {\n return currentDefault;\n }\n if (normalized === \"y\" || normalized === \"yes\") {\n return true;\n }\n if (normalized === \"n\" || normalized === \"no\") {\n return false;\n }\n return currentDefault;\n}\n\nfunction applyGovernancePreset(\n settings: PmSettings,\n preset: BuiltinGovernancePreset,\n): void {\n const knobs = GOVERNANCE_PRESET_DEFAULTS[preset];\n settings.governance = {\n preset,\n ...knobs,\n };\n settings.validation.parent_reference = knobs.parent_reference;\n settings.validation.metadata_profile = knobs.metadata_profile;\n}\n\nfunction isInstalledPackageEntry(\n value: unknown,\n): value is { alias?: unknown; ok?: unknown } {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction summarizeInstalledPackages(\n result: ExtensionCommandResult,\n): InitInstalledPackagesSummary {\n const details = result.details as {\n installed_all?: unknown;\n installed_count?: unknown;\n packages?: Array<{\n alias?: unknown;\n ok?: unknown;\n }>;\n };\n return {\n installed_all: details.installed_all === true,\n installed_count:\n typeof details.installed_count === \"number\" ? details.installed_count : 0,\n packages: Array.isArray(details.packages)\n ? details.packages.filter(isInstalledPackageEntry).map((entry) => ({\n alias: typeof entry.alias === \"string\" ? entry.alias : \"\",\n ok: entry.ok === true,\n }))\n : [],\n };\n}\n\nasync function registerInitTypePreset(\n pmRoot: string,\n settings: PmSettings,\n preset: InitTypePresetName,\n): Promise<InitRegisteredTypePresetSummary> {\n const schema = normalizeRuntimeSchemaSettings(settings.schema);\n const typesPath = filePathForSchemaSection(\n pmRoot,\n schema.files.types,\n DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types,\n );\n const parsed = parseItemTypesFile(await readFileIfExists(typesPath));\n let nextFile = parsed;\n const registered: string[] = [];\n const updated: string[] = [];\n for (const normalized of resolveTypePresetDefinitions(preset)) {\n const upsert = upsertItemType(nextFile, normalized);\n nextFile = upsert.file;\n (upsert.replaced ? updated : registered).push(upsert.definition.name);\n }\n await writeFileAtomic(typesPath, serializeItemTypesFile(nextFile));\n return {\n name: preset,\n registered,\n updated,\n file: typesPath,\n };\n}\n\nasync function isLikelyWorkspaceRoot(candidate: string): Promise<boolean> {\n const indicators = [\n \".git\",\n \"package.json\",\n \"pnpm-workspace.yaml\",\n \"AGENTS.md\",\n path.join(\".agents\", \"pm\"),\n ];\n for (const indicator of indicators) {\n if (await pathExists(path.join(candidate, indicator))) {\n return true;\n }\n }\n return false;\n}\n\nasync function assertExplicitTrackerPathIsNotWorkspaceRoot(\n pmRoot: string,\n explicitTrackerTarget: boolean,\n force: boolean,\n): Promise<void> {\n if (!explicitTrackerTarget || force) {\n return;\n }\n if (await pathExists(path.join(pmRoot, \"settings.json\"))) {\n return;\n }\n if (!(await isLikelyWorkspaceRoot(pmRoot))) {\n return;\n }\n const nestedTracker = path.join(pmRoot, \".agents\", \"pm\");\n throw new PmCliError(\n `Refusing to initialize tracker files directly in workspace root \"${pmRoot}\".`,\n EXIT_CODE.USAGE,\n {\n code: \"workspace_root_pm_path\",\n type: \"urn:pm-cli:error:workspace_root_pm_path\",\n why: \"Path-like init targets and --pm-path/--path point at the tracker storage directory itself, not the repository workspace. Point at .agents/pm, use --workspace, or pass --force if you intentionally want root-level tracker files.\",\n examples: [\n `pm --pm-path ${nestedTracker} init --yes`,\n \"pm init --yes\",\n `pm --pm-path ${pmRoot} init --yes --force`,\n ],\n nextSteps: [\n \"Use --pm-path <repo>/.agents/pm for repository-local tracker storage.\",\n \"Use PM_PATH only for sandboxed tests or explicit tracker roots.\",\n \"Pass --force only when root-level tracker files are intentional.\",\n ],\n recovery: {\n next_best_command: `pm --pm-path ${nestedTracker} init --yes`,\n },\n },\n );\n}\n\nasync function ensureInitDirectories(\n pmRoot: string,\n subdirs: readonly string[],\n): Promise<{\n createdDirs: string[];\n warnings: string[];\n}> {\n const createdDirs: string[] = [];\n const warnings: string[] = [];\n for (const subdir of subdirs) {\n const target = subdir ? path.join(pmRoot, subdir) : pmRoot;\n const existed = await pathExists(target);\n await fs.mkdir(target, { recursive: true });\n if (existed) {\n warnings.push(`already_exists:${target}`);\n } else {\n createdDirs.push(target);\n }\n warnings.push(\n ...(await runActiveOnWriteHooks({\n path: target,\n scope: \"project\",\n op: \"init:ensure_dir\",\n })),\n );\n }\n return { createdDirs, warnings };\n}\n\nasync function runInitWizard(\n initialPrefix: string,\n telemetryDefault: boolean,\n): Promise<{\n prefix: string;\n preset: BuiltinGovernancePreset;\n telemetry_enabled: boolean;\n}> {\n const rl = createInitReadlineInterface();\n try {\n output.write(\"pm init setup wizard (agent-optimized)\\n\");\n output.write(\n \"This walkthrough is non-destructive and each choice can be changed later with pm config.\\n\\n\",\n );\n\n output.write(\"1/3 Item ID prefix\\n\");\n output.write(\n \"Prefix is prepended to generated IDs (for example pm-a1b2).\\n\",\n );\n const prefixAnswer = await rl.question(\n `Item ID prefix [${initialPrefix}]: `,\n );\n const resolvedPrefix =\n prefixAnswer.trim().length > 0\n ? normalizePrefix(prefixAnswer)\n : initialPrefix;\n\n output.write(\"\\n2/3 Governance preset\\n\");\n output.write(\n \"minimal: no ownership blocking, progressive create defaults, close validation off.\\n\",\n );\n output.write(\n \"default: ownership conflict warnings, progressive create defaults, close validation warn.\\n\",\n );\n output.write(\n \"strict: ownership blocking, strict create defaults, close validation strict.\\n\",\n );\n const presetAnswer = await rl.question(\n \"Governance preset [minimal/default/strict] (default: minimal): \",\n );\n const presetChoice =\n presetAnswer.trim().length > 0 ? presetAnswer.trim() : \"minimal\";\n // The wizard is forgiving: a typo'd/unknown preset defaults to minimal with a\n // notice instead of throwing and aborting an in-progress interactive setup.\n // normalizeInitGovernancePreset returns a concrete preset for valid input and\n // throws (never returns undefined) for invalid non-empty input, so the result is\n // always a BuiltinGovernancePreset on the success path.\n let resolvedPreset: BuiltinGovernancePreset = \"minimal\";\n try {\n resolvedPreset = normalizeInitGovernancePreset(\n presetChoice,\n ) as BuiltinGovernancePreset;\n } catch {\n output.write(\n `Unrecognized governance preset \"${presetChoice}\"; using minimal.\\n`,\n );\n }\n\n output.write(\"\\n3/3 Project telemetry\\n\");\n output.write(\n \"Telemetry helps improve reliability and can be disabled anytime via pm config.\\n\",\n );\n const telemetryLabel = telemetryDefault ? \"Y/n\" : \"y/N\";\n const telemetryAnswer = await rl.question(\n `Enable telemetry for this project? [${telemetryLabel}] `,\n );\n const telemetryEnabled = parseYesNoChoice(\n telemetryAnswer,\n telemetryDefault,\n );\n\n output.write(\"\\n\");\n return {\n prefix: resolvedPrefix,\n preset: resolvedPreset,\n telemetry_enabled: telemetryEnabled,\n };\n } finally {\n rl.close();\n }\n}\n\nfunction normalizeInitCommandOptions(\n options: InitCommandOptions,\n): InitNormalizedOptions {\n return {\n presetFromOption: normalizeInitGovernancePreset(options.preset),\n useDefaults: options.defaults === true,\n authorFromOption: normalizeOptionalInitAuthor(options.author),\n installBundledPackages: options.withPackages === true,\n agentGuidanceMode: normalizeInitAgentGuidanceMode(options.agentGuidance),\n typePreset: normalizeInitTypePreset(options.typePreset),\n };\n}\n\nfunction collectExistingSettingsPendingChanges(params: {\n settings: PmSettings;\n normalizedPrefix: string;\n prefixArg: string | undefined;\n presetFromOption: BuiltinGovernancePreset | undefined;\n authorFromOption: string | undefined;\n}): string[] {\n const pendingChanges: string[] = [];\n if (\n params.prefixArg !== undefined &&\n params.settings.id_prefix !== params.normalizedPrefix\n ) {\n pendingChanges.push(\"id_prefix\");\n }\n if (\n params.presetFromOption !== undefined &&\n params.settings.governance.preset !== params.presetFromOption\n ) {\n pendingChanges.push(\"governance_preset\");\n }\n if (\n params.authorFromOption !== undefined &&\n params.settings.author_default !== params.authorFromOption\n ) {\n pendingChanges.push(\"author_default\");\n }\n return pendingChanges;\n}\n\nfunction assertExistingSettingsUpdateAllowed(\n settingsPath: string,\n pendingChanges: string[],\n force: boolean,\n): void {\n if (pendingChanges.length === 0 || force) {\n return;\n }\n throw new PmCliError(\n `Refusing to update existing tracker settings at ${settingsPath} without --force.`,\n EXIT_CODE.USAGE,\n {\n code: \"init_existing_settings_requires_force\",\n type: \"urn:pm-cli:error:init_existing_settings_requires_force\",\n required: `--force for ${pendingChanges.join(\", \")}`,\n why: \"pm init is safe to rerun, but changing id prefix, governance preset, or default author on an existing tracker can corrupt long-lived project context when an agent meant to initialize a sandbox path.\",\n examples: [\n \"pm init --yes\",\n \"pm init ./sandbox-pm --yes\",\n \"pm init acme --yes --force\",\n ],\n nextSteps: [\n \"If you meant to initialize a sandbox tracker, pass a path-like positional such as ./sandbox-pm or /tmp/pm-test.\",\n \"If you intentionally want to rewrite this existing tracker's init-managed settings, rerun with --force.\",\n ],\n },\n );\n}\n\nfunction applyExistingSettingsUpdates(params: {\n settings: PmSettings;\n normalizedPrefix: string;\n prefixArg: string | undefined;\n presetFromOption: BuiltinGovernancePreset | undefined;\n authorFromOption: string | undefined;\n warnings: string[];\n}): boolean {\n let changed = false;\n if (\n params.prefixArg !== undefined &&\n params.settings.id_prefix !== params.normalizedPrefix\n ) {\n params.settings.id_prefix = params.normalizedPrefix;\n params.warnings.push(`updated:id_prefix:${params.normalizedPrefix}`);\n changed = true;\n }\n if (\n params.presetFromOption !== undefined &&\n params.settings.governance.preset !== params.presetFromOption\n ) {\n applyGovernancePreset(params.settings, params.presetFromOption);\n params.warnings.push(\n `updated:governance_preset:${params.presetFromOption}`,\n );\n changed = true;\n }\n if (\n params.authorFromOption !== undefined &&\n params.settings.author_default !== params.authorFromOption\n ) {\n params.settings.author_default = params.authorFromOption;\n params.warnings.push(`updated:author_default:${params.authorFromOption}`);\n changed = true;\n }\n return changed;\n}\n\nasync function loadExistingInitSettings(params: {\n pmRoot: string;\n settingsPath: string;\n normalizedPrefix: string;\n prefixArg: string | undefined;\n options: InitCommandOptions;\n normalizedOptions: InitNormalizedOptions;\n warnings: string[];\n}): Promise<InitSettingsResolution> {\n const settings = await readSettings(params.pmRoot);\n params.warnings.push(`already_exists:${params.settingsPath}`);\n const pendingChanges = collectExistingSettingsPendingChanges({\n settings,\n normalizedPrefix: params.normalizedPrefix,\n prefixArg: params.prefixArg,\n presetFromOption: params.normalizedOptions.presetFromOption,\n authorFromOption: params.normalizedOptions.authorFromOption,\n });\n assertExistingSettingsUpdateAllowed(\n params.settingsPath,\n pendingChanges,\n params.options.force === true,\n );\n if (\n applyExistingSettingsUpdates({\n settings,\n normalizedPrefix: params.normalizedPrefix,\n prefixArg: params.prefixArg,\n presetFromOption: params.normalizedOptions.presetFromOption,\n authorFromOption: params.normalizedOptions.authorFromOption,\n warnings: params.warnings,\n })\n ) {\n await writeSettings(params.pmRoot, settings);\n }\n return {\n settings,\n normalizedPrefix: params.normalizedPrefix,\n chosenPreset: params.normalizedOptions.presetFromOption,\n wizardUsed: false,\n };\n}\n\nasync function createNewInitSettings(params: {\n pmRoot: string;\n normalizedPrefix: string;\n normalizedOptions: InitNormalizedOptions;\n}): Promise<InitSettingsResolution> {\n let normalizedPrefix = params.normalizedPrefix;\n let chosenPreset = params.normalizedOptions.presetFromOption;\n let chosenTelemetryEnabled: boolean | undefined;\n let wizardUsed = false;\n if (\n params.normalizedOptions.presetFromOption === undefined &&\n !params.normalizedOptions.useDefaults &&\n process.stdin.isTTY === true &&\n process.stdout.isTTY === true\n ) {\n const wizardChoices = await runInitWizard(\n normalizedPrefix,\n SETTINGS_DEFAULTS.telemetry.enabled,\n );\n normalizedPrefix = wizardChoices.prefix;\n chosenPreset = wizardChoices.preset;\n chosenTelemetryEnabled = wizardChoices.telemetry_enabled;\n wizardUsed = true;\n }\n const effectivePreset = chosenPreset ?? \"minimal\";\n const settings = cloneDefaults();\n settings.id_prefix = normalizedPrefix;\n applyGovernancePreset(settings, effectivePreset);\n const environmentAuthor = process.env.PM_AUTHOR?.trim() || undefined;\n settings.author_default =\n params.normalizedOptions.authorFromOption ??\n environmentAuthor ??\n `${userInfo().username}@${hostname()}`;\n if (chosenTelemetryEnabled !== undefined) {\n settings.telemetry.enabled = chosenTelemetryEnabled;\n settings.telemetry.first_run_prompt_completed = true;\n }\n await writeSettings(params.pmRoot, settings);\n return {\n settings,\n normalizedPrefix,\n chosenPreset,\n wizardUsed,\n };\n}\n\nasync function resolveInitSettings(params: {\n pmRoot: string;\n settingsPath: string;\n settingsExists: boolean;\n normalizedPrefix: string;\n prefixArg: string | undefined;\n options: InitCommandOptions;\n normalizedOptions: InitNormalizedOptions;\n warnings: string[];\n}): Promise<InitSettingsResolution> {\n if (params.settingsExists) {\n return await loadExistingInitSettings(params);\n }\n return await createNewInitSettings({\n pmRoot: params.pmRoot,\n normalizedPrefix: params.normalizedPrefix,\n normalizedOptions: params.normalizedOptions,\n });\n}\n\nasync function applyInitAgentGuidance(params: {\n pmRoot: string;\n cwd: string;\n agentGuidanceMode: InitAgentGuidanceMode;\n settings: PmSettings;\n warnings: string[];\n}): Promise<InitAgentGuidanceResult> {\n const agentGuidanceResult = await runInitAgentGuidance({\n pm_root: params.pmRoot,\n cwd: params.cwd,\n mode: params.agentGuidanceMode,\n interactive: process.stdin.isTTY === true && process.stdout.isTTY === true,\n settings: params.settings,\n });\n params.warnings.push(...agentGuidanceResult.warnings);\n if (agentGuidanceResult.settings_changed) {\n await writeSettings(params.pmRoot, params.settings);\n }\n return {\n ...agentGuidanceResult.summary,\n next_steps: agentGuidanceResult.next_steps,\n };\n}\n\nasync function ensureInitRuntimeSchemaFiles(\n pmRoot: string,\n settings: PmSettings,\n): Promise<{\n createdDirs: string[];\n warnings: string[];\n}> {\n const createdDirs: string[] = [];\n const warnings: string[] = [];\n const runtimeSchemaScaffold = await ensureRuntimeSchemaFileScaffold(\n pmRoot,\n settings.schema,\n );\n for (const createdPath of runtimeSchemaScaffold.created_paths) {\n createdDirs.push(createdPath);\n warnings.push(\n ...(await runActiveOnWriteHooks({\n path: createdPath,\n scope: \"project\",\n op: \"init:runtime_schema_file\",\n })),\n );\n }\n return { createdDirs, warnings };\n}\n\nasync function maybeRegisterInitTypePreset(params: {\n pmRoot: string;\n settings: PmSettings;\n typePreset: InitTypePresetName | undefined;\n warnings: string[];\n}): Promise<InitRegisteredTypePresetSummary | undefined> {\n if (params.typePreset === undefined) {\n return undefined;\n }\n const registeredTypePreset = await registerInitTypePreset(\n params.pmRoot,\n params.settings,\n params.typePreset,\n );\n params.warnings.push(`registered_type_preset:${params.typePreset}`);\n params.warnings.push(\n ...(await runActiveOnWriteHooks({\n path: registeredTypePreset.file,\n scope: \"project\",\n op: \"init:type_preset\",\n })),\n );\n return registeredTypePreset;\n}\n\nasync function ensureInitTypeDirectories(params: {\n pmRoot: string;\n settings: PmSettings;\n createdDirs: string[];\n warnings: string[];\n}): Promise<void> {\n const typeRegistry = resolveItemTypeRegistry(\n params.settings,\n getActiveExtensionRegistrations(),\n );\n const customTypeFolders = typeRegistry.folders.filter(\n (folder) => !(PM_REQUIRED_SUBDIRS as readonly string[]).includes(folder),\n );\n const scaffold = await ensureInitDirectories(\n params.pmRoot,\n customTypeFolders,\n );\n params.createdDirs.push(...scaffold.createdDirs);\n params.warnings.push(...scaffold.warnings);\n}\n\nfunction resolveInitWorkspaceRoot(\n target: InitTargetResolution,\n): string | undefined {\n const trackerRoot = path.resolve(target.tracker_root);\n const agentsRoot = path.dirname(trackerRoot);\n if (\n path.basename(trackerRoot) === \"pm\" &&\n path.basename(agentsRoot) === \".agents\"\n ) {\n return path.dirname(agentsRoot);\n }\n return target.workspace_root;\n}\n\nasync function maybeInstallInitBundledPackages(\n installBundledPackages: boolean,\n global: GlobalOptions,\n pmRoot: string,\n warnings: string[],\n): Promise<InitInstalledPackagesSummary | undefined> {\n if (!installBundledPackages) {\n return undefined;\n }\n const packageInstallResult = await runExtension(\n \"all\",\n { install: true, project: true },\n { ...global, path: pmRoot },\n );\n warnings.push(...packageInstallResult.warnings);\n const installedPackages = summarizeInstalledPackages(packageInstallResult);\n const failedAliases = installedPackages.packages\n .filter((entry) => !entry.ok)\n .map((entry) => entry.alias);\n if (!installedPackages.installed_all || failedAliases.length > 0) {\n throw new PmCliError(\n `pm init --with-packages did not install all bundled packages successfully${failedAliases.length > 0 ? `: ${failedAliases.join(\", \")}` : \".\"}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n return installedPackages;\n}\n\nfunction buildInitNextSteps(params: {\n installBundledPackages: boolean;\n registeredTypePreset: InitRegisteredTypePresetSummary | undefined;\n agentGuidanceNextSteps: string[];\n target: InitTargetResolution;\n}): string[] {\n const pmCommand = (args: string[]): string =>\n renderPmCommand([\n ...(params.target.mode === \"workspace-discovery\"\n ? []\n : [\"--pm-path\", params.target.tracker_root]),\n ...args,\n ]);\n const nextSteps: string[] = [\n `Create your first item: ${pmCommand([\"create\", \"--type\", \"Task\", \"--title\", \"<title>\"])}`,\n `List active items: ${pmCommand([\"list\"])}`,\n `Get agent-friendly project context: ${pmCommand([\"context\"])}`,\n ];\n if (!params.installBundledPackages) {\n nextSteps.push(\n `Add optional packages for richer workflows: ${pmCommand([\"install\", \"calendar\", \"--project\"])}, ${pmCommand([\"install\", \"templates\", \"--project\"])}, ${pmCommand([\"install\", \"guide-shell\", \"--project\"])}`,\n );\n nextSteps.push(\n `Or install everything bundled: ${pmCommand([\"init\", \"--with-packages\"])} (idempotent on re-run)`,\n );\n } else {\n nextSteps.push(\n `Explore newly-available commands: ${pmCommand([\"cal\"])}, ${pmCommand([\"templates\"])}, ${pmCommand([\"guide\"])}`,\n );\n }\n if (params.registeredTypePreset) {\n nextSteps.push(\n `Inspect registered preset types: ${pmCommand([\"schema\", \"list\"])}, ${pmCommand([\"schema\", \"show\", params.registeredTypePreset.registered[0] ?? params.registeredTypePreset.updated[0]])}`,\n );\n }\n nextSteps.push(\n \"Set PM_AUTHOR=<your-agent-id> so mutations attribute to the right caller.\",\n );\n for (const guidanceNextStep of params.agentGuidanceNextSteps) {\n const scopedGuidance =\n params.target.mode === \"workspace-discovery\"\n ? guidanceNextStep\n : guidanceNextStep.replace(\n /\\bpm (?=[a-z])/g,\n () => `${pmCommand([])} `,\n );\n if (!nextSteps.includes(scopedGuidance)) {\n nextSteps.push(scopedGuidance);\n }\n }\n return nextSteps;\n}\n\n/** Implements run init for the public runtime surface of this module. */\nexport async function runInit(\n prefixArg: string | undefined,\n global: GlobalOptions,\n options: InitCommandOptions = {},\n): Promise<InitResult> {\n const cwd = process.cwd();\n const invocation = resolveInitInvocation(\n cwd,\n global,\n prefixArg,\n options.workspace,\n );\n const pmRoot = invocation.pmRoot;\n prefixArg = resolveInitPrefixInput(invocation.prefixArg, options.idPrefix);\n const normalizedOptions = normalizeInitCommandOptions(options);\n await assertExplicitTrackerPathIsNotWorkspaceRoot(\n pmRoot,\n invocation.target.mode === \"tracker-path\",\n options.force === true,\n );\n const createdDirs: string[] = [];\n const warnings: string[] = [];\n const baseDirs = await ensureInitDirectories(pmRoot, PM_REQUIRED_SUBDIRS);\n createdDirs.push(...baseDirs.createdDirs);\n warnings.push(...baseDirs.warnings);\n\n const settingsPath = path.join(pmRoot, \"settings.json\");\n const settingsExists = await pathExists(settingsPath);\n const settingsResolution = await resolveInitSettings({\n pmRoot,\n settingsPath,\n settingsExists,\n normalizedPrefix: normalizePrefix(prefixArg),\n prefixArg,\n options,\n normalizedOptions,\n warnings,\n });\n let { settings } = settingsResolution;\n\n const workspaceRoot = resolveInitWorkspaceRoot(invocation.target);\n const agentGuidance = await applyInitAgentGuidance({\n pmRoot,\n cwd: workspaceRoot ?? cwd,\n agentGuidanceMode: normalizedOptions.agentGuidanceMode,\n settings,\n warnings,\n });\n\n const schemaFiles = await ensureInitRuntimeSchemaFiles(pmRoot, settings);\n createdDirs.push(...schemaFiles.createdDirs);\n warnings.push(...schemaFiles.warnings);\n\n const registeredTypePreset = await maybeRegisterInitTypePreset({\n pmRoot,\n settings,\n typePreset: normalizedOptions.typePreset,\n warnings,\n });\n if (registeredTypePreset) {\n settings = await readSettings(pmRoot);\n }\n\n await ensureInitTypeDirectories({ pmRoot, settings, createdDirs, warnings });\n if (workspaceRoot) {\n const gitignore = await ensurePmGitignore(workspaceRoot);\n if (gitignore.changed) {\n warnings.push(`updated:gitignore:${gitignore.path}`);\n }\n }\n const installedPackages = await maybeInstallInitBundledPackages(\n normalizedOptions.installBundledPackages,\n global,\n pmRoot,\n warnings,\n );\n\n const nextSteps = buildInitNextSteps({\n installBundledPackages: normalizedOptions.installBundledPackages,\n registeredTypePreset,\n agentGuidanceNextSteps: agentGuidance.next_steps,\n target: invocation.target,\n });\n\n return {\n ok: true,\n path: pmRoot,\n target: invocation.target,\n settings,\n created_dirs: createdDirs,\n warnings,\n governance_preset: settings.governance.preset,\n wizard_used: settingsResolution.wizardUsed,\n ...(registeredTypePreset\n ? { registered_type_preset: registeredTypePreset }\n : {}),\n ...(installedPackages ? { installed_packages: installedPackages } : {}),\n next_steps: nextSteps,\n agent_guidance: agentGuidance,\n };\n}\n"],"names":[],"mappings":"AAAA;;;;GAIG;;;AACH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EACL,+BAA+B,EAC/B,q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,CAAC,sBAAsB,EACxC,MAAM,EACN,MAAM,EACN,QAAQ,CACT,CAAC;IAEF,MAAM,SAAS,GAAG,kBAAkB,CAAC;QACnC,sBAAsB,EAAE,iBAAiB,CAAC,sBAAsB;QAChE,oBAAoB;QACpB,sBAAsB,EAAE,aAAa,CAAC,UAAU;QAChD,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC,CAAC;IAEH,OAAO;QACL,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,QAAQ;QACR,YAAY,EAAE,WAAW;QACzB,QAAQ;QACR,iBAAiB,EAAE,QAAQ,CAAC,UAAU,CAAC,MAAM;QAC7C,WAAW,EAAE,kBAAkB,CAAC,UAAU;QAC1C,GAAG,CAAC,oBAAoB;YACtB,CAAC,CAAC,EAAE,sBAAsB,EAAE,oBAAoB,EAAE;YAClD,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvE,UAAU,EAAE,SAAS;QACrB,cAAc,EAAE,aAAa;KAC9B,CAAC;AACJ,CAAC","debugId":"ed32382f-d4ec-574c-98ac-7d6537090dad"}
@@ -0,0 +1,2 @@
1
+ /** Apply an optional author override and return an idempotent environment restorer. */
2
+ export declare function applyInvocationAuthorOverride(author: string | undefined): () => void;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @module sdk/invocation-author
3
+ *
4
+ * Safely scopes invocation-wide mutation authors for one-shot and embedded CLI hosts.
5
+ */
6
+
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="83b4c8c6-db52-50a9-8bf7-97ed382927d6")}catch(e){}}();
8
+ import { EXIT_CODE } from "../core/shared/constants.js";
9
+ import { PmCliError } from "../core/shared/errors.js";
10
+ /** Apply an optional author override and return an idempotent environment restorer. */
11
+ export function applyInvocationAuthorOverride(author) {
12
+ if (author === undefined) {
13
+ return () => { };
14
+ }
15
+ const normalizedAuthor = author.trim();
16
+ if (normalizedAuthor.length === 0) {
17
+ throw new PmCliError("--author requires a non-empty value.", EXIT_CODE.USAGE, {
18
+ code: "missing_required_argument",
19
+ nextSteps: ["Pass an explicit author identifier with --author <id>."],
20
+ });
21
+ }
22
+ const previousAuthor = process.env.PM_AUTHOR;
23
+ process.env.PM_AUTHOR = normalizedAuthor;
24
+ let restored = false;
25
+ return () => {
26
+ if (restored) {
27
+ return;
28
+ }
29
+ restored = true;
30
+ if (previousAuthor === undefined) {
31
+ delete process.env.PM_AUTHOR;
32
+ }
33
+ else {
34
+ process.env.PM_AUTHOR = previousAuthor;
35
+ }
36
+ };
37
+ }
38
+ //# sourceMappingURL=invocation-author.js.map
39
+ //# debugId=83b4c8c6-db52-50a9-8bf7-97ed382927d6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invocation-author.js","sources":["sdk/invocation-author.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/invocation-author\n *\n * Safely scopes invocation-wide mutation authors for one-shot and embedded CLI hosts.\n */\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\n\n/** Apply an optional author override and return an idempotent environment restorer. */\nexport function applyInvocationAuthorOverride(\n author: string | undefined,\n): () => void {\n if (author === undefined) {\n return () => {};\n }\n const normalizedAuthor = author.trim();\n if (normalizedAuthor.length === 0) {\n throw new PmCliError(\n \"--author requires a non-empty value.\",\n EXIT_CODE.USAGE,\n {\n code: \"missing_required_argument\",\n nextSteps: [\"Pass an explicit author identifier with --author <id>.\"],\n },\n );\n }\n const previousAuthor = process.env.PM_AUTHOR;\n process.env.PM_AUTHOR = normalizedAuthor;\n let restored = false;\n return () => {\n if (restored) {\n return;\n }\n restored = true;\n if (previousAuthor === undefined) {\n delete process.env.PM_AUTHOR;\n } else {\n process.env.PM_AUTHOR = previousAuthor;\n }\n };\n}\n"],"names":[],"mappings":"AAAA;;;;GAIG;;;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,uFAAuF;AACvF,MAAM,UAAU,6BAA6B,CAC3C,MAA0B;IAE1B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IACvC,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,UAAU,CAClB,sCAAsC,EACtC,SAAS,CAAC,KAAK,EACf;YACE,IAAI,EAAE,2BAA2B;YACjC,SAAS,EAAE,CAAC,wDAAwD,CAAC;SACtE,CACF,CAAC;IACJ,CAAC;IACD,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,gBAAgB,CAAC;IACzC,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,OAAO,GAAG,EAAE;QACV,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QACD,QAAQ,GAAG,IAAI,CAAC;QAChB,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,cAAc,CAAC;QACzC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC","debugId":"83b4c8c6-db52-50a9-8bf7-97ed382927d6"}
@@ -0,0 +1,45 @@
1
+ import type { RuntimeStatusRegistry } from "../core/schema/runtime-schema.js";
2
+ import type { ItemMetadata } from "../types/index.js";
3
+ /** Maximum corpus rows inspected by one child projection. */
4
+ export declare const MAX_CHILD_PROJECTION_ITEMS = 1000000;
5
+ /** Default number of child summaries retained inline. */
6
+ export declare const DEFAULT_CHILD_SAMPLE_LIMIT = 20;
7
+ /** Stable compact child row embedded in a parent read. */
8
+ export interface ChildRollupSample {
9
+ /** Stable child identifier. */
10
+ id: string;
11
+ /** Human-readable child title. */
12
+ title: string;
13
+ /** Schema type of the child item. */
14
+ type: string;
15
+ /** Current lifecycle status of the child item. */
16
+ status: string;
17
+ /** Current priority of the child item. */
18
+ priority: number;
19
+ }
20
+ /** Bounded direct-child summary shared across SDK and presentation surfaces. */
21
+ export interface ChildRollupContext {
22
+ /** Total direct children discovered. */
23
+ count: number;
24
+ /** Direct children whose statuses are non-terminal. */
25
+ active: number;
26
+ /** Counts grouped by normalized lifecycle status. */
27
+ by_status: Record<string, number>;
28
+ /** Deterministic id-sorted inline sample. */
29
+ sample: ChildRollupSample[];
30
+ /** Configured maximum sample size. */
31
+ sample_limit: number;
32
+ /** Whether additional children exist beyond the inline sample. */
33
+ truncated: boolean;
34
+ /** Offset for the next page, or null when the sample is complete. */
35
+ next_offset: number | null;
36
+ /** Token-efficient CLI continuation command, or null when complete. */
37
+ continuation: string | null;
38
+ /** Number of corpus rows inspected to produce this projection. */
39
+ scanned: number;
40
+ }
41
+ /**
42
+ * Build a type-agnostic child rollup from indexed or source metadata. Input is
43
+ * capped at one million rows to keep custom-host behavior explicitly bounded.
44
+ */
45
+ export declare function buildItemChildrenRollup(parentId: string, corpus: Iterable<ItemMetadata>, statusRegistry: RuntimeStatusRegistry, sampleLimit?: number): ChildRollupContext;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @module sdk/item-children
3
+ *
4
+ * Builds deterministic, bounded direct-child projections for every item type.
5
+ * The primitive accepts metadata from either the persistent derived index or a
6
+ * source scan, allowing CLI, MCP, packages, and custom hosts to share one graph
7
+ * projection contract.
8
+ */
9
+
10
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f87417b5-010c-5fed-9b38-782ac4bd7b3b")}catch(e){}}();
11
+ import { isTerminalStatus } from "../core/item/status.js";
12
+ import { EXIT_CODE } from "../core/shared/constants.js";
13
+ import { PmCliError } from "../core/shared/errors.js";
14
+ /** Maximum corpus rows inspected by one child projection. */
15
+ export const MAX_CHILD_PROJECTION_ITEMS = 1_000_000;
16
+ /** Default number of child summaries retained inline. */
17
+ export const DEFAULT_CHILD_SAMPLE_LIMIT = 20;
18
+ /**
19
+ * Build a type-agnostic child rollup from indexed or source metadata. Input is
20
+ * capped at one million rows to keep custom-host behavior explicitly bounded.
21
+ */
22
+ export function buildItemChildrenRollup(parentId, corpus, statusRegistry, sampleLimit = DEFAULT_CHILD_SAMPLE_LIMIT) {
23
+ if (!Number.isSafeInteger(sampleLimit) || sampleLimit < 0) {
24
+ throw new PmCliError("Child projection sample limit must be a non-negative integer.", EXIT_CODE.USAGE);
25
+ }
26
+ const normalizedParentId = parentId.trim().toLowerCase();
27
+ const byStatus = {};
28
+ const children = [];
29
+ let active = 0;
30
+ let scanned = 0;
31
+ for (const candidate of corpus) {
32
+ scanned += 1;
33
+ if (scanned > MAX_CHILD_PROJECTION_ITEMS) {
34
+ throw new PmCliError(`Child projection exceeded the ${MAX_CHILD_PROJECTION_ITEMS.toLocaleString("en-US")} item safety bound.`, EXIT_CODE.GENERIC_FAILURE, {
35
+ code: "child_projection_item_bound_exceeded",
36
+ required: "Use an indexed or parent-filtered metadata source.",
37
+ why: "Unbounded graph scans can exhaust memory in universal project stores.",
38
+ nextSteps: ["Build the derived item index, then retry the parent read."],
39
+ });
40
+ }
41
+ if (candidate.parent?.trim().toLowerCase() !== normalizedParentId) {
42
+ continue;
43
+ }
44
+ children.push(candidate);
45
+ const status = candidate.status.trim().toLowerCase();
46
+ byStatus[status] = (byStatus[status] ?? 0) + 1;
47
+ if (!isTerminalStatus(status, statusRegistry)) {
48
+ active += 1;
49
+ }
50
+ }
51
+ children.sort((left, right) => left.id.localeCompare(right.id));
52
+ const sample = children.slice(0, sampleLimit).map((child) => ({
53
+ id: child.id,
54
+ title: child.title,
55
+ type: child.type,
56
+ status: child.status,
57
+ priority: child.priority,
58
+ }));
59
+ const truncated = children.length > sample.length;
60
+ return {
61
+ count: children.length,
62
+ active,
63
+ by_status: Object.fromEntries(Object.entries(byStatus).sort(([left], [right]) => left.localeCompare(right))),
64
+ sample,
65
+ sample_limit: sampleLimit,
66
+ truncated,
67
+ next_offset: truncated ? sample.length : null,
68
+ continuation: truncated
69
+ ? `pm list --status all --parent ${parentId} --offset ${sample.length} --limit ${sampleLimit}`
70
+ : null,
71
+ scanned,
72
+ };
73
+ }
74
+ //# sourceMappingURL=item-children.js.map
75
+ //# debugId=f87417b5-010c-5fed-9b38-782ac4bd7b3b
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-children.js","sources":["sdk/item-children.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/item-children\n *\n * Builds deterministic, bounded direct-child projections for every item type.\n * The primitive accepts metadata from either the persistent derived index or a\n * source scan, allowing CLI, MCP, packages, and custom hosts to share one graph\n * projection contract.\n */\nimport { isTerminalStatus } from \"../core/item/status.js\";\nimport type { RuntimeStatusRegistry } from \"../core/schema/runtime-schema.js\";\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport type { ItemMetadata } from \"../types/index.js\";\n\n/** Maximum corpus rows inspected by one child projection. */\nexport const MAX_CHILD_PROJECTION_ITEMS = 1_000_000;\n/** Default number of child summaries retained inline. */\nexport const DEFAULT_CHILD_SAMPLE_LIMIT = 20;\n\n/** Stable compact child row embedded in a parent read. */\nexport interface ChildRollupSample {\n /** Stable child identifier. */\n id: string;\n /** Human-readable child title. */\n title: string;\n /** Schema type of the child item. */\n type: string;\n /** Current lifecycle status of the child item. */\n status: string;\n /** Current priority of the child item. */\n priority: number;\n}\n\n/** Bounded direct-child summary shared across SDK and presentation surfaces. */\nexport interface ChildRollupContext {\n /** Total direct children discovered. */\n count: number;\n /** Direct children whose statuses are non-terminal. */\n active: number;\n /** Counts grouped by normalized lifecycle status. */\n by_status: Record<string, number>;\n /** Deterministic id-sorted inline sample. */\n sample: ChildRollupSample[];\n /** Configured maximum sample size. */\n sample_limit: number;\n /** Whether additional children exist beyond the inline sample. */\n truncated: boolean;\n /** Offset for the next page, or null when the sample is complete. */\n next_offset: number | null;\n /** Token-efficient CLI continuation command, or null when complete. */\n continuation: string | null;\n /** Number of corpus rows inspected to produce this projection. */\n scanned: number;\n}\n\n/**\n * Build a type-agnostic child rollup from indexed or source metadata. Input is\n * capped at one million rows to keep custom-host behavior explicitly bounded.\n */\nexport function buildItemChildrenRollup(\n parentId: string,\n corpus: Iterable<ItemMetadata>,\n statusRegistry: RuntimeStatusRegistry,\n sampleLimit = DEFAULT_CHILD_SAMPLE_LIMIT,\n): ChildRollupContext {\n if (!Number.isSafeInteger(sampleLimit) || sampleLimit < 0) {\n throw new PmCliError(\n \"Child projection sample limit must be a non-negative integer.\",\n EXIT_CODE.USAGE,\n );\n }\n const normalizedParentId = parentId.trim().toLowerCase();\n const byStatus: Record<string, number> = {};\n const children: ItemMetadata[] = [];\n let active = 0;\n let scanned = 0;\n for (const candidate of corpus) {\n scanned += 1;\n if (scanned > MAX_CHILD_PROJECTION_ITEMS) {\n throw new PmCliError(\n `Child projection exceeded the ${MAX_CHILD_PROJECTION_ITEMS.toLocaleString(\"en-US\")} item safety bound.`,\n EXIT_CODE.GENERIC_FAILURE,\n {\n code: \"child_projection_item_bound_exceeded\",\n required: \"Use an indexed or parent-filtered metadata source.\",\n why: \"Unbounded graph scans can exhaust memory in universal project stores.\",\n nextSteps: [\"Build the derived item index, then retry the parent read.\"],\n },\n );\n }\n if (candidate.parent?.trim().toLowerCase() !== normalizedParentId) {\n continue;\n }\n children.push(candidate);\n const status = candidate.status.trim().toLowerCase();\n byStatus[status] = (byStatus[status] ?? 0) + 1;\n if (!isTerminalStatus(status, statusRegistry)) {\n active += 1;\n }\n }\n children.sort((left, right) => left.id.localeCompare(right.id));\n const sample = children.slice(0, sampleLimit).map((child) => ({\n id: child.id,\n title: child.title,\n type: child.type,\n status: child.status,\n priority: child.priority,\n }));\n const truncated = children.length > sample.length;\n return {\n count: children.length,\n active,\n by_status: Object.fromEntries(\n Object.entries(byStatus).sort(([left], [right]) => left.localeCompare(right)),\n ),\n sample,\n sample_limit: sampleLimit,\n truncated,\n next_offset: truncated ? sample.length : null,\n continuation: truncated\n ? `pm list --status all --parent ${parentId} --offset ${sample.length} --limit ${sampleLimit}`\n : null,\n scanned,\n };\n}\n"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,0BAA0B,GAAG,SAAS,CAAC;AACpD,yDAAyD;AACzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAsC7C;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,QAAgB,EAChB,MAA8B,EAC9B,cAAqC,EACrC,WAAW,GAAG,0BAA0B;IAExC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,UAAU,CAClB,+DAA+D,EAC/D,SAAS,CAAC,KAAK,CAChB,CAAC;IACJ,CAAC;IACD,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACzD,MAAM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AG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC5D,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC,CAAC;IACJ,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAClD,OAAO;QACL,KAAK,EAAE,QAAQ,CAAC,MAAM;QACtB,MAAM;QACN,SAAS,EAAE,MAAM,CAAC,WAAW,CAC3B,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAC9E;QACD,MAAM;QACN,YAAY,EAAE,WAAW;QACzB,SAAS;QACT,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;QAC7C,YAAY,EAAE,SAAS;YACrB,CAAC,CAAC,iCAAiC,QAAQ,aAAa,MAAM,CAAC,MAAM,YAAY,WAAW,EAAE;YAC9F,CAAC,CAAC,IAAI;QACR,OAAO;KACR,CAAC;AACJ,CAAC","debugId":"f87417b5-010c-5fed-9b38-782ac4bd7b3b"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @module sdk/item-schedule
3
+ *
4
+ * Normalizes scheduling metadata into one stable read facet so scheduled item
5
+ * types remain useful through generic SDK, CLI, MCP, JSON, and TOON reads.
6
+ */
7
+ import type { CalendarEvent, ItemMetadata, Reminder } from "../types/index.js";
8
+ /** Schedule projection attached to standard and deep item reads. */
9
+ export interface ItemScheduleContext {
10
+ /** Item deadline when present. */
11
+ deadline: string | null;
12
+ /** Earliest event start, convenient for single-event consumers. */
13
+ start_at: string | null;
14
+ /** End of the earliest event when present. */
15
+ end_at: string | null;
16
+ /** Location of the earliest event when present. */
17
+ location: string | null;
18
+ /** All configured reminders. */
19
+ reminders: Reminder[];
20
+ /** All configured events ordered by start timestamp. */
21
+ events: CalendarEvent[];
22
+ }
23
+ /** Return whether an item carries or semantically represents schedule data. */
24
+ export declare function itemHasSchedule(item: ItemMetadata): boolean;
25
+ /** Build a deterministic schedule facet, or undefined for unscheduled items. */
26
+ export declare function buildItemSchedule(item: ItemMetadata): ItemScheduleContext | undefined;
@@ -0,0 +1,28 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="35561e52-7bf5-5bb2-b899-c0b0dbe88c8a")}catch(e){}}();
3
+ const BUILTIN_SCHEDULE_TYPES = new Set(["event", "meeting", "reminder"]);
4
+ /** Return whether an item carries or semantically represents schedule data. */
5
+ export function itemHasSchedule(item) {
6
+ return (BUILTIN_SCHEDULE_TYPES.has(item.type.trim().toLowerCase()) ||
7
+ item.deadline !== undefined ||
8
+ (item.reminders?.length ?? 0) > 0 ||
9
+ (item.events?.length ?? 0) > 0);
10
+ }
11
+ /** Build a deterministic schedule facet, or undefined for unscheduled items. */
12
+ export function buildItemSchedule(item) {
13
+ if (!itemHasSchedule(item)) {
14
+ return undefined;
15
+ }
16
+ const events = [...(item.events ?? [])].sort((left, right) => left.start_at.localeCompare(right.start_at));
17
+ const primary = events[0];
18
+ return {
19
+ deadline: item.deadline ?? null,
20
+ start_at: primary?.start_at ?? null,
21
+ end_at: primary?.end_at ?? null,
22
+ location: primary?.location ?? null,
23
+ reminders: [...(item.reminders ?? [])],
24
+ events,
25
+ };
26
+ }
27
+ //# sourceMappingURL=item-schedule.js.map
28
+ //# debugId=35561e52-7bf5-5bb2-b899-c0b0dbe88c8a
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-schedule.js","sources":["sdk/item-schedule.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/item-schedule\n *\n * Normalizes scheduling metadata into one stable read facet so scheduled item\n * types remain useful through generic SDK, CLI, MCP, JSON, and TOON reads.\n */\nimport type { CalendarEvent, ItemMetadata, Reminder } from \"../types/index.js\";\n\nconst BUILTIN_SCHEDULE_TYPES = new Set([\"event\", \"meeting\", \"reminder\"]);\n\n/** Schedule projection attached to standard and deep item reads. */\nexport interface ItemScheduleContext {\n /** Item deadline when present. */\n deadline: string | null;\n /** Earliest event start, convenient for single-event consumers. */\n start_at: string | null;\n /** End of the earliest event when present. */\n end_at: string | null;\n /** Location of the earliest event when present. */\n location: string | null;\n /** All configured reminders. */\n reminders: Reminder[];\n /** All configured events ordered by start timestamp. */\n events: CalendarEvent[];\n}\n\n/** Return whether an item carries or semantically represents schedule data. */\nexport function itemHasSchedule(item: ItemMetadata): boolean {\n return (\n BUILTIN_SCHEDULE_TYPES.has(item.type.trim().toLowerCase()) ||\n item.deadline !== undefined ||\n (item.reminders?.length ?? 0) > 0 ||\n (item.events?.length ?? 0) > 0\n );\n}\n\n/** Build a deterministic schedule facet, or undefined for unscheduled items. */\nexport function buildItemSchedule(\n item: ItemMetadata,\n): ItemScheduleContext | undefined {\n if (!itemHasSchedule(item)) {\n return undefined;\n }\n const events = [...(item.events ?? [])].sort((left, right) =>\n left.start_at.localeCompare(right.start_at),\n );\n const primary = events[0];\n return {\n deadline: item.deadline ?? null,\n start_at: primary?.start_at ?? null,\n end_at: primary?.end_at ?? null,\n location: primary?.location ?? null,\n reminders: [...(item.reminders ?? [])],\n events,\n };\n}\n"],"names":[],"mappings":";;AAQA,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAkBzE,+EAA+E;AAC/E,MAAM,UAAU,eAAe,CAAC,IAAkB;IAChD,OAAO,CACL,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC1D,IAAI,CAAC,QAAQ,KAAK,SAAS;QAC3B,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC;QACjC,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAC/B,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,iBAAiB,CAC/B,IAAkB;IAElB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAC3D,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAC5C,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI;QAC/B,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,IAAI;QACnC,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,IAAI;QAC/B,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,IAAI;QACnC,SAAS,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QACtC,MAAM;KACP,CAAC;AACJ,CAAC","debugId":"35561e52-7bf5-5bb2-b899-c0b0dbe88c8a"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @module sdk/output
3
+ *
4
+ * Defines public output-control primitives for extension commands, exporters,
5
+ * renderers, and custom SDK-built hosts.
6
+ */
7
+ export { SUPPRESS_HOST_OUTPUT_MARKER, isHostOutputSuppressed, suppressHostOutput, type SuppressedHostOutput, } from "../core/output/output-control.js";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @module sdk/output
3
+ *
4
+ * Defines public output-control primitives for extension commands, exporters,
5
+ * renderers, and custom SDK-built hosts.
6
+ */
7
+
8
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fee22fbe-b4a1-5524-9df1-7be06fb07427")}catch(e){}}();
9
+ export { SUPPRESS_HOST_OUTPUT_MARKER, isHostOutputSuppressed, suppressHostOutput, } from "../core/output/output-control.js";
10
+ //# sourceMappingURL=output.js.map
11
+ //# debugId=fee22fbe-b4a1-5524-9df1-7be06fb07427
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sources":["sdk/output.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/output\n *\n * Defines public output-control primitives for extension commands, exporters,\n * renderers, and custom SDK-built hosts.\n */\n\nexport {\n SUPPRESS_HOST_OUTPUT_MARKER,\n isHostOutputSuppressed,\n suppressHostOutput,\n type SuppressedHostOutput,\n} from \"../core/output/output-control.js\";\n"],"names":[],"mappings":"AAAA;;;;;GAKG;;;AAEH,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC","debugId":"fee22fbe-b4a1-5524-9df1-7be06fb07427"}
@@ -4,6 +4,8 @@ export interface QueryCursorState {
4
4
  after_id: string;
5
5
  /** Zero-based position of that row when the producer supplied one. */
6
6
  after_index?: number;
7
+ /** Opaque producer-defined snapshot token for stable continuation. */
8
+ snapshot?: string;
7
9
  }
8
10
  /** Describes one stable cursor page over an already ordered query result. */
9
11
  export interface QueryCursorPage<T> {
@@ -17,7 +19,7 @@ export interface QueryCursorPage<T> {
17
19
  /** Build a compact deterministic fingerprint for a normalized query contract. */
18
20
  export declare function createQueryFingerprint(command: string, contract: unknown): string;
19
21
  /** Encode the last emitted item id into a versioned opaque base64url cursor. */
20
- export declare function encodeQueryCursor(fingerprint: string, afterId: string, afterIndex?: number): string;
22
+ export declare function encodeQueryCursor(fingerprint: string, afterId: string, afterIndex?: number, snapshot?: string): string;
21
23
  /** Decode and validate complete cursor state against a query fingerprint. */
22
24
  export declare function decodeQueryCursorState(cursor: unknown, expectedFingerprint: string): QueryCursorState;
23
25
  /** Decode and validate a cursor against the normalized query fingerprint. */
@@ -30,6 +32,7 @@ export declare function paginateQueryRows<T>(rows: readonly T[], options: {
30
32
  fingerprint: string;
31
33
  limit: number;
32
34
  readId: (row: T) => string;
35
+ snapshot?: string;
33
36
  }): QueryCursorPage<T>;
34
37
  /** Public pagination constants exposed for package authors and contract tests. */
35
38
  export declare const QUERY_CURSOR_CONTRACT: Readonly<{
@@ -5,7 +5,7 @@
5
5
  * package-authored query surfaces.
6
6
  */
7
7
 
8
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e54101f6-9f6a-502a-b8ef-055c289fb0a8")}catch(e){}}();
8
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2c6ee84c-c55a-545d-a75b-4024c4820ef8")}catch(e){}}();
9
9
  import { createHash } from "node:crypto";
10
10
  import { PmCliError } from "../core/shared/errors.js";
11
11
  import { EXIT_CODE } from "../core/shared/constants.js";
@@ -23,12 +23,13 @@ export function createQueryFingerprint(command, contract) {
23
23
  .slice(0, 24);
24
24
  }
25
25
  /** Encode the last emitted item id into a versioned opaque base64url cursor. */
26
- export function encodeQueryCursor(fingerprint, afterId, afterIndex) {
26
+ export function encodeQueryCursor(fingerprint, afterId, afterIndex, snapshot) {
27
27
  return Buffer.from(JSON.stringify({
28
28
  version: QUERY_CURSOR_VERSION,
29
29
  fingerprint,
30
30
  after_id: afterId,
31
31
  ...(afterIndex === undefined ? {} : { after_index: afterIndex }),
32
+ ...(snapshot === undefined ? {} : { snapshot }),
32
33
  })).toString("base64url");
33
34
  }
34
35
  function invalidCursor(message) {
@@ -51,7 +52,9 @@ function isQueryCursorEnvelope(value) {
51
52
  envelope.after_id.length > 0 &&
52
53
  (envelope.after_index === undefined ||
53
54
  (Number.isSafeInteger(envelope.after_index) &&
54
- envelope.after_index >= 0)));
55
+ envelope.after_index >= 0)) &&
56
+ (envelope.snapshot === undefined ||
57
+ (typeof envelope.snapshot === "string" && envelope.snapshot.length > 0)));
55
58
  }
56
59
  /** Decode and validate complete cursor state against a query fingerprint. */
57
60
  export function decodeQueryCursorState(cursor, expectedFingerprint) {
@@ -83,6 +86,7 @@ export function decodeQueryCursorState(cursor, expectedFingerprint) {
83
86
  ...(envelope.after_index === undefined
84
87
  ? {}
85
88
  : { after_index: envelope.after_index }),
89
+ ...(envelope.snapshot === undefined ? {} : { snapshot: envelope.snapshot }),
86
90
  };
87
91
  }
88
92
  /** Decode and validate a cursor against the normalized query fingerprint. */
@@ -106,6 +110,10 @@ export function resolveQueryCursorStart(rows, cursor, fingerprint, readId) {
106
110
  }
107
111
  /** Page an ordered result through the shared stable cursor contract. */
108
112
  export function paginateQueryRows(rows, options) {
113
+ if (options.cursor !== undefined &&
114
+ decodeQueryCursorState(options.cursor, options.fingerprint).snapshot !==
115
+ options.snapshot)
116
+ throw invalidCursor("Query cursor does not match the requested snapshot.");
109
117
  const pageStart = resolveQueryCursorStart(rows, options.cursor, options.fingerprint, options.readId);
110
118
  const pageRows = rows.slice(pageStart, pageStart + options.limit);
111
119
  const hasMore = pageRows.length > 0 && pageStart + pageRows.length < rows.length;
@@ -115,7 +123,7 @@ export function paginateQueryRows(rows, options) {
115
123
  has_more: hasMore,
116
124
  ...(hasMore && lastRow !== undefined
117
125
  ? {
118
- next_cursor: encodeQueryCursor(options.fingerprint, options.readId(lastRow), pageStart + pageRows.length - 1),
126
+ next_cursor: encodeQueryCursor(options.fingerprint, options.readId(lastRow), pageStart + pageRows.length - 1, options.snapshot),
119
127
  }
120
128
  : {}),
121
129
  };
@@ -126,4 +134,4 @@ export const QUERY_CURSOR_CONTRACT = Object.freeze({
126
134
  max_length: MAX_CURSOR_LENGTH,
127
135
  });
128
136
  //# sourceMappingURL=pagination.js.map
129
- //# debugId=e54101f6-9f6a-502a-b8ef-055c289fb0a8
137
+ //# debugId=2c6ee84c-c55a-545d-a75b-4024c4820ef8
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","sources":["sdk/pagination.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/pagination\n *\n * Provides versioned opaque cursor primitives shared by CLI, SDK, MCP, and\n * package-authored query surfaces.\n */\nimport { createHash } from \"node:crypto\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { stableStringify } from \"../core/shared/serialization.js\";\n\nconst QUERY_CURSOR_VERSION = 1;\nconst MAX_CURSOR_LENGTH = 4096;\nconst BASE64URL_PATTERN = /^[A-Za-z0-9_-]+$/;\n\ninterface QueryCursorEnvelope {\n version: number;\n fingerprint: string;\n after_id: string;\n after_index?: number;\n}\n\n/** Decoded cursor state for advanced package and retrieval-window integrations. */\nexport interface QueryCursorState {\n /** Stable id of the last row emitted by the previous page. */\n after_id: string;\n /** Zero-based position of that row when the producer supplied one. */\n after_index?: number;\n}\n\n/** Describes one stable cursor page over an already ordered query result. */\nexport interface QueryCursorPage<T> {\n /** Rows contained in the requested page. */\n rows: T[];\n /** Whether another page exists after these rows. */\n has_more: boolean;\n /** Opaque cursor for the next page when one exists. */\n next_cursor?: string;\n}\n\n/** Build a compact deterministic fingerprint for a normalized query contract. */\nexport function createQueryFingerprint(\n command: string,\n contract: unknown,\n): string {\n return createHash(\"sha256\")\n .update(command)\n .update(\"\\0\")\n .update(stableStringify(contract))\n .digest(\"hex\")\n .slice(0, 24);\n}\n\n/** Encode the last emitted item id into a versioned opaque base64url cursor. */\nexport function encodeQueryCursor(\n fingerprint: string,\n afterId: string,\n afterIndex?: number,\n): string {\n return Buffer.from(\n JSON.stringify({\n version: QUERY_CURSOR_VERSION,\n fingerprint,\n after_id: afterId,\n ...(afterIndex === undefined ? {} : { after_index: afterIndex }),\n } satisfies QueryCursorEnvelope),\n ).toString(\"base64url\");\n}\n\nfunction invalidCursor(message: string): PmCliError {\n return new PmCliError(message, EXIT_CODE.USAGE, {\n code: \"invalid_query_cursor\",\n nextSteps: [\n \"Repeat the original query without --after to obtain a fresh cursor.\",\n ],\n });\n}\n\n/** Return whether an unknown payload is a supported cursor envelope. */\nfunction isQueryCursorEnvelope(value: unknown): value is QueryCursorEnvelope {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return false;\n }\n const envelope = value as Partial<QueryCursorEnvelope>;\n return (\n envelope.version === QUERY_CURSOR_VERSION &&\n typeof envelope.fingerprint === \"string\" &&\n typeof envelope.after_id === \"string\" &&\n envelope.after_id.length > 0 &&\n (envelope.after_index === undefined ||\n (Number.isSafeInteger(envelope.after_index) &&\n envelope.after_index >= 0))\n );\n}\n\n/** Decode and validate complete cursor state against a query fingerprint. */\nexport function decodeQueryCursorState(\n cursor: unknown,\n expectedFingerprint: string,\n): QueryCursorState {\n if (typeof cursor !== \"string\") {\n throw invalidCursor(\"Query cursor is malformed.\");\n }\n const normalized = cursor.trim();\n if (\n normalized.length === 0 ||\n normalized.length > MAX_CURSOR_LENGTH ||\n !BASE64URL_PATTERN.test(normalized)\n ) {\n throw invalidCursor(\"Query cursor is malformed.\");\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(Buffer.from(normalized, \"base64url\").toString(\"utf8\"));\n } catch {\n throw invalidCursor(\"Query cursor is malformed.\");\n }\n if (!isQueryCursorEnvelope(parsed)) {\n throw invalidCursor(\"Query cursor version or payload is unsupported.\");\n }\n const envelope = parsed;\n if (envelope.fingerprint !== expectedFingerprint) {\n throw invalidCursor(\n `Query cursor does not match the current filters, sort, or query (${envelope.fingerprint} != ${expectedFingerprint}).`,\n );\n }\n return {\n after_id: envelope.after_id,\n ...(envelope.after_index === undefined\n ? {}\n : { after_index: envelope.after_index }),\n };\n}\n\n/** Decode and validate a cursor against the normalized query fingerprint. */\nexport function decodeQueryCursor(\n cursor: unknown,\n expectedFingerprint: string,\n): string {\n return decodeQueryCursorState(cursor, expectedFingerprint).after_id;\n}\n\n/** Resolve the first row after a validated cursor's stable id tiebreaker. */\nexport function resolveQueryCursorStart<T>(\n rows: readonly T[],\n cursor: string | undefined,\n fingerprint: string,\n readId: (row: T) => string,\n): number {\n if (cursor === undefined) {\n return 0;\n }\n const state = decodeQueryCursorState(cursor, fingerprint);\n const index = rows.findIndex((row) => readId(row) === state.after_id);\n if (index < 0) {\n if (state.after_index !== undefined) {\n return Math.min(state.after_index, rows.length);\n }\n throw invalidCursor(`Query cursor item ${state.after_id} is no longer present in this result set.`);\n }\n return index + 1;\n}\n\n/** Page an ordered result through the shared stable cursor contract. */\nexport function paginateQueryRows<T>(\n rows: readonly T[],\n options: {\n cursor?: string;\n fingerprint: string;\n limit: number;\n readId: (row: T) => string;\n },\n): QueryCursorPage<T> {\n const pageStart = resolveQueryCursorStart(\n rows,\n options.cursor,\n options.fingerprint,\n options.readId,\n );\n const pageRows = rows.slice(pageStart, pageStart + options.limit);\n const hasMore =\n pageRows.length > 0 && pageStart + pageRows.length < rows.length;\n const lastRow = pageRows.at(-1);\n return {\n rows: pageRows,\n has_more: hasMore,\n ...(hasMore && lastRow !== undefined\n ? {\n next_cursor: encodeQueryCursor(\n options.fingerprint,\n options.readId(lastRow),\n pageStart + pageRows.length - 1,\n ),\n }\n : {}),\n };\n}\n\n/** Public pagination constants exposed for package authors and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7B,UAAU,EAAE,iBAAiB;CAC9B,CAAC,CAAC","debugId":"e54101f6-9f6a-502a-b8ef-055c289fb0a8"}
1
+ {"version":3,"file":"pagination.js","sources":["sdk/pagination.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/pagination\n *\n * Provides versioned opaque cursor primitives shared by CLI, SDK, MCP, and\n * package-authored query surfaces.\n */\nimport { createHash } from \"node:crypto\";\nimport { PmCliError } from \"../core/shared/errors.js\";\nimport { EXIT_CODE } from \"../core/shared/constants.js\";\nimport { stableStringify } from \"../core/shared/serialization.js\";\n\nconst QUERY_CURSOR_VERSION = 1;\nconst MAX_CURSOR_LENGTH = 4096;\nconst BASE64URL_PATTERN = /^[A-Za-z0-9_-]+$/;\n\ninterface QueryCursorEnvelope {\n version: number;\n fingerprint: string;\n after_id: string;\n after_index?: number;\n snapshot?: string;\n}\n\n/** Decoded cursor state for advanced package and retrieval-window integrations. */\nexport interface QueryCursorState {\n /** Stable id of the last row emitted by the previous page. */\n after_id: string;\n /** Zero-based position of that row when the producer supplied one. */\n after_index?: number;\n /** Opaque producer-defined snapshot token for stable continuation. */\n snapshot?: string;\n}\n\n/** Describes one stable cursor page over an already ordered query result. */\nexport interface QueryCursorPage<T> {\n /** Rows contained in the requested page. */\n rows: T[];\n /** Whether another page exists after these rows. */\n has_more: boolean;\n /** Opaque cursor for the next page when one exists. */\n next_cursor?: string;\n}\n\n/** Build a compact deterministic fingerprint for a normalized query contract. */\nexport function createQueryFingerprint(\n command: string,\n contract: unknown,\n): string {\n return createHash(\"sha256\")\n .update(command)\n .update(\"\\0\")\n .update(stableStringify(contract))\n .digest(\"hex\")\n .slice(0, 24);\n}\n\n/** Encode the last emitted item id into a versioned opaque base64url cursor. */\nexport function encodeQueryCursor(\n fingerprint: string,\n afterId: string,\n afterIndex?: number,\n snapshot?: string,\n): string {\n return Buffer.from(\n JSON.stringify({\n version: QUERY_CURSOR_VERSION,\n fingerprint,\n after_id: afterId,\n ...(afterIndex === undefined ? {} : { after_index: afterIndex }),\n ...(snapshot === undefined ? {} : { snapshot }),\n } satisfies QueryCursorEnvelope),\n ).toString(\"base64url\");\n}\n\nfunction invalidCursor(message: string): PmCliError {\n return new PmCliError(message, EXIT_CODE.USAGE, {\n code: \"invalid_query_cursor\",\n nextSteps: [\n \"Repeat the original query without --after to obtain a fresh cursor.\",\n ],\n });\n}\n\n/** Return whether an unknown payload is a supported cursor envelope. */\nfunction isQueryCursorEnvelope(value: unknown): value is QueryCursorEnvelope {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return false;\n }\n const envelope = value as Partial<QueryCursorEnvelope>;\n return (\n envelope.version === QUERY_CURSOR_VERSION &&\n typeof envelope.fingerprint === \"string\" &&\n typeof envelope.after_id === \"string\" &&\n envelope.after_id.length > 0 &&\n (envelope.after_index === undefined ||\n (Number.isSafeInteger(envelope.after_index) &&\n envelope.after_index >= 0)) &&\n (envelope.snapshot === undefined ||\n (typeof envelope.snapshot === \"string\" && envelope.snapshot.length > 0))\n );\n}\n\n/** Decode and validate complete cursor state against a query fingerprint. */\nexport function decodeQueryCursorState(\n cursor: unknown,\n expectedFingerprint: string,\n): QueryCursorState {\n if (typeof cursor !== \"string\") {\n throw invalidCursor(\"Query cursor is malformed.\");\n }\n const normalized = cursor.trim();\n if (\n normalized.length === 0 ||\n normalized.length > MAX_CURSOR_LENGTH ||\n !BASE64URL_PATTERN.test(normalized)\n ) {\n throw invalidCursor(\"Query cursor is malformed.\");\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(Buffer.from(normalized, \"base64url\").toString(\"utf8\"));\n } catch {\n throw invalidCursor(\"Query cursor is malformed.\");\n }\n if (!isQueryCursorEnvelope(parsed)) {\n throw invalidCursor(\"Query cursor version or payload is unsupported.\");\n }\n const envelope = parsed;\n if (envelope.fingerprint !== expectedFingerprint) {\n throw invalidCursor(\n `Query cursor does not match the current filters, sort, or query (${envelope.fingerprint} != ${expectedFingerprint}).`,\n );\n }\n return {\n after_id: envelope.after_id,\n ...(envelope.after_index === undefined\n ? {}\n : { after_index: envelope.after_index }),\n ...(envelope.snapshot === undefined ? {} : { snapshot: envelope.snapshot }),\n };\n}\n\n/** Decode and validate a cursor against the normalized query fingerprint. */\nexport function decodeQueryCursor(\n cursor: unknown,\n expectedFingerprint: string,\n): string {\n return decodeQueryCursorState(cursor, expectedFingerprint).after_id;\n}\n\n/** Resolve the first row after a validated cursor's stable id tiebreaker. */\nexport function resolveQueryCursorStart<T>(\n rows: readonly T[],\n cursor: string | undefined,\n fingerprint: string,\n readId: (row: T) => string,\n): number {\n if (cursor === undefined) {\n return 0;\n }\n const state = decodeQueryCursorState(cursor, fingerprint);\n const index = rows.findIndex((row) => readId(row) === state.after_id);\n if (index < 0) {\n if (state.after_index !== undefined) {\n return Math.min(state.after_index, rows.length);\n }\n throw invalidCursor(\n `Query cursor item ${state.after_id} is no longer present in this result set.`,\n );\n }\n return index + 1;\n}\n\n/** Page an ordered result through the shared stable cursor contract. */\nexport function paginateQueryRows<T>(\n rows: readonly T[],\n options: {\n cursor?: string;\n fingerprint: string;\n limit: number;\n readId: (row: T) => string;\n snapshot?: string;\n },\n): QueryCursorPage<T> {\n if (\n options.cursor !== undefined &&\n decodeQueryCursorState(options.cursor, options.fingerprint).snapshot !==\n options.snapshot\n )\n throw invalidCursor(\"Query cursor does not match the requested snapshot.\");\n const pageStart = resolveQueryCursorStart(\n rows,\n options.cursor,\n options.fingerprint,\n options.readId,\n );\n const pageRows = rows.slice(pageStart, pageStart + options.limit);\n const hasMore =\n pageRows.length > 0 && pageStart + pageRows.length < rows.length;\n const lastRow = pageRows.at(-1);\n return {\n rows: pageRows,\n has_more: hasMore,\n ...(hasMore && lastRow !== undefined\n ? {\n next_cursor: encodeQueryCursor(\n options.fingerprint,\n options.readId(lastRow),\n pageStart + pageRows.length - 1,\n options.snapshot,\n ),\n }\n : {}),\n };\n}\n\n/** Public pagination constants exposed for package authors and contract tests. */\nexport const QUERY_CURSOR_CONTRACT = Object.freeze({\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