@unbrained/pm-cli 2026.9.30 → 2026.10.1
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.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +12 -0
- package/dist/cli/register-list-query.d.ts +8 -5
- package/dist/cli/register-list-query.js +2 -2
- package/dist/cli-bundle/bundle-manifest.json +82 -82
- package/dist/cli-bundle/chunks/{chunk-6XTJLOKW.js → chunk-7E2EBJLY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-O23CQ5T4.js → chunk-A2UPOCSW.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-BTCE36JS.js → chunk-AYHLUJKD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-6YEET7XI.js → chunk-DGOIXJZJ.js} +42 -42
- package/dist/cli-bundle/chunks/{chunk-BX4LEJX4.js → chunk-HGJLVN56.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-A6NDNRCK.js → chunk-JAVO3Z42.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-EGAIIWI3.js → chunk-SCZMJ5DC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FYTXVVZG.js → chunk-TV3YDE36.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XRN3JYNN.js → chunk-VWVFKPLX.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-SYNBVMNG.js → register-list-query-L6HAHW7V.js} +6 -6
- package/dist/cli-bundle/chunks/{register-mutation-4GSUK23D.js → register-mutation-6OCZVTW5.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-7FCJUC4Z.js → register-operations-3E5U4TOE.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-YTWW2KL5.js → register-setup-VUD37N4A.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-KZULQIAG.js → chunk-6275G2AN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EFD4ATS7.js → chunk-DJPP2HAK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AKB3JN57.js → chunk-YBQ27KG7.js} +45 -45
- package/dist/cli-bundle/main.js +2 -2
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +22 -22
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/merge/install.d.ts +2 -2
- package/dist/sdk/merge/install.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/get.d.ts +19 -15
- package/dist/sdk/query/get.js +1 -1
- package/docs/BOUNDED_CONTEXT_READS.md +10 -7
- package/docs/COMMANDS.md +1 -1
- package/docs/MERGE_SAFETY.md +12 -6
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/plugins/pm-codex/plugin.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as _u,o as jo,p as wu,q as bu,r as wa,s as zo,t as ku,u as ba,v as Bo,y as Ju,z as Xu}from"./focused-chunks/chunk-XUCXRZZZ.js";import{a as tp,f as np,h as en,m as rp,o as ur,r as Qo,s as op,t as ip,x as sp}from"./focused-chunks/chunk-KZULQIAG.js";import{$ as Un,$a as Zf,A as Er,Ab as u_,B as uf,Bb as p_,C as Si,Cb as f_,D as pf,Db as __,E as ff,Eb as h_,Fb as Cr,Ga as zf,Gb as ic,Hb as sc,Ia as Hf,Ib as Ni,J as _f,Ja as Ri,Jb as ac,K as hf,Ka as _k,Kb as g_,L as gf,La as Vf,Lb as cc,M as yf,Ma as Wf,Mb as Li,N as vf,Na as oc,Nb as qn,O as wf,Ob as lc,P as bf,Pb as dc,Q as kf,Qb as y_,R as Sf,Rb as v_,S as Ef,Sb as w_,T as Af,Tb as Kn,U as Tf,Ub as mc,V as Cf,Vb as b_,W as If,X as Rf,Y as Of,Ya as Jf,Yb as $i,Z as xf,Za as Xf,_ as Pf,_a as Qf,aa as Nf,ab as e_,ba as Lf,bb as t_,ca as $f,cb as n_,da as Ut,db as nn,dc as k_,ea as w,eb as r_,ec as S_,fa as Ff,fb as o_,fc as E_,g as of,ga as Mf,gb as Oi,h as sf,ha as Fe,hb as i_,ia as Df,ib as s_,ja as ec,jb as a_,jc as A_,ka as Uf,kb as c_,kc as $_,la as tc,lb as l_,ma as Ar,mb as xi,na as Ei,nb as Gt,oa as Gn,ob as d_,pa as Gf,pb as Pi,qa as Ai,ra as ge,sa as nc,sb as Tr,ta as _e,ua as jf,va as qf,wa as Ti,xa as Kf,y as mf,ya as Ci,z as Xa,zb as m_}from"./focused-chunks/chunk-AKB3JN57.js";import{e as uu,g as pu,h as fu,k as hu,q as vu}from"./focused-chunks/chunk-T4PZJQG4.js";import{b as Qu,c as Xo,e as Zu,f as ep,g as Qb}from"./focused-chunks/chunk-MOUCTR72.js";import{R as Fa,V as Yu,a as rm,b as om,c as im,d as sm,f as am}from"./focused-chunks/chunk-4AORVUT4.js";import{a as cf,b as lf,c as Fi}from"./focused-chunks/chunk-RIJQQOEZ.js";import{K as Yf,b as df}from"./focused-chunks/chunk-EVMH4SKN.js";import{Ba as hc,Da as P_,Sa as Or,Ua as N_,Va as L_,c as Qa,e as Za,g as rc,h as Ir,i as hk,j as uc,k as pc,l as Mi,m as gk,n as yk,pa as fc,s as T_,t as C_,u as I_,ua as Rr,v as R_,w as O_,wa as _c,x as x_}from"./focused-chunks/chunk-EFD4ATS7.js";import{$a as wr,A as pe,B as Ln,C as ui,D as pi,G as fi,H as _i,I as jp,Ia as Dn,J as hi,Ja as Qp,K as gi,Ka as Ya,L as $n,La as Zp,M as Va,N as yi,O as qp,Oa as Ja,P as Kp,Pa as ef,Q as yr,Xa as wi,_a as nf,a as Fp,b as ri,c as oi,cb as rf,d as ii,e as si,i as ai,j as Nt,k as Pn,kb as ht,l as ci,m as Nn,mb as Sr,n as li,nb as tn,o as de,p as di,pb as af,q as Ba,qb as Ii,r as Ve,s as Ha,sa as Xp,t as Mp,u as Ce,vb as jn,w as ft,x as Dp,y as mi,z as Lt}from"./focused-chunks/chunk-UPOMLSW7.js";import{c as lu,f as du,g as mu,i as Go,j as Ot,k as Su,l as Eu,m as Au}from"./focused-chunks/chunk-IQBFYQF2.js";import{a as cp,b as lp,c as dp}from"./focused-chunks/chunk-OMBDUJWZ.js";import{$ as $m,A as ho,Aa as tu,B as _m,Ba as nu,C as hm,Ca as To,D as gm,Da as ru,E as go,Ea as ou,F as ym,Fa as iu,G as vm,Ga as Co,H as wm,Ha as Io,I as bm,Ia as Ro,J as yo,Ja as Oo,K as vo,Ka as dr,L as km,La as su,M as wo,Ma as xo,Na as mr,O as Sm,Oa as Po,P as cr,Pa as No,Q as Em,Qa as Lo,R as Am,Ra as $o,S as Tm,Sa as au,T as Cm,Ta as It,U as Im,Ua as Fo,V as Rm,Va as Mo,W as Om,Wa as Do,X as xm,Xa as Uo,Y as Pm,Z as Nm,_ as Lm,_a as cu,aa as Fm,ab as Rt,ba as Mm,bb as N,ca as Dm,d as ga,da as lr,e as cm,ea as Um,fa as Gm,ga as bo,h as uo,ha as ko,i as ya,ia as jm,j as Xt,ja as qm,ka as Km,l as lm,la as zm,ma as Bm,na as Hm,oa as Vm,pa as Wm,q as va,ra as Ym,s as po,sa as Jm,t as fo,ta as Xm,u as _o,ua as Qm,v as dm,va as Zm,w as mm,wa as eu,x as um,xa as So,y as pm,ya as Eo,z as fm,za as Ao}from"./focused-chunks/chunk-XB5Q2P7Z.js";import{$ as wp,$a as Ke,A as pk,Aa as hr,Ab as Vp,B as fk,C as xn,Cb as fe,D as C,Db as Wp,Eb as vi,Fb as _t,Gb as Yp,H as pt,Ha as Op,Hb as ae,Ib as Jp,Ja as za,L as pp,M as ti,Ma as xp,Mb as tf,N as fp,Na as ni,O as _p,Oa as rt,P as hp,Q as gp,Qa as Pp,R as yp,Ra as Np,Sa as Lp,Sb as br,T as ee,Ta as $p,Tb as kr,U as Da,Ua as A,Ub as bi,V as re,Va as $e,Vb as Dt,Wa as Te,X as Ua,Xa as Up,Y as vp,Ya as Gp,Z as He,Za as $t,_ as tt,_b as ki,a as Ma,aa as bp,ab as gr,b as Zb,bb as Fn,c as ek,ca as kp,cb as zp,d as tk,da as Sp,db as Mn,e as nk,ea as Ga,eb as Wa,fb as Bp,ha as ja,ja as Ep,k as Zo,ka as Ap,l as mp,la as Tp,lb as vr,m as up,ma as Cp,n as On,na as Ip,o as pr,p as rk,pc as Bf,q as ok,r as ik,ra as Le,s as sk,sa as Pt,sb as Ft,t as ak,u as ck,ua as qa,ub as Mt,v as lk,va as fr,w as dk,wa as _r,wb as Hp,x as mk,xa as Ka,xb as I,y as ei,ya as nt,yb as q,z as uk,za as Rp,zb as se}from"./focused-chunks/chunk-IDB6E3ZV.js";import{b as Tt,c as so,d as ao,g as mt,i as qo,j as ut,k as xt,l as gu,n as F,o as Ko,p as et,r as yu}from"./focused-chunks/chunk-ZJ3CLTV4.js";import{e as ap}from"./focused-chunks/chunk-HFAW3FJQ.js";import{$ as d,$a as ne,$b as Cu,Ab as ar,Ac as Mu,Ad as Ub,B as Fd,Bd as Gb,C as Md,Cc as Aa,D as Dd,Dc as Ta,Dd as jb,De as Wb,E as Ud,Ec as Ca,Ee as Yb,F as Gd,Fb as ke,Fc as Ia,Fd as qb,Fe as Jb,G as jd,Ga as En,Gc as Ra,Gd as Kb,Ge as Xb,H as aa,Hb as B,Hc as Oa,Hd as Na,He as Jo,I as ca,Ia as Vd,Ic as xa,Id as La,Ie as Wu,J as la,Jb as Jt,Jc as R,Jd as $a,K as da,Ka as fa,Kc as Cn,Kd as ju,L as ma,Lc as Qt,M as ua,Mc as Y,Md as qu,Na as _a,Nc as Ho,Nd as zb,Oa as rr,Oc as In,P as io,Pa as Ee,Pb as Tn,Pd as Bb,Qd as Hb,Rc as Vo,Rd as Vb,Sa as x,Ta as be,Tc as Se,Td as S,U as pa,Ua as lo,Uc as Wo,Va as An,W as qd,Wa as or,Xa as Wd,Xc as Du,Xd as Yo,Ya as E,Yc as Zt,Z as At,Za as Yd,Zd as ie,_a as lt,_b as Tu,aa as l,ab as dt,ac as Iu,ae as Ae,bc as Ru,cb as Ze,cc as Ou,db as mo,dc as xu,ec as ka,fc as Pu,ge as Ku,hb as Jd,hc as Nu,ia as Kd,ib as Xd,ic as Lu,jb as Qd,ka as zd,kb as Zd,kd as Uu,lb as em,lc as Sa,ma as co,mb as tm,mc as $u,nb as nm,nc as Ea,ne as zu,o as no,oa as Bd,od as Gu,oe as Bu,p as $d,pa as Hd,pb as ir,q as ro,qb as Yt,r as sa,rb as qe,re as Rn,sa as G,ta as Wt,td as Pa,ua as Ct,uc as Fu,v as Vt,va as Z,ve as Hu,w as ct,wa as te,x as bn,y as kn,ya as Sn,yb as sr,z as oo,zb as ha,ze as Vu}from"./focused-chunks/chunk-3CAZ7Z4R.js";import{AsyncLocalStorage as rM}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 vk=Fa("list").properties.outputSession,wk={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:{...vk},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},F_={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."}},M_={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},ce={type:"string",description:"pm item id, for example pm-abc1."},bk=`Operation name (one of): ${Ea.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,kk={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."}},Sk={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{...M_,properties:{...M_.properties,...e},required:t}}var Ek=[{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:[...Ea],description:bk},id:ce,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."},...wk},["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"},...Sk},["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"},...kk})},{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:ce,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:ce,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:ce,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:ce,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:ce,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:ce,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:ce,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_release",description:"Release a pm item claim.",inputSchema:D({id:ce,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:ce,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:ce,options:{type:"object"}},["id"])},{name:"pm_files",description:"List, add, remove, or validate linked files for a pm item.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_docs",description:"List, add, or remove linked docs for a pm item.",inputSchema:D({id:ce,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:ce,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:ce,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:ce,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:[...Pu]},id:ce,target:ce,options:{type:"object"}},["subcommand"])},{name:"pm_test",description:"List, add, remove, or run linked tests for a pm item.",inputSchema:D({id:ce,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({...F_,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",...Tn],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:[...sa]},description:`Lifecycle roles for add-status: ${sa.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:F_}},["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."}})}],Ak={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"},Tk=Ek.map(e=>{let t=Ak[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:Fa(t,{properties:n,required:r})}});function D_(){return Tk.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 U_=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"]]]),Ck=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],Y_=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),Ui=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"]),rn=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"]),J_=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"]]),X_=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"]]),Q_=new Map([...X_.entries()].flatMap(([e,t])=>gt(t).map(n=>[n,e]))),Z_=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],vc=new Map(Z_.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),Ik=10,Rk=20,G_=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."]]),eh=[["init",Sm],["install",Am],["uninstall",Tm],["explore",Cm],["manage",Nm],["describe",Im],["reload",Lm],["doctor",$m],["catalog",Fm],["adopt",Mm],["adopt-all",Rm],["activate",Om],["deactivate",xm],["migrate",Pm]],Ok=[...eh.map(([e,t])=>e==="init"?[e,Em]:[e,t]),["upgrade",lr]],xk=[...eh.map(([e,t])=>[`extension ${e}`,t]),...Ok.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",vo],["config",km],["extension",wo],["package",cr],["packages",cr],["install",Dm],["create",To],["item mutate",ru],["item complete",ou],["item reopen",iu],["copy",Co],["focus",Io],["update",Ro],["update-many",Oo],["upgrade",lr],["calendar",dr],["cal",dr],["context",mr],["ctx",mr],["get",Po],["search",Mo],["eval",au],["events",xo],["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",Fo],["aggregate",_o],["deps",Lo],["graph",$o],["guide",No],["reindex",Um],["history",ho],["history-compact",ym],["history-attest",vm],["history-redact",hm],["history-repair",gm],["history-author-acknowledge",go],["merge",_m],["schema",wm],["profile",bm],["plan",yo],["restore",qm],["delete",Km],["close",Gm],["close-many",bo],["append",ko],["claim",jm],["release",zm],["start-task",Bm],["pause-task",Hm],["close-task",Vm],["comments",dm],["notes",mm],["learnings",um],["files",pm],["docs",fm],["test",Jm],["test-runs-worker",[]],["test-all",Xm],["telemetry",Qm],["test-runs",Zm],["gc",eu],["stats",So],["ops",[]],["duplicates",Eo],["validate",tu],["health",Ao],["assurance",nu],...cu,["contracts",Do],["completion",Uo],["activity",su],...[...Y_].map(e=>[e,fo])],xr=new Map(xk);for(let{alias:e,canonical:t}of ke){let n=xr.get(e);n!==void 0&&xr.set(t,n)}function Pk(e){let t=Q_.get(e);return t||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function j_(e){let t=ke.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:ka.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)}`):Ui.has(e)?X_.get(e)??ye(e):null}function Nk(e,t){let n=B(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 Lk(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 Di(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 $k(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 gc(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 th(e){return e.replace(/\s+/g,"-")}function ot(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function q_(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let o=ot(r);!o||n.has(o)||(n.add(o),t.push(o))}return t}function yc(e,t,n){n&&(e[t]=!0)}function K_(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 Fk(e){let t=K_(e.long,"long"),n=K_(e.short,"short"),r=t??n;if(!r)return null;let o={flag:r};n&&t&&(o.short=n),yc(o,"required",e.required===!0),yc(o,"repeatable",e.repeatable===!0),yc(o,"list",e.list===!0);let i=ot(e.description);i&&(o.description=i);let s=ot(e.value_name);s&&(o.value_name=s);let a=[ot(e.value_type),ot(e.type),s?"string":null].find(c=>c==="string"||c==="number"||c==="boolean");return a&&(o.value_type=a),o}function nh(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=Fk(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 Mk(e){let t=nh(e.flagRegistrations),n=new Map;for(let i of e.commandDefinitions){let s=ye(i.command);if(s.length===0)continue;let a=ot(i.action)??th(s),c=Array.isArray(i.arguments)?i.arguments.map(m=>{let u=ot(m.name);return u?{name:u,required:m.required===!0,variadic:m.variadic===!0,description:ot(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:ot(i.description),intent:ot(i.intent),arguments:c,flags:t.get(s)?.flags??[],examples:q_(i.examples),failure_hints:q_(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(Dk(i,s,t.get(i)?.flags??[]))}return o}function Dk(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:th(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function Uk(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 Gk(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 jk(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 qk(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]=Gk(o,e.action),o.required&&r.push(o.name);for(let o of e.flags){let i=Uk(o);!i||n[i]!==void 0||(n[i]=jk(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 Kk(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 zk(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&&Kk(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 Bk(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(ne(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let o=await t(r),i=await sr({pmRoot:r,settings:o,cwd:process.cwd(),noExtensions:!1}),s=await ar({...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 Hk(e,t={}){let n=new Map;for(let r of Sa){let o=Ui.has(r);if(o&&!t.includePackageOwnedActions)continue;let i=j_(r);n.set(r,{action:r,provider:o?"extension":"core",requires_extension:o,command_path:i})}if(t.includePackageOwnedActions)for(let r of Ui)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:j_(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 Vk(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&&(!rn.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(B(s))),o=n.map(s=>J_.get(B(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 rh(e){return xr.get(e)??po}function Wk(e){return rn.has(B(e))?!1:xr.has(e)}function Yk(e){return Y_.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function z_(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 Xk(e){let t=new Map;for(let r of e.definitions){let o=z_(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=>z_(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,va(o.flags));return n}function B_(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 va(n)}function Qk(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=Wk(s),c=a?rh(s):[],m=n.get(Yk(s))??[],u=i.get(s),p=B_(c,m),f=B_(p,u?.flags??[]),_=c.length>0&&(u?.flags.length??0)>0?"mixed":a?"core":"extension";return{command:s,flags:f,...r?{canonical_command:ih(s),visibility:oh(s,o),positionals:cm(s)?.slots??[],flag_invocations:ur(s,f)}:{},provider:_,extension_sources:u?.sources}}).sort((s,a)=>s.command.localeCompare(a.command))}function Zk(e,t=Jt){let n=new Set(e),r=new Map;for(let o of Z_){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 eS(){return{create_string_options:Qu,create_repeatable_options:Xo,update_string_options:Zu,update_repeatable_options:ep,list_string_options:rm,search_string_options:om,calendar_string_options:im,context_string_options:sm,activity_string_options:am}}function H_(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=An(e,"create",n),o=[...new Set(r.required)].sort((a,c)=>a.localeCompare(c)),i=[...new Set(o.map(a=>Ee("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 tS(e){let t={},n={};for(let r of[...e.types].sort((o,i)=>o.localeCompare(i))){let o=e.by_type[r];t[r]=H_(o,"strict"),n[r]=H_(o,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function nS(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 rS(e){let t=Di(e.action)!==void 0||Di(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=Di(e.action),u=Di(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 oS(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 iS(e,t=A){try{return await t(e)}catch{return structuredClone(At)}}async function sS(e,t,n){let r=await iS(t),o=await Bk(e),i=x(r,o.registrations??R()),s=et(r.schema),a=Mk(o);return{settings:r,runtimeProbe:o,typeRegistry:i,statusRegistry:F(r.schema),runtimeFieldRegistry:s,runtimeFieldFlagMap:Xk(s),createRequiredOptionContracts:tS(i),extensionContracts:a,mergedExtensionContracts:zk(a.filter(c=>Gi(n,c.command,a))),extensionFlagMap:nh(o.flagRegistrations)}}function V_(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&Ui.has(e.selectedAction)||e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand)))}function aS(e,t){let n=Hk(t,{includePackageOwnedActions:V_(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set($u);return n.filter(o=>!r.has(o.action)&&(e.fullOutput||(t.find(i=>i.action===o.action)?.tier??Qo(o.action))!=="internal"))}return V_(e)&&e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:Pk(B(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function cS(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 lS(e,t){return[...new Set([...ka.filter(n=>!rn.has(B(n))),...[...xr.keys()].filter(n=>!rn.has(B(n))),...e.flatMap(n=>n.command_path?gt(n.command_path).filter(r=>n.provider==="extension"||!rn.has(B(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 dS(e,t){let n=t.slice(0,Ik),r=t.length-n.length,o=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),i=t.slice(0,Rk),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 mS(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 uS(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 pS(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 dS(e.selectedCommand,r);let o=J_.get(B(e.selectedCommand));throw o?mS(e.selectedCommand,o):uS(e.selectedCommand)}function fS(e,t){let n=aS(e,t.mergedExtensionContracts);cS(e,n);let r=lS(n,t.mergedExtensionContracts);pS(e,r);let o=e.selectedCommand?Q_.get(B(e.selectedCommand)):void 0,i=e.selectedCommand?n.filter(m=>o?m.action===o:Nk(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=>Vk(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 _S(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 hS(e){let t=Yu,n=Pr(t),r=_S(t),o=e.filter(i=>!r.has(i.action)).map(i=>qk(i));return o.length>0?{...t,oneOf:[...n,...o]}:t}function W_(e,t,n){let r=new Set(t.actionDescriptors.map(i=>i.action)),o=e.selectedAction?$k(n,e.selectedAction):e.selectedCommand?gc(n,new Set(t.scopedActionDescriptors.map(i=>i.action))):gc(n,r);return e.runtimeOnly&&!e.selectedAction?gc(o,new Set(t.actions)):o}function gS(e,t,n){let r=hS(t.mergedExtensionContracts),i=!e.flagsOnly&&!e.availabilityOnly?nS(W_(e,n,r),t.createRequiredOptionContracts):W_(e,n,r);return{mergedSchema:r,filteredSchema:i}}function yS(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?Lk(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function oh(e,t){return t.find(n=>B(n.command)===B(e))?.tier??Qo(e)}function Gi(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||oh(t,n)!=="internal"}function vS(e,t,n){if(e.selectedCommand!==void 0||e.selectedAction!==void 0)return t;let r=new Set(Jt.filter(o=>o.hidden&&(o.lifecycle==="deprecated"||!e.fullOutput&&!e.availabilityOnly)).map(o=>o.alias));if(e.summary&&!e.fullOutput)for(let o of vc.keys())r.add(o);return t.filter(o=>!r.has(o)&&Gi(e,o,n))}function ih(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":vc.get(n)??n}var wS=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"]]),bS=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function kS(e,t){let n=G_.get(B(e))??(e.includes(" ")?void 0:G_.get(ih(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(m=>gt(m.command).some(u=>B(u)===B(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=wS.get(i),c=bS.get(e)??s;return{intent:a===void 0||s.length===0?`Run ${e}.`:`${a} ${c}.`,intent_source:"generated"}}function SS(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=Pa(i,{generateFallback:!0}),a=i.split(" ")[0],c=vc.get(a)??(a.startsWith("list-")?"list":a.startsWith("history-")?"history":a),m=new Set([...rh(i).map(f=>f.flag),...t.filter(f=>gt(f.command).some(_=>B(_)===B(i))).flatMap(f=>f.flags.map(_=>_.flag))]),u=(U_.get(B(i))??U_.get(c)??Ck).filter(f=>m.has(f)),p=kS(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 ES(e){return e.map(t=>({budget:Pa(t,{generateFallback:!0}),envelope:sp(t)}))}function AS(e){let t=new Map;for(let n of e){let r=np(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 TS(e,t,n){if(e.selectedCommand)return t.extensionContracts.filter(r=>gt(r.command).some(o=>B(o)===B(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=>Gi(e,r.command,t.extensionContracts))}function CS(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 IS(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=ap);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:[...Tu],services:[...Cu],policy_modes:[...Iu],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...xu],trust_modes:[...Ru],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...Ou],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...Fd],create_modes:[...Md],close_validation_modes:[...Dd],workflow_enforcement_modes:[...Ud]},e.relationship_kind_contracts=[...Kd,...(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 RS(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 OS(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=Qk(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let i=new Set(r);e.list_projections=Object.entries(dp).filter(([s])=>i.has(s)).map(([s,a])=>({command:s,default:a,brief_fields:[...lp],compact_fields:[...cp]}))}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 xS(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=eS();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function PS(e,t,n,r){e.command_summaries=SS(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...Uu],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=>La(o)!==void 0).sort((o,i)=>o.localeCompare(i)).map(o=>({command:o,modes:[...ju(o).keys()]}))}:{}},e.grammar_contracts={nouns:Xt.nouns,shared_verbs:Xt.shared_verbs,scope_before_verb:Xt.scope_before_verb,visible_top_level_ceiling:Xt.visible_top_level_ceiling,ceiling_raise_requires_pm_item:Xt.ceiling_raise_requires_pm_item,positional_shape_budget:Xt.positional_shape_budget,positional_shape_count:new Set(ya.map(({slots:o})=>lm(o))).size,positional_action_count:ga.length,positional_action_parents:[...new Set(ga.map(({parent:o})=>o))].sort((o,i)=>o.localeCompare(i)),...r.includePositionalSignatures?{positional_signatures:ya}:{}}}async function wc(e,t){let n=rS(e);oS(n);let r=E(process.cwd(),t.path),o=await sS(t,r,n),i=fS(n,o),s=gS(n,o,i),a=yS(n,i),c=vS(n,a,o.extensionContracts),m=CS(n,s,i,c),u=TS(n,o,c),p=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&PS(m,c,u,{includeFormatBudgets:p,includeIntentProvenance:p,includePositionalSignatures:p,includeProjectionModeMatrix:p}),n.summary)return m;let f=Zk(i.commandCatalog.filter(_=>Gi(n,_,o.extensionContracts)));return n.flagsOnly&&!n.fullOutput||IS(m,o,n),RS(m,n,s,u),OS(m,n,o,c,f),xS(m,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(m.assurance_contracts={measurement_source_kinds:[...sf],gate_triggers:[...of]}),n.fullOutput&&m.grammar_contracts&&(m.grammar_contracts.destinations=uo.map(_=>({..._,reason:_.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(m.mcp_tools=D_(),m.context_intents=zu(),m.read_output_dimensions=Na,m.error_codes=rp,m.command_output_contracts=ES(c),m.diagnostic_output_contracts=Gu,m.command_exit_contracts={vocabulary:tp,command_sets:AS(c)}),m}import{readFile as NS}from"node:fs/promises";import LS 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 bc="context-intents.json";function ji(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $S(e,t,n){if(!ji(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 sh(e,t){let n=Array.isArray(e)?e:ji(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)=>$S(r,t,o))}async function FS(e){let t=LS.join(e,bc),n;try{n=await NS(t,"utf8")}catch(o){if(Wt(o))return[];throw await Hp(e),o}let r;try{r=JSON.parse(n)}catch(o){let i=o instanceof Error?o.message:String(o);throw new TypeError(`Invalid ${bc}: ${i}`,{cause:o})}return sh(r,bc)}function MS(e){if(!ji(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return ji(n)?n.contextIntents??n.context_intents:void 0}function DS(e){return e.flatMap(t=>{let n=MS(t.module);return n===void 0?[]:sh(n,`package ${t.name}`)})}async function US(e){let t=await FS(e.pmRoot),n=DS(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function kc(e,t){let n=await US(e);return await Bu(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 ah(e,t,n=Ku){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()}}}import{createHash as jS}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var Sc="PmCliError";function GS(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 ch(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,GS(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 qi(e){if(!(e instanceof Error)||e.name!==Sc)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]="4c3bb78a-4b63-51ef-a854-c4520cfd3f32")}catch{}})();function Ec(e){let t=zd();for(let n of e)t.register(n);return t}function lh(e,t,n,r){return{client:t,isItemNotFoundError:o=>qi(o)&&o.exitCode===d.NOT_FOUND,getItemAt:(o,i)=>af(o,i,{pmRoot:e}),openRelationshipEventStore:o=>lf.open({pmRoot:e,nodes:o.nodes,registry:Ec(o.definitions),...o.relativePath===void 0?{}:{relativePath:o.relativePath}}),createRelationshipGraph:o=>new Hd(o.nodes,o.edges,Ec(o.definitions)),analyzeRelationshipImpact:(o,i,s)=>df(o,i,s),validateRelationshipEvents:o=>{let i=new cf(o.nodes,{registry:Ec(o.definitions)});return o.events.map(s=>i.append({...s,expectedVersion:i.version}))},commitWorkspaceTransaction:o=>mf({...o,pmRoot:e}),mutateWorkspaceSettings:async o=>{if(!/^[a-zA-Z0-9._-]{1,128}$/u.test(o.operationId))throw new l("Workspace settings operationId must be 1-128 letters, digits, dots, underscores, or hyphens.",d.USAGE);let i=await A(e);try{let s=await ni({pmRoot:e,filePath:ne(e),op:"extension:pm:settings",idempotencyKey:r===void 0?o.operationId:`${jS("sha256").update(r).digest("hex").slice(0,16)}:${o.operationId}`,author:n??C(void 0,i.author_default),lockTtlSeconds:i.locks.ttl_seconds,lockWaitMs:i.locks.wait_ms,recordCreation:!1,dryRun:o.dryRun===!0,mutate:async a=>{let c=a===null?null:JSON.parse(a);if(!Ma(c).success)throw new l("Workspace settings mutation requires a valid initialized settings.json.",d.USAGE);let m=await o.mutate(structuredClone(c));if(!Ma(m).success)throw new l("Workspace settings mutation returned invalid settings.json.",d.USAGE);return{raw:qe(c,m)?a:Lp(m),result:void 0}}});return s.changed&&o.dryRun!==!0&&await Y({path:ne(e),scope:"project",op:"extension:pm:settings"}),{changed:s.changed,dry_run:o.dryRun===!0,replayed:s.replayed===!0}}finally{Pp(e)}}}}import qS from"node:fs/promises";import X from"node:path";import KS from"node:readline/promises";import{stdin as zS,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 Tc=Symbol.for("pm.sdk.init-invocation-cwd");var BS=()=>KS.createInterface({input:zS,output:Me});function HS(){return structuredClone(At)}var VS=["minimal","default","strict"];function mh(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: ${VS.join(", ")}`,d.USAGE)}function WS(e){if(e!==void 0){if(e.trim().length===0)throw new l("--type-preset must not be empty",d.USAGE);try{return pu(e)}catch{throw new l(`Invalid --type-preset value "${e}". Allowed: ${uu.join(", ")}`,d.USAGE)}}}function YS(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 Ac(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 JS(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||Ac(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&&Ac(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 XS(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(Ac(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: ${Nf.join(", ")}`,d.USAGE)}function ZS(e,t){let n=e.trim().toLowerCase();return n.length===0?t:n==="y"||n==="yes"?!0:n==="n"||n==="no"?!1:t}function uh(e,t){let n=qd[t];e.governance={preset:t,...n},e.validation.parent_reference=n.parent_reference,e.validation.metadata_profile=n.metadata_profile}function eE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tE(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(eE).map(n=>({alias:typeof n.alias=="string"?n.alias:"",ok:n.ok===!0})):[]}}async function nE(e,t,n){let r=qo(t.schema),o=ut(e,r.files.types,mt.types),s=du(await Z(o)),a=[],c=[];for(let m of fu(n)){let u=mu(s,m);s=u.file,(u.replaced?c:a).push(u.definition.name)}return await rt({pmRoot:e,filePath:o,raw:Go(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 rE(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 oE(e,t,n){if(!t||n||await G(X.join(e,"settings.json"))||!await rE(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 ph(e,t){let n=[],r=[];for(let o of t){let i=o?X.join(e,o):e,s=await G(i);await qS.mkdir(i,{recursive:!0}),s?r.push(`already_exists:${i}`):n.push(i),r.push(...await Y({path:i,scope:"project",op:"init:ensure_dir"}))}return{createdDirs:n,warnings:r}}async function iE(e,t){let n=BS();try{Me.write(`pm init setup wizard (agent-optimized)
|
|
1
|
+
import{n as _u,o as jo,p as wu,q as bu,r as wa,s as zo,t as ku,u as ba,v as Bo,y as Ju,z as Xu}from"./focused-chunks/chunk-XUCXRZZZ.js";import{a as tp,f as np,h as en,m as rp,o as ur,r as Qo,s as op,t as ip,x as sp}from"./focused-chunks/chunk-6275G2AN.js";import{$ as Un,$a as Zf,A as Er,Ab as u_,B as uf,Bb as p_,C as Si,Cb as f_,D as pf,Db as __,E as ff,Eb as h_,Fb as Cr,Ga as zf,Gb as ic,Hb as sc,Ia as Hf,Ib as Ni,J as _f,Ja as Ri,Jb as ac,K as hf,Ka as _k,Kb as g_,L as gf,La as Vf,Lb as cc,M as yf,Ma as Wf,Mb as Li,N as vf,Na as oc,Nb as qn,O as wf,Ob as lc,P as bf,Pb as dc,Q as kf,Qb as y_,R as Sf,Rb as v_,S as Ef,Sb as w_,T as Af,Tb as Kn,U as Tf,Ub as mc,V as Cf,Vb as b_,W as If,X as Rf,Y as Of,Ya as Jf,Yb as $i,Z as xf,Za as Xf,_ as Pf,_a as Qf,aa as Nf,ab as e_,ba as Lf,bb as t_,ca as $f,cb as n_,da as Ut,db as nn,dc as k_,ea as w,eb as r_,ec as S_,fa as Ff,fb as o_,fc as E_,g as of,ga as Mf,gb as Oi,h as sf,ha as Fe,hb as i_,ia as Df,ib as s_,ja as ec,jb as a_,jc as A_,ka as Uf,kb as c_,kc as $_,la as tc,lb as l_,ma as Ar,mb as xi,na as Ei,nb as Gt,oa as Gn,ob as d_,pa as Gf,pb as Pi,qa as Ai,ra as ge,sa as nc,sb as Tr,ta as _e,ua as jf,va as qf,wa as Ti,xa as Kf,y as mf,ya as Ci,z as Xa,zb as m_}from"./focused-chunks/chunk-YBQ27KG7.js";import{e as uu,g as pu,h as fu,k as hu,q as vu}from"./focused-chunks/chunk-T4PZJQG4.js";import{b as Qu,c as Xo,e as Zu,f as ep,g as Qb}from"./focused-chunks/chunk-MOUCTR72.js";import{R as Fa,V as Yu,a as rm,b as om,c as im,d as sm,f as am}from"./focused-chunks/chunk-4AORVUT4.js";import{a as cf,b as lf,c as Fi}from"./focused-chunks/chunk-RIJQQOEZ.js";import{K as Yf,b as df}from"./focused-chunks/chunk-EVMH4SKN.js";import{Ba as hc,Da as P_,Sa as Or,Ua as N_,Va as L_,c as Qa,e as Za,g as rc,h as Ir,i as hk,j as uc,k as pc,l as Mi,m as gk,n as yk,pa as fc,s as T_,t as C_,u as I_,ua as Rr,v as R_,w as O_,wa as _c,x as x_}from"./focused-chunks/chunk-DJPP2HAK.js";import{$a as wr,A as pe,B as Ln,C as ui,D as pi,G as fi,H as _i,I as jp,Ia as Dn,J as hi,Ja as Qp,K as gi,Ka as Ya,L as $n,La as Zp,M as Va,N as yi,O as qp,Oa as Ja,P as Kp,Pa as ef,Q as yr,Xa as wi,_a as nf,a as Fp,b as ri,c as oi,cb as rf,d as ii,e as si,i as ai,j as Nt,k as Pn,kb as ht,l as ci,m as Nn,mb as Sr,n as li,nb as tn,o as de,p as di,pb as af,q as Ba,qb as Ii,r as Ve,s as Ha,sa as Xp,t as Mp,u as Ce,vb as jn,w as ft,x as Dp,y as mi,z as Lt}from"./focused-chunks/chunk-UPOMLSW7.js";import{c as lu,f as du,g as mu,i as Go,j as Ot,k as Su,l as Eu,m as Au}from"./focused-chunks/chunk-IQBFYQF2.js";import{a as cp,b as lp,c as dp}from"./focused-chunks/chunk-OMBDUJWZ.js";import{$ as $m,A as ho,Aa as tu,B as _m,Ba as nu,C as hm,Ca as To,D as gm,Da as ru,E as go,Ea as ou,F as ym,Fa as iu,G as vm,Ga as Co,H as wm,Ha as Io,I as bm,Ia as Ro,J as yo,Ja as Oo,K as vo,Ka as dr,L as km,La as su,M as wo,Ma as xo,Na as mr,O as Sm,Oa as Po,P as cr,Pa as No,Q as Em,Qa as Lo,R as Am,Ra as $o,S as Tm,Sa as au,T as Cm,Ta as It,U as Im,Ua as Fo,V as Rm,Va as Mo,W as Om,Wa as Do,X as xm,Xa as Uo,Y as Pm,Z as Nm,_ as Lm,_a as cu,aa as Fm,ab as Rt,ba as Mm,bb as N,ca as Dm,d as ga,da as lr,e as cm,ea as Um,fa as Gm,ga as bo,h as uo,ha as ko,i as ya,ia as jm,j as Xt,ja as qm,ka as Km,l as lm,la as zm,ma as Bm,na as Hm,oa as Vm,pa as Wm,q as va,ra as Ym,s as po,sa as Jm,t as fo,ta as Xm,u as _o,ua as Qm,v as dm,va as Zm,w as mm,wa as eu,x as um,xa as So,y as pm,ya as Eo,z as fm,za as Ao}from"./focused-chunks/chunk-XB5Q2P7Z.js";import{$ as wp,$a as Ke,A as pk,Aa as hr,Ab as Vp,B as fk,C as xn,Cb as fe,D as C,Db as Wp,Eb as vi,Fb as _t,Gb as Yp,H as pt,Ha as Op,Hb as ae,Ib as Jp,Ja as za,L as pp,M as ti,Ma as xp,Mb as tf,N as fp,Na as ni,O as _p,Oa as rt,P as hp,Q as gp,Qa as Pp,R as yp,Ra as Np,Sa as Lp,Sb as br,T as ee,Ta as $p,Tb as kr,U as Da,Ua as A,Ub as bi,V as re,Va as $e,Vb as Dt,Wa as Te,X as Ua,Xa as Up,Y as vp,Ya as Gp,Z as He,Za as $t,_ as tt,_b as ki,a as Ma,aa as bp,ab as gr,b as Zb,bb as Fn,c as ek,ca as kp,cb as zp,d as tk,da as Sp,db as Mn,e as nk,ea as Ga,eb as Wa,fb as Bp,ha as ja,ja as Ep,k as Zo,ka as Ap,l as mp,la as Tp,lb as vr,m as up,ma as Cp,n as On,na as Ip,o as pr,p as rk,pc as Bf,q as ok,r as ik,ra as Le,s as sk,sa as Pt,sb as Ft,t as ak,u as ck,ua as qa,ub as Mt,v as lk,va as fr,w as dk,wa as _r,wb as Hp,x as mk,xa as Ka,xb as I,y as ei,ya as nt,yb as q,z as uk,za as Rp,zb as se}from"./focused-chunks/chunk-IDB6E3ZV.js";import{b as Tt,c as so,d as ao,g as mt,i as qo,j as ut,k as xt,l as gu,n as F,o as Ko,p as et,r as yu}from"./focused-chunks/chunk-ZJ3CLTV4.js";import{e as ap}from"./focused-chunks/chunk-HFAW3FJQ.js";import{$ as d,$a as ne,$b as Cu,Ab as ar,Ac as Mu,Ad as Ub,B as Fd,Bd as Gb,C as Md,Cc as Aa,D as Dd,Dc as Ta,Dd as jb,De as Wb,E as Ud,Ec as Ca,Ee as Yb,F as Gd,Fb as ke,Fc as Ia,Fd as qb,Fe as Jb,G as jd,Ga as En,Gc as Ra,Gd as Kb,Ge as Xb,H as aa,Hb as B,Hc as Oa,Hd as Na,He as Jo,I as ca,Ia as Vd,Ic as xa,Id as La,Ie as Wu,J as la,Jb as Jt,Jc as R,Jd as $a,K as da,Ka as fa,Kc as Cn,Kd as ju,L as ma,Lc as Qt,M as ua,Mc as Y,Md as qu,Na as _a,Nc as Ho,Nd as zb,Oa as rr,Oc as In,P as io,Pa as Ee,Pb as Tn,Pd as Bb,Qd as Hb,Rc as Vo,Rd as Vb,Sa as x,Ta as be,Tc as Se,Td as S,U as pa,Ua as lo,Uc as Wo,Va as An,W as qd,Wa as or,Xa as Wd,Xc as Du,Xd as Yo,Ya as E,Yc as Zt,Z as At,Za as Yd,Zd as ie,_a as lt,_b as Tu,aa as l,ab as dt,ac as Iu,ae as Ae,bc as Ru,cb as Ze,cc as Ou,db as mo,dc as xu,ec as ka,fc as Pu,ge as Ku,hb as Jd,hc as Nu,ia as Kd,ib as Xd,ic as Lu,jb as Qd,ka as zd,kb as Zd,kd as Uu,lb as em,lc as Sa,ma as co,mb as tm,mc as $u,nb as nm,nc as Ea,ne as zu,o as no,oa as Bd,od as Gu,oe as Bu,p as $d,pa as Hd,pb as ir,q as ro,qb as Yt,r as sa,rb as qe,re as Rn,sa as G,ta as Wt,td as Pa,ua as Ct,uc as Fu,v as Vt,va as Z,ve as Hu,w as ct,wa as te,x as bn,y as kn,ya as Sn,yb as sr,z as oo,zb as ha,ze as Vu}from"./focused-chunks/chunk-3CAZ7Z4R.js";import{AsyncLocalStorage as rM}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 vk=Fa("list").properties.outputSession,wk={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:{...vk},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},F_={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."}},M_={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},ce={type:"string",description:"pm item id, for example pm-abc1."},bk=`Operation name (one of): ${Ea.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,kk={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."}},Sk={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{...M_,properties:{...M_.properties,...e},required:t}}var Ek=[{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:[...Ea],description:bk},id:ce,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."},...wk},["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"},...Sk},["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"},...kk})},{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:ce,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:ce,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:ce,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:ce,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:ce,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:ce,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:ce,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_release",description:"Release a pm item claim.",inputSchema:D({id:ce,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:ce,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:ce,options:{type:"object"}},["id"])},{name:"pm_files",description:"List, add, remove, or validate linked files for a pm item.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_docs",description:"List, add, or remove linked docs for a pm item.",inputSchema:D({id:ce,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:ce,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:ce,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:ce,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:[...Pu]},id:ce,target:ce,options:{type:"object"}},["subcommand"])},{name:"pm_test",description:"List, add, remove, or run linked tests for a pm item.",inputSchema:D({id:ce,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({...F_,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",...Tn],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:[...sa]},description:`Lifecycle roles for add-status: ${sa.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:F_}},["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."}})}],Ak={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"},Tk=Ek.map(e=>{let t=Ak[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:Fa(t,{properties:n,required:r})}});function D_(){return Tk.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 U_=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"]]]),Ck=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],Y_=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),Ui=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"]),rn=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"]),J_=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"]]),X_=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"]]),Q_=new Map([...X_.entries()].flatMap(([e,t])=>gt(t).map(n=>[n,e]))),Z_=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],vc=new Map(Z_.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),Ik=10,Rk=20,G_=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."]]),eh=[["init",Sm],["install",Am],["uninstall",Tm],["explore",Cm],["manage",Nm],["describe",Im],["reload",Lm],["doctor",$m],["catalog",Fm],["adopt",Mm],["adopt-all",Rm],["activate",Om],["deactivate",xm],["migrate",Pm]],Ok=[...eh.map(([e,t])=>e==="init"?[e,Em]:[e,t]),["upgrade",lr]],xk=[...eh.map(([e,t])=>[`extension ${e}`,t]),...Ok.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",vo],["config",km],["extension",wo],["package",cr],["packages",cr],["install",Dm],["create",To],["item mutate",ru],["item complete",ou],["item reopen",iu],["copy",Co],["focus",Io],["update",Ro],["update-many",Oo],["upgrade",lr],["calendar",dr],["cal",dr],["context",mr],["ctx",mr],["get",Po],["search",Mo],["eval",au],["events",xo],["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",Fo],["aggregate",_o],["deps",Lo],["graph",$o],["guide",No],["reindex",Um],["history",ho],["history-compact",ym],["history-attest",vm],["history-redact",hm],["history-repair",gm],["history-author-acknowledge",go],["merge",_m],["schema",wm],["profile",bm],["plan",yo],["restore",qm],["delete",Km],["close",Gm],["close-many",bo],["append",ko],["claim",jm],["release",zm],["start-task",Bm],["pause-task",Hm],["close-task",Vm],["comments",dm],["notes",mm],["learnings",um],["files",pm],["docs",fm],["test",Jm],["test-runs-worker",[]],["test-all",Xm],["telemetry",Qm],["test-runs",Zm],["gc",eu],["stats",So],["ops",[]],["duplicates",Eo],["validate",tu],["health",Ao],["assurance",nu],...cu,["contracts",Do],["completion",Uo],["activity",su],...[...Y_].map(e=>[e,fo])],xr=new Map(xk);for(let{alias:e,canonical:t}of ke){let n=xr.get(e);n!==void 0&&xr.set(t,n)}function Pk(e){let t=Q_.get(e);return t||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function j_(e){let t=ke.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:ka.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)}`):Ui.has(e)?X_.get(e)??ye(e):null}function Nk(e,t){let n=B(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 Lk(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 Di(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 $k(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 gc(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 th(e){return e.replace(/\s+/g,"-")}function ot(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function q_(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let o=ot(r);!o||n.has(o)||(n.add(o),t.push(o))}return t}function yc(e,t,n){n&&(e[t]=!0)}function K_(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 Fk(e){let t=K_(e.long,"long"),n=K_(e.short,"short"),r=t??n;if(!r)return null;let o={flag:r};n&&t&&(o.short=n),yc(o,"required",e.required===!0),yc(o,"repeatable",e.repeatable===!0),yc(o,"list",e.list===!0);let i=ot(e.description);i&&(o.description=i);let s=ot(e.value_name);s&&(o.value_name=s);let a=[ot(e.value_type),ot(e.type),s?"string":null].find(c=>c==="string"||c==="number"||c==="boolean");return a&&(o.value_type=a),o}function nh(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=Fk(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 Mk(e){let t=nh(e.flagRegistrations),n=new Map;for(let i of e.commandDefinitions){let s=ye(i.command);if(s.length===0)continue;let a=ot(i.action)??th(s),c=Array.isArray(i.arguments)?i.arguments.map(m=>{let u=ot(m.name);return u?{name:u,required:m.required===!0,variadic:m.variadic===!0,description:ot(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:ot(i.description),intent:ot(i.intent),arguments:c,flags:t.get(s)?.flags??[],examples:q_(i.examples),failure_hints:q_(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(Dk(i,s,t.get(i)?.flags??[]))}return o}function Dk(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:th(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function Uk(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 Gk(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 jk(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 qk(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]=Gk(o,e.action),o.required&&r.push(o.name);for(let o of e.flags){let i=Uk(o);!i||n[i]!==void 0||(n[i]=jk(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 Kk(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 zk(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&&Kk(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 Bk(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(ne(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let o=await t(r),i=await sr({pmRoot:r,settings:o,cwd:process.cwd(),noExtensions:!1}),s=await ar({...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 Hk(e,t={}){let n=new Map;for(let r of Sa){let o=Ui.has(r);if(o&&!t.includePackageOwnedActions)continue;let i=j_(r);n.set(r,{action:r,provider:o?"extension":"core",requires_extension:o,command_path:i})}if(t.includePackageOwnedActions)for(let r of Ui)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:j_(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 Vk(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&&(!rn.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(B(s))),o=n.map(s=>J_.get(B(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 rh(e){return xr.get(e)??po}function Wk(e){return rn.has(B(e))?!1:xr.has(e)}function Yk(e){return Y_.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function z_(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 Xk(e){let t=new Map;for(let r of e.definitions){let o=z_(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=>z_(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,va(o.flags));return n}function B_(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 va(n)}function Qk(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=Wk(s),c=a?rh(s):[],m=n.get(Yk(s))??[],u=i.get(s),p=B_(c,m),f=B_(p,u?.flags??[]),_=c.length>0&&(u?.flags.length??0)>0?"mixed":a?"core":"extension";return{command:s,flags:f,...r?{canonical_command:ih(s),visibility:oh(s,o),positionals:cm(s)?.slots??[],flag_invocations:ur(s,f)}:{},provider:_,extension_sources:u?.sources}}).sort((s,a)=>s.command.localeCompare(a.command))}function Zk(e,t=Jt){let n=new Set(e),r=new Map;for(let o of Z_){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 eS(){return{create_string_options:Qu,create_repeatable_options:Xo,update_string_options:Zu,update_repeatable_options:ep,list_string_options:rm,search_string_options:om,calendar_string_options:im,context_string_options:sm,activity_string_options:am}}function H_(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=An(e,"create",n),o=[...new Set(r.required)].sort((a,c)=>a.localeCompare(c)),i=[...new Set(o.map(a=>Ee("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 tS(e){let t={},n={};for(let r of[...e.types].sort((o,i)=>o.localeCompare(i))){let o=e.by_type[r];t[r]=H_(o,"strict"),n[r]=H_(o,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function nS(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 rS(e){let t=Di(e.action)!==void 0||Di(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=Di(e.action),u=Di(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 oS(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 iS(e,t=A){try{return await t(e)}catch{return structuredClone(At)}}async function sS(e,t,n){let r=await iS(t),o=await Bk(e),i=x(r,o.registrations??R()),s=et(r.schema),a=Mk(o);return{settings:r,runtimeProbe:o,typeRegistry:i,statusRegistry:F(r.schema),runtimeFieldRegistry:s,runtimeFieldFlagMap:Xk(s),createRequiredOptionContracts:tS(i),extensionContracts:a,mergedExtensionContracts:zk(a.filter(c=>Gi(n,c.command,a))),extensionFlagMap:nh(o.flagRegistrations)}}function V_(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&Ui.has(e.selectedAction)||e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand)))}function aS(e,t){let n=Hk(t,{includePackageOwnedActions:V_(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set($u);return n.filter(o=>!r.has(o.action)&&(e.fullOutput||(t.find(i=>i.action===o.action)?.tier??Qo(o.action))!=="internal"))}return V_(e)&&e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:Pk(B(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function cS(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 lS(e,t){return[...new Set([...ka.filter(n=>!rn.has(B(n))),...[...xr.keys()].filter(n=>!rn.has(B(n))),...e.flatMap(n=>n.command_path?gt(n.command_path).filter(r=>n.provider==="extension"||!rn.has(B(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 dS(e,t){let n=t.slice(0,Ik),r=t.length-n.length,o=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),i=t.slice(0,Rk),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 mS(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 uS(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 pS(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 dS(e.selectedCommand,r);let o=J_.get(B(e.selectedCommand));throw o?mS(e.selectedCommand,o):uS(e.selectedCommand)}function fS(e,t){let n=aS(e,t.mergedExtensionContracts);cS(e,n);let r=lS(n,t.mergedExtensionContracts);pS(e,r);let o=e.selectedCommand?Q_.get(B(e.selectedCommand)):void 0,i=e.selectedCommand?n.filter(m=>o?m.action===o:Nk(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=>Vk(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 _S(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 hS(e){let t=Yu,n=Pr(t),r=_S(t),o=e.filter(i=>!r.has(i.action)).map(i=>qk(i));return o.length>0?{...t,oneOf:[...n,...o]}:t}function W_(e,t,n){let r=new Set(t.actionDescriptors.map(i=>i.action)),o=e.selectedAction?$k(n,e.selectedAction):e.selectedCommand?gc(n,new Set(t.scopedActionDescriptors.map(i=>i.action))):gc(n,r);return e.runtimeOnly&&!e.selectedAction?gc(o,new Set(t.actions)):o}function gS(e,t,n){let r=hS(t.mergedExtensionContracts),i=!e.flagsOnly&&!e.availabilityOnly?nS(W_(e,n,r),t.createRequiredOptionContracts):W_(e,n,r);return{mergedSchema:r,filteredSchema:i}}function yS(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?Lk(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function oh(e,t){return t.find(n=>B(n.command)===B(e))?.tier??Qo(e)}function Gi(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||oh(t,n)!=="internal"}function vS(e,t,n){if(e.selectedCommand!==void 0||e.selectedAction!==void 0)return t;let r=new Set(Jt.filter(o=>o.hidden&&(o.lifecycle==="deprecated"||!e.fullOutput&&!e.availabilityOnly)).map(o=>o.alias));if(e.summary&&!e.fullOutput)for(let o of vc.keys())r.add(o);return t.filter(o=>!r.has(o)&&Gi(e,o,n))}function ih(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":vc.get(n)??n}var wS=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"]]),bS=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function kS(e,t){let n=G_.get(B(e))??(e.includes(" ")?void 0:G_.get(ih(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(m=>gt(m.command).some(u=>B(u)===B(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=wS.get(i),c=bS.get(e)??s;return{intent:a===void 0||s.length===0?`Run ${e}.`:`${a} ${c}.`,intent_source:"generated"}}function SS(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=Pa(i,{generateFallback:!0}),a=i.split(" ")[0],c=vc.get(a)??(a.startsWith("list-")?"list":a.startsWith("history-")?"history":a),m=new Set([...rh(i).map(f=>f.flag),...t.filter(f=>gt(f.command).some(_=>B(_)===B(i))).flatMap(f=>f.flags.map(_=>_.flag))]),u=(U_.get(B(i))??U_.get(c)??Ck).filter(f=>m.has(f)),p=kS(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 ES(e){return e.map(t=>({budget:Pa(t,{generateFallback:!0}),envelope:sp(t)}))}function AS(e){let t=new Map;for(let n of e){let r=np(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 TS(e,t,n){if(e.selectedCommand)return t.extensionContracts.filter(r=>gt(r.command).some(o=>B(o)===B(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=>Gi(e,r.command,t.extensionContracts))}function CS(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 IS(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=ap);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:[...Tu],services:[...Cu],policy_modes:[...Iu],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...xu],trust_modes:[...Ru],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...Ou],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...Fd],create_modes:[...Md],close_validation_modes:[...Dd],workflow_enforcement_modes:[...Ud]},e.relationship_kind_contracts=[...Kd,...(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 RS(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 OS(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=Qk(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let i=new Set(r);e.list_projections=Object.entries(dp).filter(([s])=>i.has(s)).map(([s,a])=>({command:s,default:a,brief_fields:[...lp],compact_fields:[...cp]}))}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 xS(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=eS();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function PS(e,t,n,r){e.command_summaries=SS(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...Uu],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=>La(o)!==void 0).sort((o,i)=>o.localeCompare(i)).map(o=>({command:o,modes:[...ju(o).keys()]}))}:{}},e.grammar_contracts={nouns:Xt.nouns,shared_verbs:Xt.shared_verbs,scope_before_verb:Xt.scope_before_verb,visible_top_level_ceiling:Xt.visible_top_level_ceiling,ceiling_raise_requires_pm_item:Xt.ceiling_raise_requires_pm_item,positional_shape_budget:Xt.positional_shape_budget,positional_shape_count:new Set(ya.map(({slots:o})=>lm(o))).size,positional_action_count:ga.length,positional_action_parents:[...new Set(ga.map(({parent:o})=>o))].sort((o,i)=>o.localeCompare(i)),...r.includePositionalSignatures?{positional_signatures:ya}:{}}}async function wc(e,t){let n=rS(e);oS(n);let r=E(process.cwd(),t.path),o=await sS(t,r,n),i=fS(n,o),s=gS(n,o,i),a=yS(n,i),c=vS(n,a,o.extensionContracts),m=CS(n,s,i,c),u=TS(n,o,c),p=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&PS(m,c,u,{includeFormatBudgets:p,includeIntentProvenance:p,includePositionalSignatures:p,includeProjectionModeMatrix:p}),n.summary)return m;let f=Zk(i.commandCatalog.filter(_=>Gi(n,_,o.extensionContracts)));return n.flagsOnly&&!n.fullOutput||IS(m,o,n),RS(m,n,s,u),OS(m,n,o,c,f),xS(m,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(m.assurance_contracts={measurement_source_kinds:[...sf],gate_triggers:[...of]}),n.fullOutput&&m.grammar_contracts&&(m.grammar_contracts.destinations=uo.map(_=>({..._,reason:_.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(m.mcp_tools=D_(),m.context_intents=zu(),m.read_output_dimensions=Na,m.error_codes=rp,m.command_output_contracts=ES(c),m.diagnostic_output_contracts=Gu,m.command_exit_contracts={vocabulary:tp,command_sets:AS(c)}),m}import{readFile as NS}from"node:fs/promises";import LS 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 bc="context-intents.json";function ji(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $S(e,t,n){if(!ji(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 sh(e,t){let n=Array.isArray(e)?e:ji(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)=>$S(r,t,o))}async function FS(e){let t=LS.join(e,bc),n;try{n=await NS(t,"utf8")}catch(o){if(Wt(o))return[];throw await Hp(e),o}let r;try{r=JSON.parse(n)}catch(o){let i=o instanceof Error?o.message:String(o);throw new TypeError(`Invalid ${bc}: ${i}`,{cause:o})}return sh(r,bc)}function MS(e){if(!ji(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return ji(n)?n.contextIntents??n.context_intents:void 0}function DS(e){return e.flatMap(t=>{let n=MS(t.module);return n===void 0?[]:sh(n,`package ${t.name}`)})}async function US(e){let t=await FS(e.pmRoot),n=DS(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function kc(e,t){let n=await US(e);return await Bu(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 ah(e,t,n=Ku){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()}}}import{createHash as jS}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var Sc="PmCliError";function GS(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 ch(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,GS(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 qi(e){if(!(e instanceof Error)||e.name!==Sc)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]="4c3bb78a-4b63-51ef-a854-c4520cfd3f32")}catch{}})();function Ec(e){let t=zd();for(let n of e)t.register(n);return t}function lh(e,t,n,r){return{client:t,isItemNotFoundError:o=>qi(o)&&o.exitCode===d.NOT_FOUND,getItemAt:(o,i)=>af(o,i,{pmRoot:e}),openRelationshipEventStore:o=>lf.open({pmRoot:e,nodes:o.nodes,registry:Ec(o.definitions),...o.relativePath===void 0?{}:{relativePath:o.relativePath}}),createRelationshipGraph:o=>new Hd(o.nodes,o.edges,Ec(o.definitions)),analyzeRelationshipImpact:(o,i,s)=>df(o,i,s),validateRelationshipEvents:o=>{let i=new cf(o.nodes,{registry:Ec(o.definitions)});return o.events.map(s=>i.append({...s,expectedVersion:i.version}))},commitWorkspaceTransaction:o=>mf({...o,pmRoot:e}),mutateWorkspaceSettings:async o=>{if(!/^[a-zA-Z0-9._-]{1,128}$/u.test(o.operationId))throw new l("Workspace settings operationId must be 1-128 letters, digits, dots, underscores, or hyphens.",d.USAGE);let i=await A(e);try{let s=await ni({pmRoot:e,filePath:ne(e),op:"extension:pm:settings",idempotencyKey:r===void 0?o.operationId:`${jS("sha256").update(r).digest("hex").slice(0,16)}:${o.operationId}`,author:n??C(void 0,i.author_default),lockTtlSeconds:i.locks.ttl_seconds,lockWaitMs:i.locks.wait_ms,recordCreation:!1,dryRun:o.dryRun===!0,mutate:async a=>{let c=a===null?null:JSON.parse(a);if(!Ma(c).success)throw new l("Workspace settings mutation requires a valid initialized settings.json.",d.USAGE);let m=await o.mutate(structuredClone(c));if(!Ma(m).success)throw new l("Workspace settings mutation returned invalid settings.json.",d.USAGE);return{raw:qe(c,m)?a:Lp(m),result:void 0}}});return s.changed&&o.dryRun!==!0&&await Y({path:ne(e),scope:"project",op:"extension:pm:settings"}),{changed:s.changed,dry_run:o.dryRun===!0,replayed:s.replayed===!0}}finally{Pp(e)}}}}import qS from"node:fs/promises";import X from"node:path";import KS from"node:readline/promises";import{stdin as zS,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 Tc=Symbol.for("pm.sdk.init-invocation-cwd");var BS=()=>KS.createInterface({input:zS,output:Me});function HS(){return structuredClone(At)}var VS=["minimal","default","strict"];function mh(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: ${VS.join(", ")}`,d.USAGE)}function WS(e){if(e!==void 0){if(e.trim().length===0)throw new l("--type-preset must not be empty",d.USAGE);try{return pu(e)}catch{throw new l(`Invalid --type-preset value "${e}". Allowed: ${uu.join(", ")}`,d.USAGE)}}}function YS(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 Ac(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 JS(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||Ac(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&&Ac(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 XS(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(Ac(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: ${Nf.join(", ")}`,d.USAGE)}function ZS(e,t){let n=e.trim().toLowerCase();return n.length===0?t:n==="y"||n==="yes"?!0:n==="n"||n==="no"?!1:t}function uh(e,t){let n=qd[t];e.governance={preset:t,...n},e.validation.parent_reference=n.parent_reference,e.validation.metadata_profile=n.metadata_profile}function eE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tE(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(eE).map(n=>({alias:typeof n.alias=="string"?n.alias:"",ok:n.ok===!0})):[]}}async function nE(e,t,n){let r=qo(t.schema),o=ut(e,r.files.types,mt.types),s=du(await Z(o)),a=[],c=[];for(let m of fu(n)){let u=mu(s,m);s=u.file,(u.replaced?c:a).push(u.definition.name)}return await rt({pmRoot:e,filePath:o,raw:Go(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 rE(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 oE(e,t,n){if(!t||n||await G(X.join(e,"settings.json"))||!await rE(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 ph(e,t){let n=[],r=[];for(let o of t){let i=o?X.join(e,o):e,s=await G(i);await qS.mkdir(i,{recursive:!0}),s?r.push(`already_exists:${i}`):n.push(i),r.push(...await Y({path:i,scope:"project",op:"init:ensure_dir"}))}return{createdDirs:n,warnings:r}}async function iE(e,t){let n=BS();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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$b as hi,Aa as Oe,Ba as Ue,Ca as Pe,Da as je,Ea as Fe,F as Ie,Fa as qe,G as $e,Ga as ze,H as Be,Ha as Je,I as Ce,J as De,Oa as Ke,Pa as Xe,Qa as Le,Ra as Qe,Sa as Me,Ta as ei,Ua as ii,Va as ri,Wa as ti,Wb as mi,Xa as ni,Xb as xi,Yb as vi,Zb as bi,_b as yi,a as oe,ac as wi,b as de,bc as gi,c as ae,cc as ki,d as ue,dc as Ai,e as se,ec as Ei,f as fe,fc as _,g as pe,gc as Ri,h as ce,hc as Si,i as _e,ic as Ti,j as le,jc as Ii,k as me,kc as $i,l as xe,lc as Bi,m as ve,mb as oi,mc as Ci,n as be,nc as l,o as ye,p as he,q as we,qb as di,r as ge,rb as ai,s as ke,sb as ui,t as Ae,tb as si,u as Ee,ub as fi,v as Re,vb as pi,w as Se,wb as ci,x as Te,xb as _i,yb as li,za as Ne}from"./focused-chunks/chunk-
|
|
1
|
+
import{$b as hi,Aa as Oe,Ba as Ue,Ca as Pe,Da as je,Ea as Fe,F as Ie,Fa as qe,G as $e,Ga as ze,H as Be,Ha as Je,I as Ce,J as De,Oa as Ke,Pa as Xe,Qa as Le,Ra as Qe,Sa as Me,Ta as ei,Ua as ii,Va as ri,Wa as ti,Wb as mi,Xa as ni,Xb as xi,Yb as vi,Zb as bi,_b as yi,a as oe,ac as wi,b as de,bc as gi,c as ae,cc as ki,d as ue,dc as Ai,e as se,ec as Ei,f as fe,fc as _,g as pe,gc as Ri,h as ce,hc as Si,i as _e,ic as Ti,j as le,jc as Ii,k as me,kc as $i,l as xe,lc as Bi,m as ve,mb as oi,mc as Ci,n as be,nc as l,o as ye,p as he,q as we,qb as di,r as ge,rb as ai,s as ke,sb as ui,t as Ae,tb as si,u as Ee,ub as fi,v as Re,vb as pi,w as Se,wb as ci,x as Te,xb as _i,yb as li,za as Ne}from"./focused-chunks/chunk-YBQ27KG7.js";import"./focused-chunks/chunk-T4PZJQG4.js";import{h as j}from"./focused-chunks/chunk-MOUCTR72.js";import{E as B,F as C,G as D,H as N,I as O,J as U,K as P}from"./focused-chunks/chunk-4AORVUT4.js";import"./focused-chunks/chunk-EVMH4SKN.js";import{Aa as L,Ba as Q,Ca as M,Da as ee,Ea as ie,Fa as re,Ga as te,Ha as ne,qb as We,rb as Ze,sb as Ge,ta as G,tb as He,ua as H,ub as Ve,va as V,vb as Ye,wa as Y,xa as K,ya as X}from"./focused-chunks/chunk-UPOMLSW7.js";import"./focused-chunks/chunk-IQBFYQF2.js";import"./focused-chunks/chunk-OMBDUJWZ.js";import"./focused-chunks/chunk-XB5Q2P7Z.js";import{E as F,F as q,G as z,H as J,I as W,ib as Z}from"./focused-chunks/chunk-IDB6E3ZV.js";import"./focused-chunks/chunk-ZJ3CLTV4.js";import"./focused-chunks/chunk-HFAW3FJQ.js";import{Pb as h,Qb as w,Rb as g,Sb as k,Tb as A,Ub as E,Vb as R,Vd as c,Wb as S,Xb as T,Yb as I,Zb as $}from"./focused-chunks/chunk-3CAZ7Z4R.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new e.Error().stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="aa6b9997-a4c6-5bfb-8804-45b34afd9e01")}catch{}})();var m=["captured_redacted","captured_verbatim"],x=[{label:"home directory",pattern:/(?:\/home\/|\/Users\/)[^/\s"']+/u},{label:"GitHub token",pattern:/\b(?:gh[oprsu]_[A-Za-z0-9_]{20,})\b/u},{label:"npm token",pattern:/\bnpm_[A-Za-z0-9]{20,}\b/u},{label:"private key",pattern:/-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/u}];function n(e){return typeof e=="string"&&e.trim().length>0}function v(e,i){if(typeof i!="object"||i===null||Array.isArray(i))return[{boundary_id:e.id,kind:"invalid_fixture",detail:`${e.fixture_path} must contain a JSON object.`}];let r=i,t=[];r.boundary_id!==e.id&&t.push({boundary_id:e.id,kind:"fixture_boundary_mismatch",detail:`${e.fixture_path} names ${String(r.boundary_id)} instead of ${e.id}.`}),(r.version!==1||!m.includes(r.capture_source)||!n(r.capture_provenance)||!Array.isArray(r.redactions)||!r.redactions.every(n)||!("input"in r)||!("observed"in r))&&t.push({boundary_id:e.id,kind:"invalid_fixture",detail:`${e.fixture_path} lacks captured provenance, redaction metadata, input, or observed output.`});let d=JSON.stringify(i);for(let s of x)s.pattern.test(d)&&t.push({boundary_id:e.id,kind:"unsafe_fixture",detail:`${e.fixture_path} contains a possible ${s.label}.`});return t}function b(e,i){let r=Date.parse(e.waiver_expires_at),t=n(e.waiver_reason)&&n(e.waiver_owner)&&e.waiver_expires_at.endsWith("Z")&&c(e.waiver_expires_at)&&Number.isFinite(r);return{captured:0,waived:t&&r>=i?1:0,findings:t?r<i?[{boundary_id:e.id,kind:"expired_waiver",detail:`Boundary ${e.id} waiver expired at ${e.waiver_expires_at}.`}]:[]:[{boundary_id:e.id,kind:"invalid_waiver",detail:`Boundary ${e.id} waiver requires reason, owner, and an RFC 3339 UTC expiry.`}]}}function y(e,i,r){if(!n(e.id)||!n(e.producer)||!n(e.consumer)||!n(e.format))return{captured:0,waived:0,findings:[{boundary_id:n(e.id)?e.id:"unknown",kind:"invalid_boundary",detail:"Each boundary requires non-empty id, producer, consumer, and format."}]};if("fixture_path"in e){let t=i[e.fixture_path],d=n(e.fixture_path)&&e.fixture_path in i?v(e,t):[{boundary_id:e.id,kind:"missing_fixture",detail:`Boundary ${e.id} fixture ${String(e.fixture_path)} is missing.`}];return{captured:d.length===0?1:0,waived:0,findings:d}}return b(e,r)}function Ni(e,i,r=new Date){let t=[];if(e.version!==1||!n(e.inventory_scope)||!Array.isArray(e.boundaries))return{ok:!1,boundary_count:0,captured_count:0,waived_count:0,findings:[{boundary_id:"registry",kind:"invalid_registry",detail:"Boundary registry requires version 1, inventory_scope, and boundaries."}]};let d=new Set,s=0,p=0;for(let o of e.boundaries){if(typeof o!="object"||o===null||Array.isArray(o)){t.push({boundary_id:"unknown",kind:"invalid_boundary",detail:"Each boundary must be a JSON object."});continue}let a=o,u=n(a.id)?a.id:void 0;if(u!==void 0&&d.has(u)){t.push({boundary_id:u,kind:"duplicate_boundary",detail:`Boundary ${u} is inventoried more than once.`});continue}u!==void 0&&d.add(u);let f=y(a,i,r.getTime());s+=f.captured,p+=f.waived,t.push(...f.findings)}return t.sort((o,a)=>o.boundary_id!==a.boundary_id?o.boundary_id.localeCompare(a.boundary_id):o.kind.localeCompare(a.kind)),{ok:t.length===0,boundary_count:e.boundaries.length,captured_count:s,waived_count:p,findings:t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new e.Error().stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="47924d35-d6ce-5507-adbf-c4c3cb25c18e")}catch{}})();export{wi as ASSURANCE_ACTIONS,gi as ASSURANCE_DECLARATION_KINDS,fe as ASSURANCE_DOCUMENT_VERSION,pe as ASSURANCE_GATE_TRIGGERS,ce as ASSURANCE_MEASUREMENT_SOURCE_KINDS,Ke as ASSURANCE_PRESET_IDS,de as AssuranceEvaluationRefusalError,oe as AssuranceMutationRefusalError,ae as AssuranceSourceResolutionError,m as BOUNDARY_FIXTURE_CAPTURE_SOURCES,z as CURRENT_HISTORY_HASH_ALGORITHM,B as DEFECT_ESCAPE_CLASSES,C as DEFECT_GATE_EVIDENCE_DISPOSITIONS,Ne as HISTORY_AUTHOR_ATTRIBUTION_BASELINE,F as HISTORY_HASH_ALGORITHMS,q as LEGACY_HISTORY_HASH_ALGORITHM,w as MAX_WORKFLOW_POLICIES,g as MAX_WORKFLOW_POLICY_TERMS,j as PM_HISTORY_ATTESTATION_CONTRACT,G as PM_MUTATION_ACTION_CONTRACTS,h as WORKFLOW_POLICY_ACTIONS,$e as WORKFLOW_POLICY_DOCUMENT_SCHEMA,Ie as WORKFLOW_POLICY_SCHEMA,si as _testOnlyHealthCommand,Ze as _testOnlySimilarity,xi as _testOnlyValidateCommand,Ci as _testOnlyWorkspacePosition,Me as acceptAssuranceProposals,Je as acknowledgeUnknownAuthorHistoryEvents,ze as acknowledgeUnknownAuthorHistoryEventsFromTransport,N as analyzeDefectChangeRisk,hi as analyzeDefectRecurrenceCoverage,He as analyzeDuplicateItems,Le as applyAssurancePreset,ci as applyClosureTimestampFix,_e as assuranceAssertionUpdateIsLoosening,D as buildDefectRecurrenceIndex,_i as buildLinkedFileRepairReport,ai as buildStatusRoleWarnings,Be as buildWorkflowCompletenessCheck,Oe as classifyHistoryAuthorEvent,Xe as createAssurancePreset,bi as createAssuranceWorkspaceContext,be as createEmptyAssuranceDocument,Ce as createLifecycleCompletenessPolicies,$ as createWorkflowPolicyEvaluator,Qe as deriveAssuranceProposals,fi as deriveClosureTimestamp,he as evaluateAssuranceAssertion,we as evaluateAssuranceGate,Ni as evaluateBoundaryFixtures,O as evaluateDefectGateEvidence,ye as evaluateMeasurement,V as evaluateMutationGuard,Ye as evaluateSimilarityGovernance,I as evaluateWorkflowPolicies,Si as exportAttestation,Ve as findDuplicateClusters,Ge as findSimilarItems,Bi as formatWorkspacePositionHuman,ke as getAssuranceDeclaration,X as getMutationActionContract,W as historyDigest,Ue as inspectHistoryAuthorStream,te as inspectStaleInProgressItems,di as inspectStatusRoleAssignments,Y as isMutationAction,L as jaccardSimilarity,ge as listAssuranceDeclarations,Te as listAssuranceVerdicts,ti as listInvalidProvenanceHistoryStreamIds,K as listMutationActions,se as normalizeAssuranceEvaluation,ue as normalizeAssuranceMutation,ri as normalizeInvalidHistoryProvenance,Q as normalizeSimilarityText,P as parseDefectChangeRiskRequest,yi as parseDefectRecurrenceCoverageRequest,U as parseDefectRecurrencePolicy,Ri as parseHistoryAttestation,qe as parseUnknownAuthorHistoryEventCoordinates,k as parseWorkflowPolicy,A as parseWorkflowPolicyDocument,je as planUnknownAuthorHistoryAcknowledgment,ee as prepareSimilarityText,mi as projectValidateCounts,ei as promoteAssuranceAssertion,Ae as putAssuranceDeclaration,Ee as putAssuranceDeclarationBundle,Z as readWorkflowPolicies,E as readWorkflowPolicyField,$i as readWorkspacePosition,Se as recordAssuranceVerdict,Re as removeAssuranceDeclaration,J as resolveHistoryHashAlgorithm,Fe as resolveUnknownAuthorAcknowledgmentSelector,ki as runAssuranceAction,Ai as runAssuranceDispatch,Ei as runGc,ui as runHealth,Ii as runHistoryAttest,oi as runHistoryMaintenance,l as runReindex,_ as runUpgrade,vi as runValidate,De as runWorkflowPolicyAction,pi as scanClosureTimestamps,ii as scanExtensionHostVersions,Pe as scanHistoryAuthorAttribution,H as scanMutationSecrets,ni as scanProvenanceResolverHealth,ne as scanStaleInProgressItems,li as scanStorageIntegrity,ie as scoreItemSimilarity,re as scorePreparedItemSimilarity,We as similarityAdvisoryWarnings,M as tokenizeSimilarityText,me as validateAssertionDefinition,ve as validateAssuranceDocument,xe as validateGateDefinition,le as validateMeasurementDefinition,Ti as verifyAttestation,S as workflowApprovalFingerprint,T as workflowPolicyApplies,R as workflowPolicyFingerprint};
|
|
2
2
|
//# sourceMappingURL=sdk-governance.js.map
|