@unbrained/pm-cli 2026.9.26 → 2026.9.27

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 (130) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +16 -0
  3. package/dist/cli/commander-usage.js +2 -2
  4. package/dist/cli/error-guidance.js +1 -1
  5. package/dist/cli/main.js +2 -2
  6. package/dist/cli/register-setup.js +1 -1
  7. package/dist/cli/runtime/selection.d.ts +3 -1
  8. package/dist/cli/runtime/selection.js +1 -1
  9. package/dist/cli-bundle/bundle-manifest.json +160 -152
  10. package/dist/cli-bundle/chunks/{chunk-IYN4MJ2C.js → chunk-3BTJ66CB.js} +56 -56
  11. package/dist/cli-bundle/chunks/{chunk-FOTXRNY6.js → chunk-4SLLCDFL.js} +39 -39
  12. package/dist/cli-bundle/chunks/{chunk-GRWPZR7F.js → chunk-4UPZLUT2.js} +7 -7
  13. package/dist/cli-bundle/chunks/{chunk-U55RYT3I.js → chunk-6OJVQ7SW.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-TYJXMT3Q.js → chunk-7TAGYNFP.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-QQD3VRMZ.js → chunk-AUS6USO4.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-4ODHIX7N.js → chunk-IEP3VAT5.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-HTHTX6E6.js → chunk-JX6WCCHL.js} +2 -2
  18. package/dist/cli-bundle/chunks/chunk-LC6WEA5U.js +2 -0
  19. package/dist/cli-bundle/chunks/{chunk-VMO4P5MX.js → chunk-LKGQUZ5M.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-TC74K7SS.js → chunk-OKVDVERQ.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-SZQCHJI4.js → chunk-TSF2LPIH.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-MJWKR7YA.js → chunk-V5UGBYHN.js} +3 -3
  23. package/dist/cli-bundle/chunks/{register-list-query-426QTRET.js → register-list-query-6PAJ4PBU.js} +2 -2
  24. package/dist/cli-bundle/chunks/{register-mutation-FLI3HHMP.js → register-mutation-RZCXZXYS.js} +2 -2
  25. package/dist/cli-bundle/chunks/{register-operations-TP7ZG4MK.js → register-operations-GK6VU2H2.js} +2 -2
  26. package/dist/cli-bundle/chunks/register-setup-ASEMNMBF.js +2 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-H3BI4EDO.js → chunk-6J2YCGSN.js} +3 -3
  28. package/dist/cli-bundle/focused-chunks/{chunk-XKH2FC5D.js → chunk-6UNKK3UH.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-NRHTXBTI.js → chunk-DQ3MB7BO.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-PMPFLA6X.js → chunk-E7LYK7V5.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-25BBHWMH.js → chunk-GZD4ZYIB.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-KMPKKSA6.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-TLF6N56J.js → chunk-LBDWUHQD.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-UIFVIE5F.js → chunk-MILJCOFJ.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-MK5AKKHK.js → chunk-NETVXIH5.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-Q355NPLH.js → chunk-NWRVNHAD.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-XVBWZTU2.js → chunk-NZAG7OKB.js} +12 -12
  38. package/dist/cli-bundle/focused-chunks/{chunk-OY3VHCTX.js → chunk-OJKJFDIG.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-OJRX6G22.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-NVVB2HJC.js → chunk-PDVL7QYU.js} +16 -16
  41. package/dist/cli-bundle/focused-chunks/{chunk-O7MIBEMK.js → chunk-QO4MTAEA.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-ABA3KRPY.js → chunk-SMADBUPL.js} +2 -2
  43. package/dist/cli-bundle/main.js +21 -21
  44. package/dist/cli-bundle/sdk-authoring.js +1 -1
  45. package/dist/cli-bundle/sdk-contracts.js +1 -1
  46. package/dist/cli-bundle/sdk-core.js +2 -2
  47. package/dist/cli-bundle/sdk-governance.js +1 -1
  48. package/dist/cli-bundle/sdk-graph.js +1 -1
  49. package/dist/cli-bundle/sdk-merge.js +23 -23
  50. package/dist/cli-bundle/sdk-query.js +1 -1
  51. package/dist/cli-bundle/sdk-runtime.js +1 -1
  52. package/dist/cli-bundle/sdk-testing.js +1 -1
  53. package/dist/cli-bundle/sdk.js +8 -8
  54. package/dist/sdk/agent-capability-contracts.js +1 -1
  55. package/dist/sdk/cli-contracts/command-aliases.js +1 -1
  56. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
  57. package/dist/sdk/completion/shared.d.ts +1 -1
  58. package/dist/sdk/completion/shared.js +1 -1
  59. package/dist/sdk/extension/static-inventory.d.ts +54 -0
  60. package/dist/sdk/extension/static-inventory.js +2 -0
  61. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  62. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  63. package/dist/sdk/guide-topics.js +1 -1
  64. package/dist/sdk/index.d.ts +1 -0
  65. package/dist/sdk/index.js +1 -1
  66. package/dist/sdk/public-surface.json +1 -1
  67. package/dist/sdk/query/complete-list.js +1 -1
  68. package/dist/sdk/read-output/provenance.d.ts +20 -0
  69. package/dist/sdk/read-output/provenance.js +2 -0
  70. package/dist/sdk/read-output-contracts.js +1 -1
  71. package/dist/sdk/runtime-input.js +1 -1
  72. package/docs/CLI_GRAMMAR.md +31 -0
  73. package/docs/CODEX_PLUGIN.md +8 -0
  74. package/docs/EXTENSION_LIFECYCLE.md +18 -0
  75. package/docs/RELEASING.md +46 -1
  76. package/docs/agent-task-token-baseline.json +4 -4
  77. package/docs/generated/AGENT_CAPABILITY_ROUTING.md +1 -1
  78. package/docs/generated/AGENT_COMMAND_SURFACE.md +5 -1
  79. package/docs/generated/FLAG_LEXICON_BUDGETS.md +4 -0
  80. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +14 -7
  81. package/marketplace.json +2 -2
  82. package/package.json +2 -2
  83. package/packages/pm-beads/package.json +1 -1
  84. package/packages/pm-calendar/package.json +1 -1
  85. package/packages/pm-command-kit/package.json +1 -1
  86. package/packages/pm-digital-twin/package.json +1 -1
  87. package/packages/pm-governance-audit/package.json +1 -1
  88. package/packages/pm-guide-shell/package.json +1 -1
  89. package/packages/pm-kanban/package.json +1 -1
  90. package/packages/pm-lifecycle-hooks/package.json +1 -1
  91. package/packages/pm-linked-test-adapters/package.json +1 -1
  92. package/packages/pm-search-advanced/package.json +1 -1
  93. package/packages/pm-templates/package.json +1 -1
  94. package/packages/pm-todos/package.json +1 -1
  95. package/packages/pm-vcs/package.json +1 -1
  96. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  97. package/plugins/pm-claude/README.md +5 -1
  98. package/plugins/pm-claude/package.json +2 -2
  99. package/plugins/pm-claude/skills/pm-audit/SKILL.md +14 -103
  100. package/plugins/pm-claude/skills/pm-audit/agents/openai.yaml +4 -0
  101. package/plugins/pm-claude/skills/pm-developer/SKILL.md +20 -143
  102. package/plugins/pm-claude/skills/pm-developer/agents/openai.yaml +4 -0
  103. package/plugins/pm-claude/skills/pm-planner/SKILL.md +16 -167
  104. package/plugins/pm-claude/skills/pm-planner/agents/openai.yaml +4 -0
  105. package/plugins/pm-claude/skills/pm-release/SKILL.md +18 -102
  106. package/plugins/pm-claude/skills/pm-release/agents/openai.yaml +4 -0
  107. package/plugins/pm-claude/skills/pm-workflow/SKILL.md +25 -156
  108. package/plugins/pm-claude/skills/pm-workflow/agents/openai.yaml +4 -0
  109. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  110. package/plugins/pm-codex/README.md +10 -2
  111. package/plugins/pm-codex/mcp.json +11 -0
  112. package/plugins/pm-codex/package.json +2 -2
  113. package/plugins/pm-codex/plugin.json +45 -0
  114. package/plugins/pm-codex/skills/pm-audit/SKILL.md +21 -0
  115. package/plugins/pm-codex/skills/pm-audit/agents/openai.yaml +4 -0
  116. package/plugins/pm-codex/skills/pm-auditor/SKILL.md +5 -40
  117. package/plugins/pm-codex/skills/pm-auditor/agents/openai.yaml +3 -5
  118. package/plugins/pm-codex/skills/pm-developer/SKILL.md +26 -0
  119. package/plugins/pm-codex/skills/pm-developer/agents/openai.yaml +4 -0
  120. package/plugins/pm-codex/skills/pm-native/SKILL.md +7 -87
  121. package/plugins/pm-codex/skills/pm-native/agents/openai.yaml +3 -5
  122. package/plugins/pm-codex/skills/pm-planner/SKILL.md +22 -0
  123. package/plugins/pm-codex/skills/pm-planner/agents/openai.yaml +4 -0
  124. package/plugins/pm-codex/skills/pm-release/SKILL.md +17 -38
  125. package/plugins/pm-codex/skills/pm-release/agents/openai.yaml +2 -4
  126. package/plugins/pm-codex/skills/pm-workflow/SKILL.md +39 -0
  127. package/plugins/pm-codex/skills/pm-workflow/agents/openai.yaml +4 -0
  128. package/dist/cli-bundle/chunks/register-setup-574SIVQZ.js +0 -2
  129. package/dist/cli-bundle/focused-chunks/chunk-HNHMK5JI.js +0 -2
  130. package/dist/cli-bundle/focused-chunks/chunk-HQPTDJLF.js +0 -2
