@unbrained/pm-cli 2026.8.28 → 2026.8.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +30 -0
  3. package/dist/cli-bundle/bundle-manifest.json +125 -125
  4. package/dist/cli-bundle/chunks/{chunk-E73FDIWT.js → chunk-2MKLQL2E.js} +2 -2
  5. package/dist/cli-bundle/chunks/{chunk-NTXZHRKA.js → chunk-2UETTHY6.js} +46 -46
  6. package/dist/cli-bundle/chunks/{chunk-FEVBFFCQ.js → chunk-3TEF3HM5.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-BY2FQ2NI.js → chunk-7SKMLSMX.js} +2 -2
  8. package/dist/cli-bundle/chunks/chunk-7X6OZEIV.js +34 -0
  9. package/dist/cli-bundle/chunks/{chunk-M7OXRQE3.js → chunk-CMIEDWAY.js} +50 -50
  10. package/dist/cli-bundle/chunks/{chunk-XWEQGHHG.js → chunk-GNWPTEBW.js} +64 -61
  11. package/dist/cli-bundle/chunks/{chunk-X2RROGZE.js → chunk-MTTKAUBX.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-N6OR6FAR.js +13 -0
  13. package/dist/cli-bundle/chunks/{chunk-NBCBFVZI.js → chunk-TGNAA66W.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-QE6WQXFO.js → chunk-WS2GJQVG.js} +2 -2
  15. package/dist/cli-bundle/chunks/{register-list-query-J35ZPQQ5.js → register-list-query-OMKJ5ONN.js} +2 -2
  16. package/dist/cli-bundle/chunks/{register-mutation-J6XJJOGU.js → register-mutation-QBSNCOY3.js} +2 -2
  17. package/dist/cli-bundle/chunks/{register-operations-AE3JEMFT.js → register-operations-UC77FQZC.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-setup-OQERLLWE.js → register-setup-GLQ5SYV3.js} +2 -2
  19. package/dist/cli-bundle/focused-chunks/{chunk-HC7ODMH3.js → chunk-3AVAWVZA.js} +2 -2
  20. package/dist/cli-bundle/focused-chunks/chunk-3UMBF26I.js +158 -0
  21. package/dist/cli-bundle/focused-chunks/{chunk-YVVZ3LQ6.js → chunk-73EDXGYE.js} +16 -15
  22. package/dist/cli-bundle/focused-chunks/chunk-AXZ5AJAF.js +50 -0
  23. package/dist/cli-bundle/focused-chunks/{chunk-AHAM2HAU.js → chunk-G6PATS5E.js} +3 -3
  24. package/dist/cli-bundle/focused-chunks/chunk-RKOKG43G.js +2 -0
  25. package/dist/cli-bundle/focused-chunks/chunk-TDK3OCX3.js +2 -0
  26. package/dist/cli-bundle/focused-chunks/{chunk-FC2AXLB5.js → chunk-XXOWRJZ5.js} +2 -2
  27. package/dist/cli-bundle/main.js +2 -2
  28. package/dist/cli-bundle/sdk-contracts.js +1 -1
  29. package/dist/cli-bundle/sdk-core.js +31 -32
  30. package/dist/cli-bundle/sdk-governance.js +1 -1
  31. package/dist/cli-bundle/sdk-graph.js +1 -1
  32. package/dist/cli-bundle/sdk-merge.js +34 -32
  33. package/dist/cli-bundle/sdk-query.js +1 -1
  34. package/dist/cli-bundle/sdk-runtime.js +1 -1
  35. package/dist/cli-bundle/sdk-testing.js +1 -1
  36. package/dist/cli-bundle/sdk.js +8 -8
  37. package/dist/core/diagnostics/remediation.js +16 -6
  38. package/dist/core/history/drift-scan.d.ts +2 -0
  39. package/dist/core/history/drift-scan.js +72 -36
  40. package/dist/core/history/history.d.ts +3 -3
  41. package/dist/core/history/history.js +5 -5
  42. package/dist/core/history/replay.d.ts +1 -1
  43. package/dist/core/history/replay.js +50 -19
  44. package/dist/core/item/actionability.d.ts +7 -1
  45. package/dist/core/item/actionability.js +44 -11
  46. package/dist/core/item/dependency-reference.d.ts +10 -0
  47. package/dist/core/item/dependency-reference.js +21 -0
  48. package/dist/core/item/parse.d.ts +4 -0
  49. package/dist/core/item/parse.js +38 -16
  50. package/dist/core/shared/author.js +69 -17
  51. package/dist/sdk/dependency-provenance.d.ts +51 -2
  52. package/dist/sdk/dependency-provenance.js +91 -7
  53. package/dist/sdk/extension/install-sources.d.ts +1 -7
  54. package/dist/sdk/extension/install-sources.js +94 -33
  55. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +50 -14
  56. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +62 -26
  57. package/dist/sdk/governance/health.js +86 -22
  58. package/dist/sdk/governance/validate-history-drift.js +5 -2
  59. package/dist/sdk/graph/assembly.js +51 -22
  60. package/dist/sdk/history-repair.d.ts +1 -1
  61. package/dist/sdk/history-repair.js +20 -10
  62. package/dist/sdk/lifecycle/create.js +43 -19
  63. package/dist/sdk/linked-artifacts.js +21 -31
  64. package/dist/sdk/merge/reconcile.js +3 -16
  65. package/dist/sdk/query/next.d.ts +6 -0
  66. package/dist/sdk/query/next.js +7 -2
  67. package/dist/sdk/test/entry.d.ts +1 -1
  68. package/dist/sdk/test/entry.js +5 -9
  69. package/dist/sdk/test/execution.d.ts +3 -0
  70. package/dist/sdk/test/execution.js +54 -13
  71. package/docs/CONTEXT_RECOVERY_PRIMITIVES.md +67 -0
  72. package/docs/MERGE_SAFETY.md +23 -10
  73. package/docs/README.md +1 -0
  74. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +10 -4
  75. package/marketplace.json +2 -2
  76. package/package.json +8 -8
  77. package/packages/pm-beads/package.json +1 -1
  78. package/packages/pm-calendar/package.json +1 -1
  79. package/packages/pm-command-kit/package.json +1 -1
  80. package/packages/pm-digital-twin/package.json +1 -1
  81. package/packages/pm-governance-audit/package.json +1 -1
  82. package/packages/pm-guide-shell/package.json +1 -1
  83. package/packages/pm-kanban/package.json +1 -1
  84. package/packages/pm-lifecycle-hooks/package.json +1 -1
  85. package/packages/pm-linked-test-adapters/package.json +1 -1
  86. package/packages/pm-search-advanced/package.json +1 -1
  87. package/packages/pm-templates/package.json +1 -1
  88. package/packages/pm-todos/package.json +1 -1
  89. package/packages/pm-vcs/package.json +1 -1
  90. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  91. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  92. package/sdk/public-surface.json +100 -11
  93. package/dist/cli-bundle/chunks/chunk-TIQ6AMH2.js +0 -13
  94. package/dist/cli-bundle/chunks/chunk-XRVVYRRO.js +0 -35
  95. package/dist/cli-bundle/focused-chunks/chunk-4ZDRZYYJ.js +0 -50
  96. package/dist/cli-bundle/focused-chunks/chunk-XDPYBQCF.js +0 -156
  97. package/dist/cli-bundle/focused-chunks/chunk-Y5A7SJJ7.js +0 -2
  98. package/dist/cli-bundle/focused-chunks/chunk-YJLDHJOD.js +0 -2
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{A as Ht,B as or,C as zt,E as rr,d as Do,h as z,i as Ae,j as P,k as Zo,l as k,m as Qo,r as tt,s as er,t as tr,v as nr,w as Z,x as Ut,y as jt,z as qt}from"./chunks/chunk-X2RROGZE.js";import{A as jo,ab as Xo,f as Uo}from"./chunks/chunk-M7OXRQE3.js";import"./chunks/chunk-E73FDIWT.js";import"./chunks/chunk-NBCBFVZI.js";import{Qb as Bo,Sc as et,Vc as Ko,Wc as Jo,Xc as X,Yc as Yo,pc as Vo}from"./chunks/chunk-XRVVYRRO.js";import{Ea as Go,ma as zo}from"./chunks/chunk-NTXZHRKA.js";import{Fb as Wo}from"./chunks/chunk-TIQ6AMH2.js";import"./chunks/chunk-WYRZZ5ZE.js";import{$ as Bn,Ac as Y,Aj as ke,Bc as mo,C as f,Cc as ze,Cd as Tt,D as vt,Dc as ae,Dj as Po,E as v,Ec as xe,Eg as ko,Fe as A,Fg as Eo,Fm as Qe,G as we,Ge as Ve,Gj as No,Gm as Ft,Hc as po,Hg as Rt,Hm as Dt,Ic as Ge,Ig as y,Im as Se,Jm as $,K as Ct,Kb as Qn,Km as qo,La as Et,Lj as Mt,Lm as Lt,Mj as Mo,Nj as Fo,Oa as J,Oc as At,Pc as We,Qa as Xn,Qc as uo,Ra as He,Rc as fo,Rm as F,Sb as eo,Ua as St,Ub as to,Va as Zn,Vf as wo,Wa as E,Wf as Ot,Za as H,aa as Vn,ai as So,ba as kt,bi as le,c as q,ci as I,cj as Oo,di as Ao,dj as It,dn as Ho,ej as $t,fj as Pt,gc as no,gj as ve,hc as _e,hj as Nt,ia as Kn,ij as Ro,ja as Jn,jc as be,jf as se,jg as _o,jj as Ce,kc as oo,kf as ho,kg as bo,la as Yn,lg as xo,mf as yo,mg as vo,mj as Io,ng as Co,nj as $o,pe as go,pm as Lo,qm as Ze,tc as ro,tf as Ke,uc as io,ui as Je,vc as ao,vi as To,vk as Ye,wc as so,xc as V,xe as Be,xk as Ee,yc as lo,yk as Xe,zc as co}from"./chunks/chunk-XWEQGHHG.js";import{Command as $n,CommanderError as Yl}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]="8eca3029-0d1f-569a-84ce-5ccd0b92a272")}catch{}})();var Sa=new Set(["__proto__","prototype","constructor"]),ir=Symbol("looseOptionOccurrences");function Te(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(n,o)=>o.toUpperCase())}function Aa(e,t,n){let o=e[t];if(o===void 0){e[t]=n;return}if(Array.isArray(o)){o.push(n),e[t]=o;return}e[t]=[o,n]}function Gt(e,t){let n=e[t];if(!n.startsWith("-")||n==="-"||n==="--")return null;if(!n.startsWith("--")){let a=n.indexOf("=");if(a>=0)return{consumed:1,key:n.slice(1,a).trim(),value:n.slice(a+1)};let s=n.slice(1).trim(),l=e[t+1];return typeof l=="string"&&!l.startsWith("-")?{consumed:2,key:s,value:l}:{consumed:1,key:s,value:!0}}let o=n.indexOf("=");if(o>=0)return{consumed:1,key:n.slice(2,o).trim(),value:n.slice(o+1)};if(n.startsWith("--no-"))return{consumed:1,key:n.slice(5).trim(),value:!1};let r=n.slice(2).trim(),i=e[t+1];return typeof i=="string"&&!i.startsWith("-")?{consumed:2,key:r,value:i}:{consumed:1,key:r,value:!0}}function nt(e){return Sa.has(e)}function ar(e){let t=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return Bn(t)}function Oe(e){let t=[],n=typeof e.long=="string"?e.long.trim():"",o=typeof e.short=="string"?e.short.trim():"";if(n.startsWith("--")){let r=Te(n.slice(2));r.length>0&&!nt(r)&&t.push(r)}if(o.startsWith("-")&&!o.startsWith("--")){let r=Te(o.slice(1));r.length>0&&!nt(r)&&t.push(r)}return[...new Set(t)]}function sr(e){let t=new Set;for(let n of e)for(let o of Oe(n))t.add(o);return t}function Ta(e){let t=typeof e.long=="string"?e.long.trim():"";if(t.startsWith("--")){let n=Te(t.slice(2));if(n.length>0&&!nt(n))return n}return Oe(e)[0]??null}function Oa(e){let t=typeof e.long=="string"?e.long.trim():"";if(t.startsWith("--")&&t.length>2)return t;let n=typeof e.short=="string"?e.short.trim():"";return n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function Wt(e,t,n){if(t.length===0)return;let o=new Set,r=new Map,i=[],a=[];for(let s of t){let l=Oe(s),d=Oa(s);d!==null&&a.push(d);for(let c of l)o.add(c),s.enabled===!1&&r.set(c,d);s.required===!0&&s.enabled!==!1&&l.length>0&&i.push({keys:l,label:d})}for(let s of Object.keys(e)){if(!o.has(s)){let d=a.length>0?` Expected one of: ${[...new Set(a)].join(", ")}.`:"";throw new v(`Unknown option '--${s}' for extension command '${n}'.${d}`,f.USAGE)}let l=r.get(s);if(l)throw new v(`Option '${l}' is disabled for extension command '${n}'.`,f.USAGE)}for(let s of i)if(!s.keys.some(l=>Object.hasOwn(e,l)))throw new v(`Missing required option '${s.label}' for extension command '${n}'.`,f.USAGE)}function Ra(e){return typeof e=="string"||e==null?e:String(e)}function Ia(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let t=Number(e);return Number.isFinite(t)?t:e}return e}function $a(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1}return e}var Pa={string:Ra,number:Ia,boolean:$a};function ot(e,t){return Array.isArray(e)?e.map(n=>ot(n,t)):Pa[t](e)}function lr(e,t,n){let o=n?(Array.isArray(e)?e.flat(1/0):[e]).filter(r=>r!=null&&r!==""):Vn(e);return t?o.map(r=>ot(r,t)):o}function Na(e,t,n,o){return n?lr(e,t,o):t?ot(e,t):e}function Ma(e,t,n){let o=e[ir];if(!o||o.length===0)return n;let r=new Set(t);return o.filter(i=>r.has(i.key)).map(i=>i.value)}function cr(e,t,n=e){if(t.length===0)return e;let o=Object.create(null);for(let[r,i]of Object.entries(e))o[r]=i;for(let r of t){let i=Ta(r);if(!i)continue;let a=r.list===!0,s=Oe(r);for(let c of s)if(!(c===i||!Object.hasOwn(o,c))){if(Object.hasOwn(o,i)){if(!a){delete o[c];continue}let m=o[i],p=o[c];o[i]=[...Array.isArray(m)?m:[m],...Array.isArray(p)?p:[p]].filter(u=>u!=null),delete o[c];continue}o[i]=o[c],delete o[c]}let l=ar(r),d=r.repeatable===!0;if(!Object.hasOwn(o,i)){r.default!==void 0&&(o[i]=Na(r.default,l,a,d));continue}if(a){o[i]=lr(Ma(n,s,o[i]),l,d);continue}l&&(o[i]=ot(o[i],l))}return o}function dr(e){let t=Object.create(null),n=[];Object.defineProperty(t,ir,{value:n});let o=0;for(;o<e.length;){let r=Gt(e,o);if(!r){o+=1;continue}let i=Te(r.key);if(i.length===0||nt(i)){o+=r.consumed;continue}Aa(t,i,r.value),n.push({...r,key:i}),o+=r.consumed}return t}function mr(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="--"){t.push(...e.slice(n+1));break}let o=Gt(e,n);if(o){n+=Math.max(1,o.consumed);continue}t.push(e[n]),n+=1}return t}function Bt(e,t){if(t.length===0)return[...e];let n=new Set,o=new Set;for(let a of t){let s=ar(a);for(let l of Oe(a))n.add(l),s==="boolean"&&o.add(l)}if(n.size===0)return[...e];let r=[],i=0;for(;i<e.length;){if(e[i]==="--"){r.push(...e.slice(i+1));break}let a=Gt(e,i);if(a){let s=Te(a.key);if(n.has(s)){let l=e[i],d=o.has(s)&&!l.includes("=")?1:a.consumed;i+=d;continue}}r.push(e[i]),i+=1}return r}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c0186e30-9c25-5539-b778-1ef2ee21764a")}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]="1399e88f-710a-5e5c-b4b3-70e35ec401cf")}catch{}})();var pr=new WeakMap;function ur(e,t){pr.set(e,t)}function Q(e){return pr.get(e)}function fr(e){return e.length>0?[e[0]]:[]}function Fa(e){let t=["","Intent:",` ${e.why}`],n=fr(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(`
2
+ import{A as Ht,B as or,C as zt,E as rr,d as Do,h as z,i as Ae,j as P,k as Zo,l as k,m as Qo,r as tt,s as er,t as tr,v as nr,w as Z,x as Ut,y as jt,z as qt}from"./chunks/chunk-MTTKAUBX.js";import{A as jo,ab as Xo,f as Uo}from"./chunks/chunk-CMIEDWAY.js";import"./chunks/chunk-2MKLQL2E.js";import"./chunks/chunk-TGNAA66W.js";import{Pb as Bo,Rc as et,Uc as Ko,Vc as Jo,Wc as X,Xc as Yo,oc as Vo}from"./chunks/chunk-7X6OZEIV.js";import{Ea as Go,ma as zo}from"./chunks/chunk-2UETTHY6.js";import{Jb as Wo}from"./chunks/chunk-N6OR6FAR.js";import"./chunks/chunk-WYRZZ5ZE.js";import{$ as Bn,Ac as Y,Ak as Xe,Bc as mo,C as f,Cc as ze,Cj as ke,D as vt,Dc as ae,E as v,Ec as xe,Ed as Tt,Fj as Po,G as we,Gg as ko,Hc as po,He as A,Hg as Eo,Hm as Qe,Ic as Ge,Ie as Ve,Ij as No,Im as Ft,Jg as Rt,Jm as Dt,K as Ct,Kb as Qn,Kg as y,Km as Se,La as Et,Lm as $,Mm as qo,Nj as Mt,Nm as Lt,Oa as J,Oc as At,Oj as Mo,Pc as We,Pj as Fo,Qa as Xn,Qc as uo,Ra as He,Rc as fo,Sb as eo,Tm as F,Ua as St,Ub as to,Va as Zn,Wa as E,Xf as wo,Yf as Ot,Za as H,aa as Vn,ba as kt,c as q,ci as So,di as le,ei as I,ej as Oo,fi as Ao,fj as It,fn as Ho,gc as no,gj as $t,hc as _e,hj as Pt,ia as Kn,ij as ve,ja as Jn,jc as be,jj as Nt,kc as oo,kj as Ro,la as Yn,lf as se,lg as _o,lj as Ce,mf as ho,mg as bo,ng as xo,of as yo,og as vo,oj as Io,pg as Co,pj as $o,re as go,rm as Lo,sm as Ze,tc as ro,uc as io,vc as ao,vf as Ke,wc as so,wi as Je,xc as V,xi as To,xk as Ye,yc as lo,zc as co,ze as Be,zk as Ee}from"./chunks/chunk-GNWPTEBW.js";import{Command as $n,CommanderError as Yl}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]="8eca3029-0d1f-569a-84ce-5ccd0b92a272")}catch{}})();var Sa=new Set(["__proto__","prototype","constructor"]),ir=Symbol("looseOptionOccurrences");function Te(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(n,o)=>o.toUpperCase())}function Aa(e,t,n){let o=e[t];if(o===void 0){e[t]=n;return}if(Array.isArray(o)){o.push(n),e[t]=o;return}e[t]=[o,n]}function Gt(e,t){let n=e[t];if(!n.startsWith("-")||n==="-"||n==="--")return null;if(!n.startsWith("--")){let a=n.indexOf("=");if(a>=0)return{consumed:1,key:n.slice(1,a).trim(),value:n.slice(a+1)};let s=n.slice(1).trim(),l=e[t+1];return typeof l=="string"&&!l.startsWith("-")?{consumed:2,key:s,value:l}:{consumed:1,key:s,value:!0}}let o=n.indexOf("=");if(o>=0)return{consumed:1,key:n.slice(2,o).trim(),value:n.slice(o+1)};if(n.startsWith("--no-"))return{consumed:1,key:n.slice(5).trim(),value:!1};let r=n.slice(2).trim(),i=e[t+1];return typeof i=="string"&&!i.startsWith("-")?{consumed:2,key:r,value:i}:{consumed:1,key:r,value:!0}}function nt(e){return Sa.has(e)}function ar(e){let t=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return Bn(t)}function Oe(e){let t=[],n=typeof e.long=="string"?e.long.trim():"",o=typeof e.short=="string"?e.short.trim():"";if(n.startsWith("--")){let r=Te(n.slice(2));r.length>0&&!nt(r)&&t.push(r)}if(o.startsWith("-")&&!o.startsWith("--")){let r=Te(o.slice(1));r.length>0&&!nt(r)&&t.push(r)}return[...new Set(t)]}function sr(e){let t=new Set;for(let n of e)for(let o of Oe(n))t.add(o);return t}function Ta(e){let t=typeof e.long=="string"?e.long.trim():"";if(t.startsWith("--")){let n=Te(t.slice(2));if(n.length>0&&!nt(n))return n}return Oe(e)[0]??null}function Oa(e){let t=typeof e.long=="string"?e.long.trim():"";if(t.startsWith("--")&&t.length>2)return t;let n=typeof e.short=="string"?e.short.trim():"";return n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function Wt(e,t,n){if(t.length===0)return;let o=new Set,r=new Map,i=[],a=[];for(let s of t){let l=Oe(s),d=Oa(s);d!==null&&a.push(d);for(let c of l)o.add(c),s.enabled===!1&&r.set(c,d);s.required===!0&&s.enabled!==!1&&l.length>0&&i.push({keys:l,label:d})}for(let s of Object.keys(e)){if(!o.has(s)){let d=a.length>0?` Expected one of: ${[...new Set(a)].join(", ")}.`:"";throw new v(`Unknown option '--${s}' for extension command '${n}'.${d}`,f.USAGE)}let l=r.get(s);if(l)throw new v(`Option '${l}' is disabled for extension command '${n}'.`,f.USAGE)}for(let s of i)if(!s.keys.some(l=>Object.hasOwn(e,l)))throw new v(`Missing required option '${s.label}' for extension command '${n}'.`,f.USAGE)}function Ra(e){return typeof e=="string"||e==null?e:String(e)}function Ia(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let t=Number(e);return Number.isFinite(t)?t:e}return e}function $a(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1}return e}var Pa={string:Ra,number:Ia,boolean:$a};function ot(e,t){return Array.isArray(e)?e.map(n=>ot(n,t)):Pa[t](e)}function lr(e,t,n){let o=n?(Array.isArray(e)?e.flat(1/0):[e]).filter(r=>r!=null&&r!==""):Vn(e);return t?o.map(r=>ot(r,t)):o}function Na(e,t,n,o){return n?lr(e,t,o):t?ot(e,t):e}function Ma(e,t,n){let o=e[ir];if(!o||o.length===0)return n;let r=new Set(t);return o.filter(i=>r.has(i.key)).map(i=>i.value)}function cr(e,t,n=e){if(t.length===0)return e;let o=Object.create(null);for(let[r,i]of Object.entries(e))o[r]=i;for(let r of t){let i=Ta(r);if(!i)continue;let a=r.list===!0,s=Oe(r);for(let c of s)if(!(c===i||!Object.hasOwn(o,c))){if(Object.hasOwn(o,i)){if(!a){delete o[c];continue}let m=o[i],p=o[c];o[i]=[...Array.isArray(m)?m:[m],...Array.isArray(p)?p:[p]].filter(u=>u!=null),delete o[c];continue}o[i]=o[c],delete o[c]}let l=ar(r),d=r.repeatable===!0;if(!Object.hasOwn(o,i)){r.default!==void 0&&(o[i]=Na(r.default,l,a,d));continue}if(a){o[i]=lr(Ma(n,s,o[i]),l,d);continue}l&&(o[i]=ot(o[i],l))}return o}function dr(e){let t=Object.create(null),n=[];Object.defineProperty(t,ir,{value:n});let o=0;for(;o<e.length;){let r=Gt(e,o);if(!r){o+=1;continue}let i=Te(r.key);if(i.length===0||nt(i)){o+=r.consumed;continue}Aa(t,i,r.value),n.push({...r,key:i}),o+=r.consumed}return t}function mr(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="--"){t.push(...e.slice(n+1));break}let o=Gt(e,n);if(o){n+=Math.max(1,o.consumed);continue}t.push(e[n]),n+=1}return t}function Bt(e,t){if(t.length===0)return[...e];let n=new Set,o=new Set;for(let a of t){let s=ar(a);for(let l of Oe(a))n.add(l),s==="boolean"&&o.add(l)}if(n.size===0)return[...e];let r=[],i=0;for(;i<e.length;){if(e[i]==="--"){r.push(...e.slice(i+1));break}let a=Gt(e,i);if(a){let s=Te(a.key);if(n.has(s)){let l=e[i],d=o.has(s)&&!l.includes("=")?1:a.consumed;i+=d;continue}}r.push(e[i]),i+=1}return r}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c0186e30-9c25-5539-b778-1ef2ee21764a")}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]="1399e88f-710a-5e5c-b4b3-70e35ec401cf")}catch{}})();var pr=new WeakMap;function ur(e,t){pr.set(e,t)}function Q(e){return pr.get(e)}function fr(e){return e.length>0?[e[0]]:[]}function Fa(e){let t=["","Intent:",` ${e.why}`],n=fr(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
3
  `)}function Da(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(`
