@unbrained/pm-cli 2026.8.4 → 2026.8.6

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 (253) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +53 -13
  3. package/dist/cli/error-guidance.js +4 -4
  4. package/dist/cli/main.js +12 -37
  5. package/dist/cli/register-setup.d.ts +1 -1
  6. package/dist/cli/register-setup.js +46 -20
  7. package/dist/cli/register-structured-mutation.d.ts +2 -0
  8. package/dist/cli/register-structured-mutation.js +124 -12
  9. package/dist/cli-bundle/bundle-manifest.json +397 -397
  10. package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +2 -0
  11. package/dist/cli-bundle/chunks/{chunk-QVO3VTA4.js → chunk-343QETLI.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-Q5F6OI7C.js → chunk-3KFVGGRE.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-6S7I3UKV.js → chunk-3ZJRFYY2.js} +19 -19
  14. package/dist/cli-bundle/chunks/{chunk-NFF3JAQR.js → chunk-4AVFKHHC.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-5H47J5FG.js → chunk-4OVGQW22.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-D2MBVMVE.js → chunk-5PBP2ZP3.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-5ZKQPA44.js +2 -0
  18. package/dist/cli-bundle/chunks/chunk-A3XQ7VPU.js +2 -0
  19. package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +8 -0
  20. package/dist/cli-bundle/chunks/{chunk-2POYGY53.js → chunk-AOBDLU4T.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-PYYPQLHC.js → chunk-AYRUGRNS.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-QMWUL66F.js → chunk-BP6EMEDP.js} +5 -5
  23. package/dist/cli-bundle/chunks/{chunk-UVZREFZU.js → chunk-C3YABSJK.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-RB65T4RX.js → chunk-CA3BURYF.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-KIKLF2W4.js → chunk-D7I3TUGV.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-PQXEB7W4.js → chunk-DQGJ2RWT.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-OB7TRZ2G.js → chunk-DWOAOZHZ.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-SVDH5CHC.js → chunk-E7BFPLUZ.js} +4 -4
  29. package/dist/cli-bundle/chunks/{chunk-CGY5I2GO.js → chunk-F4NREH3G.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-DCJ6CM6F.js → chunk-FDBRXV25.js} +2 -2
  31. package/dist/cli-bundle/chunks/{chunk-NM5G7RLU.js → chunk-GU3TSEHD.js} +2 -2
  32. package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +164 -0
  33. package/dist/cli-bundle/chunks/{chunk-CU5ENFNP.js → chunk-JFZIS6JF.js} +2 -2
  34. package/dist/cli-bundle/chunks/{chunk-GOICHIX4.js → chunk-JQ4NZ5EB.js} +2 -2
  35. package/dist/cli-bundle/chunks/{chunk-HE3DZFN4.js → chunk-L6LGKJX3.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-BLINBTMX.js → chunk-M357ZCOR.js} +2 -2
  37. package/dist/cli-bundle/chunks/{chunk-NRDKVOUE.js → chunk-M4VEE3FK.js} +2 -2
  38. package/dist/cli-bundle/chunks/{chunk-HTYC76A4.js → chunk-MCS73BKB.js} +2 -2
  39. package/dist/cli-bundle/chunks/{chunk-BKMZTZYL.js → chunk-MDTH7SAE.js} +2 -2
  40. package/dist/cli-bundle/chunks/{chunk-H6FITE7D.js → chunk-NE5VRDAI.js} +2 -2
  41. package/dist/cli-bundle/chunks/{chunk-NPUJ7OLK.js → chunk-OXY3SJ3N.js} +2 -2
  42. package/dist/cli-bundle/chunks/chunk-PECV7L5T.js +2 -0
  43. package/dist/cli-bundle/chunks/{chunk-KH4GVBMC.js → chunk-Q3VOP62W.js} +2 -2
  44. package/dist/cli-bundle/chunks/{chunk-FQ4EFFDU.js → chunk-QJ7C3JIW.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-VH2EAGUG.js → chunk-R6LSRGPS.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-HQ2WU7OY.js → chunk-R6RKEYYW.js} +2 -2
  47. package/dist/cli-bundle/chunks/{chunk-PA5XRN2A.js → chunk-RAFUN7IX.js} +4 -4
  48. package/dist/cli-bundle/chunks/chunk-RUAU5OSH.js +2 -0
  49. package/dist/cli-bundle/chunks/chunk-SD3YXU2U.js +56 -0
  50. package/dist/cli-bundle/chunks/{chunk-JMKVCQSE.js → chunk-SV3YQ4RY.js} +2 -2
  51. package/dist/cli-bundle/chunks/{chunk-B5ZLCD5Z.js → chunk-SVV3DQES.js} +2 -2
  52. package/dist/cli-bundle/chunks/{chunk-J4EPW4GT.js → chunk-SXECIECW.js} +2 -2
  53. package/dist/cli-bundle/chunks/chunk-T45OHXDW.js +8 -0
  54. package/dist/cli-bundle/chunks/{chunk-NH35JNK5.js → chunk-TPKDJ5WL.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-ZSH4GNBH.js → chunk-UVVXHGYS.js} +2 -2
  56. package/dist/cli-bundle/chunks/chunk-V663653R.js +20 -0
  57. package/dist/cli-bundle/chunks/{chunk-5PZGZMPG.js → chunk-WSI5KZQJ.js} +2 -2
  58. package/dist/cli-bundle/chunks/{chunk-3XZYTRPC.js → chunk-XPOQQJTX.js} +2 -2
  59. package/dist/cli-bundle/chunks/{chunk-UJHUR3LZ.js → chunk-YCCDXBNU.js} +2 -2
  60. package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +2 -0
  61. package/dist/cli-bundle/chunks/close-DI66JMSB.js +2 -0
  62. package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +2 -0
  63. package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +2 -0
  64. package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +2 -0
  65. package/dist/cli-bundle/chunks/{create-RLLCBCXM.js → create-TG67IVFI.js} +2 -2
  66. package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +2 -0
  67. package/dist/cli-bundle/chunks/{deps-J4ONTF4X.js → deps-AJUGP2OH.js} +2 -2
  68. package/dist/cli-bundle/chunks/{docs-YL2DJ4WD.js → docs-QOCLDRKJ.js} +2 -2
  69. package/dist/cli-bundle/chunks/{files-NGNAIYKK.js → files-3ST5TY64.js} +2 -2
  70. package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +2 -0
  71. package/dist/cli-bundle/chunks/{history-compact-HW62K5XP.js → history-compact-7BJFML4S.js} +2 -2
  72. package/dist/cli-bundle/chunks/{history-redact-HVBKUJOW.js → history-redact-WJN3HYXR.js} +2 -2
  73. package/dist/cli-bundle/chunks/{history-repair-OPNBH5JJ.js → history-repair-XDNZUB7F.js} +2 -2
  74. package/dist/cli-bundle/chunks/{learnings-F36PZXT6.js → learnings-SZMUPVNA.js} +2 -2
  75. package/dist/cli-bundle/chunks/{profile-N3XMWBM7.js → profile-KL53JIAC.js} +2 -2
  76. package/dist/cli-bundle/chunks/{register-list-query-BKGHBI7Y.js → register-list-query-QH7ONPKU.js} +2 -2
  77. package/dist/cli-bundle/chunks/register-mutation-OCRQNZK4.js +20 -0
  78. package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +2 -0
  79. package/dist/cli-bundle/chunks/register-setup-QWBQ6HBS.js +2 -0
  80. package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +2 -0
  81. package/dist/cli-bundle/chunks/{schema-4PJQMGUY.js → schema-QJ27OTRV.js} +2 -2
  82. package/dist/cli-bundle/chunks/update-7GBO4SXG.js +2 -0
  83. package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +2 -0
  84. package/dist/cli-bundle/focused-chunks/chunk-27DK4A5O.js +2 -0
  85. package/dist/cli-bundle/focused-chunks/chunk-4JC3AOGS.js +8 -0
  86. package/dist/cli-bundle/focused-chunks/chunk-6KDHXURF.js +2 -0
  87. package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +2 -0
  88. package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +2 -0
  89. package/dist/cli-bundle/focused-chunks/chunk-7YTZ7A4E.js +2 -0
  90. package/dist/cli-bundle/focused-chunks/{chunk-ONIX2KKW.js → chunk-CL3NB7VW.js} +2 -2
  91. package/dist/cli-bundle/focused-chunks/chunk-EAXXF2HW.js +4 -0
  92. package/dist/cli-bundle/focused-chunks/{chunk-L6A4NVQC.js → chunk-EYO4F74Z.js} +2 -2
  93. package/dist/cli-bundle/focused-chunks/chunk-GEYU23YS.js +153 -0
  94. package/dist/cli-bundle/focused-chunks/{chunk-DQ4PLKEE.js → chunk-GIERI4YU.js} +2 -2
  95. package/dist/cli-bundle/focused-chunks/chunk-GSW2Y7VZ.js +5 -0
  96. package/dist/cli-bundle/focused-chunks/{chunk-WVGJAD7L.js → chunk-LKQXXO62.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-UFCPSWIL.js → chunk-MBBMTDD3.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/{chunk-OYTK4VNH.js → chunk-ME4XVOBJ.js} +2 -2
  99. package/dist/cli-bundle/focused-chunks/{chunk-RO5BQFG3.js → chunk-N7QN3NE6.js} +2 -2
  100. package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +2 -0
  101. package/dist/cli-bundle/focused-chunks/chunk-TQMFQYXR.js +29 -0
  102. package/dist/cli-bundle/focused-chunks/{chunk-SQXVGHMH.js → chunk-XNVXIQ4B.js} +2 -2
  103. package/dist/cli-bundle/focused-chunks/{chunk-BOGRY7M6.js → chunk-YHDCGUIW.js} +10 -10
  104. package/dist/cli-bundle/focused-chunks/{chunk-K37BB4JL.js → chunk-YLPZHWX7.js} +2 -2
  105. package/dist/cli-bundle/main.js +13 -13
  106. package/dist/cli-bundle/sdk-authoring.js +1 -1
  107. package/dist/cli-bundle/sdk-contracts.js +1 -1
  108. package/dist/cli-bundle/sdk-core.js +28 -28
  109. package/dist/cli-bundle/sdk-governance.js +1 -1
  110. package/dist/cli-bundle/sdk-graph.js +1 -1
  111. package/dist/cli-bundle/sdk-merge.js +1 -1
  112. package/dist/cli-bundle/sdk-query.js +1 -1
  113. package/dist/cli-bundle/sdk-runtime.js +1 -1
  114. package/dist/cli-bundle/sdk-testing.js +1 -1
  115. package/dist/cli-bundle/sdk.js +1 -1
  116. package/dist/core/extensions/activation-summary.d.ts +4 -0
  117. package/dist/core/extensions/activation-summary.js +5 -2
  118. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  119. package/dist/core/extensions/contribution-inventory.js +35 -2
  120. package/dist/core/extensions/extension-hook-runtime.js +5 -3
  121. package/dist/core/extensions/extension-types.d.ts +18 -1
  122. package/dist/core/extensions/extension-types.js +2 -2
  123. package/dist/core/extensions/loader.js +8 -13
  124. package/dist/core/extensions/preflight-ownership.d.ts +5 -0
  125. package/dist/core/extensions/preflight-ownership.js +42 -0
  126. package/dist/core/item/item-format.js +14 -20
  127. package/dist/core/shared/constants.js +3 -2
  128. package/dist/core/store/item-store.js +2 -2
  129. package/dist/core/store/settings.js +2 -2
  130. package/dist/mcp/server.js +12 -6
  131. package/dist/mcp/tool-definitions.js +14 -7
  132. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +18 -18
  133. package/dist/sdk/cli-contracts/agent-output-contracts.js +51 -23
  134. package/dist/sdk/cli-contracts/commander-mutation-options.js +26 -2
  135. package/dist/sdk/cli-contracts/flag-contracts.d.ts +4 -0
  136. package/dist/sdk/cli-contracts/flag-contracts.js +34 -2
  137. package/dist/sdk/cli-contracts/registration-helpers.js +4 -2
  138. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +10 -2
  139. package/dist/sdk/cli-contracts/runtime-contracts.js +21 -5
  140. package/dist/sdk/cli-contracts/tool-schema.js +4 -2
  141. package/dist/sdk/cli-contracts.d.ts +2 -2
  142. package/dist/sdk/cli-contracts.js +4 -4
  143. package/dist/sdk/cli-program.js +3 -3
  144. package/dist/sdk/compose.d.ts +2 -2
  145. package/dist/sdk/compose.js +7 -2
  146. package/dist/sdk/contracts.d.ts +1 -0
  147. package/dist/sdk/contracts.js +3 -2
  148. package/dist/sdk/define.d.ts +3 -1
  149. package/dist/sdk/define.js +3 -8
  150. package/dist/sdk/dependency-provenance.d.ts +2 -0
  151. package/dist/sdk/dependency-provenance.js +7 -3
  152. package/dist/sdk/error-code-catalog.d.ts +23 -0
  153. package/dist/sdk/error-code-catalog.js +25 -5
  154. package/dist/sdk/extension/install-sources.d.ts +43 -5
  155. package/dist/sdk/extension/install-sources.js +36 -2
  156. package/dist/sdk/extension/migrations.d.ts +114 -0
  157. package/dist/sdk/extension/migrations.js +175 -0
  158. package/dist/sdk/extension/scaffold.js +14 -9
  159. package/dist/sdk/extension/source-resolution.d.ts +50 -0
  160. package/dist/sdk/extension/source-resolution.js +66 -0
  161. package/dist/sdk/extension.d.ts +5 -1
  162. package/dist/sdk/extension.js +24 -26
  163. package/dist/sdk/generated-error-code-catalog.js +499 -3
  164. package/dist/sdk/governance/health.js +11 -2
  165. package/dist/sdk/graph/governance.js +3 -3
  166. package/dist/sdk/graph/remediation.js +3 -3
  167. package/dist/sdk/graph/run.js +4 -8
  168. package/dist/sdk/index.d.ts +7 -2
  169. package/dist/sdk/index.js +9 -4
  170. package/dist/sdk/item-transaction.d.ts +51 -6
  171. package/dist/sdk/item-transaction.js +132 -22
  172. package/dist/sdk/lifecycle/create.d.ts +4 -0
  173. package/dist/sdk/lifecycle/create.js +26 -10
  174. package/dist/sdk/lifecycle-policy.d.ts +9 -0
  175. package/dist/sdk/lifecycle-policy.js +22 -9
  176. package/dist/sdk/merge/driver.js +6 -3
  177. package/dist/sdk/output-contracts.d.ts +67 -0
  178. package/dist/sdk/output-contracts.js +173 -0
  179. package/dist/sdk/package-import-adapters.js +2 -2
  180. package/dist/sdk/package-migrations.d.ts +10 -0
  181. package/dist/sdk/package-migrations.js +21 -0
  182. package/dist/sdk/runtime.d.ts +2 -0
  183. package/dist/sdk/runtime.js +6 -2
  184. package/dist/sdk/structured-mutations.d.ts +23 -0
  185. package/dist/sdk/structured-mutations.js +219 -10
  186. package/dist/sdk/workspace-snapshot.js +58 -12
  187. package/dist/sdk/workspace.js +30 -4
  188. package/docs/COMMANDS.md +49 -10
  189. package/docs/EXTENSIONS.md +3 -3
  190. package/docs/EXTENSION_LIFECYCLE.md +46 -0
  191. package/docs/MERGE_SAFETY.md +2 -0
  192. package/docs/PR_REVIEW_LOOP.md +10 -4
  193. package/docs/README.md +23 -22
  194. package/docs/RELEASING.md +36 -23
  195. package/docs/SCRIPTING.md +32 -9
  196. package/docs/SDK.md +122 -14
  197. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  198. package/docs/TESTING.md +25 -0
  199. package/docs/examples/sdk-contract-consumer/README.md +11 -1
  200. package/docs/examples/sdk-contract-consumer/package.json +2 -1
  201. package/docs/examples/sdk-contract-consumer/parse-receipt.mjs +22 -0
  202. package/marketplace.json +2 -2
  203. package/package.json +5 -4
  204. package/packages/pm-beads/package.json +1 -1
  205. package/packages/pm-calendar/package.json +1 -1
  206. package/packages/pm-command-kit/package.json +1 -1
  207. package/packages/pm-digital-twin/package.json +1 -1
  208. package/packages/pm-governance-audit/package.json +1 -1
  209. package/packages/pm-guide-shell/package.json +1 -1
  210. package/packages/pm-kanban/package.json +1 -1
  211. package/packages/pm-lifecycle-hooks/package.json +1 -1
  212. package/packages/pm-linked-test-adapters/package.json +1 -1
  213. package/packages/pm-search-advanced/package.json +1 -1
  214. package/packages/pm-templates/package.json +1 -1
  215. package/packages/pm-todos/package.json +1 -1
  216. package/packages/pm-vcs/package.json +1 -1
  217. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  218. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  219. package/sdk/public-surface.json +508 -32
  220. package/dist/cli-bundle/chunks/append-DHBRLHHS.js +0 -2
  221. package/dist/cli-bundle/chunks/chunk-2INN52SU.js +0 -8
  222. package/dist/cli-bundle/chunks/chunk-377OOXUF.js +0 -55
  223. package/dist/cli-bundle/chunks/chunk-6RSK4IFN.js +0 -20
  224. package/dist/cli-bundle/chunks/chunk-ASJJKA57.js +0 -2
  225. package/dist/cli-bundle/chunks/chunk-IYAVULRN.js +0 -2
  226. package/dist/cli-bundle/chunks/chunk-JDPKBV5P.js +0 -2
  227. package/dist/cli-bundle/chunks/chunk-RRQBHQOV.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-SULWTPQO.js +0 -8
  229. package/dist/cli-bundle/chunks/chunk-V5K52PYW.js +0 -164
  230. package/dist/cli-bundle/chunks/chunk-XBLOD5TZ.js +0 -2
  231. package/dist/cli-bundle/chunks/close-VLHNN6YB.js +0 -2
  232. package/dist/cli-bundle/chunks/close-many-LSJNZKU6.js +0 -2
  233. package/dist/cli-bundle/chunks/comments-AAIA6A6X.js +0 -2
  234. package/dist/cli-bundle/chunks/copy-Z7YMLEHN.js +0 -2
  235. package/dist/cli-bundle/chunks/delete-KNOHHQJM.js +0 -2
  236. package/dist/cli-bundle/chunks/focus-LFRCGALV.js +0 -2
  237. package/dist/cli-bundle/chunks/register-mutation-GU3DCECN.js +0 -20
  238. package/dist/cli-bundle/chunks/register-operations-PTWH727R.js +0 -2
  239. package/dist/cli-bundle/chunks/register-setup-KWV6UD77.js +0 -2
  240. package/dist/cli-bundle/chunks/restore-4HZSLILR.js +0 -2
  241. package/dist/cli-bundle/chunks/update-E6LPS5IV.js +0 -2
  242. package/dist/cli-bundle/chunks/update-many-OSIC6KRO.js +0 -2
  243. package/dist/cli-bundle/focused-chunks/chunk-2VIIXOAD.js +0 -2
  244. package/dist/cli-bundle/focused-chunks/chunk-5MTKO7TV.js +0 -153
  245. package/dist/cli-bundle/focused-chunks/chunk-6GIZK7VQ.js +0 -2
  246. package/dist/cli-bundle/focused-chunks/chunk-AOP2WIZZ.js +0 -2
  247. package/dist/cli-bundle/focused-chunks/chunk-C2QSL62X.js +0 -28
  248. package/dist/cli-bundle/focused-chunks/chunk-CL75YW32.js +0 -2
  249. package/dist/cli-bundle/focused-chunks/chunk-E7OFMWGT.js +0 -8
  250. package/dist/cli-bundle/focused-chunks/chunk-I5F5UK3Q.js +0 -2
  251. package/dist/cli-bundle/focused-chunks/chunk-QM2BIVK7.js +0 -4
  252. package/dist/cli-bundle/focused-chunks/chunk-T5TSY36R.js +0 -5
  253. package/dist/cli-bundle/focused-chunks/chunk-VT6BF2IX.js +0 -2
@@ -1,4 +1,4 @@
1
- import{$a as Pe,Ja as re,Ka as N,L as R,La as ne,Q as bt,Qa as oe,R as St,Ua as ke,Ya as Oe,_ as Re,ab as ze,cb as ie,da as Ne,ea as Me,ga as Tt,k as De,n as te}from"./chunk-5MTKO7TV.js";import{D as F,J as ee,L as Ae,M as Ce,N as ve,O as yt,R as wt,S as h,U as B,V as U,W as b,Y as Et,a as xe,p as $,q as T,r as S,t as Z}from"./chunk-QM2BIVK7.js";import{R as Ie,Y as f,Z as p,ba as Le}from"./chunk-CL75YW32.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]="b9581c92-5e8a-589d-9681-d4d014e6902b")}catch{}})();function Hr(e,t="--limit"){if(e===void 0)return;let r=Number(e);if(!Number.isFinite(r)||r<0)throw new p(`${t} must be a non-negative number`,f.USAGE);return Math.floor(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]="7775a1f2-5167-5853-a2c5-a44d46f8e80e")}catch{}})();var Yr=/\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/,Br=/\bnpm_[A-Za-z0-9]{36}\b/,Gr=/\bxox[baprs]-(?=[A-Za-z0-9-]{20,80}\b)(?=[A-Za-z0-9-]*\d)[A-Za-z0-9-]{20,80}\b/,Wr=/-----BEGIN (?:[A-Z0-9]+ )?PRIVATE KEY-----/,Kr=/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/,xt=/\b(?:token|secret|password|passwd|api[_-]?key)\s*[:=]\s*["']?([A-Za-z0-9+/=_-]{24,})/gi,Qr=[{action:"append",history_scope:"item"},{action:"claim",history_scope:"item"},{action:"close",history_scope:"item"},{action:"close-many",history_scope:"item"},{action:"close-task",history_scope:"item"},{action:"comments",history_scope:"conditional"},{action:"config",history_scope:"conditional"},{action:"copy",history_scope:"item"},{action:"create",history_scope:"item"},{action:"delete",history_scope:"item"},{action:"deps",history_scope:"conditional"},{action:"discover",history_scope:"item"},{action:"docs",history_scope:"conditional"},{action:"files",history_scope:"conditional"},{action:"focus",history_scope:"conditional"},{action:"gc",history_scope:"conditional"},{action:"history-compact",history_scope:"history"},{action:"history-author-acknowledge",history_scope:"workspace"},{action:"history-redact",history_scope:"history"},{action:"history-repair",history_scope:"history"},{action:"init",history_scope:"workspace"},{action:"install",history_scope:"conditional"},{action:"learnings",history_scope:"conditional"},{action:"notes",history_scope:"conditional"},{action:"package",history_scope:"conditional"},{action:"pause-task",history_scope:"item"},{action:"plan",history_scope:"conditional"},{action:"profile",history_scope:"conditional"},{action:"release",history_scope:"item"},{action:"restore",history_scope:"item"},{action:"schema",history_scope:"conditional"},{action:"start-task",history_scope:"item"},{action:"templates",history_scope:"conditional"},{action:"test",history_scope:"conditional"},{action:"test-all",history_scope:"conditional"},{action:"update",history_scope:"item"},{action:"update-many",history_scope:"item"},{action:"upgrade",history_scope:"conditional"}],Fe=new Map(Qr.map(e=>[e.action,e]));function Xr(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);let r=0;for(let n of t.values()){let o=n/e.length;r-=o*Math.log2(o)}return r}function $e(e,t="$",r=new WeakSet){return typeof e=="string"?[{path:t,value:e}]:typeof e!="object"||e===null?[]:r.has(e)?[]:(r.add(e),Array.isArray(e)?e.flatMap((n,o)=>$e(n,`${t}[${o}]`,r)):Object.entries(e).flatMap(([n,o])=>$e(o,`${t}.${n}`,r)))}function It(e){let t=[];for(let r of $e(e)){Yr.test(r.value)&&t.push({rule:"github_token",path:r.path}),Br.test(r.value)&&t.push({rule:"npm_token",path:r.path}),Gr.test(r.value)&&t.push({rule:"slack_token",path:r.path}),Wr.test(r.value)&&t.push({rule:"private_key",path:r.path}),Kr.test(r.value)&&t.push({rule:"aws_access_key",path:r.path}),xt.lastIndex=0;for(let n of r.value.matchAll(xt)){let o=n[1];if(Xr(o)>=3.5){t.push({rule:"high_entropy_assignment",path:r.path});break}}}return t.filter((r,n,o)=>o.findIndex(i=>i.rule===r.rule&&i.path===r.path)===n)}function Jr(e){let t=e.author.trim()||"unknown";if(e.settings.require_attributed_author&&t.toLowerCase()==="unknown")throw new p("Mutation author is required by workspace policy.",f.USAGE,{code:"mutation_author_required",required:"Pass --author <id>, set PM_AUTHOR, or configure author_default.",nextSteps:["Retry with --author <stable-agent-id>.","Set PM_AUTHOR for this agent session."]});if(e.settings.secret_guard==="off")return{author:t,findings:[],warnings:[],override_applied:!1};let r;try{r=It(e.payload)}catch{return{author:t,findings:[],warnings:["secret_guard_scan_failed_open"],override_applied:!1}}if(r.length===0)return{author:t,findings:r,warnings:[],override_applied:!1};let n=[...new Set(r.map(o=>o.rule))].sort().join(",");if(e.settings.secret_guard==="block"&&e.force!==!0)throw new p(`Mutation blocked by secret guard (${n}). No detected value was logged.`,f.CONFLICT,{code:"mutation_secret_guard_blocked",required:"Remove the credential-shaped content or retry with --force after explicit review.",nextSteps:["Replace the value with a secret-manager reference.","Use pm history-redact if equivalent content already entered history."],recovery:{recovery_mode:"compact",attempted_command:"pm <mutation> [REDACTED]",normalized_args:["[REDACTED]"],suggested_retry:"Remove credential-shaped content, then retry the mutation."}});return{author:t,findings:r,warnings:[`secret_guard_detected:${r.length}:rules=${n}`,...e.settings.secret_guard==="block"&&e.force===!0?["secret_guard_force_override"]:[]],override_applied:e.settings.secret_guard==="block"&&e.force===!0}}function Zr(e){return Fe.has(e.trim().toLowerCase())}function en(){return[...Fe.keys()].sort((e,t)=>e.localeCompare(t))}function Ds(e){return Fe.get(e.trim().toLowerCase())}(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]="64312ac7-5a99-5a21-b99f-2bdef1b54a06")}catch{}})();var tn=/\b[a-z][a-z0-9]*-\d+(?:-[a-z0-9]+)*\b/giu;function se(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function W(e){return[...new Set(se(e).match(/[\p{L}\p{N}]+/gu)??[])]}function G(e){let t=se(e);return{normalized:t,tokens:W(t),issueCodes:[...new Set(t.match(tn)?.map(r=>r.toLowerCase())??[])]}}function Ue(e,t){let r=new Set(e),n=new Set(t),o=new Set([...r,...n]);if(o.size===0)return 1;let i=0;for(let s of r)n.has(s)&&(i+=1);return i/o.size}function ae(e,t){return ce(G(e),G(t))}function ce(e,t){if(e.normalized===t.normalized)return{score:1,reason:"exact_title"};let r=new Set(e.issueCodes);return t.issueCodes.some(n=>r.has(n))?{score:.99,reason:"issue_code"}:{score:Ue(e.tokens,t.tokens),reason:"title_token_jaccard"}}import rn 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]="376bb9d2-e202-57e7-86c8-d70a7d3fa7ab")}catch{}})();function de(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function nn(e,t){return[e.updated_at,t].map(n=>({value:n,time:Date.parse(n??"")})).filter(n=>typeof n.value=="string"&&Number.isFinite(n.time)).sort((n,o)=>o.time-n.time)[0]?.value??e.updated_at}function At(e,t){let r=Math.max(1,Math.trunc(t.threshold_hours)),n=(t.now??new Date).getTime(),o=de(t.in_progress_status),i=[];for(let s of e){if(de(String(s.status))!==o||(s.assignee?.trim().length??0)>0)continue;let a=nn(s,t.last_history_activity?.(s)),c=Date.parse(a);if(!Number.isFinite(c))continue;let d=Math.max(0,Math.floor((n-c)/36e5));d>=r&&i.push({id:s.id,last_activity_at:a,age_hours:d})}return i.sort((s,a)=>a.age_hours-s.age_hours||s.id.localeCompare(a.id)),{threshold_hours:r,count:i.length,items:i,remediation:"Claim active work with `pm claim <id>` or return abandoned work to open with `pm update <id> --status open`."}}async function on(e,t,r){let n=new Map;return await Promise.all(t.filter(o=>de(String(o.status))===de(r.in_progress_status)&&(o.assignee?.trim().length??0)===0).map(async o=>{let i;try{i=await Tt(rn.join(e,"history",`${o.id}.jsonl`),o.id)}catch{return}let s=i.map(a=>a.ts).filter(a=>Number.isFinite(Date.parse(a))).sort((a,c)=>Date.parse(c)-Date.parse(a))[0];s&&n.set(o.id,s)})),At(t,{...r,last_history_activity:o=>n.get(o.id)})}import{mkdir as sn,readFile as an}from"node:fs/promises";import Ct 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]="71a8cd89-54fc-5f8a-b93b-9e4a79bb34b6")}catch{}})();function cn(e){let t=e.trim();if(!t)throw new p("--rollback requires a non-empty checkpoint ID",f.USAGE);if(!/^[a-zA-Z0-9._-]+$/.test(t))throw new p("--rollback checkpoint ID must match [a-zA-Z0-9._-]+",f.USAGE);return t}function dn(e,t){let r=t.replace(/[-:.TZ]/g,"").slice(0,14),n=Math.random().toString(36).slice(2,8);return`${e}-${r}-${n}`}function vt(e,t){return Ct.join(e,"checkpoints",t)}function Lt(e,t,r){return Ct.join(vt(e,t),`${r}.json`)}async function ln(e,t,r,n){let o=vt(e,t);await sn(o,{recursive:!0});let i=Lt(e,t,r);return await S(i,`${JSON.stringify(n,null,2)}
1
+ import{$a as Pe,Ja as re,Ka as N,L as R,La as ne,Q as bt,Qa as oe,R as St,Ua as ke,Ya as Oe,_ as Re,ab as ze,cb as ie,da as Ne,ea as Me,ga as Tt,k as De,n as te}from"./chunk-GEYU23YS.js";import{D as F,J as ee,L as Ae,M as Ce,N as ve,O as yt,R as wt,S as h,U as B,V as U,W as b,Y as Et,a as xe,p as $,q as T,r as S,t as Z}from"./chunk-EAXXF2HW.js";import{R as Ie,Y as f,Z as p,ba as Le}from"./chunk-7AZDTGPA.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]="b9581c92-5e8a-589d-9681-d4d014e6902b")}catch{}})();function Hr(e,t="--limit"){if(e===void 0)return;let r=Number(e);if(!Number.isFinite(r)||r<0)throw new p(`${t} must be a non-negative number`,f.USAGE);return Math.floor(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]="7775a1f2-5167-5853-a2c5-a44d46f8e80e")}catch{}})();var Yr=/\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/,Br=/\bnpm_[A-Za-z0-9]{36}\b/,Gr=/\bxox[baprs]-(?=[A-Za-z0-9-]{20,80}\b)(?=[A-Za-z0-9-]*\d)[A-Za-z0-9-]{20,80}\b/,Wr=/-----BEGIN (?:[A-Z0-9]+ )?PRIVATE KEY-----/,Kr=/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/,xt=/\b(?:token|secret|password|passwd|api[_-]?key)\s*[:=]\s*["']?([A-Za-z0-9+/=_-]{24,})/gi,Qr=[{action:"append",history_scope:"item"},{action:"claim",history_scope:"item"},{action:"close",history_scope:"item"},{action:"close-many",history_scope:"item"},{action:"close-task",history_scope:"item"},{action:"comments",history_scope:"conditional"},{action:"config",history_scope:"conditional"},{action:"copy",history_scope:"item"},{action:"create",history_scope:"item"},{action:"delete",history_scope:"item"},{action:"deps",history_scope:"conditional"},{action:"discover",history_scope:"item"},{action:"docs",history_scope:"conditional"},{action:"files",history_scope:"conditional"},{action:"focus",history_scope:"conditional"},{action:"gc",history_scope:"conditional"},{action:"history-compact",history_scope:"history"},{action:"history-author-acknowledge",history_scope:"workspace"},{action:"history-redact",history_scope:"history"},{action:"history-repair",history_scope:"history"},{action:"init",history_scope:"workspace"},{action:"install",history_scope:"conditional"},{action:"learnings",history_scope:"conditional"},{action:"notes",history_scope:"conditional"},{action:"package",history_scope:"conditional"},{action:"pause-task",history_scope:"item"},{action:"plan",history_scope:"conditional"},{action:"profile",history_scope:"conditional"},{action:"release",history_scope:"item"},{action:"restore",history_scope:"item"},{action:"schema",history_scope:"conditional"},{action:"start-task",history_scope:"item"},{action:"templates",history_scope:"conditional"},{action:"test",history_scope:"conditional"},{action:"test-all",history_scope:"conditional"},{action:"update",history_scope:"item"},{action:"update-many",history_scope:"item"},{action:"upgrade",history_scope:"conditional"}],Fe=new Map(Qr.map(e=>[e.action,e]));function Xr(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);let r=0;for(let n of t.values()){let o=n/e.length;r-=o*Math.log2(o)}return r}function $e(e,t="$",r=new WeakSet){return typeof e=="string"?[{path:t,value:e}]:typeof e!="object"||e===null?[]:r.has(e)?[]:(r.add(e),Array.isArray(e)?e.flatMap((n,o)=>$e(n,`${t}[${o}]`,r)):Object.entries(e).flatMap(([n,o])=>$e(o,`${t}.${n}`,r)))}function It(e){let t=[];for(let r of $e(e)){Yr.test(r.value)&&t.push({rule:"github_token",path:r.path}),Br.test(r.value)&&t.push({rule:"npm_token",path:r.path}),Gr.test(r.value)&&t.push({rule:"slack_token",path:r.path}),Wr.test(r.value)&&t.push({rule:"private_key",path:r.path}),Kr.test(r.value)&&t.push({rule:"aws_access_key",path:r.path}),xt.lastIndex=0;for(let n of r.value.matchAll(xt)){let o=n[1];if(Xr(o)>=3.5){t.push({rule:"high_entropy_assignment",path:r.path});break}}}return t.filter((r,n,o)=>o.findIndex(i=>i.rule===r.rule&&i.path===r.path)===n)}function Jr(e){let t=e.author.trim()||"unknown";if(e.settings.require_attributed_author&&t.toLowerCase()==="unknown")throw new p("Mutation author is required by workspace policy.",f.USAGE,{code:"mutation_author_required",required:"Pass --author <id>, set PM_AUTHOR, or configure author_default.",nextSteps:["Retry with --author <stable-agent-id>.","Set PM_AUTHOR for this agent session."]});if(e.settings.secret_guard==="off")return{author:t,findings:[],warnings:[],override_applied:!1};let r;try{r=It(e.payload)}catch{return{author:t,findings:[],warnings:["secret_guard_scan_failed_open"],override_applied:!1}}if(r.length===0)return{author:t,findings:r,warnings:[],override_applied:!1};let n=[...new Set(r.map(o=>o.rule))].sort().join(",");if(e.settings.secret_guard==="block"&&e.force!==!0)throw new p(`Mutation blocked by secret guard (${n}). No detected value was logged.`,f.CONFLICT,{code:"mutation_secret_guard_blocked",required:"Remove the credential-shaped content or retry with --force after explicit review.",nextSteps:["Replace the value with a secret-manager reference.","Use pm history-redact if equivalent content already entered history."],recovery:{recovery_mode:"compact",attempted_command:"pm <mutation> [REDACTED]",normalized_args:["[REDACTED]"],suggested_retry:"Remove credential-shaped content, then retry the mutation."}});return{author:t,findings:r,warnings:[`secret_guard_detected:${r.length}:rules=${n}`,...e.settings.secret_guard==="block"&&e.force===!0?["secret_guard_force_override"]:[]],override_applied:e.settings.secret_guard==="block"&&e.force===!0}}function Zr(e){return Fe.has(e.trim().toLowerCase())}function en(){return[...Fe.keys()].sort((e,t)=>e.localeCompare(t))}function Ds(e){return Fe.get(e.trim().toLowerCase())}(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]="64312ac7-5a99-5a21-b99f-2bdef1b54a06")}catch{}})();var tn=/\b[a-z][a-z0-9]*-\d+(?:-[a-z0-9]+)*\b/giu;function se(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function W(e){return[...new Set(se(e).match(/[\p{L}\p{N}]+/gu)??[])]}function G(e){let t=se(e);return{normalized:t,tokens:W(t),issueCodes:[...new Set(t.match(tn)?.map(r=>r.toLowerCase())??[])]}}function Ue(e,t){let r=new Set(e),n=new Set(t),o=new Set([...r,...n]);if(o.size===0)return 1;let i=0;for(let s of r)n.has(s)&&(i+=1);return i/o.size}function ae(e,t){return ce(G(e),G(t))}function ce(e,t){if(e.normalized===t.normalized)return{score:1,reason:"exact_title"};let r=new Set(e.issueCodes);return t.issueCodes.some(n=>r.has(n))?{score:.99,reason:"issue_code"}:{score:Ue(e.tokens,t.tokens),reason:"title_token_jaccard"}}import rn 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]="376bb9d2-e202-57e7-86c8-d70a7d3fa7ab")}catch{}})();function de(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function nn(e,t){return[e.updated_at,t].map(n=>({value:n,time:Date.parse(n??"")})).filter(n=>typeof n.value=="string"&&Number.isFinite(n.time)).sort((n,o)=>o.time-n.time)[0]?.value??e.updated_at}function At(e,t){let r=Math.max(1,Math.trunc(t.threshold_hours)),n=(t.now??new Date).getTime(),o=de(t.in_progress_status),i=[];for(let s of e){if(de(String(s.status))!==o||(s.assignee?.trim().length??0)>0)continue;let a=nn(s,t.last_history_activity?.(s)),c=Date.parse(a);if(!Number.isFinite(c))continue;let d=Math.max(0,Math.floor((n-c)/36e5));d>=r&&i.push({id:s.id,last_activity_at:a,age_hours:d})}return i.sort((s,a)=>a.age_hours-s.age_hours||s.id.localeCompare(a.id)),{threshold_hours:r,count:i.length,items:i,remediation:"Claim active work with `pm claim <id>` or return abandoned work to open with `pm update <id> --status open`."}}async function on(e,t,r){let n=new Map;return await Promise.all(t.filter(o=>de(String(o.status))===de(r.in_progress_status)&&(o.assignee?.trim().length??0)===0).map(async o=>{let i;try{i=await Tt(rn.join(e,"history",`${o.id}.jsonl`),o.id)}catch{return}let s=i.map(a=>a.ts).filter(a=>Number.isFinite(Date.parse(a))).sort((a,c)=>Date.parse(c)-Date.parse(a))[0];s&&n.set(o.id,s)})),At(t,{...r,last_history_activity:o=>n.get(o.id)})}import{mkdir as sn,readFile as an}from"node:fs/promises";import Ct 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]="71a8cd89-54fc-5f8a-b93b-9e4a79bb34b6")}catch{}})();function cn(e){let t=e.trim();if(!t)throw new p("--rollback requires a non-empty checkpoint ID",f.USAGE);if(!/^[a-zA-Z0-9._-]+$/.test(t))throw new p("--rollback checkpoint ID must match [a-zA-Z0-9._-]+",f.USAGE);return t}function dn(e,t){let r=t.replace(/[-:.TZ]/g,"").slice(0,14),n=Math.random().toString(36).slice(2,8);return`${e}-${r}-${n}`}function vt(e,t){return Ct.join(e,"checkpoints",t)}function Lt(e,t,r){return Ct.join(vt(e,t),`${r}.json`)}async function ln(e,t,r,n){let o=vt(e,t);await sn(o,{recursive:!0});let i=Lt(e,t,r);return await S(i,`${JSON.stringify(n,null,2)}
2
2
  `),i}function un(e,t){if(!Array.isArray(e.items))throw new p(`Checkpoint ${t} is missing items`,f.GENERIC_FAILURE);return e.items.map(r=>{if(!r||typeof r!="object")throw new p(`Checkpoint ${t} contains an invalid item entry`,f.GENERIC_FAILURE);let n=r;if(typeof n.id!="string"||n.id.trim().length===0)throw new p(`Checkpoint ${t} contains an item entry without ID`,f.GENERIC_FAILURE);if(typeof n.target_updated_at!="string"||n.target_updated_at.trim().length===0)throw new p(`Checkpoint ${t} contains an item entry without target_updated_at`,f.GENERIC_FAILURE);return{id:n.id.trim(),target_updated_at:n.target_updated_at.trim()}})}async function fn(e,t,r,n){let o=cn(r),i=Lt(e,t,o);if(!await $(i))throw new p(`Checkpoint ${o} not found`,f.NOT_FOUND);let s=await an(i,"utf8"),a;try{a=JSON.parse(s)}catch(l){throw new p(`Checkpoint ${o} contains invalid JSON: ${b(l)}`,f.GENERIC_FAILURE)}if(!a||typeof a!="object")throw new p(`Checkpoint ${o} is invalid`,f.GENERIC_FAILURE);let c=a;if(c.schema_version!==n)throw new p(`Checkpoint ${o} has unsupported schema version`,f.GENERIC_FAILURE);let d=un(c,o);return{record:c,items:d,path:i,id:typeof c.id=="string"?c.id:o,created_at:typeof c.created_at=="string"?c.created_at:R(),author:typeof c.author=="string"?c.author:"unknown"}}async function mn(e,t){let r=[],n=[];for(let o of e)try{let i=await t(o.id,o.target_updated_at);r.push({id:o.id,status:"restored",changed_fields:i.changed_fields,warnings:i.warnings}),n.push(o.id)}catch(i){r.push({id:o.id,status:"failed",error:b(i)})}return{rows:r,restored_ids:n,failed_count:r.filter(o=>o.status==="failed").length}}(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]="4507a449-1c20-5684-9ed8-e72c9bc694c1")}catch{}})();function V(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t.length>0?t:null}function pn(e,t){let r=V(t);return!e||!r?null:[...e.search_providers].reverse().find(o=>(V(o.runtime_definition?.name)??V(o.definition?.name))===r)??null}function _n(e,t){let r=V(t);return!e||!r?null:[...e.vector_store_adapters].reverse().find(o=>(V(o.runtime_definition?.name)??V(o.definition?.name))===r)??null}(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]="7426082f-94a6-5b4e-9748-d3faab2fe1d4")}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]="4a376062-2e23-5991-80a5-27183909caf3")}catch{}})();var hn=new Set(["none","null","undefined"]);function Xs(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="warn"||t==="strict_error")return t;if(t==="strict")return"strict_error";throw new p("Config set parent-reference-policy requires --policy with one of: warn, strict_error (alias: strict)",f.USAGE)}function gn(e){if(typeof e!="string")throw new p("--parent must be a string. Use --unset parent to clear this field.",f.USAGE);let t=e.trim();if(t.length===0)throw new p("--parent must not be empty. Use --parent none to unset.",f.USAGE);if(Dt(t))throw new p(`--parent must not use placeholder token "${t}". Use --unset parent to clear this field.`,f.USAGE);return t}function Dt(e){return hn.has(e.trim().toLowerCase())}function yn(e,t){if(t==="strict_error")throw new p(`Parent item "${e}" was not found. Create it first or use --parent none.`,f.USAGE);return{warnings:[`validation_warning:parent_reference_missing:${e}`]}}function wn(e,t,r){let n=oe(e,r),o=oe(t,r);if(n!==o)return;let i=t!==o||e!==n?` (normalized from parent "${t}" and item "${e}")`:"";throw new p(`Parent item "${o}" cannot be the same as item "${n}"${i}. Use --unset parent to clear this field.`,f.USAGE)}(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]="806bf35f-dc7e-55a8-9bb9-64be87111c22")}catch{}})();var Ve={critical:0,high:1,medium:2,low:3,minimal:4},En=Object.keys(Ve),bn=`numbers 0..4 (0=critical, 1=high, 2=medium, 3=low, 4=minimal) or names (${En.join(", ")}), case-insensitive`;function le(e){return new p(`Invalid priority "${e}". Accepted values: ${bn}.`,f.USAGE)}function Sn(e){if(typeof e=="number"){if(Number.isInteger(e)&&e>=0&&e<=4)return e;throw le(String(e))}if(typeof e!="string")throw le(String(e));let t=e.trim();if(t.length===0)throw le(e);let r=t.toLowerCase();if(Object.prototype.hasOwnProperty.call(Ve,r))return Ve[r];if(/^[0-4]$/.test(t))return Number(t);throw le(e)}(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]="bf76a01e-7292-59df-94ca-1e41aaff7365")}catch{}})();var Tn=/^[A-Za-z0-9][A-Za-z0-9._/-]*$/,xn=64;function oa(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="warn"||t==="strict_error")return t;if(t==="strict")return"strict_error";throw new p("Config set sprint-release-format-policy requires --policy with one of: warn, strict_error (alias: strict)",f.USAGE)}function In(e,t,r){let n=t.trim();if(n.length===0)throw new p(`--${e} must not be empty. Use --${e} none to unset.`,f.USAGE);if(n.length<=xn&&Tn.test(n))return{value:n,warnings:[]};let i="Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._/-]* (no spaces).";if(r==="strict_error")throw new p(`Invalid --${e} value "${n}". ${i}`,f.USAGE);return{value:n,warnings:[`validation_warning:${e}_format:${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]="d0e997bc-8bdb-5602-8606-73ecf77b2a35")}catch{}})();var Rt={open:"open_status",closed:"close_status",canceled:"canceled_status",cancelled:"canceled_status"},Nt="all";function la(e){if(typeof e!="string")return!1;let t=e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r.length>0);return t.length===1&&t[0]===Nt}function An(e,t){let r=e.trim().toLowerCase();if(r.length===0)return;let n=Rt[r];return n?t[n]:Re(e,t)}function Cn(e){let t=new Set(Object.keys(Rt));for(let r of e.definitions){t.add(r.id);for(let n of r.aliases)t.add(n)}return[...t]}function vn(e,t){let r=e.trim().toLowerCase(),n,o=Number.POSITIVE_INFINITY;for(let i of Cn(t)){let s=xe(r,i.toLowerCase(),2);s!==null&&s<o&&(n=i,o=s)}return n}function Ln(e,t,r){if(typeof e!="string")return;let n=r?.strict===!0,o=r?.flagLabel??"--status",i=e.split(",").map(c=>c.trim()).filter(c=>c.length>0);if(i.length===0)return;if(i.filter(c=>c.trim().toLowerCase()===Nt).length>0){if(i.length===1)return;throw new p(`Invalid ${o} value "all". Use it by itself, or omit ${o} to search every status.`,f.USAGE)}let a=[];for(let c of i){let d=An(c,t);if(d===void 0){if(n){let l=vn(c,t);throw new p(`Invalid ${o} value "${c}". Use open|closed|canceled or a configured status id${l?`. Did you mean "${l}"?`:"."}`,f.USAGE)}a.push(c);continue}a.push(d)}return[...new Set(a)]}(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]="b7a167e0-3041-5056-a672-ea0a054ed8df")}catch{}})();var Dn={bug:"Issue",bugfix:"Issue",defect:"Issue",incident:"Issue",enhancement:"Feature",story:"Feature",userstory:"Feature","user-story":"Feature","user story":"Feature",change:"Chore",ticket:"Task",todo:"Task"};function Rn(e){if(e!==void 0)return Dn[e.trim().toLowerCase()]}(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]="6d11dc0f-e313-5b39-965d-6bc84ad52966")}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]="43a56374-808c-5fa6-bd6c-5d93175df0d2")}catch{}})();function Mt(e,t){return Le(e,t)}function Nn(e,t,r){let n={};for(let o of t.command_to_fields.get(r)??[]){let i=bt(e,o);i!==void 0&&(n[o.metadata_key]=St(o,i))}return n}function Mn(e,t){for(let[r,n]of Object.entries(t)){let o=e[r];if(Array.isArray(n)){if(Array.isArray(o)){let i=o.map(a=>String(a));if(!n.map(a=>String(a)).every(a=>i.includes(a)))return!1;continue}if(!Mt(o,n[n.length-1]))return!1;continue}if(!Mt(o,n))return!1}return!0}import{spawnSync as Ot}from"node:child_process";(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]="12bfc6e7-8979-58e8-8276-98cc859f3e32")}catch{}})();var kn="PM_DISABLE_OLLAMA_AUTO_DEFAULTS",On="PM_OLLAMA_MODEL",Pn="http://localhost:11434",zn="qwen3-embedding:0.6b",$n=".agents/pm/search/lancedb/",Fn=1500,Un=2500,Vn=/qwen.*(?:embed|embedding)|(?:embed|embedding).*qwen/i,jn=/embed|embedding/i,I=h;function qn(){let e=I(process.env[kn]);if(!e)return!1;let t=e.toLowerCase();return t==="1"||t==="true"||t==="yes"}function kt(e){return e.some(t=>I(t)!==null)}function Hn(e){let t=I(e);return!!(t&&t.toLowerCase()!=="ollama")}function Yn(e){let t=I(e);return!!(t&&t.toLowerCase()!=="lancedb")}function Bn(e){return Hn(e.search?.provider)||Yn(e.vector_store?.adapter)||kt([e.providers?.openai?.base_url,e.providers?.openai?.model,e.providers?.openai?.api_key])?!0:kt([e.vector_store?.qdrant?.url,e.vector_store?.qdrant?.api_key])}function Gn(){let e=Ot("ollama",["--version"],{encoding:"utf8",timeout:Fn});return e.error?!1:e.status===0}function Wn(e){let t=e.split(/\r?\n/).map(i=>i.trim()).filter(i=>i.length>0);if(t.length===0)return null;let r=t.map(i=>i.split(/\s+/)[0]?.trim()).filter(i=>!!(i&&i.length>0)).filter(i=>i.toUpperCase()!=="NAME");if(r.length===0)return null;let n=r.find(i=>Vn.test(i));return n||(r.find(i=>jn.test(i))??null)}function Kn(e){let t=I(e.providers?.ollama?.model);if(t)return t;let r=I(process.env[On]);if(r)return r;let n=Ot("ollama",["list"],{encoding:"utf8",timeout:Un});if(!n.error&&n.status===0){let o=Wn(typeof n.stdout=="string"?n.stdout:"");if(o)return o}return null}function Qn(e){return{baseUrl:I(e.providers?.ollama?.base_url)===null,model:I(e.providers?.ollama?.model)===null,lancedbPath:I(e.vector_store?.lancedb?.path)===null,embeddingModel:I(e.search?.embedding_model)===null}}function Xn(e){return e.baseUrl||e.model||e.lancedbPath||e.embeddingModel}function Jn(e,t,r){if(!t.baseUrl&&!t.model)return;let n=e.providers??={},o=n.ollama??={};t.baseUrl&&(o.base_url=Pn),t.model&&(o.model=r)}function Zn(e,t){if(!t.lancedbPath)return;let r=e.vector_store??={},n=r.lancedb??={};n.path=$n}function eo(e,t,r){if(!t.embeddingModel)return;let n=e.search??={};n.embedding_model=r}function ue(e){let t={settings:e,auto_ollama_defaults_applied:!1};if(qn()||Bn(e))return t;let r=Qn(e);if(!Xn(r)||r.model&&!Gn())return t;let n=structuredClone(e),o=Kn(n);return o?(Jn(n,r,o),Zn(n,r),eo(n,r,o),{settings:n,auto_ollama_defaults_applied:!0}):{...t,auto_ollama_defaults_skipped_reason:"no_installed_embedding_model",auto_ollama_defaults_remediation:`Run ollama pull ${zn} or configure providers.ollama.model explicitly (and search.embedding_model if you need an override).`}}(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]="d8d5f7e9-5293-564b-bc44-f5ba30336893")}catch{}})();var no="reindex";import Qt 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]="b5ce7132-0024-5d42-9cb8-585933beb7c7")}catch{}})();var oo=3e4;function M(e,t,r=oo){let n=e??r;if(!Number.isFinite(n)||n<=0)throw new Error(`${t} timeout must be a positive finite number`);return Math.floor(n)}function k(e,t){if(e)return e;if(typeof globalThis.fetch=="function")return globalThis.fetch.bind(globalThis);throw new Error(`${t} execution requires a fetch implementation`)}async function io(e){try{return(await e.text()).replaceAll(/\s+/g," ").trim()}catch(t){return`(failed to read response body: ${b(t)})`}}async function fe(e){let t=new AbortController,r=setTimeout(()=>{t.abort()},e.timeoutMs);try{let n;try{n=await e.fetcher(e.endpoint,{method:e.method,headers:e.headers,body:JSON.stringify(e.body),signal:t.signal})}catch(o){throw o instanceof Error&&o.name==="AbortError"?new Error(`${e.requestLabel} timed out after ${e.timeoutMs}ms`):new Error(`${e.requestLabel} execution failed: ${b(o)}`)}if(!n.ok){let o=await io(n),i=o.length>0?`: ${o}`:"";throw new Error(`${e.requestLabel} failed with status ${n.status} ${n.statusText}${i}`)}try{return await n.json()}catch(o){throw new Error(`${e.responseLabel} JSON parse failed: ${b(o)}`)}}finally{clearTimeout(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]="af754be6-8026-530a-8a20-b03d4ed742e1")}catch{}})();function Na(e,t){let r=h(e);if(!r)return"unconfigured";let n=h(t);return n&&n.toLowerCase()===r.toLowerCase()?"configured":"auto-detected"}function so(e){let t=B(e),r=t.toLowerCase();return r.endsWith("/embeddings")?t:r.endsWith("/v1")?`${t}/embeddings`:`${t}/v1/embeddings`}function $t(e){let t=e.search?.embedding_model;return h(t)||null}function ao(e){let t=h(e.providers?.openai?.base_url),r=h(e.providers?.openai?.model);if(!t||!r)return null;let n=$t(e),o=h(e.providers?.openai?.api_key);return{name:"openai",base_url:t,model:n??r,...o?{api_key:o}:{}}}function co(e){let t=h(e.providers?.ollama?.base_url),r=h(e.providers?.ollama?.model);if(!t||!r)return null;let n=$t(e);return{name:"ollama",base_url:t,model:n??r}}function Ft(e){let t=(Array.isArray(e)?e:[e]).map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0)throw new Error("Embedding input must include at least one non-empty string");return t}function lo(e){let t=[],r=[],n=new Map;for(let o of e){let i=n.get(o);if(i===void 0){let s=t.length;t.push(o),n.set(o,s),r.push(s);continue}r.push(i)}return{uniqueInputs:t,originalToUniqueIndex:r}}function uo(e){let t=e.map((n,o)=>({embedding:n.embedding,index:n.index,position:o}));if(t.some(n=>n.index!==void 0)){for(let n of t)if(!Number.isInteger(n.index))throw new TypeError(`OpenAI embedding response entry at position ${n.position} is missing a valid integer index`);return[...t].sort((n,o)=>{let i=n.index-o.index;return i!==0?i:n.position-o.position})}return t}function je(e){let t=ao(e),r=co(e),n=[t,r].filter(a=>a!==null),o=h(e.search?.provider),i=o?o.toLowerCase():null;return{active:(i?n.find(a=>a.name===i):void 0)??n[0]??null,available:n}}function zt(e){let t=B(e.base_url);return e.name==="openai"?{provider:"openai",endpoint:so(t),model:e.model}:{provider:"ollama",endpoint:`${t}/api/embed`,model:e.model}}function fo(e,t){let r=Ft(t);return e.name==="openai"?{target:zt(e),method:"POST",headers:{"content-type":"application/json",...e.api_key?{authorization:`Bearer ${e.api_key}`}:{}},body:{model:e.model,input:r.length===1?r[0]:r}}:{target:zt(e),method:"POST",headers:{"content-type":"application/json"},body:{model:e.model,input:r}}}function mo(e,t){if(e.name==="openai"){let o=t.data;if(!Array.isArray(o)||o.length===0)throw new Error("OpenAI embedding response must include a non-empty data array");return uo(o).map((s,a)=>{let c=s.embedding;if(!U(c))throw new Error(`OpenAI embedding response entry at index ${a} is missing a numeric embedding vector`);return[...c]})}let r=t.embedding;if(U(r))return[[...r]];let n=t.embeddings;if(Array.isArray(n)&&n.length>0)return n.map((o,i)=>{if(!U(o))throw new Error(`Ollama embedding response entry at index ${i} is missing a numeric embedding vector`);return[...o]});throw new Error("Ollama embedding response must include embedding or embeddings vectors")}async function Ut(e,t,r={}){let n=M(r.timeout_ms,"Embedding request"),o=k(r.fetcher,"Embedding request"),i=Ft(t),s=lo(i),a=fo(e,s.uniqueInputs),c=await fe({endpoint:a.target.endpoint,method:a.method,headers:a.headers,body:a.body,timeoutMs:n,fetcher:o,requestLabel:"Embedding request",responseLabel:"Embedding response"}),d=mo(e,c);if(d.length!==s.uniqueInputs.length)throw new Error(`Embedding response cardinality mismatch: expected ${s.uniqueInputs.length} vector(s), received ${d.length}`);return s.originalToUniqueIndex.map(l=>[...d[l]])}(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]="61c0153b-8fa5-5c26-aa88-ca9807f2d160")}catch{}})();var me=["title","description","tags","status","type","priority","assignee","parent","goal","value","why_now","risk","confidence","estimated_minutes","acceptance_criteria","resolution","expected_result","actual_result","body","comments","notes","learnings","reminders","events","dependencies","plan"];function qe(e){let t=e?.search?.corpus_fields;if(!Array.isArray(t))return[...me];let r=new Set(me),n=Array.from(new Set(t.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0&&r.has(o))));return n.length>0?n:[...me]}var po=8e3,He=3200,O="...[semantic corpus truncated]",_o="search_embedding_corpus_max_characters_invalid:using_provider_default";function C(e){return e.map(t=>t==null?"":String(t).trim()).filter(t=>t.length>0).join(" ")}function ho(e){return(e.reminders??[]).map(t=>C([t.at,t.text]))}function go(e){return(e.events??[]).map(t=>C([t.start_at,t.end_at,t.title,t.description,t.location,t.all_day===!0?"all day":void 0,t.timezone,t.recurrence?.freq,t.recurrence?.interval,t.recurrence?.count,t.recurrence?.until,t.recurrence?.by_weekday?.join(" "),t.recurrence?.by_month_day?.join(" "),t.recurrence?.exdates?.join(" ")]))}function yo(e,t){e.push(t.title,t.body,t.status,t.owner,t.evidence,t.blocked_reason,t.superseded_by);for(let r of t.linked_items??[])e.push(`${r.kind} ${r.id}`,r.note);for(let r of t.files??[])e.push(r.path,r.note);for(let r of t.tests??[])e.push(r.command,r.path,r.note);for(let r of t.docs??[])e.push(r.path,r.note)}function wo(e,t){for(let r of t.plan_decisions??[])e.push(r.decision,r.rationale,r.evidence);for(let r of t.plan_discoveries??[])e.push(r.text);for(let r of t.plan_validation??[])e.push(r.text,r.command,r.expected)}function Oa(e){let t=[];t.push(e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context);for(let r of e.plan_steps??[])yo(t,r);return wo(t,e),t.filter(r=>typeof r=="string"&&r.length>0).join(" ")}function Eo(e){let t=(e.plan_steps??[]).map(s=>C([s.order,s.id,s.title,s.body,s.status,s.owner,s.evidence,s.blocked_reason,s.superseded_by,(s.linked_items??[]).map(a=>C([a.kind,a.id,a.note])).join(" "),(s.files??[]).map(a=>C([a.path,a.note])).join(" "),(s.tests??[]).map(a=>C([a.command,a.path,a.note])).join(" "),(s.docs??[]).map(a=>C([a.path,a.note])).join(" ")])),r=(e.plan_decisions??[]).map(s=>C([s.decision,s.rationale,s.evidence,s.step_id])),n=(e.plan_discoveries??[]).map(s=>C([s.text,s.step_id])),o=(e.plan_validation??[]).map(s=>C([s.text,s.command,s.expected]));if([e.plan_mode,e.plan_scope,e.plan_harness,e.plan_resume_context,...t,...r,...n,...o].some(s=>s!==void 0))return{mode:e.plan_mode,scope:e.plan_scope,harness:e.plan_harness,resume_context:e.plan_resume_context,steps:t,decisions:r,discoveries:n,validation:o}}function A(e){return typeof e=="string"&&e.trim().length>0}var bo={title:e=>e.metadata.title,description:e=>e.metadata.description,tags:e=>e.metadata.tags,status:e=>e.metadata.status,type:e=>e.metadata.type,priority:e=>typeof e.metadata.priority=="number"?e.metadata.priority:void 0,assignee:e=>A(e.metadata.assignee)?e.metadata.assignee:void 0,parent:e=>A(e.metadata.parent)?e.metadata.parent:void 0,goal:e=>A(e.metadata.goal)?e.metadata.goal:void 0,value:e=>A(e.metadata.value)?e.metadata.value:void 0,why_now:e=>A(e.metadata.why_now)?e.metadata.why_now:void 0,risk:e=>A(e.metadata.risk)?e.metadata.risk:void 0,confidence:e=>e.metadata.confidence!==void 0&&e.metadata.confidence!==null?e.metadata.confidence:void 0,estimated_minutes:e=>typeof e.metadata.estimated_minutes=="number"?e.metadata.estimated_minutes:void 0,acceptance_criteria:e=>A(e.metadata.acceptance_criteria)?e.metadata.acceptance_criteria:void 0,resolution:e=>A(e.metadata.resolution)?e.metadata.resolution:void 0,expected_result:e=>A(e.metadata.expected_result)?e.metadata.expected_result:void 0,actual_result:e=>A(e.metadata.actual_result)?e.metadata.actual_result:void 0,body:e=>e.body,comments:e=>(e.metadata.comments??[]).map(t=>t.text),notes:e=>(e.metadata.notes??[]).map(t=>t.text),learnings:e=>(e.metadata.learnings??[]).map(t=>t.text),reminders:e=>ho(e.metadata),events:e=>go(e.metadata),dependencies:e=>(e.metadata.dependencies??[]).map(t=>({id:t.id,kind:t.kind})),plan:e=>Eo(e.metadata)};function Vt(e,t={}){let r=t.fields??me,n={};for(let o of r){let i=bo[o];if(!i)continue;let s=i(e);s!==void 0&&(n[o]=s)}return n}function So(e){return e?.trim().toLowerCase()==="ollama"?He:po}function j(e,t){let r=So(e),n=Et(t);return n!==null?{maxCharacters:n,warning:null}:{maxCharacters:r,warning:t==null?null:_o}}function Ye(e,t={}){let r=JSON.stringify(Vt(e,{fields:t.fields})),n=j(t.providerName,t.maxCharacters).maxCharacters;if(r.length<=n)return r;if(n<=O.length)return O.slice(0,n);let o=Math.max(0,n-O.length);return`${r.slice(0,o)}${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]="2c518b97-bc75-5e3f-91e8-d6779d565558")}catch{}})();function To(e,t){let r=e.search.embedding_batch_size,n=e.search.embedding_timeout_ms,o=e.search.scanner_max_batch_retries,i=Number.isFinite(r)&&r>0?Math.floor(r):1,s=Number.isFinite(n)&&n>0?Math.floor(n):3e4,a=Number.isFinite(o)&&o>=0?Math.floor(o):0;return{batchSize:i,timeoutMs:s,maxRetries:a,maxBatchInputCharacters:Number.POSITIVE_INFINITY,maxInputCharacters:t}}function xo(e,t,r){let n=[],o=[],i=0;for(let s of e){let a=o.length>=t,c=o.length>0&&Number.isFinite(r)&&i+s.length>r;(a||c)&&(n.push(o),o=[],i=0),o.push(s),i+=s.length}return n.push(o),n}function Io(e,t){return e.name!=="ollama"?t:{...t,maxBatchInputCharacters:He}}function Ao(e,t){if(!Number.isFinite(t)||t<=0||e.length<=t)return e;let r=Math.max(0,t-O.length);return`${e.slice(0,r)}${O}`.slice(0,t)}function jt(e){let t=b(e).toLowerCase();return t.includes("timed out")||t.includes("timeout")}function Co(e,t,r,n,o,i){let s=`Embedding batch ${t} failed after ${o} attempt(s): ${b(i)}`,a=`provider=${e.name} model=${e.model} batch_size=${r} timeout_ms=${n}`;return jt(i)?`${s} (${a}; guidance=check provider availability or lower search.embedding_batch_size, raise search.embedding_timeout_ms, or run keyword search while semantic indexing catches up)`:`${s} (${a})`}async function Be(e,t,r,n,o,i){let s=null;for(let a=0;a<=o;a+=1)try{let c=await Ut(e,t,{timeout_ms:n});return a>0&&i.push(`search_embedding_batch_retry_succeeded:batch=${r}:attempt=${a+1}:size=${t.length}`),c}catch(c){if(s=c,jt(c)&&t.length>1){let d=Math.ceil(t.length/2),l=t.slice(0,d),u=t.slice(d);return i.push(`search_embedding_batch_split_after_timeout:batch=${r}:size=${t.length}:parts=${l.length}|${u.length}`),[...await Be(e,l,`${r}.1`,n,o,i),...await Be(e,u,`${r}.2`,n,o,i)]}if(a<o){let d=Math.min(1e3*2**a,8e3);await new Promise(l=>setTimeout(l,d))}}throw new Error(Co(e,r,t.length,n,o+1,s))}async function Ge(e,t,r,n={}){if(r.length===0)return{vectors:[],warnings:[]};let o=[],i=j(e.name,t.search.embedding_corpus_max_characters);i.warning&&o.push(i.warning);let s=Io(e,To(t,i.maxCharacters)),a=0,c=r.map(_=>{let m=Ao(_,s.maxInputCharacters);return m.length<_.length&&(a+=1),m});a>0&&o.push(`search_embedding_input_truncated:count=${a}:max_characters=${s.maxInputCharacters}`);let d=xo(c,s.batchSize,s.maxBatchInputCharacters),l=[],u=0;for(let _=0;_<d.length;_+=1){let m=d[_];n.onProgress?.({batch_index:_+1,batch_total:d.length,batch_size:m.length,completed_inputs:u,total_inputs:c.length,phase:"start"}),l.push(...await Be(e,m,String(_+1),s.timeoutMs,s.maxRetries,o)),u+=m.length,n.onProgress?.({batch_index:_+1,batch_total:d.length,batch_size:m.length,completed_inputs:u,total_inputs:c.length,phase:"complete"})}return{vectors:l,warnings:o}}import{mkdir as vo,readFile as Lo,stat as Qe,unlink as Do}from"node:fs/promises";import{basename as qt,dirname as We,isAbsolute as Ro,join as No,resolve as Xe}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]="7bac9506-dcad-5e52-848b-3e2631d4936c")}catch{}})();var Je="pm_items",Mo=/[^a-zA-Z0-9_-]/g,ko=128,Oo=".pm-cli-local-vectors",Ke=1,P=new Map;function Q(e){return(h(e.collection_name)??Je).replaceAll(Mo,"_").slice(0,ko)}function pe(e){if(!U(e)||e.length===0)throw new Error("Vector values must be a non-empty numeric array");return[...e]}function Yt(e){if(!Number.isFinite(e)||e<=0)throw new Error("Vector query limit must be a positive number");return Math.floor(e)}function Po(e){let t=e.result;if(!Array.isArray(t))throw new TypeError("Qdrant query response must include a result array");let r=t.map((n,o)=>{let i=n.id,s=typeof i=="number"?String(i):i,a=h(s);if(!a)throw new Error(`Qdrant query response entry at index ${o} is missing a non-empty id`);let c=n.score;if(typeof c!="number"||!Number.isFinite(c))throw new TypeError(`Qdrant query response entry at index ${o} is missing a finite numeric score`);let d=n.payload;if(d!==void 0&&(typeof d!="object"||d===null||Array.isArray(d)))throw new Error(`Qdrant query response entry at index ${o} must provide payload as an object when set`);return{id:a,score:c,...d?{payload:d}:{}}});return r.sort((n,o)=>n.score!==o.score?o.score-n.score:n.id.localeCompare(o.id)),r}function Ze(e){let t=h(e.result?.status);if(t)return{status:t};let r=h(e.status);if(r)return{status:r};throw new Error("Qdrant upsert response must include status metadata")}async function K(e,t,r,n,o){return await fe({endpoint:e,method:t.method,headers:t.headers,body:t.body,timeoutMs:r,fetcher:n,requestLabel:`Vector ${o} request`,responseLabel:`Vector ${o} response`})}function zo(e){let t=h(e.vector_store?.qdrant?.url);if(!t)return null;let r=h(e.vector_store?.collection_name),n=h(e.vector_store?.qdrant?.api_key);return{name:"qdrant",url:t,...r&&r!==Je?{collection_name:r}:{},...n?{api_key:n}:{}}}function $o(e){let t=Xe(e),r=We(t);return qt(t)==="pm"&&qt(r)===".agents"?We(r):t}function Fo(e,t){return!t||Ro(e)?e:Xe($o(t),e)}function Uo(e,t){let r=h(e.vector_store?.lancedb?.path);if(!r)return null;let n=h(e.vector_store?.collection_name);return{name:"lancedb",path:Fo(r,t),...n&&n!==Je?{collection_name:n}:{}}}function Vo(e){if(!Array.isArray(e)||e.length===0)throw new Error("Vector upsert records must include at least one entry");return e.map((t,r)=>{let n=h(t.id);if(!n)throw new Error(`Vector upsert record at index ${r} is missing a non-empty id`);let o=pe(t.vector),i=t.payload;if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw new Error(`Vector upsert record at index ${r} must provide payload as an object when set`);return{id:n,vector:o,...i?{payload:i}:{}}})}function jo(e){if(!Array.isArray(e)||e.length===0)throw new Error("Vector delete ids must include at least one entry");let t=e.map((n,o)=>{let i=h(n);if(!i)throw new Error(`Vector delete id at index ${o} is missing a non-empty value`);return i}).sort((n,o)=>n.localeCompare(o)),r=[];for(let n of t)r.at(-1)!==n&&r.push(n);return r}function qo(e){return e.replace(/\/points\?wait=true$/,"/points/delete?wait=true")}function Ho(e){return e.replace(/\/points\?wait=true$/,"")}function _e(e){return{"content-type":"application/json",...e.api_key?{"api-key":e.api_key}:{}}}function he(e,t){return q(e,t)}function q(e,t){return No(Xe(e),Oo,`${t}.json`)}function et(e,t){return typeof e=="object"&&e!==null&&e.code===t}function Yo(e,t,r){let n=h(e.id);if(!n)throw new Error(`LanceDB local snapshot '${r}' record at index ${t} is missing a non-empty id`);let o=pe(e.vector),i=e.payload;if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw new Error(`LanceDB local snapshot '${r}' record '${n}' must provide payload as an object when set`);return{id:n,vector:o,...i?{payload:i}:{}}}function Bo(e,t,r){let n;try{n=JSON.parse(r)}catch(c){throw new Error(`LanceDB local snapshot at '${e}' is not valid JSON: ${b(c)}`)}if(typeof n!="object"||n===null||Array.isArray(n))throw new Error(`LanceDB local snapshot at '${e}' must be a JSON object`);if(n.version!==Ke)throw new Error(`LanceDB local snapshot at '${e}' must include version=${Ke}`);let i=h(n.table);if(!i)throw new Error(`LanceDB local snapshot at '${e}' must include a non-empty table value`);if(i!==t)throw new Error(`LanceDB local snapshot at '${e}' table mismatch: expected '${t}', received '${i}'`);let s=n.records;if(!Array.isArray(s))throw new TypeError(`LanceDB local snapshot at '${e}' must include a records array`);let a=new Map;for(let c=0;c<s.length;c+=1){let d=Yo(s[c],c,e);a.set(d.id,d)}return a}async function Go(e){try{let t=await Qe(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch(t){if(!et(t,"ENOENT"))throw t;return null}}function Wo(e,t){if(!t)return null;if(t.mtimeMs===null&&t.size===null&&t.records.size===0)return t.records;let r=new Map;return P.set(e,{records:r,mtimeMs:null,size:null}),r}function Ko(e,t){return e!==void 0&&t!==null&&e.mtimeMs===t.mtimeMs&&e.size===t.size}async function tt(e,t){let r=he(e,t),n=q(e,t),o=await Go(n),i=P.get(r);if(!o){let a=Wo(r,i);if(a)return a}if(Ko(i,o))return i.records;let s=new Map;try{let a=await Lo(n,"utf8");s=Bo(n,t,a)}catch(a){if(!et(a,"ENOENT"))throw a}return P.set(r,{records:s,mtimeMs:o?.mtimeMs??null,size:o?.size??null}),s}function Qo(e){let t=[...e.values()];return t.sort((r,n)=>r.id.localeCompare(n.id)),t.map(r=>({id:r.id,vector:[...r.vector],...r.payload?{payload:r.payload}:{}}))}async function Bt(e){try{await Do(e)}catch(t){if(!et(t,"ENOENT"))throw new Error(`LanceDB local snapshot delete failed at '${e}': ${b(t)}`)}}async function Gt(e,t,r){let n=q(e,t);if(r.size===0){await Bt(n);return}let o=We(n);try{await vo(o,{recursive:!0})}catch(s){throw new Error(`LanceDB local snapshot directory create failed at '${o}': ${b(s)}`)}let i=`${JSON.stringify({version:Ke,table:t,records:Qo(r)})}
3
3
  `;try{await S(n,i)}catch(s){throw new Error(`LanceDB local snapshot write failed at '${n}': ${b(s)}`)}}async function Xo(e,t){let r=he(e,t),n=q(e,t);await Bt(n),P.delete(r)}function Ht(e){let t=0;for(let r=0;r<e.length;r+=1)t+=e[r]*e[r];return Math.sqrt(t)}function Jo(e,t){let r=0;for(let i=0;i<e.length;i+=1)r+=e[i]*t[i];let n=Ht(e),o=Ht(t);return n===0||o===0?0:r/(n*o)}function rt(e,t){let r=zo(e),n=Uo(e,t),o=[r,n].filter(c=>c!==null),i=h(e.vector_store?.adapter),s=i?i.toLowerCase():null;return{active:(s?o.find(c=>c.name===s):void 0)??o[0]??null,available:o}}function ge(e){let t=Q(e);if(e.name==="qdrant"){let o=B(e.url),i=encodeURIComponent(t);return{store:"qdrant",query_target:`${o}/collections/${i}/points/search`,upsert_target:`${o}/collections/${i}/points?wait=true`}}let r=encodeURIComponent(e.path),n=encodeURIComponent(t);return{store:"lancedb",query_target:`lancedb://${r}#${n}`,upsert_target:`lancedb://${r}#${n}`}}function Zo(e,t,r){let n=ge(e),o=pe(t),i=Yt(r);return e.name==="qdrant"?{target:n,method:"POST",headers:_e(e),body:{vector:o,limit:i,with_payload:!0}}:{target:n,method:"LOCAL",headers:{},body:{table:Q(e),vector:o,limit:i}}}function ei(e,t){let r=ge(e),n=Vo(t);return e.name==="qdrant"?{target:r,method:"POST",headers:_e(e),body:{points:n}}:{target:r,method:"LOCAL",headers:{},body:{table:Q(e),records:n}}}function ti(e,t){let r=ge(e),n=jo(t);return e.name==="qdrant"?{target:r,method:"POST",headers:_e(e),body:{points:n}}:{target:r,method:"LOCAL",headers:{},body:{table:Q(e),ids:n}}}async function Ba(e,t,r,n={}){let o=Zo(e,t,r);if(o.method==="LOCAL"){let c=e,d=o.body,l=await tt(c.path,d.table);if(l.size===0)return[];let u=pe(d.vector),_=Yt(d.limit),m=[],w=0;for(let g of l.values()){if(g.vector.length!==u.length){w++;continue}m.push({id:g.id,score:Jo(u,g.vector),...g.payload?{payload:g.payload}:{}})}return w>0&&n.warnings&&n.warnings.push(`vector_dimension_mismatch:${w} records skipped (expected ${u.length} dimensions)`),m.sort((g,y)=>g.score!==y.score?y.score-g.score:g.id.localeCompare(y.id)),m.slice(0,_)}let i=M(n.timeout_ms,"Vector request"),s=k(n.fetcher,"Vector request"),a=await K(o.target.query_target,{method:"POST",headers:o.headers,body:o.body},i,s,"query");return Po(a)}async function nt(e,t,r={}){let n=ei(e,t);if(n.method==="LOCAL"){let a=e,c=n.body,d=he(a.path,c.table),l=await tt(a.path,c.table);for(let m of c.records)l.set(m.id,m);await Gt(a.path,c.table,l);let u=q(a.path,c.table),_=await Qe(u);return P.set(d,{records:l,mtimeMs:_.mtimeMs,size:_.size}),{status:"ok"}}let o=M(r.timeout_ms,"Vector request"),i=k(r.fetcher,"Vector request"),s=await K(n.target.upsert_target,{method:"POST",headers:n.headers,body:n.body},o,i,"upsert");return Ze(s)}async function ye(e,t,r={}){let n=ti(e,t);if(n.method==="LOCAL"){let a=e,c=n.body,d=he(a.path,c.table),l=await tt(a.path,c.table);if(l.size===0)return{status:"ok"};for(let u of c.ids)l.delete(u);if(await Gt(a.path,c.table,l),l.size===0)P.delete(d);else{let u=q(a.path,c.table),_=await Qe(u);P.set(d,{records:l,mtimeMs:_.mtimeMs,size:_.size})}return{status:"ok"}}let o=M(r.timeout_ms,"Vector request"),i=k(r.fetcher,"Vector request"),s=await K(qo(n.target.upsert_target),{method:"POST",headers:n.headers,body:n.body},o,i,"delete");return Ze(s)}async function Wt(e,t=[],r={},n){if(e.name==="lancedb")return await Xo(e.path,Q(e)),{status:"ok"};if(n!==void 0){if(!Number.isInteger(n)||n<=0)throw new Error("Vector reset dimension must be a positive integer when provided");let i=ge(e),s=Ho(i.upsert_target),a=M(r.timeout_ms,"Vector request"),c=k(r.fetcher,"Vector request"),d=_e(e);try{await K(s,{method:"DELETE",headers:d,body:{}},a,c,"delete")}catch(u){if(!b(u).includes("failed with status 404"))throw u}let l=await K(s,{method:"PUT",headers:d,body:{vectors:{size:n,distance:"Cosine"}}},a,c,"upsert");return Ze(l)}let o=t.map(i=>i.trim()).filter(i=>i.length>0);return o.length===0?{status:"ok"}:await ye(e,o,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]="4b3ad5fc-0f86-5f20-a23b-19d447cb0973")}catch{}})();function we(e,t){let r=h(e),n=h(t);return!r||!n?null:{provider:r,model:n}}function Kt(e){if(e==null)return null;if(typeof e!="object"||Array.isArray(e))throw new Error("Vectorization embedding metadata must be an object when set");let t=we(e.provider,e.model),r=e.vector_dimension;if(!t||typeof r!="number"||!Number.isInteger(r)||r<=0)throw new Error("Vectorization embedding metadata must include provider, model, and positive vector_dimension");return{...t,vector_dimension:r}}function ot(e,t){if(!Number.isInteger(t)||t<=0)throw new Error("Vectorization embedding metadata requires a positive vector dimension");return{provider:e.provider,model:e.model,vector_dimension:t}}function it(e,t){return!e||e.provider!==t.provider||e.model!==t.model}function st(e,t){return!!(e&&e.vector_dimension!==t)}function at(e,t){if(e.length===0)throw new Error(`${t} returned no vectors`);let n=e[0].length;if(!Number.isInteger(n)||n<=0)throw new Error(`${t} returned an empty vector`);for(let o=1;o<e.length;o+=1)if(e[o]?.length!==n)throw new Error(`${t} returned mixed vector dimensions`);return 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]="7939a590-3662-5c66-99aa-3835a0dbaecc")}catch{}})();var Xt="search/vectorization-status.json";function J(e){return[...new Set([...e].map(t=>t.trim()).filter(t=>t.length>0))].sort((t,r)=>t.localeCompare(r))}function Jt(e){return typeof e=="string"&&e.trim().length>0&&Number.isFinite(Date.parse(e))}function Zt(e){let t=new Map;for(let[r,n]of Object.entries(e)){let o=r.trim();o.length===0||!Jt(n)||t.set(o,n)}return Object.fromEntries([...t.entries()].sort((r,n)=>r[0].localeCompare(n[0])))}async function er(e){let t=Qt.join(e,Xt),r=await T(t);if(r===null||r.trim().length===0)return{entries:{},embedding:null,warnings:[]};let n;try{n=JSON.parse(r)}catch{return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]}}if(typeof n!="object"||n===null||n.version!==1||!Array.isArray(n.items))return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};let o=new Map;for(let s of n.items){if(typeof s!="object"||s===null)return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};let a=s.id,c=s.updated_at;if(typeof a!="string"||a.trim().length===0||!Jt(c))return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]};o.set(a.trim(),c)}let i=null;try{i=Kt(n.embedding)}catch{return{entries:{},embedding:null,warnings:["search_vectorization_status_ledger_invalid"]}}return{entries:Object.fromEntries([...o.entries()].sort((s,a)=>s[0].localeCompare(a[0]))),embedding:i,warnings:[]}}async function tr(e,t,r){let n=Zt(t),o=Qt.join(e,Xt),i=`${JSON.stringify({version:1,generated_at:R(),...r?{embedding:r}:{},items:Object.entries(n).map(([s,a])=>({id:s,updated_at:a}))},null,2)}
4
4
  `;await S(o,i)}function ri(e){return{id:e.id,type:e.type,status:e.status,priority:e.priority,updated_at:e.updated_at}}function ni(e){let t=we(e.name,e.model);if(!t)throw new Error("Embedding provider must include a provider name and model");return t}function X(e,t){return{refreshed:[],skipped:e,warnings:[t]}}async function oi(e,t,r){if(!r.settings&&!await $(Ce(e)))return X(t,"search_semantic_refresh_skipped:settings_not_initialized");let n;try{if(r.settings)n=r.settings;else{let a=await re(e),c=a.warnings.find(d=>d.startsWith("settings_read_"));if(c)return X(t,`search_semantic_refresh_skipped:settings_read_failed:${c}`);n=a.settings}}catch(a){return X(t,`search_semantic_refresh_skipped:settings_read_failed:${b(a)}`)}let o=r.apply_runtime_defaults?ue(n).settings:n,i=je(o).active;if(!i)return X(t,"search_semantic_refresh_skipped:provider_unconfigured");let s=rt(o,e).active;return s?{settings:o,provider:i,vectorStore:s}:X(t,"search_semantic_refresh_skipped:vector_store_unconfigured")}async function ii(e,t,r,n,o,i){let s=[],a=new Set,c=new Set,d=[];for(let l of n){let u=await Pe(e,l,t,r,o);if(!u){c.add(l);continue}try{let _=await ze(u,{schema:i});d.push({id:_.document.metadata.id,document:_.document})}catch(_){a.add(u.id),s.push(`search_semantic_refresh_item_read_failed:${u.id}:${b(_)}`)}}return d.sort((l,u)=>l.id.localeCompare(u.id)),{documents:d,missingIds:J(c),skippedIds:J(a),warnings:s}}async function si(e,t,r){let n=j(t.name,e.search.embedding_corpus_max_characters).maxCharacters,o=qe(e),i=r.map(a=>Ye(a.document,{providerName:t.name,maxCharacters:n,fields:o})),s=await Ge(t,e,i);return{vectors:s.vectors,vector_dimension:at(s.vectors,"Semantic refresh embedding"),warnings:s.warnings}}async function ai(e,t,r){return await nt(e,t.map((n,o)=>({id:n.id,vector:r[o],payload:ri(n.document.metadata)}))),{refreshed:t.map(n=>n.id),skipped:[],warnings:[]}}async function ci(e,t){if(t.length===0)return{refreshed:[],skipped:[],warnings:[]};try{return await ye(e,t),{refreshed:[],skipped:[],warnings:[]}}catch(r){return{refreshed:[],skipped:t,warnings:[`search_semantic_refresh_delete_failed:${b(r)}`]}}}async function mc(e,t,r={}){let n=J(t);if(n.length===0)return{refreshed:[],skipped:[],warnings:[]};let o=await oi(e,n,r);if(!("settings"in o))return o;let i=F(o.settings,De()),s=await ii(e,o.settings.id_prefix,o.settings.item_format,n,i.type_to_folder,o.settings.schema),a=s.documents.length>0||s.missingIds.length>0?await er(e):{entries:{},embedding:null,warnings:[]},c=ni(o.provider),d=a.entries,l={refreshed:[],skipped:[],warnings:[]},u=a.embedding;if(s.documents.length>0)if(a.embedding&&it(a.embedding,c))l={refreshed:[],skipped:s.documents.map(y=>y.id),warnings:["search_semantic_refresh_requires_reindex:embedding_identity_changed"]};else try{let y=await si(o.settings,o.provider,s.documents);if(st(a.embedding,y.vector_dimension))l={refreshed:[],skipped:s.documents.map(E=>E.id),warnings:[...y.warnings,"search_semantic_refresh_requires_reindex:vector_dimension_changed"]};else{u=ot(c,y.vector_dimension);let E=await ai(o.vectorStore,s.documents,y.vectors);l={refreshed:E.refreshed,skipped:E.skipped,warnings:[...y.warnings,...E.warnings]}}}catch(y){l={refreshed:[],skipped:s.documents.map(E=>E.id),warnings:[`search_semantic_refresh_failed:${b(y)}`]}}let _=await ci(o.vectorStore,s.missingIds),m=new Set(l.refreshed),w=Object.fromEntries(s.documents.filter(y=>m.has(y.id)).map(y=>[y.id,y.document.metadata.updated_at])),g=[];if(Object.keys(w).length>0||s.missingIds.length>0){let y={...d,...Zt(w)};for(let E of s.missingIds)delete y[E];try{await tr(e,y,u)}catch(E){g.push(`search_vectorization_status_ledger_write_failed:${b(E)}`)}g.push(...a.warnings)}return{refreshed:J([...l.refreshed,..._.refreshed]),skipped:J([...s.skippedIds,...l.skipped,..._.skipped]),warnings:[...s.warnings,...l.warnings,..._.warnings,...g]}}import{createRequire as li}from"node:module";(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]="8eb48648-6e55-5710-990e-6471c7cdcde0")}catch{}})();var ui=/(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|credentials|bearer|dsn)/i,gc=new RegExp(`\\b(${ui.source})\\s*[:=]\\s*([^\\s,;]+)`,"giu");var yc=li(import.meta.url);(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]="e896db69-ed90-53f1-a227-e3d061b3bc8d")}catch{}})();var bc=new Map([[f.USAGE,"invalid_command_usage"],[f.NOT_FOUND,"item_not_found"],[f.CONFLICT,"lock_conflict"],[f.DEPENDENCY_FAILED,"dependency_failed"]]);(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]="48cce5c1-5cca-53cc-8991-f97669251a72")}catch{}})();import{promises as nr}from"node:fs";import or 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]="611f01b6-0c72-5ea2-a44f-78877c69706c")}catch{}})();var mi="session.json";function ir(e){return or.join(wt(e),mi)}async function ct(e){try{let t=await nr.readFile(ir(e),"utf8"),r=JSON.parse(t);if(r===null||typeof r!="object"||Array.isArray(r))return{};let n=r.focused_item;return typeof n=="string"&&n.trim().length>0?{focused_item:n}:{}}catch{return{}}}async function sr(e,t){let r=ir(e);await nr.mkdir(or.dirname(r),{recursive:!0}),await S(r,JSON.stringify(t))}async function pi(e){return(await ct(e)).focused_item}async function _i(e,t){let r=await ct(e);await sr(e,{...r,focused_item:t})}async function hi(e){let r={...await ct(e)};delete r.focused_item,await sr(e,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]="c43dd9f2-78ac-5c22-970a-0016a06b87b3")}catch{}})();var kc=Object.freeze({"&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&amp;":"&"});(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]="0ce743d1-917a-5c96-b038-c95e3922bc48")}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]="868dfae8-2575-5d5f-8425-c7e68aefdc84")}catch{}})();import ar from"node:fs/promises";import Ee 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]="4baf0ef3-2412-51cf-9ade-18b5c6e610d1")}catch{}})();function gi(e){return"json_markdown"}function cr(e,t){return Ee.relative(e,t).replaceAll("\\","/")}function yi(e){return String(e).replaceAll(/[^a-zA-Z0-9._-]+/g,"_").slice(0,120)}async function wi(e,t,r="item_format:migrate",n=Ie,o){if(t!=="toon")throw new Error("Only toon item-format migration targets are supported. Markdown item files are legacy read-only input.");let i=new Set,s=new Set,a=[],c=0,d=gi(t),l=Object.entries(n);for(let[u,_]of l){let m=Ee.join(e,_),w=[];try{w=await ar.readdir(m)}catch{continue}let g=new Map;for(let E of w){let L=Ee.join(m,E),D=yt(L);if(!D)continue;let H=Ee.extname(E),Y=E.slice(0,E.length-H.length).trim();if(Y.length===0)continue;let z=g.get(Y)??{};z[D]=L,g.set(Y,z)}let y=[...g.keys()].sort((E,L)=>E.localeCompare(L));for(let E of y){let L=g.get(E);c+=1;let D=L[d];if(!D)continue;let H=L[t]??D,Y=H===L[t]?t:d;try{let z=await ar.readFile(H,"utf8"),jr=Ne(z,{format:Y,schema:o,onWarning:qr=>a.push(`item_format_migration_parse_warning:${E}:${qr}`)}),Te=ve(e,u,E,t,n),gt=Me(jr,{format:t,schema:o});await T(Te)!==gt&&(await S(Te,gt),a.push(...await te({path:Te,scope:"project",op:r})),i.add(E)),await Z(D),s.add(cr(e,D)),a.push(...await te({path:D,scope:"project",op:`${r}:remove`})),i.add(E)}catch(z){a.push(`item_format_migration_skipped:${cr(e,H)}:${yi(z)}`)}}}return{target_format:t,scanned:c,migrated:[...i].sort((u,_)=>u.localeCompare(_)),removed:[...s].sort((u,_)=>u.localeCompare(_)),warnings:a}}(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]="f280c1df-b134-57c3-91f6-cbf5a37e6e31")}catch{}})();var Ei=new Set(["completed","superseded"]);function bi(e){return e!==void 0&&Ei.has(e)}function Si(e){if(e.type.trim().toLowerCase()!=="plan")return!1;let t=e.plan_steps??[];return t.length>0&&t.every(r=>r.status==="completed")}import Wc from"node:readline/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]="6783b122-a1a8-5f86-9ac5-2c3e811622ed")}catch{}})();import ut from"node:crypto";import{mkdirSync as nd,rmSync as Ii,statSync as od}from"node:fs";import{mkdir as dt,readdir as Ai,rm as ft,stat as mr}from"node:fs/promises";import x 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]="fea9d81b-3deb-51f4-9ec3-76396ae1307d")}catch{}})();var Ci=x.join("runtime","telemetry","events.jsonl"),vi=x.join("runtime","telemetry","state.json"),Li=x.join("runtime","telemetry","otel-spans.jsonl"),Di=8,dr=500,Ri=1;var Ni=100,Mi=36e5,ki=3e4,pr=5e3,Oi=864e5,_r=65536;var hr=15;var gr=[25,50,100,200],Pi=3600*1e3,zi=6e4;var $i="PM_TELEMETRY_DISABLED",Fi="PM_NO_TELEMETRY",lr=new Set(["1","true","yes","on"]);var Ui=["user","automation","test","dogfood"],_d=Promise.resolve(),ur=Promise.resolve();var hd=new Set(Ui);var gd=ut.randomUUID();var yr="(?:token|secret|password|passwd|api[_-]?key|apikey|authorization|cookie|session|credentials|bearer|literals?|regex(?:es)?|replacements?)",Vi=new RegExp(`\\b(${yr})\\s*([:=])\\s*([^\\s,;]+)`,"giu"),ji=new RegExp(`(--${yr})(=|\\s+)([^\\s,;]+)`,"giu"),qi=/(^|[\s"'`(=])\/(?:[^\s"'`),;]+)/g,Hi=/bearer\s+[a-z0-9._=-]+/giu,Yi=/\b(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g;function Se(e){return x.join(e,Ci)}function mt(e){return x.join(e,Li)}function Bi(e){return x.dirname(Se(e))}function wr(e){return x.join(e,vi)}function Er(e){return x.join(e,"runtime","telemetry","flush.lock")}function Gi(e){return x.join(e,"runtime","telemetry","flush.spawn.lock")}async function Wi(e){let t=await T(wr(e));if(!t||t.trim().length===0)return{};try{let r=JSON.parse(t);return typeof r!="object"||r===null||Array.isArray(r)?{}:r}catch{return{}}}async function v(e,t){try{let n={...await Wi(e),...t},o=Object.fromEntries(Object.entries(n).filter(([,i])=>i!==void 0).sort((i,s)=>i[0].localeCompare(s[0])));await S(wr(e),`${JSON.stringify(o,null,2)}
@@ -9,4 +9,4 @@ import{$a as Pe,Ja as re,Ka as N,L as R,La as ne,Q as bt,Qa as oe,R as St,Ua as
9
9
  `)){let n=r.trim();if(n.length!==0)try{let o=JSON.parse(n);o&&typeof o=="object"&&typeof o.endpoint=="string"&&o.endpoint.trim().length>0&&"payload"in o&&typeof o.attempts=="number"&&Number.isFinite(o.attempts)&&((typeof o.id!="string"||o.id.length===0)&&(o.id=ns(o)),t.push(o))}catch{}}return t}function os(e,t){if(typeof e.enqueued_at!="string"||e.enqueued_at.trim().length===0)return!1;let r=Date.parse(e.enqueued_at);return Number.isNaN(r)?!1:r<t}function kr(e,t){let r=Dr(t),n=[],o=0;for(let i of e){if(JSON.stringify(i).length>_r||os(i,r)||i.attempts>=hr){o+=1;continue}n.push(i)}if(n.length>dr){let i=n.length-dr;return o+=i,{entries:n.slice(i),prunedCount:o}}return{entries:n,prunedCount:o}}async function is(e,t){let r=t.map(o=>JSON.stringify(o)).join(`
10
10
  `),n=r.length>0?`${r}
11
11
  `:"";for(let o=0;;o+=1)try{await S(mt(e),n);return}catch(i){let s=gr[o];if(s===void 0||!Rr(i))throw i;await Nr(s)}}async function fr(e,t,r,n){return _t(async()=>{let o=await T(mt(e)),i=o===null?[]:Mr(o),s=[];for(let c of i){if(r.has(c.id))continue;let d=n.get(c.id);s.push(d?{...c,attempts:d.attempts,next_attempt_after:d.next_attempt_after}:c)}let{entries:a}=kr(s,t);return await is(e,a),a.length})}async function ss(e,t){let r=await T(mt(e));if(r===null||r.trim().length===0){await v(e,{pending_otel_spans:0});return}let n=Mr(r),{entries:o,prunedCount:i}=kr(n,t),s=o.filter(w=>Lr(w.next_attempt_after)).slice(0,Di);if(s.length===0){let w=i>0?await fr(e,t,new Set,new Map):o.length;await v(e,{pending_otel_spans:w});return}let a=R(),c=new Set,d=new Map,l=0,u;await Promise.all(s.map(async w=>{try{let g=await fetch(w.endpoint,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(w.payload),signal:AbortSignal.timeout(pr)});if(!g.ok)throw new Error(`local_otel_export_http_${g.status}`);c.add(w.id),l+=1}catch(g){u=g instanceof Error?lt(g.message,"redacted"):"local_otel_export_failed";let y=w.attempts+1;d.set(w.id,{attempts:y,next_attempt_after:vr(y)})}}));let _=await fr(e,t,c,d),m={pending_otel_spans:_,last_otel_attempt_at:a};l>0&&(m.last_otel_success_at=a),u!==void 0?(m.last_otel_failure_at=a,m.last_otel_failure_error=u):_===0&&(m.last_otel_failure_at=void 0,m.last_otel_failure_error=void 0),await v(e,m)}async function as(e,t,r){try{await us(e,t,r)}catch{}try{await ss(e,r)}catch{}}async function cs(e,t=Pi){try{let r=Bi(e),n=await Ai(r,{withFileTypes:!0}),o=Date.now()-Math.max(0,t);await Promise.all(n.filter(i=>i.isFile()&&/^\.events\.jsonl\.\d+\.\d+\.[a-f0-9]+\.tmp$/.test(i.name)).map(async i=>{let s=x.join(r,i.name);(await mr(s)).mtimeMs<o&&await ft(s,{force:!0})}))}catch{}}async function _t(e){let t=ur.catch(()=>{}).then(e);return ur=t.catch(()=>{}),t}async function ht(e){let t=await T(Se(e));return t===null||t.trim().length===0?[]:Cr(t)}async function ds(e,t,r){return _t(async()=>{let n=await ht(e),{entries:o}=pt(n,r),i=o.filter(s=>!t.has(s.event.event_id));return await be(e,i),i})}async function ls(e,t,r,n){return _t(async()=>{let o=await ht(e),{entries:i}=pt(o,n),s=i.map(a=>{if(!t.has(a.event.event_id))return a;let c=a.attempts+1;return{...a,attempts:c,last_attempt_at:r,next_attempt_after:vr(c)}});return await be(e,s),s})}async function us(e,t,r){await cs(e);let n=t.trim();if(n.length===0)return;let o=await T(Se(e));if(o===null||o.trim().length===0){await v(e,{endpoint:n,queue_entries:0});return}let i=Cr(o);if(i.length===0){await v(e,{endpoint:n,queue_entries:0});return}let{entries:s,prunedCount:a}=pt(i,r);if(s.length===0){await be(e,[]),await v(e,{endpoint:n,queue_entries:0});return}let c=s.filter(m=>ts(m)).slice(0,Ni);if(c.length===0){a>0&&await be(e,s),await v(e,{endpoint:n,queue_entries:s.length});return}let d=new Set(c.map(m=>m.event.event_id)),l=R(),u={"content-type":"application/json"},_=process.env.PM_TELEMETRY_INGEST_KEY?.trim();_&&(u["x-pm-telemetry-key"]=_);try{let m=await fetch(n,{method:"POST",headers:u,body:JSON.stringify({schema_version:Ri,events:c.map(w=>w.event)}),signal:AbortSignal.timeout(pr)});if(!m.ok)throw new Error(`telemetry_flush_http_${m.status}`)}catch(m){let w=await ls(e,d,l,r),g=m instanceof Error?lt(m.message,"redacted"):"telemetry_flush_failed";await v(e,{endpoint:n,queue_entries:w.length,last_attempted_flush_at:l,last_failed_flush_at:l,last_failed_flush_error:g});return}try{let m=await ds(e,d,r);await v(e,{endpoint:n,queue_entries:m.length,last_attempted_flush_at:l,last_successful_flush_at:l,last_failed_flush_at:void 0,last_failed_flush_error:void 0})}catch(m){let w=m instanceof Error?lt(m.message,"redacted"):"telemetry_flush_failed",g=await ht(e).catch(()=>s);await v(e,{endpoint:n,queue_entries:g.length,last_attempted_flush_at:l,last_failed_flush_at:l,last_failed_flush_error:w})}}async function fs(e){let t=Er(e);await dt(x.dirname(t),{recursive:!0});try{return await dt(t),!0}catch(r){if(typeof r!="object"||r===null||!("code"in r)||r.code!=="EEXIST")throw r}try{let r=await mr(t);return Date.now()-r.mtimeMs<zi?!1:(await ft(t,{recursive:!0,force:!0}),await dt(t),!0)}catch{return!1}}function ms(e){try{Ii(e,{recursive:!0,force:!0})}catch{}}function ps(e){ms(Gi(e))}async function _s(e,t,r){let n=await fs(e);if(ps(e),!!n)try{await as(e,t,r)}finally{try{await ft(Er(e),{recursive:!0,force:!0})}catch{}}}async function yd(e=Ae(process.cwd())){if(!Zi())try{if(!(await N(e)).telemetry.enabled)return;let{endpoint:r,retentionDays:n}=await es(e);await _s(e,r,n)}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]="89efaf82-c9cb-560d-b1ca-5a676b4b979c")}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]="13c02696-29a7-598e-888a-3502fd88bfbe")}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]="078456b8-ed61-5c47-afc7-7553833934e1")}catch{}})();var hs=3,Or=20,gs=.8,ys=100,Pr=1e3,zr=1e6;function Nm(e){return e===void 0?[]:[`likely_duplicates:${e.result.items.map(t=>t.id).join(",")}`]}function $r(e){let t=e.limit??hs,r=e.threshold??gs;if(!Number.isSafeInteger(t)||t<0||t>Or)throw new p(`Similarity limit must be an integer from 0 to ${Or}.`,f.USAGE);if(!Number.isFinite(r)||r<0||r>1)throw new p("Similarity threshold must be a number from 0 to 1.",f.USAGE);return{limit:t,threshold:r}}function ws(e){let t=e.limit??ys;if(!Number.isSafeInteger(t)||t<0||t>Pr)throw new p(`Duplicate cluster limit must be an integer from 0 to ${Pr}.`,f.USAGE);let r=e.since===void 0?void 0:new Date(e.since);if(r&&Number.isNaN(r.getTime()))throw new p("Duplicate cluster --since must be a valid ISO timestamp.",f.USAGE);return{limit:t,since:r}}async function Es(e,t){let r=ee(e.cwd??process.cwd(),e.pmRoot),n=await N(r),o=F(n),i=e.statuses?new Set(e.statuses.map(s=>s.trim()).filter(Boolean)):void 0;return(await ie(r,n.item_format,o.type_to_folder,void 0,n.schema)).filter(s=>(!i||i.has(s.status))&&(!t||new Date(s.created_at).getTime()>=t.getTime())).sort((s,a)=>s.id.localeCompare(a.id)).map(s=>({item:s,prepared:G(s.title)}))}function Fr(e,t=zr){let r=new Set,n=[new Map,new Map,new Map];for(let[o,i]of e.entries()){let s=[[i.prepared.normalized],i.prepared.issueCodes,i.prepared.tokens];for(let[a,c]of s.entries())for(let d of c){let l=n[a].get(d)??[];for(let u of l)r.add(`${u}:${o}`);if(r.size>t)throw new p(`Duplicate sweep exceeded ${zr} candidate pairs; narrow it with statuses or since.`,f.CONFLICT,{code:"duplicate_sweep_cost_limit",required:"Narrow the batch duplicate query until its deterministic candidate set fits the disclosed safety bound."});l.push(o),n[a].set(d,l)}}return r}var Mm={buildDuplicateClusters:Vr,collectDuplicateCandidatePairs:Fr,createDuplicateUnionFind:Ur};function Ur(e){let t=Array.from({length:e},(n,o)=>o);return{parent:t,findRoot:n=>{let o=n;for(;t[o]!==o;)o=t[o];for(;t[n]!==n;){let i=t[n];t[n]=o,n=i}return o}}}function bs(e,t,r,n){let o=[];for(let i of t){let[s,a]=i.split(":").map(u=>Number.parseInt(u,10)),c=ce(e[s].prepared,e[a].prepared);if(c.score<r)continue;let d=n.findRoot(s),l=n.findRoot(a);d!==l&&(n.parent[l]=d),o.push({left_id:e[s].item.id,right_id:e[a].item.id,...c})}return o}function Vr(e,t,r,n){let o=new Map;for(let i of e.keys()){let s=r.findRoot(i),a=o.get(s)??[];a.push(i),o.set(s,a)}return[...o.values()].filter(i=>i.length>1).map(i=>{let s=new Set(i.map(c=>e[c].item.id)),a=t.filter(c=>s.has(c.left_id)&&s.has(c.right_id)).sort((c,d)=>d.score-c.score||c.left_id.localeCompare(d.left_id)||c.right_id.localeCompare(d.right_id));return{id:e[i[0]].item.id,items:i.map(c=>{let d=e[c].item;return{id:d.id,title:d.title,status:d.status,type:d.type}}),matches:a,max_score:a[0]?.score??0}}).sort((i,s)=>s.max_score-i.max_score||i.id.localeCompare(s.id)).slice(0,n)}function Ss(e,t,r,n,o){return t.filter(i=>!r.has(i.id)).map(i=>({id:i.id,title:i.title,status:i.status,type:i.type,...ae(e,i.title)})).filter(i=>i.score>=n).sort((i,s)=>s.score-i.score||i.id.localeCompare(s.id)).slice(0,o)}async function Ts(e,t={}){let r=e.title.trim();if(r.length===0)throw new p("Similarity candidate title must not be empty.",f.USAGE);let{limit:n,threshold:o}=$r(t),i=ee(t.cwd??process.cwd(),t.pmRoot),s=await N(i),a=F(s),c=await Oe(i,Object.values(a.type_to_folder)),d=W(r),l=c&&d.length>0?await ke({pmRoot:i,expectedSourceCursor:c.source_cursor,query:d.map(m=>`"${m.replaceAll('"','""')}"`).join(" OR "),limit:Math.max(n*10,50)}):null,u=l===null?await ie(i,s.item_format,a.type_to_folder,void 0,s.schema):l.items,_=Ss(r,u,new Set(e.excludeIds??[]),o,n);return{items:_,count:_.length,threshold:o,source:l?"persistent_index":"metadata_fallback"}}async function km(e={}){let{threshold:t}=$r({...e,limit:void 0}),{limit:r,since:n}=ws(e),o=await Es(e,n),i=Fr(o),s=Ur(o.length),a=bs(o,i,t,s),c=Vr(o,a,s,r);return{clusters:c,count:c.length,threshold:t,source:"metadata_scan",cost:{item_count:o.length,candidate_pairs:i.size,scored_pairs:i.size}}}async function Om(e,t){if(t.mode==="off")return;let r=await Ts(e,t);if(r.count===0)return;let n=t.mode==="strict"&&t.allowDuplicate===!0;if(t.mode==="strict"&&!n){let o=r.items.map(i=>`${i.id} (${i.status}): ${i.title}`).join("; ");throw new p(`Likely duplicate item(s) found: ${o}. Reuse the canonical item or pass --allow-duplicate with explicit intent.`,f.CONFLICT,{code:"likely_duplicate",required:"Reuse an existing item, or explicitly acknowledge the duplicate with --allow-duplicate.",recovery:{suggested_flags:["--allow-duplicate"]}})}return{mode:t.mode,bypassed:n,result: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]="412fc2d2-daee-5d87-82ab-5411a1503087")}catch{}})();function $m(e,t){let r=t??{};return e.filter(n=>r[n.id]!==n.updated_at).map(n=>n.id).sort((n,o)=>n.localeCompare(o))}export{dn as a,ln as b,fn as c,mn as d,pn as e,_n as f,Xs as g,gn as h,Dt as i,yn as j,wn as k,Sn as l,oa as m,In as n,la as o,Ln as p,Rn as q,Hr as r,Nn as s,Mn as t,ue as u,no as v,Na as w,je as x,Ut as y,qe as z,ho as A,go as B,Oa as C,Vt as D,j as E,Ye as F,Ge as G,rt as H,Ba as I,nt as J,ye as K,Wt as L,we as M,ot as N,it as O,st as P,at as Q,er as R,tr as S,mc as T,pi as U,_i as V,hi as W,Qr as X,It as Y,Jr as Z,Zr as _,en as $,Ds as aa,se as ba,W as ca,G as da,Ue as ea,ae as fa,ce as ga,At as ha,on as ia,wi as ja,bi as ka,Si as la,Ri as ma,hr as na,Ui as oa,yd as pa,Nm as qa,Mm as ra,Ts as sa,km as ta,Om as ua,$m as va};
12
- //# sourceMappingURL=chunk-UFCPSWIL.js.map
12
+ //# sourceMappingURL=chunk-MBBMTDD3.js.map
@@ -1,8 +1,8 @@
1
- import{sa as A,ya as _}from"./chunk-5MTKO7TV.js";import{Y as u,Z as d}from"./chunk-CL75YW32.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]="19ff592c-0746-54e8-a304-2006f4845da2")}catch{}})();function S(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function x(e){if(e==="/body"||e.startsWith("/body/"))return"body";if(e==="/metadata"||e.startsWith("/metadata/")||e==="/front_matter"||e.startsWith("/front_matter/")){let n=e.replace(/^\/(?:metadata|front_matter)\/?/,"").split("/")[0];return n?S(n):"metadata"}let t=e.replace(/^\//,"").split("/")[0];return t?S(t):"root"}function g(e,t){return t==="body"?e.body:t==="metadata"?e.metadata:t==="root"?e:e.metadata[t]}function V(e,t){let n=t?.windowStartIndex??0,o=t?.field;if(e.length===0||n>=e.length)return[];let i=A(),r=[];for(let a=0;a<e.length;a+=1){let s=e[a],c=i,p=_(i,s.patch),l;p.ok?(l=p.document,i=l):l=c;let m=new Set;for(let f of s.patch)m.add(x(f.path)),f.from!==void 0&&m.add(x(f.from));let b=[...m].sort((f,y)=>f.localeCompare(y));if(a>=n)if(o!==void 0){if(!m.has(o))continue;let f={field:o,before:g(c,o),after:g(l,o)};r.push({index:a+1,ts:s.ts,op:s.op,author:s.author,patch_ops:s.patch.length,changed_fields:[o],changes:[f]})}else{let f=b.map(y=>({field:y,before:g(c,y),after:g(l,y)}));r.push({index:a+1,ts:s.ts,op:s.op,author:s.author,patch_ops:s.patch.length,changed_fields:b,changes:f})}}return 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]="d5003dd5-f208-5734-9711-dff935d8c851")}catch{}})();var h="-",E=new Set(["actual_result","body","cmd","command","customer_impact","description","environment","expected_result","impact","location","message","note","outcome","repro_steps","resolution","text","title","unblock_note","value","why_now"]);function I(e){let t=e.trim();if(t==="")return[];let o=(T(t)??t.split(",")).map(i=>i.trim()).filter(Boolean).map(i=>i.toLowerCase());return Array.from(new Set(o)).sort((i,r)=>i.localeCompare(r))}function $(e){if(!Array.isArray(e)||e.length===0)return[];let t=[];for(let n of e)if(typeof n=="string")for(let o of I(n))t.push(o);return Array.from(new Set(t)).sort((n,o)=>n.localeCompare(o))}function k(e){return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()).filter(Boolean):[]}function B(e){return typeof e!="string"?[]:e.split(";").map(t=>t.trim()).filter(Boolean)}function F(e,t,n){let o=e.map(a=>a.trim()).filter(Boolean);for(let a of t??[]){let s=a.trim();if(s.includes(";"))throw new d('Acceptance criteria added with --add-ac cannot contain ";" because semicolons delimit stored criteria',u.USAGE,{code:"acceptance_criteria_semicolon_forbidden",required:"Pass one semicolon-free criterion per --add-ac value",why:"A semicolon inside one criterion would be re-read as multiple criteria",nextSteps:["Split the text into repeated --add-ac values, or replace the semicolon with punctuation that is not the storage delimiter"]});s.length>0&&!o.includes(s)&&o.push(s)}let i=[],r=o;for(let a of n??[]){let s=a.trim();if(s.length!==0){if(!r.includes(s)){i.push(s);continue}r=r.filter(c=>c!==s)}}return{criteria:r,unmatchedRemovals:i}}function q(e,t){let n=k(e);if(!t||t.length===0)return Array.from(new Set(n)).sort((i,r)=>i.localeCompare(r));let o=new Set(n);for(let i of $(t))o.add(i);return Array.from(o).sort((i,r)=>i.localeCompare(r))}function M(e,t){let n=Array.from(new Set(k(e))).sort((i,r)=>i.localeCompare(r));if(!t||t.length===0)return n;let o=new Set($(t));return o.size===0?n:n.filter(i=>!o.has(i))}function T(e){if(!e.startsWith("["))return null;let t;try{t=JSON.parse(e)}catch{return null}return t.map(o=>typeof o=="string"||typeof o=="number"||typeof o=="boolean"?String(o):"").filter(o=>o.length>0)}function w(e){return e.replace(/\r\n/g,`
1
+ import{sa as A,ya as _}from"./chunk-GEYU23YS.js";import{Y as u,Z as d}from"./chunk-7AZDTGPA.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]="19ff592c-0746-54e8-a304-2006f4845da2")}catch{}})();function S(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function x(e){if(e==="/body"||e.startsWith("/body/"))return"body";if(e==="/metadata"||e.startsWith("/metadata/")||e==="/front_matter"||e.startsWith("/front_matter/")){let n=e.replace(/^\/(?:metadata|front_matter)\/?/,"").split("/")[0];return n?S(n):"metadata"}let t=e.replace(/^\//,"").split("/")[0];return t?S(t):"root"}function g(e,t){return t==="body"?e.body:t==="metadata"?e.metadata:t==="root"?e:e.metadata[t]}function V(e,t){let n=t?.windowStartIndex??0,o=t?.field;if(e.length===0||n>=e.length)return[];let i=A(),r=[];for(let a=0;a<e.length;a+=1){let s=e[a],c=i,p=_(i,s.patch),l;p.ok?(l=p.document,i=l):l=c;let m=new Set;for(let f of s.patch)m.add(x(f.path)),f.from!==void 0&&m.add(x(f.from));let b=[...m].sort((f,y)=>f.localeCompare(y));if(a>=n)if(o!==void 0){if(!m.has(o))continue;let f={field:o,before:g(c,o),after:g(l,o)};r.push({index:a+1,ts:s.ts,op:s.op,author:s.author,patch_ops:s.patch.length,changed_fields:[o],changes:[f]})}else{let f=b.map(y=>({field:y,before:g(c,y),after:g(l,y)}));r.push({index:a+1,ts:s.ts,op:s.op,author:s.author,patch_ops:s.patch.length,changed_fields:b,changes:f})}}return 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]="d5003dd5-f208-5734-9711-dff935d8c851")}catch{}})();var h="-",E=new Set(["actual_result","body","cmd","command","customer_impact","description","environment","expected_result","impact","location","message","note","outcome","repro_steps","resolution","text","title","unblock_note","value","why_now"]);function I(e){let t=e.trim();if(t==="")return[];let o=(T(t)??t.split(",")).map(i=>i.trim()).filter(Boolean).map(i=>i.toLowerCase());return Array.from(new Set(o)).sort((i,r)=>i.localeCompare(r))}function $(e){if(!Array.isArray(e)||e.length===0)return[];let t=[];for(let n of e)if(typeof n=="string")for(let o of I(n))t.push(o);return Array.from(new Set(t)).sort((n,o)=>n.localeCompare(o))}function k(e){return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()).filter(Boolean):[]}function B(e){return typeof e!="string"?[]:e.split(";").map(t=>t.trim()).filter(Boolean)}function F(e,t,n){let o=e.map(a=>a.trim()).filter(Boolean);for(let a of t??[]){let s=a.trim();if(s.includes(";"))throw new d('Acceptance criteria added with --add-ac cannot contain ";" because semicolons delimit stored criteria',u.USAGE,{code:"acceptance_criteria_semicolon_forbidden",required:"Pass one semicolon-free criterion per --add-ac value",why:"A semicolon inside one criterion would be re-read as multiple criteria",nextSteps:["Split the text into repeated --add-ac values, or replace the semicolon with punctuation that is not the storage delimiter"]});s.length>0&&!o.includes(s)&&o.push(s)}let i=[],r=o;for(let a of n??[]){let s=a.trim();if(s.length!==0){if(!r.includes(s)){i.push(s);continue}r=r.filter(c=>c!==s)}}return{criteria:r,unmatchedRemovals:i}}function q(e,t){let n=k(e);if(!t||t.length===0)return Array.from(new Set(n)).sort((i,r)=>i.localeCompare(r));let o=new Set(n);for(let i of $(t))o.add(i);return Array.from(o).sort((i,r)=>i.localeCompare(r))}function M(e,t){let n=Array.from(new Set(k(e))).sort((i,r)=>i.localeCompare(r));if(!t||t.length===0)return n;let o=new Set($(t));return o.size===0?n:n.filter(i=>!o.has(i))}function T(e){if(!e.startsWith("["))return null;let t;try{t=JSON.parse(e)}catch{return null}return t.map(o=>typeof o=="string"||typeof o=="number"||typeof o=="boolean"?String(o):"").filter(o=>o.length>0)}function w(e){return e.replace(/\r\n/g,`
2
2
  `)}function C(e){let t=w(e).trim();if(!t.startsWith("```"))return e;let n=t.split(`
3
3
  `);return n.length<2||n.at(-1)?.trim()!=="```"?e:n.slice(1,-1).join(`
4
4
  `)}function D(e){let t=[],n="",o=!1,i=!1;for(let r of e){if(i){n+=r,i=!1;continue}if(r==="\\"){n+=r,i=!0;continue}if(r==='"'){o=!o,n+=r;continue}if(r===","&&!o){t.push(n.trim()),n="";continue}n+=r}return n.trim()&&t.push(n.trim()),t}function v(e){let t=e.trim();if(t.startsWith('"')&&t.endsWith('"')){try{let n=JSON.parse(t);if(typeof n=="string")return n}catch{}return t.slice(1,-1).replace(/\\"/g,'"')}return e}function O(e){let t=e.indexOf("="),n=e.indexOf(":"),o=t>0,i=n>0;return o&&i?Math.min(t,n):o?t:i?n:-1}function L(e,t){if((t==="--add"||t==="--add-glob")&&(/[./\\]/.test(e)||/\.[a-z]{1,6}$/i.test(e.trim())))return"For file/doc paths use: path=<file-path>[,scope=project|global]. The scope field is optional and defaults to project (example: path=src/api.ts or path=README.md,scope=project). ";if(t!=="--event")return"";let n=e.toLowerCase(),o=n.includes("recur_")||n.includes("recurrence")?' Recurrence list values must stay in one field and use "|" delimiters (for example recur_by_weekday=mon|wed or recur_by_month_day=1|15).':"",i=n.includes("recur_byweekday")?" Use recur_by_weekday (with underscores) for weekday recurrence filters.":"";return`${o}${i}`}function U(e,t){let n=e.replaceAll(/\s+/g," ").trim(),o=n.length>160?`${n.slice(0,157)}...`:n,i=L(e,t);return`Invalid ${t} value "${o}". Expected key=value entries separated by commas. `+i+`Also accepts markdown-style key/value lines (for example "- path: README.md"). Use ${t} ${h} to read piped stdin input.`}function z(e){let t=C(e).trim();if(t.length===0||!t.includes(`
5
5
  `)&&!t.startsWith("-")&&!t.startsWith("*")&&!t.startsWith("+"))return null;let n={},o,i=w(t).split(`
6
6
  `).map(r=>r.trim()).filter(r=>r.length>0);for(let r of i){let a=r.match(/^(?:[-*+]\s+)?([a-zA-Z0-9_.-]+)\s*(=|:)\s*(.*)$/);if(a){let s=a[1].trim();n[s]=v(a[3].trim()),o=s;continue}if(o&&E.has(o.toLowerCase())){n[o]=`${n[o]}
7
7
  ${r}`;continue}return null}return n}function Z(e,t){let n=C(e).trim();if(!n)throw new d(`${t} cannot be empty`,u.USAGE);let o=z(n);if(o)return o;let i={},r,a=D(n);for(let s of a){let c=O(s);if(c>0){let p=s.slice(0,c).trim(),l=v(s.slice(c+1).trim());i[p]=l,r=p;continue}if(r&&E.has(r.toLowerCase())){i[r]=`${i[r]},${s.trim()}`;continue}throw new d(U(e,t),u.USAGE)}return i}var G=/^[A-Za-z]:[\\/]/,K=/^(?:[-*+]\s+)?[A-Za-z_][A-Za-z0-9_.-]*\s*=/;function H(e){let t=e.trim();return G.test(t)?!1:K.test(t)}function J(e,t,n){let o=new Set(n.map(r=>r.toLowerCase())),i=Object.keys(e).filter(r=>!o.has(r.toLowerCase()));if(i.length>0)throw new d(`${t} does not recognize key${i.length>1?"s":""} ${i.map(r=>`"${r}"`).join(", ")}. Allowed keys: ${n.join(", ")}.`,u.USAGE);for(let r of Object.keys(e)){let a=r.toLowerCase();if(a!==r){if(Object.hasOwn(e,a))throw new d(`${t} provides key "${r}" more than once after case normalization.`,u.USAGE);e[a]=e[r],delete e[r]}}}async function P(e){if(process.stdin.isTTY===!0)throw new d(`${e} value "${h}" requires piped stdin input. Pipe content into the command, or end manual stdin with Ctrl+D (Unix/macOS) or Ctrl+Z then Enter (Windows).`,u.USAGE);return process.stdin.setEncoding("utf8"),await new Promise((t,n)=>{let o="";process.stdin.on("data",i=>{o+=i}),process.stdin.on("end",()=>{t(w(o))}),process.stdin.on("error",i=>{n(i)})})}function Y(){let e,t,n=async r=>{if(t&&t!==r)throw new d(`Only one option may use "${h}" stdin token per command invocation. Already used by ${t}.`,u.USAGE);return t=r,e||(e=P(r)),await e};return{resolveValue:async(r,a)=>{if(r!==void 0)return r.trim()!==h?r:await n(a)},resolveList:async(r,a)=>{if(!r)return;let s=r.map((l,m)=>l.trim()===h?m:-1).filter(l=>l>=0);if(s.length===0)return r;if(s.length>1)throw new d(`${a} accepts "${h}" stdin token at most once per command invocation`,u.USAGE);let c=await n(a),p=[...r];return p[s[0]]=c,p}}}function Q(e,t){let n=Number(e);if(!Number.isFinite(n))throw new d(`Invalid ${t} value "${e}"`,u.USAGE);return n}function X(e,t){let n=e.trim(),o=Number(n);if(n===""||!Number.isInteger(o)||o<0)throw new d(`Invalid ${t} value "${e}". Expected a non-negative integer.`,u.USAGE);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]="4ecab833-db06-5baa-bfe6-d28b4c97f85a")}catch{}})();function te(e,t){if(e==null)return[];let n=t?.separators??/,/,i=e.split(n).map(s=>s.trim()).filter(s=>s.length>0),a=t?.unique!==!1?Array.from(new Set(i)):i;return t?.sort===!0?[...a].sort():a}export{x as a,V as b,I as c,B as d,F as e,q as f,M as g,Z as h,H as i,J as j,Y as k,Q as l,X as m,te as n};
8
- //# sourceMappingURL=chunk-OYTK4VNH.js.map
8
+ //# sourceMappingURL=chunk-ME4XVOBJ.js.map
@@ -1,2 +1,2 @@
1
- import{$ as u,aa as p}from"./chunk-5MTKO7TV.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]="bf429f76-9722-5e34-a5f0-6ced8d1ed667")}catch{}})();var D="blocked_by",B="no-active-blocker";function d(e){return e.trim().toLowerCase()}function b(e){let t=new Set,n=typeof e.blocked_by=="string"?e.blocked_by.trim():"";n.length>0&&n.toLowerCase()!==B&&t.add(n);for(let o of e.dependencies??[])o.kind===D&&typeof o.id=="string"&&o.id.trim().length>0&&o.id.trim().toLowerCase()!==B&&t.add(o.id.trim());return[...t].sort((o,c)=>o.localeCompare(c))}function k(e,t,n){return b(e).map(o=>{let c=t.get(d(o));return c?{id:o,title:c.title,status:c.status,resolved:p(c.status,n)}:{id:o,title:null,status:null,resolved:!1}})}function C(e,t){let n=new Map(e.map(s=>[d(s.id),s])),o=new Set([...I(t),...t.blocked_statuses]),c=new Set;for(let s of e){let l=u(s.status,t);if(!o.has(l))continue;(t.blocked_statuses.has(l)||k(s,n,t).some(a=>!a.resolved))&&c.add(d(s.id))}return c}function I(e){return e.active_statuses.size>0?e.active_statuses:new Set([e.open_status])}function E(e,t,n){let o=[d(e)],c=new Set;for(;o.length>0;){let s=o.pop();if(!c.has(s)){c.add(s);for(let l of t.get(s)??[]){if(!p(l.status,n))return!0;o.push(d(l.id))}}}return!1}function T(e){let t=new Map,n=new Map,o=new Map;for(let c of e){t.set(d(c.id),c);let s=typeof c.parent=="string"?c.parent.trim():"";if(s.length>0){let l=d(s),i=n.get(l)??[];i.push(c),n.set(l,i)}for(let l of b(c)){let i=d(l),a=o.get(i)??[];a.push(c.id),o.set(i,a)}}return{itemsById:t,childrenByParent:n,blockedByReverse:o}}function x(e,t,n){let{itemsById:o,childrenByParent:c,blockedByReverse:s}=T(t),l=new Set([...I(n),...n.blocked_statuses]),i=new Set(t.filter(r=>!p(r.status,n)).map(r=>d(r.id))),a=[],y=[],m=0,h=0;for(let r of e){if(!l.has(u(r.status,n)))continue;if(m+=1,E(r.id,c,n)){h+=1;continue}let w=k(r,o,n).filter(f=>!f.resolved),v=(s.get(d(r.id))??[]).filter(f=>i.has(d(f))).sort((f,S)=>f.localeCompare(S)),_={item:r,open_blockers:w,unblocks:v},g=n.blocked_statuses.has(u(r.status,n));w.length===0&&!g?a.push(_):y.push(_)}return{ready:a,blocked:y,active_count:m,container_count:h}}(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]="9184e723-8269-5e45-8c6a-52fd02da60e6")}catch{}})();export{b as a,k as b,C as c,x as d};
2
- //# sourceMappingURL=chunk-RO5BQFG3.js.map
1
+ import{$ as u,aa as p}from"./chunk-GEYU23YS.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]="bf429f76-9722-5e34-a5f0-6ced8d1ed667")}catch{}})();var D="blocked_by",B="no-active-blocker";function d(e){return e.trim().toLowerCase()}function b(e){let t=new Set,n=typeof e.blocked_by=="string"?e.blocked_by.trim():"";n.length>0&&n.toLowerCase()!==B&&t.add(n);for(let o of e.dependencies??[])o.kind===D&&typeof o.id=="string"&&o.id.trim().length>0&&o.id.trim().toLowerCase()!==B&&t.add(o.id.trim());return[...t].sort((o,c)=>o.localeCompare(c))}function k(e,t,n){return b(e).map(o=>{let c=t.get(d(o));return c?{id:o,title:c.title,status:c.status,resolved:p(c.status,n)}:{id:o,title:null,status:null,resolved:!1}})}function C(e,t){let n=new Map(e.map(s=>[d(s.id),s])),o=new Set([...I(t),...t.blocked_statuses]),c=new Set;for(let s of e){let l=u(s.status,t);if(!o.has(l))continue;(t.blocked_statuses.has(l)||k(s,n,t).some(a=>!a.resolved))&&c.add(d(s.id))}return c}function I(e){return e.active_statuses.size>0?e.active_statuses:new Set([e.open_status])}function E(e,t,n){let o=[d(e)],c=new Set;for(;o.length>0;){let s=o.pop();if(!c.has(s)){c.add(s);for(let l of t.get(s)??[]){if(!p(l.status,n))return!0;o.push(d(l.id))}}}return!1}function T(e){let t=new Map,n=new Map,o=new Map;for(let c of e){t.set(d(c.id),c);let s=typeof c.parent=="string"?c.parent.trim():"";if(s.length>0){let l=d(s),i=n.get(l)??[];i.push(c),n.set(l,i)}for(let l of b(c)){let i=d(l),a=o.get(i)??[];a.push(c.id),o.set(i,a)}}return{itemsById:t,childrenByParent:n,blockedByReverse:o}}function x(e,t,n){let{itemsById:o,childrenByParent:c,blockedByReverse:s}=T(t),l=new Set([...I(n),...n.blocked_statuses]),i=new Set(t.filter(r=>!p(r.status,n)).map(r=>d(r.id))),a=[],y=[],m=0,h=0;for(let r of e){if(!l.has(u(r.status,n)))continue;if(m+=1,E(r.id,c,n)){h+=1;continue}let w=k(r,o,n).filter(f=>!f.resolved),v=(s.get(d(r.id))??[]).filter(f=>i.has(d(f))).sort((f,S)=>f.localeCompare(S)),_={item:r,open_blockers:w,unblocks:v},g=n.blocked_statuses.has(u(r.status,n));w.length===0&&!g?a.push(_):y.push(_)}return{ready:a,blocked:y,active_count:m,container_count:h}}(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]="9184e723-8269-5e45-8c6a-52fd02da60e6")}catch{}})();export{b as a,k as b,C as c,x as d};
2
+ //# sourceMappingURL=chunk-N7QN3NE6.js.map
@@ -0,0 +1,2 @@
1
+ import{F as m}from"./chunk-LKQXXO62.js";import{Ja as p}from"./chunk-7YTZ7A4E.js";import{oa as d,xa as A,za as O}from"./chunk-7AZDTGPA.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 g={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]="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}],f=c.filter(e=>e.repeatable!==!0).map(e=>({target:e.target,keys:e.keys})),v=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}],y=u.filter(e=>e.repeatable!==!0).map(e=>({target:e.target,keys:e.keys})),N=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 R=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"]),E=new Set(A),k=new Set(["--brief","--format","--full","--full-changed-fields","--id-only","--no-truncate","--stream"]),b=new Set(["--body-file","--file","--stdin-json"]),I=new Set(["--global","--local","--project"]),L=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"]),h=new Set(["action","path","pmExecutable","timeoutMs"]),P=new Set(["configAction","id","name","query","reason","subcommand","target","text"]),w={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>"}},G={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 M(e){return e.startsWith("extension-")?`extension ${e.slice(10)}`:e.startsWith("package-")?`package ${e.slice(8)}`:e}function C(e,t){let i=G[e]?.[t];return i!==void 0?i:t.replace(/^--/,"").replaceAll("_","-").replace(/-([a-z])/g,(r,o)=>o.toUpperCase())}function F(e){let t=new Set;return e.filter(({flag:i})=>!i.startsWith("--")||t.has(i)?!1:(t.add(i),!0))}function D(e,t){return t.find(({aliases:i})=>i?.includes(e))?.flag}function x(e,t,i,r){let o=C(e,t.flag);if(r.has(o))return{surface:"cli",input:t.flag,counterpart:o,disposition:"shared",reason:"The CLI flag maps directly to a strict SDK action parameter."};let n=D(t.flag,i);if(n!==void 0){let a=C(e,n);if(r.has(a))return{surface:"cli",input:t.flag,counterpart:a,disposition:"compatibility_alias",reason:`Compatibility spelling for ${n}.`}}return R.has(t.flag)?{surface:"cli",input:t.flag,disposition:"cli_transport",reason:"CLI process transport is supplied by the in-process SDK host."}:k.has(t.flag)?{surface:"cli",input:t.flag,disposition:"cli_presentation",reason:"CLI rendering or mutation projection does not alter the SDK result envelope."}:b.has(t.flag)?{surface:"cli",input:t.flag,disposition:"cli_adapter",reason:"Local file or stdin adaptation is a CLI boundary concern."}:L.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."}:I.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:o,disposition:"unclassified",reason:"The CLI flag has no strict SDK parameter or approved boundary classification."}}function U(e,t,i){let r=i.find(({counterpart:n,disposition:a})=>n===t&&(a==="shared"||a==="compatibility_alias"||a==="cli_scope_selector"));if(r!==void 0)return{surface:"sdk",input:t,counterpart:r.input,disposition:"shared",reason:"The strict SDK parameter is reachable from the CLI contract."};let o=w[e]?.[t];return o!==void 0?{surface:"sdk",input:t,counterpart:o,disposition:"shared",reason:"The strict SDK parameter maps to a canonical CLI positional argument."}:h.has(t)?{surface:"sdk",input:t,disposition:"sdk_transport",reason:"The SDK host supplies in-process transport and workspace selection."}:P.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 V(e={}){let t=e.actions??d,i=e.resolveFlags??p,r=e.resolveParameters??m;return t.map(o=>{let n=M(o),a=F(i(n)).filter(({flag:s})=>O(o)!==void 0||!E.has(s)),_=new Set(r(o)??[]),l=a.map(s=>x(o,s,a,_)),T=[..._].sort((s,S)=>s.localeCompare(S)).map(s=>U(o,s,l));return{action:o,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{g as a,c as b,f as c,v as d,u as e,y as f,N as g,V as h};
2
+ //# sourceMappingURL=chunk-QL5H3AQH.js.map