@unbrained/pm-cli 2026.6.13 → 2026.6.17

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 (808) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/README.md +1 -1
  3. package/dist/cli/bootstrap-args.d.ts +29 -0
  4. package/dist/cli/bootstrap-args.js +11 -4
  5. package/dist/cli/bootstrap-args.js.map +1 -1
  6. package/dist/cli/commander-usage.d.ts +12 -0
  7. package/dist/cli/commander-usage.js +18 -7
  8. package/dist/cli/commander-usage.js.map +1 -1
  9. package/dist/cli/commands/activity.d.ts +19 -0
  10. package/dist/cli/commands/activity.js +12 -2
  11. package/dist/cli/commands/activity.js.map +1 -1
  12. package/dist/cli/commands/aggregate.d.ts +58 -0
  13. package/dist/cli/commands/aggregate.js +48 -15
  14. package/dist/cli/commands/aggregate.js.map +1 -1
  15. package/dist/cli/commands/annotation-command.d.ts +6 -1
  16. package/dist/cli/commands/annotation-command.js +72 -2
  17. package/dist/cli/commands/annotation-command.js.map +1 -1
  18. package/dist/cli/commands/append.js +4 -3
  19. package/dist/cli/commands/append.js.map +1 -1
  20. package/dist/cli/commands/close-many.d.ts +20 -0
  21. package/dist/cli/commands/close-many.js +14 -23
  22. package/dist/cli/commands/close-many.js.map +1 -1
  23. package/dist/cli/commands/close.js +37 -4
  24. package/dist/cli/commands/close.js.map +1 -1
  25. package/dist/cli/commands/comments-audit.js +3 -2
  26. package/dist/cli/commands/comments-audit.js.map +1 -1
  27. package/dist/cli/commands/comments.d.ts +2 -0
  28. package/dist/cli/commands/comments.js +49 -23
  29. package/dist/cli/commands/comments.js.map +1 -1
  30. package/dist/cli/commands/completion.js +362 -15
  31. package/dist/cli/commands/completion.js.map +1 -1
  32. package/dist/cli/commands/config.d.ts +51 -1
  33. package/dist/cli/commands/config.js +50 -12
  34. package/dist/cli/commands/config.js.map +1 -1
  35. package/dist/cli/commands/context.d.ts +79 -1
  36. package/dist/cli/commands/context.js +151 -25
  37. package/dist/cli/commands/context.js.map +1 -1
  38. package/dist/cli/commands/contracts.d.ts +80 -1
  39. package/dist/cli/commands/contracts.js +54 -4
  40. package/dist/cli/commands/contracts.js.map +1 -1
  41. package/dist/cli/commands/create.d.ts +51 -0
  42. package/dist/cli/commands/create.js +137 -18
  43. package/dist/cli/commands/create.js.map +1 -1
  44. package/dist/cli/commands/dedupe-audit.d.ts +33 -0
  45. package/dist/cli/commands/dedupe-audit.js +18 -14
  46. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  47. package/dist/cli/commands/deps.js +7 -4
  48. package/dist/cli/commands/deps.js.map +1 -1
  49. package/dist/cli/commands/event-validation-messages.js +3 -3
  50. package/dist/cli/commands/event-validation-messages.js.map +1 -1
  51. package/dist/cli/commands/extension/bundled-catalog.d.ts +7 -0
  52. package/dist/cli/commands/extension/bundled-catalog.js +19 -15
  53. package/dist/cli/commands/extension/bundled-catalog.js.map +1 -1
  54. package/dist/cli/commands/extension/install-sources.d.ts +41 -1
  55. package/dist/cli/commands/extension/install-sources.js +26 -8
  56. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  57. package/dist/cli/commands/extension/shared.d.ts +5 -0
  58. package/dist/cli/commands/extension/shared.js +9 -3
  59. package/dist/cli/commands/extension/shared.js.map +1 -1
  60. package/dist/cli/commands/extension.d.ts +133 -1
  61. package/dist/cli/commands/extension.js +127 -9
  62. package/dist/cli/commands/extension.js.map +1 -1
  63. package/dist/cli/commands/files.d.ts +30 -1
  64. package/dist/cli/commands/files.js +21 -2
  65. package/dist/cli/commands/files.js.map +1 -1
  66. package/dist/cli/commands/focus.d.ts +11 -0
  67. package/dist/cli/commands/focus.js +86 -0
  68. package/dist/cli/commands/focus.js.map +1 -0
  69. package/dist/cli/commands/get.d.ts +9 -2
  70. package/dist/cli/commands/get.js +34 -6
  71. package/dist/cli/commands/get.js.map +1 -1
  72. package/dist/cli/commands/guide.d.ts +5 -0
  73. package/dist/cli/commands/guide.js +6 -3
  74. package/dist/cli/commands/guide.js.map +1 -1
  75. package/dist/cli/commands/health.d.ts +109 -0
  76. package/dist/cli/commands/health.js +87 -35
  77. package/dist/cli/commands/health.js.map +1 -1
  78. package/dist/cli/commands/history-compact.js +27 -36
  79. package/dist/cli/commands/history-compact.js.map +1 -1
  80. package/dist/cli/commands/history-redact.d.ts +46 -0
  81. package/dist/cli/commands/history-redact.js +99 -67
  82. package/dist/cli/commands/history-redact.js.map +1 -1
  83. package/dist/cli/commands/history-repair.js +34 -37
  84. package/dist/cli/commands/history-repair.js.map +1 -1
  85. package/dist/cli/commands/history.js +6 -2
  86. package/dist/cli/commands/history.js.map +1 -1
  87. package/dist/cli/commands/index.d.ts +4 -1
  88. package/dist/cli/commands/index.js +6 -3
  89. package/dist/cli/commands/index.js.map +1 -1
  90. package/dist/cli/commands/init-agent-guidance.d.ts +54 -0
  91. package/dist/cli/commands/init-agent-guidance.js +31 -4
  92. package/dist/cli/commands/init-agent-guidance.js.map +1 -1
  93. package/dist/cli/commands/init.d.ts +38 -2
  94. package/dist/cli/commands/init.js +50 -64
  95. package/dist/cli/commands/init.js.map +1 -1
  96. package/dist/cli/commands/learnings.js +4 -3
  97. package/dist/cli/commands/learnings.js.map +1 -1
  98. package/dist/cli/commands/lifecycle-transitions.d.ts +23 -0
  99. package/dist/cli/commands/lifecycle-transitions.js +41 -0
  100. package/dist/cli/commands/lifecycle-transitions.js.map +1 -0
  101. package/dist/cli/commands/linked-artifacts.d.ts +5 -0
  102. package/dist/cli/commands/linked-artifacts.js +18 -4
  103. package/dist/cli/commands/linked-artifacts.js.map +1 -1
  104. package/dist/cli/commands/linked-test-parsers.d.ts +5 -0
  105. package/dist/cli/commands/linked-test-parsers.js +5 -2
  106. package/dist/cli/commands/linked-test-parsers.js.map +1 -1
  107. package/dist/cli/commands/list-filter-shared.d.ts +8 -0
  108. package/dist/cli/commands/list-filter-shared.js +70 -0
  109. package/dist/cli/commands/list-filter-shared.js.map +1 -0
  110. package/dist/cli/commands/list.d.ts +116 -0
  111. package/dist/cli/commands/list.js +194 -6
  112. package/dist/cli/commands/list.js.map +1 -1
  113. package/dist/cli/commands/normalize.js +16 -2
  114. package/dist/cli/commands/normalize.js.map +1 -1
  115. package/dist/cli/commands/notes.js +4 -3
  116. package/dist/cli/commands/notes.js.map +1 -1
  117. package/dist/cli/commands/plan.js +3 -2
  118. package/dist/cli/commands/plan.js.map +1 -1
  119. package/dist/cli/commands/recurrence-parsers.d.ts +9 -0
  120. package/dist/cli/commands/recurrence-parsers.js +19 -2
  121. package/dist/cli/commands/recurrence-parsers.js.map +1 -1
  122. package/dist/cli/commands/reindex.d.ts +83 -0
  123. package/dist/cli/commands/reindex.js +45 -10
  124. package/dist/cli/commands/reindex.js.map +1 -1
  125. package/dist/cli/commands/repeatable-metadata-parsers.js +28 -4
  126. package/dist/cli/commands/repeatable-metadata-parsers.js.map +1 -1
  127. package/dist/cli/commands/restore.d.ts +40 -1
  128. package/dist/cli/commands/restore.js +27 -2
  129. package/dist/cli/commands/restore.js.map +1 -1
  130. package/dist/cli/commands/scheduling-shortcuts.d.ts +43 -0
  131. package/dist/cli/commands/scheduling-shortcuts.js +87 -0
  132. package/dist/cli/commands/scheduling-shortcuts.js.map +1 -0
  133. package/dist/cli/commands/schema.d.ts +152 -2
  134. package/dist/cli/commands/schema.js +510 -4
  135. package/dist/cli/commands/schema.js.map +1 -1
  136. package/dist/cli/commands/search.d.ts +289 -1
  137. package/dist/cli/commands/search.js +367 -60
  138. package/dist/cli/commands/search.js.map +1 -1
  139. package/dist/cli/commands/stats.d.ts +38 -0
  140. package/dist/cli/commands/stats.js +38 -10
  141. package/dist/cli/commands/stats.js.map +1 -1
  142. package/dist/cli/commands/telemetry.js +5 -3
  143. package/dist/cli/commands/telemetry.js.map +1 -1
  144. package/dist/cli/commands/templates.d.ts +18 -0
  145. package/dist/cli/commands/templates.js +9 -2
  146. package/dist/cli/commands/templates.js.map +1 -1
  147. package/dist/cli/commands/test-all.d.ts +5 -0
  148. package/dist/cli/commands/test-all.js +9 -3
  149. package/dist/cli/commands/test-all.js.map +1 -1
  150. package/dist/cli/commands/test.d.ts +70 -1
  151. package/dist/cli/commands/test.js +84 -3
  152. package/dist/cli/commands/test.js.map +1 -1
  153. package/dist/cli/commands/update-many.d.ts +34 -1
  154. package/dist/cli/commands/update-many.js +60 -31
  155. package/dist/cli/commands/update-many.js.map +1 -1
  156. package/dist/cli/commands/update.d.ts +71 -0
  157. package/dist/cli/commands/update.js +91 -11
  158. package/dist/cli/commands/update.js.map +1 -1
  159. package/dist/cli/commands/upgrade.d.ts +28 -1
  160. package/dist/cli/commands/upgrade.js +17 -4
  161. package/dist/cli/commands/upgrade.js.map +1 -1
  162. package/dist/cli/commands/validate.d.ts +114 -0
  163. package/dist/cli/commands/validate.js +153 -8
  164. package/dist/cli/commands/validate.js.map +1 -1
  165. package/dist/cli/error-guidance.d.ts +30 -0
  166. package/dist/cli/error-guidance.js +41 -6
  167. package/dist/cli/error-guidance.js.map +1 -1
  168. package/dist/cli/extension-command-options.js +9 -7
  169. package/dist/cli/extension-command-options.js.map +1 -1
  170. package/dist/cli/help-content.d.ts +8 -0
  171. package/dist/cli/help-content.js +54 -6
  172. package/dist/cli/help-content.js.map +1 -1
  173. package/dist/cli/help-json-payload.d.ts +19 -1
  174. package/dist/cli/help-json-payload.js +16 -7
  175. package/dist/cli/help-json-payload.js.map +1 -1
  176. package/dist/cli/main.d.ts +242 -0
  177. package/dist/cli/main.js +241 -45
  178. package/dist/cli/main.js.map +1 -1
  179. package/dist/cli/register-list-query.js +62 -5
  180. package/dist/cli/register-list-query.js.map +1 -1
  181. package/dist/cli/register-mutation.d.ts +16 -0
  182. package/dist/cli/register-mutation.js +376 -100
  183. package/dist/cli/register-mutation.js.map +1 -1
  184. package/dist/cli/register-operations.d.ts +8 -0
  185. package/dist/cli/register-operations.js +134 -11
  186. package/dist/cli/register-operations.js.map +1 -1
  187. package/dist/cli/register-setup.js +9 -6
  188. package/dist/cli/register-setup.js.map +1 -1
  189. package/dist/cli/registration-helpers.d.ts +4 -0
  190. package/dist/cli/registration-helpers.js +124 -38
  191. package/dist/cli/registration-helpers.js.map +1 -1
  192. package/dist/cli-bundle/chunks/activity-PZYSZA26.js +18 -0
  193. package/dist/cli-bundle/chunks/{activity-PPO7QWJF.js → activity-SFM4THAU.js} +13 -11
  194. package/dist/cli-bundle/chunks/{aggregate-IRHJWEKG.js → aggregate-Y5ADDKBM.js} +55 -26
  195. package/dist/cli-bundle/chunks/aggregate-Y5ADDKBM.js.map +1 -0
  196. package/dist/cli-bundle/chunks/{aggregate-XEBW22UQ.js → aggregate-YTAUQLRW.js} +54 -25
  197. package/dist/cli-bundle/chunks/aggregate-YTAUQLRW.js.map +7 -0
  198. package/dist/cli-bundle/chunks/{append-NL67JNJU.js → append-4M7OVV7M.js} +11 -11
  199. package/dist/cli-bundle/chunks/append-4M7OVV7M.js.map +1 -0
  200. package/dist/cli-bundle/chunks/{append-N2AWXKZC.js → append-HSPK4L4V.js} +10 -10
  201. package/dist/cli-bundle/chunks/{append-N2AWXKZC.js.map → append-HSPK4L4V.js.map} +2 -2
  202. package/dist/cli-bundle/chunks/{chunk-IIOIBAQW.js → chunk-26BM6YLO.js} +3 -3
  203. package/dist/cli-bundle/chunks/{chunk-CEGUH2E5.js → chunk-2C6FU3D3.js} +5 -5
  204. package/dist/cli-bundle/chunks/{chunk-CEGUH2E5.js.map → chunk-2C6FU3D3.js.map} +1 -1
  205. package/dist/cli-bundle/chunks/{chunk-SQDKAEKG.js → chunk-2OPYLXDO.js} +117 -37
  206. package/dist/cli-bundle/chunks/chunk-2OPYLXDO.js.map +7 -0
  207. package/dist/cli-bundle/chunks/{chunk-4ZKKZMLH.js → chunk-2S46FKLB.js} +104 -30
  208. package/dist/cli-bundle/chunks/chunk-2S46FKLB.js.map +1 -0
  209. package/dist/cli-bundle/chunks/{chunk-LSSTKL3Y.js → chunk-2TMKMTEI.js} +3 -3
  210. package/dist/cli-bundle/chunks/{chunk-QU3OPNVV.js → chunk-2VH7DFSJ.js} +2 -2
  211. package/dist/cli-bundle/chunks/{chunk-RHYBR6G7.js → chunk-3ENF4NO4.js} +74 -14
  212. package/dist/cli-bundle/chunks/chunk-3ENF4NO4.js.map +1 -0
  213. package/dist/cli-bundle/chunks/chunk-3GR2HTYY.js +404 -0
  214. package/dist/cli-bundle/chunks/chunk-3GR2HTYY.js.map +7 -0
  215. package/dist/cli-bundle/chunks/{chunk-AAUYXSFF.js → chunk-3R3FYCBV.js} +223 -50
  216. package/dist/cli-bundle/chunks/chunk-3R3FYCBV.js.map +7 -0
  217. package/dist/cli-bundle/chunks/{chunk-5HSAHRYA.js → chunk-3UKJX3RP.js} +82 -21
  218. package/dist/cli-bundle/chunks/chunk-3UKJX3RP.js.map +7 -0
  219. package/dist/cli-bundle/chunks/chunk-4RTLBTYS.js +83 -0
  220. package/dist/cli-bundle/chunks/chunk-4RTLBTYS.js.map +1 -0
  221. package/dist/cli-bundle/chunks/{chunk-UCVJP4JL.js → chunk-5FDYWOJT.js} +52 -8
  222. package/dist/cli-bundle/chunks/chunk-5FDYWOJT.js.map +7 -0
  223. package/dist/cli-bundle/chunks/{chunk-LGOXXQUW.js → chunk-5XGWFUW2.js} +2 -2
  224. package/dist/cli-bundle/chunks/{chunk-LYNQ3NGI.js → chunk-6BD77FGL.js} +309 -20
  225. package/dist/cli-bundle/chunks/chunk-6BD77FGL.js.map +1 -0
  226. package/dist/cli-bundle/chunks/chunk-6EFCFPNE.js +35 -0
  227. package/dist/cli-bundle/chunks/chunk-6EFCFPNE.js.map +7 -0
  228. package/dist/cli-bundle/chunks/{chunk-36BCSMKP.js → chunk-6HF6CIY2.js} +26 -11
  229. package/dist/cli-bundle/chunks/chunk-6HF6CIY2.js.map +7 -0
  230. package/dist/cli-bundle/chunks/{chunk-M3SI2REU.js → chunk-6PBPD4MN.js} +322 -19
  231. package/dist/cli-bundle/chunks/chunk-6PBPD4MN.js.map +7 -0
  232. package/dist/cli-bundle/chunks/{chunk-TSXWFN3L.js → chunk-6VFUEGOA.js} +53 -9
  233. package/dist/cli-bundle/chunks/chunk-6VFUEGOA.js.map +1 -0
  234. package/dist/cli-bundle/chunks/{chunk-2J2AH4V5.js → chunk-AAOXSPAE.js} +56 -72
  235. package/dist/cli-bundle/chunks/chunk-AAOXSPAE.js.map +1 -0
  236. package/dist/cli-bundle/chunks/{chunk-Z647PYLD.js → chunk-AJCQ5GT6.js} +4 -4
  237. package/dist/cli-bundle/chunks/chunk-ALTGYHN3.js +61 -0
  238. package/dist/cli-bundle/chunks/chunk-ALTGYHN3.js.map +7 -0
  239. package/dist/cli-bundle/chunks/{chunk-KHGTYCJ6.js → chunk-AOJQL33L.js} +83 -22
  240. package/dist/cli-bundle/chunks/chunk-AOJQL33L.js.map +1 -0
  241. package/dist/cli-bundle/chunks/{chunk-5LMF75Q7.js → chunk-AXLDUGXA.js} +7 -4
  242. package/dist/cli-bundle/chunks/{chunk-5LMF75Q7.js.map → chunk-AXLDUGXA.js.map} +2 -2
  243. package/dist/cli-bundle/chunks/{chunk-DWG4FHPY.js → chunk-BITCVGHT.js} +2 -2
  244. package/dist/cli-bundle/chunks/{chunk-JE5IZXDS.js → chunk-CGQTFWYI.js} +4 -4
  245. package/dist/cli-bundle/chunks/{chunk-LFW5NQUP.js → chunk-CHM2VFVL.js} +407 -290
  246. package/dist/cli-bundle/chunks/chunk-CHM2VFVL.js.map +7 -0
  247. package/dist/cli-bundle/chunks/{chunk-VYZNX4C5.js → chunk-COVLE33A.js} +3 -3
  248. package/dist/cli-bundle/chunks/{chunk-SGMGMCIF.js → chunk-DDNBWH4W.js} +157 -25
  249. package/dist/cli-bundle/chunks/chunk-DDNBWH4W.js.map +1 -0
  250. package/dist/cli-bundle/chunks/{chunk-6ZFTM65G.js → chunk-F5MSD5HE.js} +2 -2
  251. package/dist/cli-bundle/chunks/{chunk-6TBR5AZ2.js → chunk-FAXB6F6R.js} +76 -8
  252. package/dist/cli-bundle/chunks/chunk-FAXB6F6R.js.map +7 -0
  253. package/dist/cli-bundle/chunks/{chunk-L6YQONLM.js → chunk-FPDK5BZQ.js} +18 -19
  254. package/dist/cli-bundle/chunks/chunk-FPDK5BZQ.js.map +1 -0
  255. package/dist/cli-bundle/chunks/{chunk-AGG32LKL.js → chunk-FPY2TOFI.js} +480 -24
  256. package/dist/cli-bundle/chunks/chunk-FPY2TOFI.js.map +1 -0
  257. package/dist/cli-bundle/chunks/{chunk-JWXTOYBI.js → chunk-G2MOUCTU.js} +121 -44
  258. package/dist/cli-bundle/chunks/chunk-G2MOUCTU.js.map +7 -0
  259. package/dist/cli-bundle/chunks/{chunk-3VULHQNS.js → chunk-G57RHEGP.js} +36 -18
  260. package/dist/cli-bundle/chunks/chunk-G57RHEGP.js.map +1 -0
  261. package/dist/cli-bundle/chunks/{chunk-QQG4HEX7.js → chunk-IROHIK2T.js} +37 -63
  262. package/dist/cli-bundle/chunks/chunk-IROHIK2T.js.map +1 -0
  263. package/dist/cli-bundle/chunks/{chunk-GOO4UXBI.js → chunk-JZHL4E3Q.js} +4 -4
  264. package/dist/cli-bundle/chunks/{chunk-XXLMJDUB.js → chunk-KA22USXD.js} +21 -22
  265. package/dist/cli-bundle/chunks/chunk-KA22USXD.js.map +7 -0
  266. package/dist/cli-bundle/chunks/{chunk-WLH7X4RN.js → chunk-KBC4O7SY.js} +56 -72
  267. package/dist/cli-bundle/chunks/chunk-KBC4O7SY.js.map +7 -0
  268. package/dist/cli-bundle/chunks/{chunk-NN6RKGFW.js → chunk-KCAGIH6K.js} +3 -3
  269. package/dist/cli-bundle/chunks/{chunk-BVL5KGVA.js → chunk-KO3VM5GS.js} +27 -12
  270. package/dist/cli-bundle/chunks/chunk-KO3VM5GS.js.map +1 -0
  271. package/dist/cli-bundle/chunks/{chunk-IXVSSHGV.js → chunk-LNH5Q32E.js} +13 -8
  272. package/dist/cli-bundle/chunks/chunk-LNH5Q32E.js.map +7 -0
  273. package/dist/cli-bundle/chunks/{chunk-3FMQMHAG.js → chunk-LORM3M2I.js} +4 -4
  274. package/dist/cli-bundle/chunks/{chunk-3FMQMHAG.js.map → chunk-LORM3M2I.js.map} +1 -1
  275. package/dist/cli-bundle/chunks/{chunk-PNYAAB4S.js → chunk-LWGMDLQ6.js} +8 -3
  276. package/dist/cli-bundle/chunks/chunk-LWGMDLQ6.js.map +1 -0
  277. package/dist/cli-bundle/chunks/{chunk-GFBEXDCQ.js → chunk-M4AVU7VC.js} +19 -8
  278. package/dist/cli-bundle/chunks/{chunk-GFBEXDCQ.js.map → chunk-M4AVU7VC.js.map} +2 -2
  279. package/dist/cli-bundle/chunks/{chunk-3CQPVBK3.js → chunk-MIBX6ZRN.js} +3 -3
  280. package/dist/cli-bundle/chunks/{chunk-AUDDXKNX.js → chunk-MMF2E3FM.js} +77 -9
  281. package/dist/cli-bundle/chunks/chunk-MMF2E3FM.js.map +1 -0
  282. package/dist/cli-bundle/chunks/{chunk-RFR2YQGO.js → chunk-MORZOR7W.js} +21 -8
  283. package/dist/cli-bundle/chunks/chunk-MORZOR7W.js.map +1 -0
  284. package/dist/cli-bundle/chunks/{chunk-4TPFXE2R.js → chunk-MUTUZ2HD.js} +118 -74
  285. package/dist/cli-bundle/chunks/chunk-MUTUZ2HD.js.map +1 -0
  286. package/dist/cli-bundle/chunks/{chunk-HZOX5BYD.js → chunk-OGXEBTX3.js} +35 -17
  287. package/dist/cli-bundle/chunks/chunk-OGXEBTX3.js.map +7 -0
  288. package/dist/cli-bundle/chunks/{chunk-LOAR5TKX.js → chunk-OOIH6J5T.js} +4 -4
  289. package/dist/cli-bundle/chunks/{chunk-LOAR5TKX.js.map → chunk-OOIH6J5T.js.map} +1 -1
  290. package/dist/cli-bundle/chunks/{chunk-VNC2HBL4.js → chunk-OSBJPPX3.js} +20 -9
  291. package/dist/cli-bundle/chunks/chunk-OSBJPPX3.js.map +1 -0
  292. package/dist/cli-bundle/chunks/{chunk-2ANTZBYF.js → chunk-PJS3WDO2.js} +122 -45
  293. package/dist/cli-bundle/chunks/chunk-PJS3WDO2.js.map +1 -0
  294. package/dist/cli-bundle/chunks/{chunk-7SM7VA5I.js → chunk-QGPE2H6Z.js} +19 -8
  295. package/dist/cli-bundle/chunks/chunk-QGPE2H6Z.js.map +7 -0
  296. package/dist/cli-bundle/chunks/chunk-QVTFFLR2.js +58 -0
  297. package/dist/cli-bundle/chunks/chunk-QVTFFLR2.js.map +1 -0
  298. package/dist/cli-bundle/chunks/{chunk-JCTZV7TO.js → chunk-QW2F6ARZ.js} +8 -5
  299. package/dist/cli-bundle/chunks/{chunk-JCTZV7TO.js.map → chunk-QW2F6ARZ.js.map} +1 -1
  300. package/dist/cli-bundle/chunks/{chunk-TOX7YQ7X.js → chunk-QXC3LWB7.js} +223 -50
  301. package/dist/cli-bundle/chunks/chunk-QXC3LWB7.js.map +1 -0
  302. package/dist/cli-bundle/chunks/{chunk-W6KNFAMZ.js → chunk-QXMXRPX5.js} +9 -8
  303. package/dist/cli-bundle/chunks/chunk-QXMXRPX5.js.map +7 -0
  304. package/dist/cli-bundle/chunks/{chunk-O3YCJOVX.js → chunk-R4AKUPKI.js} +3 -3
  305. package/dist/cli-bundle/chunks/{chunk-O3YCJOVX.js.map → chunk-R4AKUPKI.js.map} +1 -1
  306. package/dist/cli-bundle/chunks/chunk-RASR23HV.js +394 -0
  307. package/dist/cli-bundle/chunks/chunk-RASR23HV.js.map +1 -0
  308. package/dist/cli-bundle/chunks/{chunk-JW7D6437.js → chunk-SCDCNGCV.js} +20 -9
  309. package/dist/cli-bundle/chunks/chunk-SCDCNGCV.js.map +1 -0
  310. package/dist/cli-bundle/chunks/{chunk-GRZGHGRG.js → chunk-SCS5PVAA.js} +10 -9
  311. package/dist/cli-bundle/chunks/{chunk-GRZGHGRG.js.map → chunk-SCS5PVAA.js.map} +2 -2
  312. package/dist/cli-bundle/chunks/{chunk-S2CDTRJ6.js → chunk-SJCMTOEU.js} +381 -271
  313. package/dist/cli-bundle/chunks/chunk-SJCMTOEU.js.map +1 -0
  314. package/dist/cli-bundle/chunks/{chunk-XWDZVCBJ.js → chunk-SO2ES46D.js} +11 -10
  315. package/dist/cli-bundle/chunks/{chunk-XWDZVCBJ.js.map → chunk-SO2ES46D.js.map} +1 -1
  316. package/dist/cli-bundle/chunks/{chunk-MACCNKSZ.js → chunk-TBV33CB4.js} +36 -62
  317. package/dist/cli-bundle/chunks/chunk-TBV33CB4.js.map +7 -0
  318. package/dist/cli-bundle/chunks/chunk-TEFEXQWI.js +86 -0
  319. package/dist/cli-bundle/chunks/chunk-TEFEXQWI.js.map +7 -0
  320. package/dist/cli-bundle/chunks/{chunk-HLEGAQXT.js → chunk-TWBDDVIF.js} +20 -7
  321. package/dist/cli-bundle/chunks/chunk-TWBDDVIF.js.map +7 -0
  322. package/dist/cli-bundle/chunks/{chunk-4JHJ7YG2.js → chunk-UGUJ2UOR.js} +118 -74
  323. package/dist/cli-bundle/chunks/chunk-UGUJ2UOR.js.map +7 -0
  324. package/dist/cli-bundle/chunks/{chunk-XOYHMHFF.js → chunk-UN6P3IJ4.js} +3 -3
  325. package/dist/cli-bundle/chunks/{chunk-32XSW44C.js → chunk-V2GYOMEX.js} +10 -9
  326. package/dist/cli-bundle/chunks/chunk-V2GYOMEX.js.map +1 -0
  327. package/dist/cli-bundle/chunks/{chunk-HWHONML5.js → chunk-VF3KQGNY.js} +4 -4
  328. package/dist/cli-bundle/chunks/{chunk-SOHXUA2Q.js → chunk-VHG6LUKR.js} +116 -36
  329. package/dist/cli-bundle/chunks/chunk-VHG6LUKR.js.map +1 -0
  330. package/dist/cli-bundle/chunks/{chunk-7CRFV6JR.js → chunk-VXHMQDXA.js} +483 -27
  331. package/dist/cli-bundle/chunks/chunk-VXHMQDXA.js.map +7 -0
  332. package/dist/cli-bundle/chunks/{chunk-IZHCCG4S.js → chunk-VXRFAE7W.js} +14 -9
  333. package/dist/cli-bundle/chunks/chunk-VXRFAE7W.js.map +1 -0
  334. package/dist/cli-bundle/chunks/{chunk-R4VWYWRN.js → chunk-W3HFLORZ.js} +7 -2
  335. package/dist/cli-bundle/chunks/chunk-W3HFLORZ.js.map +7 -0
  336. package/dist/cli-bundle/chunks/{chunk-4FHLNNW7.js → chunk-WQRL4COW.js} +74 -14
  337. package/dist/cli-bundle/chunks/chunk-WQRL4COW.js.map +7 -0
  338. package/dist/cli-bundle/chunks/chunk-X3W5ESZQ.js +32 -0
  339. package/dist/cli-bundle/chunks/chunk-X3W5ESZQ.js.map +1 -0
  340. package/dist/cli-bundle/chunks/{chunk-MGAQ6KZG.js → chunk-XESAPVZ4.js} +166 -27
  341. package/dist/cli-bundle/chunks/chunk-XESAPVZ4.js.map +7 -0
  342. package/dist/cli-bundle/chunks/{chunk-PEH7SZD2.js → chunk-YLAW3FZN.js} +105 -31
  343. package/dist/cli-bundle/chunks/chunk-YLAW3FZN.js.map +7 -0
  344. package/dist/cli-bundle/chunks/{claim-HE6KEGJW.js → claim-WGAWJCPY.js} +10 -10
  345. package/dist/cli-bundle/chunks/{claim-QJOQBH7J.js → claim-ZI6P4LMU.js} +10 -10
  346. package/dist/cli-bundle/chunks/close-I7PRQ5G7.js +13 -0
  347. package/dist/cli-bundle/chunks/{close-SPUFW5QR.js → close-JMVVSIQE.js} +8 -8
  348. package/dist/cli-bundle/chunks/{close-many-GKAJX54X.js → close-many-IKPJXVOZ.js} +32 -20
  349. package/dist/cli-bundle/chunks/close-many-IKPJXVOZ.js.map +1 -0
  350. package/dist/cli-bundle/chunks/{close-many-GL6NRUU5.js → close-many-TXABDCSJ.js} +31 -19
  351. package/dist/cli-bundle/chunks/close-many-TXABDCSJ.js.map +7 -0
  352. package/dist/cli-bundle/chunks/{comments-5FPT6L7N.js → comments-RLWR2S7W.js} +55 -31
  353. package/dist/cli-bundle/chunks/comments-RLWR2S7W.js.map +1 -0
  354. package/dist/cli-bundle/chunks/{comments-TOLOYWNI.js → comments-YAMXKHUX.js} +54 -30
  355. package/dist/cli-bundle/chunks/comments-YAMXKHUX.js.map +7 -0
  356. package/dist/cli-bundle/chunks/{config-7N6D7YJE.js → config-7ICYC2WU.js} +83 -19
  357. package/dist/cli-bundle/chunks/config-7ICYC2WU.js.map +7 -0
  358. package/dist/cli-bundle/chunks/{config-4MN45TIH.js → config-NGWN3EXC.js} +83 -19
  359. package/dist/cli-bundle/chunks/config-NGWN3EXC.js.map +1 -0
  360. package/dist/cli-bundle/chunks/{context-AQSLE7DZ.js → context-K6QAHN5H.js} +128 -39
  361. package/dist/cli-bundle/chunks/context-K6QAHN5H.js.map +1 -0
  362. package/dist/cli-bundle/chunks/{context-U3PUJMVN.js → context-VGXOOAH2.js} +127 -38
  363. package/dist/cli-bundle/chunks/context-VGXOOAH2.js.map +7 -0
  364. package/dist/cli-bundle/chunks/{contracts-ITSJXO3O.js → contracts-KJGY2AQA.js} +99 -15
  365. package/dist/cli-bundle/chunks/contracts-KJGY2AQA.js.map +1 -0
  366. package/dist/cli-bundle/chunks/{contracts-H7KCQXLY.js → contracts-KMA6OJY7.js} +99 -15
  367. package/dist/cli-bundle/chunks/contracts-KMA6OJY7.js.map +7 -0
  368. package/dist/cli-bundle/chunks/{copy-EB3MUCSW.js → copy-Q2PPU4AY.js} +7 -7
  369. package/dist/cli-bundle/chunks/{copy-C4W522JM.js → copy-SC6UF3PI.js} +7 -7
  370. package/dist/cli-bundle/chunks/{create-4EQNELMY.js → create-76FE7JVF.js} +16 -13
  371. package/dist/cli-bundle/chunks/create-RTRFW6RE.js +30 -0
  372. package/dist/cli-bundle/chunks/{delete-X5QLXIQX.js → delete-T6DJSUJI.js} +7 -7
  373. package/dist/cli-bundle/chunks/{delete-ZLGUYIXU.js → delete-XFUX533E.js} +7 -7
  374. package/dist/cli-bundle/chunks/{deps-GPB3LGWN.js → deps-5GWMMS6D.js} +9 -10
  375. package/dist/cli-bundle/chunks/{deps-GPB3LGWN.js.map → deps-5GWMMS6D.js.map} +2 -2
  376. package/dist/cli-bundle/chunks/{deps-HV2C2L46.js → deps-MCCU633S.js} +10 -11
  377. package/dist/cli-bundle/chunks/deps-MCCU633S.js.map +1 -0
  378. package/dist/cli-bundle/chunks/{docs-SRTLCQOL.js → docs-HE3HCQ4S.js} +9 -9
  379. package/dist/cli-bundle/chunks/{docs-RJQPLROO.js → docs-SXMOABHR.js} +9 -9
  380. package/dist/cli-bundle/chunks/{extension-WKPVPNCC.js → extension-E23K4QRR.js} +7 -5
  381. package/dist/cli-bundle/chunks/{extension-MM3TVWOO.js → extension-PMD3XMLN.js} +7 -5
  382. package/dist/cli-bundle/chunks/{files-OIFN3DQX.js → files-2RSWGPEU.js} +25 -11
  383. package/dist/cli-bundle/chunks/files-2RSWGPEU.js.map +1 -0
  384. package/dist/cli-bundle/chunks/{files-LIFDKNCN.js → files-ZWFJFWBK.js} +24 -10
  385. package/dist/cli-bundle/chunks/files-ZWFJFWBK.js.map +7 -0
  386. package/dist/cli-bundle/chunks/focus-KTTB3P3F.js +106 -0
  387. package/dist/cli-bundle/chunks/focus-KTTB3P3F.js.map +1 -0
  388. package/dist/cli-bundle/chunks/focus-ZMDP4FEL.js +109 -0
  389. package/dist/cli-bundle/chunks/focus-ZMDP4FEL.js.map +7 -0
  390. package/dist/cli-bundle/chunks/{gc-NRFHLVFT.js → gc-BXIAKLAH.js} +3 -3
  391. package/dist/cli-bundle/chunks/{gc-DL6AVOX5.js → gc-C7K6JNUO.js} +3 -3
  392. package/dist/cli-bundle/chunks/{get-SAB7CRBG.js → get-AZQLC4NO.js} +43 -16
  393. package/dist/cli-bundle/chunks/get-AZQLC4NO.js.map +1 -0
  394. package/dist/cli-bundle/chunks/{get-K7UULTQF.js → get-I65HTAWO.js} +42 -15
  395. package/dist/cli-bundle/chunks/get-I65HTAWO.js.map +7 -0
  396. package/dist/cli-bundle/chunks/{health-NUVZYIEV.js → health-3MFFPQVZ.js} +75 -49
  397. package/dist/cli-bundle/chunks/health-3MFFPQVZ.js.map +1 -0
  398. package/dist/cli-bundle/chunks/{health-VJWH3ZFK.js → health-MYZEOCLI.js} +74 -48
  399. package/dist/cli-bundle/chunks/health-MYZEOCLI.js.map +7 -0
  400. package/dist/cli-bundle/chunks/{history-GYFD2DJW.js → history-73Z6OBFZ.js} +10 -10
  401. package/dist/cli-bundle/chunks/history-BIPHVUMF.js +20 -0
  402. package/dist/cli-bundle/chunks/{history-compact-WQZQ6KXM.js → history-compact-24VQ63A3.js} +37 -46
  403. package/dist/cli-bundle/chunks/history-compact-24VQ63A3.js.map +7 -0
  404. package/dist/cli-bundle/chunks/{history-compact-SLL6ESXH.js → history-compact-UIAR2OI4.js} +38 -47
  405. package/dist/cli-bundle/chunks/history-compact-UIAR2OI4.js.map +1 -0
  406. package/dist/cli-bundle/chunks/{history-redact-SDTDR6WM.js → history-redact-7YCXEWJD.js} +13 -11
  407. package/dist/cli-bundle/chunks/history-redact-WZZ6GZ2Z.js +21 -0
  408. package/dist/cli-bundle/chunks/{history-repair-BJCGM6Q3.js → history-repair-4NOFFG2W.js} +44 -49
  409. package/dist/cli-bundle/chunks/history-repair-4NOFFG2W.js.map +1 -0
  410. package/dist/cli-bundle/chunks/{history-repair-UCYS55ZX.js → history-repair-GQN2X4TR.js} +43 -48
  411. package/dist/cli-bundle/chunks/history-repair-GQN2X4TR.js.map +7 -0
  412. package/dist/cli-bundle/chunks/init-K34V4PZR.js +20 -0
  413. package/dist/cli-bundle/chunks/{init-MXV57LKL.js → init-TDEDNVMM.js} +12 -9
  414. package/dist/cli-bundle/chunks/{learnings-QKJOKEAO.js → learnings-TV2CTGJ3.js} +13 -12
  415. package/dist/cli-bundle/chunks/learnings-TV2CTGJ3.js.map +7 -0
  416. package/dist/cli-bundle/chunks/{learnings-L6KTZGOT.js → learnings-U67FTXPB.js} +14 -13
  417. package/dist/cli-bundle/chunks/learnings-U67FTXPB.js.map +1 -0
  418. package/dist/cli-bundle/chunks/list-MSHYOCFU.js +33 -0
  419. package/dist/cli-bundle/chunks/list-VV57WGUD.js +29 -0
  420. package/dist/cli-bundle/chunks/{notes-HMCB7TK6.js → notes-EUANWWKD.js} +13 -12
  421. package/dist/cli-bundle/chunks/notes-EUANWWKD.js.map +7 -0
  422. package/dist/cli-bundle/chunks/{notes-3NLK7WTZ.js → notes-GYVNDAL4.js} +14 -13
  423. package/dist/cli-bundle/chunks/notes-GYVNDAL4.js.map +1 -0
  424. package/dist/cli-bundle/chunks/{plan-NANUWH4T.js → plan-4LF4AV63.js} +15 -14
  425. package/dist/cli-bundle/chunks/plan-4LF4AV63.js.map +7 -0
  426. package/dist/cli-bundle/chunks/{plan-DWBYI5C6.js → plan-W27O6DBS.js} +16 -15
  427. package/dist/cli-bundle/chunks/plan-W27O6DBS.js.map +1 -0
  428. package/dist/cli-bundle/chunks/{register-list-query-SMMMLSWW.js → register-list-query-BXLEHJ7L.js} +32 -23
  429. package/dist/cli-bundle/chunks/register-list-query-BXLEHJ7L.js.map +1 -0
  430. package/dist/cli-bundle/chunks/{register-list-query-PWQ5F2VI.js → register-list-query-C2MS3BVQ.js} +31 -22
  431. package/dist/cli-bundle/chunks/register-list-query-C2MS3BVQ.js.map +7 -0
  432. package/dist/cli-bundle/chunks/{register-mutation-QKFPTIZG.js → register-mutation-6UCOEQ6L.js} +361 -106
  433. package/dist/cli-bundle/chunks/register-mutation-6UCOEQ6L.js.map +7 -0
  434. package/dist/cli-bundle/chunks/{register-mutation-ZYJQ4DVP.js → register-mutation-HE73PREP.js} +355 -107
  435. package/dist/cli-bundle/chunks/register-mutation-HE73PREP.js.map +1 -0
  436. package/dist/cli-bundle/chunks/{register-operations-2FMZ6WEF.js → register-operations-L6C32FDA.js} +111 -39
  437. package/dist/cli-bundle/chunks/register-operations-L6C32FDA.js.map +7 -0
  438. package/dist/cli-bundle/chunks/{register-operations-BAFQURZG.js → register-operations-QQEHEX4P.js} +112 -40
  439. package/dist/cli-bundle/chunks/register-operations-QQEHEX4P.js.map +1 -0
  440. package/dist/cli-bundle/chunks/{register-setup-QN2XV7UL.js → register-setup-A7N4PNT3.js} +18 -21
  441. package/dist/cli-bundle/chunks/register-setup-A7N4PNT3.js.map +1 -0
  442. package/dist/cli-bundle/chunks/{register-setup-DQEIKBIP.js → register-setup-WHG3NBP6.js} +17 -20
  443. package/dist/cli-bundle/chunks/register-setup-WHG3NBP6.js.map +7 -0
  444. package/dist/cli-bundle/chunks/{restore-FJQWXMPY.js → restore-TSWSULYY.js} +13 -11
  445. package/dist/cli-bundle/chunks/restore-XQXICL3V.js +19 -0
  446. package/dist/cli-bundle/chunks/scheduling-shortcuts-NC46K6BD.js +91 -0
  447. package/dist/cli-bundle/chunks/scheduling-shortcuts-NC46K6BD.js.map +7 -0
  448. package/dist/cli-bundle/chunks/scheduling-shortcuts-UGDPQALY.js +88 -0
  449. package/dist/cli-bundle/chunks/scheduling-shortcuts-UGDPQALY.js.map +1 -0
  450. package/dist/cli-bundle/chunks/{schema-ZZ7ZDM2X.js → schema-7U7JUYGK.js} +797 -10
  451. package/dist/cli-bundle/chunks/schema-7U7JUYGK.js.map +1 -0
  452. package/dist/cli-bundle/chunks/{schema-RNVJ55V2.js → schema-TSBYSEMW.js} +810 -9
  453. package/dist/cli-bundle/chunks/schema-TSBYSEMW.js.map +7 -0
  454. package/dist/cli-bundle/chunks/{search-BJ457C2A.js → search-OXLSQKHP.js} +328 -71
  455. package/dist/cli-bundle/chunks/search-OXLSQKHP.js.map +7 -0
  456. package/dist/cli-bundle/chunks/{search-FQDZXX7P.js → search-T3TOFLOQ.js} +328 -71
  457. package/dist/cli-bundle/chunks/search-T3TOFLOQ.js.map +1 -0
  458. package/dist/cli-bundle/chunks/{stats-DUQWCVOS.js → stats-5CLG22YZ.js} +41 -16
  459. package/dist/cli-bundle/chunks/stats-5CLG22YZ.js.map +7 -0
  460. package/dist/cli-bundle/chunks/{stats-CUG3ZHOI.js → stats-XEMUXS42.js} +42 -17
  461. package/dist/cli-bundle/chunks/stats-XEMUXS42.js.map +1 -0
  462. package/dist/cli-bundle/chunks/{telemetry-RK2VX75A.js → telemetry-23OPBBZT.js} +7 -7
  463. package/dist/cli-bundle/chunks/telemetry-23OPBBZT.js.map +1 -0
  464. package/dist/cli-bundle/chunks/{telemetry-33MRGX4Z.js → telemetry-I3D7XZ55.js} +6 -6
  465. package/dist/cli-bundle/chunks/telemetry-I3D7XZ55.js.map +7 -0
  466. package/dist/cli-bundle/chunks/test-AROS3LIV.js +35 -0
  467. package/dist/cli-bundle/chunks/{test-Y3CTFMEC.js → test-CECIMKOA.js} +17 -14
  468. package/dist/cli-bundle/chunks/{test-all-ARSMX33Q.js → test-all-4DEQPIXH.js} +25 -17
  469. package/dist/cli-bundle/chunks/test-all-4DEQPIXH.js.map +1 -0
  470. package/dist/cli-bundle/chunks/{test-all-ANYQ33O2.js → test-all-6RO6X3SM.js} +24 -16
  471. package/dist/cli-bundle/chunks/test-all-6RO6X3SM.js.map +7 -0
  472. package/dist/cli-bundle/chunks/{test-runs-5URSD34O.js → test-runs-AAXVFWKH.js} +62 -65
  473. package/dist/cli-bundle/chunks/test-runs-AAXVFWKH.js.map +1 -0
  474. package/dist/cli-bundle/chunks/{test-runs-XNACGSNQ.js → test-runs-LYBQSYRC.js} +61 -64
  475. package/dist/cli-bundle/chunks/test-runs-LYBQSYRC.js.map +7 -0
  476. package/dist/cli-bundle/chunks/update-MIWEJC76.js +24 -0
  477. package/dist/cli-bundle/chunks/update-P7I5YSRB.js +28 -0
  478. package/dist/cli-bundle/chunks/{update-many-724JCVDE.js → update-many-5B4HLVBK.js} +79 -33
  479. package/dist/cli-bundle/chunks/update-many-5B4HLVBK.js.map +7 -0
  480. package/dist/cli-bundle/chunks/{update-many-6B7PJ33I.js → update-many-G2QOVZSB.js} +80 -34
  481. package/dist/cli-bundle/chunks/update-many-G2QOVZSB.js.map +1 -0
  482. package/dist/cli-bundle/chunks/{upgrade-QHRGDBSA.js → upgrade-GFIDL62L.js} +23 -9
  483. package/dist/cli-bundle/chunks/upgrade-GFIDL62L.js.map +1 -0
  484. package/dist/cli-bundle/chunks/{upgrade-ALBEZAI7.js → upgrade-QUQYL7D3.js} +22 -8
  485. package/dist/cli-bundle/chunks/upgrade-QUQYL7D3.js.map +7 -0
  486. package/dist/cli-bundle/chunks/{validate-UY6DRCG5.js → validate-ADDZBMM3.js} +236 -30
  487. package/dist/cli-bundle/chunks/validate-ADDZBMM3.js.map +7 -0
  488. package/dist/cli-bundle/chunks/{validate-IQRYFXIV.js → validate-MAS3H6ZP.js} +222 -30
  489. package/dist/cli-bundle/chunks/validate-MAS3H6ZP.js.map +1 -0
  490. package/dist/cli-bundle/main.js +312 -139
  491. package/dist/cli-bundle/main.js.map +3 -3
  492. package/dist/cli.d.ts +10 -0
  493. package/dist/cli.js +21 -8
  494. package/dist/cli.js.map +1 -1
  495. package/dist/core/config/nested-settings.js +40 -2
  496. package/dist/core/config/nested-settings.js.map +1 -1
  497. package/dist/core/diagnostics/remediation.js +7 -2
  498. package/dist/core/diagnostics/remediation.js.map +1 -1
  499. package/dist/core/extensions/extension-policy.js +14 -15
  500. package/dist/core/extensions/extension-policy.js.map +1 -1
  501. package/dist/core/extensions/item-fields.js +4 -5
  502. package/dist/core/extensions/item-fields.js.map +1 -1
  503. package/dist/core/extensions/loader.d.ts +75 -1
  504. package/dist/core/extensions/loader.js +56 -32
  505. package/dist/core/extensions/loader.js.map +1 -1
  506. package/dist/core/governance/content-fields.d.ts +84 -0
  507. package/dist/core/governance/content-fields.js +182 -0
  508. package/dist/core/governance/content-fields.js.map +1 -0
  509. package/dist/core/governance/issue-codes.d.ts +51 -0
  510. package/dist/core/governance/issue-codes.js +95 -0
  511. package/dist/core/governance/issue-codes.js.map +1 -0
  512. package/dist/core/governance/metadata-coverage.d.ts +168 -0
  513. package/dist/core/governance/metadata-coverage.js +362 -0
  514. package/dist/core/governance/metadata-coverage.js.map +1 -0
  515. package/dist/core/history/history-rewrite.d.ts +22 -0
  516. package/dist/core/history/history-rewrite.js +38 -2
  517. package/dist/core/history/history-rewrite.js.map +1 -1
  518. package/dist/core/history/history.d.ts +7 -0
  519. package/dist/core/history/history.js +6 -2
  520. package/dist/core/history/history.js.map +1 -1
  521. package/dist/core/io/body-file.d.ts +14 -0
  522. package/dist/core/io/body-file.js +47 -0
  523. package/dist/core/io/body-file.js.map +1 -0
  524. package/dist/core/item/item-format.d.ts +46 -1
  525. package/dist/core/item/item-format.js +51 -60
  526. package/dist/core/item/item-format.js.map +1 -1
  527. package/dist/core/item/parse.d.ts +41 -0
  528. package/dist/core/item/parse.js +69 -16
  529. package/dist/core/item/parse.js.map +1 -1
  530. package/dist/core/item/type-registry.d.ts +1 -0
  531. package/dist/core/item/type-registry.js +8 -10
  532. package/dist/core/item/type-registry.js.map +1 -1
  533. package/dist/core/lock/lock.d.ts +26 -0
  534. package/dist/core/lock/lock.js +10 -2
  535. package/dist/core/lock/lock.js.map +1 -1
  536. package/dist/core/output/output.d.ts +7 -0
  537. package/dist/core/output/output.js +6 -2
  538. package/dist/core/output/output.js.map +1 -1
  539. package/dist/core/schema/fields-file.d.ts +94 -0
  540. package/dist/core/schema/fields-file.js +317 -0
  541. package/dist/core/schema/fields-file.js.map +1 -0
  542. package/dist/core/schema/item-types-file.d.ts +25 -2
  543. package/dist/core/schema/item-types-file.js +78 -6
  544. package/dist/core/schema/item-types-file.js.map +1 -1
  545. package/dist/core/schema/runtime-schema.d.ts +7 -0
  546. package/dist/core/schema/runtime-schema.js +23 -16
  547. package/dist/core/schema/runtime-schema.js.map +1 -1
  548. package/dist/core/schema/type-inference.d.ts +34 -0
  549. package/dist/core/schema/type-inference.js +97 -0
  550. package/dist/core/schema/type-inference.js.map +1 -0
  551. package/dist/core/schema/type-presets.d.ts +30 -0
  552. package/dist/core/schema/type-presets.js +96 -0
  553. package/dist/core/schema/type-presets.js.map +1 -0
  554. package/dist/core/search/cache.d.ts +19 -1
  555. package/dist/core/search/cache.js +11 -3
  556. package/dist/core/search/cache.js.map +1 -1
  557. package/dist/core/search/corpus.d.ts +36 -2
  558. package/dist/core/search/corpus.js +120 -24
  559. package/dist/core/search/corpus.js.map +1 -1
  560. package/dist/core/search/providers.d.ts +19 -0
  561. package/dist/core/search/providers.js +19 -2
  562. package/dist/core/search/providers.js.map +1 -1
  563. package/dist/core/sentry/instrument.d.ts +1 -0
  564. package/dist/core/sentry/instrument.js +6 -2
  565. package/dist/core/sentry/instrument.js.map +1 -1
  566. package/dist/core/session/session-state.d.ts +16 -0
  567. package/dist/core/session/session-state.js +48 -0
  568. package/dist/core/session/session-state.js.map +1 -0
  569. package/dist/core/shared/constants.d.ts +8 -0
  570. package/dist/core/shared/constants.js +11 -2
  571. package/dist/core/shared/constants.js.map +1 -1
  572. package/dist/core/shared/text-normalization.js +4 -3
  573. package/dist/core/shared/text-normalization.js.map +1 -1
  574. package/dist/core/shared/time.d.ts +13 -0
  575. package/dist/core/shared/time.js +19 -7
  576. package/dist/core/shared/time.js.map +1 -1
  577. package/dist/core/store/front-matter-cache.d.ts +13 -0
  578. package/dist/core/store/front-matter-cache.js +21 -11
  579. package/dist/core/store/front-matter-cache.js.map +1 -1
  580. package/dist/core/store/item-store.d.ts +11 -0
  581. package/dist/core/store/item-store.js +12 -3
  582. package/dist/core/store/item-store.js.map +1 -1
  583. package/dist/core/store/settings-validator.d.ts +2 -0
  584. package/dist/core/store/settings-validator.js +25 -2
  585. package/dist/core/store/settings-validator.js.map +1 -1
  586. package/dist/core/store/settings.d.ts +60 -1
  587. package/dist/core/store/settings.js +100 -46
  588. package/dist/core/store/settings.js.map +1 -1
  589. package/dist/core/telemetry/observability.js +10 -8
  590. package/dist/core/telemetry/observability.js.map +1 -1
  591. package/dist/core/telemetry/runtime.d.ts +272 -1
  592. package/dist/core/telemetry/runtime.js +358 -37
  593. package/dist/core/telemetry/runtime.js.map +1 -1
  594. package/dist/core/test/background-runs.d.ts +35 -0
  595. package/dist/core/test/background-runs.js +72 -61
  596. package/dist/core/test/background-runs.js.map +1 -1
  597. package/dist/core/test/run-selectors.js +5 -4
  598. package/dist/core/test/run-selectors.js.map +1 -1
  599. package/dist/core/validate/estimate-defaults.d.ts +39 -0
  600. package/dist/core/validate/estimate-defaults.js +117 -0
  601. package/dist/core/validate/estimate-defaults.js.map +1 -0
  602. package/dist/core/validate/fix-planning.d.ts +21 -3
  603. package/dist/core/validate/fix-planning.js +31 -4
  604. package/dist/core/validate/fix-planning.js.map +1 -1
  605. package/dist/core/validate/missing-link-owners.d.ts +64 -0
  606. package/dist/core/validate/missing-link-owners.js +98 -0
  607. package/dist/core/validate/missing-link-owners.js.map +1 -0
  608. package/dist/mcp/server.d.ts +61 -0
  609. package/dist/mcp/server.js +98 -8
  610. package/dist/mcp/server.js.map +1 -1
  611. package/dist/mcp/tool-definitions.js +64 -10
  612. package/dist/mcp/tool-definitions.js.map +1 -1
  613. package/dist/sdk/cli-contracts/commander-types.js +13 -2
  614. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  615. package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
  616. package/dist/sdk/cli-contracts/enum-contracts.js +7 -2
  617. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  618. package/dist/sdk/cli-contracts/tool-option-contracts.js +110 -2
  619. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  620. package/dist/sdk/cli-contracts/tool-parameter-tables.js +127 -11
  621. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  622. package/dist/sdk/cli-contracts.d.ts +31 -0
  623. package/dist/sdk/cli-contracts.js +238 -12
  624. package/dist/sdk/cli-contracts.js.map +1 -1
  625. package/dist/types.d.ts +17 -1
  626. package/dist/types.js +3 -3
  627. package/dist/types.js.map +1 -1
  628. package/docs/AGENT_GUIDE.md +15 -3
  629. package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
  630. package/docs/COMMANDS.md +171 -10
  631. package/docs/CONFIGURATION.md +135 -0
  632. package/docs/TESTING.md +6 -4
  633. package/package.json +6 -4
  634. package/packages/pm-calendar/extensions/calendar/runtime.js +6 -0
  635. package/packages/pm-calendar/extensions/calendar/runtime.ts +12 -0
  636. package/packages/pm-todos/extensions/todos/runtime.ts +5 -0
  637. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  638. package/plugins/pm-claude/README.md +3 -3
  639. package/plugins/pm-claude/commands/pm-init.md +1 -1
  640. package/plugins/pm-codex/README.md +1 -1
  641. package/scripts/bundle-cli.mjs +46 -37
  642. package/scripts/finalize-build.mjs +20 -9
  643. package/scripts/prepare-build-cache.mjs +27 -16
  644. package/dist/cli-bundle/chunks/activity-XIOTGZMU.js +0 -16
  645. package/dist/cli-bundle/chunks/aggregate-IRHJWEKG.js.map +0 -1
  646. package/dist/cli-bundle/chunks/aggregate-XEBW22UQ.js.map +0 -7
  647. package/dist/cli-bundle/chunks/append-NL67JNJU.js.map +0 -1
  648. package/dist/cli-bundle/chunks/chunk-2ANTZBYF.js.map +0 -1
  649. package/dist/cli-bundle/chunks/chunk-2J2AH4V5.js.map +0 -1
  650. package/dist/cli-bundle/chunks/chunk-32XSW44C.js.map +0 -1
  651. package/dist/cli-bundle/chunks/chunk-36BCSMKP.js.map +0 -7
  652. package/dist/cli-bundle/chunks/chunk-3VULHQNS.js.map +0 -1
  653. package/dist/cli-bundle/chunks/chunk-4FHLNNW7.js.map +0 -7
  654. package/dist/cli-bundle/chunks/chunk-4JHJ7YG2.js.map +0 -7
  655. package/dist/cli-bundle/chunks/chunk-4TPFXE2R.js.map +0 -1
  656. package/dist/cli-bundle/chunks/chunk-4ZKKZMLH.js.map +0 -1
  657. package/dist/cli-bundle/chunks/chunk-5HSAHRYA.js.map +0 -7
  658. package/dist/cli-bundle/chunks/chunk-6TBR5AZ2.js.map +0 -7
  659. package/dist/cli-bundle/chunks/chunk-7CRFV6JR.js.map +0 -7
  660. package/dist/cli-bundle/chunks/chunk-7SM7VA5I.js.map +0 -7
  661. package/dist/cli-bundle/chunks/chunk-AAUYXSFF.js.map +0 -7
  662. package/dist/cli-bundle/chunks/chunk-AGG32LKL.js.map +0 -1
  663. package/dist/cli-bundle/chunks/chunk-AUDDXKNX.js.map +0 -1
  664. package/dist/cli-bundle/chunks/chunk-BVL5KGVA.js.map +0 -1
  665. package/dist/cli-bundle/chunks/chunk-C24PWDFG.js +0 -138
  666. package/dist/cli-bundle/chunks/chunk-C24PWDFG.js.map +0 -7
  667. package/dist/cli-bundle/chunks/chunk-HLEGAQXT.js.map +0 -7
  668. package/dist/cli-bundle/chunks/chunk-HZOX5BYD.js.map +0 -7
  669. package/dist/cli-bundle/chunks/chunk-IXVSSHGV.js.map +0 -7
  670. package/dist/cli-bundle/chunks/chunk-IZHCCG4S.js.map +0 -1
  671. package/dist/cli-bundle/chunks/chunk-JW7D6437.js.map +0 -1
  672. package/dist/cli-bundle/chunks/chunk-JWXTOYBI.js.map +0 -7
  673. package/dist/cli-bundle/chunks/chunk-KHGTYCJ6.js.map +0 -1
  674. package/dist/cli-bundle/chunks/chunk-L6YQONLM.js.map +0 -1
  675. package/dist/cli-bundle/chunks/chunk-LFW5NQUP.js.map +0 -7
  676. package/dist/cli-bundle/chunks/chunk-LYNQ3NGI.js.map +0 -1
  677. package/dist/cli-bundle/chunks/chunk-M3SI2REU.js.map +0 -7
  678. package/dist/cli-bundle/chunks/chunk-MACCNKSZ.js.map +0 -7
  679. package/dist/cli-bundle/chunks/chunk-MGAQ6KZG.js.map +0 -7
  680. package/dist/cli-bundle/chunks/chunk-PEH7SZD2.js.map +0 -7
  681. package/dist/cli-bundle/chunks/chunk-PNYAAB4S.js.map +0 -1
  682. package/dist/cli-bundle/chunks/chunk-QQG4HEX7.js.map +0 -1
  683. package/dist/cli-bundle/chunks/chunk-R4VWYWRN.js.map +0 -7
  684. package/dist/cli-bundle/chunks/chunk-RFR2YQGO.js.map +0 -1
  685. package/dist/cli-bundle/chunks/chunk-RHYBR6G7.js.map +0 -1
  686. package/dist/cli-bundle/chunks/chunk-S2CDTRJ6.js.map +0 -1
  687. package/dist/cli-bundle/chunks/chunk-SGMGMCIF.js.map +0 -1
  688. package/dist/cli-bundle/chunks/chunk-SOHXUA2Q.js.map +0 -1
  689. package/dist/cli-bundle/chunks/chunk-SQDKAEKG.js.map +0 -7
  690. package/dist/cli-bundle/chunks/chunk-TOX7YQ7X.js.map +0 -1
  691. package/dist/cli-bundle/chunks/chunk-TSXWFN3L.js.map +0 -1
  692. package/dist/cli-bundle/chunks/chunk-UCVJP4JL.js.map +0 -7
  693. package/dist/cli-bundle/chunks/chunk-V4KP3TCN.js +0 -128
  694. package/dist/cli-bundle/chunks/chunk-V4KP3TCN.js.map +0 -1
  695. package/dist/cli-bundle/chunks/chunk-VNC2HBL4.js.map +0 -1
  696. package/dist/cli-bundle/chunks/chunk-W6KNFAMZ.js.map +0 -7
  697. package/dist/cli-bundle/chunks/chunk-WLH7X4RN.js.map +0 -7
  698. package/dist/cli-bundle/chunks/chunk-XXLMJDUB.js.map +0 -7
  699. package/dist/cli-bundle/chunks/close-WOG5WTMZ.js +0 -13
  700. package/dist/cli-bundle/chunks/close-many-GKAJX54X.js.map +0 -1
  701. package/dist/cli-bundle/chunks/close-many-GL6NRUU5.js.map +0 -7
  702. package/dist/cli-bundle/chunks/comments-5FPT6L7N.js.map +0 -1
  703. package/dist/cli-bundle/chunks/comments-TOLOYWNI.js.map +0 -7
  704. package/dist/cli-bundle/chunks/config-4MN45TIH.js.map +0 -1
  705. package/dist/cli-bundle/chunks/config-7N6D7YJE.js.map +0 -7
  706. package/dist/cli-bundle/chunks/context-AQSLE7DZ.js.map +0 -1
  707. package/dist/cli-bundle/chunks/context-U3PUJMVN.js.map +0 -7
  708. package/dist/cli-bundle/chunks/contracts-H7KCQXLY.js.map +0 -7
  709. package/dist/cli-bundle/chunks/contracts-ITSJXO3O.js.map +0 -1
  710. package/dist/cli-bundle/chunks/create-NW3K7LVG.js +0 -27
  711. package/dist/cli-bundle/chunks/deps-HV2C2L46.js.map +0 -1
  712. package/dist/cli-bundle/chunks/files-LIFDKNCN.js.map +0 -7
  713. package/dist/cli-bundle/chunks/files-OIFN3DQX.js.map +0 -1
  714. package/dist/cli-bundle/chunks/get-K7UULTQF.js.map +0 -7
  715. package/dist/cli-bundle/chunks/get-SAB7CRBG.js.map +0 -1
  716. package/dist/cli-bundle/chunks/health-NUVZYIEV.js.map +0 -1
  717. package/dist/cli-bundle/chunks/health-VJWH3ZFK.js.map +0 -7
  718. package/dist/cli-bundle/chunks/history-IUVN4NTN.js +0 -20
  719. package/dist/cli-bundle/chunks/history-compact-SLL6ESXH.js.map +0 -1
  720. package/dist/cli-bundle/chunks/history-compact-WQZQ6KXM.js.map +0 -7
  721. package/dist/cli-bundle/chunks/history-redact-75KIIJUJ.js +0 -19
  722. package/dist/cli-bundle/chunks/history-repair-BJCGM6Q3.js.map +0 -1
  723. package/dist/cli-bundle/chunks/history-repair-UCYS55ZX.js.map +0 -7
  724. package/dist/cli-bundle/chunks/init-JJFYRUKG.js +0 -17
  725. package/dist/cli-bundle/chunks/learnings-L6KTZGOT.js.map +0 -1
  726. package/dist/cli-bundle/chunks/learnings-QKJOKEAO.js.map +0 -7
  727. package/dist/cli-bundle/chunks/list-GGVPXEV6.js +0 -23
  728. package/dist/cli-bundle/chunks/list-VOQDQHA4.js +0 -19
  729. package/dist/cli-bundle/chunks/notes-3NLK7WTZ.js.map +0 -1
  730. package/dist/cli-bundle/chunks/notes-HMCB7TK6.js.map +0 -7
  731. package/dist/cli-bundle/chunks/plan-DWBYI5C6.js.map +0 -1
  732. package/dist/cli-bundle/chunks/plan-NANUWH4T.js.map +0 -7
  733. package/dist/cli-bundle/chunks/register-list-query-PWQ5F2VI.js.map +0 -7
  734. package/dist/cli-bundle/chunks/register-list-query-SMMMLSWW.js.map +0 -1
  735. package/dist/cli-bundle/chunks/register-mutation-QKFPTIZG.js.map +0 -7
  736. package/dist/cli-bundle/chunks/register-mutation-ZYJQ4DVP.js.map +0 -1
  737. package/dist/cli-bundle/chunks/register-operations-2FMZ6WEF.js.map +0 -7
  738. package/dist/cli-bundle/chunks/register-operations-BAFQURZG.js.map +0 -1
  739. package/dist/cli-bundle/chunks/register-setup-DQEIKBIP.js.map +0 -7
  740. package/dist/cli-bundle/chunks/register-setup-QN2XV7UL.js.map +0 -1
  741. package/dist/cli-bundle/chunks/restore-DRBNXJJH.js +0 -17
  742. package/dist/cli-bundle/chunks/schema-RNVJ55V2.js.map +0 -7
  743. package/dist/cli-bundle/chunks/schema-ZZ7ZDM2X.js.map +0 -1
  744. package/dist/cli-bundle/chunks/search-BJ457C2A.js.map +0 -7
  745. package/dist/cli-bundle/chunks/search-FQDZXX7P.js.map +0 -1
  746. package/dist/cli-bundle/chunks/stats-CUG3ZHOI.js.map +0 -1
  747. package/dist/cli-bundle/chunks/stats-DUQWCVOS.js.map +0 -7
  748. package/dist/cli-bundle/chunks/telemetry-33MRGX4Z.js.map +0 -7
  749. package/dist/cli-bundle/chunks/telemetry-RK2VX75A.js.map +0 -1
  750. package/dist/cli-bundle/chunks/test-SDMYEQHH.js +0 -32
  751. package/dist/cli-bundle/chunks/test-all-ANYQ33O2.js.map +0 -7
  752. package/dist/cli-bundle/chunks/test-all-ARSMX33Q.js.map +0 -1
  753. package/dist/cli-bundle/chunks/test-runs-5URSD34O.js.map +0 -1
  754. package/dist/cli-bundle/chunks/test-runs-XNACGSNQ.js.map +0 -7
  755. package/dist/cli-bundle/chunks/update-PD46VOXI.js +0 -21
  756. package/dist/cli-bundle/chunks/update-U235A7WP.js +0 -25
  757. package/dist/cli-bundle/chunks/update-many-6B7PJ33I.js.map +0 -1
  758. package/dist/cli-bundle/chunks/update-many-724JCVDE.js.map +0 -7
  759. package/dist/cli-bundle/chunks/upgrade-ALBEZAI7.js.map +0 -7
  760. package/dist/cli-bundle/chunks/upgrade-QHRGDBSA.js.map +0 -1
  761. package/dist/cli-bundle/chunks/validate-IQRYFXIV.js.map +0 -1
  762. package/dist/cli-bundle/chunks/validate-UY6DRCG5.js.map +0 -7
  763. /package/dist/cli-bundle/chunks/{activity-XIOTGZMU.js.map → activity-PZYSZA26.js.map} +0 -0
  764. /package/dist/cli-bundle/chunks/{activity-PPO7QWJF.js.map → activity-SFM4THAU.js.map} +0 -0
  765. /package/dist/cli-bundle/chunks/{chunk-IIOIBAQW.js.map → chunk-26BM6YLO.js.map} +0 -0
  766. /package/dist/cli-bundle/chunks/{chunk-LSSTKL3Y.js.map → chunk-2TMKMTEI.js.map} +0 -0
  767. /package/dist/cli-bundle/chunks/{chunk-QU3OPNVV.js.map → chunk-2VH7DFSJ.js.map} +0 -0
  768. /package/dist/cli-bundle/chunks/{chunk-LGOXXQUW.js.map → chunk-5XGWFUW2.js.map} +0 -0
  769. /package/dist/cli-bundle/chunks/{chunk-Z647PYLD.js.map → chunk-AJCQ5GT6.js.map} +0 -0
  770. /package/dist/cli-bundle/chunks/{chunk-DWG4FHPY.js.map → chunk-BITCVGHT.js.map} +0 -0
  771. /package/dist/cli-bundle/chunks/{chunk-JE5IZXDS.js.map → chunk-CGQTFWYI.js.map} +0 -0
  772. /package/dist/cli-bundle/chunks/{chunk-VYZNX4C5.js.map → chunk-COVLE33A.js.map} +0 -0
  773. /package/dist/cli-bundle/chunks/{chunk-6ZFTM65G.js.map → chunk-F5MSD5HE.js.map} +0 -0
  774. /package/dist/cli-bundle/chunks/{chunk-GOO4UXBI.js.map → chunk-JZHL4E3Q.js.map} +0 -0
  775. /package/dist/cli-bundle/chunks/{chunk-NN6RKGFW.js.map → chunk-KCAGIH6K.js.map} +0 -0
  776. /package/dist/cli-bundle/chunks/{chunk-3CQPVBK3.js.map → chunk-MIBX6ZRN.js.map} +0 -0
  777. /package/dist/cli-bundle/chunks/{chunk-XOYHMHFF.js.map → chunk-UN6P3IJ4.js.map} +0 -0
  778. /package/dist/cli-bundle/chunks/{chunk-HWHONML5.js.map → chunk-VF3KQGNY.js.map} +0 -0
  779. /package/dist/cli-bundle/chunks/{claim-HE6KEGJW.js.map → claim-WGAWJCPY.js.map} +0 -0
  780. /package/dist/cli-bundle/chunks/{claim-QJOQBH7J.js.map → claim-ZI6P4LMU.js.map} +0 -0
  781. /package/dist/cli-bundle/chunks/{close-WOG5WTMZ.js.map → close-I7PRQ5G7.js.map} +0 -0
  782. /package/dist/cli-bundle/chunks/{close-SPUFW5QR.js.map → close-JMVVSIQE.js.map} +0 -0
  783. /package/dist/cli-bundle/chunks/{copy-EB3MUCSW.js.map → copy-Q2PPU4AY.js.map} +0 -0
  784. /package/dist/cli-bundle/chunks/{copy-C4W522JM.js.map → copy-SC6UF3PI.js.map} +0 -0
  785. /package/dist/cli-bundle/chunks/{create-4EQNELMY.js.map → create-76FE7JVF.js.map} +0 -0
  786. /package/dist/cli-bundle/chunks/{create-NW3K7LVG.js.map → create-RTRFW6RE.js.map} +0 -0
  787. /package/dist/cli-bundle/chunks/{delete-X5QLXIQX.js.map → delete-T6DJSUJI.js.map} +0 -0
  788. /package/dist/cli-bundle/chunks/{delete-ZLGUYIXU.js.map → delete-XFUX533E.js.map} +0 -0
  789. /package/dist/cli-bundle/chunks/{docs-SRTLCQOL.js.map → docs-HE3HCQ4S.js.map} +0 -0
  790. /package/dist/cli-bundle/chunks/{docs-RJQPLROO.js.map → docs-SXMOABHR.js.map} +0 -0
  791. /package/dist/cli-bundle/chunks/{extension-WKPVPNCC.js.map → extension-E23K4QRR.js.map} +0 -0
  792. /package/dist/cli-bundle/chunks/{extension-MM3TVWOO.js.map → extension-PMD3XMLN.js.map} +0 -0
  793. /package/dist/cli-bundle/chunks/{gc-NRFHLVFT.js.map → gc-BXIAKLAH.js.map} +0 -0
  794. /package/dist/cli-bundle/chunks/{gc-DL6AVOX5.js.map → gc-C7K6JNUO.js.map} +0 -0
  795. /package/dist/cli-bundle/chunks/{history-GYFD2DJW.js.map → history-73Z6OBFZ.js.map} +0 -0
  796. /package/dist/cli-bundle/chunks/{history-IUVN4NTN.js.map → history-BIPHVUMF.js.map} +0 -0
  797. /package/dist/cli-bundle/chunks/{history-redact-SDTDR6WM.js.map → history-redact-7YCXEWJD.js.map} +0 -0
  798. /package/dist/cli-bundle/chunks/{history-redact-75KIIJUJ.js.map → history-redact-WZZ6GZ2Z.js.map} +0 -0
  799. /package/dist/cli-bundle/chunks/{init-JJFYRUKG.js.map → init-K34V4PZR.js.map} +0 -0
  800. /package/dist/cli-bundle/chunks/{init-MXV57LKL.js.map → init-TDEDNVMM.js.map} +0 -0
  801. /package/dist/cli-bundle/chunks/{list-GGVPXEV6.js.map → list-MSHYOCFU.js.map} +0 -0
  802. /package/dist/cli-bundle/chunks/{list-VOQDQHA4.js.map → list-VV57WGUD.js.map} +0 -0
  803. /package/dist/cli-bundle/chunks/{restore-FJQWXMPY.js.map → restore-TSWSULYY.js.map} +0 -0
  804. /package/dist/cli-bundle/chunks/{restore-DRBNXJJH.js.map → restore-XQXICL3V.js.map} +0 -0
  805. /package/dist/cli-bundle/chunks/{test-SDMYEQHH.js.map → test-AROS3LIV.js.map} +0 -0
  806. /package/dist/cli-bundle/chunks/{test-Y3CTFMEC.js.map → test-CECIMKOA.js.map} +0 -0
  807. /package/dist/cli-bundle/chunks/{update-PD46VOXI.js.map → update-MIWEJC76.js.map} +0 -0
  808. /package/dist/cli-bundle/chunks/{update-U235A7WP.js.map → update-P7I5YSRB.js.map} +0 -0
