@unbrained/pm-cli 2026.8.6 → 2026.8.8

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 (269) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +65 -0
  3. package/dist/cli/main.js +6 -3
  4. package/dist/cli/register-annotations.d.ts +11 -0
  5. package/dist/cli/register-annotations.js +195 -0
  6. package/dist/cli/register-history-author.js +7 -30
  7. package/dist/cli/register-mutation.js +25 -206
  8. package/dist/cli/register-operations.js +11 -2
  9. package/dist/cli/runtime-compatibility-boundary.d.ts +17 -0
  10. package/dist/cli/runtime-compatibility-boundary.js +43 -0
  11. package/dist/cli/stats-analytics-json.d.ts +9 -0
  12. package/dist/cli/stats-analytics-json.js +69 -0
  13. package/dist/cli-bundle/bundle-manifest.json +156 -692
  14. package/dist/cli-bundle/chunks/chunk-2ZMXX3Q6.js +2068 -0
  15. package/dist/cli-bundle/chunks/chunk-ALDHXLPS.js +3 -0
  16. package/dist/cli-bundle/chunks/chunk-CBLA33YK.js +8 -0
  17. package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +5 -0
  18. package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +2 -0
  19. package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +26 -0
  20. package/dist/cli-bundle/chunks/chunk-NUXRRNAB.js +77 -0
  21. package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +13 -0
  22. package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +194 -0
  23. package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +2 -0
  24. package/dist/cli-bundle/chunks/chunk-SQ7QZFQ6.js +2 -0
  25. package/dist/cli-bundle/chunks/{register-list-query-QH7ONPKU.js → register-list-query-WFZAMJHZ.js} +8 -8
  26. package/dist/cli-bundle/chunks/register-mutation-SOKKOTHQ.js +20 -0
  27. package/dist/cli-bundle/chunks/register-operations-5XQETS6E.js +2 -0
  28. package/dist/cli-bundle/chunks/register-setup-2HL5ZHMK.js +2 -0
  29. package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-N7QN3NE6.js → chunk-5FLBTZJQ.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-YLPZHWX7.js → chunk-ANTMGYLI.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +14 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-EYO4F74Z.js → chunk-DMKOMTTY.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-GSW2Y7VZ.js → chunk-F5B3HBEZ.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-27DK4A5O.js → chunk-FI6DWU2M.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-CL3NB7VW.js → chunk-FNOKJG6N.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-EAXXF2HW.js → chunk-FPDYXZBK.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-XNVXIQ4B.js → chunk-GWI6YIKJ.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-6KDHXURF.js → chunk-HCUC62AB.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-GEYU23YS.js → chunk-HGNKPSCB.js} +22 -22
  42. package/dist/cli-bundle/focused-chunks/chunk-IAS7PMLG.js +2 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-TQMFQYXR.js → chunk-PL2EYDJK.js} +29 -29
  44. package/dist/cli-bundle/focused-chunks/chunk-SM2PJGP3.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-4JC3AOGS.js → chunk-TCSAPH33.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-U646T7Z6.js +18 -0
  47. package/dist/cli-bundle/focused-chunks/chunk-YKPE4PPY.js +2 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-GIERI4YU.js → chunk-YSAHYUXX.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-ZOLDTUU7.js +2 -0
  50. package/dist/cli-bundle/main.js +13 -13
  51. package/dist/cli-bundle/sdk-authoring.js +1 -1
  52. package/dist/cli-bundle/sdk-contracts.js +1 -1
  53. package/dist/cli-bundle/sdk-core.js +38 -37
  54. package/dist/cli-bundle/sdk-governance.js +1 -1
  55. package/dist/cli-bundle/sdk-graph.js +1 -1
  56. package/dist/cli-bundle/sdk-merge.js +1 -1
  57. package/dist/cli-bundle/sdk-query.js +1 -1
  58. package/dist/cli-bundle/sdk-runtime.js +1 -1
  59. package/dist/cli-bundle/sdk-testing.js +1 -1
  60. package/dist/cli-bundle/sdk.js +2 -1
  61. package/dist/cli.js +14 -4
  62. package/dist/core/extensions/reserved-host-flags.js +3 -2
  63. package/dist/core/history/workspace-history.d.ts +22 -2
  64. package/dist/core/history/workspace-history.js +60 -36
  65. package/dist/core/output/output.d.ts +2 -0
  66. package/dist/core/output/output.js +10 -2
  67. package/dist/core/sentry/helpers.d.ts +10 -0
  68. package/dist/core/sentry/helpers.js +59 -4
  69. package/dist/core/shared/command-types.d.ts +2 -0
  70. package/dist/core/shared/command-types.js +2 -2
  71. package/dist/core/shared/constants.d.ts +2 -0
  72. package/dist/core/shared/constants.js +4 -2
  73. package/dist/mcp/tool-definitions.js +6 -2
  74. package/dist/sdk/annotations.d.ts +40 -0
  75. package/dist/sdk/annotations.js +61 -9
  76. package/dist/sdk/author-attribution.d.ts +12 -0
  77. package/dist/sdk/author-attribution.js +87 -9
  78. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  79. package/dist/sdk/cli-bootstrap.js +7 -2
  80. package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +118 -0
  81. package/dist/sdk/cli-contracts/command-exit-contracts.js +152 -0
  82. package/dist/sdk/cli-contracts/completeness.js +54 -5
  83. package/dist/sdk/cli-contracts/flag-contracts.js +6 -2
  84. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  85. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -0
  86. package/dist/sdk/cli-contracts/runtime-contracts.js +41 -8
  87. package/dist/sdk/cli-contracts/tool-parameter-tables.js +129 -10
  88. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  89. package/dist/sdk/cli-contracts/tool-schema.js +22 -3
  90. package/dist/sdk/cli-program.js +3 -2
  91. package/dist/sdk/comments.d.ts +7 -0
  92. package/dist/sdk/comments.js +2 -2
  93. package/dist/sdk/completion.js +12 -5
  94. package/dist/sdk/contracts.d.ts +2 -0
  95. package/dist/sdk/contracts.js +3 -2
  96. package/dist/sdk/core.d.ts +3 -1
  97. package/dist/sdk/core.js +4 -3
  98. package/dist/sdk/environment/host-environment-errors.d.ts +27 -0
  99. package/dist/sdk/environment/host-environment-errors.js +124 -0
  100. package/dist/sdk/environment/project-runtime-compatibility.d.ts +65 -0
  101. package/dist/sdk/environment/project-runtime-compatibility.js +385 -0
  102. package/dist/sdk/environment/source-context.d.ts +23 -0
  103. package/dist/sdk/environment/source-context.js +29 -0
  104. package/dist/sdk/error-code-catalog.d.ts +6 -0
  105. package/dist/sdk/error-code-catalog.js +62 -8
  106. package/dist/sdk/extension.js +9 -11
  107. package/dist/sdk/generated-error-code-catalog.js +739 -3
  108. package/dist/sdk/governance/health.d.ts +11 -3
  109. package/dist/sdk/governance/health.js +5 -5
  110. package/dist/sdk/history-analytics.d.ts +141 -0
  111. package/dist/sdk/history-analytics.js +283 -0
  112. package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
  113. package/dist/sdk/improvement-ledger-validation.js +63 -0
  114. package/dist/sdk/improvement-ledger.d.ts +139 -0
  115. package/dist/sdk/improvement-ledger.js +261 -0
  116. package/dist/sdk/index.d.ts +13 -5
  117. package/dist/sdk/index.js +15 -7
  118. package/dist/sdk/learnings.d.ts +15 -0
  119. package/dist/sdk/learnings.js +2 -2
  120. package/dist/sdk/lifecycle/close-many.d.ts +6 -1
  121. package/dist/sdk/lifecycle/close-many.js +43 -5
  122. package/dist/sdk/lifecycle/plan.js +6 -3
  123. package/dist/sdk/lifecycle/update-many.d.ts +2 -1
  124. package/dist/sdk/lifecycle/update-many.js +29 -5
  125. package/dist/sdk/merge/index.d.ts +1 -1
  126. package/dist/sdk/merge/index.js +3 -3
  127. package/dist/sdk/merge/install.d.ts +21 -0
  128. package/dist/sdk/merge/install.js +58 -20
  129. package/dist/sdk/notes.d.ts +7 -0
  130. package/dist/sdk/notes.js +2 -2
  131. package/dist/sdk/read-output-budget.js +24 -22
  132. package/dist/sdk/read-output-contracts.d.ts +10 -2
  133. package/dist/sdk/read-output-contracts.js +204 -66
  134. package/dist/sdk/read-output-rows.d.ts +29 -0
  135. package/dist/sdk/read-output-rows.js +100 -0
  136. package/dist/sdk/read-output-session.d.ts +69 -0
  137. package/dist/sdk/read-output-session.js +200 -0
  138. package/dist/sdk/runtime-input.d.ts +2 -0
  139. package/dist/sdk/runtime-input.js +14 -2
  140. package/dist/sdk/runtime-primitives.d.ts +1 -1
  141. package/dist/sdk/runtime-primitives.js +3 -3
  142. package/dist/sdk/runtime-stats-options.d.ts +9 -0
  143. package/dist/sdk/runtime-stats-options.js +38 -0
  144. package/dist/sdk/runtime.d.ts +1 -0
  145. package/dist/sdk/runtime.js +13 -50
  146. package/dist/sdk/stats.d.ts +40 -0
  147. package/dist/sdk/stats.js +112 -29
  148. package/dist/sdk/test/execution.js +4 -2
  149. package/dist/sdk/test/parsers.js +5 -2
  150. package/dist/sdk/workspace-snapshot.d.ts +9 -0
  151. package/dist/sdk/workspace-snapshot.js +48 -16
  152. package/docs/AGENT_RUNTIME_PRIMITIVES.md +11 -4
  153. package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
  154. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
  155. package/docs/README.md +2 -0
  156. package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
  157. package/docs/RELEASING.md +27 -2
  158. package/docs/SCRIPTING.md +27 -1
  159. package/docs/SDK_CONTEXT_INTEGRITY.md +66 -0
  160. package/docs/SDK_RUNTIME_BOUNDARIES.md +58 -0
  161. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  162. package/docs/TESTING.md +17 -0
  163. package/marketplace.json +2 -2
  164. package/package.json +6 -4
  165. package/packages/pm-beads/package.json +1 -1
  166. package/packages/pm-calendar/package.json +1 -1
  167. package/packages/pm-command-kit/package.json +1 -1
  168. package/packages/pm-digital-twin/package.json +1 -1
  169. package/packages/pm-governance-audit/package.json +1 -1
  170. package/packages/pm-guide-shell/package.json +1 -1
  171. package/packages/pm-kanban/package.json +1 -1
  172. package/packages/pm-lifecycle-hooks/package.json +1 -1
  173. package/packages/pm-linked-test-adapters/package.json +1 -1
  174. package/packages/pm-search-advanced/package.json +1 -1
  175. package/packages/pm-templates/package.json +1 -1
  176. package/packages/pm-todos/package.json +1 -1
  177. package/packages/pm-vcs/package.json +1 -1
  178. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  179. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  180. package/sdk/public-surface.json +875 -827
  181. package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +0 -2
  182. package/dist/cli-bundle/chunks/chunk-343QETLI.js +0 -2
  183. package/dist/cli-bundle/chunks/chunk-3KFVGGRE.js +0 -2
  184. package/dist/cli-bundle/chunks/chunk-3ZJRFYY2.js +0 -23
  185. package/dist/cli-bundle/chunks/chunk-4AVFKHHC.js +0 -2
  186. package/dist/cli-bundle/chunks/chunk-4OVGQW22.js +0 -2
  187. package/dist/cli-bundle/chunks/chunk-5PBP2ZP3.js +0 -2
  188. package/dist/cli-bundle/chunks/chunk-5ZKQPA44.js +0 -2
  189. package/dist/cli-bundle/chunks/chunk-A3XQ7VPU.js +0 -2
  190. package/dist/cli-bundle/chunks/chunk-A6KGKEWT.js +0 -2
  191. package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +0 -8
  192. package/dist/cli-bundle/chunks/chunk-AOBDLU4T.js +0 -2
  193. package/dist/cli-bundle/chunks/chunk-AYRUGRNS.js +0 -3
  194. package/dist/cli-bundle/chunks/chunk-BP6EMEDP.js +0 -5
  195. package/dist/cli-bundle/chunks/chunk-BXCSXK4J.js +0 -2
  196. package/dist/cli-bundle/chunks/chunk-C3YABSJK.js +0 -2
  197. package/dist/cli-bundle/chunks/chunk-CA3BURYF.js +0 -2
  198. package/dist/cli-bundle/chunks/chunk-CHOQ2VAW.js +0 -2
  199. package/dist/cli-bundle/chunks/chunk-D7I3TUGV.js +0 -2
  200. package/dist/cli-bundle/chunks/chunk-DQGJ2RWT.js +0 -3
  201. package/dist/cli-bundle/chunks/chunk-DWOAOZHZ.js +0 -2
  202. package/dist/cli-bundle/chunks/chunk-E2ZSLTOP.js +0 -2
  203. package/dist/cli-bundle/chunks/chunk-E7BFPLUZ.js +0 -5
  204. package/dist/cli-bundle/chunks/chunk-F4NREH3G.js +0 -2
  205. package/dist/cli-bundle/chunks/chunk-FB7G2HY2.js +0 -2
  206. package/dist/cli-bundle/chunks/chunk-FDBRXV25.js +0 -2
  207. package/dist/cli-bundle/chunks/chunk-GU3TSEHD.js +0 -2
  208. package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +0 -164
  209. package/dist/cli-bundle/chunks/chunk-JC6FKIFM.js +0 -2
  210. package/dist/cli-bundle/chunks/chunk-JFZIS6JF.js +0 -2
  211. package/dist/cli-bundle/chunks/chunk-JQ4NZ5EB.js +0 -2
  212. package/dist/cli-bundle/chunks/chunk-L6LGKJX3.js +0 -2
  213. package/dist/cli-bundle/chunks/chunk-LEPJJ6QC.js +0 -2
  214. package/dist/cli-bundle/chunks/chunk-M357ZCOR.js +0 -2
  215. package/dist/cli-bundle/chunks/chunk-M4VEE3FK.js +0 -2
  216. package/dist/cli-bundle/chunks/chunk-MCS73BKB.js +0 -3
  217. package/dist/cli-bundle/chunks/chunk-MDTH7SAE.js +0 -19
  218. package/dist/cli-bundle/chunks/chunk-NE5VRDAI.js +0 -2
  219. package/dist/cli-bundle/chunks/chunk-OXY3SJ3N.js +0 -2
  220. package/dist/cli-bundle/chunks/chunk-PECV7L5T.js +0 -2
  221. package/dist/cli-bundle/chunks/chunk-Q3VOP62W.js +0 -2
  222. package/dist/cli-bundle/chunks/chunk-QJ7C3JIW.js +0 -2
  223. package/dist/cli-bundle/chunks/chunk-R6LSRGPS.js +0 -8
  224. package/dist/cli-bundle/chunks/chunk-R6RKEYYW.js +0 -2
  225. package/dist/cli-bundle/chunks/chunk-RAFUN7IX.js +0 -2005
  226. package/dist/cli-bundle/chunks/chunk-RSIC5OPE.js +0 -2
  227. package/dist/cli-bundle/chunks/chunk-RUAU5OSH.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-SD3YXU2U.js +0 -56
  229. package/dist/cli-bundle/chunks/chunk-SV3YQ4RY.js +0 -2
  230. package/dist/cli-bundle/chunks/chunk-SVV3DQES.js +0 -2
  231. package/dist/cli-bundle/chunks/chunk-SXECIECW.js +0 -5
  232. package/dist/cli-bundle/chunks/chunk-T45OHXDW.js +0 -8
  233. package/dist/cli-bundle/chunks/chunk-TPKDJ5WL.js +0 -2
  234. package/dist/cli-bundle/chunks/chunk-UVVXHGYS.js +0 -3
  235. package/dist/cli-bundle/chunks/chunk-V663653R.js +0 -20
  236. package/dist/cli-bundle/chunks/chunk-WSI5KZQJ.js +0 -55
  237. package/dist/cli-bundle/chunks/chunk-XPOQQJTX.js +0 -13
  238. package/dist/cli-bundle/chunks/chunk-YCCDXBNU.js +0 -2
  239. package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +0 -2
  240. package/dist/cli-bundle/chunks/close-DI66JMSB.js +0 -2
  241. package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +0 -2
  242. package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +0 -2
  243. package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +0 -2
  244. package/dist/cli-bundle/chunks/create-TG67IVFI.js +0 -2
  245. package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +0 -2
  246. package/dist/cli-bundle/chunks/deps-AJUGP2OH.js +0 -2
  247. package/dist/cli-bundle/chunks/docs-QOCLDRKJ.js +0 -2
  248. package/dist/cli-bundle/chunks/files-3ST5TY64.js +0 -2
  249. package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +0 -2
  250. package/dist/cli-bundle/chunks/history-compact-7BJFML4S.js +0 -2
  251. package/dist/cli-bundle/chunks/history-redact-WJN3HYXR.js +0 -2
  252. package/dist/cli-bundle/chunks/history-repair-XDNZUB7F.js +0 -2
  253. package/dist/cli-bundle/chunks/learnings-SZMUPVNA.js +0 -2
  254. package/dist/cli-bundle/chunks/profile-KL53JIAC.js +0 -2
  255. package/dist/cli-bundle/chunks/register-mutation-OCRQNZK4.js +0 -20
  256. package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +0 -2
  257. package/dist/cli-bundle/chunks/register-setup-QWBQ6HBS.js +0 -2
  258. package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +0 -2
  259. package/dist/cli-bundle/chunks/schema-QJ27OTRV.js +0 -2
  260. package/dist/cli-bundle/chunks/update-7GBO4SXG.js +0 -2
  261. package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +0 -2
  262. package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +0 -2
  263. package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +0 -2
  264. package/dist/cli-bundle/focused-chunks/chunk-7YTZ7A4E.js +0 -2
  265. package/dist/cli-bundle/focused-chunks/chunk-LKQXXO62.js +0 -2
  266. package/dist/cli-bundle/focused-chunks/chunk-MBBMTDD3.js +0 -12
  267. package/dist/cli-bundle/focused-chunks/chunk-ME4XVOBJ.js +0 -8
  268. package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +0 -2
  269. package/dist/cli-bundle/focused-chunks/chunk-YHDCGUIW.js +0 -14