@@ -1,4 +1,4 @@
1
- import{n as du,o as Go,p as _u,q as hu,r as ha,s as Ko,t as gu,u as ga,v as zo,y as zu,z as Bu}from"./focused-chunks/chunk-OY3VHCTX.js";import{a as Yu,f as Ju,h as Qt,m as Xu,o as ur,r as Xo,s as Qu,t as Zu,x as ep}from"./focused-chunks/chunk-HNHMK5JI.js";import{$ as Mn,$a as Vf,A as Er,Ab as s_,B as sf,Bb as a_,C as bi,Cb as c_,D as af,Db as l_,E as cf,Eb as Cr,Fa as Mf,Fb as ec,Gb as tc,Ha as Uf,Hb as Oi,Ia as Ti,Ib as nc,J as lf,Ja as sk,Jb as d_,K as df,Ka as Gf,Kb as rc,L as mf,La as jf,Lb as xi,M as uf,Ma as Za,Mb as Gn,N as pf,Nb as oc,O as ff,Ob as ic,P as _f,Pb as m_,Q as hf,Qb as u_,R as gf,Rb as p_,S as yf,Sb as jn,T as vf,Tb as sc,U as wf,Ub as f_,V as bf,W as kf,X as Sf,Xa as Kf,Xb as Pi,Y as Ef,Ya as zf,Z as Af,Za as Bf,_ as Tf,_a as Hf,aa as Cf,ab as Wf,ba as If,bb as Yf,ca as Ut,cb as en,cc as __,da as w,db as Jf,dc as h_,ea as Rf,eb as Xf,ec as g_,fa as Of,fb as Ci,g as Qp,ga as Fe,gb as Qf,h as Zp,ha as xf,hb as Zf,ia as Wa,ib as e_,ic as y_,ja as Pf,jb as t_,jc as I_,ka as Ya,kb as n_,la as Ar,lb as Ii,ma as ki,mb as Gt,na as Dn,nb as r_,oa as Nf,ob as Ri,pa as Ja,qa as he,ra as Xa,rb as Tr,sa as ge,ta as Lf,ua as $f,va as Si,wa as Ff,xa as Ei,y as of,yb as o_,z as Ba,zb as i_}from"./focused-chunks/chunk-H3BI4EDO.js";import{e as au,g as cu,h as lu,k as mu,q as fu}from"./focused-chunks/chunk-MK5AKKHK.js";import{b as Hu,c as Jo,e as Vu,f as Wu,g as Kb}from"./focused-chunks/chunk-NRHTXBTI.js";import{R as Pa,V as Ku,a as Qd,b as Zd,c as em,d as tm,f as nm}from"./focused-chunks/chunk-PMPFLA6X.js";import{a as tf,b as nf,c as Ni}from"./focused-chunks/chunk-ABA3KRPY.js";import{K as qf,b as rf}from"./focused-chunks/chunk-XKH2FC5D.js";import{Ba as mc,Da as A_,Sa as Or,Ua as T_,Va as C_,c as Ha,e as Va,g as Qa,h as Ir,i as ak,j as ac,k as cc,l as Li,m as ck,n as lk,pa as lc,s as v_,t as w_,u as b_,ua as Rr,v as k_,w as S_,wa as dc,x as E_}from"./focused-chunks/chunk-XVBWZTU2.js";import{$a as wr,A as pe,B as Pn,C as di,D as mi,G as ui,H as pi,I as Lp,Ia as Fn,J as fi,Ja as Bp,K as _i,Ka as za,L as Nn,La as Hp,M as qa,N as hi,O as $p,Oa as Vp,P as Fp,Pa as Wp,Q as yr,Xa as yi,_a as Jp,a as Rp,b as ti,c as ni,cb as Xp,d as ri,e as oi,i as ii,j as Nt,k as On,kb as ht,l as si,m as xn,mb as Sr,n as ai,nb as Zt,o as le,p as ci,pb as ef,q as Ga,qb as Ai,r as He,s as ja,sa as zp,t as Op,u as Ce,vb as Un,w as ft,x as xp,y as li,z as Lt}from"./focused-chunks/chunk-25BBHWMH.js";import{c as ou,f as iu,g as su,i as Uo,j as Ot,k as yu,l as vu,m as wu}from"./focused-chunks/chunk-O7MIBEMK.js";import{a as np,b as rp,c as op}from"./focused-chunks/chunk-UIFVIE5F.js";import{$ as Om,A as _o,Aa as Jm,B as dm,Ba as Xm,C as mm,Ca as Ao,D as um,Da as Qm,E as ho,Ea as Zm,F as pm,Fa as eu,G as fm,Ga as To,H as _m,Ha as Co,I as hm,Ia as Io,J as go,Ja as Ro,K as yo,Ka as lr,L as gm,La as tu,M as vo,Ma as Oo,Na as dr,O as ym,Oa as xo,P as ar,Pa as Po,Q as vm,Qa as No,R as wm,Ra as Lo,S as bm,Sa as nu,T as km,Ta as It,U as Sm,Ua as $o,V as Em,Va as Fo,W as Am,Wa as Mo,X as Tm,Xa as Do,Y as Cm,Z as Im,_ as Rm,_a as ru,aa as xm,ab as Rt,ba as Pm,bb as N,ca as Nm,d as pa,da as cr,e as rm,ea as Lm,fa as $m,ga as wo,h as mo,ha as bo,i as fa,ia as Fm,j as Jt,ja as Mm,ka as Dm,l as om,la as Um,ma as Gm,na as jm,oa as qm,pa as Km,q as _a,ra as zm,s as uo,sa as Bm,t as po,ta as Hm,u as fo,ua as Vm,v as im,va as Wm,w as sm,wa as Ym,x as am,xa as ko,y as cm,ya as So,z as lm,za as Eo}from"./focused-chunks/chunk-HQPTDJLF.js";import{$ as _p,$a as Ln,A as ik,Ab as fe,B as Rn,Bb as jp,C,Cb as gi,Db as _t,Eb as qp,Fb as ie,G as pt,Ga as Ep,Gb as Kp,Ia as Ua,K as ap,Kb as Yp,L as ei,La as Ap,M as cp,Ma as Tp,N as lp,Na as nt,O as dp,P as mp,Q as up,Qa as Cp,Qb as br,Ra as Ip,Rb as kr,S as ee,Sa as A,Sb as vi,T as Na,Ta as $e,Tb as Dt,U as te,Ua as Te,Va as Pp,W as La,Wa as Np,X as pp,Xa as $t,Y as Be,Yb as wi,Z as et,Za as qe,_ as fp,_a as gr,a as zb,ab as Mp,b as Bb,ba as hp,bb as $n,c as Hb,ca as gp,cb as Ka,d as Vb,da as $a,db as Dp,ga as Fa,ia as yp,j as Qo,ja as vp,jb as vr,k as ip,ka as wp,l as sp,la as bp,m as In,ma as kp,n as pr,nc as Df,o as Wb,p as Yb,q as Jb,qa as Le,qb as Ft,r as Xb,ra as Pt,s as Qb,sb as Mt,t as Zb,ta as Ma,u as ek,ua as fr,ub as Up,v as tk,va as _r,vb as I,w as nk,wa as Da,wb as q,x as Zo,xa as tt,xb as oe,y as rk,ya as Sp,yb as Gp,z as ok,za as hr}from"./focused-chunks/chunk-Q355NPLH.js";import{b as Tt,c as io,d as so,g as mt,i as jo,j as ut,k as xt,l as uu,n as F,o as qo,p as Ze,r as pu}from"./focused-chunks/chunk-TLF6N56J.js";import{e as tp}from"./focused-chunks/chunk-HFAW3FJQ.js";import{$ as d,$a as ue,$b as ku,$d as Ae,Ab as ir,Ac as Pu,Ad as Ob,B as xd,Bd as xb,C as Pd,Cc as ba,Cd as Pb,Ce as Ub,D as Nd,Dc as ka,De as Gb,E as Ld,Ec as Sa,Ed as Nb,Ee as jb,F as $d,Fb as ke,Fc as Ea,Fd as Lb,Fe as qb,G as Fd,Ga as kn,Gc as Aa,Gd as Ra,Ge as Yo,H as ra,Hb as H,Hc as Ta,Hd as Oa,He as qu,I as oa,Ia as qd,Ic as Ca,Id as xa,J as ia,Jb as sr,Jc as O,Jd as $u,K as sa,Ka as da,Kc as An,L as aa,Lc as Xt,Ld as Fu,M as ca,Mc as J,Md as $b,Na as ma,Nc as Bo,Oa as tr,Oc as Tn,Od as Fb,P as oo,Pa as Se,Pb as En,Pd as Mb,Qd as Db,Rc as Ho,Sa as x,Sd as S,Ta as be,Tc as Ee,U as la,Ua as co,Uc as Vo,Va as Sn,W as Md,Wa as nr,Wd as Wo,Xa as Kd,Ya as E,Yc as mr,Yd as re,Z as At,Za as zd,_a as ct,_b as bu,aa as l,ab as lt,ac as Su,bc as Eu,cb as Qe,cc as Au,db as lo,dc as Tu,ec as ya,fc as Cu,fe as Mu,hb as Bd,hc as Iu,ia as Dd,ib as Hd,ic as Ru,jb as Vd,ka as Ud,kb as Wd,kd as Nu,lb as Yd,lc as va,ma as ao,mb as Jd,mc as Ou,me as Du,nb as Xd,nc as wa,ne as Uu,o as to,oa as Gd,od as Lu,p as Od,pa as jd,pb as rr,q as no,qb as Yt,qe as Cn,r as na,rb as dt,sa as G,ta as Wt,td as Ia,ua as Ct,uc as xu,ue as Gu,v as Vt,va as Z,w as at,wa as ce,x as vn,y as wn,ya as bn,yb as or,ye as ju,z as ro,zb as ua}from"./focused-chunks/chunk-NVVB2HJC.js";import{AsyncLocalStorage as jF}from"node:async_hooks";(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]="1979adcd-4a7f-5dc7-b5dd-6bfc15eed1af")}catch{}})();var dk=Pa("list").properties.outputSession,mk={outputInclude:{type:"string",minLength:1,description:"Comma-separated fields or sections retained by any built-in read action."},outputLimit:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal read row ceiling, or unbounded to disable the shared ceiling."},outputBudget:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal estimated-token ceiling, or unbounded to return the complete read result."},outputFormat:{type:"string",enum:["json","toon"],description:"Universal read-result encoding selector."},outputSession:{...dk},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},R_={definition:{anyOf:[{type:"object"},{type:"string"}],description:"Policy declaration for policy-put, or proposed metadata for policy-check; structured JSON or JSON text."},policy:{type:"string",description:"Approval policy id for policy-approve."},message:{type:"string",description:"History explanation for policy mutations and approvals."},dryRun:{type:"boolean",description:"Preview registry changes without writing; policy-approve rejects previews."}},O_={type:"object",properties:{cwd:{type:"string",description:"Workspace directory to run the native pm operation in. Defaults to the MCP server process cwd."},path:{type:"string",description:"Optional pm data root, equivalent to PM_PATH/global --path. Leave unset for real repository tracking."},author:{type:"string",description:"Optional mutation author override. Otherwise pm uses PM_AUTHOR, project settings, or detected harness identity."},tokenAccounting:{type:"boolean",description:"Attach the same bounded per-section token-cost receipt emitted by CLI --token-accounting."}},additionalProperties:!0},se={type:"string",description:"pm item id, for example pm-abc1."},uk=`Operation name (one of): ${wa.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,pk={status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."},offset:{type:["string","number"],description:"Alias for options.offset."}},fk={mode:{type:"string",description:"Alias for options.mode."},status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."}};function D(e,t=[]){return{...O_,properties:{...O_.properties,...e},required:t}}var _k=[{name:"pm_run",description:"Run any supported pm operation natively through the pm library. Use this for commands not covered by narrower pm_* tools.",inputSchema:D({action:{type:"string",enum:[...wa],description:uk},id:se,query:{type:"string",description:"Search query for action=search."},reason:{type:"string",description:"Close reason for action=close."},force:{type:"boolean",description:"Force ownership/terminal-state override when supported."},subcommand:{type:"string",description:"Subcommand selector for actions that take one (for example telemetry, or schema \u2014 prefer the dedicated pm_schema tool for schema operations)."},options:{type:"object",description:"Underlying pm command options using camelCase keys."},fullChangedFields:{type:"boolean",description:"For mutation actions, return the full changed_fields array instead of the default changed_field_count."},idOnly:{type:"boolean",description:"For single-item mutation actions, return only id and status."},...mk},["action"])},{name:"pm_discover",description:"Discover the smallest relevant authorized pm tool catalog under an explicit token budget. Ranking is deterministic and returns public lexical, semantic, graph, permission, freshness, and usage signal explanations. Continue with next_cursor; set includeSchema=true only when complete input schemas are needed.",inputSchema:D({query:{type:"string",maxLength:4096,description:"Free-text capability intent. Empty text lists by stable policy order."},family:{type:"string",enum:["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],description:"Optional stable capability-family filter."},tier:{type:"string",enum:["core","standard","full"],description:"Maximum command visibility tier included in results."},limit:{type:"integer",minimum:1,maximum:100,description:"Maximum result rows; defaults to 10."},cursor:{type:"string",minLength:1,maxLength:4096,description:"Opaque next_cursor from an equivalent discovery request."},includeSchema:{type:"boolean",description:"Include complete tool input schemas; false by default."},outputBudget:{anyOf:[{type:"integer",minimum:128},{const:"unbounded"}],description:"Estimated-token ceiling; defaults to 1200."}})},{name:"pm_context",description:"Return the agent-oriented project context snapshot. Pass options.depth=brief|standard|deep|full (full = every section with no per-section row cap), options.parent='<id>' to scope the snapshot to one item's subtree (the item plus all descendants), options.fields='id,title,priority' to project focus rows to a field subset for low-token reads, or options.section=['hierarchy','progress',...] to pick sections.",inputSchema:D({options:{type:"object"}})},{name:"pm_next",description:"Recommend the next actionable work item: the single highest-priority READY item (active status, no open blockers, no open children; completed containers surface only when no concrete leaf work is ready) plus the ranked ready and blocked queues. The recommended item carries a rationale and each blocked item lists the open blockers gating it. Pass options.parent='<id>' to scope to one subtree, options.limit=N to cap ready rows, options.readyOnly=true to omit the blocked list, or filters (options.type/tag/priority/assignee/sprint/release). The most token-efficient 'what should I do now?' read for agents.",inputSchema:D({options:{type:"object"}})},{name:"pm_search",description:"Search pm items with keyword, semantic, or hybrid search. Defaults to a compact projection for token efficiency. Pass options.mode=keyword|semantic|hybrid (default follows search.default_mode: auto runs hybrid when semantic search is configured and runnable, else keyword; the result reports mode_source), options.limit=N to cap hits, options.status='all' for no lifecycle restriction, options.fields='id,title,score' for a custom projection, or options.full=true for full item bodies (can be large). The result echoes the applied filters and projection mode in query_summary.",inputSchema:D({query:{type:"string"},options:{type:"object"},...fk},["query"])},{name:"pm_list",description:"List pm items with status/type/tag/priority filters. Defaults to compact projection for token efficiency. options.status accepts CSV (all,open,in_progress). Pass options.compact=false or options.includeBody=true for full bodies/comments. Pass options.brief=true for ultra-terse (id/status/type/title only). Pass options.fields='id,title,priority' for custom projection. Pass options.limit=N to cap row count. The result echoes the applied filters and projection mode in query_summary.",inputSchema:D({options:{type:"object"},...pk})},{name:"pm_get",description:"Read one pm item with shared SDK projections. Pass options.depth='brief' or options.fields='id,title,status' for low-token inspection, options.fields='id,schedule.start_at' for schedule context, or options.at='7' / an ISO timestamp for a verified mutation-free historical read. Parent results include bounded child counts, samples, and continuation metadata.",inputSchema:D({id:se,options:{type:"object",description:"Get options such as depth=brief|standard|deep|full, fields=id,title,status, or at=<version|ISO timestamp>."}},["id"])},{name:"pm_events",description:"Read a bounded, cursor-resumable page of committed mutation events across item history streams. Batch cursors are the token-efficient default; pass cursorMode=row for per-event checkpoints.",inputSchema:D({since:{type:"string",description:"Durable event cursor or ISO timestamp lower bound."},type:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},author:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},limit:{type:"integer",minimum:0,maximum:1e3},full:{type:"boolean"},cursorMode:{type:"string",enum:["batch","row"],description:"Cursor framing: batch returns one terminal next_cursor (default); row also adds a cursor to every event."}})},{name:"pm_create",description:"Create a pm item natively and write pm history. Output is compact by default (changed_fields replaced with changed_field_count for token efficiency); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},allowMissingParent:{type:"boolean",description:"Allow unresolved parent references and emit a validation warning."},allowDuplicate:{type:"boolean",description:"Explicitly create when strict similarity governance finds likely duplicates."},options:{type:"object",description:"Create options. title and description are required."}},["options"])},{name:"pm_mutate",description:"Apply an ordered create/update/close/release batch atomically through the public pm SDK. Create rows may declare ref and omit id; @ref forward references resolve deterministically from the stable transactionId. Set dryRun=true to validate and preview without writes.",inputSchema:D({transactionId:{type:"string",description:"Stable idempotency key for this atomic mutation batch."},mutations:{type:"array",minItems:1,description:"Ordered rows shaped as {op:create|update|close|release,id?,ref?,options?,reason?}.",items:{type:"object",properties:{op:{type:"string",enum:["create","update","close","release"]},id:se,ref:{type:"string",description:"Batch-local create alias; its deterministic id can be referenced as @alias by any row."},reason:{type:"string"},options:{type:"object"}},required:["op"],additionalProperties:!1}},dryRun:{type:"boolean",description:"Validate and preview without writing."},createCompensation:{type:"string",enum:["close","delete"],description:"How a failed batch compensates created items; defaults to close."},lockTtlSeconds:{type:"number"},lockWaitMs:{type:"number"}},["transactionId","mutations"])},{name:"pm_copy",description:"Copy an existing pm item into a new id while resetting lifecycle fields. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:se,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object",description:"Copy options such as title override, author, and message."}},["id"])},{name:"pm_focus",description:"Set, clear, or show the session focused item. When focused, pm_create defaults its parent to the focused item (an explicit parent still overrides). Pass id to focus an item, options.clear=true to clear, or neither to show current focus.",inputSchema:D({id:se,clear:{type:"boolean",description:"Clear the focused item (cannot be combined with id)."},options:{type:"object",description:"Focus options such as clear (boolean)."}},[])},{name:"pm_update",description:"Update pm item metadata/body/dependencies/log seeds natively. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields delta.",inputSchema:D({id:se,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object"}},["id","options"])},{name:"pm_append",description:"Append markdown text to a pm item body and write pm history. Useful for seeding evidence/log entries before close. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:se,body:{type:"string",description:"Markdown text to append to the item body. Required here or as options.body."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object",description:"Append options such as body, author, and message."}},["id"])},{name:"pm_claim",description:"Claim a pm item.",inputSchema:D({id:se,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_release",description:"Release a pm item claim.",inputSchema:D({id:se,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_close",description:"Close a pm item with optional close reason and optional close validation (reason requirement follows governance settings). Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:se,reason:{type:"string",description:"Close reason text when provided or required by governance settings."},duplicateOf:{type:"string",description:"Canonical item id when closing this item as a duplicate."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object"}},["id"])},{name:"pm_comments",description:"List, add, edit, or delete comments on a pm item. Use options.add to append, options.edit=<1-based index> with replacement text to fix a comment, or options.delete=<1-based index> to remove one. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. List calls default to the most recent 20 comments with total_count/has_more metadata for token efficiency. Pass options.limit=N to choose a page size, options.limit=0 for summary-only metadata, or options.full=true for full history.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_files",description:"List, add, remove, or validate linked files for a pm item.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_docs",description:"List, add, or remove linked docs for a pm item.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_notes",description:"List, add, edit, or delete structured notes on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing notes.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_learnings",description:"List, add, edit, or delete learnings on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing learnings.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_deps",description:"Read dependency trees/graphs or one bounded explainable relationship context packet. Use options.format=context with direction, kind, depth, node, edge, token, and cursor bounds; context returns a counts-first summary, per-node roles/reasons, root evidence pointers, and enumerated missing references.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_graph",description:"Run bounded workspace relationship-graph queries: ancestors/descendants (hierarchy), predecessors/successors (ordering), paths, impact (blast radius), analyze (execution + knowledge analytics), audit (governance findings with change-since-baseline deltas), communities (label-propagation clusters), redundancy (transitively implied edges), dominators (structural bottlenecks), slack (critical-path method float per task), centrality (betweenness/closeness/degree with directed fan-in/out), articulation (cut points and bridges \u2014 single points of failure), plan (dry-run remediation proposals derived from the audit), and index (durable cross-process graph index status/rebuild/clear). Traversals, paths, impact, and dominators require id; paths also requires target. Options support kind, maxDepth, limit, after, direction, maxPaths, sample, exemptIsolate, exemptIsolateType, saveBaseline (audit), rebuild/clear (index), and counts-first summary.",inputSchema:D({subcommand:{type:"string",enum:[...Cu]},id:se,target:se,options:{type:"object"}},["subcommand"])},{name:"pm_test",description:"List, add, remove, or run linked tests for a pm item.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_validate",description:"Run pm validation checks.",inputSchema:D({options:{type:"object"}})},{name:"pm_health",description:"Run pm health diagnostics. Pass options.brief=true for compact low-token details, options.skipIntegrity=true, options.skipDrift=true, options.skipVectors=true for a fast status-only check, or options.full=true for the complete deep check.",inputSchema:D({options:{type:"object"}})},{name:"pm_contracts",description:"Inspect pm command, flag, schema, and availability contracts.",inputSchema:D({options:{type:"object"}})},{name:"pm_schema",description:"Inspect or modify the workspace item-type/status/field schema (pm schema). subcommand selects the operation; name carries the item type name (show/add-type/remove-type), status id (show-status/add-status/remove-status), or field key (show-field/add-field/remove-field). apply-preset adopts a domain type preset; add-type with infer=true derives types from title-prefix conventions. Policy verbs author declarations, preview changes, set enforcement, and record content-bound approvals. Registry mutations write workspace history; approvals write item history.",inputSchema:D({...R_,subcommand:{type:"string",enum:["list","show","show-status","add-type","remove-type","add-status","remove-status","add-field","remove-field","list-fields","show-field","apply-preset",...En],description:"Schema subcommand to run."},name:{type:"string",description:"Item type name, status id, field key, policy id, or item id for the selected schema verb; policy-mode requires advise|refuse."},description:{type:"string",description:"Custom item type, status, or field description for add-type/add-status/add-field."},defaultStatus:{type:"string",description:"Default status for add-type."},folder:{type:"string",description:"Storage folder for add-type."},alias:{type:"array",items:{type:"string"},description:"Aliases for add-type/add-status, or extra CLI flag aliases for add-field."},role:{type:"array",items:{type:"string",enum:[...na]},description:`Lifecycle roles for add-status: ${na.join(", ")}.`},order:{type:"number",description:"Display/sort order for add-status."},fieldType:{type:"string",enum:["string","number","boolean","string_array"],description:"Value type for a custom field (add-field)."},commands:{type:"array",items:{type:"string"},description:"Commands a custom field is wired onto (add-field): create, update, update_many, list, search, calendar, context."},cliFlag:{type:"string",description:"Override the auto-derived CLI flag for a custom field (add-field)."},required:{type:"boolean",description:"Mark a custom field as always required (add-field)."},requiredOnCreate:{type:"boolean",description:"Mark a custom field as required at create time (add-field)."},allowUnset:{type:"boolean",description:"Whether a custom field may be cleared via --unset (add-field); defaults to true."},requiredTypes:{type:"array",items:{type:"string"},description:"Restrict a custom field's requirement to specific item types (add-field)."},typePreset:{type:"string",enum:["agile","ops","research"],description:"Domain type preset to adopt (apply-preset)."},infer:{type:"boolean",description:"Infer item types from title-prefix conventions (add-type); previews unless apply is true."},minCount:{type:"number",description:"Minimum items sharing a prefix for add-type inference (default 10)."},apply:{type:"boolean",description:"Register inferred types (add-type infer); without it the call previews only."},force:{type:"boolean",description:"Override removal guardrails for destructive schema changes when supported."},options:{type:"object",description:"Additional schema options using camelCase keys.",properties:R_}},["subcommand"])},{name:"pm_profile",description:"List, show, apply, or lint project profiles (pm profile) \u2014 archetype bundles that stage item types, statuses, fields, per-type workflows, config knobs, create templates, and recommended packages. subcommand selects the operation; name carries the profile name (agile, ops, research) for show/apply/lint. apply stages every dimension idempotently; dryRun previews the diff without writing; lint reports author-time consistency findings (graded error/warning) without touching the tracker. Profile staging writes workspace config/schema files, not item history.",inputSchema:D({subcommand:{type:"string",enum:["list","show","apply","lint"],description:"Profile subcommand to run."},name:{type:"string",description:"Profile name for show/apply/lint. Required for those subcommands. Built-ins are agile, ops, and research; an active extension can contribute additional archetype names that resolve here too."},dryRun:{type:"boolean",description:"Preview the apply diff without writing any files (apply)."},author:{type:"string",description:"Mutation author for apply."},force:{type:"boolean",description:"Force ownership/lock override for apply."},options:{type:"object",description:"Additional profile options using camelCase keys."}},["subcommand"])},{name:"pm_config",description:"Read or write pm workspace configuration (pm config). configAction selects get/set/list/export; key/value address a single setting for get/set. scope chooses the project (default) or global settings file.",inputSchema:D({configAction:{type:"string",enum:["get","set","list","export"],description:"Config operation to perform. get/set require key; list/export dump the resolved settings surface."},key:{type:"string",description:"Settings key for get/set, for example governance-require-close-reason, telemetry-tracking, or a nested leaf such as search_provider (dash and underscore variants accepted; configAction=get without a key lists supported keys in the error)."},value:{type:"string",description:"New value for configAction=set."},scope:{type:"string",enum:["project","global"],description:"Settings scope to read or write. Defaults to project."},options:{type:"object",description:"Additional config options such as criterion, clearCriteria, format, or policy."}},["configAction"])},{name:"pm_plan",description:"Run agent-optimized Plan workflows. options.subcommand selects: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize. Provide id for all non-create subcommands; provide stepRef for step lifecycle subcommands. Plans store agent-readable steps with dependencies, decisions, discoveries, validation, and resume context.",inputSchema:D({id:{type:"string",description:"Plan id (required for all subcommands except create)."},stepRef:{type:"string",description:"Step id or order for step lifecycle subcommands."},options:{type:"object",description:"Plan options including subcommand, stepRef, stepStatus, link, depth, etc."}})}],hk={pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_docs:"docs",pm_events:"events",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"},gk=_k.map(e=>{let t=hk[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:Pa(t,{properties:n,required:r})}});function x_(){return gk.map(e=>{let t=e.inputSchema.required,n=Array.isArray(t)?t.map(r=>String(r)).sort((r,o)=>r.localeCompare(o)):[];return{name:e.name,description:e.description,required:n,input_schema:e.inputSchema}}).sort((e,t)=>e.name.localeCompare(t.name))}(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]="845638dd-45b8-5057-bed2-2f687591eeaa")}catch{}})();var P_=new Map([["claim",["--if-available","--next","--type","--priority","--token-budget","--explain-ranking"]],["close",["--reason","--validate-close","--resolution","--expected-result","--actual-result","--message"]],["context",["--limit","--after","--depth","--section","--token-budget","--explain-ranking"]],["contracts",["--command","--flags-only","--summary","--runtime-only","--availability-only","--full"]],["create",["--title","--type","--status","--priority","--dep","--comment"]],["get",["--full","--depth","--fields","--tree","--tree-depth","--format"]],["health",["--check-only","--summary","--brief","--check-telemetry","--strict-exit","--full"]],["list",["--status","--type","--limit","--after","--brief","--fields"]],["next",["--limit","--blocked-limit","--ready-only","--token-budget","--explain-ranking","--format"]],["search",["--mode","--status","--type","--limit","--after","--fields"]],["update",["--status","--message","--dep","--comment","--file","--test"]],["validate",["--check-resolution","--check-history-drift","--check-storage-integrity","--counts","--strict-exit","--fix-hints"]]]),yk=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],q_=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),Fi=new Set(["calendar","guide","reindex","completion","test-runs-list","test-runs-status","test-runs-logs","test-runs-stop","test-runs-resume","templates-list","templates-save","templates-show"]),tn=new Set(["meet","event","remind","search-advanced","dedupe-audit","dedupe-merge","comments-audit","cal","calendar","completion","completion-statuses","completion-tags","completion-types","guide","reindex","normalize","templates","templates list","templates save","templates show","test-runs","test-runs list","test-runs status","test-runs logs","test-runs stop","test-runs resume"]),K_=new Map([["meet","calendar"],["event","calendar"],["remind","calendar"],["search-advanced","search-advanced"],["dedupe-audit","governance-audit"],["dedupe-merge","governance-audit"],["comments-audit","governance-audit"],["cal","calendar"],["calendar","calendar"],["completion","guide-shell"],["completion-statuses","guide-shell"],["completion-tags","guide-shell"],["completion-types","guide-shell"],["guide","guide-shell"],["reindex","search-advanced"],["normalize","governance-audit"],["templates","templates"],["templates list","templates"],["templates save","templates"],["templates show","templates"],["test-runs","linked-test-adapters"],["test-runs list","linked-test-adapters"],["test-runs status","linked-test-adapters"],["test-runs logs","linked-test-adapters"],["test-runs stop","linked-test-adapters"],["test-runs resume","linked-test-adapters"]]),z_=new Map([["calendar","calendar|cal"],["guide","guide"],["reindex","reindex"],["completion","completion"],["test-runs-list","test-runs|test-runs list"],["test-runs-status","test-runs status"],["test-runs-logs","test-runs logs"],["test-runs-stop","test-runs stop"],["test-runs-resume","test-runs resume"],["templates-list","templates|templates list"],["templates-save","templates save"],["templates-show","templates show"]]),B_=new Map([...z_.entries()].flatMap(([e,t])=>gt(t).map(n=>[n,e]))),H_=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],fc=new Map(H_.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),vk=10,wk=20,N_=new Map([["activity","Read activity."],["aggregate","Group counts."],["append","Append body."],["assurance","Evaluate assurance."],["assurance derive","Derive checks."],["assurance risk","Select checks for changes."],["assurance lineages","Measure recurrence coverage."],["beads","Manage Beads interoperability."],["cal","Manage calendar integration."],["calendar","Manage calendar integration."],["changelog","Generate changelog output."],["claim","Claim work."],["close","Close work."],["close-many","Close matching work."],["close-task","Close task work."],["command-kit","Inspect command authoring primitives."],["comments","Manage comments."],["comments-audit","Audit comment governance."],["completion","Generate shell completions."],["config","Manage settings."],["context","Build context."],["contracts","Inspect contracts."],["copy","Copy work."],["create","Create work."],["dedupe-audit","Audit duplicate work."],["dedupe-merge","Merge duplicate work."],["delete","Delete work."],["deps","Manage deps."],["duplicates","Find duplicate clusters."],["docs","Link docs."],["eval","Run evaluations."],["event","Manage events."],["events","Read events."],["files","Link files."],["focus","Manage focus."],["gc","Clean caches."],["get","Read item."],["graph","Query graph."],["guide","Show user guides."],["health","Check health."],["help","Show help."],["history","Inspect history."],["init","Initialize workspace."],["install","Install packages."],["item","Mutate items."],["learnings","Manage learnings."],["list","List work."],["list-all","List work across every status."],["list-blocked","List blocked work."],["list-canceled","List canceled work."],["list-closed","List closed work."],["list-draft","List draft work."],["list-in-progress","List in-progress work."],["list-open","List open work."],["meet","Record meeting context."],["merge","Manage tracker merges."],["next","Pick next work."],["notes","Manage notes."],["normalize","Normalize tracker data."],["ops","Run operations."],["package","Manage packages."],["packages","Manage packages."],["pause-task","Pause task work."],["plan","Manage plans."],["profile","Manage profiles."],["reindex","Refresh search index."],["release","Release claim."],["remind","Manage reminders."],["restore","Restore history."],["schema","Customize schema."],["search","Search work."],["search-advanced","Run advanced search."],["start-task","Start task work."],["stats","Show stats."],["telemetry","Manage telemetry."],["templates","Manage work templates."],["test","Run linked tests."],["test-all","Run all linked tests."],["test-runs","Inspect background test runs."],["todos","Manage source-code todos."],["twin","Manage repository twins."],["update","Update work."],["update-many","Update matching work."],["upgrade","Upgrade packages."],["validate","Validate data."],["vcs","Inspect version-control context."],["workspace","Manage workspaces."],["history-author-acknowledge","Acknowledge reviewed history authors."],["history-compact","Compact history."],["history-attest","Export or verify detached history proof."],["history-redact","Redact sensitive history values."],["history-repair","Repair history integrity."]]),V_=[["init",ym],["install",wm],["uninstall",bm],["explore",km],["manage",Im],["describe",Sm],["reload",Rm],["doctor",Om],["catalog",xm],["adopt",Pm],["adopt-all",Em],["activate",Am],["deactivate",Tm],["migrate",Cm]],bk=[...V_.map(([e,t])=>e==="init"?[e,vm]:[e,t]),["upgrade",cr]],kk=[...V_.map(([e,t])=>[`extension ${e}`,t]),...bk.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",yo],["config",gm],["extension",vo],["package",ar],["packages",ar],["install",Nm],["create",Ao],["item mutate",Qm],["item complete",Zm],["item reopen",eu],["copy",To],["focus",Co],["update",Io],["update-many",Ro],["upgrade",cr],["calendar",lr],["cal",lr],["context",dr],["ctx",dr],["get",xo],["search",Fo],["eval",nu],["events",Oo],["workspace",It],["workspace position",[]],["workspace snapshot",It],["workspace snapshot create",It],["workspace snapshot list",It],["workspace snapshot inspect",It],["workspace snapshot restore",It],["workspace snapshot delete",It],["next",$o],["aggregate",fo],["deps",No],["graph",Lo],["guide",Po],["reindex",Lm],["history",_o],["history-compact",pm],["history-attest",fm],["history-redact",mm],["history-repair",um],["history-author-acknowledge",ho],["merge",dm],["schema",_m],["profile",hm],["plan",go],["restore",Mm],["delete",Dm],["close",$m],["close-many",wo],["append",bo],["claim",Fm],["release",Um],["start-task",Gm],["pause-task",jm],["close-task",qm],["comments",im],["notes",sm],["learnings",am],["files",cm],["docs",lm],["test",Bm],["test-runs-worker",[]],["test-all",Hm],["telemetry",Vm],["test-runs",Wm],["gc",Ym],["stats",ko],["ops",[]],["duplicates",So],["validate",Jm],["health",Eo],["assurance",Xm],...ru,["contracts",Mo],["completion",Do],["activity",tu],...[...q_].map(e=>[e,po])],xr=new Map(kk);for(let{alias:e,canonical:t}of ke){let n=xr.get(e);n!==void 0&&xr.set(t,n)}function Sk(e){let t=B_.get(e);return t||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function L_(e){let t=ke.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:ya.includes(e)?ye(e):e.startsWith("extension-")?ye(`extension ${e.slice(10)}`):e.startsWith("package-")?ye(`package ${e.slice(8)}`):e.startsWith("item-")?ye(`item ${e.slice(5)}`):e.startsWith("test-runs-")?ye(`test-runs ${e.slice(10)}`):e.startsWith("templates-")?ye(`templates ${e.slice(10)}`):Fi.has(e)?z_.get(e)??ye(e):null}function Ek(e,t){let n=H(t);return n!==t||ke.some(r=>r.alias===t)?e.action===n:e.command_path===null?!1:gt(e.command_path).some(r=>r===t?!0:r.startsWith(`${t} `)||t.startsWith(`${r} `))}function gt(e){return e.split("|").map(t=>ye(t)).filter(t=>t.length>0)}function Ak(e,t){let n=new Set(t),r=new Set;for(let o of e)if(o.command_path)for(let i of gt(o.command_path)){let s=i.split(" ").filter(a=>a.length>0);if(s.length!==0)for(let a=s.length;a>0;a-=1){let c=s.slice(0,a).join(" ");if(n.has(c)){r.add(c);break}}}return[...r].sort((o,i)=>o.localeCompare(i))}function $i(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Pr(e){let t=e.oneOf;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null):[]}function Tk(e,t){if(!t)return{...e};let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;return typeof s!="object"||s===null?!1:s.const===t});return{...e,oneOf:r}}function uc(e,t){let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;if(typeof s!="object"||s===null)return!1;let a=s.const;return typeof a=="string"&&t.has(a)});return{...e,oneOf:r}}function ye(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function W_(e){return e.replace(/\s+/g,"-")}function rt(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function $_(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let o=rt(r);!o||n.has(o)||(n.add(o),t.push(o))}return t}function pc(e,t,n){n&&(e[t]=!0)}function F_(e,t){if(e==null)return null;if(typeof e!="string")throw new TypeError("Expected string for extension flag name.");let n=e.trim();return n.length===0?null:t==="long"?n.startsWith("--")&&n.length>2?n:null:n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function Ck(e){let t=F_(e.long,"long"),n=F_(e.short,"short"),r=t??n;if(!r)return null;let o={flag:r};n&&t&&(o.short=n),pc(o,"required",e.required===!0),pc(o,"repeatable",e.repeatable===!0),pc(o,"list",e.list===!0);let i=rt(e.description);i&&(o.description=i);let s=rt(e.value_name);s&&(o.value_name=s);let a=[rt(e.value_type),rt(e.type),s?"string":null].find(c=>c==="string"||c==="number"||c==="boolean");return a&&(o.value_type=a),o}function Y_(e){let t=new Map;for(let r of e){let o=ye(r.target_command);if(o.length===0)continue;let i=t.get(o)??{flags:[],sources:[],dedupe:new Set,sourceDedupe:new Set},s=`${r.layer}:${r.name}`;i.sourceDedupe.has(s)||(i.sourceDedupe.add(s),i.sources.push({layer:r.layer,name:r.name}));for(let a of r.flags){let c=Ck(a);if(!c)continue;let m=`${c.flag}|${c.short??""}`;i.dedupe.has(m)||(i.dedupe.add(m),i.flags.push(c))}t.set(o,i)}let n=new Map;for(let[r,o]of t.entries())n.set(r,{flags:o.flags,sources:o.sources.sort((i,s)=>{let a=i.layer.localeCompare(s.layer);return a!==0?a:(i.name??"").localeCompare(s.name??"")})});return n}function Ik(e){let t=Y_(e.flagRegistrations),n=new Map;for(let i of e.commandDefinitions){let s=ye(i.command);if(s.length===0)continue;let a=rt(i.action)??W_(s),c=Array.isArray(i.arguments)?i.arguments.map(m=>{let u=rt(m.name);return u?{name:u,required:m.required===!0,variadic:m.variadic===!0,description:rt(m.description)}:null}).filter(m=>m!==null):[];n.set(s,{...i.tier===void 0?{}:{tier:i.tier},command:s,action:a,source:{layer:i.layer,name:i.name},description:rt(i.description),intent:rt(i.intent),arguments:c,flags:t.get(s)?.flags??[],examples:$_(i.examples),failure_hints:$_(i.failure_hints)})}let r=new Set;for(let i of e.handlers)r.add(ye(i));for(let i of n.keys())r.add(i);for(let i of t.keys())r.add(i);let o=[];for(let i of[...r].sort((s,a)=>s.localeCompare(a))){let s=n.get(i);o.push(Rk(i,s,t.get(i)?.flags??[]))}return o}function Rk(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:W_(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function Ok(e){let t=e.flag.replace(/^-+/,"").trim();if(t.length===0)return null;let r=t.replace(/-([a-z0-9])/g,(o,i)=>i.toUpperCase()).replace(/[^a-zA-Z0-9]/g,"");return r.length>0?r:null}function xk(e,t){return e.variadic?{type:"array",items:{type:"string"},description:e.description??`Variadic argument '${e.name}' for extension action '${t}'.`}:{type:"string",description:e.description??`Argument '${e.name}' for extension action '${t}'.`}}function Pk(e,t){let n=e.value_type??"boolean",r=n==="boolean"?"boolean":n==="number"?["number","string"]:"string",o=e.repeatable===!0||e.list===!0;return{type:o?"array":r,...o?{items:{type:r}}:{},description:e.description??`Extension option '${e.flag}' for action '${t}'.`}}function Nk(e){let t=e.command.split("|").map(o=>o.trim()).filter(o=>o.length>0),n={action:{type:"string",const:e.action,description:e.intent??e.description??`Invoke extension command '${e.command}'.`}},r=["action"];for(let o of e.arguments)n[o.name]=xk(o,e.action),o.required&&r.push(o.name);for(let o of e.flags){let i=Ok(o);!i||n[i]!==void 0||(n[i]=Pk(o,e.action),o.required===!0&&r.push(i))}return{type:"object",properties:n,required:r,additionalProperties:!0,"x-extension-source":e.source,"x-extension-command":t[0]??e.command,"x-extension-commands":t}}function Lk(e,t){e.description??=t.description,e.value_name??=t.value_name,e.value_type??=t.value_type,t.required===!0&&(e.required=!0),t.repeatable===!0&&(e.repeatable=!0)}function $k(e){let t=new Map;for(let n of e){let r=t.get(n.action);if(!r){t.set(n.action,{...n,flags:[...n.flags],examples:[...n.examples],failure_hints:[...n.failure_hints]});continue}r.command=[...new Set([r.command,n.command])].sort((i,s)=>i.localeCompare(s)).join("|"),r.arguments=r.arguments.length>=n.arguments.length?r.arguments:n.arguments;let o=new Set(r.flags.map(i=>`${i.flag}|${i.short??""}`));for(let i of n.flags){let s=`${i.flag}|${i.short??""}`;if(!o.has(s))o.add(s),r.flags.push(i);else{let a=r.flags.find(c=>`${c.flag}|${c.short??""}`===s);a&&Lk(a,i)}}r.examples=[...new Set([...r.examples,...n.examples])],r.failure_hints=[...new Set([...r.failure_hints,...n.failure_hints])]}return[...t.values()].sort((n,r)=>n.action.localeCompare(r.action))}async function Fk(e,t=A){let n={mode:At.extensions.policy.mode,trust_mode:At.extensions.policy.trust_mode,default_sandbox_profile:At.extensions.policy.default_sandbox_profile};if(e.noExtensions)return{handlers:new Set,disabledReason:"extensions_disabled",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};let r=E(process.cwd(),e.path);if(!await G(ue(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let o=await t(r),i=await or({pmRoot:r,settings:o,cwd:process.cwd(),noExtensions:!1}),s=await ir({...i,loaded:i.loaded});return{handlers:new Set(s.commands.handlers.map(c=>ye(c.command))),disabledReason:null,commandDefinitions:s.registrations.commands,flagRegistrations:s.registrations.flags,registrations:s.registrations,policyState:{mode:i.policy.mode,trust_mode:i.policy.trust_mode,default_sandbox_profile:i.policy.default_sandbox_profile}}}catch{return{handlers:new Set,disabledReason:"extension_runtime_probe_failed",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n}}}function Mk(e,t={}){let n=new Map;for(let r of va){let o=Fi.has(r);if(o&&!t.includePackageOwnedActions)continue;let i=L_(r);n.set(r,{action:r,provider:o?"extension":"core",requires_extension:o,command_path:i})}if(t.includePackageOwnedActions)for(let r of Fi)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:L_(r)});for(let r of e)n.has(r.action)||n.set(r.action,{action:r.action,provider:"extension",requires_extension:!0,command_path:ke.find(o=>o.alias===r.command)?.canonical??ye(r.command)});return[...n.values()].sort((r,o)=>(r.action??"").localeCompare(o.action??""))}function Dk(e,t){if(e.provider==="core"&&!e.requires_extension)return{action:e.action,invocable:!0,available:!0,requires_extension:!1,provider:"core",disabled_reason:null,command_path:e.command_path,cli_exposed:e.command_path!==null&&(!tn.has(e.action)||t.handlers.has(e.action))};let n=e.command_path?gt(e.command_path):[],r=n.some(s=>t.handlers.has(s)||t.handlers.has(H(s))),o=n.map(s=>K_.get(H(s))).find(s=>typeof s=="string"),i=t.disabledReason===null&&r;return{action:e.action,invocable:i,available:i,requires_extension:!0,provider:"extension",disabled_reason:i?null:t.disabledReason??(o?`optional_package_not_installed:${o}`:"extension_command_not_registered"),command_path:e.command_path,cli_exposed:r,policy_state:{mode:t.policyState.mode,trust_mode:t.policyState.trust_mode,default_sandbox_profile:t.policyState.default_sandbox_profile}}}function J_(e){return xr.get(e)??uo}function Uk(e){return tn.has(H(e))?!1:xr.has(e)}function Gk(e){return q_.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function M_(e){let t=e.trim();return t?t.startsWith("--")?t:t.startsWith("-")?null:`--${t}`:null}function jk(e){let t=e.trim();return!t||t.startsWith("--")?null:t.startsWith("-")?t:null}function qk(e){let t=new Map;for(let r of e.definitions){let o=M_(r.cli_flag);if(!o)continue;let i=r.cli_aliases.map(a=>jk(a)).find(a=>a!==null),s=r.cli_aliases.map(a=>M_(a)).filter(a=>a!==null&&a!==o);for(let a of r.commands){let c=t.get(a)??{flags:[],seen:new Set},m=i?{flag:o,short:i}:{flag:o},u=`${m.flag}|${m.short??""}`;c.seen.has(u)||(c.seen.add(u),c.flags.push(m));for(let p of s){let f=`${p}|`;c.seen.has(f)||(c.seen.add(f),c.flags.push({flag:p}))}t.set(a,c)}}let n=new Map;for(let[r,o]of t.entries())n.set(r,_a(o.flags));return n}function D_(e,t){let n=[],r=new Set;for(let o of[...e,...t]){let i=`${o.flag}|${o.short??""}`;r.has(i)||(r.add(i),n.push(o))}return _a(n)}function Kk(e,t,n,r,o){let i=new Map(t);for(let{alias:s,canonical:a}of ke){let c=t.get(a)??t.get(s);c&&(i.set(s,c),i.set(a,c))}return e.map(s=>{let a=Uk(s),c=a?J_(s):[],m=n.get(Gk(s))??[],u=i.get(s),p=D_(c,m),f=D_(p,u?.flags??[]),_=c.length>0&&(u?.flags.length??0)>0?"mixed":a?"core":"extension";return{command:s,flags:f,...r?{canonical_command:Q_(s),visibility:X_(s,o),positionals:rm(s)?.slots??[],flag_invocations:ur(s,f)}:{},provider:_,extension_sources:u?.sources}}).sort((s,a)=>s.command.localeCompare(a.command))}function zk(e,t=sr){let n=new Set(e),r=new Map;for(let o of H_){let i=o.aliases.filter(s=>n.has(s));r.set(o.canonical,{canonical:o.canonical,aliases:i,contracts:[]})}for(let o of t){if(!n.has(o.canonical)||o.registration==="commander"&&!n.has(o.alias))continue;let i=r.get(o.canonical)??{canonical:o.canonical,aliases:[],contracts:[]};i.aliases.includes(o.alias)||i.aliases.push(o.alias),i.contracts.push(o),r.set(o.canonical,i)}return[...r.values()].map(({contracts:o,...i})=>o.length===0?i:{...i,contracts:o}).sort((o,i)=>o.canonical.localeCompare(i.canonical))}function Bk(){return{create_string_options:Hu,create_repeatable_options:Jo,update_string_options:Vu,update_repeatable_options:Wu,list_string_options:Qd,search_string_options:Zd,calendar_string_options:em,context_string_options:tm,activity_string_options:nm}}function U_(e,t){let n=new Set(["title","type"]);if(t==="strict"){for(let a of e.required_create_fields)n.add(a);for(let a of e.required_create_repeatables)n.add(a)}let r=Sn(e,"create",n),o=[...new Set(r.required)].sort((a,c)=>a.localeCompare(c)),i=[...new Set(o.map(a=>Se("create",a)))].sort((a,c)=>a.localeCompare(c)),s=[...new Set(e.options.filter(a=>a.required===!0).map(a=>a.key))].sort((a,c)=>a.localeCompare(c));return{required_option_keys:o,required_flags:i,required_type_options:s,policy_errors:[...new Set(r.errors)].sort((a,c)=>a.localeCompare(c))}}function Hk(e){let t={},n={};for(let r of[...e.types].sort((o,i)=>o.localeCompare(i))){let o=e.by_type[r];t[r]=U_(o,"strict"),n[r]=U_(o,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function Vk(e,t){let n=Pr(e);if(n.length===0)return e;let r=!1,o=n.map(i=>{let s=i.properties;if(typeof s!="object"||s===null)return i;let a=s.action;return typeof a!="object"||a===null||a.const!=="create"?i:(r=!0,{...i,"x-create-required-options":t})});return r?{...e,oneOf:o}:e}function Wk(e){let t=$i(e.action)!==void 0||$i(e.command)!==void 0,n=e.schemaOnly===!0||e.flagsOnly===!0||e.availabilityOnly===!0,r=e.summary===!0||e.full!==!0&&e.runtimeOnly!==!0&&!t&&!n,o=e.schemaOnly===!0,i=e.flagsOnly===!0,s=e.availabilityOnly===!0,a=e.runtimeOnly===!0,c=e.full===!0,m=$i(e.action),u=$i(e.command),p=!r&&!c&&!o&&!i&&!s&&!m&&!u;return{selectedAction:m,selectedCommand:u,summary:r,schemaOnly:o,flagsOnly:i,availabilityOnly:s,runtimeOnly:a,fullOutput:c,omitUnfilteredSchema:p,omitUnfilteredCommandFlags:p,omitUnfilteredCommanderAliases:p||u!==void 0&&!c}}function Yk(e){if([e.summary,e.schemaOnly,e.flagsOnly,e.availabilityOnly].filter(n=>n).length>1)throw new l("Choose only one projection flag: --summary, --schema-only, --flags-only, or --availability-only.",d.USAGE)}async function Jk(e,t=A){try{return await t(e)}catch{return structuredClone(At)}}async function Xk(e,t,n){let r=await Jk(t),o=await Fk(e),i=x(r,o.registrations??O()),s=Ze(r.schema),a=Ik(o);return{settings:r,runtimeProbe:o,typeRegistry:i,statusRegistry:F(r.schema),runtimeFieldRegistry:s,runtimeFieldFlagMap:qk(s),createRequiredOptionContracts:Hk(i),extensionContracts:a,mergedExtensionContracts:$k(a.filter(c=>Mi(n,c.command,a))),extensionFlagMap:Y_(o.flagRegistrations)}}function G_(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&Fi.has(e.selectedAction)||e.selectedCommand!==void 0&&tn.has(H(e.selectedCommand)))}function Qk(e,t){let n=Mk(t,{includePackageOwnedActions:G_(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set(Ou);return n.filter(o=>!r.has(o.action)&&(e.fullOutput||(t.find(i=>i.action===o.action)?.tier??Xo(o.action))!=="internal"))}return G_(e)&&e.selectedCommand!==void 0&&tn.has(H(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:Sk(H(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function Zk(e,t){let n=new Set(t.map(r=>r.action));if(e.selectedAction&&!n.has(e.selectedAction))throw new l(`Unknown action: "${e.selectedAction}".`,d.USAGE)}function eS(e,t){return[...new Set([...ya.filter(n=>!tn.has(H(n))),...[...xr.keys()].filter(n=>!tn.has(H(n))),...e.flatMap(n=>n.command_path?gt(n.command_path).filter(r=>n.provider==="extension"||!tn.has(H(r))||t.some(o=>o.action===n.action)):[]),...t.flatMap(n=>n.command.split("|").flatMap(r=>{let o=ke.find(i=>i.alias===r||i.canonical===r);return o===void 0?[r]:[o.alias,o.canonical]}))])].map(n=>ye(n)).filter(n=>n.length>0).sort((n,r)=>n.localeCompare(r))}function tS(e,t){let n=t.slice(0,vk),r=t.length-n.length,o=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),i=t.slice(0,wk),s=t.slice(0,5).map(c=>`pm contracts --command "${c}" --flags-only --json`),a=t[0];return new l(`Command "${e}" is a command namespace. Choose a concrete child command: ${o}.`,d.USAGE,{code:"command_namespace",required:"Use a concrete child command path listed under this namespace.",why:"Command groups expose help at the namespace root, but command flag contracts belong to executable child commands.",examples:s,nextSteps:[`Retry with a child command, for example: ${s[0]}`],recovery:{suggested_retry:`pm contracts --command "${a}" --flags-only --json`,fallback_candidates:i.map(c=>({source:"command_namespace",command:`pm contracts --command "${c}" --flags-only --json`,reason:`Child command under ${e}`}))}})}function nS(e,t){return new l(`Unknown command: "${e}". Command "${e}" is provided by the optional "${t}" package. Run "pm install ${t} --project" and retry.`,d.USAGE,{code:"unknown_command",required:`Install the optional "${t}" package, or choose a command from pm contracts --flags-only --json.`,why:"Command contracts include core commands plus commands registered by active packages and extensions.",examples:[`pm install ${t} --project`,`pm contracts --command ${e} --flags-only --json`],nextSteps:[`Install the optional package first: pm install ${t} --project`],recovery:{suggested_retry:`pm install ${t} --project`}})}function rS(e){return new l(`Unknown command: "${e}".`,d.USAGE,{code:"unknown_command",required:"Use a command path listed by pm contracts --flags-only --json.",why:"Command contracts are generated from the active core, package, and extension command registry.",examples:["pm contracts --flags-only --json","pm --help"],nextSteps:["Verify spelling and active packages/extensions, then rerun with a known command path."],recovery:{suggested_retry:"pm contracts --flags-only --json"}})}function oS(e,t){if(!e.selectedCommand||new Set(t).has(e.selectedCommand))return;let r=t.filter(i=>i.startsWith(`${e.selectedCommand} `));if(r.length>0)throw tS(e.selectedCommand,r);let o=K_.get(H(e.selectedCommand));throw o?nS(e.selectedCommand,o):rS(e.selectedCommand)}function iS(e,t){let n=Qk(e,t.mergedExtensionContracts);Zk(e,n);let r=eS(n,t.mergedExtensionContracts);oS(e,r);let o=e.selectedCommand?B_.get(H(e.selectedCommand)):void 0,i=e.selectedCommand?n.filter(m=>o?m.action===o:Ek(m,e.selectedCommand)):n;if(e.selectedCommand&&e.selectedAction&&!i.some(m=>m.action===e.selectedAction))throw new l(`Action "${e.selectedAction}" is not mapped to command "${e.selectedCommand}" in contracts output.`,d.USAGE);let s=e.selectedAction?i.filter(m=>m.action===e.selectedAction):i,a=[...new Map(s.map(m=>Dk(m,t.runtimeProbe)).map(m=>[o?m.action:`${m.action}|${m.command_path??""}`,m])).values()],c=e.runtimeOnly&&!e.selectedAction&&!e.availabilityOnly?a.filter(m=>m.invocable):a;return{actionDescriptors:n,commandCatalog:r,commandScopedDescriptors:i,scopedActionDescriptors:s,selectedPackageOwnedAction:o,actionAvailability:c,actions:[...new Set(c.map(m=>m.action))]}}function sS(e){return new Set(Pr(e).map(t=>{let n=t.properties;if(typeof n!="object"||n===null)return null;let r=n.action;if(typeof r!="object"||r===null)return null;let o=r.const;return typeof o=="string"?o:null}).filter(t=>t!==null))}function aS(e){let t=Ku,n=Pr(t),r=sS(t),o=e.filter(i=>!r.has(i.action)).map(i=>Nk(i));return o.length>0?{...t,oneOf:[...n,...o]}:t}function j_(e,t,n){let r=new Set(t.actionDescriptors.map(i=>i.action)),o=e.selectedAction?Tk(n,e.selectedAction):e.selectedCommand?uc(n,new Set(t.scopedActionDescriptors.map(i=>i.action))):uc(n,r);return e.runtimeOnly&&!e.selectedAction?uc(o,new Set(t.actions)):o}function cS(e,t,n){let r=aS(t.mergedExtensionContracts),i=!e.flagsOnly&&!e.availabilityOnly?Vk(j_(e,n,r),t.createRequiredOptionContracts):j_(e,n,r);return{mergedSchema:r,filteredSchema:i}}function lS(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?Ak(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function X_(e,t){return t.find(n=>H(n.command)===H(e))?.tier??Xo(e)}function Mi(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||X_(t,n)!=="internal"}function dS(e,t,n){if(e.selectedCommand!==void 0||e.selectedAction!==void 0)return t;let r=new Set(sr.filter(o=>o.hidden&&(o.lifecycle==="deprecated"||!e.fullOutput&&!e.availabilityOnly)).map(o=>o.alias));if(e.summary&&!e.fullOutput)for(let o of fc.keys())r.add(o);return t.filter(o=>!r.has(o)&&Mi(e,o,n))}function Q_(e){let t=ke.find(r=>r.alias===e||r.canonical===e);if(t)return t.canonical;let n=e.split(" ")[0];return n.startsWith("list-")?"list":fc.get(n)??n}var mS=new Map([["activate","Activate"],["adopt","Adopt"],["adopt-all","Adopt all"],["catalog","Catalog"],["complete","Complete"],["create","Create"],["deactivate","Deactivate"],["delete","Delete"],["describe","Describe"],["doctor","Diagnose"],["explore","Explore"],["init","Initialize"],["inspect","Inspect"],["install","Install"],["list","List"],["manage","Manage"],["migrate","Migrate"],["mutate","Mutate"],["reload","Reload"],["restore","Restore"],["run","Run"],["snapshot","Manage snapshots for"],["uninstall","Uninstall"],["upgrade","Upgrade"]]),uS=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function pS(e,t){let n=N_.get(H(e))??(e.includes(" ")?void 0:N_.get(Q_(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(m=>gt(m.command).some(u=>H(u)===H(e)));if(r?.intent!==null&&r?.intent!==void 0)return{intent:r.intent,intent_source:"command"};if(r?.description!==null&&r?.description!==void 0)return{intent:r.description,intent_source:"description"};let o=e.split(" "),i=o.at(-1),s=o.slice(0,-1).join(" "),a=mS.get(i),c=uS.get(e)??s;return{intent:a===void 0||s.length===0?`Run ${e}.`:`${a} ${c}.`,intent_source:"generated"}}function fS(e,t=[],n={}){let r=n.includeFormatBudgets??!0,o=n.includeIntentProvenance??!0;return[...new Set(e.map(ye))].filter(i=>i.length>0).sort((i,s)=>i.localeCompare(s)).map(i=>{let s=Ia(i,{generateFallback:!0}),a=i.split(" ")[0],c=fc.get(a)??(a.startsWith("list-")?"list":a.startsWith("history-")?"history":a),m=new Set([...J_(i).map(f=>f.flag),...t.filter(f=>gt(f.command).some(_=>H(_)===H(i))).flatMap(f=>f.flags.map(_=>_.flag))]),u=(P_.get(H(i))??P_.get(c)??yk).filter(f=>m.has(f)),p=pS(i,t);return{command:i,intent:p.intent,...o||p.intent_source!=="command"?{intent_source:p.intent_source}:{},...u.length>0?{flags:u}:{},default_max_estimated_tokens:s.default_max_estimated_tokens,...r?{default_max_estimated_tokens_by_format:{...s.default_max_estimated_tokens_by_format}}:{}}})}function _S(e){return e.map(t=>({budget:Ia(t,{generateFallback:!0}),envelope:ep(t)}))}function hS(e){let t=new Map;for(let n of e){let r=Ju(n),o=r===void 0?[d.SUCCESS,d.GENERIC_FAILURE,d.USAGE,d.NOT_FOUND,d.CONFLICT,d.DEPENDENCY_FAILED]:r.exit_codes,i=o.join(","),s=t.get(i)??{commands:[],exit_codes:o};s.commands.push(n),t.set(i,s)}return[...t.values()]}function gS(e,t,n){if(e.selectedCommand)return t.extensionContracts.filter(r=>gt(r.command).some(o=>H(o)===H(e.selectedCommand)));if(e.selectedAction){let r=new Set(n);return t.extensionContracts.filter(o=>gt(o.command).some(i=>r.has(i)))}return t.extensionContracts.filter(r=>Mi(e,r.command,t.extensionContracts))}function yS(e,t,n,r){return{schema_version:typeof t.mergedSchema["x-schema-version"]=="string"?t.mergedSchema["x-schema-version"]:null,schema_id:typeof t.mergedSchema.$id=="string"?t.mergedSchema.$id:null,selected:{action:e.selectedAction??null,command:e.selectedCommand??null,summary:e.summary,schema_only:e.schemaOnly,flags_only:e.flagsOnly,availability_only:e.availabilityOnly,runtime_only:e.runtimeOnly,command_scoped:e.selectedCommand!==void 0},commands:e.summary?[]:r,...!e.summary&&!e.flagsOnly?{actions:n.actions,action_availability:n.actionAvailability}:{}}}function vS(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=tp);let r=n.selectedCommand;e.runtime_schema={statuses:t.statusRegistry.definitions.map(o=>o.id),open_status:t.statusRegistry.open_status,close_status:t.statusRegistry.close_status,canceled_status:t.statusRegistry.canceled_status,types:[...t.typeRegistry.types],fields_by_command:Object.fromEntries([...t.runtimeFieldRegistry.command_to_fields.entries()].filter(([o])=>r===void 0||o===r).map(([o,i])=>[o,[...new Set(i.map(s=>`--${s.cli_flag}`))].sort((s,a)=>s.localeCompare(a))]))},!(r!==void 0&&!n.fullOutput)&&(e.extension_contracts={capabilities:[...bu],services:[...ku],policy_modes:[...Su],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...Tu],trust_modes:[...Eu],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...Au],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...xd],create_modes:[...Pd],close_validation_modes:[...Nd],workflow_enforcement_modes:[...Ld]},e.relationship_kind_contracts=[...Dd,...(t.runtimeProbe.registrations?.relationship_kinds??[]).flatMap(o=>o.definitions)].sort((o,i)=>o.kind.localeCompare(i.kind)).map(o=>({canonical:o.kind,aliases:[...o.aliases??[]],...o.inverse===void 0?{}:{inverse:o.inverse},ordering:o.ordering,hierarchy:o.hierarchy})))}function wS(e,t,n,r){if(!(t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredSchema){e.schema=n.filteredSchema,e.extension_commands=r;return}e.schema_omitted_reason="unfiltered_default_brief",e.extension_commands=r}}function bS(e,t,n,r,o){if(!(t.schemaOnly||t.availabilityOnly)){if(t.omitUnfilteredCommandFlags)e.command_flags_omitted_reason="unfiltered_default_brief";else{e.command_flags=Kk(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let i=new Set(r);e.list_projections=Object.entries(op).filter(([s])=>i.has(s)).map(([s,a])=>({command:s,default:a,brief_fields:[...rp],compact_fields:[...np]}))}e.command_aliases=t.fullOutput?o:o.map(({canonical:i,aliases:s})=>({canonical:i,aliases:s})),t.fullOutput||(e.command_alias_contracts_omitted_reason="compact_projection; restore with --full")}}function kS(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=Bk();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function SS(e,t,n,r){e.command_summaries=fS(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...Nu],allows_unbounded_opt_out:!0},e.output_projection_contracts={global_ladder_field:"output_policy.degradation_ladder",global_ladder_scope:"union_not_per_command",discovery:"pm contracts --command <command> --summary",...r.includeProjectionModeMatrix?{commands:[...new Set(t.map(ye))].filter(o=>Oa(o)!==void 0).sort((o,i)=>o.localeCompare(i)).map(o=>({command:o,modes:[...$u(o).keys()]}))}:{}},e.grammar_contracts={nouns:Jt.nouns,shared_verbs:Jt.shared_verbs,scope_before_verb:Jt.scope_before_verb,visible_top_level_ceiling:Jt.visible_top_level_ceiling,ceiling_raise_requires_pm_item:Jt.ceiling_raise_requires_pm_item,positional_shape_budget:Jt.positional_shape_budget,positional_shape_count:new Set(fa.map(({slots:o})=>om(o))).size,positional_action_count:pa.length,positional_action_parents:[...new Set(pa.map(({parent:o})=>o))].sort((o,i)=>o.localeCompare(i)),...r.includePositionalSignatures?{positional_signatures:fa}:{}}}async function _c(e,t){let n=Wk(e);Yk(n);let r=E(process.cwd(),t.path),o=await Xk(t,r,n),i=iS(n,o),s=cS(n,o,i),a=lS(n,i),c=dS(n,a,o.extensionContracts),m=yS(n,s,i,c),u=gS(n,o,c),p=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&SS(m,c,u,{includeFormatBudgets:p,includeIntentProvenance:p,includePositionalSignatures:p,includeProjectionModeMatrix:p}),n.summary)return m;let f=zk(i.commandCatalog.filter(_=>Mi(n,_,o.extensionContracts)));return n.flagsOnly&&!n.fullOutput||vS(m,o,n),wS(m,n,s,u),bS(m,n,o,c,f),kS(m,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(m.assurance_contracts={measurement_source_kinds:[...Zp],gate_triggers:[...Qp]}),n.fullOutput&&m.grammar_contracts&&(m.grammar_contracts.destinations=mo.map(_=>({..._,reason:_.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(m.mcp_tools=x_(),m.context_intents=Du(),m.read_output_dimensions=Ra,m.error_codes=Xu,m.command_output_contracts=_S(c),m.diagnostic_output_contracts=Lu,m.command_exit_contracts={vocabulary:Yu,command_sets:hS(c)}),m}import{readFile as ES}from"node:fs/promises";import AS 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]="c64f304d-9081-5bad-8187-7bf6b65e4a07")}catch{}})();var hc="context-intents.json";function Di(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function TS(e,t,n){if(!Di(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let r=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(r)||!r.every(o=>typeof o=="string")||typeof e.token_budget!="number")throw new TypeError(`${t} context intent at index ${String(n)} has an invalid contract shape`);return{command:e.command,intent:e.intent,description:e.description,included_field_groups:r,token_budget:e.token_budget}}function Z_(e,t){let n=Array.isArray(e)?e:Di(e)&&Array.isArray(e.intents)?e.intents:void 0;if(!n)throw new TypeError(`${t} context intents must be an array or an object with an intents array`);return n.map((r,o)=>TS(r,t,o))}async function CS(e){let t=AS.join(e,hc),n;try{n=await ES(t,"utf8")}catch(o){if(Wt(o))return[];throw await Up(e),o}let r;try{r=JSON.parse(n)}catch(o){let i=o instanceof Error?o.message:String(o);throw new TypeError(`Invalid ${hc}: ${i}`,{cause:o})}return Z_(r,hc)}function IS(e){if(!Di(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return Di(n)?n.contextIntents??n.context_intents:void 0}function RS(e){return e.flatMap(t=>{let n=IS(t.module);return n===void 0?[]:Z_(n,`package ${t.name}`)})}async function OS(e){let t=await CS(e.pmRoot),n=RS(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function gc(e,t){let n=await OS(e);return await Uu(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c2766f4e-6354-55bb-9e40-676273ee901f")}catch{}})();async function eh(e,t,n=Mu){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let r=t,o=Array.isArray(r.warnings)?r.warnings.filter(i=>typeof i=="string"):[];r.warnings=[...new Set([...o,"context_usage_feedback_write_failed"])].sort()}}}(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]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var yc="PmCliError";function xS(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=d.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function th(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new l(e,xS(t.exitCode??d.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function Ui(e){if(!(e instanceof Error)||e.name!==yc)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}(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]="3113ad4b-282a-50af-a836-8e9abfde7d7e")}catch{}})();function vc(e){let t=Ud();for(let n of e)t.register(n);return t}function nh(e,t){return{client:t,isItemNotFoundError:n=>Ui(n)&&n.exitCode===d.NOT_FOUND,getItemAt:(n,r)=>ef(n,r,{pmRoot:e}),openRelationshipEventStore:n=>nf.open({pmRoot:e,nodes:n.nodes,registry:vc(n.definitions),...n.relativePath===void 0?{}:{relativePath:n.relativePath}}),createRelationshipGraph:n=>new jd(n.nodes,n.edges,vc(n.definitions)),analyzeRelationshipImpact:(n,r,o)=>rf(n,r,o),validateRelationshipEvents:n=>{let r=new tf(n.nodes,{registry:vc(n.definitions)});return n.events.map(o=>r.append({...o,expectedVersion:r.version}))},commitWorkspaceTransaction:n=>of({...n,pmRoot:e})}}import PS from"node:fs/promises";import X from"node:path";import NS from"node:readline/promises";import{stdin as LS,stdout as Me}from"node: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]="231597cc-2166-5029-9b3a-476587a33941")}catch{}})();var bc=Symbol.for("pm.sdk.init-invocation-cwd");var $S=()=>NS.createInterface({input:LS,output:Me});function FS(){return structuredClone(At)}var MS=["minimal","default","strict"];function oh(e){if(e===void 0)return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new l("--preset must not be empty",d.USAGE);if(t==="minimal"||t==="default"||t==="strict")return t;if(t==="lite"||t==="minimum")return"minimal";throw new l(`Invalid --preset value "${e}". Allowed: ${MS.join(", ")}`,d.USAGE)}function DS(e){if(e!==void 0){if(e.trim().length===0)throw new l("--type-preset must not be empty",d.USAGE);try{return cu(e)}catch{throw new l(`Invalid --type-preset value "${e}". Allowed: ${au.join(", ")}`,d.USAGE)}}}function US(e){if(e===void 0)return;let t=e.trim();if(t.length===0)throw new l("--author must not be empty",d.USAGE);return t}function wc(e){if(e===void 0)return!1;let t=e.trim();return t.length===0?!1:X.isAbsolute(t)||/^[a-z]:/iu.test(t)||t.startsWith(".")||t.includes("/")||t.includes("\\")}function GS(e,t,n,r){let o=r?.trim();if(r!==void 0&&o?.length===0)throw new l("--workspace must not be empty",d.USAGE);if(o!==void 0){if(t.path!==void 0||wc(n))throw new l("--workspace cannot be combined with --pm-path/--path or a path-like positional target.",d.USAGE);let m=X.resolve(e,o),u=X.join(m,".agents","pm");return{pmRoot:u,prefixArg:n,target:{mode:"workspace-path",tracker_root:u,workspace_root:m}}}if(t.path===void 0&&wc(n)){let m=X.resolve(e,n.trim());return{pmRoot:m,prefixArg:void 0,target:{mode:"tracker-path",tracker_root:m}}}let i=E(e,t.path),s=X.join(X.resolve(e),".agents","pm"),a=X.dirname(X.dirname(i)),c=X.resolve(i)===s?"current":"ancestor";return{pmRoot:i,prefixArg:n,target:t.path===void 0?{mode:"workspace-discovery",tracker_root:i,workspace_root:a,discovery:c,requested_cwd:X.resolve(e),...c==="ancestor"?{suggested_current_tracker_root:s}:{}}:{mode:"tracker-path",tracker_root:i}}}function jS(e,t){if(t===void 0)return e;if(t.trim().length===0)throw new l("--id-prefix must not be empty",d.USAGE);if(wc(t))throw new l(`--id-prefix accepts an item ID prefix, not a tracker path: "${t}".`,d.USAGE,{code:"init_id_prefix_path_like",required:"Pass the tracker path positionally or with the global --path option.",examples:[`pm init ${t}`,`pm --path ${t} init`]});if(e!==void 0&&$t(e)!==$t(t))throw new l(`Conflicting id prefixes: positional "${e}" and --id-prefix "${t}".`,d.USAGE,{code:"init_id_prefix_conflict",required:"Use either the positional id prefix or --id-prefix with one value.",examples:[`pm init ${$t(e)}`,`pm init --id-prefix ${$t(t)}`]});return t}function qS(e){if(e===void 0)return"ask";let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new l("--agent-guidance must not be empty",d.USAGE);if(t==="ask"||t==="add"||t==="skip"||t==="status")return t;throw new l(`Invalid --agent-guidance value "${e}". Allowed: ${Cf.join(", ")}`,d.USAGE)}function KS(e,t){let n=e.trim().toLowerCase();return n.length===0?t:n==="y"||n==="yes"?!0:n==="n"||n==="no"?!1:t}function ih(e,t){let n=Md[t];e.governance={preset:t,...n},e.validation.parent_reference=n.parent_reference,e.validation.metadata_profile=n.metadata_profile}function zS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function BS(e){let t=e.details;return{installed_all:t.installed_all===!0,installed_count:typeof t.installed_count=="number"?t.installed_count:0,packages:Array.isArray(t.packages)?t.packages.filter(zS).map(n=>({alias:typeof n.alias=="string"?n.alias:"",ok:n.ok===!0})):[]}}async function HS(e,t,n){let r=jo(t.schema),o=ut(e,r.files.types,mt.types),s=iu(await Z(o)),a=[],c=[];for(let m of lu(n)){let u=su(s,m);s=u.file,(u.replaced?c:a).push(u.definition.name)}return await nt({pmRoot:e,filePath:o,raw:Uo(s),op:"init:type-preset",author:C(void 0,t.author_default),lockTtlSeconds:t.locks.ttl_seconds,lockWaitMs:t.locks.wait_ms}),{name:n,registered:a,updated:c,file:o}}async function VS(e){let t=[".git","package.json","pnpm-workspace.yaml","AGENTS.md",X.join(".agents","pm")];for(let n of t)if(await G(X.join(e,n)))return!0;return!1}async function WS(e,t,n){if(!t||n||await G(X.join(e,"settings.json"))||!await VS(e))return;let r=X.join(e,".agents","pm");throw new l(`Refusing to initialize tracker files directly in workspace root "${e}".`,d.USAGE,{code:"workspace_root_pm_path",type:"urn:pm-cli:error:workspace_root_pm_path",why:"Path-like init targets and --pm-path/--path point at the tracker storage directory itself, not the repository workspace. Point at .agents/pm, use --workspace, or pass --force if you intentionally want root-level tracker files.",examples:[`pm --pm-path ${r} init --yes`,"pm init --yes",`pm --pm-path ${e} init --yes --force`],nextSteps:["Use --pm-path <repo>/.agents/pm for repository-local tracker storage.","Use PM_PATH only for sandboxed tests or explicit tracker roots.","Pass --force only when root-level tracker files are intentional."],recovery:{next_best_command:`pm --pm-path ${r} init --yes`}})}async function sh(e,t){let n=[],r=[];for(let o of t){let i=o?X.join(e,o):e,s=await G(i);await PS.mkdir(i,{recursive:!0}),s?r.push(`already_exists:${i}`):n.push(i),r.push(...await J({path:i,scope:"project",op:"init:ensure_dir"}))}return{createdDirs:n,warnings:r}}async function YS(e,t){let n=$S();try{Me.write(`pm init setup wizard (agent-optimized)
1
+ import{n as du,o as Go,p as _u,q as hu,r as ha,s as Ko,t as gu,u as ga,v as zo,y as zu,z as Bu}from"./focused-chunks/chunk-OJKJFDIG.js";import{a as Yu,f as Ju,h as Qt,m as Xu,o as ur,r as Xo,s as Qu,t as Zu,x as ep}from"./focused-chunks/chunk-KMPKKSA6.js";import{$ as Mn,$a as Vf,A as Er,Ab as s_,B as sf,Bb as a_,C as bi,Cb as c_,D as af,Db as l_,E as cf,Eb as Cr,Fa as Mf,Fb as ec,Gb as tc,Ha as Uf,Hb as Oi,Ia as Ti,Ib as nc,J as lf,Ja as sk,Jb as d_,K as df,Ka as Gf,Kb as rc,L as mf,La as jf,Lb as xi,M as uf,Ma as Za,Mb as Gn,N as pf,Nb as oc,O as ff,Ob as ic,P as _f,Pb as m_,Q as hf,Qb as u_,R as gf,Rb as p_,S as yf,Sb as jn,T as vf,Tb as sc,U as wf,Ub as f_,V as bf,W as kf,X as Sf,Xa as Kf,Xb as Pi,Y as Ef,Ya as zf,Z as Af,Za as Bf,_ as Tf,_a as Hf,aa as Cf,ab as Wf,ba as If,bb as Yf,ca as Ut,cb as en,cc as __,da as w,db as Jf,dc as h_,ea as Rf,eb as Xf,ec as g_,fa as Of,fb as Ci,g as Qp,ga as Fe,gb as Qf,h as Zp,ha as xf,hb as Zf,ia as Wa,ib as e_,ic as y_,ja as Pf,jb as t_,jc as I_,ka as Ya,kb as n_,la as Ar,lb as Ii,ma as ki,mb as Gt,na as Dn,nb as r_,oa as Nf,ob as Ri,pa as Ja,qa as he,ra as Xa,rb as Tr,sa as ge,ta as Lf,ua as $f,va as Si,wa as Ff,xa as Ei,y as of,yb as o_,z as Ba,zb as i_}from"./focused-chunks/chunk-6J2YCGSN.js";import{e as au,g as cu,h as lu,k as mu,q as fu}from"./focused-chunks/chunk-NETVXIH5.js";import{b as Hu,c as Jo,e as Vu,f as Wu,g as Kb}from"./focused-chunks/chunk-DQ3MB7BO.js";import{R as Pa,V as Ku,a as Qd,b as Zd,c as em,d as tm,f as nm}from"./focused-chunks/chunk-E7LYK7V5.js";import{a as tf,b as nf,c as Ni}from"./focused-chunks/chunk-SMADBUPL.js";import{K as qf,b as rf}from"./focused-chunks/chunk-6UNKK3UH.js";import{Ba as mc,Da as A_,Sa as Or,Ua as T_,Va as C_,c as Ha,e as Va,g as Qa,h as Ir,i as ak,j as ac,k as cc,l as Li,m as ck,n as lk,pa as lc,s as v_,t as w_,u as b_,ua as Rr,v as k_,w as S_,wa as dc,x as E_}from"./focused-chunks/chunk-NZAG7OKB.js";import{$a as wr,A as pe,B as Pn,C as di,D as mi,G as ui,H as pi,I as Lp,Ia as Fn,J as fi,Ja as Bp,K as _i,Ka as za,L as Nn,La as Hp,M as qa,N as hi,O as $p,Oa as Vp,P as Fp,Pa as Wp,Q as yr,Xa as yi,_a as Jp,a as Rp,b as ti,c as ni,cb as Xp,d as ri,e as oi,i as ii,j as Nt,k as On,kb as ht,l as si,m as xn,mb as Sr,n as ai,nb as Zt,o as le,p as ci,pb as ef,q as Ga,qb as Ai,r as He,s as ja,sa as zp,t as Op,u as Ce,vb as Un,w as ft,x as xp,y as li,z as Lt}from"./focused-chunks/chunk-GZD4ZYIB.js";import{c as ou,f as iu,g as su,i as Uo,j as Ot,k as yu,l as vu,m as wu}from"./focused-chunks/chunk-QO4MTAEA.js";import{a as np,b as rp,c as op}from"./focused-chunks/chunk-MILJCOFJ.js";import{$ as Om,A as _o,Aa as Jm,B as dm,Ba as Xm,C as mm,Ca as Ao,D as um,Da as Qm,E as ho,Ea as Zm,F as pm,Fa as eu,G as fm,Ga as To,H as _m,Ha as Co,I as hm,Ia as Io,J as go,Ja as Ro,K as yo,Ka as lr,L as gm,La as tu,M as vo,Ma as Oo,Na as dr,O as ym,Oa as xo,P as ar,Pa as Po,Q as vm,Qa as No,R as wm,Ra as Lo,S as bm,Sa as nu,T as km,Ta as It,U as Sm,Ua as $o,V as Em,Va as Fo,W as Am,Wa as Mo,X as Tm,Xa as Do,Y as Cm,Z as Im,_ as Rm,_a as ru,aa as xm,ab as Rt,ba as Pm,bb as N,ca as Nm,d as pa,da as cr,e as rm,ea as Lm,fa as $m,ga as wo,h as mo,ha as bo,i as fa,ia as Fm,j as Jt,ja as Mm,ka as Dm,l as om,la as Um,ma as Gm,na as jm,oa as qm,pa as Km,q as _a,ra as zm,s as uo,sa as Bm,t as po,ta as Hm,u as fo,ua as Vm,v as im,va as Wm,w as sm,wa as Ym,x as am,xa as ko,y as cm,ya as So,z as lm,za as Eo}from"./focused-chunks/chunk-OJRX6G22.js";import{$ as _p,$a as Ln,A as ik,Ab as fe,B as Rn,Bb as jp,C,Cb as gi,Db as _t,Eb as qp,Fb as ie,G as pt,Ga as Ep,Gb as Kp,Ia as Ua,K as ap,Kb as Yp,L as ei,La as Ap,M as cp,Ma as Tp,N as lp,Na as nt,O as dp,P as mp,Q as up,Qa as Cp,Qb as br,Ra as Ip,Rb as kr,S as ee,Sa as A,Sb as vi,T as Na,Ta as $e,Tb as Dt,U as te,Ua as Te,Va as Pp,W as La,Wa as Np,X as pp,Xa as $t,Y as Be,Yb as wi,Z as et,Za as qe,_ as fp,_a as gr,a as zb,ab as Mp,b as Bb,ba as hp,bb as $n,c as Hb,ca as gp,cb as Ka,d as Vb,da as $a,db as Dp,ga as Fa,ia as yp,j as Qo,ja as vp,jb as vr,k as ip,ka as wp,l as sp,la as bp,m as In,ma as kp,n as pr,nc as Df,o as Wb,p as Yb,q as Jb,qa as Le,qb as Ft,r as Xb,ra as Pt,s as Qb,sb as Mt,t as Zb,ta as Ma,u as ek,ua as fr,ub as Up,v as tk,va as _r,vb as I,w as nk,wa as Da,wb as q,x as Zo,xa as tt,xb as oe,y as rk,ya as Sp,yb as Gp,z as ok,za as hr}from"./focused-chunks/chunk-NWRVNHAD.js";import{b as Tt,c as io,d as so,g as mt,i as jo,j as ut,k as xt,l as uu,n as F,o as qo,p as Ze,r as pu}from"./focused-chunks/chunk-LBDWUHQD.js";import{e as tp}from"./focused-chunks/chunk-HFAW3FJQ.js";import{$ as d,$a as ue,$b as ku,Ab as ir,Ac as Pu,Ad as Ob,B as xd,Bd as xb,C as Pd,Cc as ba,D as Nd,Dc as ka,Dd as Pb,De as Ub,E as Ld,Ec as Sa,Ee as Gb,F as $d,Fb as ke,Fc as Ea,Fd as Nb,Fe as jb,G as Fd,Ga as kn,Gc as Aa,Gd as Lb,Ge as qb,H as ra,Hb as H,Hc as Ta,Hd as Ra,He as Yo,I as oa,Ia as qd,Ic as Ca,Id as Oa,Ie as qu,J as ia,Jb as sr,Jc as O,Jd as xa,K as sa,Ka as da,Kc as An,Kd as $u,L as aa,Lc as Xt,M as ca,Mc as J,Md as Fu,Na as ma,Nc as Bo,Nd as $b,Oa as tr,Oc as Tn,P as oo,Pa as Se,Pb as En,Pd as Fb,Qd as Mb,Rc as Ho,Rd as Db,Sa as x,Ta as be,Tc as Ee,Td as S,U as la,Ua as co,Uc as Vo,Va as Sn,W as Md,Wa as nr,Xa as Kd,Xd as Wo,Ya as E,Yc as mr,Z as At,Za as zd,Zd as re,_a as ct,_b as bu,aa as l,ab as lt,ac as Su,ae as Ae,bc as Eu,cb as Qe,cc as Au,db as lo,dc as Tu,ec as ya,fc as Cu,ge as Mu,hb as Bd,hc as Iu,ia as Dd,ib as Hd,ic as Ru,jb as Vd,ka as Ud,kb as Wd,kd as Nu,lb as Yd,lc as va,ma as ao,mb as Jd,mc as Ou,nb as Xd,nc as wa,ne as Du,o as to,oa as Gd,od as Lu,oe as Uu,p as Od,pa as jd,pb as rr,q as no,qb as Yt,r as na,rb as dt,re as Cn,sa as G,ta as Wt,td as Ia,ua as Ct,uc as xu,v as Vt,va as Z,ve as Gu,w as at,wa as ce,x as vn,y as wn,ya as bn,yb as or,z as ro,zb as ua,ze as ju}from"./focused-chunks/chunk-PDVL7QYU.js";import{AsyncLocalStorage as jF}from"node:async_hooks";(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]="1979adcd-4a7f-5dc7-b5dd-6bfc15eed1af")}catch{}})();var dk=Pa("list").properties.outputSession,mk={outputInclude:{type:"string",minLength:1,description:"Comma-separated fields or sections retained by any built-in read action."},outputLimit:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal read row ceiling, or unbounded to disable the shared ceiling."},outputBudget:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal estimated-token ceiling, or unbounded to return the complete read result."},outputFormat:{type:"string",enum:["json","toon"],description:"Universal read-result encoding selector."},outputSession:{...dk},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},R_={definition:{anyOf:[{type:"object"},{type:"string"}],description:"Policy declaration for policy-put, or proposed metadata for policy-check; structured JSON or JSON text."},policy:{type:"string",description:"Approval policy id for policy-approve."},message:{type:"string",description:"History explanation for policy mutations and approvals."},dryRun:{type:"boolean",description:"Preview registry changes without writing; policy-approve rejects previews."}},O_={type:"object",properties:{cwd:{type:"string",description:"Workspace directory to run the native pm operation in. Defaults to the MCP server process cwd."},path:{type:"string",description:"Optional pm data root, equivalent to PM_PATH/global --path. Leave unset for real repository tracking."},author:{type:"string",description:"Optional mutation author override. Otherwise pm uses PM_AUTHOR, project settings, or detected harness identity."},tokenAccounting:{type:"boolean",description:"Attach the same bounded per-section token-cost receipt emitted by CLI --token-accounting."}},additionalProperties:!0},se={type:"string",description:"pm item id, for example pm-abc1."},uk=`Operation name (one of): ${wa.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,pk={status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."},offset:{type:["string","number"],description:"Alias for options.offset."}},fk={mode:{type:"string",description:"Alias for options.mode."},status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."}};function D(e,t=[]){return{...O_,properties:{...O_.properties,...e},required:t}}var _k=[{name:"pm_run",description:"Run any supported pm operation natively through the pm library. Use this for commands not covered by narrower pm_* tools.",inputSchema:D({action:{type:"string",enum:[...wa],description:uk},id:se,query:{type:"string",description:"Search query for action=search."},reason:{type:"string",description:"Close reason for action=close."},force:{type:"boolean",description:"Force ownership/terminal-state override when supported."},subcommand:{type:"string",description:"Subcommand selector for actions that take one (for example telemetry, or schema \u2014 prefer the dedicated pm_schema tool for schema operations)."},options:{type:"object",description:"Underlying pm command options using camelCase keys."},fullChangedFields:{type:"boolean",description:"For mutation actions, return the full changed_fields array instead of the default changed_field_count."},idOnly:{type:"boolean",description:"For single-item mutation actions, return only id and status."},...mk},["action"])},{name:"pm_discover",description:"Discover the smallest relevant authorized pm tool catalog under an explicit token budget. Ranking is deterministic and returns public lexical, semantic, graph, permission, freshness, and usage signal explanations. Continue with next_cursor; set includeSchema=true only when complete input schemas are needed.",inputSchema:D({query:{type:"string",maxLength:4096,description:"Free-text capability intent. Empty text lists by stable policy order."},family:{type:"string",enum:["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],description:"Optional stable capability-family filter."},tier:{type:"string",enum:["core","standard","full"],description:"Maximum command visibility tier included in results."},limit:{type:"integer",minimum:1,maximum:100,description:"Maximum result rows; defaults to 10."},cursor:{type:"string",minLength:1,maxLength:4096,description:"Opaque next_cursor from an equivalent discovery request."},includeSchema:{type:"boolean",description:"Include complete tool input schemas; false by default."},outputBudget:{anyOf:[{type:"integer",minimum:128},{const:"unbounded"}],description:"Estimated-token ceiling; defaults to 1200."}})},{name:"pm_context",description:"Return the agent-oriented project context snapshot. Pass options.depth=brief|standard|deep|full (full = every section with no per-section row cap), options.parent='<id>' to scope the snapshot to one item's subtree (the item plus all descendants), options.fields='id,title,priority' to project focus rows to a field subset for low-token reads, or options.section=['hierarchy','progress',...] to pick sections.",inputSchema:D({options:{type:"object"}})},{name:"pm_next",description:"Recommend the next actionable work item: the single highest-priority READY item (active status, no open blockers, no open children; completed containers surface only when no concrete leaf work is ready) plus the ranked ready and blocked queues. The recommended item carries a rationale and each blocked item lists the open blockers gating it. Pass options.parent='<id>' to scope to one subtree, options.limit=N to cap ready rows, options.readyOnly=true to omit the blocked list, or filters (options.type/tag/priority/assignee/sprint/release). The most token-efficient 'what should I do now?' read for agents.",inputSchema:D({options:{type:"object"}})},{name:"pm_search",description:"Search pm items with keyword, semantic, or hybrid search. Defaults to a compact projection for token efficiency. Pass options.mode=keyword|semantic|hybrid (default follows search.default_mode: auto runs hybrid when semantic search is configured and runnable, else keyword; the result reports mode_source), options.limit=N to cap hits, options.status='all' for no lifecycle restriction, options.fields='id,title,score' for a custom projection, or options.full=true for full item bodies (can be large). The result echoes the applied filters and projection mode in query_summary.",inputSchema:D({query:{type:"string"},options:{type:"object"},...fk},["query"])},{name:"pm_list",description:"List pm items with status/type/tag/priority filters. Defaults to compact projection for token efficiency. options.status accepts CSV (all,open,in_progress). Pass options.compact=false or options.includeBody=true for full bodies/comments. Pass options.brief=true for ultra-terse (id/status/type/title only). Pass options.fields='id,title,priority' for custom projection. Pass options.limit=N to cap row count. The result echoes the applied filters and projection mode in query_summary.",inputSchema:D({options:{type:"object"},...pk})},{name:"pm_get",description:"Read one pm item with shared SDK projections. Pass options.depth='brief' or options.fields='id,title,status' for low-token inspection, options.fields='id,schedule.start_at' for schedule context, or options.at='7' / an ISO timestamp for a verified mutation-free historical read. Parent results include bounded child counts, samples, and continuation metadata.",inputSchema:D({id:se,options:{type:"object",description:"Get options such as depth=brief|standard|deep|full, fields=id,title,status, or at=<version|ISO timestamp>."}},["id"])},{name:"pm_events",description:"Read a bounded, cursor-resumable page of committed mutation events across item history streams. Batch cursors are the token-efficient default; pass cursorMode=row for per-event checkpoints.",inputSchema:D({since:{type:"string",description:"Durable event cursor or ISO timestamp lower bound."},type:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},author:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},limit:{type:"integer",minimum:0,maximum:1e3},full:{type:"boolean"},cursorMode:{type:"string",enum:["batch","row"],description:"Cursor framing: batch returns one terminal next_cursor (default); row also adds a cursor to every event."}})},{name:"pm_create",description:"Create a pm item natively and write pm history. Output is compact by default (changed_fields replaced with changed_field_count for token efficiency); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},allowMissingParent:{type:"boolean",description:"Allow unresolved parent references and emit a validation warning."},allowDuplicate:{type:"boolean",description:"Explicitly create when strict similarity governance finds likely duplicates."},options:{type:"object",description:"Create options. title and description are required."}},["options"])},{name:"pm_mutate",description:"Apply an ordered create/update/close/release batch atomically through the public pm SDK. Create rows may declare ref and omit id; @ref forward references resolve deterministically from the stable transactionId. Set dryRun=true to validate and preview without writes.",inputSchema:D({transactionId:{type:"string",description:"Stable idempotency key for this atomic mutation batch."},mutations:{type:"array",minItems:1,description:"Ordered rows shaped as {op:create|update|close|release,id?,ref?,options?,reason?}.",items:{type:"object",properties:{op:{type:"string",enum:["create","update","close","release"]},id:se,ref:{type:"string",description:"Batch-local create alias; its deterministic id can be referenced as @alias by any row."},reason:{type:"string"},options:{type:"object"}},required:["op"],additionalProperties:!1}},dryRun:{type:"boolean",description:"Validate and preview without writing."},createCompensation:{type:"string",enum:["close","delete"],description:"How a failed batch compensates created items; defaults to close."},lockTtlSeconds:{type:"number"},lockWaitMs:{type:"number"}},["transactionId","mutations"])},{name:"pm_copy",description:"Copy an existing pm item into a new id while resetting lifecycle fields. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:se,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object",description:"Copy options such as title override, author, and message."}},["id"])},{name:"pm_focus",description:"Set, clear, or show the session focused item. When focused, pm_create defaults its parent to the focused item (an explicit parent still overrides). Pass id to focus an item, options.clear=true to clear, or neither to show current focus.",inputSchema:D({id:se,clear:{type:"boolean",description:"Clear the focused item (cannot be combined with id)."},options:{type:"object",description:"Focus options such as clear (boolean)."}},[])},{name:"pm_update",description:"Update pm item metadata/body/dependencies/log seeds natively. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields delta.",inputSchema:D({id:se,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object"}},["id","options"])},{name:"pm_append",description:"Append markdown text to a pm item body and write pm history. Useful for seeding evidence/log entries before close. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:se,body:{type:"string",description:"Markdown text to append to the item body. Required here or as options.body."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object",description:"Append options such as body, author, and message."}},["id"])},{name:"pm_claim",description:"Claim a pm item.",inputSchema:D({id:se,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_release",description:"Release a pm item claim.",inputSchema:D({id:se,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_close",description:"Close a pm item with optional close reason and optional close validation (reason requirement follows governance settings). Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:se,reason:{type:"string",description:"Close reason text when provided or required by governance settings."},duplicateOf:{type:"string",description:"Canonical item id when closing this item as a duplicate."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object"}},["id"])},{name:"pm_comments",description:"List, add, edit, or delete comments on a pm item. Use options.add to append, options.edit=<1-based index> with replacement text to fix a comment, or options.delete=<1-based index> to remove one. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. List calls default to the most recent 20 comments with total_count/has_more metadata for token efficiency. Pass options.limit=N to choose a page size, options.limit=0 for summary-only metadata, or options.full=true for full history.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_files",description:"List, add, remove, or validate linked files for a pm item.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_docs",description:"List, add, or remove linked docs for a pm item.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_notes",description:"List, add, edit, or delete structured notes on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing notes.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_learnings",description:"List, add, edit, or delete learnings on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing learnings.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_deps",description:"Read dependency trees/graphs or one bounded explainable relationship context packet. Use options.format=context with direction, kind, depth, node, edge, token, and cursor bounds; context returns a counts-first summary, per-node roles/reasons, root evidence pointers, and enumerated missing references.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_graph",description:"Run bounded workspace relationship-graph queries: ancestors/descendants (hierarchy), predecessors/successors (ordering), paths, impact (blast radius), analyze (execution + knowledge analytics), audit (governance findings with change-since-baseline deltas), communities (label-propagation clusters), redundancy (transitively implied edges), dominators (structural bottlenecks), slack (critical-path method float per task), centrality (betweenness/closeness/degree with directed fan-in/out), articulation (cut points and bridges \u2014 single points of failure), plan (dry-run remediation proposals derived from the audit), and index (durable cross-process graph index status/rebuild/clear). Traversals, paths, impact, and dominators require id; paths also requires target. Options support kind, maxDepth, limit, after, direction, maxPaths, sample, exemptIsolate, exemptIsolateType, saveBaseline (audit), rebuild/clear (index), and counts-first summary.",inputSchema:D({subcommand:{type:"string",enum:[...Cu]},id:se,target:se,options:{type:"object"}},["subcommand"])},{name:"pm_test",description:"List, add, remove, or run linked tests for a pm item.",inputSchema:D({id:se,options:{type:"object"}},["id"])},{name:"pm_validate",description:"Run pm validation checks.",inputSchema:D({options:{type:"object"}})},{name:"pm_health",description:"Run pm health diagnostics. Pass options.brief=true for compact low-token details, options.skipIntegrity=true, options.skipDrift=true, options.skipVectors=true for a fast status-only check, or options.full=true for the complete deep check.",inputSchema:D({options:{type:"object"}})},{name:"pm_contracts",description:"Inspect pm command, flag, schema, and availability contracts.",inputSchema:D({options:{type:"object"}})},{name:"pm_schema",description:"Inspect or modify the workspace item-type/status/field schema (pm schema). subcommand selects the operation; name carries the item type name (show/add-type/remove-type), status id (show-status/add-status/remove-status), or field key (show-field/add-field/remove-field). apply-preset adopts a domain type preset; add-type with infer=true derives types from title-prefix conventions. Policy verbs author declarations, preview changes, set enforcement, and record content-bound approvals. Registry mutations write workspace history; approvals write item history.",inputSchema:D({...R_,subcommand:{type:"string",enum:["list","show","show-status","add-type","remove-type","add-status","remove-status","add-field","remove-field","list-fields","show-field","apply-preset",...En],description:"Schema subcommand to run."},name:{type:"string",description:"Item type name, status id, field key, policy id, or item id for the selected schema verb; policy-mode requires advise|refuse."},description:{type:"string",description:"Custom item type, status, or field description for add-type/add-status/add-field."},defaultStatus:{type:"string",description:"Default status for add-type."},folder:{type:"string",description:"Storage folder for add-type."},alias:{type:"array",items:{type:"string"},description:"Aliases for add-type/add-status, or extra CLI flag aliases for add-field."},role:{type:"array",items:{type:"string",enum:[...na]},description:`Lifecycle roles for add-status: ${na.join(", ")}.`},order:{type:"number",description:"Display/sort order for add-status."},fieldType:{type:"string",enum:["string","number","boolean","string_array"],description:"Value type for a custom field (add-field)."},commands:{type:"array",items:{type:"string"},description:"Commands a custom field is wired onto (add-field): create, update, update_many, list, search, calendar, context."},cliFlag:{type:"string",description:"Override the auto-derived CLI flag for a custom field (add-field)."},required:{type:"boolean",description:"Mark a custom field as always required (add-field)."},requiredOnCreate:{type:"boolean",description:"Mark a custom field as required at create time (add-field)."},allowUnset:{type:"boolean",description:"Whether a custom field may be cleared via --unset (add-field); defaults to true."},requiredTypes:{type:"array",items:{type:"string"},description:"Restrict a custom field's requirement to specific item types (add-field)."},typePreset:{type:"string",enum:["agile","ops","research"],description:"Domain type preset to adopt (apply-preset)."},infer:{type:"boolean",description:"Infer item types from title-prefix conventions (add-type); previews unless apply is true."},minCount:{type:"number",description:"Minimum items sharing a prefix for add-type inference (default 10)."},apply:{type:"boolean",description:"Register inferred types (add-type infer); without it the call previews only."},force:{type:"boolean",description:"Override removal guardrails for destructive schema changes when supported."},options:{type:"object",description:"Additional schema options using camelCase keys.",properties:R_}},["subcommand"])},{name:"pm_profile",description:"List, show, apply, or lint project profiles (pm profile) \u2014 archetype bundles that stage item types, statuses, fields, per-type workflows, config knobs, create templates, and recommended packages. subcommand selects the operation; name carries the profile name (agile, ops, research) for show/apply/lint. apply stages every dimension idempotently; dryRun previews the diff without writing; lint reports author-time consistency findings (graded error/warning) without touching the tracker. Profile staging writes workspace config/schema files, not item history.",inputSchema:D({subcommand:{type:"string",enum:["list","show","apply","lint"],description:"Profile subcommand to run."},name:{type:"string",description:"Profile name for show/apply/lint. Required for those subcommands. Built-ins are agile, ops, and research; an active extension can contribute additional archetype names that resolve here too."},dryRun:{type:"boolean",description:"Preview the apply diff without writing any files (apply)."},author:{type:"string",description:"Mutation author for apply."},force:{type:"boolean",description:"Force ownership/lock override for apply."},options:{type:"object",description:"Additional profile options using camelCase keys."}},["subcommand"])},{name:"pm_config",description:"Read or write pm workspace configuration (pm config). configAction selects get/set/list/export; key/value address a single setting for get/set. scope chooses the project (default) or global settings file.",inputSchema:D({configAction:{type:"string",enum:["get","set","list","export"],description:"Config operation to perform. get/set require key; list/export dump the resolved settings surface."},key:{type:"string",description:"Settings key for get/set, for example governance-require-close-reason, telemetry-tracking, or a nested leaf such as search_provider (dash and underscore variants accepted; configAction=get without a key lists supported keys in the error)."},value:{type:"string",description:"New value for configAction=set."},scope:{type:"string",enum:["project","global"],description:"Settings scope to read or write. Defaults to project."},options:{type:"object",description:"Additional config options such as criterion, clearCriteria, format, or policy."}},["configAction"])},{name:"pm_plan",description:"Run agent-optimized Plan workflows. options.subcommand selects: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize. Provide id for all non-create subcommands; provide stepRef for step lifecycle subcommands. Plans store agent-readable steps with dependencies, decisions, discoveries, validation, and resume context.",inputSchema:D({id:{type:"string",description:"Plan id (required for all subcommands except create)."},stepRef:{type:"string",description:"Step id or order for step lifecycle subcommands."},options:{type:"object",description:"Plan options including subcommand, stepRef, stepStatus, link, depth, etc."}})}],hk={pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_docs:"docs",pm_events:"events",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"},gk=_k.map(e=>{let t=hk[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:Pa(t,{properties:n,required:r})}});function x_(){return gk.map(e=>{let t=e.inputSchema.required,n=Array.isArray(t)?t.map(r=>String(r)).sort((r,o)=>r.localeCompare(o)):[];return{name:e.name,description:e.description,required:n,input_schema:e.inputSchema}}).sort((e,t)=>e.name.localeCompare(t.name))}(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]="845638dd-45b8-5057-bed2-2f687591eeaa")}catch{}})();var P_=new Map([["claim",["--if-available","--next","--type","--priority","--token-budget","--explain-ranking"]],["close",["--reason","--validate-close","--resolution","--expected-result","--actual-result","--message"]],["context",["--limit","--after","--depth","--section","--token-budget","--explain-ranking"]],["contracts",["--command","--flags-only","--summary","--runtime-only","--availability-only","--full"]],["create",["--title","--type","--status","--priority","--dep","--comment"]],["get",["--full","--depth","--fields","--tree","--tree-depth","--format"]],["health",["--check-only","--summary","--brief","--check-telemetry","--strict-exit","--full"]],["list",["--status","--type","--limit","--after","--brief","--fields"]],["next",["--limit","--blocked-limit","--ready-only","--token-budget","--explain-ranking","--format"]],["search",["--mode","--status","--type","--limit","--after","--fields"]],["update",["--status","--message","--dep","--comment","--file","--test"]],["validate",["--check-resolution","--check-history-drift","--check-storage-integrity","--counts","--strict-exit","--fix-hints"]]]),yk=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],q_=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),Fi=new Set(["calendar","guide","reindex","completion","test-runs-list","test-runs-status","test-runs-logs","test-runs-stop","test-runs-resume","templates-list","templates-save","templates-show"]),tn=new Set(["meet","event","remind","search-advanced","dedupe-audit","dedupe-merge","comments-audit","cal","calendar","completion","completion-statuses","completion-tags","completion-types","guide","reindex","normalize","templates","templates list","templates save","templates show","test-runs","test-runs list","test-runs status","test-runs logs","test-runs stop","test-runs resume"]),K_=new Map([["meet","calendar"],["event","calendar"],["remind","calendar"],["search-advanced","search-advanced"],["dedupe-audit","governance-audit"],["dedupe-merge","governance-audit"],["comments-audit","governance-audit"],["cal","calendar"],["calendar","calendar"],["completion","guide-shell"],["completion-statuses","guide-shell"],["completion-tags","guide-shell"],["completion-types","guide-shell"],["guide","guide-shell"],["reindex","search-advanced"],["normalize","governance-audit"],["templates","templates"],["templates list","templates"],["templates save","templates"],["templates show","templates"],["test-runs","linked-test-adapters"],["test-runs list","linked-test-adapters"],["test-runs status","linked-test-adapters"],["test-runs logs","linked-test-adapters"],["test-runs stop","linked-test-adapters"],["test-runs resume","linked-test-adapters"]]),z_=new Map([["calendar","calendar|cal"],["guide","guide"],["reindex","reindex"],["completion","completion"],["test-runs-list","test-runs|test-runs list"],["test-runs-status","test-runs status"],["test-runs-logs","test-runs logs"],["test-runs-stop","test-runs stop"],["test-runs-resume","test-runs resume"],["templates-list","templates|templates list"],["templates-save","templates save"],["templates-show","templates show"]]),B_=new Map([...z_.entries()].flatMap(([e,t])=>gt(t).map(n=>[n,e]))),H_=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],fc=new Map(H_.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),vk=10,wk=20,N_=new Map([["activity","Read activity."],["aggregate","Group counts."],["append","Append body."],["assurance","Evaluate assurance."],["assurance derive","Derive checks."],["assurance risk","Select checks for changes."],["assurance lineages","Measure recurrence coverage."],["beads","Manage Beads interoperability."],["cal","Manage calendar integration."],["calendar","Manage calendar integration."],["changelog","Generate changelog output."],["claim","Claim work."],["close","Close work."],["close-many","Close matching work."],["close-task","Close task work."],["command-kit","Inspect command authoring primitives."],["comments","Manage comments."],["comments-audit","Audit comment governance."],["completion","Generate shell completions."],["config","Manage settings."],["context","Build context."],["contracts","Inspect contracts."],["copy","Copy work."],["create","Create work."],["dedupe-audit","Audit duplicate work."],["dedupe-merge","Merge duplicate work."],["delete","Delete work."],["deps","Manage deps."],["duplicates","Find duplicate clusters."],["docs","Link docs."],["eval","Run evaluations."],["event","Manage events."],["events","Read events."],["files","Link files."],["focus","Manage focus."],["gc","Clean caches."],["get","Read item."],["graph","Query graph."],["guide","Show user guides."],["health","Check health."],["help","Show help."],["history","Inspect history."],["init","Initialize workspace."],["install","Install packages."],["item","Mutate items."],["learnings","Manage learnings."],["list","List work."],["list-all","List work across every status."],["list-blocked","List blocked work."],["list-canceled","List canceled work."],["list-closed","List closed work."],["list-draft","List draft work."],["list-in-progress","List in-progress work."],["list-open","List open work."],["meet","Record meeting context."],["merge","Manage tracker merges."],["next","Pick next work."],["notes","Manage notes."],["normalize","Normalize tracker data."],["ops","Run operations."],["package","Manage packages."],["packages","Manage packages."],["pause-task","Pause task work."],["plan","Manage plans."],["profile","Manage profiles."],["reindex","Refresh search index."],["release","Release claim."],["remind","Manage reminders."],["restore","Restore history."],["schema","Customize schema."],["search","Search work."],["search-advanced","Run advanced search."],["start-task","Start task work."],["stats","Show stats."],["telemetry","Manage telemetry."],["templates","Manage work templates."],["test","Run linked tests."],["test-all","Run all linked tests."],["test-runs","Inspect background test runs."],["todos","Manage source-code todos."],["twin","Manage repository twins."],["update","Update work."],["update-many","Update matching work."],["upgrade","Upgrade packages."],["validate","Validate data."],["vcs","Inspect version-control context."],["workspace","Manage workspaces."],["history-author-acknowledge","Acknowledge reviewed history authors."],["history-compact","Compact history."],["history-attest","Export or verify detached history proof."],["history-redact","Redact sensitive history values."],["history-repair","Repair history integrity."]]),V_=[["init",ym],["install",wm],["uninstall",bm],["explore",km],["manage",Im],["describe",Sm],["reload",Rm],["doctor",Om],["catalog",xm],["adopt",Pm],["adopt-all",Em],["activate",Am],["deactivate",Tm],["migrate",Cm]],bk=[...V_.map(([e,t])=>e==="init"?[e,vm]:[e,t]),["upgrade",cr]],kk=[...V_.map(([e,t])=>[`extension ${e}`,t]),...bk.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",yo],["config",gm],["extension",vo],["package",ar],["packages",ar],["install",Nm],["create",Ao],["item mutate",Qm],["item complete",Zm],["item reopen",eu],["copy",To],["focus",Co],["update",Io],["update-many",Ro],["upgrade",cr],["calendar",lr],["cal",lr],["context",dr],["ctx",dr],["get",xo],["search",Fo],["eval",nu],["events",Oo],["workspace",It],["workspace position",[]],["workspace snapshot",It],["workspace snapshot create",It],["workspace snapshot list",It],["workspace snapshot inspect",It],["workspace snapshot restore",It],["workspace snapshot delete",It],["next",$o],["aggregate",fo],["deps",No],["graph",Lo],["guide",Po],["reindex",Lm],["history",_o],["history-compact",pm],["history-attest",fm],["history-redact",mm],["history-repair",um],["history-author-acknowledge",ho],["merge",dm],["schema",_m],["profile",hm],["plan",go],["restore",Mm],["delete",Dm],["close",$m],["close-many",wo],["append",bo],["claim",Fm],["release",Um],["start-task",Gm],["pause-task",jm],["close-task",qm],["comments",im],["notes",sm],["learnings",am],["files",cm],["docs",lm],["test",Bm],["test-runs-worker",[]],["test-all",Hm],["telemetry",Vm],["test-runs",Wm],["gc",Ym],["stats",ko],["ops",[]],["duplicates",So],["validate",Jm],["health",Eo],["assurance",Xm],...ru,["contracts",Mo],["completion",Do],["activity",tu],...[...q_].map(e=>[e,po])],xr=new Map(kk);for(let{alias:e,canonical:t}of ke){let n=xr.get(e);n!==void 0&&xr.set(t,n)}function Sk(e){let t=B_.get(e);return t||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function L_(e){let t=ke.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:ya.includes(e)?ye(e):e.startsWith("extension-")?ye(`extension ${e.slice(10)}`):e.startsWith("package-")?ye(`package ${e.slice(8)}`):e.startsWith("item-")?ye(`item ${e.slice(5)}`):e.startsWith("test-runs-")?ye(`test-runs ${e.slice(10)}`):e.startsWith("templates-")?ye(`templates ${e.slice(10)}`):Fi.has(e)?z_.get(e)??ye(e):null}function Ek(e,t){let n=H(t);return n!==t||ke.some(r=>r.alias===t)?e.action===n:e.command_path===null?!1:gt(e.command_path).some(r=>r===t?!0:r.startsWith(`${t} `)||t.startsWith(`${r} `))}function gt(e){return e.split("|").map(t=>ye(t)).filter(t=>t.length>0)}function Ak(e,t){let n=new Set(t),r=new Set;for(let o of e)if(o.command_path)for(let i of gt(o.command_path)){let s=i.split(" ").filter(a=>a.length>0);if(s.length!==0)for(let a=s.length;a>0;a-=1){let c=s.slice(0,a).join(" ");if(n.has(c)){r.add(c);break}}}return[...r].sort((o,i)=>o.localeCompare(i))}function $i(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Pr(e){let t=e.oneOf;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null):[]}function Tk(e,t){if(!t)return{...e};let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;return typeof s!="object"||s===null?!1:s.const===t});return{...e,oneOf:r}}function uc(e,t){let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;if(typeof s!="object"||s===null)return!1;let a=s.const;return typeof a=="string"&&t.has(a)});return{...e,oneOf:r}}function ye(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function W_(e){return e.replace(/\s+/g,"-")}function rt(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function $_(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let o=rt(r);!o||n.has(o)||(n.add(o),t.push(o))}return t}function pc(e,t,n){n&&(e[t]=!0)}function F_(e,t){if(e==null)return null;if(typeof e!="string")throw new TypeError("Expected string for extension flag name.");let n=e.trim();return n.length===0?null:t==="long"?n.startsWith("--")&&n.length>2?n:null:n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function Ck(e){let t=F_(e.long,"long"),n=F_(e.short,"short"),r=t??n;if(!r)return null;let o={flag:r};n&&t&&(o.short=n),pc(o,"required",e.required===!0),pc(o,"repeatable",e.repeatable===!0),pc(o,"list",e.list===!0);let i=rt(e.description);i&&(o.description=i);let s=rt(e.value_name);s&&(o.value_name=s);let a=[rt(e.value_type),rt(e.type),s?"string":null].find(c=>c==="string"||c==="number"||c==="boolean");return a&&(o.value_type=a),o}function Y_(e){let t=new Map;for(let r of e){let o=ye(r.target_command);if(o.length===0)continue;let i=t.get(o)??{flags:[],sources:[],dedupe:new Set,sourceDedupe:new Set},s=`${r.layer}:${r.name}`;i.sourceDedupe.has(s)||(i.sourceDedupe.add(s),i.sources.push({layer:r.layer,name:r.name}));for(let a of r.flags){let c=Ck(a);if(!c)continue;let m=`${c.flag}|${c.short??""}`;i.dedupe.has(m)||(i.dedupe.add(m),i.flags.push(c))}t.set(o,i)}let n=new Map;for(let[r,o]of t.entries())n.set(r,{flags:o.flags,sources:o.sources.sort((i,s)=>{let a=i.layer.localeCompare(s.layer);return a!==0?a:(i.name??"").localeCompare(s.name??"")})});return n}function Ik(e){let t=Y_(e.flagRegistrations),n=new Map;for(let i of e.commandDefinitions){let s=ye(i.command);if(s.length===0)continue;let a=rt(i.action)??W_(s),c=Array.isArray(i.arguments)?i.arguments.map(m=>{let u=rt(m.name);return u?{name:u,required:m.required===!0,variadic:m.variadic===!0,description:rt(m.description)}:null}).filter(m=>m!==null):[];n.set(s,{...i.tier===void 0?{}:{tier:i.tier},command:s,action:a,source:{layer:i.layer,name:i.name},description:rt(i.description),intent:rt(i.intent),arguments:c,flags:t.get(s)?.flags??[],examples:$_(i.examples),failure_hints:$_(i.failure_hints)})}let r=new Set;for(let i of e.handlers)r.add(ye(i));for(let i of n.keys())r.add(i);for(let i of t.keys())r.add(i);let o=[];for(let i of[...r].sort((s,a)=>s.localeCompare(a))){let s=n.get(i);o.push(Rk(i,s,t.get(i)?.flags??[]))}return o}function Rk(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:W_(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function Ok(e){let t=e.flag.replace(/^-+/,"").trim();if(t.length===0)return null;let r=t.replace(/-([a-z0-9])/g,(o,i)=>i.toUpperCase()).replace(/[^a-zA-Z0-9]/g,"");return r.length>0?r:null}function xk(e,t){return e.variadic?{type:"array",items:{type:"string"},description:e.description??`Variadic argument '${e.name}' for extension action '${t}'.`}:{type:"string",description:e.description??`Argument '${e.name}' for extension action '${t}'.`}}function Pk(e,t){let n=e.value_type??"boolean",r=n==="boolean"?"boolean":n==="number"?["number","string"]:"string",o=e.repeatable===!0||e.list===!0;return{type:o?"array":r,...o?{items:{type:r}}:{},description:e.description??`Extension option '${e.flag}' for action '${t}'.`}}function Nk(e){let t=e.command.split("|").map(o=>o.trim()).filter(o=>o.length>0),n={action:{type:"string",const:e.action,description:e.intent??e.description??`Invoke extension command '${e.command}'.`}},r=["action"];for(let o of e.arguments)n[o.name]=xk(o,e.action),o.required&&r.push(o.name);for(let o of e.flags){let i=Ok(o);!i||n[i]!==void 0||(n[i]=Pk(o,e.action),o.required===!0&&r.push(i))}return{type:"object",properties:n,required:r,additionalProperties:!0,"x-extension-source":e.source,"x-extension-command":t[0]??e.command,"x-extension-commands":t}}function Lk(e,t){e.description??=t.description,e.value_name??=t.value_name,e.value_type??=t.value_type,t.required===!0&&(e.required=!0),t.repeatable===!0&&(e.repeatable=!0)}function $k(e){let t=new Map;for(let n of e){let r=t.get(n.action);if(!r){t.set(n.action,{...n,flags:[...n.flags],examples:[...n.examples],failure_hints:[...n.failure_hints]});continue}r.command=[...new Set([r.command,n.command])].sort((i,s)=>i.localeCompare(s)).join("|"),r.arguments=r.arguments.length>=n.arguments.length?r.arguments:n.arguments;let o=new Set(r.flags.map(i=>`${i.flag}|${i.short??""}`));for(let i of n.flags){let s=`${i.flag}|${i.short??""}`;if(!o.has(s))o.add(s),r.flags.push(i);else{let a=r.flags.find(c=>`${c.flag}|${c.short??""}`===s);a&&Lk(a,i)}}r.examples=[...new Set([...r.examples,...n.examples])],r.failure_hints=[...new Set([...r.failure_hints,...n.failure_hints])]}return[...t.values()].sort((n,r)=>n.action.localeCompare(r.action))}async function Fk(e,t=A){let n={mode:At.extensions.policy.mode,trust_mode:At.extensions.policy.trust_mode,default_sandbox_profile:At.extensions.policy.default_sandbox_profile};if(e.noExtensions)return{handlers:new Set,disabledReason:"extensions_disabled",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};let r=E(process.cwd(),e.path);if(!await G(ue(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let o=await t(r),i=await or({pmRoot:r,settings:o,cwd:process.cwd(),noExtensions:!1}),s=await ir({...i,loaded:i.loaded});return{handlers:new Set(s.commands.handlers.map(c=>ye(c.command))),disabledReason:null,commandDefinitions:s.registrations.commands,flagRegistrations:s.registrations.flags,registrations:s.registrations,policyState:{mode:i.policy.mode,trust_mode:i.policy.trust_mode,default_sandbox_profile:i.policy.default_sandbox_profile}}}catch{return{handlers:new Set,disabledReason:"extension_runtime_probe_failed",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n}}}function Mk(e,t={}){let n=new Map;for(let r of va){let o=Fi.has(r);if(o&&!t.includePackageOwnedActions)continue;let i=L_(r);n.set(r,{action:r,provider:o?"extension":"core",requires_extension:o,command_path:i})}if(t.includePackageOwnedActions)for(let r of Fi)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:L_(r)});for(let r of e)n.has(r.action)||n.set(r.action,{action:r.action,provider:"extension",requires_extension:!0,command_path:ke.find(o=>o.alias===r.command)?.canonical??ye(r.command)});return[...n.values()].sort((r,o)=>(r.action??"").localeCompare(o.action??""))}function Dk(e,t){if(e.provider==="core"&&!e.requires_extension)return{action:e.action,invocable:!0,available:!0,requires_extension:!1,provider:"core",disabled_reason:null,command_path:e.command_path,cli_exposed:e.command_path!==null&&(!tn.has(e.action)||t.handlers.has(e.action))};let n=e.command_path?gt(e.command_path):[],r=n.some(s=>t.handlers.has(s)||t.handlers.has(H(s))),o=n.map(s=>K_.get(H(s))).find(s=>typeof s=="string"),i=t.disabledReason===null&&r;return{action:e.action,invocable:i,available:i,requires_extension:!0,provider:"extension",disabled_reason:i?null:t.disabledReason??(o?`optional_package_not_installed:${o}`:"extension_command_not_registered"),command_path:e.command_path,cli_exposed:r,policy_state:{mode:t.policyState.mode,trust_mode:t.policyState.trust_mode,default_sandbox_profile:t.policyState.default_sandbox_profile}}}function J_(e){return xr.get(e)??uo}function Uk(e){return tn.has(H(e))?!1:xr.has(e)}function Gk(e){return q_.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function M_(e){let t=e.trim();return t?t.startsWith("--")?t:t.startsWith("-")?null:`--${t}`:null}function jk(e){let t=e.trim();return!t||t.startsWith("--")?null:t.startsWith("-")?t:null}function qk(e){let t=new Map;for(let r of e.definitions){let o=M_(r.cli_flag);if(!o)continue;let i=r.cli_aliases.map(a=>jk(a)).find(a=>a!==null),s=r.cli_aliases.map(a=>M_(a)).filter(a=>a!==null&&a!==o);for(let a of r.commands){let c=t.get(a)??{flags:[],seen:new Set},m=i?{flag:o,short:i}:{flag:o},u=`${m.flag}|${m.short??""}`;c.seen.has(u)||(c.seen.add(u),c.flags.push(m));for(let p of s){let f=`${p}|`;c.seen.has(f)||(c.seen.add(f),c.flags.push({flag:p}))}t.set(a,c)}}let n=new Map;for(let[r,o]of t.entries())n.set(r,_a(o.flags));return n}function D_(e,t){let n=[],r=new Set;for(let o of[...e,...t]){let i=`${o.flag}|${o.short??""}`;r.has(i)||(r.add(i),n.push(o))}return _a(n)}function Kk(e,t,n,r,o){let i=new Map(t);for(let{alias:s,canonical:a}of ke){let c=t.get(a)??t.get(s);c&&(i.set(s,c),i.set(a,c))}return e.map(s=>{let a=Uk(s),c=a?J_(s):[],m=n.get(Gk(s))??[],u=i.get(s),p=D_(c,m),f=D_(p,u?.flags??[]),_=c.length>0&&(u?.flags.length??0)>0?"mixed":a?"core":"extension";return{command:s,flags:f,...r?{canonical_command:Q_(s),visibility:X_(s,o),positionals:rm(s)?.slots??[],flag_invocations:ur(s,f)}:{},provider:_,extension_sources:u?.sources}}).sort((s,a)=>s.command.localeCompare(a.command))}function zk(e,t=sr){let n=new Set(e),r=new Map;for(let o of H_){let i=o.aliases.filter(s=>n.has(s));r.set(o.canonical,{canonical:o.canonical,aliases:i,contracts:[]})}for(let o of t){if(!n.has(o.canonical)||o.registration==="commander"&&!n.has(o.alias))continue;let i=r.get(o.canonical)??{canonical:o.canonical,aliases:[],contracts:[]};i.aliases.includes(o.alias)||i.aliases.push(o.alias),i.contracts.push(o),r.set(o.canonical,i)}return[...r.values()].map(({contracts:o,...i})=>o.length===0?i:{...i,contracts:o}).sort((o,i)=>o.canonical.localeCompare(i.canonical))}function Bk(){return{create_string_options:Hu,create_repeatable_options:Jo,update_string_options:Vu,update_repeatable_options:Wu,list_string_options:Qd,search_string_options:Zd,calendar_string_options:em,context_string_options:tm,activity_string_options:nm}}function U_(e,t){let n=new Set(["title","type"]);if(t==="strict"){for(let a of e.required_create_fields)n.add(a);for(let a of e.required_create_repeatables)n.add(a)}let r=Sn(e,"create",n),o=[...new Set(r.required)].sort((a,c)=>a.localeCompare(c)),i=[...new Set(o.map(a=>Se("create",a)))].sort((a,c)=>a.localeCompare(c)),s=[...new Set(e.options.filter(a=>a.required===!0).map(a=>a.key))].sort((a,c)=>a.localeCompare(c));return{required_option_keys:o,required_flags:i,required_type_options:s,policy_errors:[...new Set(r.errors)].sort((a,c)=>a.localeCompare(c))}}function Hk(e){let t={},n={};for(let r of[...e.types].sort((o,i)=>o.localeCompare(i))){let o=e.by_type[r];t[r]=U_(o,"strict"),n[r]=U_(o,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function Vk(e,t){let n=Pr(e);if(n.length===0)return e;let r=!1,o=n.map(i=>{let s=i.properties;if(typeof s!="object"||s===null)return i;let a=s.action;return typeof a!="object"||a===null||a.const!=="create"?i:(r=!0,{...i,"x-create-required-options":t})});return r?{...e,oneOf:o}:e}function Wk(e){let t=$i(e.action)!==void 0||$i(e.command)!==void 0,n=e.schemaOnly===!0||e.flagsOnly===!0||e.availabilityOnly===!0,r=e.summary===!0||e.full!==!0&&e.runtimeOnly!==!0&&!t&&!n,o=e.schemaOnly===!0,i=e.flagsOnly===!0,s=e.availabilityOnly===!0,a=e.runtimeOnly===!0,c=e.full===!0,m=$i(e.action),u=$i(e.command),p=!r&&!c&&!o&&!i&&!s&&!m&&!u;return{selectedAction:m,selectedCommand:u,summary:r,schemaOnly:o,flagsOnly:i,availabilityOnly:s,runtimeOnly:a,fullOutput:c,omitUnfilteredSchema:p,omitUnfilteredCommandFlags:p,omitUnfilteredCommanderAliases:p||u!==void 0&&!c}}function Yk(e){if([e.summary,e.schemaOnly,e.flagsOnly,e.availabilityOnly].filter(n=>n).length>1)throw new l("Choose only one projection flag: --summary, --schema-only, --flags-only, or --availability-only.",d.USAGE)}async function Jk(e,t=A){try{return await t(e)}catch{return structuredClone(At)}}async function Xk(e,t,n){let r=await Jk(t),o=await Fk(e),i=x(r,o.registrations??O()),s=Ze(r.schema),a=Ik(o);return{settings:r,runtimeProbe:o,typeRegistry:i,statusRegistry:F(r.schema),runtimeFieldRegistry:s,runtimeFieldFlagMap:qk(s),createRequiredOptionContracts:Hk(i),extensionContracts:a,mergedExtensionContracts:$k(a.filter(c=>Mi(n,c.command,a))),extensionFlagMap:Y_(o.flagRegistrations)}}function G_(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&Fi.has(e.selectedAction)||e.selectedCommand!==void 0&&tn.has(H(e.selectedCommand)))}function Qk(e,t){let n=Mk(t,{includePackageOwnedActions:G_(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set(Ou);return n.filter(o=>!r.has(o.action)&&(e.fullOutput||(t.find(i=>i.action===o.action)?.tier??Xo(o.action))!=="internal"))}return G_(e)&&e.selectedCommand!==void 0&&tn.has(H(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:Sk(H(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function Zk(e,t){let n=new Set(t.map(r=>r.action));if(e.selectedAction&&!n.has(e.selectedAction))throw new l(`Unknown action: "${e.selectedAction}".`,d.USAGE)}function eS(e,t){return[...new Set([...ya.filter(n=>!tn.has(H(n))),...[...xr.keys()].filter(n=>!tn.has(H(n))),...e.flatMap(n=>n.command_path?gt(n.command_path).filter(r=>n.provider==="extension"||!tn.has(H(r))||t.some(o=>o.action===n.action)):[]),...t.flatMap(n=>n.command.split("|").flatMap(r=>{let o=ke.find(i=>i.alias===r||i.canonical===r);return o===void 0?[r]:[o.alias,o.canonical]}))])].map(n=>ye(n)).filter(n=>n.length>0).sort((n,r)=>n.localeCompare(r))}function tS(e,t){let n=t.slice(0,vk),r=t.length-n.length,o=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),i=t.slice(0,wk),s=t.slice(0,5).map(c=>`pm contracts --command "${c}" --flags-only --json`),a=t[0];return new l(`Command "${e}" is a command namespace. Choose a concrete child command: ${o}.`,d.USAGE,{code:"command_namespace",required:"Use a concrete child command path listed under this namespace.",why:"Command groups expose help at the namespace root, but command flag contracts belong to executable child commands.",examples:s,nextSteps:[`Retry with a child command, for example: ${s[0]}`],recovery:{suggested_retry:`pm contracts --command "${a}" --flags-only --json`,fallback_candidates:i.map(c=>({source:"command_namespace",command:`pm contracts --command "${c}" --flags-only --json`,reason:`Child command under ${e}`}))}})}function nS(e,t){return new l(`Unknown command: "${e}". Command "${e}" is provided by the optional "${t}" package. Run "pm install ${t} --project" and retry.`,d.USAGE,{code:"unknown_command",required:`Install the optional "${t}" package, or choose a command from pm contracts --flags-only --json.`,why:"Command contracts include core commands plus commands registered by active packages and extensions.",examples:[`pm install ${t} --project`,`pm contracts --command ${e} --flags-only --json`],nextSteps:[`Install the optional package first: pm install ${t} --project`],recovery:{suggested_retry:`pm install ${t} --project`}})}function rS(e){return new l(`Unknown command: "${e}".`,d.USAGE,{code:"unknown_command",required:"Use a command path listed by pm contracts --flags-only --json.",why:"Command contracts are generated from the active core, package, and extension command registry.",examples:["pm contracts --flags-only --json","pm --help"],nextSteps:["Verify spelling and active packages/extensions, then rerun with a known command path."],recovery:{suggested_retry:"pm contracts --flags-only --json"}})}function oS(e,t){if(!e.selectedCommand||new Set(t).has(e.selectedCommand))return;let r=t.filter(i=>i.startsWith(`${e.selectedCommand} `));if(r.length>0)throw tS(e.selectedCommand,r);let o=K_.get(H(e.selectedCommand));throw o?nS(e.selectedCommand,o):rS(e.selectedCommand)}function iS(e,t){let n=Qk(e,t.mergedExtensionContracts);Zk(e,n);let r=eS(n,t.mergedExtensionContracts);oS(e,r);let o=e.selectedCommand?B_.get(H(e.selectedCommand)):void 0,i=e.selectedCommand?n.filter(m=>o?m.action===o:Ek(m,e.selectedCommand)):n;if(e.selectedCommand&&e.selectedAction&&!i.some(m=>m.action===e.selectedAction))throw new l(`Action "${e.selectedAction}" is not mapped to command "${e.selectedCommand}" in contracts output.`,d.USAGE);let s=e.selectedAction?i.filter(m=>m.action===e.selectedAction):i,a=[...new Map(s.map(m=>Dk(m,t.runtimeProbe)).map(m=>[o?m.action:`${m.action}|${m.command_path??""}`,m])).values()],c=e.runtimeOnly&&!e.selectedAction&&!e.availabilityOnly?a.filter(m=>m.invocable):a;return{actionDescriptors:n,commandCatalog:r,commandScopedDescriptors:i,scopedActionDescriptors:s,selectedPackageOwnedAction:o,actionAvailability:c,actions:[...new Set(c.map(m=>m.action))]}}function sS(e){return new Set(Pr(e).map(t=>{let n=t.properties;if(typeof n!="object"||n===null)return null;let r=n.action;if(typeof r!="object"||r===null)return null;let o=r.const;return typeof o=="string"?o:null}).filter(t=>t!==null))}function aS(e){let t=Ku,n=Pr(t),r=sS(t),o=e.filter(i=>!r.has(i.action)).map(i=>Nk(i));return o.length>0?{...t,oneOf:[...n,...o]}:t}function j_(e,t,n){let r=new Set(t.actionDescriptors.map(i=>i.action)),o=e.selectedAction?Tk(n,e.selectedAction):e.selectedCommand?uc(n,new Set(t.scopedActionDescriptors.map(i=>i.action))):uc(n,r);return e.runtimeOnly&&!e.selectedAction?uc(o,new Set(t.actions)):o}function cS(e,t,n){let r=aS(t.mergedExtensionContracts),i=!e.flagsOnly&&!e.availabilityOnly?Vk(j_(e,n,r),t.createRequiredOptionContracts):j_(e,n,r);return{mergedSchema:r,filteredSchema:i}}function lS(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?Ak(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function X_(e,t){return t.find(n=>H(n.command)===H(e))?.tier??Xo(e)}function Mi(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||X_(t,n)!=="internal"}function dS(e,t,n){if(e.selectedCommand!==void 0||e.selectedAction!==void 0)return t;let r=new Set(sr.filter(o=>o.hidden&&(o.lifecycle==="deprecated"||!e.fullOutput&&!e.availabilityOnly)).map(o=>o.alias));if(e.summary&&!e.fullOutput)for(let o of fc.keys())r.add(o);return t.filter(o=>!r.has(o)&&Mi(e,o,n))}function Q_(e){let t=ke.find(r=>r.alias===e||r.canonical===e);if(t)return t.canonical;let n=e.split(" ")[0];return n.startsWith("list-")?"list":fc.get(n)??n}var mS=new Map([["activate","Activate"],["adopt","Adopt"],["adopt-all","Adopt all"],["catalog","Catalog"],["complete","Complete"],["create","Create"],["deactivate","Deactivate"],["delete","Delete"],["describe","Describe"],["doctor","Diagnose"],["explore","Explore"],["init","Initialize"],["inspect","Inspect"],["install","Install"],["list","List"],["manage","Manage"],["migrate","Migrate"],["mutate","Mutate"],["reload","Reload"],["restore","Restore"],["run","Run"],["snapshot","Manage snapshots for"],["uninstall","Uninstall"],["upgrade","Upgrade"]]),uS=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function pS(e,t){let n=N_.get(H(e))??(e.includes(" ")?void 0:N_.get(Q_(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(m=>gt(m.command).some(u=>H(u)===H(e)));if(r?.intent!==null&&r?.intent!==void 0)return{intent:r.intent,intent_source:"command"};if(r?.description!==null&&r?.description!==void 0)return{intent:r.description,intent_source:"description"};let o=e.split(" "),i=o.at(-1),s=o.slice(0,-1).join(" "),a=mS.get(i),c=uS.get(e)??s;return{intent:a===void 0||s.length===0?`Run ${e}.`:`${a} ${c}.`,intent_source:"generated"}}function fS(e,t=[],n={}){let r=n.includeFormatBudgets??!0,o=n.includeIntentProvenance??!0;return[...new Set(e.map(ye))].filter(i=>i.length>0).sort((i,s)=>i.localeCompare(s)).map(i=>{let s=Ia(i,{generateFallback:!0}),a=i.split(" ")[0],c=fc.get(a)??(a.startsWith("list-")?"list":a.startsWith("history-")?"history":a),m=new Set([...J_(i).map(f=>f.flag),...t.filter(f=>gt(f.command).some(_=>H(_)===H(i))).flatMap(f=>f.flags.map(_=>_.flag))]),u=(P_.get(H(i))??P_.get(c)??yk).filter(f=>m.has(f)),p=pS(i,t);return{command:i,intent:p.intent,...o||p.intent_source!=="command"?{intent_source:p.intent_source}:{},...u.length>0?{flags:u}:{},default_max_estimated_tokens:s.default_max_estimated_tokens,...r?{default_max_estimated_tokens_by_format:{...s.default_max_estimated_tokens_by_format}}:{}}})}function _S(e){return e.map(t=>({budget:Ia(t,{generateFallback:!0}),envelope:ep(t)}))}function hS(e){let t=new Map;for(let n of e){let r=Ju(n),o=r===void 0?[d.SUCCESS,d.GENERIC_FAILURE,d.USAGE,d.NOT_FOUND,d.CONFLICT,d.DEPENDENCY_FAILED]:r.exit_codes,i=o.join(","),s=t.get(i)??{commands:[],exit_codes:o};s.commands.push(n),t.set(i,s)}return[...t.values()]}function gS(e,t,n){if(e.selectedCommand)return t.extensionContracts.filter(r=>gt(r.command).some(o=>H(o)===H(e.selectedCommand)));if(e.selectedAction){let r=new Set(n);return t.extensionContracts.filter(o=>gt(o.command).some(i=>r.has(i)))}return t.extensionContracts.filter(r=>Mi(e,r.command,t.extensionContracts))}function yS(e,t,n,r){return{schema_version:typeof t.mergedSchema["x-schema-version"]=="string"?t.mergedSchema["x-schema-version"]:null,schema_id:typeof t.mergedSchema.$id=="string"?t.mergedSchema.$id:null,selected:{action:e.selectedAction??null,command:e.selectedCommand??null,summary:e.summary,schema_only:e.schemaOnly,flags_only:e.flagsOnly,availability_only:e.availabilityOnly,runtime_only:e.runtimeOnly,command_scoped:e.selectedCommand!==void 0},commands:e.summary?[]:r,...!e.summary&&!e.flagsOnly?{actions:n.actions,action_availability:n.actionAvailability}:{}}}function vS(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=tp);let r=n.selectedCommand;e.runtime_schema={statuses:t.statusRegistry.definitions.map(o=>o.id),open_status:t.statusRegistry.open_status,close_status:t.statusRegistry.close_status,canceled_status:t.statusRegistry.canceled_status,types:[...t.typeRegistry.types],fields_by_command:Object.fromEntries([...t.runtimeFieldRegistry.command_to_fields.entries()].filter(([o])=>r===void 0||o===r).map(([o,i])=>[o,[...new Set(i.map(s=>`--${s.cli_flag}`))].sort((s,a)=>s.localeCompare(a))]))},!(r!==void 0&&!n.fullOutput)&&(e.extension_contracts={capabilities:[...bu],services:[...ku],policy_modes:[...Su],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...Tu],trust_modes:[...Eu],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...Au],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...xd],create_modes:[...Pd],close_validation_modes:[...Nd],workflow_enforcement_modes:[...Ld]},e.relationship_kind_contracts=[...Dd,...(t.runtimeProbe.registrations?.relationship_kinds??[]).flatMap(o=>o.definitions)].sort((o,i)=>o.kind.localeCompare(i.kind)).map(o=>({canonical:o.kind,aliases:[...o.aliases??[]],...o.inverse===void 0?{}:{inverse:o.inverse},ordering:o.ordering,hierarchy:o.hierarchy})))}function wS(e,t,n,r){if(!(t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredSchema){e.schema=n.filteredSchema,e.extension_commands=r;return}e.schema_omitted_reason="unfiltered_default_brief",e.extension_commands=r}}function bS(e,t,n,r,o){if(!(t.schemaOnly||t.availabilityOnly)){if(t.omitUnfilteredCommandFlags)e.command_flags_omitted_reason="unfiltered_default_brief";else{e.command_flags=Kk(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let i=new Set(r);e.list_projections=Object.entries(op).filter(([s])=>i.has(s)).map(([s,a])=>({command:s,default:a,brief_fields:[...rp],compact_fields:[...np]}))}e.command_aliases=t.fullOutput?o:o.map(({canonical:i,aliases:s})=>({canonical:i,aliases:s})),t.fullOutput||(e.command_alias_contracts_omitted_reason="compact_projection; restore with --full")}}function kS(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=Bk();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function SS(e,t,n,r){e.command_summaries=fS(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...Nu],allows_unbounded_opt_out:!0},e.output_projection_contracts={global_ladder_field:"output_policy.degradation_ladder",global_ladder_scope:"union_not_per_command",discovery:"pm contracts --command <command> --summary",...r.includeProjectionModeMatrix?{commands:[...new Set(t.map(ye))].filter(o=>Oa(o)!==void 0).sort((o,i)=>o.localeCompare(i)).map(o=>({command:o,modes:[...$u(o).keys()]}))}:{}},e.grammar_contracts={nouns:Jt.nouns,shared_verbs:Jt.shared_verbs,scope_before_verb:Jt.scope_before_verb,visible_top_level_ceiling:Jt.visible_top_level_ceiling,ceiling_raise_requires_pm_item:Jt.ceiling_raise_requires_pm_item,positional_shape_budget:Jt.positional_shape_budget,positional_shape_count:new Set(fa.map(({slots:o})=>om(o))).size,positional_action_count:pa.length,positional_action_parents:[...new Set(pa.map(({parent:o})=>o))].sort((o,i)=>o.localeCompare(i)),...r.includePositionalSignatures?{positional_signatures:fa}:{}}}async function _c(e,t){let n=Wk(e);Yk(n);let r=E(process.cwd(),t.path),o=await Xk(t,r,n),i=iS(n,o),s=cS(n,o,i),a=lS(n,i),c=dS(n,a,o.extensionContracts),m=yS(n,s,i,c),u=gS(n,o,c),p=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&SS(m,c,u,{includeFormatBudgets:p,includeIntentProvenance:p,includePositionalSignatures:p,includeProjectionModeMatrix:p}),n.summary)return m;let f=zk(i.commandCatalog.filter(_=>Mi(n,_,o.extensionContracts)));return n.flagsOnly&&!n.fullOutput||vS(m,o,n),wS(m,n,s,u),bS(m,n,o,c,f),kS(m,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(m.assurance_contracts={measurement_source_kinds:[...Zp],gate_triggers:[...Qp]}),n.fullOutput&&m.grammar_contracts&&(m.grammar_contracts.destinations=mo.map(_=>({..._,reason:_.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(m.mcp_tools=x_(),m.context_intents=Du(),m.read_output_dimensions=Ra,m.error_codes=Xu,m.command_output_contracts=_S(c),m.diagnostic_output_contracts=Lu,m.command_exit_contracts={vocabulary:Yu,command_sets:hS(c)}),m}import{readFile as ES}from"node:fs/promises";import AS 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]="c64f304d-9081-5bad-8187-7bf6b65e4a07")}catch{}})();var hc="context-intents.json";function Di(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function TS(e,t,n){if(!Di(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let r=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(r)||!r.every(o=>typeof o=="string")||typeof e.token_budget!="number")throw new TypeError(`${t} context intent at index ${String(n)} has an invalid contract shape`);return{command:e.command,intent:e.intent,description:e.description,included_field_groups:r,token_budget:e.token_budget}}function Z_(e,t){let n=Array.isArray(e)?e:Di(e)&&Array.isArray(e.intents)?e.intents:void 0;if(!n)throw new TypeError(`${t} context intents must be an array or an object with an intents array`);return n.map((r,o)=>TS(r,t,o))}async function CS(e){let t=AS.join(e,hc),n;try{n=await ES(t,"utf8")}catch(o){if(Wt(o))return[];throw await Up(e),o}let r;try{r=JSON.parse(n)}catch(o){let i=o instanceof Error?o.message:String(o);throw new TypeError(`Invalid ${hc}: ${i}`,{cause:o})}return Z_(r,hc)}function IS(e){if(!Di(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return Di(n)?n.contextIntents??n.context_intents:void 0}function RS(e){return e.flatMap(t=>{let n=IS(t.module);return n===void 0?[]:Z_(n,`package ${t.name}`)})}async function OS(e){let t=await CS(e.pmRoot),n=RS(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function gc(e,t){let n=await OS(e);return await Uu(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c2766f4e-6354-55bb-9e40-676273ee901f")}catch{}})();async function eh(e,t,n=Mu){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let r=t,o=Array.isArray(r.warnings)?r.warnings.filter(i=>typeof i=="string"):[];r.warnings=[...new Set([...o,"context_usage_feedback_write_failed"])].sort()}}}(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]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var yc="PmCliError";function xS(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=d.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function th(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new l(e,xS(t.exitCode??d.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function Ui(e){if(!(e instanceof Error)||e.name!==yc)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}(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]="3113ad4b-282a-50af-a836-8e9abfde7d7e")}catch{}})();function vc(e){let t=Ud();for(let n of e)t.register(n);return t}function nh(e,t){return{client:t,isItemNotFoundError:n=>Ui(n)&&n.exitCode===d.NOT_FOUND,getItemAt:(n,r)=>ef(n,r,{pmRoot:e}),openRelationshipEventStore:n=>nf.open({pmRoot:e,nodes:n.nodes,registry:vc(n.definitions),...n.relativePath===void 0?{}:{relativePath:n.relativePath}}),createRelationshipGraph:n=>new jd(n.nodes,n.edges,vc(n.definitions)),analyzeRelationshipImpact:(n,r,o)=>rf(n,r,o),validateRelationshipEvents:n=>{let r=new tf(n.nodes,{registry:vc(n.definitions)});return n.events.map(o=>r.append({...o,expectedVersion:r.version}))},commitWorkspaceTransaction:n=>of({...n,pmRoot:e})}}import PS from"node:fs/promises";import X from"node:path";import NS from"node:readline/promises";import{stdin as LS,stdout as Me}from"node: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]="231597cc-2166-5029-9b3a-476587a33941")}catch{}})();var bc=Symbol.for("pm.sdk.init-invocation-cwd");var $S=()=>NS.createInterface({input:LS,output:Me});function FS(){return structuredClone(At)}var MS=["minimal","default","strict"];function oh(e){if(e===void 0)return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new l("--preset must not be empty",d.USAGE);if(t==="minimal"||t==="default"||t==="strict")return t;if(t==="lite"||t==="minimum")return"minimal";throw new l(`Invalid --preset value "${e}". Allowed: ${MS.join(", ")}`,d.USAGE)}function DS(e){if(e!==void 0){if(e.trim().length===0)throw new l("--type-preset must not be empty",d.USAGE);try{return cu(e)}catch{throw new l(`Invalid --type-preset value "${e}". Allowed: ${au.join(", ")}`,d.USAGE)}}}function US(e){if(e===void 0)return;let t=e.trim();if(t.length===0)throw new l("--author must not be empty",d.USAGE);return t}function wc(e){if(e===void 0)return!1;let t=e.trim();return t.length===0?!1:X.isAbsolute(t)||/^[a-z]:/iu.test(t)||t.startsWith(".")||t.includes("/")||t.includes("\\")}function GS(e,t,n,r){let o=r?.trim();if(r!==void 0&&o?.length===0)throw new l("--workspace must not be empty",d.USAGE);if(o!==void 0){if(t.path!==void 0||wc(n))throw new l("--workspace cannot be combined with --pm-path/--path or a path-like positional target.",d.USAGE);let m=X.resolve(e,o),u=X.join(m,".agents","pm");return{pmRoot:u,prefixArg:n,target:{mode:"workspace-path",tracker_root:u,workspace_root:m}}}if(t.path===void 0&&wc(n)){let m=X.resolve(e,n.trim());return{pmRoot:m,prefixArg:void 0,target:{mode:"tracker-path",tracker_root:m}}}let i=E(e,t.path),s=X.join(X.resolve(e),".agents","pm"),a=X.dirname(X.dirname(i)),c=X.resolve(i)===s?"current":"ancestor";return{pmRoot:i,prefixArg:n,target:t.path===void 0?{mode:"workspace-discovery",tracker_root:i,workspace_root:a,discovery:c,requested_cwd:X.resolve(e),...c==="ancestor"?{suggested_current_tracker_root:s}:{}}:{mode:"tracker-path",tracker_root:i}}}function jS(e,t){if(t===void 0)return e;if(t.trim().length===0)throw new l("--id-prefix must not be empty",d.USAGE);if(wc(t))throw new l(`--id-prefix accepts an item ID prefix, not a tracker path: "${t}".`,d.USAGE,{code:"init_id_prefix_path_like",required:"Pass the tracker path positionally or with the global --path option.",examples:[`pm init ${t}`,`pm --path ${t} init`]});if(e!==void 0&&$t(e)!==$t(t))throw new l(`Conflicting id prefixes: positional "${e}" and --id-prefix "${t}".`,d.USAGE,{code:"init_id_prefix_conflict",required:"Use either the positional id prefix or --id-prefix with one value.",examples:[`pm init ${$t(e)}`,`pm init --id-prefix ${$t(t)}`]});return t}function qS(e){if(e===void 0)return"ask";let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new l("--agent-guidance must not be empty",d.USAGE);if(t==="ask"||t==="add"||t==="skip"||t==="status")return t;throw new l(`Invalid --agent-guidance value "${e}". Allowed: ${Cf.join(", ")}`,d.USAGE)}function KS(e,t){let n=e.trim().toLowerCase();return n.length===0?t:n==="y"||n==="yes"?!0:n==="n"||n==="no"?!1:t}function ih(e,t){let n=Md[t];e.governance={preset:t,...n},e.validation.parent_reference=n.parent_reference,e.validation.metadata_profile=n.metadata_profile}function zS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function BS(e){let t=e.details;return{installed_all:t.installed_all===!0,installed_count:typeof t.installed_count=="number"?t.installed_count:0,packages:Array.isArray(t.packages)?t.packages.filter(zS).map(n=>({alias:typeof n.alias=="string"?n.alias:"",ok:n.ok===!0})):[]}}async function HS(e,t,n){let r=jo(t.schema),o=ut(e,r.files.types,mt.types),s=iu(await Z(o)),a=[],c=[];for(let m of lu(n)){let u=su(s,m);s=u.file,(u.replaced?c:a).push(u.definition.name)}return await nt({pmRoot:e,filePath:o,raw:Uo(s),op:"init:type-preset",author:C(void 0,t.author_default),lockTtlSeconds:t.locks.ttl_seconds,lockWaitMs:t.locks.wait_ms}),{name:n,registered:a,updated:c,file:o}}async function VS(e){let t=[".git","package.json","pnpm-workspace.yaml","AGENTS.md",X.join(".agents","pm")];for(let n of t)if(await G(X.join(e,n)))return!0;return!1}async function WS(e,t,n){if(!t||n||await G(X.join(e,"settings.json"))||!await VS(e))return;let r=X.join(e,".agents","pm");throw new l(`Refusing to initialize tracker files directly in workspace root "${e}".`,d.USAGE,{code:"workspace_root_pm_path",type:"urn:pm-cli:error:workspace_root_pm_path",why:"Path-like init targets and --pm-path/--path point at the tracker storage directory itself, not the repository workspace. Point at .agents/pm, use --workspace, or pass --force if you intentionally want root-level tracker files.",examples:[`pm --pm-path ${r} init --yes`,"pm init --yes",`pm --pm-path ${e} init --yes --force`],nextSteps:["Use --pm-path <repo>/.agents/pm for repository-local tracker storage.","Use PM_PATH only for sandboxed tests or explicit tracker roots.","Pass --force only when root-level tracker files are intentional."],recovery:{next_best_command:`pm --pm-path ${r} init --yes`}})}async function sh(e,t){let n=[],r=[];for(let o of t){let i=o?X.join(e,o):e,s=await G(i);await PS.mkdir(i,{recursive:!0}),s?r.push(`already_exists:${i}`):n.push(i),r.push(...await J({path:i,scope:"project",op:"init:ensure_dir"}))}return{createdDirs:n,warnings:r}}async function YS(e,t){let n=$S();try{Me.write(`pm init setup wizard (agent-optimized)
2
2
  `),Me.write(`This walkthrough is non-destructive and each choice can be changed later with pm config.