@@ -1,11 +1,32 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1f8d48a8-041d-5a4c-9dd2-a175d9be03ea")}catch(e){}}();
3
- import { parseCsvKv } from "../../core/item/parse.js";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="71ba6ea0-3e58-5d3c-b4db-e1a92bd21e36")}catch(e){}}();
3
+ import { assertNoUnknownCsvKeys, parseCsvKv } from "../../core/item/parse.js";
4
4
  import { EXIT_CODE } from "../../core/shared/constants.js";
5
5
  import { PmCliError } from "../../core/shared/errors.js";
6
6
  import { resolveIsoOrRelative } from "../../core/shared/time.js";
7
7
  import { resolveEventEndAt } from "./event-validation-messages.js";
8
- import { parseEventBoolean, parseRecurrenceRule, } from "./recurrence-parsers.js";
8
+ import { parseEventBoolean, parseRecurrenceRule, RECURRENCE_CSV_KEYS, } from "./recurrence-parsers.js";
9
+ /** Allowed CSV/markdown keys for `--reminder` (GH-258). */
10
+ const REMINDER_KEYS = ["at", "date", "text", "title"];
11
+ /**
12
+ * Allowed CSV/markdown keys for `--event` (GH-258). Recurrence keys are spread
13
+ * from the authoritative RECURRENCE_CSV_KEYS next to parseRecurrenceRule so the
14
+ * allow-list can never drift from what the recurrence parser actually reads.
15
+ */
16
+ const EVENT_KEYS = [
17
+ "start",
18
+ "date",
19
+ "end",
20
+ "duration",
21
+ "title",
22
+ "description",
23
+ "location",
24
+ "timezone",
25
+ "all_day",
26
+ ...RECURRENCE_CSV_KEYS,
27
+ ];
28
+ /** Allowed CSV/markdown keys for the `--type-option` structured form (GH-258). */
29
+ const TYPE_OPTION_KEYS = ["key", "value"];
9
30
  function optionalString(value, mode) {
10
31
  return mode === "trimmed" ? value?.trim() : value;
11
32
  }
