@unbrained/pm-cli 2026.7.14 → 2026.7.15

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 +48 -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
@@ -1,1260 +1,11 @@
1
1
  /**
2
2
  * @module cli/commands/schema
3
3
  *
4
- * Implements the pm schema command surface and its agent-facing runtime behavior.
4
+ * Preserves the CLI command-module contract while schema behavior, result
5
+ * types, and rendering helpers are owned by the public SDK module.
5
6
  */
6
7
 
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]="c5ee3d92-dd9c-52d3-913e-47802396873f")}catch(e){}}();
8
- import path from "node:path";
9
- import { mkdir } from "node:fs/promises";
10
- import { pathExists, readFileIfExists, writeFileAtomic, } from "../../core/fs/fs-utils.js";
11
- import { acquireLock } from "../../core/lock/lock.js";
12
- import { assertAliasesAvailable, assertTypeFolderAvailable, buildInvalidTypeHint, escapeForDoubleQuotes, normalizeAddTypeInput, parseItemTypesFile, removeItemType, serializeItemTypesFile, upsertItemType, } from "../../core/schema/item-types-file.js";
13
- import { assertStatusTokensAvailable, BUILTIN_STATUS_IDS, normalizeAddStatusInput, normalizeStatusToken, parseStatusDefsFile, removeStatusDef, serializeStatusDefsFile, upsertStatusDef, } from "../../core/schema/status-defs-file.js";
14
- import { normalizeAddFieldInput, normalizeFieldKey, parseFieldsFile, removeField, serializeFieldsFile, upsertField, } from "../../core/schema/fields-file.js";
15
- import { normalizeTypePresetName, resolveTypePresetDefinitions, TYPE_PRESET_NAMES, } from "../../core/schema/type-presets.js";
16
- import { inferTypesFromTitles, } from "../../core/schema/type-inference.js";
17
- import { DEFAULT_RUNTIME_SCHEMA_FILE_PATHS, filePathForSchemaSection, normalizeRuntimeSchemaSettings, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, } from "../../core/schema/runtime-schema.js";
18
- import { resolveItemTypeRegistry, toDefaultFolder, } from "../../core/item/type-registry.js";
19
- import { listAllItemMetadataLight } from "../../core/store/item-store.js";
20
- import { EXIT_CODE } from "../../core/shared/constants.js";
21
- import { PmCliError } from "../../core/shared/errors.js";
22
- import { nowIso } from "../../core/shared/time.js";
23
- import { getActiveExtensionRegistrations, runActiveOnWriteHooks, } from "../../core/extensions/index.js";
24
- import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
25
- import { readSettings, resolveGovernanceKnobs, } from "../../core/store/settings.js";
26
- /** Public contract for schema subcommands, shared by SDK and presentation-layer consumers. */
27
- export const SCHEMA_SUBCOMMANDS = [
28
- "add-type",
29
- "remove-type",
30
- "add-status",
31
- "remove-status",
32
- "add-field",
33
- "remove-field",
34
- "list-fields",
35
- "show-field",
36
- "apply-preset",
37
- "list",
38
- "show",
39
- "show-status",
40
- ];
41
- const SCHEMA_TYPES_LOCK_ID = "schema-types";
42
- const SCHEMA_STATUSES_LOCK_ID = "schema-statuses";
43
- const SCHEMA_FIELDS_LOCK_ID = "schema-fields";
44
- function toAuthor(candidate, defaultAuthor) {
45
- const resolved = candidate ?? process.env.PM_AUTHOR ?? defaultAuthor;
46
- const trimmed = resolved.trim();
47
- return trimmed.length > 0 ? trimmed : "unknown";
48
- }
49
- /* c8 ignore start -- schema command mutation/inspection branches are covered by broader schema integration workflows. */
50
- /** Implements run schema add type for the public runtime surface of this module. */
51
- export async function runSchemaAddType(name, options, global) {
52
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
53
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
54
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
55
- }
56
- let normalized;
57
- try {
58
- normalized = normalizeAddTypeInput({
59
- name,
60
- description: options.description,
61
- defaultStatus: options.defaultStatus,
62
- folder: options.folder,
63
- aliases: options.alias,
64
- });
65
- }
66
- catch (error) {
67
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);
68
- }
69
- const settings = await readSettings(pmRoot);
70
- const schema = normalizeRuntimeSchemaSettings(settings.schema);
71
- const typesPath = filePathForSchemaSection(pmRoot, schema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types);
72
- const warnings = [];
73
- const author = toAuthor(options.author, settings.author_default);
74
- const governance = resolveGovernanceKnobs(settings);
75
- const releaseLock = await acquireLock(pmRoot, SCHEMA_TYPES_LOCK_ID, settings.locks.ttl_seconds, author, Boolean(options.force), governance.force_required_for_stale_lock, settings.locks.wait_ms);
76
- let upsert;
77
- try {
78
- const previousRaw = await readFileIfExists(typesPath);
79
- let parsed;
80
- try {
81
- parsed = parseItemTypesFile(previousRaw);
82
- }
83
- catch (error) {
84
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.GENERIC_FAILURE);
85
- }
86
- try {
87
- assertAliasesAvailable(normalized, parsed);
88
- // GH-248: reject distinct type names that would slug to the same storage
89
- // folder (e.g. "Spike"/"Spikes") so item files never silently share a
90
- // directory. Same-named upserts (recase/idempotent re-runs) are exempt.
91
- // reservedFolders covers built-in + extension + settings-resolved custom
92
- // folders so a slug like "Tasks" can't collide with the built-in Task.
93
- const reservedFolders = new Map();
94
- const resolvedRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
95
- for (const [typeName, folder] of Object.entries(resolvedRegistry.type_to_folder)) {
96
- const folderKey = folder.trim().toLowerCase();
97
- if (folderKey.length > 0 && !reservedFolders.has(folderKey)) {
98
- reservedFolders.set(folderKey, typeName);
99
- }
100
- }
101
- assertTypeFolderAvailable(normalized, parsed, reservedFolders);
102
- }
103
- catch (error) {
104
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);
105
- }
106
- upsert = upsertItemType(parsed, normalized);
107
- // GH-248: an upsert that only differs in case from the existing canonical
108
- // name silently renames the stored type (e.g. registering "spike" over
109
- // "Spike"). Surface it as a non-blocking warning so the operator knows the
110
- // existing definition was replaced rather than a new type created.
111
- if (upsert.replaced &&
112
- upsert.previousName !== undefined &&
113
- upsert.previousName !== upsert.definition.name) {
114
- warnings.push(`type_recased:${upsert.previousName}->${upsert.definition.name}`);
115
- }
116
- // writeFileAtomic writes to a temp file then renames, so a failure leaves the
117
- // existing types.json untouched; no manual rollback is needed.
118
- await writeFileAtomic(typesPath, serializeItemTypesFile(upsert.file));
119
- await ensureTypeFolderScaffold(pmRoot, [upsert.definition], warnings, "schema:add-type-folder");
120
- warnings.push(...(await runActiveOnWriteHooks({
121
- path: typesPath,
122
- scope: "project",
123
- op: "schema:add-type",
124
- })));
125
- }
126
- finally {
127
- await releaseLock();
128
- }
129
- return {
130
- action: "add-type",
131
- registered: true,
132
- replaced: upsert.replaced,
133
- type: upsert.definition,
134
- file: {
135
- path: typesPath,
136
- definitions: upsert.file.definitions.length,
137
- },
138
- warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
139
- generated_at: nowIso(),
140
- };
141
- }
142
- async function ensureInitialized(pmRoot) {
143
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
144
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
145
- }
146
- }
147
- /** Counts items whose resolved type matches `typeName` (case-insensitive). Uses the lightest existing read path (listAllItemMetadataLight skips the heavy collections cache). All items are counted — not just open ones — so the advisory warning surfaces every item the removed definition would orphan; the count is non-blocking. The caller passes its already-loaded `settings` so we never re-read settings.json from disk here. */
148
- async function countItemsUsingType(pmRoot, settings, schema, typeName) {
149
- const registry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
150
- const lowerName = typeName.trim().toLowerCase();
151
- const items = await listAllItemMetadataLight(pmRoot, settings.item_format, registry.type_to_folder, [], schema);
152
- return items.filter((item) => typeof item.type === "string" && item.type.toLowerCase() === lowerName).length;
153
- }
154
- /** Counts items currently set to the status whose id/aliases resolve to `statusId`. Uses listAllItemMetadataLight (the lightest read path). All items are counted regardless of lifecycle phase; the count is advisory only. The caller passes its already-loaded `settings` so we never re-read from disk. */
155
- async function countItemsUsingStatus(pmRoot, settings, schema, statusId) {
156
- const registry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
157
- const statusRegistry = resolveRuntimeStatusRegistry(schema);
158
- const normalizedId = normalizeStatusToken(statusId);
159
- const items = await listAllItemMetadataLight(pmRoot, settings.item_format, registry.type_to_folder, [], schema);
160
- return items.filter((item) => {
161
- const itemStatus = typeof item.status === "string" ? item.status : "";
162
- const resolved = statusRegistry.alias_to_id.get(normalizeStatusToken(itemStatus)) ??
163
- normalizeStatusToken(itemStatus);
164
- return resolved === normalizedId;
165
- }).length;
166
- }
167
- /** Returns the workflow role-slot names (open_status, close_status, ...) that currently point at `statusId` (normalized). Used to warn before removing a status that a workflow default still references. */
168
- function workflowSlotsReferencing(workflow, statusId) {
169
- const slots = [
170
- ["draft_status", workflow.draft_status],
171
- ["open_status", workflow.open_status],
172
- ["in_progress_status", workflow.in_progress_status],
173
- ["blocked_status", workflow.blocked_status],
174
- ["close_status", workflow.close_status],
175
- ["canceled_status", workflow.canceled_status],
176
- ];
177
- return slots
178
- .filter(([, value]) => value !== undefined && normalizeStatusToken(value) === statusId)
179
- .map(([slot]) => slot);
180
- }
181
- /** Implements run schema remove type for the public runtime surface of this module. */
182
- export async function runSchemaRemoveType(name, options, global) {
183
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
184
- await ensureInitialized(pmRoot);
185
- const settings = await readSettings(pmRoot);
186
- const schema = normalizeRuntimeSchemaSettings(settings.schema);
187
- const typesPath = filePathForSchemaSection(pmRoot, schema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types);
188
- const warnings = [];
189
- const author = toAuthor(options.author, settings.author_default);
190
- const governance = resolveGovernanceKnobs(settings);
191
- const releaseLock = await acquireLock(pmRoot, SCHEMA_TYPES_LOCK_ID, settings.locks.ttl_seconds, author, Boolean(options.force), governance.force_required_for_stale_lock, settings.locks.wait_ms);
192
- let removal;
193
- try {
194
- const previousRaw = await readFileIfExists(typesPath);
195
- let parsed;
196
- try {
197
- parsed = parseItemTypesFile(previousRaw);
198
- }
199
- catch (error) {
200
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.GENERIC_FAILURE);
201
- }
202
- try {
203
- removal = removeItemType(parsed, name);
204
- }
205
- catch (error) {
206
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);
207
- }
208
- if (removal.removed) {
209
- // Only emit the advisory orphan-count warning once a removable custom
210
- // definition was actually removed; a no-op/unknown removal would otherwise
211
- // surface a misleading items_using_type:* warning. The count is
212
- // non-blocking and reuses the already-loaded settings (no disk re-read).
213
- const removedName = (removal.definition?.name ?? name ?? "").trim();
214
- if (removedName.length > 0) {
215
- const usingType = await countItemsUsingType(pmRoot, settings, schema, removedName);
216
- if (usingType > 0) {
217
- warnings.push(`items_using_type:${usingType}`);
218
- }
219
- }
220
- // writeFileAtomic writes to a temp file then renames, so a failure leaves
221
- // the existing types.json untouched; no manual rollback is needed.
222
- await writeFileAtomic(typesPath, serializeItemTypesFile(removal.file));
223
- warnings.push(...(await runActiveOnWriteHooks({
224
- path: typesPath,
225
- scope: "project",
226
- op: "schema:remove-type",
227
- })));
228
- }
229
- }
230
- finally {
231
- await releaseLock();
232
- }
233
- return {
234
- action: "remove-type",
235
- removed: removal.removed,
236
- ...(removal.definition ? { type: removal.definition } : {}),
237
- file: {
238
- path: typesPath,
239
- definitions: removal.file.definitions.length,
240
- },
241
- warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
242
- generated_at: nowIso(),
243
- };
244
- }
245
- function statusesPathFor(pmRoot, schema) {
246
- return filePathForSchemaSection(pmRoot, schema.files.statuses, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.statuses);
247
- }
248
- function fieldsPathFor(pmRoot, schema) {
249
- return filePathForSchemaSection(pmRoot, schema.files.fields, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.fields);
250
- }
251
- function typesPathFor(pmRoot, schema) {
252
- return filePathForSchemaSection(pmRoot, schema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types);
253
- }
254
- /** Creates the storage folder for each item-type definition (resolving the default folder when unset) and runs on-write hooks for newly created folders. Shared with `pm profile apply` so profile-staged types scaffold identically to `pm schema add-type`. Existing folders are skipped, keeping the call idempotent. */
255
- export async function ensureTypeFolderScaffold(pmRoot, definitions, warnings, op) {
256
- for (const definition of definitions) {
257
- const folder = definition.folder ?? toDefaultFolder(definition.name);
258
- const target = path.join(pmRoot, folder);
259
- if (await pathExists(target)) {
260
- continue;
261
- }
262
- await mkdir(target, { recursive: true });
263
- warnings.push(...(await runActiveOnWriteHooks({
264
- path: target,
265
- scope: "project",
266
- op,
267
- })));
268
- }
269
- }
270
- function toSchemaFieldSummary(field) {
271
- return {
272
- key: field.key,
273
- type: field.type,
274
- commands: [...field.commands],
275
- cli_flag: `--${field.cli_flag}`,
276
- cli_aliases: field.cli_aliases.map((alias) => `--${alias}`),
277
- ...(field.description ? { description: field.description } : {}),
278
- required: field.required,
279
- required_on_create: field.required_on_create,
280
- allow_unset: field.allow_unset,
281
- required_types: [...field.required_types],
282
- };
283
- }
284
- function toExistingStatusDefinition(resolvedExisting) {
285
- if (!resolvedExisting) {
286
- return undefined;
287
- }
288
- return {
289
- id: resolvedExisting.id,
290
- ...(resolvedExisting.roles.length > 0
291
- ? { roles: [...resolvedExisting.roles] }
292
- : {}),
293
- ...(resolvedExisting.aliases.length > 0
294
- ? { aliases: [...resolvedExisting.aliases] }
295
- : {}),
296
- ...(resolvedExisting.description
297
- ? { description: resolvedExisting.description }
298
- : {}),
299
- ...(typeof resolvedExisting.order === "number"
300
- ? { order: resolvedExisting.order }
301
- : {}),
302
- };
303
- }
304
- function buildStatusFileAliasMap(statuses) {
305
- const fileAliasToId = new Map();
306
- for (const definition of statuses) {
307
- const defId = normalizeStatusToken(definition.id);
308
- if (defId.length === 0) {
309
- continue;
310
- }
311
- fileAliasToId.set(defId, defId);
312
- for (const alias of Array.isArray(definition.aliases)
313
- ? definition.aliases
314
- : []) {
315
- const aliasToken = normalizeStatusToken(alias);
316
- if (aliasToken.length > 0 && !fileAliasToId.has(aliasToken)) {
317
- fileAliasToId.set(aliasToken, defId);
318
- }
319
- }
320
- }
321
- return fileAliasToId;
322
- }
323
- /** Implements run schema add status for the public runtime surface of this module. */
324
- export async function runSchemaAddStatus(id, options, global) {
325
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
326
- await ensureInitialized(pmRoot);
327
- let normalized;
328
- try {
329
- normalized = normalizeAddStatusInput({
330
- id,
331
- roles: options.role,
332
- aliases: options.alias,
333
- description: options.description,
334
- order: options.order,
335
- });
336
- }
337
- catch (error) {
338
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);
339
- }
340
- const settings = await readSettings(pmRoot);
341
- const schema = normalizeRuntimeSchemaSettings(settings.schema);
342
- const statusesPath = statusesPathFor(pmRoot, schema);
343
- const statusRegistry = resolveRuntimeStatusRegistry(schema);
344
- // Reject id/alias collisions with a DIFFERENT existing status so a custom
345
- // status can never shadow a built-in lifecycle token (e.g. --alias open).
346
- try {
347
- assertStatusTokensAvailable(normalized, statusRegistry.alias_to_id);
348
- }
349
- catch (error) {
350
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);
351
- }
352
- // Seed the upsert from the resolved (settings-or-file) definition so omitting
353
- // --role/--alias preserves metadata defined in settings.schema.statuses, not
354
- // only what is already in statuses.json.
355
- const baseDefinition = toExistingStatusDefinition(statusRegistry.by_id.get(normalized.id));
356
- const warnings = [];
357
- const author = toAuthor(options.author, settings.author_default);
358
- const governance = resolveGovernanceKnobs(settings);
359
- const releaseLock = await acquireLock(pmRoot, SCHEMA_STATUSES_LOCK_ID, settings.locks.ttl_seconds, author, Boolean(options.force), governance.force_required_for_stale_lock, settings.locks.wait_ms);
360
- let upsert;
361
- try {
362
- const previousRaw = await readFileIfExists(statusesPath);
363
- let parsed;
364
- try {
365
- parsed = parseStatusDefsFile(previousRaw);
366
- }
367
- catch (error) {
368
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.GENERIC_FAILURE);
369
- }
370
- // Re-check collisions against the CURRENT file under the lock: the pre-lock
371
- // check used the registry loaded before acquiring schema-statuses, so a
372
- // concurrent add-status could have written a colliding id/alias in between.
373
- // The lock serializes writes; this serializes the collision decision too.
374
- const fileAliasToId = buildStatusFileAliasMap(parsed.statuses);
375
- try {
376
- assertStatusTokensAvailable(normalized, fileAliasToId);
377
- }
378
- catch (error) {
379
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);
380
- }
381
- upsert = upsertStatusDef(parsed, normalized, baseDefinition);
382
- // writeFileAtomic writes to a temp file then renames, so a failure leaves
383
- // the existing statuses.json untouched; no manual rollback is needed.
384
- await writeFileAtomic(statusesPath, serializeStatusDefsFile(upsert.file));
385
- warnings.push(...(await runActiveOnWriteHooks({
386
- path: statusesPath,
387
- scope: "project",
388
- op: "schema:add-status",
389
- })));
390
- }
391
- finally {
392
- await releaseLock();
393
- }
394
- return {
395
- action: "add-status",
396
- registered: true,
397
- replaced: upsert.replaced,
398
- status: upsert.definition,
399
- file: {
400
- path: statusesPath,
401
- statuses: upsert.file.statuses.length,
402
- },
403
- warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
404
- generated_at: nowIso(),
405
- };
406
- }
407
- /** Implements run schema remove status for the public runtime surface of this module. */
408
- export async function runSchemaRemoveStatus(id, options, global) {
409
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
410
- await ensureInitialized(pmRoot);
411
- const settings = await readSettings(pmRoot);
412
- const schema = normalizeRuntimeSchemaSettings(settings.schema);
413
- const statusesPath = statusesPathFor(pmRoot, schema);
414
- const warnings = [];
415
- const author = toAuthor(options.author, settings.author_default);
416
- const governance = resolveGovernanceKnobs(settings);
417
- const releaseLock = await acquireLock(pmRoot, SCHEMA_STATUSES_LOCK_ID, settings.locks.ttl_seconds, author, Boolean(options.force), governance.force_required_for_stale_lock, settings.locks.wait_ms);
418
- let removal;
419
- try {
420
- const previousRaw = await readFileIfExists(statusesPath);
421
- let parsed;
422
- try {
423
- parsed = parseStatusDefsFile(previousRaw);
424
- }
425
- catch (error) {
426
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.GENERIC_FAILURE);
427
- }
428
- try {
429
- removal = removeStatusDef(parsed, id);
430
- }
431
- catch (error) {
432
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);
433
- }
434
- if (removal.removed) {
435
- // Only emit the advisory orphan-count warning once a removable custom
436
- // status was actually removed; a no-op/unknown removal would otherwise
437
- // surface a misleading items_using_status:* warning. The count reuses the
438
- // already-loaded settings (no disk re-read) and is non-blocking.
439
- const removedId = normalizeStatusToken(removal.definition?.id ?? id);
440
- if (removedId.length > 0 && !BUILTIN_STATUS_IDS.has(removedId)) {
441
- const usingStatus = await countItemsUsingStatus(pmRoot, settings, schema, removedId);
442
- if (usingStatus > 0) {
443
- warnings.push(`items_using_status:${usingStatus}`);
444
- }
445
- // Removing a status that a workflow default still points at would leave
446
- // pm close / default pm create resolving to an unregistered status. Warn
447
- // (non-blocking, consistent with remove-type) so the operator re-points
448
- // the workflow slot via schema/workflows.json or pm config.
449
- const referencingSlots = workflowSlotsReferencing(schema.workflow, removedId);
450
- if (referencingSlots.length > 0) {
451
- warnings.push(`status_referenced_by_workflow:${referencingSlots.join(",")}`);
452
- }
453
- }
454
- await writeFileAtomic(statusesPath, serializeStatusDefsFile(removal.file));
455
- warnings.push(...(await runActiveOnWriteHooks({
456
- path: statusesPath,
457
- scope: "project",
458
- op: "schema:remove-status",
459
- })));
460
- }
461
- }
462
- finally {
463
- await releaseLock();
464
- }
465
- return {
466
- action: "remove-status",
467
- removed: removal.removed,
468
- ...(removal.definition ? { status: removal.definition } : {}),
469
- file: {
470
- path: statusesPath,
471
- statuses: removal.file.statuses.length,
472
- },
473
- warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
474
- generated_at: nowIso(),
475
- };
476
- }
477
- function toSchemaTypeSummary(definition) {
478
- return {
479
- name: definition.name,
480
- folder: definition.folder,
481
- aliases: Array.isArray(definition.aliases) ? [...definition.aliases] : [],
482
- ...(definition.default_status
483
- ? { default_status: definition.default_status }
484
- : {}),
485
- ...(definition.description ? { description: definition.description } : {}),
486
- };
487
- }
488
- function toSchemaTypeDefinition(definition, source, extensionProvenance) {
489
- return {
490
- ...toSchemaTypeSummary(definition),
491
- source,
492
- ...(extensionProvenance ? { extension: extensionProvenance } : {}),
493
- required_create_fields: [...definition.required_create_fields],
494
- required_create_repeatables: [...definition.required_create_repeatables],
495
- options: structuredClone(definition.options),
496
- command_option_policies: structuredClone(definition.command_option_policies),
497
- };
498
- }
499
- function toSchemaStatusSummary(definition) {
500
- return {
501
- id: definition.id,
502
- source: BUILTIN_STATUS_IDS.has(definition.id) ? "builtin" : "custom",
503
- roles: Array.isArray(definition.roles) ? [...definition.roles] : [],
504
- aliases: Array.isArray(definition.aliases) ? [...definition.aliases] : [],
505
- ...(definition.description ? { description: definition.description } : {}),
506
- ...(typeof definition.order === "number"
507
- ? { order: definition.order }
508
- : {}),
509
- };
510
- }
511
- function classifyTypeSource(name, customNames, extensionNames) {
512
- const lowerName = name.toLowerCase();
513
- if (extensionNames.has(lowerName)) {
514
- return "extension";
515
- }
516
- if (customNames.has(lowerName)) {
517
- return "custom";
518
- }
519
- return "builtin";
520
- }
521
- function collectExtensionTypeProvenance() {
522
- const provenance = new Map();
523
- const registrations = getActiveExtensionRegistrations();
524
- for (const registration of registrations?.item_types ?? []) {
525
- const rawTypes = registration.types;
526
- if (!Array.isArray(rawTypes)) {
527
- continue;
528
- }
529
- for (const rawType of rawTypes) {
530
- if (typeof rawType !== "object" ||
531
- rawType === null ||
532
- Array.isArray(rawType)) {
533
- continue;
534
- }
535
- const name = rawType.name;
536
- if (typeof name === "string" && name.trim().length > 0) {
537
- provenance.set(name.trim().toLowerCase(), {
538
- layer: registration.layer,
539
- name: registration.name,
540
- });
541
- }
542
- }
543
- }
544
- return provenance;
545
- }
546
- function buildSchemaStatusSummaries(schema) {
547
- const registry = resolveRuntimeStatusRegistry(schema);
548
- const builtin = [];
549
- const custom = [];
550
- for (const definition of registry.definitions) {
551
- const summary = toSchemaStatusSummary(definition);
552
- if (summary.source === "builtin") {
553
- builtin.push(summary);
554
- }
555
- else {
556
- custom.push(summary);
557
- }
558
- }
559
- return { builtin, custom };
560
- }
561
- async function loadSchemaInspectionContext(global) {
562
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
563
- if (!(await pathExists(getSettingsPath(pmRoot)))) {
564
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
565
- }
566
- const settings = await readSettings(pmRoot);
567
- const schema = normalizeRuntimeSchemaSettings(settings.schema);
568
- const typesPath = filePathForSchemaSection(pmRoot, schema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types);
569
- const statusesPath = statusesPathFor(pmRoot, schema);
570
- const registry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
571
- const extensionProvenance = collectExtensionTypeProvenance();
572
- const customNames = new Set((settings.item_types?.definitions ?? [])
573
- .map((definition) => definition.name.trim().toLowerCase())
574
- .filter((name) => name.length > 0 && !extensionProvenance.has(name)));
575
- return {
576
- pmRoot,
577
- typesPath,
578
- statusesPath,
579
- byType: registry.by_type,
580
- customNames,
581
- extensionProvenance,
582
- schema,
583
- };
584
- }
585
- /** Implements run schema list for the public runtime surface of this module. */
586
- export async function runSchemaList(global) {
587
- const context = await loadSchemaInspectionContext(global);
588
- const builtin = [];
589
- const custom = [];
590
- const extension = [];
591
- for (const definition of Object.values(context.byType).sort((left, right) => left.name.localeCompare(right.name))) {
592
- const source = classifyTypeSource(definition.name, context.customNames, new Set(context.extensionProvenance.keys()));
593
- const summary = toSchemaTypeSummary(definition);
594
- if (source === "extension") {
595
- extension.push(summary);
596
- }
597
- else if (source === "custom") {
598
- custom.push(summary);
599
- }
600
- else {
601
- builtin.push(summary);
602
- }
603
- }
604
- const statusSummaries = buildSchemaStatusSummaries(context.schema);
605
- const fieldSummaries = resolveRuntimeFieldRegistry(context.schema).definitions.map(toSchemaFieldSummary);
606
- return {
607
- action: "list",
608
- builtin,
609
- custom,
610
- extension,
611
- counts: {
612
- builtin: builtin.length,
613
- custom: custom.length,
614
- extension: extension.length,
615
- total: builtin.length + custom.length + extension.length,
616
- },
617
- statuses: {
618
- builtin: statusSummaries.builtin,
619
- custom: statusSummaries.custom,
620
- counts: {
621
- builtin: statusSummaries.builtin.length,
622
- custom: statusSummaries.custom.length,
623
- total: statusSummaries.builtin.length + statusSummaries.custom.length,
624
- },
625
- },
626
- fields: {
627
- custom: fieldSummaries,
628
- counts: {
629
- total: fieldSummaries.length,
630
- },
631
- },
632
- file: {
633
- path: context.typesPath,
634
- },
635
- generated_at: nowIso(),
636
- };
637
- }
638
- /** Implements run schema show for the public runtime surface of this module. */
639
- export async function runSchemaShow(name, global) {
640
- const typeName = (name ?? "").trim();
641
- if (typeName.length === 0) {
642
- throw new PmCliError("Type name must not be empty.", EXIT_CODE.USAGE);
643
- }
644
- const context = await loadSchemaInspectionContext(global);
645
- const match = Object.values(context.byType).find((definition) => definition.name.toLowerCase() === typeName.toLowerCase() ||
646
- definition.aliases.some((alias) => alias.toLowerCase() === typeName.toLowerCase()));
647
- if (!match) {
648
- throw new PmCliError(`Unknown item type "${typeName}". Run pm schema list to inspect registered types, or pm schema add-type "${escapeForDoubleQuotes(typeName)}" to register it.`, EXIT_CODE.NOT_FOUND, { code: "unknown_item_type" });
649
- }
650
- return {
651
- action: "show",
652
- type: toSchemaTypeDefinition(match, classifyTypeSource(match.name, context.customNames, new Set(context.extensionProvenance.keys())), context.extensionProvenance.get(match.name.toLowerCase())),
653
- file: {
654
- path: context.typesPath,
655
- },
656
- generated_at: nowIso(),
657
- };
658
- }
659
- /** Implements run schema show status for the public runtime surface of this module. */
660
- export async function runSchemaShowStatus(id, global) {
661
- const statusToken = normalizeStatusToken(id);
662
- if (statusToken.length === 0) {
663
- throw new PmCliError("Status id must not be empty.", EXIT_CODE.USAGE);
664
- }
665
- const context = await loadSchemaInspectionContext(global);
666
- const statusRegistry = resolveRuntimeStatusRegistry(context.schema);
667
- const resolvedId = statusRegistry.alias_to_id.get(statusToken) ?? statusToken;
668
- const match = statusRegistry.by_id.get(resolvedId);
669
- if (!match) {
670
- throw new PmCliError(`Unknown status "${id}". Run pm schema list to inspect registered statuses, or pm schema add-status "${escapeForDoubleQuotes(id ?? "")}" to register it.`, EXIT_CODE.NOT_FOUND, { code: "unknown_status" });
671
- }
672
- return {
673
- action: "show-status",
674
- status: toSchemaStatusSummary(match),
675
- file: {
676
- path: context.statusesPath,
677
- },
678
- generated_at: nowIso(),
679
- };
680
- }
681
- /** Implements run schema add field for the public runtime surface of this module. */
682
- export async function runSchemaAddField(key, options, global) {
683
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
684
- await ensureInitialized(pmRoot);
685
- let normalized;
686
- try {
687
- normalized = normalizeAddFieldInput({
688
- key,
689
- type: options.type,
690
- commands: options.commands,
691
- description: options.description,
692
- cliFlag: options.cliFlag,
693
- aliases: options.alias,
694
- required: options.required,
695
- requiredOnCreate: options.requiredOnCreate,
696
- allowUnset: options.allowUnset,
697
- requiredTypes: options.requiredTypes,
698
- });
699
- }
700
- catch (error) {
701
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);
702
- }
703
- const settings = await readSettings(pmRoot);
704
- const schema = normalizeRuntimeSchemaSettings(settings.schema);
705
- const fieldsPath = fieldsPathFor(pmRoot, schema);
706
- const warnings = [];
707
- const author = toAuthor(options.author, settings.author_default);
708
- const governance = resolveGovernanceKnobs(settings);
709
- const releaseLock = await acquireLock(pmRoot, SCHEMA_FIELDS_LOCK_ID, settings.locks.ttl_seconds, author, Boolean(options.force), governance.force_required_for_stale_lock, settings.locks.wait_ms);
710
- let upsert;
711
- try {
712
- const previousRaw = await readFileIfExists(fieldsPath);
713
- let parsed;
714
- try {
715
- parsed = parseFieldsFile(previousRaw);
716
- }
717
- catch (error) {
718
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.GENERIC_FAILURE);
719
- }
720
- upsert = upsertField(parsed, normalized);
721
- await writeFileAtomic(fieldsPath, serializeFieldsFile(upsert.file));
722
- warnings.push(...(await runActiveOnWriteHooks({
723
- path: fieldsPath,
724
- scope: "project",
725
- op: "schema:add-field",
726
- })));
727
- }
728
- finally {
729
- await releaseLock();
730
- }
731
- return {
732
- action: "add-field",
733
- registered: true,
734
- replaced: upsert.replaced,
735
- field: upsert.definition,
736
- file: {
737
- path: fieldsPath,
738
- fields: upsert.file.fields.length,
739
- },
740
- warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
741
- generated_at: nowIso(),
742
- };
743
- }
744
- /** Counts items carrying a non-empty value for the custom field's metadata key. Advisory only (non-blocking) so remove-field can surface how many items would lose a managed column. Reuses the already-loaded settings (no disk re-read). */
745
- async function countItemsUsingField(pmRoot, settings, schema, metadataKey) {
746
- const registry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
747
- const items = await listAllItemMetadataLight(pmRoot, settings.item_format, registry.type_to_folder, [], schema);
748
- return items.filter((item) => {
749
- const value = item[metadataKey];
750
- if (value === undefined || value === null) {
751
- return false;
752
- }
753
- if (Array.isArray(value)) {
754
- return value.length > 0;
755
- }
756
- if (typeof value === "string") {
757
- return value.trim().length > 0;
758
- }
759
- return true;
760
- }).length;
761
- }
762
- /** Implements run schema remove field for the public runtime surface of this module. */
763
- export async function runSchemaRemoveField(key, options, global) {
764
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
765
- await ensureInitialized(pmRoot);
766
- const settings = await readSettings(pmRoot);
767
- const schema = normalizeRuntimeSchemaSettings(settings.schema);
768
- const fieldsPath = fieldsPathFor(pmRoot, schema);
769
- const warnings = [];
770
- const author = toAuthor(options.author, settings.author_default);
771
- const governance = resolveGovernanceKnobs(settings);
772
- const releaseLock = await acquireLock(pmRoot, SCHEMA_FIELDS_LOCK_ID, settings.locks.ttl_seconds, author, Boolean(options.force), governance.force_required_for_stale_lock, settings.locks.wait_ms);
773
- let removal;
774
- try {
775
- const previousRaw = await readFileIfExists(fieldsPath);
776
- let parsed;
777
- try {
778
- parsed = parseFieldsFile(previousRaw);
779
- }
780
- catch (error) {
781
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.GENERIC_FAILURE);
782
- }
783
- try {
784
- removal = removeField(parsed, key);
785
- }
786
- catch (error) {
787
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);
788
- }
789
- if (removal.removed) {
790
- const removedKey = normalizeFieldKey(removal.definition?.key ?? key);
791
- const metadataKey = normalizeFieldKey(removal.definition?.metadata_key ??
792
- removal.definition?.front_matter_key ??
793
- removedKey);
794
- if (metadataKey.length > 0) {
795
- const usingField = await countItemsUsingField(pmRoot, settings, schema, metadataKey);
796
- if (usingField > 0) {
797
- warnings.push(`items_using_field:${usingField}`);
798
- }
799
- }
800
- await writeFileAtomic(fieldsPath, serializeFieldsFile(removal.file));
801
- warnings.push(...(await runActiveOnWriteHooks({
802
- path: fieldsPath,
803
- scope: "project",
804
- op: "schema:remove-field",
805
- })));
806
- }
807
- }
808
- finally {
809
- await releaseLock();
810
- }
811
- return {
812
- action: "remove-field",
813
- removed: removal.removed,
814
- ...(removal.definition ? { field: removal.definition } : {}),
815
- file: {
816
- path: fieldsPath,
817
- fields: removal.file.fields.length,
818
- },
819
- warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
820
- generated_at: nowIso(),
821
- };
822
- }
823
- /** Implements run schema list fields for the public runtime surface of this module. */
824
- export async function runSchemaListFields(global) {
825
- const context = await loadSchemaInspectionContext(global);
826
- const fields = resolveRuntimeFieldRegistry(context.schema).definitions.map(toSchemaFieldSummary);
827
- return {
828
- action: "list-fields",
829
- fields,
830
- counts: {
831
- total: fields.length,
832
- },
833
- file: {
834
- path: fieldsPathFor(context.pmRoot, context.schema),
835
- },
836
- generated_at: nowIso(),
837
- };
838
- }
839
- /** Implements run schema show field for the public runtime surface of this module. */
840
- export async function runSchemaShowField(key, global) {
841
- const fieldKey = normalizeFieldKey(key);
842
- if (fieldKey.length === 0) {
843
- throw new PmCliError("Field key must not be empty.", EXIT_CODE.USAGE);
844
- }
845
- const context = await loadSchemaInspectionContext(global);
846
- const match = resolveRuntimeFieldRegistry(context.schema).by_key.get(fieldKey);
847
- if (!match) {
848
- throw new PmCliError(`Unknown custom field "${key}". Run pm schema list-fields to inspect registered fields, or pm schema add-field "${escapeForDoubleQuotes(key ?? "")}" to register it.`, EXIT_CODE.NOT_FOUND, { code: "unknown_field" });
849
- }
850
- return {
851
- action: "show-field",
852
- field: toSchemaFieldSummary(match),
853
- file: {
854
- path: fieldsPathFor(context.pmRoot, context.schema),
855
- },
856
- generated_at: nowIso(),
857
- };
858
- }
859
- /** Implements run schema apply preset for the public runtime surface of this module. */
860
- export async function runSchemaApplyPreset(preset, options, global) {
861
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
862
- await ensureInitialized(pmRoot);
863
- let presetName;
864
- try {
865
- const normalized = normalizeTypePresetName(preset);
866
- if (normalized === undefined) {
867
- throw new Error(`Type preset name is required. Allowed: ${TYPE_PRESET_NAMES.join(", ")}.`);
868
- }
869
- presetName = normalized;
870
- }
871
- catch (error) {
872
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.USAGE);
873
- }
874
- const settings = await readSettings(pmRoot);
875
- const schema = normalizeRuntimeSchemaSettings(settings.schema);
876
- const typesPath = typesPathFor(pmRoot, schema);
877
- const warnings = [];
878
- const author = toAuthor(options.author, settings.author_default);
879
- const governance = resolveGovernanceKnobs(settings);
880
- const registered = [];
881
- const replaced = [];
882
- let definitionsCount = 0;
883
- const releaseLock = await acquireLock(pmRoot, SCHEMA_TYPES_LOCK_ID, settings.locks.ttl_seconds, author, Boolean(options.force), governance.force_required_for_stale_lock, settings.locks.wait_ms);
884
- try {
885
- const previousRaw = await readFileIfExists(typesPath);
886
- let parsed;
887
- try {
888
- parsed = parseItemTypesFile(previousRaw);
889
- }
890
- catch (error) {
891
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.GENERIC_FAILURE);
892
- }
893
- let nextFile = parsed;
894
- for (const normalized of resolveTypePresetDefinitions(presetName)) {
895
- const upsert = upsertItemType(nextFile, normalized);
896
- nextFile = upsert.file;
897
- (upsert.replaced ? replaced : registered).push(upsert.definition.name);
898
- }
899
- definitionsCount = nextFile.definitions.length;
900
- await writeFileAtomic(typesPath, serializeItemTypesFile(nextFile));
901
- await ensureTypeFolderScaffold(pmRoot, resolveTypePresetDefinitions(presetName), warnings, "schema:apply-preset-folder");
902
- warnings.push(...(await runActiveOnWriteHooks({
903
- path: typesPath,
904
- scope: "project",
905
- op: "schema:apply-preset",
906
- })));
907
- }
908
- finally {
909
- await releaseLock();
910
- }
911
- return {
912
- action: "apply-preset",
913
- preset: presetName,
914
- registered,
915
- replaced,
916
- file: {
917
- path: typesPath,
918
- definitions: definitionsCount,
919
- },
920
- warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
921
- generated_at: nowIso(),
922
- };
923
- }
924
- /** Implements run schema infer types for the public runtime surface of this module. */
925
- export async function runSchemaInferTypes(options, global) {
926
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
927
- await ensureInitialized(pmRoot);
928
- const settings = await readSettings(pmRoot);
929
- const schema = normalizeRuntimeSchemaSettings(settings.schema);
930
- const typesPath = typesPathFor(pmRoot, schema);
931
- let minCount = 10;
932
- if (options.minCount !== undefined) {
933
- if (!Number.isInteger(options.minCount) || options.minCount < 1) {
934
- throw new PmCliError("--min-count must be a positive integer (>= 1).", EXIT_CODE.USAGE);
935
- }
936
- minCount = options.minCount;
937
- }
938
- const registry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
939
- const items = await listAllItemMetadataLight(pmRoot, settings.item_format, registry.type_to_folder, [], schema);
940
- const titles = items.map((item) => typeof item.title === "string" ? item.title : "");
941
- const candidates = inferTypesFromTitles(titles, { minCount });
942
- const warnings = [];
943
- const registered = [];
944
- const replaced = [];
945
- const skipped = [];
946
- let definitionsCount;
947
- // Dry-run preview by default: only --apply mutates schema/types.json.
948
- if (!options.apply) {
949
- let parsed;
950
- try {
951
- parsed = parseItemTypesFile(await readFileIfExists(typesPath));
952
- }
953
- catch (error) {
954
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.GENERIC_FAILURE);
955
- }
956
- definitionsCount = parsed.definitions.length;
957
- return {
958
- action: "infer-types",
959
- applied: false,
960
- min_count: minCount,
961
- candidates,
962
- registered,
963
- replaced,
964
- skipped,
965
- file: {
966
- path: typesPath,
967
- definitions: definitionsCount,
968
- },
969
- warnings,
970
- generated_at: nowIso(),
971
- };
972
- }
973
- const author = toAuthor(options.author, settings.author_default);
974
- const governance = resolveGovernanceKnobs(settings);
975
- const releaseLock = await acquireLock(pmRoot, SCHEMA_TYPES_LOCK_ID, settings.locks.ttl_seconds, author, Boolean(options.force), governance.force_required_for_stale_lock, settings.locks.wait_ms);
976
- try {
977
- const previousRaw = await readFileIfExists(typesPath);
978
- let parsed;
979
- try {
980
- parsed = parseItemTypesFile(previousRaw);
981
- }
982
- catch (error) {
983
- throw new PmCliError(error instanceof Error ? error.message : String(error), EXIT_CODE.GENERIC_FAILURE);
984
- }
985
- let nextFile = parsed;
986
- for (const candidate of candidates) {
987
- if (candidate.shadows_builtin) {
988
- skipped.push({ name: candidate.name, reason: "shadows_builtin" });
989
- continue;
990
- }
991
- let normalized;
992
- try {
993
- normalized = normalizeAddTypeInput({ name: candidate.name });
994
- }
995
- catch {
996
- // A title prefix that does not normalize to a valid type token (rare,
997
- // given the inference pattern) is skipped rather than aborting the batch.
998
- skipped.push({ name: candidate.name, reason: "invalid_type_token" });
999
- continue;
1000
- }
1001
- const upsert = upsertItemType(nextFile, normalized);
1002
- nextFile = upsert.file;
1003
- (upsert.replaced ? replaced : registered).push(upsert.definition.name);
1004
- }
1005
- definitionsCount = nextFile.definitions.length;
1006
- await writeFileAtomic(typesPath, serializeItemTypesFile(nextFile));
1007
- await ensureTypeFolderScaffold(pmRoot, nextFile.definitions.filter((definition) => registered.includes(definition.name) ||
1008
- replaced.includes(definition.name)), warnings, "schema:infer-types-folder");
1009
- warnings.push(...(await runActiveOnWriteHooks({
1010
- path: typesPath,
1011
- scope: "project",
1012
- op: "schema:infer-types",
1013
- })));
1014
- }
1015
- finally {
1016
- await releaseLock();
1017
- }
1018
- return {
1019
- action: "infer-types",
1020
- applied: true,
1021
- min_count: minCount,
1022
- candidates,
1023
- registered,
1024
- replaced,
1025
- skipped,
1026
- file: {
1027
- path: typesPath,
1028
- definitions: definitionsCount,
1029
- },
1030
- warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
1031
- generated_at: nowIso(),
1032
- };
1033
- }
1034
- /** Implements format schema add type human for the public runtime surface of this module. */
1035
- export function formatSchemaAddTypeHuman(result) {
1036
- const verb = result.replaced ? "Updated" : "Registered";
1037
- const aliasSuffix = result.type.aliases && result.type.aliases.length > 0
1038
- ? ` (aliases: ${result.type.aliases.join(", ")})`
1039
- : "";
1040
- return `${verb} custom item type "${result.type.name}"${aliasSuffix} in ${result.file.path}. Run: pm create "${escapeForDoubleQuotes(result.type.name)}" "<title>"`;
1041
- }
1042
- /** Implements format schema remove type human for the public runtime surface of this module. */
1043
- export function formatSchemaRemoveTypeHuman(result) {
1044
- if (!result.removed) {
1045
- return `No custom item type matched; nothing removed from ${result.file.path}.`;
1046
- }
1047
- const name = result.type?.name ?? "(unknown)";
1048
- return `Removed custom item type "${name}" from ${result.file.path}.`;
1049
- }
1050
- /** Implements format schema add status human for the public runtime surface of this module. */
1051
- export function formatSchemaAddStatusHuman(result) {
1052
- const verb = result.replaced ? "Updated" : "Registered";
1053
- const roleSuffix = result.status.roles && result.status.roles.length > 0
1054
- ? ` (roles: ${result.status.roles.join(", ")})`
1055
- : "";
1056
- const aliasSuffix = result.status.aliases && result.status.aliases.length > 0
1057
- ? ` (aliases: ${result.status.aliases.join(", ")})`
1058
- : "";
1059
- return `${verb} status "${result.status.id}"${roleSuffix}${aliasSuffix} in ${result.file.path}.`;
1060
- }
1061
- /** Implements format schema remove status human for the public runtime surface of this module. */
1062
- export function formatSchemaRemoveStatusHuman(result) {
1063
- if (!result.removed) {
1064
- return `No custom status matched; nothing removed from ${result.file.path}.`;
1065
- }
1066
- const id = result.status?.id ?? "(unknown)";
1067
- return `Removed custom status "${id}" from ${result.file.path}.`;
1068
- }
1069
- /** Implements format schema list human for the public runtime surface of this module. */
1070
- export function formatSchemaListHuman(result) {
1071
- const lines = [
1072
- `Schema types: ${result.counts.total} total (${result.counts.builtin} builtin, ${result.counts.custom} custom, ${result.counts.extension} extension)`,
1073
- ];
1074
- for (const [label, entries] of [
1075
- ["builtin", result.builtin],
1076
- ["custom", result.custom],
1077
- ["extension", result.extension],
1078
- ]) {
1079
- if (entries.length === 0) {
1080
- continue;
1081
- }
1082
- lines.push(`${label}: ${entries.map((entry) => entry.name).join(", ")}`);
1083
- }
1084
- lines.push(`statuses: ${result.statuses.counts.total} total (${result.statuses.counts.builtin} builtin, ${result.statuses.counts.custom} custom)`);
1085
- for (const [label, entries] of [
1086
- ["builtin statuses", result.statuses.builtin],
1087
- ["custom statuses", result.statuses.custom],
1088
- ]) {
1089
- if (entries.length === 0) {
1090
- continue;
1091
- }
1092
- lines.push(`${label}: ${entries.map((entry) => entry.id).join(", ")}`);
1093
- }
1094
- lines.push(`custom fields: ${result.fields.counts.total} total`);
1095
- if (result.fields.custom.length > 0) {
1096
- lines.push(`fields: ${result.fields.custom.map((field) => `${field.key} (${field.type}, ${field.cli_flag})`).join(", ")}`);
1097
- }
1098
- lines.push(`Inspect one: pm schema show <Type>`);
1099
- lines.push(`Inspect one status: pm schema show-status <status>`);
1100
- lines.push(`Inspect one field: pm schema show-field <key>`);
1101
- return lines.join("\n");
1102
- }
1103
- /** Implements format schema show human for the public runtime surface of this module. */
1104
- export function formatSchemaShowHuman(result) {
1105
- const parts = [
1106
- `type: ${result.type.name}`,
1107
- `source: ${result.type.source}`,
1108
- `folder: ${result.type.folder}`,
1109
- ];
1110
- if (result.type.default_status) {
1111
- parts.push(`default_status: ${result.type.default_status}`);
1112
- }
1113
- if (result.type.aliases.length > 0) {
1114
- parts.push(`aliases: ${result.type.aliases.join(", ")}`);
1115
- }
1116
- if (result.type.description) {
1117
- parts.push(`description: ${result.type.description}`);
1118
- }
1119
- if (result.type.options.length > 0) {
1120
- parts.push(`options: ${result.type.options.map((option) => option.key).join(", ")}`);
1121
- }
1122
- return parts.join("\n");
1123
- }
1124
- /** Implements format schema show status human for the public runtime surface of this module. */
1125
- export function formatSchemaShowStatusHuman(result) {
1126
- const parts = [
1127
- `status: ${result.status.id}`,
1128
- `source: ${result.status.source}`,
1129
- ];
1130
- if (result.status.roles.length > 0) {
1131
- parts.push(`roles: ${result.status.roles.join(", ")}`);
1132
- }
1133
- if (result.status.aliases.length > 0) {
1134
- parts.push(`aliases: ${result.status.aliases.join(", ")}`);
1135
- }
1136
- if (result.status.description) {
1137
- parts.push(`description: ${result.status.description}`);
1138
- }
1139
- if (typeof result.status.order === "number") {
1140
- parts.push(`order: ${result.status.order}`);
1141
- }
1142
- return parts.join("\n");
1143
- }
1144
- function formatFieldSummaryLine(field) {
1145
- const flags = [];
1146
- if (field.required) {
1147
- flags.push("required");
1148
- }
1149
- if (field.required_on_create) {
1150
- flags.push("required_on_create");
1151
- }
1152
- if (!field.allow_unset) {
1153
- flags.push("no_unset");
1154
- }
1155
- const flagSuffix = flags.length > 0 ? ` [${flags.join(", ")}]` : "";
1156
- return `${field.key} (${field.type}) ${field.cli_flag} commands=${field.commands.join("/")}${flagSuffix}`;
1157
- }
1158
- /** Implements format schema add field human for the public runtime surface of this module. */
1159
- export function formatSchemaAddFieldHuman(result) {
1160
- const verb = result.replaced ? "Updated" : "Registered";
1161
- return `${verb} custom field "${result.field.key}" in ${result.file.path}. Use it: pm create "<title>" --${(result.field.cli_flag ?? result.field.key).replaceAll("_", "-")} <value>`;
1162
- }
1163
- /** Implements format schema remove field human for the public runtime surface of this module. */
1164
- export function formatSchemaRemoveFieldHuman(result) {
1165
- if (!result.removed) {
1166
- return `No custom field matched; nothing removed from ${result.file.path}.`;
1167
- }
1168
- const key = result.field?.key ?? "(unknown)";
1169
- return `Removed custom field "${key}" from ${result.file.path}.`;
1170
- }
1171
- /** Implements format schema list fields human for the public runtime surface of this module. */
1172
- export function formatSchemaListFieldsHuman(result) {
1173
- const lines = [`Custom fields: ${result.counts.total} total`];
1174
- for (const field of result.fields) {
1175
- lines.push(` ${formatFieldSummaryLine(field)}`);
1176
- }
1177
- lines.push(`Inspect one: pm schema show-field <key>`);
1178
- return lines.join("\n");
1179
- }
1180
- /** Implements format schema show field human for the public runtime surface of this module. */
1181
- export function formatSchemaShowFieldHuman(result) {
1182
- const field = result.field;
1183
- const parts = [
1184
- `field: ${field.key}`,
1185
- `type: ${field.type}`,
1186
- `cli_flag: ${field.cli_flag}`,
1187
- `commands: ${field.commands.join(", ")}`,
1188
- ];
1189
- if (field.cli_aliases.length > 0) {
1190
- parts.push(`cli_aliases: ${field.cli_aliases.join(", ")}`);
1191
- }
1192
- if (field.description) {
1193
- parts.push(`description: ${field.description}`);
1194
- }
1195
- if (field.required) {
1196
- parts.push(`required: true`);
1197
- }
1198
- if (field.required_on_create) {
1199
- parts.push(`required_on_create: true`);
1200
- }
1201
- if (!field.allow_unset) {
1202
- parts.push(`allow_unset: false`);
1203
- }
1204
- if (field.required_types.length > 0) {
1205
- parts.push(`required_types: ${field.required_types.join(", ")}`);
1206
- }
1207
- return parts.join("\n");
1208
- }
1209
- /** Implements format schema apply preset human for the public runtime surface of this module. */
1210
- export function formatSchemaApplyPresetHuman(result) {
1211
- const registered = result.registered.length > 0
1212
- ? `registered: ${result.registered.join(", ")}`
1213
- : "";
1214
- const replaced = result.replaced.length > 0 ? `updated: ${result.replaced.join(", ")}` : "";
1215
- const detail = [registered, replaced]
1216
- .filter((part) => part.length > 0)
1217
- .join("; ");
1218
- return `Applied "${result.preset}" type preset to ${result.file.path}${detail.length > 0 ? ` (${detail})` : ""}.`;
1219
- }
1220
- /** Implements format schema infer types human for the public runtime surface of this module. */
1221
- export function formatSchemaInferTypesHuman(result) {
1222
- if (result.candidates.length === 0) {
1223
- return `No title-prefix conventions found with at least ${result.min_count} items. Lower the threshold with --min-count <n>.`;
1224
- }
1225
- const lines = result.applied
1226
- ? [
1227
- `Inferred and registered custom types from title prefixes (min-count ${result.min_count}):`,
1228
- ]
1229
- : [
1230
- `Inferred custom type candidates from title prefixes (min-count ${result.min_count}, dry-run):`,
1231
- ];
1232
- for (const candidate of result.candidates) {
1233
- const note = candidate.shadows_builtin
1234
- ? " [shadows built-in, skipped]"
1235
- : "";
1236
- lines.push(` ${candidate.name} <- "${candidate.prefix}" (${candidate.count} items)${note}`);
1237
- }
1238
- if (!result.applied) {
1239
- lines.push(`Re-run with --apply to register the non-shadowing candidates.`);
1240
- }
1241
- else {
1242
- if (result.registered.length > 0) {
1243
- lines.push(`registered: ${result.registered.join(", ")}`);
1244
- }
1245
- if (result.replaced.length > 0) {
1246
- lines.push(`updated: ${result.replaced.join(", ")}`);
1247
- }
1248
- }
1249
- return lines.join("\n");
1250
- }
1251
- /* c8 ignore stop */
1252
- /** Re-export so register-mutation can surface the hint in usage examples without importing the core module directly. */
1253
- export { buildInvalidTypeHint };
1254
- /** Public contract for test only schema command, shared by SDK and presentation-layer consumers. */
1255
- export const _testOnlySchemaCommand = {
1256
- toAuthor,
1257
- workflowSlotsReferencing,
1258
- };
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]="1259041a-3566-5b2a-be21-591d487b6c34")}catch(e){}}();
9
+ export * from "../../sdk/schema.js";
1259
10
  //# sourceMappingURL=schema.js.map
1260
- //# debugId=c5ee3d92-dd9c-52d3-913e-47802396873f
11
+ //# debugId=1259041a-3566-5b2a-be21-591d487b6c34