4
4
  `)}function gr(e,t){return t==="detailed"?Da(e):Fa(e)}function N(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}var La={cal:"calendar",ctx:"context"};function Ua(e,t){return e.commands.find(n=>n.name()===t)??null}function ja(e,t){let n=e;for(let o of t){let r=Ua(n,o);if(!r)return null;n=r}return n}function Vt(e,t,n,o){let r=ja(e,t.split(" ").filter(i=>i.length>0));r&&r.addHelpText("after",gr(n,o))}function Jt(e){return e.includes("--explain")?"detailed":"compact"}function ce(e){return e.includes("--all")||e.includes("--explain")}var hr={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 install ./my-package --project","pm 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 extension explore --project","pm extension manage --global","pm extension describe sample-ext --project","pm extension 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 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 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 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 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 extension init ./my-extension","pm extension init ./my-hook-extension --capability hooks","pm extension init ./my-search-extension --capability search","pm extension init ./my-sync-extension --capability importers","pm extension init ./my-domain-extension --capability schema","pm extension init ./my-output-extension --capability renderers","pm extension --install --project ./my-sync-extension","pm extension --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 extension install ./my-extension --project","pm extension --install --project ./my-extension","pm extension 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 extension doctor --project --detail summary","pm extension doctor --project --detail deep --trace","pm extension 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 extension catalog --project","pm extension 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 install '*' --project","pm install ./packages/pm-todos --project","pm install npm:@scope/pm-package --global","pm 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 upgrade --dry-run","pm upgrade --packages-only --project","pm upgrade todos --dry-run","pm upgrade --cli-only --repair","pm 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."]},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-open --priority 0 --limit 10"]},"list-in-progress":{why:"Tracks active execution and owner progress.",examples:["pm list-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-closed --limit 20 --type Task"]},"list-canceled":{why:"Audits intentionally discontinued work.",examples:["pm list-canceled --limit 20"]},"list-draft":{why:"Finds incompletely defined items that need refinement before execution.",examples:["pm list-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 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?' in one read: the single highest-priority ready item with rationale, plus the ranked ready and blocked queues (project management = context management).",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:"Inspects item mutation timeline and audit trail.",examples:["pm history pm-a1b2 --limit 20","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 "All acceptance criteria met" --message "Close after verification"','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 --message "Claim for implementation"','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 takeover for non-terminal items does not require --force; --force is reserved for terminal/lock overrides.","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 --message "Release after closure"']},"start-task":{why:"Lifecycle alias that claims an item and sets status to in_progress.",examples:['pm start-task pm-a1b2 --message "Start implementation"']},"pause-task":{why:"Lifecycle alias that sets status to open and releases active assignment.",examples:['pm pause-task pm-a1b2 --message "Pause for dependency unblock"']},"close-task":{why:"Lifecycle alias that closes with reason text and clears assignment metadata.",examples:['pm close-task 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."]}},Kt={why:"Provides deterministic project management workflows for humans and coding agents.",examples:["pm init","pm install guide-shell --project","pm list-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."]};function qa(e){let t=N(e??"");return t?La[t]??t:""}function Ha(e){let t=qa(e);return t?hr[t]??Kt:Kt}function yr(e,t){let n=Ha(e);return{intent:n.why,examples:t==="detailed"?[...n.examples]:fr(n.examples),tips:t==="detailed"?[...n.tips??[]]:[],detail_mode:t}}function za(){let e=se.filter(({lifecycle:n})=>n==="permanent"),t=se.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(" ")} (${yo(n)})`)].join(`
5
5
  `)}function Ga(e,t,n,o){let r=new Set(Ko);e.configureHelp({visibleCommands(i){let a=t.visibleCommands(i);return n?a.filter(s=>(Q(s)??X(s.name()))!=="internal"):i!==e?a:a.filter(s=>o.has(s))},visibleOptions(i){let a=t.visibleOptions(i);return i!==e||n?a:a.filter(s=>r.has(s.flags))}})}function Wa(e,t,n,o){let r=new Set(Yo("core")),i=e.createHelp();i.prepareContext({error:!1,helpWidth:80,outputHasColors:!1});let a=()=>`${i.formatHelp(e,i)}${o}
@@ -26,6 +26,6 @@ ${o}`}function hn(e){return P(e).commandPathTokens[0]??k(e)??"<command>"}functio
26
26
  `)}return process.exitCode=f.SUCCESS,!0}function Wl(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(`
27
27
  `)}function Bl(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)":"",r=n.aliases??[];e.push(` - ${n.key}${o}`),e.push(` values: ${n.values.length>0?n.values.join("|"):"any non-empty string"}`),e.push(` aliases: ${r.length>0?r.join("|"):"none"}`),n.description&&n.description.trim().length>0&&e.push(` description: ${n.description.trim()}`)}}function Vl(e,t){let n=e==="create"?new Set(["title","type"]):new Set,o=new Set(n);if(e==="create")for(let r of[...t.required_create_fields,...t.required_create_repeatables])o.add(r);return{progressive:n,strict:o}}function Kl(e,t,n,o){let r=new Set(n),i=o.filter(l=>!r.has(l)),a=l=>l.length>0?l.map(d=>Et("create",d)).join(", "):"none";e.push(` required in strict mode: ${a(i)}`);let s=i.map(Vo).filter(l=>l!==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 Jl(e,t,n){let o=er(n);if(!o)return Wl(e,t);let r=Xn(o,t);if(!r){let w=t.types.join("|");return["",`Type-aware option policies: type "${o}" is not in the active registry.`,` active type values: ${w}`].join(`
28
28
  `)}let i=n.indexOf("--"),a=i<0?n:n.slice(0,i),s=a.findIndex(w=>w==="--create-mode"||w.startsWith("--create-mode=")),l=s<0?void 0:a[s]?.startsWith("--create-mode=")?a[s]?.slice(14):a[s+1],d=e==="create"&&l?.toLowerCase()==="strict",c=Vl(e,r),m=He(r,e,c.progressive),p=He(r,e,d?c.strict:c.progressive),u=w=>w.length>0?w.map(h=>Et(e,h)).join(", "):"none",g=["",`Type-aware option policies for ${r.name}:`,` required: ${u(p.required)}`,` disabled: ${u(p.disabled)}`,` hidden: ${u(p.hidden)}`];if(e==="create"){let w=He(r,e,c.strict);Kl(g,r,m.required,w.required)}return Bl(g,r),p.errors.length>0&&g.push(` config errors: ${p.errors.join("; ")}`),g.join(`