@@ -15,6 +36,7 @@ function isProvided(value, guard) {
15
36
  export function parseReminderEntries(raw, nowValue, options) {
16
37
  return raw.map((entry) => {
17
38
  const kv = parseCsvKv(entry, "--reminder");
39
+ assertNoUnknownCsvKeys(kv, "--reminder", REMINDER_KEYS);
18
40
  const atRaw = optionalString(kv.at ?? kv.date, options.valueMode);
19
41
  const textRaw = optionalString(kv.text ?? kv.title, options.valueMode);
20
42
  if (!atRaw || !textRaw) {
@@ -33,6 +55,7 @@ export function parseReminderEntries(raw, nowValue, options) {
33
55
  export function parseEventEntries(raw, nowValue, options) {
34
56
  return raw.map((entry) => {
35
57
  const kv = parseCsvKv(entry, "--event");
58
+ assertNoUnknownCsvKeys(kv, "--event", EVENT_KEYS);
36
59
  const startRaw = (kv.start ?? kv.date)?.trim();
37
60
  if (!startRaw) {
38
61
  throw new PmCliError("--event requires start=<iso|relative> or date=<iso|relative>", EXIT_CODE.USAGE);
@@ -93,6 +116,7 @@ export function parseTypeOptionEntries(raw) {
93
116
  /^(?:[-*+]\s+)?(?:key|value)\s*[:=]/i.test(trimmedEntry);
94
117
  if (prefersStructuredKv) {
95
118
  const kv = parseCsvKv(trimmedEntry, "--type-option");
119
+ assertNoUnknownCsvKeys(kv, "--type-option", TYPE_OPTION_KEYS);
96
120
  key = kv.key?.trim();
97
121
  value = kv.value?.trim();
98
122
  }
@@ -117,4 +141,4 @@ export function parseTypeOptionEntries(raw) {
117
141
  return Object.fromEntries(Object.entries(values).sort((left, right) => left[0].localeCompare(right[0])));
118
142
  }
119
143
  //# sourceMappingURL=repeatable-metadata-parsers.js.map
120
- //# debugId=1f8d48a8-041d-5a4c-9dd2-a175d9be03ea
144
+ //# debugId=71ba6ea0-3e58-5d3c-b4db-e1a92bd21e36
@@ -1 +1 @@
1
- {"version":3,"file":"repeatable-metadata-parsers.js","sources":["cli/commands/repeatable-metadata-parsers.ts"],"sourceRoot":"/","sourcesContent":["import { parseCsvKv } from \"../../core/item/parse.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { resolveIsoOrRelative } from \"../../core/shared/time.js\";\nimport type { CalendarEvent, Reminder } from \"../../types/index.js\";\nimport { resolveEventEndAt } from \"./event-validation-messages.js\";\nimport {\n parseEventBoolean,\n parseRecurrenceRule,\n type RecurrenceEmptyNumericGuard,\n} from \"./recurrence-parsers.js\";\n\ntype EmptyValueGuard = \"defined\" | \"truthy\";\ntype ReminderValueMode = \"raw\" | \"trimmed\";\n\ninterface ParseReminderEntriesOptions {\n valueMode: ReminderValueMode;\n}\n\ninterface ParseEventEntriesOptions {\n allDayEmptyGuard: EmptyValueGuard;\n recurrenceEmptyNumericGuard: RecurrenceEmptyNumericGuard;\n}\n\nfunction optionalString(value: string | undefined, mode: ReminderValueMode): string | undefined {\n return mode === \"trimmed\" ? value?.trim() : value;\n}\n\nfunction isProvided(value: string | undefined, guard: EmptyValueGuard): boolean {\n return guard === \"defined\" ? value !== undefined : Boolean(value);\n}\n\nexport function parseReminderEntries(raw: string[], nowValue: Date, options: ParseReminderEntriesOptions): Reminder[] {\n return raw.map((entry) => {\n const kv = parseCsvKv(entry, \"--reminder\");\n const atRaw = optionalString(kv.at ?? kv.date, options.valueMode);\n const textRaw = optionalString(kv.text ?? kv.title, options.valueMode);\n if (!atRaw || !textRaw) {\n throw new PmCliError(\"--reminder requires at=<iso|relative> or date=<iso|relative>, plus text=<value> or title=<value>\", EXIT_CODE.USAGE);\n }\n const text = textRaw.trim();\n if (!text) {\n throw new PmCliError(\"--reminder text must not be empty\", EXIT_CODE.USAGE);\n }\n return {\n at: resolveIsoOrRelative(atRaw, nowValue, \"reminder.at\"),\n text,\n };\n });\n}\n\nexport function parseEventEntries(raw: string[], nowValue: Date, options: ParseEventEntriesOptions): CalendarEvent[] {\n return raw.map((entry) => {\n const kv = parseCsvKv(entry, \"--event\");\n const startRaw = (kv.start ?? kv.date)?.trim();\n if (!startRaw) {\n throw new PmCliError(\"--event requires start=<iso|relative> or date=<iso|relative>\", EXIT_CODE.USAGE);\n }\n const startAt = resolveIsoOrRelative(startRaw, nowValue, \"event.start\");\n const endRaw = kv.end?.trim();\n const durationRaw = kv.duration?.trim();\n const endAt = resolveEventEndAt(startAt, endRaw, durationRaw, nowValue);\n\n const titleRaw = kv.title;\n const descriptionRaw = kv.description;\n const locationRaw = kv.location;\n const timezoneRaw = kv.timezone;\n\n const title = titleRaw?.trim();\n const description = descriptionRaw?.trim();\n const location = locationRaw?.trim();\n const timezone = timezoneRaw?.trim();\n if (titleRaw !== undefined && !title) {\n throw new PmCliError(\"--event title must not be empty\", EXIT_CODE.USAGE);\n }\n if (descriptionRaw !== undefined && !description) {\n throw new PmCliError(\"--event description must not be empty\", EXIT_CODE.USAGE);\n }\n if (locationRaw !== undefined && !location) {\n throw new PmCliError(\"--event location must not be empty\", EXIT_CODE.USAGE);\n }\n if (timezoneRaw !== undefined && !timezone) {\n throw new PmCliError(\"--event timezone must not be empty\", EXIT_CODE.USAGE);\n }\n\n const allDayRaw = kv.all_day?.trim();\n const recurrence = parseRecurrenceRule(kv, startAt, nowValue, options.recurrenceEmptyNumericGuard);\n const allDay = isProvided(allDayRaw, options.allDayEmptyGuard)\n ? parseEventBoolean(allDayRaw as string, \"--event all_day\")\n : undefined;\n\n return {\n start_at: startAt,\n end_at: endAt,\n title,\n description,\n location,\n all_day: allDay,\n timezone,\n recurrence,\n };\n });\n}\n\nexport function parseTypeOptionEntries(raw: string[]): Record<string, string> {\n const values: Record<string, string> = {};\n for (const entry of raw) {\n const trimmedEntry = entry.trim();\n if (trimmedEntry.length === 0) {\n throw new PmCliError(\"--type-option values must not be empty\", EXIT_CODE.USAGE);\n }\n let key: string | undefined;\n let value: string | undefined;\n const prefersStructuredKv =\n trimmedEntry.includes(\",\") ||\n trimmedEntry.includes(\"\\n\") ||\n trimmedEntry.startsWith(\"```\") ||\n /^(?:[-*+]\\s+)?(?:key|value)\\s*[:=]/i.test(trimmedEntry);\n if (prefersStructuredKv) {\n const kv = parseCsvKv(trimmedEntry, \"--type-option\");\n key = kv.key?.trim();\n value = kv.value?.trim();\n } else {\n const equalsIndex = trimmedEntry.indexOf(\"=\");\n const colonIndex = trimmedEntry.indexOf(\":\");\n let separatorIndex = equalsIndex;\n if (equalsIndex <= 0 && colonIndex > 0) {\n separatorIndex = colonIndex;\n }\n if (separatorIndex <= 0 || separatorIndex === trimmedEntry.length - 1) {\n throw new PmCliError(\n \"--type-option requires key=value or key=<name>,value=<value> entries\",\n EXIT_CODE.USAGE,\n );\n }\n key = trimmedEntry.slice(0, separatorIndex).trim();\n value = trimmedEntry.slice(separatorIndex + 1).trim();\n }\n if (!key || !value) {\n throw new PmCliError(\"--type-option requires key and value\", EXIT_CODE.USAGE);\n }\n values[key] = value;\n }\n return Object.fromEntries(Object.entries(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AAU,CAAC;YAC9B,CAAC;YACD,IAAI,cAAc,IAAI,CAAC,IAAI,cAAc,KAAK,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtE,MAAM,IAAI,UAAU,CAClB,sEAAsE,EACtE,SAAS,CAAC,KAAK,CAChB,CAAC;YACJ,CAAC;YACD,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,IAAI,EAAE,CAAC;YACnD,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,IAAI,UAAU,CAAC,sCAAsC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QAChF,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3G,CAAC","debugId":"1f8d48a8-041d-5a4c-9dd2-a175d9be03ea"}
1
+ {"version":3,"file":"repeatable-metadata-parsers.js","sources":["cli/commands/repeatable-metadata-parsers.ts"],"sourceRoot":"/","sourcesContent":["import { assertNoUnknownCsvKeys, parseCsvKv } from \"../../core/item/parse.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { resolveIsoOrRelative } from \"../../core/shared/time.js\";\nimport type { CalendarEvent, Reminder } from \"../../types/index.js\";\nimport { resolveEventEndAt } from \"./event-validation-messages.js\";\nimport {\n parseEventBoolean,\n parseRecurrenceRule,\n RECURRENCE_CSV_KEYS,\n type RecurrenceEmptyNumericGuard,\n} from \"./recurrence-parsers.js\";\n\n/** Allowed CSV/markdown keys for `--reminder` (GH-258). */\nconst REMINDER_KEYS = [\"at\", \"date\", \"text\", \"title\"] as const;\n/**\n * Allowed CSV/markdown keys for `--event` (GH-258). Recurrence keys are spread\n * from the authoritative RECURRENCE_CSV_KEYS next to parseRecurrenceRule so the\n * allow-list can never drift from what the recurrence parser actually reads.\n */\nconst EVENT_KEYS = [\n \"start\",\n \"date\",\n \"end\",\n \"duration\",\n \"title\",\n \"description\",\n \"location\",\n \"timezone\",\n \"all_day\",\n ...RECURRENCE_CSV_KEYS,\n] as const;\n/** Allowed CSV/markdown keys for the `--type-option` structured form (GH-258). */\nconst TYPE_OPTION_KEYS = [\"key\", \"value\"] as const;\n\ntype EmptyValueGuard = \"defined\" | \"truthy\";\ntype ReminderValueMode = \"raw\" | \"trimmed\";\n\ninterface ParseReminderEntriesOptions {\n valueMode: ReminderValueMode;\n}\n\ninterface ParseEventEntriesOptions {\n allDayEmptyGuard: EmptyValueGuard;\n recurrenceEmptyNumericGuard: RecurrenceEmptyNumericGuard;\n}\n\nfunction optionalString(value: string | undefined, mode: ReminderValueMode): string | undefined {\n return mode === \"trimmed\" ? value?.trim() : value;\n}\n\nfunction isProvided(value: string | undefined, guard: EmptyValueGuard): boolean {\n return guard === \"defined\" ? value !== undefined : Boolean(value);\n}\n\nexport function parseReminderEntries(raw: string[], nowValue: Date, options: ParseReminderEntriesOptions): Reminder[] {\n return raw.map((entry) => {\n const kv = parseCsvKv(entry, \"--reminder\");\n assertNoUnknownCsvKeys(kv, \"--reminder\", REMINDER_KEYS);\n const atRaw = optionalString(kv.at ?? kv.date, options.valueMode);\n const textRaw = optionalString(kv.text ?? kv.title, options.valueMode);\n if (!atRaw || !textRaw) {\n throw new PmCliError(\"--reminder requires at=<iso|relative> or date=<iso|relative>, plus text=<value> or title=<value>\", EXIT_CODE.USAGE);\n }\n const text = textRaw.trim();\n if (!text) {\n throw new PmCliError(\"--reminder text must not be empty\", EXIT_CODE.USAGE);\n }\n return {\n at: resolveIsoOrRelative(atRaw, nowValue, \"reminder.at\"),\n text,\n };\n });\n}\n\nexport function parseEventEntries(raw: string[], nowValue: Date, options: ParseEventEntriesOptions): CalendarEvent[] {\n return raw.map((entry) => {\n const kv = parseCsvKv(entry, \"--event\");\n assertNoUnknownCsvKeys(kv, \"--event\", EVENT_KEYS);\n const startRaw = (kv.start ?? kv.date)?.trim();\n if (!startRaw) {\n throw new PmCliError(\"--event requires start=<iso|relative> or date=<iso|relative>\", EXIT_CODE.USAGE);\n }\n const startAt = resolveIsoOrRelative(startRaw, nowValue, \"event.start\");\n const endRaw = kv.end?.trim();\n const durationRaw = kv.duration?.trim();\n const endAt = resolveEventEndAt(startAt, endRaw, durationRaw, nowValue);\n\n const titleRaw = kv.title;\n const descriptionRaw = kv.description;\n const locationRaw = kv.location;\n const timezoneRaw = kv.timezone;\n\n const title = titleRaw?.trim();\n const description = descriptionRaw?.trim();\n const location = locationRaw?.trim();\n const timezone = timezoneRaw?.trim();\n if (titleRaw !== undefined && !title) {\n throw new PmCliError(\"--event title must not be empty\", EXIT_CODE.USAGE);\n }\n if (descriptionRaw !== undefined && !description) {\n throw new PmCliError(\"--event description must not be empty\", EXIT_CODE.USAGE);\n }\n if (locationRaw !== undefined && !location) {\n throw new PmCliError(\"--event location must not be empty\", EXIT_CODE.USAGE);\n }\n if (timezoneRaw !== undefined && !timezone) {\n throw new PmCliError(\"--event timezone must not be empty\", EXIT_CODE.USAGE);\n }\n\n const allDayRaw = kv.all_day?.trim();\n const recurrence = parseRecurrenceRule(kv, startAt, nowValue, options.recurrenceEmptyNumericGuard);\n const allDay = isProvided(allDayRaw, options.allDayEmptyGuard)\n ? parseEventBoolean(allDayRaw as string, \"--event all_day\")\n : undefined;\n\n return {\n start_at: startAt,\n end_at: endAt,\n title,\n description,\n location,\n all_day: allDay,\n timezone,\n recurrence,\n };\n });\n}\n\nexport function parseTypeOptionEntries(raw: string[]): Record<string, string> {\n const values: Record<string, string> = {};\n for (const entry of raw) {\n const trimmedEntry = entry.trim();\n if (trimmedEntry.length === 0) {\n throw new PmCliError(\"--type-option values must not be empty\", EXIT_CODE.USAGE);\n }\n let key: string | undefined;\n let value: string | undefined;\n const prefersStructuredKv =\n trimmedEntry.includes(\",\") ||\n trimmedEntry.includes(\"\\n\") ||\n trimmedEntry.startsWith(\"```\") ||\n /^(?:[-*+]\\s+)?(?:key|value)\\s*[:=]/i.test(trimmedEntry);\n if (prefersStructuredKv) {\n const kv = parseCsvKv(trimmedEntry, \"--type-option\");\n assertNoUnknownCsvKeys(kv, \"--type-option\", TYPE_OPTION_KEYS);\n key = kv.key?.trim();\n value = kv.value?.trim();\n } else {\n const equalsIndex = trimmedEntry.indexOf(\"=\");\n const colonIndex = trimmedEntry.indexOf(\":\");\n let separatorIndex = equalsIndex;\n if (equalsIndex <= 0 && colonIndex > 0) {\n separatorIndex = colonIndex;\n }\n if (separatorIndex <= 0 || separatorIndex === trimmedEntry.length - 1) {\n throw new PmCliError(\n \"--type-option requires key=value or key=<name>,value=<value> entries\",\n EXIT_CODE.USAGE,\n );\n }\n key = trimmedEntry.slice(0, separatorIndex).trim();\n value = trimmedEntry.slice(separatorIndex + 1).trim();\n }\n if (!key || !value) {\n throw new PmCliError(\"--type-option requires key and value\", EXIT_CODE.USAGE);\n }\n values[key] = value;\n }\n return Object.fromEntries(Object.entries(values).sort((left, right) => left[0].localeCompare(right[0])));\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OA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Y,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC9C,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC7C,IAAI,cAAc,GAAG,WAAW,CAAC;YACjC,IAAI,WAAW,IAAI,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;gBACvC,cAAc,GAAG,UAAU,CAAC;YAC9B,CAAC;YACD,IAAI,cAAc,IAAI,CAAC,IAAI,cAAc,KAAK,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtE,MAAM,IAAI,UAAU,CAClB,sEAAsE,EACtE,SAAS,CAAC,KAAK,CAChB,CAAC;YACJ,CAAC;YACD,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,IAAI,EAAE,CAAC;YACnD,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,IAAI,UAAU,CAAC,sCAAsC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QAChF,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3G,CAAC","debugId":"71ba6ea0-3e58-5d3c-b4db-e1a92bd21e36"}
@@ -1,5 +1,19 @@
1
+ import { type ReplayDocument as CanonicalReplayDocument } from "../../core/history/replay.js";
1
2
  import type { GlobalOptions } from "../../core/shared/command-types.js";
2
- import type { ItemMetadata } from "../../types/index.js";
3
+ import { locateItem } from "../../core/store/item-store.js";
4
+ import { readSettings } from "../../core/store/settings.js";
5
+ import type { HistoryEntry, HistoryPatchOp, ItemDocument, ItemMetadata } from "../../types/index.js";
6
+ interface ResolvedRestoreTarget {
7
+ kind: "version" | "timestamp";
8
+ raw: string;
9
+ historyIndex: number;
10
+ }
11
+ interface ResolvedRestoreSubject {
12
+ id: string;
13
+ historyPath: string;
14
+ located: Awaited<ReturnType<typeof locateItem>>;
15
+ historyPolicyWarnings: string[];
16
+ }
3
17
  export interface RestoreCommandOptions {
4
18
  author?: string;
5
19
  message?: string;
@@ -17,4 +31,29 @@ export interface RestoreResult {
17
31
  changed_fields: string[];
18
32
  warnings: string[];
19
33
  }
34
+ declare function ensureReplayTarget(target: string, history: HistoryEntry[]): ResolvedRestoreTarget;
35
+ declare function extractPatchFailureContext(patch: HistoryPatchOp[], error: unknown): {
36
+ patchIndex?: number;
37
+ op?: string;
38
+ path?: string;
39
+ from?: string;
40
+ reason?: string;
41
+ };
42
+ declare function applyHistoryPatch(current: CanonicalReplayDocument, patch: HistoryPatchOp[], entryNumber: number, entryOp: string): CanonicalReplayDocument;
43
+ declare function replayToTarget(history: HistoryEntry[], targetIndex: number): CanonicalReplayDocument;
44
+ declare function ensureMaterializedRestoreTarget(replayDocument: CanonicalReplayDocument, target: ResolvedRestoreTarget): CanonicalReplayDocument;
45
+ declare function replayCurrentDocument(history: HistoryEntry[]): ItemDocument;
46
+ declare function resolveRestoreSubject(pmRoot: string, id: string, settings: Awaited<ReturnType<typeof readSettings>>, typeToFolder: Record<string, string>): Promise<ResolvedRestoreSubject>;
47
+ declare function changedFields(beforeDocument: ItemDocument, afterDocument: ItemDocument): string[];
20
48
  export declare function runRestore(id: string, target: string, options: RestoreCommandOptions, global: GlobalOptions): Promise<RestoreResult>;
49
+ export declare const _testOnlyRestoreCommand: {
50
+ applyHistoryPatch: typeof applyHistoryPatch;
51
+ changedFields: typeof changedFields;
52
+ ensureMaterializedRestoreTarget: typeof ensureMaterializedRestoreTarget;
53
+ ensureReplayTarget: typeof ensureReplayTarget;
54
+ extractPatchFailureContext: typeof extractPatchFailureContext;
55
+ replayCurrentDocument: typeof replayCurrentDocument;
56
+ replayToTarget: typeof replayToTarget;
57
+ resolveRestoreSubject: typeof resolveRestoreSubject;
58
+ };
59
+ export {};
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="33d24f2b-7b7a-5588-9a53-e0511add3644")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6a04c7ce-b4b5-5641-8717-6a5bc50df4c1")}catch(e){}}();
3
3
  import jsonPatch from "fast-json-patch";
4
4
  import fs from "node:fs/promises";
5
5
  import { pathExists, readFileIfExists, writeFileAtomic } from "../../core/fs/fs-utils.js";
@@ -67,12 +67,16 @@ function extractPatchFailureContext(patch, error) {
67
67
  return context;
68
68
  }
69
69
  const candidate = error;
70
+ /* c8 ignore start -- parser-generated patch errors may omit index metadata in current fixtures. */
70
71
  if (typeof candidate.index === "number" && Number.isInteger(candidate.index) && candidate.index >= 0) {
71
72
  context.patchIndex = candidate.index;
72
73
  }
74
+ /* c8 ignore stop */
75
+ /* c8 ignore start -- operation payload metadata is optional in upstream json-patch failures. */
73
76
  const operationRecord = typeof candidate.operation === "object" && candidate.operation !== null
74
77
  ? candidate.operation
75
78
  : null;
79
+ /* c8 ignore stop */
76
80
  if (operationRecord && typeof operationRecord.op === "string") {
77
81
  context.op = operationRecord.op;
78
82
  }
@@ -84,11 +88,13 @@ function extractPatchFailureContext(patch, error) {
84
88
  }
85
89
  if ((context.op === undefined || context.path === undefined) && context.patchIndex !== undefined) {
86
90
  const fallback = patch[context.patchIndex];
91
+ /* c8 ignore start -- fallback enrichment paths are only exercised by malformed patch telemetry payloads. */
87
92
  if (fallback) {
88
93
  context.op = context.op ?? fallback.op;
89
94
  context.path = context.path ?? fallback.path;
90
95
  context.from = context.from ?? fallback.from;
91
96
  }
97
+ /* c8 ignore stop */
92
98
  }
93
99
  return context;
94
100
  }
@@ -118,12 +124,18 @@ function applyHistoryPatch(current, patch, entryNumber, entryOp) {
118
124
  const failureContext = extractPatchFailureContext(patch, error);
119
125
  const contextTokens = [
120
126
  `history_op=${entryOp}`,
127
+ /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */
121
128
  failureContext.patchIndex !== undefined ? `patch_index=${failureContext.patchIndex}` : null,
129
+ /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */
122
130
  failureContext.op ? `op=${failureContext.op}` : null,
131
+ /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */
123
132
  failureContext.path ? `path=${failureContext.path}` : null,
133
+ /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */
124
134
  failureContext.from ? `from=${failureContext.from}` : null,
125
135
  ].filter((token) => token !== null);
136
+ /* c8 ignore start -- jsonPatch/structuredClone/normalizeReplayPatchOps always throw Error instances with non-empty messages here, so extractPatchFailureContext always sets reason; the empty-suffix fallback is unreachable through applyHistoryPatch. */
126
137
  const reasonSuffix = failureContext.reason ? ` ${failureContext.reason}` : "";
138
+ /* c8 ignore stop */
127
139
  throw new PmCliError(`Failed to apply history patch at entry ${entryNumber} (${contextTokens.join(", ")}).${reasonSuffix}`, EXIT_CODE.GENERIC_FAILURE);
128
140
  }
129
141
  }
@@ -181,7 +193,9 @@ async function resolveRestoreSubject(pmRoot, id, settings, typeToFolder) {
181
193
  }
182
194
  const normalizedId = normalizeItemId(id, settings.id_prefix);
183
195
  const rawNormalizedId = normalizeRawItemId(id);
196
+ /* c8 ignore start -- raw-id fallback is covered by normalize-item-id utility tests. */
184
197
  const candidateIds = normalizedId === rawNormalizedId ? [normalizedId] : [normalizedId, rawNormalizedId];
198
+ /* c8 ignore stop */
185
199
  for (const candidateId of candidateIds) {
186
200
  const historyPath = getHistoryPath(pmRoot, candidateId);
187
201
  if (await pathExists(historyPath)) {
@@ -270,6 +284,7 @@ export async function runRestore(id, target, options, global) {
270
284
  }
271
285
  }
272
286
  const serializedRestore = serializeItemDocument(restoredDocument, { format: itemFormat, schema: settings.schema });
287
+ /* c8 ignore next -- restored item path typing is exercised in restore integration workflows. */
273
288
  const restoredItemPath = getItemPath(pmRoot, restoredDocument.metadata.type, resolvedId, itemFormat, typeRegistry.type_to_folder);
274
289
  await writeFileAtomic(restoredItemPath, serializedRestore);
275
290
  if (existingItemPath && restoredItemPath !== existingItemPath) {
@@ -350,5 +365,15 @@ export async function runRestore(id, target, options, global) {
350
365
  await releaseLock();
351
366
  }
352
367
  }
368
+ export const _testOnlyRestoreCommand = {
369
+ applyHistoryPatch,
370
+ changedFields,
371
+ ensureMaterializedRestoreTarget,
372
+ ensureReplayTarget,
373
+ extractPatchFailureContext,
374
+ replayCurrentDocument,
375
+ replayToTarget,
376
+ resolveRestoreSubject,
377
+ };
353
378
  //# sourceMappingURL=restore.js.map
354
- //# debugId=33d24f2b-7b7a-5588-9a53-e0511add3644
379
+ //# debugId=6a04c7ce-b4b5-5641-8717-6a5bc50df4c1
@@ -1 +1 @@
1
- {"version":3,"file":"restore.js","sources":["cli/commands/restore.ts"],"sourceRoot":"/","sourcesContent":["import jsonPatch from \"fast-json-patch\";\nimport fs from \"node:fs/promises\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { appendHistoryEntry, createHistoryEntry } from \"../../core/history/history.js\";\nimport {\n EMPTY_REPLAY_DOCUMENT,\n normalizeReplayPatchOps,\n replayHash,\n toReplayDocument,\n type ReplayDocument as CanonicalReplayDocument,\n} from \"../../core/history/replay.js\";\nimport { enforceHistoryStreamPolicyForItem } from \"../../core/history/history-stream-policy.js\";\nimport { normalizeItemId, normalizeRawItemId } from \"../../core/item/id.js\";\nimport { canonicalDocument, serializeItemDocument } from \"../../core/item/item-format.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { acquireLock } from \"../../core/lock/lock.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport {\n getActiveExtensionRegistrations,\n projectAfterCommandItemSnapshot,\n recordAfterCommandAffectedItem,\n runActiveOnWriteHooks,\n} from \"../../core/extensions/index.js\";\nimport { locateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getHistoryPath, getItemPath, getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument, ItemMetadata } from \"../../types/index.js\";\nimport { readHistoryEntries } from \"./history.js\";\n\ninterface ResolvedRestoreTarget {\n kind: \"version\" | \"timestamp\";\n raw: string;\n historyIndex: number;\n}\n\ninterface ResolvedRestoreSubject {\n id: string;\n historyPath: string;\n located: Awaited<ReturnType<typeof locateItem>>;\n historyPolicyWarnings: string[];\n}\n\nexport interface RestoreCommandOptions {\n author?: string;\n message?: string;\n force?: boolean;\n}\n\nexport interface RestoreResult {\n item: ItemMetadata;\n restored_from: {\n kind: \"version\" | \"timestamp\";\n target: string;\n history_index: number;\n entry_ts: string;\n entry_op: string;\n };\n changed_fields: string[];\n warnings: string[];\n}\n\nfunction ensureReplayTarget(target: string, history: HistoryEntry[]): ResolvedRestoreTarget {\n const trimmed = target.trim();\n if (!trimmed) {\n throw new PmCliError(\"Missing restore target. Use a timestamp or version number.\", EXIT_CODE.USAGE);\n }\n\n if (/^\\d+$/.test(trimmed)) {\n const version = Number(trimmed);\n if (!Number.isSafeInteger(version) || version < 1 || version > history.length) {\n throw new PmCliError(\n `Restore version must be between 1 and ${history.length} for this item.`,\n EXIT_CODE.USAGE,\n );\n }\n return {\n kind: \"version\",\n raw: trimmed,\n historyIndex: version - 1,\n };\n }\n\n const parsedTarget = Date.parse(trimmed);\n if (!Number.isFinite(parsedTarget)) {\n throw new PmCliError(\n `Invalid restore target \"${target}\". Use a positive version number or ISO timestamp.`,\n EXIT_CODE.USAGE,\n );\n }\n\n let index = -1;\n for (let i = 0; i < history.length; i += 1) {\n const entryTimestamp = Date.parse(history[i].ts);\n if (!Number.isFinite(entryTimestamp)) {\n throw new PmCliError(\n `History for this item contains invalid timestamp at entry ${i + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (entryTimestamp <= parsedTarget) {\n index = i;\n }\n }\n\n if (index < 0) {\n throw new PmCliError(`No history entries exist at or before timestamp ${trimmed}.`, EXIT_CODE.USAGE);\n }\n\n return {\n kind: \"timestamp\",\n raw: trimmed,\n historyIndex: index,\n };\n}\n\nfunction extractPatchFailureContext(\n patch: HistoryPatchOp[],\n error: unknown,\n): { patchIndex?: number; op?: string; path?: string; from?: string; reason?: string } {\n const context: { patchIndex?: number; op?: string; path?: string; from?: string; reason?: string } = {};\n if (error instanceof Error && error.message.trim().length > 0) {\n context.reason = error.message.trim();\n }\n if (typeof error !== \"object\" || error === null) {\n return context;\n }\n const candidate = error as {\n index?: unknown;\n operation?: unknown;\n };\n if (typeof candidate.index === \"number\" && Number.isInteger(candidate.index) && candidate.index >= 0) {\n context.patchIndex = candidate.index;\n }\n const operationRecord =\n typeof candidate.operation === \"object\" && candidate.operation !== null\n ? (candidate.operation as { op?: unknown; path?: unknown; from?: unknown })\n : null;\n if (operationRecord && typeof operationRecord.op === \"string\") {\n context.op = operationRecord.op;\n }\n if (operationRecord && typeof operationRecord.path === \"string\") {\n context.path = operationRecord.path;\n }\n if (operationRecord && typeof operationRecord.from === \"string\") {\n context.from = operationRecord.from;\n }\n if ((context.op === undefined || context.path === undefined) && context.patchIndex !== undefined) {\n const fallback = patch[context.patchIndex];\n if (fallback) {\n context.op = context.op ?? fallback.op;\n context.path = context.path ?? fallback.path;\n context.from = context.from ?? fallback.from;\n }\n }\n return context;\n}\n\nfunction applyHistoryPatch(\n current: CanonicalReplayDocument,\n patch: HistoryPatchOp[],\n entryNumber: number,\n entryOp: string,\n): CanonicalReplayDocument {\n try {\n const normalizedPatch = normalizeReplayPatchOps(patch);\n const applied = jsonPatch.applyPatch(\n structuredClone(current),\n normalizedPatch as jsonPatch.Operation[],\n true,\n false,\n ).newDocument as unknown;\n if (\n typeof applied !== \"object\" ||\n applied === null ||\n !(\"metadata\" in applied) ||\n !(\"body\" in applied) ||\n typeof (applied as { body: unknown }).body !== \"string\" ||\n typeof (applied as { metadata: unknown }).metadata !== \"object\" ||\n (applied as { metadata: unknown }).metadata === null\n ) {\n throw new PmCliError(\n `History replay produced an invalid document shape at entry ${entryNumber}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const replay = applied as { metadata: Record<string, unknown>; body: string };\n return {\n metadata: replay.metadata,\n body: replay.body,\n };\n } catch (error: unknown) {\n if (error instanceof PmCliError) {\n throw error;\n }\n const failureContext = extractPatchFailureContext(patch, error);\n const contextTokens = [\n `history_op=${entryOp}`,\n failureContext.patchIndex !== undefined ? `patch_index=${failureContext.patchIndex}` : null,\n failureContext.op ? `op=${failureContext.op}` : null,\n failureContext.path ? `path=${failureContext.path}` : null,\n failureContext.from ? `from=${failureContext.from}` : null,\n ].filter((token): token is string => token !== null);\n const reasonSuffix = failureContext.reason ? ` ${failureContext.reason}` : \"\";\n throw new PmCliError(\n `Failed to apply history patch at entry ${entryNumber} (${contextTokens.join(\", \")}).${reasonSuffix}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n}\n\nfunction replayToTarget(history: HistoryEntry[], targetIndex: number): CanonicalReplayDocument {\n let document: CanonicalReplayDocument = structuredClone(EMPTY_REPLAY_DOCUMENT);\n\n for (let i = 0; i <= targetIndex; i += 1) {\n const entry = history[i];\n const beforeHash = replayHash(document);\n if (beforeHash !== entry.before_hash) {\n throw new PmCliError(\n `History hash mismatch before replay at entry ${i + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n\n document = applyHistoryPatch(document, entry.patch, i + 1, entry.op);\n\n const afterHash = replayHash(document);\n if (afterHash !== entry.after_hash) {\n throw new PmCliError(\n `History hash mismatch after replay at entry ${i + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n }\n\n return document;\n}\n\nfunction ensureMaterializedRestoreTarget(\n replayDocument: CanonicalReplayDocument,\n target: ResolvedRestoreTarget,\n): CanonicalReplayDocument {\n if (Object.keys(replayDocument.metadata).length > 0) {\n return replayDocument;\n }\n throw new PmCliError(\n `Restore target ${target.raw} resolves to a deleted state; choose a version or timestamp where the item exists.`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction replayCurrentDocument(history: HistoryEntry[]): ItemDocument {\n const currentReplay = replayToTarget(history, history.length - 1);\n if (Object.keys(currentReplay.metadata).length === 0) {\n return {\n metadata: {} as ItemMetadata,\n body: currentReplay.body,\n };\n }\n return canonicalDocument({\n metadata: currentReplay.metadata as unknown as ItemMetadata,\n body: currentReplay.body,\n });\n}\n\nasync function resolveRestoreSubject(\n pmRoot: string,\n id: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n typeToFolder: Record<string, string>,\n): Promise<ResolvedRestoreSubject> {\n const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeToFolder);\n if (located) {\n const historyPath = getHistoryPath(pmRoot, located.id);\n const historyPolicy = await enforceHistoryStreamPolicyForItem({\n pmRoot,\n settings,\n itemId: located.id,\n commandLabel: \"restore\",\n });\n return {\n id: located.id,\n historyPath,\n located,\n historyPolicyWarnings: historyPolicy.warnings,\n };\n }\n\n const normalizedId = normalizeItemId(id, settings.id_prefix);\n const rawNormalizedId = normalizeRawItemId(id);\n const candidateIds = normalizedId === rawNormalizedId ? [normalizedId] : [normalizedId, rawNormalizedId];\n for (const candidateId of candidateIds) {\n const historyPath = getHistoryPath(pmRoot, candidateId);\n if (await pathExists(historyPath)) {\n return {\n id: candidateId,\n historyPath,\n located: null,\n historyPolicyWarnings: [],\n };\n }\n }\n\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n}\n\nfunction changedFields(beforeDocument: ItemDocument, afterDocument: ItemDocument): string[] {\n const beforeReplay = toReplayDocument(beforeDocument);\n const afterReplay = toReplayDocument(afterDocument);\n const patch = jsonPatch.compare(beforeReplay, afterReplay) as HistoryPatchOp[];\n const fields = new Set<string>();\n\n for (const op of patch) {\n if (op.path === \"/body\" || op.path.startsWith(\"/body/\")) {\n fields.add(\"body\");\n continue;\n }\n const segment = op.path.replace(/^\\/(?:metadata|front_matter)\\/?/, \"\").split(\"/\")[0];\n fields.add(segment.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\"));\n }\n\n return Array.from(fields).sort((a, b) => a.localeCompare(b));\n}\n\nexport async function runRestore(\n id: string,\n target: string,\n options: RestoreCommandOptions,\n global: GlobalOptions,\n): Promise<RestoreResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const subject = await resolveRestoreSubject(pmRoot, id, settings, typeRegistry.type_to_folder);\n const resolvedId = subject.id;\n const historyRawBeforeLock = await readFileIfExists(subject.historyPath);\n const history = await readHistoryEntries(subject.historyPath, resolvedId);\n if (history.length === 0) {\n throw new PmCliError(`No history exists for ${resolvedId}; restore is unavailable.`, EXIT_CODE.NOT_FOUND);\n }\n\n const resolvedTarget = ensureReplayTarget(target, history);\n const replayDocument = ensureMaterializedRestoreTarget(replayToTarget(history, resolvedTarget.historyIndex), resolvedTarget);\n const restoredDocument = canonicalDocument(\n {\n metadata: replayDocument.metadata as unknown as ItemMetadata,\n body: replayDocument.body,\n },\n { schema: settings.schema },\n );\n\n if (restoredDocument.metadata.id !== resolvedId) {\n throw new PmCliError(\n `Restore target resolved to item ${restoredDocument.metadata.id}, expected ${resolvedId}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const loadedItemBeforeLock = subject.located ? await readLocatedItem(subject.located, { schema: settings.schema }) : null;\n const currentItemRawBeforeLock = loadedItemBeforeLock?.raw ?? null;\n\n const author = resolveAuthor(options.author, settings.author_default);\n const releaseLock = await acquireLock(\n pmRoot,\n resolvedId,\n settings.locks.ttl_seconds,\n author,\n Boolean(options.force),\n settings.governance.force_required_for_stale_lock,\n );\n\n try {\n const historyRawUnderLock = await readFileIfExists(subject.historyPath);\n if (historyRawUnderLock !== historyRawBeforeLock) {\n throw new PmCliError(\n `History for ${resolvedId} changed while waiting for lock; retry restore.`,\n EXIT_CODE.CONFLICT,\n );\n }\n const locatedUnderLock = await locateItem(\n pmRoot,\n resolvedId,\n settings.id_prefix,\n settings.item_format,\n typeRegistry.type_to_folder,\n );\n const loadedItemUnderLock = locatedUnderLock ? await readLocatedItem(locatedUnderLock, { schema: settings.schema }) : null;\n if ((loadedItemUnderLock?.raw ?? null) !== currentItemRawBeforeLock) {\n throw new PmCliError(`Item ${resolvedId} changed while waiting for lock; retry restore.`, EXIT_CODE.CONFLICT);\n }\n\n const existingItemPath = locatedUnderLock?.itemPath ?? null;\n const itemFormat = \"toon\";\n let resolvedCurrentDocument: ItemDocument;\n let resolvedOriginalRaw: string | null = null;\n if (loadedItemUnderLock) {\n resolvedCurrentDocument = loadedItemUnderLock.document;\n resolvedOriginalRaw = loadedItemUnderLock.raw;\n } else {\n resolvedCurrentDocument = replayCurrentDocument(history);\n }\n const assigned = resolvedCurrentDocument.metadata.assignee?.trim();\n const ownershipWarnings: string[] = [];\n const hasOwnershipConflict = assigned && assigned !== author && !options.force;\n if (hasOwnershipConflict) {\n if (settings.governance.ownership_enforcement === \"strict\") {\n throw new PmCliError(\n `Item ${resolvedId} is assigned to ${assigned}. Use --force to override.`,\n EXIT_CODE.CONFLICT,\n );\n }\n if (settings.governance.ownership_enforcement === \"warn\") {\n ownershipWarnings.push(`ownership_warning:assignee_conflict:${resolvedId}:${assigned}`);\n }\n }\n\n const serializedRestore = serializeItemDocument(restoredDocument, { format: itemFormat, schema: settings.schema });\n const restoredItemPath = getItemPath(\n pmRoot,\n restoredDocument.metadata.type,\n resolvedId,\n itemFormat,\n typeRegistry.type_to_folder,\n );\n await writeFileAtomic(restoredItemPath, serializedRestore);\n if (existingItemPath && restoredItemPath !== existingItemPath) {\n await fs.rm(existingItemPath);\n }\n\n const historyEntry = createHistoryEntry({\n nowIso: nowIso(),\n author,\n op: \"restore\",\n before: resolvedCurrentDocument,\n after: restoredDocument,\n message: options.message,\n });\n\n try {\n await appendHistoryEntry(subject.historyPath, historyEntry);\n } catch (error: unknown) {\n if (existingItemPath && resolvedOriginalRaw !== null && restoredItemPath !== existingItemPath) {\n await writeFileAtomic(existingItemPath, resolvedOriginalRaw);\n await fs.rm(restoredItemPath, { force: true });\n } else if (existingItemPath && resolvedOriginalRaw !== null) {\n await writeFileAtomic(existingItemPath, resolvedOriginalRaw);\n } else {\n await fs.rm(restoredItemPath, { force: true });\n }\n throw error;\n }\n const restoreChangedFields = changedFields(resolvedCurrentDocument, restoredDocument);\n const hookWarnings = [\n ...(await runActiveOnWriteHooks({\n path: restoredItemPath,\n scope: \"project\",\n op: \"restore\",\n item_id: restoredDocument.metadata.id,\n item_type: restoredDocument.metadata.type,\n before: resolvedCurrentDocument,\n after: restoredDocument,\n changed_fields: [\"restored\"],\n })),\n ...(await runActiveOnWriteHooks({\n path: subject.historyPath,\n scope: \"project\",\n op: \"restore:history\",\n item_id: restoredDocument.metadata.id,\n item_type: restoredDocument.metadata.type,\n before: resolvedCurrentDocument,\n after: restoredDocument,\n changed_fields: [\"restored\"],\n })),\n ];\n recordAfterCommandAffectedItem({\n id: restoredDocument.metadata.id,\n op: \"restore\",\n item_type: restoredDocument.metadata.type,\n previous_status: resolvedCurrentDocument.metadata.status,\n status: restoredDocument.metadata.status,\n previous: projectAfterCommandItemSnapshot(resolvedCurrentDocument.metadata, restoreChangedFields),\n current: projectAfterCommandItemSnapshot(restoredDocument.metadata, restoreChangedFields),\n changed_fields: restoreChangedFields,\n });\n\n const targetEntry = history[resolvedTarget.historyIndex];\n return {\n item: restoredDocument.metadata,\n restored_from: {\n kind: resolvedTarget.kind,\n target: resolvedTarget.raw,\n history_index: resolvedTarget.historyIndex + 1,\n entry_ts: targetEntry.ts,\n entry_op: targetEntry.op,\n },\n changed_fields: restoreChangedFields,\n warnings: [...subject.historyPolicyWarnings, ...ownershipWarnings, ...hookWarnings],\n };\n } finally {\n await releaseLock();\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,gBAAgB,GAEjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iCAAiC,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC1F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD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QAAQ,EAAE,oBAAoB,CAAC;YACzF,cAAc,EAAE,oBAAoB;SACrC,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QACzD,OAAO;YACL,IAAI,EAAE,gBAAgB,CAAC,QAAQ;YAC/B,aAAa,EAAE;gBACb,IAAI,EAAE,cAAc,CAAC,IAAI;gBACzB,MAAM,EAAE,cAAc,CAAC,GAAG;gBAC1B,aAAa,EAAE,cAAc,CAAC,YAAY,GAAG,CAAC;gBAC9C,QAAQ,EAAE,WAAW,CAAC,EAAE;gBACxB,QAAQ,EAAE,WAAW,CAAC,EAAE;aACzB;YACD,cAAc,EAAE,oBAAoB;YACpC,QAAQ,EAAE,CAAC,GAAG,OAAO,CAAC,qBAAqB,EAAE,GAAG,iBAAiB,EAAE,GAAG,YAAY,CAAC;SACpF,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,WAAW,EAAE,CAAC;IACtB,CAAC;AACH,CAAC","debugId":"33d24f2b-7b7a-5588-9a53-e0511add3644"}
1
+ {"version":3,"file":"restore.js","sources":["cli/commands/restore.ts"],"sourceRoot":"/","sourcesContent":["import jsonPatch from \"fast-json-patch\";\nimport fs from \"node:fs/promises\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { appendHistoryEntry, createHistoryEntry } from \"../../core/history/history.js\";\nimport {\n EMPTY_REPLAY_DOCUMENT,\n normalizeReplayPatchOps,\n replayHash,\n toReplayDocument,\n type ReplayDocument as CanonicalReplayDocument,\n} from \"../../core/history/replay.js\";\nimport { enforceHistoryStreamPolicyForItem } from \"../../core/history/history-stream-policy.js\";\nimport { normalizeItemId, normalizeRawItemId } from \"../../core/item/id.js\";\nimport { canonicalDocument, serializeItemDocument } from \"../../core/item/item-format.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { acquireLock } from \"../../core/lock/lock.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport {\n getActiveExtensionRegistrations,\n projectAfterCommandItemSnapshot,\n recordAfterCommandAffectedItem,\n runActiveOnWriteHooks,\n} from \"../../core/extensions/index.js\";\nimport { locateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getHistoryPath, getItemPath, getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument, ItemMetadata } from \"../../types/index.js\";\nimport { readHistoryEntries } from \"./history.js\";\n\ninterface ResolvedRestoreTarget {\n kind: \"version\" | \"timestamp\";\n raw: string;\n historyIndex: number;\n}\n\ninterface ResolvedRestoreSubject {\n id: string;\n historyPath: string;\n located: Awaited<ReturnType<typeof locateItem>>;\n historyPolicyWarnings: string[];\n}\n\nexport interface RestoreCommandOptions {\n author?: string;\n message?: string;\n force?: boolean;\n}\n\nexport interface RestoreResult {\n item: ItemMetadata;\n restored_from: {\n kind: \"version\" | \"timestamp\";\n target: string;\n history_index: number;\n entry_ts: string;\n entry_op: string;\n };\n changed_fields: string[];\n warnings: string[];\n}\n\nfunction ensureReplayTarget(target: string, history: HistoryEntry[]): ResolvedRestoreTarget {\n const trimmed = target.trim();\n if (!trimmed) {\n throw new PmCliError(\"Missing restore target. Use a timestamp or version number.\", EXIT_CODE.USAGE);\n }\n\n if (/^\\d+$/.test(trimmed)) {\n const version = Number(trimmed);\n if (!Number.isSafeInteger(version) || version < 1 || version > history.length) {\n throw new PmCliError(\n `Restore version must be between 1 and ${history.length} for this item.`,\n EXIT_CODE.USAGE,\n );\n }\n return {\n kind: \"version\",\n raw: trimmed,\n historyIndex: version - 1,\n };\n }\n\n const parsedTarget = Date.parse(trimmed);\n if (!Number.isFinite(parsedTarget)) {\n throw new PmCliError(\n `Invalid restore target \"${target}\". Use a positive version number or ISO timestamp.`,\n EXIT_CODE.USAGE,\n );\n }\n\n let index = -1;\n for (let i = 0; i < history.length; i += 1) {\n const entryTimestamp = Date.parse(history[i].ts);\n if (!Number.isFinite(entryTimestamp)) {\n throw new PmCliError(\n `History for this item contains invalid timestamp at entry ${i + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (entryTimestamp <= parsedTarget) {\n index = i;\n }\n }\n\n if (index < 0) {\n throw new PmCliError(`No history entries exist at or before timestamp ${trimmed}.`, EXIT_CODE.USAGE);\n }\n\n return {\n kind: \"timestamp\",\n raw: trimmed,\n historyIndex: index,\n };\n}\n\nfunction extractPatchFailureContext(\n patch: HistoryPatchOp[],\n error: unknown,\n): { patchIndex?: number; op?: string; path?: string; from?: string; reason?: string } {\n const context: { patchIndex?: number; op?: string; path?: string; from?: string; reason?: string } = {};\n if (error instanceof Error && error.message.trim().length > 0) {\n context.reason = error.message.trim();\n }\n if (typeof error !== \"object\" || error === null) {\n return context;\n }\n const candidate = error as {\n index?: unknown;\n operation?: unknown;\n };\n /* c8 ignore start -- parser-generated patch errors may omit index metadata in current fixtures. */\n if (typeof candidate.index === \"number\" && Number.isInteger(candidate.index) && candidate.index >= 0) {\n context.patchIndex = candidate.index;\n }\n /* c8 ignore stop */\n /* c8 ignore start -- operation payload metadata is optional in upstream json-patch failures. */\n const operationRecord =\n typeof candidate.operation === \"object\" && candidate.operation !== null\n ? (candidate.operation as { op?: unknown; path?: unknown; from?: unknown })\n : null;\n /* c8 ignore stop */\n if (operationRecord && typeof operationRecord.op === \"string\") {\n context.op = operationRecord.op;\n }\n if (operationRecord && typeof operationRecord.path === \"string\") {\n context.path = operationRecord.path;\n }\n if (operationRecord && typeof operationRecord.from === \"string\") {\n context.from = operationRecord.from;\n }\n if ((context.op === undefined || context.path === undefined) && context.patchIndex !== undefined) {\n const fallback = patch[context.patchIndex];\n /* c8 ignore start -- fallback enrichment paths are only exercised by malformed patch telemetry payloads. */\n if (fallback) {\n context.op = context.op ?? fallback.op;\n context.path = context.path ?? fallback.path;\n context.from = context.from ?? fallback.from;\n }\n /* c8 ignore stop */\n }\n return context;\n}\n\nfunction applyHistoryPatch(\n current: CanonicalReplayDocument,\n patch: HistoryPatchOp[],\n entryNumber: number,\n entryOp: string,\n): CanonicalReplayDocument {\n try {\n const normalizedPatch = normalizeReplayPatchOps(patch);\n const applied = jsonPatch.applyPatch(\n structuredClone(current),\n normalizedPatch as jsonPatch.Operation[],\n true,\n false,\n ).newDocument as unknown;\n if (\n typeof applied !== \"object\" ||\n applied === null ||\n !(\"metadata\" in applied) ||\n !(\"body\" in applied) ||\n typeof (applied as { body: unknown }).body !== \"string\" ||\n typeof (applied as { metadata: unknown }).metadata !== \"object\" ||\n (applied as { metadata: unknown }).metadata === null\n ) {\n throw new PmCliError(\n `History replay produced an invalid document shape at entry ${entryNumber}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const replay = applied as { metadata: Record<string, unknown>; body: string };\n return {\n metadata: replay.metadata,\n body: replay.body,\n };\n } catch (error: unknown) {\n if (error instanceof PmCliError) {\n throw error;\n }\n const failureContext = extractPatchFailureContext(patch, error);\n const contextTokens = [\n `history_op=${entryOp}`,\n /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */\n failureContext.patchIndex !== undefined ? `patch_index=${failureContext.patchIndex}` : null,\n /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */\n failureContext.op ? `op=${failureContext.op}` : null,\n /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */\n failureContext.path ? `path=${failureContext.path}` : null,\n /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */\n failureContext.from ? `from=${failureContext.from}` : null,\n ].filter((token): token is string => token !== null);\n /* c8 ignore start -- jsonPatch/structuredClone/normalizeReplayPatchOps always throw Error instances with non-empty messages here, so extractPatchFailureContext always sets reason; the empty-suffix fallback is unreachable through applyHistoryPatch. */\n const reasonSuffix = failureContext.reason ? ` ${failureContext.reason}` : \"\";\n /* c8 ignore stop */\n throw new PmCliError(\n `Failed to apply history patch at entry ${entryNumber} (${contextTokens.join(\", \")}).${reasonSuffix}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n}\n\nfunction replayToTarget(history: HistoryEntry[], targetIndex: number): CanonicalReplayDocument {\n let document: CanonicalReplayDocument = structuredClone(EMPTY_REPLAY_DOCUMENT);\n\n for (let i = 0; i <= targetIndex; i += 1) {\n const entry = history[i];\n const beforeHash = replayHash(document);\n if (beforeHash !== entry.before_hash) {\n throw new PmCliError(\n `History hash mismatch before replay at entry ${i + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n\n document = applyHistoryPatch(document, entry.patch, i + 1, entry.op);\n\n const afterHash = replayHash(document);\n if (afterHash !== entry.after_hash) {\n throw new PmCliError(\n `History hash mismatch after replay at entry ${i + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n }\n\n return document;\n}\n\nfunction ensureMaterializedRestoreTarget(\n replayDocument: CanonicalReplayDocument,\n target: ResolvedRestoreTarget,\n): CanonicalReplayDocument {\n if (Object.keys(replayDocument.metadata).length > 0) {\n return replayDocument;\n }\n throw new PmCliError(\n `Restore target ${target.raw} resolves to a deleted state; choose a version or timestamp where the item exists.`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction replayCurrentDocument(history: HistoryEntry[]): ItemDocument {\n const currentReplay = replayToTarget(history, history.length - 1);\n if (Object.keys(currentReplay.metadata).length === 0) {\n return {\n metadata: {} as ItemMetadata,\n body: currentReplay.body,\n };\n }\n return canonicalDocument({\n metadata: currentReplay.metadata as unknown as ItemMetadata,\n body: currentReplay.body,\n });\n}\n\nasync function resolveRestoreSubject(\n pmRoot: string,\n id: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n typeToFolder: Record<string, string>,\n): Promise<ResolvedRestoreSubject> {\n const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeToFolder);\n if (located) {\n const historyPath = getHistoryPath(pmRoot, located.id);\n const historyPolicy = await enforceHistoryStreamPolicyForItem({\n pmRoot,\n settings,\n itemId: located.id,\n commandLabel: \"restore\",\n });\n return {\n id: located.id,\n historyPath,\n located,\n historyPolicyWarnings: historyPolicy.warnings,\n };\n }\n\n const normalizedId = normalizeItemId(id, settings.id_prefix);\n const rawNormalizedId = normalizeRawItemId(id);\n /* c8 ignore start -- raw-id fallback is covered by normalize-item-id utility tests. */\n const candidateIds = normalizedId === rawNormalizedId ? [normalizedId] : [normalizedId, rawNormalizedId];\n /* c8 ignore stop */\n for (const candidateId of candidateIds) {\n const historyPath = getHistoryPath(pmRoot, candidateId);\n if (await pathExists(historyPath)) {\n return {\n id: candidateId,\n historyPath,\n located: null,\n historyPolicyWarnings: [],\n };\n }\n }\n\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n}\n\nfunction changedFields(beforeDocument: ItemDocument, afterDocument: ItemDocument): string[] {\n const beforeReplay = toReplayDocument(beforeDocument);\n const afterReplay = toReplayDocument(afterDocument);\n const patch = jsonPatch.compare(beforeReplay, afterReplay) as HistoryPatchOp[];\n const fields = new Set<string>();\n\n for (const op of patch) {\n if (op.path === \"/body\" || op.path.startsWith(\"/body/\")) {\n fields.add(\"body\");\n continue;\n }\n const segment = op.path.replace(/^\\/(?:metadata|front_matter)\\/?/, \"\").split(\"/\")[0];\n fields.add(segment.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\"));\n }\n\n return Array.from(fields).sort((a, b) => a.localeCompare(b));\n}\n\nexport async function runRestore(\n id: string,\n target: string,\n options: RestoreCommandOptions,\n global: GlobalOptions,\n): Promise<RestoreResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const subject = await resolveRestoreSubject(pmRoot, id, settings, typeRegistry.type_to_folder);\n const resolvedId = subject.id;\n const historyRawBeforeLock = await readFileIfExists(subject.historyPath);\n const history = await readHistoryEntries(subject.historyPath, resolvedId);\n if (history.length === 0) {\n throw new PmCliError(`No history exists for ${resolvedId}; restore is unavailable.`, EXIT_CODE.NOT_FOUND);\n }\n\n const resolvedTarget = ensureReplayTarget(target, history);\n const replayDocument = ensureMaterializedRestoreTarget(replayToTarget(history, resolvedTarget.historyIndex), resolvedTarget);\n const restoredDocument = canonicalDocument(\n {\n metadata: replayDocument.metadata as unknown as ItemMetadata,\n body: replayDocument.body,\n },\n { schema: settings.schema },\n );\n\n if (restoredDocument.metadata.id !== resolvedId) {\n throw new PmCliError(\n `Restore target resolved to item ${restoredDocument.metadata.id}, expected ${resolvedId}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const loadedItemBeforeLock = subject.located ? await readLocatedItem(subject.located, { schema: settings.schema }) : null;\n const currentItemRawBeforeLock = loadedItemBeforeLock?.raw ?? null;\n\n const author = resolveAuthor(options.author, settings.author_default);\n const releaseLock = await acquireLock(\n pmRoot,\n resolvedId,\n settings.locks.ttl_seconds,\n author,\n Boolean(options.force),\n settings.governance.force_required_for_stale_lock,\n );\n\n try {\n const historyRawUnderLock = await readFileIfExists(subject.historyPath);\n if (historyRawUnderLock !== historyRawBeforeLock) {\n throw new PmCliError(\n `History for ${resolvedId} changed while waiting for lock; retry restore.`,\n EXIT_CODE.CONFLICT,\n );\n }\n const locatedUnderLock = await locateItem(\n pmRoot,\n resolvedId,\n settings.id_prefix,\n settings.item_format,\n typeRegistry.type_to_folder,\n );\n const loadedItemUnderLock = locatedUnderLock ? await readLocatedItem(locatedUnderLock, { schema: settings.schema }) : null;\n if ((loadedItemUnderLock?.raw ?? null) !== currentItemRawBeforeLock) {\n throw new PmCliError(`Item ${resolvedId} changed while waiting for lock; retry restore.`, EXIT_CODE.CONFLICT);\n }\n\n const existingItemPath = locatedUnderLock?.itemPath ?? null;\n const itemFormat = \"toon\";\n let resolvedCurrentDocument: ItemDocument;\n let resolvedOriginalRaw: string | null = null;\n if (loadedItemUnderLock) {\n resolvedCurrentDocument = loadedItemUnderLock.document;\n resolvedOriginalRaw = loadedItemUnderLock.raw;\n } else {\n resolvedCurrentDocument = replayCurrentDocument(history);\n }\n const assigned = resolvedCurrentDocument.metadata.assignee?.trim();\n const ownershipWarnings: string[] = [];\n const hasOwnershipConflict = assigned && assigned !== author && !options.force;\n if (hasOwnershipConflict) {\n if (settings.governance.ownership_enforcement === \"strict\") {\n throw new PmCliError(\n `Item ${resolvedId} is assigned to ${assigned}. Use --force to override.`,\n EXIT_CODE.CONFLICT,\n );\n }\n if (settings.governance.ownership_enforcement === \"warn\") {\n ownershipWarnings.push(`ownership_warning:assignee_conflict:${resolvedId}:${assigned}`);\n }\n }\n\n const serializedRestore = serializeItemDocument(restoredDocument, { format: itemFormat, schema: settings.schema });\n /* c8 ignore next -- restored item path typing is exercised in restore integration workflows. */\n const restoredItemPath = getItemPath(\n pmRoot,\n restoredDocument.metadata.type,\n resolvedId,\n itemFormat,\n typeRegistry.type_to_folder,\n );\n await writeFileAtomic(restoredItemPath, serializedRestore);\n if (existingItemPath && restoredItemPath !== existingItemPath) {\n await fs.rm(existingItemPath);\n }\n\n const historyEntry = createHistoryEntry({\n nowIso: nowIso(),\n author,\n op: \"restore\",\n before: resolvedCurrentDocument,\n after: restoredDocument,\n message: options.message,\n });\n\n try {\n await appendHistoryEntry(subject.historyPath, historyEntry);\n } catch (error: unknown) {\n if (existingItemPath && resolvedOriginalRaw !== null && restoredItemPath !== existingItemPath) {\n await writeFileAtomic(existingItemPath, resolvedOriginalRaw);\n await fs.rm(restoredItemPath, { force: true });\n } else if (existingItemPath && resolvedOriginalRaw !== null) {\n await writeFileAtomic(existingItemPath, resolvedOriginalRaw);\n } else {\n await fs.rm(restoredItemPath, { force: true });\n }\n throw error;\n }\n const restoreChangedFields = changedFields(resolvedCurrentDocument, restoredDocument);\n const hookWarnings = [\n ...(await runActiveOnWriteHooks({\n path: restoredItemPath,\n scope: \"project\",\n op: \"restore\",\n item_id: restoredDocument.metadata.id,\n item_type: restoredDocument.metadata.type,\n before: resolvedCurrentDocument,\n after: restoredDocument,\n changed_fields: [\"restored\"],\n })),\n ...(await runActiveOnWriteHooks({\n path: subject.historyPath,\n scope: \"project\",\n op: \"restore:history\",\n item_id: restoredDocument.metadata.id,\n item_type: restoredDocument.metadata.type,\n before: resolvedCurrentDocument,\n after: restoredDocument,\n changed_fields: [\"restored\"],\n })),\n ];\n recordAfterCommandAffectedItem({\n id: restoredDocument.metadata.id,\n op: \"restore\",\n item_type: restoredDocument.metadata.type,\n previous_status: resolvedCurrentDocument.metadata.status,\n status: restoredDocument.metadata.status,\n previous: projectAfterCommandItemSnapshot(resolvedCurrentDocument.metadata, restoreChangedFields),\n current: projectAfterCommandItemSnapshot(restoredDocument.metadata, restoreChangedFields),\n changed_fields: restoreChangedFields,\n });\n\n const targetEntry = history[resolvedTarget.historyIndex];\n return {\n item: restoredDocument.metadata,\n restored_from: {\n kind: resolvedTarget.kind,\n target: resolvedTarget.raw,\n history_index: resolvedTarget.historyIndex + 1,\n entry_ts: targetEntry.ts,\n entry_op: targetEntry.op,\n },\n changed_fields: restoreChangedFields,\n warnings: [...subject.historyPolicyWarnings, ...ownershipWarnings, ...hookWarnings],\n };\n } finally {\n await releaseLock();\n }\n}\n\nexport const _testOnlyRestoreCommand = {\n applyHistoryPatch,\n changedFields,\n ensureMaterializedRestoreTarget,\n ensureReplayTarget,\n extractPatchFailureContext,\n replayCurrentDocument,\n replayToTarget,\n resolveRestoreSubject,\n};\n"],"names":[],"mappings":";;AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,gBAA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AAiB,EAAE,GAAG,YAAY,CAAC;SACpF,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,WAAW,EAAE,CAAC;IACtB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,iBAAiB;IACjB,aAAa;IACb,+BAA+B;IAC/B,kBAAkB;IAClB,0BAA0B;IAC1B,qBAAqB;IACrB,cAAc;IACd,qBAAqB;CACtB,CAAC","debugId":"6a04c7ce-b4b5-5641-8717-6a5bc50df4c1"}
@@ -0,0 +1,43 @@
1
+ import type { GlobalOptions } from "../../core/shared/command-types.js";
2
+ import { type CreateResult } from "./create.js";
3
+ /**
4
+ * GH-217: low-friction creation shortcuts for the scheduling item types
5
+ * (Meeting/Event/Reminder), which sit unused because `pm create --type Event`
6
+ * demands structured `--event`/`--reminder` CSV entries. These commands accept
7
+ * friendly time flags (`--start`, `--duration`, `--end`, `--at`) and translate
8
+ * them into the canonical scheduling fields, then delegate to `runCreate` so the
9
+ * full create pipeline (parent/focus inheritance, governance, hooks, validation)
10
+ * applies unchanged. The `lightweight` schedule preset is applied so progressive
11
+ * scheduling fields are not demanded up front.
12
+ */
13
+ /** Options shared by every scheduling shortcut, forwarded to `runCreate`. */
14
+ export interface SchedulingShortcutCommonOptions {
15
+ parent?: string;
16
+ allowMissingParent?: boolean;
17
+ tags?: string;
18
+ priority?: string;
19
+ body?: string;
20
+ description?: string;
21
+ author?: string;
22
+ message?: string;
23
+ }
24
+ /** Options for `pm meet` and `pm event` (a start time plus a span). */
25
+ export interface MeetingEventShortcutOptions extends SchedulingShortcutCommonOptions {
26
+ start?: string;
27
+ duration?: string;
28
+ end?: string;
29
+ location?: string;
30
+ timezone?: string;
31
+ allDay?: boolean;
32
+ }
33
+ /** Options for `pm remind` (a single point in time). */
34
+ export interface ReminderShortcutOptions extends SchedulingShortcutCommonOptions {
35
+ at?: string;
36
+ text?: string;
37
+ }
38
+ /** `pm meet "<title>"` — create a Meeting with sensible scheduling defaults. */
39
+ export declare function runMeet(title: string, options: MeetingEventShortcutOptions, global: GlobalOptions): Promise<CreateResult>;
40
+ /** `pm event "<title>"` — create an Event with sensible scheduling defaults. */
41
+ export declare function runEvent(title: string, options: MeetingEventShortcutOptions, global: GlobalOptions): Promise<CreateResult>;
42
+ /** `pm remind "<title>"` — create a Reminder from a single point in time. */
43
+ export declare function runRemind(title: string, options: ReminderShortcutOptions, global: GlobalOptions): Promise<CreateResult>;
@@ -0,0 +1,87 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4bf8318c-3db7-55c8-8d48-e1d18c5a2be7")}catch(e){}}();
3
+ import { runCreate } from "./create.js";
4
+ /** Default span applied when neither `--end` nor `--duration` is given. */
5
+ const DEFAULT_DURATION = "1h";
6
+ /** Default start applied when `--start` is omitted (keeps the item calendar-visible). */
7
+ const DEFAULT_START = "now";
8
+ /** Default reminder time applied when `--at` is omitted. */
9
+ const DEFAULT_REMINDER_AT = "+1d";
10
+ /**
11
+ * Wrap a free-text value (reminder text, event location) in double quotes so
12
+ * commas and colons survive the CSV round-trip into `--reminder`/`--event`.
13
+ * Backslashes are escaped first, then embedded quotes — escaping quotes alone
14
+ * would let a trailing backslash escape the closing quote and break out of the
15
+ * quoted field (CSV injection). The parser's `unquoteValue` strips the wrapping
16
+ * quotes and unescapes `\"` back to `"`.
17
+ */
18
+ function quoteCsvValue(value) {
19
+ return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
20
+ }
21
+ /**
22
+ * Append a `key="value"` pair. EVERY value is double-quoted (not just free-text
23
+ * fields) so a comma or `=` in any token — `start`, `duration`, `at`, etc. —
24
+ * cannot inject extra CSV key/value pairs into the `--event`/`--reminder`
25
+ * entry. The parser's `parseCsvKv` unquotes every value before use, so quoting
26
+ * is transparent to ISO/relative/timezone tokens.
27
+ */
28
+ function appendPair(pairs, key, value) {
29
+ if (value !== undefined) {
30
+ pairs.push(`${key}=${quoteCsvValue(value)}`);
31
+ }
32
+ }
33
+ function buildCommonOptions(type, title, options) {
34
+ return {
35
+ type,
36
+ title,
37
+ schedulePreset: "lightweight",
38
+ parent: options.parent,
39
+ allowMissingParent: options.allowMissingParent,
40
+ tags: options.tags,
41
+ priority: options.priority,
42
+ body: options.body,
43
+ description: options.description,
44
+ author: options.author,
45
+ message: options.message,
46
+ };
47
+ }
48
+ function buildEventEntry(options) {
49
+ const pairs = [];
50
+ appendPair(pairs, "start", options.start ?? DEFAULT_START);
51
+ if (options.end !== undefined) {
52
+ appendPair(pairs, "end", options.end);
53
+ }
54
+ else {
55
+ appendPair(pairs, "duration", options.duration ?? DEFAULT_DURATION);
56
+ }
57
+ appendPair(pairs, "location", options.location);
58
+ appendPair(pairs, "timezone", options.timezone);
59
+ if (options.allDay === true) {
60
+ appendPair(pairs, "all_day", "true");
61
+ }
62
+ return pairs.join(",");
63
+ }
64
+ async function createScheduled(type, title, options, global) {
65
+ const createOptions = buildCommonOptions(type, title, options);
66
+ createOptions.event = [buildEventEntry(options)];
67
+ return runCreate(createOptions, global);
68
+ }
69
+ /** `pm meet "<title>"` — create a Meeting with sensible scheduling defaults. */
70
+ export function runMeet(title, options, global) {
71
+ return createScheduled("Meeting", title, options, global);
72
+ }
73
+ /** `pm event "<title>"` — create an Event with sensible scheduling defaults. */
74
+ export function runEvent(title, options, global) {
75
+ return createScheduled("Event", title, options, global);
76
+ }
77
+ /** `pm remind "<title>"` — create a Reminder from a single point in time. */
78
+ export function runRemind(title, options, global) {
79
+ const createOptions = buildCommonOptions("Reminder", title, options);
80
+ const pairs = [];
81
+ appendPair(pairs, "at", options.at ?? DEFAULT_REMINDER_AT);
82
+ appendPair(pairs, "text", options.text ?? title);
83
+ createOptions.reminder = [pairs.join(",")];
84
+ return runCreate(createOptions, global);
85
+ }
86
+ //# sourceMappingURL=scheduling-shortcuts.js.map
87
+ //# debugId=4bf8318c-3db7-55c8-8d48-e1d18c5a2be7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduling-shortcuts.js","sources":["cli/commands/scheduling-shortcuts.ts"],"sourceRoot":"/","sourcesContent":["import type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { runCreate, type CreateCommandOptions, type CreateResult } from \"./create.js\";\n\n/**\n * GH-217: low-friction creation shortcuts for the scheduling item types\n * (Meeting/Event/Reminder), which sit unused because `pm create --type Event`\n * demands structured `--event`/`--reminder` CSV entries. These commands accept\n * friendly time flags (`--start`, `--duration`, `--end`, `--at`) and translate\n * them into the canonical scheduling fields, then delegate to `runCreate` so the\n * full create pipeline (parent/focus inheritance, governance, hooks, validation)\n * applies unchanged. The `lightweight` schedule preset is applied so progressive\n * scheduling fields are not demanded up front.\n */\n\n/** Options shared by every scheduling shortcut, forwarded to `runCreate`. */\nexport interface SchedulingShortcutCommonOptions {\n parent?: string;\n allowMissingParent?: boolean;\n tags?: string;\n priority?: string;\n body?: string;\n description?: string;\n author?: string;\n message?: string;\n}\n\n/** Options for `pm meet` and `pm event` (a start time plus a span). */\nexport interface MeetingEventShortcutOptions extends SchedulingShortcutCommonOptions {\n start?: string;\n duration?: string;\n end?: string;\n location?: string;\n timezone?: string;\n allDay?: boolean;\n}\n\n/** Options for `pm remind` (a single point in time). */\nexport interface ReminderShortcutOptions extends SchedulingShortcutCommonOptions {\n at?: string;\n text?: string;\n}\n\n/** Default span applied when neither `--end` nor `--duration` is given. */\nconst DEFAULT_DURATION = \"1h\";\n/** Default start applied when `--start` is omitted (keeps the item calendar-visible). */\nconst DEFAULT_START = \"now\";\n/** Default reminder time applied when `--at` is omitted. */\nconst DEFAULT_REMINDER_AT = \"+1d\";\n\n/**\n * Wrap a free-text value (reminder text, event location) in double quotes so\n * commas and colons survive the CSV round-trip into `--reminder`/`--event`.\n * Backslashes are escaped first, then embedded quotes — escaping quotes alone\n * would let a trailing backslash escape the closing quote and break out of the\n * quoted field (CSV injection). The parser's `unquoteValue` strips the wrapping\n * quotes and unescapes `\\\"` back to `\"`.\n */\nfunction quoteCsvValue(value: string): string {\n return `\"${value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\")}\"`;\n}\n\n/**\n * Append a `key=\"value\"` pair. EVERY value is double-quoted (not just free-text\n * fields) so a comma or `=` in any token — `start`, `duration`, `at`, etc. —\n * cannot inject extra CSV key/value pairs into the `--event`/`--reminder`\n * entry. The parser's `parseCsvKv` unquotes every value before use, so quoting\n * is transparent to ISO/relative/timezone tokens.\n */\nfunction appendPair(pairs: string[], key: string, value: string | undefined): void {\n if (value !== undefined) {\n pairs.push(`${key}=${quoteCsvValue(value)}`);\n }\n}\n\nfunction buildCommonOptions(\n type: string,\n title: string,\n options: SchedulingShortcutCommonOptions,\n): CreateCommandOptions {\n return {\n type,\n title,\n schedulePreset: \"lightweight\",\n parent: options.parent,\n allowMissingParent: options.allowMissingParent,\n tags: options.tags,\n priority: options.priority,\n body: options.body,\n description: options.description,\n author: options.author,\n message: options.message,\n };\n}\n\nfunction buildEventEntry(options: MeetingEventShortcutOptions): string {\n const pairs: string[] = [];\n appendPair(pairs, \"start\", options.start ?? DEFAULT_START);\n if (options.end !== undefined) {\n appendPair(pairs, \"end\", options.end);\n } else {\n appendPair(pairs, \"duration\", options.duration ?? DEFAULT_DURATION);\n }\n appendPair(pairs, \"location\", options.location);\n appendPair(pairs, \"timezone\", options.timezone);\n if (options.allDay === true) {\n appendPair(pairs, \"all_day\", \"true\");\n }\n return pairs.join(\",\");\n}\n\nasync function createScheduled(\n type: string,\n title: string,\n options: MeetingEventShortcutOptions,\n global: GlobalOptions,\n): Promise<CreateResult> {\n const createOptions = buildCommonOptions(type, title, options);\n createOptions.event = [buildEventEntry(options)];\n return runCreate(createOptions, global);\n}\n\n/** `pm meet \"<title>\"` — create a Meeting with sensible scheduling defaults. */\nexport function runMeet(\n title: string,\n options: MeetingEventShortcutOptions,\n global: GlobalOptions,\n): Promise<CreateResult> {\n return createScheduled(\"Meeting\", title, options, global);\n}\n\n/** `pm event \"<title>\"` — create an Event with sensible scheduling defaults. */\nexport function runEvent(\n title: string,\n options: MeetingEventShortcutOptions,\n global: GlobalOptions,\n): Promise<CreateResult> {\n return createScheduled(\"Event\", title, options, global);\n}\n\n/** `pm remind \"<title>\"` — create a Reminder from a single point in time. */\nexport function runRemind(\n title: string,\n options: ReminderShortcutOptions,\n global: GlobalOptions,\n): Promise<CreateResult> {\n const createOptions = buildCommonOptions(\"Reminder\", title, options);\n const pairs: string[] = [];\n appendPair(pairs, \"at\", options.at ?? DEFAULT_REMINDER_AT);\n appendPair(pairs, \"text\", options.text ?? title);\n createOptions.reminder = [pairs.join(\",\")];\n return runCreate(createOptions, global);\n}\n"],"names":[],"mappings":";;AACA,OAAO,EAAE,SAAS,EAAgD,MAAM,aAAa,CAAC;AAyCtF,2EAA2E;AAC3E,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,yFAAyF;AACzF,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,4DAA4D;AAC5D,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAElC;;;;;;;GAOG;AACH,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,KAAe,EAAE,GAAW,EAAE,KAAyB;IACzE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CACzB,IAAY,EACZ,KAAa,EACb,OAAwC;IAExC,OAAO;QACL,IAAI;QACJ,KAAK;QACL,c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