3
3
 
4
4
  `),Me.write(`1/3 Item ID prefix
@@ -32,5 +32,5 @@ import{n as du,o as Go,p as _u,q as hu,r as ha,s as Ko,t as gu,u as ga,v as zo,y
32
32
  `);return _N.some(n=>n.test(t))||t.split(/\r?\n/u).some(n=>hN.test(n)&&gN.test(n))}function XN(e){return JN(e)?"infra_collision":e.timedOut?"timeout":e.maxBufferExceeded?"max_buffer":e.spawnError?"spawn_error":e.signal?"signal":"assertion_failure"}function QN(){return{infra_collision:0,trust_refusal:0,assertion_failure:0,empty_run:0,timeout:0,max_buffer:0,spawn_error:0,signal:0}}function Ds(e){let t=QN();for(let n of e)n.status!=="failed"||!n.failure_category||(t[n.failure_category]+=1);return t}function ew(e,t){for(let[n,r]of Object.entries(t.env_set))an.has(n.toUpperCase())||(e[n]=r);for(let n of t.env_clear)an.has(n.toUpperCase())||delete e[n]}function ZN(e){e.PORT===void 0&&(e.PORT="0"),e.HOST===void 0&&(e.HOST="127.0.0.1"),e.PM_SHARED_HOST_SAFE===void 0&&(e.PM_SHARED_HOST_SAFE="1"),e.PLAYWRIGHT_HTML_OPEN===void 0&&(e.PLAYWRIGHT_HTML_OPEN="never"),e.PW_TEST_HTML_REPORT_OPEN===void 0&&(e.PW_TEST_HTML_REPORT_OPEN="never")}function eL(e,t){let n={...e.env_set,...t.env_set},r=[...new Set([...e.env_clear,...t.env_clear??[]])],o=t.shared_host_safe??e.shared_host_safe;return{env_set:n,env_clear:r,shared_host_safe:o}}function tL(e,t,n){return{env_set:IN(e,"--env-set"),env_clear:RN(t,"--env-clear"),shared_host_safe:n===!0}}async function Qn(e,t,n=!1,r=$s){if(await G(e))try{await rr("seed_linked_test",async()=>{if(await r(W.dirname(t),{recursive:!0}),n){await Xl(e,t,{recursive:!0,force:!0});return}await Xl(e,t,{force:!0})},{why:"Linked tests need an isolated PM context without mutating the source tracker.",nextSteps:["Reclaim capacity on the filesystem that hosts the linked-test temporary directory."]})}catch(o){if(typeof o=="object"&&o!==null&&"code"in o&&Ct(o))return;throw o}}async function tw(e,t,n){await Qn(ue(n.projectPmRoot),ue(e)),await Qn(W.join(n.projectPmRoot,"extensions"),W.join(e,"extensions"),!0),await Qn(ue(n.globalPmRoot),ue(t)),await Qn(W.join(n.globalPmRoot,"extensions"),W.join(t,"extensions"),!0)}async function nw(e,t){if(!await G(e))return;let n=await Zl(e,{withFileTypes:!0});for(let r of n){if(pN.has(r.name))continue;let o=W.join(e,r.name),i=W.join(t,r.name);if(r.isDirectory()){await Qn(o,i,!0);continue}r.isFile()&&await Qn(o,i)}}async function rw(e,t){let n=await Z(ue(e));if(n===null||await G(Ua(e)))return;let r=await A(t);await Jr(Ua(t),{force:!0}),await Jr(ue(t),{force:!0}),await nt({pmRoot:t,filePath:ue(t),raw:n,op:"settings:write",author:C(void 0,r.author_default),lockTtlSeconds:r.locks.ttl_seconds,lockWaitMs:r.locks.wait_ms,recordCreation:!0,message:"Seed linked-test tracker settings history"})}async function Xn(e){if(!await G(e))return 0;let t=0,n=await Zl(e,{withFileTypes:!0});for(let r of n){if(!r.isDirectory()||fN.has(r.name))continue;let o=W.join(e,r.name),i;try{i=await Zl(o,{withFileTypes:!0})}catch{continue}for(let s of i)s.isFile()&&Kd.some(a=>s.name.toLowerCase().endsWith(a))&&(t+=1)}return t}function nL(e){let t=typeof e.exitCode=="number"?e.exitCode:1;return(e.timedOut||e.maxBufferExceeded)&&t===0?1:t}function rL(e){let t=e.trim();if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return null;let n=Number(t);if(t.length>0&&Number.isFinite(n))return n;if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch{}return t}function oL(e,t){return typeof e=="object"&&e!==null&&typeof t=="object"&&t!==null?dt(e,t):Object.is(e,t)}function iL(e,t,n){let r=[];r.push(...ow("stdout",t,e.assert_stdout_contains)),r.push(...iw("stdout",t,e.assert_stdout_regex)),r.push(...ow("stderr",n,e.assert_stderr_contains)),r.push(...iw("stderr",n,e.assert_stderr_regex)),r.push(...sL(t,e.assert_stdout_min_lines));let o=e.assert_json_field_equals??{},i=e.assert_json_field_gte??{};if(!(Object.keys(o).length>0||Object.keys(i).length>0))return r;let a;try{a=JSON.parse(t)}catch(c){return r.push(`stdout is not valid JSON for assert_json_field_* checks: ${c instanceof Error?c.message:String(c)}`),r}for(let[c,m]of Object.entries(o)){let u=Wl(a,c);if(!u.found){r.push(`assert_json_field_equals missing path "${c}"`);continue}let p=rL(m);oL(u.value,p)||r.push(`assert_json_field_equals mismatch at "${c}" (expected=${JSON.stringify(p)} actual=${JSON.stringify(u.value)})`)}for(let[c,m]of Object.entries(i)){let u=Wl(a,c);if(!u.found){r.push(`assert_json_field_gte missing path "${c}"`);continue}if(typeof u.value!="number"||!Number.isFinite(u.value)){r.push(`assert_json_field_gte path "${c}" resolved to non-numeric value`);continue}u.value<m&&r.push(`assert_json_field_gte failed at "${c}" (expected >= ${m}, actual ${u.value})`)}return r}function ow(e,t,n){let r=[];for(let o of n??[])t.includes(o)||r.push(`${e} missing required text: "${o}"`);return r}function iw(e,t,n){let r=[];for(let o of n??[])try{new RegExp(o,"m").test(t)||r.push(`${e} failed regex assertion: /${o}/m`)}catch(i){r.push(`${e} regex assertion is invalid: /${o}/ (${i instanceof Error?i.message:String(i)})`)}return r}function sL(e,t){if(typeof t!="number")return[];let n=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0).length;return n<t?[`stdout line count ${n} is below required minimum ${t}`]:[]}var aL=[{code:"no_projects_matched_filters",regex:/\bNo projects matched the filters\b/i},{code:"no_test_files_found",regex:/\bNo test files found\b/i},{code:"no_tests_found",regex:/\bNo tests found\b/i},{code:"no_matching_tests",regex:/\bNo matching tests?\b/i},{code:"collected_zero_items",regex:/\bcollected 0 items?\b/i},{code:"reported_zero_passes",regex:/(?:^\s*(?:#|ℹ)?\s*tests\s+0\s*$[\s\S]*^\s*(?:#|ℹ)?\s*pass\s+0\s*$|^\s*(?:#|ℹ)?\s*pass\s+0\s*$[\s\S]*^\s*(?:#|ℹ)?\s*tests\s+0\s*$)/imu},{code:"reported_zero_tests",regex:/^\s*(?:#|ℹ)?\s*tests\s+0\s*$/imu}],cL=[/^\s*(?:#|ℹ)?\s*tests\s+[1-9]\d*\s*$/imu,/^\s*(?:#|ℹ)?\s*pass\s+[1-9]\d*\s*$/imu,/\bTests?\s+[1-9]\d*\s+passed\b/iu,/\b[1-9]\d*\s+passed\b/iu,/\bTests:\s+(?:.*\b)?[1-9]\d*\s+passed\b/iu];function lL(e,t){let n=`${e}
33
33
  ${t}`;for(let r of aL)if(r.regex.test(n))return{code:r.code};return null}function dL(e,t){let n=`${e}
34
34
  ${t}`;return cL.some(r=>r.test(n))}function sw(e){let t=Ms(e);return/(?:^|\s)(?:--test-name-pattern|--testnamepattern)(?:=|\s)/u.test(t)?!0:Cr(t).some(n=>/(?:^|\s)-t(?:=|\s)/u.test(n)&&kw(n))}function mL(e){return{root:e,schemaProjectPmPath:W.join(e,"schema","project",".agents","pm"),schemaGlobalPmPath:W.join(e,"schema","global"),trackerProjectPmPath:W.join(e,"tracker","project",".agents","pm"),trackerGlobalPmPath:W.join(e,"tracker","global"),workspaceSnapshotRoot:W.join(e,"workspace","project"),workspaceIsolatedRoot:W.join(e,"workspace","isolated")}}function uL(e,t,n){return e.some(r=>fw(r,t,n)==="snapshot")}async function pL(e,t){let n=new Set([".agents",".git",".nyc_output",".turbo","coverage","node_modules"]);await $s(W.dirname(e.workspaceSnapshotRoot),{recursive:!0}),await Xl(t,e.workspaceSnapshotRoot,{recursive:!0,force:!0,filter(o){let i=W.relative(t,o);return i?!i.split(W.sep).some(s=>n.has(s)):!0}});let r=W.join(t,"node_modules");await G(r)&&await uw(r,W.join(e.workspaceSnapshotRoot,"node_modules"),process.platform==="win32"?"junction":"dir")}async function fL(e,t){let n=W.join(e,".agents"),r=W.join(n,"pm");await $s(n,{recursive:!0}),await Jr(r,{recursive:!0,force:!0}),await uw(t,r,process.platform==="win32"?"junction":"dir")}async function _L(e,t=Nr,n=!0){let r={defaults:!0,agentGuidance:"skip"};await t(void 0,{path:e.schemaProjectPmPath},r),await t(void 0,{path:e.schemaGlobalPmPath},r),n&&(await t(void 0,{path:e.trackerProjectPmPath},r),await t(void 0,{path:e.trackerGlobalPmPath},r))}async function hL(e,t,n){t&&(await tw(e.schemaProjectPmPath,e.schemaGlobalPmPath,t),n&&(await tw(e.trackerProjectPmPath,e.trackerGlobalPmPath,t),await nw(t.projectPmRoot,e.trackerProjectPmPath),await nw(t.globalPmRoot,e.trackerGlobalPmPath),await rw(t.projectPmRoot,e.trackerProjectPmPath),await rw(t.globalPmRoot,e.trackerGlobalPmPath)))}function gL(e,t,n){return e.some(r=>{let o=r.command??"",i=o.length>0&&gw(o),s=n?.autoPmContext===!0&&i?"auto":_w(r,t,n?.overrideLinkedPmContext===!0);return hw(s,i)==="tracker"})}async function yL(e,t){return{sourceProjectItemCount:t?await Xn(t.projectPmRoot):0,sourceGlobalItemCount:t?await Xn(t.globalPmRoot):0,schemaProjectItemCount:await Xn(e.schemaProjectPmPath),schemaGlobalItemCount:await Xn(e.schemaGlobalPmPath),trackerProjectItemCount:await Xn(e.trackerProjectPmPath),trackerGlobalItemCount:await Xn(e.trackerGlobalPmPath)}}function vL(e){let t=e.effectivePmContextMode==="tracker",n=t?e.layout.trackerProjectPmPath:e.layout.schemaProjectPmPath,r=t?e.layout.trackerGlobalPmPath:e.layout.schemaGlobalPmPath,o=t?e.counts.trackerProjectItemCount:e.counts.schemaProjectItemCount,i=t?e.counts.trackerGlobalItemCount:e.counts.schemaGlobalItemCount,s=e.workspaceContextMode==="snapshot"?e.layout.workspaceSnapshotRoot:e.workspaceContextMode==="isolated"?e.layout.workspaceIsolatedRoot:e.sourceWorkspaceRoot,a=e.workspaceContextMode==="isolated"?"":s;return{requested_pm_context_mode:e.requestedPmContextMode,pm_context_mode:e.effectivePmContextMode,auto_pm_context_applied:e.autoPmContextApplied,is_pm_command:e.isPmCommand,is_pm_tracker_read_command:e.isPmTrackerReadCommand,source_project_pm_path:e.sourceRoots?.projectPmRoot??"",sandbox_project_pm_path:n,source_global_pm_path:e.sourceRoots?.globalPmRoot??"",sandbox_global_pm_path:r,source_project_item_count:e.counts.sourceProjectItemCount,sandbox_project_item_count:o,source_global_item_count:e.counts.sourceGlobalItemCount,sandbox_global_item_count:i,mismatch_detected:e.isPmCommand&&(e.counts.sourceProjectItemCount!==o||e.counts.sourceGlobalItemCount!==i),project_extensions_seeded:!!e.sourceRoots,global_extensions_seeded:!!e.sourceRoots,requested_workspace_context_mode:e.requestedWorkspaceContextMode,workspace_context_mode:e.workspaceContextMode,working_directory:s,source_workspace_root:a,trust:e.trust}}async function wL(e){let t=typeof e.linkedTest.pm_context_mode=="string"&&e.linkedTest.pm_context_mode.trim().length>0?Fs(e.linkedTest.pm_context_mode):void 0,n=typeof e.linkedTest.command=="string"&&e.linkedTest.command.length>0?e.linkedTest.command:void 0,r=n?ON(n):!1,o=r&&n?gw(n):!1,i=e.options?.autoPmContext===!0&&o,s=i?"auto":_w(e.linkedTest,e.runLevelPmContextMode,e.options?.overrideLinkedPmContext===!0),a=hw(s,o),c=a==="tracker"?e.layout.trackerProjectPmPath:e.layout.schemaProjectPmPath;e.workspaceContextMode==="snapshot"&&await fL(e.layout.workspaceSnapshotRoot,c);let m=e.options?.pmRoot?await sc(e.options.pmRoot,e.linkedTest,e.currentSourceRef):await sc(e.layout.root,e.linkedTest,e.currentSourceRef);return{linkedOverridePmContextMode:t,executionContext:vL({layout:e.layout,counts:e.counts,sourceRoots:e.sourceRoots,isPmCommand:r,isPmTrackerReadCommand:o,requestedPmContextMode:s,effectivePmContextMode:a,autoPmContextApplied:i,requestedWorkspaceContextMode:e.requestedWorkspaceContextMode,workspaceContextMode:e.workspaceContextMode,sourceWorkspaceRoot:e.sourceWorkspaceRoot,trust:m})}}function aw(e,t,n){return{command:e.command,path:e.path,status:"skipped",execution_context:t,error:n}}function td(e,t,n,r){return{command:e.command,path:e.path,status:"failed",exit_code:1,failure_category:"assertion_failure",execution_context:t,...r?{stdout:r.stdout,stderr:r.stderr}:{},error:n}}function bL(e,t,n){return{command:e.command,path:e.path,status:"failed",exit_code:1,failure_category:"trust_refusal",execution_context:t,error:n}}function kL(e){if(e.executionContext.trust.trusted)return null;let t=e.options?.allowUntrustedLinkedTests===!0,n=e.options?.untrustedLinkedTestsPolicyEnabled===!0;if(t&&n)return null;let r=n?"Retry with --allow-untrusted-linked-tests for this invocation, or acknowledge the current commands with --acknowledge-linked-tests.":"Set testing.allow_untrusted_linked_tests=true, then retry with --allow-untrusted-linked-tests; alternatively acknowledge the current commands with --acknowledge-linked-tests.";return bL(e.linkedTest,e.executionContext,`Linked test command is not trusted by this clone (source_ref=${e.executionContext.trust.source_ref??"unknown"}, current_ref=${e.executionContext.trust.current_source_ref??"unknown"}). ${r}`)}function SL(e){if(!e.linkedTest.command)return aw(e.linkedTest,e.executionContext,"No command configured for this linked test.");let t=LN(e.linkedTest.command);return t?aw(e.linkedTest,e.executionContext,t):null}function EL(e){let t=SL(e);if(t)return t;let n=kL(e);if(n)return n;let r=e.executionContext.pm_context_mode==="schema"&&e.executionContext.is_pm_tracker_read_command&&e.executionContext.mismatch_detected,o=e.options?.failOnContextMismatch===!0&&e.executionContext.is_pm_command&&e.executionContext.mismatch_detected;if(r||o){let i=CN({executionContext:e.executionContext,runLevelPmContextMode:e.runLevelPmContextMode,linkedOverridePmContextMode:e.linkedOverridePmContextMode}),s=e.options?.checkContext===!0?"Linked test preflight PM context mismatch detected":"Linked test PM context mismatch detected";return td(e.linkedTest,e.executionContext,`${s} (source_project_items=${e.executionContext.source_project_item_count}, sandbox_project_items=${e.executionContext.sandbox_project_item_count}).${i}`)}return e.options?.requireAssertionsForPm===!0&&e.executionContext.is_pm_command&&!TN(e.linkedTest)?td(e.linkedTest,e.executionContext,"Linked PM command requires assertions when --require-assertions-for-pm is enabled."):null}function AL(e){let t=eL(e.runtimeDirectives,e.linkedTest),n={...process.env,SENTRY_ENVIRONMENT:"test"};return ew(n,e.runtimeDirectives),ew(n,{env_set:e.linkedTest.env_set??{},env_clear:e.linkedTest.env_clear??[]}),t.shared_host_safe&&ZN(n),n.FORCE_COLOR="0",n.PM_PATH=e.executionContext.sandbox_project_pm_path,n.PM_GLOBAL_PATH=e.executionContext.sandbox_global_pm_path,e.executionContext.workspace_context_mode==="isolated"?(delete n.PM_SOURCE_WORKSPACE_ROOT,delete n.PM_SOURCE_PM_PATH,delete n[Er]):(n.PM_SOURCE_WORKSPACE_ROOT=e.executionContext.source_workspace_root,n.PM_SOURCE_PM_PATH=e.executionContext.workspace_context_mode==="snapshot"?e.executionContext.sandbox_project_pm_path:e.executionContext.source_project_pm_path,n[Er]="read_only"),n}function TL(e,t,n){return{command:e.command,path:e.path,status:"passed",exit_code:0,execution_context:t,stdout:n.stdout,stderr:n.stderr}}function cw(e){return{command:e.linkedTest.command,path:e.linkedTest.path,status:"failed",exit_code:1,failure_category:"empty_run",execution_context:e.executionContext,stdout:e.execution.stdout,stderr:e.execution.stderr,error:`Linked test reported an empty test run (${e.emptyRunSignal.code}). Update the test selection so at least one test executes; unfiltered commands may opt out by omitting --fail-on-empty-test-run.`}}function CL(e){return{command:e.linkedTest.command,path:e.linkedTest.path,status:"failed",exit_code:nL(e.execution),failure_category:XN(e.execution),execution_context:e.executionContext,stdout:e.execution.stdout,stderr:e.execution.stderr,error:YN(e.execution,e.timeoutMs)}}function IL(e){if(e.options?.failOnEmptyTestRun===!0||sw(e.linkedTest.command??"")){let n=lL(e.execution.stdout,e.execution.stderr);if(n)return cw({...e,emptyRunSignal:n});if(sw(e.linkedTest.command??"")&&!dL(e.execution.stdout,e.execution.stderr))return cw({...e,emptyRunSignal:{code:"missing_positive_execution_receipt"}})}let t=iL(e.linkedTest,e.execution.stdout,e.execution.stderr);return t.length>0?td(e.linkedTest,e.executionContext,`Linked test assertion(s) failed: ${t.join("; ")}`,e.execution):TL(e.linkedTest,e.executionContext,e.execution)}async function RL(e){let t=e.linkedTest.command??"",n=(e.linkedTest.timeout_seconds??e.defaultTimeoutSeconds??120)*1e3,r=await WN(t,n,AL(e),{index:e.index+1,total:e.total,timeoutMs:n,command:t},e.progressMode,e.executionContext.working_directory);return r.exitCode===0&&!r.timedOut&&!r.maxBufferExceeded?IL({...e,execution:r}):CL({...e,execution:r,timeoutMs:n})}async function od(e,t,n){let r=[],o=await mw(W.join(pw(),"pm-linked-test-")),i=mL(o),s=Fs(n?.pmContext),a=AN(n?.workspaceContext),c=n?.progress===!0?"always":"auto",m=tL(n?.envSet,n?.envClear,n?.sharedHostSafe),u=n?.sourceRoots,p=p_(),f=gL(e,s,n),_=uL(e,a,n?.overrideLinkedWorkspaceContext===!0),h=await u_(p);try{await _L(i,Nr,f),await $s(i.workspaceIsolatedRoot,{recursive:!0}),await hL(i,u,f),_&&await pL(i,p);let y=await yL(i,u);for(let g=0;g<e.length;g+=1){let v=e[g],b=fw(v,a,n?.overrideLinkedWorkspaceContext===!0),k=await wL({linkedTest:v,layout:i,counts:y,sourceRoots:u,runLevelPmContextMode:s,options:n,requestedWorkspaceContextMode:a,workspaceContextMode:b,currentSourceRef:h,sourceWorkspaceRoot:p}),T=EL({linkedTest:v,executionContext:k.executionContext,runLevelPmContextMode:s,linkedOverridePmContextMode:k.linkedOverridePmContextMode,options:n});if(T){r.push(T);continue}r.push(await RL({linkedTest:v,index:g,total:e.length,defaultTimeoutSeconds:t,runtimeDirectives:m,progressMode:c,executionContext:k.executionContext,options:n}))}}finally{await Jr(i.root,{recursive:!0,force:!0,maxRetries:3,retryDelay:100})}return r}async function OL(e){let{id:t,pmRoot:n,settings:r,typeToFolder:o}=e,i=await q(n,t,r.id_prefix,r.item_format,o);if(!i)throw new l(`Item ${t} not found`,d.NOT_FOUND);let s=await oe(i,{schema:r.schema});return{itemId:i.id,tests:s.document.metadata.tests??[],testRuns:s.document.metadata.test_runs??[],changed:!1,removed:0}}function xL(e,t){return e.command===t.command&&e.path===t.path&&e.scope===t.scope&&e.pm_context_mode===t.pm_context_mode&&e.workspace_context_mode===t.workspace_context_mode}function PL(e,t){let n=[...e];for(let r of t)n.some(o=>xL(o,r))||n.push(r);return n}function NL(e,t,n){if(t.length===0&&n.length===0)return{tests:e,removed:0};let r=new Set(n),o=e.filter((i,s)=>r.has(s+1)?!1:!t.some(a=>a.kind==="command"?i.command===a.value:a.kind==="path"?i.path===a.value:i.command===a.value||i.path===a.value));return{tests:o,removed:e.length-o.length}}function LL(e,t,n,r){return NL(PL(e,t),n,r)}function $L(e){return[(e.envSet?.length??0)>0,(e.envClear?.length??0)>0,e.sharedHostSafe===!0,e.pmContext!==void 0,e.overrideLinkedPmContext===!0,e.failOnContextMismatch===!0,e.failOnSkipped===!0,e.failOnEmptyTestRun===!0,e.requireAssertionsForPm===!0,e.checkContext===!0,e.autoPmContext===!0,e.workspaceContext!==void 0,e.overrideLinkedWorkspaceContext===!0,e.allowUntrustedLinkedTests===!0].some(Boolean)}function FL(e){if($L(e)&&e.run!==!0)throw new l("--env-set, --env-clear, --shared-host-safe, --pm-context, --override-linked-pm-context, --workspace-context, --override-linked-workspace-context, --allow-untrusted-linked-tests, --fail-on-context-mismatch, --fail-on-skipped, --fail-on-empty-test-run, --require-assertions-for-pm, --check-context, and --auto-pm-context require --run",d.USAGE);if(e.acknowledgeLinkedTests===!0&&e.run===!0)throw new l("--acknowledge-linked-tests records trust without executing commands; run it separately before --run",d.USAGE);if((e.match!==void 0||e.onlyIndex!==void 0||e.onlyLast===!0)&&e.run!==!0)throw new l("--match, --only-index, and --only-last require --run",d.USAGE)}async function ML(e){let{id:t,options:n,pmRoot:r,settings:o,typeToFolder:i,adds:s,removes:a,removeIndexes:c}=e;if(s.length===0&&a.length===0&&c.length===0)return OL({id:t,pmRoot:r,settings:o,typeToFolder:i});let m=0,u=await ie({pmRoot:r,settings:o,id:t,op:s.length>0?"tests_add":"tests_remove",author:C(n.author,o.author_default),message:n.message,force:n.force,skipNoop:!0,mutate(p){let f=p.metadata.tests??[],_=LL(f,s,a,c);if(m=_.removed,(a.length>0||c.length>0)&&m===0)throw new l("No linked tests matched the requested removal selector",d.NOT_FOUND,{code:"linked_test_remove_no_match",unmatched:[...a.map(h=>`${h.kind}=${h.value}`),...c.map(h=>`index=${h}`)],required:"List linked tests and retry with an exact command/path or a current 1-based --remove-index.",examples:[`pm test ${t} --list`,`pm test ${t} --remove-index 1`]});return p.metadata.tests=_.tests,{changedFields:dt(f,_.tests)?[]:["tests"]}}});return{itemId:u.item.id,tests:u.item.tests??[],testRuns:u.item.test_runs??[],changed:u.changedFields.length>0,removed:m}}function DL(e,t){FL(e);let n={match:e.match,onlyIndex:e.onlyIndex===void 0?void 0:Yl(e.onlyIndex),onlyLast:e.onlyLast},r=e.run===!0?Yv(t,n):void 0,o=e.timeout===void 0?void 0:pe(e.timeout,"timeout");if(o!==void 0&&o<=0)throw new l("Test timeout must be a positive number",d.USAGE);return{defaultTimeoutSeconds:o,pmContextMode:Fs(e.pmContext),runSelection:r,testsToRun:r?.selected??t}}async function UL(e){let{options:t,runOptions:n,pmRoot:r}=e;return t.run!==!0?[]:await od(n.testsToRun,n.defaultTimeoutSeconds,{progress:t.progress,envSet:t.envSet,envClear:t.envClear,sharedHostSafe:t.sharedHostSafe,pmContext:n.pmContextMode,overrideLinkedPmContext:t.overrideLinkedPmContext,failOnContextMismatch:t.failOnContextMismatch,failOnEmptyTestRun:t.failOnEmptyTestRun,requireAssertionsForPm:t.requireAssertionsForPm,checkContext:t.checkContext,autoPmContext:t.autoPmContext,workspaceContext:t.workspaceContext,overrideLinkedWorkspaceContext:t.overrideLinkedWorkspaceContext,pmRoot:r,allowUntrustedLinkedTests:t.allowUntrustedLinkedTests,untrustedLinkedTestsPolicyEnabled:e.untrustedLinkedTestsPolicyEnabled,sourceRoots:{projectPmRoot:r,globalPmRoot:ct(process.cwd())}})}function GL(e,t,n){let r=[];if(t&&t.selector!==null&&r.push(`linked_test_selection:${t.selector}=${t.requested};selected=${t.selected_count};skipped=${t.skipped_count};indexes=${t.selected_indexes.join(",")}`),e.run===!0&&e.checkContext===!0){let o=rd(n);r.push(`context_preflight:checked_pm_commands=${o.checked_pm_commands};tracker_read_commands=${o.tracker_read_commands};mismatches=${o.mismatches};auto_remediated=${o.auto_remediated}`)}return r}function jL(e){let t=SN(e.runResults),n=Number.parseInt(process.env.PM_BACKGROUND_TEST_RUN_ATTEMPT?.trim()??"",10),r=process.env.PM_BACKGROUND_TEST_RUN_RESUMED_FROM?.trim(),o=S(),i=Yr(e.options.measure,o);return{run_id:kN("test"),kind:"test",status:t.failed>0||e.failOnSkippedTriggered?"failed":"passed",started_at:e.runStartedAt,finished_at:o,recorded_at:o,attempt:Number.isFinite(n)&&n>=1?n:void 0,resumed_from:r&&r.length>0?r:void 0,passed:t.passed,failed:t.failed,skipped:t.skipped,fail_on_skipped_triggered:e.failOnSkippedTriggered?!0:void 0,measurements:i.length>0?i:void 0,executions:e.runResults.filter(s=>s.command?.trim()).slice(0,32).map(s=>({command:s.command.trim(),requested_pm_context_mode:s.execution_context?.requested_pm_context_mode,pm_context_mode:s.execution_context?.pm_context_mode,workspace_context_mode:s.execution_context?.workspace_context_mode,trust_reason:s.execution_context?.trust.reason}))}}async function qL(e){let{options:t,pmRoot:n,settings:r,itemId:o,runStartedAt:i,runResults:s,failOnSkippedTriggered:a,warnings:c}=e;if(t.run!==!0||!i)return;let m=jL({options:t,runStartedAt:i,runResults:s,failOnSkippedTriggered:a});if(r.testing.record_results_to_items!==!0)return m;try{return await xs({pmRoot:n,settings:r,itemId:o,author:C(t.author,r.author_default),message:`Track test run summary (${m.run_id})`,entry:m}),m}catch(u){return c.push(`test_result_tracking_failed:${o}:${u instanceof Error?u.message:String(u)}`),m}}function lw(e,t,n){let r;if(e.metricBelow!==void 0){let o=e.metricBelow.indexOf("="),i=e.metricBelow.slice(0,o).trim(),s=e.metricBelow.slice(o+1).trim(),a=Number(s);if(o<=0||i.length===0||s.length===0||!Number.isFinite(a))throw new l("--metric-below must use name=value",d.USAGE);r=Pv(t,i,a)}return{measurements:n?.measurements,metric_below:r,metric_diff:e.metricDiff===void 0?void 0:Nv(t,e.metricDiff)}}async function KL(e,t,n){if(e.acknowledgeLinkedTests===!0)return f_(t,n,S())}async function Us(e,t,n){let r=Lt(),o=E(process.cwd(),n.path);await I(o);let i=await A(o);if((t.measure?.length??0)>0&&t.run!==!0)throw new l("--measure requires --run",d.USAGE);Yr(t.measure,"validation"),lw(t,[],void 0);let s=x(i,O()),a=await r.resolveList(t.add,"--add"),c=await r.resolveList(t.addJson,"--add-json"),m=await r.resolveList(t.remove,"--remove"),u=[...$N(a),...DN(c)],p=await jn(u,C(t.author,i.author_default),S())??[],f=UN(m),_=GN(t.removeIndex),h=await ML({id:e,options:t,pmRoot:o,settings:i,typeToFolder:s.type_to_folder,adds:p,removes:f,removeIndexes:_}),y=DL(t,h.tests),g=await KL(t,o,h.tests),v=t.run===!0?S():void 0,b=await UL({options:t,runOptions:y,pmRoot:o,untrustedLinkedTestsPolicyEnabled:i.testing.allow_untrusted_linked_tests}),k=Ds(b),T=t.run===!0&&t.failOnSkipped===!0&&b.some(z=>z.status==="skipped"),R=GL(t,y.runSelection,b);g&&R.push(`linked_test_trust_acknowledged:${g.acknowledged}`);let L=await qL({options:t,pmRoot:o,settings:i,itemId:h.itemId,runStartedAt:v,runResults:b,failOnSkippedTriggered:T,warnings:R}),$=L?Vl([...h.testRuns,L]):h.testRuns,K=lw(t,$,L);return{ok:b.every(z=>z.status!=="failed")&&T!==!0,id:h.itemId,tests:h.tests,run_results:b,failure_categories:k,selection:y.runSelection?{selector:y.runSelection.selector,requested:y.runSelection.requested,selected_indexes:y.runSelection.selected_indexes,selected_count:y.runSelection.selected_count,skipped_count:y.runSelection.skipped_count}:void 0,fail_on_skipped_triggered:T?!0:void 0,warnings:R.length>0?R:void 0,changed:h.changed,count:h.tests.length,...h.removed>0?{removed:h.removed}:{},...K}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e3e3a1d4-4552-5f3c-9b02-c33ae72ea32b")}catch{}})();var zL=(e,t)=>{if(e===void 0)return;let n=ee(e,t);if(!n){let r=t.definitions.map(o=>o.id);throw new l(`Invalid --status value "${e}". Allowed: ${r.join(", ")}`,d.USAGE)}return n},BL=e=>{if(e===void 0)return;let t=pe(e,"timeout");if(t<=0)throw new l("timeout must be a positive number",d.USAGE);return t},Aw=(e,t)=>{if(e===void 0)return;let n=Number(e);if(!Number.isInteger(n)||n<0)throw new l(`${t} must be a non-negative integer`,d.USAGE);return n},HL=e=>e instanceof Error?e.message:String(e),VL=()=>{let e=process.env.PM_BACKGROUND_TEST_RUN_ID?.trim();return e&&e.length>0?e:`test-all-local-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`},WL=e=>e.trim().replaceAll(/\s+/g," "),YL=e=>!e||Object.keys(e).length===0?"{}":JSON.stringify(Object.fromEntries(Object.entries(e).sort(([t],[n])=>t.localeCompare(n)))),JL=e=>!e||e.length===0?"[]":JSON.stringify([...e].sort((t,n)=>t.localeCompare(n))),XL=e=>{let t=e?.trim().toLowerCase();return t&&t.length>0?t:"none"},QL=e=>{let t=e?.trim().toLowerCase();return t&&t.length>0?t:"source"},Gs=e=>[...new Set(e??[])].sort((t,n)=>t.localeCompare(n)),Tw=e=>Object.fromEntries(Object.entries(e??{}).sort(([t],[n])=>t.localeCompare(n))),ZL=e=>typeof e=="number"?e:void 0,e$=e=>{let t={assert_stdout_contains:Gs(e.assert_stdout_contains),assert_stdout_regex:Gs(e.assert_stdout_regex),assert_stderr_contains:Gs(e.assert_stderr_contains),assert_stderr_regex:Gs(e.assert_stderr_regex),assert_stdout_min_lines:ZL(e.assert_stdout_min_lines),assert_json_field_equals:Tw(e.assert_json_field_equals),assert_json_field_gte:Tw(e.assert_json_field_gte)};return JSON.stringify(t)},t$=e=>{let t=id(e.command);return t!==void 0?`command:${e.scope}:${WL(t)}`:`path:${e.scope}:${id(e.path)??""}`},Cw=e=>{let t=YL(e.env_set),n=JL(e.env_clear),r=XL(e.pm_context_mode),o=QL(e.workspace_context_mode),i=e.shared_host_safe===!0?"true":"false",s=e$(e);return`${t$(e)}:${t}:${n}:${r}:${o}:${i}:${s}`},n$=(e,t)=>t===void 0?e:e===void 0||t>e?t:e,r$=e=>{let t=0,n=0,r=0;for(let o of e){if(o.status==="passed"){t+=1;continue}if(o.status==="failed"){n+=1;continue}r+=1}return{passed:t,failed:n,skipped:r}},o$=(e,t)=>{for(let[n,r]of Object.entries(t))e[n]+=r},js=(e,t)=>{if(e.progress===!0)try{process.stderr.write(`[pm test-all] ${t}
35
- `)}catch{}},i$=async(e,t,n)=>{let r=[],o=0;for(let i of e){let s=await Us(i.id,{run:!1},{...t,path:n});o+=s.tests.length,r.push({item:i,tests:s.tests})}return{itemTests:r,linkedTests:o}},s$=async e=>{let t=F(e.settings.schema),n=x(e.settings,O()),r=zL(e.options.status,t),o=Aw(e.options.limit,"--limit"),i=Aw(e.options.offset,"--offset")??0,a=(await fe(e.pmRoot,e.settings.item_format,n.type_to_folder,void 0,e.settings.schema)).filter(m=>r?m.status===r:!0).sort((m,u)=>m.id.localeCompare(u.id));return{filteredItems:o===void 0?a.slice(i):a.slice(i,i+o),statusFilter:r,limitFilter:o,offsetFilter:i}},a$=e=>{let t=new Map;for(let{tests:n}of e)for(let r of n){let o=Cw(r);if(!t.has(o)){t.set(o,r.timeout_seconds);continue}t.set(o,n$(t.get(o),r.timeout_seconds))}return t},c$=async(e,t)=>{let n=[],r=e.tests.map(u=>{let p=Cw(u),f=t.seenTestKeys.has(p);if(!f){t.seenTestKeys.add(p);let _=t.effectiveTimeoutByKey.get(p);n.push(_===void 0?u:{...u,timeout_seconds:_})}return{test:u,key:p,duplicate:f}}),o=n.length>0?await od(n,t.defaultTimeoutSeconds,{progress:t.options.progress,sourceRoots:t.sourceRoots,envSet:t.options.envSet,envClear:t.options.envClear,sharedHostSafe:t.options.sharedHostSafe,pmContext:t.options.pmContext,overrideLinkedPmContext:t.options.overrideLinkedPmContext,failOnContextMismatch:t.options.failOnContextMismatch,failOnEmptyTestRun:t.options.failOnEmptyTestRun,requireAssertionsForPm:t.options.requireAssertionsForPm,checkContext:t.options.checkContext,autoPmContext:t.options.autoPmContext,workspaceContext:t.options.workspaceContext,overrideLinkedWorkspaceContext:t.options.overrideLinkedWorkspaceContext,pmRoot:t.pmRoot,allowUntrustedLinkedTests:t.options.allowUntrustedLinkedTests,untrustedLinkedTestsPolicyEnabled:t.settings.testing.allow_untrusted_linked_tests}):[],i=0,s=r.map(({test:u,key:p,duplicate:f})=>{if(!f){let _=o[i];return i+=1,_}return{command:u.command,path:u.path,status:"skipped",error:`Duplicate linked test skipped (key=${p}).`}}),a=r$(s),c=Ds(s),m=await m$(e,a,s,t);return{passed:a.passed,failed:a.failed,skipped:a.skipped,trackingWarnings:m,failureCategories:c,result:{ok:a.failed===0&&!(t.options.failOnSkipped===!0&&a.skipped>0),id:e.item.id,status:e.item.status,test_count:e.tests.length,passed:a.passed,failed:a.failed,skipped:a.skipped,run_results:s,failure_categories:c}}},l$=(e,t)=>[e.failed>0,t.failOnSkipped===!0&&e.skipped>0].includes(!0),d$=e=>e?!0:void 0,m$=async(e,t,n,r)=>{if(!r.trackingEnabled)return[];try{let o=l$(t,r.options);await xs({pmRoot:r.pmRoot,settings:r.settings,itemId:e.item.id,author:r.trackingAuthor,message:`Track test-all run summary (${r.trackingRunId})`,entry:{run_id:r.trackingRunId,kind:"test-all",status:o?"failed":"passed",started_at:r.runStartedAt,finished_at:S(),recorded_at:S(),attempt:r.trackingAttempt,resumed_from:r.trackingResumedFrom,passed:t.passed,failed:t.failed,skipped:t.skipped,items:1,linked_tests:e.tests.length,fail_on_skipped_triggered:d$(r.options.failOnSkipped===!0&&t.skipped>0),executions:n.filter(i=>i.command?.trim()).slice(0,32).map(i=>({command:i.command.trim(),requested_pm_context_mode:i.execution_context?.requested_pm_context_mode,pm_context_mode:i.execution_context?.pm_context_mode,workspace_context_mode:i.execution_context?.workspace_context_mode,trust_reason:i.execution_context?.trust.reason}))}})}catch(o){return[`test_result_tracking_failed:${e.item.id}:${HL(o)}`]}return[]},u$=()=>{let e=process.env.PM_BACKGROUND_TEST_RUN_ATTEMPT?.trim(),t=e?Number.parseInt(e,10):Number.NaN;return Number.isFinite(t)&&t>=1?t:void 0},id=e=>{let t=e?.trim();return t&&t.length>0?t:void 0},p$=e=>({pmRoot:e.pmRoot,settings:e.settings,options:e.options,defaultTimeoutSeconds:e.defaultTimeoutSeconds,sourceRoots:{projectPmRoot:e.pmRoot,globalPmRoot:ct(process.cwd())},seenTestKeys:new Set,effectiveTimeoutByKey:a$(e.itemTests),trackingEnabled:e.settings.testing.record_results_to_items===!0,trackingAuthor:C(e.options.author,e.settings.author_default),trackingRunId:VL(),trackingAttempt:u$(),trackingResumedFrom:id(process.env.PM_BACKGROUND_TEST_RUN_RESUMED_FROM),runStartedAt:e.runStartedAt}),f$=(e,t,n)=>{let r={results:[],passed:0,failed:0,skipped:0,failureCategories:Ds([]),trackingWarnings:[]},o=e.failOnEmptyTestRun===!0&&t===0;return o&&(r.failed+=1,r.failureCategories.empty_run+=1,r.trackingWarnings.push(`empty_linked_test_selection:items=${n.length};linked_tests=0;fail_on_empty_test_run=true`)),{accumulation:r,failOnEmptyTestRunTriggered:o}},_$=async(e,t,n)=>{for(let[r,o]of e.entries()){js(t.options,`item ${r+1}/${e.length} start id=${o.item.id} linked_tests=${o.tests.length}`);let i=await c$(o,t);o$(n.failureCategories,i.failureCategories),n.passed+=i.passed,n.failed+=i.failed,n.skipped+=i.skipped,n.trackingWarnings.push(...i.trackingWarnings),n.results.push(i.result),js(t.options,`item ${r+1}/${e.length} end id=${o.item.id} status=${i.failed===0?"passed":"failed"} passed=${i.passed} failed=${i.failed} skipped=${i.skipped}`)}},h$=(e,t)=>{if(e.checkContext!==!0)return;let n=t.results.flatMap(o=>o.run_results),r=rd(n);t.trackingWarnings.push(`context_preflight:checked_pm_commands=${r.checked_pm_commands};tracker_read_commands=${r.tracker_read_commands};mismatches=${r.mismatches};auto_remediated=${r.auto_remediated}`)},g$=e=>({ok:e.ok,totals:{items:e.filteredItems.length,linked_tests:e.linkedTests,passed:e.accumulation.passed,failed:e.accumulation.failed,skipped:e.accumulation.skipped,failure_categories:e.accumulation.failureCategories},failed:e.accumulation.failed,passed:e.accumulation.passed,skipped:e.accumulation.skipped,fail_on_skipped_triggered:e.failOnSkippedTriggered?!0:void 0,fail_on_empty_test_run_triggered:e.failOnEmptyTestRunTriggered?!0:void 0,warnings:e.accumulation.trackingWarnings.length>0?e.accumulation.trackingWarnings:void 0,results:e.accumulation.results}),y$=e=>[`selection items=${e.filteredItems.length}`,`linked_tests=${e.linkedTests}`,e.statusFilter===void 0?"":`status=${e.statusFilter}`,e.limitFilter===void 0?"":`limit=${e.limitFilter}`,e.offsetFilter>0?`offset=${e.offsetFilter}`:""].filter(t=>t.length>0).join(" "),v$=async(e,t)=>{let n=E(process.cwd(),t.path);await I(n);let r=await A(n),o=await s$({pmRoot:n,settings:r,options:e}),i=BL(e.timeout),s=S(),a=await i$(o.filteredItems,t,n);return js(e,y$({...o,linkedTests:a.linkedTests})),{pmRoot:n,settings:r,filteredItems:o.filteredItems,itemTests:a.itemTests,linkedTests:a.linkedTests,defaultTimeoutSeconds:i,runStartedAt:s}},w$=e=>{let t=e.options.failOnSkipped===!0&&e.accumulation.skipped>0,n=![e.accumulation.failed>0,t,e.failOnEmptyTestRunTriggered].includes(!0);return{failOnSkippedTriggered:t,ok:n}},Iw=async(e,t)=>{let n=await v$(e,t),{accumulation:r,failOnEmptyTestRunTriggered:o}=f$(e,n.linkedTests,n.filteredItems),i=p$({pmRoot:n.pmRoot,settings:n.settings,options:e,itemTests:n.itemTests,defaultTimeoutSeconds:n.defaultTimeoutSeconds,runStartedAt:n.runStartedAt});await _$(n.itemTests,i,r),h$(e,r);let s=w$({options:e,accumulation:r,failOnEmptyTestRunTriggered:o});return js(e,`end status=${s.ok?"passed":"failed"} items=${n.filteredItems.length} linked_tests=${n.linkedTests} passed=${r.passed} failed=${r.failed} skipped=${r.skipped}`),g$({ok:s.ok,filteredItems:n.filteredItems,linkedTests:n.linkedTests,accumulation:r,failOnSkippedTriggered:s.failOnSkippedTriggered,failOnEmptyTestRunTriggered: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]="419a061f-e181-5b18-9e3a-d22cc5aff416")}catch{}})();function Rw(e,t,n){let r;if(typeof e.lines=="string")r=Ti(e.lines);else if(e.lineRange!==void 0){if(e.lineRange===null||typeof e.lineRange!="object"||Array.isArray(e.lineRange))throw new RangeError("Source line range must be an object with numeric start and end values.");r=Ti(`${String(Reflect.get(e.lineRange,"start"))}:${String(Reflect.get(e.lineRange,"end"))}`)}return{paths:t,scope:e.scope==="project"||e.scope==="global"?e.scope:void 0,limit:n(e.limit,"files lookup limit"),offset:n(e.offset,"files lookup offset"),noTruncate:e.noTruncate===!0,strictRead:e.strictRead===!0,explain:e.explain===!0,lineRange:r,decisionDepth:n(e.decisionDepth,"files lookup decision depth")}}(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]="c6f4c40f-50cf-568f-8a45-860ac4be3c97")}catch{}})();function Pe(e,t){let n=w(e,t);if(!n)throw new l(`Missing required argument: ${t}`,64);return n}function yn(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}(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]="1b86373f-26a3-5893-95dc-e794fcc1afa1")}catch{}})();function b$(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=e.args.alias??e.options.alias;return{ctx:e,subcommand:t.trim().toLowerCase(),name:w(e.args,"name")??w(e.options,"name"),author:w(e.args,"author")??w(e.options,"author"),force:e.args.force===!0||e.options.force===!0,aliases:n===void 0?void 0:he(n)}}function k$(e){let{ctx:t,subcommand:n,name:r,author:o,force:i}=e,a=yn({list:()=>gf(t.global),show:()=>yf(r,t.global),"show-status":()=>vf(r,t.global),"list-fields":()=>kf(t.global),"show-field":()=>Sf(r,t.global),"remove-type":()=>pf(r,{author:o,force:i},t.global),"remove-field":()=>bf(r,{author:o,force:i},t.global),"remove-status":()=>hf(r,{author:o,force:i},t.global),"apply-preset":()=>Ef(w(t.args,"typePreset")??w(t.options,"typePreset"),{author:o,force:i},t.global)},n);return a?a():null}function S$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e,s=t.args.commands??t.options.commands,a=t.args.requiredTypes??t.options.requiredTypes;return wf(n,{type:w(t.args,"fieldType")??w(t.options,"fieldType"),commands:s===void 0?void 0:he(s),description:w(t.args,"description")??w(t.options,"description"),cliFlag:w(t.args,"cliFlag")??w(t.options,"cliFlag"),alias:i,required:t.args.required===!0||t.options.required===!0,requiredOnCreate:t.args.requiredOnCreate===!0||t.options.requiredOnCreate===!0,allowUnset:!(t.args.allowUnset===!1||t.options.allowUnset===!1),requiredTypes:a===void 0?void 0:he(a),author:r,force:o},t.global)}function E$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e,s=t.args.role??t.options.role;return _f(n,{role:s===void 0?void 0:he(s),alias:i,description:w(t.args,"description")??w(t.options,"description"),order:Fe(t.args.order??t.options.order,"schema add-status order"),author:r,force:o},t.global)}function A$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e;return uf(n,{description:w(t.args,"description")??w(t.options,"description"),defaultStatus:w(t.args,"defaultStatus")??w(t.args,"default_status")??w(t.options,"defaultStatus")??w(t.options,"default_status"),folder:w(t.args,"folder")??w(t.options,"folder"),alias:i,author:r,force:o},t.global)}function T$(e){let{ctx:t,subcommand:n,name:r,author:o,force:i}=e,s=w(t.args,"to")??Pe(t.options,"to"),a=w(t.args,"migrationId")??w(t.args,"migration_id")??w(t.options,"migrationId")??w(t.options,"migration_id"),c=w(t.args,"fieldTypeScope")??w(t.options,"fieldTypeScope")??w(t.args,"type")??w(t.options,"type"),m=n==="rename-type"?{kind:"rename-type",from:r??"",to:s}:n==="rename-field"?{kind:"rename-field",from:r??"",to:s,...c===void 0?{}:{type:c}}:{kind:"remap-status",from:r??"",to:s};return df(m,{migrationId:a,dryRun:t.args.dryRun===!0||t.options.dryRun===!0,author:o,force:i},t.global)}function Ow(e){let t=b$(e);Rp(t.subcommand,e.args.dryRun===!0||e.options.dryRun===!0);let n=En.find(o=>o===t.subcommand);if(n)return lf(n,t.name,{definition:e.args.definition??e.options.definition,policy:w(e.args,"policy")??w(e.options,"policy"),message:w(e.args,"message")??w(e.options,"message"),author:t.author,dryRun:e.args.dryRun===!0||e.options.dryRun===!0},e.global);let r=k$(t);if(r!==null)return r;if(["rename-type","rename-field","remap-status"].includes(t.subcommand))return T$(t);if(t.subcommand==="add-field")return S$(t);if(t.subcommand==="add-status")return E$(t);if(t.subcommand==="add-type")return e.args.infer===!0||e.options.infer===!0?Af({minCount:Fe(e.args.minCount??e.options.minCount,"schema infer minCount"),apply:e.args.apply===!0||e.options.apply===!0,author:t.author,force:t.force},e.global):A$(t);throw Te({command_path:"schema",token:t.subcommand,allowed:mf,exit_code:64})}(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]="a23d5ebd-6257-53e1-bed4-815b99a10bbb")}catch{}})();function qs(e){return w(e.args,"target")??w(e.options,"target")}function we(e,t=e.options){return e.id??Pe(t,"id")}async function C$(e){let t=Cn("list",e.options);return t.compact===void 0&&t.brief===void 0&&t.full===void 0&&t.fields===void 0&&t.includeBody===void 0&&(t.compact=!0),kc(await ht(w(e.args,"status")??w(t,"status"),t,e.global),t)}async function I$(e){let t=Pe(e.args,"query"),n=Cn("search",e.options,[t]);return n.compact===void 0&&n.full===void 0&&n.fields===void 0&&(n.compact=!0),kc(await Or(t,n,e.global),n)}async function R$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=ge(e.args,e.options);return Ee(await jt(r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function O$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=ge(e.args,e.options),o={...r,...r.title===void 0&&typeof e.args.title=="string"?{title:e.args.title}:{},...r.message===void 0&&typeof e.args.message=="string"?{message:e.args.message}:{}};return Ee(await Gc(we(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function x$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=ge(e.args,e.options);return Ee(await ot(we(e,r),r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function P$(e){let t=ji(e.options);return t.add===void 0&&t.stdin===void 0&&t.file===void 0&&t.edit===void 0&&t.delete===void 0&&(t.includeMeta=!0,t.limit===void 0&&t.fullHistory!==!0&&(t.limit="20")),fh(we(e),t,e.global)}function xw(e,t){return jf(Rw(e.options,t,Fe),e.global)}function N$(e){let t=he(e.options.lookupPath);if(t&&t.length>0)return xw(e,t);let n=we(e);return e.options.discover===!0?Za(n,ki(e.options),e.global):Gf(n,Ar(e.options),e.global)}function L$(e){return zv({subcommand:w(e.args,"subcommand")??w(e.options,"subcommand"),limit:xf(e.args,e.options)},e.global)}function $$(e){let t={...e.options};return t.brief===void 0&&t.summary===void 0&&t.full===void 0&&(t.summary=!0),Tr(e.global,t)}function F$(e){let t=w(e.args,"configAction")??w(e.options,"configAction")??w(e.options,"action");if(t===void 0)throw new l("Missing required argument: configAction",64);let n=w(e.args,"value")??w(e.options,"value"),r=w(e.options,"policy")!==void 0&&n!==void 0?{...e.options,value:n}:e.options;return Fh(w(e.args,"scope")??w(e.options,"scope")??"project",t,w(e.args,"key")??w(e.options,"key"),r,e.global,w(e.options,"policy")===void 0?n:void 0)}function M$(e){let t=e.options;return E_(S_(t),e.global)}function D$(e,t){if(typeof e=="number"){if(!Number.isFinite(e)||!Number.isInteger(e))throw new l(`${t} must be a finite integer.`,64);return e}if(typeof e=="string"&&e.trim().length>0){let n=e.trim();if(!/^[+-]?\d+(?:st|nd|rd|th)?$/i.test(n))throw new l(`${t} must be a finite integer.`,64);let r=Number.parseInt(n,10);if(!Number.isInteger(r))throw new l(`${t} must be a finite integer.`,64);return r}}function U$(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=e.options;return fy({subcommand:t,id:typeof e.id=="string"?e.id:typeof n.id=="string"?n.id:void 0,stepRef:G$(e),reorderTo:D$(n.reorderTo??e.args.reorderTo,"plan reorderTo"),options:e.options,global:e.global})}function G$(e){return typeof e.options.stepRef=="string"?e.options.stepRef:typeof e.args.stepRef=="string"?e.args.stepRef:void 0}function j$(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=t.trim().toLowerCase(),r=w(e.args,"name")??w(e.options,"name"),i=yn({list:()=>Ry(),show:()=>Oy(r),lint:()=>xy(r),apply:()=>Py(r,{dryRun:e.args.dryRun===!0||e.options.dryRun===!0,author:w(e.args,"author")??w(e.options,"author"),force:e.args.force===!0||e.options.force===!0},e.global)},n);if(!i)throw Te({command_path:"profile",token:t,allowed:Iy,exit_code:64});return i()}async function q$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=ge(e.args,e.options);return Ee(await Yh(we(e,r),r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function K$(e){let{changedFields:t,runnerOptions:n}=ge(e.args,e.options);return Ee(await vy(Ei(n),e.global),{changedFields:t})}async function z$(e){let{changedFields:t,runnerOptions:n}=ge(e.args,e.options),r=w(e.args,"reason"),o=r!==void 0&&n.reason===void 0?{...n,reason:r}:{...n};return e.force&&o.force===void 0&&(o.force=!0),Ee(await ig(Si(o),e.global),{changedFields:t})}async function B$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=ge(e.args,e.options),o=w(r,"target")??Pe(e.args,"target");return Ee(await rn(we(e,r),o,r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function H$(e){let t={...e.args,...e.options};return qf(Pe(t,"subcommand"),w(t,"id")??e.id,w(t,"target"),$f(t),e.global)}function V$(e){return Mf(E(process.cwd(),e.global.path),{...e.args,...e.options})}var Pw={init:e=>Nr(w(e.args,"prefix"),e.global,e.options),context:e=>lc(Cn("context",e.options),e.global),next:e=>Rr(Cn("next",e.options),e.global),eval:uv,events:pv,merge:fv,workspace:_v,meet:Cs,event:Cs,remind:Cs,list:C$,get:e=>{let t=we(e);return mc(t,e.global,Cn("get",e.options,[t]))},search:I$,duplicates:e=>{let t=typeof e.options.status=="string"?[e.options.status]:he(e.options.status);return Qa(e.global,{exhaustive:e.options.exhaustive===!0,...t.length===0?{}:{status:t},since:w(e.options,"since"),threshold:typeof e.options.threshold=="number"?e.options.threshold:void 0,limit:e.options.limit==="default"?void 0:Fe(e.options.limit,"limit")})},create:R$,copy:O$,focus:e=>Zc(e.id,{clear:e.options.clear===!0||e.args.clear===!0},e.global),update:x$,"item-reopen":ty,restore:B$,claim:Qg,release:ey,"start-task":e=>pn(e,"start_task"),"pause-task":e=>pn(e,"pause_task"),"close-task":e=>pn(e,"close_task"),close:Zg,comments:P$,notes:e=>wy(we(e),ji(e.options),e.global),learnings:e=>Wh(we(e),ji(e.options),e.global),files:N$,docs:e=>Uf(we(e),Ar(e.options),e.global),test:e=>Us(we(e),e.options,e.global),"test-all":e=>Iw(e.options,e.global),telemetry:L$,validate:e=>Pi(e.options,e.global,{runUpdate:(t,n,r)=>ot(t,n,r)}),health:$$,assurance:e=>__(e.args,e.options,e.global),contracts:e=>_c(e.options,e.global),config:F$,activity:M$,aggregate:e=>dc(e.options,e.global),extension:e=>Mn(qs(e),e.options,e.global),package:e=>Mn(qs(e),e.options,e.global),install:e=>Mn(qs(e),{...e.options,install:!0},e.global),upgrade:e=>g_(qs(e),e.options,e.global),delete:e=>Qc(we(e),e.options,e.global),deps:e=>Df(we(e),e.options,e.global),graph:H$,"files-discover":e=>Za(we(e),e.options,e.global),"files-lookup":e=>xw(e,he(e.options.paths)),history:e=>A_(we(e),e.options,e.global),"history-redact":e=>Vh(we(e),e.options,e.global),"history-repair":qh,"history-compact":Kh,"history-attest":e=>y_(e.options,e.global),"history-author-acknowledge":V$,plan:U$,schema:Ow,profile:j$,stats:e=>zl(e.global,hv(e.options)),append:q$,"update-many":K$,"close-many":z$,gc:e=>h_(e.global,e.options)};(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]="e8137f8b-745a-5ef5-9e7e-14b7d032c1ea")}catch{}})();var W$=new Map;function sd(){W$.clear()}(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]="0c84b11c-502f-5c33-a757-5757402357b4")}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]="b841f903-6276-5067-842f-6a6bff114cec")}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]="4277a72c-f012-55d2-9e18-c9a836d829d6")}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]="aba4af26-98d3-53aa-8b23-1be7c90a38d1")}catch{}})();function Nw(){return{metadata:{},body:""}}(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]="37be266f-5f38-508c-af1f-f82bdbc63ab4")}catch{}})();var $w=[{id:"capabilities",aliases:["capability-map","families","routing"],title:"Generated Capability Routing",summary:"Route work through command families generated from the canonical agent capability contract.",intent:"Use this as the drift-free entrypoint when selecting a CLI, MCP, completion, documentation, or extension command surface.",commands:Zu().flatMap(({commands:e})=>e.map(t=>`pm ${t}`)),workflows:[],docs:[{path:"docs/generated/AGENT_CAPABILITY_ROUTING.md",purpose:"Generated command-to-family routing table."},{path:"docs/generated/AGENT_COMMAND_SURFACE.md",purpose:"Generated visibility-tier and family table."}],related:["commands","workflows","extensions"]},{id:"quickstart",aliases:["start","getting-started","bootstrap"],title:"Quickstart",summary:"Initialize a tracker and run the shortest safe plan -> execute -> close loop.",intent:"Use this when a human or agent needs to start productive work quickly with minimal context load.",commands:["pm init","pm context --limit 10","pm list --status open --limit 20",'pm create --create-mode progressive --title "..." --description "..." --type Task',"pm claim <ID>","pm update <ID> --status in_progress",'pm close <ID> "<reason with evidence>" --validate-close warn'],workflows:[{name:"Start Session Safely",goal:"Bootstrap without mutating unrelated state.",prompt:"You are bootstrapping pm work. Use a token-efficient context snapshot first, then select one open item, claim it, and only then mutate.",commands:["pm context --limit 10","pm list --status open --limit 20","pm claim <ID>"]}],docs:[{path:"README.md",purpose:"High-level project and install entrypoint."},{path:"docs/QUICKSTART.md",purpose:"Short setup and first-command walkthrough."},{path:"docs/COMMANDS.md",purpose:"Task-oriented command recipes."}],related:["commands","workflows","release"]},{id:"commands",aliases:["cli","operations","reference"],title:"CLI Command Routing",summary:"Find the right command family quickly and use command-scoped help/contracts output.",intent:"Use this when selecting command paths, flags, and output formats for implementation or automation.",commands:["pm --help","pm <command> --help","pm <command> --help --explain","pm contracts --command <command> --flags-only","pm contracts --command <command> --availability-only --runtime-only","pm completion <bash|zsh|fish>"],workflows:[{name:"Flag Discovery",goal:"Resolve command flags deterministically before mutations.",prompt:"You are preparing to run a command. Use help and contracts surfaces to verify required/optional flags before execution.",commands:["pm <command> --help --explain","pm contracts --command <command> --flags-only"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Command grouping and examples."},{path:"docs/CONFIGURATION.md",purpose:"Project/global settings and policy controls."},{path:"docs/TESTING.md",purpose:"Linked-test orchestration and safety guidance."}],related:["quickstart","workflows","sdk","extensions"]},{id:"workflows",aliases:["developer","maintainer","agent"],title:"Developer and Agent Workflows",summary:"Apply canonical claim -> execute -> verify -> close workflows with append-only evidence.",intent:"Use this for day-to-day coding-agent execution loops and handoff-safe updates.",commands:["pm claim <ID>","pm update <ID> --status in_progress","pm files <ID> --add ...","pm test <ID> --add ...",'pm comments <ID> "..."',"pm validate --check-resolution --check-history-drift","pm release <ID>"],workflows:[{name:"Execution Loop",goal:"Keep code, tests, and tracker evidence synchronized.",prompt:"You are implementing a scoped change. Claim first, link files/tests/docs as you go, append evidence comments, and close only after validation.",commands:["pm claim <ID>","pm update <ID> --status in_progress","pm files <ID> --add path=<file>,scope=project","pm test <ID> --run --progress",'pm close <ID> "<evidence>" --validate-close warn']}],docs:[{path:"AGENTS.md",purpose:"Repository operating rules and required workflow."},{path:"docs/AGENT_GUIDE.md",purpose:"Agent-oriented usage and context strategy."},{path:"docs/TESTING.md",purpose:"Sandbox-safe test execution rules."}],related:["quickstart","commands","skills"]},{id:"sdk",aliases:["api","typescript-sdk"],title:"SDK and Integrations",summary:"Use the published SDK surface for extension authoring and contract-safe integrations.",intent:"Use this when building or reviewing programmatic integrations against @unbrained/pm-cli/sdk.",commands:["pm contracts --schema-only","pm contracts --command extension --flags-only","pm contracts --runtime-only --availability-only"],workflows:[{name:"Integration Contract Check",goal:"Confirm action schemas and runtime availability before coding.",prompt:"You are wiring an integration. Capture schema + runtime availability first, then map your adapter payload fields to contract keys.",commands:["pm contracts --schema-only","pm contracts --availability-only --runtime-only","pm contracts --command <command> --flags-only"]}],docs:[{path:"docs/SDK.md",purpose:"Public SDK exports and extension authoring references."},{path:"docs/ARCHITECTURE.md",purpose:"Core runtime composition and extension load flow."}],related:["extensions","commands"]},{id:"extensions",aliases:["plugins","extension-authoring","packages","package-authoring"],title:"Packages and Extensions",summary:"Install, author, and diagnose packages/extensions with deterministic lifecycle controls.",intent:"Use this for package management, extension capability registration, and runtime diagnostics.",commands:["pm package install <target> --project","pm package upgrade --dry-run","pm package explore --project","pm package manage --detail summary","pm package doctor --detail deep","pm package activate <target> --project","pm package deactivate <target> --project"],workflows:[{name:"Lifecycle Triage",goal:"Diagnose extension state before forceful lifecycle actions.",prompt:"You are debugging package behavior. Inspect managed state first, then run doctor diagnostics, then apply install/adopt/activate actions.",commands:["pm package explore --project","pm package manage --detail summary","pm package doctor --detail deep","pm package upgrade --packages-only --dry-run"]}],docs:[{path:"docs/EXTENSIONS.md",purpose:"Capability model and lifecycle command usage."},{path:"docs/examples/starter-extension/README.md",purpose:"Starter extension scaffold and local development path."},{path:"docs/SDK.md",purpose:"SDK contracts used by extension implementations."}],related:["sdk","commands","skills"]},{id:"skills",aliases:["agent-skills","agentskills"],title:"Agent Skills",summary:"Skill bundles for developer, user, extensions, and sdk workflows aligned to the current CLI.",intent:"Use this when an agent needs reproducible prompts/workflows with strict compatibility metadata.",commands:["pm guide skills --depth deep","pm contracts --command guide --flags-only","pm validate --check-command-references"],workflows:[{name:"Skill Selection",goal:"Pick the narrowest compatible skill first to minimize context usage.",prompt:"Select a pm skill based on the task intent, then execute only the workflow section needed for the current change.",commands:["pm guide skills","pm guide skills --depth deep"]}],docs:[{path:"docs/AGENT_GUIDE.md",purpose:"Agent-first usage and context model."},{path:"docs/README.md",purpose:"Documentation routing with progressive disclosure."},{path:".agents/skills/README.md",purpose:"Agent skills index and routing overview."},{path:".agents/skills/pm-developer/SKILL.md",purpose:"Developer-oriented pm skill workflow."},{path:".agents/skills/pm-user/SKILL.md",purpose:"User/operator pm skill workflow."},{path:".agents/skills/pm-extensions/SKILL.md",purpose:"Extension-focused pm skill workflow."},{path:".agents/skills/pm-sdk/SKILL.md",purpose:"SDK integration pm skill workflow."}],related:["workflows","harnesses","commands"]},{id:"harnesses",aliases:["compatibility","agent-compatibility"],title:"Agent Harness Compatibility",summary:"Cross-harness compatibility guidance for docs routing.",intent:"Use this when adapting pm docs and SDK contracts for an external automation harness.",commands:["pm guide skills","pm guide commands","pm contracts --runtime-only --availability-only"],workflows:[{name:"Harness Mapping",goal:"Route each harness to the same canonical skill/docs sources.",prompt:"Map harness-specific entrypoints to the same pm guide topics and .agents/skills workflows without adding runtime harness-specific code.",commands:["pm guide harnesses --depth standard","pm guide skills --depth deep"]}],docs:[{path:"docs/AGENT_GUIDE.md",purpose:"Agent context and output-mode conventions."},{path:"docs/README.md",purpose:"Single-source documentation routing entrypoint."},{path:".agents/skills/HARNESS_COMPATIBILITY.md",purpose:"Harness compatibility matrix and usage notes."}],related:["skills","workflows"]},{id:"release",aliases:["gates","ship","release-readiness"],title:"Release and Staleness Gates",summary:"Run release gates and docs/skills freshness checks before publishing.",intent:"Use this when validating release readiness and preventing docs/skills drift.",commands:["pnpm build","pnpm test:coverage","pnpm quality:static","node scripts/release/run-gates.mjs --telemetry-mode best-effort","pnpm security:scan"],workflows:[{name:"Pre-Release Gate Sweep",goal:"Ensure code, docs, and skills are all green before publish.",prompt:"Run release gates in deterministic order and treat docs/skills freshness failures as release blockers.",commands:["pnpm build","pnpm test:coverage","node scripts/release/run-gates.mjs --telemetry-mode best-effort"]}],docs:[{path:"docs/RELEASING.md",purpose:"Release flow and safety checks."},{path:"CHANGELOG.md",purpose:"Versioned release history and unreleased notes."},{path:"scripts/release/run-gates.mjs",purpose:"Source of truth for release gate ordering."}],related:["commands","skills","workflows"]},{id:"tokens",aliases:["output","budget","context-cost","projections"],title:"Read Output and Token Budgets",summary:"Bound what a read costs before it is emitted, and resume the part a budget withheld.",intent:"Use this when an agent must keep context small: every read declares a token ceiling, degrades deterministically, and reports what it omitted.",commands:["pm contracts --summary --json","pm list --status open --output-limit 20","pm get <ID> --output-include id,title,status,dependencies","pm context --limit 10 --token-accounting","pm notes <ID> --output-cursor <cursor>","pm list --status closed --output-budget unbounded"],workflows:[{name:"Bound A Read Before Emitting It",goal:"Never pay for rows the task does not need.",prompt:"Choose the narrowest projection first, then a row limit, then a token budget. Read the omission receipt before concluding the result is complete.",commands:["pm contracts --command list --flags-only --json","pm list --status open --output-limit 20 --output-format toon","pm list --status open --token-accounting"]},{name:"Recover A Truncated Read",goal:"Continue a bounded read instead of re-running it unbounded.",prompt:"When output_budget_truncation appears, prefer the declared continuation cursor. Only widen the budget when the response declares no cursor.",commands:["pm notes <ID> --output-cursor <cursor>","pm get <ID> --output-budget 20000"]}],docs:[{path:"docs/READ_OUTPUT_CONTRACTS.md",purpose:"Budget, truncation, continuation, and omission receipts."},{path:"docs/OUTPUT_PROJECTION_CONTRACTS.md",purpose:"Field and section projection grammar for every read."},{path:"docs/OUTPUT_TOKEN_ACCOUNTING.md",purpose:"Per-section token cost receipts."},{path:"docs/ITEM_READ_PROJECTIONS.md",purpose:"Item-level projection defaults and restore hints."}],related:["commands","workflows","quickstart"]},{id:"graph",aliases:["relationships","deps","dependencies","analytics"],title:"Relationship Graph and Planning Analytics",summary:"Type the relationships between items, then read the project as a graph rather than as a list.",intent:"Use this when the question is about lineage, ordering, blast radius, bottlenecks, or which work reaches a declared outcome.",commands:["pm deps <ID>",'pm update <ID> --dep "id=<other>,kind=implements"',"pm graph analyze","pm graph impact <ID> --direction downstream","pm graph paths <ID> <ID>","pm graph audit"],workflows:[{name:"Place New Work In The Ladder",goal:"Every item resolves to an outcome through a typed, explainable path.",prompt:"Set parent lineage first, then add typed edges that cite durable evidence. Never add an edge to satisfy a count.",commands:['pm search "<topic>" --limit 10','pm update <ID> --dep "id=<parent-goal>,kind=implements"',"pm graph ancestors <ID>"]},{name:"Assess Blast Radius Before Changing Something",goal:"Know what derives from an item before touching it.",prompt:"Walk the directed graph downstream from the item, then check whether any bottleneck node sits on the path.",commands:["pm graph impact <ID> --direction downstream","pm graph dominators <ID>","pm graph articulation"]}],docs:[{path:"docs/RELATIONSHIP_GRAPH.md",purpose:"Graph model, traversal verbs, and analytics surface."},{path:"docs/DEPENDENCY_KIND_CONTRACT.md",purpose:"Every typed edge kind, its direction, and its semantics."}],related:["commands","workflows","assurance"]},{id:"assurance",aliases:["gates","invariants","measurements","quality"],title:"Declared Invariants and Gates",summary:"Express a project's own quality rules as tracked data the SDK evaluates, instead of as scripts.",intent:"Use this when a rule must hold over the record itself \u2014 a floor, a ceiling, or a monotone property \u2014 and must fail closed in CI.",commands:["pm assurance list","pm assurance run <gate-id> --trigger ci --dry-run","pm validate --check-resolution --check-history-drift","pm health --summary"],workflows:[{name:"Add An Invariant Rather Than A Script",goal:"A new enforcement gap becomes declared data, not a new bespoke gate script.",prompt:"Define the measurement, bind an assertion with an explicit bound and polarity, prove a negative control, then attach it to a trigger.",commands:["pm assurance list --json","pm assurance run <gate-id> --trigger ci --dry-run --json"]},{name:"Read A Verdict Before Believing It",goal:"Know which population a passing assertion speaks for.",prompt:"Read population_size and scope on every assertion. A gate that cannot fail for the reason it exists is not evidence.",commands:["pm assurance run <gate-id> --trigger ci --dry-run --json --output-budget unbounded"]}],docs:[{path:"docs/ASSURANCE.md",purpose:"Measurement, assertion, gate, and trigger vocabulary."},{path:"docs/MUTATION_INTEGRITY.md",purpose:"What every mutation must record to remain provable."}],related:["release","graph","workflows"]},{id:"merge",aliases:["branches","concurrency","multi-agent","fleet"],title:"Branching, Merging, and Concurrent Agents",summary:"Keep tracker data and history conflict-free while many agents work on separate branches.",intent:"Use this when more than one agent or worktree mutates the same tracker and the results must merge without hand resolution.",commands:["pm merge install","pm merge report","pm merge reconcile --dry-run","pm claim <ID>","pm release <ID>","pm validate --check-history-drift","pm health --check-only"],workflows:[{name:"Prepare A Clone For Field-Aware Merges",goal:"The committed merge fence needs clone-local driver configuration once.",prompt:"Run the merge installer in every fresh clone or worktree before the first branch merge of tracker data.",commands:["pm merge install","pm health --check-only"]},{name:"Settle A Merge Before Trusting Health",goal:"A lossless merge still leaves pending receipts that strict health reports until they are reconciled.",prompt:"After any branch merge that touched tracker data, read the merge report, preview the reconciliation, then apply it; only then treat a health verdict as a statement about the data.",commands:["pm merge report","pm merge reconcile --dry-run",'pm merge reconcile --message "Post-merge history reconciliation"',"pm health --check-only"]},{name:"Hand Work Between Agents Safely",goal:"Ownership and evidence survive the handoff.",prompt:"Claim before substantial edits, record evidence as comments, and release the claim when pausing, handing off, closing, or canceling.",commands:["pm claim <ID>",'pm comments <ID> "Handoff: <state and next step>"',"pm release <ID>"]}],docs:[{path:"docs/MERGE_SAFETY.md",purpose:"Merge driver, field-aware resolution, and clone setup."},{path:"docs/SDK_CONTEXT_COORDINATION.md",purpose:"Coordination primitives for concurrent agents."}],related:["workflows","assurance","commands"]},{id:"evidence",aliases:["record","annotations","learnings","history-maintenance"],title:"Evidence, Durable Knowledge, and Record Maintenance",summary:"Append comments, notes, learnings, files, docs, and tests to items, and maintain the immutable history those records live in.",intent:"Use this when work must be explained to the next agent, when a durable lesson should outlive the item, or when a history stream needs verification, repair, redaction, compaction, or author attribution.",commands:['pm comments <ID> "<progress or verification evidence>"','pm notes <ID> --add "<rationale that belongs on the item>"','pm learnings <ID> --add "<lesson that should outlive the item>"',"pm append <ID> --body -","pm files <ID> --add path=<path>,scope=project,note=<why>","pm history <ID> --verify --strict-exit","pm history-repair --all --dry-run","pm history-redact <ID> --literal <secret> --dry-run","pm history-compact <ID> --dry-run","pm history-author-acknowledge --all-actionable --dry-run","pm close-many --ids <ID>,<ID> --reason <text> --dry-run","pm test-all --status open --limit 10 --progress"],workflows:[{name:"Record While Working, Not After",goal:"Another agent can rebuild the full situation from the item alone.",prompt:"Add a comment for each verified step, a note for each rationale the item body does not carry, and a learning for each lesson that applies beyond this item. Prefer appending over rewriting.",commands:['pm comments <ID> "Evidence: <what changed and what passed>"','pm notes <ID> --add "Decision log: <why this shape>"','pm learnings <ID> --add "<durable lesson>"',"pm learnings <ID> --limit 5"]},{name:"Verify And Repair A History Stream",goal:"Every mutation stays provable and the chain re-anchors after drift.",prompt:"Verify the chain with a strict exit before trusting a stream, preview any repair, and record why the repair was needed in the audit message.",commands:["pm history <ID> --verify --strict-exit","pm history-repair --all --dry-run",'pm history-repair --all --message "<why the chain drifted>"',"pm validate --check-history-drift"]},{name:"Redact, Compact, Or Attribute Without Losing Proof",goal:"Sensitive text, stream length, and unknown authors are handled through audited rewrites.",prompt:"Preview every history rewrite with --dry-run, read the receipt, then apply. Compaction renumbers ordinal versions, so record the checkpoint it created.",commands:["pm history-redact <ID> --literal <secret> --dry-run","pm history-compact <ID> --dry-run","pm history-author-acknowledge --all-actionable --dry-run"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Annotation, bulk, and history-and-recovery command families."},{path:"docs/MUTATION_INTEGRITY.md",purpose:"Provenance and content-safety policy every mutation shares."},{path:"docs/AGENT_GUIDE.md",purpose:"Evidence expectations in the agent loop and self-repair remediation."}],related:["workflows","assurance","merge","graph"]},{id:"automation",aliases:["calendar","reminders","meetings","events"],title:"Reminders, Events, and Meetings",summary:"Attach time to items so context and agenda views can surface deadlines, meetings, and reminders when they matter.",intent:"Use this when an item needs a due signal, a scheduled event, or a meeting record that later context reads should surface.",commands:["pm package install calendar --project","pm calendar remind <title> --at <when> --parent <ID>","pm calendar event <title> --start <when> --parent <ID>","pm calendar meet <title> --start <when> --duration 30min --parent <ID>","pm context --limit 10"],workflows:[{name:"Put A Deadline Where Context Will Find It",goal:"Time-bound work surfaces in the agenda section of context reads.",prompt:"Install calendar, then record the reminder or event under its owning item and confirm it in context. Use explicit min or mo for durations; bare m is ambiguous.",commands:["pm package install calendar --project","pm calendar remind <title> --at <when> --parent <ID>","pm context --limit 10"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Calendar and context command family."},{path:"packages/pm-calendar/README.md",purpose:"Package commands, duration units, and compatibility aliases."}],related:["workflows","quickstart","extensions"]}],Lw=new Map;for(let e of $w){Lw.set(e.id,e);for(let t of e.aliases)Lw.set(t,e)}function ad(){return $w.map(e=>e.id)}(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]="3a7cf539-2663-5265-90e8-c2aa9926a62a")}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]="033b7bbd-f219-583f-a43c-42ffdf535d9d")}catch{}})();var BW=[...to],HW=[...no],cd=new Set(sr.filter(e=>e.hidden).map(e=>e.alias)),Fw=Qu("full").filter(e=>!e.includes(" ")&&!cd.has(e)),Y$=N(po),J$=N(fo),X$=N(bo),Q$=N(To),Mw=ur("restore",Rt("restore")),Dw=ur("history-attest",Rt("history-attest")),Z$=N(Co),eF=N(Km),tF=N(zm),nF=N(Ao),rF=N(xo),oF=N(Io),iF=N(Ro),sF=N(wo),ld=[...new Set(ke.map(e=>e.canonical_argv[0]))],Uw=[...new Set(ke.flatMap(e=>e.canonical_argv.slice(0,-1).map((t,n)=>e.canonical_argv.slice(0,n+1).join(" "))))],VW=new Set(mo.filter(e=>e.disposition==="package_owned").map(e=>H(e.command))),Gw=ke.filter(e=>e.canonical_argv[0]==="history"),aF=Gw.map(e=>e.canonical_argv[1]).join(" ");var cF=Gw.map(e=>({...e,flags:N(Rt(e.alias))})),lF=N(_o),dF=N(ho,!1),mF=N(Oo),uF=N(lr),pF=N(dr),fF=N($o),_F=N(No),hF=N(So),gF=N(Lo),yF=N(Po),vF=N(Fo),wF=N(ko),bF=N(Eo),kF=N(yo),SF=N(Mo),EF=N(go),dd=`${En.join(" ")} list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status`;var AF=N(Do),TF=`${AF} bash zsh fish`,md=zs(ad()),Ks="init scaffold install uninstall explore manage describe reload doctor catalog adopt adopt-all activate deactivate migrate",ud=`${Ks} upgrade`,CF=N(vo),IF=N(ar),RF=N(cr);var OF=N(Rt("close")),xF=N(Rt("close-task")),PF=N(Rt("release")),NF=N(Rt("claim"));var jw=uo.flatMap(e=>[e.short,e.flag,...e.aliases??[]]).filter(e=>!!e).join(" "),pd=[...Vo].join("|"),fd=[...Vo].map(e=>`${e}=*`).join("|"),_d=[...jw.split(" ").filter(e=>!Vo.has(e)),"-h","-V"].join("|");function zs(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n)).join(" ")}(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]="2dba61cf-0757-5b46-b86c-e5b7a1c733ae")}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]="30266073-c2de-54c4-bdf7-8cf9d4cfb36b")}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]="8e48bd9b-07b3-5772-984e-10f27864c736")}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]="c1fb3981-3bae-5f63-861a-ee689a9ffd36")}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]="2c2a4576-a5d8-57c1-84e8-ca8b9019c84e")}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]="e7f8a7ea-3ec2-521b-ad52-45b655208f06")}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]="856f6aeb-4343-5cda-8b04-66d786e351d9")}catch{}})();var Vw=Symbol("pm.active-extension-host-context");function Ge(e){return{fullChangedFields:!0,options:e}}var U=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[Vw]=!0,n}run(t,n={}){return Ww({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return ah(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return Va(await this.list(Ha(t)))}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},r={}){return this.runTyped("graph",{subcommand:t,...n,options:r})}append(t,n,r={}){return this.runTyped("append",{id:t,...Ge(Ut(r,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,r,o,i={}){return this.runTyped("config",{scope:t,configAction:n,...r===void 0?{}:{key:r},...o===void 0?{}:{value:o},options:i})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}workflowPolicy(t,n,r={}){return this.runTyped("schema",{name:n,options:{...r,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,r){return this.runTyped("schema",{name:t,options:{...r,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,r,o){return this.runTyped("schema",{name:t,options:{...r,subcommand:"rename-field",to:n,...o?{fieldTypeScope:o}:{}}})}schemaRemapStatus(t,n,r){return this.runTyped("schema",{name:t,options:{...r,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyAttest(t={}){return this.runTyped("history-attest",{options:t})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,r={},o,i){return this.runTyped("plan",{...n===void 0?{}:{id:n},...o===void 0?{}:{stepRef:o},...i===void 0?{}:{reorderTo:i},options:Ut(r,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,r){return this.plan("update-step",t,r,n)}planCompleteStep(t,n,r={}){return this.plan("complete-step",t,r,n)}planBlockStep(t,n,r){return this.plan("block-step",t,r,n)}planReorderStep(t,n,r,o={}){return this.plan("reorder-step",t,o,n,r)}planRemoveStep(t,n,r={}){return this.plan("remove-step",t,r,n)}planLink(t,n,r){return this.plan("link",t,r,n)}planUnlink(t,n,r){return this.plan("unlink",t,r,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",Ge(t))}update(t,n={}){return this.runTyped("update",{id:t,...Ge(n)})}reopen(t,n,r={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:r})}close(t,n,r={}){return this.runTyped("close",{id:t,reason:n,...Ge(r)})}claim(t,n={}){return this.runTyped("claim",{id:t,...Ge(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...Ge(t)})}release(t,n={}){return this.runTyped("release",{id:t,...Ge(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...Ge(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...Ge(n)})}restore(t,n,r={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...r,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...Ge(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...Ge(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...Ge(n)})}closeTask(t,n,r={}){return this.runTyped("close-task",{id:t,reason:n,...Ge(r)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function qF(e={},t={}){return new U(t).context(e)}function KF(e={},t={}){return new U(t).list(e)}function zF(e={},t={}){return new U(t).listAllComplete(e)}function BF(e,t={},n={}){return new U(n).search(e,t)}function HF(e,t={},n={}){return new U(n).get(e,t)}function VF(e={},t={}){return new U(t).next(e)}function WF(e={},t={}){return new U(t).aggregate(e)}function YF(e,t={},n={}){return new U(n).comments(e,t)}function JF(e,t={},n={}){return new U(n).notes(e,t)}function XF(e,t={},n={}){return new U(n).learnings(e,t)}function QF(e,t={},n={}){return new U(n).files(e,t)}function ZF(e,t={},n={}){return new U(n).filesDiscover(e,t)}function eM(e,t={},n={}){return new U(n).docs(e,t)}function tM(e,t={},n={}){return new U(n).deps(e,t)}function nM(e,t={},n={},r={}){return new U(r).graph(e,t,n)}function rM(e,t,n={},r={}){return new U(r).append(e,t,n)}function oM(e={},t={}){return new U(t).create(e)}function iM(e,t={},n={}){return new U(n).update(e,t)}function sM(e,t,n={},r={}){return new U(r).reopen(e,t,n)}function aM(e,t,n={},r={}){return new U(r).close(e,t,n)}function cM(e,t={},n={}){return new U(n).claim(e,t)}function lM(e={},t={}){return new U(t).claimNext(e)}function dM(e,t={},n={}){return new U(n).release(e,t)}function mM(e,t={},n={}){return new U(n).copy(e,t)}function uM(e,t={},n={}){return new U(n).delete(e,t)}function pM(e,t,n={},r={}){return new U(r).restore(e,t,n)}function fM(e,t={},n={}){return new U(n).focus(e,t)}var Bw=xu(),_M=new jF;function Bs(){ba(Bd()),ka(Hd()),Sa(Vd()),Ea(Wd()),Aa(Yd()),Ta(Jd()),Ca(Xd())}async function hM(e,t,n,r){return Pu(()=>t===void 0?Bw.read(()=>Hw(e,n,r)):Bw.write(()=>yM(t,()=>Hw(e,n,r))))}async function Hw(e,t,n){let r=E(t,e.path);if(e.noExtensions)return Bs(),gc({pmRoot:r},()=>n(null));if(!await G(ue(r)))return Bs(),n(null);let o=null,i;try{let s=await A(r),a=await or({pmRoot:r,settings:s,cwd:t,noExtensions:!1}),c=await ir({...a,loaded:a.loaded});i={loadResult:a,activationResult:c},ba(c.hooks),ka(c.commands),Sa(c.parsers),Ea(c.preflight),Aa(c.services),Ta(c.renderers),Ca(c.registrations),o={registrations:c.registrations,commands:c.commands,pmRoot:r,packages:a.loaded}}catch(s){Bs(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",s)}try{return await gc({pmRoot:r,packages:o?.packages},()=>n(o))}finally{Bs(),i&&await ua(i.loadResult,i.activationResult).catch(()=>{})}}async function gM(e,t,n,r,o){if(!o)throw new l(`Unsupported native pm action: ${e}`,d.USAGE);let i=Dn(e),a=o.registrations.commands.find(m=>Dn(m.action)===i)?.command??o.commands.handlers.find(m=>Dn(m.command)===i)?.command;if(!a)throw new l(`Unsupported native pm action: ${e}`,d.USAGE);let c=await Ho({command:Ja(a),args:he(n.args??t.args),options:Xa(t,n),global:r,pm_root:o.pmRoot,sdk:nh(o.pmRoot,U.forActiveExtensionHost({pmRoot:o.pmRoot,author:typeof r.author=="string"&&r.author.trim()?r.author.trim():"pm-extension"}))});if(!c.handled){let m=c.warnings.length>0?` (${c.warnings.join(", ")})`:"";throw new l(`Unsupported native pm action: ${e}${m}`,d.USAGE)}return c.result}async function yM(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}function vM(e){let t=Pe(e,"action"),n=Dn(t),r=yn(lh,n),o=r?.action??n,i={...e,action:o};return r?.options!==void 0&&(i.options={...r.options,...da(e.options)}),o==="package"&&(i.options={...da(i.options),vocabulary:"package"}),{action:o,args:i}}async function Ww(e){let t=vM(e),n=Wa(t.args),r=Nf(t.action),o=w(t.args,"cwd"),i=o??process.cwd();t.action==="init"&&(n[bc]=i),(t.action!=="init"||n.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(n.path=E(i,n.path));try{return t.action==="history-attest"?await hd(t.action,t.args,n,null):e[Vw]===!0||_M.getStore()===!0?await hd(t.action,t.args,n,null):await hM(n,o,i,s=>hd(t.action,t.args,n,s))}finally{r&&sd()}}async function hd(e,t,n,r){let o=Ya(t,e);xa(e,o),Fu(e,o);let i={action:e,args:t,options:o,id:w(t,"id"),force:t.force===!0||o.force===!0,global:n,activeExtensions:r},s=yn(Pw,e),a=s?await s(i):await gM(e,t,o,n,r);if(e==="history-attest")return a;{o.resolvedOutputFormat="json";let c=Gu(e,o,a);return await eh(E(process.cwd(),n.path),c),c}}var wM={closeManyOptionsFromFlat:Si,extensionOptionsFromArgs:Xa,globalOptions:Wa,mutationListOptions:Lf,normalizeActionName:Dn,normalizeCommandPath:Ja,normalizeMcpUpdateOptions:Ff,normalizeMcpOptionsArrays:Pf,optionsWithAuthor:Ya,readRequiredString:Pe,readScalarString:Rf,readScalarStringAllowBlank:Of,readStringArray:he,updateManyOptionsFromFlat:Ei,withAddNoteOption:Ar,withFilesDiscoveryOptions:ki,withMutationCompaction:ge};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=wM);(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]="48d03e9b-14a4-545c-8e5d-5f5f2092a113")}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]="38023567-8a5b-5e25-8d71-5112f74d1894")}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]="3eaa41f7-77a1-5838-8a2f-2ab6a49c21ef")}catch{}})();export{In as AGENT_PROVENANCE_DIMENSIONS,cp as BASELINE_ITEM_FORMAT_VERSION,Wb as BUILTIN_AGENT_PROVENANCE_ADAPTERS,pr as BUILTIN_HARNESS_SIGNAL_DESCRIPTORS,to as BUILTIN_ITEM_TYPE_VALUES,ro as CONFIDENCE_TEXT_VALUES,lp as CURRENT_ITEM_FORMAT_VERSION,Vt as DEPENDENCY_KIND_VALUES,d as EXIT_CODE,wn as ISSUE_SEVERITY_VALUES,Od as ITEM_TYPE_VALUES,yc as PM_CLI_EXPECTED_ERROR_NAME,Lb as PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,Pb as PM_READ_OUTPUT_DIMENSIONS,Nb as PM_READ_OUTPUT_OPTION_FLAGS,Ra as PM_READ_OUTPUT_SURFACE_CONTRACTS,l as PmCliError,U as PmClient,vn as RISK_VALUES,ck as SEMANTIC_ATTRIBUTION_LIMITS,no as STATUS_VALUES,Vb as agentSessionEnvironment,WF as aggregate,ql as analyzeAgentProvenanceDescriptorCoverage,Kb as analyzeSdkCliParameterCompleteness,rM as append,Fb as applyReadOutputDimensions,Gb as applyReadOutputSessionReferences,jb as attachReadOutputSessionReceipt,zb as boundAgentEpisodeIdentity,et as canonicalDocument,cM as claim,lM as claimNext,up as classifyItemFormatVersion,aM as close,YF as comments,qF as context,mM as copy,oM as create,th as createPmCliExpectedError,xb as decodeReadOutputContinuationCursor,uM as deleteItem,tM as deps,tk as detectAgentIdentity,ok as detectHarnessIdentity,nk as diagnoseAgentIdentity,eM as docs,dp as effectiveItemFormatVersion,Nw as emptyImportedDocument,Ob as encodeReadOutputContinuationCursor,sP as evaluateSemanticAttributionCoverage,sk as explainSourceTraceability,QF as files,ZF as filesDiscover,fM as focus,HF as get,nM as graph,aP as groupHistoryByEpisode,Jg as isAlreadyClaimedError,Ui as isPmCliExpectedError,Mb as isReadOutputBudgetExceeded,XF as learnings,KF as list,Jb as listAgentProvenanceAdapters,zF as listAllComplete,VF as next,Qb as normalizeAgentProvenanceAdapterValue,mp as normalizeItemFormatVersion,qe as normalizeItemId,ee as normalizeStatusInput,JF as notes,S as nowIso,Ub as parseReadOutputSession,Ti as parseSourceLineRange,Zo as readAuthorEnvironment,qb as readOutputSessionRemainingTokens,ac as recordClaimSemanticAttribution,Li as recordFocusSemanticAttribution,cc as recordReleaseSemanticAttribution,Xb as registerAgentProvenanceAdapters,Yb as registerHarnessSignalDescriptors,dM as release,sM as reopen,Bb as resolveAgentSessionContextFromSignals,ik as resolveAuthorIdentity,Av as resolveHistoryEpisodeGroupIdentity,$b as resolveReadOutputDimensions,Db as resolveReadOutputEncoding,Oa as resolveReadOutputSurface,ak as resolveSemanticLineageIds,pM as restore,Ww as runAction,Hb as runWithAgentSessionContext,Zb as runWithHarnessDetectionSignals,ek as runWithWorkspaceHarnessSignalDescriptors,BF as search,lk as semanticAttributionAffinity,Be as serializeItemDocument,iP as summarizeAgentModelProvenance,Kl as summarizeAgentProvenance,iM as update,xa as validateReadOutputOptions,rk as writeAuthorEnvironment};
35
+ `)}catch{}},i$=async(e,t,n)=>{let r=[],o=0;for(let i of e){let s=await Us(i.id,{run:!1},{...t,path:n});o+=s.tests.length,r.push({item:i,tests:s.tests})}return{itemTests:r,linkedTests:o}},s$=async e=>{let t=F(e.settings.schema),n=x(e.settings,O()),r=zL(e.options.status,t),o=Aw(e.options.limit,"--limit"),i=Aw(e.options.offset,"--offset")??0,a=(await fe(e.pmRoot,e.settings.item_format,n.type_to_folder,void 0,e.settings.schema)).filter(m=>r?m.status===r:!0).sort((m,u)=>m.id.localeCompare(u.id));return{filteredItems:o===void 0?a.slice(i):a.slice(i,i+o),statusFilter:r,limitFilter:o,offsetFilter:i}},a$=e=>{let t=new Map;for(let{tests:n}of e)for(let r of n){let o=Cw(r);if(!t.has(o)){t.set(o,r.timeout_seconds);continue}t.set(o,n$(t.get(o),r.timeout_seconds))}return t},c$=async(e,t)=>{let n=[],r=e.tests.map(u=>{let p=Cw(u),f=t.seenTestKeys.has(p);if(!f){t.seenTestKeys.add(p);let _=t.effectiveTimeoutByKey.get(p);n.push(_===void 0?u:{...u,timeout_seconds:_})}return{test:u,key:p,duplicate:f}}),o=n.length>0?await od(n,t.defaultTimeoutSeconds,{progress:t.options.progress,sourceRoots:t.sourceRoots,envSet:t.options.envSet,envClear:t.options.envClear,sharedHostSafe:t.options.sharedHostSafe,pmContext:t.options.pmContext,overrideLinkedPmContext:t.options.overrideLinkedPmContext,failOnContextMismatch:t.options.failOnContextMismatch,failOnEmptyTestRun:t.options.failOnEmptyTestRun,requireAssertionsForPm:t.options.requireAssertionsForPm,checkContext:t.options.checkContext,autoPmContext:t.options.autoPmContext,workspaceContext:t.options.workspaceContext,overrideLinkedWorkspaceContext:t.options.overrideLinkedWorkspaceContext,pmRoot:t.pmRoot,allowUntrustedLinkedTests:t.options.allowUntrustedLinkedTests,untrustedLinkedTestsPolicyEnabled:t.settings.testing.allow_untrusted_linked_tests}):[],i=0,s=r.map(({test:u,key:p,duplicate:f})=>{if(!f){let _=o[i];return i+=1,_}return{command:u.command,path:u.path,status:"skipped",error:`Duplicate linked test skipped (key=${p}).`}}),a=r$(s),c=Ds(s),m=await m$(e,a,s,t);return{passed:a.passed,failed:a.failed,skipped:a.skipped,trackingWarnings:m,failureCategories:c,result:{ok:a.failed===0&&!(t.options.failOnSkipped===!0&&a.skipped>0),id:e.item.id,status:e.item.status,test_count:e.tests.length,passed:a.passed,failed:a.failed,skipped:a.skipped,run_results:s,failure_categories:c}}},l$=(e,t)=>[e.failed>0,t.failOnSkipped===!0&&e.skipped>0].includes(!0),d$=e=>e?!0:void 0,m$=async(e,t,n,r)=>{if(!r.trackingEnabled)return[];try{let o=l$(t,r.options);await xs({pmRoot:r.pmRoot,settings:r.settings,itemId:e.item.id,author:r.trackingAuthor,message:`Track test-all run summary (${r.trackingRunId})`,entry:{run_id:r.trackingRunId,kind:"test-all",status:o?"failed":"passed",started_at:r.runStartedAt,finished_at:S(),recorded_at:S(),attempt:r.trackingAttempt,resumed_from:r.trackingResumedFrom,passed:t.passed,failed:t.failed,skipped:t.skipped,items:1,linked_tests:e.tests.length,fail_on_skipped_triggered:d$(r.options.failOnSkipped===!0&&t.skipped>0),executions:n.filter(i=>i.command?.trim()).slice(0,32).map(i=>({command:i.command.trim(),requested_pm_context_mode:i.execution_context?.requested_pm_context_mode,pm_context_mode:i.execution_context?.pm_context_mode,workspace_context_mode:i.execution_context?.workspace_context_mode,trust_reason:i.execution_context?.trust.reason}))}})}catch(o){return[`test_result_tracking_failed:${e.item.id}:${HL(o)}`]}return[]},u$=()=>{let e=process.env.PM_BACKGROUND_TEST_RUN_ATTEMPT?.trim(),t=e?Number.parseInt(e,10):Number.NaN;return Number.isFinite(t)&&t>=1?t:void 0},id=e=>{let t=e?.trim();return t&&t.length>0?t:void 0},p$=e=>({pmRoot:e.pmRoot,settings:e.settings,options:e.options,defaultTimeoutSeconds:e.defaultTimeoutSeconds,sourceRoots:{projectPmRoot:e.pmRoot,globalPmRoot:ct(process.cwd())},seenTestKeys:new Set,effectiveTimeoutByKey:a$(e.itemTests),trackingEnabled:e.settings.testing.record_results_to_items===!0,trackingAuthor:C(e.options.author,e.settings.author_default),trackingRunId:VL(),trackingAttempt:u$(),trackingResumedFrom:id(process.env.PM_BACKGROUND_TEST_RUN_RESUMED_FROM),runStartedAt:e.runStartedAt}),f$=(e,t,n)=>{let r={results:[],passed:0,failed:0,skipped:0,failureCategories:Ds([]),trackingWarnings:[]},o=e.failOnEmptyTestRun===!0&&t===0;return o&&(r.failed+=1,r.failureCategories.empty_run+=1,r.trackingWarnings.push(`empty_linked_test_selection:items=${n.length};linked_tests=0;fail_on_empty_test_run=true`)),{accumulation:r,failOnEmptyTestRunTriggered:o}},_$=async(e,t,n)=>{for(let[r,o]of e.entries()){js(t.options,`item ${r+1}/${e.length} start id=${o.item.id} linked_tests=${o.tests.length}`);let i=await c$(o,t);o$(n.failureCategories,i.failureCategories),n.passed+=i.passed,n.failed+=i.failed,n.skipped+=i.skipped,n.trackingWarnings.push(...i.trackingWarnings),n.results.push(i.result),js(t.options,`item ${r+1}/${e.length} end id=${o.item.id} status=${i.failed===0?"passed":"failed"} passed=${i.passed} failed=${i.failed} skipped=${i.skipped}`)}},h$=(e,t)=>{if(e.checkContext!==!0)return;let n=t.results.flatMap(o=>o.run_results),r=rd(n);t.trackingWarnings.push(`context_preflight:checked_pm_commands=${r.checked_pm_commands};tracker_read_commands=${r.tracker_read_commands};mismatches=${r.mismatches};auto_remediated=${r.auto_remediated}`)},g$=e=>({ok:e.ok,totals:{items:e.filteredItems.length,linked_tests:e.linkedTests,passed:e.accumulation.passed,failed:e.accumulation.failed,skipped:e.accumulation.skipped,failure_categories:e.accumulation.failureCategories},failed:e.accumulation.failed,passed:e.accumulation.passed,skipped:e.accumulation.skipped,fail_on_skipped_triggered:e.failOnSkippedTriggered?!0:void 0,fail_on_empty_test_run_triggered:e.failOnEmptyTestRunTriggered?!0:void 0,warnings:e.accumulation.trackingWarnings.length>0?e.accumulation.trackingWarnings:void 0,results:e.accumulation.results}),y$=e=>[`selection items=${e.filteredItems.length}`,`linked_tests=${e.linkedTests}`,e.statusFilter===void 0?"":`status=${e.statusFilter}`,e.limitFilter===void 0?"":`limit=${e.limitFilter}`,e.offsetFilter>0?`offset=${e.offsetFilter}`:""].filter(t=>t.length>0).join(" "),v$=async(e,t)=>{let n=E(process.cwd(),t.path);await I(n);let r=await A(n),o=await s$({pmRoot:n,settings:r,options:e}),i=BL(e.timeout),s=S(),a=await i$(o.filteredItems,t,n);return js(e,y$({...o,linkedTests:a.linkedTests})),{pmRoot:n,settings:r,filteredItems:o.filteredItems,itemTests:a.itemTests,linkedTests:a.linkedTests,defaultTimeoutSeconds:i,runStartedAt:s}},w$=e=>{let t=e.options.failOnSkipped===!0&&e.accumulation.skipped>0,n=![e.accumulation.failed>0,t,e.failOnEmptyTestRunTriggered].includes(!0);return{failOnSkippedTriggered:t,ok:n}},Iw=async(e,t)=>{let n=await v$(e,t),{accumulation:r,failOnEmptyTestRunTriggered:o}=f$(e,n.linkedTests,n.filteredItems),i=p$({pmRoot:n.pmRoot,settings:n.settings,options:e,itemTests:n.itemTests,defaultTimeoutSeconds:n.defaultTimeoutSeconds,runStartedAt:n.runStartedAt});await _$(n.itemTests,i,r),h$(e,r);let s=w$({options:e,accumulation:r,failOnEmptyTestRunTriggered:o});return js(e,`end status=${s.ok?"passed":"failed"} items=${n.filteredItems.length} linked_tests=${n.linkedTests} passed=${r.passed} failed=${r.failed} skipped=${r.skipped}`),g$({ok:s.ok,filteredItems:n.filteredItems,linkedTests:n.linkedTests,accumulation:r,failOnSkippedTriggered:s.failOnSkippedTriggered,failOnEmptyTestRunTriggered: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]="419a061f-e181-5b18-9e3a-d22cc5aff416")}catch{}})();function Rw(e,t,n){let r;if(typeof e.lines=="string")r=Ti(e.lines);else if(e.lineRange!==void 0){if(e.lineRange===null||typeof e.lineRange!="object"||Array.isArray(e.lineRange))throw new RangeError("Source line range must be an object with numeric start and end values.");r=Ti(`${String(Reflect.get(e.lineRange,"start"))}:${String(Reflect.get(e.lineRange,"end"))}`)}return{paths:t,scope:e.scope==="project"||e.scope==="global"?e.scope:void 0,limit:n(e.limit,"files lookup limit"),offset:n(e.offset,"files lookup offset"),noTruncate:e.noTruncate===!0,strictRead:e.strictRead===!0,explain:e.explain===!0,lineRange:r,decisionDepth:n(e.decisionDepth,"files lookup decision depth")}}(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]="c6f4c40f-50cf-568f-8a45-860ac4be3c97")}catch{}})();function Pe(e,t){let n=w(e,t);if(!n)throw new l(`Missing required argument: ${t}`,64);return n}function yn(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}(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]="1b86373f-26a3-5893-95dc-e794fcc1afa1")}catch{}})();function b$(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=e.args.alias??e.options.alias;return{ctx:e,subcommand:t.trim().toLowerCase(),name:w(e.args,"name")??w(e.options,"name"),author:w(e.args,"author")??w(e.options,"author"),force:e.args.force===!0||e.options.force===!0,aliases:n===void 0?void 0:he(n)}}function k$(e){let{ctx:t,subcommand:n,name:r,author:o,force:i}=e,a=yn({list:()=>gf(t.global),show:()=>yf(r,t.global),"show-status":()=>vf(r,t.global),"list-fields":()=>kf(t.global),"show-field":()=>Sf(r,t.global),"remove-type":()=>pf(r,{author:o,force:i},t.global),"remove-field":()=>bf(r,{author:o,force:i},t.global),"remove-status":()=>hf(r,{author:o,force:i},t.global),"apply-preset":()=>Ef(w(t.args,"typePreset")??w(t.options,"typePreset"),{author:o,force:i},t.global)},n);return a?a():null}function S$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e,s=t.args.commands??t.options.commands,a=t.args.requiredTypes??t.options.requiredTypes;return wf(n,{type:w(t.args,"fieldType")??w(t.options,"fieldType"),commands:s===void 0?void 0:he(s),description:w(t.args,"description")??w(t.options,"description"),cliFlag:w(t.args,"cliFlag")??w(t.options,"cliFlag"),alias:i,required:t.args.required===!0||t.options.required===!0,requiredOnCreate:t.args.requiredOnCreate===!0||t.options.requiredOnCreate===!0,allowUnset:!(t.args.allowUnset===!1||t.options.allowUnset===!1),requiredTypes:a===void 0?void 0:he(a),author:r,force:o},t.global)}function E$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e,s=t.args.role??t.options.role;return _f(n,{role:s===void 0?void 0:he(s),alias:i,description:w(t.args,"description")??w(t.options,"description"),order:Fe(t.args.order??t.options.order,"schema add-status order"),author:r,force:o},t.global)}function A$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e;return uf(n,{description:w(t.args,"description")??w(t.options,"description"),defaultStatus:w(t.args,"defaultStatus")??w(t.args,"default_status")??w(t.options,"defaultStatus")??w(t.options,"default_status"),folder:w(t.args,"folder")??w(t.options,"folder"),alias:i,author:r,force:o},t.global)}function T$(e){let{ctx:t,subcommand:n,name:r,author:o,force:i}=e,s=w(t.args,"to")??Pe(t.options,"to"),a=w(t.args,"migrationId")??w(t.args,"migration_id")??w(t.options,"migrationId")??w(t.options,"migration_id"),c=w(t.args,"fieldTypeScope")??w(t.options,"fieldTypeScope")??w(t.args,"type")??w(t.options,"type"),m=n==="rename-type"?{kind:"rename-type",from:r??"",to:s}:n==="rename-field"?{kind:"rename-field",from:r??"",to:s,...c===void 0?{}:{type:c}}:{kind:"remap-status",from:r??"",to:s};return df(m,{migrationId:a,dryRun:t.args.dryRun===!0||t.options.dryRun===!0,author:o,force:i},t.global)}function Ow(e){let t=b$(e);Rp(t.subcommand,e.args.dryRun===!0||e.options.dryRun===!0);let n=En.find(o=>o===t.subcommand);if(n)return lf(n,t.name,{definition:e.args.definition??e.options.definition,policy:w(e.args,"policy")??w(e.options,"policy"),message:w(e.args,"message")??w(e.options,"message"),author:t.author,dryRun:e.args.dryRun===!0||e.options.dryRun===!0},e.global);let r=k$(t);if(r!==null)return r;if(["rename-type","rename-field","remap-status"].includes(t.subcommand))return T$(t);if(t.subcommand==="add-field")return S$(t);if(t.subcommand==="add-status")return E$(t);if(t.subcommand==="add-type")return e.args.infer===!0||e.options.infer===!0?Af({minCount:Fe(e.args.minCount??e.options.minCount,"schema infer minCount"),apply:e.args.apply===!0||e.options.apply===!0,author:t.author,force:t.force},e.global):A$(t);throw Te({command_path:"schema",token:t.subcommand,allowed:mf,exit_code:64})}(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]="a23d5ebd-6257-53e1-bed4-815b99a10bbb")}catch{}})();function qs(e){return w(e.args,"target")??w(e.options,"target")}function we(e,t=e.options){return e.id??Pe(t,"id")}async function C$(e){let t=Cn("list",e.options);return t.compact===void 0&&t.brief===void 0&&t.full===void 0&&t.fields===void 0&&t.includeBody===void 0&&(t.compact=!0),kc(await ht(w(e.args,"status")??w(t,"status"),t,e.global),t)}async function I$(e){let t=Pe(e.args,"query"),n=Cn("search",e.options,[t]);return n.compact===void 0&&n.full===void 0&&n.fields===void 0&&(n.compact=!0),kc(await Or(t,n,e.global),n)}async function R$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=ge(e.args,e.options);return Ee(await jt(r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function O$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=ge(e.args,e.options),o={...r,...r.title===void 0&&typeof e.args.title=="string"?{title:e.args.title}:{},...r.message===void 0&&typeof e.args.message=="string"?{message:e.args.message}:{}};return Ee(await Gc(we(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function x$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=ge(e.args,e.options);return Ee(await ot(we(e,r),r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function P$(e){let t=ji(e.options);return t.add===void 0&&t.stdin===void 0&&t.file===void 0&&t.edit===void 0&&t.delete===void 0&&(t.includeMeta=!0,t.limit===void 0&&t.fullHistory!==!0&&(t.limit="20")),fh(we(e),t,e.global)}function xw(e,t){return jf(Rw(e.options,t,Fe),e.global)}function N$(e){let t=he(e.options.lookupPath);if(t&&t.length>0)return xw(e,t);let n=we(e);return e.options.discover===!0?Za(n,ki(e.options),e.global):Gf(n,Ar(e.options),e.global)}function L$(e){return zv({subcommand:w(e.args,"subcommand")??w(e.options,"subcommand"),limit:xf(e.args,e.options)},e.global)}function $$(e){let t={...e.options};return t.brief===void 0&&t.summary===void 0&&t.full===void 0&&(t.summary=!0),Tr(e.global,t)}function F$(e){let t=w(e.args,"configAction")??w(e.options,"configAction")??w(e.options,"action");if(t===void 0)throw new l("Missing required argument: configAction",64);let n=w(e.args,"value")??w(e.options,"value"),r=w(e.options,"policy")!==void 0&&n!==void 0?{...e.options,value:n}:e.options;return Fh(w(e.args,"scope")??w(e.options,"scope")??"project",t,w(e.args,"key")??w(e.options,"key"),r,e.global,w(e.options,"policy")===void 0?n:void 0)}function M$(e){let t=e.options;return E_(S_(t),e.global)}function D$(e,t){if(typeof e=="number"){if(!Number.isFinite(e)||!Number.isInteger(e))throw new l(`${t} must be a finite integer.`,64);return e}if(typeof e=="string"&&e.trim().length>0){let n=e.trim();if(!/^[+-]?\d+(?:st|nd|rd|th)?$/i.test(n))throw new l(`${t} must be a finite integer.`,64);let r=Number.parseInt(n,10);if(!Number.isInteger(r))throw new l(`${t} must be a finite integer.`,64);return r}}function U$(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=e.options;return fy({subcommand:t,id:typeof e.id=="string"?e.id:typeof n.id=="string"?n.id:void 0,stepRef:G$(e),reorderTo:D$(n.reorderTo??e.args.reorderTo,"plan reorderTo"),options:e.options,global:e.global})}function G$(e){return typeof e.options.stepRef=="string"?e.options.stepRef:typeof e.args.stepRef=="string"?e.args.stepRef:void 0}function j$(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=t.trim().toLowerCase(),r=w(e.args,"name")??w(e.options,"name"),i=yn({list:()=>Ry(),show:()=>Oy(r),lint:()=>xy(r),apply:()=>Py(r,{dryRun:e.args.dryRun===!0||e.options.dryRun===!0,author:w(e.args,"author")??w(e.options,"author"),force:e.args.force===!0||e.options.force===!0},e.global)},n);if(!i)throw Te({command_path:"profile",token:t,allowed:Iy,exit_code:64});return i()}async function q$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=ge(e.args,e.options);return Ee(await Yh(we(e,r),r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function K$(e){let{changedFields:t,runnerOptions:n}=ge(e.args,e.options);return Ee(await vy(Ei(n),e.global),{changedFields:t})}async function z$(e){let{changedFields:t,runnerOptions:n}=ge(e.args,e.options),r=w(e.args,"reason"),o=r!==void 0&&n.reason===void 0?{...n,reason:r}:{...n};return e.force&&o.force===void 0&&(o.force=!0),Ee(await ig(Si(o),e.global),{changedFields:t})}async function B$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=ge(e.args,e.options),o=w(r,"target")??Pe(e.args,"target");return Ee(await rn(we(e,r),o,r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function H$(e){let t={...e.args,...e.options};return qf(Pe(t,"subcommand"),w(t,"id")??e.id,w(t,"target"),$f(t),e.global)}function V$(e){return Mf(E(process.cwd(),e.global.path),{...e.args,...e.options})}var Pw={init:e=>Nr(w(e.args,"prefix"),e.global,e.options),context:e=>lc(Cn("context",e.options),e.global),next:e=>Rr(Cn("next",e.options),e.global),eval:uv,events:pv,merge:fv,workspace:_v,meet:Cs,event:Cs,remind:Cs,list:C$,get:e=>{let t=we(e);return mc(t,e.global,Cn("get",e.options,[t]))},search:I$,duplicates:e=>{let t=typeof e.options.status=="string"?[e.options.status]:he(e.options.status);return Qa(e.global,{exhaustive:e.options.exhaustive===!0,...t.length===0?{}:{status:t},since:w(e.options,"since"),threshold:typeof e.options.threshold=="number"?e.options.threshold:void 0,limit:e.options.limit==="default"?void 0:Fe(e.options.limit,"limit")})},create:R$,copy:O$,focus:e=>Zc(e.id,{clear:e.options.clear===!0||e.args.clear===!0},e.global),update:x$,"item-reopen":ty,restore:B$,claim:Qg,release:ey,"start-task":e=>pn(e,"start_task"),"pause-task":e=>pn(e,"pause_task"),"close-task":e=>pn(e,"close_task"),close:Zg,comments:P$,notes:e=>wy(we(e),ji(e.options),e.global),learnings:e=>Wh(we(e),ji(e.options),e.global),files:N$,docs:e=>Uf(we(e),Ar(e.options),e.global),test:e=>Us(we(e),e.options,e.global),"test-all":e=>Iw(e.options,e.global),telemetry:L$,validate:e=>Pi(e.options,e.global,{runUpdate:(t,n,r)=>ot(t,n,r)}),health:$$,assurance:e=>__(e.args,e.options,e.global),contracts:e=>_c(e.options,e.global),config:F$,activity:M$,aggregate:e=>dc(e.options,e.global),extension:e=>Mn(qs(e),e.options,e.global),package:e=>Mn(qs(e),e.options,e.global),install:e=>Mn(qs(e),{...e.options,install:!0},e.global),upgrade:e=>g_(qs(e),e.options,e.global),delete:e=>Qc(we(e),e.options,e.global),deps:e=>Df(we(e),e.options,e.global),graph:H$,"files-discover":e=>Za(we(e),e.options,e.global),"files-lookup":e=>xw(e,he(e.options.paths)),history:e=>A_(we(e),e.options,e.global),"history-redact":e=>Vh(we(e),e.options,e.global),"history-repair":qh,"history-compact":Kh,"history-attest":e=>y_(e.options,e.global),"history-author-acknowledge":V$,plan:U$,schema:Ow,profile:j$,stats:e=>zl(e.global,hv(e.options)),append:q$,"update-many":K$,"close-many":z$,gc:e=>h_(e.global,e.options)};(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]="e8137f8b-745a-5ef5-9e7e-14b7d032c1ea")}catch{}})();var W$=new Map;function sd(){W$.clear()}(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]="0c84b11c-502f-5c33-a757-5757402357b4")}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]="b841f903-6276-5067-842f-6a6bff114cec")}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]="4277a72c-f012-55d2-9e18-c9a836d829d6")}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]="aba4af26-98d3-53aa-8b23-1be7c90a38d1")}catch{}})();function Nw(){return{metadata:{},body:""}}(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]="5b106ed0-ef19-58a4-a7d0-bd0988482f58")}catch{}})();var $w=[{id:"capabilities",aliases:["capability-map","families","routing"],title:"Generated Capability Routing",summary:"Route work through command families generated from the canonical agent capability contract.",intent:"Use this as the drift-free entrypoint when selecting a CLI, MCP, completion, documentation, or extension command surface.",commands:Zu().flatMap(({commands:e})=>e.map(t=>`pm ${t}`)),workflows:[],docs:[{path:"docs/generated/AGENT_CAPABILITY_ROUTING.md",purpose:"Generated command-to-family routing table."},{path:"docs/generated/AGENT_COMMAND_SURFACE.md",purpose:"Generated visibility-tier and family table."}],related:["commands","workflows","extensions"]},{id:"quickstart",aliases:["start","getting-started","bootstrap"],title:"Quickstart",summary:"Initialize a tracker and run the shortest safe plan -> execute -> close loop.",intent:"Use this when a human or agent needs to start productive work quickly with minimal context load.",commands:["pm workspace init","pm workspace config --help","pm workspace schema --help","pm workspace profile --help","pm context --limit 10","pm list --status open --limit 20",'pm create --create-mode progressive --title "..." --description "..." --type Task',"pm claim <ID>","pm update <ID> --status in_progress",'pm close <ID> "<reason with evidence>" --validate-close warn'],workflows:[{name:"Start Session Safely",goal:"Bootstrap without mutating unrelated state.",prompt:"You are bootstrapping pm work. Use a token-efficient context snapshot first, then select one open item, claim it, and only then mutate.",commands:["pm context --limit 10","pm list --status open --limit 20","pm claim <ID>"]}],docs:[{path:"README.md",purpose:"High-level project and install entrypoint."},{path:"docs/QUICKSTART.md",purpose:"Short setup and first-command walkthrough."},{path:"docs/COMMANDS.md",purpose:"Task-oriented command recipes."}],related:["commands","workflows","release"]},{id:"commands",aliases:["cli","operations","reference"],title:"CLI Command Routing",summary:"Find the right command family quickly and use command-scoped help/contracts output.",intent:"Use this when selecting command paths, flags, and output formats for implementation or automation.",commands:["pm --help","pm <command> --help","pm <command> --help --explain","pm contracts --command <command> --flags-only","pm contracts --command <command> --availability-only --runtime-only","pm completion <bash|zsh|fish>"],workflows:[{name:"Flag Discovery",goal:"Resolve command flags deterministically before mutations.",prompt:"You are preparing to run a command. Use help and contracts surfaces to verify required/optional flags before execution.",commands:["pm <command> --help --explain","pm contracts --command <command> --flags-only"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Command grouping and examples."},{path:"docs/CONFIGURATION.md",purpose:"Project/global settings and policy controls."},{path:"docs/TESTING.md",purpose:"Linked-test orchestration and safety guidance."}],related:["quickstart","workflows","sdk","extensions"]},{id:"workflows",aliases:["developer","maintainer","agent"],title:"Developer and Agent Workflows",summary:"Apply canonical claim -> execute -> verify -> close workflows with append-only evidence.",intent:"Use this for day-to-day coding-agent execution loops and handoff-safe updates.",commands:["pm claim <ID>","pm update <ID> --status in_progress","pm files <ID> --add ...","pm test <ID> --add ...",'pm comments <ID> "..."',"pm validate --check-resolution --check-history-drift","pm release <ID>"],workflows:[{name:"Execution Loop",goal:"Keep code, tests, and tracker evidence synchronized.",prompt:"You are implementing a scoped change. Claim first, link files/tests/docs as you go, append evidence comments, and close only after validation.",commands:["pm claim <ID>","pm update <ID> --status in_progress","pm files <ID> --add path=<file>,scope=project","pm test <ID> --run --progress",'pm close <ID> "<evidence>" --validate-close warn']}],docs:[{path:"AGENTS.md",purpose:"Repository operating rules and required workflow."},{path:"docs/AGENT_GUIDE.md",purpose:"Agent-oriented usage and context strategy."},{path:"docs/TESTING.md",purpose:"Sandbox-safe test execution rules."}],related:["quickstart","commands","skills"]},{id:"sdk",aliases:["api","typescript-sdk"],title:"SDK and Integrations",summary:"Use the published SDK surface for extension authoring and contract-safe integrations.",intent:"Use this when building or reviewing programmatic integrations against @unbrained/pm-cli/sdk.",commands:["pm contracts --schema-only","pm contracts --command extension --flags-only","pm contracts --runtime-only --availability-only"],workflows:[{name:"Integration Contract Check",goal:"Confirm action schemas and runtime availability before coding.",prompt:"You are wiring an integration. Capture schema + runtime availability first, then map your adapter payload fields to contract keys.",commands:["pm contracts --schema-only","pm contracts --availability-only --runtime-only","pm contracts --command <command> --flags-only"]}],docs:[{path:"docs/SDK.md",purpose:"Public SDK exports and extension authoring references."},{path:"docs/ARCHITECTURE.md",purpose:"Core runtime composition and extension load flow."}],related:["extensions","commands"]},{id:"extensions",aliases:["plugins","extension-authoring","packages","package-authoring"],title:"Packages and Extensions",summary:"Install, author, and diagnose packages/extensions with deterministic lifecycle controls.",intent:"Use this for package management, extension capability registration, and runtime diagnostics.",commands:["pm package install <target> --project","pm package upgrade --dry-run","pm package explore --project","pm package manage --detail summary","pm package doctor --detail deep","pm package activate <target> --project","pm package deactivate <target> --project"],workflows:[{name:"Lifecycle Triage",goal:"Diagnose extension state before forceful lifecycle actions.",prompt:"You are debugging package behavior. Inspect managed state first, then run doctor diagnostics, then apply install/adopt/activate actions.",commands:["pm package explore --project","pm package manage --detail summary","pm package doctor --detail deep","pm package upgrade --packages-only --dry-run"]}],docs:[{path:"docs/EXTENSIONS.md",purpose:"Capability model and lifecycle command usage."},{path:"docs/examples/starter-extension/README.md",purpose:"Starter extension scaffold and local development path."},{path:"docs/SDK.md",purpose:"SDK contracts used by extension implementations."}],related:["sdk","commands","skills"]},{id:"skills",aliases:["agent-skills","agentskills"],title:"Agent Skills",summary:"Skill bundles for developer, user, extensions, and sdk workflows aligned to the current CLI.",intent:"Use this when an agent needs reproducible prompts/workflows with strict compatibility metadata.",commands:["pm guide skills --depth deep","pm contracts --command guide --flags-only","pm validate --check-command-references"],workflows:[{name:"Skill Selection",goal:"Pick the narrowest compatible skill first to minimize context usage.",prompt:"Select a pm skill based on the task intent, then execute only the workflow section needed for the current change.",commands:["pm guide skills","pm guide skills --depth deep"]}],docs:[{path:"docs/AGENT_GUIDE.md",purpose:"Agent-first usage and context model."},{path:"docs/README.md",purpose:"Documentation routing with progressive disclosure."},{path:".agents/skills/README.md",purpose:"Agent skills index and routing overview."},{path:".agents/skills/pm-developer/SKILL.md",purpose:"Developer-oriented pm skill workflow."},{path:".agents/skills/pm-user/SKILL.md",purpose:"User/operator pm skill workflow."},{path:".agents/skills/pm-extensions/SKILL.md",purpose:"Extension-focused pm skill workflow."},{path:".agents/skills/pm-sdk/SKILL.md",purpose:"SDK integration pm skill workflow."}],related:["workflows","harnesses","commands"]},{id:"harnesses",aliases:["compatibility","agent-compatibility"],title:"Agent Harness Compatibility",summary:"Cross-harness compatibility guidance for docs routing.",intent:"Use this when adapting pm docs and SDK contracts for an external automation harness.",commands:["pm guide skills","pm guide commands","pm contracts --runtime-only --availability-only"],workflows:[{name:"Harness Mapping",goal:"Route each harness to the same canonical skill/docs sources.",prompt:"Map harness-specific entrypoints to the same pm guide topics and .agents/skills workflows without adding runtime harness-specific code.",commands:["pm guide harnesses --depth standard","pm guide skills --depth deep"]}],docs:[{path:"docs/AGENT_GUIDE.md",purpose:"Agent context and output-mode conventions."},{path:"docs/README.md",purpose:"Single-source documentation routing entrypoint."},{path:".agents/skills/HARNESS_COMPATIBILITY.md",purpose:"Harness compatibility matrix and usage notes."}],related:["skills","workflows"]},{id:"release",aliases:["gates","ship","release-readiness"],title:"Release and Staleness Gates",summary:"Run release gates and docs/skills freshness checks before publishing.",intent:"Use this when validating release readiness and preventing docs/skills drift.",commands:["pnpm build","pnpm test:coverage","pnpm quality:static","node scripts/release/run-gates.mjs --telemetry-mode best-effort","pnpm security:scan"],workflows:[{name:"Pre-Release Gate Sweep",goal:"Ensure code, docs, and skills are all green before publish.",prompt:"Run release gates in deterministic order and treat docs/skills freshness failures as release blockers.",commands:["pnpm build","pnpm test:coverage","node scripts/release/run-gates.mjs --telemetry-mode best-effort"]}],docs:[{path:"docs/RELEASING.md",purpose:"Release flow and safety checks."},{path:"CHANGELOG.md",purpose:"Versioned release history and unreleased notes."},{path:"scripts/release/run-gates.mjs",purpose:"Source of truth for release gate ordering."}],related:["commands","skills","workflows"]},{id:"tokens",aliases:["output","budget","context-cost","projections"],title:"Read Output and Token Budgets",summary:"Bound what a read costs before it is emitted, and resume the part a budget withheld.",intent:"Use this when an agent must keep context small: every read declares a token ceiling, degrades deterministically, and reports what it omitted.",commands:["pm contracts --summary --json","pm list --status open --output-limit 20","pm get <ID> --output-include id,title,status,dependencies","pm context --limit 10 --token-accounting","pm notes <ID> --output-cursor <cursor>","pm list --status closed --output-budget unbounded"],workflows:[{name:"Bound A Read Before Emitting It",goal:"Never pay for rows the task does not need.",prompt:"Choose the narrowest projection first, then a row limit, then a token budget. Read the omission receipt before concluding the result is complete.",commands:["pm contracts --command list --flags-only --json","pm list --status open --output-limit 20 --output-format toon","pm list --status open --token-accounting"]},{name:"Recover A Truncated Read",goal:"Continue a bounded read instead of re-running it unbounded.",prompt:"When output_budget_truncation appears, prefer the declared continuation cursor. Only widen the budget when the response declares no cursor.",commands:["pm notes <ID> --output-cursor <cursor>","pm get <ID> --output-budget 20000"]}],docs:[{path:"docs/READ_OUTPUT_CONTRACTS.md",purpose:"Budget, truncation, continuation, and omission receipts."},{path:"docs/OUTPUT_PROJECTION_CONTRACTS.md",purpose:"Field and section projection grammar for every read."},{path:"docs/OUTPUT_TOKEN_ACCOUNTING.md",purpose:"Per-section token cost receipts."},{path:"docs/ITEM_READ_PROJECTIONS.md",purpose:"Item-level projection defaults and restore hints."}],related:["commands","workflows","quickstart"]},{id:"graph",aliases:["relationships","deps","dependencies","analytics"],title:"Relationship Graph and Planning Analytics",summary:"Type the relationships between items, then read the project as a graph rather than as a list.",intent:"Use this when the question is about lineage, ordering, blast radius, bottlenecks, or which work reaches a declared outcome.",commands:["pm deps <ID>",'pm update <ID> --dep "id=<other>,kind=implements"',"pm graph analyze","pm graph impact <ID> --direction downstream","pm graph paths <ID> <ID>","pm graph audit"],workflows:[{name:"Place New Work In The Ladder",goal:"Every item resolves to an outcome through a typed, explainable path.",prompt:"Set parent lineage first, then add typed edges that cite durable evidence. Never add an edge to satisfy a count.",commands:['pm search "<topic>" --limit 10','pm update <ID> --dep "id=<parent-goal>,kind=implements"',"pm graph ancestors <ID>"]},{name:"Assess Blast Radius Before Changing Something",goal:"Know what derives from an item before touching it.",prompt:"Walk the directed graph downstream from the item, then check whether any bottleneck node sits on the path.",commands:["pm graph impact <ID> --direction downstream","pm graph dominators <ID>","pm graph articulation"]}],docs:[{path:"docs/RELATIONSHIP_GRAPH.md",purpose:"Graph model, traversal verbs, and analytics surface."},{path:"docs/DEPENDENCY_KIND_CONTRACT.md",purpose:"Every typed edge kind, its direction, and its semantics."}],related:["commands","workflows","assurance"]},{id:"assurance",aliases:["gates","invariants","measurements","quality"],title:"Declared Invariants and Gates",summary:"Express a project's own quality rules as tracked data the SDK evaluates, instead of as scripts.",intent:"Use this when a rule must hold over the record itself \u2014 a floor, a ceiling, or a monotone property \u2014 and must fail closed in CI.",commands:["pm assurance list","pm assurance run <gate-id> --trigger ci --dry-run","pm validate --check-resolution --check-history-drift","pm health --summary"],workflows:[{name:"Add An Invariant Rather Than A Script",goal:"A new enforcement gap becomes declared data, not a new bespoke gate script.",prompt:"Define the measurement, bind an assertion with an explicit bound and polarity, prove a negative control, then attach it to a trigger.",commands:["pm assurance list --json","pm assurance run <gate-id> --trigger ci --dry-run --json"]},{name:"Read A Verdict Before Believing It",goal:"Know which population a passing assertion speaks for.",prompt:"Read population_size and scope on every assertion. A gate that cannot fail for the reason it exists is not evidence.",commands:["pm assurance run <gate-id> --trigger ci --dry-run --json --output-budget unbounded"]}],docs:[{path:"docs/ASSURANCE.md",purpose:"Measurement, assertion, gate, and trigger vocabulary."},{path:"docs/MUTATION_INTEGRITY.md",purpose:"What every mutation must record to remain provable."}],related:["release","graph","workflows"]},{id:"merge",aliases:["branches","concurrency","multi-agent","fleet"],title:"Branching, Merging, and Concurrent Agents",summary:"Keep tracker data and history conflict-free while many agents work on separate branches.",intent:"Use this when more than one agent or worktree mutates the same tracker and the results must merge without hand resolution.",commands:["pm merge install","pm merge report","pm merge reconcile --dry-run","pm claim <ID>","pm release <ID>","pm validate --check-history-drift","pm health --check-only"],workflows:[{name:"Prepare A Clone For Field-Aware Merges",goal:"The committed merge fence needs clone-local driver configuration once.",prompt:"Run the merge installer in every fresh clone or worktree before the first branch merge of tracker data.",commands:["pm merge install","pm health --check-only"]},{name:"Settle A Merge Before Trusting Health",goal:"A lossless merge still leaves pending receipts that strict health reports until they are reconciled.",prompt:"After any branch merge that touched tracker data, read the merge report, preview the reconciliation, then apply it; only then treat a health verdict as a statement about the data.",commands:["pm merge report","pm merge reconcile --dry-run",'pm merge reconcile --message "Post-merge history reconciliation"',"pm health --check-only"]},{name:"Hand Work Between Agents Safely",goal:"Ownership and evidence survive the handoff.",prompt:"Claim before substantial edits, record evidence as comments, and release the claim when pausing, handing off, closing, or canceling.",commands:["pm claim <ID>",'pm comments <ID> "Handoff: <state and next step>"',"pm release <ID>"]}],docs:[{path:"docs/MERGE_SAFETY.md",purpose:"Merge driver, field-aware resolution, and clone setup."},{path:"docs/SDK_CONTEXT_COORDINATION.md",purpose:"Coordination primitives for concurrent agents."}],related:["workflows","assurance","commands"]},{id:"evidence",aliases:["record","annotations","learnings","history-maintenance"],title:"Evidence, Durable Knowledge, and Record Maintenance",summary:"Append comments, notes, learnings, files, docs, and tests to items, and maintain the immutable history those records live in.",intent:"Use this when work must be explained to the next agent, when a durable lesson should outlive the item, or when a history stream needs verification, repair, redaction, compaction, or author attribution.",commands:['pm comments <ID> "<progress or verification evidence>"','pm notes <ID> --add "<rationale that belongs on the item>"','pm learnings <ID> --add "<lesson that should outlive the item>"',"pm append <ID> --body -","pm files <ID> --add path=<path>,scope=project,note=<why>","pm history <ID> --verify --strict-exit","pm history-repair --all --dry-run","pm history-redact <ID> --literal <secret> --dry-run","pm history-compact <ID> --dry-run","pm history-author-acknowledge --all-actionable --dry-run","pm close-many --ids <ID>,<ID> --reason <text> --dry-run","pm test-all --status open --limit 10 --progress"],workflows:[{name:"Record While Working, Not After",goal:"Another agent can rebuild the full situation from the item alone.",prompt:"Add a comment for each verified step, a note for each rationale the item body does not carry, and a learning for each lesson that applies beyond this item. Prefer appending over rewriting.",commands:['pm comments <ID> "Evidence: <what changed and what passed>"','pm notes <ID> --add "Decision log: <why this shape>"','pm learnings <ID> --add "<durable lesson>"',"pm learnings <ID> --limit 5"]},{name:"Verify And Repair A History Stream",goal:"Every mutation stays provable and the chain re-anchors after drift.",prompt:"Verify the chain with a strict exit before trusting a stream, preview any repair, and record why the repair was needed in the audit message.",commands:["pm history <ID> --verify --strict-exit","pm history-repair --all --dry-run",'pm history-repair --all --message "<why the chain drifted>"',"pm validate --check-history-drift"]},{name:"Redact, Compact, Or Attribute Without Losing Proof",goal:"Sensitive text, stream length, and unknown authors are handled through audited rewrites.",prompt:"Preview every history rewrite with --dry-run, read the receipt, then apply. Compaction renumbers ordinal versions, so record the checkpoint it created.",commands:["pm history-redact <ID> --literal <secret> --dry-run","pm history-compact <ID> --dry-run","pm history-author-acknowledge --all-actionable --dry-run"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Annotation, bulk, and history-and-recovery command families."},{path:"docs/MUTATION_INTEGRITY.md",purpose:"Provenance and content-safety policy every mutation shares."},{path:"docs/AGENT_GUIDE.md",purpose:"Evidence expectations in the agent loop and self-repair remediation."}],related:["workflows","assurance","merge","graph"]},{id:"automation",aliases:["calendar","reminders","meetings","events"],title:"Reminders, Events, and Meetings",summary:"Attach time to items so context and agenda views can surface deadlines, meetings, and reminders when they matter.",intent:"Use this when an item needs a due signal, a scheduled event, or a meeting record that later context reads should surface.",commands:["pm package install calendar --project","pm calendar remind <title> --at <when> --parent <ID>","pm calendar event <title> --start <when> --parent <ID>","pm calendar meet <title> --start <when> --duration 30min --parent <ID>","pm context --limit 10"],workflows:[{name:"Put A Deadline Where Context Will Find It",goal:"Time-bound work surfaces in the agenda section of context reads.",prompt:"Install calendar, then record the reminder or event under its owning item and confirm it in context. Use explicit min or mo for durations; bare m is ambiguous.",commands:["pm package install calendar --project","pm calendar remind <title> --at <when> --parent <ID>","pm context --limit 10"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Calendar and context command family."},{path:"packages/pm-calendar/README.md",purpose:"Package commands, duration units, and compatibility aliases."}],related:["workflows","quickstart","extensions"]}],Lw=new Map;for(let e of $w){Lw.set(e.id,e);for(let t of e.aliases)Lw.set(t,e)}function ad(){return $w.map(e=>e.id)}(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]="3a7cf539-2663-5265-90e8-c2aa9926a62a")}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]="be171aef-09e7-5f87-9605-1d47ca665440")}catch{}})();var BW=[...to],HW=[...no],cd=new Set(sr.filter(e=>e.hidden).map(e=>e.alias)),Fw=Qu("full").filter(e=>!e.includes(" ")&&!cd.has(e)),Y$=N(po),J$=N(fo),X$=N(bo),Q$=N(To),Mw=ur("restore",Rt("restore")),Dw=ur("history-attest",Rt("history-attest")),Z$=N(Co),eF=N(Km),tF=N(zm),nF=N(Ao),rF=N(xo),oF=N(Io),iF=N(Ro),sF=N(wo),ld=[...new Set(ke.map(e=>e.canonical_argv[0]))],Uw=[...new Set(ke.flatMap(e=>e.canonical_argv.slice(0,-1).map((t,n)=>e.canonical_argv.slice(0,n+1).join(" "))))],VW=new Set(mo.filter(e=>e.disposition==="package_owned").map(e=>H(e.command))),Gw=ke.filter(e=>e.canonical_argv[0]==="history"),aF=Gw.map(e=>e.canonical_argv[1]).join(" ");var cF=Gw.map(e=>({...e,flags:N(Rt(e.alias))})),lF=N(_o),dF=N(ho,!1),mF=N(Oo),uF=N(lr),pF=N(dr),fF=N($o),_F=N(No),hF=N(So),gF=N(Lo),yF=N(Po),vF=N(Fo),wF=N(ko),bF=N(Eo),kF=N(yo),SF=N(Mo),EF=N(go),dd=`${En.join(" ")} list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status`;var AF=N(Do),TF=`${AF} bash zsh fish`,md=zs(ad()),Ks="init scaffold install uninstall explore manage describe reload doctor catalog adopt adopt-all activate deactivate migrate",ud=`${Ks} upgrade`,CF=N(vo),IF=N(ar),RF=N(cr);var OF=N(Rt("close")),xF=N(Rt("close-task")),PF=N(Rt("release")),NF=N(Rt("claim"));var jw=uo.flatMap(e=>[e.short,e.flag,...e.aliases??[]]).filter(e=>!!e).join(" "),pd=[...Vo].join("|"),fd=[...Vo].map(e=>`${e}=*`).join("|"),_d=[...jw.split(" ").filter(e=>!Vo.has(e)),"-h","-V"].join("|");function zs(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n)).join(" ")}(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]="2dba61cf-0757-5b46-b86c-e5b7a1c733ae")}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]="30266073-c2de-54c4-bdf7-8cf9d4cfb36b")}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]="8e48bd9b-07b3-5772-984e-10f27864c736")}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]="c1fb3981-3bae-5f63-861a-ee689a9ffd36")}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]="2c2a4576-a5d8-57c1-84e8-ca8b9019c84e")}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]="e7f8a7ea-3ec2-521b-ad52-45b655208f06")}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]="856f6aeb-4343-5cda-8b04-66d786e351d9")}catch{}})();var Vw=Symbol("pm.active-extension-host-context");function Ge(e){return{fullChangedFields:!0,options:e}}var U=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[Vw]=!0,n}run(t,n={}){return Ww({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return ah(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return Va(await this.list(Ha(t)))}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},r={}){return this.runTyped("graph",{subcommand:t,...n,options:r})}append(t,n,r={}){return this.runTyped("append",{id:t,...Ge(Ut(r,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,r,o,i={}){return this.runTyped("config",{scope:t,configAction:n,...r===void 0?{}:{key:r},...o===void 0?{}:{value:o},options:i})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}workflowPolicy(t,n,r={}){return this.runTyped("schema",{name:n,options:{...r,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,r){return this.runTyped("schema",{name:t,options:{...r,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,r,o){return this.runTyped("schema",{name:t,options:{...r,subcommand:"rename-field",to:n,...o?{fieldTypeScope:o}:{}}})}schemaRemapStatus(t,n,r){return this.runTyped("schema",{name:t,options:{...r,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyAttest(t={}){return this.runTyped("history-attest",{options:t})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,r={},o,i){return this.runTyped("plan",{...n===void 0?{}:{id:n},...o===void 0?{}:{stepRef:o},...i===void 0?{}:{reorderTo:i},options:Ut(r,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,r){return this.plan("update-step",t,r,n)}planCompleteStep(t,n,r={}){return this.plan("complete-step",t,r,n)}planBlockStep(t,n,r){return this.plan("block-step",t,r,n)}planReorderStep(t,n,r,o={}){return this.plan("reorder-step",t,o,n,r)}planRemoveStep(t,n,r={}){return this.plan("remove-step",t,r,n)}planLink(t,n,r){return this.plan("link",t,r,n)}planUnlink(t,n,r){return this.plan("unlink",t,r,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",Ge(t))}update(t,n={}){return this.runTyped("update",{id:t,...Ge(n)})}reopen(t,n,r={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:r})}close(t,n,r={}){return this.runTyped("close",{id:t,reason:n,...Ge(r)})}claim(t,n={}){return this.runTyped("claim",{id:t,...Ge(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...Ge(t)})}release(t,n={}){return this.runTyped("release",{id:t,...Ge(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...Ge(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...Ge(n)})}restore(t,n,r={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...r,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...Ge(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...Ge(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...Ge(n)})}closeTask(t,n,r={}){return this.runTyped("close-task",{id:t,reason:n,...Ge(r)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function qF(e={},t={}){return new U(t).context(e)}function KF(e={},t={}){return new U(t).list(e)}function zF(e={},t={}){return new U(t).listAllComplete(e)}function BF(e,t={},n={}){return new U(n).search(e,t)}function HF(e,t={},n={}){return new U(n).get(e,t)}function VF(e={},t={}){return new U(t).next(e)}function WF(e={},t={}){return new U(t).aggregate(e)}function YF(e,t={},n={}){return new U(n).comments(e,t)}function JF(e,t={},n={}){return new U(n).notes(e,t)}function XF(e,t={},n={}){return new U(n).learnings(e,t)}function QF(e,t={},n={}){return new U(n).files(e,t)}function ZF(e,t={},n={}){return new U(n).filesDiscover(e,t)}function eM(e,t={},n={}){return new U(n).docs(e,t)}function tM(e,t={},n={}){return new U(n).deps(e,t)}function nM(e,t={},n={},r={}){return new U(r).graph(e,t,n)}function rM(e,t,n={},r={}){return new U(r).append(e,t,n)}function oM(e={},t={}){return new U(t).create(e)}function iM(e,t={},n={}){return new U(n).update(e,t)}function sM(e,t,n={},r={}){return new U(r).reopen(e,t,n)}function aM(e,t,n={},r={}){return new U(r).close(e,t,n)}function cM(e,t={},n={}){return new U(n).claim(e,t)}function lM(e={},t={}){return new U(t).claimNext(e)}function dM(e,t={},n={}){return new U(n).release(e,t)}function mM(e,t={},n={}){return new U(n).copy(e,t)}function uM(e,t={},n={}){return new U(n).delete(e,t)}function pM(e,t,n={},r={}){return new U(r).restore(e,t,n)}function fM(e,t={},n={}){return new U(n).focus(e,t)}var Bw=xu(),_M=new jF;function Bs(){ba(Bd()),ka(Hd()),Sa(Vd()),Ea(Wd()),Aa(Yd()),Ta(Jd()),Ca(Xd())}async function hM(e,t,n,r){return Pu(()=>t===void 0?Bw.read(()=>Hw(e,n,r)):Bw.write(()=>yM(t,()=>Hw(e,n,r))))}async function Hw(e,t,n){let r=E(t,e.path);if(e.noExtensions)return Bs(),gc({pmRoot:r},()=>n(null));if(!await G(ue(r)))return Bs(),n(null);let o=null,i;try{let s=await A(r),a=await or({pmRoot:r,settings:s,cwd:t,noExtensions:!1}),c=await ir({...a,loaded:a.loaded});i={loadResult:a,activationResult:c},ba(c.hooks),ka(c.commands),Sa(c.parsers),Ea(c.preflight),Aa(c.services),Ta(c.renderers),Ca(c.registrations),o={registrations:c.registrations,commands:c.commands,pmRoot:r,packages:a.loaded}}catch(s){Bs(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",s)}try{return await gc({pmRoot:r,packages:o?.packages},()=>n(o))}finally{Bs(),i&&await ua(i.loadResult,i.activationResult).catch(()=>{})}}async function gM(e,t,n,r,o){if(!o)throw new l(`Unsupported native pm action: ${e}`,d.USAGE);let i=Dn(e),a=o.registrations.commands.find(m=>Dn(m.action)===i)?.command??o.commands.handlers.find(m=>Dn(m.command)===i)?.command;if(!a)throw new l(`Unsupported native pm action: ${e}`,d.USAGE);let c=await Ho({command:Ja(a),args:he(n.args??t.args),options:Xa(t,n),global:r,pm_root:o.pmRoot,sdk:nh(o.pmRoot,U.forActiveExtensionHost({pmRoot:o.pmRoot,author:typeof r.author=="string"&&r.author.trim()?r.author.trim():"pm-extension"}))});if(!c.handled){let m=c.warnings.length>0?` (${c.warnings.join(", ")})`:"";throw new l(`Unsupported native pm action: ${e}${m}`,d.USAGE)}return c.result}async function yM(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}function vM(e){let t=Pe(e,"action"),n=Dn(t),r=yn(lh,n),o=r?.action??n,i={...e,action:o};return r?.options!==void 0&&(i.options={...r.options,...da(e.options)}),o==="package"&&(i.options={...da(i.options),vocabulary:"package"}),{action:o,args:i}}async function Ww(e){let t=vM(e),n=Wa(t.args),r=Nf(t.action),o=w(t.args,"cwd"),i=o??process.cwd();t.action==="init"&&(n[bc]=i),(t.action!=="init"||n.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(n.path=E(i,n.path));try{return t.action==="history-attest"?await hd(t.action,t.args,n,null):e[Vw]===!0||_M.getStore()===!0?await hd(t.action,t.args,n,null):await hM(n,o,i,s=>hd(t.action,t.args,n,s))}finally{r&&sd()}}async function hd(e,t,n,r){let o=Ya(t,e);xa(e,o),Fu(e,o);let i={action:e,args:t,options:o,id:w(t,"id"),force:t.force===!0||o.force===!0,global:n,activeExtensions:r},s=yn(Pw,e),a=s?await s(i):await gM(e,t,o,n,r);if(e==="history-attest")return a;{o.resolvedOutputFormat="json";let c=Gu(e,o,a);return await eh(E(process.cwd(),n.path),c),c}}var wM={closeManyOptionsFromFlat:Si,extensionOptionsFromArgs:Xa,globalOptions:Wa,mutationListOptions:Lf,normalizeActionName:Dn,normalizeCommandPath:Ja,normalizeMcpUpdateOptions:Ff,normalizeMcpOptionsArrays:Pf,optionsWithAuthor:Ya,readRequiredString:Pe,readScalarString:Rf,readScalarStringAllowBlank:Of,readStringArray:he,updateManyOptionsFromFlat:Ei,withAddNoteOption:Ar,withFilesDiscoveryOptions:ki,withMutationCompaction:ge};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=wM);(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]="48d03e9b-14a4-545c-8e5d-5f5f2092a113")}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]="38023567-8a5b-5e25-8d71-5112f74d1894")}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]="3eaa41f7-77a1-5838-8a2f-2ab6a49c21ef")}catch{}})();export{In as AGENT_PROVENANCE_DIMENSIONS,cp as BASELINE_ITEM_FORMAT_VERSION,Wb as BUILTIN_AGENT_PROVENANCE_ADAPTERS,pr as BUILTIN_HARNESS_SIGNAL_DESCRIPTORS,to as BUILTIN_ITEM_TYPE_VALUES,ro as CONFIDENCE_TEXT_VALUES,lp as CURRENT_ITEM_FORMAT_VERSION,Vt as DEPENDENCY_KIND_VALUES,d as EXIT_CODE,wn as ISSUE_SEVERITY_VALUES,Od as ITEM_TYPE_VALUES,yc as PM_CLI_EXPECTED_ERROR_NAME,Lb as PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,Pb as PM_READ_OUTPUT_DIMENSIONS,Nb as PM_READ_OUTPUT_OPTION_FLAGS,Ra as PM_READ_OUTPUT_SURFACE_CONTRACTS,l as PmCliError,U as PmClient,vn as RISK_VALUES,ck as SEMANTIC_ATTRIBUTION_LIMITS,no as STATUS_VALUES,Vb as agentSessionEnvironment,WF as aggregate,ql as analyzeAgentProvenanceDescriptorCoverage,Kb as analyzeSdkCliParameterCompleteness,rM as append,Fb as applyReadOutputDimensions,Gb as applyReadOutputSessionReferences,jb as attachReadOutputSessionReceipt,zb as boundAgentEpisodeIdentity,et as canonicalDocument,cM as claim,lM as claimNext,up as classifyItemFormatVersion,aM as close,YF as comments,qF as context,mM as copy,oM as create,th as createPmCliExpectedError,xb as decodeReadOutputContinuationCursor,uM as deleteItem,tM as deps,tk as detectAgentIdentity,ok as detectHarnessIdentity,nk as diagnoseAgentIdentity,eM as docs,dp as effectiveItemFormatVersion,Nw as emptyImportedDocument,Ob as encodeReadOutputContinuationCursor,sP as evaluateSemanticAttributionCoverage,sk as explainSourceTraceability,QF as files,ZF as filesDiscover,fM as focus,HF as get,nM as graph,aP as groupHistoryByEpisode,Jg as isAlreadyClaimedError,Ui as isPmCliExpectedError,Mb as isReadOutputBudgetExceeded,XF as learnings,KF as list,Jb as listAgentProvenanceAdapters,zF as listAllComplete,VF as next,Qb as normalizeAgentProvenanceAdapterValue,mp as normalizeItemFormatVersion,qe as normalizeItemId,ee as normalizeStatusInput,JF as notes,S as nowIso,Ub as parseReadOutputSession,Ti as parseSourceLineRange,Zo as readAuthorEnvironment,qb as readOutputSessionRemainingTokens,ac as recordClaimSemanticAttribution,Li as recordFocusSemanticAttribution,cc as recordReleaseSemanticAttribution,Xb as registerAgentProvenanceAdapters,Yb as registerHarnessSignalDescriptors,dM as release,sM as reopen,Bb as resolveAgentSessionContextFromSignals,ik as resolveAuthorIdentity,Av as resolveHistoryEpisodeGroupIdentity,$b as resolveReadOutputDimensions,Db as resolveReadOutputEncoding,Oa as resolveReadOutputSurface,ak as resolveSemanticLineageIds,pM as restore,Ww as runAction,Hb as runWithAgentSessionContext,Zb as runWithHarnessDetectionSignals,ek as runWithWorkspaceHarnessSignalDescriptors,BF as search,lk as semanticAttributionAffinity,Be as serializeItemDocument,iP as summarizeAgentModelProvenance,Kl as summarizeAgentProvenance,iM as update,xa as validateReadOutputOptions,rk as writeAuthorEnvironment};
36
36
  //# sourceMappingURL=sdk-core.js.map