@@ -1,55 +0,0 @@
1
- import{b as x,c as K,d as Ee,e as Se}from"./chunk-CHOQ2VAW.js";import{A as B,K as Te,r as E,s as _e,t as U,u as ke,v as S,w as ve,x as W,y as be}from"./chunk-3ZJRFYY2.js";import{m as he}from"./chunk-ZFBWCKYF.js";import{s as we}from"./chunk-SV3YQ4RY.js";import{a as A}from"./chunk-RSIC5OPE.js";import{c as h,f as ue,g as me,i as M}from"./chunk-UVVXHGYS.js";import{A as f,Af as z,Bf as ge,C as u,H as L,Hc as b,Ic as pe,Jc as de,Kc as T,La as P,Oa as D,R as _,aa as ce,b as I,c as w,lc as le,mf as fe,rf as $,uc as N,xf as ye,zd as j}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]="bed1d1d4-0c1d-59e5-8267-fbe800dfd83b")}catch{}})();var C=["agile","ops","research"],X={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:B.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
2
-
3
- ## I want
4
-
5
- ## So that
6
-
7
- ## Acceptance
8
- - [ ]
9
- `}}],packages:[{spec:"templates",reason:"Reusable create templates for recurring story shapes."},{spec:"calendar",reason:"Sprint and iteration scheduling views."},{spec:"search-advanced",reason:"Richer retrieval as the backlog grows."}]},ops:{name:"ops",title:"Operations",summary:"Incident/Runbook response with mitigation and monitoring stages, severity, and service fields.",types:B.ops,statuses:[{id:"mitigating",roles:["active"],aliases:["mitigation"],description:"Active mitigation is underway to restore service."},{id:"monitoring",roles:["active"],aliases:["observing"],description:"Mitigation applied; monitoring for recurrence before closure."}],fields:[{key:"severity",type:"string",commands:["create","update","list"],description:"Incident severity classification (e.g. sev1, sev2, sev3).",aliases:["sev"]},{key:"service",type:"string",commands:["create","update","list"],description:"Primary affected service or component."}],workflows:[{type:"Incident",allowed_transitions:[["open","mitigating"],["mitigating","monitoring"],["monitoring","mitigating"],["monitoring","closed"],["mitigating","blocked"],["blocked","mitigating"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search for fast incident lookup."},{key:"search_max_results",value:"25",summary:"Wider result cap to surface related incidents and runbooks."}],templates:[{name:"incident",options:{type:"Incident",priority:"1",tags:"incident",acceptanceCriteria:"Service restored, root cause documented, and follow-ups filed.",body:`## Impact
10
-
11
- ## Timeline
12
-
13
- ## Root cause
14
-
15
- ## Mitigation
16
-
17
- ## Follow-ups
18
- `}}],packages:[{spec:"lifecycle-hooks",reason:"Automate transitions and notifications on incident state changes."},{spec:"governance-audit",reason:"Audit incident metadata completeness and closure quality."},{spec:"calendar",reason:"On-call and follow-up scheduling."}]},research:{name:"research",title:"Research",summary:"Experiment/Hypothesis investigation with an analysis stage, hypothesis, and method fields.",types:B.research,statuses:[{id:"analyzing",roles:["active"],aliases:["analysis"],description:"Data collected; analysis and synthesis in progress."}],fields:[{key:"hypothesis",type:"string",commands:["create","update"],description:"The testable claim the experiment evaluates."},{key:"method",type:"string",commands:["create","update","list"],description:"Experimental method or protocol used to evaluate the hypothesis.",aliases:["protocol"]}],workflows:[{type:"Experiment",allowed_transitions:[["open","in_progress"],["in_progress","analyzing"],["analyzing","in_progress"],["analyzing","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search across the research corpus."},{key:"search_max_results",value:"50",summary:"Broader recall cap for literature and prior-experiment discovery."}],templates:[{name:"experiment",options:{type:"Experiment",priority:"2",tags:"experiment",acceptanceCriteria:"Hypothesis is supported, rejected, or refined with recorded evidence.",body:`## Hypothesis
19
-
20
- ## Method
21
-
22
- ## Results
23
-
24
- ## Conclusion
25
- `}}],packages:[{spec:"search-advanced",reason:"Semantic retrieval over experiments and findings."},{spec:"templates",reason:"Consistent experiment and hypothesis scaffolds."},{spec:"beads",reason:"Import structured prior work into the tracker."}]}};function qe(e){if(e===void 0)return;let t=k(e);if(t.length===0)throw new Error("Profile name must not be empty.");if(C.includes(t))return t;throw new Error(`Invalid profile "${e}". Allowed: ${C.join(", ")}.`)}function vt(e){let t=qe(e);if(t===void 0)throw new Error(`Profile name is required. Allowed: ${C.join(", ")}.`);return X[t]}function bt(){return C.map(e=>X[e])}function k(e){return e.trim().toLowerCase().replaceAll("-","_")}function Ie(e){return e.map(t=>t.definition.name).join(", ")}function Q(e=[]){let t=C.map(s=>({definition:X[s],source:"builtin"})),n=new Set(C.map(s=>k(s))),o=new Set(n),i=[];for(let s of e){let r=k(s.profile.name);if(n.has(r)){i.push(`Extension "${s.name}" profile "${s.profile.name}" uses a name reserved by a built-in archetype and was ignored.`);continue}if(o.has(r)){i.push(`Profile "${s.profile.name}" from extension "${s.name}" duplicates an already-registered profile and was ignored.`);continue}o.add(r),t.push({definition:s.profile,source:"extension",package:s.name})}return{profiles:t,warnings:i}}function G(e,t=[]){let{profiles:n,warnings:o}=Q(t);if(typeof e!="string"||e.trim().length===0)throw new Error(`Profile name is required. Allowed: ${Ie(n)}.`);let i=k(e),s=n.find(r=>k(r.definition.name)===i);if(s===void 0)throw new Error(`Invalid profile "${e}". Allowed: ${Ie(n)}.`);return{resolved:s,warnings: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]="933d8f74-c4aa-58d0-bd3b-8932a35d3702")}catch{}})();function ee(e){return{types:e.types.length,statuses:e.statuses.length,fields:e.fields.length,workflows:e.workflows.length,config:e.config.length,templates:e.templates.length,packages:e.packages.length}}function Pe(e){return{name:e.name,title:e.title,summary:e.summary,composition:ee(e),types:e.types.map(t=>V(()=>h(t).name,()=>String(t.name??""))),statuses:e.statuses.map(t=>V(()=>E(t).id,()=>String(t.id??""))),fields:e.fields.map(t=>V(()=>S(t).key,()=>String(t.key??""))),workflows:e.workflows.map(t=>t.type),config:e.config.map(t=>`${t.key}=${t.value}`),templates:e.templates.map(t=>t.name),packages:e.packages.map(t=>({spec:t.spec,reason:t.reason}))}}function V(e,t){try{return e()}catch{return t()}}(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]="f9b22df0-7ec2-5d72-bc88-3eb7201a6051")}catch{}})();var jt=["profile","types","statuses","fields","workflows","config","templates","packages"],Mt=["profile_name_empty","profile_name_not_normalized","profile_title_empty","profile_summary_empty","type_invalid","type_duplicate","status_invalid","status_duplicate","field_invalid","field_duplicate","field_mcp_input_collision","workflow_type_empty","workflow_type_unknown","workflow_duplicate_type","workflow_transition_malformed","workflow_status_unknown","config_key_unknown","config_value_invalid","config_duplicate","template_type_unknown","package_spec_empty"],Je=new Set(pe.flatMap(e=>[A(e.id),...(e.aliases??[]).map(t=>A(t))]).filter(e=>e.length>0)),$e=new Set(ce.map(e=>e.toLowerCase()));function Ye(e,t){e.name.trim().length===0?t.push({severity:"error",code:"profile_name_empty",dimension:"profile",message:"Profile name must not be empty; profile resolution requires a non-blank name."}):e.name!==k(e.name)&&t.push({severity:"warning",code:"profile_name_not_normalized",dimension:"profile",target:e.name,message:`Profile name "${e.name}" is not in canonical form; resolution folds it to "${k(e.name)}" (lowercase, hyphens as underscores).`}),e.title.trim().length===0&&t.push({severity:"warning",code:"profile_title_empty",dimension:"profile",message:"Profile title is empty; list and show surfaces will render a blank title."}),e.summary.trim().length===0&&t.push({severity:"warning",code:"profile_summary_empty",dimension:"profile",message:"Profile summary is empty; list and show surfaces will render a blank archetype description."})}function Ze(e,t){let n=new Set,o=new Set;for(let[i,s]of e.types.entries()){let r;try{r=h(s).name}catch(c){t.push({severity:"error",code:"type_invalid",dimension:"types",target:typeof s.name=="string"?s.name:`#${i}`,message:L(c)});continue}let a=r.toLowerCase();if(o.has(a)){t.push({severity:"error",code:"type_duplicate",dimension:"types",target:r,message:`Item type "${r}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}o.add(a),n.add(a)}return n}function Xe(e,t){let n=new Set,o=new Set;for(let[i,s]of e.statuses.entries()){let r;try{r=E(s)}catch(a){t.push({severity:"error",code:"status_invalid",dimension:"statuses",target:typeof s.id=="string"?s.id:`#${i}`,message:L(a)});continue}if(o.has(r.id)){t.push({severity:"error",code:"status_duplicate",dimension:"statuses",target:r.id,message:`Status "${r.id}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}o.add(r.id),n.add(r.id);for(let a of r.aliases??[])n.add(A(a))}return n}function Qe(e,t){let n=new Set;for(let[o,i]of e.fields.entries()){let s;try{s=S(i).key}catch(a){t.push({severity:"error",code:"field_invalid",dimension:"fields",target:typeof i.key=="string"?i.key:`#${o}`,message:L(a)});continue}if(n.has(s)){t.push({severity:"error",code:"field_duplicate",dimension:"fields",target:s,message:`Field "${s}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}n.add(s);let r=we(s);r&&t.push({severity:"warning",code:"field_mcp_input_collision",dimension:"fields",target:s,message:`Field "${s}" collides with canonical MCP property "${r.property}" owned by ${r.owner}; callers must pass the custom value through ${r.nested_path}.`})}}function Ve(e,t,n,o){let i=new Set;for(let[s,r]of e.workflows.entries()){let a=r.type.trim().toLowerCase();if(a.length===0){o.push({severity:"error",code:"workflow_type_empty",dimension:"workflows",target:`#${s}`,message:"Workflow has an empty type; the workflow resolver drops entries without a type."});continue}let c=i.has(a);i.add(a),c?o.push({severity:"warning",code:"workflow_duplicate_type",dimension:"workflows",target:r.type,message:`Workflow type "${r.type}" is declared more than once; the later transition set wins.`}):!$e.has(a)&&!t.has(a)&&o.push({severity:"warning",code:"workflow_type_unknown",dimension:"workflows",target:r.type,message:`Workflow governs type "${r.type}" which is neither a built-in type nor declared by this profile; it has no effect unless that type already exists.`});let p=new Set;for(let l of r.allowed_transitions){let y=A(l[0]),R=A(l[1]);if(y.length===0||R.length===0){o.push({severity:"error",code:"workflow_transition_malformed",dimension:"workflows",target:r.type,message:`Workflow "${r.type}" has a transition with an empty status; the workflow resolver silently drops it.`});continue}for(let g of[y,R])Je.has(g)||n.has(g)||p.has(g)||(p.add(g),o.push({severity:"warning",code:"workflow_status_unknown",dimension:"workflows",target:g,message:`Workflow "${r.type}" references status "${g}" which is neither a built-in status nor declared by this profile; transitions to or from it are unreachable.`}))}}}function et(e,t){let n=new Set;for(let o of e.config){let i=x(o.key);if(i===void 0){t.push({severity:"error",code:"config_key_unknown",dimension:"config",target:o.key,message:`Config knob "${o.key}" is not a recognized setting; apply rejects it with a usage error.`});continue}n.has(i.key)?t.push({severity:"error",code:"config_duplicate",dimension:"config",target:i.key,message:`Config knob "${i.key}" is set more than once; the later value silently overwrites the earlier one.`}):n.add(i.key);let s=K(i,o.value);s.ok||t.push({severity:"error",code:"config_value_invalid",dimension:"config",target:o.key,message:s.error.message})}}function tt(e,t,n){for(let o of e.templates){let i=o.options.type;if(typeof i!="string"||i.trim().length===0)continue;let s=i.trim().toLowerCase();!$e.has(s)&&!t.has(s)&&n.push({severity:"warning",code:"template_type_unknown",dimension:"templates",target:o.name,message:`Template "${o.name}" creates type "${i}" which is neither a built-in type nor declared by this profile.`})}}function nt(e,t){for(let[n,o]of e.packages.entries())o.spec.trim().length===0&&t.push({severity:"warning",code:"package_spec_empty",dimension:"packages",target:`#${n}`,message:"Package recommendation has an empty spec; it cannot be surfaced as an install hint."})}function Ae(e){let t=[];Ye(e,t);let n=Ze(e,t),o=Xe(e,t);Qe(e,t),Ve(e,n,o,t),et(e,t),tt(e,n,t),nt(e,t);let i=t.filter(r=>r.severity==="error").length,s=t.length-i;return{profile:e.name,ok:i===0,findings:t,errorCount:i,warningCount: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]="ead1caea-8e8b-5208-9fba-23fb114044b5")}catch{}})();function te(e,t,n,o,i){let s=e,r=[];for(let a of t){let c=o(s),p=i(s,a),l=o(p.file);s=p.file;let y=c===l?"unchanged":p.replaced?"update":"add";r.push({key:n(a),status:y})}return{file:s,changes:r,changed:r.some(a=>a.status!=="unchanged")}}function xe(e){return JSON.stringify(e.map(t=>t.join("\0")).sort())}function ot(e,t){let n=e.map(i=>({...i})),o=[];for(let i of t){let s=n.findIndex(a=>a.type===i.type),r={type:i.type,allowed_transitions:i.allowed_transitions};s<0?(n.push(r),o.push({type:i.type,status:"add"})):xe(n[s].allowed_transitions)===xe(i.allowed_transitions)?o.push({type:i.type,status:"unchanged"}):(n[s]=r,o.push({type:i.type,status:"update"}))}return{changes:o,result:n,changed:o.some(i=>i.status!=="unchanged")}}function st(e,t){let n=[];for(let o of e.config){let i=x(o.key);if(i===void 0)throw new Error(`Profile "${e.name}" references unknown config key "${o.key}".`);let s=K(i,o.value);if(!s.ok)throw new Error(`Profile "${e.name}" config ${o.key}: ${s.error.message}`);let r=Ee(t,i),a=r===null?"add":r===s.parsed.value?"unchanged":"update";n.push({key:i.key,path:i.path,value:s.parsed.value,status:a})}return{changes:n,changed:n.some(o=>o.status!=="unchanged")}}function Ce(e){let t=Object.entries(e).sort(([n],[o])=>n.localeCompare(o));return JSON.stringify(t)}function it(e,t){let n=[];for(let o of e.templates){let i=t.get(o.name),s;i===void 0?s="add":Ce(i)===Ce(o.options)?s="unchanged":s="update",n.push({name:o.name,options:o.options,status:s})}return{changes:n,changed:n.some(o=>o.status!=="unchanged")}}function Oe(e,t){let n=te(ue(t.typesRaw),e.types,l=>h(l).name,M,(l,y)=>me(l,h(y))),o=te(_e(t.statusesRaw),e.statuses,l=>E(l).id,U,(l,y)=>ke(l,E(y))),i=te(ve(t.fieldsRaw),e.fields,l=>S(l).key,W,(l,y)=>be(l,S(y))),s=ot(t.workflows,e.workflows),r=st(e,t.settings),a=it(e,t.templates),c=e.packages.map(l=>({spec:l.spec,reason:l.reason,status:t.installedPackages.has(l.spec)?"installed":"recommended"})),p=n.changed||o.changed||i.changed||s.changed||r.changed||a.changed;return{profile:{name:e.name,title:e.title,summary:e.summary},types:n,statuses:o,fields:i,workflows:s,config:r,templates:a,packages:c,changed:p}}import Fe from"node:fs/promises";import Le 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]="f232e106-54f4-572e-8f6e-054f52290267")}catch{}})();var rt="templates",ne=".json",De=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,at=he.map(e=>e.target).filter(e=>e!=="acceptanceCriteria"),ct=new Set(at),Re="1970-01-01T00:00:00.000Z",Ne={bug:{type:"Issue",priority:"1",tags:"bug",acceptanceCriteria:"Bug no longer reproduces with the steps below and a regression test guards it.",expectedResult:"Describe the correct behavior.",actualResult:"Describe the observed (buggy) behavior.",body:`## Repro steps
26
- 1.
27
- 2.
28
- 3.
29
-
30
- ## Expected
31
-
32
- ## Actual
33
- `},feature:{type:"Feature",priority:"2",tags:"feature",acceptanceCriteria:"Feature is shipped behind agreed scope with tests and docs updated.",whyNow:"Explain why this is worth doing now (impact / urgency).",body:`## Goal
34
-
35
- ## Why now
36
-
37
- ## Out of scope
38
- `},spike:{type:"Task",priority:"2",tags:"spike",estimatedMinutes:"120",acceptanceCriteria:"Timeboxed investigation complete; findings and a recommendation are recorded.",body:`## Question to answer
39
-
40
- ## Timebox
41
- 2h
42
-
43
- ## Findings
44
-
45
- ## Recommendation
46
- `},chore:{type:"Chore",priority:"3",tags:"chore",acceptanceCriteria:"Maintenance task done with no behavior change and green checks.",body:`## What
47
-
48
- ## Why
49
- `}},on={normalizeTemplateName:H,extractTemplateOptions:je,parseStoredTemplateDocument:re,builtinTemplateDocument:Me,readStoredTemplateDocument:Ue};function H(e){let t=e.trim();if(!De.test(t))throw new u(`Invalid template name "${e}". Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._-]*.`,f.USAGE);return t}function oe(e){return Le.join(e,rt)}function q(e,t){return Le.join(oe(e),`${t}${ne}`)}async function se(e){if(!await I(D(e)))throw new u(`Tracker is not initialized at ${e}. Run pm init first.`,f.NOT_FOUND)}function ie(e){return Object.fromEntries(Object.entries(e).sort(([t],[n])=>t.localeCompare(n)))}function je(e){let t={};for(let[n,o]of Object.entries(e))if(o!==void 0){if(ct.has(n)){if(typeof o=="string"){t[n]=[o];continue}if(!Array.isArray(o))continue;let i=o.filter(s=>typeof s=="string");i.length>0&&(t[n]=i);continue}if(typeof o=="string"){t[n]=o;continue}Array.isArray(o)&&o.every(i=>typeof i=="string")&&(t[n]=[...o])}return ie(t)}function lt(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw new u(`Template "${t}" has invalid options payload.`,f.GENERIC_FAILURE);let n=e,o={};for(let[i,s]of Object.entries(n)){let r=i.trim();if(r.length===0)throw new u(`Template "${t}" contains an empty option key.`,f.GENERIC_FAILURE);if(typeof s=="string"){o[r]=s;continue}if(Array.isArray(s)&&s.every(a=>typeof a=="string")){o[r]=[...s];continue}throw new u(`Template "${t}" contains invalid value for option "${r}".`,f.GENERIC_FAILURE)}return ie(o)}function re(e,t){let n;try{n=JSON.parse(e)}catch{throw new u(`Template "${t}" contains invalid JSON.`,f.GENERIC_FAILURE)}if(typeof n!="object"||n===null||Array.isArray(n))throw new u(`Template "${t}" has invalid document shape.`,f.GENERIC_FAILURE);let o=n,i=lt(o.options,t),s=_();return{name:typeof o.name=="string"&&o.name.trim().length>0?o.name.trim():t,created_at:typeof o.created_at=="string"?o.created_at:s,updated_at:typeof o.updated_at=="string"?o.updated_at:s,options:i}}function Me(e){let t=Ne[e];return t?{name:e,created_at:Re,updated_at:Re,options:ie({...t})}:null}async function ze(e,t){let n=await w(q(e,t));if(n!==null)return{document:re(n,t),source:"user"};let o=Me(t);if(o)return{document:o,source:"builtin"};throw new u(`Template "${t}" not found`,f.NOT_FOUND)}async function Ue(e,t){let n=await w(q(e,t));if(n===null)throw new u(`Template "${t}" not found`,f.NOT_FOUND);return re(n,t)}async function sn(e,t){let n=H(t),{document:o}=await ze(e,n);return o.options}async function We(e,t,n){let o=P(process.cwd(),n.path);await se(o);let i=H(e),s=je(t);if(Object.keys(s).length===0)throw new u("templates save requires at least one create option flag",f.USAGE);let r=_(),a=q(o,i),c=r;await I(a)&&(c=(await Ue(o,i)).created_at);let p={name:i,created_at:c,updated_at:r,options:s},l=await z(o);return await Fe.mkdir(oe(o),{recursive:!0}),await $({pmRoot:o,filePath:a,raw:`${JSON.stringify(p,null,2)}
50
- `,op:"templates:save",author:j(void 0,l.author_default),lockTtlSeconds:l.locks.ttl_seconds,lockWaitMs:l.locks.wait_ms}),{name:p.name,created_at:p.created_at,updated_at:p.updated_at,path:a,options:p.options}}async function pt(e){let t=oe(e);return await I(t)?(await Fe.readdir(t)).filter(o=>o.toLowerCase().endsWith(ne)).map(o=>o.slice(0,-ne.length)).filter(o=>De.test(o)):[]}async function rn(e){let t=P(process.cwd(),e.path);await se(t);let n=await pt(t),o=new Set(n),i=Object.keys(Ne).filter(c=>!o.has(c)),s=[...n].sort((c,p)=>c.localeCompare(p)),r=[...i].sort((c,p)=>c.localeCompare(p)),a=[...new Set([...s,...r])].sort((c,p)=>c.localeCompare(p));return{templates:a,count:a.length,builtin_templates:r,user_templates:s}}async function an(e,t){let n=P(process.cwd(),t.path);await se(n);let o=H(e),{document:i,source:s}=await ze(n,o);return{name:i.name,source:s,created_at:i.created_at,updated_at:i.updated_at,path:s==="builtin"?`builtin:${o}`:q(n,o),options:i.options}}import dt 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]="a1e34cfb-3d4e-5b79-8585-3162e71e574c")}catch{}})();var Cn=["list","show","apply","lint"],ft="schema-types",ut="schema-statuses",mt="schema-fields";function J(){let e=le();return e===null?[]:e.profiles.map(t=>({name:t.name,profile:t.profile}))}function On(){let{profiles:e,warnings:t}=Q(J());return{action:"list",profiles:e.map(n=>({name:n.definition.name,title:n.definition.title,summary:n.definition.summary,source:n.source,...n.package!==void 0?{package:n.package}:{},composition:ee(n.definition)})),warnings:t,generated_at:_()}}function Rn(e){let t;try{t=G(e,J())}catch(o){throw new u(o instanceof Error?o.message:String(o),f.USAGE)}let{resolved:n}=t;return{action:"show",...Pe(n.definition),source:n.source,...n.package!==void 0?{package:n.package}:{},warnings:t.warnings,generated_at:_()}}function Fn(e){let t;try{t=G(e,J())}catch(i){throw new u(i instanceof Error?i.message:String(i),f.USAGE)}let{resolved:n}=t,o=Ae(n.definition);return{action:"lint",name:n.definition.name,title:n.definition.title,source:n.source,...n.package!==void 0?{package:n.package}:{},ok:o.ok,error_count:o.errorCount,warning_count:o.warningCount,findings:o.findings,warnings:t.warnings,generated_at:_()}}function yt(e,t){return dt.join(e,"templates",`${t}.json`)}async function gt(e,t){let n=await w(yt(e,t));if(n!==null)try{let o=JSON.parse(n);if(o!==null&&typeof o=="object"&&!Array.isArray(o)){let i=o.options;if(i!==null&&typeof i=="object"&&!Array.isArray(i))return i}}catch{}}async function Be(e,t,n,o){let i=new Map;for(let s of o.templates){let r=await gt(e,s.name);r!==void 0&&i.set(s.name,r)}return{typesRaw:await w(T(e,t.files.types,b.types)),statusesRaw:await w(T(e,t.files.statuses,b.statuses)),fieldsRaw:await w(T(e,t.files.fields,b.fields)),workflows:n.schema.type_workflows??[],settings:n,templates:i,installedPackages:new Set}}function O(e){let t=[],n=[],o=[];for(let i of e)(i.status==="add"?t:i.status==="update"?n:o).push(i.key);return{added:t,updated:n,unchanged:o}}function Ke(e,t,n,o,i){return{action:"apply",name:e.name,title:e.title,applied:n,dry_run:o,changed:t.changed,types:O(t.types.changes),statuses:O(t.statuses.changes),fields:O(t.fields.changes),workflows:O(t.workflows.changes.map(s=>({key:s.type,status:s.status}))),config:O(t.config.changes),templates:O(t.templates.changes.map(s=>({key:s.name,status:s.status}))),packages:t.packages,warnings:[...new Set(i)].sort((s,r)=>s.localeCompare(r)),generated_at:_()}}async function ht(e){if(!await I(D(e)))throw new u(`Tracker is not initialized at ${e}. Run pm init first.`,f.NOT_FOUND)}function wt(e){try{let t=G(e,J());return{profile:t.resolved.definition,warnings:t.warnings}}catch(t){throw new u(t instanceof Error?t.message:String(t),f.USAGE)}}async function Ln(e,t,n){let o=P(process.cwd(),n.path);await ht(o);let i=wt(e),s=i.profile,r=i.warnings,a=t.dryRun===!0,c=await z(o),p=de(c.schema);if(a){let v=await Be(o,p,c,s),d=Ge(s,v);return Ke(s,d,!1,!0,[...r])}let l=j(t.author,c.author_default),y=ye(c),R=!!t.force,g=[...r],ae=[],Y=async v=>{ae.push(await fe(o,v,c.locks.ttl_seconds,l,R,y.force_required_for_stale_lock,c.locks.wait_ms))},m;try{await Y(ft),await Y(ut),await Y(mt);let v=await Be(o,p,c,s);if(m=Ge(s,v),m.types.changed){let d=T(o,p.files.types,b.types);await $({pmRoot:o,filePath:d,raw:M(m.types.file),op:"profile:apply-types",author:l,lockTtlSeconds:c.locks.ttl_seconds,lockWaitMs:c.locks.wait_ms});let F=new Set(s.types.map(Z=>h(Z).name)),He=m.types.file.definitions.filter(Z=>F.has(Z.name));await Te(o,He,g,"profile:apply-type-folder"),g.push(...await N({path:d,scope:"project",op:"profile:apply-types"}))}if(m.statuses.changed){let d=T(o,p.files.statuses,b.statuses);await $({pmRoot:o,filePath:d,raw:U(m.statuses.file),op:"profile:apply-statuses",author:l,lockTtlSeconds:c.locks.ttl_seconds,lockWaitMs:c.locks.wait_ms}),g.push(...await N({path:d,scope:"project",op:"profile:apply-statuses"}))}if(m.fields.changed){let d=T(o,p.files.fields,b.fields);await $({pmRoot:o,filePath:d,raw:W(m.fields.file),op:"profile:apply-fields",author:l,lockTtlSeconds:c.locks.ttl_seconds,lockWaitMs:c.locks.wait_ms}),g.push(...await N({path:d,scope:"project",op:"profile:apply-fields"}))}if(m.config.changed||m.workflows.changed){for(let d of m.config.changes){if(d.status==="unchanged")continue;let F=x(d.key);F!==void 0&&Se(c,F,d.value)}c.schema.type_workflows=m.workflows.result,await ge(o,c,"profile:apply-config")}for(let d of m.templates.changes)d.status!=="unchanged"&&await We(d.name,{...d.options},n)}finally{for(let v of ae.reverse())try{await v()}catch{}}return Ke(s,m,m.changed,!1,g)}function Ge(e,t){try{return Oe(e,t)}catch(n){throw new u(n instanceof Error?n.message:String(n),f.USAGE)}}function _t(e,t){let n=[];if(t.added.length>0&&n.push(`+${t.added.join(", ")}`),t.updated.length>0&&n.push(`~${t.updated.join(", ")}`),n.length!==0)return` ${e}: ${n.join(" ")}`}function Dn(e){let t=["Project profiles:"];for(let n of e.profiles){let o=n.source==="extension"?` [${n.package??"extension"}]`:"";t.push(` ${n.name} \u2014 ${n.title}: ${n.summary}${o}`)}for(let n of e.warnings)t.push(` warning: ${n}`);return t.join(`
51
- `)}function Nn(e){let t=e.source==="extension"?` [${e.package??"extension"}]`:"",n=[`${e.name} \u2014 ${e.title}${t}`,e.summary,""];n.push(`types: ${e.types.join(", ")||"(none)"}`),n.push(`statuses: ${e.statuses.join(", ")||"(none)"}`),n.push(`fields: ${e.fields.join(", ")||"(none)"}`),n.push(`workflows: ${e.workflows.join(", ")||"(none)"}`),n.push(`config: ${e.config.join(", ")||"(none)"}`),n.push(`templates: ${e.templates.join(", ")||"(none)"}`),n.push(`packages: ${e.packages.map(o=>o.spec).join(", ")||"(none)"}`);for(let o of e.warnings)n.push(`warning: ${o}`);return n.join(`
52
- `)}function jn(e){let t=e.source==="extension"?` [${e.package??"extension"}]`:"",n=e.warning_count+e.warnings.length,i=[e.ok?`Profile ${e.name}${t}: ok (${n} warning${n===1?"":"s"})`:`Profile ${e.name}${t}: ${e.error_count} error${e.error_count===1?"":"s"}, ${n} warning${n===1?"":"s"}`];for(let s of e.findings){let r=s.target!==void 0?` (${s.target})`:"";i.push(` ${s.severity} [${s.code}] ${s.dimension}${r}: ${s.message}`)}for(let s of e.warnings)i.push(` warning: ${s}`);return i.join(`
53
- `)}function Mn(e){let t=e.dry_run?"dry-run":e.applied?"applied":"no changes",n=[`Profile ${e.name} (${t})`];if(!e.changed)n.push(" already up to date");else for(let[i,s]of[["types",e.types],["statuses",e.statuses],["fields",e.fields],["workflows",e.workflows],["config",e.config],["templates",e.templates]]){let r=_t(i,s);r!==void 0&&n.push(r)}let o=e.packages.filter(i=>i.status==="recommended");o.length>0&&n.push(` recommended packages: ${o.map(i=>i.spec).join(", ")}`);for(let i of e.warnings)n.push(` warning: ${i}`);return n.join(`
54
- `)}export{C as a,X as b,qe as c,vt as d,bt as e,ee as f,Pe as g,jt as h,Mt as i,Ae as j,Oe as k,on as l,sn as m,We as n,rn as o,an as p,Cn as q,On as r,Rn as s,Fn as t,Ln as u,Dn as v,Nn as w,jn as x,Mn as y};
55
- //# sourceMappingURL=chunk-WSI5KZQJ.js.map
@@ -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{K as o,L as f,M as t,N as b,O as s,P as l,Q as r}from"./chunk-BP6EMEDP.js";import"./chunk-DWOAOZHZ.js";import"./chunk-NE5VRDAI.js";import"./chunk-PECV7L5T.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:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="e8b566c3-db93-54d7-a917-38bf317cb575")}catch{}})();export{r as _testOnlyCreateCommand,b as parseDocs,f as parseFiles,o as parseLogSeed,t as parseTests,s as requireStringOption,l as runCreate};
2
- //# sourceMappingURL=create-TG67IVFI.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{f as d,g as f,h as t,i as s,j as l,k as r,l as a,m as b,n as i}from"./chunk-F4NREH3G.js";import"./chunk-PECV7L5T.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]="41658a2a-e730-5c0c-9783-70b30ee9b2fc")}catch{}})();export{f as DEPS_COLLAPSE_VALUES,t as DEPS_DIRECTION_VALUES,d as DEPS_FORMAT_VALUES,b as buildDepsRelationshipContext,r as parseDirection,a as parseKinds,l as parseMaxDepth,s as parsePositiveInteger,i as runDeps};
2
- //# sourceMappingURL=deps-AJUGP2OH.js.map
@@ -1,2 +0,0 @@
1
- import{a as o}from"./chunk-FDBRXV25.js";import"./chunk-DQGJ2RWT.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.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]="890d56e2-d85f-5d29-90b3-1d832210ea09")}catch{}})();export{o as runDocs};
2
- //# sourceMappingURL=docs-QOCLDRKJ.js.map
@@ -1,2 +0,0 @@
1
- import{a as f,b as o,c as t,d as s}from"./chunk-4AVFKHHC.js";import"./chunk-DQGJ2RWT.js";import"./chunk-A6KGKEWT.js";import"./chunk-R6LSRGPS.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]="2fa91bad-9a89-5c42-8b0f-dbcd2728c563")}catch{}})();export{f as _testOnly,o as runFiles,s as runFilesDiscover,t as runFilesLookup};
2
- //# sourceMappingURL=files-3ST5TY64.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{a as t,c as n,d as r}from"./chunk-343QETLI.js";import"./chunk-QJ7C3JIW.js";import"./chunk-C3YABSJK.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:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="c916e9b2-d840-585e-b7e2-120b677c7498")}catch{}})();export{n as assertHistoryCompactTarget,t as runHistoryCompact,r as runHistoryCompactBulk};
2
- //# sourceMappingURL=history-compact-7BJFML4S.js.map
@@ -1,2 +0,0 @@
1
- import{h as t,i as f,j as n}from"./chunk-C3YABSJK.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]="f3dbfd7a-f028-5927-b62d-2f078389f06d")}catch{}})();export{n as _testOnly,t as resolveHistorySubject,f as runHistoryRedact};
2
- //# sourceMappingURL=history-redact-WJN3HYXR.js.map
@@ -1,2 +0,0 @@
1
- import{b as n,c as o,d as t}from"./chunk-SVV3DQES.js";import"./chunk-D7I3TUGV.js";import"./chunk-C3YABSJK.js";import"./chunk-4OVGQW22.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:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="49eb11f2-6d0e-59e6-9b7d-3a1515229879")}catch{}})();export{o as assertHistoryRepairTarget,n as runHistoryRepair,t as runHistoryRepairAll};
2
- //# sourceMappingURL=history-repair-XDNZUB7F.js.map