@unbrained/pm-cli 2026.11.14 → 2026.11.15
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 +1 -1
- package/README.md +1 -1
- package/dist/cli/extension-command-help.js +2 -2
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/chunk-6UTBX62V.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-65SBMIK6.js → chunk-7AODVNHX.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-ASGAELBQ.js +9 -0
- package/dist/cli-bundle/chunks/{chunk-V2OAXGHK.js → chunk-DBUBX4DL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-547OEGDR.js → chunk-E4B2HWH7.js} +13 -13
- package/dist/cli-bundle/chunks/chunk-E74OMFBZ.js +6 -0
- package/dist/cli-bundle/chunks/chunk-FSE624WQ.js +2 -0
- package/dist/cli-bundle/chunks/chunk-FYOIH56R.js +20 -0
- package/dist/cli-bundle/chunks/chunk-GAFALSR2.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-AXTUB74T.js → chunk-GCSKHCYK.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-HMVZSXB4.js +8 -0
- package/dist/cli-bundle/chunks/chunk-IXV5UM4U.js +31 -0
- package/dist/cli-bundle/chunks/chunk-J6L3Q5J4.js +3 -0
- package/dist/cli-bundle/chunks/chunk-KLWGIEDC.js +114 -0
- package/dist/cli-bundle/chunks/chunk-KSLPRST2.js +10 -0
- package/dist/cli-bundle/chunks/chunk-LC6DL446.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-MELSYAFE.js → chunk-NAX554KY.js} +35 -35
- package/dist/cli-bundle/chunks/chunk-PMIGRSNZ.js +2 -0
- package/dist/cli-bundle/chunks/chunk-Q6GBRK27.js +3 -0
- package/dist/cli-bundle/chunks/chunk-QZNDEZYI.js +2 -0
- package/dist/cli-bundle/chunks/chunk-S5UXBECQ.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-UJMQP2HP.js → chunk-TESRFVGF.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-EXO4PM5J.js → chunk-VWKLTHYQ.js} +74 -70
- package/dist/cli-bundle/chunks/chunk-YJNY5MKP.js +2 -0
- package/dist/cli-bundle/chunks/chunk-YLPZE2TK.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-RSAN2YUU.js → chunk-ZVDXGAYV.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-ZWUS65LN.js +2 -0
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-I6RQGD6Y.js → indexed-receipt-blobs-42Y2CSEQ.js} +2 -2
- package/dist/cli-bundle/chunks/item-revision-JCEDTAVX.js +2 -0
- package/dist/cli-bundle/chunks/item-transaction-BSMGKZ4S.js +2 -0
- package/dist/cli-bundle/chunks/mutation-actor-IQHBRFAJ.js +2 -0
- package/dist/cli-bundle/chunks/mutation-admission-DF6BFGG6.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-MCNOV6ML.js → register-list-query-DNKPQB76.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-KYXLYHOK.js → register-mutation-WVTDFLEF.js} +3 -3
- package/dist/cli-bundle/chunks/register-operations-NR5MTT5T.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-2RTG3LII.js +2 -0
- package/dist/cli-bundle/chunks/{settlement-hook-JHXLUBEN.js → settlement-hook-W5ULPKIE.js} +2 -2
- package/dist/cli-bundle/chunks/stage-YFNK7U26.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EAYRYXA6.js → chunk-2UQFFVQK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-52H6AELE.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YNYO7PMT.js → chunk-63FM3TIG.js} +6 -6
- package/dist/cli-bundle/focused-chunks/{chunk-EH7JKGDH.js → chunk-7GCAZJT4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-BSY6FZ3Y.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-CZZKAGHE.js +91 -0
- package/dist/cli-bundle/focused-chunks/chunk-DRBXOAGY.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-DXMQ32EH.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-EALGFJRP.js +78 -0
- package/dist/cli-bundle/focused-chunks/chunk-FK2X6MJY.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IDAYTYNN.js → chunk-JE3MFEQZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7KNF6RCV.js → chunk-JRRHN2PZ.js} +12 -12
- package/dist/cli-bundle/focused-chunks/chunk-JXA77YIV.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-LQZ5F6LE.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-LSWUTTE6.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-QXOFSZR6.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-I7A5VP5E.js → chunk-RMCODWHZ.js} +52 -52
- package/dist/cli-bundle/focused-chunks/chunk-S6GTALM4.js +24 -0
- package/dist/cli-bundle/focused-chunks/chunk-UPUIDGNJ.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TA4EGVE6.js → chunk-W2KIQ7RF.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-WGYR3X6O.js +26 -0
- package/dist/cli-bundle/focused-chunks/chunk-WVYXR3YX.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EXCVUBAE.js → chunk-XQZKGTZV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3SUKWYR2.js → chunk-YTNUUEY6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-YZUBG4W2.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-Z6HCQYSW.js +8 -0
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-7XGVHYAO.js → indexed-receipt-blobs-LSBWMXKS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-revision-YO7YGQYE.js +2 -0
- package/dist/cli-bundle/focused-chunks/item-transaction-7A3Q4CAJ.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-actor-UQHBNHOF.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-admission-G565NLPE.js +2 -0
- package/dist/cli-bundle/focused-chunks/{settlement-hook-H56537UV.js → settlement-hook-UXN76GMA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/stage-F3YJGNRK.js +2 -0
- package/dist/cli-bundle/main.js +7 -7
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +3 -3
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +57 -57
- 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 +11 -11
- package/dist/core/extensions/extension-hook-runtime.js +1 -1
- package/dist/core/extensions/extension-types.d.ts +30 -0
- package/dist/core/extensions/extension-types.js +1 -1
- package/dist/core/extensions/index.d.ts +21 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/mutation-actor-snapshot.js +2 -0
- package/dist/core/extensions/mutation-actor.js +2 -0
- package/dist/core/item/deferred-fields.js +2 -0
- package/dist/core/item/item-format-version.d.ts +8 -7
- package/dist/core/item/item-format-version.js +1 -1
- package/dist/core/item/item-format.js +2 -2
- package/dist/core/output/output.d.ts +7 -0
- package/dist/core/output/output.js +3 -3
- package/dist/core/schema/runtime-field-values.d.ts +4 -0
- package/dist/core/schema/runtime-field-values.js +1 -1
- package/dist/core/shared/item-metadata-contract.js +1 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/sdk/agent/closed-domain-contracts.js +1 -1
- package/dist/sdk/authoring.d.ts +1 -1
- package/dist/sdk/authoring.js +1 -1
- package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/completion/fish.js +3 -1
- package/dist/sdk/completion/zsh.js +3 -1
- package/dist/sdk/extension/command-options.d.ts +23 -4
- package/dist/sdk/extension/command-options.js +1 -1
- package/dist/sdk/extension/native-command-options.js +2 -0
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/governance/health.js +1 -1
- package/dist/sdk/governance/lifecycle-dependency-cycles.d.ts +12 -0
- package/dist/sdk/governance/lifecycle-dependency-cycles.js +2 -0
- package/dist/sdk/governance/validate-deferred-fields.js +2 -0
- package/dist/sdk/governance/validate.d.ts +2 -2
- package/dist/sdk/governance/validate.js +1 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/item-transaction.d.ts +2 -2
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/lifecycle/close.js +1 -1
- package/dist/sdk/lifecycle/copy.js +1 -1
- package/dist/sdk/lifecycle/create-deferrals.js +2 -0
- package/dist/sdk/lifecycle/create.d.ts +6 -2
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/lifecycle/shared-unset-fields.d.ts +7 -1
- package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
- package/dist/sdk/merge/three-way.d.ts +1 -1
- package/dist/sdk/merge/three-way.js +2 -2
- package/dist/sdk/package-import-adapters.d.ts +9 -1
- package/dist/sdk/package-import-adapters.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/complete-list.d.ts +14 -5
- package/dist/sdk/query/complete-list.js +1 -1
- package/dist/sdk/query/list.js +1 -1
- package/dist/sdk/query/projection-contracts.d.ts +6 -0
- package/dist/sdk/query/projection-contracts.js +1 -1
- package/dist/sdk/read-output/extension.js +1 -1
- package/dist/sdk/runtime-input.d.ts +6 -2
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime.d.ts +2 -2
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/structured-mutations.js +1 -1
- package/dist/sdk/testing.d.ts +15 -2
- package/dist/sdk/testing.js +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.js +1 -1
- package/docs/COMMANDS.md +9 -0
- package/docs/EXTENSIONS.md +1 -1
- package/docs/SDK.md +111 -5
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +1 -1
- package/marketplace.json +1 -1
- package/package.json +6 -3
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/extensions/calendar/command-definitions.ts +2 -0
- 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/extensions/todos/runtime.ts +3 -0
- 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 +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-25BUKX4W.js +0 -2
- package/dist/cli-bundle/chunks/chunk-27FG6ROB.js +0 -2
- package/dist/cli-bundle/chunks/chunk-5TGFB34A.js +0 -2
- package/dist/cli-bundle/chunks/chunk-BHH65KLL.js +0 -2
- package/dist/cli-bundle/chunks/chunk-C7M54YV6.js +0 -122
- package/dist/cli-bundle/chunks/chunk-DMWL3K4A.js +0 -20
- package/dist/cli-bundle/chunks/chunk-DVN7CD5B.js +0 -2
- package/dist/cli-bundle/chunks/chunk-DZ7CWUVM.js +0 -8
- package/dist/cli-bundle/chunks/chunk-FRCNYOTG.js +0 -9
- package/dist/cli-bundle/chunks/chunk-HXECILIE.js +0 -31
- package/dist/cli-bundle/chunks/chunk-IDFRGH4X.js +0 -3
- package/dist/cli-bundle/chunks/chunk-JSTBYDLL.js +0 -3
- package/dist/cli-bundle/chunks/chunk-O4ZLEN4T.js +0 -3
- package/dist/cli-bundle/chunks/chunk-OTM6PXZQ.js +0 -8
- package/dist/cli-bundle/chunks/chunk-PC5DGK3C.js +0 -6
- package/dist/cli-bundle/chunks/chunk-PF3V443A.js +0 -2
- package/dist/cli-bundle/chunks/chunk-U2HVJVA5.js +0 -2
- package/dist/cli-bundle/chunks/chunk-VERRDW3Q.js +0 -2
- package/dist/cli-bundle/chunks/item-revision-VGIHIWZM.js +0 -2
- package/dist/cli-bundle/chunks/item-transaction-6OB6BGTD.js +0 -2
- package/dist/cli-bundle/chunks/mutation-admission-LL6SGQYU.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-6RQF6IAE.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-XGPOFFD3.js +0 -2
- package/dist/cli-bundle/chunks/stage-ZS7WNUD4.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2A4JCFMI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2T6MQ7NP.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-32QYILXW.js +0 -82
- package/dist/cli-bundle/focused-chunks/chunk-4WOF3Q6R.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5IQPFV4Y.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-6C7NBJ7A.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-FNLOLNPQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-G6ERMFJ5.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-HRLGC3P7.js +0 -28
- package/dist/cli-bundle/focused-chunks/chunk-JHC3X43E.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-MKYNDWT3.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-RDTHL44U.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-UCCLV5GJ.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-W3RWCLEU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-W57DSFSU.js +0 -44
- package/dist/cli-bundle/focused-chunks/item-revision-7J7WSCPC.js +0 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-F5YMCPRB.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-2NRQEAOG.js +0 -2
- package/dist/cli-bundle/focused-chunks/stage-2KVCKOGC.js +0 -2
package/dist/cli-bundle/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as Xr}from"./chunks/chunk-
|
|
1
|
+
import{a as Xr}from"./chunks/chunk-6UTBX62V.js";import"./chunks/chunk-DEZPZOQ7.js";import{A as Gn,C as _a,D as va,F as wa,G as zn,a as Ln,d as P,e as F,f as O,g as D,h as k,i as Gr,n as Xe,o as zr,p as Zr,t as Qr,u as pa,v as ua,w as fa,x as ga,y as ha,z as ya}from"./chunks/chunk-YLPZE2TK.js";import{Wa as ma,f as Ur,k as qr}from"./chunks/chunk-VWKLTHYQ.js";import"./chunks/chunk-Q6GBRK27.js";import"./chunks/chunk-E74OMFBZ.js";import{A as $t,D as ia,E as ra,F as Q,G as aa,Lc as ca,Nd as da,aa as sa,b as Te,l as Kr,q as Un,r as qn,s as ea,t as ta,u as na,v as Hn,w as Pt,x as Qe,z as oa}from"./chunks/chunk-IXV5UM4U.js";import"./chunks/chunk-TESRFVGF.js";import"./chunks/chunk-S5UXBECQ.js";import{ha as la,j as Hr}from"./chunks/chunk-E4B2HWH7.js";import"./chunks/chunk-GAFALSR2.js";import"./chunks/chunk-ZVDXGAYV.js";import"./chunks/chunk-FYOIH56R.js";import"./chunks/chunk-FSE624WQ.js";import{Ac as It,Bc as Fn,Cc as Ze,D as Rt,Dc as E,E as pe,Ec as Jr,Fc as jn,Jc as z,Xc as Yr,kb as Tt,lb as H,nb as Wr,o as St,ob as Br,q as Ye,qb as Vr,r as At,zc as Ot}from"./chunks/chunk-ASGAELBQ.js";import{A as Lr,B as Fr,C as Mn,D as jr,n as Dn,p as Nr,u as Nn,w as Mr}from"./chunks/chunk-ZWUS65LN.js";import"./chunks/chunk-QZNDEZYI.js";import"./chunks/chunk-IB7UB5TE.js";import{$c as Tr,Ac as vr,Ad as $r,Bc as wr,Bd as Dr,Dc as br,Hb as kt,Hc as Cr,Ib as yr,Ic as xr,Jc as Sn,K as $i,Lc as kr,Mc as me,Nc as An,Oc as Rn,Pc as Tn,Qc as On,Rc as Et,Sc as In,Tc as Er,Uc as Sr,Vc as Ar,Wc as Pn,Xc as Rr,Yc as Re,ad as Or,hb as ur,ib as fr,jb as gr,kb as hr,ld as Je,od as Ir,rc as En,ud as Pr,xc as _r,zd as $n}from"./chunks/chunk-NAX554KY.js";import{A as yn,Hc as Z,Mb as er,Nb as tr,Ob as nr,Pb as or,Pd as xt,Qb as ir,Qc as cr,Rb as rr,Rc as ie,Sb as ar,Sd as dr,Td as mr,Vc as kn,Wc as b,Wd as Ae,Xd as L,Yd as pr,h as Ee,i as ze,ob as _n,pb as vn,qb as Zi,qc as sr,rb as Qi,tb as wn,ub as bn,uc as lr,vb as Cn,xb as xn}from"./chunks/chunk-KLWGIEDC.js";import{A as Ei,Ae as Ji,Ba as dn,Be as bt,Ea as le,Ec as Mi,Fb as un,Ga as Ai,H as Ge,Ha as yt,Ka as mn,Ke as hn,La as Ri,Le as Ct,Ma as T,Me as Yi,Oa as Ti,Oe as Xi,Pa as X,Wb as _t,Wc as Li,Y as Si,Yc as Fi,Yd as qi,Zb as fn,Zd as Hi,fb as _,gb as Oi,hb as pn,he as vt,jd as ji,kc as Di,kd as Ve,ke as Gi,lc as Ni,le as zi,md as Ke,me as Wi,nd as Ui,ne as Bi,ob as Ii,oe,pb as Pi,pe as Vi,qb as K,qe as gn,re as ce,s as M,se as Ki,te as wt,u as B,ub as We,v as q,we as Se,x as J,xe as de,y as cn,yb as Be,z as V}from"./chunks/chunk-KSLPRST2.js";import"./chunks/chunk-VS565KBX.js";import"./chunks/chunk-SPPHDVZE.js";import{A as h,B as ht,C as R,E as Y}from"./chunks/chunk-LC6DL446.js";import"./chunks/chunk-XAWE4EAK.js";import{AsyncLocalStorage as Ul}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]="0e47421c-706d-5e31-a466-6152cdeba30f")}catch{}})();var Oe=new Ul;function ba(e){let t=Oe.getStore();return t===void 0?e:t!==null}function ue(e,t=`warning:${e}`){let n=Oe.getStore();n?(!n.has(e)||t!==`warning:${e}`)&&n.set(e,t):b(t)}function et(e){let t=Oe.getStore();if(!t?.size)return e;let n=Reflect.get(e,"warnings"),o=[...t].filter(([a,s])=>s!==`warning:${a}`).map(([a,s])=>({code:a,message:s})),i=Reflect.get(e,"warning_details"),r={...e,warnings:[...Array.isArray(n)?n:[],...t.keys()],...o.length>0?{warning_details:[...Array.isArray(i)?i:[],...o]}:{}};return t.clear(),r}function Wn(e){if(!Oe.getStore()?.size)return e;let{token_accounting:t,...n}=et(JSON.parse(e));return JSON.stringify(t===void 0?n:Z(n,o=>`${JSON.stringify(o,null,2)}
|
|
2
2
|
`),null,2)}async function Ca(e,t){if(!e){await Oe.run(null,t);return}let n=new Map;await Oe.run(n,async()=>{await t(),n.size>0&&ie(`${JSON.stringify(et({type:"warning"}))}
|
|
3
|
-
`)})}import{AsyncLocalStorage as ql}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]="ad9cd4bc-07aa-5641-a1c4-b2aea5d4700c")}catch{}})();var Bn=new ql,xa=new WeakMap;function Hl(e){let t=e.outputFormat!==void 0?["--output-format",e.outputFormat]:e.json===!0?["--json"]:[];return{scopeArgs:Ee(e),outputArgs:t}}var ka=new WeakMap;function Gl(e,t){let n=e.registeredArguments.findIndex(o=>o.name()==="id");if(!(n===-1||e.name()==="plan"&&t[0]==="create"))return t[n]}function Vn(e,t){return t.some(n=>n.path!==e.path||n.args.length!==e.args.length||n.args.some((o,i)=>o!==e.args[i]))}async function Kn(e){if(e.expectHash===void 0)return;let t=Dn(e.expectHash),n=e.commandPath.trim().toLowerCase();if(Mn(n,e.commandOptions),e.rewritten===!0)throw Nn();let o=Bn.getStore();if(o===void 0)throw new TypeError("--expect-hash was parsed outside an invocation revision scope");let i=await Nr(e.pmRoot,t,Gl(e.command,e.commandArgs));gr(o,e.pmRoot,i),ka.set(o,n),e.globalOptions!==void 0&&xa.set(o,Hl(e.globalOptions))}function Jn(e,t,n){let o=Bn.getStore(),i=o===void 0?void 0:ka.get(o);if(i!==void 0){if(Vn(e,[t]))throw Nn();Mn(i,n)}}function Ea(e,t){if(t!==void 0)throw Dn(t),jr(e)}function zl(e){for(let t of hr(e).unchecked)ue(Fr(t))}async function Wl(e,t){return e.pmRoot===void 0?t:Mr(t,e.pmRoot,xa.get(e))}async function Sa(e){let t=ur();try{await e(n=>Bn.run(t,()=>fr(t,n)))}catch(n){throw await Wl(t,n)}zl(t)}import{Command as fi,CommanderError as sl}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="50318c14-8c1c-50f3-95d0-fd9ea3f0bb69")}catch{}})();function W(e){return`--${e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`}function fe(e){if(!e.startsWith("--"))return;let t=e.includes("=")?e.slice(0,e.indexOf("=")):e;return W(t)}function ee(e){let t=new Set,n=[];for(let o of e){let i=fe(o);i&&(t.has(i)||n.push(i),t.add(i))}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ceab696e-18da-519f-8df1-ae9d92e5245f")}catch{}})();var Yn=new Set(["--fields","--output-include","--depth","--for","--token-budget"]),Dt=new Set(["--full","--brief","--compact"]);function Bl(e,t){return!!(e.flag==="--pm-path"||e.value_name||e.list||e.value_type==="number"||e.value_type==="string"||t.has(e.flag))}function Xn(e,t=k([...e])){let n=H(t),o=new Set([...Wr,...Br,...Vr].flatMap(s=>s.keys.map(c=>`--${c.replace(/[A-Z]/g,l=>`-${l.toLowerCase()}`)}`))),i=new Map([...pe,...n].flatMap(s=>[s.flag,...s.aliases??[]].map(c=>[c,s.flag]))),r=new Map([...pe,...n].flatMap(s=>[s.flag,...s.aliases??[]].map(c=>[c,Bl(s,o)])));for(let s of Yn)r.set(s,!0);for(let s of Dt)r.set(s,!1);let a=new Map;for(let s=0;s<e.length;s+=1){let c=e[s];if(c==="--")break;if(!c.startsWith("-"))continue;let l=c.split("=")[0];if(!r.has(l)&&!c.includes("="))return;let d=r.get(l)===!0&&!c.includes("=");a.set(s,{flag:i.get(l)??l,consumesValue:d}),d&&(s+=1)}return a}function Vl(e){let t=Xn(e);return t===void 0?void 0:new Map([...t].map(([n,{flag:o}])=>[n,o]))}function Aa(e,t,n){let o=new Set;for(let[i,r]of t)n.has(r)&&(o.add(i),Yn.has(r)&&!e[i].includes("=")&&o.add(i+1));return e.filter((i,r)=>!o.has(r))}function Kl(e,t){let n=t.find(i=>Dt.has(i));if(n===void 0)return;let o=[...new Set(e.values())].filter(i=>Dt.has(i));return o.length===1?o[0]:n}function Ra(e,t,n){if(!n||!["unknown_field_projection","projection_options_mutually_exclusive"].includes(t??""))return n;let o=n.suggested_retry_args,i={...n,suggested_retry:void 0,suggested_retry_args:void 0};if(!o)return i;let r=Vl(e);if(!r)return i;let a;if(t==="unknown_field_projection"){let s=o.indexOf("--fields");if(s<0||o[s+1]===void 0)return i;let c=[...r].find(([l,d])=>d==="--fields")?.[0]??-1;if(c<0)return i;a=Aa(e,r,new Set(["--fields"])),a.splice(c,0,"--fields",o[s+1])}else{let s=Kl(r,o);if(s===void 0||![...r.values()].includes(s))return i;let c=new Set([...Yn,...Dt].filter(l=>l!==s));a=Aa(e,r,c)}return{...n,suggested_retry:_(a),suggested_retry_args:a}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="df0b3527-6272-570d-8f41-6bcfa3bfd75d")}catch{}})();var Ta=new Set(or);function Jl(e){return e.includes("@")&&e.includes(":")}function Yl(e){let t=D([...e]);if(t===void 0)return;let n=e[t+1],o=n===void 0||n.startsWith("-")?void 0:`${e[t]} ${n}`;return o!==void 0&&Tt(o)?o:e[t]}function Xl(e){let t=Te(e??"",H(e));return new Set(t.filter(n=>n.takes_value).flatMap(n=>[n.flag,...n.aliases??[]]))}function Oa(e,t,n,o=[],i=()=>!1){if(t!==nr)return n;let r=n===void 0?void 0:{...n,suggested_retry:void 0,suggested_retry_args:void 0},a=Yl(e),s=Xn(e,a);if(s===void 0||o===null||e.some(Jl)||i())return r;let c=Zl(e,s,Xl(a));if(c===void 0||c.size===0)return r;let l=[...o,...e.filter((d,m)=>!c.has(m))];return{...n,suggested_retry:_(l),suggested_retry_args:l}}function Zl(e,t,n){let o=new Set;for(let[i,{flag:r,consumesValue:a}]of t){if(!Ta.has(r))continue;let s=e[i-1];if(s!==void 0&&!s.includes("=")&&n.has(s)||a&&e[i+1]?.startsWith("-")===!0)return;o.add(i),a&&o.add(i+1)}return e.some((i,r)=>!o.has(r)&&Ta.has(i.split("=",1)[0]))?void 0:o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fe4ae753-52f9-57d4-b85b-f6dfc106db94")}catch{}})();var Ql=new Set(["normalized_args","suggested_retry_args","provided_fields","parsed_positionals","normalizedInvocationArgs","providedOptionFlags","suggestedRetryArgs"]),ec=new Set(["code","original_code","type","recovery_mode","option_scope","diagnostic_class"]),Zn=`URL credentials in this invocation were replaced with ${Oi}; restore them before replaying any command shown here.`;function ge(e){return e.map(pn)}function tc(e,t){return e==="producer"||t==="details"?"producer":e==="schema"&&t==="recovery"?"schema":"typed"}function nc(e,t,n){let o=K(e);o!==e&&(n.changed=!0);let i=o;for(let r=2;Object.hasOwn(t,i);r+=1)i=`${o} (${r})`;return i}function oc(e,t,n){let o=K(n?pn(e):e);return o!==e&&(t.changed=!0),o}function Qn(e,t,n,o){if(e===Zn)return e;if(typeof e=="string")return oc(e,t,n);if(typeof e!="object"||e===null)return e;let i=t.copies.get(e);if(i!==void 0)return i;if(Array.isArray(e)){let a=[];t.copies.set(e,a);for(let s of e)a.push(Qn(s,t,n,o));return a}let r={};t.copies.set(e,r);for(let[a,s]of Object.entries(e)){if(o==="schema"&&ec.has(a)&&typeof s=="string"){r[a]=s;continue}let c=o==="producer"?nc(a,r,t):a;r[c]=Qn(s,t,n||Ql.has(a),tc(o,a))}return r}function Nt(e){let t={copies:new Map,changed:!1},n=Qn(e,t,!1,"schema");if(!t.changed&&!Pi())return e;n.recovery&&(n.recovery={...n.recovery,suggested_retry:void 0,suggested_retry_args:void 0});let o=(n.nextSteps??[]).filter(i=>i!==Zn);return n.nextSteps=[Zn,...o],n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c470fd86-4218-5aed-a681-58557d759b28")}catch{}})();var ic="project_schema_field_requires_declared_flag";function rc(e){let t=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="--")break;o.startsWith("--field=")?t.push({index:n,width:1,assignment:o.slice(8)}):o==="--field"&&n+1<e.length&&(t.push({index:n,width:2,assignment:e[n+1]}),n+=1)}return t}function Ia(e,t,n,o){let i=o?.suggested_flags?.[0];if(t!==ic||n===void 0||i===void 0)return o;let r=rc(e).filter(({assignment:d})=>d.split("=",1)[0].trim()===n&&d.includes("="));if(r.length!==1)return o;let[a]=r,s=a.assignment.trim(),c=s.slice(s.indexOf("=")+1),l=[...e.slice(0,a.index),i,c,...e.slice(a.index+a.width)];return{...o,suggested_retry:_(l),suggested_retry_args:l}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f8935dde-8de2-508e-b910-2a603a763c48")}catch{}})();var eo=Kr;function ac(e,t,n,o,i){let r=[],a=e.indexOf(n,t);if(a<0||e.slice(t,a).some(s=>s.startsWith("-")))return r;for(let s=a+1;s<e.length;s+=1){let c=e[s];if(c==="--")break;c===`${o}=${i}`?r.push({index:s,width:1}):c===o&&e[s+1]===i&&(r.push({index:s,width:2}),s+=1)}return r}function Pa(e,t,n,o,i=[]){let r=o?.suggested_flags?.[0];if(t!==eo||n===void 0||r===void 0||o.suggested_retry_args===void 0)return o;let a={...o,suggested_retry:void 0,suggested_retry_args:void 0},s=D([...e]);if(s===void 0||i===null)return a;let c=o.suggested_retry_args,l=ac(e,s,c[0],n,r);if(l.length!==1)return a;let{index:d,width:m}=l[0],p=[...e.slice(0,d),r,...e.slice(d+m)];if(!sc(p,d,n,r,c))return a;let u=[...i,...p];return{...o,suggested_retry:_(u),suggested_retry_args:u}}function sc(e,t,n,o,i){let r=i.lastIndexOf(o);return r<0||i.slice(r).some((a,s)=>e[t+s]!==a)?!1:!e.some((a,s)=>s!==t&&(a===n||a.startsWith(`${n}=`)))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bed9cdab-5e06-5035-8d76-d9943a8e7e5f")}catch{}})();var to="close_validation_missing_fields";function lc(e,t,n,o){let i=e.slice(t+1);if(!i.includes("--"))return[...e,...o];if(!i.some(r=>n.has(r.split("=",1)[0])))return[...e.slice(0,t+1),...o,...i]}function cc(e,t){let n=e.slice(0,e.length-2*t),o=n.length;for(;o>0&&n[o-1].startsWith("--expect-hash=");)o-=1;return n.slice(o)}function $a(e,t,n,o=[]){let i=n?.missing;if(t!==to||i===void 0||i.length===0)return n;let r=n.suggested_retry_args;if(r===void 0)return n;let a={...n,suggested_retry:void 0,suggested_retry_args:void 0},s=D([...e]);if(s===void 0||o===null)return a;let c=H(e[s].trim().toLowerCase()),l=i.map(f=>c.find(g=>g.flag===f||g.aliases?.includes(f)===!0));if(l.some(f=>f===void 0))return a;let d=new Set(l.flatMap(f=>[f.flag,...f.aliases??[]])),m=cc(r,i.length),p=lc(e,s,d,[...i.flatMap(f=>[f,"<value>"]),...m]);if(p===void 0)return a;let u=[...o,...p];return{...n,suggested_retry:_(u),suggested_retry_args:u}}(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]="afa4a7a0-d9de-529d-92dd-3e9704ea00d2")}catch{}})();async function Da(e,t){await $r(e,{ok:t.ok,error:t.error,result:de(),exit_code:t.exit_code,error_code:t.error_code,error_category:t.error_category,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage})}async function Na(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1")return;let t;try{await sr({pmRoot:e.pmRoot,result:de()})}catch(o){t=o}let n=await L(e.pmRoot);if(await lr({pmRoot:e.pmRoot,author:Ct(e.author,n.author_default),itemIds:e.itemIds,intent:e.intent}),t!==void 0)throw 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]="dacf3952-3ae1-57fa-840a-c8a43cf855a5")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9490326e-507d-5b3e-9958-08c12afbc5ff")}catch{}})();var Ma=new WeakMap;function Mt(e,t){Ma.set(e,t)}function he(e){return Ma.get(e)}function La(e){return e.length>0?[e[0]]:[]}function dc(e){let t=["","Intent:",` ${e.why}`],n=La(e.examples);return n.length>0&&(t.push("","Example:"),t.push(` ${n[0]}`)),t.push("","Need deeper rationale and more examples?"),t.push(" Re-run with --explain."),t.join(`
|
|
3
|
+
`)})}import{AsyncLocalStorage as ql}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]="ad9cd4bc-07aa-5641-a1c4-b2aea5d4700c")}catch{}})();var Bn=new ql,xa=new WeakMap;function Hl(e){let t=e.outputFormat!==void 0?["--output-format",e.outputFormat]:e.json===!0?["--json"]:[];return{scopeArgs:Ee(e),outputArgs:t}}var ka=new WeakMap;function Gl(e,t){let n=e.registeredArguments.findIndex(o=>o.name()==="id");if(!(n===-1||e.name()==="plan"&&t[0]==="create"))return t[n]}function Vn(e,t){return t.some(n=>n.path!==e.path||n.args.length!==e.args.length||n.args.some((o,i)=>o!==e.args[i]))}async function Kn(e){if(e.expectHash===void 0)return;let t=Dn(e.expectHash),n=e.commandPath.trim().toLowerCase();if(Mn(n,e.commandOptions),e.rewritten===!0)throw Nn();let o=Bn.getStore();if(o===void 0)throw new TypeError("--expect-hash was parsed outside an invocation revision scope");let i=await Nr(e.pmRoot,t,Gl(e.command,e.commandArgs));gr(o,e.pmRoot,i),ka.set(o,n),e.globalOptions!==void 0&&xa.set(o,Hl(e.globalOptions))}function Jn(e,t,n){let o=Bn.getStore(),i=o===void 0?void 0:ka.get(o);if(i!==void 0){if(Vn(e,[t]))throw Nn();Mn(i,n)}}function Ea(e,t){if(t!==void 0)throw Dn(t),jr(e)}function zl(e){for(let t of hr(e).unchecked)ue(Fr(t))}async function Wl(e,t){return e.pmRoot===void 0?t:Mr(t,e.pmRoot,xa.get(e))}async function Sa(e){let t=ur();try{await e(n=>Bn.run(t,()=>fr(t,n)))}catch(n){throw await Wl(t,n)}zl(t)}import{Command as fi,CommanderError as sl}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="50318c14-8c1c-50f3-95d0-fd9ea3f0bb69")}catch{}})();function W(e){return`--${e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`}function fe(e){if(!e.startsWith("--"))return;let t=e.includes("=")?e.slice(0,e.indexOf("=")):e;return W(t)}function ee(e){let t=new Set,n=[];for(let o of e){let i=fe(o);i&&(t.has(i)||n.push(i),t.add(i))}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ceab696e-18da-519f-8df1-ae9d92e5245f")}catch{}})();var Yn=new Set(["--fields","--output-include","--depth","--for","--token-budget"]),Dt=new Set(["--full","--brief","--compact"]);function Bl(e,t){return!!(e.flag==="--pm-path"||e.value_name||e.list||e.value_type==="number"||e.value_type==="string"||t.has(e.flag))}function Xn(e,t=k([...e])){let n=H(t),o=new Set([...Wr,...Br,...Vr].flatMap(s=>s.keys.map(c=>`--${c.replace(/[A-Z]/g,l=>`-${l.toLowerCase()}`)}`))),i=new Map([...pe,...n].flatMap(s=>[s.flag,...s.aliases??[]].map(c=>[c,s.flag]))),r=new Map([...pe,...n].flatMap(s=>[s.flag,...s.aliases??[]].map(c=>[c,Bl(s,o)])));for(let s of Yn)r.set(s,!0);for(let s of Dt)r.set(s,!1);let a=new Map;for(let s=0;s<e.length;s+=1){let c=e[s];if(c==="--")break;if(!c.startsWith("-"))continue;let l=c.split("=")[0];if(!r.has(l)&&!c.includes("="))return;let d=r.get(l)===!0&&!c.includes("=");a.set(s,{flag:i.get(l)??l,consumesValue:d}),d&&(s+=1)}return a}function Vl(e){let t=Xn(e);return t===void 0?void 0:new Map([...t].map(([n,{flag:o}])=>[n,o]))}function Aa(e,t,n){let o=new Set;for(let[i,r]of t)n.has(r)&&(o.add(i),Yn.has(r)&&!e[i].includes("=")&&o.add(i+1));return e.filter((i,r)=>!o.has(r))}function Kl(e,t){let n=t.find(i=>Dt.has(i));if(n===void 0)return;let o=[...new Set(e.values())].filter(i=>Dt.has(i));return o.length===1?o[0]:n}function Ra(e,t,n){if(!n||!["unknown_field_projection","projection_options_mutually_exclusive"].includes(t??""))return n;let o=n.suggested_retry_args,i={...n,suggested_retry:void 0,suggested_retry_args:void 0};if(!o)return i;let r=Vl(e);if(!r)return i;let a;if(t==="unknown_field_projection"){let s=o.indexOf("--fields");if(s<0||o[s+1]===void 0)return i;let c=[...r].find(([l,d])=>d==="--fields")?.[0]??-1;if(c<0)return i;a=Aa(e,r,new Set(["--fields"])),a.splice(c,0,"--fields",o[s+1])}else{let s=Kl(r,o);if(s===void 0||![...r.values()].includes(s))return i;let c=new Set([...Yn,...Dt].filter(l=>l!==s));a=Aa(e,r,c)}return{...n,suggested_retry:_(a),suggested_retry_args:a}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="df0b3527-6272-570d-8f41-6bcfa3bfd75d")}catch{}})();var Ta=new Set(or);function Jl(e){return e.includes("@")&&e.includes(":")}function Yl(e){let t=D([...e]);if(t===void 0)return;let n=e[t+1],o=n===void 0||n.startsWith("-")?void 0:`${e[t]} ${n}`;return o!==void 0&&Tt(o)?o:e[t]}function Xl(e){let t=Te(e??"",H(e));return new Set(t.filter(n=>n.takes_value).flatMap(n=>[n.flag,...n.aliases??[]]))}function Oa(e,t,n,o=[],i=()=>!1){if(t!==nr)return n;let r=n===void 0?void 0:{...n,suggested_retry:void 0,suggested_retry_args:void 0},a=Yl(e),s=Xn(e,a);if(s===void 0||o===null||e.some(Jl)||i())return r;let c=Zl(e,s,Xl(a));if(c===void 0||c.size===0)return r;let l=[...o,...e.filter((d,m)=>!c.has(m))];return{...n,suggested_retry:_(l),suggested_retry_args:l}}function Zl(e,t,n){let o=new Set;for(let[i,{flag:r,consumesValue:a}]of t){if(!Ta.has(r))continue;let s=e[i-1];if(s!==void 0&&!s.includes("=")&&n.has(s)||a&&e[i+1]?.startsWith("-")===!0)return;o.add(i),a&&o.add(i+1)}return e.some((i,r)=>!o.has(r)&&Ta.has(i.split("=",1)[0]))?void 0:o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fe4ae753-52f9-57d4-b85b-f6dfc106db94")}catch{}})();var Ql=new Set(["normalized_args","suggested_retry_args","provided_fields","parsed_positionals","normalizedInvocationArgs","providedOptionFlags","suggestedRetryArgs"]),ec=new Set(["code","original_code","type","recovery_mode","option_scope","diagnostic_class"]),Zn=`URL credentials in this invocation were replaced with ${Oi}; restore them before replaying any command shown here.`;function ge(e){return e.map(pn)}function tc(e,t){return e==="producer"||t==="details"?"producer":e==="schema"&&t==="recovery"?"schema":"typed"}function nc(e,t,n){let o=K(e);o!==e&&(n.changed=!0);let i=o;for(let r=2;Object.hasOwn(t,i);r+=1)i=`${o} (${r})`;return i}function oc(e,t,n){let o=K(n?pn(e):e);return o!==e&&(t.changed=!0),o}function Qn(e,t,n,o){if(e===Zn)return e;if(typeof e=="string")return oc(e,t,n);if(typeof e!="object"||e===null)return e;let i=t.copies.get(e);if(i!==void 0)return i;if(Array.isArray(e)){let a=[];t.copies.set(e,a);for(let s of e)a.push(Qn(s,t,n,o));return a}let r={};t.copies.set(e,r);for(let[a,s]of Object.entries(e)){if(o==="schema"&&ec.has(a)&&typeof s=="string"){r[a]=s;continue}let c=o==="producer"?nc(a,r,t):a;r[c]=Qn(s,t,n||Ql.has(a),tc(o,a))}return r}function Nt(e){let t={copies:new Map,changed:!1},n=Qn(e,t,!1,"schema");if(!t.changed&&!Pi())return e;n.recovery&&(n.recovery={...n.recovery,suggested_retry:void 0,suggested_retry_args:void 0});let o=(n.nextSteps??[]).filter(i=>i!==Zn);return n.nextSteps=[Zn,...o],n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c470fd86-4218-5aed-a681-58557d759b28")}catch{}})();var ic="project_schema_field_requires_declared_flag";function rc(e){let t=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="--")break;o.startsWith("--field=")?t.push({index:n,width:1,assignment:o.slice(8)}):o==="--field"&&n+1<e.length&&(t.push({index:n,width:2,assignment:e[n+1]}),n+=1)}return t}function Ia(e,t,n,o){let i=o?.suggested_flags?.[0];if(t!==ic||n===void 0||i===void 0)return o;let r=rc(e).filter(({assignment:d})=>d.split("=",1)[0].trim()===n&&d.includes("="));if(r.length!==1)return o;let[a]=r,s=a.assignment.trim(),c=s.slice(s.indexOf("=")+1),l=[...e.slice(0,a.index),i,c,...e.slice(a.index+a.width)];return{...o,suggested_retry:_(l),suggested_retry_args:l}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f8935dde-8de2-508e-b910-2a603a763c48")}catch{}})();var eo=Kr;function ac(e,t,n,o,i){let r=[],a=e.indexOf(n,t);if(a<0||e.slice(t,a).some(s=>s.startsWith("-")))return r;for(let s=a+1;s<e.length;s+=1){let c=e[s];if(c==="--")break;c===`${o}=${i}`?r.push({index:s,width:1}):c===o&&e[s+1]===i&&(r.push({index:s,width:2}),s+=1)}return r}function Pa(e,t,n,o,i=[]){let r=o?.suggested_flags?.[0];if(t!==eo||n===void 0||r===void 0||o.suggested_retry_args===void 0)return o;let a={...o,suggested_retry:void 0,suggested_retry_args:void 0},s=D([...e]);if(s===void 0||i===null)return a;let c=o.suggested_retry_args,l=ac(e,s,c[0],n,r);if(l.length!==1)return a;let{index:d,width:m}=l[0],p=[...e.slice(0,d),r,...e.slice(d+m)];if(!sc(p,d,n,r,c))return a;let u=[...i,...p];return{...o,suggested_retry:_(u),suggested_retry_args:u}}function sc(e,t,n,o,i){let r=i.lastIndexOf(o);return r<0||i.slice(r).some((a,s)=>e[t+s]!==a)?!1:!e.some((a,s)=>s!==t&&(a===n||a.startsWith(`${n}=`)))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bed9cdab-5e06-5035-8d76-d9943a8e7e5f")}catch{}})();var to="close_validation_missing_fields";function lc(e,t,n,o){let i=e.slice(t+1);if(!i.includes("--"))return[...e,...o];if(!i.some(r=>n.has(r.split("=",1)[0])))return[...e.slice(0,t+1),...o,...i]}function cc(e,t){let n=e.slice(0,e.length-2*t),o=n.length;for(;o>0&&n[o-1].startsWith("--expect-hash=");)o-=1;return n.slice(o)}function $a(e,t,n,o=[]){let i=n?.missing;if(t!==to||i===void 0||i.length===0)return n;let r=n.suggested_retry_args;if(r===void 0)return n;let a={...n,suggested_retry:void 0,suggested_retry_args:void 0},s=D([...e]);if(s===void 0||o===null)return a;let c=H(e[s].trim().toLowerCase()),l=i.map(f=>c.find(g=>g.flag===f||g.aliases?.includes(f)===!0));if(l.some(f=>f===void 0))return a;let d=new Set(l.flatMap(f=>[f.flag,...f.aliases??[]])),m=cc(r,i.length),p=lc(e,s,d,[...i.flatMap(f=>[f,"<value>"]),...m]);if(p===void 0)return a;let u=[...o,...p];return{...n,suggested_retry:_(u),suggested_retry_args:u}}(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]="afa4a7a0-d9de-529d-92dd-3e9704ea00d2")}catch{}})();async function Da(e,t){await $r(e,{ok:t.ok,error:t.error,result:de(),exit_code:t.exit_code,error_code:t.error_code,error_category:t.error_category,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage})}async function Na(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1")return;let t;try{await sr({pmRoot:e.pmRoot,result:de()})}catch(o){t=o}let n=await L(e.pmRoot);if(await lr({pmRoot:e.pmRoot,author:vt(e.author,n.author_default),itemIds:e.itemIds,intent:e.intent}),t!==void 0)throw 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]="dacf3952-3ae1-57fa-840a-c8a43cf855a5")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9490326e-507d-5b3e-9958-08c12afbc5ff")}catch{}})();var Ma=new WeakMap;function Mt(e,t){Ma.set(e,t)}function he(e){return Ma.get(e)}function La(e){return e.length>0?[e[0]]:[]}function dc(e){let t=["","Intent:",` ${e.why}`],n=La(e.examples);return n.length>0&&(t.push("","Example:"),t.push(` ${n[0]}`)),t.push("","Need deeper rationale and more examples?"),t.push(" Re-run with --explain."),t.join(`
|
|
4
4
|
`)}function mc(e){let t=["","Why use this command:",` ${e.why}`,"","Examples:",...e.examples.map(n=>` ${n}`)];return e.tips&&e.tips.length>0&&(t.push("","Tips:"),t.push(...e.tips.map(n=>` - ${n}`))),t.join(`
|
|
5
5
|
`)}function Fa(e,t){return t==="detailed"?mc(e):dc(e)}function j(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}var pc={cal:"calendar",ctx:"context"};function uc(e,t){return e.commands.find(n=>n.name()===t)??null}function fc(e,t){let n=e;for(let o of t){let i=uc(n,o);if(!i)return null;n=i}return n}function no(e,t,n,o){let i=fc(e,t.split(" ").filter(r=>r.length>0));i&&i.addHelpText("after",Fa(n,o))}function oo(e){return e.includes("--explain")?"detailed":"compact"}function re(e){return e.includes("--all")||e.includes("--explain")}var ye={"item reopen":{why:"Reopens recurring work while archiving earlier closure evidence and declaring its current planning outcome.",examples:['pm item reopen pm-a1b2 "The failure recurred" --expected-result "The recurrence regression passes"'],tips:["Without --expected-result, follow recovery.suggested_retry_args to restore current planning before claiming the item."]},ops:{why:"Groups workspace diagnostics, quality checks, and maintenance under one discoverable command.",examples:["pm ops health --summary","pm ops validate --check-history-drift","pm ops --help"]},init:{why:"Bootstraps tracker storage and settings so all other commands can run safely.",examples:["pm init","pm init acme","pm init ./pm-sandbox --defaults","pm init --preset minimal","pm init --agent-guidance add","pm init --defaults --with-packages"],tips:["Run this once per repository before create/list/update commands.","A path-like positional (`./dir`, `/tmp/dir`) initializes that tracker path; a plain word remains an id prefix.","Rewriting id prefix, governance preset, or default author on an existing tracker requires --force.","Use --preset for non-interactive automation; omit it in a TTY to use the setup wizard.","Use --agent-guidance add to inject compact AGENTS/CLAUDE workflow guidance, or --agent-guidance status to inspect missing guidance without modifying files.","Use --with-packages when agents need bundled commands such as calendar and templates available immediately."]},config:{why:"Reads or updates project/global settings such as definition-of-done, item format, telemetry, and policy toggles.",examples:["pm config project get definition-of-done",'pm config project set definition-of-done --criterion "tests pass"',"pm config project set item-format --format toon","pm config project set sprint-release-format-policy --policy strict_error","pm config project set governance-preset --policy minimal","pm config project set governance-ownership-enforcement --policy none","pm config project set test-result-tracking --policy enabled","pm config global set telemetry-tracking --policy disabled"]},extension:{why:"Compatibility command for package-backed runtime extension lifecycle operations across project or global scope.",examples:["pm package install ./my-package --project","pm package install '*' --project","pm package doctor --project --detail summary","pm package manage --global","pm package activate sample-ext --project","pm package deactivate sample-ext --project","pm package uninstall sample-ext --global","pm package explore --project","pm package manage --global","pm package describe sample-ext --project","pm package doctor --detail deep"],tips:["Prefer pm install and pm package in new user-facing automation.","Use pm extension when maintaining existing extension-specific scripts or debugging the compatibility runtime directly.","Bundled aliases beads and todos resolve to package-shipped extension sources.","Use --gh/--github shorthand for GitHub sources and --ref to pin a branch, tag, or ref.","Install updates settings activation state automatically unless extension allowlist mode is unchanged.","Use --adopt for single-extension adoption and --adopt-all to bulk-register unmanaged installs as managed without reinstalling.","Use --manage for concise triage summaries and remediation-oriented diagnostics alongside full extension details.","Use --describe to map exactly what each loaded extension registers (commands, hooks, item types, providers, overrides) in one call.","Use --doctor for consolidated diagnostics with warning codes, remediation hints, and optional deep detail payloads."]},package:{why:"Installs, explores, manages, diagnoses, adopts, activates, deactivates, and refreshes package-backed pm runtime extensions.",examples:["pm package install npm:@scope/pm-package --project","pm package install ./my-package --project","pm package doctor --project --detail deep","pm package manage --project --runtime-probe","pm package describe --project","pm package activate sample-ext --project","pm package upgrade --packages-only --dry-run"],tips:["Prefer package vocabulary for user-facing workflows; extension vocabulary remains available for compatibility.","Use pm package describe [name] to map every surface a package registers without reading its manifest or running diagnostics.","Use pm upgrade to refresh the CLI/SDK and managed packages from their recorded sources.","Use --dry-run before upgrade when automation needs a deterministic plan."]},"package init":{why:"Generates an installable starter pm package with package metadata and a root extension entrypoint.",examples:["pm package init ./my-package","pm package init ./my-hook-package --capability hooks","pm package init ./my-search-package --capability search","pm package init ./my-sync-package --capability importers","pm package init ./my-domain-package --capability schema","pm package init ./my-output-package --capability renderers","pm package install ./my-sync-package --project","pm package doctor --project --detail summary"],tips:["Use --capability hooks for a starter after_command lifecycle reactor with runnable SDK testing coverage.","Use --capability search for a starter search provider/vector-store adapter with runnable SDK testing coverage.","Use --capability importers for paired import/export commands that move project context across systems.","Use --capability schema for a starter custom item type, field, and migration so pm models your project domain.","Use --capability renderers/parser/preflight/services for starter override surfaces (output renderer, parsed-option rewrite, pre-run gate decision, built-in service) \u2014 one runnable starter per SDK capability.","The generated package is local-install safe; add SDK runtime imports only after declaring dependencies and validating with package doctor.","Use package doctor after changes to verify activation, policy, and collision diagnostics."]},"package install":{why:"Installs pm packages from local paths, npm sources, GitHub sources, bundled aliases, or wildcard/all aliases.",examples:["pm package install ./my-package --project","pm package install npm:pm-changelog --project","pm package install --github org/repo/packages/my-pm-package --ref main"],tips:["Prefer the top-level pm install alias in scripts when only installation is needed.","Run pm package manage or pm package doctor after installing external packages."]},"package doctor":{why:"Diagnoses package activation, policy, collision, and managed-state health for project or global package scopes.",examples:["pm package doctor --project --detail summary","pm package doctor --project --detail deep --trace","pm package doctor --project --isolated --detail deep --trace"],tips:["Use --isolated (alias --ignore-global) for hermetic project smoke tests that must ignore globally installed package registrations.","Set PM_GLOBAL_PATH for a whole subprocess suite when every pm invocation must avoid machine-local global package state: PM_GLOBAL_PATH=$(mktemp -d) pm package doctor --project --detail deep --trace.","Non-isolated project diagnostics include global registrations and emit remediation when global package state can affect the result."]},"package catalog":{why:"Lists bundled first-party package catalog metadata and compact field projections.",examples:["pm package catalog --project","pm package catalog --project --fields alias,installed,install_command","pm package list --project --fields alias,package_name,category"],tips:["Use --fields for low-token package discovery in agent loops.","External npm package discovery still belongs to npm search."]},"extension init":{why:"Generates an installable starter runtime extension with manifest and entrypoint files.",examples:["pm package init ./my-extension","pm package init ./my-hook-extension --capability hooks","pm package init ./my-search-extension --capability search","pm package init ./my-sync-extension --capability importers","pm package init ./my-domain-extension --capability schema","pm package init ./my-output-extension --capability renderers","pm package --install --project ./my-sync-extension","pm package --doctor --project --detail summary"],tips:["Use --capability hooks when the extension should react to command lifecycle events.","Use --capability search when the extension should register retrieval primitives.","Use --capability importers when the extension should register project-context import/export commands.","Use --capability schema when the extension should register custom item types, fields, and migrations.","Use --capability renderers/parser/preflight/services to override pm's output rendering, parsed options, pre-run gate, or a built-in service.","Use package init for new distributable package workflows; extension init is the compatibility-level runtime scaffold."]},"extension install":{why:"Installs a compatibility runtime extension from local, npm, GitHub, bundled alias, or wildcard sources.",examples:["pm package install ./my-extension --project","pm package --install --project ./my-extension","pm package doctor --project --detail summary"],tips:["Prefer pm install or pm package install for new package-first automation."]},"extension doctor":{why:"Diagnoses compatibility extension activation, policy, collision, and managed-state health for project or global extension scopes.",examples:["pm package doctor --project --detail summary","pm package doctor --project --detail deep --trace","pm package doctor --project --isolated --detail deep --trace"],tips:["Use --isolated (alias --ignore-global) for hermetic project smoke tests that must ignore globally installed extension registrations.","Set PM_GLOBAL_PATH for a whole subprocess suite when every pm invocation must avoid machine-local global extension state: PM_GLOBAL_PATH=$(mktemp -d) pm extension doctor --project --detail deep --trace.","Prefer pm package doctor in new package-first workflows."]},"extension catalog":{why:"Compatibility view of bundled package catalog metadata.",examples:["pm package catalog --project","pm package catalog --project --fields alias,installed,install_command"],tips:["Prefer pm package catalog in new user-facing workflows."]},install:{why:"Installs a pm package into project scope by default, using local, npm, GitHub, or bundled alias sources.",examples:["pm package install '*' --project","pm package install ./packages/pm-todos --project","pm package install npm:@scope/pm-package --global","pm package install --github org/repo/packages/my-pm-package --ref main"],tips:["Installed packages are recorded in managed state and can be inspected with pm package manage."]},upgrade:{why:"Updates the global pm CLI/SDK and refreshes managed pm packages from recorded install sources.",examples:["pm package upgrade --dry-run","pm package upgrade --packages-only --project","pm package upgrade todos --dry-run","pm package upgrade --cli-only --repair","pm package upgrade --tag next --dry-run"],tips:["Omit target to include the CLI/SDK plus all managed packages in the selected scope.","Pass a target to refresh one managed package by name, directory, package name, or source.","Use --packages-only in repository automation when the global CLI should not be changed."]},create:{why:"Creates a new planning item with deterministic metadata and history.",examples:['pm create --title "Harden lock flow" --description "Improve stale lock handling" --type Task --status open --priority 1 --message "Create lock hardening task" --create-mode progressive','pm create --title "Weekly planning sync" --description "Recurring coordination meeting" --type Meeting --schedule-preset lightweight','pm create --title "Asset: Hero model" --description "Track playable model asset" --type Asset --status open --priority 1 --message "Create asset item" --type-option category=Character --dep "id=pm-epic01,kind=parent,created_at=now" --comment "created_at=now,text=Why this asset item exists." --note "created_at=now,text=Initial implementation note." --learning "created_at=now,text=Durable lesson placeholder." --file "path=src/assets/hero.glb,note=tracked asset" --test "command=node scripts/run-tests.mjs test,timeout_seconds=240" --doc "path=README.md,note=asset docs"'],tips:["Use --schedule-preset lightweight for Reminder/Meeting/Event when you want minimal required create inputs.","Use --type <value> to load type-aware policy guidance in --help output.","Bulk creation is pm item mutate --from items.jsonl (JSON Lines, array, or envelope; --upsert-key <field> makes re-runs idempotent)."]},focus:{why:"Sets a session focused item so new pm create items default their --parent to it (project management = context management).",examples:["pm focus pm-epic1","pm focus","pm focus --clear"],tips:["Focus is session-local (stored in .agents/pm/runtime/session.json, gitignored) \u2014 it never affects teammates.",'An explicit --parent on pm create always overrides the focused item; use --parent "" to create with no parent.',"A stale focused item produces the same missing-parent validation as an explicit stale --parent."]},update:{why:"Mutates existing item fields while preserving history and lock safety.",examples:['pm update pm-a1b2 --status in_progress --message "Start implementation"','pm update pm-a1b2 --unset close-reason --message "Clear stale close reason after reopen"','pm update pm-a1b2 --unset assignee --deadline +2d --message "Replan ownership and deadline"','pm update pm-a1b2 --body "Backfilled body text for legacy item" --message "Normalize missing body"'],tips:['Use "pm close <ID> <TEXT>" to close items instead of --status closed.',"When reopening from closed to a non-terminal status, update clears stale close_reason unless explicitly set via --close-reason.",'Use "pm append <ID> --body <text>" for additive notes; use update --body to replace body content.']},"update-many":{why:"Bulk-updates matched item sets with dry-run previews and rollback checkpoints for safe large-scale metadata changes.",examples:["pm update-many --filter-status open --status in_progress --dry-run",'pm update-many --filter-tag wave:7 --replace-tests --test "command=node scripts/run-tests.mjs test -- tests/core/history.spec.ts,timeout_seconds=240"','pm update-many --filter-tag governance --reviewer maintainer-review --message "Normalize reviewer metadata"',"pm update-many --rollback ckpt-abc123"],tips:["Use --dry-run first to inspect proposed changes before apply mode.","Linked-array mutation flags mirror pm update semantics (for example --replace-tests, --clear-files, and repeatable --doc/--note seeds).","Checkpoints are enabled by default for apply mode and can be restored with --rollback."]},"close-many":{why:"Bulk-closes matched items with a shared reason routed through full pm close semantics (close validation, active-child orphan checks, blocked-edge cleanup) plus dry-run previews and rollback checkpoints \u2014 unlike update-many --status closed, which bypasses close validation.",examples:['pm close-many --filter-sprint S-12 --reason "Sprint S-12 acceptance criteria met" --dry-run','pm close-many --filter-tag wave:7 --reason "Superseded by redesign" --validate-close warn','pm close-many --ids pm-a,pm-b,pm-c --reason "Closed in batch" --resolution "Verified by integration suite"',"pm close-many --rollback close-many-20260604-abc123"],tips:["At least one filter (--filter-* or --ids) is required so close-many never matches every item.","Already-terminal matches are skipped by default; pass --force to re-close them.","Use --dry-run to preview matches plus per-item skip reasons and active-child orphan warnings before applying.","Checkpoints are enabled by default for apply mode; restore with --rollback <checkpoint-id>."]},templates:{why:"Saves, lists, and inspects reusable create option bundles for repeatable workflows.",examples:['pm templates save triage-default --title "Triage item" --description "..." --type Task --status open --priority 2 --message "Seed triage template"',"pm templates list","pm templates show triage-default"],tips:["Template names are positional arguments (`pm templates save <name>` and `pm templates show <name>`), not --name flags.","Combine templates with explicit create flags; explicit flags always override template defaults."]},deps:{why:"Inspects an item dependency graph as a tree or graph payload to understand blockers and hierarchy links.",examples:["pm deps pm-a1b2","pm deps pm-a1b2 --format graph","pm deps pm-a1b2 --max-depth 2 --collapse repeated --summary"],tips:["Use --summary for lightweight counts when full graph payloads are unnecessary."]},list:{why:"Lists active items with deterministic filtering and ordering.",examples:["pm list --limit 20","pm list --type Task --priority 0 --tag release --status in_progress","pm list --compact --sort deadline --order asc","pm list --fields id,title,parent,type --sort parent --order asc"]},"list-all":{why:"Lists all item states (including terminal states) when you need full visibility.",examples:["pm list --all --limit 50","pm list --all --type Issue --include-body"]},"list-open":{why:"Shows work that is ready to claim and start.",examples:["pm list --status open --priority 0 --limit 10"]},"list-in-progress":{why:"Tracks active execution and owner progress.",examples:["pm list --status in_progress --priority 0 --limit 20"]},"list-blocked":{why:"Surfaces blocked work that needs intervention.",examples:["pm list --blocked --limit 20"]},"list-closed":{why:"Reviews completed work and closure outcomes.",examples:["pm list --status closed --limit 20 --type Task"]},"list-canceled":{why:"Audits intentionally discontinued work.",examples:["pm list --status canceled --limit 20"]},"list-draft":{why:"Finds incompletely defined items that need refinement before execution.",examples:["pm list --status draft --limit 20"]},aggregate:{why:"Runs grouped aggregation queries for governance checks such as decomposition by parent/type or triage by status/priority.",examples:["pm aggregate --group-by parent,type --count","pm aggregate --group-by type,status --count","pm aggregate --group-by parent,type --count --status open --parent pm-feature01"],tips:["Current aggregate mode is grouped counts only, so pass --count explicitly."]},guide:{why:"Routes local progressive-disclosure documentation so agents can fetch only the context they need.",examples:["pm package install guide-shell --project","pm guide","pm guide quickstart","pm guide commands --depth standard","pm guide skills --depth deep --format markdown","pm guide release --json"],tips:["Use brief depth for minimal token footprint, standard for excerpted docs, and deep for full local document rendering.","Use --list to force topic index output even when topic parsing is ambiguous."]},calendar:{why:"Provides deadline/reminder/event scheduling views for planning and coordination.",examples:["pm calendar","pm calendar --view agenda --from +0d --to +7d --tag release","pm calendar --view week --date 2026-04-06 --full-period --include deadlines,events","pm calendar --view month --tag release --format json"],tips:["Day/week/month views are anchored period windows; default mode clips the start to now unless --past or --full-period is set.","--full-period applies only to day/week/month views; use --from/--to to bound agenda windows."]},context:{why:"Builds an agent-optimized snapshot of critical active work plus near-term agenda context with progressive depth levels.",examples:["pm context","pm ctx --depth standard --limit 10","pm ctx --depth deep --tag release","pm ctx --section hierarchy --section progress --section blockers","pm context --depth standard --activity-limit 20 --stale-threshold 14d","pm context --from +0d --to +7d --format markdown --depth deep"],tips:["High-level focus contains Epics/Features and low-level focus contains Tasks/Issues/Chores/Decisions/Event/Reminder/Milestone/Meeting/Plan.","When no open or in-progress work exists, blocked items are shown as fallback context.","--depth brief (default) shows focus+agenda; standard adds hierarchy/activity/progress/workload; deep adds blockers/files/staleness/tests.","--section overrides --depth and selects specific sections: hierarchy, activity, progress, blockers, files, workload, staleness, tests.","Configure defaults via pm config project set context --default-depth standard --activity-limit 15."]},next:{why:"Answers 'what should I work on now?' with the highest-priority ready item, rationale, and ranked ready and blocked queues.",examples:["pm next","pm next --json","pm next --limit 3 --ready-only","pm next --parent pm-mpbb","pm next --tag release --format markdown"],tips:["Ready = active status, no open blockers, and no open children (a concrete leaf); the recommendation resumes in-progress work before starting new work.","An item is blocked when its scalar blocked_by or a blocked_by dependency points at a non-terminal item; the blocked list names the blockers to clear.","Containers (Epics/Features with open children) are never recommended directly \u2014 the actionable leaf beneath them is.","Use --parent to scope to one epic's subtree, or --ready-only to drop the blocked companion list for the tightest output."]},search:{why:"Finds relevant items by keyword, semantic, or hybrid retrieval modes.",examples:['pm search "lock stale retry" --mode keyword --limit 10','pm search "extension migration blockers" --mode hybrid --type Task --priority 0','pm search "Cross-Epic Realism Dependency Council" --mode keyword --title-exact'],tips:["Use --title-exact to require exact normalized title parity, or --phrase-exact to require full-phrase matches in item text fields.","Use --include-linked when linked docs/files/tests should influence scoring."]},eval:{why:"Measures search relevance against a curated golden-query set so retrieval regressions are caught, not guessed.",examples:["pm eval --json","pm eval --mode hybrid --k 10","pm eval --fail-under 0.6 --json","pm eval --queries ./my-eval.json --mode semantic"],tips:["Curate ground truth in <pmRoot>/search/eval-queries.json as an array of {query, relevant_ids, mode?} objects.","Wire --fail-under into CI to fail the build when aggregate nDCG@k drops below your baseline."]},reindex:{why:"Rebuilds search artifacts after large changes to item corpus or provider/vector config.",examples:["pm reindex --mode keyword","pm reindex --mode hybrid --progress --json"],tips:["Use --progress for non-interactive visibility during local embedding runs.","JSON output includes semantic stale/unchanged/embed/upsert counts so agents can gate long reindex work without parsing stderr."]},get:{why:"Shows details for one item by ID, with optional lower-token projections for agent loops.",examples:["pm get pm-a1b2","pm get pm-a1b2 --depth brief --json","pm get pm-a1b2 --fields id,title,status,parent,type --json","pm get pm-a1b2 --at 7 --fields id,title,status,body --json"],tips:["Default depth is standard for body plus linked artifacts without append-only logs; use brief for metadata-only checks or --full for complete history-heavy metadata.","Use --fields for the smallest deterministic item metadata payload when an agent only needs specific fields.","Schedule metadata is normalized under schedule; request schedule.start_at or schedule.location for narrow calendar reads.","Children are type-agnostic and include bounded deterministic samples plus continuation metadata when a parent has direct children.","Use --at <version|timestamp> for a verified read-only historical projection; reconstructed/as_of fields distinguish it from current state.","JSON output shape is { item, linked, claim_state, schedule, children }; body is nested at item.body (parity with list --include-body)."]},history:{why:"Inspect recorded mutations.",examples:["pm history pm-a1b2 --order oldest_first","pm history pm-a1b2 --full --verify"]},"history-compact":{why:"Compacts long history streams into a synthetic checkpoint while preserving replay integrity. Pass an item id for one stream, or a bulk selector (--ids/--all-over/--closed/--all-streams) to sweep many.",examples:["pm history-compact pm-a1b2 --dry-run",'pm history-compact pm-a1b2 --before 25 --message "Compact early history"',"pm history-compact --all-over 500 --dry-run","pm history-compact --closed","pm history-compact --ids pm-a1b2,pm-c3d4 --dry-run"]},activity:{why:"Reviews recent tracker-wide activity across items.",examples:["pm activity --limit 50","pm activity --full --id pm-a1b2 --limit 50","pm activity --id pm-a1b2 --op update --from -7d --to now","pm activity --json --stream rows --limit 200"],tips:["Use --stream with --json for line-delimited automation output; --from is inclusive and --to is exclusive."]},restore:{why:"Restores an item to a prior timestamp/version with history replay safety.",examples:['pm restore pm-a1b2 2026-04-01T00:00:00.000Z --message "Rollback to known-good state"']},close:{why:"Transitions work to terminal closed state with explicit rationale.",examples:['pm close pm-a1b2 "Done" --resolution "Delivered" --expected "Required outcome" --actual "Verified outcome" --release-assignment --validate-close warn','pm close pm-a1b2 "Done" --validate-close','pm close pm-a1b2 "Done" --validate-close off','pm close pm-a1b2 "Done" --validate-close strict']},delete:{why:"Removes an item while preserving history evidence and lock/ownership checks.",examples:['pm delete pm-a1b2 --message "Remove duplicate item"']},append:{why:"Adds implementation notes to body without replacing existing content.",examples:['pm append pm-a1b2 --body "Implemented retry with bounded backoff." --message "Record implementation detail"']},comments:{why:"Adds or reviews lightweight status updates linked to an item.",examples:['pm comments pm-a1b2 "Verified fix on Linux and macOS"','pm comments pm-a1b2 --add "Verified fix on Linux and macOS"','printf "%s\\n" "## Verification" "- linux pass" "- mac pass" | pm comments pm-a1b2 --stdin',"pm comments pm-a1b2 --file docs/release-evidence.md",'pm comments pm-a1b2 --add "text: verification note with commas, key-like words, and parser details"','pm comments pm-a1b2 --add "Follow-up needed after review" --force',"pm comments pm-a1b2 --limit 10"],tips:["Use exactly one comment source at a time: positional [text], --add, --stdin, or --file.","Use --force when adding comments to items currently assigned to a different owner.","When --add payload resembles CSV-like key fragments (for example text=hello,scope:project), plain-text fallback is intentional; use explicit text=..., markdown text: ..., or stdin token - for structured intent."]},notes:{why:"Adds or reviews durable implementation notes linked to an item.",examples:['pm notes pm-a1b2 --add "Investigated parser edge case and documented fallback logic."','pm notes pm-a1b2 --add "text: parser rationale with commas, colons, and key-like wording"','pm notes pm-a1b2 --edit 1 --add "Corrected durable note"',"pm notes pm-a1b2 --delete 2","pm notes pm-a1b2 --limit 10"],tips:["CSV-like add payloads with extra key fragments are treated as plain text by design; use explicit text keys (text= or text:) when structured parsing is required."]},learnings:{why:"Adds or reviews post-implementation learnings for future work.",examples:['pm learnings pm-a1b2 --add "Avoid direct test-runner commands in linked tests; use sandbox runner."','pm learnings pm-a1b2 --add "text: lesson with commas, key-like words, and punctuation-safe context"',"pm learnings pm-a1b2 --edit 1 --file docs/corrected-learning.md","pm learnings pm-a1b2 --delete 2","pm learnings pm-a1b2 --limit 10"],tips:["If you intended structured parsing for a key-like payload, prefer explicit text=..., markdown text: ..., or stdin token -; ambiguous CSV-like forms intentionally remain plain text."]},files:{why:"Associates changed source files with tracker items for reproducibility.",examples:['pm files pm-a1b2 --add "path=src/cli/main.ts,note=help orchestration"','pm files pm-a1b2 --add src/cli/main.ts --note "help orchestration"',"pm files discover pm-a1b2",'pm files discover pm-a1b2 --apply --note "discovered from item text"']},docs:{why:"Associates relevant documentation paths with tracker items.",examples:['pm docs pm-a1b2 --add "path=README.md,note=user-facing command guidance"','pm docs pm-a1b2 --add README.md --note "user-facing command guidance"']},test:{why:"Links test commands/paths and optionally executes them for one item.",examples:['pm test pm-a1b2 --add "command=node scripts/run-tests.mjs test -- tests/unit/output.spec.ts,timeout_seconds=2400"','pm test pm-a1b2 --add "command=pm list --all --type Task --limit 200,assert_stdout_contains=count:,assert_stdout_regex=count:\\s+\\d+"','pm test pm-a1b2 --add "command=pm list --all --type Task --limit 200,pm_context_mode=auto"',"pm test pm-a1b2 --run --timeout 2400 --env-set PORT=0 --env-clear PLAYWRIGHT_BASE_URL --shared-host-safe --pm-context tracker --fail-on-context-mismatch --fail-on-skipped","pm test pm-a1b2 --run --timeout 2400 --pm-context auto","pm test pm-a1b2 --run --background --timeout 2400 --progress"]},"test-all":{why:"Runs linked tests in bulk for release/readiness sweeps.",examples:["pm test-all --status in_progress --limit 5 --offset 10 --timeout 2400","pm test-all --status closed --timeout 3600 --progress --env-set PORT=0 --shared-host-safe --fail-on-skipped","pm test-all --status in_progress --pm-context tracker --fail-on-context-mismatch --require-assertions-for-pm","pm test-all --status in_progress --pm-context auto --fail-on-context-mismatch","pm test-all --status in_progress --background --timeout 3600"]},"test-runs":{why:"Manages background linked-test runs with lifecycle controls and log/status inspection.",examples:["pm test-runs list --status running --limit 20","pm test-runs status tr-abc123","pm test-runs logs tr-abc123 --stream stderr --tail 200","pm test-runs stop tr-abc123","pm test-runs resume tr-abc123"]},stats:{why:"Reports tracker-level totals and distribution by type/status.",examples:["pm stats","pm stats --json"]},telemetry:{why:"Inspects and manages local telemetry queue/runtime state for observability diagnostics.",examples:["pm telemetry status","pm telemetry stats --limit 10","pm telemetry flush","pm telemetry clear"]},health:{why:"Validates tracker/runtime health including extension triage, migration, and integrity diagnostics.",examples:["pm health","pm health --check-only --summary --json","pm health --brief --json","pm health --no-refresh","pm health --refresh-vectors"]},validate:{why:"Runs standalone metadata, resolution, lifecycle (including dependency-cycle diagnostics), linked-file, linked-command reference, and history drift checks with default remediation hints for resolution gaps.",examples:["pm validate","pm validate --check-resolution --json","pm validate --check-lifecycle --dependency-cycle-severity error","pm validate --check-lifecycle --parent-cycle-severity error","pm validate --check-files --scan-mode tracked-all","pm validate --check-files --scan-mode tracked-all-strict --include-pm-internals","pm validate --check-command-references","pm validate --check-resolution --fail-on-warn --json"],tips:["Resolution-gap warnings include default `pm update <id> ...` remediation hint templates in check details."]},gc:{why:"Deletes optional cache artifacts by default to keep local tracker state tidy; use --dry-run to preview targets without deleting files.",examples:["pm gc --dry-run","pm gc"]},claim:{why:"Claims an item to signal active ownership and reduce conflicts.",examples:["pm claim pm-a1b2 --start",'pm claim pm-a1b2 --force --message "Take over terminal item"','pm claim pm-a1b2 --author "release-service" --message "Explicit non-agent identity override"'],tips:["Claim is an atomic test-and-set: a non-terminal item held by another principal refuses with already_claimed_by. Use --if-available to skip that item without failing. Terminal items still require --force, even when --if-available is set. Use --force for coordinated takeovers; stale locks require --force only when governance.force_required_for_stale_lock is enabled.","Harness identity is automatic; use --author only to assert an intentional external principal."]},release:{why:"Releases an active claim when paused, handed off, or completed.",examples:["pm release pm-a1b2 --pause",'pm release pm-a1b2 --handoff review --message "Implemented; run linked verification"'],tips:["Register the project queue with pm schema add-status review --role active before using --handoff."]},"start-task":{why:"Lifecycle alias that claims an item and sets status to in_progress.",examples:['pm claim --start pm-a1b2 --message "Start implementation"']},"pause-task":{why:"Lifecycle alias that sets status to open and releases active assignment.",examples:['pm release --pause pm-a1b2 --message "Pause for dependency unblock"']},"close-task":{why:"Lifecycle alias that closes with reason text and clears assignment metadata.",examples:['pm close --release-assignment pm-a1b2 "All acceptance criteria met" --message "Close and handoff"']},meet:{why:"Shortcut to create a Meeting from friendly time flags (start/duration) without structured --event CSV.",examples:['pm meet "Sprint Planning" --start +1h --duration 1h','pm meet "1:1" --start 2026-07-01T15:00:00Z --end 2026-07-01T15:30:00Z --location "Room A"'],tips:["Start defaults to now and duration to 1h; pass --end to set an explicit end instead of --duration.","--duration accepts relative tokens (h/d/w/m where m is months) plus sub-hour forms like 30min or PT30M."]},event:{why:"Shortcut to create an Event from friendly time flags (start/duration) without structured --event CSV.",examples:['pm event "Release v2" --start 2026-07-01T10:00:00Z --duration 2h','pm event "Conference" --start 2026-08-01 --all-day'],tips:["Start defaults to now and duration to 1h; pass --end to set an explicit end instead of --duration.","--duration accepts relative tokens (h/d/w/m where m is months) plus sub-hour forms like 30min or PT30M."]},remind:{why:"Shortcut to create a Reminder from a single point in time without structured --reminder CSV.",examples:['pm remind "Review PR" --at +2d','pm remind "Follow up" --at 2026-07-01T09:00:00Z --text "Ping the team"'],tips:["The reminder time defaults to +1d and the reminder text defaults to the title."]},completion:{why:"Generates shell completion scripts for faster and more reliable command entry.",examples:["pm completion bash","pm completion zsh","pm completion fish","pm completion bash --eager-tags"],tips:["Default scripts resolve tag suggestions lazily at completion time; use --eager-tags to embed current tags directly."]},contracts:{why:"Exposes machine-readable CLI command and tool schema contracts for agent integrations.",examples:["pm contracts","pm contracts --command list --runtime-only","pm contracts --command update --flags-only","pm contracts --availability-only --runtime-only","pm contracts --action create","pm contracts --schema-only"],tips:["Use --command to narrow actions/schema to one CLI surface; combine with --flags-only or --availability-only for lighter payloads."]}};for(let{alias:e,canonical:t}of M){let n=ye[e];n&&(ye[t]={...n,examples:n.examples.map(o=>o.replace(`pm ${e}`,`pm ${t}`))})}var Ie={why:"Provides deterministic project management workflows for humans and coding agents.",examples:["pm init","pm package install guide-shell --project","pm list --status open --limit 10",'pm create --title "..." --description "..." --type Task --status open --priority 1 --message "..." --create-mode progressive'],tips:["Use <command> --help for command-specific guidance and examples.","Install guide-shell before using pm guide for local docs and skills routing.","Use --json for machine parsing and integration flows.","Use --no-pager to force direct help output in CI and other non-interactive shells."]},ja=J.filter(e=>e.lifecycle==="deprecated");for(let e of ja){let t=ye[e.alias];ye[e.alias]={...t,why:`Deprecated: use pm ${e.canonical_argv.join(" ")}. ${t.why}`}}for(let e of[Ie,...Object.values(ye)])e.examples=e.examples.map(t=>{for(let n of ja){let o=n.alias.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replaceAll(new RegExp(`\\bpm ${o}(?![\\w-])`,"g"),`pm ${n.canonical_argv.join(" ")}`)}return t});function gc(e){let t=j(e??"");return t?pc[t]??t:""}function io(e){let t=gc(e);return t?ye[t]??Ie:Ie}function Ua(e,t){let n=io(e);return{intent:n.why,examples:t==="detailed"?[...n.examples]:La(n.examples),tips:t==="detailed"?[...n.tips??[]]:[],detail_mode:t}}function hc(){let e=J.filter(({lifecycle:n})=>n==="permanent"),t=J.filter(({lifecycle:n})=>n==="deprecated");return["","Command aliases:",...e.map(({alias:n,canonical_argv:o})=>` ${n} -> pm ${o.join(" ")}`),"","Deprecated aliases:",...t.map(n=>` ${n.alias} -> pm ${n.canonical_argv.join(" ")} (${Ei(n)})`)].join(`
|
|
6
6
|
`)}function yc(e,t,n,o){let i=new Set(ia);e.configureHelp({visibleCommands(a){let s=t.visibleCommands(a);return n?s.filter(c=>(he(c)??Q(c.name()))!=="internal"):a!==e?s:s.filter(c=>o.has(c))},visibleOptions(a){let s=t.visibleOptions(a);return a!==e||n?s:s.filter(c=>i.has(c.flags))}});let r=e.options.filter(a=>a.long==="--output-cursor");for(let a of e.commands.flatMap(s=>[s,...s.commands]))["list","search","context"].includes(a.name())&&a.configureHelp({visibleOptions:s=>[...t.visibleOptions(s),...r]})}function _c(e,t,n,o){let i=new Set(aa("core")),r=e.createHelp();r.prepareContext({error:!1,helpWidth:80,outputHasColors:!1});let a=()=>`${r.formatHelp(e,r)}${o}
|
|
@@ -22,11 +22,11 @@ ${a}`:""}
|
|
|
22
22
|
${e}
|
|
23
23
|
Extension activation failures:
|
|
24
24
|
${i}`}function _o(e){return O(e).commandPathTokens[0]??k(e)??"<command>"}function fs(e,t){let n=new Set,o=[...e.commands];for(;o.length>0;){let i=o.shift();if(!i)continue;let r=j(E(i)),a=r.split(" ").some(s=>s.startsWith("_"));r.length>0&&!a&&n.add(r),o.push(...i.commands)}for(let i of t.keys()){let r=j(i),a=r.split(" ").some(s=>s.startsWith("_"));r.length>0&&!a&&n.add(r)}return[...n].sort((i,r)=>i.localeCompare(r))}function ds(e,t){let n=e.trim().toLowerCase(),o=t.trim().toLowerCase();if(o.length===0)return Number.POSITIVE_INFINITY;let i=n.split(" ");if(n===o)return 0;if(i.includes(o))return 1;if(i.some(s=>s.startsWith(o)))return 2;if(n.includes(o))return 3;let r=o.length>=5?2:1,a=Number.POSITIVE_INFINITY;for(let s of i){let c=fn(s,o,r);c!==null&&(a=Math.min(a,c))}return Number.isFinite(a)?4+a:Number.POSITIVE_INFINITY}function ms(e){return W(e).slice(2).replace(/-/g,"")}function vo(e){return _(e)}function qd(e){let t=V(e)?.canonical??cn[e]??e,n=t.split(" ")[0]?.trim().toLowerCase();if(!n)return null;let o=Fd[n];return o?{packageAlias:o,canonicalPath:t,installCommand:`pm package install ${o} --project`}:null}function ps(e){let t=la(e);for(let n of["@unbrained/","builtin-","pm-"])t.startsWith(n)&&(t=t.slice(n.length));return t}function Hd(e,t){let n=ps(e);if(n.length===0)return[];let o=[];for(let i of t.values()){let r=new Set,a=i.source;if(a)for(let s of[a.name,a.package]){let c=ps(s??"");c.length>0&&r.add(c)}r.size!==0&&[...r].some(s=>s===n||s.includes(n)||n.includes(s))&&o.push(i.command)}return[...new Set(o)].sort((i,r)=>i.localeCompare(r))}function ot(e,t){let n=new Set,o=t??H(e);for(let i of o){i.flag.startsWith("--")&&n.add(W(i.flag));for(let r of i.aliases??[])r.startsWith("--")&&n.add(W(r))}return[...n].sort((i,r)=>i.localeCompare(r))}function Gd(e,t){if(!e.startsWith("--"))return[];let n=ms(e);if(n.length===0)return[];let o=n.length>=8?2:1,i=[];for(let r of t){let a=ms(r);if(a===n)continue;if(n.length>=3&&a.startsWith(n)){i.push({flag:r,rank:0,distance:a.length-n.length});continue}let s=fn(n,a,o);s===null||s<=0||i.push({flag:r,rank:1,distance:s})}return i.sort((r,a)=>r.rank!==a.rank?r.rank-a.rank:r.distance!==a.distance?r.distance-a.distance:r.flag.localeCompare(a.flag)).map(r=>r.flag).slice(0,3)}var qt,zd=new Set(["ctx","packages","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","start-task","pause-task","close-task","help"]);function Wd(){if(qt)return qt;let e=new Map;for(let t of Ge)if(!zd.has(t))for(let n of ot(t)){let o=e.get(n)??[];o.push(t),e.set(n,o)}return qt=e,qt}function Bd(e,t){if(!e.startsWith("--"))return[];let n=Wd().get(W(e));if(!n)return[];let o=t?.trim().toLowerCase(),i=new Set(ot(o));return[...new Set(n.filter(r=>r!==o).map(r=>({command:r,sharedFlagCount:ot(r).filter(a=>i.has(a)).length})).sort((r,a)=>r.sharedFlagCount!==a.sharedFlagCount?a.sharedFlagCount-r.sharedFlagCount:r.command.localeCompare(a.command)).map(({command:r})=>V(r)?.canonical??r))]}function Vd(e,t,n){for(let o=0;o<e.length;o+=1){let i=e[o];if(!i.startsWith("--"))continue;let r=i.indexOf("="),a=r>=0?i.slice(0,r):i;if(W(a)!==W(t))continue;let s=[...e];return s[o]=r>=0?`${n}${i.slice(r)}`:n,s}}function Kd(e){let t=new Set(e.commandPaths),n=r=>Math.min(ds(r,e.normalizedUnknown),e.primaryToken!==e.normalizedUnknown?ds(r,e.primaryToken):Number.POSITIVE_INFINITY),o=new Map,i=(r,a)=>{if(!Number.isFinite(a)||!t.has(r))return;let s=o.get(r);(s===void 0||a<s)&&o.set(r,a)};for(let r of e.commandPaths)i(r,n(r));for(let[r,a]of Object.entries(cn))r!=="read"&&i(a,n(r));return[...o.entries()].sort(([r,a],[s,c])=>a!==c?a-c:r.localeCompare(s)).map(([r])=>r)}function Jd(e){let t=V(e.normalizedUnknown),n=wa(e.commandPaths,e.primaryToken),o=Kd(e),i=Hd(e.primaryToken,e.extensionDescriptors).filter(r=>e.commandPaths.includes(r));return zn([...t&&e.commandPaths.includes(t.canonical)?[t.canonical_argv.join(" ")]:[],...n,...o,...i],e.commandPaths,e.primaryToken).filter(r=>!e.normalizedUnknown.includes(" ")||r!==e.normalizedUnknown)}function Yd(e){return[...new Set(e.map(t=>t.split(" ")[0]).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n))}function Xd(e,t){let n=e.map(o=>`pm ${o} --help`);return t?[...new Set([...n,"pm --help --all"])]:[...new Set(["pm --help --all",...n])]}function Zd(e,t,n){let o=D([...t]),i=[];for(;o!==void 0;){if(i.push(t[o]),t[o]===e)return i.join(" ");if(!n.includes(i.join(" ")))return e;let r=D(t.slice(o+1));o=r===void 0?void 0:o+1+r}return e}function us(e,t){if(!e)return;let n=P([...t]);return[...Ee(n),...e.split(" "),"--help"]}function wo(e,t,n,o=[]){let i=e.match(/unknown command '([^']+)'/i);if(!i||typeof i[1]!="string")return;let r=fs(t,n),a=Zd(i[1],o,r),s=j(a);if(s.length===0||r.length===0)return;let c=pa(s,r);if(c){let x=us("update",o),S=x.slice(0,-2);return{suggestedRetryCommand:_(x),suggestedRetryArgs:x,unknownCommandExamples:[_(x),...c.examples.map($=>_([...S,...$]))],unknownCommandNextSteps:c.nextSteps}}let l=qd(s);if(l&&!r.includes(l.canonicalPath.split(" ")[0]))return{unknownCommandExamples:[l.installCommand,`pm ${l.canonicalPath} --help`,"pm --help --all"],unknownCommandNextSteps:[`"${s}" is provided by the "${l.packageAlias}" package. Install it with: ${l.installCommand}. Command after installation: pm ${l.canonicalPath}.`],suggestedRetryCommand:l.installCommand};let d=s.split(" ")[0],m=Jd({commandPaths:r,normalizedUnknown:s,primaryToken:d,extensionDescriptors:n}),p=Yd(r),u=va(s,r),f=us(u,o),g=[...new Set([...u?[u]:[],...m.length>0?m:zn(p,r)])].slice(0,3),y=Xd(g,m.length>0),I=m.length>0?`Did you mean: ${g.join(", ")}?`:null;return{...f?{suggestedRetryCommand:_(f),suggestedRetryArgs:f}:{},unknownCommandExamples:f?[_(f),...y.slice(1)]:y,unknownCommandNextSteps:[...I?[I]:[],'Run "pm --help --all" to list every command available in this runtime, including active extensions.',...I?["Use one of the suggested command paths above with --help to inspect valid flags and usage."]:[]]}}function Qd(e){return Array.from(new Set(e))}function em(e){let t="";for(let n of e){if(n===" "||n===" "||n===`
|
|
25
|
-
`||n==="\r"||n==="\f"||n==="\v")break;t+=n}return t}function tm(e){let t=e.length;for(;t>0;){let n=e[t-1];if(n!==","&&n!==":"&&n!==";")break;t-=1}return e.slice(0,t)}function nm(e,t){let n=t.trim().toLowerCase();return e.commands.find(o=>o.name().trim().toLowerCase()===n?!0:(typeof o.aliases=="function"?o.aliases():[]).some(i=>i.trim().toLowerCase()===n))}function De(e,t){if(t.length===0)return!0;let n=e;for(let[o,i]of t.entries()){let r=nm(n,i);if(!r){let a=n.registeredArguments;return a.length>0&&(n.commands.length===0||a[0]?.required===!0)&&(a.at(-1)?.variadic===!0||t.length-o<=a.length)}n=r}return!0}async function om(e,t,n,o){try{let i=T(process.cwd(),e.path);if(!await Y(X(i)))return{allowedTypes:nt};let r=await L(i),a=e.noExtensions?void 0:ce(),s=le(r,a),c;if(/too many arguments/i.test(t)&&["comments","docs","files","learnings","notes","test"].includes(o??"")){let l=n.findIndex(m=>m===o),d=n[l+2];if(n[l+1]?.toLowerCase()==="add"&&d!==void 0&&!d.startsWith("-"))try{c=(await kt(i,d,r.id_prefix,r.item_format,s.type_to_folder))?.id}catch{}}return{allowedTypes:s.types.length>0?s.types.join("|"):nt,pmRoot:i,settings:r,typeToFolder:s.type_to_folder,verifiedCollectionItemId:c}}catch{return{allowedTypes:nt}}}function im(e,t){let n=e.match(/unknown option '([^']+)'/i),o=n&&t?Qd([...Ud(t,n[1]),...Gd(n[1],ot(t))]).filter(a=>ya(n[1],a)):void 0,i=n?Bd(n[1],t):[],r=n!==null&&ot(t).includes(W(n[1]));return{match:n,suggestions:o,otherCommands:i,scope:r?"declared_on_path":i.length>0?"declared_elsewhere":"declared_nowhere"}}function rm(e,t,n){if(!t||!n||n.length===0)return;let o=Vd(e,t[1],n[0]);return o?vo(o):void 0}function am(e,t){let n=e.match(/required option '([^']+)' not specified/i),o=n?.[1]?tm(em(n[1].trim())):void 0;if(!o?.startsWith("--"))return;let i=k(t);if(i)return _a(t,i,[o])}function sm(e,t){if(!/too many arguments/i.test(e))return;let n=D(t),o=B(t.slice(n));if(o?.alias!=="schema")return;let i=n+o.canonical_argv.length-1,r=t[i+1]?.trim().toLowerCase(),a=t[i+2]?.trim().toLowerCase();if(!r||!a)return;let s=`${r}-${a}`;if(!cs.includes(s))return;let c=[...t.slice(0,i+1),s,...t.slice(i+3)];return{unknownSubcommandPath:"schema",unknownSubcommandToken:`${r} ${a}`,unknownSubcommandAllowedValues:[...cs],suggestedRetryCommand:vo(c)}}function lm(e,t,n,o){let i=D(t),r=B(t.slice(i))?.alias??k(t);if(!/unknown option /i.test(e)||r===void 0)return r;let a=V(r)?.canonical??r;return Ge.some(s=>s===r)||fs(n,o).includes(a)?r:void 0}async function it(e,t,n,o={},i=process.argv.slice(2)){let r=(typeof e=="object"&&e!==null?e.message:void 0)??"Invalid command usage",a=Xe([...i]).argv,s=ge(a),c=P(a),l=lm(r,s,t,n),d=vo(s),m=ee(s),p=await om(c,r,s,l),u=p.allowedTypes,f=wo(r,t,n,s),g=im(r,l),y=sm(r,s),I=y?.suggestedRetryCommand??rm(s,g.match,g.suggestions)??am(r,s);return{message:r,commandName:l,allowedTypes:u,attemptedCommand:d,normalizedInvocationArgs:[...s],providedOptionFlags:m,unknownOptionSuggestions:g.suggestions,unknownOptionOtherCommands:g.otherCommands.length>0?g.otherCommands.slice(0,12):void 0,unknownOptionOtherCommandsTotal:g.otherCommands.length>0?g.otherCommands.length:void 0,unknownOptionOtherCommandsTruncated:g.otherCommands.length>12||void 0,unknownOptionScope:g.scope,suggestedRetryCommand:I,verifiedCollectionItemId:p.verifiedCollectionItemId,...y,...f,...o}}async function bo(e,t,n,o={},i=process.argv.slice(2)){let r=await it(e,t,n,o,i),{message:a,commandName:s,allowedTypes:c,...l}=r,d=P(r.normalizedInvocationArgs).lean,m=rs(a,s,c,l,{lean:d}),p=await
|
|
26
|
-
`):c,null,2)}(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]="e57ce782-5c73-5c74-a929-0971a990a355")}catch{}})();async function gs(e,t,n,o){if(n)return null;let i=e.some(a=>a==="--for"||a.startsWith("--for=")),r=k(e)==="contracts"&&e.includes("--full");return i||r?await o(t):null}import{Option as cm}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="
|
|
25
|
+
`||n==="\r"||n==="\f"||n==="\v")break;t+=n}return t}function tm(e){let t=e.length;for(;t>0;){let n=e[t-1];if(n!==","&&n!==":"&&n!==";")break;t-=1}return e.slice(0,t)}function nm(e,t){let n=t.trim().toLowerCase();return e.commands.find(o=>o.name().trim().toLowerCase()===n?!0:(typeof o.aliases=="function"?o.aliases():[]).some(i=>i.trim().toLowerCase()===n))}function De(e,t){if(t.length===0)return!0;let n=e;for(let[o,i]of t.entries()){let r=nm(n,i);if(!r){let a=n.registeredArguments;return a.length>0&&(n.commands.length===0||a[0]?.required===!0)&&(a.at(-1)?.variadic===!0||t.length-o<=a.length)}n=r}return!0}async function om(e,t,n,o){try{let i=T(process.cwd(),e.path);if(!await Y(X(i)))return{allowedTypes:nt};let r=await L(i),a=e.noExtensions?void 0:ce(),s=le(r,a),c;if(/too many arguments/i.test(t)&&["comments","docs","files","learnings","notes","test"].includes(o??"")){let l=n.findIndex(m=>m===o),d=n[l+2];if(n[l+1]?.toLowerCase()==="add"&&d!==void 0&&!d.startsWith("-"))try{c=(await kt(i,d,r.id_prefix,r.item_format,s.type_to_folder))?.id}catch{}}return{allowedTypes:s.types.length>0?s.types.join("|"):nt,pmRoot:i,settings:r,typeToFolder:s.type_to_folder,verifiedCollectionItemId:c}}catch{return{allowedTypes:nt}}}function im(e,t){let n=e.match(/unknown option '([^']+)'/i),o=n&&t?Qd([...Ud(t,n[1]),...Gd(n[1],ot(t))]).filter(a=>ya(n[1],a)):void 0,i=n?Bd(n[1],t):[],r=n!==null&&ot(t).includes(W(n[1]));return{match:n,suggestions:o,otherCommands:i,scope:r?"declared_on_path":i.length>0?"declared_elsewhere":"declared_nowhere"}}function rm(e,t,n){if(!t||!n||n.length===0)return;let o=Vd(e,t[1],n[0]);return o?vo(o):void 0}function am(e,t){let n=e.match(/required option '([^']+)' not specified/i),o=n?.[1]?tm(em(n[1].trim())):void 0;if(!o?.startsWith("--"))return;let i=k(t);if(i)return _a(t,i,[o])}function sm(e,t){if(!/too many arguments/i.test(e))return;let n=D(t),o=B(t.slice(n));if(o?.alias!=="schema")return;let i=n+o.canonical_argv.length-1,r=t[i+1]?.trim().toLowerCase(),a=t[i+2]?.trim().toLowerCase();if(!r||!a)return;let s=`${r}-${a}`;if(!cs.includes(s))return;let c=[...t.slice(0,i+1),s,...t.slice(i+3)];return{unknownSubcommandPath:"schema",unknownSubcommandToken:`${r} ${a}`,unknownSubcommandAllowedValues:[...cs],suggestedRetryCommand:vo(c)}}function lm(e,t,n,o){let i=D(t),r=B(t.slice(i))?.alias??k(t);if(!/unknown option /i.test(e)||r===void 0)return r;let a=V(r)?.canonical??r;return Ge.some(s=>s===r)||fs(n,o).includes(a)?r:void 0}async function it(e,t,n,o={},i=process.argv.slice(2)){let r=(typeof e=="object"&&e!==null?e.message:void 0)??"Invalid command usage",a=Xe([...i]).argv,s=ge(a),c=P(a),l=lm(r,s,t,n),d=vo(s),m=ee(s),p=await om(c,r,s,l),u=p.allowedTypes,f=wo(r,t,n,s),g=im(r,l),y=sm(r,s),I=y?.suggestedRetryCommand??rm(s,g.match,g.suggestions)??am(r,s);return{message:r,commandName:l,allowedTypes:u,attemptedCommand:d,normalizedInvocationArgs:[...s],providedOptionFlags:m,unknownOptionSuggestions:g.suggestions,unknownOptionOtherCommands:g.otherCommands.length>0?g.otherCommands.slice(0,12):void 0,unknownOptionOtherCommandsTotal:g.otherCommands.length>0?g.otherCommands.length:void 0,unknownOptionOtherCommandsTruncated:g.otherCommands.length>12||void 0,unknownOptionScope:g.scope,suggestedRetryCommand:I,verifiedCollectionItemId:p.verifiedCollectionItemId,...y,...f,...o}}async function bo(e,t,n,o={},i=process.argv.slice(2)){let r=await it(e,t,n,o,i),{message:a,commandName:s,allowedTypes:c,...l}=r,d=P(r.normalizedInvocationArgs).lean,m=rs(a,s,c,l,{lean:d}),p=await Xi("help_format",{message:m,command:s,allowed_types:c});return p.handled&&typeof p.result=="string"?p.result:m}async function Co(e,t,n,o=!1,i={},r=process.argv.slice(2)){let a=await it(e,t,n,i,r),s=Ut(a.message,a.commandName,a.allowedTypes,h.USAGE,a),c=o?Ft(s):s,l=P(a.normalizedInvocationArgs).tokenAccounting===!0;return JSON.stringify(l?Z(c,d=>`${JSON.stringify(d,null,2)}
|
|
26
|
+
`):c,null,2)}(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]="e57ce782-5c73-5c74-a929-0971a990a355")}catch{}})();async function gs(e,t,n,o){if(n)return null;let i=e.some(a=>a==="--for"||a.startsWith("--for=")),r=k(e)==="contracts"&&e.includes("--full");return i||r?await o(t):null}import{Option as cm}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0c4a9247-bcce-54a9-ab83-7f82b6a47658")}catch{}})();function w(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function ys(e,t){let n=new Map;for(let o of e){let i=w(o.command);for(let r of t){if(r.layer!==o.layer||r.name!==o.name)continue;let a=w(r.command),s=a.split(" "),c=s.at(-1),l=s.slice(1).join(" "),d=l?`${s[0]}-${c} ${l}`:`${s[0]}-${c}`;if(c&&i===d){n.set(i,a);break}}}return n}function xo(e,t,n,o){if(!t||!n)return;let i,r=0;for(let[s,c]of e.entries()){if(c!==t)continue;let l=e.slice(s);for(let[d,m]of o.entries()){let p=d.split(" ");p.length>r&&p.every((u,f)=>l[f]===u)&&(i=m,r=p.length)}}let a=i?.flags.find(s=>s.long===n||s.short===n);if(a)return dm(a).takesValue}function Gt(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Ht(e){return typeof e=="boolean"?e:void 0}function dm(e){let t=_t(e);return{takesValue:t.value_arity!=="none",valueName:t.value_name}}function mm(e){let t=We(e.long);if(!t||!t.startsWith("--")||t.length<3)return null;let n=ko(e);return n?`${n} ${Eo(e)}`:null}function _s(e){let t=[...new Set(e.map(mm).filter(n=>n!==null))].sort((n,o)=>n.localeCompare(o));return t.length===0?null:`
|
|
27
27
|
Extension-provided flags:
|
|
28
28
|
${t.join(`
|
|
29
|
-
`)}`}function vs(e){let t=new Map;for(let i of e){let r=w(i.target_command);if(r.length===0)continue;let a=t.get(r)??[];a.push(...i.flags),t.set(r,a)}let n=[...t.entries()].sort(([i],[r])=>i.localeCompare(r)),o=new Map;for(let[i,r]of n){let a=_s(r);a&&o.set(i,a)}return o}function ws(e,t){return typeof t!="string"||t.trim().length===0?e.replace(/\s+/g,"-"):t.trim().toLowerCase()}function hs(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let o of e){if(typeof o!="string")continue;let i=o.trim();i.length===0||n.has(i)||(n.add(i),t.push(i))}return t}function pm(e){return Array.isArray(e)?e.map(t=>{let n=typeof t.name=="string"?t.name.trim():"";if(n.length===0)return null;let o={name:n,required:t.required===!0,variadic:t.variadic===!0};return typeof t.description=="string"&&t.description.trim().length>0&&(o.description=t.description.trim()),o}).filter(t=>t!==null):[]}function um(e){let t=new Map;for(let n of e){let o=w(n.command);if(o.length===0)continue;let i=typeof n.description=="string"&&n.description.trim().length>0?n.description.trim():void 0,r=typeof n.intent=="string"&&n.intent.trim().length>0?n.intent.trim():void 0;t.set(o,{command:o,action:ws(o,n.action),description:i,intent:r,examples:hs(n.examples),failure_hints:hs(n.failure_hints),arguments:pm(n.arguments),flags:[],tier:n.tier??"standard",family:n.family??"extensions",...n.read_output===void 0?{}:{read_output_declared:!0},source:{layer:n.layer,name:n.name,package:n.source_package,version:n.source_version}})}return t}function fm(e){let t=new Map;for(let n of e){let o=w(n.target_command);if(o.length===0)continue;let i=t.get(o)??[];i.push(...n.flags),t.set(o,i)}return t}function gm(e,t,n){let o=new Set;for(let i of e){let r=w(i);r.length>0&&o.add(r)}for(let i of t.keys())o.add(i);for(let i of n.keys())o.add(i);return o}function hm(e,t,n){let o=n.get(e);return o?t.get(o):void 0}function bs(e,t,n,o=new Map){let i=um(t),r=fm(n),a=gm(e,i,r),s=new Map,c=[...a].sort((l,d)=>l.localeCompare(d));for(let l of c){let d=hm(l,i,o)??i.get(l),m=r.get(l)??(d?r.get(d.command):void 0)??[];if(d){s.set(l,{...d,command:l,flags:m});continue}s.set(l,{command:l,action:ws(l,void 0),examples:[],failure_hints:[],arguments:[],flags:m,tier:"standard",family:"extensions"})}return s}function ym(e){let t=e.variadic?"...":"";return e.required?`<${e.name}${t}>`:`[${e.name}${t}]`}function Cs(e,t){for(let n of t.arguments)e.argument(ym(n),n.description??"Extension argument.")}function _m(e){if(Ht(e.visible)===!1)return null;let t=We(e.long),n=Gt(e.short),o=n&&n.startsWith("-")&&!n.startsWith("--")?n:null,i=t&&t.startsWith("--")&&t.length>2?t:null,r=[o,i].filter(a=>a!==null);return r.length>0?r:null}function ko(e){let t=_m(e);if(!t)return null;let{value_name:n,value_arity:o}=_t(e),i=n?o==="optional"?` [${n}]`:` <${n}>`:"";return`${t.join(", ")}${i}`}function vm(e){return ko(e)}function Eo(e){let t=Gt(e.description)??"Extension-provided option.",n=[];Ht(e.required)===!0&&n.push("required"),Ht(e.enabled)===!1&&n.push("disabled");let o=n.length>0?` [${n.join(", ")}]`:"",i=e.default!==void 0?` (default: ${JSON.stringify(e.default)})`:"";return`${t}${o}${i}`}function xs(e,t){let n=We(t.long),o=Gt(t.short);return e.options.some(i=>{let r=i;return n!==null&&r.long===n||o!==null&&r.short===o})}function So(e,t){for(let n of t){if(xs(e,n))continue;let o=vm(n);if(!o)continue;let i=Eo(n),r=new cm(o,i);if(r.negate=!1,n.list!==!0){e.addOption(r);continue}e.addOption(r.argParser((a,s=[])=>[...Array.isArray(s)?s:[s],a]))}}function Ao(e,t){return _s(t.filter(n=>!xs(e,n)))}function wm(e){let t=ko(e);if(!t)return null;let n=We(e.long),o=Gt(e.short),i=n&&n.startsWith("--")&&n.length>2?n:null,r=o&&o.startsWith("-")&&!o.startsWith("--")?o:null,a=_t(e),s=Ht(e.required)===!0;return{flags:t,long:i,short:r,description:Eo(e),takes_value:a.value_arity!=="none",value_required:a.value_arity==="required",value_name:a.value_name,variadic:!1,required:s,aliases:[],alias_for:null,...e.default!==void 0?{default_value:e.default}:{},owner:"extension",...bm(Pt(e))}}function bm(e){return e===null?{}:{sdk_option:e}}function Ro(e){return Te(e.command,Rt({readOutput:e.read_output_declared===!0})).map(t=>({flags:t.takes_value?`${t.flag} <${t.value_name}>`:t.flag,long:t.flag,short:null,description:t.description,takes_value:t.takes_value,value_required:t.value_required,value_name:t.takes_value?t.value_name:null,variadic:!1,required:!1,aliases:[...t.aliases??[]],alias_for:null,owner:"host"}))}function To(e){return["","Inherited host flags (delivered through context.global):",` ${Ro(e).map(t=>t.flags).join(", ")}`,` Run pm contracts --command ${e.command} --flags-only --json for each flag's owner and sdk_option key.`].join(`
|
|
29
|
+
`)}`}function vs(e){let t=new Map;for(let i of e){let r=w(i.target_command);if(r.length===0)continue;let a=t.get(r)??[];a.push(...i.flags),t.set(r,a)}let n=[...t.entries()].sort(([i],[r])=>i.localeCompare(r)),o=new Map;for(let[i,r]of n){let a=_s(r);a&&o.set(i,a)}return o}function ws(e,t){return typeof t!="string"||t.trim().length===0?e.replace(/\s+/g,"-"):t.trim().toLowerCase()}function hs(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let o of e){if(typeof o!="string")continue;let i=o.trim();i.length===0||n.has(i)||(n.add(i),t.push(i))}return t}function pm(e){return Array.isArray(e)?e.map(t=>{let n=typeof t.name=="string"?t.name.trim():"";if(n.length===0)return null;let o={name:n,required:t.required===!0,variadic:t.variadic===!0};return typeof t.description=="string"&&t.description.trim().length>0&&(o.description=t.description.trim()),o}).filter(t=>t!==null):[]}function um(e){let t=new Map;for(let n of e){let o=w(n.command);if(o.length===0)continue;let i=typeof n.description=="string"&&n.description.trim().length>0?n.description.trim():void 0,r=typeof n.intent=="string"&&n.intent.trim().length>0?n.intent.trim():void 0;t.set(o,{command:o,action:ws(o,n.action),description:i,intent:r,examples:hs(n.examples),failure_hints:hs(n.failure_hints),arguments:pm(n.arguments),flags:[],tier:n.tier??"standard",family:n.family??"extensions",...n.read_output===void 0?{}:{read_output_declared:!0},source:{layer:n.layer,name:n.name,package:n.source_package,version:n.source_version}})}return t}function fm(e){let t=new Map;for(let n of e){let o=w(n.target_command);if(o.length===0)continue;let i=t.get(o)??[];i.push(...n.flags),t.set(o,i)}return t}function gm(e,t,n){let o=new Set;for(let i of e){let r=w(i);r.length>0&&o.add(r)}for(let i of t.keys())o.add(i);for(let i of n.keys())o.add(i);return o}function hm(e,t,n){let o=n.get(e);return o?t.get(o):void 0}function bs(e,t,n,o=new Map){let i=um(t),r=fm(n),a=gm(e,i,r),s=new Map,c=[...a].sort((l,d)=>l.localeCompare(d));for(let l of c){let d=hm(l,i,o)??i.get(l),m=r.get(l)??(d?r.get(d.command):void 0)??[];if(d){s.set(l,{...d,command:l,flags:m});continue}s.set(l,{command:l,action:ws(l,void 0),examples:[],failure_hints:[],arguments:[],flags:m,tier:"standard",family:"extensions"})}return s}function ym(e){let t=e.variadic?"...":"";return e.required?`<${e.name}${t}>`:`[${e.name}${t}]`}function Cs(e,t){for(let n of t.arguments)e.argument(ym(n),n.description??"Extension argument.")}function _m(e){if(Ht(e.visible)===!1)return null;let t=We(e.long),n=Gt(e.short),o=n&&n.startsWith("-")&&!n.startsWith("--")?n:null,i=t&&t.startsWith("--")&&t.length>2?t:null,r=[o,i].filter(a=>a!==null);return r.length>0?r:null}function ko(e){let t=_m(e);if(!t)return null;let{value_name:n,value_arity:o}=_t(e),i=n?o==="optional"?` [${n}]`:` <${n}>`:"";return`${t.join(", ")}${i}`}function vm(e){return ko(e)}function Eo(e){let t=Gt(e.description)??"Extension-provided option.",n=[];Ht(e.required)===!0&&n.push("required"),Ht(e.enabled)===!1&&n.push("disabled");let o=n.length>0?` [${n.join(", ")}]`:"",i=e.default!==void 0?` (default: ${JSON.stringify(e.default)})`:"";return`${t}${o}${i}`}function xs(e,t){let n=We(t.long),o=Gt(t.short);return e.options.some(i=>{let r=i;return n!==null&&r.long===n||o!==null&&r.short===o})}function So(e,t){for(let n of t){if(xs(e,n))continue;let o=vm(n);if(!o)continue;let i=Eo(n),r=new cm(o,i);if(r.negate=!1,n.list!==!0){e.addOption(r);continue}e.addOption(r.argParser((a,s=[])=>[...Array.isArray(s)?s:[s],a??!0]))}}function Ao(e,t){return _s(t.filter(n=>!xs(e,n)))}function wm(e){let t=ko(e);if(!t)return null;let n=We(e.long),o=Gt(e.short),i=n&&n.startsWith("--")&&n.length>2?n:null,r=o&&o.startsWith("-")&&!o.startsWith("--")?o:null,a=_t(e),s=Ht(e.required)===!0;return{flags:t,long:i,short:r,description:Eo(e),takes_value:a.value_arity!=="none",value_required:a.value_arity==="required",value_name:a.value_name,variadic:!1,required:s,aliases:[],alias_for:null,...e.default!==void 0?{default_value:e.default}:{},owner:"extension",...bm(Pt(e))}}function bm(e){return e===null?{}:{sdk_option:e}}function Ro(e){return Te(e.command,Rt({readOutput:e.read_output_declared===!0})).map(t=>({flags:t.takes_value?`${t.flag} <${t.value_name}>`:t.flag,long:t.flag,short:null,description:t.description,takes_value:t.takes_value,value_required:t.value_required,value_name:t.takes_value?t.value_name:null,variadic:!1,required:!1,aliases:[...t.aliases??[]],alias_for:null,owner:"host"}))}function To(e){return["","Inherited host flags (delivered through context.global):",` ${Ro(e).map(t=>t.flags).join(", ")}`,` Run pm contracts --command ${e.command} --flags-only --json for each flag's owner and sdk_option key.`].join(`
|
|
30
30
|
`)}function ks(e){if(!e)return[];let t=[],n=new Set;for(let o of e.flags){let i=wm(o);!i||n.has(i.flags)||(n.add(i.flags),t.push(i))}return t}function Es(e,t){if(t.length===0)return e;let n=new Map(e.map(o=>[o.flags,o]));for(let o of t){let i=n.get(o.flags);n.set(o.flags,i?{...i,...o.default_value!==void 0?{default_value:o.default_value}:{},...o.owner===void 0?{}:{owner:o.owner},...o.sdk_option===void 0?{}:{sdk_option:o.sdk_option}}:o)}return[...n.values()]}function Ss(e){let t=[];if(e.intent&&t.push(`Intent: ${e.intent}`),e.action&&t.push(`Action contract: ${e.action}`),e.examples.length>0){t.push("Examples:");for(let n of e.examples)t.push(` - ${n}`)}if(e.failure_hints.length>0){t.push("Common failure hints:");for(let n of e.failure_hints)t.push(` - ${n}`)}return t.length===0?null:`
|
|
31
31
|
Extension command metadata:
|
|
32
32
|
${t.join(`
|
|
@@ -36,9 +36,9 @@ Extension command metadata:
|
|
|
36
36
|
`)}return process.exitCode=h.SUCCESS,!0}function jm(e,t){let n=["","Type-aware option policies:"," pass --type <value> with --help to render required/disabled/hidden option policy details for that type.",` active type values: ${t.types.join("|")}`];return e==="create"&&n.push(" scheduling shortcut: use --schedule-preset lightweight for Reminder/Meeting/Event minimal create flows."),n.join(`
|
|
37
37
|
`)}function Um(e,t){if(t.options.length===0){e.push(" type options: none");return}e.push(" type options:");for(let n of t.options){let o=n.required?" (required)":"",i=n.aliases??[];e.push(` - ${n.key}${o}`),e.push(` values: ${n.values.length>0?n.values.join("|"):"any non-empty string"}`),e.push(` aliases: ${i.length>0?i.join("|"):"none"}`),n.description&&n.description.trim().length>0&&e.push(` description: ${n.description.trim()}`)}}function qm(e,t){let n=e==="create"?new Set(["title","type"]):new Set,o=new Set(n);if(e==="create")for(let i of[...t.required_create_fields,...t.required_create_repeatables])o.add(i);return{progressive:n,strict:o}}function Hm(e,t,n,o){let i=new Set(n),r=o.filter(c=>!i.has(c)),a=c=>c.length>0?c.map(l=>dn("create",l)).join(", "):"none";e.push(` required in strict mode: ${a(r)}`);let s=r.map(ca).filter(c=>c!==void 0);e.push(` explicit empty assertion: ${s.length>0?s.join(", "):"none"}`),["Reminder","Meeting","Event"].includes(t.name)&&(e.push(" schedule preset: --schedule-preset lightweight switches schedule artifacts to progressive required-option policy."),e.push(" strict parity remains available via --create-mode strict."))}function Gm(e,t,n){let o=zr(n);if(!o)return jm(e,t);let i=Ai(o,t);if(!i){let g=t.types.join("|");return["",`Type-aware option policies: type "${o}" is not in the active registry.`,` active type values: ${g}`].join(`
|
|
38
38
|
`)}let r=n.indexOf("--"),a=r<0?n:n.slice(0,r),s=a.findIndex(g=>g==="--create-mode"||g.startsWith("--create-mode=")),c=s<0?void 0:a[s]?.startsWith("--create-mode=")?a[s]?.slice(14):a[s+1],l=e==="create"&&c?.toLowerCase()==="strict",d=qm(e,i),m=yt(i,e,d.progressive),p=yt(i,e,l?d.strict:d.progressive),u=g=>g.length>0?g.map(y=>dn(e,y)).join(", "):"none",f=["",`Type-aware option policies for ${i.name}:`,` required: ${u(p.required)}`,` disabled: ${u(p.disabled)}`,` hidden: ${u(p.hidden)}`];if(e==="create"){let g=yt(i,e,d.strict);Hm(f,i,m.required,g.required)}return Um(f,i),p.errors.length>0&&f.push(` config errors: ${p.errors.join("; ")}`),f.join(`
|
|
39
|
-
`)}function Ms(e,t,n){let o=k(n);if(o!=="create"&&o!=="update")return;let i=rt(e,o);i&&i.addHelpText("after",Gm(o,t,n))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="665c29cd-2a3b-5cfc-9690-6d82541fc5d9")}catch{}})();function zm(e,t){return Be(e.id)||`migration-${String(t+1).padStart(3,"0")}`}function Wm(e){return Be(e.status)?.toLowerCase()??"pending"}function Bm(e){return e.mandatory===!0}function Vm(e,t){let n=e.layer.localeCompare(t.layer);if(n!==0)return n;let o=e.name.localeCompare(t.name);return o!==0?o:e.id.localeCompare(t.id)}function js(e){let t=[];return e.forEach((n,o)=>{if(!Bm(n.definition))return;let i=Wm(n.definition);i!=="applied"&&t.push({layer:n.layer,name:n.name,id:zm(n.definition,o),status:i})}),t.sort(Vm),t}function Ls(e){return Array.isArray(e)&&e.length>0}var Km=new Set(["create","beads import","todos import"]),Jm=new Set(["restore","update","close","delete","append","claim","release"]),Ym=new Set(["comments","notes","learnings"]),Xm=new Set(["files","docs","test"]),Zm=new Set(["activate","add","add-field","add-status","add-type","apply","compact","create","deactivate","delete","disable","edit","enable","import","infer","install","materialize","migrate","redact","remove","remove-field","remove-status","remove-type","remap-status","rename-field","rename-type","repair","run","save","set","unset","update","upgrade"]);function Po(e,t){let n=t.force===!0;return Km.has(e)?{isMutation:!0,forceCapable:!1,forceRequested:!1}:Jm.has(e)?{isMutation:!0,forceCapable:!0,forceRequested:n}:Ym.has(e)?{isMutation:typeof t.add=="string",forceCapable:!0,forceRequested:n}:Xm.has(e)?{isMutation:Ls(t.add)||Ls(t.remove),forceCapable:!0,forceRequested:n}:{isMutation:!1,forceCapable:!1,forceRequested:!1}}function Qm(e,t,n){if(Po(e,n).isMutation)return!0;let o=e.trim().toLowerCase();return Or(o)?["close-many","close-task","copy","delete","discover","focus","pause-task","start-task","update-many"].includes(o)?!0:t.some(i=>Zm.has(i.trim().toLowerCase())):!1}function Fs(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function ep(e,t,n){let o=t[0]?.trim().toLowerCase()??"";if(e.trim().toLowerCase()!=="schema"||!["rename-type","rename-field","remap-status"].includes(o))return;let i=[];if(Be(t[1])||i.push("source"),Be(n.to)||i.push("--to"),i.length!==0)throw new R(`Schema migration requires ${i.join(", ")}.`,h.USAGE,{code:"schema_migration_input_required",required:i.join(","),why:"Schema migrations require a source and target. A workspace-bound stable migration id is derived automatically when --migration-id is omitted.",recovery:{recovery_mode:"compact",missing_required_fields:i,suggested_flags:i.filter(r=>r.startsWith("--")),suggested_retry:`pm schema ${o} <source> --to <target>`}})}async function tp(e,t,n,o,i){if(e.trim().toLowerCase()!=="update"||typeof n.status!="string"||Fs(n.status)!==Fs(i.schema.workflow.in_progress_status))return;let r=t[0];if(!r)return;let a=le(i,ce()),s=await kt(o,r,i.id_prefix,i.item_format,a.type_to_folder);if(!s)return;let c=await yr(s,{schema:i.schema}),l=typeof n.assignee=="string"?n.assignee.trim():void 0;(l===void 0?c.document.metadata.assignee?.trim():!["","none","null","undefined"].includes(l.toLowerCase())&&l)||b(`warning:in_progress_item_unclaimed:${s.id}:claim_with=pm claim ${s.id}`)}async function $o(e,t,n,o,i){if(!Qm(e,t,n)||(ep(e,t,n),!await Y(X(i))))return;let r=await Ae(i);ba(o.json===!0)||await tp(e,t,n,i,r.settings);let a=Tr({author:Ct(o.author,r.settings.author_default),payload:{command:e,args:t,options:n},settings:r.settings.mutation_guard,force:o.force===!0||n.force===!0});for(let s of a.warnings)ue(s)}function Us(e,t,n){if(n.length===0)return;let o=Po(e,t);if(!o.isMutation||o.forceCapable&&o.forceRequested)return;let i=n.map(a=>`extension_migration_blocking:${a.layer}:${a.name}:${a.id}:${a.status}`),r=o.forceCapable?"Re-run this command with --force to bypass.":"This command path does not support --force bypass.";throw new R(`Write command "${e}" blocked by unresolved mandatory extension migrations (${i.join(",")}). ${r}`,h.CONFLICT)}async function Do(e,t,n,o){if(!Po(e,t).isMutation||!o.enforce_item_format_gate&&!o.run_preflight_item_format_sync||!await Y(X(n)))return;let{settings:i,metadata:r,warnings:a}=await Ae(n);for(let s of a)ue(s);if(!mr(i)&&(o.enforce_item_format_gate&&!r.has_explicit_item_format&&(dr(i),await pr(n,i,"item_format:auto_select_default")),o.run_preflight_item_format_sync)){let s=le(i,ce());await Ir(n,i.item_format,"item_format:pre_mutation_sync",s.type_to_folder,i.schema)}}(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]="c0826cb1-5181-51b3-9ad9-0cd7a3d2c4b3")}catch{}})();function No(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=w(n);o.length!==0&&t.push(o)}return t}function Le(e){let t=w(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(i=>i.length>0);for(let i of No(e.commandArgs))o.push(...i.split(" ").filter(r=>r.length>0)),n.push(o.join(" "));return[...new Set(n.flatMap(i=>[i,q(i)]))]}function Mo(e,t){let n=w(e);if(n.length===0)return!1;let o=Le(t);for(let i of o)if(i===n||i.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(i=>n.startsWith(`${i} `)):!1}function Bt(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...N(n.commands),...N(n.command_handlers),...N(n.command_overrides),...N(n.flag_commands),...N(n.parser_overrides),...qs(n.preflight_ownership),...qs(n.renderer_ownership)]:[]}function N(e){return e??[]}function qs(e){return N(e).flatMap(t=>t.commands)}function st(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var Hs=new Set(["hooks","parser","preflight","renderers"]),Gs=new Set(["commands","schema","services","importers"]),np=new Set(["reindex","search","search-advanced"]),op=new Set(["--template"]);function Me(e,t){for(let n of t)if(e.has(n))return!0;return!1}function Lo(e){let t=w(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return np.has(n??t)}function Fo(e,t){for(let n of e.commandArgs??[]){if(!n.startsWith("--"))continue;let[o]=n.split("=",1);if(t.has(o))return!0}return!1}function Vt(e){return w(e.commandPath??"")==="create"&&Fo(e,op)}function jo(e){return e.some(t=>{let n=w(t);return n==="templates"||n.startsWith("templates ")})}function Wt(e,t){return e.some(n=>Mo(n,t))||Vt(t)&&jo(e)}function Uo(e){return[N(e.hooks).length,(e.preflight_overrides??0)-N(e.preflight_ownership).length,N(e.item_types).length,N(e.item_fields).length,N(e.relationship_kinds).length,N(e.service_overrides).length,N(e.assurance_providers).length,N(e.renderer_overrides).length-N(e.renderer_ownership).length].some(t=>t>0)}function qo(e,t){let n=e.activation?.commands??[];if(n.length>0)return Wt(n,t);let o=Bt(e);if(Wt(o,t)||st(e).has("search")&&Lo(t.commandPath))return!0;if(e.contributions)return Uo(e.contributions)}function Kt(e,t){let n=qo(e,t);if(n!==void 0)return n;let o=st(e);return!!(Me(o,Hs)||Me(o,Gs))}function lt(e,t){return e.effective.length===0?!1:ct(t)!=="all"?e.effective.some(n=>Kt(n,t)):e.effective.some(n=>{let o=st(n);return Bt(n).length>0||Me(o,Hs)||Me(o,Gs)||o.has("search")})}function ct(e){if(w(e.commandPath??"").split(" ")[0]==="completion")return"all";let t=Le(e).filter(o=>o.split(" ").every(i=>!i.startsWith("-"))).sort((o,i)=>i.length-o.length)[0]??w(e.commandPath??"");if(t.length===0)return"all";let n=Vt(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function Ho(e){return ct(e)==="all"?void 0:t=>Kt(t,e)}function Fe(e){let t=O(e);if(t.requested&&t.commandPathTokens.length>0){let[i,...r]=t.commandPathTokens;return{commandPath:i,commandArgs:r,allowCommandPrefixMatch:!0}}let n=F(e),o=n.findIndex(i=>i.trim().length>0&&!i.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function Go(e){let t=e.args.map(String);if(w(E(e))==="create"){let n=e.optsWithGlobals();typeof n.template=="string"&&n.template.trim().length>0&&t.push("--template")}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8065373f-1652-563e-9b43-f21c104f0f61")}catch{}})();var Jt=Symbol.for("pm.readOutputInvocationProvenance"),ip=new Map(pe.filter(e=>e.reservation_scope==="root_only").map(e=>[Pt({long:e.flag}),e.flag]));function se(e,t){let n=Reflect.get(e,Jt);n!==void 0&&Reflect.set(t,Jt,n)}function zo(e,t,n){let o=tr(t,n);if(!o)return;let i=e;for(;i.parent;)i=i.parent;let r=i.rawArgs,a=new Set(ee(r.slice(2))),s=er.find(d=>d.command===o),c=Object.values(s?.dimensions??{}).flatMap(d=>d.legacy_aliases.flatMap(m=>a.has(m.flag)?[m.flag]:[])),l=Reflect.get(n,Jt);Reflect.set(n,Jt,{canonical_include_modes:l?.canonical_include_modes??[],explicit_legacy_aliases:c,cli_invocation_observed:!0}),se(n,e)}function rp(e){let t=e.optsWithGlobals(),n=E(e);if(q(n)===n)return t;let o=e.opts();for(let i=e.parent;i?.parent;i=i.parent)for(let r of i.options){let a=r.attributeName(),s=i.getOptionValueSource(a)==="cli";if(s&&!e.options.some(c=>c.long===r.long))throw new R(`Unknown option '${r.long}' for ${n}`,h.USAGE,{code:"unknown_option",flag:r.long,required:`Use options declared by pm ${n} --help.`});if(s&&e.getOptionValueSource(a)!=="cli"){let c=i.getOptionValue(a);e.setOptionValueWithSource(a,c,"cli")}a in o?t[a]=o[a]:delete t[a]}return t}function Wo(e,t,n,o){zo(e,t,o);let i=n.outputInclude;if(i===void 0)return;let{selectors:r,modes:a}=ar(t,i,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),a.length===0)return;se(o,e);let s=rr(t);for(let l of a){let d=s.get(l),m=o[d];e.setOptionValueWithSource(d,m,"cli")}let c=r.length>0?r.join(","):void 0;c===void 0?delete n.outputInclude:n.outputInclude=c;for(let l=e;l;l=l.parent)l.setOptionValueWithSource("outputInclude",c,"cli");It(e,n)}function je(e,t,n=[],o){let i={...rp(e)};se(e,i),delete i.json,delete i.quiet,delete i.path,delete i.pmPath,delete i.noExtensions,delete i.extensions,delete i.profile,delete i.pager,delete i.changedFields,delete i.fullChangedFields,delete i.idOnly,delete i.lean,delete i.tokenAccounting,delete i.outputInclude,delete i.outputLimit,delete i.outputBudget,delete i.outputFormat,delete i.outputSession,delete i.expectHash;let r=ta(t);for(let[a,s]of Object.entries(r))i[a]===void 0&&(i[a]=s);if(n.length>0){let a=Un(n),s=H(E(e)).map(d=>({long:d.flag,short:d.short,aliases:d.aliases})),c={...r};for(let d of a)i[d]!==void 0&&(c[d]=i[d]);qn(c,[...s,...n],E(e),o);let l=ea(i,n,r,E(e));return se(i,l),l}return i}function Bs(e,t,n){let o=Un(t.map(({long:a})=>({long:a}))),i=[...ip].find(([a])=>e[a]!==void 0&&!o.has(a));if(i===void 0)return;let r=i[1];throw new R(`Unknown option '${r}' for extension command '${n}'. ${r} is a root-only pm flag and this command does not declare it.`,h.USAGE,{code:"unknown_option",flag:r,required:`Remove ${r}, or use it on the root command (pm --help ${r}).`,nextSteps:[`Run pm contracts --command ${n} --flags-only --json to list the flags this command accepts.`]})}function dt(e,t,n){let o=Qe(e,t),i=[t],r=[];for(let a of n){if(a.startsWith("-"))break;i.push(a);let s=Qe(e,i.join(" "));s.length>0&&(r=s)}return r.length>0?r:o}function Yt(e){return e.arguments??[]}function zs(e){let t=Yt(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function Bo(e,t){if(!e)return!1;let n=w(t);return e.importers.some(o=>w(`${o.importer} import`)===n)||e.exporters.some(o=>w(`${o.exporter} export`)===n)}var Vs=Symbol("pm.commandOptionTokens"),Ws=Symbol("pm.capturesOptionTokens");function Ks(e){if(Reflect.get(e,Ws)===!0)return;Reflect.set(e,Ws,!0);let t=e.parseOptions.bind(e);e.parseOptions=n=>(Reflect.set(e,Vs,[...n]),t(n))}function ap(e){let t=new Map;for(let n of e.options){let o={arity:n.required?"required":n.optional?"optional":"none",key:n.attributeName(),variadic:n.variadic};for(let i of[n.short,n.long])i&&t.set(i,o)}return t}function sp(e){let t=Reflect.get(e,"_passThroughOptions")===!0;return!t&&Reflect.get(e,"_enablePositionalOptions")!==!0?{}:{stop:{atSubcommand:n=>e.commands.some(o=>o.name()===n||o.aliases().includes(n)),atFirstUnrecognized:t}}}function Js(e,t,n){if(t.length===0)return;let o=[];for(let r=e;r?.parent;r=r.parent)o.unshift(r);let i=[];for(let r of o){let a=Reflect.get(r,Vs);if(a===void 0)continue;let s=ap(r),c=[];for(let l=r;l;l=l.parent)c.push(l);i.push({tokens:a,optionOf:l=>s.get(l),includesLooseFlags:r===e,negativeNumbersAreValues:!c.some(l=>l.options.some(d=>d.short!==void 0&&/^-\d$/u.test(d.short))),...sp(r)})}oa(i,t,n)}function Vo(e,t){let n=Yt(e),o=n.filter(s=>s.required).length,i=n.some(s=>s.variadic)?Number.POSITIVE_INFINITY:n.length,r=e.failure_hints??[],a=r.length>0?` ${r.join(" ")}`:"";if(t.length<o)throw new R(`Missing required argument for extension command '${e.command}'. Usage: ${zs(e)}${a}`,h.USAGE);if(t.length>i){let s=t.slice(i).join(" ");throw new R(`Too many arguments for extension command '${e.command}': ${s}. Usage: ${zs(e)}${a}`,h.USAGE)}}function lp(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function Xt(e,t){return{definitions:e,inheritedFlags:Rt({readOutput:t}).map(n=>n.flag)}}function cp(e,t,n){let o=Object.keys(e).filter(r=>e[r]!==void 0).sort().map(lp);if(o.length===0)return;let{inheritedFlags:i}=Xt([],n);throw new R(`Unknown option '${o.join(", ")}' for extension command '${t}'. This command declares no flags; it accepts only the host flags ${i.join(", ")}.`,h.USAGE,{code:"unknown_option",flag:o[0],required:`Remove ${o.join(", ")}, or ask the package to declare it with api.registerFlags.`,nextSteps:[`Run pm contracts --command ${t} --flags-only --json to list the flags this command accepts.`]})}function dp(e,t,n){let o=e.read_output_declared===!0;if(n.length>0){qn(t,n,e.command,Xt(n,o));return}cp(t,e.command,o)}function Ko(e,t,n,o){e&&(Vo(e,t),dp(e,n,o))}import{Command as Ys}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0503f6e5-36d9-5afb-a17f-feef2241f984")}catch{}})();var mp=new Set(["--version","-V"]);function mt(e){let t=F(e);return["package","packages","extension"].includes(t[0]??"")&&t[1]==="inventory"}function Xs(e){if(F(e)[0]!=="item"||!e.includes("--dry-run"))return;let t=new Ys().configureOutput({writeErr:()=>{}}).exitOverride(),n=new Set;for(let i of pe)for(let r of[i.flag,i.short,...i.aliases??[]]){if(r===void 0||n.has(r))continue;n.add(r);let a=i.value_name!==void 0||i.flag==="--pm-path";t.option(`${r}${a?" <value>":""}`)}try{t.parseOptions(e)}catch{}let o=t.opts();return{path:o.pmPath??o.path}}var pp=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),Jo=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]),Zs=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]),up=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),fp=new Set(["claim","close-task","pause-task","release","start-task","test"]),be={setup:!0,listQuery:!0,mutation:!0,operation:!0},gp=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function pt(e){return e.some(t=>mp.has(t))}function hp(e,t){if(!M.some(o=>o.canonical_argv[0]===t))return;let n=new Ys().configureOutput({writeErr:()=>{}}).exitOverride();for(let o of Te(t,H(t))){let i=o.takes_value?o.value_required?" <value>":" [value]":"";for(let r of[o.flag,o.short,...o.aliases??[]])r!==void 0&&n.option(`${r}${i}`)}try{let o=n.parseOptions(e.slice(1));if(o.unknown.length>0)return be;let i=B([t,...o.operands])?.alias;if(M.some(r=>r.alias===i))return{...be,targetCommandName:i}}catch{return be}}function Yo(e){if(pt(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||O(e).requested)return be;let t=k(e);if(!t)return be;let n=t.trim().toLowerCase(),o=F(e),i=B(o)?.alias;return M.some(r=>r.alias===i)?{...be,targetCommandName:i}:hp(o,n==="ctx"?"context":n)||(pp.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:Jo.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:Zs.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:up.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:be)}function Xo(e){return e.length===0||O(e).requested||e.includes("--explain")&&k(e)===void 0}function Zo(e,t){return mt(t)||pt(t)?!1:re(t)||O(t).requested?!0:!!k(t)}function Qo(e){if(pt(e))return!1;let t=k(e);return t?gp.has(t):!1}function yp(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,i=e.normalizedTokens.map(l=>{let d=l.indexOf("=");return d>=0?l.slice(0,d):l}).find(l=>l==="--literal"||l==="--regex"||l==="--replacement"),r=i?e.argv.map(l=>{let d=l.indexOf("=");return(d>=0?l.slice(0,d):l)===o?d>=0?`${i}${l.slice(d)}`:i:l}):e.argv,a=ze(r),s=i&&n>=0?`${o}=[redacted]`:t,c=i&&e.normalizedDisplay.includes("=")?`${i}=[redacted]`:e.normalizedDisplay;return{argv:a,normalizedDisplay:c,sourceDisplay:s}}function ei(e){let t=e.commandName;if(!t)return;let n=e.trace.find(l=>l.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(l=>l.length>0),i=o.length>0?o.join(" "):"the canonical flag",r=Zs.has(t)||fp.has(t),a=r?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=r?"mutating option":"option",c=yp({argv:e.argv,normalizedDisplay:i,normalizedTokens:o,rawFrom:n.from});throw new R(`Refusing to auto-correct ${s} ${c.sourceDisplay} to ${c.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,h.USAGE,{code:a,examples:[_(c.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:c.argv,suggested_retry:_(c.argv)}})}(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]="6d83c356-db56-5116-9fe7-e0c27973b36f")}catch{}})();var _p=new Set(["success","nonexistent_command","invalid_option","missing_required_option","missing_required_argument","invalid_usage","validation_failed","health_findings","validation_findings","conflict","runtime_failed","unknown_failed"]),vp=new Set(["parse","preflight","execute","unknown"]),wp=new Set(["usage","validation","conflict","runtime","unknown"]);function Ce(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let i=o.trim();if(i.length>0)return i}}}function ti(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Zt(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="number"&&Number.isFinite(o))return Math.max(0,Math.trunc(o))}}function ni(e){if(!e)return;let t=e.trim().toLowerCase();if(_p.has(t))return t}function oi(e){if(!e)return;let t=e.trim().toLowerCase();if(vp.has(t))return t}function ii(e){if(!e)return;let t=e.trim().toLowerCase();if(wp.has(t))return t}function ri(e){let t=Ce(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let r=n.find(a=>typeof a=="string"&&a.trim().length>0);if(typeof r=="string")return r.trim()}if(ti(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let o=Zt(e,"failed");if(typeof o=="number"&&o>0)return`failed_runs:${o}`;let i=e?.run_results;if(Array.isArray(i)){let r=i.filter(a=>un(a)?.status==="failed").length;if(r>0)return`failed_runs:${r}`}}function ai(e,t){if(!e)return t===h.USAGE?"invalid_command_usage":t===h.NOT_FOUND?"item_not_found":t===h.CONFLICT?"lock_conflict":t===h.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function si(){let e=un(de()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Zt(e,"exit_code","exitCode"),o=t??n??h.SUCCESS,i=sa(o),r=Ce(e,"error_code","errorCode")??ai(i,o),a=ii(Ce(e,"error_category","errorCategory"))??(i?void 0:ht(r)),s=i?void 0:ri(e)??`command_exit_${o}`,c=ni(Ce(e,"command_resolution","commandResolution"))??Et({ok:i,errorCode:r,errorCategory:a}),l=oi(Ce(e,"resolution_stage","resolutionStage"))??"execute";return{ok:i,error:s,exit_code:o,error_code:r,error_category:a,command_resolution:c,resolution_stage:l}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="df513d3f-9fef-51e0-b2cb-e43cf27db6ec")}catch{}})();var li="PM_CLI_PACKAGE_ROOT",ll=Symbol("pm.deprecatedAliasInvocation"),tn=new Map;for(let e of J){let t=e.alias.split(" ")[0],n=tn.get(t)??[];n.push(e),tn.set(t,n)}for(let e of tn.values())e.sort((t,n)=>n.alias.split(" ").length-t.alias.split(" ").length);function bp(){return Di(import.meta.url,["../.."])}(typeof process.env[li]!="string"||process.env[li]?.trim().length===0)&&(process.env[li]=bp());var ke=null,U=null,nn=null;function Cp(e){ke=e}function xp(e){A=e}var ut=null,xe=null,A=new Map,gi=250,kp=new Set([h.USAGE,h.NOT_FOUND,h.CONFLICT]),Ep=new Set(["1","true","yes","on"]),Sp=Je(()=>import("./chunks/register-setup-XGPOFFD3.js")),Ap=Je(()=>import("./chunks/register-list-query-MCNOV6ML.js")),Rp=Je(()=>import("./chunks/register-mutation-KYXLYHOK.js")),Tp=Je(()=>import("./chunks/register-operations-6RQF6IAE.js"));function en(e){return _(e)}function cl(e){let t=e.match(/--[a-zA-Z0-9][a-zA-Z0-9_-]*/g);if(!t||t.length===0)return;let n=[...new Set(t.map(o=>fe(o)??o))];return n.length>0?n:void 0}function Op(e,t,n,o){if(n?.suggested_retry||o===to||o===eo||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let i=ee(t),r=new Set(i.map(m=>fe(m)??m)),a=cl(e),s=t.find(m=>v.commands.some(p=>p.name()===m)),c=s?v.commands.find(m=>m.name()===s):void 0,l=new Set([...v.options,...c?.options??[]].flatMap(m=>m.flags.split(/[ ,|]+/).map(p=>fe(p)).filter(p=>p!==void 0))),d=a?.filter(m=>{let p=fe(m)??m;return r.has(p)?!1:l.has(p)||xo(t,s,p,A)!==void 0});return d&&d.length>0?d:void 0}function Ip(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let i=n?.[0],r=i?fe(i):void 0,a=e.find(p=>v.commands.some(u=>u.name()===p)),s=a?v.commands.find(p=>p.name()===a):void 0,c=r?s?.options.find(p=>p.flags.split(/[ ,|]+/).includes(r)):void 0,l=xo(e,a,r,A),d=r?c?.isBoolean()===!0||l===!1?[r]:[r,"<value>"]:[],m=r?en([...e,...d]):t;return m===t?void 0:m}function Pp(e){if(!e)return{};let t=["recovery_mode","missing_required_fields","suggested_flags","suggested_retry_args","allowed_values","candidate_commands","candidate_commands_total","candidate_commands_truncated","fallback_candidates","next_best_command"],n={};for(let o of t){let i=e[o];i!==void 0&&(o==="allowed_values"||i!==null)&&(n[o]=i)}return n}function $p(e){let t=e.existingRecovery;return{attempted_command:t?.attempted_command??e.attemptedCommand,normalized_args:t?.normalized_args??[...e.invocationArgv],provided_fields:t?.provided_fields??(e.providedFields.length>0?e.providedFields:void 0),missing:t?.missing??e.inferredMissing,...Pp(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function Qs(e,t){return{...e,recovery:t}}function Dp(e,t){if(t===void 0)return;let n=Ia(e,t.code,t.field,Ra(e,t.code,t.recovery)),o=Np(e),i=Pa(e,t.code,t.field,n,o),r=Oa(e,t.code,i,o,()=>Lr(T(process.cwd(),P(e).path)));return $a(e,t.code,r,o)}var el=" ";function Np(e){let t=e.map(i=>i===""?el:/^--(?:pm-)?path=$/u.test(i)?`${i}${el}`:i),n=P(t).path;if(n!==void 0&&n.trim()!=="")return[];let o=Ee({});return n!==void 0&&o.length>0?null:o}function dl(e,t,n){let o=ze(t),i=F(o),r=D(i),[a,s]=r===void 0?[]:i.slice(r,r+2),c=o.includes("--explain");e=e===void 0?void 0:vr(e);let l=Dp(o,e),d=l&&(a==="history-redact"||a==="history"&&s==="redact")?{...l,...l.attempted_command?{attempted_command:en(o)}:{},...l.normalized_args?{normalized_args:[...o]}:{},...l.suggested_retry?{suggested_retry:en(o)}:{},...l.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:l;if(d?.recovery_mode==="compact"&&!c)return Qs(e,d);let m=en(o),p=ee(o),u=Op(n,o,d,e?.code),f=Ip(o,m,u,d),g=$p({invocationArgv:o,attemptedCommand:m,providedFields:p,inferredMissing:u,suggestedRetry:f,existingRecovery:d});return Qs(e,g)}async function ft(e){let t=U;U=null,await Da(t,e);let n=ke;if(ke=null,!n){wt();return}let o=[],i=Vi();try{await Na({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?i?.map(r=>r.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await Fi(n.hooks,{command:n.commandName,args:n.commandArgs,options:{...n.commandOptions},global:{...n.globalOptions},pm_root:n.pmRoot,ok:e.ok,error:e.error,result:de(),affected:i}))}catch(r){o=[`afterCommand hooks failed: ${r instanceof Error?r.message:String(r)}`]}finally{wt()}!n.globalOptions.json&&o.length>0&&b(`[pm] warning: afterCommand hook_warnings=${z(o)}`),n.profileEnabled&&o.length>0&&b(`profile:extensions hook_warnings=${z(o)}`)}async function ml(e,t){await xr();let n=U,o=ke,i=n?.command??o?.commandName??e,r=n??En(o?.globalOptions??t),a=A.get(w(i))?.source;In(i,o?.commandArgs??[],{...o?.commandOptions,...o?.globalOptions},{source_context:r.source_context,source_context_source:r.source_context_source,pm_version:n?.pm_version??qe,extension:a})}function pl(e){return Ep.has((process.env[e]??"").trim().toLowerCase())}function ul(e){return pl("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!kp.has(Math.trunc(e))}async function on(e,t){return ul(e.exit_code)?(await ml(e.command,t),Rr({...e,source_context:e.source_context??En(t).source_context}),!0):!1}async function fl(e){let t=K(me(e.error)),n=ls(t);e.bootstrapGlobal.json?b(JSON.stringify(et(as(t,h.GENERIC_FAILURE)),null,2)):b(t),process.exitCode=h.GENERIC_FAILURE;let o="runtime",i="runtime_failed";try{await ml(e.attemptedCommand,e.bootstrapGlobal),Pn(e.error);let r=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:h.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=r.errorCategory,i=r.commandResolution,await sn(!1,t,{error_code:n.code,error_category:o,exit_code:h.GENERIC_FAILURE,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||b(`Failed to report error: ${me(r)}`)}try{await ft({ok:!1,error:t,exit_code:h.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||b(`Failed to run error hooks: ${me(r)}`)}try{await Re()}catch(r){e.bootstrapGlobal.json||b(`Failed to flush error reporting: ${me(r)}`)}}var Mp={create:"create",update:"update","update-many":"update_many",list:"list","list-all":"list","list-draft":"list","list-open":"list","list-in-progress":"list","list-blocked":"list","list-closed":"list","list-canceled":"list",search:"search",calendar:"calendar",context:"context","templates save":"create"},ci=new Map;function di(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function gl(e,t){return e.options.some(n=>n.long===t)}function hl(e,t){return e.options.some(n=>n.short===t)}function mi(e,t,n,o){let i=t.trim();if(!i)return;let r=n.length>0?n:`Runtime schema field (${t})`;if(i.startsWith("-")&&!i.startsWith("--")){if(hl(e,i))return;if(o){e.option(`${i} <value>`,`${r} (repeatable)`,jn);return}e.option(`${i} <value>`,r);return}let a=i.startsWith("--")?i:`--${i}`;if(!gl(e,a)){if(o){e.option(`${a} <value>`,`${r} (repeatable)`,jn);return}e.option(`${a} <value>`,r)}}async function yl(e,t){let n=Mp[e];if(!n)return[];let o=`${t}:${n}`,i=ci.get(o);if(i)return i;if(!await Y(X(t)))return ci.set(o,[]),[];let r=await L(t),a=(yn(r.schema).command_to_fields.get(n)??[]).flatMap(s=>[s.cli_flag,...s.cli_aliases].map(c=>({long:`--${c}`,type:di(s.type),value_type:di(s.type)})));return ci.set(o,a),a}async function _l(e,t){let n=P(t),o=T(process.cwd(),n.path);if(!await Y(X(o)))return;let i=xe?.key===_i(o)?xe.snapshot:null,r=i===null?await L(o):i.settings,a=yn(r.schema),s=[{path:"create",command:"create"},{path:"update",command:"update"},{path:"update-many",command:"update_many"},{path:"list",command:"list"},{path:"list-all",command:"list"},{path:"list-draft",command:"list"},{path:"list-open",command:"list"},{path:"list-in-progress",command:"list"},{path:"list-blocked",command:"list"},{path:"list-closed",command:"list"},{path:"list-canceled",command:"list"},{path:"search",command:"search"},{path:"calendar",command:"calendar"},{path:"context",command:"context"},{path:"templates save",command:"create"}];for(let c of s){let l=ne(e,c.path.split(" "));if(l)for(let d of a.command_to_fields.get(c.command)??[]){let m=d.description??"";mi(l,d.cli_flag,m,d.repeatable);for(let p of d.cli_aliases)mi(l,p,`Alias for --${d.cli_flag}`,d.repeatable)}}}async function hi(e,t,n,o,i){let r=k(n);if(!(r!=="create"&&r!=="update"))try{let a=i??await L(t),s=le(a,o);Ms(e,s,n)}catch{}}function pi(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function vl(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function yi(e){return e.some(t=>t==="--profile")}function _i(e){return`pm-root:${e}`}function ui(e){for(let t of e)t.startsWith("settings_read_")&&ue(t,`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function wl(e,t){e.profile&&(b(`profile:extensions loaded=${t.loadedCount} failed=${t.loadFailedCount} warnings=${t.loadWarnings.length} activation_failed=${t.activationFailedCount} hook_counts=before:${t.hooks.beforeCommand.length}|after:${t.hooks.afterCommand.length}|write:${t.hooks.onWrite.length}|read:${t.hooks.onRead.length}|index:${t.hooks.onIndex.length} command_overrides=${t.commands.overrides.length} command_handlers=${t.commands.handlers.length} parser_overrides=${t.parsers.overrides.length} preflight_overrides=${t.preflight.overrides.length} service_overrides=${t.services.overrides.length} renderer_overrides=${t.renderers.overrides.length}`),t.activationWarnings.length>0&&b(`profile:extensions activation_warnings=${z(t.activationWarnings)}`))}function rn(e,t,n){if(!e)return;let o=w(n.commandPath??"")||"<none>";b(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function an(e,t=Ae){let n=_i(e);if(xe?.key===n)return xe.snapshot;try{let o=Date.now(),{settings:i,warnings:r}=await t(e),a=await ji({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:i,discovery:a,discoveryMs:Date.now()-o,settingsReadWarnings:[...r]};return xe={key:n,snapshot:s},s}catch{return xe={key:n,snapshot:null},null}}async function He(e,t,n=L){let o=t?ct(t):"all",i=vl(e,o);if(ut?.key===i)return ut.snapshot;try{let r=await n(e),a=await Ve({pmRoot:e,settings:r,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?Ho(t):void 0}),s=await Ke({...a,loaded:a.loaded}),c=[...new Set(s.commands.handlers.map(u=>w(u.command)))].filter(u=>u.length>0).sort((u,f)=>u.localeCompare(f)),l=vs(s.registrations.flags),d=ys(s.commands.handlers,s.registrations.commands),m=bs(c,s.registrations.commands,s.registrations.flags,d),p={hooks:s.hooks,commands:s.commands,parsers:s.parsers,preflight:s.preflight,services:s.services,renderers:s.renderers,registrations:s.registrations,pmRoot:e,settings:r,commandHandlers:c,commandFlagHelp:l,commandDescriptors:m,commandAliases:d,loadWarnings:[...a.warnings],activationWarnings:[...s.warnings],loadedCount:a.loaded.length,loadFailedCount:a.failed.length,activationFailedCount:s.failed.length,contextIntentPackages:a.loaded.map(({name:u,module:f})=>({name:u,module:f}))};return ut={key:i,snapshot:p},p}catch{return ut={key:i,snapshot:null},null}}async function bl(e){let t=Ze(e);if(t.noExtensions){let a=T(process.cwd(),t.path);return await Y(X(a))&&ui((await Ae(a)).warnings),null}let n=T(process.cwd(),t.path),o=await an(n);if(!o)return null;ui(o.settingsReadWarnings);let i={commandPath:E(e),commandArgs:Go(e)};if(!lt(o.discovery,i))return rn(t.profile,o,i),null;let r=await He(n,i);return r?(wl(t,r),{hooks:r.hooks,commands:r.commands,parsers:r.parsers,preflight:r.preflight,services:r.services,renderers:r.renderers,registrations:r.registrations,pmRoot:n}):null}async function vi(e){let t=await He(e);return t?new Map(t.commandDescriptors):A}async function Lp(e,t){return!e.requested||t.noExtensions||De(v,e.commandPathTokens)?A:vi(T(process.cwd(),t.path))}async function Cl(e,t){return(await Hr({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(n=>n.outcome==="failed").map(n=>`extension_migration_failed:${n.layer}:${n.extension}:${n.id}`)}function xl(e,t,n){let o=t.author;return qr(e,ma.forActiveExtensionHost({pmRoot:e,author:o}),o,w(n))}async function kl(e,t,n,o=[]){let i=E(e),r=Hn(e.args.map(String),o),a={...t};delete a.author;let s={...n},c=T(process.cwd(),n.path),l={args:[...r],path:n.path},d=await bt({command:i,args:r,options:a,global:s,pm_root:c});n.profile&&d.warnings.length>0&&b(`profile:extensions parser_warnings=${z(d.warnings)}`),r=d.context.args,a=d.context.options,s=d.context.global,Jn(l,{args:r,path:s.path},a),Ko(A.get(w(i)),r,a,o),Se(void 0),vt({command:i,args:r,options:{...a},global:{...s},pm_root:c});let m=await hn({command:i,args:r,options:a,global:s,pm_root:c,sdk:xl(c,s,i)});if(s.profile&&m.warnings.length>0&&b(`profile:extensions command_handler_warnings=${z(m.warnings)}`),!m.handled)throw m.warnings.length>0?kr(i,m):new R(`Command "${i}" is provided by extensions and is not currently available.`,h.NOT_FOUND);return m.exitCode!==void 0&&(process.exitCode=m.exitCode),Se(m.result),m.result}var tl=Symbol("pm.wrappedActionHandler");function Fp(e,t){let n=e[e.length-1];return n instanceof fi?n:t}function nl(e,t,n){e&&n.length>0&&b(`profile:extensions ${t}=${z(n)}`)}function jp(e){let t=A.get(w(e.commandPath));if(!t||!Bo(e.activeRegistrations,e.commandPath))return;let n=Yt(t).length===0?na(e.commandArgs):Hn(e.commandArgs,e.extensionFlagDefinitions);Vo(t,n)}function Up(e,t,n){e.args=[...n],"_processArguments"in e&&typeof e._processArguments=="function"&&e._processArguments(),t.length>0&&Array.isArray(t[0])&&(t[0]=[...e.processedArgs])}function wi(e,t,n){if(!at(e))return;let o=A.get(w(t))?.read_output_declared===!0;return Xt(n,o)}function El(e){let t=n=>{let o=n;if(Ks(n),typeof o._actionHandler=="function"&&o[tl]!==!0){let i=o._actionHandler;o._actionHandler=async function(...r){let a=Fp(r,n),s=Date.now();Fn(a);let c=Ze(a),l=q(E(a));if(["package inventory","packages inventory","extension inventory"].includes(l))return Ea(l,c.expectHash),await i.apply(this,r);let d=T(process.cwd(),c.path),m=a.args.map(String),p=ce(),u=p?dt(p,l,m):[],f=await yl(l,d),g=wi(a,l,u),y=je(a,m,[...u,...f],g);Js(a,u,l),A.has(w(l))&&delete y.author,g!==void 0&&Bs(y,u,l);let I={args:[...m],path:c.path},x=await bt({command:l,args:m,options:y,global:c,pm_root:d});nl(c.profile,"parser_warnings",x.warnings),m=x.context.args,y=x.context.options,se(a,y),c=x.context.global,Jn(I,{args:m,path:c.path},y),jp({activeRegistrations:p,commandPath:l,commandArgs:m,extensionFlagDefinitions:u}),c=await Jr(c),It(a,c),Up(a,r,m),Ot(a,y),Se(void 0),vt({command:l,args:m,options:{...y},global:{...c},pm_root:d});let S=await hn({command:l,args:m,options:y,global:c,pm_root:d,sdk:xl(d,c,l)});if(nl(c.profile,"command_handler_warnings",S.warnings),S.handled){Se(S.result),kn(S.result,{...c,command:l,commandArgs:m,commandOptions:y,pmRoot:d}),c.profile&&b(`profile:command=${l} took_ms=${Date.now()-s}`);return}return await i.apply(this,r)},o[tl]=!0}for(let i of n.commands)t(i)};t(e)}async function Qt(e){A=new Map,oe({overrides:[]}),e&&await hi(e.rootProgram,e.pmRoot,e.invocationArgv,Mi(),e.settings)}function qp(e,t,n,o){if(t?.flags&&t.flags.length>0){So(e,t.flags);let i=Ao(e,t.flags);i&&e.addHelpText("after",i)}else n&&e.addHelpText("after",n);t&&at(e)&&e.addHelpText("after",To(t)),o&&e.addHelpText("after",o)}function Hp(e,t,n,o){t&&e.addHelpText("after",t),n&&e.addHelpText("after",To(n)),o&&e.addHelpText("after",o)}function Sl(e,t,n){let o={core:0,standard:1,full:2,internal:3},i=(r,a)=>{let s=a.join(" "),c=[...n.entries()].filter(([d])=>d===s||d.startsWith(`${s} `)).map(([,d])=>d),l=c.length===0?"standard":c.reduce((d,m)=>o[m.tier]<o[d]?m.tier:d,"internal");Mt(r,l);for(let d of r.commands)i(d,[...a,d.name()])};for(let r of e.commands)t.has(r.name())||i(r,[r.name()])}async function Al(e,t){let n=P(t),o=T(process.cwd(),n.path);if(n.noExtensions){await Qt({rootProgram:e,pmRoot:o,invocationArgv:t});return}let i=await an(o),r=Fe(t);if(!i){await Qt();return}if(!lt(i.discovery,r)){await Qt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings}),rn(yi(t),i,r);return}let a=await He(o,r);if(!a){await Qt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings});return}oe(a.services),A=new Map(a.commandDescriptors),await hi(e,o,t,a.registrations,a.settings);let s=Rs(e,a.commandHandlers,a.commandDescriptors,a.commandAliases,d=>Ts(a.activationWarnings,b,d)),c=new Set(e.commands.map(d=>d.name())),l=d=>{let m=d.split(" ").filter(x=>x.length>0),p=a.commandDescriptors.get(d),u=ne(e,m),f=a.commandFlagHelp.get(d),g=p?Ss(p):null;if(u){qp(u,p,f,g);return}let y=As(e,m);p?.description&&y.description(p.description);let I=f;p&&(Cs(y,p),p.flags.length>0&&(So(y,p.flags),I=Ao(y,p.flags)??void 0)),Hp(y,I,p,g),y.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...x)=>{let S=x[x.length-1],$=S instanceof fi?S:y,gt=Ze($),jl=Date.now(),ln=dt(a.registrations,d,$.args.map(String)),xi=je($,$.args.map(String),ln,wi($,d,ln)),ki=await kl($,xi,gt,ln);await Yr(gt,ki),kn(ki,{...gt,command:d,commandArgs:$.args.map(String),commandOptions:xi,pmRoot:o}),gt.profile&&b(`profile:command=${d} took_ms=${Date.now()-jl}`)})};for(let d of s)l(d);Sl(e,c,a.commandDescriptors)}var qe=Ni(import.meta.url,["../.."])??"0.0.0",v=Ln(qe);async function ol(e){if(!U)return;let t=Reflect.get(e,ll);typeof t=="string"&&await da(t)}async function il(e,t,n){let o=E(e);return["item mutate","item complete"].includes(o)&&e.optsWithGlobals().dryRun===!0?t:n()}async function rl(e,t,n){!U||!await Sn(!0)||(In(e,t,n,{source_context:U.source_context,source_context_source:U.source_context_source}),Er(e),nn=U)}async function sn(e,t,n){let o=nn;if(!o)return;nn=null;let i=!1;try{let r=await L(o.global_pm_root);i=r.telemetry.enabled&&r.telemetry.installation_id===o.installation_id}catch{}await Sn(i)?Ar(e,t,n):Sr()}async function Gp(e){let t=await bl(e);return gn(t?.registrations??null),t}function Rl(e,t){t&&mt(t)||(e.hook("preAction",async(n,o)=>{ke=null,U=null,nn=null,wt(),Fn(o);let i=o.optsWithGlobals(),r=Ze(o),a=q(E(o)),s=o.args.map(String),c={args:[...s],path:r.path},l=je(o,s),d={...r},m=T(process.cwd(),r.path),p=await Gp(o);if(ir(a,{...l,...Xr(a,o.processedArgs),outputInclude:i.outputInclude,outputLimit:i.outputLimit,outputBudget:i.outputBudget,outputFormat:i.outputFormat,outputSession:i.outputSession,outputCursor:i.outputCursor}),Wo(o,a,d,l),await il(o,void 0,()=>Pr(a,d)),!p){ke=Ui({commandName:a,commandArgs:s,commandOptions:l,globalOptions:d,pmRoot:m}),U=await $n({command:a,pm_version:qe,args:s,options:l,global:d,pm_root:m}),await ol(e),await rl(a,s,l),await Do(a,l,m,pi()),await $o(a,s,l,d,m),await Kn({command:o,commandPath:a,commandArgs:s,commandOptions:l,expectHash:r.expectHash,pmRoot:m,globalOptions:d});return}qi(p.hooks),Hi(p.commands),Gi(p.parsers),zi(p.preflight),oe(p.services),Wi(p.renderers),gn(p.registrations);let u=dt(p.registrations,a,s);l=je(o,s,u,wi(o,a,u)),Wo(o,a,d,l);let f=await bt({command:a,args:s,options:l,global:d,pm_root:p.pmRoot});d.profile&&f.warnings.length>0&&b(`profile:extensions parser_warnings=${z(f.warnings)}`),s=f.context.args,l=f.context.options,se(o,l),d=f.context.global;let g={args:[...s],path:d.path};Ot(o,l);let y=await Ki({command:a,args:s,options:l,global:d,pm_root:p.pmRoot,decision:pi()});d.profile&&y.warnings.length>0&&b(`profile:extensions preflight_warnings=${z(y.warnings)}`),s=y.context.args,l=y.context.options,se(o,l),d=y.context.global,Ot(o,l);let I=y.decision;await Do(a,l,p.pmRoot,I),await $o(a,s,l,d,p.pmRoot),await Kn({command:o,commandPath:a,commandArgs:c.args,commandOptions:l,expectHash:r.expectHash,pmRoot:p.pmRoot,rewritten:Vn(c,[g,{args:s,path:d.path}]),globalOptions:{...d,path:r.path,noExtensions:r.noExtensions}});let x=I.run_extension_migrations?await il(o,[],()=>Cl(p.registrations.migrations,p.pmRoot)):[];d.profile&&x.length>0&&b(`profile:extensions migration_warnings=${z(x)}`);let S=js(p.registrations.migrations);ke={hooks:p.hooks,commandName:a,commandArgs:s,commandOptions:{...l},globalOptions:{...d},pmRoot:p.pmRoot,profileEnabled:!!d.profile,migrationBlockers:S},Se(void 0),vt({command:a,args:s,options:{...l},global:{...d},pm_root:p.pmRoot}),U=await $n({command:a,pm_version:qe,args:s,options:l,global:d,pm_root:p.pmRoot}),await ol(e),await rl(a,s,l);let $=await Li(p.hooks,{command:a,args:s,options:{...l},global:{...d},pm_root:p.pmRoot});d.profile&&$.length>0&&b(`profile:extensions hook_warnings=${z($)}`),I.enforce_mandatory_migration_gate&&Us(a,l,S)}),e.hook("postAction",async()=>{let n=si();await sn(n.ok,n.error,{error_code:n.error_code,error_category:n.error_category,exit_code:n.exit_code,command_resolution:n.command_resolution,resolution_stage:n.resolution_stage}),await ft(n),await Re()}))}Rl(v);var al=Symbol("pmCliIdempotentTopLevelRegistration");function Tl(e){let t=e;if(t[al])return;t[al]=!0;let n=e.command.bind(e);e.command=((o,...i)=>{let r=o.split(/\s+/u)[0];return e.commands.some(a=>a.name()===r||a.aliases().includes(r))?new fi(r):n(o,...i)})}async function zp(e,t){if(Tl(e),t.setup){let{registerSetupCommands:n}=await Sp();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await Ap(),o=typeof t.targetCommandName=="string"&&Jo.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await Rp();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await Tp();n(e)}}function Ue(e){return e.rawInvocationArgv??e.invocationArgv}function Wp(e){return async t=>{let n=ht(t.errorCode),o=Et({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Dr({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:qe,pm_root:e.bootstrapPmRoot,error_code:t.errorCode,error_message:t.errorMessage,exit_code:t.exitCode,error_category:n,command_resolution:o,resolution_stage:t.resolutionStage}),{errorCategory:n,commandResolution:o}}}async function Ol(e){if(e.bootstrapGlobal.noExtensions||mt(e.invocationArgv))return;let t=Fe(e.invocationArgv),n=await an(e.bootstrapPmRoot);if(n&<(n.discovery,t)){let o=await He(e.bootstrapPmRoot,t);Il(o);return}n&&rn(yi(e.invocationArgv),n,t),oe({overrides:[]})}function Il(e){if(!e){oe({overrides:[]});return}oe(e.services)}async function bi(e){await sn(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await ft({ok:!1,error:e.errorMessage,exit_code:e.exitCode,error_code:e.classificationCode,error_category:e.errorCategory,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage})}async function Pl(){await sn(!0,void 0,{exit_code:h.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await ft({ok:!0,exit_code:h.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=h.SUCCESS}async function $l(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof R)&&(Tn(e.error)||!n))return!1;let o=K(me(e.error)),i=e.error instanceof R?e.error.exitCode:Rn(t),r=e.error instanceof R||Cr(e.error)?e.error.context:void 0,a=dl(r,e.invocationArgv,o),s=is(o,a),c=et(e.bootstrapGlobal.lean?Ft(go(o,i,a)):go(o,i,a)),l=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?Z(c,u=>`${JSON.stringify(u,null,2)}
|
|
39
|
+
`)}function Ms(e,t,n){let o=k(n);if(o!=="create"&&o!=="update")return;let i=rt(e,o);i&&i.addHelpText("after",Gm(o,t,n))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="665c29cd-2a3b-5cfc-9690-6d82541fc5d9")}catch{}})();function zm(e,t){return Be(e.id)||`migration-${String(t+1).padStart(3,"0")}`}function Wm(e){return Be(e.status)?.toLowerCase()??"pending"}function Bm(e){return e.mandatory===!0}function Vm(e,t){let n=e.layer.localeCompare(t.layer);if(n!==0)return n;let o=e.name.localeCompare(t.name);return o!==0?o:e.id.localeCompare(t.id)}function js(e){let t=[];return e.forEach((n,o)=>{if(!Bm(n.definition))return;let i=Wm(n.definition);i!=="applied"&&t.push({layer:n.layer,name:n.name,id:zm(n.definition,o),status:i})}),t.sort(Vm),t}function Ls(e){return Array.isArray(e)&&e.length>0}var Km=new Set(["create","beads import","todos import"]),Jm=new Set(["restore","update","close","delete","append","claim","release"]),Ym=new Set(["comments","notes","learnings"]),Xm=new Set(["files","docs","test"]),Zm=new Set(["activate","add","add-field","add-status","add-type","apply","compact","create","deactivate","delete","disable","edit","enable","import","infer","install","materialize","migrate","redact","remove","remove-field","remove-status","remove-type","remap-status","rename-field","rename-type","repair","run","save","set","unset","update","upgrade"]);function Po(e,t){let n=t.force===!0;return Km.has(e)?{isMutation:!0,forceCapable:!1,forceRequested:!1}:Jm.has(e)?{isMutation:!0,forceCapable:!0,forceRequested:n}:Ym.has(e)?{isMutation:typeof t.add=="string",forceCapable:!0,forceRequested:n}:Xm.has(e)?{isMutation:Ls(t.add)||Ls(t.remove),forceCapable:!0,forceRequested:n}:{isMutation:!1,forceCapable:!1,forceRequested:!1}}function Qm(e,t,n){if(Po(e,n).isMutation)return!0;let o=e.trim().toLowerCase();return Or(o)?["close-many","close-task","copy","delete","discover","focus","pause-task","start-task","update-many"].includes(o)?!0:t.some(i=>Zm.has(i.trim().toLowerCase())):!1}function Fs(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function ep(e,t,n){let o=t[0]?.trim().toLowerCase()??"";if(e.trim().toLowerCase()!=="schema"||!["rename-type","rename-field","remap-status"].includes(o))return;let i=[];if(Be(t[1])||i.push("source"),Be(n.to)||i.push("--to"),i.length!==0)throw new R(`Schema migration requires ${i.join(", ")}.`,h.USAGE,{code:"schema_migration_input_required",required:i.join(","),why:"Schema migrations require a source and target. A workspace-bound stable migration id is derived automatically when --migration-id is omitted.",recovery:{recovery_mode:"compact",missing_required_fields:i,suggested_flags:i.filter(r=>r.startsWith("--")),suggested_retry:`pm schema ${o} <source> --to <target>`}})}async function tp(e,t,n,o,i){if(e.trim().toLowerCase()!=="update"||typeof n.status!="string"||Fs(n.status)!==Fs(i.schema.workflow.in_progress_status))return;let r=t[0];if(!r)return;let a=le(i,ce()),s=await kt(o,r,i.id_prefix,i.item_format,a.type_to_folder);if(!s)return;let c=await yr(s,{schema:i.schema}),l=typeof n.assignee=="string"?n.assignee.trim():void 0;(l===void 0?c.document.metadata.assignee?.trim():!["","none","null","undefined"].includes(l.toLowerCase())&&l)||b(`warning:in_progress_item_unclaimed:${s.id}:claim_with=pm claim ${s.id}`)}async function $o(e,t,n,o,i){if(!Qm(e,t,n)||(ep(e,t,n),!await Y(X(i))))return;let r=await Ae(i);ba(o.json===!0)||await tp(e,t,n,i,r.settings);let a=Tr({author:vt(o.author,r.settings.author_default),payload:{command:e,args:t,options:n},settings:r.settings.mutation_guard,force:o.force===!0||n.force===!0});for(let s of a.warnings)ue(s)}function Us(e,t,n){if(n.length===0)return;let o=Po(e,t);if(!o.isMutation||o.forceCapable&&o.forceRequested)return;let i=n.map(a=>`extension_migration_blocking:${a.layer}:${a.name}:${a.id}:${a.status}`),r=o.forceCapable?"Re-run this command with --force to bypass.":"This command path does not support --force bypass.";throw new R(`Write command "${e}" blocked by unresolved mandatory extension migrations (${i.join(",")}). ${r}`,h.CONFLICT)}async function Do(e,t,n,o){if(!Po(e,t).isMutation||!o.enforce_item_format_gate&&!o.run_preflight_item_format_sync||!await Y(X(n)))return;let{settings:i,metadata:r,warnings:a}=await Ae(n);for(let s of a)ue(s);if(!mr(i)&&(o.enforce_item_format_gate&&!r.has_explicit_item_format&&(dr(i),await pr(n,i,"item_format:auto_select_default")),o.run_preflight_item_format_sync)){let s=le(i,ce());await Ir(n,i.item_format,"item_format:pre_mutation_sync",s.type_to_folder,i.schema)}}(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]="c0826cb1-5181-51b3-9ad9-0cd7a3d2c4b3")}catch{}})();function No(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=w(n);o.length!==0&&t.push(o)}return t}function Le(e){let t=w(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(i=>i.length>0);for(let i of No(e.commandArgs))o.push(...i.split(" ").filter(r=>r.length>0)),n.push(o.join(" "));return[...new Set(n.flatMap(i=>[i,q(i)]))]}function Mo(e,t){let n=w(e);if(n.length===0)return!1;let o=Le(t);for(let i of o)if(i===n||i.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(i=>n.startsWith(`${i} `)):!1}function Bt(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...N(n.commands),...N(n.command_handlers),...N(n.command_overrides),...N(n.flag_commands),...N(n.parser_overrides),...qs(n.preflight_ownership),...qs(n.renderer_ownership)]:[]}function N(e){return e??[]}function qs(e){return N(e).flatMap(t=>t.commands)}function st(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var Hs=new Set(["hooks","parser","preflight","renderers"]),Gs=new Set(["commands","schema","services","importers"]),np=new Set(["reindex","search","search-advanced"]),op=new Set(["--template"]);function Me(e,t){for(let n of t)if(e.has(n))return!0;return!1}function Lo(e){let t=w(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return np.has(n??t)}function Fo(e,t){for(let n of e.commandArgs??[]){if(!n.startsWith("--"))continue;let[o]=n.split("=",1);if(t.has(o))return!0}return!1}function Vt(e){return w(e.commandPath??"")==="create"&&Fo(e,op)}function jo(e){return e.some(t=>{let n=w(t);return n==="templates"||n.startsWith("templates ")})}function Wt(e,t){return e.some(n=>Mo(n,t))||Vt(t)&&jo(e)}function Uo(e){return[N(e.hooks).length,(e.preflight_overrides??0)-N(e.preflight_ownership).length,N(e.item_types).length,N(e.item_fields).length,N(e.relationship_kinds).length,N(e.service_overrides).length,N(e.assurance_providers).length,N(e.renderer_overrides).length-N(e.renderer_ownership).length].some(t=>t>0)}function qo(e,t){let n=e.activation?.commands??[];if(n.length>0)return Wt(n,t);let o=Bt(e);if(Wt(o,t)||st(e).has("search")&&Lo(t.commandPath))return!0;if(e.contributions)return Uo(e.contributions)}function Kt(e,t){let n=qo(e,t);if(n!==void 0)return n;let o=st(e);return!!(Me(o,Hs)||Me(o,Gs))}function lt(e,t){return e.effective.length===0?!1:ct(t)!=="all"?e.effective.some(n=>Kt(n,t)):e.effective.some(n=>{let o=st(n);return Bt(n).length>0||Me(o,Hs)||Me(o,Gs)||o.has("search")})}function ct(e){if(w(e.commandPath??"").split(" ")[0]==="completion")return"all";let t=Le(e).filter(o=>o.split(" ").every(i=>!i.startsWith("-"))).sort((o,i)=>i.length-o.length)[0]??w(e.commandPath??"");if(t.length===0)return"all";let n=Vt(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function Ho(e){return ct(e)==="all"?void 0:t=>Kt(t,e)}function Fe(e){let t=O(e);if(t.requested&&t.commandPathTokens.length>0){let[i,...r]=t.commandPathTokens;return{commandPath:i,commandArgs:r,allowCommandPrefixMatch:!0}}let n=F(e),o=n.findIndex(i=>i.trim().length>0&&!i.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function Go(e){let t=e.args.map(String);if(w(E(e))==="create"){let n=e.optsWithGlobals();typeof n.template=="string"&&n.template.trim().length>0&&t.push("--template")}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8065373f-1652-563e-9b43-f21c104f0f61")}catch{}})();var Jt=Symbol.for("pm.readOutputInvocationProvenance"),ip=new Map(pe.filter(e=>e.reservation_scope==="root_only").map(e=>[Pt({long:e.flag}),e.flag]));function se(e,t){let n=Reflect.get(e,Jt);n!==void 0&&Reflect.set(t,Jt,n)}function zo(e,t,n){let o=tr(t,n);if(!o)return;let i=e;for(;i.parent;)i=i.parent;let r=i.rawArgs,a=new Set(ee(r.slice(2))),s=er.find(d=>d.command===o),c=Object.values(s?.dimensions??{}).flatMap(d=>d.legacy_aliases.flatMap(m=>a.has(m.flag)?[m.flag]:[])),l=Reflect.get(n,Jt);Reflect.set(n,Jt,{canonical_include_modes:l?.canonical_include_modes??[],explicit_legacy_aliases:c,cli_invocation_observed:!0}),se(n,e)}function rp(e){let t=e.optsWithGlobals(),n=E(e);if(q(n)===n)return t;let o=e.opts();for(let i=e.parent;i?.parent;i=i.parent)for(let r of i.options){let a=r.attributeName(),s=i.getOptionValueSource(a)==="cli";if(s&&!e.options.some(c=>c.long===r.long))throw new R(`Unknown option '${r.long}' for ${n}`,h.USAGE,{code:"unknown_option",flag:r.long,required:`Use options declared by pm ${n} --help.`});if(s&&e.getOptionValueSource(a)!=="cli"){let c=i.getOptionValue(a);e.setOptionValueWithSource(a,c,"cli")}a in o?t[a]=o[a]:delete t[a]}return t}function Wo(e,t,n,o){zo(e,t,o);let i=n.outputInclude;if(i===void 0)return;let{selectors:r,modes:a}=ar(t,i,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),a.length===0)return;se(o,e);let s=rr(t);for(let l of a){let d=s.get(l),m=o[d];e.setOptionValueWithSource(d,m,"cli")}let c=r.length>0?r.join(","):void 0;c===void 0?delete n.outputInclude:n.outputInclude=c;for(let l=e;l;l=l.parent)l.setOptionValueWithSource("outputInclude",c,"cli");It(e,n)}function je(e,t,n=[],o){let i={...rp(e)};se(e,i),delete i.json,delete i.quiet,delete i.path,delete i.pmPath,delete i.noExtensions,delete i.extensions,delete i.profile,delete i.pager,delete i.changedFields,delete i.fullChangedFields,delete i.idOnly,delete i.lean,delete i.tokenAccounting,delete i.outputInclude,delete i.outputLimit,delete i.outputBudget,delete i.outputFormat,delete i.outputSession,delete i.expectHash;let r=ta(t);for(let[a,s]of Object.entries(r))i[a]===void 0&&(i[a]=s);if(n.length>0){let a=Un(n),s=H(E(e)).map(d=>({long:d.flag,short:d.short,aliases:d.aliases})),c={...r};for(let d of a)i[d]!==void 0&&(c[d]=i[d]);qn(c,[...s,...n],E(e),o);let l=ea(i,n,r,E(e));return se(i,l),l}return i}function Bs(e,t,n){let o=Un(t.map(({long:a})=>({long:a}))),i=[...ip].find(([a])=>e[a]!==void 0&&!o.has(a));if(i===void 0)return;let r=i[1];throw new R(`Unknown option '${r}' for extension command '${n}'. ${r} is a root-only pm flag and this command does not declare it.`,h.USAGE,{code:"unknown_option",flag:r,required:`Remove ${r}, or use it on the root command (pm --help ${r}).`,nextSteps:[`Run pm contracts --command ${n} --flags-only --json to list the flags this command accepts.`]})}function dt(e,t,n){let o=Qe(e,t),i=[t],r=[];for(let a of n){if(a.startsWith("-"))break;i.push(a);let s=Qe(e,i.join(" "));s.length>0&&(r=s)}return r.length>0?r:o}function Yt(e){return e.arguments??[]}function zs(e){let t=Yt(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function Bo(e,t){if(!e)return!1;let n=w(t);return e.importers.some(o=>w(`${o.importer} import`)===n)||e.exporters.some(o=>w(`${o.exporter} export`)===n)}var Vs=Symbol("pm.commandOptionTokens"),Ws=Symbol("pm.capturesOptionTokens");function Ks(e){if(Reflect.get(e,Ws)===!0)return;Reflect.set(e,Ws,!0);let t=e.parseOptions.bind(e);e.parseOptions=n=>(Reflect.set(e,Vs,[...n]),t(n))}function ap(e){let t=new Map;for(let n of e.options){let o={arity:n.required?"required":n.optional?"optional":"none",key:n.attributeName(),variadic:n.variadic};for(let i of[n.short,n.long])i&&t.set(i,o)}return t}function sp(e){let t=Reflect.get(e,"_passThroughOptions")===!0;return!t&&Reflect.get(e,"_enablePositionalOptions")!==!0?{}:{stop:{atSubcommand:n=>e.commands.some(o=>o.name()===n||o.aliases().includes(n)),atFirstUnrecognized:t}}}function Js(e,t,n){if(t.length===0)return;let o=[];for(let r=e;r?.parent;r=r.parent)o.unshift(r);let i=[];for(let r of o){let a=Reflect.get(r,Vs);if(a===void 0)continue;let s=ap(r),c=[];for(let l=r;l;l=l.parent)c.push(l);i.push({tokens:a,optionOf:l=>s.get(l),includesLooseFlags:r===e,negativeNumbersAreValues:!c.some(l=>l.options.some(d=>d.short!==void 0&&/^-\d$/u.test(d.short))),...sp(r)})}oa(i,t,n)}function Vo(e,t){let n=Yt(e),o=n.filter(s=>s.required).length,i=n.some(s=>s.variadic)?Number.POSITIVE_INFINITY:n.length,r=e.failure_hints??[],a=r.length>0?` ${r.join(" ")}`:"";if(t.length<o)throw new R(`Missing required argument for extension command '${e.command}'. Usage: ${zs(e)}${a}`,h.USAGE);if(t.length>i){let s=t.slice(i).join(" ");throw new R(`Too many arguments for extension command '${e.command}': ${s}. Usage: ${zs(e)}${a}`,h.USAGE)}}function lp(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function Xt(e,t){return{definitions:e,inheritedFlags:Rt({readOutput:t}).map(n=>n.flag)}}function cp(e,t,n){let o=Object.keys(e).filter(r=>e[r]!==void 0).sort().map(lp);if(o.length===0)return;let{inheritedFlags:i}=Xt([],n);throw new R(`Unknown option '${o.join(", ")}' for extension command '${t}'. This command declares no flags; it accepts only the host flags ${i.join(", ")}.`,h.USAGE,{code:"unknown_option",flag:o[0],required:`Remove ${o.join(", ")}, or ask the package to declare it with api.registerFlags.`,nextSteps:[`Run pm contracts --command ${t} --flags-only --json to list the flags this command accepts.`]})}function dp(e,t,n){let o=e.read_output_declared===!0;if(n.length>0){qn(t,n,e.command,Xt(n,o));return}cp(t,e.command,o)}function Ko(e,t,n,o){e&&(Vo(e,t),dp(e,n,o))}import{Command as Ys}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0503f6e5-36d9-5afb-a17f-feef2241f984")}catch{}})();var mp=new Set(["--version","-V"]);function mt(e){let t=F(e);return["package","packages","extension"].includes(t[0]??"")&&t[1]==="inventory"}function Xs(e){if(F(e)[0]!=="item"||!e.includes("--dry-run"))return;let t=new Ys().configureOutput({writeErr:()=>{}}).exitOverride(),n=new Set;for(let i of pe)for(let r of[i.flag,i.short,...i.aliases??[]]){if(r===void 0||n.has(r))continue;n.add(r);let a=i.value_name!==void 0||i.flag==="--pm-path";t.option(`${r}${a?" <value>":""}`)}try{t.parseOptions(e)}catch{}let o=t.opts();return{path:o.pmPath??o.path}}var pp=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),Jo=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]),Zs=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]),up=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),fp=new Set(["claim","close-task","pause-task","release","start-task","test"]),be={setup:!0,listQuery:!0,mutation:!0,operation:!0},gp=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function pt(e){return e.some(t=>mp.has(t))}function hp(e,t){if(!M.some(o=>o.canonical_argv[0]===t))return;let n=new Ys().configureOutput({writeErr:()=>{}}).exitOverride();for(let o of Te(t,H(t))){let i=o.takes_value?o.value_required?" <value>":" [value]":"";for(let r of[o.flag,o.short,...o.aliases??[]])r!==void 0&&n.option(`${r}${i}`)}try{let o=n.parseOptions(e.slice(1));if(o.unknown.length>0)return be;let i=B([t,...o.operands])?.alias;if(M.some(r=>r.alias===i))return{...be,targetCommandName:i}}catch{return be}}function Yo(e){if(pt(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||O(e).requested)return be;let t=k(e);if(!t)return be;let n=t.trim().toLowerCase(),o=F(e),i=B(o)?.alias;return M.some(r=>r.alias===i)?{...be,targetCommandName:i}:hp(o,n==="ctx"?"context":n)||(pp.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:Jo.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:Zs.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:up.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:be)}function Xo(e){return e.length===0||O(e).requested||e.includes("--explain")&&k(e)===void 0}function Zo(e,t){return mt(t)||pt(t)?!1:re(t)||O(t).requested?!0:!!k(t)}function Qo(e){if(pt(e))return!1;let t=k(e);return t?gp.has(t):!1}function yp(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,i=e.normalizedTokens.map(l=>{let d=l.indexOf("=");return d>=0?l.slice(0,d):l}).find(l=>l==="--literal"||l==="--regex"||l==="--replacement"),r=i?e.argv.map(l=>{let d=l.indexOf("=");return(d>=0?l.slice(0,d):l)===o?d>=0?`${i}${l.slice(d)}`:i:l}):e.argv,a=ze(r),s=i&&n>=0?`${o}=[redacted]`:t,c=i&&e.normalizedDisplay.includes("=")?`${i}=[redacted]`:e.normalizedDisplay;return{argv:a,normalizedDisplay:c,sourceDisplay:s}}function ei(e){let t=e.commandName;if(!t)return;let n=e.trace.find(l=>l.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(l=>l.length>0),i=o.length>0?o.join(" "):"the canonical flag",r=Zs.has(t)||fp.has(t),a=r?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=r?"mutating option":"option",c=yp({argv:e.argv,normalizedDisplay:i,normalizedTokens:o,rawFrom:n.from});throw new R(`Refusing to auto-correct ${s} ${c.sourceDisplay} to ${c.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,h.USAGE,{code:a,examples:[_(c.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:c.argv,suggested_retry:_(c.argv)}})}(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]="6d83c356-db56-5116-9fe7-e0c27973b36f")}catch{}})();var _p=new Set(["success","nonexistent_command","invalid_option","missing_required_option","missing_required_argument","invalid_usage","validation_failed","health_findings","validation_findings","conflict","runtime_failed","unknown_failed"]),vp=new Set(["parse","preflight","execute","unknown"]),wp=new Set(["usage","validation","conflict","runtime","unknown"]);function Ce(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let i=o.trim();if(i.length>0)return i}}}function ti(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Zt(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="number"&&Number.isFinite(o))return Math.max(0,Math.trunc(o))}}function ni(e){if(!e)return;let t=e.trim().toLowerCase();if(_p.has(t))return t}function oi(e){if(!e)return;let t=e.trim().toLowerCase();if(vp.has(t))return t}function ii(e){if(!e)return;let t=e.trim().toLowerCase();if(wp.has(t))return t}function ri(e){let t=Ce(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let r=n.find(a=>typeof a=="string"&&a.trim().length>0);if(typeof r=="string")return r.trim()}if(ti(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let o=Zt(e,"failed");if(typeof o=="number"&&o>0)return`failed_runs:${o}`;let i=e?.run_results;if(Array.isArray(i)){let r=i.filter(a=>un(a)?.status==="failed").length;if(r>0)return`failed_runs:${r}`}}function ai(e,t){if(!e)return t===h.USAGE?"invalid_command_usage":t===h.NOT_FOUND?"item_not_found":t===h.CONFLICT?"lock_conflict":t===h.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function si(){let e=un(de()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Zt(e,"exit_code","exitCode"),o=t??n??h.SUCCESS,i=sa(o),r=Ce(e,"error_code","errorCode")??ai(i,o),a=ii(Ce(e,"error_category","errorCategory"))??(i?void 0:ht(r)),s=i?void 0:ri(e)??`command_exit_${o}`,c=ni(Ce(e,"command_resolution","commandResolution"))??Et({ok:i,errorCode:r,errorCategory:a}),l=oi(Ce(e,"resolution_stage","resolutionStage"))??"execute";return{ok:i,error:s,exit_code:o,error_code:r,error_category:a,command_resolution:c,resolution_stage:l}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="df513d3f-9fef-51e0-b2cb-e43cf27db6ec")}catch{}})();var li="PM_CLI_PACKAGE_ROOT",ll=Symbol("pm.deprecatedAliasInvocation"),tn=new Map;for(let e of J){let t=e.alias.split(" ")[0],n=tn.get(t)??[];n.push(e),tn.set(t,n)}for(let e of tn.values())e.sort((t,n)=>n.alias.split(" ").length-t.alias.split(" ").length);function bp(){return Di(import.meta.url,["../.."])}(typeof process.env[li]!="string"||process.env[li]?.trim().length===0)&&(process.env[li]=bp());var ke=null,U=null,nn=null;function Cp(e){ke=e}function xp(e){A=e}var ut=null,xe=null,A=new Map,gi=250,kp=new Set([h.USAGE,h.NOT_FOUND,h.CONFLICT]),Ep=new Set(["1","true","yes","on"]),Sp=Je(()=>import("./chunks/register-setup-2RTG3LII.js")),Ap=Je(()=>import("./chunks/register-list-query-DNKPQB76.js")),Rp=Je(()=>import("./chunks/register-mutation-WVTDFLEF.js")),Tp=Je(()=>import("./chunks/register-operations-NR5MTT5T.js"));function en(e){return _(e)}function cl(e){let t=e.match(/--[a-zA-Z0-9][a-zA-Z0-9_-]*/g);if(!t||t.length===0)return;let n=[...new Set(t.map(o=>fe(o)??o))];return n.length>0?n:void 0}function Op(e,t,n,o){if(n?.suggested_retry||o===to||o===eo||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let i=ee(t),r=new Set(i.map(m=>fe(m)??m)),a=cl(e),s=t.find(m=>v.commands.some(p=>p.name()===m)),c=s?v.commands.find(m=>m.name()===s):void 0,l=new Set([...v.options,...c?.options??[]].flatMap(m=>m.flags.split(/[ ,|]+/).map(p=>fe(p)).filter(p=>p!==void 0))),d=a?.filter(m=>{let p=fe(m)??m;return r.has(p)?!1:l.has(p)||xo(t,s,p,A)!==void 0});return d&&d.length>0?d:void 0}function Ip(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let i=n?.[0],r=i?fe(i):void 0,a=e.find(p=>v.commands.some(u=>u.name()===p)),s=a?v.commands.find(p=>p.name()===a):void 0,c=r?s?.options.find(p=>p.flags.split(/[ ,|]+/).includes(r)):void 0,l=xo(e,a,r,A),d=r?c?.isBoolean()===!0||l===!1?[r]:[r,"<value>"]:[],m=r?en([...e,...d]):t;return m===t?void 0:m}function Pp(e){if(!e)return{};let t=["recovery_mode","missing_required_fields","suggested_flags","suggested_retry_args","allowed_values","candidate_commands","candidate_commands_total","candidate_commands_truncated","fallback_candidates","next_best_command"],n={};for(let o of t){let i=e[o];i!==void 0&&(o==="allowed_values"||i!==null)&&(n[o]=i)}return n}function $p(e){let t=e.existingRecovery;return{attempted_command:t?.attempted_command??e.attemptedCommand,normalized_args:t?.normalized_args??[...e.invocationArgv],provided_fields:t?.provided_fields??(e.providedFields.length>0?e.providedFields:void 0),missing:t?.missing??e.inferredMissing,...Pp(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function Qs(e,t){return{...e,recovery:t}}function Dp(e,t){if(t===void 0)return;let n=Ia(e,t.code,t.field,Ra(e,t.code,t.recovery)),o=Np(e),i=Pa(e,t.code,t.field,n,o),r=Oa(e,t.code,i,o,()=>Lr(T(process.cwd(),P(e).path)));return $a(e,t.code,r,o)}var el=" ";function Np(e){let t=e.map(i=>i===""?el:/^--(?:pm-)?path=$/u.test(i)?`${i}${el}`:i),n=P(t).path;if(n!==void 0&&n.trim()!=="")return[];let o=Ee({});return n!==void 0&&o.length>0?null:o}function dl(e,t,n){let o=ze(t),i=F(o),r=D(i),[a,s]=r===void 0?[]:i.slice(r,r+2),c=o.includes("--explain");e=e===void 0?void 0:vr(e);let l=Dp(o,e),d=l&&(a==="history-redact"||a==="history"&&s==="redact")?{...l,...l.attempted_command?{attempted_command:en(o)}:{},...l.normalized_args?{normalized_args:[...o]}:{},...l.suggested_retry?{suggested_retry:en(o)}:{},...l.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:l;if(d?.recovery_mode==="compact"&&!c)return Qs(e,d);let m=en(o),p=ee(o),u=Op(n,o,d,e?.code),f=Ip(o,m,u,d),g=$p({invocationArgv:o,attemptedCommand:m,providedFields:p,inferredMissing:u,suggestedRetry:f,existingRecovery:d});return Qs(e,g)}async function ft(e){let t=U;U=null,await Da(t,e);let n=ke;if(ke=null,!n){bt();return}let o=[],i=Ji();try{await Na({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?i?.map(r=>r.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await Fi(n.hooks,{command:n.commandName,args:n.commandArgs,options:{...n.commandOptions},global:{...n.globalOptions},pm_root:n.pmRoot,ok:e.ok,error:e.error,result:de(),affected:i}))}catch(r){o=[`afterCommand hooks failed: ${r instanceof Error?r.message:String(r)}`]}finally{bt()}!n.globalOptions.json&&o.length>0&&b(`[pm] warning: afterCommand hook_warnings=${z(o)}`),n.profileEnabled&&o.length>0&&b(`profile:extensions hook_warnings=${z(o)}`)}async function ml(e,t){await xr();let n=U,o=ke,i=n?.command??o?.commandName??e,r=n??En(o?.globalOptions??t),a=A.get(w(i))?.source;In(i,o?.commandArgs??[],{...o?.commandOptions,...o?.globalOptions},{source_context:r.source_context,source_context_source:r.source_context_source,pm_version:n?.pm_version??qe,extension:a})}function pl(e){return Ep.has((process.env[e]??"").trim().toLowerCase())}function ul(e){return pl("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!kp.has(Math.trunc(e))}async function on(e,t){return ul(e.exit_code)?(await ml(e.command,t),Rr({...e,source_context:e.source_context??En(t).source_context}),!0):!1}async function fl(e){let t=K(me(e.error)),n=ls(t);e.bootstrapGlobal.json?b(JSON.stringify(et(as(t,h.GENERIC_FAILURE)),null,2)):b(t),process.exitCode=h.GENERIC_FAILURE;let o="runtime",i="runtime_failed";try{await ml(e.attemptedCommand,e.bootstrapGlobal),Pn(e.error);let r=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:h.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=r.errorCategory,i=r.commandResolution,await sn(!1,t,{error_code:n.code,error_category:o,exit_code:h.GENERIC_FAILURE,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||b(`Failed to report error: ${me(r)}`)}try{await ft({ok:!1,error:t,exit_code:h.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||b(`Failed to run error hooks: ${me(r)}`)}try{await Re()}catch(r){e.bootstrapGlobal.json||b(`Failed to flush error reporting: ${me(r)}`)}}var Mp={create:"create",update:"update","update-many":"update_many",list:"list","list-all":"list","list-draft":"list","list-open":"list","list-in-progress":"list","list-blocked":"list","list-closed":"list","list-canceled":"list",search:"search",calendar:"calendar",context:"context","templates save":"create"},ci=new Map;function di(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function gl(e,t){return e.options.some(n=>n.long===t)}function hl(e,t){return e.options.some(n=>n.short===t)}function mi(e,t,n,o){let i=t.trim();if(!i)return;let r=n.length>0?n:`Runtime schema field (${t})`;if(i.startsWith("-")&&!i.startsWith("--")){if(hl(e,i))return;if(o){e.option(`${i} <value>`,`${r} (repeatable)`,jn);return}e.option(`${i} <value>`,r);return}let a=i.startsWith("--")?i:`--${i}`;if(!gl(e,a)){if(o){e.option(`${a} <value>`,`${r} (repeatable)`,jn);return}e.option(`${a} <value>`,r)}}async function yl(e,t){let n=Mp[e];if(!n)return[];let o=`${t}:${n}`,i=ci.get(o);if(i)return i;if(!await Y(X(t)))return ci.set(o,[]),[];let r=await L(t),a=(yn(r.schema).command_to_fields.get(n)??[]).flatMap(s=>[s.cli_flag,...s.cli_aliases].map(c=>({long:`--${c}`,type:di(s.type),value_type:di(s.type)})));return ci.set(o,a),a}async function _l(e,t){let n=P(t),o=T(process.cwd(),n.path);if(!await Y(X(o)))return;let i=xe?.key===_i(o)?xe.snapshot:null,r=i===null?await L(o):i.settings,a=yn(r.schema),s=[{path:"create",command:"create"},{path:"update",command:"update"},{path:"update-many",command:"update_many"},{path:"list",command:"list"},{path:"list-all",command:"list"},{path:"list-draft",command:"list"},{path:"list-open",command:"list"},{path:"list-in-progress",command:"list"},{path:"list-blocked",command:"list"},{path:"list-closed",command:"list"},{path:"list-canceled",command:"list"},{path:"search",command:"search"},{path:"calendar",command:"calendar"},{path:"context",command:"context"},{path:"templates save",command:"create"}];for(let c of s){let l=ne(e,c.path.split(" "));if(l)for(let d of a.command_to_fields.get(c.command)??[]){let m=d.description??"";mi(l,d.cli_flag,m,d.repeatable);for(let p of d.cli_aliases)mi(l,p,`Alias for --${d.cli_flag}`,d.repeatable)}}}async function hi(e,t,n,o,i){let r=k(n);if(!(r!=="create"&&r!=="update"))try{let a=i??await L(t),s=le(a,o);Ms(e,s,n)}catch{}}function pi(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function vl(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function yi(e){return e.some(t=>t==="--profile")}function _i(e){return`pm-root:${e}`}function ui(e){for(let t of e)t.startsWith("settings_read_")&&ue(t,`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function wl(e,t){e.profile&&(b(`profile:extensions loaded=${t.loadedCount} failed=${t.loadFailedCount} warnings=${t.loadWarnings.length} activation_failed=${t.activationFailedCount} hook_counts=before:${t.hooks.beforeCommand.length}|after:${t.hooks.afterCommand.length}|write:${t.hooks.onWrite.length}|read:${t.hooks.onRead.length}|index:${t.hooks.onIndex.length} command_overrides=${t.commands.overrides.length} command_handlers=${t.commands.handlers.length} parser_overrides=${t.parsers.overrides.length} preflight_overrides=${t.preflight.overrides.length} service_overrides=${t.services.overrides.length} renderer_overrides=${t.renderers.overrides.length}`),t.activationWarnings.length>0&&b(`profile:extensions activation_warnings=${z(t.activationWarnings)}`))}function rn(e,t,n){if(!e)return;let o=w(n.commandPath??"")||"<none>";b(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function an(e,t=Ae){let n=_i(e);if(xe?.key===n)return xe.snapshot;try{let o=Date.now(),{settings:i,warnings:r}=await t(e),a=await ji({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:i,discovery:a,discoveryMs:Date.now()-o,settingsReadWarnings:[...r]};return xe={key:n,snapshot:s},s}catch{return xe={key:n,snapshot:null},null}}async function He(e,t,n=L){let o=t?ct(t):"all",i=vl(e,o);if(ut?.key===i)return ut.snapshot;try{let r=await n(e),a=await Ve({pmRoot:e,settings:r,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?Ho(t):void 0}),s=await Ke({...a,loaded:a.loaded}),c=[...new Set(s.commands.handlers.map(u=>w(u.command)))].filter(u=>u.length>0).sort((u,f)=>u.localeCompare(f)),l=vs(s.registrations.flags),d=ys(s.commands.handlers,s.registrations.commands),m=bs(c,s.registrations.commands,s.registrations.flags,d),p={hooks:s.hooks,commands:s.commands,parsers:s.parsers,preflight:s.preflight,services:s.services,renderers:s.renderers,registrations:s.registrations,pmRoot:e,settings:r,commandHandlers:c,commandFlagHelp:l,commandDescriptors:m,commandAliases:d,loadWarnings:[...a.warnings],activationWarnings:[...s.warnings],loadedCount:a.loaded.length,loadFailedCount:a.failed.length,activationFailedCount:s.failed.length,contextIntentPackages:a.loaded.map(({name:u,module:f})=>({name:u,module:f}))};return ut={key:i,snapshot:p},p}catch{return ut={key:i,snapshot:null},null}}async function bl(e){let t=Ze(e);if(t.noExtensions){let a=T(process.cwd(),t.path);return await Y(X(a))&&ui((await Ae(a)).warnings),null}let n=T(process.cwd(),t.path),o=await an(n);if(!o)return null;ui(o.settingsReadWarnings);let i={commandPath:E(e),commandArgs:Go(e)};if(!lt(o.discovery,i))return rn(t.profile,o,i),null;let r=await He(n,i);return r?(wl(t,r),{hooks:r.hooks,commands:r.commands,parsers:r.parsers,preflight:r.preflight,services:r.services,renderers:r.renderers,registrations:r.registrations,pmRoot:n}):null}async function vi(e){let t=await He(e);return t?new Map(t.commandDescriptors):A}async function Lp(e,t){return!e.requested||t.noExtensions||De(v,e.commandPathTokens)?A:vi(T(process.cwd(),t.path))}async function Cl(e,t){return(await Hr({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(n=>n.outcome==="failed").map(n=>`extension_migration_failed:${n.layer}:${n.extension}:${n.id}`)}function xl(e,t,n){let o=t.author;return qr(e,ma.forActiveExtensionHost({pmRoot:e,author:o}),o,w(n))}async function kl(e,t,n,o=[]){let i=E(e),r=Hn(e.args.map(String),o),a={...t};delete a.author;let s={...n},c=T(process.cwd(),n.path),l={args:[...r],path:n.path},d=await Ct({command:i,args:r,options:a,global:s,pm_root:c});n.profile&&d.warnings.length>0&&b(`profile:extensions parser_warnings=${z(d.warnings)}`),r=d.context.args,a=d.context.options,s=d.context.global,Jn(l,{args:r,path:s.path},a),Ko(A.get(w(i)),r,a,o),Se(void 0),wt({command:i,args:r,options:{...a},global:{...s},pm_root:c});let m=await hn({command:i,args:r,options:a,global:s,pm_root:c,sdk:xl(c,s,i)});if(s.profile&&m.warnings.length>0&&b(`profile:extensions command_handler_warnings=${z(m.warnings)}`),!m.handled)throw m.warnings.length>0?kr(i,m):new R(`Command "${i}" is provided by extensions and is not currently available.`,h.NOT_FOUND);return m.exitCode!==void 0&&(process.exitCode=m.exitCode),Se(m.result),m.result}var tl=Symbol("pm.wrappedActionHandler");function Fp(e,t){let n=e[e.length-1];return n instanceof fi?n:t}function nl(e,t,n){e&&n.length>0&&b(`profile:extensions ${t}=${z(n)}`)}function jp(e){let t=A.get(w(e.commandPath));if(!t||!Bo(e.activeRegistrations,e.commandPath))return;let n=Yt(t).length===0?na(e.commandArgs):Hn(e.commandArgs,e.extensionFlagDefinitions);Vo(t,n)}function Up(e,t,n){e.args=[...n],"_processArguments"in e&&typeof e._processArguments=="function"&&e._processArguments(),t.length>0&&Array.isArray(t[0])&&(t[0]=[...e.processedArgs])}function wi(e,t,n){if(!at(e))return;let o=A.get(w(t))?.read_output_declared===!0;return Xt(n,o)}function El(e){let t=n=>{let o=n;if(Ks(n),typeof o._actionHandler=="function"&&o[tl]!==!0){let i=o._actionHandler;o._actionHandler=async function(...r){let a=Fp(r,n),s=Date.now();Fn(a);let c=Ze(a),l=q(E(a));if(["package inventory","packages inventory","extension inventory"].includes(l))return Ea(l,c.expectHash),await i.apply(this,r);let d=T(process.cwd(),c.path),m=a.args.map(String),p=ce(),u=p?dt(p,l,m):[],f=await yl(l,d),g=wi(a,l,u),y=je(a,m,[...u,...f],g);Js(a,u,l),A.has(w(l))&&delete y.author,g!==void 0&&Bs(y,u,l);let I={args:[...m],path:c.path},x=await Ct({command:l,args:m,options:y,global:c,pm_root:d});nl(c.profile,"parser_warnings",x.warnings),m=x.context.args,y=x.context.options,se(a,y),c=x.context.global,Jn(I,{args:m,path:c.path},y),jp({activeRegistrations:p,commandPath:l,commandArgs:m,extensionFlagDefinitions:u}),c=await Jr(c),It(a,c),Up(a,r,m),Ot(a,y),Se(void 0),wt({command:l,args:m,options:{...y},global:{...c},pm_root:d});let S=await hn({command:l,args:m,options:y,global:c,pm_root:d,sdk:xl(d,c,l)});if(nl(c.profile,"command_handler_warnings",S.warnings),S.handled){Se(S.result),kn(S.result,{...c,command:l,commandArgs:m,commandOptions:y,pmRoot:d}),c.profile&&b(`profile:command=${l} took_ms=${Date.now()-s}`);return}return await i.apply(this,r)},o[tl]=!0}for(let i of n.commands)t(i)};t(e)}async function Qt(e){A=new Map,oe({overrides:[]}),e&&await hi(e.rootProgram,e.pmRoot,e.invocationArgv,Mi(),e.settings)}function qp(e,t,n,o){if(t?.flags&&t.flags.length>0){So(e,t.flags);let i=Ao(e,t.flags);i&&e.addHelpText("after",i)}else n&&e.addHelpText("after",n);t&&at(e)&&e.addHelpText("after",To(t)),o&&e.addHelpText("after",o)}function Hp(e,t,n,o){t&&e.addHelpText("after",t),n&&e.addHelpText("after",To(n)),o&&e.addHelpText("after",o)}function Sl(e,t,n){let o={core:0,standard:1,full:2,internal:3},i=(r,a)=>{let s=a.join(" "),c=[...n.entries()].filter(([d])=>d===s||d.startsWith(`${s} `)).map(([,d])=>d),l=c.length===0?"standard":c.reduce((d,m)=>o[m.tier]<o[d]?m.tier:d,"internal");Mt(r,l);for(let d of r.commands)i(d,[...a,d.name()])};for(let r of e.commands)t.has(r.name())||i(r,[r.name()])}async function Al(e,t){let n=P(t),o=T(process.cwd(),n.path);if(n.noExtensions){await Qt({rootProgram:e,pmRoot:o,invocationArgv:t});return}let i=await an(o),r=Fe(t);if(!i){await Qt();return}if(!lt(i.discovery,r)){await Qt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings}),rn(yi(t),i,r);return}let a=await He(o,r);if(!a){await Qt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings});return}oe(a.services),A=new Map(a.commandDescriptors),await hi(e,o,t,a.registrations,a.settings);let s=Rs(e,a.commandHandlers,a.commandDescriptors,a.commandAliases,d=>Ts(a.activationWarnings,b,d)),c=new Set(e.commands.map(d=>d.name())),l=d=>{let m=d.split(" ").filter(x=>x.length>0),p=a.commandDescriptors.get(d),u=ne(e,m),f=a.commandFlagHelp.get(d),g=p?Ss(p):null;if(u){qp(u,p,f,g);return}let y=As(e,m);p?.description&&y.description(p.description);let I=f;p&&(Cs(y,p),p.flags.length>0&&(So(y,p.flags),I=Ao(y,p.flags)??void 0)),Hp(y,I,p,g),y.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...x)=>{let S=x[x.length-1],$=S instanceof fi?S:y,gt=Ze($),jl=Date.now(),ln=dt(a.registrations,d,$.args.map(String)),xi=je($,$.args.map(String),ln,wi($,d,ln)),ki=await kl($,xi,gt,ln);await Yr(gt,ki),kn(ki,{...gt,command:d,commandArgs:$.args.map(String),commandOptions:xi,pmRoot:o}),gt.profile&&b(`profile:command=${d} took_ms=${Date.now()-jl}`)})};for(let d of s)l(d);Sl(e,c,a.commandDescriptors)}var qe=Ni(import.meta.url,["../.."])??"0.0.0",v=Ln(qe);async function ol(e){if(!U)return;let t=Reflect.get(e,ll);typeof t=="string"&&await da(t)}async function il(e,t,n){let o=E(e);return["item mutate","item complete"].includes(o)&&e.optsWithGlobals().dryRun===!0?t:n()}async function rl(e,t,n){!U||!await Sn(!0)||(In(e,t,n,{source_context:U.source_context,source_context_source:U.source_context_source}),Er(e),nn=U)}async function sn(e,t,n){let o=nn;if(!o)return;nn=null;let i=!1;try{let r=await L(o.global_pm_root);i=r.telemetry.enabled&&r.telemetry.installation_id===o.installation_id}catch{}await Sn(i)?Ar(e,t,n):Sr()}async function Gp(e){let t=await bl(e);return gn(t?.registrations??null),t}function Rl(e,t){t&&mt(t)||(e.hook("preAction",async(n,o)=>{ke=null,U=null,nn=null,bt(),Fn(o);let i=o.optsWithGlobals(),r=Ze(o),a=q(E(o)),s=o.args.map(String),c={args:[...s],path:r.path},l=je(o,s),d={...r},m=T(process.cwd(),r.path),p=await Gp(o);if(ir(a,{...l,...Xr(a,o.processedArgs),outputInclude:i.outputInclude,outputLimit:i.outputLimit,outputBudget:i.outputBudget,outputFormat:i.outputFormat,outputSession:i.outputSession,outputCursor:i.outputCursor}),Wo(o,a,d,l),await il(o,void 0,()=>Pr(a,d)),!p){ke=Ui({commandName:a,commandArgs:s,commandOptions:l,globalOptions:d,pmRoot:m}),U=await $n({command:a,pm_version:qe,args:s,options:l,global:d,pm_root:m}),await ol(e),await rl(a,s,l),await Do(a,l,m,pi()),await $o(a,s,l,d,m),await Kn({command:o,commandPath:a,commandArgs:s,commandOptions:l,expectHash:r.expectHash,pmRoot:m,globalOptions:d});return}Gi(p.hooks),zi(p.commands),Wi(p.parsers),Bi(p.preflight),oe(p.services),Vi(p.renderers),gn(p.registrations);let u=dt(p.registrations,a,s);l=je(o,s,u,wi(o,a,u)),Wo(o,a,d,l);let f=await Ct({command:a,args:s,options:l,global:d,pm_root:p.pmRoot});d.profile&&f.warnings.length>0&&b(`profile:extensions parser_warnings=${z(f.warnings)}`),s=f.context.args,l=f.context.options,se(o,l),d=f.context.global;let g={args:[...s],path:d.path};Ot(o,l);let y=await Yi({command:a,args:s,options:l,global:d,pm_root:p.pmRoot,decision:pi()});d.profile&&y.warnings.length>0&&b(`profile:extensions preflight_warnings=${z(y.warnings)}`),s=y.context.args,l=y.context.options,se(o,l),d=y.context.global,Ot(o,l);let I=y.decision;await Do(a,l,p.pmRoot,I),await $o(a,s,l,d,p.pmRoot),await Kn({command:o,commandPath:a,commandArgs:c.args,commandOptions:l,expectHash:r.expectHash,pmRoot:p.pmRoot,rewritten:Vn(c,[g,{args:s,path:d.path}]),globalOptions:{...d,path:r.path,noExtensions:r.noExtensions}});let x=I.run_extension_migrations?await il(o,[],()=>Cl(p.registrations.migrations,p.pmRoot)):[];d.profile&&x.length>0&&b(`profile:extensions migration_warnings=${z(x)}`);let S=js(p.registrations.migrations);ke={hooks:p.hooks,commandName:a,commandArgs:s,commandOptions:{...l},globalOptions:{...d},pmRoot:p.pmRoot,profileEnabled:!!d.profile,migrationBlockers:S},Se(void 0),wt({command:a,args:s,options:{...l},global:{...d},pm_root:p.pmRoot}),U=await $n({command:a,pm_version:qe,args:s,options:l,global:d,pm_root:p.pmRoot}),await ol(e),await rl(a,s,l);let $=await Li(p.hooks,{command:a,args:s,options:{...l},global:{...d},pm_root:p.pmRoot});d.profile&&$.length>0&&b(`profile:extensions hook_warnings=${z($)}`),I.enforce_mandatory_migration_gate&&Us(a,l,S)}),e.hook("postAction",async()=>{let n=si();await sn(n.ok,n.error,{error_code:n.error_code,error_category:n.error_category,exit_code:n.exit_code,command_resolution:n.command_resolution,resolution_stage:n.resolution_stage}),await ft(n),await Re()}))}Rl(v);var al=Symbol("pmCliIdempotentTopLevelRegistration");function Tl(e){let t=e;if(t[al])return;t[al]=!0;let n=e.command.bind(e);e.command=((o,...i)=>{let r=o.split(/\s+/u)[0];return e.commands.some(a=>a.name()===r||a.aliases().includes(r))?new fi(r):n(o,...i)})}async function zp(e,t){if(Tl(e),t.setup){let{registerSetupCommands:n}=await Sp();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await Ap(),o=typeof t.targetCommandName=="string"&&Jo.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await Rp();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await Tp();n(e)}}function Ue(e){return e.rawInvocationArgv??e.invocationArgv}function Wp(e){return async t=>{let n=ht(t.errorCode),o=Et({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Dr({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:qe,pm_root:e.bootstrapPmRoot,error_code:t.errorCode,error_message:t.errorMessage,exit_code:t.exitCode,error_category:n,command_resolution:o,resolution_stage:t.resolutionStage}),{errorCategory:n,commandResolution:o}}}async function Ol(e){if(e.bootstrapGlobal.noExtensions||mt(e.invocationArgv))return;let t=Fe(e.invocationArgv),n=await an(e.bootstrapPmRoot);if(n&<(n.discovery,t)){let o=await He(e.bootstrapPmRoot,t);Il(o);return}n&&rn(yi(e.invocationArgv),n,t),oe({overrides:[]})}function Il(e){if(!e){oe({overrides:[]});return}oe(e.services)}async function bi(e){await sn(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await ft({ok:!1,error:e.errorMessage,exit_code:e.exitCode,error_code:e.classificationCode,error_category:e.errorCategory,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage})}async function Pl(){await sn(!0,void 0,{exit_code:h.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await ft({ok:!0,exit_code:h.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=h.SUCCESS}async function $l(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof R)&&(Tn(e.error)||!n))return!1;let o=K(me(e.error)),i=e.error instanceof R?e.error.exitCode:Rn(t),r=e.error instanceof R||Cr(e.error)?e.error.context:void 0,a=dl(r,e.invocationArgv,o),s=is(o,a),c=et(e.bootstrapGlobal.lean?Ft(go(o,i,a)):go(o,i,a)),l=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?Z(c,u=>`${JSON.stringify(u,null,2)}
|
|
40
40
|
`):c,null,2):ns(o,a,{lean:e.bootstrapGlobal.lean===!0});e.jsonErrors?ie(`${l}
|
|
41
41
|
`):b(l);let{errorCategory:d,commandResolution:m}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:s.code,errorMessage:s.detail,exitCode:i,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"}),p=await on({command:e.attemptedCommand,error_code:s.code,error_category:d,exit_code:i,error_message:s.detail,command_resolution:m,resolution_stage:"execute",source_context:U?.source_context},e.bootstrapGlobal);return await bi({errorMessage:o,exitCode:i,classificationCode:s.code,errorCategory:d,commandResolution:m,resolutionStage:"execute"}),p&&(Pn(On(e.error,o)),await Re(gi)),process.exitCode=i,!0}async function Dl(e,t){let n=O(e.invocationArgv).commandPathTokens.join(" ")||_o(e.invocationArgv),o=q(n),i=`unknown command '${n}'`,r=T(process.cwd(),e.bootstrapGlobal.path),a=e.bootstrapGlobal.noExtensions?A:await vi(r),s=Fe(e.invocationArgv),c=e.bootstrapGlobal.noExtensions?[]:await Io(r,{},Le(s)),l=await it({message:i},v,a,{failedExtensions:c},Ue(e)),d=ho(l.message,l.commandName,l.allowedTypes,{unknownCommandExamples:l.unknownCommandExamples,unknownCommandNextSteps:l.unknownCommandNextSteps,attemptedCommand:l.attemptedCommand,normalizedInvocationArgs:l.normalizedInvocationArgs,providedOptionFlags:l.providedOptionFlags,unknownOptionSuggestions:l.unknownOptionSuggestions,suggestedRetryCommand:l.suggestedRetryCommand,failedExtensions:c}),{errorCategory:m,commandResolution:p}=await e.emitTelemetryCommandError({command:o,errorCode:d.code,errorMessage:d.detail,exitCode:h.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t??"commander.helpDisplayed"},resolutionStage:"parse"}),u=await on({command:o,error_code:d.code,error_category:m,exit_code:h.USAGE,error_message:d.detail,command_resolution:p,resolution_stage:"parse"},e.bootstrapGlobal),f=e.jsonErrors?await Co({message:i},v,a,e.bootstrapGlobal.lean===!0,{failedExtensions:c},Ue(e)):await bo({message:i},v,a,{failedExtensions:c},Ue(e)),g=yo(f,e.jsonErrors,c);await bi({errorMessage:i,exitCode:h.USAGE,classificationCode:d.code,errorCategory:m,commandResolution:p,resolutionStage:"parse"}),e.jsonErrors?ie(`${Wn(g)}
|
|
42
42
|
`):b(g),u&&await Re(gi),process.exitCode=h.USAGE}async function Nl(e,t,n){if(!(t==="commander.helpDisplayed"||t==="commander.help"||t==="commander.helpCommand")&&!n.includes("(outputHelp)"))return!1;let o=O(e.invocationArgv);return o.requested&&!De(v,o.commandPathTokens)?(await Dl(e,t),!0):(await Pl(),!0)}async function Ml(e,t){let n=await it(e.error,v,A,{},Ue(e)),o=ho(n.message,n.commandName,n.allowedTypes,{unknownCommandExamples:n.unknownCommandExamples,unknownCommandNextSteps:n.unknownCommandNextSteps,attemptedCommand:n.attemptedCommand,normalizedInvocationArgs:n.normalizedInvocationArgs,providedOptionFlags:n.providedOptionFlags,unknownOptionSuggestions:n.unknownOptionSuggestions,suggestedRetryCommand:n.suggestedRetryCommand}),{errorCategory:i,commandResolution:r}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:o.code,errorMessage:o.detail,exitCode:h.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t},resolutionStage:"parse"}),a=await on({command:e.attemptedCommand,error_code:o.code,error_category:i,exit_code:h.USAGE,error_message:o.detail,command_resolution:r,resolution_stage:"parse",source_context:U?.source_context},e.bootstrapGlobal),s=e.jsonErrors?await Co(e.error,v,A,e.bootstrapGlobal.lean===!0,{},Ue(e)):await bo(e.error,v,A,{},Ue(e)),c=await Os(o.code,e.bootstrapPmRoot,{},Le(Fe(e.invocationArgv))),l=yo(s,e.jsonErrors,c);await bi({errorMessage:n.message,exitCode:h.USAGE,classificationCode:o.code,errorCategory:i,commandResolution:r,resolutionStage:"parse"}),e.jsonErrors?ie(`${Wn(l)}
|
|
43
|
-
`):b(l),a&&await Re(gi),process.exitCode=h.USAGE}function Ll(e){if(typeof e!="object"||e===null||!("code"in e))return!1;let t=e.code;return typeof t=="string"&&(t==="commander.version"||t.startsWith("commander."))?!0:String(e.message??"").includes("(outputHelp)")}async function Fl(e){let t=e.error.code,n=String(e.error.message??"");if(!await Nl(e,t,n)){if(t==="commander.version"){await Pl();return}await Ml(e,t)}}async function Ci(e){let t=P(e.invocationArgv),n=T(process.cwd(),t.path),o=ge(e.invocationArgv),i={error:e.error,invocationArgv:o,rawInvocationArgv:e.invocationArgv,bootstrapGlobal:t,jsonErrors:t.json,bootstrapPmRoot:n,attemptedCommand:k(o)??"<unknown>",emitTelemetryCommandError:Wp({invocationArgv:o,bootstrapGlobal:t,bootstrapPmRoot:n})};if(await Ol({invocationArgv:e.invocationArgv,bootstrapGlobal:t,bootstrapPmRoot:n}),!await $l(i,An(e.error))){if(Ll(e.error)){await Fl(i);return}await fl({error:e.error,attemptedCommand:i.attemptedCommand,bootstrapGlobal:t,emitTelemetryCommandError:i.emitTelemetryCommandError})}}function Bp(e,t,n){let o=n.requested?n.commandPathTokens:F(t),i=B(o);if(i&&!ne(e,[...i.canonical_argv]))throw new sl(h.USAGE,"commander.unknownCommand",`unknown command '${i.alias}'`)}function Vp(e,t){let n=D(t);if(n===void 0)return;if(["pm","pm-cli"].includes(t[n]?.trim().toLowerCase())){let a=D(t.slice(n+1));if(a===void 0)return;n+=a+1}let o=tn.get(t[n]),i=t.slice(n).filter(a=>!["--global","--project","--local"].includes(a)),r=o?.find(a=>a.alias.split(" ").every((s,c)=>i[c]===s));r?.lifecycle==="deprecated"&&Reflect.set(e,ll,r.alias)}function Kp(e){return[process.argv[0],process.argv[1]??"pm",...e]}async function Jp(e,t){v=Ln(qe),v.hook("preAction",(r,a)=>{t.configurationOnly=["item mutate","item complete"].includes(E(a))&&a.optsWithGlobals().dryRun===!0}),Rl(v,e),ut=null,xe=null,A=new Map,
|
|
43
|
+
`):b(l),a&&await Re(gi),process.exitCode=h.USAGE}function Ll(e){if(typeof e!="object"||e===null||!("code"in e))return!1;let t=e.code;return typeof t=="string"&&(t==="commander.version"||t.startsWith("commander."))?!0:String(e.message??"").includes("(outputHelp)")}async function Fl(e){let t=e.error.code,n=String(e.error.message??"");if(!await Nl(e,t,n)){if(t==="commander.version"){await Pl();return}await Ml(e,t)}}async function Ci(e){let t=P(e.invocationArgv),n=T(process.cwd(),t.path),o=ge(e.invocationArgv),i={error:e.error,invocationArgv:o,rawInvocationArgv:e.invocationArgv,bootstrapGlobal:t,jsonErrors:t.json,bootstrapPmRoot:n,attemptedCommand:k(o)??"<unknown>",emitTelemetryCommandError:Wp({invocationArgv:o,bootstrapGlobal:t,bootstrapPmRoot:n})};if(await Ol({invocationArgv:e.invocationArgv,bootstrapGlobal:t,bootstrapPmRoot:n}),!await $l(i,An(e.error))){if(Ll(e.error)){await Fl(i);return}await fl({error:e.error,attemptedCommand:i.attemptedCommand,bootstrapGlobal:t,emitTelemetryCommandError:i.emitTelemetryCommandError})}}function Bp(e,t,n){let o=n.requested?n.commandPathTokens:F(t),i=B(o);if(i&&!ne(e,[...i.canonical_argv]))throw new sl(h.USAGE,"commander.unknownCommand",`unknown command '${i.alias}'`)}function Vp(e,t){let n=D(t);if(n===void 0)return;if(["pm","pm-cli"].includes(t[n]?.trim().toLowerCase())){let a=D(t.slice(n+1));if(a===void 0)return;n+=a+1}let o=tn.get(t[n]),i=t.slice(n).filter(a=>!["--global","--project","--local"].includes(a)),r=o?.find(a=>a.alias.split(" ").every((s,c)=>i[c]===s));r?.lifecycle==="deprecated"&&Reflect.set(e,ll,r.alias)}function Kp(e){return[process.argv[0],process.argv[1]??"pm",...e]}async function Jp(e,t){v=Ln(qe),v.hook("preAction",(r,a)=>{t.configurationOnly=["item mutate","item complete"].includes(E(a))&&a.optsWithGlobals().dryRun===!0}),Rl(v,e),ut=null,xe=null,A=new Map,Ki();let n=[...e],o,i;try{let r=Xe(e);n=r.argv,Vp(v,e);let a=Kp(n),s=n.length===0,c=P(n);if(c.authorMissingValue)throw new R("--author requires a non-empty value.",h.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});o=Zr(c.author),ei(r),i=Gr(n);let l=Yo(n);await zp(v,l),ro(v,!0),Zo(v,n)?await Al(v,n):(A=new Map,oe({overrides:[]})),Qo(n)&&await _l(v,n),ro(v);let d=O(n);Bp(v,n,d),Xo(n)&&qa(v,n),El(v);let m=await Lp(d,c);if(await Ns(v,n,m,e))return;if(d.requested&&!De(v,d.commandPathTokens))throw new sl(h.USAGE,"commander.helpDisplayed","(outputHelp)");if(s||re(n)&&k(n)===void 0){v.outputHelp();return}if(mt(n)){await v.parseAsync(a);return}let p=T(process.cwd(),c.path),u=await L(p),f=await gs(n,p,c.noExtensions,He);await Sa(g=>Ur({pmRoot:p,packages:f?.contextIntentPackages},()=>qi({env:{...process.env,PM_PATH:p},argv:a,cwd:process.cwd()},()=>Hi(u.agent_identity.harness_signals,()=>g(()=>v.parseAsync(a)),{probesEnabled:u.agent_identity?.probes_enabled}))))}catch(r){await Ci({error:r,invocationArgv:n})}finally{i?.(),o?.()}}async function _h(e=process.argv.slice(2)){let t=e;try{t=Xe(e).argv}catch{}await Ii([...e,...t],()=>Yp(e,t))}async function Yp(e,t){let n=Xs(t),o={configurationOnly:n!==void 0},i=()=>o.configurationOnly,r=()=>Ca(P(t).json,async()=>{try{await Qr(process.env,()=>Jp(e,o))}catch(a){await Ci({error:a,invocationArgv:[...e]})}});if(n!==void 0){let a=T(process.cwd(),P(t).path),s=T(process.cwd(),n.path),c=Ti(process.cwd());await xt(a,()=>xt(s,()=>xt(c,r,i),i),i)}else await r()}var vh={activationCommandMatchesProbe:Mo,applyDynamicExtensionRootHelpVisibility:Sl,bootstrapProfileEnabled:yi,buildBootstrapActivationProbe:Fe,buildPostActionTelemetryOutcome:si,buildPmCliRecoveryContext:dl,buildRuntimeExtensionDiscoverySnapshotCacheKey:_i,buildRuntimeExtensionActivationScope:ct,buildRuntimeExtensionSnapshotCacheKey:vl,buildRuntimeExtensionFilterForProbe:Ho,addRuntimeFieldOption:mi,collectActivationCommandCandidates:Le,collectExtensionFlagDefinitionsForCommand:Qe,collectExtensionFlagDefinitionsForInvocation:dt,collectLeadingCommandArgs:No,collectParsedActivationCommandArgs:Go,collectRuntimeFieldLooseFlagDefinitionsForCommand:yl,commandHasLongOption:gl,commandHasShortOption:hl,commandPathNeedsSearchExtensions:Lo,commandPathNeedsTemplateExtensions:Vt,describeUnknownError:me,defaultPreflightDecision:pi,discoveryNeedsActivationForProbe:lt,emitExtensionProfile:wl,emitExtensionSkippedProfile:rn,emitSettingsReadWarnings:ui,ensureIdempotentTopLevelCommandRegistration:Tl,enforceExplicitRetryForFlagTypos:ei,envFlagEnabled:pl,executeRegisteredRuntimeMigrations:Cl,extractCommandScopedOptions:je,extensionActivationCommands:Bt,extensionCapabilities:st,extensionNeedsActivationForProbe:Kt,extensionProvidesTemplatesRuntime:jo,hasAnyCapability:Me,hasGlobalExtensionContributions:Uo,handleGenericRunPmCliError:fl,handleRunPmCliCommanderError:Fl,handleRunPmCliError:Ci,handleRunPmCliHelpDisplayError:Nl,handleRunPmCliKnownError:$l,handleRunPmCliCommanderUsageError:Ml,handleUnknownHelpCommandError:Dl,inferMissingFieldsFromErrorMessage:cl,inferPostActionErrorCode:ai,inferPostActionFailureMessage:ri,invocationRequestsVersion:pt,isCommanderError:Tn,loadRuntimeExtensionCommandDescriptorsForRecovery:vi,loadRuntimeExtensionDiscoverySnapshot:an,loadRuntimeExtensionSnapshot:He,maybeLoadRuntimeExtensions:bl,maybeAttachCreateUpdatePolicyHelpText:hi,maybeLogHandledCliErrorToSentry:on,matchesStaticExtensionCommand:Wt,normalizeTelemetryCommandResolution:ni,normalizeTelemetryErrorCategory:ii,normalizeTelemetryResolutionStage:oi,normalizeThrownExitCode:Rn,probeUsesAnyFlag:Fo,prepareExtensionServicesForRunPmCliError:Ol,readRecordBoolean:ti,readRecordNumber:Zt,readRecordString:Ce,recordCliReadOutputInvocationProvenance:zo,registerDynamicExtensionCommandPaths:Al,registerRuntimeSchemaFieldFlags:_l,resolveCoreCommandRegistrationSelection:Yo,resolveStaticExtensionActivationDecision:qo,resolveUnknownHelpToken:_o,readThrownExitCode:An,runAndClearAfterCommandHooks:ft,runRequiredExtensionCommand:kl,shouldAttachRichHelpTextForInvocation:Xo,shouldLogHandledErrorToSentry:ul,shouldRegisterDynamicExtensionPaths:Zo,shouldRegisterRuntimeSchemaFlags:Qo,shouldHandleRunPmCliCommanderError:Ll,setActiveExtensionHookContextForTest:Cp,setActiveRuntimeExtensionCommandDescriptorsForTest:xp,setRecoveredExtensionServices:Il,toLooseFieldDefinitionType:di,isImporterOrExporterCommandPath:Bo,validateDynamicExtensionCommandInvocation:Ko,wrapProgramActionsForExtensionHandlers:El,wrapThrownErrorForSentry:On};export{vh as _testOnly,_h as runPmCli};
|
|
44
44
|
//# sourceMappingURL=main.js.map
|