@unbrained/pm-cli 2026.8.6 → 2026.8.7

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 (209) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +30 -0
  3. package/dist/cli/main.js +4 -2
  4. package/dist/cli/register-operations.js +11 -2
  5. package/dist/cli/stats-analytics-json.d.ts +9 -0
  6. package/dist/cli/stats-analytics-json.js +69 -0
  7. package/dist/cli-bundle/bundle-manifest.json +397 -397
  8. package/dist/cli-bundle/chunks/append-7BXBFDGD.js +2 -0
  9. package/dist/cli-bundle/chunks/{chunk-TPKDJ5WL.js → chunk-2AXF3VSK.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-R6RKEYYW.js → chunk-2XS43CCV.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-T45OHXDW.js → chunk-3A6KWB72.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-3ISTDB42.js +8 -0
  13. package/dist/cli-bundle/chunks/{chunk-SXECIECW.js → chunk-4MTI7XOV.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-MCS73BKB.js → chunk-6BX5UDCN.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-A3XQ7VPU.js → chunk-6QPO7KLR.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-BP6EMEDP.js → chunk-7MXHZHSQ.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-GU3TSEHD.js → chunk-7ZPMJW4U.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-343QETLI.js → chunk-AGYNSNCI.js} +2 -2
  19. package/dist/cli-bundle/chunks/chunk-B4H7FEFH.js +5 -0
  20. package/dist/cli-bundle/chunks/{chunk-CA3BURYF.js → chunk-B4KLBBMN.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-3ZJRFYY2.js → chunk-CALJHNBL.js} +12 -12
  22. package/dist/cli-bundle/chunks/{chunk-M357ZCOR.js → chunk-CFIGP5LY.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-SVV3DQES.js → chunk-CS6MRHG7.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-DWOAOZHZ.js → chunk-CUGNQQKH.js} +2 -2
  25. package/dist/cli-bundle/chunks/chunk-D4FPS43D.js +164 -0
  26. package/dist/cli-bundle/chunks/{chunk-L6LGKJX3.js → chunk-H5Y5YE6A.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-5PBP2ZP3.js → chunk-H5Y6UV6E.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-QJ7C3JIW.js → chunk-H7KGWPDF.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-D7I3TUGV.js → chunk-HFSD77TQ.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-AOBDLU4T.js → chunk-HX2GTA6L.js} +2 -2
  31. package/dist/cli-bundle/chunks/{chunk-4AVFKHHC.js → chunk-J2IEKAVR.js} +2 -2
  32. package/dist/cli-bundle/chunks/{chunk-OXY3SJ3N.js → chunk-K44PYFXH.js} +2 -2
  33. package/dist/cli-bundle/chunks/{chunk-M4VEE3FK.js → chunk-K4KGEEBT.js} +2 -2
  34. package/dist/cli-bundle/chunks/chunk-KFLK5TRH.js +21 -0
  35. package/dist/cli-bundle/chunks/{chunk-FDBRXV25.js → chunk-KL6IEBV2.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-JQ4NZ5EB.js → chunk-KWQZDZSS.js} +2 -2
  37. package/dist/cli-bundle/chunks/{chunk-UVVXHGYS.js → chunk-KZ4X3DGU.js} +2 -2
  38. package/dist/cli-bundle/chunks/chunk-LD77HJMQ.js +13 -0
  39. package/dist/cli-bundle/chunks/{chunk-AYRUGRNS.js → chunk-ME2JJ4LA.js} +2 -2
  40. package/dist/cli-bundle/chunks/chunk-NFLJ3FHD.js +2 -0
  41. package/dist/cli-bundle/chunks/{chunk-MDTH7SAE.js → chunk-NG6OXIBR.js} +8 -8
  42. package/dist/cli-bundle/chunks/{chunk-R6LSRGPS.js → chunk-NYIGHWQY.js} +2 -2
  43. package/dist/cli-bundle/chunks/{chunk-3KFVGGRE.js → chunk-NZ75GNSA.js} +2 -2
  44. package/dist/cli-bundle/chunks/{chunk-Q3VOP62W.js → chunk-PCJWJNC2.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-C3YABSJK.js → chunk-PD3225AM.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-JFZIS6JF.js → chunk-PDEGKG7P.js} +2 -2
  47. package/dist/cli-bundle/chunks/chunk-PIE5HBNA.js +2 -0
  48. package/dist/cli-bundle/chunks/{chunk-SD3YXU2U.js → chunk-PW2H7YJR.js} +20 -20
  49. package/dist/cli-bundle/chunks/{chunk-PECV7L5T.js → chunk-TPKN3S7S.js} +2 -2
  50. package/dist/cli-bundle/chunks/{chunk-F4NREH3G.js → chunk-TPXAXTCO.js} +2 -2
  51. package/dist/cli-bundle/chunks/chunk-UFWUJO4V.js +2 -0
  52. package/dist/cli-bundle/chunks/{chunk-WSI5KZQJ.js → chunk-UQLZQVFW.js} +2 -2
  53. package/dist/cli-bundle/chunks/{chunk-4OVGQW22.js → chunk-VT3Z5G7D.js} +2 -2
  54. package/dist/cli-bundle/chunks/{chunk-RUAU5OSH.js → chunk-WOD3WWUN.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-DQGJ2RWT.js → chunk-WSJEIGJF.js} +2 -2
  56. package/dist/cli-bundle/chunks/{chunk-RAFUN7IX.js → chunk-WYNUU7ZW.js} +49 -46
  57. package/dist/cli-bundle/chunks/{chunk-5ZKQPA44.js → chunk-YGPNCCXZ.js} +2 -2
  58. package/dist/cli-bundle/chunks/close-CMY3BAUG.js +2 -0
  59. package/dist/cli-bundle/chunks/close-many-SA4XZCTK.js +2 -0
  60. package/dist/cli-bundle/chunks/comments-EZ556ZD3.js +2 -0
  61. package/dist/cli-bundle/chunks/copy-ZSGPA52X.js +2 -0
  62. package/dist/cli-bundle/chunks/{create-TG67IVFI.js → create-I5DVV4YG.js} +2 -2
  63. package/dist/cli-bundle/chunks/delete-RL3JACSW.js +2 -0
  64. package/dist/cli-bundle/chunks/{deps-AJUGP2OH.js → deps-S7UBCECS.js} +2 -2
  65. package/dist/cli-bundle/chunks/{docs-QOCLDRKJ.js → docs-ZZNVBBYO.js} +2 -2
  66. package/dist/cli-bundle/chunks/{files-3ST5TY64.js → files-27C337VT.js} +2 -2
  67. package/dist/cli-bundle/chunks/focus-5Z2SG7LU.js +2 -0
  68. package/dist/cli-bundle/chunks/{history-compact-7BJFML4S.js → history-compact-HJQK67CZ.js} +2 -2
  69. package/dist/cli-bundle/chunks/{history-redact-WJN3HYXR.js → history-redact-PWC6PDWA.js} +2 -2
  70. package/dist/cli-bundle/chunks/{history-repair-XDNZUB7F.js → history-repair-N3CY4WBF.js} +2 -2
  71. package/dist/cli-bundle/chunks/{learnings-SZMUPVNA.js → learnings-4FH23XDT.js} +2 -2
  72. package/dist/cli-bundle/chunks/{profile-KL53JIAC.js → profile-5Y5XXH5N.js} +2 -2
  73. package/dist/cli-bundle/chunks/{register-list-query-QH7ONPKU.js → register-list-query-FJZCJ67O.js} +2 -2
  74. package/dist/cli-bundle/chunks/{register-mutation-OCRQNZK4.js → register-mutation-YGYPW3BL.js} +3 -3
  75. package/dist/cli-bundle/chunks/register-operations-WMDSUMQF.js +2 -0
  76. package/dist/cli-bundle/chunks/{register-setup-QWBQ6HBS.js → register-setup-DL7FFABC.js} +2 -2
  77. package/dist/cli-bundle/chunks/restore-6KYBV5BY.js +2 -0
  78. package/dist/cli-bundle/chunks/{schema-QJ27OTRV.js → schema-EQGKBYXJ.js} +2 -2
  79. package/dist/cli-bundle/chunks/update-QVTYOD6I.js +2 -0
  80. package/dist/cli-bundle/chunks/update-many-DJSBU525.js +2 -0
  81. package/dist/cli-bundle/focused-chunks/{chunk-MBBMTDD3.js → chunk-2ECLECMK.js} +3 -3
  82. package/dist/cli-bundle/focused-chunks/{chunk-CL3NB7VW.js → chunk-3K4XV2BF.js} +2 -2
  83. package/dist/cli-bundle/focused-chunks/{chunk-ME4XVOBJ.js → chunk-4EX25PXM.js} +2 -2
  84. package/dist/cli-bundle/focused-chunks/chunk-4VJQTS3P.js +2 -0
  85. package/dist/cli-bundle/focused-chunks/chunk-73JUDYXT.js +2 -0
  86. package/dist/cli-bundle/focused-chunks/{chunk-GSW2Y7VZ.js → chunk-CIXVQPB7.js} +2 -2
  87. package/dist/cli-bundle/focused-chunks/{chunk-7YTZ7A4E.js → chunk-DLTS3IHM.js} +2 -2
  88. package/dist/cli-bundle/focused-chunks/{chunk-YHDCGUIW.js → chunk-DQ6FKGL3.js} +10 -10
  89. package/dist/cli-bundle/focused-chunks/{chunk-YLPZHWX7.js → chunk-HNL6IFGS.js} +2 -2
  90. package/dist/cli-bundle/focused-chunks/chunk-JLG2C4EQ.js +2 -0
  91. package/dist/cli-bundle/focused-chunks/{chunk-6KDHXURF.js → chunk-MHMTKV5V.js} +2 -2
  92. package/dist/cli-bundle/focused-chunks/{chunk-GEYU23YS.js → chunk-MOTJFQ3F.js} +22 -22
  93. package/dist/cli-bundle/focused-chunks/{chunk-EYO4F74Z.js → chunk-NBJKQP4S.js} +2 -2
  94. package/dist/cli-bundle/focused-chunks/{chunk-XNVXIQ4B.js → chunk-QHRTT7WT.js} +2 -2
  95. package/dist/cli-bundle/focused-chunks/{chunk-27DK4A5O.js → chunk-R2LEMEV5.js} +2 -2
  96. package/dist/cli-bundle/focused-chunks/{chunk-4JC3AOGS.js → chunk-RPNYG5MO.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-EAXXF2HW.js → chunk-RW5IYD4J.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/{chunk-TQMFQYXR.js → chunk-TIKDBG4D.js} +16 -16
  99. package/dist/cli-bundle/focused-chunks/{chunk-N7QN3NE6.js → chunk-VZFU2R4M.js} +2 -2
  100. package/dist/cli-bundle/focused-chunks/{chunk-GIERI4YU.js → chunk-YZEZAPJK.js} +2 -2
  101. package/dist/cli-bundle/focused-chunks/chunk-ZJIMJHDB.js +2 -0
  102. package/dist/cli-bundle/main.js +2 -2
  103. package/dist/cli-bundle/sdk-authoring.js +1 -1
  104. package/dist/cli-bundle/sdk-contracts.js +1 -1
  105. package/dist/cli-bundle/sdk-core.js +29 -28
  106. package/dist/cli-bundle/sdk-governance.js +1 -1
  107. package/dist/cli-bundle/sdk-graph.js +1 -1
  108. package/dist/cli-bundle/sdk-merge.js +1 -1
  109. package/dist/cli-bundle/sdk-query.js +1 -1
  110. package/dist/cli-bundle/sdk-runtime.js +1 -1
  111. package/dist/cli-bundle/sdk-testing.js +1 -1
  112. package/dist/cli-bundle/sdk.js +1 -1
  113. package/dist/core/extensions/reserved-host-flags.js +3 -2
  114. package/dist/core/history/workspace-history.d.ts +22 -2
  115. package/dist/core/history/workspace-history.js +60 -36
  116. package/dist/core/output/output.d.ts +2 -0
  117. package/dist/core/output/output.js +3 -2
  118. package/dist/core/shared/command-types.d.ts +2 -0
  119. package/dist/core/shared/command-types.js +2 -2
  120. package/dist/mcp/tool-definitions.js +6 -2
  121. package/dist/sdk/author-attribution.js +23 -7
  122. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  123. package/dist/sdk/cli-bootstrap.js +7 -2
  124. package/dist/sdk/cli-contracts/completeness.js +51 -4
  125. package/dist/sdk/cli-contracts/flag-contracts.js +3 -2
  126. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  127. package/dist/sdk/cli-contracts/runtime-contracts.js +14 -8
  128. package/dist/sdk/cli-contracts/tool-parameter-tables.js +116 -10
  129. package/dist/sdk/cli-contracts/tool-schema.js +18 -2
  130. package/dist/sdk/cli-program.js +3 -2
  131. package/dist/sdk/completion.js +5 -2
  132. package/dist/sdk/contracts.d.ts +1 -0
  133. package/dist/sdk/contracts.js +2 -2
  134. package/dist/sdk/core.d.ts +3 -1
  135. package/dist/sdk/core.js +4 -3
  136. package/dist/sdk/extension.js +9 -11
  137. package/dist/sdk/generated-error-code-catalog.js +112 -2
  138. package/dist/sdk/history-analytics.d.ts +141 -0
  139. package/dist/sdk/history-analytics.js +283 -0
  140. package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
  141. package/dist/sdk/improvement-ledger-validation.js +63 -0
  142. package/dist/sdk/improvement-ledger.d.ts +139 -0
  143. package/dist/sdk/improvement-ledger.js +261 -0
  144. package/dist/sdk/index.d.ts +6 -2
  145. package/dist/sdk/index.js +8 -4
  146. package/dist/sdk/lifecycle/plan.js +6 -3
  147. package/dist/sdk/merge/install.js +10 -2
  148. package/dist/sdk/read-output-budget.js +24 -22
  149. package/dist/sdk/read-output-contracts.d.ts +10 -2
  150. package/dist/sdk/read-output-contracts.js +124 -65
  151. package/dist/sdk/read-output-rows.d.ts +29 -0
  152. package/dist/sdk/read-output-rows.js +100 -0
  153. package/dist/sdk/read-output-session.d.ts +69 -0
  154. package/dist/sdk/read-output-session.js +200 -0
  155. package/dist/sdk/runtime-input.d.ts +2 -0
  156. package/dist/sdk/runtime-input.js +14 -2
  157. package/dist/sdk/runtime-primitives.d.ts +1 -1
  158. package/dist/sdk/runtime-primitives.js +3 -3
  159. package/dist/sdk/runtime-stats-options.d.ts +9 -0
  160. package/dist/sdk/runtime-stats-options.js +38 -0
  161. package/dist/sdk/runtime.d.ts +1 -0
  162. package/dist/sdk/runtime.js +6 -27
  163. package/dist/sdk/stats.d.ts +40 -0
  164. package/dist/sdk/stats.js +112 -29
  165. package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
  166. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
  167. package/docs/README.md +1 -0
  168. package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
  169. package/marketplace.json +2 -2
  170. package/package.json +3 -3
  171. package/packages/pm-beads/package.json +1 -1
  172. package/packages/pm-calendar/package.json +1 -1
  173. package/packages/pm-command-kit/package.json +1 -1
  174. package/packages/pm-digital-twin/package.json +1 -1
  175. package/packages/pm-governance-audit/package.json +1 -1
  176. package/packages/pm-guide-shell/package.json +1 -1
  177. package/packages/pm-kanban/package.json +1 -1
  178. package/packages/pm-lifecycle-hooks/package.json +1 -1
  179. package/packages/pm-linked-test-adapters/package.json +1 -1
  180. package/packages/pm-search-advanced/package.json +1 -1
  181. package/packages/pm-templates/package.json +1 -1
  182. package/packages/pm-todos/package.json +1 -1
  183. package/packages/pm-vcs/package.json +1 -1
  184. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  185. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  186. package/sdk/public-surface.json +374 -821
  187. package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +0 -2
  188. package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +0 -8
  189. package/dist/cli-bundle/chunks/chunk-E7BFPLUZ.js +0 -5
  190. package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +0 -164
  191. package/dist/cli-bundle/chunks/chunk-SV3YQ4RY.js +0 -2
  192. package/dist/cli-bundle/chunks/chunk-V663653R.js +0 -20
  193. package/dist/cli-bundle/chunks/chunk-XPOQQJTX.js +0 -13
  194. package/dist/cli-bundle/chunks/chunk-YCCDXBNU.js +0 -2
  195. package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +0 -2
  196. package/dist/cli-bundle/chunks/close-DI66JMSB.js +0 -2
  197. package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +0 -2
  198. package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +0 -2
  199. package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +0 -2
  200. package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +0 -2
  201. package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +0 -2
  202. package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +0 -2
  203. package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +0 -2
  204. package/dist/cli-bundle/chunks/update-7GBO4SXG.js +0 -2
  205. package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +0 -2
  206. package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +0 -2
  207. package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +0 -2
  208. package/dist/cli-bundle/focused-chunks/chunk-LKQXXO62.js +0 -2
  209. package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +0 -2
@@ -1,13 +0,0 @@
1
- import{a as L,b as Nt,c as At,u as V}from"./chunk-3KFVGGRE.js";import{a as Ot,b as Fe,c as Mt,d as Ft}from"./chunk-L6LGKJX3.js";import{wa as Dt}from"./chunk-RUAU5OSH.js";import{v as It,w as $t}from"./chunk-MDTH7SAE.js";import{a as Tt}from"./chunk-M4VEE3FK.js";import{A as f,Ad as wt,Af as M,Bb as pt,C as m,Cc as yt,Da as de,If as fe,La as N,Md as kt,Nc as H,Oa as ue,Of as me,Pc as _t,R as O,Rd as bt,Sd as vt,T as b,Td as Ct,Ub as gt,V as G,Wd as St,ad as v,b as ae,bb as mt,bd as C,cd as Me,d as lt,lc as le,lf as xt,mf as Et,od as X,ra as W,wa as Oe,wc as ht,xa as ce,z as ft,zd as Y}from"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8b010e79-a73a-5760-ac05-8dc88484cd69")}catch{}})();var pe={version:1,aliases:{}};function Lt(e=[]){let t=new Set(X),n=r=>{/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(r)&&t.add(r)};for(let r of e){for(let o of Object.keys(r.provenance_environment_keys??{}))n(o);for(let o of Object.keys(r.provenance_resolvers??{}))n(o);for(let o of r.provenance_unavailable_dimensions??[])n(o)}return[...t].sort()}function Rt(e){if(e===void 0)return;let n=(typeof e=="string"?[e]:e).flatMap(r=>r.split(",")).map(r=>r.trim()).filter(r=>r.length>0);return n.length===0?void 0:new Set(n)}function Re(e,t){if(e.agent_harness?.trim())return{agent_harness:e.agent_harness,harness_source:"recorded"};let n=t.aliases[e.author];return n?{agent_harness:n,harness_source:"vocabulary"}:{harness_source:"unresolved"}}function Un(e,t=X){let n=new Set(t),r=new Map,o=e.provenance===void 0?[]:typeof e.provenance=="string"?[e.provenance]:e.provenance;for(let i of o.flatMap(s=>s.split(","))){let s=i.indexOf("=");if(s<0)throw new m(`Provenance predicate must use dimension=value; received "${i.trim()}".`,f.USAGE,{code:"invalid_provenance_predicate"});let a=i.slice(0,s).trim().toLowerCase(),d=i.slice(s+1).trim();if(!n.has(a))throw new m(`Unknown provenance dimension "${a||i.trim()}". Declared dimensions: ${[...n].sort().join(", ")}.`,f.USAGE,{code:"unknown_provenance_dimension"});if(d.length===0)throw new m(`Provenance predicate must use dimension=value; received "${i.trim()}".`,f.USAGE,{code:"invalid_provenance_predicate"});let c=r.get(a)??new Set;c.add(d),r.set(a,c)}return r}function Ut(e,t=pe,n={}){let r=Re(e,t);return{...n.itemId===void 0?{}:{item_id:n.itemId},...n.version===void 0?{}:{version:n.version},ts:e.ts,op:e.op,author:e.author,...e.author_source===void 0?{}:{author_source:e.author_source},...r,vocabulary_version:t.version,...e.agent_instance===void 0?{}:{agent_instance:e.agent_instance},agent_provenance:e.agent_provenance??{},...e.message===void 0?{}:{message:e.message}}}function Us(e,t,n=pe,r=X){return Le(t,n,r)(e)}function Le(e,t=pe,n=X){let r=Rt(e.harness),o=Rt(e.agentInstance),i=Un(e,n);return s=>{let d=Re(s,t).agent_harness;if(r&&(!d||!r.has(d))||o&&!o.has(s.agent_instance??""))return!1;for(let[c,u]of i){let l=s.agent_provenance?.[c];if(!l||!u.has(l.value))return!1}return!0}}function Pt(e,t=pe,n=X){let r=new Set(n),o=new Map,i=0;for(let s of e){for(let d of Object.keys(s.agent_provenance??{}))r.add(d);Re(s,t).agent_harness?i+=1:o.set(s.author,(o.get(s.author)??0)+1)}return{entries:e.length,vocabulary_version:t.version,harness:{resolved:i,unresolved:e.length-i,unresolved_authors:[...o].map(([s,a])=>({author:s,entries:a})).sort((s,a)=>a.entries-s.entries||s.author.localeCompare(a.author)).slice(0,20)},dimensions:[...r].sort().map(s=>{let a=0,d=0;for(let c of e){let u=c.agent_provenance?.[s];u===null?d+=1:u!==void 0&&(a+=1)}return{dimension:s,observed:a,unavailable:d,legacy_missing:e.length-a-d}})}}import Pn from"node:fs/promises";import Bt from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a7efa5e0-5610-51ca-8288-4f5410dbcf51")}catch{}})();var jn=20,Bn=5;function Ue(e,t){if(e===void 0)return;let n=e.trim();if(n.length===0)throw new m(`${t} must not be empty`,f.USAGE);return n}function jt(e,t,n){if(e===void 0)return;let r=e.trim();if(r.length===0)throw new m("Activity time bounds must not be empty",f.USAGE);let o=n==="--from"&&/^\d+[hdwm]$/iu.test(r)?`-${r}`:r;return G(o,new Date(t),n)}function zn(e,t,n){return!(e.ts.length===0&&(t||n)||t&&b(e.ts,t)<0||n&&b(e.ts,n)>=0)}function Gn(e,t){return t===void 0?e:e.slice(0,t)}function K(e,t=""){return typeof e=="string"?e:t}function Wn(e,t){return{...t,id:e,ts:K(t.ts),author:K(t.author,"unknown"),op:K(t.op,"unknown"),patch:Array.isArray(t.patch)?t.patch:[],before_hash:K(t.before_hash),after_hash:K(t.after_hash)}}function Hn(e){return[...e].sort((t,n)=>{let r=n.ts.localeCompare(t.ts);if(r!==0)return r;let o=t.id.localeCompare(n.id);return o!==0?o:t.op.localeCompare(n.op)})}async function Xn(e){try{return(await Pn.readdir(e)).filter(t=>t.endsWith(".jsonl")).sort((t,n)=>t.localeCompare(n))}catch(t){if(t.code==="ENOENT")return[];throw t}}function qn(e){let t=O(),n=jt(e.from,t,"--from"),r=jt(e.to,t,"--to");if(n&&r&&b(n,r)>=0)throw new m("Activity --from must be before --to",f.USAGE);let o=Tt(e.limit);if(e.unbounded===!0&&o!==void 0)throw new m("Activity --unbounded cannot be combined with --limit",f.USAGE);return{id:Ue(e.id,"Activity --id"),op:Ue(e.op,"Activity --op"),author:Ue(e.author,"Activity --author"),from:n,to:r,limit:e.unbounded===!0?void 0:o??(e.compact===!0?jn:Bn),limitSource:e.unbounded===!0||o!==void 0?"explicit":"default",harness:e.harness,agentInstance:e.agentInstance,provenance:e.provenanceFilter}}async function Yn(e){let t=N(process.cwd(),e.path);if(!await ae(ue(t)))throw new m(`Tracker is not initialized at ${t}. Run pm init first.`,f.NOT_FOUND);return{pmRoot:t,settings:await M(t)}}async function Vn(e){let t=de(e.settings,le()),n=await me(e.pmRoot,e.settings.item_format,t.type_to_folder,void 0,e.settings.schema);await xt({pmRoot:e.pmRoot,settings:e.settings,itemIds:n.map(o=>o.id),commandLabel:"activity"});let r=Bt.join(e.pmRoot,"history");return await ht({path:r,scope:"project"}),r}function Kn(e,t,n){return n.op&&e.op!==n.op||n.author&&e.author!==n.author?!1:zn(t,n.from,n.to)}async function Jn(e,t){let n=[];for(let r of await Xn(e)){let o=r.slice(0,-6);if(t.id&&o!==t.id)continue;let i=await wt(Bt.join(e,r),o);for(let s of i){let a=Wn(o,s);Kn(s,a,t)&&n.push(a)}}return n}function Zn(e){return e.map(t=>({id:t.id,op:t.op,ts:t.ts,author:t.author,...t.message?{msg:t.message}:{}}))}async function zt(e,t){let n=await Yn(t),r=qn(e),o=await Vn(n),i=Lt(n.settings.agent_identity.harness_signals),s=n.settings.agent_identity.identity_vocabulary,a=Le({harness:r.harness,agentInstance:r.agentInstance,provenance:r.provenance},s,i),d=Hn(await Jn(o,r)).filter(a),c=Gn(d,r.limit),u=e.compact===!0,l=u?Zn(c):void 0,p=e.provenance===!0?c.map(S=>Ut(S,s,{itemId:S.id})):void 0,g=d.length-c.length,w=e.provenance===!0?"provenance":u?"compact":"full";return{...{compact:{compact_activity:l},provenance:{provenance_activity:p},full:{activity:c}}[w],compact:u,projection:{mode:w,row_key:w==="compact"?"compact_activity":w==="provenance"?"provenance_activity":"activity"},omission_receipt:kt("activity",w),count:c.length,total_count:d.length,limit:r.limit??null,omitted_count:g,has_more:g>0,...e.provenanceSummary===!0?{provenance_summary:Pt(d,s,i)}:{},applied_bound:{kind:r.limit===void 0?"unbounded":"limit",source:r.limitSource,value:r.limit??null}}}import{encode as Qn}from"@toon-format/toon";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f1677c6e-872e-5c42-ae3d-f73f4ec73616")}catch{}})();var Pe=["agenda","day","week","month"],je=["markdown","toon","json"],er=["sun","mon","tue","wed","thu","fri","sat"],tr=365,nr=365,Ht=28,rr=1e3;function Be(e,t){if(e===void 0)return;let n=Number(e);if(!Number.isInteger(n)||n<0)throw new m(`${t} must be a non-negative integer`,f.USAGE);return n}function or(e){if(!e)return new Set(["deadlines","reminders","events"]);let t=e.trim().toLowerCase();if(t==="all")return new Set(["deadlines","reminders","events"]);let n=t.split(/[|,]/).map(o=>o.trim()).filter(o=>o.length>0);if(n.length===0)throw new m("Calendar include filter must not be empty",f.USAGE);let r=new Set;for(let o of n){if(o==="deadlines"||o==="deadline"){r.add("deadlines");continue}if(o==="reminders"||o==="reminder"){r.add("reminders");continue}if(o==="events"||o==="event"||o==="scheduled"){r.add("events");continue}throw new m("Calendar include filter must be deadlines|reminders|events|scheduled|all",f.USAGE)}return r}function Xt(e,t){let n;for(let r of t){let o=mt(e,r,2);o!==null&&(n===void 0||o<n.distance)&&(n={choice:r,distance:o})}return n?.choice}function ir(e){if(!e)return"agenda";let t=e.trim().toLowerCase();if(!Pe.includes(t)){let n=Xt(t,Pe);throw new m(`Calendar view must be one of ${Pe.join("|")}${n?`. Did you mean "${n}"?`:"."}`,f.USAGE)}return t}function sr(e){if(!e)return;let t=e.trim().toLowerCase();if(!je.includes(t)){let n=Xt(t,je);throw new m(`Calendar format must be one of ${je.join("|")}${n?`. Did you mean "${n}"?`:"."}`,f.USAGE)}return t}function Zs(e,t){let n=sr(e.format);if(t.json&&n&&n!=="json")throw new m("Cannot combine --json with --format markdown|toon",f.USAGE);return t.json?"json":n??"markdown"}function ar(e,t){if(e===void 0)return;let n=v(e,t);if(!n){let r=t.definitions.map(o=>o.id);throw new m(`Calendar status filter must be one of ${r.join("|")}`,f.USAGE)}return n}function cr(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!t)throw new m("Calendar assignee filter must be one of assigned|unassigned",f.USAGE);if(t!=="assigned"&&t!=="unassigned")throw new m(`Invalid calendar assignee filter "${e}". Allowed: assigned|unassigned`,f.USAGE);return t}function ge(e){return new Date(e).toISOString().slice(0,10)}function qt(e,t){if(!t||t==="UTC")return ge(e);try{let n=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(e)),r=n.find(s=>s.type==="year")?.value,o=n.find(s=>s.type==="month")?.value,i=n.find(s=>s.type==="day")?.value;if(r&&o&&i)return`${r}-${o}-${i}`}catch{}return ge(e)}function He(e){let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),0,0,0,0)).toISOString()}function A(e,t){let n=new Date(e);return new Date(n.getTime()+t*24*60*60*1e3).toISOString()}function Yt(e){let t=new Date(He(e)),n=t.getUTCDay(),r=n===0?-6:1-n;return A(t.toISOString(),r)}function dr(e){let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),1,0,0,0,0)).toISOString()}function ur(e){let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,1,0,0,0,0)).toISOString()}function lr(e,t){return b(e,t)>=0?e:t}function Gt(e){return Object.fromEntries([...e.entries()].sort(([t],[n])=>t.localeCompare(n)))}function Wt(e,t){e.set(t,(e.get(t)??0)+1)}function fr(e){if(!e)return null;let t=[`freq=${e.freq}`];if(e.interval!==void 0&&t.push(`interval=${e.interval}`),e.count!==void 0&&t.push(`count=${e.count}`),e.until&&t.push(`until=${e.until}`),e.by_weekday&&e.by_weekday.length>0){let n=[...e.by_weekday].sort((r,o)=>W(r)-W(o));t.push(`by_weekday=${n.join("|")}`)}if(e.by_month_day&&e.by_month_day.length>0){let n=[...e.by_month_day].sort((r,o)=>r-o);t.push(`by_month_day=${n.join("|")}`)}if(e.exdates&&e.exdates.length>0){let n=[...e.exdates].sort((r,o)=>r.localeCompare(o));t.push(`exdates=${n.join("|")}`)}return t.join(",")}function Vt(e,t,n,r){let o=new Date(Date.UTC(e,t,n,r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()));if(!(o.getUTCFullYear()!==e||o.getUTCMonth()!==t||o.getUTCDate()!==n))return o.toISOString()}function Kt(e){return er[new Date(e).getUTCDay()]}function mr(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():null}function pr(e){let t=new Set;for(let n of e??[]){let r=mr(n);r&&t.add(r)}return t}function gr(e,t,n,r,o){let i=e??A(n,-(r??nr)),s=t??A(e??n,o??tr);return{start:i,end:b(s,i)>0?s:A(i,1)}}function hr(e,t,n,r){let o=t.by_weekday!==void 0?[...t.by_weekday]:[Kt(e)],i=t.by_month_day!==void 0?[...t.by_month_day]:[new Date(e).getUTCDate()];return{startAt:e,startDate:new Date(e),window:n,maxOccurrences:r??rr,interval:t.interval??1,countLimit:t.count??Number.POSITIVE_INFINITY,until:t.until,excluded:pr(t.exdates),weekdayFilter:t.by_weekday!==void 0?new Set(t.by_weekday):void 0,monthDayFilter:t.by_month_day!==void 0?new Set(t.by_month_day):void 0,sortedWeekdays:[...new Set(o)].sort((s,a)=>W(s)-W(a)),sortedMonthDays:[...new Set(i)].sort((s,a)=>s-a),occurrences:[],produced:0}}function he(e,t){return b(t,e.startAt)<0?"continue":e.until&&b(t,e.until)>0||b(t,e.window.end)>=0?"stop":e.excluded.has(t)?"continue":(e.produced+=1,b(t,e.window.start)>=0&&e.occurrences.push(t),e.produced>=e.countLimit||e.occurrences.length>=e.maxOccurrences?"stop":"continue")}function ye(e,t){let n=Kt(t),r=new Date(t).getUTCDate(),o=!e.weekdayFilter||e.weekdayFilter.has(n),i=!e.monthDayFilter||e.monthDayFilter.has(r);return o&&i}function yr(e){let t=e.startAt;for(let n=0;n<e.maxOccurrences&&!(ye(e,t)&&he(e,t)==="stop");n+=1)t=A(t,e.interval);return e.occurrences}function _r(e,t,n){let r=W(n),o=A(t,r),i=new Date(o);return new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),e.startDate.getUTCHours(),e.startDate.getUTCMinutes(),e.startDate.getUTCSeconds(),e.startDate.getUTCMilliseconds())).toISOString()}function wr(e){let t=Yt(e.startAt);for(let n=0;n<e.maxOccurrences;n+=1){let r=A(t,n*e.interval*7);for(let o of e.sortedWeekdays){let i=_r(e,r,o);if(ye(e,i)&&he(e,i)==="stop")return e.occurrences}}return e.occurrences}function kr(e){let t=e.startDate.getUTCFullYear(),n=e.startDate.getUTCMonth();for(let r=0;r<e.maxOccurrences;r+=1){let o=new Date(Date.UTC(t,n+r*e.interval,1,0,0,0,0));for(let i of e.sortedMonthDays){let s=Vt(o.getUTCFullYear(),o.getUTCMonth(),i,e.startDate);if(!(!s||!ye(e,s))&&he(e,s)==="stop")return e.occurrences}}return e.occurrences}function br(e){let t=e.startDate.getUTCFullYear(),n=e.startDate.getUTCMonth();for(let r=0;r<e.maxOccurrences;r+=1){let o=t+r*e.interval;for(let i of e.sortedMonthDays){let s=Vt(o,n,i,e.startDate);if(!(!s||!ye(e,s))&&he(e,s)==="stop")return e.occurrences}}return e.occurrences}function vr(e,t,n,r){let o=hr(e,t,n,r);return t.freq==="daily"?yr(o):t.freq==="weekly"?wr(o):t.freq==="monthly"?kr(o):br(o)}function Jt(e){return[...e].sort((t,n)=>{let r=b(t.at,n.at);if(r!==0)return r;let o=t.item_priority-n.item_priority;if(o!==0)return o;let i=t.item_id.localeCompare(n.item_id);if(i!==0)return i;let s=t.kind.localeCompare(n.kind);if(s!==0)return s;let a=String(t.event_title).localeCompare(String(n.event_title));return a!==0?a:String(t.reminder_text).localeCompare(String(n.reminder_text))})}function Xe(e){return{item_id:e.id,item_title:e.title,item_type:e.type,item_status:e.status,item_priority:e.priority,item_assignee:e.assignee??null,item_deadline:e.deadline??null,item_tags:e.tags}}function Cr(e){return e.deadline?{at:e.deadline,date:ge(e.deadline),kind:"deadline",reminder_text:null,event_title:null,event_end:null,event_location:null,event_all_day:null,event_timezone:null,event_recurring:null,event_recurrence_rule:null,...Xe(e),item_deadline:e.deadline}:null}function Sr(e){return(e.reminders??[]).map(t=>({at:t.at,date:ge(t.at),kind:"reminder",reminder_text:t.text,event_title:null,event_end:null,event_location:null,event_all_day:null,event_timezone:null,event_recurring:null,event_recurrence_rule:null,...Xe(e)}))}function xr(e,t){if(!t)return null;let n=Date.parse(t)-Date.parse(e);return Number.isFinite(n)&&n>0?n:null}function Er(e,t,n){return t.recurrence&&n!==null?new Date(new Date(e).getTime()+n).toISOString():t.end_at??null}function Tr(e,t,n,r){let o=fr(t.recurrence),i=xr(t.start_at,t.end_at);return(t.recurrence?vr(t.start_at,t.recurrence,n,r):[t.start_at]).map(a=>({at:a,date:t.all_day===!0?a.slice(0,10):qt(a,t.timezone),kind:"event",reminder_text:t.description??null,event_title:t.title??e.title,event_end:Er(a,t,i),event_location:t.location??null,event_all_day:t.all_day??null,event_timezone:t.timezone??null,event_recurring:!!t.recurrence,event_recurrence_rule:o,...Xe(e)}))}function Ir(e,t,n,r){let o=[];for(let i of e){let s=n.has("deadlines")?Cr(i):null;s&&o.push(s),n.has("reminders")&&o.push(...Sr(i));for(let a of n.has("events")?i.events??[]:[])o.push(...Tr(i,a,t,r))}return Jt(o)}function $r(e,t,n,r,o){let i=At(t.type,n),s=t.tag?.trim().toLowerCase(),a=Nt(t.priority),d=ar(t.status,r),c=t.assignee?.trim(),u=cr(t.assigneeFilter),l=t.sprint?.trim(),p=t.release?.trim();if(c&&(c.toLowerCase()==="none"||c.toLowerCase()==="null"))throw new m('--assignee no longer accepts "none" or "null". Use --assignee-filter unassigned.',f.USAGE);if(c!==void 0&&u==="unassigned")throw new m("Cannot combine --assignee with --assignee-filter unassigned",f.USAGE);return e.filter(g=>Dr(g,{typeFilter:i,tagFilter:s,priorityFilter:a,statusFilter:d,assigneeFilter:c,assigneeModeFilter:u,sprintFilter:l,releaseFilter:p,runtimeFieldFilters:o}))}function Dr(e,t){return Nr(e,t)&&Ar(e,t)&&$t(e,t.runtimeFieldFilters)}function Nr(e,t){return!(t.typeFilter&&e.type!==t.typeFilter||t.tagFilter&&!e.tags.some(n=>n.trim().toLowerCase()===t.tagFilter)||t.priorityFilter!==void 0&&e.priority!==t.priorityFilter||t.statusFilter&&e.status!==t.statusFilter)}function Ar(e,t){return!(t.assigneeModeFilter==="assigned"&&!e.assignee||t.assigneeModeFilter==="unassigned"&&e.assignee||t.assigneeFilter!==void 0&&e.assignee!==t.assigneeFilter||t.sprintFilter!==void 0&&e.sprint!==t.sprintFilter||t.releaseFilter!==void 0&&e.release!==t.releaseFilter)}function Or(e,t,n){return!(t&&b(e.at,t)<0||n&&b(e.at,n)>=0)}function ze(e,t,n){return e.trim().toLowerCase()==="today"?He(t):G(e,new Date(t),n)}function Mr(e,t,n){let r=t.date?ze(t.date,n,"--date"):n,o=t.past===!0,i=t.fullPeriod===!0,s=t.from?ze(t.from,n,"--from"):void 0,a=t.to?ze(t.to,n,"--to"):void 0;if(s&&a&&b(s,a)>=0)throw new m("Calendar --from must be before --to",f.USAGE);if(e!=="agenda"&&(t.from!==void 0||t.to!==void 0))throw new m("--from and --to are only supported for --view agenda",f.USAGE);if(e==="agenda")return Fr(r,t,n,o,i,s,a);if(e==="day"){let c=He(r);return Ge(r,n,o,i,c,A(c,1))}if(e==="week"){let c=Yt(r);return Ge(r,n,o,i,c,A(c,7))}let d=dr(r);return Ge(r,n,o,i,d,ur(r))}function Fr(e,t,n,r,o,i,s){if(o)throw new m("--full-period is only supported for --view day|week|month. For agenda windows, use --from and --to.",f.USAGE);return{anchor:e,start:i??(t.date?e:r?void 0:n),end:s,fullPeriod:!1}}function Ge(e,t,n,r,o,i){let s=n||r;return{anchor:e,start:s?o:lr(o,t),end:i,periodStart:o,periodEnd:i,fullPeriod:s}}function Rr(e){let t=new Map;for(let n of e){let r=t.get(n.date)??[];r.push(n),t.set(n.date,r)}return[...t.entries()].sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>({date:n,count:r.length,events:Jt(r)}))}function Lr(e){let t=new Set,n=new Map,r=new Map,o=0,i=0,s=0,a=0;for(let d of e)t.add(d.item_id),Wt(n,d.item_type),Wt(r,d.item_status),d.kind==="deadline"?o+=1:d.kind==="reminder"?i+=1:(s+=1,d.event_recurring===!0&&(a+=1));return{events:e.length,items:t.size,deadlines:o,reminders:i,scheduled:s,by_kind:{deadline:o,reminder:i,event:s},by_type:Gt(n),by_status:Gt(r),recurring_events:a}}function Ur(e){let t=e.start??"unbounded",n=e.end??"unbounded";return`${t} -> ${n}`}function Zt(e,t){if(t&&t!=="UTC")try{let n=new Intl.DateTimeFormat("en-GB",{timeZone:t,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(new Date(e)),r=n.find(i=>i.type==="hour")?.value,o=n.find(i=>i.type==="minute")?.value;if(r&&o)return`${r}:${o}`}catch{}return`${new Date(e).toISOString().slice(11,16)}Z`}function We(e){let t=Object.entries(e);return t.length===0?"empty":t.map(([n,r])=>`${n}=${r}`).join(", ")}function Pr(e){return e.event_end?e.event_all_day===!0?e.event_end.slice(0,10):e.date===qt(e.event_end,e.event_timezone)?Zt(e.event_end,e.event_timezone):e.event_end:null}function jr(e){let t=`${Zt(e.at,e.event_timezone)} [${e.kind}] ${e.item_id} type=${e.item_type} p${e.item_priority} ${e.item_status} ${e.item_title}`;if(e.kind==="reminder"){let n=e.reminder_text??"";return`${t} \u2014 ${n} reminder=${JSON.stringify(n)}`}if(e.kind==="event"){let n=[],r=e.event_title??e.item_title;e.event_title!==null&&e.event_title!==e.item_title&&(n.push(r),n.push(`title=${JSON.stringify(r)}`)),e.event_recurring&&(n.push("(recurring)"),n.push("recurring=true"));let i=Pr(e);return i&&n.push(`end=${i}`),e.event_all_day!==null&&n.push(`all_day=${e.event_all_day?"true":"false"}`),e.event_timezone&&n.push(`timezone=${e.event_timezone}`),e.event_location&&(n.push(`@ ${e.event_location}`),n.push(`location=${JSON.stringify(e.event_location)}`)),e.event_recurrence_rule&&n.push(`recurrence=${e.event_recurrence_rule}`),e.reminder_text&&n.push(`description=${JSON.stringify(e.reminder_text)}`),`${t} \u2014 ${n.join(" ")}`}return t}function Qs(e){let t=[];if(t.push(`# pm calendar (${e.view})`),t.push(""),t.push(`- now: ${e.now}`),t.push(`- window: ${Ur(e.range)}`),e.range.period_start&&e.range.period_end&&(t.push(`- period: ${e.range.period_start} -> ${e.range.period_end}`),t.push(`- period-mode: ${e.range.full_period?"full-period":"active-window"}`)),t.push(`- events: ${e.summary.events} (deadlines: ${e.summary.deadlines}, reminders: ${e.summary.reminders}, scheduled: ${e.summary.scheduled})`),t.push(`- items: ${e.summary.items}`),t.push(`- by-kind: ${We(e.summary.by_kind)}`),t.push(`- by-type: ${We(e.summary.by_type)}`),t.push(`- by-status: ${We(e.summary.by_status)}`),t.push(`- recurring-events: ${e.summary.recurring_events}`),t.push(""),e.events.length===0)return t.push("No calendar events matched the selected filters."),t.join(`
2
- `);for(let n of e.days){t.push(`## ${n.date} (${n.count})`);for(let r of n.events)t.push(`- ${jr(r)}`);t.push("")}if(e.warnings&&e.warnings.length>0){t.push("### warnings");for(let n of e.warnings)t.push(`- ${n}`);t.push("")}return Br(t.join(`
3
- `))}function ea(e){return Qn(e)}function Br(e){let t=e.length;for(;t>0&&e[t-1]===`
4
- `;)t-=1;return e.slice(0,t)}function zr(e){let t=O(),n=ir(e.view),r=Mr(n,e,t),o=L(e.limit),i=or(e.include),s=Be(e.recurrenceLookaheadDays,"Calendar recurrence lookahead days"),a=Be(e.recurrenceLookbackDays,"Calendar recurrence lookback days"),d=Be(e.occurrenceLimit,"Calendar occurrence limit");if(d!==void 0&&d<1)throw new m("Calendar occurrence limit must be >= 1",f.USAGE);let c=i.has("events")&&!i.has("deadlines")&&!i.has("reminders"),u=e.to!==void 0||s!==void 0||a!==void 0||d!==void 0,l=c&&!u;return{nowValue:t,view:n,rangeBounds:r,limit:o,includeSources:i,occurrenceLimit:d,recurrenceLookaheadDays:l?Ht:s,recurrenceLookbackWindowDays:l&&a===void 0?0:a,eventsOnlyCapApplied:l}}function Gr(e,t){t&&e.push(`recurring_events_default_cap_applied:lookback=0d,lookahead=${Ht}d -- use --recurrence-lookback-days/--recurrence-lookahead-days or --to for wider range`)}function Wr(e,t){return{type:e.type??null,tag:e.tag??null,priority:e.priority??null,status:e.status??null,assignee:e.assignee??null,assignee_filter:e.assigneeFilter??null,sprint:e.sprint??null,release:e.release??null,runtime_filters:t,limit:e.limit??null,include:e.include??null,full_period:e.fullPeriod===!0?"true":null,recurrence_lookahead_days:e.recurrenceLookaheadDays??null,recurrence_lookback_days:e.recurrenceLookbackDays??null,occurrence_limit:e.occurrenceLimit??null}}function Hr(e,t){return{start:t.start??null,end:t.end??null,period_start:t.periodStart??null,period_end:t.periodEnd??null,full_period:t.fullPeriod,past:e.past===!0,from:e.from??null,to:e.to??null}}async function Qt(e,t){let n=N(process.cwd(),t.path);if(!await ae(ue(n)))throw new m(`Tracker is not initialized at ${n}. Run pm init first.`,f.NOT_FOUND);let r=zr(e),o=await M(n),i=H(o.schema),s=_t(o.schema),a=It(e,s,"calendar"),d=de(o,le()),c=[];Gr(c,r.eventsOnlyCapApplied);let u=await me(n,o.item_format,d.type_to_folder,c,o.schema),l=$r(u,e,d,i,a),p=gr(r.rangeBounds.start,r.rangeBounds.end,r.nowValue,r.recurrenceLookbackWindowDays,r.recurrenceLookaheadDays),w=Ir(l,p,r.includeSources,r.occurrenceLimit).filter(k=>Or(k,r.rangeBounds.start,r.rangeBounds.end)),h=r.limit===void 0?w:w.slice(0,r.limit),S=Rr(h),_=[...new Set(c)].sort((k,x)=>k.localeCompare(x));return{view:r.view,output_default:"markdown",now:r.nowValue,anchor:r.rangeBounds.anchor,range:Hr(e,r.rangeBounds),filters:Wr(e,a),summary:Lr(h),events:h,days:S,..._.length>0?{warnings:_}:{}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1f898377-b606-5bfd-932d-6ce5f2f9c717")}catch{}})();var qe=["structural","recency","activity_density","graph_proximity","claim_focus","priority_pressure","risk_pressure","deadline_pressure","knowledge_density","author_affinity","usage_affinity","semantic_similarity"],Xr=Symbol("no-context-author"),qr=Symbol("no-item-assignee");function en(e,t){if(typeof e!="string")return t;let n=e.trim().toLowerCase();return n.length>0?n:t}function Yr(e,t){let n=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(n)?1-Math.min(Math.max(n,0),t)/t:0}function Vr(e,t){let n=typeof e=="string"?Date.parse(e):e instanceof Date?e.getTime():typeof e=="number"?e:Number.NaN;if(!Number.isFinite(n)||!Number.isFinite(t))return 0;let r=(n-t)/864e5;return r<=0?1:1/(1+r/30)}function Kr(e){let t=typeof e=="string"?e.trim().toLowerCase():void 0;return t==="critical"||t==="high"?1:t==="medium"?.5:t==="low"?.1:0}function _e(e,t,n){return e?.[t]??n}function we(e,t){let n=c=>{if(typeof c!="string")return"";try{return G(c,new Date(Number.NaN),"updated_at")}catch{return""}},r=[...e].sort((c,u)=>{let l=n(c.updated_at),p=n(u.updated_at);return b(p,l)||c.id.localeCompare(u.id)}),o=new Map(r.map((c,u)=>[c.id,u])),i=Math.max(e.length-1,1),s=en(t.author,Xr),a=v("in_progress",t.statusRegistry),d=Date.parse(t.now);return e.map(c=>{let u=en(c.assignee,qr)===s,l=(c.comments?.length??0)+(c.notes?.length??0)+(c.learnings?.length??0);return{id:c.id,item:c,signals:{recency:e.length===1?1:1-o.get(c.id)/i,activity_density:t.activityDensity?.[c.id],graph_proximity:_e(t.graphProximity,c.id,c.parent?.3:0),claim_focus:_e(t.claimFocus,c.id,C(c.status,t.statusRegistry)===a?1:u?.75:0),priority_pressure:Yr(c.priority,4),risk_pressure:Kr(c.risk),deadline_pressure:Vr(c.deadline,d),knowledge_density:_e(t.knowledgeDensity,c.id,Math.min(l/5,1)),author_affinity:_e(t.authorAffinity,c.id,u?1:0),usage_affinity:t.usageAffinity?.[c.id],semantic_similarity:t.semanticSimilarity?.[c.id]}}})}var Jr="context_relevance",Zr={structural:.4,recency:.35,activity_density:.25,graph_proximity:.15,claim_focus:.6,priority_pressure:.35,risk_pressure:.2,deadline_pressure:.45,knowledge_density:.25,author_affinity:.2,usage_affinity:.3,semantic_similarity:.5},Qr=new TextEncoder;function eo(e){let t=new Set;for(let n of e){if(typeof n.id!="string"||n.id.trim().length===0||t.has(n.id))throw new TypeError("Context relevance candidates require unique non-empty ids");t.add(n.id);for(let[r,o]of Object.entries(n.signals??{})){if(r==="structural"||!qe.includes(r))throw new TypeError(`Unknown context relevance signal: ${r}`);if(o!==void 0&&(!Number.isFinite(o)||o<0||o>1))throw new TypeError(`Context relevance signal ${r} must be a finite number from 0 to 1`)}}}function to(e){let t={...Zr};for(let[n,r]of Object.entries(e??{}))r!==void 0&&qe.includes(n)&&(t[n]=r);for(let[n,r]of Object.entries(t))if(!Number.isFinite(r)||r<0)throw new TypeError(`Context relevance weight ${n} must be a finite non-negative number`);return t}function nn(e,t={}){eo(e);let n=to(t.weights),r=Math.max(e.length-1,1),o=new Set(["structural"]);for(let a of e)for(let[d,c]of Object.entries(a.signals??{}))c!==void 0&&o.add(d);let i=qe.filter(a=>o.has(a)),s=e.map((a,d)=>{let c={structural:e.length===1?1:1-d/r,...a.signals},u={},l=0,p=0;for(let g of i){let w=c[g];if(w===void 0)continue;let h=w*n[g];u[g]=h,l+=h,p+=n[g]}return{...a,baseline_rank:d+1,rank:0,score:p===0?0:l/p,contributions:u}});return s.sort((a,d)=>d.score-a.score||a.baseline_rank-d.baseline_rank),s.forEach((a,d)=>{a.rank=d+1}),{model:"default-weighted-v1",available_signals:i,ranked:s}}async function no(e,t={}){let n=nn(e,t);if(!t.scorer)return n;let r=await t.scorer({candidates:e,default_report:n}),o=new Map;for(let s of r){if(o.has(s.id)||!Number.isFinite(s.score))throw new TypeError("Context relevance scorer must return one finite score for every candidate");o.set(s.id,s.score)}if(o.size!==e.length||e.some(s=>!o.has(s.id)))throw new TypeError("Context relevance scorer must return one finite score for every candidate");let i=n.ranked.map(s=>{let a=o.get(s.id);return{...s,score:a,contributions:{custom:a}}});return i.sort((s,a)=>a.score-s.score||s.baseline_rank-a.baseline_rank),i.forEach((s,a)=>{s.rank=a+1}),{model:"custom",available_signals:n.available_signals,ranked:i}}async function ke(e,t,n={}){let r=nn(t,n),o=await yt(Jr,{surface:e,candidates:t,default_report:r});if(!o.handled)return o.warnings.length>0?{...r,warnings:o.warnings}:r;if(!Array.isArray(o.result)||!o.result.every(i=>typeof i=="object"&&i!==null&&typeof i.id=="string"&&typeof i.score=="number"&&Number.isFinite(i.score)))return{...r,warnings:[...o.warnings,"extension_context_relevance_invalid_result"]};try{let i=await no(t,{...n,scorer:()=>o.result});return o.warnings.length>0?{...i,warnings:o.warnings}:i}catch{return{...r,warnings:[...o.warnings,"extension_context_relevance_invalid_result"]}}}var ro=["ndcg","reciprocal_rank","required_recall","continuity_coverage","token_budget_adherence"];function tn(e,t){return e.length===0?1:e.filter(n=>t.has(n)).length/e.length}function oo(e){if(!Number.isFinite(e.actual_tokens)||e.actual_tokens<0||!Number.isFinite(e.token_budget)||e.token_budget<=0)throw new TypeError("Context ranking token counts require actual_tokens >= 0 and token_budget > 0");let t=e.judgments??{},n=e.ranked_ids.map(c=>Math.max(0,t[c]??0)),r=Object.values(t).map(c=>Math.max(0,c)).sort((c,u)=>u-c).slice(0,n.length||1),o=c=>c.reduce((u,l,p)=>u+(2**l-1)/Math.log2(p+2),0),i=o(r),s=n.findIndex(c=>c>0),a=new Set(e.ranked_ids),d=e.actual_tokens<=e.token_budget;return{ndcg:i===0?1:o(n)/i,reciprocal_rank:s<0?0:1/(s+1),required_recall:tn(e.required_ids??[],a),continuity_coverage:tn(e.continuity_ids??[],a),token_budget_adherence:d?1:e.token_budget/e.actual_tokens,within_token_budget:d}}function io(e){return Math.ceil(Qr.encode(JSON.stringify(e)).byteLength/4)}function so(e){return Math.round(e*1e4)/1e4}function ao(e,t){let n=t==="context"?[...e.high_level??[],...e.low_level??[],...e.blocked_fallback??[]].map(i=>i.id):[...e.recommended?[e.recommended]:[],...e.ready??[]].map(i=>i.id),r=new Set(n),o=(e.ranking?.items??[]).filter(i=>r.has(i.id)).map(i=>({id:i.id,contributions:i.contributions}));return{rankedIds:n,attribution:o}}async function co(e,t){if(e.id.trim().length===0||e.rationale.trim().length===0)throw new TypeError("Context evaluation scenarios require non-empty id and rationale values");let n=e.surface==="context"?await t.context({...e.options,explainRanking:!0}):await t.next({...e.options,explainRanking:!0}),{rankedIds:r,attribution:o}=ao(n,e.surface),i={...n,ranking:void 0},s=io(i);return{id:e.id,surface:e.surface,rationale:e.rationale,ranked_ids:r,actual_tokens:s,metrics:oo({ranked_ids:r,judgments:e.judgments,required_ids:e.required_ids,continuity_ids:e.continuity_ids,actual_tokens:s,token_budget:e.token_budget}),attribution:o}}function uo(e,t){if(e.length===0)throw new TypeError("Context evaluation requires at least one scenario report");let n=ro;for(let i of n)if(!Number.isFinite(t[i]))throw new TypeError(`Context evaluation threshold ${i} must be a finite number`);let r=Object.fromEntries(n.map(i=>[i,so(e.reduce((s,a)=>s+a.metrics[i],0)/e.length)])),o=n.filter(i=>r[i]<t[i]).map(i=>`${i}:${r[i]}<${t[i]}`);return{scenario_count:e.length,aggregate:r,scenarios:[...e],passed:o.length===0,failures:o}}async function ia(e,t,n){let r=[];for(let o of e)r.push(await co(o,t));return uo(r,n)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b5c90a16-c075-5dc6-a326-ad2da7a6ef6d")}catch{}})();var lo={balanced:{redundancyPenalty:.35,uncertaintyPenalty:.2},context:{redundancyPenalty:.45,uncertaintyPenalty:.15},next:{redundancyPenalty:.25,uncertaintyPenalty:.3}},fo=["identity","summary","full"];function mo(e){if(!e.id.trim()||!Number.isInteger(e.rank)||e.rank<1)throw new TypeError("Context packing candidates require a non-empty id and positive integer rank");if(!Number.isFinite(e.score)||e.score<0)throw new TypeError("Context packing candidate scores must be finite and non-negative");let t=fo.map(n=>e.token_costs[n]);if(t.some(n=>!Number.isInteger(n)||n<1)||t[0]>t[1]||t[1]>t[2])throw new TypeError("Context projection costs must be positive monotone integers");if(e.uncertainty!==void 0&&(!Number.isFinite(e.uncertainty)||e.uncertainty<0))throw new TypeError("Context packing uncertainty must be finite and non-negative")}function po(e){if(!Number.isInteger(e.tokenBudget)||e.tokenBudget<1)throw new TypeError("Context packing tokenBudget must be a positive integer");let t=e.profile??"balanced",n=lo[t];if(!n)throw new TypeError("Unknown context packing profile");let r=e.redundancyPenalty??n.redundancyPenalty,o=e.uncertaintyPenalty??n.uncertaintyPenalty;if(!Number.isFinite(r)||r<0||r>1||!Number.isFinite(o)||o<0)throw new TypeError("Context packing penalties must be finite and within their supported ranges");if(e.latencyBudgetMs!==void 0&&(!Number.isFinite(e.latencyBudgetMs)||e.latencyBudgetMs<=0))throw new TypeError("Context packing latencyBudgetMs must be positive");return{redundancy:r,uncertainty:o,profile:t}}function go(e){let t=new Set;for(let n of e){if(mo(n),t.has(n.id))throw new TypeError("Context packing candidates require unique ids");t.add(n.id)}return[...e].sort((n,r)=>n.rank-r.rank||n.id.localeCompare(r.id))}function ho(e,t,n,r,o){let i=-1,s=0;for(let a=0;a<e.length;a+=1){if(a%128===0&&o()>=r)return{index:i,evaluated:s,timedOut:!0};let d=e[a];if(d.token_costs.identity>t)continue;s+=1;let c=i<0?void 0:e[i],u=n(d)/d.token_costs.identity,l=c===void 0?Number.NEGATIVE_INFINITY:n(c)/c.token_costs.identity;(u>l||u===l&&c!==void 0&&(d.rank<c.rank||d.rank===c.rank&&d.id.localeCompare(c.id)<0))&&(i=a)}return{index:i,evaluated:s,timedOut:!1}}function yo(e){let t=new Set,n=[],r=e.tokenBudget,o=c=>{let u=c.lineage??c.cluster,l=u&&t.has(u)?1-e.redundancyPenalty:1;return Math.max(0,(c.score-e.uncertaintyPenalty*(c.uncertainty??0))*l)},i=c=>{let u=c.token_costs.identity;n.push({...c,projection:"identity",tokens:u,marginal_value:o(c)}),r-=u;let l=c.lineage??c.cluster;l&&t.add(l)};for(let c of e.ordered.filter(u=>u.required))c.token_costs.identity<=r&&i(c);let s=e.ordered.filter(c=>!c.required),a=!0,d=0;for(;s.length>0;){let c=ho(s,r,o,e.deadline,e.readClock);if(d+=c.evaluated,c.timedOut&&(a=!1),c.index<0||c.timedOut)break;i(s.splice(c.index,1)[0])}return{included:n,remaining:r,selectionComplete:a,evaluatedCandidates:d}}function _o(e,t){let n=t;for(let r of["summary","full"]){let o=r==="summary"?"identity":"summary",i=[...e].sort((s,a)=>{let d=s.token_costs[r]-s.token_costs[o],c=a.token_costs[r]-a.token_costs[o];return a.marginal_value/Math.max(c,1)-s.marginal_value/Math.max(d,1)||s.rank-a.rank||s.id.localeCompare(a.id)});for(let s of i){if(s.projection!==o)continue;let a=s.token_costs[r]-s.tokens;a>n||(s.projection=r,s.tokens+=a,n-=a)}}return n}function rn(e,t){let n=po(t),r=go(e),o=t.readClock??performance.now.bind(performance),i=t.latencyBudgetMs===void 0?Number.POSITIVE_INFINITY:o()+t.latencyBudgetMs,s=yo({ordered:r,tokenBudget:t.tokenBudget,redundancyPenalty:n.redundancy,uncertaintyPenalty:n.uncertainty,deadline:i,readClock:o}),{included:a}=s,d=_o(a,s.remaining);a.sort((u,l)=>u.rank-l.rank||u.id.localeCompare(l.id));let c=new Set(a.map(u=>u.id));return{included:a,omitted_ids:r.filter(u=>!c.has(u.id)).map(u=>u.id),token_budget:t.tokenBudget,used_tokens:t.tokenBudget-d,remaining_tokens:d,complete:s.selectionComplete&&a.length===e.length&&a.every(u=>u.projection==="full"),selection_complete:s.selectionComplete,termination_reason:s.selectionComplete?"exhausted":"latency_budget",evaluated_candidates:s.evaluatedCandidates,latency_budget_ms:t.latencyBudgetMs??null,profile:n.profile,degradation_ladder:["full","summary","identity"]}}import{randomUUID as wo}from"node:crypto";import{appendFile as ko,mkdir as bo,readFile as vo,rename as Co,stat as So,writeFile as xo}from"node:fs/promises";import on from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5f4ccd28-a001-54aa-8378-893025c69b96")}catch{}})();var sn=2048,an=30,cn=864e5,Eo=262144,To="context-usage-ledger",I=class extends TypeError{code="context_usage_validation_failed";constructor(t){super(t),this.name="ContextUsageValidationError"}};function dn(e){return on.join(e,"runtime","context-usage.jsonl")}function J(e){let t=e.now??new Date().toISOString(),n=Date.parse(t);if(!Number.isFinite(n))throw new I("Context usage now must be a valid timestamp");return{iso:new Date(n).toISOString(),ms:n}}async function un(e){try{let n=(await vo(dn(e.pmRoot),"utf8")).split(`
5
- `).filter(Boolean).flatMap(s=>{try{return[JSON.parse(s)]}catch{return[]}}),r=e.maxEvents??sn,o=e.retentionDays??an,i=J(e).ms-o*cn;return n.filter(s=>Date.parse(s.at)>=i).slice(-r)}catch{return[]}}async function ln(e,t){let n=e.maxEvents??sn,r=e.retentionDays??an;if(!Number.isInteger(n)||n<1||!Number.isFinite(r)||r<=0)throw new I("Context usage retention requires positive maxEvents and retentionDays");let o=dn(e.pmRoot),i=on.dirname(o),s=await Et(e.pmRoot,To,30,`context-usage:${process.pid}`,!1,!1,3e3);try{if(await bo(i,{recursive:!0}),await ko(o,t.map(u=>`${JSON.stringify(u)}
6
- `).join(""),"utf8"),!(e.maxEvents!==void 0||e.retentionDays!==void 0)&&(await So(o)).size<=Eo)return;let d=await un(e),c=`${o}.${process.pid}.${wo()}.tmp`;await xo(c,`${d.map(u=>JSON.stringify(u)).join(`
7
- `)}
8
- `,"utf8"),await Co(c,o)}finally{await s()}}async function fn(e,t){await ln(e,[t])}async function be(e){if(!(process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1)){if(!e.author.trim()||e.rows.some(t=>!t.id.trim()||!Number.isInteger(t.rank)||t.rank<1))throw new I("Context usage serving requires an author and valid ranked rows");await fn(e,{kind:"serve",at:J(e).iso,author:e.author.trim(),surface:e.surface,profile:e.profile.trim()||"balanced",rows:e.rows})}}async function fa(e){if(!(process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1)){if(!e.author.trim()||!e.itemId.trim()||!e.intent.trim())throw new I("Context usage touch requires author, itemId, and intent");await fn(e,{kind:"touch",at:J(e).iso,author:e.author.trim(),item_id:e.itemId.trim(),intent:e.intent.trim()})}}async function ma(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1||e.itemIds.length===0)return;let t=e.author.trim(),n=e.intent.trim();if(!t||!n)throw new I("Context usage touch requires author and intent");let r=new Set;for(let s of e.itemIds){if(typeof s!="string")throw new I("Context usage touch requires string itemIds");let a=s.trim();if(!a)throw new I("Context usage touch requires non-empty itemId");r.add(a)}let o=J(e).iso,i=[...r].map(s=>({kind:"touch",at:o,author:t,item_id:s,intent:n}));await ln(e,i)}function Io(e,t,n,r){return e.find(({entry:o,time:i})=>o.item_id===t&&i>=n&&i-n<=r)?.time}async function ve(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1"||e.enabled===!1)return{affinity:{},positive_judgments:0,serving_events:0};let t=await un(e),n=J(e).ms,r=(e.horizonHours??24)*36e5;if(!Number.isFinite(r)||r<=0)throw new I("Context usage horizonHours must be positive");let o=e.author.trim(),i=t.filter(l=>l.kind==="touch"&&l.author===o).map(l=>({entry:l,time:Date.parse(l.at)})),s=new Map,a=0,d=0;for(let l of t){if(l.kind!=="serve"||l.author!==o)continue;a+=1;let p=Date.parse(l.at);for(let g of l.rows){if(!g.included)continue;let w=Io(i,g.id,p,r);if(w===void 0)continue;d+=1;let h=Math.max(0,(n-w)/cn);s.set(g.id,(s.get(g.id)??0)+Math.exp(-h/14))}}let c=Math.max(0,...s.values());return{affinity:Object.fromEntries([...s.entries()].map(([l,p])=>[l,.05+.95*(c>0?p/c:0)])),positive_judgments:d,serving_events:a}}import Z from"node:fs/promises";import Q from"node:path";import{createHash as $o,randomUUID as Do}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a502be8f-57da-53c2-8de0-118a15688d93")}catch{}})();var Ye=1,Ve=1,mn=["recency","activity_density","graph_proximity","priority_pressure","risk_pressure","knowledge_density"];function Ce(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pn(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function No(e){let t={};for(let n of mn){let r=e[n];if(r!==void 0){if(!pn(r))throw new TypeError(`Context relevance signal ${n} must be a finite number from 0 to 1`);t[n]=r}}return t}function Ao(e,t){let n=e.map(o=>[o.id,t(o)]),r=Math.max(0,...n.map(([,o])=>o));return Object.fromEntries(n.map(([o,i])=>[o,r===0?0:i/r]))}function Oo(e){let t=new Map(e.map(o=>[o.id,0])),n=o=>{t.set(o,(t.get(o)??0)+1)};for(let o of e){typeof o.parent=="string"&&o.parent.trim()&&(n(o.id),n(o.parent.trim()));for(let i of o.dependencies??[])typeof i.id!="string"||!i.id.trim()||(n(o.id),n(i.id.trim()))}let r=Math.max(0,...t.values());return Object.fromEntries(e.map(o=>[o.id,r===0?0:t.get(o.id)/r]))}function Mo(e,t){return{...t,activityDensity:t.activityDensity??Ao(e,n=>(n.comments?.length??0)+(n.notes?.length??0)+(n.learnings?.length??0)+(n.test_runs?.length??0)),graphProximity:t.graphProximity??Oo(e)}}function Fo(e){if(!Ce(e)||typeof e.id!="string"||!Ce(e.signals))return null;let t={},n=new Set(mn);for(let[r,o]of Object.entries(e.signals)){if(!n.has(r)||!pn(o))return null;t[r]=o}return{id:e.id,signals:t}}function Ro(e){if(!Ce(e)||e.format_version!==Ye||e.signal_set_version!==Ve||typeof e.source_cursor!="string"||e.source_cursor.trim().length===0||typeof e.generated_at!="string"||!Number.isFinite(Date.parse(e.generated_at))||e.source!=="derived_index"&&e.source!=="scan_fallback"||!Array.isArray(e.items))return null;let t=e.items.map(Fo);if(t.some(r=>r===null))return null;let n=t;return new Set(n.map(r=>r.id)).size!==n.length||n.some(r=>r.id.trim().length===0)?null:{format_version:Ye,signal_set_version:Ve,source_cursor:e.source_cursor,generated_at:e.generated_at,source:e.source,items:n.sort((r,o)=>r.id.localeCompare(o.id))}}function Lo(e,t){if(typeof t.sourceCursor!="string"||t.sourceCursor.trim().length===0)throw new TypeError("Context signal source cursor must be non-empty");if(!Number.isFinite(Date.parse(t.now)))throw new TypeError("Context signal snapshot clock must be a valid timestamp");if(t.source!=="derived_index"&&t.source!=="scan_fallback")throw new TypeError("Context signal snapshot source must be derived_index or scan_fallback");let n=we(e,Mo(e,t)).map(({id:r,signals:o})=>({id:r,signals:No(o)})).sort((r,o)=>r.id.localeCompare(o.id));return Object.freeze({format_version:Ye,signal_set_version:Ve,source_cursor:t.sourceCursor,generated_at:t.now,source:t.source,items:Object.freeze(n.map(r=>Object.freeze(r)))})}var Ke=class{filePath;constructor(t){if(typeof t!="string"||t.trim().length===0)throw new TypeError("Context signal store path must be non-empty");this.filePath=Q.resolve(t)}async read(){try{return JSON.parse(await Z.readFile(this.filePath,"utf8"))}catch(t){if(Ce(t)&&t.code==="ENOENT")return null;throw t}}async write(t){let n=Q.dirname(this.filePath);await Z.mkdir(n,{recursive:!0});let r=Q.join(n,`.${Q.basename(this.filePath)}.${Do()}.tmp`);try{await Z.writeFile(r,`${JSON.stringify(t)}
9
- `,{encoding:"utf8",flag:"wx"}),await Z.rename(r,this.filePath)}finally{try{await Z.rm(r,{force:!0})}catch{}}}},Je=class{adapter;constructor(t){this.adapter=t}async readOrRebuild(t,n){let r=[],o=null;try{let l=await this.adapter.read();o=Ro(l),l!==null&&o===null&&r.push("context_signal_store_invalid")}catch{r.push("context_signal_store_invalid")}let i=t.map(l=>l.id).sort((l,p)=>l.localeCompare(p)),s=o?.items.map(l=>l.id)??[],a=o!==null&&o.source_cursor===n.sourceCursor&&o.source===n.source&&s.length===i.length&&s.every((l,p)=>l===i[p]),d;if(a&&o!==null)d=o;else{o!==null&&r.push("context_signal_store_stale"),d=Lo(t,n);try{await this.adapter.write(d)}catch{r.push("context_signal_store_write_failed")}}let c=new Map(d.items.map(l=>[l.id,l.signals])),u=we(t,n);return{snapshot:d,candidates:u.map(l=>({...l,signals:{...l.signals,...c.get(l.id)}})),cache_status:a?"fresh":"rebuilt",warnings:r}}};function Uo(e){let t=$o("sha256");for(let n of[...e].sort((r,o)=>r.id.localeCompare(o.id)))t.update(JSON.stringify([n.id,n.updated_at,n.status,n.parent??null,n.priority??null,n.risk??null,(n.dependencies??[]).map(r=>r.id).sort(),n.comments?.length??0,n.notes?.length??0,n.learnings?.length??0,n.test_runs?.length??0]));return`scan:${t.digest("hex")}`}async function Se(e,t){let n=t.sourceCursor!==void 0,r=t.source!==void 0;if(n!==r)throw new TypeError("Context signal source and source cursor must be provided together");if(t.storeKey!==void 0&&!/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$/u.test(t.storeKey))throw new TypeError("Context signal store key must be a filesystem-safe identifier");let o=n?null:await fe(t.pmRoot),i=t.sourceCursor??o?.source_cursor??Uo(e),s=t.source??(o===null?"scan_fallback":"derived_index");return new Je(new Ke(Q.join(t.pmRoot,"runtime",t.storeKey?`context-signals-${t.storeKey}.json`:"context-signals.json"))).readOrRebuild(e,{...t,sourceCursor:i,source:s})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a19662f9-f8b3-5988-bc04-1b5a5edaaaa5")}catch{}})();function Po(e){for(let t of e.patch){if(t.path==="/metadata/status"||t.path==="/front_matter/status"){if(typeof t.value=="string")return t.value.trim().toLowerCase();continue}if(t.path!==""||typeof t.value!="object")continue;let n=t.value,r=n.metadata??n.front_matter;if(typeof r?.status=="string")return r.status.trim().toLowerCase()}}function jo(e,t,n){let r,o;for(let i of t){let s=Po(i);if(s===void 0)continue;let a=n.has(s)&&(r!==void 0&&!n.has(r)||r===void 0&&i.op==="create");r=s,a&&Number.isFinite(Date.parse(i.ts))&&(o={id:e,completed_at:i.ts,history_op:i.op})}return o}function gn(e){return e.completed_at!==void 0?{resolved:!0,timestamp:e.completed_at,source:"completed_at",fallback:!1}:e.closed_at!==void 0?{resolved:!0,timestamp:e.closed_at,source:"closed_at",fallback:!0}:e.updated_at!==void 0?{resolved:!0,timestamp:e.updated_at,source:"updated_at",fallback:!0}:{resolved:!1}}function ba(e,t,n){let r=[];for(let o of e){if(o.completed_at!==void 0||!n.has(o.status.trim().toLowerCase()))continue;let i=jo(o.id,t.get(o.id)??[],n);i!==void 0&&r.push(i)}return r.sort((o,i)=>o.id.localeCompare(i.id))}import Bo from"node:path";import{createHash as zo}from"node:crypto";import Go from"node:fs/promises";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2e225010-1b53-59e9-8188-dcbe4a4f7eb7")}catch{}})();var hn=1,Wo=1e4,yn=12;function Ho(e){let t=new Date(e);return`${t.getUTCFullYear()}-Q${Math.floor(t.getUTCMonth()/3)+1}`}function Xo(e,t){let n=new Set,r=e.parent;for(;r&&!n.has(r);){n.add(r);let o=t.get(r);if(!o)return;if(o.type.toLowerCase()==="epic")return o;r=o.parent}}function qo(e){let t=[...e.items].sort((o,i)=>i.completion.timestamp.localeCompare(o.completion.timestamp)||o.item.id.localeCompare(i.item.id)),n=new Set,r=0;for(let{item:o}of t){let i=o.resolution??o.close_reason;i?.trim()&&n.add(i.trim()),r+=(o.notes?.length??0)+(o.learnings?.length??0)}return{kind:e.kind,key:e.key,label:e.label,item_count:t.length,first_closed_at:t.at(-1).completion.timestamp,last_closed_at:t[0].completion.timestamp,representative_items:t.slice(0,5).map(({item:{id:o,title:i}})=>({id:o,title:i})),outcomes:[...n].sort().slice(0,5),knowledge_entries:r}}function Yo(e,t){if(!t.sourceCursor.trim())throw new TypeError("Workspace memory source cursor must be non-empty");if(!Number.isFinite(Date.parse(t.now)))throw new TypeError("Workspace memory clock must be a valid timestamp");let n=e.filter(i=>t.statusRegistry.terminal_done_statuses.has(C(i.status,t.statusRegistry))).map(i=>{let s=gn(i);if(!s.resolved)throw new TypeError(`Completed item ${i.id} has no reporting timestamp`);return{item:i,completion:s}}),r=new Map(e.map(i=>[i.id,i])),o=new Map;for(let i of n){let{item:s,completion:a}=i,d=Ho(a.timestamp),c=`epoch:${d}`,u=o.get(c)??{kind:"epoch",key:d,label:d,items:[]};u.items.push(i),o.set(c,u);let l=Xo(s,r);if(l){let p=`epic:${l.id}`,g=o.get(p)??{kind:"epic",key:l.id,label:l.title,items:[]};g.items.push(i),o.set(p,g)}}return{format_version:hn,source_cursor:t.sourceCursor,source_item_count:e.length,generated_at:t.now,completion_time_sources:n.reduce((i,{completion:s})=>(i[s.source]+=1,i),{completed_at:0,closed_at:0,updated_at:0}),rollups:[...o.values()].map(qo).sort((i,s)=>s.last_closed_at.localeCompare(i.last_closed_at)||i.kind.localeCompare(s.kind)||i.key.localeCompare(s.key))}}function Vo(e){return typeof e=="object"&&e!==null&&"id"in e&&typeof e.id=="string"&&e.id.length>0&&"title"in e&&typeof e.title=="string"}function Ko(e){if(typeof e!="object"||e===null)return!1;let t=e,n=[t.key,t.label].every(o=>typeof o=="string"&&o.length>0),r=[t.first_closed_at,t.last_closed_at].every(o=>typeof o=="string"&&Number.isFinite(Date.parse(o)));return(t.kind==="epoch"||t.kind==="epic")&&n&&Number.isSafeInteger(t.item_count)&&t.item_count>0&&r&&Array.isArray(t.representative_items)&&t.representative_items.every(Vo)&&Array.isArray(t.outcomes)&&t.outcomes.every(o=>typeof o=="string")&&Number.isSafeInteger(t.knowledge_entries)&&t.knowledge_entries>=0}function Jo(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=e;return t.format_version!==hn||typeof t.source_cursor!="string"||!t.source_cursor.trim()||!Number.isSafeInteger(t.source_item_count)||t.source_item_count<0||typeof t.generated_at!="string"||!Number.isFinite(Date.parse(t.generated_at))||!Array.isArray(t.rollups)?null:t.rollups.every(Ko)?t:null}function Zo(e){return`scan:${zo("sha256").update(pt(e.map(t=>[t.id,t.updated_at,t.status,t.parent]).sort(([t],[n])=>String(t).localeCompare(String(n))))).digest("hex")}`}async function Qo(e,t,n){return n!==void 0?n:(await fe(t))?.source_cursor??Zo(e)}async function ei(e){try{let t=Jo(JSON.parse(await Go.readFile(e,"utf8")));return{snapshot:t,invalid:t===null}}catch(t){return{snapshot:null,invalid:!(typeof t=="object"&&t!==null&&"code"in t&&t.code==="ENOENT")}}}async function _n(e,t){let n=Math.max(1,Math.floor(t.minimumItems??Wo));if(e.length<n)return{snapshot:null,cache_status:"skipped",warnings:[]};let r=await Qo(e,t.pmRoot,t.sourceCursor),o=Bo.join(t.pmRoot,"runtime","workspace-memory.json"),i=[],s=await ei(o),a=s.snapshot;if(s.invalid&&i.push("workspace_memory_invalid"),a?.source_cursor===r&&a.source_item_count===e.length)return{snapshot:a,cache_status:"fresh",warnings:i};a&&i.push("workspace_memory_stale");let d=Yo(e,{statusRegistry:t.statusRegistry,sourceCursor:r,now:t.now});try{await lt(o,`${JSON.stringify(d)}
10
- `)}catch{i.push("workspace_memory_write_failed")}return{snapshot:d,cache_status:"rebuilt",warnings:i}}function ti(e,t,n=yn){let r=Math.max(0,Math.floor(t)),o=0,i=[];for(let s of e.rollups){if(i.length>=Math.max(0,Math.floor(n)))break;let a=Math.ceil(JSON.stringify(s).length/4);o+a>r||(i.push(s),o+=a)}return i}function wn(e,t,n=yn){if(e.snapshot===null)return;let r=ti(e.snapshot,t,n);if(r.length!==0)return{cache_status:e.cache_status==="fresh"?"fresh":"rebuilt",source_cursor:e.snapshot.source_cursor,...e.snapshot.completion_time_sources?{completion_time_sources:{...e.snapshot.completion_time_sources}}:{},rollups:r}}function ni(e,t,n=5){if(e===null)return[];let r=t.trim().toLowerCase().split(/\s+/u).filter(Boolean);return r.length===0?[]:e.rollups.map(o=>({rollup:o,score:r.filter(i=>[o.key,o.label,...o.outcomes,...o.representative_items.flatMap(s=>[s.id,s.title])].join(" ").toLowerCase().includes(i)).length})).filter(({score:o})=>o>0).sort((o,i)=>i.score-o.score||i.rollup.last_closed_at.localeCompare(o.rollup.last_closed_at)||o.rollup.key.localeCompare(i.rollup.key)).slice(0,Math.max(0,Math.floor(n))).map(({rollup:o})=>o)}function Na(e,t,n=5){let r=ni(e.snapshot,t,n);if(r.length!==0)return{cache_status:e.cache_status==="fresh"?"fresh":"rebuilt",matches:r}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="dbcd4e0e-3fa0-5ce9-8bbc-6de05779d729")}catch{}})();var ri=["markdown","toon","json","ndjson"],te=new Set(["Epic","Feature"]),xn=10,En=1e4,Tn=["hierarchy","activity","progress","recently_created","unparented","workload"],oi=[...Tn,"blockers","files","staleness","tests"],ii=/^(\d{4})-(\d{2})-(\d{2})/,si=/^(\d{4})(\d{2})(\d{2})(?:[T ]?\d{2}|$)/,ai=/^(\d{4})(\d{2})(\d{2})$/,ci=/^(\d{4})(\d{2})(\d{2})(?:[T\s]?)(\d{2})(\d{2})(\d{2})?(Z|[+-]\d{2}:?\d{2})?$/i;function di(e){if(!e)return;let t=e.trim().toLowerCase();if(!ri.includes(t))throw new m("Context format must be one of markdown|toon|json|ndjson",f.USAGE);return t}var kn=new Set(["id","title","type","status","priority","order","deadline","assignee","tags","tags_inherited","updated_at","parent","children_total","children_closed","completion_pct","blocked","blocker_ids","created_at"]);function ui(e){if(e===void 0)return;let t=[];for(let n of e.split(",")){let r=n.trim().toLowerCase();if(r.length!==0){if(!kn.has(r))throw new m(`Context --fields value not projectable: ${r} (valid: ${[...kn].join(", ")})`,f.USAGE);t.includes(r)||t.push(r)}}if(t.length===0)throw new m("Context --fields requires at least one field name",f.USAGE);return t}function ee(e,t){return e.map(n=>{let r={},o=n;for(let i of t)r[i]=o[i]??null;return r})}function qa(e,t){let n=di(e.format);if(t.json&&n&&n!=="json"&&n!=="ndjson")throw new m("Cannot combine --json with --format markdown|toon",f.USAGE);return t.json?n==="ndjson"?"ndjson":"json":n??"toon"}function li(e,t){return L(e,"--limit")??(t==="full"?Number.MAX_SAFE_INTEGER:xn)}function et(e,t){if(e===void 0)return t;let n=typeof e=="number"?e:Number(e);if(!Number.isInteger(n)||n<1)throw new m("--token-budget must be a positive integer",f.USAGE);return n}function fi(e,t){return t>=En&&e===Number.MAX_SAFE_INTEGER?xn:e}function mi(e,t){if(!e)return t.default_depth;let n=e.trim().toLowerCase();if(!Oe.includes(n))throw new m(`Context --depth must be one of ${Oe.join("|")}`,f.USAGE);return n}function pi(e,t,n){if(e&&e.length>0){let o=[];for(let i of e){let s=i.trim().toLowerCase();if(!ce.includes(s))throw new m(`Context --section must be one of ${ce.join("|")}`,f.USAGE);o.includes(s)||o.push(s)}return o}return t==="brief"?[]:t==="full"?[...ce]:(t==="deep"?oi:Tn).filter(o=>n.sections[o])}function gi(e,t){return e?L(e,"--activity-limit")??t.activity_limit:t.activity_limit}function hi(e,t){if(!e)return t.stale_threshold_days;let n=e.trim().toLowerCase(),r=/^(\d+)d?$/.exec(n);if(!r)throw new m("--stale-threshold must be a number of days (e.g. 7 or 7d)",f.USAGE);let o=parseInt(r[1],10);if(o<=0)throw new m("--stale-threshold must be positive",f.USAGE);return o}function bn(e,t){let n=C(e,t),r=v("in_progress",t),o=v("open",t),i=v("blocked",t),s=v("draft",t);return r&&n===r?0:o&&n===o?1:i&&n===i?2:s&&n===s?3:t.active_statuses.has(n)?4:t.blocked_statuses.has(n)?5:t.terminal_statuses.has(n)?7:6}function ne(e,t){let n=v("closed",t);return C(e,t)===n}function tt(e,t){let n=v("in_progress",t);return C(e,t)===n}function In(e,t){let n=v("open",t);return C(e,t)===n}function yi(e,t){return t.blocked_statuses.has(C(e,t))}var _i=["compact","brief","fields","includeBody","include_body","parent"];function wi(e){let t={...e};for(let n of _i)delete t[n];return t}function nt(e,t){let n=t.trim().toLowerCase(),r=e.find(a=>a.id.trim().toLowerCase()===n);if(!r)return{ids:new Set,found:!1};let o=q(e),i=re(r.id,o);return{ids:new Set([r.id,...i.map(a=>a.id)].map(a=>a.trim().toLowerCase())),found:!0}}function ki(e){if(e===void 0)return;let t=e.trim();if(t.length===0)throw new m("Context --parent requires an item id",f.USAGE);return t}function bi(e,t){let n=e??null,r=t??null;return n===null&&r===null?0:n===null?1:r===null?-1:n-r}function vi(e,t){let n=e??null,r=t??null;return n===null&&r===null?0:n===null?1:r===null?-1:b(n,r)}function Ci(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function Si(e){let t=ii.exec(e)??si.exec(e);if(!t)return!0;let n=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10),o=Number.parseInt(t[3],10);return r>=1&&r<=12&&o>=1&&o<=Ci(n,r-1)}function xi(e){let t=ai.exec(e);if(t)return`${t[1]}-${t[2]}-${t[3]}`;let n=ci.exec(e);if(n){let[,r,o,i,s,a,d,c]=n,u=d?`:${d}`:"",l=c&&c.length===5&&c!=="Z"?`${c.slice(0,3)}:${c.slice(3)}`:c??"";return`${r}-${o}-${i}T${s}:${a}${u}${l}`}return e}function $n(e){if(typeof e!="string")return Number.NaN;let t=e.trim();if(t.length===0||!Si(t))return Number.NaN;let n=Date.parse(xi(t));return Number.isFinite(n)?n:Number.NaN}function Qe(e){let t=$n(e);return Number.isFinite(t)?new Date(t).toISOString():""}function Ei(e){let t=$n(e);return Number.isFinite(t)?new Date(t).toISOString().slice(0,10):"unknown"}function rt(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function U(e,t,n){let r=bn(e.status,n)-bn(t.status,n);if(r!==0)return r;let o=e.priority-t.priority;if(o!==0)return o;let i=bi(e.order,t.order);if(i!==0)return i;let s=vi(e.deadline,t.deadline);if(s!==0)return s;let a=b(Qe(t.updated_at),Qe(e.updated_at)),d=e.id.localeCompare(t.id);return a!==0?a:d}function Ze(e){return Math.max(1,Math.ceil(Buffer.byteLength(JSON.stringify(e),"utf8")/4))}function ot(e,t,n=new Set,r="context"){return rn(e.ranked.map(o=>({id:o.id,item:o.item,rank:o.rank,score:o.score,required:n.has(o.id),cluster:o.item.parent?.trim()||o.item.type,token_costs:{identity:Ze({id:o.id,title:o.item.title}),summary:Ze({id:o.id,title:o.item.title,type:o.item.type,status:o.item.status,priority:o.item.priority,parent:o.item.parent}),full:Ze(o.item)}})),{tokenBudget:t,profile:r,latencyBudgetMs:25})}function it(e){return{...e,included:e.included.map(t=>({id:t.id,projection:t.projection,tokens:t.tokens}))}}function st(e,t){return{model:e.model,available_signals:e.available_signals,items:e.ranked.map(n=>({id:n.id,rank:n.rank,baseline_rank:n.baseline_rank,score:n.score,contributions:n.contributions})),...t?{feature_store:{source:t.snapshot.source,cache_status:t.cache_status,source_cursor:t.snapshot.source_cursor,generated_at:t.snapshot.generated_at}}:{}}}function Dn(e,t){return t>0?Math.round(e/t*100):0}function q(e){let t=new Map;for(let n of e){let r=rt(n.parent);if(!r)continue;let o=t.get(r)??[];o.push(n),t.set(r,o)}return t}function oe(e,t,n){let r={id:e.id,title:e.title,type:e.type,status:e.status,priority:e.priority,order:e.order??null,deadline:e.deadline??null,assignee:e.assignee??null,tags:Array.isArray(e.tags)?[...e.tags]:[],updated_at:e.updated_at,parent:rt(e.parent)};if(t&&n){let o=re(e.id,n),i=o.length;if(i>0){let s=o.filter(a=>ne(a.status,t)).length;r.children_total=i,r.children_closed=s,r.completion_pct=Dn(s,i)}}return r}function Ti(e){let t=0,n=0,r=0,o=new Set;for(let i of e){if(o.add(i.item_id),i.kind==="deadline"){t+=1;continue}if(i.kind==="reminder"){n+=1;continue}r+=1}return{events:e.length,items:o.size,deadlines:t,reminders:n,scheduled:r}}function xe(...e){return[...new Set(e.flatMap(t=>t??[]))].sort((t,n)=>t.localeCompare(n))}function Ii(e,t){return e.filter(n=>!t.terminal_statuses.has(C(n.item_status,t)))}function $i(e,t,n,r){let o=new Map;for(let d of e)o.set(d.id,d);let i=q(e),s=new Set(t.filter(d=>te.has(d.type)).map(d=>d.id)),a=[];for(let d of s){let c=o.get(d);if(!c)continue;let u=re(d,i),l=i.get(d)??[],p=0,g=0,w=0,h=0;for(let _ of u)ne(_.status,n)?p++:tt(_.status,n)?w++:yi(_.status,n)?h++:In(_.status,n)&&g++;let S=l.sort((_,k)=>U(_,k,n)).slice(0,r).map(_=>{let k=re(_.id,i),x=k.filter($=>ne($.status,n)).length;return{id:_.id,title:_.title,type:_.type,status:_.status,children_total:k.length,children_closed:x}});a.push({id:c.id,title:c.title,type:c.type,status:c.status,children_total:u.length,children_closed:p,children_open:g,children_in_progress:w,children_blocked:h,children:S})}return a.sort((d,c)=>{let u=o.get(d.id),l=o.get(c.id);return U(u,l,n)}).slice(0,r)}function re(e,t){let n=[],r=[e],o=new Set;for(;r.length>0;){let i=r.pop();if(o.has(i))continue;o.add(i);let s=t.get(i)??[];for(let a of s)n.push(a),r.push(a.id)}return n}async function Di(e,t){return(await zt({compact:!0,limit:String(e)},t)).compact_activity??[]}function Ni(e,t,n,r,o){let i=new Map;for(let d of e){if(!d.parent)continue;let c=i.get(d.parent)??[];c.push(d),i.set(d.parent,c)}let s=t.filter(d=>te.has(d.type)),a=[];for(let d of s){let c=re(d.id,i),u=c.length;if(u===0)continue;let l=0,p=0,g=0,w=0;for(let h of c)ne(h.status,r)?l++:n.has(h.id.trim().toLowerCase())?w++:tt(h.status,r)?g++:In(h.status,r)&&p++;a.push({id:d.id,title:d.title,type:d.type,total:u,closed:l,open:p,in_progress:g,blocked:w,completion_pct:Dn(l,u)})}return a.sort((d,c)=>d.completion_pct-c.completion_pct).slice(0,o)}function Ai(e,t,n,r){let o=new Map(t.map(i=>[i.id.trim().toLowerCase(),i]));return e.slice(0,r).map(i=>{let s=Fe(i,o,n),a=s.find(c=>!c.resolved)?.id??s[0]?.id??null,d=a?o.get(a.trim().toLowerCase()):void 0;return{id:i.id,title:i.title,blocked_by:a,blocked_by_title:d?.title??null,blocked_by_status:d?.status??null,blocked_reason:i.blocked_reason??null,unblock_note:i.unblock_note??null}})}function Oi(e,t){let n=new Map;for(let r of e)for(let o of r.files??[]){let i=n.get(o.path)??new Set;i.add(r.id),n.set(o.path,i)}return[...n.entries()].map(([r,o])=>({path:r,references:o.size,items:[...o].sort()})).sort((r,o)=>o.references-r.references).slice(0,t)}function Mi(e,t,n){let r=new Map;for(let o of e){let i=o.assignee??null,s=r.get(i)??[];s.push(o),r.set(i,s)}return[...r.entries()].map(([o,i])=>({assignee:o,active:i.length,in_progress:i.filter(s=>tt(s.status,t)).length,items:i.map(s=>s.id).sort()})).sort((o,i)=>i.active-o.active).slice(0,n)}function Fi(e,t,n,r){let o=new Date(n).getTime()-t*24*60*60*1e3;return e.filter(i=>new Date(i.updated_at).getTime()<o).map(i=>({id:i.id,title:i.title,status:i.status,updated_at:i.updated_at,stale_days:Math.floor((new Date(n).getTime()-new Date(i.updated_at).getTime())/(1440*60*1e3))})).sort((i,s)=>s.stale_days-i.stale_days).slice(0,r)}function Ri(e,t,n,r){return e.map(o=>({item:o,sortKey:Qe(o.created_at)})).sort((o,i)=>{let s=b(i.sortKey,o.sortKey);return s!==0?s:o.item.id.localeCompare(i.item.id)}).slice(0,r).map(({item:o})=>({...oe(o,t,n),created_at:o.created_at}))}function Li(e,t,n,r){return e.filter(o=>!rt(o.parent)&&!te.has(o.type)).sort((o,i)=>U(o,i,t)).slice(0,r).map(o=>oe(o,t,n))}function Ui(e){let t=0,n=0,r=0,o=0,i=0,s=[];for(let a of e){(a.tests??[]).length>0&&t++;let d=a.test_runs??[];if(d.length>0){n++;let c=!1;for(let u of d)r+=u.passed??0,o+=u.failed??0,i+=u.skipped??0,(u.failed??0)>0&&(c=!0);c&&s.push(a.id)}}return{items_with_tests:t,items_with_recent_runs:n,recent_runs:{passed:r,failed:o,skipped:i},items_failing:s.sort()}}function vn(e){return`${new Date(e).toISOString().slice(11,16)}Z`}function Nn(e){let t=e.order===null?"-":String(e.order),n=e.deadline??"-",r=e.parent?` parent:${e.parent}`:"",o=e.children_total!==void 0&&e.children_closed!==void 0&&e.completion_pct!==void 0?` children:${e.children_closed}/${e.children_total} done:${e.completion_pct}%`:"",i=e.blocked===!0?` blocked:${e.blocker_ids?.join(",")||"lifecycle"}`:"";return`${e.id} p${e.priority} ${e.status} ${e.type} order:${t} deadline:${n}${r}${o}${i} ${e.title}`}function Pi(e,t){let n=e;return t.map(r=>{let o=n[r];return Array.isArray(o)?`${r}:${o.join(",")}`:`${r}:${o??"-"}`}).join(" ")}function ji(e){if("reference_only"in e){let n=e.kind==="reminder"?` \u2014 ${e.reminder_text??"reminder"}`:e.kind==="event"?` \u2014 ${e.event_title??"event"}${e.event_recurring?" (recurring)":""}`:"";return`${vn(e.at)} [${e.kind}] ${e.item_id} (see focus item)${n}`}let t=`${vn(e.at)} [${e.kind}] ${e.item_id} p${e.item_priority} ${e.item_status} ${e.item_title}`;if(e.kind==="reminder")return`${t} \u2014 ${e.reminder_text}`;if(e.kind==="event"){let n=e.event_recurring?" (recurring)":"",r=e.event_title??e.item_title;return`${t} \u2014 ${r}${n}`}return t}function Cn(e,t,n,r,o){if(e.push(`## ${t}`),n.length===0)e.push(r);else for(let i of n)e.push(`- ${o(i)}`);e.push("")}function Bi(e,t,n){if(t.blocked_fallback.length!==0){e.push("## Blocked fallback");for(let r of t.blocked_fallback)e.push(`- ${n(r)}`);e.push("")}}function zi(e,t){if(e.push("## Agenda"),e.push(`- events: ${t.agenda.summary.events} (deadlines: ${t.agenda.summary.deadlines}, reminders: ${t.agenda.summary.reminders}, scheduled: ${t.agenda.summary.scheduled})`),t.agenda.events.length===0)e.push("No agenda events matched the selected filters.");else for(let n of t.agenda.events)e.push(`- ${ji(n)}`);e.push("")}function Gi(e,t){if(!(!t.hierarchy||t.hierarchy.length===0)){e.push("## Hierarchy");for(let n of t.hierarchy){let r=n.children_total>0?Math.round(n.children_closed/n.children_total*100):0;e.push(`- ${n.id} ${n.type} ${n.status} "${n.title}" [${n.children_closed}/${n.children_total} done ${r}%]`);for(let o of n.children){let i=o.children_total>0?Math.round(o.children_closed/o.children_total*100):0;e.push(` - ${o.id} ${o.type} ${o.status} "${o.title}" [${o.children_closed}/${o.children_total} done ${i}%]`)}}e.push("")}}function Wi(e,t){if(!(!t.progress||t.progress.length===0)){e.push("## Progress");for(let n of t.progress)e.push(`- ${n.id} "${n.title}" ${n.completion_pct}% (${n.closed}/${n.total} closed, ${n.in_progress} wip, ${n.open} open, ${n.blocked} blocked)`);e.push("")}}function Hi(e,t,n,r){if(!(!t.recently_created||t.recently_created.length===0)){e.push("## Recently created");for(let o of t.recently_created)e.push(n?`- ${r(o)}`:`- ${Ei(o.created_at)} ${Nn(o)}`);e.push("")}}function Xi(e,t,n){if(!(!t.unparented||t.unparented.length===0)){e.push("## Unparented");for(let r of t.unparented)e.push(`- ${n(r)}`);e.push("")}}function qi(e,t){if(!(!t.activity||t.activity.length===0)){e.push("## Recent activity");for(let n of t.activity){let r=n.msg?` ${n.msg}`:"";e.push(`- ${n.ts.slice(0,16)}Z ${n.id} ${n.op} by:${n.author}${r}`)}e.push("")}}function Yi(e,t){if(!(!t.blockers||t.blockers.length===0)){e.push("## Blockers");for(let n of t.blockers){let r=n.blocked_by?`blocked_by:${n.blocked_by}(${n.blocked_by_status??"?"})`:"blocked_by:-",o=n.blocked_reason?` reason:"${n.blocked_reason}"`:"",i=n.unblock_note?` unblock:"${n.unblock_note}"`:"";e.push(`- ${n.id} "${n.title}" ${r}${o}${i}`)}e.push("")}}function Vi(e,t){if(!(!t.files||t.files.length===0)){e.push("## Hot files");for(let n of t.files)e.push(`- ${n.path} refs:${n.references} items:[${n.items.join(",")}]`);e.push("")}}function Ki(e,t){if(!(!t.workload||t.workload.length===0)){e.push("## Workload");for(let n of t.workload){let r=n.assignee??"(unassigned)";e.push(`- ${r} active:${n.active} wip:${n.in_progress} items:[${n.items.join(",")}]`)}e.push("")}}function Ji(e,t){if(!(!t.staleness||t.staleness.length===0)){e.push("## Stale items");for(let n of t.staleness)e.push(`- ${n.id} ${n.status} stale:${n.stale_days}d last:${n.updated_at.slice(0,10)} "${n.title}"`);e.push("")}}function Zi(e,t){t.tests&&(e.push("## Test health"),e.push(`- items_with_tests: ${t.tests.items_with_tests}`),e.push(`- items_with_recent_runs: ${t.tests.items_with_recent_runs}`),e.push(`- passed: ${t.tests.recent_runs.passed}, failed: ${t.tests.recent_runs.failed}, skipped: ${t.tests.recent_runs.skipped}`),t.tests.items_failing.length>0&&e.push(`- items_failing: [${t.tests.items_failing.join(",")}]`),e.push(""))}function Qi(e,t){t.summary.active_items===0&&t.summary.blocked===0&&t.agenda.summary.events===0&&(e.push("## Suggestions"),e.push("No active work items or upcoming events. Consider:"),e.push('- `pm create --type Task --title "..."` to add a new work item'),e.push("- `pm list --status closed --limit 5` to review recent completions"),e.push("- `pm search <keywords>` to find related past work"),e.push("- `pm aggregate` for a full project status overview"))}function Ya(e){let t=[],n=e.focus_fields,r=i=>n?Pi(i,n):Nn(i);if(t.push("# pm context"),t.push(""),t.push(`- now: ${e.now}`),t.push(`- depth: ${e.depth}`),e.filters.parent&&t.push(`- scope: subtree of ${e.filters.parent}`),t.push(`- active_items: ${e.summary.active_items} (in_progress: ${e.summary.in_progress}, open: ${e.summary.open})`),e.summary.total_items!==void 0&&t.push(`- total_items: ${e.summary.total_items} (closed: ${e.summary.closed??0}, canceled: ${e.summary.canceled??0})`),t.push(`- agenda_events: ${e.summary.agenda_events}`),t.push(`- blocked_fallback_used: ${e.summary.blocked_fallback_used}`),e.extension_health){let i=e.extension_health.packages.filter(s=>s.status==="degraded").map(s=>s.name);t.push(`- extensions: ${e.extension_health.ok} ok, ${e.extension_health.degraded} degraded${i.length>0?` (${i.join(", ")})`:""}`)}let o=e.sections_included.filter(i=>i!=="blockers"||(e.blockers?.length??0)>0);if(o.length>0&&t.push(`- sections: ${o.join(", ")}`),t.push(""),Cn(t,"High-level focus",e.high_level,"No high-level active items.",r),Cn(t,"Low-level focus",e.low_level,"No low-level active items.",r),Bi(t,e,r),zi(t,e),e.workspace_memory){t.push("## Workspace memory");for(let i of e.workspace_memory.rollups)t.push(`- ${i.kind}:${i.key} \u2014 ${i.label} (${i.item_count} completed, latest ${i.last_closed_at})`);t.push("")}return Gi(t,e),Wi(t,e),Hi(t,e,n,r),Xi(t,e,r),qi(t,e),Yi(t,e),Vi(t,e),Ki(t,e),Ji(t,e),Zi(t,e),Qi(t,e),t.join(`
11
- `)}async function es(e,t){let n=N(process.cwd(),t.path),r=await M(n),o=r.context??ft.context,i=H(r.schema),s=mi(e.depth,o),a=li(e.limit??e.maxItems,s);return{settings:r,contextSettings:o,statusRegistry:i,depth:s,limit:a,sectionsIncluded:pi(e.section,s,o),activityLimit:gi(e.activityLimit,o),staleThresholdDays:hi(e.staleThreshold,o),parentScope:ki(e.parent),focusFields:ui(e.fields),baseListOptions:wi(e)}}function at(e){return e.some(t=>["hierarchy","progress","blockers","staleness","recently_created","unparented"].includes(t))}function ts(e,t){return{...e,...t,noTruncate:!0,limit:void 0,offset:void 0,after:void 0}}async function ns(e,t){let n=at(t.sectionsIncluded),r=await V(void 0,ts(t.baseListOptions,{excludeTerminal:!1}),e),o=r.items,i=o.filter(d=>!Me(d.status,t.statusRegistry)),s=n||t.parentScope!==void 0?o:i,a=rs(t.parentScope,o);return a&&(i=i.filter(d=>a.has(d.id.trim().toLowerCase())),s=s.filter(d=>a.has(d.id.trim().toLowerCase()))),{listed:r,listedItemMetadata:i,allItems:s,fullCorpus:o,subtreeIds:a}}function rs(e,t){if(e===void 0)return;let n=nt(t,e);if(!n.found)throw new m(`Context --parent item not found: ${e}`,f.NOT_FOUND);return n.ids}async function os(e,t,n,r,o,i,s,a,d,c,u,l,p,g){let w=[...e].sort((y,z)=>U(y,z,o)),h=await ve({pmRoot:p,author:d,enabled:process.env.PM_CONTEXT_USAGE_DISABLED!=="1"}),S=await Se(w,{pmRoot:p,storeKey:"context",statusRegistry:o,now:a,author:d,usageAffinity:h.affinity}),_=await ke("context",S.candidates),k=_.ranked.map(y=>y.item),x=o.active_statuses,$=k.filter(y=>x.has(C(y.status,o))),P=l?St($,c,u,y=>y.id):0,E=l?$.slice(P,P+s):$,ie=l&&E.length>0&&P+E.length<$.length,se=ie&&E.length>0?Ct(u,E[E.length-1].id,P+E.length-1):void 0,Ie=k.filter(y=>r.has(y.id.trim().toLowerCase())),$e=new Set([...E.map(y=>y.id),...Ie.slice(0,s).map(y=>y.id)]),F=ot({..._,ranked:_.ranked.filter(y=>$e.has(y.id))},g),j=F.included.map(y=>y.item),R=j.filter(y=>x.has(C(y.status,o))),B=j.filter(y=>r.has(y.id.trim().toLowerCase())),De=q(t),Ne=at(i)?De:void 0,D=new Map(n.map(y=>[y.id.trim().toLowerCase(),y])),T=y=>{let z=oe(y,o,Ne);return r.has(y.id.trim().toLowerCase())&&(z.blocked=!0,z.blocker_ids=Fe(y,D,o).filter(Ae=>!Ae.resolved).map(Ae=>Ae.id)),z},Rn=R.filter(y=>te.has(y.type)).slice(0,l?E.length:s).map(T),Ln=R.filter(y=>!te.has(y.type)).slice(0,l?E.length:s).map(T),ut=$.length===0;return{activeItems:R,blockedItems:B,highLevel:Rn,lowLevel:Ln,blockedFallback:ut?B.slice(0,s).map(T):[],blockedFallbackUsed:ut,ranking:_,packing:F,featureStore:S,pageExtras:{...l?{applied_limit:s}:{},...ie?{has_more:!0,truncated:!0}:{},...se?{next_cursor:se}:{}}}}function is(e){return vt("context",bt(e,Dt))}function ss(e,t){return e.limit!==void 0||e.maxItems!==void 0||e.after!==void 0||t>=En}async function as(e,t,n,r){let o={...t.baseListOptions,view:"agenda",include:"all",limit:t.parentScope===void 0?String(t.limit):void 0},i=await Qt(o,e),s=n===void 0?i.events:i.events.filter(c=>n.has(c.item_id.trim().toLowerCase())),a=Ii(s,t.statusRegistry).slice(0,t.limit),d=a.map(c=>r.has(c.item_id)?{at:c.at,date:c.date,kind:c.kind,item_id:c.item_id,reference_only:!0,...c.kind==="reminder"?{reminder_text:c.reminder_text}:{},...c.kind==="event"?{event_title:c.event_title,event_recurring:c.event_recurring}:{}}:c);return{agenda:i,agendaEvents:d,agendaSummary:Ti(a)}}function Sn(e,t,n){let r=String(t);return e.filter(o=>C(o.status,n)===r).length}async function cs(e){let{runtime:t,allItems:n,fullCorpus:r,blockedIds:o,focusGroups:i,now:s,global:a}=e,d=q(n),c=n.filter(l=>!Me(l.status,t.statusRegistry)),u=l=>t.sectionsIncluded.includes(l);return{hierarchy:u("hierarchy")?$i(n,i.activeItems,t.statusRegistry,t.limit):void 0,activity:u("activity")?await Di(t.activityLimit,a):void 0,progress:u("progress")?Ni(n,i.activeItems,o,t.statusRegistry,t.limit):void 0,blockersSection:u("blockers")?Ai(i.blockedItems,r,t.statusRegistry,t.limit):void 0,recentlyCreated:u("recently_created")?Ri(c,t.statusRegistry,d,t.limit):void 0,unparented:u("unparented")?Li(c,t.statusRegistry,d,t.limit):void 0,filesSection:u("files")?Oi(i.activeItems,t.limit):void 0,workload:u("workload")?Mi(i.activeItems,t.statusRegistry,t.limit):void 0,staleness:u("staleness")?Fi(c,t.staleThresholdDays,s,t.limit):void 0,tests:u("tests")?Ui(i.activeItems):void 0}}function ds(e,t,n){if(!e)return{};let r=v("canceled",n);return{total_items:t.length,closed:t.filter(o=>ne(o.status,n)).length,canceled:t.filter(o=>C(o.status,n)===r).length}}function us(e,t){t.hierarchy&&(e.hierarchy=t.hierarchy),t.activity&&(e.activity=t.activity),t.progress&&(e.progress=t.progress),t.blockersSection&&(e.blockers=t.blockersSection),t.recentlyCreated&&(e.recently_created=t.recentlyCreated),t.unparented&&(e.unparented=t.unparented),t.filesSection&&(e.files=t.filesSection),t.workload&&(e.workload=t.workload),t.staleness&&(e.staleness=t.staleness),t.tests&&(e.tests=t.tests)}function ls(e,t){t&&(e.focus_fields=t,e.high_level=ee(e.high_level,t),e.low_level=ee(e.low_level,t),e.blocked_fallback=ee(e.blocked_fallback,t),e.recently_created&&(e.recently_created=ee(e.recently_created,t)),e.unparented&&(e.unparented=ee(e.unparented,t)))}function fs(e,t){let n=[e.high_level,e.low_level,e.blocked_fallback,e.recently_created??[],e.unparented??[]].flat();if(t){for(let i of n)delete i.tags,delete i.tags_inherited;return}let r=new Map(n.map(i=>[i.id,i])),o=new Map(n.map(i=>[i.id,i.tags?[...i.tags].sort().join("\0"):void 0]));for(let i of n){if(!i.parent||!i.tags)continue;let s=r.get(i.parent);s&&o.get(i.id)===o.get(s.id)&&(delete i.tags,i.tags_inherited=s.id)}}function ms(e,t,n){t.length>0||n.length>0||e.agenda.events.length>0||(e.suggestions=['pm create --type Task --title "..." to add a new work item',"pm list --status closed --limit 5 to review recent completions","pm search <keywords> to find related past work","pm aggregate for a full project status overview"])}async function ps(e,t,n,r){try{let o=new Set(t.packing.included.map(i=>i.id));await be({pmRoot:n,author:r,surface:"context",profile:t.packing.profile,rows:t.ranking.ranked.map(i=>({id:i.id,rank:i.rank,included:o.has(i.id)})),enabled:process.env.PM_CONTEXT_USAGE_DISABLED!=="1"})}catch{e.warnings=xe(e.warnings,["context_usage_feedback_write_failed"])}}async function gs(e,t,n){if(e)return{};let o=(await gt({pmRoot:t,settings:n,cwd:process.cwd(),noExtensions:!1})).discovered.map(s=>({name:s.name??s.directory,status:s.status==="ok"?"ok":"degraded"})).sort((s,a)=>s.name.localeCompare(a.name)),i=o.filter(s=>s.status==="degraded").length;return o.length===0?{}:{extension_health:{total:o.length,ok:o.length-i,degraded:i,packages:o.slice(0,20),...o.length>20?{truncated:!0}:{}}}}async function Va(e,t){let n=N(process.cwd(),t.path),r=await es(e,t),o=await ns(t,r),i=fi(r.limit,o.fullCorpus.length),s={...r,limit:i,tokenBudget:et(e.tokenBudget,Math.max(256,i*160))},a=Y(void 0,s.settings.author_default),d=gs(e.noExtensionHealth===!0,n,s.settings),c=Mt(o.fullCorpus,s.statusRegistry),u=await os(o.listedItemMetadata,o.allItems,o.fullCorpus,c,s.statusRegistry,s.sectionsIncluded,s.limit,O(),a,e.after,is(e),ss(e,o.fullCorpus.length),n,s.tokenBudget),l=await as(t,s,o.subtreeIds,new Set([...u.highLevel,...u.lowLevel,...u.blockedFallback].map(x=>x.id))),p=await _n(o.fullCorpus,{pmRoot:n,statusRegistry:s.statusRegistry,now:l.agenda.now}),g=xe(o.listed.warnings,l.agenda.warnings,u.ranking.warnings,[...u.featureStore.warnings],p.warnings),w=Sn(u.activeItems,v("in_progress",s.statusRegistry),s.statusRegistry),h=Sn(u.activeItems,v("open",s.statusRegistry),s.statusRegistry),S=await cs({runtime:s,allItems:o.allItems,fullCorpus:o.fullCorpus,blockedIds:c,focusGroups:u,now:l.agenda.now,global:t}),_=ds(at(s.sectionsIncluded),o.allItems,s.statusRegistry),k={output_default:"toon",now:l.agenda.now,depth:s.depth,sections_included:s.sectionsIncluded,window:{anchor:l.agenda.anchor,start:l.agenda.range.start,end:l.agenda.range.end,past:l.agenda.range.past,from:l.agenda.range.from,to:l.agenda.range.to},filters:{type:e.type??null,tag:e.tag??null,priority:e.priority??null,assignee:e.assignee??null,assignee_filter:e.assigneeFilter??null,sprint:e.sprint??null,release:e.release??null,limit:e.limit??e.maxItems??null,parent:s.parentScope??null,token_budget:s.tokenBudget,runtime_filters:o.listed.filters.runtime_filters??l.agenda.filters.runtime_filters??{}},summary:{active_items:u.activeItems.length,in_progress:w,open:h,blocked:u.blockedItems.length,blocked_fallback_used:u.blockedFallbackUsed,high_level:u.highLevel.length,low_level:u.lowLevel.length,agenda_events:l.agendaSummary.events,..._},high_level:u.highLevel,low_level:u.lowLevel,blocked_fallback:u.blockedFallback,agenda:{summary:l.agendaSummary,events:l.agendaEvents},...u.pageExtras};return k.workspace_memory=wn(p,Math.min(800,Math.floor(s.tokenBudget*.2))),Object.assign(k,await d),us(k,S),fs(k,e.noTags===!0),e.explainRanking===!0&&(k.ranking=st(u.ranking,u.featureStore),k.packing=it(u.packing)),ls(k,s.focusFields),g.length>0&&(k.warnings=g),ms(k,u.activeItems,u.blockedItems),await ps(k,u,n,a),k}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3431d4d4-e053-5416-b3d1-6dbfbed0142d")}catch{}})();var hs=["markdown","toon","json"],ys=5,_s=1440*60*1e3;function ws(e){if(!e)return;let t=e.trim().toLowerCase();if(!hs.includes(t))throw new m("Next format must be one of markdown|toon|json",f.USAGE);return t}function sc(e,t){let n=ws(e.format);if(t.json&&n&&n!=="json")throw new m("Cannot combine --json with --format markdown|toon",f.USAGE);return t.json?"json":n??"toon"}function An(e,t,n){let r=L(e,t);return r===void 0||r<=0?n:r}function ct(e,t,n,r){return{...oe(e.item,t,n),open_blocker_count:e.open_blockers.length,blockers:e.open_blockers.map(o=>({id:o.id,title:o.title,status:o.status})),unblocks:e.unblocks,rank:r}}function ks(e,t,n,r){let o=e.item,i=[],s=v("in_progress",t);return i.push(C(o.status,t)===s?"in progress \u2014 resume to finish":"open and ready to start"),r&&i.push("completed container \u2014 governance closeout"),i.push(`priority p${o.priority}${o.priority===0?" (highest)":""}`),typeof o.deadline=="string"&&o.deadline.trim().length>0&&i.push(vs(o.deadline,n)),i.push(Ot(o).length>0?"all blockers resolved":"no blockers"),typeof o.parent=="string"&&o.parent.trim().length>0&&i.push(`advances ${o.parent.trim()}`),e.unblocks.length>0&&i.push(`unblocks ${e.unblocks.length} item(s): ${e.unblocks.join(", ")}`),i}function Mn(e,t,n){let r=Y(n,t),o=[],i=[];for(let s of e){let a=typeof s.item.assignee=="string"?s.item.assignee.trim():"";a.length>0&&a!==r?i.push({id:s.item.id,assignee:a}):o.push(s)}return{available:o,held:i}}var ac={partitionCallerOwnedReady:Mn,resolveNextCallerAuthor:(e,t)=>Fn(e,t)};function bs(e,t){let n=e.filter(r=>r.item.type.trim().toLowerCase()==="decision");return{agent:t?e:e.filter(r=>r.item.type.trim().toLowerCase()!=="decision"),decisions:t?[]:n}}function vs(e,t){let n=Date.parse(e);if(!Number.isFinite(n))return`deadline ${e.trim()}`;let r=new Date(n).toISOString().slice(0,10),o=new Date(Date.parse(t)).toISOString().slice(0,10),i=Math.round((Date.parse(r)-Date.parse(o))/_s);return i<0?`deadline ${r} (overdue ${-i}d)`:i===0?`deadline ${r} (due today)`:`deadline ${r} (in ${i}d)`}function Cs(e,t){let n=v("in_progress",t);return e.filter(r=>C(r.status,t)===n).length}function dt(e,t){return(t.get(e.id.trim().toLowerCase())??[]).length>0}function Ss(e,t){return{type:e.type,tag:e.tag,priority:typeof e.priority=="number"?String(e.priority):e.priority,assignee:e.assignee,assigneeFilter:e.assigneeFilter,sprint:e.sprint,release:e.release,noTruncate:!0,...t}}function On(e,t,n){return[...e].sort((r,o)=>{let i=dt(r.item,t),s=dt(o.item,t);return i!==s?Number(i)-Number(s):U(r.item,o.item,n)})}function xs(e){return e.projectedReady.length===0?null:{...e.readyRows[0],reasons:ks(e.projectedReady[0],e.statusRegistry,e.now,e.completedContainer)}}function Es(e,t){if(e===null){if(t.length>0){let n=t.find(r=>r.blockers.length>0);return[n?`${t.length} item(s) are blocked; unblock the top one by closing ${n.blockers.map(r=>r.id).join(", ")}`:`${t.length} item(s) are blocked; add blocker context or move the top item back to an active status`,"pm next --ready-only after a blocker closes to re-check ready work",'pm create --type Task --title "..." to add new ready work']}return['pm create --type Task --title "..." to add a new work item',"pm list --status in_progress to review work already underway","pm context --depth deep for the full project snapshot"]}}function Ts(e,t,n){let r={};return e>n&&(r.decision_needed_total=e),t>n&&(r.held_by_others_total=t),Object.keys(r).length>0?r:void 0}async function Is(e){try{let t=new Set(e.packing.included.map(n=>n.id));await be({pmRoot:e.pmRoot,author:e.author,surface:"next",profile:e.packing.profile,rows:e.ranking.ranked.map(n=>({id:n.id,rank:n.rank,included:t.has(n.id)})),enabled:process.env.PM_CONTEXT_USAGE_DISABLED!=="1"})}catch{e.result.warnings=xe(e.result.warnings,["context_usage_feedback_write_failed"])}}async function $s(e){let t=[...new Set([...e.candidatesWarnings??[],...e.corpusWarnings??[],...e.readyRanking.warnings??[],...e.featureStore.warnings])].sort((n,r)=>n.localeCompare(r));return t.length>0&&(e.result.warnings=t),e.explainRanking&&(e.result.ranking=st(e.readyRanking,e.featureStore),e.result.packing=it(e.packing)),e.result.suggestions=Es(e.recommended,e.blockedRows),await Is({result:e.result,pmRoot:e.pmRoot,author:e.author,packing:e.packing,ranking:e.readyRanking}),e.result}function Ds(e,t,n){if(!n)return e;let r=nt(t,n);if(!r.found)throw new m(`Next --parent item not found: ${n}`,f.NOT_FOUND);return e.filter(o=>r.ids.has(o.id.trim().toLowerCase()))}async function Ns(e,t,n,r,o,i,s){let a=e.filter(h=>!dt(h.item,t)),d=a.length>0?a:e,c=await ve({pmRoot:i,author:o,enabled:process.env.PM_CONTEXT_USAGE_DISABLED!=="1"}),u=await Se(d.map(h=>h.item),{pmRoot:i,storeKey:"next",statusRegistry:n,now:r,author:o,usageAffinity:c.affinity}),l=await ke("next",u.candidates),p=ot(l,s,new Set,"next"),g=new Map(d.map(h=>[h.item.id,h]));return{projectedReady:l.ranked.map(h=>g.get(h.id)).filter(h=>h!==void 0),ranking:l,completedContainer:a.length===0,packing:p,featureStore:u}}function Fn(e,t){let n=e.assignee?.trim();return Y(e.callerAuthor??(n&&n.length>0?n:void 0),t)}async function cc(e,t){let n=N(process.cwd(),t.path),r=await M(n),o=Fn(e,r.author_default),i=H(r.schema),s=O(),a=An(e.limit,"--limit",ys),d=et(e.tokenBudget,Math.max(192,a*128)),c=An(e.blockedLimit,"--blocked-limit",a),u=e.readyOnly===!0,l=typeof e.parent=="string"?e.parent.trim():"",p=await V(void 0,Ss(e,{excludeTerminal:!0}),t),g=await V(void 0,{excludeTerminal:!1,noTruncate:!0},t),w=Ds(p.items,g.items,l),h=g.items,S=Ft(w,h,i),_=q(h),k=bs(S.ready,e.includeDecisions===!0),x=Mn(k.agent,r.author_default,o),$=On(x.available,_,i),P=[...S.blocked].sort((D,T)=>U(D.item,T.item,i)),{projectedReady:E,ranking:ie,completedContainer:se,packing:Ie,featureStore:$e}=await Ns($,_,i,s,o,n,d),F=E.map((D,T)=>ct(D,i,_,T+1)),j=P.map((D,T)=>ct(D,i,_,T+1)),R=On(k.decisions,_,i).map((D,T)=>ct(D,i,_,T+1)),B=xs({projectedReady:E,readyRows:F,statusRegistry:i,now:s,completedContainer:se}),De=Ts(R.length,x.held.length,a),Ne={output_default:"toon",now:s,recommended:B,ready:F.slice(1,a+1),decision_needed:R.slice(0,a),blocked:u?[]:j.slice(0,c),held_by_others:x.held.slice(0,a),summary:{recommended:B!==null,ready:F.length,blocked:j.length,in_progress:Cs(F,i),candidates:S.active_count,containers:S.container_count,decision_needed:R.length,held_by_others:x.held.length},filters:{type:e.type??null,tag:e.tag??null,priority:e.priority??null,assignee:e.assignee??null,assignee_filter:e.assigneeFilter??null,sprint:e.sprint??null,release:e.release??null,parent:l.length>0?l:null,limit:a,blocked_limit:c,ready_only:u,include_decisions:e.includeDecisions===!0,token_budget:d},truncation:De};return $s({result:Ne,recommended:B,blockedRows:j,candidatesWarnings:p.warnings,corpusWarnings:g.warnings,readyRanking:ie,explainRanking:e.explainRanking===!0,pmRoot:n,author:o,packing:Ie,featureStore:$e})}function dc(e){let t=["# pm next","",...As(e)];if(t.push(...Ee("Recommended",Os(e.recommended),"No ready work.")),t.push(...Ee("Decision needed",(e.decision_needed??[]).map(n=>`- ${Te(n)}`),"No human-gated decisions.")),t.push(...Ee("Ready",e.ready.map(n=>`- ${Te(n)}`),"No ready items.")),e.filters.ready_only||t.push(...Ee("Blocked",e.blocked.map(n=>`- ${Ms(n)}`),"No blocked items.")),e.suggestions&&e.suggestions.length>0){t.push("## Suggestions");for(let n of e.suggestions)t.push(`- ${n}`)}return t.join(`
12
- `).trimEnd()}function As(e){let t=[`- now: ${e.now}`,`- ready: ${e.summary.ready} (in_progress: ${e.summary.in_progress}), blocked: ${e.summary.blocked}, candidates: ${e.summary.candidates}`];return e.filters.parent&&t.push(`- scope: subtree of ${e.filters.parent}`),t.push(""),t}function Os(e){return e?[`- ${Te(e)}`,` why: ${e.reasons.join("; ")}`]:[]}function Ee(e,t,n){return[`## ${e}`,...t.length===0?[n]:t,""]}function Ms(e){let t=e.blockers.map(n=>`${n.id}(${n.status??"?"})`).join(", ");return`${Te(e)} blocked_by:${t}`}function Te(e){let t=e.deadline??"-",n=e.parent?` parent:${e.parent}`:"",r=e.unblocks.length>0?` unblocks:${e.unblocks.length}`:"";return`${Number.isInteger(e.rank)?`#${e.rank} `:""}${e.id} p${e.priority} ${e.status} ${e.type} deadline:${t}${n}${r} ${e.title}`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="412fc2d2-daee-5d87-82ab-5411a1503087")}catch{}})();function lc(e,t){let n=t??{};return e.filter(r=>n[r.id]!==r.updated_at).map(r=>r.id).sort((r,o)=>r.localeCompare(o))}export{pe as a,Lt as b,Un as c,Ut as d,Us as e,Le as f,Pt as g,zt as h,Zs as i,Qs as j,ea as k,Qt as l,qe as m,we as n,Jr as o,nn as p,no as q,ke as r,ro as s,oo as t,co as u,uo as v,ia as w,lo as x,rn as y,I as z,be as A,fa as B,ma as C,ve as D,Ye as E,Ve as F,Ro as G,Lo as H,Ke as I,Je as J,Se as K,gn as L,ba as M,Wo as N,Yo as O,_n as P,ti as Q,wn as R,ni as S,Na as T,ri as U,ui as V,ee as W,qa as X,et as Y,mi as Z,pi as _,nt as $,U as aa,ot as ba,it as ca,st as da,q as ea,oe as fa,xe as ga,Ya as ha,fs as ia,Va as ja,hs as ka,sc as la,ac as ma,bs as na,cc as oa,dc as pa,lc as qa};
13
- //# sourceMappingURL=chunk-XPOQQJTX.js.map
@@ -1,2 +0,0 @@
1
- import{a as _}from"./chunk-ZFBWCKYF.js";import{Ia as I}from"./chunk-RUAU5OSH.js";import{A as d,C as m,Re as E,bb as k,ud as T,vd as g}from"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d82065d1-488d-523e-9df2-a30056f29603")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5810cf1d-fc9a-597b-a47e-a914009fadfa")}catch{}})();function he(e){return e instanceof m||e instanceof Error?e.message:"Unknown failure"}function V(e){if(typeof e!="object"||e===null||!("exitCode"in e))return;let t=e.exitCode;return typeof t=="number"&&Number.isFinite(t)?t:void 0}function P(e){let t=Math.trunc(e);return t>d.SUCCESS?t:d.GENERIC_FAILURE}function me(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("commander.")}function ge(e,t){if(e instanceof Error)return e;let n=new Error(t),o=V(e);return o!==void 0&&(n.exitCode=P(o)),n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="212ba734-6a06-576f-8ad8-de759727cd75")}catch{}})();var p=new Set(["--pm-path","--path","--author","--output-include","--output-limit","--output-budget","--output-format"]),N=new Set(["--output-include","--output-limit","--output-budget","--output-format"]),A=e=>{let t=e.indexOf("=");return t>0&&p.has(e.slice(0,t))},w=(e,t)=>typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-"),x=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting"]);function B(e,t,n){let o=e[t];if(x.has(o))return n.booleanFlags.add(o),1;let i=o.indexOf("="),s=i>0?o.slice(0,i):o;if(!p.has(s))return 1;let r=i>0?o.slice(i+1):void 0,a=r===void 0&&w(s,e[t+1]),u=r??(a?e[t+1]:void 0);return s==="--author"?n.author=u??"":typeof u=="string"&&u.length>0&&(N.has(s)?n.outputValues:n.pathValues).set(s,u),a?2:1}function D(e){let t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map},n=0;for(;n<e.length&&e[n]!=="--";)n+=B(e,n,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions"),noPager:t.booleanFlags.has("--no-pager"),json:t.booleanFlags.has("--json"),quiet:t.booleanFlags.has("--quiet"),lean:t.booleanFlags.has("--lean"),tokenAccounting:t.booleanFlags.has("--token-accounting"),...t.outputValues.get("--output-include")===void 0?{}:{outputInclude:t.outputValues.get("--output-include")},...t.outputValues.get("--output-limit")===void 0?{}:{outputLimit:t.outputValues.get("--output-limit")},...t.outputValues.get("--output-budget")===void 0?{}:{outputBudget:t.outputValues.get("--output-budget")},...t.outputValues.get("--output-format")==="toon"||t.outputValues.get("--output-format")==="json"?{outputFormat:t.outputValues.get("--output-format")}:{},...t.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function L(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="--")break;if(x.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(p.has(o)){n+=w(o,e[n+1])?2:1;continue}if(A(o)){n+=1;continue}t.push(o),n+=1}return t}function z(e){let t=L(e);if(t[0]?.trim().toLowerCase()==="help"){let s=[];for(let r=1;r<t.length;r+=1){let a=t[r];if(a.startsWith("-"))break;s.push(a.trim().toLowerCase())}return{requested:!0,commandPathTokens:s}}if(t.findIndex(s=>s==="--help"||s==="-h")<0)return{requested:!1,commandPathTokens:[]};let i=[];for(let s of t){if(s.startsWith("-"))break;i.push(s.trim().toLowerCase())}return{requested:!0,commandPathTokens:i}}function b(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")return;if(p.has(n)){t+=w(n,e[t+1])?1:0;continue}if(!(A(n)||x.has(n)||n==="--profile"||n==="--id-only"||n==="--explain")&&!n.startsWith("-"))return t}}function G(e){let t=b(e);return t===void 0?void 0:e[t].trim().toLowerCase()}function $(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:z(e).requested}function xe(e){let t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(s=>process.env[s]),o=()=>{for(let[s,r]of t.entries()){let a=n[s];a===void 0?delete process.env[r]:process.env[r]=a}},i=D(e);return $(e,i)&&(process.env.PAGER="cat",process.env.MANPAGER="cat",process.env.GIT_PAGER="cat",(typeof process.env.LESS!="string"||process.env.LESS.trim().length===0)&&(process.env.LESS="FRX")),o}var v=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function M(e){let t=b(e);if(t===void 0||e[t]!=="extension")return[...e];let n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!v.has(n))return[...e];if(e.includes("--help")||e.includes("-h"))return[...e];let o=`--${n}`;return e.includes(o)?[...e]:[...e.slice(0,t+1),o,...e.slice(t+2)]}var R=new Set(["pm","pm-cli"]);function W(e,t){let n=b(e);if(n===void 0)return e;let o=e[n];return R.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function q(e,t){let n=b(e);if(n===void 0)return e;let o=e[n],i=_[o.trim().toLowerCase()];if(!i)return e;let s=[...e];return s[n]=i,t.push({from:o,to:[i],reason:"command_alias",confidence:"high"}),s}function y(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function C(e){return y(e).replace(/-/g,"")}function S(e,t,n){let o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function U(e){let t=[],n=o=>{typeof o=="string"&&o.startsWith("--")&&t.push(o)};n(e.flag);for(let o of e.aliases??[])n(o);return t}function j(e,t){let n=t??I(e),o=new Map,i=new Map,s=new Map,r=new Set;for(let a of n){let u=U(a);if(u.length===0)continue;let l=`--${y(u[0])}`;for(let c of u)S(o,y(c),l),S(i,C(c),l);let f=C(l);s.has(l)||s.set(l,f),a.list===!0&&r.add(l)}return{canonicalByNormalized:o,canonicalByCompact:i,canonicalComparables:[...s.entries()].map(([a,u])=>({canonicalFlag:a,comparable:u})),listCanonicalFlags:r}}function F(e,t){let n=y(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};let i=n.replace(/-/g,""),s=t.canonicalByCompact.get(i);if(typeof s=="string")return{flag:s,reason:"flag_alias",confidence:"high"};let r=i.length>=8?2:1,a=Number.POSITIVE_INFINITY,u,l=!1;for(let f of t.canonicalComparables){let c=k(i,f.comparable,r);if(c!==null){if(c<a){a=c,u=f.canonicalFlag,l=!1;continue}c===a&&u!==f.canonicalFlag&&(l=!0)}}return!u||l||!Number.isFinite(a)||a<=0?null:{flag:u,reason:"flag_typo",confidence:a>=2?"medium":"high"}}function ke(e){let t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function K(e,t=!1){if(t||e.includes("://"))return null;let n=e.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!n)return null;let o=n[1],i=n[3];return i.length===0?null:{key:o,value:i}}function X(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};let o=e.indexOf("="),i=o>=0?e.slice(0,o):e,s=o>=0?e.slice(o+1):void 0,r=F(i,t);if(!r)return{tokens:[e]};let a=s===void 0?r.flag:`${r.flag}=${s}`;return a===e?{tokens:[e]}:{tokens:[a],event:{from:e,to:[a],reason:r.reason,confidence:r.confidence}}}function Y(e){let t=new Set,n=!1;for(let o=0;o<e.length;o+=1){if(n){t.add(o),n=!1;continue}let i=e[o];n=i==="--path"||i==="--pm-path"}return t}function Z(e){if(!e.startsWith("--"))return null;let t=e.indexOf("=");return t<0?{flag:e}:{flag:e.slice(0,t),inlineValue:e.slice(t+1)}}function H(e,t,n){n.push(e[t]);let o=e[t+1];return typeof o=="string"&&o!=="--"?(n.push(o),t+2):t+1}function J(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};let i=[],s=t+1;for(;s<e.length&&e[s]!=="--"&&!e[s].startsWith("-")&&(i.length===0||o.has(n.flag));)i.push(e[s]),s+=1;let r=i.length===0?1:1+i.length;return{originalTokens:e.slice(t,t+r),value:i.length===0?void 0:i.join(","),consumed:r}}function Q(e,t,n,o){let i=e.get(n);if(i){i.values.push(o.value),i.occurrences+=1;return}e.set(n,{outputIndex:t.length,originalTokens:o.originalTokens,values:[o.value],occurrences:1}),t.push(null)}function ee(e,t){let n=[],o=[];for(let[i,s]of e){if(!(s.occurrences>=2||t.has(i)&&s.originalTokens.length>2)){o.push({outputIndex:s.outputIndex,tokens:s.originalTokens});continue}let a=`${i}=${s.values.join(",")}`;o.push({outputIndex:s.outputIndex,tokens:[a]}),n.push({from:`${i} (x${s.occurrences})`,to:[a],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function te(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(let n of t)e.splice(n.outputIndex,1,...n.tokens)}function ne(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};let i=[],s=new Map,r=0;for(;r<e.length;){let l=e[r];if(l==="--"){i.push(...e.slice(r));break}if(n.has(l)){r=H(e,r,i);continue}let f=Z(l);if(!f||!t.has(f.flag)){i.push(l),r+=1;continue}let c=J(e,r,f,o);if(c.value===void 0){i.push(l),r+=c.consumed;continue}Q(s,i,f.flag,{originalTokens:c.originalTokens,value:c.value}),r+=c.consumed}let{events:a,splices:u}=ee(s,o);return te(i,u),{argv:i,events:a}}var O=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function oe(e,t){if(e!=="test"||t.length<2)return!1;let n=t[t.length-1],o=t[t.length-2],i=O.get(o);return i!==void 0&&i.has(n)}function ie(e,t){return e==="search"||oe(e,t)}function se(e,t,n){if(t!=="test")return e;let o=[],i=0;for(;i<e.length;){let s=e[i];if(s==="--")return o.push(...e.slice(i)),o;let r=O.get(s),a=r?e[i+1]:void 0;if(!r||typeof a!="string"||!r.has(a)){o.push(s),i+=1;continue}let u=i+2;for(;u<e.length&&!e[u].startsWith("-");)u+=1;if(u-(i+2)!==1){o.push(s),i+=1;continue}let l=e[i+2],f=`${a}=${l}`;o.push(s,f),n.push({from:`${s} ${a} ${l}`,to:[s,f],reason:"bare_key_value",confidence:"high"}),i+=3}return o}function re(e,t,n,o){let i=[],s=Y(e);for(let r=0;r<e.length;r+=1){let a=e[r];if(a==="--"){i.push(...e.slice(r));break}let u=s.has(r),l=i[i.length-1];if(a.startsWith("--")){let c=X(a,t,u);i.push(...c.tokens),c.event&&o.push(c.event);continue}let f=K(a,u);if(f&&!(typeof l=="string"&&l.startsWith("-"))&&!ie(n,i)){let c=F(f.key,t);if(c){let h=[c.flag,f.value];i.push(...h),o.push({from:a,to:h,reason:"bare_key_value",confidence:c.confidence});continue}}i.push(a)}return i}function Te(e){let t=[],n=W(e,t),o=M(n);(o.length!==n.length||o.some((c,h)=>c!==n[h]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});let i=q(o,t),s=G(i),r=ae(i),a=j(r??s),u=re(i,a,s,t),l=se(u,s,t),f=ne(l,a.listCanonicalFlags,p,s==="create"?new Set(["--tags"]):new Set);for(let c of f.events)t.push(c);return{argv:f.argv,commandName:s,trace:t}}function ae(e){let t=L(e),n=t[0]?.trim().toLowerCase(),o=t[1]?.trim().toLowerCase();return(n==="extension"||n==="package"||n==="packages")&&typeof o=="string"&&o.length>0&&!o.startsWith("-")?`${n} ${o}`:n}function Ee(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--type"){let o=e[t+1];if(typeof o=="string"&&o.trim().length>0)return o.trim();continue}if(n.startsWith("--type=")){let o=n.slice(7).trim();if(o.length>0)return o}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8f7cca3d-9b19-53b4-a510-5290aaf75e12")}catch{}})();function Ae(e){if(e===void 0)return()=>{};let t=e.trim();if(t.length===0)throw new m("--author requires a non-empty value.",d.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});let n=T();g(t);let o=!1;return()=>{o||(o=!0,n===void 0?g(void 0):g(n))}}import{Command as ue}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="26c939a0-e02d-5998-95e3-a4c26c3b47bd")}catch{}})();function Ve(e){return new ue().name("pm").description("Universal, flexible, extensible, agent-optimized project management CLI for any project or programming language.").version(e).showHelpAfterError(!1).allowExcessArguments(!1).allowUnknownOption(!1).configureOutput({writeOut:t=>{E(t)},writeErr:()=>{}}).option("--json","Output JSON instead of TOON; mutations emit a flat receipt with top-level id/status/changed_field_count while reads use documented entity or collection envelopes").option("--lean","Omit null and empty containers from JSON output").option("--token-accounting","Attach a bounded per-section token-cost receipt to command output").option("--output-include <fields>","Retain comma-separated fields or sections in read output").option("--output-limit <count>","Bound rows in read output").option("--output-budget <tokens>","Bound estimated tokens in read output").option("--output-format <toon|json>","Select the read-output encoding").option("--quiet","Suppress stdout output").option("--no-changed-fields","Omit the changed_fields array from mutation output (keeps changed_field_count)").option("--full-changed-fields","Restore the legacy full mutation envelope and changed_fields array").option("--id-only","Print only id and status for single-item mutation output").option("--pm-path <dir>","Explicit tracker storage path for this command (preferred over --path)").option("--path <dir>","Backward-compatible alias for --pm-path; this is the tracker storage path, not a workspace cwd").option("--no-extensions","Disable extension loading").option("--no-pager","Disable pager integration for help and long output").option("--explain","Render extended rationale and examples in help output").option("--profile","Print deterministic timing diagnostics").option("--author <id>","Override mutation author for this invocation").exitOverride()}export{he as a,V as b,P as c,me as d,ge as e,D as f,L as g,z as h,G as i,xe as j,M as k,ke as l,ne as m,se as n,Te as o,Ee as p,Ae as q,Ve as r};
2
- //# sourceMappingURL=chunk-YCCDXBNU.js.map
@@ -1,2 +0,0 @@
1
- import{w as m}from"./chunk-SV3YQ4RY.js";import{Ia as d}from"./chunk-RUAU5OSH.js";import{$d as A,Be as p,be as g}from"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="940f11a8-f40d-5169-ba74-e91920d32c4a")}catch{}})();var C={fetch:"get",read:"get",show:"get",view:"get",comment:"comments",note:"notes",learning:"learnings"};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3b9b9ebe-8d98-5983-8257-b7b77c7e6194")}catch{}})();var f=[{target:"status",keys:["status"]},{target:"type",keys:["type"]},{target:"tag",keys:["tag","tags"]},{target:"priority",keys:["priority"]},{target:"deadlineBefore",keys:["deadlineBefore"]},{target:"deadlineAfter",keys:["deadlineAfter"]},{target:"updatedAfter",keys:["updatedAfter"]},{target:"updatedBefore",keys:["updatedBefore"]},{target:"createdAfter",keys:["createdAfter"]},{target:"createdBefore",keys:["createdBefore"]},{target:"ids",keys:["ids"]},{target:"assignee",keys:["assignee"]},{target:"assigneeFilter",keys:["assigneeFilter","assignee_filter"]},{target:"parent",keys:["parent"]},{target:"sprint",keys:["sprint"]},{target:"release",keys:["release"]},{target:"limit",keys:["limit"]},{target:"offset",keys:["offset"]},{target:"after",keys:["after"]},{target:"fields",keys:["fields"]},{target:"sort",keys:["sort"]},{target:"order",keys:["order"]},{target:"treeDepth",keys:["treeDepth","tree_depth"]}],S=[{target:"mode",keys:["mode"]},{target:"matchMode",keys:["matchMode","match_mode"]},{target:"minScore",keys:["minScore","min_score"]},{target:"semanticWeight",keys:["semanticWeight","semantic_weight"]},{target:"status",keys:["status"]},{target:"type",keys:["type"]},{target:"tag",keys:["tag","tags"]},{target:"priority",keys:["priority"]},{target:"deadlineBefore",keys:["deadlineBefore"]},{target:"deadlineAfter",keys:["deadlineAfter"]},{target:"updatedAfter",keys:["updatedAfter"]},{target:"updatedBefore",keys:["updatedBefore"]},{target:"createdAfter",keys:["createdAfter"]},{target:"createdBefore",keys:["createdBefore"]},{target:"assignee",keys:["assignee"]},{target:"sprint",keys:["sprint"]},{target:"release",keys:["release"]},{target:"parent",keys:["parent"]},{target:"fields",keys:["fields"]},{target:"limit",keys:["limit"]},{target:"after",keys:["after"]}],k=[{target:"view",keys:["view"]},{target:"date",keys:["date"]},{target:"from",keys:["from"]},{target:"to",keys:["to"]},{target:"limit",keys:["limit"]},{target:"type",keys:["type"]},{target:"tag",keys:["tag"]},{target:"priority",keys:["priority"]},{target:"status",keys:["status"]},{target:"assignee",keys:["assignee"]},{target:"assigneeFilter",keys:["assigneeFilter","assignee_filter"]},{target:"sprint",keys:["sprint"]},{target:"release",keys:["release"]},{target:"include",keys:["include"]},{target:"recurrenceLookaheadDays",keys:["recurrenceLookaheadDays","recurrence_lookahead_days"]},{target:"recurrenceLookbackDays",keys:["recurrenceLookbackDays","recurrence_lookback_days"]},{target:"occurrenceLimit",keys:["occurrenceLimit","occurrence_limit"]},{target:"format",keys:["format"]}],v=[{target:"date",keys:["date"]},{target:"from",keys:["from"]},{target:"to",keys:["to"]},{target:"type",keys:["type"]},{target:"tag",keys:["tag"]},{target:"priority",keys:["priority"]},{target:"assignee",keys:["assignee"]},{target:"assigneeFilter",keys:["assigneeFilter","assignee_filter"]},{target:"sprint",keys:["sprint"]},{target:"release",keys:["release"]},{target:"parent",keys:["parent"]},{target:"limit",keys:["limit","maxItems","max_items"]},{target:"after",keys:["after"]},{target:"format",keys:["format"]},{target:"depth",keys:["depth"]},{target:"fields",keys:["fields"]},{target:"activityLimit",keys:["activityLimit","activity_limit"]},{target:"staleThreshold",keys:["staleThreshold","stale_threshold"]},{target:"tokenBudget",keys:["tokenBudget","token_budget"]}],N=[{target:"type",keys:["type"]},{target:"tag",keys:["tag"]},{target:"priority",keys:["priority"]},{target:"assignee",keys:["assignee"]},{target:"assigneeFilter",keys:["assigneeFilter","assignee_filter"]},{target:"sprint",keys:["sprint"]},{target:"release",keys:["release"]},{target:"parent",keys:["parent"]},{target:"limit",keys:["limit"]},{target:"blockedLimit",keys:["blockedLimit","blocked_limit"]},{target:"format",keys:["format"]},{target:"tokenBudget",keys:["tokenBudget","token_budget"]}],R=[{target:"id",keys:["id"]},{target:"op",keys:["op"]},{target:"author",keys:["author"]},{target:"from",keys:["from"]},{target:"to",keys:["to"]},{target:"limit",keys:["limit"]}];function E(e,t){for(let a of t.keys){let o=e[a];if(typeof o=="string")return o}}function b(e,t){for(let a of t.keys)if(Object.hasOwn(e,a))return e[a]}function I(e,t){for(let a of t.keys){let o=e[a];if(Array.isArray(o))return o}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b0f52c3d-091d-51db-a4c1-bb177414dd7f")}catch{}})();var c=[{target:"title",keys:["title"],option:"--title, -t <value>",description:"Item title [required] (or pass title as the first positional argument)"},{target:"id",keys:["id"],option:"--id <value>",description:"Explicit item id (normalized with the configured id_prefix)"},{target:"description",keys:["description"],option:"--description, -d <value>",description:"Item description (allow empty string)"},{target:"type",keys:["type"],option:"--type <value>",description:"Item type (built-ins plus any configured custom types)"},{target:"template",keys:["template"],option:"--template <value>",description:"Apply named create template defaults before explicit flags"},{target:"createMode",keys:["createMode","create_mode"],option:"--create-mode <value>",description:"Create required-option policy mode: strict|progressive",aliasOptions:[{option:"--create_mode <value>",description:"Alias for --create-mode"}]},{target:"schedulePreset",keys:["schedulePreset","schedule_preset"],option:"--schedule-preset <value>",description:"Scheduling preset for Reminder|Meeting|Event: lightweight",aliasOptions:[{option:"--schedule_preset <value>",description:"Alias for --schedule-preset"}]},{target:"status",keys:["status"],option:"--status, -s <value>",description:"Item status"},{target:"closeReason",keys:["closeReason","close_reason"],option:"--close-reason <value>",description:"Close reason when creating directly in a terminal status",aliasOptions:[{option:"--close_reason <value>",description:"Alias for --close-reason"}]},{target:"completedAt",keys:["completedAt","completed_at"],option:"--completed-at <value>",description:"Actual completion time for a terminal imported item",aliasOptions:[{option:"--completed_at <value>",description:"Alias for --completed-at"}]},{target:"priority",keys:["priority"],option:"--priority, -p <value>",description:"Priority 0..4"},{target:"tags",keys:["tags"],option:"--tags <value>",description:"Comma-separated tags"},{target:"addTags",keys:["addTags","add_tags"],option:"--add-tags <value>",description:"Add tags additively on top of --tags (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--add_tags <value>",description:"Alias for --add-tags"}]},{target:"body",keys:["body"],option:"--body, -b <value>",description:"Item markdown body (allow empty string)"},{target:"deadline",keys:["deadline"],option:"--deadline <value>",description:"Deadline (ISO/date string or relative +6h/+1d/+2w/+6m)"},{target:"estimatedMinutes",keys:["estimate","estimatedMinutes","estimated_minutes"],option:"--estimate, --estimated-minutes <value>",description:"Estimated minutes",aliasOptions:[{option:"--estimated_minutes <value>",description:"Alias for --estimated-minutes"}]},{target:"acceptanceCriteria",keys:["acceptanceCriteria","acceptance_criteria","ac"],option:"--acceptance-criteria <value>",description:"Acceptance criteria (repeatable; values join with '; '; allow empty string)",repeatable:!0,aliasOptions:[{option:"--acceptance_criteria <value>",description:"Alias for --acceptance-criteria"},{option:"--ac <value>",description:"Alias for --acceptance-criteria"}]},{target:"definitionOfReady",keys:["definitionOfReady","definition_of_ready"],option:"--definition-of-ready <value>",description:"Definition of ready (allow empty string)",aliasOptions:[{option:"--definition_of_ready <value>",description:"Alias for --definition-of-ready"}]},{target:"order",keys:["order"],option:"--order <value>",description:"Planning order/rank integer"},{target:"rank",keys:["rank"],option:"--rank <value>",description:"Alias for --order"},{target:"goal",keys:["goal"],option:"--goal <value>",description:"Goal identifier"},{target:"objective",keys:["objective"],option:"--objective <value>",description:"Objective identifier"},{target:"value",keys:["value"],option:"--value <value>",description:"Business value summary"},{target:"impact",keys:["impact"],option:"--impact <value>",description:"Business impact summary"},{target:"outcome",keys:["outcome"],option:"--outcome <value>",description:"Expected outcome summary"},{target:"whyNow",keys:["whyNow","why_now"],option:"--why-now <value>",description:"Why-now rationale",aliasOptions:[{option:"--why_now <value>",description:"Alias for --why-now"}]},{target:"author",keys:["author"],option:"--author <value>",description:"Mutation author"},{target:"message",keys:["message"],option:"--message <value>",description:"History message (allow empty string)"},{target:"assignee",keys:["assignee"],option:"--assignee <value>",description:"Item assignee"},{target:"parent",keys:["parent"],option:"--parent <value>",description:"Parent item ID"},{target:"allowMissingParent",keys:["allowMissingParent","allow_missing_parent"],option:"--allow-missing-parent",description:"Allow creating with an unresolved parent reference and emit a validation warning"},{target:"reviewer",keys:["reviewer"],option:"--reviewer <value>",description:"Reviewer"},{target:"risk",keys:["risk"],option:"--risk <value>",description:"Risk level: low|med|medium|high|critical (med persists as medium)"},{target:"confidence",keys:["confidence"],option:"--confidence <value>",description:"Confidence level: 0..100|low|med|medium|high (med persists as medium)"},{target:"sprint",keys:["sprint"],option:"--sprint <value>",description:"Sprint identifier"},{target:"release",keys:["release"],option:"--release <value>",description:"Release identifier"},{target:"blockedBy",keys:["blockedBy","blocked_by"],option:"--blocked-by <value>",description:"Set latest blocked-by item ID or reason; resolved item IDs append a blocked_by dependency edge",aliasOptions:[{option:"--blocked_by <value>",description:"Alias for --blocked-by"}]},{target:"blockedReason",keys:["blockedReason","blocked_reason"],option:"--blocked-reason <value>",description:"Blocked reason",aliasOptions:[{option:"--blocked_reason <value>",description:"Alias for --blocked-reason"}]},{target:"unblockNote",keys:["unblockNote","unblock_note"],option:"--unblock-note <value>",description:"Unblock rationale note",aliasOptions:[{option:"--unblock_note <value>",description:"Alias for --unblock-note"}]},{target:"reporter",keys:["reporter"],option:"--reporter <value>",description:"Issue reporter"},{target:"severity",keys:["severity"],option:"--severity <value>",description:"Issue severity: low|med|medium|high|critical (med persists as medium)"},{target:"environment",keys:["environment"],option:"--environment <value>",description:"Issue environment context"},{target:"reproSteps",keys:["reproSteps","repro_steps"],option:"--repro-steps <value>",description:"Issue reproduction steps",aliasOptions:[{option:"--repro_steps <value>",description:"Alias for --repro-steps"}]},{target:"resolution",keys:["resolution"],option:"--resolution <value>",description:"Issue resolution summary"},{target:"expectedResult",keys:["expectedResult","expected_result","expected"],option:"--expected-result <value>",description:"Issue expected behavior",aliasOptions:[{option:"--expected_result <value>",description:"Alias for --expected-result"},{option:"--expected <value>",description:"Short alias for --expected-result"}]},{target:"actualResult",keys:["actualResult","actual_result","actual"],option:"--actual-result <value>",description:"Issue observed behavior",aliasOptions:[{option:"--actual_result <value>",description:"Alias for --actual-result"},{option:"--actual <value>",description:"Short alias for --actual-result"}]},{target:"affectedVersion",keys:["affectedVersion","affected_version"],option:"--affected-version <value>",description:"Affected version identifier",aliasOptions:[{option:"--affected_version <value>",description:"Alias for --affected-version"}]},{target:"fixedVersion",keys:["fixedVersion","fixed_version"],option:"--fixed-version <value>",description:"Fixed version identifier",aliasOptions:[{option:"--fixed_version <value>",description:"Alias for --fixed-version"}]},{target:"component",keys:["component"],option:"--component <value>",description:"Issue component ownership"},{target:"regression",keys:["regression"],option:"--regression [value]",description:"Regression marker; bare flag means true, or pass true|false|1|0"},{target:"customerImpact",keys:["customerImpact","customer_impact"],option:"--customer-impact <value>",description:"Customer impact summary",aliasOptions:[{option:"--customer_impact <value>",description:"Alias for --customer-impact"}]},{target:"dep",keys:["dep"],option:"--dep <value>",description:"Seed dependency entry (key=value CSV, markdown key:value lines, or - for stdin; repeatable)",repeatable:!0},{target:"typeOption",keys:["typeOption","type_option"],option:"--type-option <value>",description:"Type option key=value or key=<name>,value=<value> (also accepts key:value and markdown pairs; use - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--type_option <value>",description:"Alias for --type-option"}]},{target:"field",keys:["field"],option:"--field <name=value>",description:"Set a field declared by an active extension registerItemFields registration (repeatable)",repeatable:!0},{target:"unset",keys:["unset"],option:"--unset <field>",description:"Clear scalar metadata field by name (repeatable)",repeatable:!0},{target:"reminder",keys:["reminder"],option:"--reminder <value>",description:"Seed reminder entry at=<iso|relative>,text=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"event",keys:["event"],option:"--event <value>",description:"Seed event entry start=<iso|relative>,end=<iso|relative>,duration=<relative|30min|PT30M>,title=<text>,all_day=<true|false>,recur_* fields (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"comment",keys:["comment"],option:"--comment <value>",description:"Seed comment entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"note",keys:["note"],option:"--note <value>",description:"Seed note entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"learning",keys:["learning"],option:"--learning <value>",description:"Seed learning entry (text=<value> CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"file",keys:["file"],option:"--file <value>",description:"Seed linked file entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"test",keys:["test"],option:"--test <value>",description:"Seed linked test entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0},{target:"doc",keys:["doc"],option:"--doc <value>",description:"Seed linked doc entry (CSV/markdown pairs or - for stdin; repeatable)",repeatable:!0}],L=c.filter(e=>e.repeatable!==!0).map(e=>({target:e.target,keys:e.keys})),h=c.filter(e=>e.repeatable===!0).map(e=>({target:e.target,keys:e.keys})),u=[{target:"title",keys:["title"],option:"--title, -t <value>",description:"Set title"},{target:"description",keys:["description"],option:"--description, -d <value>",description:"Set description"},{target:"body",keys:["body"],option:"--body, -b <value>",description:"Set body (allow empty string)"},{target:"status",keys:["status"],option:"--status, -s <value>",description:"Set status (use close command for closed)"},{target:"closeReason",keys:["closeReason","close_reason"],option:"--close-reason <value>",description:"Set close reason",aliasOptions:[{option:"--close_reason <value>",description:"Alias for --close-reason"}]},{target:"priority",keys:["priority"],option:"--priority, -p <value>",description:"Set priority"},{target:"type",keys:["type"],option:"--type <value>",description:"Set type"},{target:"tags",keys:["tags"],option:"--tags <value>",description:"Set comma-separated tags (replaces existing). Use --add-tags / --remove-tags to mutate additively."},{target:"addTags",keys:["addTags","add_tags"],option:"--add-tags <value>",description:"Add tags to the existing list without replacing it (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--add_tags <value>",description:"Alias for --add-tags"}]},{target:"removeTags",keys:["removeTags","remove_tags"],option:"--remove-tags <value>",description:"Remove tags from the existing list (repeatable; CSV accepted)",repeatable:!0,aliasOptions:[{option:"--remove_tags <value>",description:"Alias for --remove-tags"}]},{target:"deadline",keys:["deadline"],option:"--deadline <value>",description:"Set deadline (ISO/date string or relative)"},{target:"estimatedMinutes",keys:["estimate","estimatedMinutes","estimated_minutes"],option:"--estimate, --estimated-minutes <value>",description:"Set estimated minutes",aliasOptions:[{option:"--estimated_minutes <value>",description:"Alias for --estimated-minutes"}]},{target:"acceptanceCriteria",keys:["acceptanceCriteria","acceptance_criteria","ac"],option:"--acceptance-criteria <value>",description:"Set acceptance criteria (repeatable; values join with '; ')",repeatable:!0,aliasOptions:[{option:"--acceptance_criteria <value>",description:"Alias for --acceptance-criteria"},{option:"--ac <value>",description:"Alias for --acceptance-criteria"}]},{target:"addAc",keys:["addAc","add_ac"],option:"--add-ac <value>",description:"Add one semicolon-free acceptance criterion without replacing the existing list (repeatable)",repeatable:!0,aliasOptions:[{option:"--add_ac <value>",description:"Alias for --add-ac"}]},{target:"removeAc",keys:["removeAc","remove_ac"],option:"--remove-ac <value>",description:"Remove one semicolon-free acceptance criterion by exact text match (repeatable)",repeatable:!0,aliasOptions:[{option:"--remove_ac <value>",description:"Alias for --remove-ac"}]},{target:"definitionOfReady",keys:["definitionOfReady","definition_of_ready"],option:"--definition-of-ready <value>",description:"Set definition of ready",aliasOptions:[{option:"--definition_of_ready <value>",description:"Alias for --definition-of-ready"}]},{target:"order",keys:["order"],option:"--order <value>",description:"Set planning order/rank integer"},{target:"rank",keys:["rank"],option:"--rank <value>",description:"Alias for --order"},{target:"goal",keys:["goal"],option:"--goal <value>",description:"Set goal identifier"},{target:"objective",keys:["objective"],option:"--objective <value>",description:"Set objective identifier"},{target:"value",keys:["value"],option:"--value <value>",description:"Set business value summary"},{target:"impact",keys:["impact"],option:"--impact <value>",description:"Set business impact summary"},{target:"outcome",keys:["outcome"],option:"--outcome <value>",description:"Set expected outcome summary"},{target:"whyNow",keys:["whyNow","why_now"],option:"--why-now <value>",description:"Set why-now rationale",aliasOptions:[{option:"--why_now <value>",description:"Alias for --why-now"}]},{target:"author",keys:["author"],option:"--author <value>",description:"Mutation author"},{target:"message",keys:["message"],option:"--message <value>",description:"Mutation message"},{target:"assignee",keys:["assignee"],option:"--assignee <value>",description:"Set assignee"},{target:"parent",keys:["parent"],option:"--parent <value>",description:"Set parent item ID"},{target:"allowMissingParent",keys:["allowMissingParent","allow_missing_parent"],option:"--allow-missing-parent",description:"Allow updating to an unresolved parent reference and emit a validation warning"},{target:"completedAt",keys:["completedAt","completed_at"],option:"--completed-at <value>",description:"Correct the actual completion timestamp on a terminal item"},{target:"reviewer",keys:["reviewer"],option:"--reviewer <value>",description:"Set reviewer"},{target:"risk",keys:["risk"],option:"--risk <value>",description:"Set risk level: low|med|medium|high|critical (med persists as medium)"},{target:"confidence",keys:["confidence"],option:"--confidence <value>",description:"Set confidence level: 0..100|low|med|medium|high (med persists as medium)"},{target:"sprint",keys:["sprint"],option:"--sprint <value>",description:"Set sprint identifier"},{target:"release",keys:["release"],option:"--release <value>",description:"Set release identifier"},{target:"blockedBy",keys:["blockedBy","blocked_by"],option:"--blocked-by <value>",description:"Set latest blocked-by item ID or reason; resolved item IDs append a blocked_by dependency edge",aliasOptions:[{option:"--blocked_by <value>",description:"Alias for --blocked-by"}]},{target:"blockedReason",keys:["blockedReason","blocked_reason"],option:"--blocked-reason <value>",description:"Set blocked reason",aliasOptions:[{option:"--blocked_reason <value>",description:"Alias for --blocked-reason"}]},{target:"unblockNote",keys:["unblockNote","unblock_note"],option:"--unblock-note <value>",description:"Set unblock rationale note",aliasOptions:[{option:"--unblock_note <value>",description:"Alias for --unblock-note"}]},{target:"reporter",keys:["reporter"],option:"--reporter <value>",description:"Set issue reporter"},{target:"severity",keys:["severity"],option:"--severity <value>",description:"Set issue severity: low|med|medium|high|critical (med persists as medium)"},{target:"environment",keys:["environment"],option:"--environment <value>",description:"Set issue environment context"},{target:"reproSteps",keys:["reproSteps","repro_steps"],option:"--repro-steps <value>",description:"Set issue reproduction steps",aliasOptions:[{option:"--repro_steps <value>",description:"Alias for --repro-steps"}]},{target:"resolution",keys:["resolution"],option:"--resolution <value>",description:"Set issue resolution summary"},{target:"expectedResult",keys:["expectedResult","expected_result","expected"],option:"--expected-result <value>",description:"Set issue expected behavior",aliasOptions:[{option:"--expected_result <value>",description:"Alias for --expected-result"},{option:"--expected <value>",description:"Short alias for --expected-result"}]},{target:"actualResult",keys:["actualResult","actual_result","actual"],option:"--actual-result <value>",description:"Set issue observed behavior",aliasOptions:[{option:"--actual_result <value>",description:"Alias for --actual-result"},{option:"--actual <value>",description:"Short alias for --actual-result"}]},{target:"affectedVersion",keys:["affectedVersion","affected_version"],option:"--affected-version <value>",description:"Set affected version identifier",aliasOptions:[{option:"--affected_version <value>",description:"Alias for --affected-version"}]},{target:"fixedVersion",keys:["fixedVersion","fixed_version"],option:"--fixed-version <value>",description:"Set fixed version identifier",aliasOptions:[{option:"--fixed_version <value>",description:"Alias for --fixed-version"}]},{target:"component",keys:["component"],option:"--component <value>",description:"Set issue component ownership"},{target:"regression",keys:["regression"],option:"--regression [value]",description:"Set regression marker; bare flag means true, or pass true|false|1|0"},{target:"customerImpact",keys:["customerImpact","customer_impact"],option:"--customer-impact <value>",description:"Set customer impact summary",aliasOptions:[{option:"--customer_impact <value>",description:"Alias for --customer-impact"}]},{target:"dep",keys:["dep"],option:"--dep <value>",description:"Add dependency entries id=<id>,kind=<value>,author=<value>,created_at=<iso|now>,source_kind=<value> (repeatable)",repeatable:!0},{target:"depRemove",keys:["depRemove","dep_remove"],option:"--dep-remove <value>",description:"Remove dependencies by id or id=<id>,kind=<value>,source_kind=<value> selectors (repeatable)",repeatable:!0,aliasOptions:[{option:"--dep_remove <value>",description:"Alias for --dep-remove"}]},{target:"comment",keys:["comment"],option:"--comment <value>",description:"Append comment seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"note",keys:["note"],option:"--note <value>",description:"Append note seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"learning",keys:["learning"],option:"--learning <value>",description:"Append learning seed author=<value>,created_at=<iso|now>,text=<value> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"file",keys:["file"],option:"--file <value>",description:"Append linked file path=<value>,scope=<project|global>,note=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"test",keys:["test"],option:"--test <value>",description:"Append linked test command=<value>,path=<value>,scope=<project|global>,timeout_seconds=<n>,pm_context_mode=<schema|tracker|auto> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"doc",keys:["doc"],option:"--doc <value>",description:"Append linked doc path=<value>,scope=<project|global>,note=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"reminder",keys:["reminder"],option:"--reminder <value>",description:"Set reminders at=<iso|relative>,text=<text> (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"event",keys:["event"],option:"--event <value>",description:"Set events start=<iso|relative>,end=<iso|relative>,duration=<relative|30min|PT30M>,title=<text>,all_day=<true|false>,recur_* fields (also accepts markdown pairs and - for stdin; repeatable)",repeatable:!0},{target:"typeOption",keys:["typeOption","type_option"],option:"--type-option <value>",description:"Set type options key=value or key=<name>,value=<value> (also accepts key:value and markdown pairs; use - for stdin; repeatable)",repeatable:!0,aliasOptions:[{option:"--type_option <value>",description:"Alias for --type-option"}]},{target:"field",keys:["field"],option:"--field <name=value>",description:"Set a field declared by an active extension registerItemFields registration (repeatable)",repeatable:!0},{target:"unset",keys:["unset"],option:"--unset <field>",description:"Clear scalar metadata field by name (repeatable)",repeatable:!0}],P=u.filter(e=>e.repeatable!==!0).map(e=>({target:e.target,keys:e.keys})),M=u.filter(e=>e.repeatable===!0).map(e=>({target:e.target,keys:e.keys}));(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5f5b9bd3-1b92-5fb2-b649-6eb942a7a3c4")}catch{}})();var w=new Set(["--author","--follow","--help","--lean","--token-accounting","--output-include","--output-limit","--output-budget","--output-format","--no-changed-fields","--no-extensions","--no-pager","--pm-path","--profile","--quiet","--interval-ms"]),F=new Set(A),G=new Set(["--brief","--format","--full","--full-changed-fields","--id-only","--no-truncate","--stream"]),D=new Set(["--body-file","--file","--stdin-json"]),x=new Set(["--global","--local","--project"]),U=new Set(["--activity-limit","--default-depth","--section-activity","--section-blockers","--section-files","--section-hierarchy","--section-progress","--section-staleness","--section-tests","--section-workload","--stale-threshold-days"]),B=new Set(["action","path","pmExecutable","timeoutMs"]),V=new Set(["configAction","id","name","query","reason","subcommand","target","text"]),X={event:{title:"<title>"},files:{lookupPath:"lookup <path...>"},meet:{title:"<title>"},merge:{subcommand:"<subcommand>"},remind:{title:"<title>"},workspace:{name:"<name>",subcommand:"snapshot",snapshotAction:"<snapshot-action>",target:"<target>"}},H={init:{"--id-prefix":"idPrefix","--no-merge-fence":"mergeFence","--workspace":"workspace"},create:{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},update:{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},"update-many":{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},files:{"--note":"addNote"},docs:{"--note":"addNote"},notes:{"--file":"text"},gc:{"--scope":"gcScope"},contracts:{"--action":"contractAction"},schema:{"--no-allow-unset":"allowUnset","--type":"fieldTypeScope"},"history-author-acknowledge":{"--event":"historyEvent","--all-actionable":"allActionable"},"extension-init":{"--capability":"capability"},"package-init":{"--capability":"capability"},"extension-install":{"--gh":"github"},"package-install":{"--gh":"github"},"extension-adopt":{"--gh":"github"},"package-adopt":{"--gh":"github"},extension:{"--gh":"github","--scaffold":"init"},package:{"--gh":"github","--scaffold":"init"},install:{"--gh":"github"}};function K(e){return e.startsWith("extension-")?`extension ${e.slice(10)}`:e.startsWith("package-")?`package ${e.slice(8)}`:e}function y(e,t){let a=H[e]?.[t];return a!==void 0?a:t.replace(/^--/,"").replaceAll("_","-").replace(/-([a-z])/g,(o,i)=>i.toUpperCase())}function Y(e){let t=new Set;return e.filter(({flag:a})=>!a.startsWith("--")||t.has(a)?!1:(t.add(a),!0))}function j(e,t){return t.find(({aliases:a})=>a?.includes(e))?.flag}function W(e,t,a,o){let i=y(e,t.flag);if(o.has(i))return{surface:"cli",input:t.flag,counterpart:i,disposition:"shared",reason:"The CLI flag maps directly to a strict SDK action parameter."};let n=j(t.flag,a);if(n!==void 0){let r=y(e,n);if(o.has(r))return{surface:"cli",input:t.flag,counterpart:r,disposition:"compatibility_alias",reason:`Compatibility spelling for ${n}.`}}return w.has(t.flag)?{surface:"cli",input:t.flag,disposition:"cli_transport",reason:"CLI process transport is supplied by the in-process SDK host."}:G.has(t.flag)?{surface:"cli",input:t.flag,disposition:"cli_presentation",reason:"CLI rendering or mutation projection does not alter the SDK result envelope."}:D.has(t.flag)?{surface:"cli",input:t.flag,disposition:"cli_adapter",reason:"Local file or stdin adaptation is a CLI boundary concern."}:U.has(t.flag)?{surface:"cli",input:t.flag,counterpart:"key",disposition:"compatibility_alias",reason:"CLI config shorthand normalizes to the SDK configAction/key/value contract."}:x.has(t.flag)?{surface:"cli",input:t.flag,counterpart:"scope",disposition:"cli_scope_selector",reason:"Mutually exclusive CLI scope switches normalize to the SDK scope parameter."}:{surface:"cli",input:t.flag,counterpart:i,disposition:"unclassified",reason:"The CLI flag has no strict SDK parameter or approved boundary classification."}}function z(e,t,a){let o=a.find(({counterpart:n,disposition:r})=>n===t&&(r==="shared"||r==="compatibility_alias"||r==="cli_scope_selector"));if(o!==void 0)return{surface:"sdk",input:t,counterpart:o.input,disposition:"shared",reason:"The strict SDK parameter is reachable from the CLI contract."};let i=X[e]?.[t];return i!==void 0?{surface:"sdk",input:t,counterpart:i,disposition:"shared",reason:"The strict SDK parameter maps to a canonical CLI positional argument."}:B.has(t)?{surface:"sdk",input:t,disposition:"sdk_transport",reason:"The SDK host supplies in-process transport and workspace selection."}:V.has(t)?{surface:"sdk",input:t,disposition:"cli_positional",reason:"The CLI accepts this SDK parameter as a positional command argument."}:{surface:"sdk",input:t,disposition:"sdk_native",reason:"The typed SDK exposes this structured input without a canonical CLI long flag."}}function q(e={}){let t=e.actions??p,a=e.resolveFlags??d,o=e.resolveParameters??m;return t.map(i=>{let n=K(i),r=Y(a(n)).filter(({flag:s})=>g(i)!==void 0||!F.has(s)),_=new Set(o(i)??[]),l=r.map(s=>W(i,s,r,_)),T=[..._].sort((s,O)=>s.localeCompare(O)).map(s=>z(i,s,l));return{action:i,command:n,cli:l,sdk:T,unclassified:[...l,...T].filter(({disposition:s})=>s==="unclassified")}})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8071fd9d-649a-5fce-b342-84b11066d559")}catch{}})();export{C as a,f as b,S as c,k as d,v as e,N as f,R as g,E as h,b as i,I as j,c as k,L as l,h as m,u as n,P as o,M as p,q};
2
- //# sourceMappingURL=chunk-ZFBWCKYF.js.map
@@ -1,2 +0,0 @@
1
- import"./chunk-BXCSXK4J.js";import{a,b,c}from"./chunk-TPKDJ5WL.js";import"./chunk-JC6FKIFM.js";import"./chunk-L6LGKJX3.js";import"./chunk-5ZKQPA44.js";import"./chunk-MDTH7SAE.js";import"./chunk-4OVGQW22.js";import"./chunk-RSIC5OPE.js";import"./chunk-M4VEE3FK.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.js";import"./chunk-UVVXHGYS.js";import"./chunk-HS7OVAUN.js";export{a as _testOnlyCloseCommand,b as closeItem,c as runClose};
2
- //# sourceMappingURL=close-DI66JMSB.js.map
@@ -1,2 +0,0 @@
1
- import{a as o,b as d}from"./chunk-M357ZCOR.js";import"./chunk-OXY3SJ3N.js";import"./chunk-TPKDJ5WL.js";import"./chunk-JC6FKIFM.js";import"./chunk-FB7G2HY2.js";import"./chunk-3KFVGGRE.js";import"./chunk-CA3BURYF.js";import"./chunk-QJ7C3JIW.js";import"./chunk-C3YABSJK.js";import"./chunk-L6LGKJX3.js";import"./chunk-RUAU5OSH.js";import"./chunk-5ZKQPA44.js";import"./chunk-E2ZSLTOP.js";import"./chunk-MDTH7SAE.js";import"./chunk-4OVGQW22.js";import"./chunk-RSIC5OPE.js";import"./chunk-M4VEE3FK.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.js";import"./chunk-UVVXHGYS.js";import"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f439176a-7297-5235-b96a-3e393af8602b")}catch{}})();export{d as _testOnly,o as runCloseMany};
2
- //# sourceMappingURL=close-many-VFKT6U3O.js.map
@@ -1,2 +0,0 @@
1
- import{a as n}from"./chunk-AOBDLU4T.js";import"./chunk-5PBP2ZP3.js";import"./chunk-MDTH7SAE.js";import"./chunk-4OVGQW22.js";import"./chunk-RSIC5OPE.js";import"./chunk-M4VEE3FK.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.js";import"./chunk-UVVXHGYS.js";import"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="2d8a7e66-16e7-552f-b6d8-4cfbfb519a30")}catch{}})();export{n as runComments};
2
- //# sourceMappingURL=comments-E73HIEZJ.js.map
@@ -1,2 +0,0 @@
1
- import{a as d}from"./chunk-JFZIS6JF.js";import"./chunk-DWOAOZHZ.js";import"./chunk-E2ZSLTOP.js";import"./chunk-MDTH7SAE.js";import"./chunk-4OVGQW22.js";import"./chunk-RSIC5OPE.js";import"./chunk-M4VEE3FK.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.js";import"./chunk-UVVXHGYS.js";import"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="51b91e68-4bd6-521d-926e-e3b03f4b4956")}catch{}})();export{d as runCopy};
2
- //# sourceMappingURL=copy-WBYVLCPC.js.map
@@ -1,2 +0,0 @@
1
- import{a as d}from"./chunk-Q3VOP62W.js";import"./chunk-MDTH7SAE.js";import"./chunk-4OVGQW22.js";import"./chunk-RSIC5OPE.js";import"./chunk-M4VEE3FK.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.js";import"./chunk-UVVXHGYS.js";import"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d9bb2d77-9ea1-51f9-a186-a2c222a6fbb3")}catch{}})();export{d as runDelete};
2
- //# sourceMappingURL=delete-6XKUVVQN.js.map
@@ -1,2 +0,0 @@
1
- import{a as d}from"./chunk-JQ4NZ5EB.js";import"./chunk-MDTH7SAE.js";import"./chunk-4OVGQW22.js";import"./chunk-RSIC5OPE.js";import"./chunk-M4VEE3FK.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.js";import"./chunk-UVVXHGYS.js";import"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="13a390ed-dac6-51bc-aeee-17f601e73282")}catch{}})();export{d as runFocus};
2
- //# sourceMappingURL=focus-R2AWS63Y.js.map
@@ -1,2 +0,0 @@
1
- import"./chunk-BXCSXK4J.js";import"./chunk-LEPJJ6QC.js";import{B as N,C as G,D as W,E as J,F as j,H as Y,aa as K,b as C,ba as X,c as O,ca as Q,d as I,ea as Z,f as M,oa as ee,pa as te,q as F,qa as ne,ra as R,w as L,x as H,xa as ae,y as q,z}from"./chunk-V663653R.js";import"./chunk-D7I3TUGV.js";import"./chunk-4AVFKHHC.js";import"./chunk-FDBRXV25.js";import"./chunk-DQGJ2RWT.js";import"./chunk-5PBP2ZP3.js";import{a as x}from"./chunk-AYRUGRNS.js";import"./chunk-SD3YXU2U.js";import"./chunk-3ZJRFYY2.js";import"./chunk-XPOQQJTX.js";import"./chunk-WYRZZ5ZE.js";import{B as p,a as V,e as c,h as g,i as l,j as k,l as $,m as U}from"./chunk-AJE3AHPD.js";import"./chunk-ZFBWCKYF.js";import"./chunk-SV3YQ4RY.js";import"./chunk-BP6EMEDP.js";import"./chunk-DWOAOZHZ.js";import"./chunk-NE5VRDAI.js";import"./chunk-PECV7L5T.js";import{c as P}from"./chunk-TPKDJ5WL.js";import"./chunk-JC6FKIFM.js";import"./chunk-3KFVGGRE.js";import"./chunk-CA3BURYF.js";import"./chunk-QJ7C3JIW.js";import"./chunk-C3YABSJK.js";import"./chunk-L6LGKJX3.js";import"./chunk-RUAU5OSH.js";import"./chunk-5ZKQPA44.js";import"./chunk-E2ZSLTOP.js";import"./chunk-MDTH7SAE.js";import"./chunk-4OVGQW22.js";import"./chunk-RSIC5OPE.js";import"./chunk-M4VEE3FK.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.js";import"./chunk-UVVXHGYS.js";import{A as u,Af as _,C as w,La as D,Nc as S,Te as s,Ue as d,oc as B,zd as T}from"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="eee25545-a7e9-54be-abc0-dbccc9b41e74")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b0095f00-00bd-5b28-933c-b63a1711a73d")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="99355d20-090b-503e-8079-b858291938e3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="35276f20-abc5-54e2-8251-35971f1fcb4f")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8fa4af33-ba9f-5a19-a359-c64143287b5d")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="52c4154e-2761-5230-942c-6ac5e83a830c")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c3fceb32-e0b9-5690-8653-4c699f865c0f")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1e42a508-5568-522f-843d-61febc0bad27")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="43769e60-ed80-521d-9375-c28ee5b0ac06")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3f1deb3b-e341-533a-a349-eca48f347600")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="91a42861-f8cb-575b-8596-53870f6275c6")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c85956ff-383f-5482-96a9-0ef38949859c")}catch{}})();var oe=(e,t)=>L(e,t,{runUpdate:(n,a,o)=>x(n,a,o)});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f8f29a82-44af-5354-9880-335ec177bae3")}catch{}})();function se(e,t){let n=e?.trim().toLowerCase(),a=t?.trim().toLowerCase();if(n===void 0||n.length===0)return a;if(n==="local-analytics")return a&&a.length>0?a:"status";if(a!==void 0&&a.length>0)throw new w(`Unknown pm telemetry path "${e} ${t}". Use "pm telemetry ${e}" or legacy alias "pm telemetry local-analytics ${a}".`,u.USAGE,{code:"unknown_subcommand",examples:["pm telemetry status","pm telemetry flush","pm telemetry stats --limit 10","pm telemetry clear","pm telemetry local-analytics status --json"]});return n}function le(e){return{addValues:Array.isArray(e.add)?e.add:[],addJsonValues:Array.isArray(e.addJson)?e.addJson:[],removeValues:Array.isArray(e.remove)?e.remove:[]}}function ce(e,t){if(e.background===!0){if(e.run!==!0)throw new w("--background requires --run",u.USAGE);if(t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0)throw new w("--background does not support --add/--add-json/--remove; update linked tests first, then run in background",u.USAGE)}}async function de(e,t,n,a){let o=await R({kind:"test",commandArgs:$(e,{...t,add:a.addValues,addJson:a.addJsonValues,remove:a.removeValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:n.noExtensions===!0},n);s(o,n)}function ue(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,list:!!e.list,run:!!e.run,match:typeof e.match=="string"?e.match:void 0,onlyIndex:typeof e.onlyIndex=="string"||typeof e.onlyIndex=="number"?e.onlyIndex:void 0,onlyLast:!!e.onlyLast,timeout:typeof e.timeout=="string"?e.timeout:void 0,progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:typeof e.pmContext=="string"?e.pmContext:void 0,overrideLinkedPmContext:!!e.overrideLinkedPmContext,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext,author:typeof e.author=="string"?e.author:void 0,message:typeof e.message=="string"?e.message:void 0,force:!!e.force,measure:Array.isArray(e.measure)?e.measure:[],metricBelow:typeof e.metricBelow=="string"?e.metricBelow:void 0,metricDiff:typeof e.metricDiff=="string"?e.metricDiff:void 0}}async function me(e,t,n,a){let o=await ee(e,ue(t,a),n);(a.addValues.length>0||a.addJsonValues.length>0||a.removeValues.length>0||t.run===!0)&&await p(n,o),s(o,n),(o.run_results.some(i=>i.status==="failed")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED)}async function fe(e,t,n){let a=c(n),o=Date.now(),i=le(t);ce(t,i),t.background===!0?await de(e,t,a,i):await me(e,t,a,i),a.profile&&d(`profile:command=test took_ms=${Date.now()-o}`)}function A(e){let t=l(e,"author"),n=l(e,"assignee");if(t!==void 0&&n!==void 0&&t!==n)throw new w("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",u.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm start-task pm-123","pm release pm-123"]});return{author:t??n,message:l(e,"message")}}async function pe(e,t){let n=c(t),a=Date.now();if(e.background===!0){let r=await R({kind:"test-all",commandArgs:U(e),statusFilter:l(e,"status"),noExtensions:n.noExtensions===!0},n);s(r,n),n.profile&&d(`profile:command=test-all took_ms=${Date.now()-a}`);return}let i=await te({status:l(e,"status"),limit:l(e,"limit"),offset:l(e,"offset"),timeout:l(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:l(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext},n);await p(n,{ids:i.results.map(r=>r.id)}),s(i,n),(i.failed>0||i.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED),n.profile&&d(`profile:command=test-all took_ms=${Date.now()-a}`)}async function ye(e,t,n,a){let o=c(a),i=Date.now(),r=await Z({subcommand:se(e,t),limit:l(n,"limit")},o);s(r,o),o.profile&&d(`profile:command=telemetry took_ms=${Date.now()-i}`)}async function he(e,t){let n=c(t),a=Date.now(),o=await X(n,{storage:e.storage===!0,metadataCoverage:e.metadataCoverage===!0,byAssignee:e.byAssignee===!0,byTag:e.byTag===!0,byPriority:e.byPriority===!0,tagPrefix:l(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0});s(o,n),n.profile&&d(`profile:command=stats took_ms=${Date.now()-a}`)}async function ge(e,t){let n=c(t),a=Date.now(),o=l(e,"threshold"),i=l(e,"limit"),r=await Q(n,{status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:l(e,"since"),...o===void 0?{}:{threshold:Number(o)},...i===void 0?{}:{limit:Number(i)}});s(r,n),n.profile&&d(`profile:command=duplicates took_ms=${Date.now()-a}`)}async function we(e,t){let n=c(t),a=Date.now(),o=await F(n,{strictDirectories:!!e.strictDirectories,requireMergeDrivers:!!e.requireMergeDrivers,checkOnly:!!e.checkOnly,checkTelemetry:!!e.checkTelemetry,noRefresh:!!e.noRefresh,refreshVectors:!!e.refreshVectors,verboseStaleItems:!!e.verboseStaleItems,verboseAuthorEvents:!!e.verboseAuthorEvents,brief:!!e.brief,summary:!!e.summary,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});s(o,n),(e.strictExit||e.failOnWarn)&&!o.ok&&(B({...o,exit_code:u.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),n.profile&&d(`profile:command=health took_ms=${Date.now()-a}`)}async function ke(e,t){let n=c(t),a=Date.now(),o=await oe({checkMetadata:!!e.checkMetadata,metadataProfile:l(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:l(e,"dependencyCycleSeverity"),parentCycleSeverity:l(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:l(e,"scanMode"),includePmInternals:!!e.includePmInternals,verboseFileLists:!!e.verboseFileLists,verboseDiagnostics:!!e.verboseDiagnostics,allAffectedIds:!!e.allAffectedIds,checkHistoryDrift:!!e.checkHistoryDrift,checkStorageIntegrity:!!e.checkStorageIntegrity,fixHints:!!e.fixHints,autoFix:!!e.autoFix,dryRun:!!e.dryRun,fixScope:Array.isArray(e.fixScope)?e.fixScope:void 0,pruneMissing:!!e.pruneMissing,counts:!!e.counts,full:!!e.full},n);s(o,n),(e.strictExit||e.failOnWarn)&&(o.has_warnings||!o.ok)&&(B({...o,exit_code:u.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),n.profile&&d(`profile:command=validate took_ms=${Date.now()-a}`)}async function be(e,t){let n=c(t),a=Date.now(),o=await M(n,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});s(o,n),n.profile&&d(`profile:command=gc took_ms=${Date.now()-a}`)}async function ve(e,t,n,a){let o=c(a),i=D(process.cwd(),o.path),r=e.trim().toLowerCase();if(!["create","list","inspect","restore","delete"].includes(r))throw new w(`Unknown workspace snapshot action "${e}". Use create, list, inspect, restore, or delete.`,u.USAGE,{code:"unknown_subcommand",examples:["pm workspace snapshot create before-migration","pm workspace snapshot list","pm workspace snapshot restore before-migration"]});if(r==="list"){s(await W(i),o);return}if(r==="create"){s(await N(i,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new w(`pm workspace snapshot ${r} requires a snapshot name or fingerprint`,u.USAGE);if(r==="inspect"){s(await G(i,t),o);return}if(r==="restore"){if(n.dryRun===!0){s(await J(i,t),o);return}let m=await _(i);s(await j(i,t,{force:n.force===!0,author:T(l(n,"author"),m.author_default),message:l(n,"message"),lockTtlSeconds:m.locks.ttl_seconds,lockWaitMs:m.locks.wait_ms}),o);return}s(await Y(i,t),o)}async function xe(e,t){let n=c(t),a=Date.now(),o=await K({action:l(e,"action"),command:l(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},n);s(o,n),n.profile&&d(`profile:command=contracts took_ms=${Date.now()-a}`)}async function Ae(e,t,n){let a=c(n),o=Date.now(),i={...A(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts};De(e,t.next===!0);let r=t.next===!0?await O(!!t.force,a,i,{type:typeof t.type=="string"?t.type:void 0,tag:typeof t.tag=="string"?t.tag:void 0,priority:t.priority,assigneeFilter:typeof t.assigneeFilter=="string"?t.assigneeFilter:void 0,parent:typeof t.parent=="string"?t.parent:void 0,sprint:typeof t.sprint=="string"?t.sprint:void 0,release:typeof t.release=="string"?t.release:void 0,includeDecisions:t.includeDecisions===!0,tokenBudget:t.tokenBudget??t.token_budget,explainRanking:t.explainRanking===!0||t.explain_ranking===!0}):await C(e,!!t.force,a,i);await p(a,r),s(r,a),a.profile&&d(`profile:command=claim took_ms=${Date.now()-o}`)}function De(e,t){if(!t&&!e)throw new w("Specify an item id or pass --next",u.USAGE);if(t&&e)throw new w("Specify either an item id or --next, not both",u.USAGE)}async function _e(e,t,n){let a=c(n),o=Date.now(),i=await I(e,!!t.force,a,{...A(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0});await p(a,i),s(await V("release",[e],t,a,i),a),a.profile&&d(`profile:command=release took_ms=${Date.now()-o}`)}async function Ie(e,t,n){let a=c(n),o=Date.now(),i=D(process.cwd(),a.path),r=await _(i),m=S(r.schema),h=ne(m),y=!!t.force,b=A(t),v=await C(e,y,a,b);await p(a,v);let E=await x(e,{...b,status:h,force:y},a);await p(a,E),s({id:e,action:"start_task",claim:v,update:E},a),a.profile&&d(`profile:command=start-task took_ms=${Date.now()-o}`)}async function Be(e,t,n){let a=c(n),o=Date.now(),i=D(process.cwd(),a.path),r=await _(i),m=S(r.schema),h=!!t.force,y=A(t),b=await x(e,{...y,status:m.open_status,force:h},a);await p(a,b);let v=await I(e,h,a,y);await p(a,v),s({id:e,action:"pause_task",update:b,release:v},a),a.profile&&d(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function Se(e,t,n,a){let o=c(a),i=Date.now(),r=!!n.force,m=A(n),h=await P(e,t,{...m,validateClose:l(n,"validateClose"),force:r},o);await p(o,h);let y=await I(e,r,o,m);await p(o,y),s({id:e,action:"close_task",close:h,release:y},o),o.profile&&d(`profile:command=close-task took_ms=${Date.now()-i}`)}function ie(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds").option("--progress","Emit linked-test progress to stderr (always shown in TTY, opt-in for non-TTY)").option("--env-set <value>","Set environment variable(s) for linked-test runs (KEY=VALUE, repeatable)",g).option("--env-clear <value>","Clear environment variable(s) for linked-test runs (NAME, repeatable)",g).option("--shared-host-safe","Apply additive shared-host-safe runtime defaults for linked-test runs").option("--pm-context <mode>","PM linked-test context mode: schema|tracker|auto (default: schema)").option("--override-linked-pm-context","Force run-level --pm-context to override per-linked-test pm_context_mode metadata").option("--fail-on-context-mismatch","Fail linked PM commands when context item counts differ").option("--fail-on-skipped","Treat skipped linked tests as dependency failures").option("--fail-on-empty-test-run","Treat successful linked-test commands that report zero executed tests as failures").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Preflight linked PM command context diagnostics before executing commands").option("--auto-pm-context","Auto-remediate PM tracker-read context mismatches by routing those linked commands through tracker context")}function bt(e){let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add linked test entry (CSV/markdown pairs or - for stdin)",g).option("--add-json <value>","Add linked test entry from JSON object/array (or - for stdin)",g).option("--remove <value>","Remove linked test entry by command/path (command=<value>, path=<value>, markdown pairs, plain value, or - for stdin)",g).option("--list","List linked tests without mutating").option("--run","Run linked test commands").option("--match <value>","Run only linked tests whose command/path contains this substring").option("--only-index <n>","Run only the 1-based linked-test index from --list order").option("--only-last","Run only the most recently added linked test");ie(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...] evidence; repeatable",g).option("--metric-below <value>","Return evidence below name=value").option("--metric-diff <name>","Diff the latest two values").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage tests linked to an item and optionally run them.").action(fe);let n=e.command("test-all").description("Run linked tests across matching items.").option("--status <value>","Filter items by status before running tests").option("--limit <n>","Limit matching items before running linked tests").option("--offset <n>","Skip matching items before running linked tests");ie(n).action(pe),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(h,y,b)=>{let v=c(b);await ae(h,v)}),e.command("telemetry").argument("[namespaceOrSubcommand]","Telemetry subcommand: status, flush, stats, clear (default: status)").argument("[subcommand]","Compatibility alias target for local-analytics: status, flush, stats, clear").option("--limit <n>","Maximum command groups returned by telemetry stats").description("Inspect and manage local telemetry queue/runtime state.").action(ye),e.command("duplicates").description("Find existing duplicate clusters across all statuses without creating an item.").option("--status <value>","Lifecycle status to include (repeatable or comma-separated)",g,[]).option("--since <value>","Only inspect items created at or after this time").option("--threshold <value>","Minimum similarity score from 0 through 1").option("--limit <n>","Maximum duplicate clusters to return").action(ge),e.command("stats").description("Show project tracker statistics.").option("--storage","Include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries)").option("--metadata-coverage","Include metadata coverage % (acceptance_criteria, estimated_minutes, resolution, tags, parent) overall and by type").option("--by-assignee","Include a lifecycle-bucketed item breakdown grouped by assignee").option("--by-tag","Include a lifecycle-bucketed item breakdown grouped by tag").option("--by-priority","Include a lifecycle-bucketed item breakdown grouped by priority").option("--tag-prefix <value>","With --by-tag: only count tags starting with this prefix (e.g. domain:)").option("--field-utilization","Report content-field utilization rates (notes/learnings/files/docs/tests/comments/deps/body) for governance analysis").action(he),e.command("health").description("Show project tracker health checks.").option("--strict-directories","Treat optional item-type directories as required failures").option("--require-merge-drivers","Treat absent clone-local merge drivers as a required health failure").option("--check-only","Run read-only health diagnostics without refreshing vectors").option("--check-telemetry","Probe telemetry endpoint health and include network diagnostics").option("--no-refresh","Disable automatic vector refresh attempts during health checks").option("--refresh-vectors","Explicitly enable vector refresh attempts during health checks").option("--verbose-stale-items","Include full stale vectorization ID lists in health output").option("--verbose-author-events","Include every actionable unknown-author event coordinate for review or disposition").option("--brief","Emit compact health details for low-token agent checks").option("--summary","Emit one-line-style health status with check names and warning count").option("--skip-vectors","Skip vectorization check for a faster run").option("--skip-integrity","Skip item/history file integrity check for a faster run").option("--skip-drift","Skip history drift hash check for a faster run").option("--full","Run all checks including slow integrity, drift, and vectorization checks").option("--strict-exit","Return non-zero exit when health is not ok (advisory telemetry warnings are excluded; see warnings[])").option("--fail-on-warn","Alias for --strict-exit").action(we),e.command("validate").description("Run standalone metadata, resolution, lifecycle, files, linked-command reference, and history drift validation checks.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Select metadata validation profile for --check-metadata (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-lifecycle","Run active-item lifecycle governance drift checks").option("--check-stale-blockers","Include stale blocker-pattern diagnostics in lifecycle checks").option("--dependency-cycle-severity <value>","Set dependency-cycle warning policy for lifecycle checks (off|warn|error)").option("--parent-cycle-severity <value>","Set parent-hierarchy cycle warning policy for lifecycle checks (off|warn|error)").option("--check-files","Run linked-file and orphaned-file checks").option("--check-command-references","Run linked-command PM-ID reference checks").option("--scan-mode <value>","Select file candidate scan mode for --check-files (default|tracked-all|tracked-all-strict)").option("--include-pm-internals","Include PM storage internals in tracked-all candidate scans").option("--verbose-file-lists","Include full file-path lists for validate --check-files details").option("--verbose-diagnostics","Include full validate diagnostic ID lists instead of compact summaries").option("--all-affected-ids","Emit complete missing_* affected-ID lists with no truncation (implied by --json)").option("--strict-exit","Return non-zero exit when validation warnings are present").option("--fail-on-warn","Alias for --strict-exit").option("--fix-hints","Add a machine-executable fix_hints[] of pm commands to each failing check's details").option("--auto-fix","Apply the safe, deterministic subset of fix-hint remediations (field backfills) automatically").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, lifecycle; comma-separated or repeatable). Default: metadata, resolution; lifecycle must be named explicitly",g).option("--prune-missing","Remove stale linked-file/doc LINKS whose paths classified as deleted (never touches real files)").option("--check-history-drift","Run item/history hash drift checks").option("--check-storage-integrity","Run the post-merge storage-integrity check (unreadable items, history conflict markers, resurrected deletes, unparseable config/schema)").option("--counts","Keep validation counts and totals while omitting per-item diagnostic arrays").option("--full","Return the complete validation diagnostic projection").action(ke),e.command("gc").option("--dry-run","Preview cleanup targets without deleting files; without this flag, pm gc deletes matched artifacts").option("--scope <value>","Limit cleanup to one or more scopes (comma-separated or repeatable): index, embeddings, runtime, locks, checkpoints, transactions",g).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(be),e.command("workspace").description("Manage portable workspace-level SDK primitives.").command("snapshot").argument("<action>","Snapshot action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Create, inspect, list, restore, or delete content-addressed tracker snapshots.").option("--dry-run","Preview restore file, item, stream, and history-entry impact without mutating state").option("--force","Explicitly confirm a whole-workspace snapshot restore").option("--author <value>","Actor recorded on the restore audit event").option("--message <value>","Human-readable restore rationale").action(ve),e.command("contracts").description("Show machine-readable command and schema contracts for agents.").option("--action <value>","Filter tool schema branches to a specific action").option("--command <value>","Scope contracts output to one CLI command (narrow-by-default)").option("--summary","Return one command+intent row per top-level command for cheap agent bootstrap").option("--schema-only","Return schema-focused output only").option("--flags-only","Return command flag contracts only").option("--availability-only","Return action availability surface only").option("--runtime-only","Include only actions invocable in the current runtime").option("--active-only","Alias for --runtime-only").option("--full","Include full schema and command-flag surfaces (large; default brief output omits heavy sections for unfiltered queries)").action(xe);let a=e.command("claim").argument("[id]","Item id (omit with --next)").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force claim override").option("--if-available","Skip silently when the item is already claimed by another author (returns skipped=true)").option("--next","Atomically claim the next caller-available actionable item").option("--type <value>","Filter --next candidates by type").option("--tag <value>","Filter --next candidates by tag").option("--priority <value>","Filter --next candidates by priority").option("--assignee-filter <value>","Filter --next candidates: assigned|unassigned").option("--parent <id>","Scope --next candidates to a subtree").option("--sprint <value>","Filter --next candidates by sprint").option("--release <value>","Filter --next candidates by release").option("--max-attempts <n>","Bound the --next candidate walk (default 10; maximum 100)").option("--include-decisions","Allow --next to claim human-gated Decision items").option("--token-budget <n>","Bound the estimated tokens used to rank --next candidates").option("--explain-ranking","Include ranking provenance for --next selection").description("Claim an item for active work.").action(Ae);k(a,"--assignee <value>","Alias for --author on lifecycle ownership commands"),k(a,"--token_budget <n>","Alias for --token-budget"),k(a,"--explain_ranking","Alias for --explain-ranking");let o=e.command("release").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force release override").description("Release an item's active claim.").action(_e);k(o,"--assignee <value>","Alias for --author on lifecycle ownership commands");let i=e.command("start-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: claim an item and move it to in_progress.").action(Ie);k(i,"--assignee <value>","Alias for --author on lifecycle ownership commands");let r=e.command("pause-task").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override when required").description("Lifecycle alias: move an item to open and release its claim.").action(Be);k(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let m=e.command("close-task").argument("<id>","Item id").argument("[reason]","Close reason text").option("--author <value>","Mutation author").option("--message <value>","History message").option("--validate-close <value>","Close-time validation mode: off|warn|strict").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: close an item and release assignment metadata.").action(Se);k(m,"--assignee <value>","Alias for --author on lifecycle ownership commands"),Ce(e)}function f(e){return typeof e=="string"?e:void 0}function re(e){return{parent:f(e.parent),allowMissingParent:e.allowMissingParent===!0?!0:void 0,tags:f(e.tags),priority:f(e.priority),body:f(e.body),description:f(e.description),author:f(e.author),message:f(e.message)}}function Ce(e){for(let{name:t,describe:n}of[{name:"meet",describe:"Shortcut: create a Meeting with a start time and duration."},{name:"event",describe:"Shortcut: create an Event with a start time and duration."}])e.command(t).argument("<title>","Item title").option("--start <when>","Start time (ISO, 'now', or relative like +1h/+2d); defaults to now").option("--duration <span>","Duration from start (relative like 1h/2d); defaults to 1h when --end is omitted").option("--end <when>","End time (ISO or relative); overrides --duration").option("--location <value>","Location").option("--timezone <value>","IANA timezone (for example America/New_York)").option("--all-day","Mark as an all-day event").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description(n).action(async(a,o,i)=>{let r=c(i),m=Date.now(),y=await(t==="meet"?H:q)(a,{...re(o),start:f(o.start),duration:f(o.duration),end:f(o.end),location:f(o.location),timezone:f(o.timezone),allDay:o.allDay===!0?!0:void 0},r);await p(r,y),s(y,r),r.profile&&d(`profile:command=${t} took_ms=${Date.now()-m}`)});e.command("remind").argument("<title>","Item title").option("--at <when>","Reminder time (ISO, 'now', or relative like +2d); defaults to +1d").option("--text <value>","Reminder text; defaults to the title").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description("Shortcut: create a Reminder from a single point in time.").action(async(t,n,a)=>{let o=c(a),i=Date.now(),r=await z(t,{...re(n),at:f(n.at),text:f(n.text)},o);await p(o,r),s(r,o),o.profile&&d(`profile:command=remind took_ms=${Date.now()-i}`)})}export{bt as registerOperationCommands,De as requireClaimTarget};
2
- //# sourceMappingURL=register-operations-HIBJXRGB.js.map
@@ -1,2 +0,0 @@
1
- import{a as n,b as o}from"./chunk-OXY3SJ3N.js";import"./chunk-CA3BURYF.js";import"./chunk-C3YABSJK.js";import"./chunk-E2ZSLTOP.js";import"./chunk-MDTH7SAE.js";import"./chunk-4OVGQW22.js";import"./chunk-RSIC5OPE.js";import"./chunk-M4VEE3FK.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.js";import"./chunk-UVVXHGYS.js";import"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="bb095de1-0784-5659-9d73-91fd0a033c7d")}catch{}})();export{o as _testOnlyRestoreCommand,n as runRestore};
2
- //# sourceMappingURL=restore-FXA5QPM7.js.map
@@ -1,2 +0,0 @@
1
- import"./chunk-LEPJJ6QC.js";import{a,b}from"./chunk-AYRUGRNS.js";import"./chunk-BP6EMEDP.js";import"./chunk-DWOAOZHZ.js";import"./chunk-NE5VRDAI.js";import"./chunk-PECV7L5T.js";import"./chunk-TPKDJ5WL.js";import"./chunk-JC6FKIFM.js";import"./chunk-L6LGKJX3.js";import"./chunk-5ZKQPA44.js";import"./chunk-E2ZSLTOP.js";import"./chunk-MDTH7SAE.js";import"./chunk-4OVGQW22.js";import"./chunk-RSIC5OPE.js";import"./chunk-M4VEE3FK.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.js";import"./chunk-UVVXHGYS.js";import"./chunk-HS7OVAUN.js";export{b as _testOnlyUpdateCommand,a as runUpdate};
2
- //# sourceMappingURL=update-7GBO4SXG.js.map
@@ -1,2 +0,0 @@
1
- import{a as o,b as d}from"./chunk-GU3TSEHD.js";import"./chunk-AYRUGRNS.js";import"./chunk-BP6EMEDP.js";import"./chunk-DWOAOZHZ.js";import"./chunk-NE5VRDAI.js";import"./chunk-PECV7L5T.js";import"./chunk-OXY3SJ3N.js";import"./chunk-TPKDJ5WL.js";import"./chunk-JC6FKIFM.js";import"./chunk-FB7G2HY2.js";import"./chunk-3KFVGGRE.js";import"./chunk-CA3BURYF.js";import"./chunk-QJ7C3JIW.js";import"./chunk-C3YABSJK.js";import"./chunk-L6LGKJX3.js";import"./chunk-RUAU5OSH.js";import"./chunk-5ZKQPA44.js";import"./chunk-E2ZSLTOP.js";import"./chunk-MDTH7SAE.js";import"./chunk-4OVGQW22.js";import"./chunk-RSIC5OPE.js";import"./chunk-M4VEE3FK.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.js";import"./chunk-UVVXHGYS.js";import"./chunk-HS7OVAUN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},f=new e.Error().stack;f&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[f]="8052e529-7849-58b1-8ff2-94be44af3ca9")}catch{}})();export{d as _testOnlyUpdateManyCommand,o as runUpdateMany};
2
- //# sourceMappingURL=update-many-VF6ZKQUO.js.map