29
- `)}function pi(e,t,n){let o=k(n);if(o!=="create"&&o!=="update")return;let r=Re(e,o);r&&r.addHelpText("after",Jl(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]="fa92f987-990a-5159-8c45-f055d5a15da2")}catch{}})();async function ui(e,t,n,o){if(n)return null;let r=e.some(a=>a==="--for"||a.startsWith("--for=")),i=k(e)==="contracts"&&e.includes("--full");return r||i?await o(t):null}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f947c7f0-adf8-59da-8bc7-9cd746b05839")}catch{}})();var Cn="PM_CLI_PACKAGE_ROOT",ut=Symbol.for("pm.readOutputInvocationProvenance");function Pn(e,t){let n=Reflect.get(e,ut);n!==void 0&&Reflect.set(t,ut,n)}function bi(e,t,n){let o=bo(t,n);if(!o)return;let r=e;for(;r.parent;)r=r.parent;let i=r.rawArgs,a=new Set(K(i.slice(2))),s=_o.find(c=>c.command===o),l=Object.values(s.dimensions).flatMap(c=>c.legacy_aliases.flatMap(m=>a.has(m.flag)?[m.flag]:[])),d=Reflect.get(n,ut);Reflect.set(n,ut,{canonical_include_modes:d?.canonical_include_modes??[],explicit_legacy_aliases:l,cli_invocation_observed:!0}),Pn(n,e)}function Xl(){return Kn(import.meta.url,["../.."])}(typeof process.env[Cn]!="string"||process.env[Cn]?.trim().length===0)&&(process.env[Cn]=Xl());var ge=null,U=null;function Zl(e){ge=e}function Ql(e){O=e}var ec=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"]),tc=new Set(["parse","preflight","execute","unknown"]),nc=new Set(["usage","validation","conflict","runtime","unknown"]),Ne=null,oe=null,O=new Map,Nn=250,oc=new Set([f.USAGE,f.NOT_FOUND,f.CONFLICT]),rc=new Set(["1","true","yes","on"]),ic=ke(()=>import("./chunks/register-setup-OQERLLWE.js")),ac=ke(()=>import("./chunks/register-list-query-J35ZPQQ5.js")),sc=ke(()=>import("./chunks/register-mutation-J6XJJOGU.js")),lc=ke(()=>import("./chunks/register-operations-AE3JEMFT.js"));function pt(e){return A(e)}function xi(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=>ee(o)??o))];return n.length>0?n:void 0}function cc(e,t,n){if(n?.suggested_retry||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let o=K(t),r=new Set(o.map(c=>ee(c)??c)),i=xi(e),a=t.find(c=>b.commands.some(m=>m.name()===c)),s=a?b.commands.find(c=>c.name()===a):void 0,l=new Set([...b.options,...s?.options??[]].flatMap(c=>c.flags.split(/[ ,|]+/).map(m=>ee(m)).filter(m=>m!==void 0))),d=i?.filter(c=>{let m=ee(c)??c;return r.has(m)?!1:l.has(m)||ln(t,a,m,O)!==void 0});return d&&d.length>0?d:void 0}function dc(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let r=n?.[0],i=r?ee(r):void 0,a=e.find(p=>b.commands.some(u=>u.name()===p)),s=a?b.commands.find(p=>p.name()===a):void 0,l=i?s?.options.find(p=>p.flags.split(/[ ,|]+/).includes(i)):void 0,d=ln(e,a,i,O),c=i?l?.isBoolean()===!0||d===!1?[i]:[i,"<value>"]:[],m=i?pt([...e,...c]):t;return m===t?void 0:m}function mc(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 r=e[o];r!=null&&(n[o]=r)}return n}function pc(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,...mc(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function vi(e,t,n){let o=Ve(t),r=o.includes("--explain"),i=e?.recovery,a=i&&o.includes("history-redact")?{...i,...i.attempted_command?{attempted_command:pt(o)}:{},...i.normalized_args?{normalized_args:[...o]}:{},...i.suggested_retry?{suggested_retry:pt(o)}:{},...i.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:i;if(a?.recovery_mode==="compact"&&!r)return{...e,recovery:a};let s=pt(o),l=K(o),d=cc(n,o,a),c=dc(o,s,d,a),m=pc({invocationArgv:o,attemptedCommand:s,providedFields:l,inferredMissing:d,suggestedRetry:c,existingRecovery:a});return{...e,recovery:m}}function fe(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let r=o.trim();if(r.length>0)return r}}}function Ci(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Mn(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 ki(e){if(!e)return;let t=e.trim().toLowerCase();if(ec.has(t))return t}function Ei(e){if(!e)return;let t=e.trim().toLowerCase();if(tc.has(t))return t}function Si(e){if(!e)return;let t=e.trim().toLowerCase();if(nc.has(t))return t}function Ai(e){let t=fe(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let a=n.find(s=>typeof s=="string"&&s.trim().length>0);if(typeof a=="string")return a.trim()}if(Ci(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let r=Mn(e,"failed");if(typeof r=="number"&&r>0)return`failed_runs:${r}`;let i=e?.run_results;if(Array.isArray(i)){let a=i.filter(s=>Ct(s)?.status==="failed").length;if(a>0)return`failed_runs:${a}`}}function Ti(e,t){if(!e)return t===f.USAGE?"invalid_command_usage":t===f.NOT_FOUND?"item_not_found":t===f.CONFLICT?"lock_conflict":t===f.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function Oi(){let e=Ct(xe()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Mn(e,"exit_code","exitCode"),o=t??n??f.SUCCESS,r=Bo(o),i=fe(e,"error_code","errorCode")??Ti(r,o),a=Si(fe(e,"error_category","errorCategory"))??(r?void 0:vt(i)),s=r?void 0:Ai(e)??`command_exit_${o}`,l=ki(fe(e,"command_resolution","commandResolution"))??It({ok:r,errorCode:i,errorCategory:a}),d=Ei(fe(e,"resolution_stage","resolutionStage"))??"execute";return{ok:r,error:s,exit_code:o,error_code:i,error_category:a,command_resolution:l,resolution_stage:d}}async function Le(e){let t=U;U=null,await _r(t,e);let n=ge;if(ge=null,!n){Ge();return}let o=[],r=po();try{await br({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?r?.map(i=>i.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await to(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:xe(),affected:r}))}catch(i){o=[`afterCommand hooks failed: ${i instanceof Error?i.message:String(i)}`]}finally{Ge()}!n.globalOptions.json&&o.length>0&&y(`[pm] warning: afterCommand hook_warnings=${F(o)}`),n.profileEnabled&&o.length>0&&y(`profile:extensions hook_warnings=${F(o)}`)}async function Ri(){await Oo()}function Ii(e){return rc.has((process.env[e]??"").trim().toLowerCase())}function $i(e){return Ii("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!oc.has(Math.trunc(e))}async function ft(e){return $i(e.exit_code)?(await Ri(),Ro(e),!0):!1}async function Pi(e){let t=Z(e.error),n=Nr(t);e.bootstrapGlobal.json?y(JSON.stringify($r(t,f.GENERIC_FAILURE),null,2)):y(t),process.exitCode=f.GENERIC_FAILURE;let o="runtime",r="runtime_failed";try{await Ri(),Nt(e.error);let i=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:f.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=i.errorCategory,r=i.commandResolution,ve(!1,t,{error_code:n.code,error_category:o,exit_code:f.GENERIC_FAILURE,command_resolution:r,resolution_stage:"execute"})}catch(i){e.bootstrapGlobal.json||y(`Failed to report error: ${Z(i)}`)}try{await Le({ok:!1,error:t,exit_code:f.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:r,resolution_stage:"execute"})}catch(i){e.bootstrapGlobal.json||y(`Failed to run error hooks: ${Z(i)}`)}try{await Ce()}catch(i){e.bootstrapGlobal.json||y(`Failed to flush error reporting: ${Z(i)}`)}}function fi(e,t,n,o){bi(e,t,o);let r=n.outputInclude;if(r===void 0)return;let{selectors:i,modes:a}=Co(t,r,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),a.length===0)return;Pn(o,e);let s=vo(t);for(let d of a){let c=s.get(d),m=o[c];e.setOptionValueWithSource(c,m,"cli")}let l=i.length>0?i.join(","):void 0;l===void 0?delete n.outputInclude:n.outputInclude=l;for(let d=e;d;d=d.parent)d.setOptionValueWithSource("outputInclude",l,"cli");Ft(e,n)}function Me(e,t,n=[]){let r={...e.optsWithGlobals()};Pn(e,r),delete r.json,delete r.quiet,delete r.path,delete r.pmPath,delete r.noExtensions,delete r.extensions,delete r.profile,delete r.pager,delete r.changedFields,delete r.fullChangedFields,delete r.idOnly,delete r.lean,delete r.tokenAccounting,delete r.outputInclude,delete r.outputLimit,delete r.outputBudget,delete r.outputFormat,delete r.outputSession;let i=dr(t);for(let[a,s]of Object.entries(i))r[a]===void 0&&(r[a]=s);if(n.length>0){let a=sr(n),s=Ze($(e)).map(d=>({long:d.flag,short:d.short,aliases:d.aliases})),l={...i};for(let d of a)r[d]!==void 0&&(l[d]=r[d]);return Wt(l,[...s,...n],$(e)),cr(r,n,i)}return r}function Sn(e,t){let n=_(t);return n.length===0?[]:e.flags.filter(o=>_(o.target_command)===n).flatMap(o=>o.flags)}function gt(e,t,n){let o=Sn(e,t),r=[t],i=[];for(let a of n){if(a.startsWith("-"))break;r.push(a);let s=Sn(e,r.join(" "));s.length>0&&(i=s)}return i.length>0?i:o}function Fn(e){return e.arguments??[]}function gi(e){let t=Fn(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function Ni(e,t){if(!e)return!1;let n=_(t);return e.importers.some(o=>_(`${o.importer} import`)===n)||e.exporters.some(o=>_(`${o.exporter} export`)===n)}function Mi(e,t){let n=Fn(e),o=n.filter(l=>l.required).length,i=n.some(l=>l.variadic)?Number.POSITIVE_INFINITY:n.length,a=e.failure_hints??[],s=a.length>0?` ${a.join(" ")}`:"";if(t.length<o)throw new v(`Missing required argument for extension command '${e.command}'. Usage: ${gi(e)}${s}`,f.USAGE);if(t.length>i){let l=t.slice(i).join(" ");throw new v(`Too many arguments for extension command '${e.command}': ${l}. Usage: ${gi(e)}${s}`,f.USAGE)}}function uc(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function fc(e,t,n){if(n.length>0){Wt(t,n,e.command);return}let o=Object.keys(t).filter(r=>t[r]!==void 0).sort();if(o.length!==0)throw new v(`Unknown option '${o.map(uc).join(", ")}' for extension command '${e.command}'. This command does not define extension flags.`,f.USAGE)}function Fi(e,t,n,o){e&&(Mi(e,t),fc(e,n,o))}var gc={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"},kn=new Map;function An(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function Di(e,t){return e.options.some(n=>n.long===t)}function Li(e,t){return e.options.some(n=>n.short===t)}function Tn(e,t,n,o){let r=t.trim();if(!r)return;let i=n.length>0?n:`Runtime schema field (${t})`;if(r.startsWith("-")&&!r.startsWith("--")){if(Li(e,r))return;if(o){e.option(`${r} <value>`,`${i} (repeatable)`,Lt);return}e.option(`${r} <value>`,i);return}let a=r.startsWith("--")?r:`--${r}`;if(!Di(e,a)){if(o){e.option(`${a} <value>`,`${i} (repeatable)`,Lt);return}e.option(`${a} <value>`,i)}}async function Ui(e,t){let n=gc[e];if(!n)return[];let o=`${t}:${n}`,r=kn.get(o);if(r)return r;if(!await q(H(t)))return kn.set(o,[]),[];let i=await I(t),s=(Tt(i.schema).command_to_fields.get(n)??[]).flatMap(l=>[l.cli_flag,...l.cli_aliases].map(c=>({long:`--${c}`,type:An(l.type),value_type:An(l.type)})));return kn.set(o,s),s}async function ji(e,t){let n=z(t),o=E(process.cwd(),n.path);if(!await q(H(o)))return;let r=oe?.key===Un(o)?oe.snapshot:null,i=r===null?await I(o):r.settings,a=Tt(i.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 l of s){let d=pe(e,l.path.split(" "));if(d)for(let c of a.command_to_fields.get(l.command)??[]){let m=c.description??"";Tn(d,c.cli_flag,m,c.repeatable);for(let p of c.cli_aliases)Tn(d,p,`Alias for --${c.cli_flag}`,c.repeatable)}}}async function Dn(e,t,n,o,r){let i=k(n);if(!(i!=="create"&&i!=="update"))try{let a=r??await I(t),s=J(a,o);pi(e,s,n)}catch{}}function On(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function qi(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function Ln(e){return e.some(t=>t==="--profile")}function Un(e){return`pm-root:${e}`}function Hi(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=_(n);o.length!==0&&t.push(o)}return t}function Ue(e){let t=_(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(r=>r.length>0);for(let r of Hi(e.commandArgs))o.push(...r.split(" ").filter(i=>i.length>0)),n.push(o.join(" "));return[...new Set(n)]}function zi(e,t){let n=_(e);if(n.length===0)return!1;let o=Ue(t);for(let r of o)if(r===n||r.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(r=>n.startsWith(`${r} `)):!1}function jn(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...S(n.commands),...S(n.command_handlers),...S(n.command_overrides),...S(n.flag_commands),...S(n.parser_overrides),...hi(n.preflight_ownership),...hi(n.renderer_ownership)]:[]}function S(e){return e??[]}function hi(e){return S(e).flatMap(t=>t.commands)}function ht(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var Gi=new Set(["hooks","parser","preflight","renderers"]),Wi=new Set(["commands","schema","services","importers"]),hc=new Set(["reindex","search","search-advanced"]),yc=new Set(["--template"]);function Fe(e,t){for(let n of t)if(e.has(n))return!0;return!1}function Bi(e){let t=_(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return hc.has(n??t)}function Vi(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 qn(e){return _(e.commandPath??"")==="create"&&Vi(e,yc)}function Ki(e){return e.some(t=>{let n=_(t);return n==="templates"||n.startsWith("templates ")})}function Rn(e,t){return e.some(n=>zi(n,t))||qn(t)&&Ki(e)}function Ji(e){return[S(e.hooks).length,(e.preflight_overrides??0)-S(e.preflight_ownership).length,S(e.item_types).length,S(e.item_fields).length,S(e.relationship_kinds).length,S(e.service_overrides).length,S(e.assurance_providers).length,S(e.renderer_overrides).length-S(e.renderer_ownership).length].some(n=>n>0)}function Yi(e,t){let n=e.activation?.commands??[];if(n.length>0)return Rn(n,t);let o=jn(e);if(Rn(o,t)||ht(e).has("search")&&Bi(t.commandPath))return!0;if(e.contributions)return Ji(e.contributions)}function Hn(e,t){let n=Yi(e,t);if(n!==void 0)return n;let o=ht(e);return!!(Fe(o,Gi)||Fe(o,Wi))}function yt(e,t){return e.effective.length===0?!1:_(t.commandPath??"").length>0?e.effective.some(o=>Hn(o,t)):e.effective.some(o=>{let r=ht(o);return jn(o).length>0||Fe(r,Gi)||Fe(r,Wi)||r.has("search")})}function zn(e){let t=Ue(e).filter(r=>r.split(" ").every(i=>!i.startsWith("-"))).sort((r,i)=>i.length-r.length)[0]??_(e.commandPath??"");if(t.length===0)return"all";let n=qn(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function Xi(e){return zn(e)==="all"?void 0:t=>Hn(t,e)}function je(e){let t=P(e);if(t.requested&&t.commandPathTokens.length>0){let[r,...i]=t.commandPathTokens;return{commandPath:r,commandArgs:i,allowCommandPrefixMatch:!0}}let n=Ae(e),o=n.findIndex(r=>r.trim().length>0&&!r.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function Zi(e){let t=e.args.map(String);if(_($(e))==="create"){let o=e.optsWithGlobals();typeof o.template=="string"&&o.template.trim().length>0&&t.push("--template")}return t}function In(e){for(let t of e)t.startsWith("settings_read_")&&y(`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function Qi(e,t){e.profile&&(y(`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&&y(`profile:extensions activation_warnings=${F(t.activationWarnings)}`))}function wt(e,t,n){if(!e)return;let o=_(n.commandPath??"")||"<none>";y(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function _t(e,t=le){let n=Un(e);if(oe?.key===n)return oe.snapshot;try{let o=Date.now(),{settings:r,warnings:i}=await t(e),a=await no({pmRoot:e,settings:r,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:r,discovery:a,discoveryMs:Date.now()-o,settingsReadWarnings:[...i]};return oe={key:n,snapshot:s},s}catch{return oe={key:n,snapshot:null},null}}async function he(e,t,n=I){let o=t?zn(t):"all",r=qi(e,o);if(Ne?.key===r)return Ne.snapshot;try{let i=await n(e),a=await _e({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?Xi(t):void 0}),s=await be({...a,loaded:a.loaded}),l=[...new Set(s.commands.handlers.map(u=>_(u.command)))].filter(u=>u.length>0).sort((u,g)=>u.localeCompare(g)),d=Lr(s.registrations.flags),c=Fr(s.commands.handlers,s.registrations.commands),m=jr(l,s.registrations.commands,s.registrations.flags,c),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:i,commandHandlers:l,commandFlagHelp:d,commandDescriptors:m,commandAliases:c,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:g})=>({name:u,module:g}))};return Ne={key:r,snapshot:p},p}catch{return Ne={key:r,snapshot:null},null}}async function ea(e){let t=Se(e);if(t.noExtensions){let a=E(process.cwd(),t.path);return await q(H(a))&&In((await le(a)).warnings),null}let n=E(process.cwd(),t.path),o=await _t(n);if(!o)return null;In(o.settingsReadWarnings);let r={commandPath:$(e),commandArgs:Zi(e)};if(!yt(o.discovery,r))return wt(t.profile,o,r),null;let i=await he(n,r);return i?(Qi(t,i),{hooks:i.hooks,commands:i.commands,parsers:i.parsers,preflight:i.preflight,services:i.services,renderers:i.renderers,registrations:i.registrations,pmRoot:n}):null}async function ta(e){let t=await he(e);return t?new Map(t.commandDescriptors):O}async function na(e,t){return(await Go({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(o=>o.outcome==="failed").map(o=>`extension_migration_failed:${o.layer}:${o.extension}:${o.id}`)}function oa(e,t){let n=typeof t.author=="string"&&t.author.trim()?t.author.trim():"pm-extension";return Uo(e,Xo.forActiveExtensionHost({pmRoot:e,author:n}))}async function ra(e,t,n,o=[]){let r=$(e),i=Bt(e.args.map(String),o),a={...t},s={...n},l=E(process.cwd(),n.path),d=await We({command:r,args:i,options:a,global:s,pm_root:l});n.profile&&d.warnings.length>0&&y(`profile:extensions parser_warnings=${F(d.warnings)}`),i=d.context.args,a=d.context.options,s=d.context.global,Fi(O.get(_(r)),i,a,o),ae(void 0),ze({command:r,args:i,options:{...a},global:{...s},pm_root:l});let c=await At({command:r,args:i,options:a,global:s,pm_root:l,sdk:oa(l,s)});if(s.profile&&c.warnings.length>0&&y(`profile:extensions command_handler_warnings=${F(c.warnings)}`),!c.handled){if(c.warnings.length>0){let m=c.warnings[0],p=c.errorMessage?.trim(),u=p?` ${p}`:"";throw new v(`Command "${r}" failed in extension handler (${m}).${u}`,f.GENERIC_FAILURE,{code:c.errorCode??"command_failed",nextSteps:c.remediation?[c.remediation]:void 0})}throw new v(`Command "${r}" is provided by extensions and is not currently available.`,f.NOT_FOUND)}return c.exitCode!==void 0&&(process.exitCode=c.exitCode),ae(c.result),c.result}var yi=Symbol("pm.wrappedActionHandler");function wc(e,t){let n=e[e.length-1];return n instanceof $n?n:t}function wi(e,t,n){e&&n.length>0&&y(`profile:extensions ${t}=${F(n)}`)}function _c(e){let t=O.get(_(e.commandPath));if(!t||!Ni(e.activeRegistrations,e.commandPath))return;let n=Fn(t).length===0?mr(e.commandArgs):Bt(e.commandArgs,e.extensionFlagDefinitions);Mi(t,n)}function bc(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 ia(e){let t=n=>{let o=n;if(typeof o._actionHandler=="function"&&o[yi]!==!0){let r=o._actionHandler;o._actionHandler=async function(...a){let s=wc(a,n),l=Date.now();Dt(s);let d=Se(s),c=$(s),m=E(process.cwd(),d.path),p=s.args.map(String),u=Y(),g=u?gt(u,c,p):[],w=await Ui(c,m),h=Me(s,p,[...g,...w]),C=await We({command:c,args:p,options:h,global:d,pm_root:m});wi(d.profile,"parser_warnings",C.warnings),p=C.context.args,h=C.context.options,d=C.context.global,_c({activeRegistrations:u,commandPath:c,commandArgs:p,extensionFlagDefinitions:g}),d=await qo(d),Ft(s,d),bc(s,a,p),Qe(s,h),ae(void 0),ze({command:c,args:p,options:{...h},global:{...d},pm_root:m});let R=await At({command:c,args:p,options:h,global:d,pm_root:m,sdk:oa(m,d)});if(wi(d.profile,"command_handler_warnings",R.warnings),R.handled){ae(R.result),Rt(R.result,{...d,command:c,commandArgs:p,commandOptions:h,pmRoot:m}),d.profile&&y(`profile:command=${c} took_ms=${Date.now()-l}`);return}return await r.apply(this,a)},o[yi]=!0}for(let r of n.commands)t(r)};t(e)}async function mt(e){O=new Map,V({overrides:[]}),e&&await Dn(e.rootProgram,e.pmRoot,e.invocationArgv,Qn(),e.settings)}function xc(e,t,n,o){if(t?.flags&&t.flags.length>0){cn(e,t.flags);let r=dn(e,t.flags);r&&e.addHelpText("after",r)}else n&&e.addHelpText("after",n);o&&e.addHelpText("after",o)}function aa(e,t,n){let o={core:0,standard:1,full:2,internal:3},r=(i,a)=>{let s=a.join(" "),l=[...n.entries()].filter(([c])=>c===s||c.startsWith(`${s} `)).map(([,c])=>c),d=l.length===0?"standard":l.reduce((c,m)=>o[m.tier]<o[c]?m.tier:c,"internal");ur(i,d);for(let c of i.commands)r(c,[...a,c.name()])};for(let i of e.commands)t.has(i.name())||r(i,[i.name()])}async function sa(e,t){let n=z(t),o=E(process.cwd(),n.path);if(n.noExtensions){await mt({rootProgram:e,pmRoot:o,invocationArgv:t});return}let r=await _t(o),i=je(t);if(!r){await mt();return}if(!yt(r.discovery,i)){await mt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:r.settings}),wt(Ln(t),r,i);return}let a=await he(o,i);if(!a){await mt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:r.settings});return}V(a.services),O=new Map(a.commandDescriptors),await Dn(e,o,t,a.registrations,a.settings);let s=Yr(e,a.commandHandlers,a.commandDescriptors,a.commandAliases,c=>Xr(a.activationWarnings,y,c)),l=new Set(e.commands.map(c=>c.name())),d=c=>{let m=c.split(" ").filter(R=>R.length>0),p=a.commandDescriptors.get(c),u=pe(e,m),g=a.commandFlagHelp.get(c),w=p?Vr(p):null;if(u){xc(u,p,g,w);return}let h=Jr(e,m);p?.description&&h.description(p.description);let C=g;p&&(qr(h,p),p.flags.length>0&&(cn(h,p.flags),C=dn(h,p.flags)??void 0)),C&&h.addHelpText("after",C),w&&h.addHelpText("after",w),h.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...R)=>{let j=R[R.length-1],M=j instanceof $n?j:h,re=Se(M),xt=Date.now(),qe=gt(a.registrations,c,M.args.map(String)),ye=Me(M,M.args.map(String),qe),ie=await ra(M,ye,re,qe);await Ho(re,ie),Rt(ie,{...re,command:c,commandArgs:M.args.map(String),commandOptions:ye,pmRoot:o}),re.profile&&y(`profile:command=${c} took_ms=${Date.now()-xt}`)})};for(let c of s)d(c);aa(e,l,a.commandDescriptors)}var De=Jn(import.meta.url,["../.."])??"0.0.0",b=zt(De);function la(e){e.hook("preAction",async(t,n)=>{ge=null,U=null,Ge(),Dt(n);let o=n.optsWithGlobals(),r=Se(n),i=$(n),a=n.args.map(String),s=Me(n,a),l={...r};xo(i,{...s,outputInclude:o.outputInclude,outputLimit:o.outputLimit,outputBudget:o.outputBudget,outputFormat:o.outputFormat,outputSession:o.outputSession,outputCursor:o.outputCursor}),fi(n,i,l,s),await No(i,l);let d=E(process.cwd(),r.path),c=await ea(n);if(!c){ge=oo({commandName:i,commandArgs:a,commandOptions:s,globalOptions:l,pmRoot:d}),U=await Mt({command:i,pm_version:De,args:a,options:s,global:l,pm_root:d}),$t(i,a,s,{source_context:U?.source_context,source_context_source:U?.source_context_source}),Pt(i),await fn(i,s,d,On()),await un(i,a,s,l,d);return}ro(c.hooks),io(c.commands),ao(c.parsers),so(c.preflight),V(c.services),lo(c.renderers),co(c.registrations);let m=gt(c.registrations,i,a);s=Me(n,a,m),fi(n,i,l,s);let p=await We({command:i,args:a,options:s,global:l,pm_root:c.pmRoot});l.profile&&p.warnings.length>0&&y(`profile:extensions parser_warnings=${F(p.warnings)}`),a=p.context.args,s=p.context.options,l=p.context.global,Qe(n,s);let u=await uo({command:i,args:a,options:s,global:l,pm_root:c.pmRoot,decision:On()});l.profile&&u.warnings.length>0&&y(`profile:extensions preflight_warnings=${F(u.warnings)}`),a=u.context.args,s=u.context.options,l=u.context.global,Qe(n,s);let g=u.decision;await fn(i,s,c.pmRoot,g),await un(i,a,s,l,c.pmRoot);let w=g.run_extension_migrations?await na(c.registrations.migrations,c.pmRoot):[];l.profile&&w.length>0&&y(`profile:extensions migration_warnings=${F(w)}`);let h=ei(c.registrations.migrations);ge={hooks:c.hooks,commandName:i,commandArgs:a,commandOptions:{...s},globalOptions:{...l},pmRoot:c.pmRoot,profileEnabled:!!l.profile,migrationBlockers:h},ae(void 0),ze({command:i,args:a,options:{...s},global:{...l},pm_root:c.pmRoot}),U=await Mt({command:i,pm_version:De,args:a,options:s,global:l,pm_root:c.pmRoot}),$t(i,a,s,{source_context:U?.source_context,source_context_source:U?.source_context_source}),Pt(i);let C=await eo(c.hooks,{command:i,args:a,options:{...s},global:{...l},pm_root:c.pmRoot});l.profile&&C.length>0&&y(`profile:extensions hook_warnings=${F(C)}`),g.enforce_mandatory_migration_gate&&ti(i,s,h)}),e.hook("postAction",async()=>{let t=Oi();ve(t.ok,t.error,{error_code:t.error_code,error_category:t.error_category,exit_code:t.exit_code,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage}),await Le(t)})}la(b);var vc=new Set(["--version","-V"]),Cc=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),ca=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"]),da=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","learnings","notes","plan","restore","update","update-many","create"]),kc=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),Ec=new Set(["claim","close-task","pause-task","release","start-task","test"]),En={setup:!0,listQuery:!0,mutation:!0,operation:!0},Sc=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 bt(e){return e.some(t=>vc.has(t))}function ma(e){if(bt(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||P(e).requested)return En;let t=k(e);if(!t)return En;let n=t.trim().toLowerCase();return Cc.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:ca.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:da.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:kc.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:En}function pa(e){return e.length===0||P(e).requested||e.includes("--explain")&&k(e)===void 0}var _i=Symbol("pmCliIdempotentTopLevelRegistration");function ua(e){let t=e;if(t[_i])return;t[_i]=!0;let n=e.command.bind(e);e.command=((o,...r)=>{let i=o.split(/\s+/u)[0];return e.commands.some(a=>a.name()===i||a.aliases().includes(i))?new $n(i):n(o,...r)})}async function Ac(e,t){if(ua(e),t.setup){let{registerSetupCommands:n}=await ic();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await ac(),o=typeof t.targetCommandName=="string"&&ca.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await sc();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await lc();n(e)}}function fa(e,t){return bt(t)?!1:ce(t)||P(t).requested?!0:!!k(t)}function ga(e){if(bt(e))return!1;let t=k(e);return t?Sc.has(t):!1}function Tc(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,r=e.normalizedTokens.map(d=>{let c=d.indexOf("=");return c>=0?d.slice(0,c):d}).find(d=>d==="--literal"||d==="--regex"||d==="--replacement"),i=r?e.argv.map(d=>{let c=d.indexOf("=");return(c>=0?d.slice(0,c):d)===o?c>=0?`${r}${d.slice(c)}`:r:d}):e.argv,a=Ve(i),s=r&&n>=0?`${o}=[redacted]`:t,l=r&&e.normalizedDisplay.includes("=")?`${r}=[redacted]`:e.normalizedDisplay;return{argv:a,normalizedDisplay:l,sourceDisplay:s}}function ha(e){let t=e.commandName;if(!t)return;let n=e.trace.find(d=>d.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(d=>d.length>0),r=o.length>0?o.join(" "):"the canonical flag",i=da.has(t)||Ec.has(t),a=i?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=i?"mutating option":"option",l=Tc({argv:e.argv,normalizedDisplay:r,normalizedTokens:o,rawFrom:n.from});throw new v(`Refusing to auto-correct ${s} ${l.sourceDisplay} to ${l.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,f.USAGE,{code:a,examples:[A(l.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:l.argv,suggested_retry:A(l.argv)}})}function Oc(e){return async t=>{let n=vt(t.errorCode),o=It({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Fo({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:De,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 ya(e){if(e.bootstrapGlobal.noExtensions)return;let t=je(e.invocationArgv),n=await _t(e.bootstrapPmRoot);if(n&&yt(n.discovery,t)){let o=await he(e.bootstrapPmRoot,t);wa(o);return}n&&wt(Ln(e.invocationArgv),n,t),V({overrides:[]})}function wa(e){if(!e){V({overrides:[]});return}V(e.services)}async function Gn(e){ve(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await Le({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 _a(){ve(!0,void 0,{exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await Le({ok:!0,exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=f.SUCCESS}async function ba(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof v)&&(qt(e.error)||!n))return!1;let o=Z(e.error),r=e.error instanceof v?e.error.exitCode:jt(t),i=e.error instanceof v?e.error.context:void 0,a=vi(i,e.invocationArgv,o),s=Rr(o,a),l=e.bootstrapGlobal.lean?at(an(o,r,a)):an(o,r,a),d=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?ko(l,u=>`${JSON.stringify(u,null,2)}
29
+ `)}function pi(e,t,n){let o=k(n);if(o!=="create"&&o!=="update")return;let r=Re(e,o);r&&r.addHelpText("after",Jl(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]="fa92f987-990a-5159-8c45-f055d5a15da2")}catch{}})();async function ui(e,t,n,o){if(n)return null;let r=e.some(a=>a==="--for"||a.startsWith("--for=")),i=k(e)==="contracts"&&e.includes("--full");return r||i?await o(t):null}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f947c7f0-adf8-59da-8bc7-9cd746b05839")}catch{}})();var Cn="PM_CLI_PACKAGE_ROOT",ut=Symbol.for("pm.readOutputInvocationProvenance");function Pn(e,t){let n=Reflect.get(e,ut);n!==void 0&&Reflect.set(t,ut,n)}function bi(e,t,n){let o=bo(t,n);if(!o)return;let r=e;for(;r.parent;)r=r.parent;let i=r.rawArgs,a=new Set(K(i.slice(2))),s=_o.find(c=>c.command===o),l=Object.values(s.dimensions).flatMap(c=>c.legacy_aliases.flatMap(m=>a.has(m.flag)?[m.flag]:[])),d=Reflect.get(n,ut);Reflect.set(n,ut,{canonical_include_modes:d?.canonical_include_modes??[],explicit_legacy_aliases:l,cli_invocation_observed:!0}),Pn(n,e)}function Xl(){return Kn(import.meta.url,["../.."])}(typeof process.env[Cn]!="string"||process.env[Cn]?.trim().length===0)&&(process.env[Cn]=Xl());var ge=null,U=null;function Zl(e){ge=e}function Ql(e){O=e}var ec=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"]),tc=new Set(["parse","preflight","execute","unknown"]),nc=new Set(["usage","validation","conflict","runtime","unknown"]),Ne=null,oe=null,O=new Map,Nn=250,oc=new Set([f.USAGE,f.NOT_FOUND,f.CONFLICT]),rc=new Set(["1","true","yes","on"]),ic=ke(()=>import("./chunks/register-setup-GLQ5SYV3.js")),ac=ke(()=>import("./chunks/register-list-query-OMKJ5ONN.js")),sc=ke(()=>import("./chunks/register-mutation-QBSNCOY3.js")),lc=ke(()=>import("./chunks/register-operations-UC77FQZC.js"));function pt(e){return A(e)}function xi(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=>ee(o)??o))];return n.length>0?n:void 0}function cc(e,t,n){if(n?.suggested_retry||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let o=K(t),r=new Set(o.map(c=>ee(c)??c)),i=xi(e),a=t.find(c=>b.commands.some(m=>m.name()===c)),s=a?b.commands.find(c=>c.name()===a):void 0,l=new Set([...b.options,...s?.options??[]].flatMap(c=>c.flags.split(/[ ,|]+/).map(m=>ee(m)).filter(m=>m!==void 0))),d=i?.filter(c=>{let m=ee(c)??c;return r.has(m)?!1:l.has(m)||ln(t,a,m,O)!==void 0});return d&&d.length>0?d:void 0}function dc(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let r=n?.[0],i=r?ee(r):void 0,a=e.find(p=>b.commands.some(u=>u.name()===p)),s=a?b.commands.find(p=>p.name()===a):void 0,l=i?s?.options.find(p=>p.flags.split(/[ ,|]+/).includes(i)):void 0,d=ln(e,a,i,O),c=i?l?.isBoolean()===!0||d===!1?[i]:[i,"<value>"]:[],m=i?pt([...e,...c]):t;return m===t?void 0:m}function mc(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 r=e[o];r!=null&&(n[o]=r)}return n}function pc(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,...mc(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function vi(e,t,n){let o=Ve(t),r=o.includes("--explain"),i=e?.recovery,a=i&&o.includes("history-redact")?{...i,...i.attempted_command?{attempted_command:pt(o)}:{},...i.normalized_args?{normalized_args:[...o]}:{},...i.suggested_retry?{suggested_retry:pt(o)}:{},...i.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:i;if(a?.recovery_mode==="compact"&&!r)return{...e,recovery:a};let s=pt(o),l=K(o),d=cc(n,o,a),c=dc(o,s,d,a),m=pc({invocationArgv:o,attemptedCommand:s,providedFields:l,inferredMissing:d,suggestedRetry:c,existingRecovery:a});return{...e,recovery:m}}function fe(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let r=o.trim();if(r.length>0)return r}}}function Ci(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Mn(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 ki(e){if(!e)return;let t=e.trim().toLowerCase();if(ec.has(t))return t}function Ei(e){if(!e)return;let t=e.trim().toLowerCase();if(tc.has(t))return t}function Si(e){if(!e)return;let t=e.trim().toLowerCase();if(nc.has(t))return t}function Ai(e){let t=fe(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let a=n.find(s=>typeof s=="string"&&s.trim().length>0);if(typeof a=="string")return a.trim()}if(Ci(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let r=Mn(e,"failed");if(typeof r=="number"&&r>0)return`failed_runs:${r}`;let i=e?.run_results;if(Array.isArray(i)){let a=i.filter(s=>Ct(s)?.status==="failed").length;if(a>0)return`failed_runs:${a}`}}function Ti(e,t){if(!e)return t===f.USAGE?"invalid_command_usage":t===f.NOT_FOUND?"item_not_found":t===f.CONFLICT?"lock_conflict":t===f.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function Oi(){let e=Ct(xe()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Mn(e,"exit_code","exitCode"),o=t??n??f.SUCCESS,r=Bo(o),i=fe(e,"error_code","errorCode")??Ti(r,o),a=Si(fe(e,"error_category","errorCategory"))??(r?void 0:vt(i)),s=r?void 0:Ai(e)??`command_exit_${o}`,l=ki(fe(e,"command_resolution","commandResolution"))??It({ok:r,errorCode:i,errorCategory:a}),d=Ei(fe(e,"resolution_stage","resolutionStage"))??"execute";return{ok:r,error:s,exit_code:o,error_code:i,error_category:a,command_resolution:l,resolution_stage:d}}async function Le(e){let t=U;U=null,await _r(t,e);let n=ge;if(ge=null,!n){Ge();return}let o=[],r=po();try{await br({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?r?.map(i=>i.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await to(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:xe(),affected:r}))}catch(i){o=[`afterCommand hooks failed: ${i instanceof Error?i.message:String(i)}`]}finally{Ge()}!n.globalOptions.json&&o.length>0&&y(`[pm] warning: afterCommand hook_warnings=${F(o)}`),n.profileEnabled&&o.length>0&&y(`profile:extensions hook_warnings=${F(o)}`)}async function Ri(){await Oo()}function Ii(e){return rc.has((process.env[e]??"").trim().toLowerCase())}function $i(e){return Ii("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!oc.has(Math.trunc(e))}async function ft(e){return $i(e.exit_code)?(await Ri(),Ro(e),!0):!1}async function Pi(e){let t=Z(e.error),n=Nr(t);e.bootstrapGlobal.json?y(JSON.stringify($r(t,f.GENERIC_FAILURE),null,2)):y(t),process.exitCode=f.GENERIC_FAILURE;let o="runtime",r="runtime_failed";try{await Ri(),Nt(e.error);let i=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:f.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=i.errorCategory,r=i.commandResolution,ve(!1,t,{error_code:n.code,error_category:o,exit_code:f.GENERIC_FAILURE,command_resolution:r,resolution_stage:"execute"})}catch(i){e.bootstrapGlobal.json||y(`Failed to report error: ${Z(i)}`)}try{await Le({ok:!1,error:t,exit_code:f.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:r,resolution_stage:"execute"})}catch(i){e.bootstrapGlobal.json||y(`Failed to run error hooks: ${Z(i)}`)}try{await Ce()}catch(i){e.bootstrapGlobal.json||y(`Failed to flush error reporting: ${Z(i)}`)}}function fi(e,t,n,o){bi(e,t,o);let r=n.outputInclude;if(r===void 0)return;let{selectors:i,modes:a}=Co(t,r,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),a.length===0)return;Pn(o,e);let s=vo(t);for(let d of a){let c=s.get(d),m=o[c];e.setOptionValueWithSource(c,m,"cli")}let l=i.length>0?i.join(","):void 0;l===void 0?delete n.outputInclude:n.outputInclude=l;for(let d=e;d;d=d.parent)d.setOptionValueWithSource("outputInclude",l,"cli");Ft(e,n)}function Me(e,t,n=[]){let r={...e.optsWithGlobals()};Pn(e,r),delete r.json,delete r.quiet,delete r.path,delete r.pmPath,delete r.noExtensions,delete r.extensions,delete r.profile,delete r.pager,delete r.changedFields,delete r.fullChangedFields,delete r.idOnly,delete r.lean,delete r.tokenAccounting,delete r.outputInclude,delete r.outputLimit,delete r.outputBudget,delete r.outputFormat,delete r.outputSession;let i=dr(t);for(let[a,s]of Object.entries(i))r[a]===void 0&&(r[a]=s);if(n.length>0){let a=sr(n),s=Ze($(e)).map(d=>({long:d.flag,short:d.short,aliases:d.aliases})),l={...i};for(let d of a)r[d]!==void 0&&(l[d]=r[d]);return Wt(l,[...s,...n],$(e)),cr(r,n,i)}return r}function Sn(e,t){let n=_(t);return n.length===0?[]:e.flags.filter(o=>_(o.target_command)===n).flatMap(o=>o.flags)}function gt(e,t,n){let o=Sn(e,t),r=[t],i=[];for(let a of n){if(a.startsWith("-"))break;r.push(a);let s=Sn(e,r.join(" "));s.length>0&&(i=s)}return i.length>0?i:o}function Fn(e){return e.arguments??[]}function gi(e){let t=Fn(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function Ni(e,t){if(!e)return!1;let n=_(t);return e.importers.some(o=>_(`${o.importer} import`)===n)||e.exporters.some(o=>_(`${o.exporter} export`)===n)}function Mi(e,t){let n=Fn(e),o=n.filter(l=>l.required).length,i=n.some(l=>l.variadic)?Number.POSITIVE_INFINITY:n.length,a=e.failure_hints??[],s=a.length>0?` ${a.join(" ")}`:"";if(t.length<o)throw new v(`Missing required argument for extension command '${e.command}'. Usage: ${gi(e)}${s}`,f.USAGE);if(t.length>i){let l=t.slice(i).join(" ");throw new v(`Too many arguments for extension command '${e.command}': ${l}. Usage: ${gi(e)}${s}`,f.USAGE)}}function uc(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function fc(e,t,n){if(n.length>0){Wt(t,n,e.command);return}let o=Object.keys(t).filter(r=>t[r]!==void 0).sort();if(o.length!==0)throw new v(`Unknown option '${o.map(uc).join(", ")}' for extension command '${e.command}'. This command does not define extension flags.`,f.USAGE)}function Fi(e,t,n,o){e&&(Mi(e,t),fc(e,n,o))}var gc={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"},kn=new Map;function An(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function Di(e,t){return e.options.some(n=>n.long===t)}function Li(e,t){return e.options.some(n=>n.short===t)}function Tn(e,t,n,o){let r=t.trim();if(!r)return;let i=n.length>0?n:`Runtime schema field (${t})`;if(r.startsWith("-")&&!r.startsWith("--")){if(Li(e,r))return;if(o){e.option(`${r} <value>`,`${i} (repeatable)`,Lt);return}e.option(`${r} <value>`,i);return}let a=r.startsWith("--")?r:`--${r}`;if(!Di(e,a)){if(o){e.option(`${a} <value>`,`${i} (repeatable)`,Lt);return}e.option(`${a} <value>`,i)}}async function Ui(e,t){let n=gc[e];if(!n)return[];let o=`${t}:${n}`,r=kn.get(o);if(r)return r;if(!await q(H(t)))return kn.set(o,[]),[];let i=await I(t),s=(Tt(i.schema).command_to_fields.get(n)??[]).flatMap(l=>[l.cli_flag,...l.cli_aliases].map(c=>({long:`--${c}`,type:An(l.type),value_type:An(l.type)})));return kn.set(o,s),s}async function ji(e,t){let n=z(t),o=E(process.cwd(),n.path);if(!await q(H(o)))return;let r=oe?.key===Un(o)?oe.snapshot:null,i=r===null?await I(o):r.settings,a=Tt(i.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 l of s){let d=pe(e,l.path.split(" "));if(d)for(let c of a.command_to_fields.get(l.command)??[]){let m=c.description??"";Tn(d,c.cli_flag,m,c.repeatable);for(let p of c.cli_aliases)Tn(d,p,`Alias for --${c.cli_flag}`,c.repeatable)}}}async function Dn(e,t,n,o,r){let i=k(n);if(!(i!=="create"&&i!=="update"))try{let a=r??await I(t),s=J(a,o);pi(e,s,n)}catch{}}function On(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function qi(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function Ln(e){return e.some(t=>t==="--profile")}function Un(e){return`pm-root:${e}`}function Hi(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=_(n);o.length!==0&&t.push(o)}return t}function Ue(e){let t=_(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(r=>r.length>0);for(let r of Hi(e.commandArgs))o.push(...r.split(" ").filter(i=>i.length>0)),n.push(o.join(" "));return[...new Set(n)]}function zi(e,t){let n=_(e);if(n.length===0)return!1;let o=Ue(t);for(let r of o)if(r===n||r.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(r=>n.startsWith(`${r} `)):!1}function jn(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...S(n.commands),...S(n.command_handlers),...S(n.command_overrides),...S(n.flag_commands),...S(n.parser_overrides),...hi(n.preflight_ownership),...hi(n.renderer_ownership)]:[]}function S(e){return e??[]}function hi(e){return S(e).flatMap(t=>t.commands)}function ht(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var Gi=new Set(["hooks","parser","preflight","renderers"]),Wi=new Set(["commands","schema","services","importers"]),hc=new Set(["reindex","search","search-advanced"]),yc=new Set(["--template"]);function Fe(e,t){for(let n of t)if(e.has(n))return!0;return!1}function Bi(e){let t=_(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return hc.has(n??t)}function Vi(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 qn(e){return _(e.commandPath??"")==="create"&&Vi(e,yc)}function Ki(e){return e.some(t=>{let n=_(t);return n==="templates"||n.startsWith("templates ")})}function Rn(e,t){return e.some(n=>zi(n,t))||qn(t)&&Ki(e)}function Ji(e){return[S(e.hooks).length,(e.preflight_overrides??0)-S(e.preflight_ownership).length,S(e.item_types).length,S(e.item_fields).length,S(e.relationship_kinds).length,S(e.service_overrides).length,S(e.assurance_providers).length,S(e.renderer_overrides).length-S(e.renderer_ownership).length].some(n=>n>0)}function Yi(e,t){let n=e.activation?.commands??[];if(n.length>0)return Rn(n,t);let o=jn(e);if(Rn(o,t)||ht(e).has("search")&&Bi(t.commandPath))return!0;if(e.contributions)return Ji(e.contributions)}function Hn(e,t){let n=Yi(e,t);if(n!==void 0)return n;let o=ht(e);return!!(Fe(o,Gi)||Fe(o,Wi))}function yt(e,t){return e.effective.length===0?!1:_(t.commandPath??"").length>0?e.effective.some(o=>Hn(o,t)):e.effective.some(o=>{let r=ht(o);return jn(o).length>0||Fe(r,Gi)||Fe(r,Wi)||r.has("search")})}function zn(e){let t=Ue(e).filter(r=>r.split(" ").every(i=>!i.startsWith("-"))).sort((r,i)=>i.length-r.length)[0]??_(e.commandPath??"");if(t.length===0)return"all";let n=qn(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function Xi(e){return zn(e)==="all"?void 0:t=>Hn(t,e)}function je(e){let t=P(e);if(t.requested&&t.commandPathTokens.length>0){let[r,...i]=t.commandPathTokens;return{commandPath:r,commandArgs:i,allowCommandPrefixMatch:!0}}let n=Ae(e),o=n.findIndex(r=>r.trim().length>0&&!r.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function Zi(e){let t=e.args.map(String);if(_($(e))==="create"){let o=e.optsWithGlobals();typeof o.template=="string"&&o.template.trim().length>0&&t.push("--template")}return t}function In(e){for(let t of e)t.startsWith("settings_read_")&&y(`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function Qi(e,t){e.profile&&(y(`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&&y(`profile:extensions activation_warnings=${F(t.activationWarnings)}`))}function wt(e,t,n){if(!e)return;let o=_(n.commandPath??"")||"<none>";y(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function _t(e,t=le){let n=Un(e);if(oe?.key===n)return oe.snapshot;try{let o=Date.now(),{settings:r,warnings:i}=await t(e),a=await no({pmRoot:e,settings:r,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:r,discovery:a,discoveryMs:Date.now()-o,settingsReadWarnings:[...i]};return oe={key:n,snapshot:s},s}catch{return oe={key:n,snapshot:null},null}}async function he(e,t,n=I){let o=t?zn(t):"all",r=qi(e,o);if(Ne?.key===r)return Ne.snapshot;try{let i=await n(e),a=await _e({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?Xi(t):void 0}),s=await be({...a,loaded:a.loaded}),l=[...new Set(s.commands.handlers.map(u=>_(u.command)))].filter(u=>u.length>0).sort((u,g)=>u.localeCompare(g)),d=Lr(s.registrations.flags),c=Fr(s.commands.handlers,s.registrations.commands),m=jr(l,s.registrations.commands,s.registrations.flags,c),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:i,commandHandlers:l,commandFlagHelp:d,commandDescriptors:m,commandAliases:c,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:g})=>({name:u,module:g}))};return Ne={key:r,snapshot:p},p}catch{return Ne={key:r,snapshot:null},null}}async function ea(e){let t=Se(e);if(t.noExtensions){let a=E(process.cwd(),t.path);return await q(H(a))&&In((await le(a)).warnings),null}let n=E(process.cwd(),t.path),o=await _t(n);if(!o)return null;In(o.settingsReadWarnings);let r={commandPath:$(e),commandArgs:Zi(e)};if(!yt(o.discovery,r))return wt(t.profile,o,r),null;let i=await he(n,r);return i?(Qi(t,i),{hooks:i.hooks,commands:i.commands,parsers:i.parsers,preflight:i.preflight,services:i.services,renderers:i.renderers,registrations:i.registrations,pmRoot:n}):null}async function ta(e){let t=await he(e);return t?new Map(t.commandDescriptors):O}async function na(e,t){return(await Go({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(o=>o.outcome==="failed").map(o=>`extension_migration_failed:${o.layer}:${o.extension}:${o.id}`)}function oa(e,t){let n=typeof t.author=="string"&&t.author.trim()?t.author.trim():"pm-extension";return Uo(e,Xo.forActiveExtensionHost({pmRoot:e,author:n}))}async function ra(e,t,n,o=[]){let r=$(e),i=Bt(e.args.map(String),o),a={...t},s={...n},l=E(process.cwd(),n.path),d=await We({command:r,args:i,options:a,global:s,pm_root:l});n.profile&&d.warnings.length>0&&y(`profile:extensions parser_warnings=${F(d.warnings)}`),i=d.context.args,a=d.context.options,s=d.context.global,Fi(O.get(_(r)),i,a,o),ae(void 0),ze({command:r,args:i,options:{...a},global:{...s},pm_root:l});let c=await At({command:r,args:i,options:a,global:s,pm_root:l,sdk:oa(l,s)});if(s.profile&&c.warnings.length>0&&y(`profile:extensions command_handler_warnings=${F(c.warnings)}`),!c.handled){if(c.warnings.length>0){let m=c.warnings[0],p=c.errorMessage?.trim(),u=p?` ${p}`:"";throw new v(`Command "${r}" failed in extension handler (${m}).${u}`,f.GENERIC_FAILURE,{code:c.errorCode??"command_failed",nextSteps:c.remediation?[c.remediation]:void 0})}throw new v(`Command "${r}" is provided by extensions and is not currently available.`,f.NOT_FOUND)}return c.exitCode!==void 0&&(process.exitCode=c.exitCode),ae(c.result),c.result}var yi=Symbol("pm.wrappedActionHandler");function wc(e,t){let n=e[e.length-1];return n instanceof $n?n:t}function wi(e,t,n){e&&n.length>0&&y(`profile:extensions ${t}=${F(n)}`)}function _c(e){let t=O.get(_(e.commandPath));if(!t||!Ni(e.activeRegistrations,e.commandPath))return;let n=Fn(t).length===0?mr(e.commandArgs):Bt(e.commandArgs,e.extensionFlagDefinitions);Mi(t,n)}function bc(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 ia(e){let t=n=>{let o=n;if(typeof o._actionHandler=="function"&&o[yi]!==!0){let r=o._actionHandler;o._actionHandler=async function(...a){let s=wc(a,n),l=Date.now();Dt(s);let d=Se(s),c=$(s),m=E(process.cwd(),d.path),p=s.args.map(String),u=Y(),g=u?gt(u,c,p):[],w=await Ui(c,m),h=Me(s,p,[...g,...w]),C=await We({command:c,args:p,options:h,global:d,pm_root:m});wi(d.profile,"parser_warnings",C.warnings),p=C.context.args,h=C.context.options,d=C.context.global,_c({activeRegistrations:u,commandPath:c,commandArgs:p,extensionFlagDefinitions:g}),d=await qo(d),Ft(s,d),bc(s,a,p),Qe(s,h),ae(void 0),ze({command:c,args:p,options:{...h},global:{...d},pm_root:m});let R=await At({command:c,args:p,options:h,global:d,pm_root:m,sdk:oa(m,d)});if(wi(d.profile,"command_handler_warnings",R.warnings),R.handled){ae(R.result),Rt(R.result,{...d,command:c,commandArgs:p,commandOptions:h,pmRoot:m}),d.profile&&y(`profile:command=${c} took_ms=${Date.now()-l}`);return}return await r.apply(this,a)},o[yi]=!0}for(let r of n.commands)t(r)};t(e)}async function mt(e){O=new Map,V({overrides:[]}),e&&await Dn(e.rootProgram,e.pmRoot,e.invocationArgv,Qn(),e.settings)}function xc(e,t,n,o){if(t?.flags&&t.flags.length>0){cn(e,t.flags);let r=dn(e,t.flags);r&&e.addHelpText("after",r)}else n&&e.addHelpText("after",n);o&&e.addHelpText("after",o)}function aa(e,t,n){let o={core:0,standard:1,full:2,internal:3},r=(i,a)=>{let s=a.join(" "),l=[...n.entries()].filter(([c])=>c===s||c.startsWith(`${s} `)).map(([,c])=>c),d=l.length===0?"standard":l.reduce((c,m)=>o[m.tier]<o[c]?m.tier:c,"internal");ur(i,d);for(let c of i.commands)r(c,[...a,c.name()])};for(let i of e.commands)t.has(i.name())||r(i,[i.name()])}async function sa(e,t){let n=z(t),o=E(process.cwd(),n.path);if(n.noExtensions){await mt({rootProgram:e,pmRoot:o,invocationArgv:t});return}let r=await _t(o),i=je(t);if(!r){await mt();return}if(!yt(r.discovery,i)){await mt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:r.settings}),wt(Ln(t),r,i);return}let a=await he(o,i);if(!a){await mt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:r.settings});return}V(a.services),O=new Map(a.commandDescriptors),await Dn(e,o,t,a.registrations,a.settings);let s=Yr(e,a.commandHandlers,a.commandDescriptors,a.commandAliases,c=>Xr(a.activationWarnings,y,c)),l=new Set(e.commands.map(c=>c.name())),d=c=>{let m=c.split(" ").filter(R=>R.length>0),p=a.commandDescriptors.get(c),u=pe(e,m),g=a.commandFlagHelp.get(c),w=p?Vr(p):null;if(u){xc(u,p,g,w);return}let h=Jr(e,m);p?.description&&h.description(p.description);let C=g;p&&(qr(h,p),p.flags.length>0&&(cn(h,p.flags),C=dn(h,p.flags)??void 0)),C&&h.addHelpText("after",C),w&&h.addHelpText("after",w),h.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...R)=>{let j=R[R.length-1],M=j instanceof $n?j:h,re=Se(M),xt=Date.now(),qe=gt(a.registrations,c,M.args.map(String)),ye=Me(M,M.args.map(String),qe),ie=await ra(M,ye,re,qe);await Ho(re,ie),Rt(ie,{...re,command:c,commandArgs:M.args.map(String),commandOptions:ye,pmRoot:o}),re.profile&&y(`profile:command=${c} took_ms=${Date.now()-xt}`)})};for(let c of s)d(c);aa(e,l,a.commandDescriptors)}var De=Jn(import.meta.url,["../.."])??"0.0.0",b=zt(De);function la(e){e.hook("preAction",async(t,n)=>{ge=null,U=null,Ge(),Dt(n);let o=n.optsWithGlobals(),r=Se(n),i=$(n),a=n.args.map(String),s=Me(n,a),l={...r};xo(i,{...s,outputInclude:o.outputInclude,outputLimit:o.outputLimit,outputBudget:o.outputBudget,outputFormat:o.outputFormat,outputSession:o.outputSession,outputCursor:o.outputCursor}),fi(n,i,l,s),await No(i,l);let d=E(process.cwd(),r.path),c=await ea(n);if(!c){ge=oo({commandName:i,commandArgs:a,commandOptions:s,globalOptions:l,pmRoot:d}),U=await Mt({command:i,pm_version:De,args:a,options:s,global:l,pm_root:d}),$t(i,a,s,{source_context:U?.source_context,source_context_source:U?.source_context_source}),Pt(i),await fn(i,s,d,On()),await un(i,a,s,l,d);return}ro(c.hooks),io(c.commands),ao(c.parsers),so(c.preflight),V(c.services),lo(c.renderers),co(c.registrations);let m=gt(c.registrations,i,a);s=Me(n,a,m),fi(n,i,l,s);let p=await We({command:i,args:a,options:s,global:l,pm_root:c.pmRoot});l.profile&&p.warnings.length>0&&y(`profile:extensions parser_warnings=${F(p.warnings)}`),a=p.context.args,s=p.context.options,l=p.context.global,Qe(n,s);let u=await uo({command:i,args:a,options:s,global:l,pm_root:c.pmRoot,decision:On()});l.profile&&u.warnings.length>0&&y(`profile:extensions preflight_warnings=${F(u.warnings)}`),a=u.context.args,s=u.context.options,l=u.context.global,Qe(n,s);let g=u.decision;await fn(i,s,c.pmRoot,g),await un(i,a,s,l,c.pmRoot);let w=g.run_extension_migrations?await na(c.registrations.migrations,c.pmRoot):[];l.profile&&w.length>0&&y(`profile:extensions migration_warnings=${F(w)}`);let h=ei(c.registrations.migrations);ge={hooks:c.hooks,commandName:i,commandArgs:a,commandOptions:{...s},globalOptions:{...l},pmRoot:c.pmRoot,profileEnabled:!!l.profile,migrationBlockers:h},ae(void 0),ze({command:i,args:a,options:{...s},global:{...l},pm_root:c.pmRoot}),U=await Mt({command:i,pm_version:De,args:a,options:s,global:l,pm_root:c.pmRoot}),$t(i,a,s,{source_context:U?.source_context,source_context_source:U?.source_context_source}),Pt(i);let C=await eo(c.hooks,{command:i,args:a,options:{...s},global:{...l},pm_root:c.pmRoot});l.profile&&C.length>0&&y(`profile:extensions hook_warnings=${F(C)}`),g.enforce_mandatory_migration_gate&&ti(i,s,h)}),e.hook("postAction",async()=>{let t=Oi();ve(t.ok,t.error,{error_code:t.error_code,error_category:t.error_category,exit_code:t.exit_code,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage}),await Le(t)})}la(b);var vc=new Set(["--version","-V"]),Cc=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),ca=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"]),da=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","learnings","notes","plan","restore","update","update-many","create"]),kc=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),Ec=new Set(["claim","close-task","pause-task","release","start-task","test"]),En={setup:!0,listQuery:!0,mutation:!0,operation:!0},Sc=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 bt(e){return e.some(t=>vc.has(t))}function ma(e){if(bt(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||P(e).requested)return En;let t=k(e);if(!t)return En;let n=t.trim().toLowerCase();return Cc.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:ca.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:da.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:kc.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:En}function pa(e){return e.length===0||P(e).requested||e.includes("--explain")&&k(e)===void 0}var _i=Symbol("pmCliIdempotentTopLevelRegistration");function ua(e){let t=e;if(t[_i])return;t[_i]=!0;let n=e.command.bind(e);e.command=((o,...r)=>{let i=o.split(/\s+/u)[0];return e.commands.some(a=>a.name()===i||a.aliases().includes(i))?new $n(i):n(o,...r)})}async function Ac(e,t){if(ua(e),t.setup){let{registerSetupCommands:n}=await ic();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await ac(),o=typeof t.targetCommandName=="string"&&ca.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await sc();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await lc();n(e)}}function fa(e,t){return bt(t)?!1:ce(t)||P(t).requested?!0:!!k(t)}function ga(e){if(bt(e))return!1;let t=k(e);return t?Sc.has(t):!1}function Tc(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,r=e.normalizedTokens.map(d=>{let c=d.indexOf("=");return c>=0?d.slice(0,c):d}).find(d=>d==="--literal"||d==="--regex"||d==="--replacement"),i=r?e.argv.map(d=>{let c=d.indexOf("=");return(c>=0?d.slice(0,c):d)===o?c>=0?`${r}${d.slice(c)}`:r:d}):e.argv,a=Ve(i),s=r&&n>=0?`${o}=[redacted]`:t,l=r&&e.normalizedDisplay.includes("=")?`${r}=[redacted]`:e.normalizedDisplay;return{argv:a,normalizedDisplay:l,sourceDisplay:s}}function ha(e){let t=e.commandName;if(!t)return;let n=e.trace.find(d=>d.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(d=>d.length>0),r=o.length>0?o.join(" "):"the canonical flag",i=da.has(t)||Ec.has(t),a=i?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=i?"mutating option":"option",l=Tc({argv:e.argv,normalizedDisplay:r,normalizedTokens:o,rawFrom:n.from});throw new v(`Refusing to auto-correct ${s} ${l.sourceDisplay} to ${l.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,f.USAGE,{code:a,examples:[A(l.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:l.argv,suggested_retry:A(l.argv)}})}function Oc(e){return async t=>{let n=vt(t.errorCode),o=It({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Fo({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:De,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 ya(e){if(e.bootstrapGlobal.noExtensions)return;let t=je(e.invocationArgv),n=await _t(e.bootstrapPmRoot);if(n&&yt(n.discovery,t)){let o=await he(e.bootstrapPmRoot,t);wa(o);return}n&&wt(Ln(e.invocationArgv),n,t),V({overrides:[]})}function wa(e){if(!e){V({overrides:[]});return}V(e.services)}async function Gn(e){ve(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await Le({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 _a(){ve(!0,void 0,{exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await Le({ok:!0,exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=f.SUCCESS}async function ba(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof v)&&(qt(e.error)||!n))return!1;let o=Z(e.error),r=e.error instanceof v?e.error.exitCode:jt(t),i=e.error instanceof v?e.error.context:void 0,a=vi(i,e.invocationArgv,o),s=Rr(o,a),l=e.bootstrapGlobal.lean?at(an(o,r,a)):an(o,r,a),d=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?ko(l,u=>`${JSON.stringify(u,null,2)}
30
30
  `):l,null,2):Or(o,a);y(d);let{errorCategory:c,commandResolution:m}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:s.code,errorMessage:s.detail,exitCode:r,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"}),p=await ft({command:e.attemptedCommand,error_code:s.code,error_category:c,exit_code:r,error_message:s.detail,command_resolution:m,resolution_stage:"execute",source_context:U?.source_context});return await Gn({errorMessage:o,exitCode:r,classificationCode:s.code,errorCategory:c,commandResolution:m,resolutionStage:"execute"}),p&&(Nt(Ht(e.error,o)),await Ce(Nn)),process.exitCode=r,!0}async function xa(e,t){let n=hn(e.invocationArgv),o=`unknown command '${n}'`,r=E(process.cwd(),e.bootstrapGlobal.path),i=await ta(r),a=je(e.invocationArgv),s=await vn(r,{},Ue(a)),l=await Pe({message:o},b,i,{failedExtensions:s}),d=sn(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:s}),{errorCategory:c,commandResolution:m}=await e.emitTelemetryCommandError({command:n,errorCode:d.code,errorMessage:d.detail,exitCode:f.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t??"commander.helpDisplayed"},resolutionStage:"parse"}),p=await ft({command:n,error_code:d.code,error_category:c,exit_code:f.USAGE,error_message:d.detail,command_resolution:m,resolution_stage:"parse"}),u=e.jsonErrors?await xn({message:o},b,i,e.bootstrapGlobal.lean===!0,{failedExtensions:s}):await bn({message:o},b,i,{failedExtensions:s}),g=gn(u,e.jsonErrors,s);await Gn({errorMessage:o,exitCode:f.USAGE,classificationCode:d.code,errorCategory:c,commandResolution:m,resolutionStage:"parse"}),y(g),p&&await Ce(Nn),process.exitCode=f.USAGE}async function va(e,t,n){if(!(t==="commander.helpDisplayed"||t==="commander.help"||t==="commander.helpCommand")&&!n.includes("(outputHelp)"))return!1;let r=P(e.invocationArgv);return r.requested&&!_n(b,r.commandPathTokens)?(await xa(e,t),!0):(await _a(),!0)}async function Ca(e,t){let n=await Pe(e.error,b,O),o=sn(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:r,commandResolution:i}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:o.code,errorMessage:o.detail,exitCode:f.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t},resolutionStage:"parse"}),a=await ft({command:e.attemptedCommand,error_code:o.code,error_category:r,exit_code:f.USAGE,error_message:o.detail,command_resolution:i,resolution_stage:"parse",source_context:U?.source_context}),s=e.jsonErrors?await xn(e.error,b,O,e.bootstrapGlobal.lean===!0):await bn(e.error,b,O),l=await si(o.code,e.bootstrapPmRoot,{},Ue(je(e.invocationArgv))),d=gn(s,e.jsonErrors,l);await Gn({errorMessage:n.message,exitCode:f.USAGE,classificationCode:o.code,errorCategory:r,commandResolution:i,resolutionStage:"parse"}),y(d),a&&await Ce(Nn),process.exitCode=f.USAGE}function ka(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 Ea(e){let t=e.error.code,n=String(e.error.message??"");if(!await va(e,t,n)){if(t==="commander.version"){await _a();return}await Ca(e,t)}}async function Wn(e){let t=z(e.invocationArgv),n=E(process.cwd(),t.path),o={error:e.error,invocationArgv:e.invocationArgv,bootstrapGlobal:t,jsonErrors:t.json,bootstrapPmRoot:n,attemptedCommand:k(e.invocationArgv)??"<unknown>",emitTelemetryCommandError:Oc({invocationArgv:e.invocationArgv,bootstrapGlobal:t,bootstrapPmRoot:n})};if(await ya({invocationArgv:e.invocationArgv,bootstrapGlobal:t,bootstrapPmRoot:n}),!await ba(o,Ut(e.error))){if(ka(e.error)){await Ea(o);return}await Pi({error:e.error,attemptedCommand:o.attemptedCommand,bootstrapGlobal:t,emitTelemetryCommandError:o.emitTelemetryCommandError})}}async function Rc(e){b=zt(De),la(b),Ne=null,oe=null,O=new Map,mo();let t=[...e],n,o;try{let r=tt(e);t=r.argv;let i=[process.argv[0],process.argv[1],...t],a=t.length===0,s=z(t);if(s.authorMissingValue)throw new v("--author requires a non-empty value.",f.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});n=or(s.author),ha(r),o=Qo(t);let l=ma(t);if(await Ac(b,l),pa(t)&&wr(b,t),fa(b,t)?await sa(b,t):(O=new Map,V({overrides:[]})),ga(t)&&await ji(b,t),ia(b),await mi(b,t,O))return;let m=P(t);if(m.requested&&!_n(b,m.commandPathTokens))throw new Yl(f.USAGE,"commander.helpDisplayed","(outputHelp)");if(a||ce(t)&&k(t)===void 0){b.outputHelp();return}let p=await I(E(process.cwd(),s.path)),u=await ui(t,E(process.cwd(),s.path),s.noExtensions,he);await jo({pmRoot:E(process.cwd(),s.path),packages:u?.contextIntentPackages},()=>go(p.agent_identity.harness_signals,()=>b.parseAsync(i),{probesEnabled:p.agent_identity?.probes_enabled}))}catch(r){await Wn({error:r,invocationArgv:t})}finally{o?.(),n?.()}}async function lm(e=process.argv.slice(2)){try{await Do(process.env,()=>Rc(e))}catch(t){await Wn({error:t,invocationArgv:[...e]})}}var cm={activationCommandMatchesProbe:zi,applyDynamicExtensionRootHelpVisibility:aa,bootstrapProfileEnabled:Ln,buildBootstrapActivationProbe:je,buildPostActionTelemetryOutcome:Oi,buildPmCliRecoveryContext:vi,buildRuntimeExtensionDiscoverySnapshotCacheKey:Un,buildRuntimeExtensionActivationScope:zn,buildRuntimeExtensionSnapshotCacheKey:qi,buildRuntimeExtensionFilterForProbe:Xi,addRuntimeFieldOption:Tn,collectActivationCommandCandidates:Ue,collectExtensionFlagDefinitionsForCommand:Sn,collectExtensionFlagDefinitionsForInvocation:gt,collectLeadingCommandArgs:Hi,collectParsedActivationCommandArgs:Zi,collectRuntimeFieldLooseFlagDefinitionsForCommand:Ui,commandHasLongOption:Di,commandHasShortOption:Li,commandPathNeedsSearchExtensions:Bi,commandPathNeedsTemplateExtensions:qn,describeUnknownError:Z,defaultPreflightDecision:On,discoveryNeedsActivationForProbe:yt,emitExtensionProfile:Qi,emitExtensionSkippedProfile:wt,emitSettingsReadWarnings:In,ensureIdempotentTopLevelCommandRegistration:ua,enforceExplicitRetryForFlagTypos:ha,envFlagEnabled:Ii,executeRegisteredRuntimeMigrations:na,extractCommandScopedOptions:Me,extensionActivationCommands:jn,extensionCapabilities:ht,extensionNeedsActivationForProbe:Hn,extensionProvidesTemplatesRuntime:Ki,hasAnyCapability:Fe,hasGlobalExtensionContributions:Ji,handleGenericRunPmCliError:Pi,handleRunPmCliCommanderError:Ea,handleRunPmCliError:Wn,handleRunPmCliHelpDisplayError:va,handleRunPmCliKnownError:ba,handleRunPmCliCommanderUsageError:Ca,handleUnknownHelpCommandError:xa,inferMissingFieldsFromErrorMessage:xi,inferPostActionErrorCode:Ti,inferPostActionFailureMessage:Ai,invocationRequestsVersion:bt,isCommanderError:qt,loadRuntimeExtensionCommandDescriptorsForRecovery:ta,loadRuntimeExtensionDiscoverySnapshot:_t,loadRuntimeExtensionSnapshot:he,maybeLoadRuntimeExtensions:ea,maybeAttachCreateUpdatePolicyHelpText:Dn,maybeLogHandledCliErrorToSentry:ft,matchesStaticExtensionCommand:Rn,normalizeTelemetryCommandResolution:ki,normalizeTelemetryErrorCategory:Si,normalizeTelemetryResolutionStage:Ei,normalizeThrownExitCode:jt,probeUsesAnyFlag:Vi,prepareExtensionServicesForRunPmCliError:ya,readRecordBoolean:Ci,readRecordNumber:Mn,readRecordString:fe,recordCliReadOutputInvocationProvenance:bi,registerDynamicExtensionCommandPaths:sa,registerRuntimeSchemaFieldFlags:ji,resolveCoreCommandRegistrationSelection:ma,resolveStaticExtensionActivationDecision:Yi,resolveUnknownHelpToken:hn,readThrownExitCode:Ut,runAndClearAfterCommandHooks:Le,runRequiredExtensionCommand:ra,shouldAttachRichHelpTextForInvocation:pa,shouldLogHandledErrorToSentry:$i,shouldRegisterDynamicExtensionPaths:fa,shouldRegisterRuntimeSchemaFlags:ga,shouldHandleRunPmCliCommanderError:ka,setActiveExtensionHookContextForTest:Zl,setActiveRuntimeExtensionCommandDescriptorsForTest:Ql,setRecoveredExtensionServices:wa,toLooseFieldDefinitionType:An,isImporterOrExporterCommandPath:Ni,validateDynamicExtensionCommandInvocation:Fi,wrapProgramActionsForExtensionHandlers:ia,wrapThrownErrorForSentry:Ht};export{cm as _testOnly,lm as runPmCli};
31
31
  //# sourceMappingURL=main.js.map
@@ -1,3 +1,3 @@
1
- import{a as nn,b as sn,c as dn,d as w,e as an,f as O,g as cn,h as ln,i as wn,j as xn,k as kn,l as Tn,m as $n,n as Cn,o as v,p as En,q as A,u as I,v as Sn,w as On,x as D,y as vn,z as An}from"./focused-chunks/chunk-YJLDHJOD.js";import{a as Ho,b as Qo,c as Zo,d as en,e as tn,f as rn,g as on}from"./focused-chunks/chunk-THEPQMLX.js";import{A as oo,B as Lo,C as Ro,D as qo,E as Bo,F as Go,H as Uo,I as Jo,J as Ko,K as Vo,L as Wo,M as Xo,N as Yo,a as le,b as ue,c as pe,d as fe,e as _e,f as me,g as ge,h as ye,i as be,j as Rr,k as qr,l as Br,m as Gr,n as Ur,o as Jr,p as Kr,q as Vr,r as Wr,s as Xr,t as Yr,u as Hr,v as Qr,w as Zr,x as eo,y as to,z as ro}from"./focused-chunks/chunk-LYFWQMVC.js";import{c as F,d as N,f as P,h as M}from"./focused-chunks/chunk-MEASX544.js";import{$ as xt,$a as S,A as We,Aa as Wt,B as Xe,Ba as Xt,C as Ye,Ca as Yt,D as He,Da as Ht,E as Qe,Ea as Qt,F as Ze,Fa as Zt,G as et,Ga as er,H as tt,Ha as tr,I as rt,Ia as rr,J as ot,Ja as or,K as nt,Ka as nr,L as it,La as ir,M as st,Ma as sr,N as dt,Na as dr,O as at,Oa as ar,P as ct,Pa as cr,Q as lt,Qa as lr,R as ut,Ra as ur,S as pt,Sa as pr,T as ft,Ta as fr,U as _t,Ua as _r,V as mt,Va as mr,W as gt,Wa as gr,X as yt,Y as bt,Ya as yr,Z as ht,_ as wt,_a as j,aa as kt,ab as br,b as Te,ba as Tt,c as $e,ca as $t,d as Ce,da as Ct,e as Ee,ea as Et,f as je,fa as jt,g as Se,ga as St,h as Oe,ha as Ot,i as ve,ia as vt,j as Ae,ja as At,k as Ie,ka as It,l as De,la as Dt,m as Fe,ma as Ft,n as Ne,na as Nt,o as Pe,oa as Pt,p as Me,pa as Mt,q as ze,qa as zt,r as Le,ra as Lt,s as Re,sa as Rt,t as qe,ta as qt,u as Be,ua as Bt,v as Ge,va as Gt,w as Ue,wa as Ut,x as Je,xa as Jt,y as Ke,ya as Kt,z as Ve,za as Vt}from"./focused-chunks/chunk-LLNTHF5X.js";import{g as x,h as un,i as pn,j as fn,k as _n,l as mn,m as gn,n as yn,o as bn,p as hn,q as jn}from"./focused-chunks/chunk-6GCRSLPG.js";import{$a as To,Aa as Pr,Ba as Mr,Ca as zr,Da as Lr,Ja as no,Ka as io,La as so,Ma as ao,Na as co,Oa as lo,Pa as uo,Qa as po,Ra as fo,Sa as _o,Ta as mo,Ua as go,Va as yo,Wa as bo,Xa as ho,Y as h,Ya as wo,Za as xo,_a as ko,ea as he,fa as we,ga as xe,ha as ke,ia as hr,ja as wr,jb as $o,ka as xr,kb as Co,la as kr,lb as Eo,ma as Tr,mb as jo,na as $r,nb as So,oa as Cr,ob as Oo,pb as vo,qa as Er,qb as Ao,ra as jr,rb as Io,sa as Sr,sb as Do,ta as Or,tb as Fo,ua as vr,ub as No,va as Ar,vb as Po,wa as Ir,wb as Mo,xa as Dr,xb as zo,ya as Fr,za as Nr}from"./focused-chunks/chunk-Z2USIBR2.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3466866d-8869-5ab6-b981-d084e7330aa5")}catch{}})();var _,K=Object.freeze({list:"list-item-projection","list-all":"list-item-projection","list-draft":"list-item-projection","list-open":"list-item-projection","list-in-progress":"list-item-projection","list-blocked":"list-item-projection","list-closed":"list-item-projection","list-canceled":"list-item-projection",get:"get-item-projection",graph:"graph-detail-projection",search:"search-result-projection",history:"history-entry-projection",events:"mutation-event-projection",activity:"activity-entry-projection",deps:"dependency-graph-projection",health:"health-diagnostic-projection",validate:"validation-diagnostic-projection",contracts:"contract-catalog-projection"});function V(e,t){if(t==="--limit")return"result-row-limit";if(t==="--node-limit")return"graph-node-limit";if(t==="--edge-limit")return"graph-edge-limit";if(t==="--output-limit")return"rendered-output-row-limit";if(t==="--output-budget")return"rendered-output-byte-budget";if(t==="--token-budget")return"context-intent-token-budget";if(t==="--full"){let o=K[e];if(o===void 0)throw new Error(`Command ${e} exposes --full without a registered projection concept.`);return o}return t!=="--file"?t.slice(2):["create","update","update-many"].includes(e)?"linked-file-path":["comments","notes","learnings"].includes(e)?"entry-file-input":"plan-definition-file"}function m(){if(_!==void 0)return _;let t=A.filter(({command:n})=>j(n)).flatMap(({command:n,family:s})=>v(n,S(n)).map(a=>({command:n,family:s,concept:V(n,a.flag),flag:a.flag,aliases:Object.freeze([...a.aliases??[]]),value_kind:a.repeatable?"list":a.flag==="--limit"?"number":a.value_type}))),o=new Set(t.flatMap(n=>n.aliases.map(s=>`${n.command}:${s}`))),i=t.filter(n=>!o.has(`${n.command}:${n.flag}`)),r=new Map;for(let n of i){let s=r.get(n.concept)??new Set;s.add(n.value_kind),r.set(n.concept,s)}return _=Object.freeze(i.map(n=>Object.freeze({...n,concept:r.get(n.concept)?.size===1?n.concept:`${n.concept}@${n.command}`}))),_}function Nn(){return Object.freeze(m().map(e=>Object.freeze({command:e.command,canonical_flag:e.flag,accepted_spellings:Object.freeze([...new Set([e.flag,...e.aliases])].sort())})))}var z=Object.freeze({init:30,config:35,extension:53,package:54,packages:54,install:26,upgrade:29,create:100,copy:24,focus:22,list:86,"list-all":85,"list-draft":84,"list-open":84,"list-in-progress":84,"list-blocked":84,"list-closed":84,"list-canceled":84,aggregate:37,context:45,ctx:45,get:30,graph:34,search:78,duplicates:24,eval:25,next:35,history:35,events:33,"history-redact":27,"history-repair":26,"history-compact":30,"history-author-acknowledge":28,merge:24,schema:40,profile:22,activity:35,restore:23,update:105,"update-many":140,close:31,"close-many":72,delete:24,append:24,comments:31,notes:35,learnings:27,files:39,docs:30,deps:32,plan:109,test:52,"test-all":40,telemetry:21,stats:29,health:36,validate:45,assurance:30,gc:22,workspace:23,contracts:29,claim:36,release:23,"start-task":23,"pause-task":23,"close-task":24,meet:33,event:33,remind:29,"test-runs-worker":25});function L(){let e=new Map(Object.keys(z).map(t=>[t,0]));for(let{command:t}of m())e.set(t,Number(e.get(t))+1);return Object.freeze(Object.entries(z).map(([t,o])=>Object.freeze({command:t,current:Number(e.get(t)),maximum:o})))}function W(e,t,o){for(let i of e)for(let r of i.aliases){let n=t.get(`${i.command}:${r}`);n===void 0||n.flag===i.flag||o.push({code:"alias_collision",command:i.command,detail:`${r} aliases ${i.flag} but is canonical for ${n.flag}.`})}}function X(e,t,o){let i=new Set(t.map(({command:r})=>r));for(let r of e.keys())i.has(r)||o.push({code:"missing_budget",command:r,detail:`${r} has canonical flags but no persisted budget.`});for(let r of t){let n=e.get(r.command)??0;n===0&&o.push({code:"stale_budget",command:r.command,detail:`${r.command} has a persisted budget but no canonical flags.`}),!(n<=r.maximum)&&o.push({code:"budget_exceeded",command:r.command,detail:`${n} canonical flags exceed the ratcheted maximum ${r.maximum}.`})}}function Y(e,t,o){let i=new Map(e.map(r=>[`${r.command}:${r.flag}`,r]));for(let r of t){let n=`${r.command}:${r.canonical_flag}`,s=i.get(n);if(!s){o.push({code:"removed_canonical_spelling",command:r.command,detail:`${r.canonical_flag} disappeared from the executable spelling inventory.`});continue}let a=new Set([s.flag,...s.aliases]);for(let d of r.accepted_spellings)a.has(d)||o.push({code:"removed_compatibility_spelling",command:r.command,detail:`${d} no longer resolves to ${r.canonical_flag}.`})}}function Pn(e=m(),t=L(),o=[]){let i=[],r=new Map,n=new Map,s=new Map,a=new Map;for(let d of e){let c=`${d.command}:${d.flag}`;r.has(c)?i.push({code:"duplicate_canonical_flag",command:d.command,detail:`${d.flag} has more than one canonical row.`}):r.set(c,d),a.set(d.command,(a.get(d.command)??0)+1);let l=n.get(d.concept);l!==void 0&&l!==d.value_kind?i.push({code:"inconsistent_concept_kind",command:d.command,detail:`${d.concept} uses both ${l} and ${d.value_kind}.`}):n.set(d.concept,d.value_kind);let u=s.get(d.concept);u!==void 0&&u!==d.flag?i.push({code:"semantic_spelling_collision",command:d.command,detail:`${d.concept} is canonicalized by both ${u} and ${d.flag}.`}):s.set(d.concept,d.flag)}return W(e,r,i),X(a,t,i),Y(e,o,i),i.sort((d,c)=>d.command.localeCompare(c.command)||d.code.localeCompare(c.code)||d.detail.localeCompare(c.detail)),{ok:i.length===0,entry_count:e.length,budget_count:t.length,concept_count:new Set(e.map(({concept:d})=>d)).size,baseline_entry_count:o.length,findings:i}}function Mn(){let e=m(),t=L(),o=new Map(t.map(({command:r})=>[r,"unknown"]));for(let{command:r,family:n}of e)o.set(r,n);return["# Generated flag lexicon budgets","","This file is generated by `listPmFlagLexicon()`. Compatibility aliases do not consume canonical budget.","","| Command | Capability family | Canonical flags | Maximum |","| --- | --- | ---: | ---: |",...t.map(({command:r,current:n,maximum:s})=>{let a=o.get(r);return`| \`${r}\` | ${a} | ${n} | ${s} |`}),""].join(`
1
+ import{a as nn,b as sn,c as dn,d as w,e as an,f as O,g as cn,h as ln,i as wn,j as xn,k as kn,l as Tn,m as $n,n as Cn,o as v,p as En,q as A,u as I,v as Sn,w as On,x as D,y as vn,z as An}from"./focused-chunks/chunk-TDK3OCX3.js";import{a as Ho,b as Qo,c as Zo,d as en,e as tn,f as rn,g as on}from"./focused-chunks/chunk-THEPQMLX.js";import{A as oo,B as Lo,C as Ro,D as qo,E as Bo,F as Go,H as Uo,I as Jo,J as Ko,K as Vo,L as Wo,M as Xo,N as Yo,a as le,b as ue,c as pe,d as fe,e as _e,f as me,g as ge,h as ye,i as be,j as Rr,k as qr,l as Br,m as Gr,n as Ur,o as Jr,p as Kr,q as Vr,r as Wr,s as Xr,t as Yr,u as Hr,v as Qr,w as Zr,x as eo,y as to,z as ro}from"./focused-chunks/chunk-LYFWQMVC.js";import{c as F,d as N,f as P,h as M}from"./focused-chunks/chunk-MEASX544.js";import{$ as xt,$a as S,A as We,Aa as Wt,B as Xe,Ba as Xt,C as Ye,Ca as Yt,D as He,Da as Ht,E as Qe,Ea as Qt,F as Ze,Fa as Zt,G as et,Ga as er,H as tt,Ha as tr,I as rt,Ia as rr,J as ot,Ja as or,K as nt,Ka as nr,L as it,La as ir,M as st,Ma as sr,N as dt,Na as dr,O as at,Oa as ar,P as ct,Pa as cr,Q as lt,Qa as lr,R as ut,Ra as ur,S as pt,Sa as pr,T as ft,Ta as fr,U as _t,Ua as _r,V as mt,Va as mr,W as gt,Wa as gr,X as yt,Y as bt,Ya as yr,Z as ht,_ as wt,_a as j,aa as kt,ab as br,b as Te,ba as Tt,c as $e,ca as $t,d as Ce,da as Ct,e as Ee,ea as Et,f as je,fa as jt,g as Se,ga as St,h as Oe,ha as Ot,i as ve,ia as vt,j as Ae,ja as At,k as Ie,ka as It,l as De,la as Dt,m as Fe,ma as Ft,n as Ne,na as Nt,o as Pe,oa as Pt,p as Me,pa as Mt,q as ze,qa as zt,r as Le,ra as Lt,s as Re,sa as Rt,t as qe,ta as qt,u as Be,ua as Bt,v as Ge,va as Gt,w as Ue,wa as Ut,x as Je,xa as Jt,y as Ke,ya as Kt,z as Ve,za as Vt}from"./focused-chunks/chunk-LLNTHF5X.js";import{g as x,h as un,i as pn,j as fn,k as _n,l as mn,m as gn,n as yn,o as bn,p as hn,q as jn}from"./focused-chunks/chunk-6GCRSLPG.js";import{$a as To,Aa as Pr,Ba as Mr,Ca as zr,Da as Lr,Ja as no,Ka as io,La as so,Ma as ao,Na as co,Oa as lo,Pa as uo,Qa as po,Ra as fo,Sa as _o,Ta as mo,Ua as go,Va as yo,Wa as bo,Xa as ho,Y as h,Ya as wo,Za as xo,_a as ko,ea as he,fa as we,ga as xe,ha as ke,ia as hr,ja as wr,jb as $o,ka as xr,kb as Co,la as kr,lb as Eo,ma as Tr,mb as jo,na as $r,nb as So,oa as Cr,ob as Oo,pb as vo,qa as Er,qb as Ao,ra as jr,rb as Io,sa as Sr,sb as Do,ta as Or,tb as Fo,ua as vr,ub as No,va as Ar,vb as Po,wa as Ir,wb as Mo,xa as Dr,xb as zo,ya as Fr,za as Nr}from"./focused-chunks/chunk-Z2USIBR2.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3466866d-8869-5ab6-b981-d084e7330aa5")}catch{}})();var _,K=Object.freeze({list:"list-item-projection","list-all":"list-item-projection","list-draft":"list-item-projection","list-open":"list-item-projection","list-in-progress":"list-item-projection","list-blocked":"list-item-projection","list-closed":"list-item-projection","list-canceled":"list-item-projection",get:"get-item-projection",graph:"graph-detail-projection",search:"search-result-projection",history:"history-entry-projection",events:"mutation-event-projection",activity:"activity-entry-projection",deps:"dependency-graph-projection",health:"health-diagnostic-projection",validate:"validation-diagnostic-projection",contracts:"contract-catalog-projection"});function V(e,t){if(t==="--limit")return"result-row-limit";if(t==="--node-limit")return"graph-node-limit";if(t==="--edge-limit")return"graph-edge-limit";if(t==="--output-limit")return"rendered-output-row-limit";if(t==="--output-budget")return"rendered-output-byte-budget";if(t==="--token-budget")return"context-intent-token-budget";if(t==="--full"){let o=K[e];if(o===void 0)throw new Error(`Command ${e} exposes --full without a registered projection concept.`);return o}return t!=="--file"?t.slice(2):["create","update","update-many"].includes(e)?"linked-file-path":["comments","notes","learnings"].includes(e)?"entry-file-input":"plan-definition-file"}function m(){if(_!==void 0)return _;let t=A.filter(({command:n})=>j(n)).flatMap(({command:n,family:s})=>v(n,S(n)).map(a=>({command:n,family:s,concept:V(n,a.flag),flag:a.flag,aliases:Object.freeze([...a.aliases??[]]),value_kind:a.repeatable?"list":a.flag==="--limit"?"number":a.value_type}))),o=new Set(t.flatMap(n=>n.aliases.map(s=>`${n.command}:${s}`))),i=t.filter(n=>!o.has(`${n.command}:${n.flag}`)),r=new Map;for(let n of i){let s=r.get(n.concept)??new Set;s.add(n.value_kind),r.set(n.concept,s)}return _=Object.freeze(i.map(n=>Object.freeze({...n,concept:r.get(n.concept)?.size===1?n.concept:`${n.concept}@${n.command}`}))),_}function Nn(){return Object.freeze(m().map(e=>Object.freeze({command:e.command,canonical_flag:e.flag,accepted_spellings:Object.freeze([...new Set([e.flag,...e.aliases])].sort())})))}var z=Object.freeze({init:30,config:35,extension:53,package:54,packages:54,install:26,upgrade:29,create:100,copy:24,focus:22,list:86,"list-all":85,"list-draft":84,"list-open":84,"list-in-progress":84,"list-blocked":84,"list-closed":84,"list-canceled":84,aggregate:37,context:45,ctx:45,get:30,graph:34,search:78,duplicates:24,eval:25,next:35,history:35,events:33,"history-redact":27,"history-repair":26,"history-compact":30,"history-author-acknowledge":28,merge:24,schema:40,profile:22,activity:35,restore:23,update:105,"update-many":140,close:31,"close-many":72,delete:24,append:24,comments:31,notes:35,learnings:27,files:39,docs:30,deps:32,plan:109,test:52,"test-all":40,telemetry:21,stats:29,health:36,validate:45,assurance:30,gc:22,workspace:23,contracts:29,claim:36,release:23,"start-task":23,"pause-task":23,"close-task":24,meet:33,event:33,remind:29,"test-runs-worker":25});function L(){let e=new Map(Object.keys(z).map(t=>[t,0]));for(let{command:t}of m())e.set(t,Number(e.get(t))+1);return Object.freeze(Object.entries(z).map(([t,o])=>Object.freeze({command:t,current:Number(e.get(t)),maximum:o})))}function W(e,t,o){for(let i of e)for(let r of i.aliases){let n=t.get(`${i.command}:${r}`);n===void 0||n.flag===i.flag||o.push({code:"alias_collision",command:i.command,detail:`${r} aliases ${i.flag} but is canonical for ${n.flag}.`})}}function X(e,t,o){let i=new Set(t.map(({command:r})=>r));for(let r of e.keys())i.has(r)||o.push({code:"missing_budget",command:r,detail:`${r} has canonical flags but no persisted budget.`});for(let r of t){let n=e.get(r.command)??0;n===0&&o.push({code:"stale_budget",command:r.command,detail:`${r.command} has a persisted budget but no canonical flags.`}),!(n<=r.maximum)&&o.push({code:"budget_exceeded",command:r.command,detail:`${n} canonical flags exceed the ratcheted maximum ${r.maximum}.`})}}function Y(e,t,o){let i=new Map(e.map(r=>[`${r.command}:${r.flag}`,r]));for(let r of t){let n=`${r.command}:${r.canonical_flag}`,s=i.get(n);if(!s){o.push({code:"removed_canonical_spelling",command:r.command,detail:`${r.canonical_flag} disappeared from the executable spelling inventory.`});continue}let a=new Set([s.flag,...s.aliases]);for(let d of r.accepted_spellings)a.has(d)||o.push({code:"removed_compatibility_spelling",command:r.command,detail:`${d} no longer resolves to ${r.canonical_flag}.`})}}function Pn(e=m(),t=L(),o=[]){let i=[],r=new Map,n=new Map,s=new Map,a=new Map;for(let d of e){let c=`${d.command}:${d.flag}`;r.has(c)?i.push({code:"duplicate_canonical_flag",command:d.command,detail:`${d.flag} has more than one canonical row.`}):r.set(c,d),a.set(d.command,(a.get(d.command)??0)+1);let l=n.get(d.concept);l!==void 0&&l!==d.value_kind?i.push({code:"inconsistent_concept_kind",command:d.command,detail:`${d.concept} uses both ${l} and ${d.value_kind}.`}):n.set(d.concept,d.value_kind);let u=s.get(d.concept);u!==void 0&&u!==d.flag?i.push({code:"semantic_spelling_collision",command:d.command,detail:`${d.concept} is canonicalized by both ${u} and ${d.flag}.`}):s.set(d.concept,d.flag)}return W(e,r,i),X(a,t,i),Y(e,o,i),i.sort((d,c)=>d.command.localeCompare(c.command)||d.code.localeCompare(c.code)||d.detail.localeCompare(c.detail)),{ok:i.length===0,entry_count:e.length,budget_count:t.length,concept_count:new Set(e.map(({concept:d})=>d)).size,baseline_entry_count:o.length,findings:i}}function Mn(){let e=m(),t=L(),o=new Map(t.map(({command:r})=>[r,"unknown"]));for(let{command:r,family:n}of e)o.set(r,n);return["# Generated flag lexicon budgets","","This file is generated by `listPmFlagLexicon()`. Compatibility aliases do not consume canonical budget.","","| Command | Capability family | Canonical flags | Maximum |","| --- | --- | ---: | ---: |",...t.map(({command:r,current:n,maximum:s})=>{let a=o.get(r);return`| \`${r}\` | ${a} | ${n} | ${s} |`}),""].join(`
2
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]="9d04e30a-caf5-59b4-8853-9df39c1728aa")}catch{}})();var R=new Set(["--pm-path","--path","--author","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),H=new Set(["--no-extensions","--no-pager","--json","--quiet","--lean","--token-accounting","--output-row-contract","--all"]);function Q(e){let t=e.indexOf("=");return t>0&&R.has(e.slice(0,t))}function Z(e,t){return typeof t!="string"?!1:e==="--path"||e==="--pm-path"||!t.startsWith("-")}function ee(e){for(let t=0;t<e.length;t+=1){let o=e[t];if(o==="--")return;if(R.has(o)){t+=Z(o,e[t+1])?1:0;continue}if(!(Q(o)||H.has(o)||o==="--profile"||o==="--id-only"||o==="--explain")&&!o.startsWith("-"))return t}}function q(e){let t=ee(e);return t===void 0?void 0:e[t].trim().toLowerCase()}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="006109f8-cb09-5a91-8929-7ac7521753b6")}catch{}})();var k=2,te=["self_reported","independent_transport"];function g(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function f(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`${t} must be a non-empty string`);return e.trim()}function B(e,t,o=!1){if(!Array.isArray(e)||e.length===0)throw new TypeError(`${t} must be a non-empty string array`);return e.map((i,r)=>{let n=f(i,`${t}[${String(r)}]`);return o?i:n})}function T(e,t){return e===void 0?void 0:f(e,t)}function re(e,t){if(e===void 0)return;if(!g(e)||Object.keys(e).length===0)throw new TypeError(`${t} must be a non-empty object`);let o=Object.entries(e).map(([i,r])=>{if(i.length===0||i.split(".").some(n=>n.length===0))throw new TypeError(`${t} must use dot-separated own-property paths`);if(r!==null&&typeof r!="string"&&typeof r!="boolean"&&(typeof r!="number"||!Number.isFinite(r)))throw new TypeError(`${t} values must be JSON primitives`);return[i,r]});return Object.fromEntries(o)}function oe(e,t,o,i,r,n){if(i==="refusal"){if(w(o)||r===void 0||n===void 0)throw new TypeError(`${e} refusal steps require a non-success exit, error code, and refusal surface`);return}if(r!==void 0||n!==void 0)throw new TypeError(`${e} only refusal steps may declare expected_error_code or expected_refusal_surface`);let s=q(t);if(s===void 0)throw new TypeError(`${e}.args must identify a command after global flags`);let a=O(s);if(!w(o)||o!==0&&!a?.exit_codes.some(c=>c===o))throw new TypeError(`${e} successful output must use exit code 0 or a command-declared successful effect exit`);let d=D(s).kind;if(i!==d)throw new TypeError(`${e} expected ${i}, but ${s} declares ${d}`)}function ne(e,t,o){if(!g(e))throw new TypeError(`tasks.${t}.steps[${String(o)}] must be an object`);let i=`tasks.${t}.steps[${String(o)}]`,r=f(e.id,`${i}.id`),n=B(e.args,`${i}.args`,!0),s=e.expected_exit_code;if(typeof s!="number"||!Number.isSafeInteger(s))throw new TypeError(`${i}.expected_exit_code must be a safe integer`);let a=e.expected_output_kind;if(a!=="refusal"&&!I.includes(a))throw new TypeError(`${i}.expected_output_kind is unsupported`);let d=a,c=e.expected_accounting_mode;if(!te.includes(c))throw new TypeError(`${i}.expected_accounting_mode is unsupported`);let l=c;if(l==="independent_transport"&&d!=="refusal")throw new TypeError(`${i} independent_transport accounting is supported only for refusal steps`);let u=B(e.required_fields,`${i}.required_fields`);if(u.some(U=>U.split(".").some(J=>J.length===0)))throw new TypeError(`${i}.required_fields must contain dot-separated own-property paths`);let C=re(e.expected_field_values,`${i}.expected_field_values`),y=T(e.expected_error_code,`${i}.expected_error_code`),b=T(e.expected_refusal_surface,`${i}.expected_refusal_surface`),E=T(e.recovery_for,`${i}.recovery_for`);return oe(i,n,s,d,y,b),{id:r,args:n,expected_exit_code:s,expected_output_kind:d,expected_accounting_mode:l,required_fields:u,...C?{expected_field_values:C}:{},...y?{expected_error_code:y}:{},...b?{expected_refusal_surface:b}:{},...E?{recovery_for:E}:{}}}function ie(e,t){if(!g(e))throw new TypeError(`tasks[${String(t)}] must be an object`);let o=f(e.id,`tasks[${String(t)}].id`),i=f(e.description,`tasks.${o}.description`);if(!Array.isArray(e.steps)||e.steps.length===0)throw new TypeError(`tasks.${o}.steps must be a non-empty array`);let r=e.steps.map((s,a)=>ne(s,o,a)),n=new Map;for(let s of r){if(n.has(s.id))throw new TypeError(`tasks.${o} contains duplicate step id ${s.id}`);if(s.recovery_for!==void 0&&(n.get(s.recovery_for)?.expected_output_kind!=="refusal"||s.expected_output_kind==="refusal"))throw new TypeError(`tasks.${o}.${s.id} recovery_for must reference an earlier refusal and declare successful output`);n.set(s.id,s)}if(r.at(-1)?.expected_output_kind==="refusal")throw new TypeError(`tasks.${o} completed task must terminate with successful output`);for(let s of r)if(s.expected_output_kind==="refusal"&&!r.some(a=>a.recovery_for===s.id))throw new TypeError(`tasks.${o}.${s.id} refusal must have a later successful recovery_for step`);return{id:o,description:i,steps:r}}function Gn(e){if(!g(e))throw new TypeError("agent-task transcript corpus must be an object");if(e.version!==k)throw new TypeError(`agent-task transcript corpus version must be ${String(k)}`);if(!Array.isArray(e.tasks)||e.tasks.length===0)throw new TypeError("agent-task transcript corpus tasks must be non-empty");let t=e.tasks.map((i,r)=>ie(i,r)),o=new Set;for(let i of t){if(o.has(i.id))throw new TypeError(`duplicate agent-task transcript id ${i.id}`);o.add(i.id)}return{version:k,tasks: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]="0ec8c375-e58e-5ce4-b0aa-8a8a4dfa0778")}catch{}})();function se(e){return[e.expected_error_code!==void 0&&e.error_code!==e.expected_error_code?{code:"error_code_mismatch",probe_id:e.probe_id,detail:`Expected error code ${e.expected_error_code}, received ${e.error_code??"<missing>"}.`}:void 0,e.expected_allowed_values!==void 0&&JSON.stringify([...e.allowed_values].sort())!==JSON.stringify([...e.expected_allowed_values].sort())?{code:"incomplete_allowed_values",probe_id:e.probe_id,detail:"The refusal's accepted domain differs from the SDK-owned domain contract."}:void 0,e.expected_suggested_retry_args!==void 0&&(e.suggested_retry_args?.length??0)===0?{code:"missing_suggested_retry_args",probe_id:e.probe_id,detail:"The refusal omitted shell-free suggested retry arguments."}:void 0,e.expected_suggested_retry_args!==void 0&&(e.suggested_retry_args?.length??0)>0&&JSON.stringify(e.suggested_retry_args)!==JSON.stringify(e.expected_suggested_retry_args)?{code:"suggested_retry_args_mismatch",probe_id:e.probe_id,detail:"The refusal's suggested retry arguments differ from the SDK-owned contract."}:void 0]}function de(e){return[e.exit_code!==h.USAGE?{code:"non_refusal_exit",probe_id:e.probe_id,detail:`${e.entrypoint} returned exit code ${e.exit_code}; a structured usage refusal must return ${h.USAGE}.`}:void 0,e.allowed_values_required!==!1&&e.allowed_values.length===0?{code:"missing_allowed_values",probe_id:e.probe_id,detail:"The refusal omitted its complete accepted value domain."}:void 0,e.allowed_values.includes(e.rejected_value)?{code:"accepted_rejected_value",probe_id:e.probe_id,detail:`${e.rejected_value} is both rejected and advertised as allowed.`}:void 0,e.suggested_retry.trim().length===0?{code:"missing_suggested_retry",probe_id:e.probe_id,detail:"The refusal omitted an executable suggested retry."}:void 0,e.retry_succeeded?void 0:{code:"retry_failed",probe_id:e.probe_id,detail:"The advertised suggested retry did not succeed."},...se(e)]}function Kn(e){let t=[],o=new Set,i=0;e.length===0&&t.push({code:"empty_corpus",probe_id:"corpus",detail:"At least one real refusal observation is required."});for(let r of e){if(o.has(r.probe_id)){t.push({code:"duplicate_probe",probe_id:r.probe_id,detail:`${r.probe_id} was supplied more than once.`});continue}o.add(r.probe_id);let n=t.length;for(let s of de(r))s!==void 0&&t.push(s);t.length===n&&(i+=1)}return t.sort((r,n)=>r.probe_id!==n.probe_id?r.probe_id.localeCompare(n.probe_id):r.code.localeCompare(n.code)),{ok:t.length===0,probe_count:o.size,closed_probe_count:i,closure_fraction:o.size===0?0:i/o.size,findings: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]="95833d58-d6b9-5ab4-b447-5ce003643fd5")}catch{}})();var G="not-a-declared-intent",p="not-a-declared-field";function ae(){let e={get:["pm-domain"],search:["Domain query"]},t=[...new Set(x.map(({command:n})=>n))].map(n=>{let s=x.filter(c=>c.command===n),a=s[0],d=e[a.command]??[];return{probe_id:`${a.command}-invalid-intent`,command:a.command,flag:"--for",rejected_value:G,refusal_args:[a.command,...d,"--for",G],allowed_values:s.map(({intent:c})=>c).sort(),suggested_retry_args:[a.command,...d,"--for",a.intent],error_code:"unknown_context_intent"}}),o=N(),i=Object.keys(F).map(n=>({probe_id:`${n}-invalid-field`,command:n,flag:"--fields",rejected_value:p,refusal_args:[n,"--fields",p],allowed_values:o,suggested_retry_args:[n,"--fields","id,title,status","--limit","10"],error_code:"unknown_field_projection"}));return[...t,...i,{probe_id:"get-invalid-field",command:"get",flag:"--fields",rejected_value:p,refusal_args:["get","pm-domain","--fields",p],allowed_values:P(),suggested_retry_args:["get","pm-domain","--fields","id,title,status"],error_code:"unknown_field_projection"},{probe_id:"list-mutually-exclusive-projection",command:"list",flag:"--projection",rejected_value:"--brief+--full",refusal_args:["list","--brief","--full"],allowed_values:[],suggested_retry_args:["list","--brief"],error_code:"projection_options_mutually_exclusive",allowed_values_required:!1},{probe_id:"get-mutually-exclusive-projection",command:"get",flag:"--projection",rejected_value:"--full+--fields",refusal_args:["get","pm-domain","--full","--fields","id"],allowed_values:[],suggested_retry_args:["get","pm-domain","--full"],error_code:"projection_options_mutually_exclusive",allowed_values_required:!1},{probe_id:"search-mutually-exclusive-projection",command:"search",flag:"--projection",rejected_value:"--full+--fields",refusal_args:["search","Domain query","--full","--fields","id"],allowed_values:[],suggested_retry_args:["search","Domain query","--full"],error_code:"projection_options_mutually_exclusive",allowed_values_required:!1},{probe_id:"package-upgrade-mutually-exclusive-modes",command:"package upgrade",flag:"--cli-only/--packages-only",rejected_value:"--cli-only+--packages-only",refusal_args:["package","upgrade","--cli-only","--packages-only","--dry-run"],allowed_values:[],suggested_retry_args:["package","upgrade","--packages-only","--dry-run"],error_code:"package_upgrade_modes_mutually_exclusive",allowed_values_required:!1},{probe_id:"search-invalid-field",command:"search",flag:"--fields",rejected_value:p,refusal_args:["search","Domain query","--fields",p],allowed_values:M(),suggested_retry_args:["search","Domain query","--fields","id,title,status,score"],error_code:"unknown_field_projection"}].sort((n,s)=>n.probe_id.localeCompare(s.probe_id))}function Yn(e,t){let o=ae().find(n=>n.command===e&&n.flag===t);if(!o)return"No stable core values are declared.";let i=o.allowed_values.filter(n=>!n.startsWith("item.")),r=t==="--fields"?" item.<field> aliases and configured runtime metadata fields are also accepted.":" Configured package and workspace intents may extend this domain.";return`Allowed core values: ${i.join("|")}.${r}`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="941a11a9-f756-56b3-9dc1-8afd78bc9328")}catch{}})();var $=[{probe_id:"tracker-root-missing",failure_kind:"missing_root",expected_error_code:"tracker_root_missing",expected_exit_code:3,recovery_kind:"initialize"},{probe_id:"tracker-root-settings-missing",failure_kind:"settings_missing",expected_error_code:"tracker_not_initialized",expected_exit_code:3,recovery_kind:"initialize"},{probe_id:"tracker-root-not-directory",failure_kind:"not_directory",expected_error_code:"tracker_root_not_directory",expected_exit_code:2,recovery_kind:"select_directory"},{probe_id:"tracker-root-unreadable",failure_kind:"unreadable_root",expected_error_code:"tracker_root_unreadable",expected_exit_code:1,recovery_kind:"repair_permissions"}];function Qn(){return $.map(e=>({...e}))}function ce(e,t){let o=[];t.error_code!==e.expected_error_code&&o.push({code:"error_code_mismatch",probe_id:e.probe_id,detail:`Expected ${e.expected_error_code}, received ${t.error_code}.`}),t.exit_code!==e.expected_exit_code&&o.push({code:"exit_code_mismatch",probe_id:e.probe_id,detail:`Expected exit ${e.expected_exit_code}, received ${t.exit_code}.`}),t.recovery_kind!==e.recovery_kind&&o.push({code:"recovery_kind_mismatch",probe_id:e.probe_id,detail:`Expected ${e.recovery_kind}, received ${t.recovery_kind}.`});let i=t.suggested_retry_args.indexOf("init"),r=i===0||i===2&&t.suggested_retry_args[0]==="--pm-path"&&t.suggested_retry_args[1]?.length>0;return e.recovery_kind==="initialize"&&!r&&o.push({code:"missing_init_recovery",probe_id:e.probe_id,detail:"Missing and uninitialized roots must emit a tokenized init retry."}),(t.unsafe_init_recommended||e.recovery_kind!=="initialize"&&t.suggested_retry_args.includes("init"))&&o.push({code:"unsafe_init_recovery",probe_id:e.probe_id,detail:"A tracker root that cannot be initialized safely must not recommend initialization."}),t.retry_succeeded||o.push({code:"retry_failed",probe_id:e.probe_id,detail:"The emitted retry or safe alternate-root recovery did not execute successfully."}),o}function Zn(e){let t=new Map(e.map(r=>[r.probe_id,r])),o=[],i=0;for(let r of $){let n=t.get(r.probe_id);if(n===void 0){o.push({code:"missing_probe",probe_id:r.probe_id,detail:"No runtime observation was supplied for this contract."});continue}let s=ce(r,n);o.push(...s),s.length===0&&(i+=1)}return o.sort((r,n)=>r.probe_id.localeCompare(n.probe_id)||r.code.localeCompare(n.code)),{ok:o.length===0,probe_count:$.length,closed_probe_count:i,findings: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]="b47a3cc6-caba-5de8-8813-a4e6112dbe61")}catch{}})();export{me as ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS,nr as ACTIVITY_FLAG_CONTRACTS,Be as AGGREGATE_FLAG_CONTRACTS,St as APPEND_FLAG_CONTRACTS,Wt as ASSURANCE_FLAG_CONTRACTS,pe as CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS,or as CALENDAR_FLAG_CONTRACTS,Ot as CLAIM_FLAG_CONTRACTS,Bo as CLOSE_ACTION_OPTION_KEYS,Et as CLOSE_FLAG_CONTRACTS,jt as CLOSE_MANY_FLAG_CONTRACTS,Nt as CLOSE_TASK_FLAG_CONTRACTS,Ge as COMMENTS_FLAG_CONTRACTS,gr as COMPLETION_FLAG_CONTRACTS,nt as CONFIG_FLAG_CONTRACTS,fe as CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS,sr as CONTEXT_FLAG_CONTRACTS,mr as CONTRACTS_FLAG_CONTRACTS,Zt as COPY_FLAG_CONTRACTS,Ho as CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,Zo as CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,Qo as CREATE_COMMANDER_STRING_OPTION_CONTRACTS,Xt as CREATE_FLAG_CONTRACTS,At as DELETE_FLAG_CONTRACTS,cr as DEPS_FLAG_CONTRACTS,Ve as DOCS_FLAG_CONTRACTS,Jt as DUPLICATES_FLAG_CONTRACTS,ur as EVAL_FLAG_CONTRACTS,ir as EVENTS_FLAG_CONTRACTS,Mt as EVENT_FLAG_CONTRACTS,we as EXECUTABLE_COMMAND_ALIASES,mt as EXTENSION_ACTIVATE_FLAG_CONTRACTS,_t as EXTENSION_ADOPT_ALL_FLAG_CONTRACTS,kt as EXTENSION_ADOPT_FLAG_CONTRACTS,xt as EXTENSION_CATALOG_FLAG_CONTRACTS,gt as EXTENSION_DEACTIVATE_FLAG_CONTRACTS,ft as EXTENSION_DESCRIBE_FLAG_CONTRACTS,wt as EXTENSION_DOCTOR_FLAG_CONTRACTS,pt as EXTENSION_EXPLORE_FLAG_CONTRACTS,it as EXTENSION_FLAG_CONTRACTS,dt as EXTENSION_INIT_FLAG_CONTRACTS,lt as EXTENSION_INSTALL_FLAG_CONTRACTS,bt as EXTENSION_MANAGE_FLAG_CONTRACTS,yt as EXTENSION_MIGRATE_FLAG_CONTRACTS,ht as EXTENSION_RELOAD_FLAG_CONTRACTS,st as EXTENSION_SCOPE_FLAG_CONTRACTS,ut as EXTENSION_UNINSTALL_FLAG_CONTRACTS,Ke as FILES_FLAG_CONTRACTS,er as FOCUS_FLAG_CONTRACTS,Gt as GC_FLAG_CONTRACTS,dr as GET_FLAG_CONTRACTS,Re as GLOBAL_FLAG_CONTRACTS,lr as GRAPH_FLAG_CONTRACTS,ar as GUIDE_FLAG_CONTRACTS,Kt as HEALTH_FLAG_CONTRACTS,Qe as HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,Ze as HISTORY_COMPACT_FLAG_CONTRACTS,We as HISTORY_FLAG_CONTRACTS,Ye as HISTORY_REDACT_FLAG_CONTRACTS,He as HISTORY_REPAIR_FLAG_CONTRACTS,ot as INIT_FLAG_CONTRACTS,Tt as INSTALL_FLAG_CONTRACTS,Ht as ITEM_COMPLETE_FLAG_CONTRACTS,Yt as ITEM_MUTATE_FLAG_CONTRACTS,Qt as ITEM_REOPEN_FLAG_CONTRACTS,Je as LEARNINGS_FLAG_CONTRACTS,le as LIST_COMMANDER_STRING_OPTION_CONTRACTS,qe as LIST_FILTER_FLAG_CONTRACTS,Pt as MEET_FLAG_CONTRACTS,Xe as MERGE_FLAG_CONTRACTS,Er as MERGE_SUBCOMMAND_VALUES,_e as NEXT_COMMANDER_STRING_OPTION_CONTRACTS,fr as NEXT_FLAG_CONTRACTS,Ue as NOTES_FLAG_CONTRACTS,at as PACKAGE_FLAG_CONTRACTS,ct as PACKAGE_INIT_FLAG_CONTRACTS,Ft as PAUSE_TASK_FLAG_CONTRACTS,qo as PLAN_CREATE_METADATA_PARAMETER_KEYS,rt as PLAN_FLAG_CONTRACTS,te as PM_AGENT_TASK_ACCOUNTING_MODES,k as PM_AGENT_TASK_TRANSCRIPT_VERSION,Ae as PM_CLI_GRAMMAR_CONTRACT,Te as PM_CLI_GRAMMAR_NOUNS,vr as PM_CLI_ONLY_TOOL_ACTION_WAIVERS,$e as PM_CLI_SHARED_VERBS,he as PM_COMMAND_ALIAS_CONTRACTS,Oe as PM_COMMAND_DESTINATION_CONTRACTS,sn as PM_COMMAND_EXIT_CONTRACTS,nn as PM_COMMAND_EXIT_OUTCOME_CONTRACTS,_o as PM_COMMAND_OUTPUT_BUDGET_CONTRACTS,On as PM_COMMAND_OUTPUT_ENVELOPE_CONTRACTS,ve as PM_COMMAND_POSITIONAL_CONTRACTS,x as PM_CONTEXT_INTENT_CONTRACTS,Cr as PM_CORE_COMMAND_NAMES,Ir as PM_DEPRECATED_TOOL_ACTIONS,co as PM_DIAGNOSTIC_DEGRADATION_STEPS,lo as PM_DIAGNOSTIC_OUTPUT_BUDGET_CONTRACTS,ao as PM_DIAGNOSTIC_OUTPUT_CLASSES,Dr as PM_DISCOVERABLE_TOOL_ACTIONS,$n as PM_ERROR_CODE_CATALOG,wn as PM_ERROR_CODE_EXIT_CLASS_CONTRACTS,hr as PM_EXTENSION_CAPABILITY_CONTRACTS,jr as PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS,xr as PM_EXTENSION_POLICY_MODE_CONTRACTS,$r as PM_EXTENSION_POLICY_SURFACE_CONTRACTS,Tr as PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS,wr as PM_EXTENSION_SERVICE_NAME_CONTRACTS,kr as PM_EXTENSION_TRUST_MODE_CONTRACTS,Or as PM_ITEM_ACTION_SUBCOMMANDS,so as PM_OUTPUT_BUDGET_CLASSES,io as PM_OUTPUT_DEGRADATION_STEPS,I as PM_OUTPUT_ENVELOPE_KINDS,Sr as PM_PACKAGE_ONLY_ACTION_SUBCOMMANDS,Ce as PM_POSITIONAL_ACTION_CONTRACTS,Xo as PM_PROVIDER_TOOL_PARAMETERS_SCHEMA,Vo as PM_PROVIDER_TOOL_PARAMETERS_SCHEMA_VERSION,jo as PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,wo as PM_READ_OUTPUT_CONTINUATION_FINGERPRINT_POLICIES,$o as PM_READ_OUTPUT_DIMENSIONS,Eo as PM_READ_OUTPUT_OPTION_FLAGS,Co as PM_READ_OUTPUT_SURFACES,So as PM_READ_OUTPUT_SURFACE_CONTRACTS,dn as PM_SUCCESS_EXIT_CODES,Ar as PM_TOOL_ACTIONS,Go as PM_TOOL_ACTION_PARAMETER_CONTRACTS,Wo as PM_TOOL_PARAMETERS_SCHEMA,Ko as PM_TOOL_PARAMETERS_SCHEMA_MAJOR,Jo as PM_TOOL_PARAMETERS_SCHEMA_VERSION,Lo as PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES,tt as PROFILE_FLAG_CONTRACTS,Ct as REINDEX_FLAG_CONTRACTS,It as RELEASE_FLAG_CONTRACTS,zt as REMIND_FLAG_CONTRACTS,vt as RESTORE_FLAG_CONTRACTS,et as SCHEMA_FLAG_CONTRACTS,ue as SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,_r as SEARCH_FLAG_CONTRACTS,Dt as START_TASK_FLAG_CONTRACTS,Ut as STATS_FLAG_CONTRACTS,Le as SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,qt as TELEMETRY_FLAG_CONTRACTS,Rt as TEST_ALL_FLAG_CONTRACTS,Lt as TEST_FLAG_CONTRACTS,Bt as TEST_RUNS_FLAG_CONTRACTS,eo as TOOL_ACTIVITY_OPTION_CONTRACTS,Br as TOOL_AGGREGATE_OPTION_CONTRACTS,Yr as TOOL_BULK_MUTATION_FILTER_OPTION_CONTRACT_SOURCE,Zr as TOOL_CALENDAR_OPTION_CONTRACTS,Qr as TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS,to as TOOL_CONTEXT_OPTION_CONTRACTS,Vr as TOOL_CREATE_OPTION_CONTRACTS,Kr as TOOL_CREATE_OPTION_CONTRACT_SOURCE,ro as TOOL_DEPS_OPTION_CONTRACTS,oo as TOOL_GRAPH_OPTION_CONTRACTS,qr as TOOL_LIST_FILTER_OPTION_CONTRACTS,Gr as TOOL_SEARCH_FILTER_OPTION_CONTRACTS,Jr as TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS,Ur as TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACT_SOURCE,Hr as TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS,Xr as TOOL_UPDATE_OPTION_CONTRACTS,Wr as TOOL_UPDATE_OPTION_CONTRACT_SOURCE,en as UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS,rn as UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,tn as UPDATE_COMMANDER_STRING_OPTION_CONTRACTS,tr as UPDATE_FLAG_CONTRACTS,rr as UPDATE_MANY_FLAG_CONTRACTS,$t as UPGRADE_FLAG_CONTRACTS,Vt as VALIDATE_FLAG_CONTRACTS,pr as WORKSPACE_FLAG_CONTRACTS,Yo as _testOnlyCliContracts,cn as analyzePmCommandExitConformance,Fr as analyzePmToolActionParity,on as analyzeSdkCliParameterCompleteness,mn as applyContextIntentProjection,Po as applyReadOutputDimensions,Io as applyReadOutputIncludeModes,bn as attachContextIntentReceipt,jn as attachOutputTokenAccounting,hn as attachReadOutputContracts,Uo as buildPmActionToolInputSchema,ze as compactFlagAliasContracts,fn as composeContextIntentContracts,yn as contextIntentRowId,po as createPmCommandOutputBudget,gn as decodeContextIntentCursor,To as decodeReadOutputContinuationCursor,fo as definePmCommandOutputBudget,Sn as definePmCommandOutputEnvelope,xn as definePmErrorCodeCatalog,ln as derivePmBulkMutationEffect,ko as encodeReadOutputContinuationCursor,Cn as enrichCliFlagInvocationContract,v as enrichCliFlagInvocationContracts,go as estimatePmOutputTokens,Se as formatPmPositionalActionFlagTip,un as getActiveContextIntentContracts,j as hasSubcommandFlagContractsForCommand,uo as inferPmOutputBudgetClass,Pr as isPmExtensionCapabilityContract,zr as isPmExtensionPolicyModeContract,Lr as isPmExtensionPolicySurfaceContract,Mr as isPmExtensionServiceNameContract,an as isPmKnownExitCode,vn as isPmMutationReceipt,w as isPmSuccessfulExitCode,Nr as isPmToolAction,Mo as isReadOutputBudgetExceeded,ae as listCoreClosedDomainContracts,L as listPmCommandFlagBudgets,m as listPmFlagLexicon,Nn as listPmFlagSpellingInventory,Qn as listTrackerPreflightRecoveryContracts,Do as normalizeReadOutputIncludeModeOptions,An as parseMutationReceipt,Gn as parsePmAgentTaskTranscriptCorpus,De as positionalShapeKey,Fe as positionalSignatureKey,bo as projectPmDiagnosticOutput,ho as projectPmDiagnosticText,ge as readFirstStringFromCommanderOptions,ye as readFirstValueFromCommanderOptions,xo as readOutputCollectionFingerprint,Ao as readOutputIncludeModeOptions,be as readStringArrayFromCommanderOptions,Yn as renderPmClosedDomainHelp,ke as renderPmCommandAliasMigrationHint,Mn as renderPmFlagLexiconMarkdown,kn as resolveCanonicalPmErrorCodeContract,_n as resolveContextIntentContract,xe as resolvePmCommandAlias,O as resolvePmCommandExitContract,mo as resolvePmCommandOutputBudget,D as resolvePmCommandOutputEnvelope,Ee as resolvePmCommandPositionalContract,yo as resolvePmDiagnosticOutputBudget,Tn as resolvePmErrorCodeContract,V as resolvePmFlagSemanticConcept,je as resolvePmPositionalActionContract,yr as resolvePmPositionalActionFlagContracts,Ro as resolvePmToolCustomFieldCollision,Fo as resolveReadOutputDimensions,zo as resolveReadOutputEncoding,no as resolveReadOutputRecoveryBudget,Oo as resolveReadOutputSurface,S as resolveSubcommandFlagContractsForCommand,pn as runWithContextIntentContracts,Kn as scorePmRefusalClosure,Zn as scoreTrackerPreflightRecoveryClosure,No as stabilizeReadOutputReceiptEstimates,br as toCompletionFlagString,vo as validateReadOutputOptions,En as verifyCliFlagInvocationParity,Ie as verifyExplicitPositionalSlotCensus,Pe as verifyPmCliGrammar,Ne as verifyPmCommandPositionalContracts,Pn as verifyPmFlagLexicon,Rr as verifyToolOptionCliParity,Me as withFlagAliasMetadata};
3
3
  //# sourceMappingURL=sdk-contracts.js.map