@unbrained/pm-cli 2026.8.25 → 2026.8.26

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 (116) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +33 -0
  3. package/dist/cli-bundle/bundle-manifest.json +133 -133
  4. package/dist/cli-bundle/chunks/chunk-E2GCFJSU.js +35 -0
  5. package/dist/cli-bundle/chunks/{chunk-QKGMHGEI.js → chunk-ES25LX3D.js} +51 -51
  6. package/dist/cli-bundle/chunks/{chunk-TPQIBSL2.js → chunk-FRDWWB6R.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-65MHLHAA.js → chunk-ICQ3RVIY.js} +2 -2
  8. package/dist/cli-bundle/chunks/chunk-IV64RJVE.js +13 -0
  9. package/dist/cli-bundle/chunks/{chunk-QLUORNIB.js → chunk-KBFP3E4E.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-T2ENPRXF.js → chunk-MVYLQ67M.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-5I5RWIJC.js → chunk-S4U76VZF.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-OWHNAR2B.js → chunk-UKBCRPA2.js} +2 -2
  13. package/dist/cli-bundle/chunks/chunk-WRHJ3MB6.js +8 -0
  14. package/dist/cli-bundle/chunks/{chunk-244MI4GS.js → chunk-ZNRLJ54C.js} +60 -60
  15. package/dist/cli-bundle/chunks/{register-list-query-XVN2ZLI7.js → register-list-query-EMCPMICY.js} +2 -2
  16. package/dist/cli-bundle/chunks/{register-mutation-QCKAEGIJ.js → register-mutation-OJ67ABCB.js} +2 -2
  17. package/dist/cli-bundle/chunks/{register-operations-SDEAXE7E.js → register-operations-H2GLP7LT.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-setup-LXVBRCJ3.js → register-setup-GLZAHLVI.js} +2 -2
  19. package/dist/cli-bundle/focused-chunks/{chunk-NOOZGIXP.js → chunk-4K2II4TV.js} +2 -2
  20. package/dist/cli-bundle/focused-chunks/{chunk-IBZZZGK3.js → chunk-4XNH2HM7.js} +2 -2
  21. package/dist/cli-bundle/focused-chunks/{chunk-VXWATRFL.js → chunk-57XY346D.js} +2 -2
  22. package/dist/cli-bundle/focused-chunks/{chunk-GQR3WH3F.js → chunk-66VGB23P.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/{chunk-42S3GGZ7.js → chunk-72T6JGAE.js} +45 -45
  24. package/dist/cli-bundle/focused-chunks/{chunk-RAFKLNZX.js → chunk-FXDLT6FL.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/{chunk-H5JZEIQV.js → chunk-IBHXMFE7.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/{chunk-N7W67YIG.js → chunk-LV5N3LK5.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/{chunk-2UIWOP3O.js → chunk-MMXUPDDJ.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/{chunk-ONYQCALA.js → chunk-P2E6LDAE.js} +6 -6
  29. package/dist/cli-bundle/focused-chunks/{chunk-XUQPEKRN.js → chunk-TMJDFHVD.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-OVJL6NZE.js → chunk-UYBA57GY.js} +4 -4
  31. package/dist/cli-bundle/main.js +2 -2
  32. package/dist/cli-bundle/sdk-authoring.js +1 -1
  33. package/dist/cli-bundle/sdk-contracts.js +1 -1
  34. package/dist/cli-bundle/sdk-core.js +31 -31
  35. package/dist/cli-bundle/sdk-governance.js +1 -1
  36. package/dist/cli-bundle/sdk-graph.js +1 -1
  37. package/dist/cli-bundle/sdk-merge.js +18 -18
  38. package/dist/cli-bundle/sdk-query.js +1 -1
  39. package/dist/cli-bundle/sdk-runtime.js +1 -1
  40. package/dist/cli-bundle/sdk-testing.js +1 -1
  41. package/dist/cli-bundle/sdk.js +7 -6
  42. package/dist/core/extensions/manifest-schema.d.ts +20 -0
  43. package/dist/core/extensions/manifest-schema.js +28 -10
  44. package/dist/mcp/http-server.d.ts +60 -0
  45. package/dist/mcp/http-server.js +451 -0
  46. package/dist/mcp/legacy-adapter.d.ts +50 -0
  47. package/dist/mcp/legacy-adapter.js +64 -0
  48. package/dist/mcp/server.d.ts +42 -9
  49. package/dist/mcp/server.js +457 -58
  50. package/dist/sdk/agent/refusal-closure-census.d.ts +6 -2
  51. package/dist/sdk/agent/refusal-closure-census.js +16 -8
  52. package/dist/sdk/compose.d.ts +4 -1
  53. package/dist/sdk/compose.js +23 -36
  54. package/dist/sdk/extension/author-manifest.d.ts +22 -0
  55. package/dist/sdk/extension/author-manifest.js +93 -0
  56. package/dist/sdk/extension.js +6 -3
  57. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +20 -5
  58. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +6 -3
  59. package/dist/sdk/governance/health.js +7 -2
  60. package/dist/sdk/index.d.ts +6 -0
  61. package/dist/sdk/index.js +8 -2
  62. package/dist/sdk/mcp/authorization.d.ts +134 -0
  63. package/dist/sdk/mcp/authorization.js +405 -0
  64. package/dist/sdk/mcp/interactions.d.ts +118 -0
  65. package/dist/sdk/mcp/interactions.js +337 -0
  66. package/dist/sdk/mcp/protocol.d.ts +142 -0
  67. package/dist/sdk/mcp/protocol.js +174 -0
  68. package/dist/sdk/mcp/subscriptions.d.ts +65 -0
  69. package/dist/sdk/mcp/subscriptions.js +212 -0
  70. package/dist/sdk/mcp/tasks.d.ts +107 -0
  71. package/dist/sdk/mcp/tasks.js +431 -0
  72. package/dist/sdk/mcp/transport.d.ts +30 -0
  73. package/dist/sdk/mcp/transport.js +261 -0
  74. package/dist/sdk/merge/receipts.d.ts +16 -0
  75. package/dist/sdk/merge/receipts.js +9 -8
  76. package/dist/sdk/runtime-primitives.d.ts +1 -1
  77. package/dist/sdk/runtime-primitives.js +3 -3
  78. package/dist/sdk/test/execution.d.ts +6 -0
  79. package/dist/sdk/test/execution.js +32 -3
  80. package/docs/AGENT_PROVENANCE_ADR.md +6 -4
  81. package/docs/AGENT_RUNTIME_PRIMITIVES.md +6 -5
  82. package/docs/CLAUDE_CODE_PLUGIN.md +12 -5
  83. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +8 -0
  84. package/docs/EXTENSIONS.md +3 -4
  85. package/docs/MCP_2026_07_28.md +138 -0
  86. package/docs/MCP_2026_07_28_CONFORMANCE.md +30 -0
  87. package/docs/MCP_REMOTE_TRANSPORT_SECURITY.md +180 -0
  88. package/docs/README.md +4 -0
  89. package/docs/RELEASING.md +3 -2
  90. package/docs/SDK.md +22 -1
  91. package/docs/SDK_AGENT_SESSION_CONTEXT.md +18 -13
  92. package/docs/SDK_MCP_INTERACTIONS.md +227 -0
  93. package/docs/TESTING.md +4 -0
  94. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +9 -8
  95. package/marketplace.json +2 -2
  96. package/package.json +7 -5
  97. package/packages/pm-beads/package.json +1 -1
  98. package/packages/pm-calendar/package.json +1 -1
  99. package/packages/pm-command-kit/package.json +1 -1
  100. package/packages/pm-digital-twin/package.json +1 -1
  101. package/packages/pm-governance-audit/package.json +1 -1
  102. package/packages/pm-guide-shell/package.json +1 -1
  103. package/packages/pm-kanban/package.json +1 -1
  104. package/packages/pm-lifecycle-hooks/package.json +1 -1
  105. package/packages/pm-linked-test-adapters/package.json +1 -1
  106. package/packages/pm-search-advanced/package.json +1 -1
  107. package/packages/pm-templates/package.json +1 -1
  108. package/packages/pm-todos/package.json +1 -1
  109. package/packages/pm-vcs/package.json +1 -1
  110. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  111. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  112. package/scripts/finalize-build.mjs +1 -0
  113. package/sdk/public-surface.json +628 -2
  114. package/dist/cli-bundle/chunks/chunk-2F3LUFMW.js +0 -8
  115. package/dist/cli-bundle/chunks/chunk-6C7GIMIL.js +0 -13
  116. package/dist/cli-bundle/chunks/chunk-YQMYF3YD.js +0 -35
@@ -1,4 +1,4 @@
1
- import{a as uc,b as tt,c as _n,d as _c,e as hc,h as gc}from"./chunk-T2ENPRXF.js";import{C as Po,E as bc,a as xt,b as So,d as cc,j as $o}from"./chunk-5I5RWIJC.js";import{$b as To,Ac as kc,Bc as Sc,Db as Ao,Eb as ac,F as St,Fb as fn,G as y,H as ha,Hc as Ic,I as ga,Ic as Ec,Id as Lo,Jc as xc,Jd as Mo,K as ee,Kc as Rc,L as ya,Lc as Ac,Ld as $c,M as nn,Mb as Me,N as ba,Nc as Cc,O as _o,Oc as hn,P as on,Pa as ec,Q as ho,Qa as vo,R as we,Rd as Pc,S as go,Sa as tc,Sd as Fc,T as B,Ta as nc,U as yo,Ua as ko,Ub as De,V as te,Vb as Co,W as wa,X as va,Xb as dc,Y as bo,Yc as Tc,Z as ka,_ as wo,_c as Oc,eb as mn,ga as Sa,la as Et,ma as Wa,na as Ka,pa as Ya,pd as Fo,qa as Ja,qb as oc,ra as Xa,rb as pn,rc as Rt,sb as rc,sc as Oo,ta as dn,tc as lc,ua as Za,ub as Qe,uc as mc,va as ln,vb as ic,vc as ve,wa as Qa,wb as Io,wc as pc,xb as un,yc as fc,zb as et,zc as vc}from"./chunk-YQMYF3YD.js";import{A as sn,Aa as Va,B as Ra,C as Le,D as Aa,E as rn,F as Ca,G as an,Ha as cn,J as Ta,L as Oa,M as $a,N as Pa,Na as yc,O as Fa,P as La,Q as Ma,R as Da,S as Na,T as ja,U as Ua,V as Ga,W as qa,X as za,Y as Ha,Z as Ba,b as ma,q as Ia,ta as It,w as Ea,y as Fe,z as xa}from"./chunk-244MI4GS.js";import{$b as Eo,A as pa,B as ua,Bc as wc,Ca as _a,Pa as sc,Y as fa,b as oa,c as tn,d as fo,e as sa,f as ra,g as ia,h as aa,i as ca,kb as fe,l as da,n as la,tc as xo,yc as Ro}from"./chunk-6C7GIMIL.js";import{$c as kr,$g as Kr,$k as Oi,$l as Wi,Aj as po,Bd as yt,Be as oe,Bg as Vr,Bi as vt,C as u,Cd as $r,Ci as di,Cj as uo,Da as Gn,Dh as Xr,E as p,Ea as qn,Eb as rr,Ec as Gt,Ei as ao,El as Li,Fa as zn,Fb as ir,Fc as _t,Fd as Pr,G as nr,Ga as Hn,Gb as ar,Gi as co,Gk as Ii,Gl as Mi,H as be,Hb as cr,Hh as Zr,Ib as dr,Ic as N,Ik as Ei,Jb as lr,Jc as hr,Jk as Qt,Kb as mr,Kc as to,Kh as ue,Ki as li,Kk as xi,Li as mi,Mc as gr,Md as Ae,Mi as pi,Mj as vi,Ml as Di,N as jn,Nc as yr,Nh as Qr,Ni as ui,Nj as ki,Nl as Ni,Oa as P,Ob as F,Od as Ke,Og as ae,Oh as ei,Oi as fi,Ol as ji,Pa as jt,Pb as pr,Pd as Bt,Pg as Te,Qb as ur,Qh as Kt,Qi as _i,Qk as Ri,R as S,Rg as Wt,Ri as hi,Rl as Ui,Sc as Ve,Sd as Ye,Se as Dr,Sg as Xe,Sh as ti,Si as gi,Td as pe,Tg as Oe,Ti as kt,U as Ft,Ud as Ce,Ug as Wr,Ui as yi,Uk as Ai,Ve as Nr,Vg as bt,Vi as Zt,Vl as Gi,W as or,Wa as E,Wc as br,Wi as bi,Wl as qi,X as Lt,Xc as wr,Xi as lo,Xj as Si,Xl as zi,Y as Mt,Ye as jr,Yi as mo,Yk as Ci,Yl as Hi,Z as Dt,Za as ut,Zc as ht,Zg as so,Zh as ni,Zi as wi,Zk as Ti,Zl as Bi,_ as Nt,_a as ft,_c as vr,_l as Vi,ab as ie,ad as Sr,ah as $e,ai as R,am as Ki,bd as Ir,bi as oi,bm as Yi,c as Z,ci as si,cl as $i,cm as Ji,d as He,da as me,de as Fr,dh as Yr,di as ri,dm as Xi,e as Nn,ee as Lr,em as Zi,f as z,fd as no,fe as Mr,fh as W,g as H,gc as Bn,gd as Er,h as mt,hc as Vn,hd as gt,hm as Qi,i as Js,ic as Wn,if as Ur,im as en,jd as xr,jg as zr,jm as ea,ka as sr,kc as fr,kd as Rr,km as ta,la as pt,li as Yt,m as Xs,md as qt,mg as Hr,mh as Ze,n as Zs,na as Un,ni as Jt,o as Qs,od as Ar,oi as ii,p as er,pd as zt,pm as C,qc as _r,qd as Ht,qi as ai,rh as ro,ri as $,rm as na,s as tr,sc as Kn,sd as We,sh as wt,si as Q,tb as Ut,tc as Yn,td as xe,th as io,ti as K,uc as Jn,ud as Cr,ug as Br,vc as Xn,vd as Tr,ve as oo,vf as Gr,vi as Pe,vl as Pi,wc as Zn,wd as Re,we as A,wl as Fi,xc as Qn,xd as Or,xe as Vt,xg as Je,xi as ci,yb as Be,yc as eo,yf as qr,yi as Xt,zc as O,zd as U,zh as Jr}from"./chunk-QKGMHGEI.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]="bb16b445-3bd4-520d-becf-c55621bfa186")}catch{}})();var cy=Js,dy=Xs,ly=er,my=Zs,py=Qs;function Lc(e,t,n,o){let s=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),r=n.has(s);return{long:t,...o?{short:o}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:r?"string":"boolean",...r?{value_name:e.value_name??"value"}:{}}}function Mc(e,t=[]){let n=new Set(t.flatMap(s=>s.keys)),o=[];for(let s of Ii(e.map(r=>({...r})))){o.push(Lc(s,s.flag,n,s.short));for(let r of s.aliases??[])o.push(Lc(s,r,n))}return o}var uy=Mc(Qt,vi),om=Mc(en,ki);import{AsyncLocalStorage as fg}from"node:async_hooks";import Bl from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="27dd77f6-e53d-55b7-be15-db0e60eaec4e")}catch{}})();function Dc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function sm(e){return e.brief===!0?"brief":typeof e.fields=="string"&&e.fields.trim().length>0||Array.isArray(e.fields)&&e.fields.length>0?"fields":e.compact===!0?"compact":"full"}function Do(e,t){let n=sm(t),o=n==="brief"?n:Dc(e.projection)&&typeof e.projection.mode=="string"?e.projection.mode:n;return{...e,query_summary:{filters:Dc(e.filters)?e.filters:{},projection: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]="6ede8efb-54ec-5b13-a1bf-216b525acc12")}catch{}})();async function Nc(e,t){let n=E(t??process.cwd(),e),o=await R(n);return Pe(n,o.item_format,P(o,null).type_to_folder,void 0,o.schema)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c14a67b4-102d-5219-b2b3-15d39da36627")}catch{}})();var rm=["invalid_envelope","source_incomplete","source_unchecked","filtered_corpus","terminal_items_excluded","strict_read_unproven","page_incomplete","count_mismatch","projection_incomplete","field_omission","omission_receipt_missing","omission_receipt_invalid","read_output_missing","read_output_invalid","read_output_dimensions_incomplete","budget_compaction","budget_omission","session_projection","invalid_item_id","duplicate_item_id"],gn=class extends Error{receipt;constructor(t){super(`Complete-list certification failed: ${t.map(n=>n.code).join(", ")}.`),this.name="PmCompleteListValidationError",this.receipt={contract_version:1,contract:"complete_list",findings:t,recovery:{suggested_retry:"pm list --all --output-include full --strict-read --no-truncate --output-budget unbounded --output-limit unbounded --json",sdk:"await client.listAllComplete()"}}}};function No(e={}){return{excludeTerminal:!1,full:!0,...e.includeBody===void 0?{}:{includeBody:e.includeBody},noTruncate:!0,outputBudget:"unbounded",outputLimit:"unbounded",strictRead:!0}}function _e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function M(e,t,n,o){t&&e.push({code:n,message:o})}function im(e,t){let n=_e(e.completeness)?e.completeness:{};M(t,n.status==="partial","source_incomplete","The source scan reported unreadable tracker artifacts."),M(t,n.status!=="complete"&&n.status!=="partial","source_unchecked","The source scan did not prove completeness.");let o=n.unreadable_item_count,s=n.unreadable_directory_count;M(t,n.status==="complete"&&(o!==0||s!==0)&&Number.isSafeInteger(o)&&Number.isSafeInteger(s),"source_incomplete","The source scan reports unreadable tracker artifacts despite a complete status."),M(t,n.status==="complete"&&(!Number.isSafeInteger(o)||!Number.isSafeInteger(s)||Number(o)<0||Number(s)<0),"source_unchecked","The source scan did not report safe non-negative unreadable counts.");let r=_e(e.filters)?e.filters:{},i=_e(r.runtime_filters)?r.runtime_filters:{},a=new Set(["exclude_terminal","include_body","no_truncate","runtime_filters","status","strict_read"]);return M(t,r.status!=="all"||Object.keys(i).length>0||Object.keys(r).some(c=>!a.has(c)),"filtered_corpus","The list did not explicitly select every lifecycle status."),M(t,r.exclude_terminal===!0,"terminal_items_excluded","Terminal lifecycle states were explicitly excluded."),M(t,r.strict_read!==!0,"strict_read_unproven","The result does not echo strict source-read enforcement."),r}function am(e,t,n){M(n,e.has_more!==!1||e.next_cursor!==null||e.truncated!==!1||e.applied_limit!==void 0||t.no_truncate!==!0,"page_incomplete","Pagination or a row ceiling may have withheld items."),M(n,e.count!==e.items.length||e.total!==e.items.length,"count_mismatch","Envelope counts do not equal the returned item count.");let o=_e(e.projection)?e.projection:{};M(n,o.mode!=="full"||o.fields!==null,"projection_incomplete","The result is not the full metadata projection.");let s=_e(e.omission_receipt)?e.omission_receipt:void 0;M(n,s===void 0,"omission_receipt_missing","The result carries no field-omission receipt."),M(n,s!==void 0&&(s.has_omissions!==!1||s.omitted_field_group_count!==0||!Number.isSafeInteger(s.omitted_field_group_count)||!Array.isArray(s.omitted_field_groups)||s.omitted_field_groups.length!==0),"omission_receipt_invalid","The field-omission receipt is malformed or contradicts its no-omission claim."),M(n,s?.has_omissions===!0,"field_omission","The omission receipt reports withheld field groups.")}function cm(e){return e.contract_version!==1||e.command!=="list"||e.within_budget!==!0||e.strings_compacted!==!1||e.rows_compacted!==!1||e.result_omitted!==!1}function dm(e){if(!Array.isArray(e.requested_dimensions))return!1;let t=new Set(e.requested_dimensions);return["include","amount","cost"].every(n=>t.has(n))}function lm(e,t){let n=_e(e.read_output)?e.read_output:void 0;M(t,n===void 0,"read_output_missing","The result carries no universal read-output receipt."),M(t,n!==void 0&&cm(n),"read_output_invalid","The universal read-output receipt does not prove an intact list result."),M(t,n!==void 0&&!dm(n),"read_output_dimensions_incomplete","The universal read-output receipt does not prove full, unbounded include, amount, and cost dimensions."),M(t,n?.strings_compacted===!0||n?.rows_compacted===!0||e.output_budget_truncation!==void 0,"budget_compaction","Universal output shaping compacted the result.");let o=_e(e.output_budget_exceeded)?e.output_budget_exceeded:void 0;M(t,n?.result_omitted===!0||o?.omitted_result===!0,"budget_omission","Universal output shaping omitted the useful result."),M(t,e.read_session!==void 0,"session_projection","A cross-call read session can suppress previously served facts.")}function mm(e,t){let n=e.map(o=>_e(o)&&typeof o.id=="string"?o.id.trim():"");M(t,n.some(o=>o.length===0),"invalid_item_id","Every full item row must carry a non-empty string id."),M(t,new Set(n).size!==n.length,"duplicate_item_id","Every item id must occur exactly once.")}function jc(e){if(!_e(e)||!Array.isArray(e.items))return{ok:!1,findings:[{code:rm[0],message:"The result must be an object with an items array."}]};let t=e,n=[],o=im(t,n);return am(t,o,n),lm(t,n),mm(t.items,n),{ok:n.length===0,findings:n}}function yn(e){let t=jc(e);if(!t.ok)throw new gn(t.findings);let n=e;return{...n,complete_list:{contract_version:1,item_count:n.items.length,unique_item_id_count:new Set(n.items.map(o=>o.id)).size,terminal_items_included:!0,source_complete:!0,full_projection:!0,no_omissions:!0,unbounded:!0}}}function pm(e){yn(e)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="10052b6f-216f-5b50-81ec-ee373cc13d17")}catch{}})();function Uc(e){return e.map(t=>({key:t.key,optionName:$r(t),metadataKey:t.metadata_key,type:t.type,commands:[...t.commands],repeatable:t.repeatable,requiredOnCreate:t.required_on_create,...t.description?{description:t.description}:{}}))}function Gc(e){return e.map(t=>({command:t.command,action:t.action,arguments:t.arguments.map(n=>({name:n.name,required:n.required===!0,variadic:n.variadic===!0,description:n.description})),description:t.description,tier:t.tier??"standard",family:t.family??"extensions"}))}(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]="7c898a52-eba4-5626-8207-5ffefd4990ba")}catch{}})();var um=50,ke=new Map;function jo(){ke.clear()}function qc(e,t){let n=ke.get(e);if(n!==void 0)return n;if(ke.size>=um){let s=ke.keys().next().value;ke.delete(s)}let o=t().catch(s=>{throw ke.get(e)===o&&ke.delete(e),s});return ke.set(e,o),o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6f62939a-7b99-5687-93ae-834e0032f1d5")}catch{}})();var fm={"list-all":{action:"list",options:{excludeTerminal:!1}},"list-draft":{action:"list",options:{status:"draft",excludeTerminal:!1}},"list-open":{action:"list",options:{status:"open",excludeTerminal:!1}},"list-in-progress":{action:"list",options:{status:"in_progress",excludeTerminal:!1}},"list-blocked":{action:"list",options:{status:"blocked",excludeTerminal:!1}},"list-closed":{action:"list",options:{status:"closed",excludeTerminal:!1}},"list-canceled":{action:"list",options:{status:"canceled",excludeTerminal:!1}}};function zc(e){return Object.fromEntries(Gr.map(t=>[`${e}-${t}`,{action:e,options:{[t==="adopt-all"?"adoptAll":t]:!0,...e==="package"?{vocabulary:"package"}:{}}}]))}var Uo={ctx:{action:"context"},...fm,...zc("extension"),...zc("package")};(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]="41012e87-ed61-56b2-8505-8f786b3952b2")}catch{}})();var Hc="PmCliError";function _m(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=u.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function hm(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new p(e,_m(t.exitCode??u.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function Go(e){if(!(e instanceof Error)||e.name!==Hc)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}import{constants as At}from"node:fs";import{lstat as Bc,mkdir as zo,open as Vc}from"node:fs/promises";import he from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47")}catch{}})();function qo(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Ho(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function gm(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function ym(e,t,n,o){let s=n.require(e.kind),r=o.outgoingOne.get(`${s.kind}\0${e.source}`);if(r!==void 0&&r!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${s.kind}`);let i=o.incomingOne.get(`${s.kind}\0${e.target}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${s.kind}`);let a=Ho(e,n),c=o.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function bm(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function wm(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=qo(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:qo(e.relationshipId,"relationshipId"),author:qo(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function vm(e,t,n,o,s,r){let i=n.has(t);if(e.action==="add"&&i)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!i)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(a)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let d=new Be([a,c],[e.edge],s).edges()[0];return ym(d,t,s,r),gm(d)}var Ct=class{#t;#n;#o=[];#r=new Set;#e=new Map;#s={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??Ut()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,s=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(s)||s<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let r=n-1;r<o;r+=s)yield Object.freeze(this.#o.slice(r,Math.min(r+s,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let s=t,r=0,i;for(let a of this.stream({...o,batchSize:256}))for(let c of a)s=n(s,c),r+=1,i=c;return Object.freeze({state:s,version:i?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:r,...i===void 0?{}:{asOf:i.timestamp}})}#i(t,n){let o=this.#n.require(n.kind);this.#s.identities.set(Ho(n,this.#n),t),o.outgoing==="one"&&this.#s.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#s.incomingOne.set(`${o.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#s.identities.delete(Ho(t,this.#n)),n.outgoing==="one"&&this.#s.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#s.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=wm(t,this.version,this.#r),o=this.#e.get(n.relationshipId),s=vm(t,n.relationshipId,this.#e,this.#t,this.#n,this.#s),r=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...s===void 0?{}:{edge:s},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(r),this.#r.add(n.eventId),o&&this.#a(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,s),this.#i(n.relationshipId,s)),r}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let r=Date.parse(t.atTimestamp);if(!Number.isFinite(r))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(i=>Date.parse(i.timestamp)<=r)}else{let r=t.atVersion??this.version;if(!Number.isInteger(r)||r<0||r>this.version)throw new TypeError(`Relationship snapshot version out of range: ${r}`);n=this.#o.slice(0,r)}let o=bm(n),s=new Be(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:s.edges(),graph:s})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Dr("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(Nr(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let s=jr(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:r=>r.eventId,snapshot:String(o)});return{version:o,events:s.rows,hasMore:s.has_more,...s.next_cursor?{nextCursor:s.next_cursor}:{}}}},km="relationship-event-store",Wc=At.O_NOFOLLOW;function bn(e){return W(e,km,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function Ne(e,t="relationships/events.jsonl"){let n=he.resolve(e),o=he.resolve(n,t),s=he.relative(n,o);if(s.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(s===".."||s.startsWith(`..${he.sep}`)||he.isAbsolute(s))throw new TypeError("Relationship event path must stay within the tracker root");if(await zo(n,{recursive:!0}),(await Bc(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let i=n;for(let a of s.split(he.sep)){i=he.join(i,a);try{if((await Bc(i)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(Nn(c))break;throw c}}return o}async function wn(e,t,n){let o=new Ct(t,{registry:n}),s,r;try{r=await Vc(e,At.O_RDONLY|Wc),s=await r.readFile("utf8")}catch(a){if(Nn(a))return{log:o,raw:""};throw a}finally{await r?.close()}let i=s.split(`
1
+ import{a as uc,b as tt,c as _n,d as _c,e as hc,h as gc}from"./chunk-MVYLQ67M.js";import{C as Po,E as bc,a as xt,b as So,d as cc,j as $o}from"./chunk-S4U76VZF.js";import{$b as To,Ac as kc,Bc as Sc,Db as Ao,Eb as ac,F as St,Fb as fn,G as y,H as ha,Hc as Ic,I as ga,Ic as Ec,Id as Lo,Jc as xc,Jd as Mo,K as ee,Kc as Rc,L as ya,Lc as Ac,Ld as $c,M as nn,Mb as Me,N as ba,Nc as Cc,O as _o,Oc as hn,P as on,Pa as ec,Q as ho,Qa as vo,R as we,Rd as Pc,S as go,Sa as tc,Sd as Fc,T as B,Ta as nc,U as yo,Ua as ko,Ub as De,V as te,Vb as Co,W as wa,X as va,Xb as dc,Y as bo,Yc as Tc,Z as ka,_ as wo,_c as Oc,eb as mn,ga as Sa,la as Et,ma as Wa,na as Ka,pa as Ya,pd as Fo,qa as Ja,qb as oc,ra as Xa,rb as pn,rc as Rt,sb as rc,sc as Oo,ta as dn,tc as lc,ua as Za,ub as Qe,uc as mc,va as ln,vb as ic,vc as ve,wa as Qa,wb as Io,wc as pc,xb as un,yc as fc,zb as et,zc as vc}from"./chunk-E2GCFJSU.js";import{A as sn,Aa as Va,B as Ra,C as Le,D as Aa,E as rn,F as Ca,G as an,Ia as cn,J as Ta,L as Oa,M as $a,N as Pa,O as Fa,Oa as yc,P as La,Q as Ma,R as Da,S as Na,T as ja,U as Ua,V as Ga,W as qa,X as za,Y as Ha,Z as Ba,b as ma,q as Ia,ta as It,w as Ea,y as Fe,z as xa}from"./chunk-ZNRLJ54C.js";import{$b as Eo,A as pa,B as ua,Bc as wc,Ca as _a,Pa as sc,Y as fa,b as oa,c as tn,d as fo,e as sa,f as ra,g as ia,h as aa,i as ca,kb as fe,l as da,n as la,tc as xo,yc as Ro}from"./chunk-IV64RJVE.js";import{$c as vr,$l as Vi,Ac as O,Ad as U,Ah as Jr,Bj as po,C as u,Cd as yt,Ce as oe,Cg as Vr,Ci as vt,Da as Gn,Dd as $r,Di as di,Dj as uo,E as p,Ea as qn,Eb as rr,Eh as Xr,Fa as zn,Fb as ir,Fc as Gt,Fi as ao,Fl as Li,G as nr,Ga as Hn,Gb as ar,Gc as _t,Gd as Pr,H as be,Hb as cr,Hi as co,Hk as Ii,Hl as Mi,Ib as dr,Ih as Zr,Jb as lr,Jc as N,Jk as Ei,Kb as mr,Kc as hr,Kk as Qt,Lc as to,Lh as ue,Li as li,Lk as xi,Mi as mi,N as jn,Nc as gr,Nd as Ae,Ni as pi,Nj as vi,Nl as Di,Oa as P,Oc as yr,Oh as Qr,Oi as ui,Oj as ki,Ol as Ni,Pa as jt,Pb as F,Pd as Ke,Pg as ae,Ph as ei,Pi as fi,Pl as ji,Qb as pr,Qd as Bt,Qg as Te,R as S,Rb as ur,Rh as Kt,Ri as _i,Rk as Ri,Sg as Wt,Si as hi,Sl as Ui,Tc as Ve,Td as Ye,Te as Dr,Tg as Xe,Th as ti,Ti as gi,U as Ft,Ud as pe,Ug as Oe,Ui as kt,Vd as Ce,Vg as Wr,Vi as yi,Vk as Ai,W as or,Wa as E,We as Nr,Wg as bt,Wi as Zt,Wl as Gi,X as Lt,Xc as br,Xi as bi,Xl as qi,Y as Mt,Yc as wr,Yi as lo,Yj as Si,Yl as zi,Z as Dt,Za as ut,Ze as jr,Zi as mo,Zk as Ci,Zl as Hi,_ as Nt,_a as ft,_c as ht,_g as so,_h as ni,_i as wi,_k as Ti,_l as Bi,ab as ie,ad as kr,ah as Kr,al as Oi,am as Wi,bd as Sr,bh as $e,bi as R,bm as Ki,c as Z,cd as Ir,ci as oi,cm as Yi,d as He,da as me,di as si,dl as $i,dm as Ji,e as Nn,ee as Fr,eh as Yr,ei as ri,em as Xi,f as z,fe as Lr,fm as Zi,g as H,gd as no,ge as Mr,gh as W,h as mt,hc as Bn,hd as Er,i as Js,ic as Vn,id as gt,im as Qi,jc as Wn,jf as Ur,jm as en,ka as sr,kd as xr,kg as zr,km as ea,la as pt,lc as fr,ld as Rr,lm as ta,m as Xs,mi as Yt,n as Zs,na as Un,nd as qt,ng as Hr,nh as Ze,o as Qs,oi as Jt,p as er,pd as Ar,pi as ii,qd as zt,qm as C,rc as _r,rd as Ht,ri as ai,s as tr,sh as ro,si as $,sm as na,tb as Ut,tc as Kn,td as We,th as wt,ti as Q,uc as Yn,ud as xe,uh as io,ui as K,vc as Jn,vd as Cr,vg as Br,wc as Xn,wd as Tr,we as oo,wf as Gr,wi as Pe,wl as Pi,xc as Zn,xd as Re,xe as A,xl as Fi,yb as Be,yc as Qn,yd as Or,ye as Vt,yg as Je,yi as ci,zc as eo,zf as qr,zi as Xt}from"./chunk-ES25LX3D.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]="bb16b445-3bd4-520d-becf-c55621bfa186")}catch{}})();var cy=Js,dy=Xs,ly=er,my=Zs,py=Qs;function Lc(e,t,n,o){let s=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),r=n.has(s);return{long:t,...o?{short:o}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:r?"string":"boolean",...r?{value_name:e.value_name??"value"}:{}}}function Mc(e,t=[]){let n=new Set(t.flatMap(s=>s.keys)),o=[];for(let s of Ii(e.map(r=>({...r})))){o.push(Lc(s,s.flag,n,s.short));for(let r of s.aliases??[])o.push(Lc(s,r,n))}return o}var uy=Mc(Qt,vi),om=Mc(en,ki);import{AsyncLocalStorage as fg}from"node:async_hooks";import Bl from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="27dd77f6-e53d-55b7-be15-db0e60eaec4e")}catch{}})();function Dc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function sm(e){return e.brief===!0?"brief":typeof e.fields=="string"&&e.fields.trim().length>0||Array.isArray(e.fields)&&e.fields.length>0?"fields":e.compact===!0?"compact":"full"}function Do(e,t){let n=sm(t),o=n==="brief"?n:Dc(e.projection)&&typeof e.projection.mode=="string"?e.projection.mode:n;return{...e,query_summary:{filters:Dc(e.filters)?e.filters:{},projection: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]="6ede8efb-54ec-5b13-a1bf-216b525acc12")}catch{}})();async function Nc(e,t){let n=E(t??process.cwd(),e),o=await R(n);return Pe(n,o.item_format,P(o,null).type_to_folder,void 0,o.schema)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c14a67b4-102d-5219-b2b3-15d39da36627")}catch{}})();var rm=["invalid_envelope","source_incomplete","source_unchecked","filtered_corpus","terminal_items_excluded","strict_read_unproven","page_incomplete","count_mismatch","projection_incomplete","field_omission","omission_receipt_missing","omission_receipt_invalid","read_output_missing","read_output_invalid","read_output_dimensions_incomplete","budget_compaction","budget_omission","session_projection","invalid_item_id","duplicate_item_id"],gn=class extends Error{receipt;constructor(t){super(`Complete-list certification failed: ${t.map(n=>n.code).join(", ")}.`),this.name="PmCompleteListValidationError",this.receipt={contract_version:1,contract:"complete_list",findings:t,recovery:{suggested_retry:"pm list --all --output-include full --strict-read --no-truncate --output-budget unbounded --output-limit unbounded --json",sdk:"await client.listAllComplete()"}}}};function No(e={}){return{excludeTerminal:!1,full:!0,...e.includeBody===void 0?{}:{includeBody:e.includeBody},noTruncate:!0,outputBudget:"unbounded",outputLimit:"unbounded",strictRead:!0}}function _e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function M(e,t,n,o){t&&e.push({code:n,message:o})}function im(e,t){let n=_e(e.completeness)?e.completeness:{};M(t,n.status==="partial","source_incomplete","The source scan reported unreadable tracker artifacts."),M(t,n.status!=="complete"&&n.status!=="partial","source_unchecked","The source scan did not prove completeness.");let o=n.unreadable_item_count,s=n.unreadable_directory_count;M(t,n.status==="complete"&&(o!==0||s!==0)&&Number.isSafeInteger(o)&&Number.isSafeInteger(s),"source_incomplete","The source scan reports unreadable tracker artifacts despite a complete status."),M(t,n.status==="complete"&&(!Number.isSafeInteger(o)||!Number.isSafeInteger(s)||Number(o)<0||Number(s)<0),"source_unchecked","The source scan did not report safe non-negative unreadable counts.");let r=_e(e.filters)?e.filters:{},i=_e(r.runtime_filters)?r.runtime_filters:{},a=new Set(["exclude_terminal","include_body","no_truncate","runtime_filters","status","strict_read"]);return M(t,r.status!=="all"||Object.keys(i).length>0||Object.keys(r).some(c=>!a.has(c)),"filtered_corpus","The list did not explicitly select every lifecycle status."),M(t,r.exclude_terminal===!0,"terminal_items_excluded","Terminal lifecycle states were explicitly excluded."),M(t,r.strict_read!==!0,"strict_read_unproven","The result does not echo strict source-read enforcement."),r}function am(e,t,n){M(n,e.has_more!==!1||e.next_cursor!==null||e.truncated!==!1||e.applied_limit!==void 0||t.no_truncate!==!0,"page_incomplete","Pagination or a row ceiling may have withheld items."),M(n,e.count!==e.items.length||e.total!==e.items.length,"count_mismatch","Envelope counts do not equal the returned item count.");let o=_e(e.projection)?e.projection:{};M(n,o.mode!=="full"||o.fields!==null,"projection_incomplete","The result is not the full metadata projection.");let s=_e(e.omission_receipt)?e.omission_receipt:void 0;M(n,s===void 0,"omission_receipt_missing","The result carries no field-omission receipt."),M(n,s!==void 0&&(s.has_omissions!==!1||s.omitted_field_group_count!==0||!Number.isSafeInteger(s.omitted_field_group_count)||!Array.isArray(s.omitted_field_groups)||s.omitted_field_groups.length!==0),"omission_receipt_invalid","The field-omission receipt is malformed or contradicts its no-omission claim."),M(n,s?.has_omissions===!0,"field_omission","The omission receipt reports withheld field groups.")}function cm(e){return e.contract_version!==1||e.command!=="list"||e.within_budget!==!0||e.strings_compacted!==!1||e.rows_compacted!==!1||e.result_omitted!==!1}function dm(e){if(!Array.isArray(e.requested_dimensions))return!1;let t=new Set(e.requested_dimensions);return["include","amount","cost"].every(n=>t.has(n))}function lm(e,t){let n=_e(e.read_output)?e.read_output:void 0;M(t,n===void 0,"read_output_missing","The result carries no universal read-output receipt."),M(t,n!==void 0&&cm(n),"read_output_invalid","The universal read-output receipt does not prove an intact list result."),M(t,n!==void 0&&!dm(n),"read_output_dimensions_incomplete","The universal read-output receipt does not prove full, unbounded include, amount, and cost dimensions."),M(t,n?.strings_compacted===!0||n?.rows_compacted===!0||e.output_budget_truncation!==void 0,"budget_compaction","Universal output shaping compacted the result.");let o=_e(e.output_budget_exceeded)?e.output_budget_exceeded:void 0;M(t,n?.result_omitted===!0||o?.omitted_result===!0,"budget_omission","Universal output shaping omitted the useful result."),M(t,e.read_session!==void 0,"session_projection","A cross-call read session can suppress previously served facts.")}function mm(e,t){let n=e.map(o=>_e(o)&&typeof o.id=="string"?o.id.trim():"");M(t,n.some(o=>o.length===0),"invalid_item_id","Every full item row must carry a non-empty string id."),M(t,new Set(n).size!==n.length,"duplicate_item_id","Every item id must occur exactly once.")}function jc(e){if(!_e(e)||!Array.isArray(e.items))return{ok:!1,findings:[{code:rm[0],message:"The result must be an object with an items array."}]};let t=e,n=[],o=im(t,n);return am(t,o,n),lm(t,n),mm(t.items,n),{ok:n.length===0,findings:n}}function yn(e){let t=jc(e);if(!t.ok)throw new gn(t.findings);let n=e;return{...n,complete_list:{contract_version:1,item_count:n.items.length,unique_item_id_count:new Set(n.items.map(o=>o.id)).size,terminal_items_included:!0,source_complete:!0,full_projection:!0,no_omissions:!0,unbounded:!0}}}function pm(e){yn(e)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="10052b6f-216f-5b50-81ec-ee373cc13d17")}catch{}})();function Uc(e){return e.map(t=>({key:t.key,optionName:$r(t),metadataKey:t.metadata_key,type:t.type,commands:[...t.commands],repeatable:t.repeatable,requiredOnCreate:t.required_on_create,...t.description?{description:t.description}:{}}))}function Gc(e){return e.map(t=>({command:t.command,action:t.action,arguments:t.arguments.map(n=>({name:n.name,required:n.required===!0,variadic:n.variadic===!0,description:n.description})),description:t.description,tier:t.tier??"standard",family:t.family??"extensions"}))}(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]="7c898a52-eba4-5626-8207-5ffefd4990ba")}catch{}})();var um=50,ke=new Map;function jo(){ke.clear()}function qc(e,t){let n=ke.get(e);if(n!==void 0)return n;if(ke.size>=um){let s=ke.keys().next().value;ke.delete(s)}let o=t().catch(s=>{throw ke.get(e)===o&&ke.delete(e),s});return ke.set(e,o),o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6f62939a-7b99-5687-93ae-834e0032f1d5")}catch{}})();var fm={"list-all":{action:"list",options:{excludeTerminal:!1}},"list-draft":{action:"list",options:{status:"draft",excludeTerminal:!1}},"list-open":{action:"list",options:{status:"open",excludeTerminal:!1}},"list-in-progress":{action:"list",options:{status:"in_progress",excludeTerminal:!1}},"list-blocked":{action:"list",options:{status:"blocked",excludeTerminal:!1}},"list-closed":{action:"list",options:{status:"closed",excludeTerminal:!1}},"list-canceled":{action:"list",options:{status:"canceled",excludeTerminal:!1}}};function zc(e){return Object.fromEntries(Gr.map(t=>[`${e}-${t}`,{action:e,options:{[t==="adopt-all"?"adoptAll":t]:!0,...e==="package"?{vocabulary:"package"}:{}}}]))}var Uo={ctx:{action:"context"},...fm,...zc("extension"),...zc("package")};(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]="41012e87-ed61-56b2-8505-8f786b3952b2")}catch{}})();var Hc="PmCliError";function _m(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=u.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function hm(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new p(e,_m(t.exitCode??u.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function Go(e){if(!(e instanceof Error)||e.name!==Hc)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}import{constants as At}from"node:fs";import{lstat as Bc,mkdir as zo,open as Vc}from"node:fs/promises";import he from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47")}catch{}})();function qo(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Ho(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function gm(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function ym(e,t,n,o){let s=n.require(e.kind),r=o.outgoingOne.get(`${s.kind}\0${e.source}`);if(r!==void 0&&r!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${s.kind}`);let i=o.incomingOne.get(`${s.kind}\0${e.target}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${s.kind}`);let a=Ho(e,n),c=o.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function bm(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function wm(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=qo(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:qo(e.relationshipId,"relationshipId"),author:qo(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function vm(e,t,n,o,s,r){let i=n.has(t);if(e.action==="add"&&i)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!i)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(a)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let d=new Be([a,c],[e.edge],s).edges()[0];return ym(d,t,s,r),gm(d)}var Ct=class{#t;#n;#o=[];#r=new Set;#e=new Map;#s={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??Ut()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,s=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(s)||s<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let r=n-1;r<o;r+=s)yield Object.freeze(this.#o.slice(r,Math.min(r+s,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let s=t,r=0,i;for(let a of this.stream({...o,batchSize:256}))for(let c of a)s=n(s,c),r+=1,i=c;return Object.freeze({state:s,version:i?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:r,...i===void 0?{}:{asOf:i.timestamp}})}#i(t,n){let o=this.#n.require(n.kind);this.#s.identities.set(Ho(n,this.#n),t),o.outgoing==="one"&&this.#s.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#s.incomingOne.set(`${o.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#s.identities.delete(Ho(t,this.#n)),n.outgoing==="one"&&this.#s.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#s.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=wm(t,this.version,this.#r),o=this.#e.get(n.relationshipId),s=vm(t,n.relationshipId,this.#e,this.#t,this.#n,this.#s),r=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...s===void 0?{}:{edge:s},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(r),this.#r.add(n.eventId),o&&this.#a(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,s),this.#i(n.relationshipId,s)),r}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let r=Date.parse(t.atTimestamp);if(!Number.isFinite(r))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(i=>Date.parse(i.timestamp)<=r)}else{let r=t.atVersion??this.version;if(!Number.isInteger(r)||r<0||r>this.version)throw new TypeError(`Relationship snapshot version out of range: ${r}`);n=this.#o.slice(0,r)}let o=bm(n),s=new Be(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:s.edges(),graph:s})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Dr("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(Nr(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let s=jr(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:r=>r.eventId,snapshot:String(o)});return{version:o,events:s.rows,hasMore:s.has_more,...s.next_cursor?{nextCursor:s.next_cursor}:{}}}},km="relationship-event-store",Wc=At.O_NOFOLLOW;function bn(e){return W(e,km,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function Ne(e,t="relationships/events.jsonl"){let n=he.resolve(e),o=he.resolve(n,t),s=he.relative(n,o);if(s.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(s===".."||s.startsWith(`..${he.sep}`)||he.isAbsolute(s))throw new TypeError("Relationship event path must stay within the tracker root");if(await zo(n,{recursive:!0}),(await Bc(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let i=n;for(let a of s.split(he.sep)){i=he.join(i,a);try{if((await Bc(i)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(Nn(c))break;throw c}}return o}async function wn(e,t,n){let o=new Ct(t,{registry:n}),s,r;try{r=await Vc(e,At.O_RDONLY|Wc),s=await r.readFile("utf8")}catch(a){if(Nn(a))return{log:o,raw:""};throw a}finally{await r?.close()}let i=s.split(`
2
2
  `);for(let a=0;a<i.length;a+=1){let c=i[a].trim();if(!c)continue;let d;try{d=JSON.parse(c)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${a+1}`)}if(d.sequence!==o.version+1)throw new TypeError(`Invalid relationship event sequence at line ${a+1}`);o.append({eventId:d.eventId,relationshipId:d.relationshipId,action:d.action,...d.edge===void 0?{}:{edge:d.edge},author:d.author,timestamp:d.timestamp,...d.reason===void 0?{}:{reason:d.reason},expectedVersion:o.version})}return{log:o,raw:s}}function Sm(e,t,n,o){let s=Date.parse(t.timestamp),r;return t.action!=="remove"&&t.edge!==void 0&&(r=new Be(n,[t.edge],o).edges()[0]),e.eventId===t.eventId.trim()&&e.relationshipId===t.relationshipId.trim()&&e.action===t.action&&e.author===t.author.trim()&&Number.isFinite(s)&&e.timestamp===new Date(s).toISOString()&&e.reason===(t.reason?.trim()||void 0)&&F(e.edge)===F(r)}var vn=class e{#t;#n;#o;#r;#e;constructor(t,n,o,s){this.#t=t.pmRoot,this.#n=n,this.#o=t.registry,this.#r=o,this.#e=s}static async open(t){let n=Object.freeze([...t.nodes]),o=await Ne(t.pmRoot,t.relativePath),s=await bn(t.pmRoot);try{await Ne(t.pmRoot,o);let{log:r}=await wn(o,n,t.registry);return new e(t,n,o,r)}finally{await s()}}get path(){return this.#r}async currentVersion(){return this.#e=await this.#s(),this.#e.version}async append(t){let n=await bn(this.#t);try{let o=await Ne(this.#t,this.#r),{log:s}=await wn(o,this.#n,this.#o),r=s.append(t);await zo(he.dirname(o),{recursive:!0}),await Ne(this.#t,o);let i=await Vc(o,At.O_APPEND|At.O_CREAT|At.O_WRONLY|Wc);try{await i.appendFile(`${JSON.stringify(r)}
3
3
  `,"utf8")}finally{await i.close()}return this.#e=s,r}finally{await n()}}async appendBatch(t,n={}){let o=await bn(this.#t);try{let s=await Ne(this.#t,this.#r),{log:r,raw:i}=await wn(s,this.#n,this.#o),a=r.version,c=new Map(r.events().map(m=>[m.eventId,m])),d=[],l=[];for(let m of t){let f=m.eventId.trim(),_=c.get(f);if(_!==void 0){if(n.existingEventPolicy==="skip_identical"&&Sm(_,m,this.#n,this.#o)){l.push(_.eventId);continue}if(n.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${f}`)}let w=r.append(m);c.set(w.eventId,w),d.push(w)}if(d.length>0){let m=i.length===0||i.endsWith(`
4
4
  `)?i:`${i}
@@ -2089,4 +2089,4 @@ end`}var Gh={bash:'Add to ~/.bashrc or ~/.bash_profile: eval "$(pm completion ba
2089
2089
  `);j(e.progressEnabled,"writing keyword artifacts"),await H(t,`${JSON.stringify(e.manifest,null,2)}
2090
2090
  `),await H(n,`${s}
2091
2091
  `);let r=[];if(e.mode!=="keyword")try{j(e.progressEnabled,"writing vectorization status ledger"),await wi(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(i){r.push(`search_vectorization_status_ledger_write_failed:${i instanceof Error?i.message:String(i)}`)}return r}async function ug(e,t){let n=Vh(e.mode),o=Bh(e),s=e.full===!0;j(o,`start mode=${n}`);let r=E(process.cwd(),t.path);await $(r);let i=si(await R(r)).settings,a=null;try{a=await W(r,ri,i.locks.ttl_seconds,A(void 0,"pm-reindex"),!1,i.governance.force_required_for_stale_lock,i.locks.wait_ms)}catch(c){throw c instanceof p&&c.exitCode===u.CONFLICT?new p("Another pm reindex run is already active for this project. Wait for it to finish before starting a new keyword, semantic, or hybrid reindex.",u.CONFLICT,{code:"reindex_already_running",type:"urn:pm-cli:error:reindex_already_running",why:"Semantic reindex can be expensive and duplicate runs compete for the same local embedding model and vector store.",nextSteps:["Check active pm reindex processes before starting another reindex.","Rerun with --progress when you need non-interactive visibility."]}):c}try{let c=Yh(i),d=Jh(i),l=ng({requestedMode:n,pmRoot:r,settings:i,extensionEmbedding:c,extensionVectorAdapter:d}),m=n;j(o,"loading item corpus");let f=await og({pmRoot:r,settings:i}),_=f.warnings,{documentCandidates:w,metadataDocuments:v}=f;j(o,`loaded_items=${v.length}`);let g=S(),h=tg(m,g,v),k=Pt.join(r,Bs),x=Pt.join(r,Vs),T=m==="keyword"?await Ks(r,w,i.schema,_):v,I=[],L={},q=null,se=eg(m);if(m==="keyword"&&await sg({pmRoot:r,settings:i,forceFullSemantic:s,extensionEmbedding:c,reindexWarnings:_}),m!=="keyword"){let re=await mg({pmRoot:r,settings:i,requestedMode:n,activeEmbeddingProvider:l.activeEmbeddingProvider,activeVectorStore:l.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:d,documentCandidates:w,metadataDocuments:v,documentsForKeywordArtifacts:T,forceFullSemantic:s,reindexWarnings:_,semanticWarnings:I,semanticSummary:se,progressEnabled:o});T=re.documentsForKeywordArtifacts,L=re.vectorizationLedgerEntries,q=re.vectorizationEmbeddingMetadata}let le=await pg({pmRoot:r,mode:m,manifest:h,documentsForKeywordArtifacts:T,settings:i,vectorizationLedgerEntries:L,vectorizationEmbeddingMetadata:q,progressEnabled:o}),Ee=[...await N({path:k,scope:"project",op:"reindex:manifest"}),...await N({path:x,scope:"project",op:"reindex:embeddings"}),...await gr({mode:m,total_items:v.length})];return j(o,"done"),{ok:!0,mode:m,total_items:v.length,semantic:se,artifacts:{manifest:Bs,embeddings:Vs},warnings:[..._,...I,...le,...Ee],generated_at:g}}finally{await a?.()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="72111aa2-52b2-53da-a1c8-07ba53a74944")}catch{}})();var Yl=Symbol("pm.active-extension-host-context");function X(e){return{fullChangedFields:!0,options:e}}var b=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[Yl]=!0,n}run(t,n={}){return kg({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return Nc(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return yn(await this.list(No(t)))}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},o={}){return this.runTyped("graph",{subcommand:t,...n,options:o})}append(t,n,o={}){return this.runTyped("append",{id:t,...X(St(o,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,o,s,r={}){return this.runTyped("config",{scope:t,configAction:n,...o===void 0?{}:{key:o},...s===void 0?{}:{value:s},options:r})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,o,s){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-field",to:n,...s?{fieldTypeScope:s}:{}}})}schemaRemapStatus(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,o={},s,r){return this.runTyped("plan",{...n===void 0?{}:{id:n},...s===void 0?{}:{stepRef:s},...r===void 0?{}:{reorderTo:r},options:St(o,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,o){return this.plan("update-step",t,o,n)}planCompleteStep(t,n,o={}){return this.plan("complete-step",t,o,n)}planBlockStep(t,n,o){return this.plan("block-step",t,o,n)}planReorderStep(t,n,o,s={}){return this.plan("reorder-step",t,s,n,o)}planRemoveStep(t,n,o={}){return this.plan("remove-step",t,o,n)}planLink(t,n,o){return this.plan("link",t,o,n)}planUnlink(t,n,o){return this.plan("unlink",t,o,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",X(t))}update(t,n={}){return this.runTyped("update",{id:t,...X(n)})}reopen(t,n,o={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:o})}close(t,n,o={}){return this.runTyped("close",{id:t,reason:n,...X(o)})}claim(t,n={}){return this.runTyped("claim",{id:t,...X(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...X(t)})}release(t,n={}){return this.runTyped("release",{id:t,...X(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...X(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...X(n)})}restore(t,n,o={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...o,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...X(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...X(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...X(n)})}closeTask(t,n,o={}){return this.runTyped("close-task",{id:t,reason:n,...X(o)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function ex(e={},t={}){return new b(t).context(e)}function tx(e={},t={}){return new b(t).list(e)}function nx(e={},t={}){return new b(t).listAllComplete(e)}function ox(e,t={},n={}){return new b(n).search(e,t)}function sx(e,t={},n={}){return new b(n).get(e,t)}function rx(e={},t={}){return new b(t).next(e)}function ix(e={},t={}){return new b(t).aggregate(e)}function ax(e={},t={}){return new b(t).stats(e)}function cx(e={},t={}){return new b(t).duplicates(e)}function dx(e,t={},n={}){return new b(n).comments(e,t)}function lx(e,t={},n={}){return new b(n).notes(e,t)}function mx(e,t={},n={}){return new b(n).learnings(e,t)}function px(e,t={},n={}){return new b(n).files(e,t)}function ux(e,t={},n={}){return new b(n).filesDiscover(e,t)}function fx(e,t={}){return new b(t).filesLookup(e)}function _x(e,t={},n={}){return new b(n).docs(e,t)}function hx(e,t={},n={}){return new b(n).deps(e,t)}function gx(e,t={},n={},o={}){return new b(o).graph(e,t,n)}function yx(e,t,n={},o={}){return new b(o).append(e,t,n)}function bx(e,t={},n={}){return new b(n).init(e,t)}function wx(e,t,n,o,s={},r={}){return new b(r).config(e,t,n,o,s)}function vx(e,t={},n={}){return new b(n).schema(e,t)}function kx(e={}){return new b(e).schemaList()}function Sx(e,t={}){return new b(t).schemaShow(e)}function Ix(e,t={},n={}){return new b(n).schemaAddType(e,t)}function Ex(e,t={},n={}){return new b(n).schemaRemoveType(e,t)}function xx(e,t={},n={}){return new b(n).schemaAddStatus(e,t)}function Rx(e,t={},n={}){return new b(n).schemaRemoveStatus(e,t)}function Ax(e,t={},n={}){return new b(n).schemaAddField(e,t)}function Cx(e,t={},n={}){return new b(n).schemaRemoveField(e,t)}function Tx(e={}){return new b(e).schemaListFields()}function Ox(e,t={}){return new b(t).schemaShowField(e)}function $x(e,t={},n={}){return new b(n).schemaApplyPreset(e,t)}function Px(e={},t={}){return new b(t).schemaInferTypes(e)}function Fx(e,t,n,o={}){return new b(o).schemaRenameType(e,t,n)}function Lx(e,t,n,o,s={}){return new b(s).schemaRenameField(e,t,n,o)}function Mx(e,t,n,o={}){return new b(o).schemaRemapStatus(e,t,n)}function Dx(e,t={}){return new b(t).schemaShowStatus(e)}function Nx(e,t={},n={}){return new b(n).profile(e,t)}function jx(e={}){return new b(e).profileList()}function Ux(e,t={}){return new b(t).profileShow(e)}function Gx(e,t={},n={}){return new b(n).profileApply(e,t)}function qx(e,t={}){return new b(t).profileLint(e)}function zx(e={},t={}){return new b(t).validate(e)}function Hx(e={},t={}){return new b(t).health(e)}function Bx(e={},t={}){return new b(t).gc(e)}function Vx(e,t,n={}){return new b(n).historyRedact(e,t)}function Wx(e,t={},n={}){return new b(n).historyRepair(e,t)}function Kx(e={},t={}){return new b(t).historyRepairAll(e)}function Yx(e,t={},n={}){return new b(n).historyCompact(e,t)}function Jx(e,t={}){return new b(t).historyCompactBulk(e)}function Xx(e={},t={}){return new b(t).create(e)}function Zx(e,t={},n={}){return new b(n).update(e,t)}function Qx(e,t,n={},o={}){return new b(o).reopen(e,t,n)}function eR(e,t,n={},o={}){return new b(o).close(e,t,n)}function tR(e,t={},n={}){return new b(n).claim(e,t)}function nR(e={},t={}){return new b(t).claimNext(e)}function oR(e,t={},n={}){return new b(n).release(e,t)}function sR(e,t={},n={}){return new b(n).copy(e,t)}function rR(e,t={},n={}){return new b(n).delete(e,t)}function iR(e,t,n={},o={}){return new b(o).restore(e,t,n)}function aR(e,t={},n={}){return new b(n).focus(e,t)}function cR(e,t={},n={}){return new b(n).startTask(e,t)}function dR(e,t={},n={}){return new b(n).pauseTask(e,t)}function lR(e,t,n={},o={}){return new b(o).closeTask(e,t,n)}function mR(e,t={},n={}){return new b(n).extension(e,t)}function pR(e={},t={}){return new b(t).extensionList(e)}function uR(e,t={},n={}){return new b(n).extensionActivate(e,t)}function fR(e,t={},n={}){return new b(n).extensionDeactivate(e,t)}function _R(e,t={},n={}){return new b(n).package(e,t)}function hR(e={},t={}){return new b(t).packageList(e)}function gR(e,t={},n={}){return new b(n).packageInstall(e,t)}function yR(e,t={},n={}){return new b(n).packageUninstall(e,t)}function bR(e={},t={}){return new b(t).packageDoctor(e)}function wR(e,t={},n={}){return new b(n).packageManage(e,t)}function vR(e,t={},n={}){return new b(n).packageDescribe(e,t)}function kR(e={},t={}){return new b(t).packageReload(e)}function SR(e={},t={}){return new b(t).packageCatalog(e)}function IR(e,t={},n={}){return new b(n).packageActivate(e,t)}function ER(e,t={},n={}){return new b(n).packageDeactivate(e,t)}function xR(e,t={},n={}){return new b(n).upgrade(e,t)}function _g(e,t,n){return JSON.stringify([Bl.resolve(e),Bl.resolve(n??process.cwd()),t.extensions.enabled,t.extensions.disabled,t.extensions.policy])}async function hg(e,t,n){let o=_g(e,t,n);return qc(o,()=>ty(e,t,n))}async function RR(e,t={}){let n=await R(e),o=t.extensionRegistrations??(t.noExtensions===!0?null:await hg(e,n,t.cwd)),s=P(n,o),r=U(n.schema),i=yt(n.schema);return{types:[...s.types],statuses:r.definitions.map(a=>a.id),openStatus:r.open_status,closeStatus:r.close_status,canceledStatus:r.canceled_status,fields:Uc(i.definitions),extensionCommands:Gc(o?.commands??[])}}async function AR(e,t={}){let n=typeof e=="string"?{...t,pmRoot:e}:e??t,o={json:!0,quiet:n.quiet??!0,noExtensions:n.noExtensions??!1,noPager:!0,profile:n.profile??!1,path:n.pmRoot};return Fo(n,o)}function de(e,t){let n=y(e,t);if(!n)throw new p(`Missing required argument: ${t}`,64);return n}var Vl=fr(),Jl=new fg;function Mn(){Kn(rr()),Yn(ir()),Jn(ar()),Xn(cr()),Zn(dr()),Qn(lr()),eo(mr())}async function Xl(e,t,n,o){return _r(()=>t===void 0?Vl.read(()=>Wl(e,n,o)):Vl.write(()=>yg(t,()=>Wl(e,n,o))))}async function CR(e,t){let n=e.cwd,o=n??process.cwd();return Xl(nn({path:e.path,noExtensions:e.noExtensions}),n,o,()=>Jl.run(!0,t))}async function Wl(e,t,n){let o=E(t,e.path);if(e.noExtensions)return Mn(),Wo({pmRoot:o},()=>n(null));if(!await Z(ut(o)))return Mn(),n(null);let s=null,r;try{let i=await R(o),a=await Bn({pmRoot:o,settings:i,cwd:t,noExtensions:!1}),c=await Wn({...a,loaded:a.loaded});r={loadResult:a,activationResult:c},Kn(c.hooks),Yn(c.commands),Jn(c.parsers),Xn(c.preflight),Zn(c.services),Qn(c.renderers),eo(c.registrations),s={registrations:c.registrations,commands:c.commands,pmRoot:o,packages:a.loaded}}catch(i){Mn(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",i)}try{return await Wo({pmRoot:o,packages:s?.packages},()=>n(s))}finally{Mn(),r&&await Vn(r.loadResult,r.activationResult).catch(()=>{})}}async function gg(e,t,n,o,s){if(!s)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let r=we(e),a=s.registrations.commands.find(d=>we(d.action)===r)?.command??s.commands.handlers.find(d=>we(d.command)===r)?.command;if(!a)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let c=await yr({command:go(a),args:B(n.args??t.args),options:yo(t,n),global:o,pm_root:s.pmRoot,sdk:Kc(s.pmRoot,b.forActiveExtensionHost({pmRoot:s.pmRoot,author:typeof o.author=="string"&&o.author.trim()?o.author.trim():"pm-extension"}))});if(!c.handled){let d=c.warnings.length>0?` (${c.warnings.join(", ")})`:"";throw new p(`Unsupported native pm action: ${e}${d}`,u.USAGE)}return c.result}async function yg(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}var bg=new Set(["activity","aggregate","context","contracts","deps","files-discover","get","graph","health","history","list","next","search","stats","telemetry","validate"]);function wg(e){let t=de(e,"action"),n=we(t),o=lt(Uo,n),s=o?.action??n,r={...e,action:s};return o?.options!==void 0&&(r.options={...o.options,...jn(e.options)}),s==="package"&&(r.options={...jn(r.options),vocabulary:"package"}),{action:s,args:r}}function vg(e){return!bg.has(we(e))}async function kg(e){let t=wg(e),n=nn(t.args),o=vg(t.action),s=y(t.args,"cwd"),r=s??process.cwd();try{return e[Yl]===!0||Jl.getStore()===!0?await Kl(t.action,t.args,n,null):await Xl(n,s,r,i=>Kl(t.action,t.args,n,i))}finally{o&&jo()}}function lt(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function Dn(e){return y(e.args,"target")??y(e.options,"target")}function D(e,t=e.options){return e.id??de(t,"id")}async function Sg(e){let t=Je("list",e.options);return t.compact===void 0&&t.brief===void 0&&t.full===void 0&&t.fields===void 0&&t.includeBody===void 0&&(t.compact=!0),Do(await fe(y(e.args,"status")??y(t,"status"),t,e.global),t)}async function Ig(e){let t=de(e.args,"query"),n=Je("search",e.options,[t]);return n.compact===void 0&&n.full===void 0&&n.fields===void 0&&(n.compact=!0),Do(await Po(t,n,e.global),n)}async function Eg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=te(e.args,e.options);return oe(await Rt(o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function xg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=te(e.args,e.options),s={...o,...o.title===void 0&&typeof e.args.title=="string"?{title:e.args.title}:{},...o.message===void 0&&typeof e.args.message=="string"?{message:e.args.message}:{}};return oe(await ps(D(e,s),s,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function Rg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=te(e.args,e.options);return oe(await ve(D(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function Ag(e){let t=pn(e.options);return t.add===void 0&&t.stdin===void 0&&t.file===void 0&&t.edit===void 0&&t.delete===void 0&&(t.includeMeta=!0,t.limit===void 0&&t.fullHistory!==!0&&(t.limit="20")),nd(D(e),t,e.global)}function Zl(e,t){return nc(bl(e.options,t,ee),e.global)}function Cg(e){let t=B(e.options.lookupPath);if(t&&t.length>0)return Zl(e,t);let n=D(e);return e.options.discover===!0?ko(n,ho(e.options),e.global):tc(n,on(e.options),e.global)}function Tg(e){return $c({subcommand:y(e.args,"subcommand")??y(e.options,"subcommand"),limit:ya(e.args,e.options)},e.global)}function Og(e){let t={...e.options};return t.brief===void 0&&t.summary===void 0&&t.full===void 0&&(t.summary=!0),Qa(e.global,t)}function $g(e){let t=y(e.args,"configAction")??y(e.options,"configAction")??y(e.options,"action");if(t===void 0)throw new p("Missing required argument: configAction",64);let n=y(e.args,"value")??y(e.options,"value"),o=y(e.options,"policy")!==void 0&&n!==void 0?{...e.options,value:n}:e.options;return gc(y(e.args,"scope")??y(e.options,"scope")??"project",t,y(e.args,"key")??y(e.options,"key"),o,e.global,y(e.options,"policy")===void 0?n:void 0)}function Pg(e){let t=e.options;return ua(pa(t),e.global)}function Fg(e,t){if(typeof e=="number"){if(!Number.isFinite(e)||!Number.isInteger(e))throw new p(`${t} must be a finite integer.`,64);return e}if(typeof e=="string"&&e.trim().length>0){let n=e.trim();if(!/^[+-]?\d+(?:st|nd|rd|th)?$/i.test(n))throw new p(`${t} must be a finite integer.`,64);let o=Number.parseInt(n,10);if(!Number.isInteger(o))throw new p(`${t} must be a finite integer.`,64);return o}}function Lg(e){let t=y(e.args,"subcommand")??de(e.options,"subcommand"),n=e.options;return kd({subcommand:t,id:typeof e.id=="string"?e.id:typeof n.id=="string"?n.id:void 0,stepRef:Mg(e),reorderTo:Fg(n.reorderTo??e.args.reorderTo,"plan reorderTo"),options:e.options,global:e.global})}function Mg(e){return typeof e.options.stepRef=="string"?e.options.stepRef:typeof e.args.stepRef=="string"?e.args.stepRef:void 0}function Dg(e){let t=y(e.args,"subcommand")??de(e.options,"subcommand"),n=e.args.alias??e.options.alias;return{ctx:e,subcommand:t.trim().toLowerCase(),name:y(e.args,"name")??y(e.options,"name"),author:y(e.args,"author")??y(e.options,"author"),force:e.args.force===!0||e.options.force===!0,aliases:n===void 0?void 0:B(n)}}function Ng(e){let{ctx:t,subcommand:n,name:o,author:s,force:r}=e,a=lt({list:()=>Da(t.global),show:()=>Na(o,t.global),"show-status":()=>ja(o,t.global),"list-fields":()=>qa(t.global),"show-field":()=>za(o,t.global),"remove-type":()=>Pa(o,{author:s,force:r},t.global),"remove-field":()=>Ga(o,{author:s,force:r},t.global),"remove-status":()=>Ma(o,{author:s,force:r},t.global),"apply-preset":()=>Ha(y(t.args,"typePreset")??y(t.options,"typePreset"),{author:s,force:r},t.global)},n);return a?a():null}function jg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e,i=t.args.commands??t.options.commands,a=t.args.requiredTypes??t.options.requiredTypes;return Ua(n,{type:y(t.args,"fieldType")??y(t.options,"fieldType"),commands:i===void 0?void 0:B(i),description:y(t.args,"description")??y(t.options,"description"),cliFlag:y(t.args,"cliFlag")??y(t.options,"cliFlag"),alias:r,required:t.args.required===!0||t.options.required===!0,requiredOnCreate:t.args.requiredOnCreate===!0||t.options.requiredOnCreate===!0,allowUnset:!(t.args.allowUnset===!1||t.options.allowUnset===!1),requiredTypes:a===void 0?void 0:B(a),author:o,force:s},t.global)}function Ug(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e,i=t.args.role??t.options.role;return La(n,{role:i===void 0?void 0:B(i),alias:r,description:y(t.args,"description")??y(t.options,"description"),order:ee(t.args.order??t.options.order,"schema add-status order"),author:o,force:s},t.global)}function Gg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e;return $a(n,{description:y(t.args,"description")??y(t.options,"description"),defaultStatus:y(t.args,"defaultStatus")??y(t.args,"default_status")??y(t.options,"defaultStatus")??y(t.options,"default_status"),folder:y(t.args,"folder")??y(t.options,"folder"),alias:r,author:o,force:s},t.global)}function qg(e){let{ctx:t,subcommand:n,name:o,author:s,force:r}=e,i=y(t.args,"to")??de(t.options,"to"),a=y(t.args,"migrationId")??y(t.args,"migration_id")??y(t.options,"migrationId")??y(t.options,"migration_id"),c=y(t.args,"fieldTypeScope")??y(t.options,"fieldTypeScope")??y(t.args,"type")??y(t.options,"type"),d=n==="rename-type"?{kind:"rename-type",from:o??"",to:i}:n==="rename-field"?{kind:"rename-field",from:o??"",to:i,...c===void 0?{}:{type:c}}:{kind:"remap-status",from:o??"",to:i};return Ta(d,{migrationId:a,dryRun:t.args.dryRun===!0||t.options.dryRun===!0,author:s,force:r},t.global)}function zg(e){let t=Dg(e),n=Ng(t);if(n!==null)return n;if(t.subcommand==="rename-type"||t.subcommand==="rename-field"||t.subcommand==="remap-status")return qg(t);if(t.subcommand==="add-field")return jg(t);if(t.subcommand==="add-status")return Ug(t);if(t.subcommand==="add-type")return e.args.infer===!0||e.options.infer===!0?Ba({minCount:ee(e.args.minCount??e.options.minCount,"schema infer minCount"),apply:e.args.apply===!0||e.options.apply===!0,author:t.author,force:t.force},e.global):Gg(t);throw me({command_path:"schema",token:t.subcommand,allowed:Oa,exit_code:64})}function Hg(e){let t=y(e.args,"subcommand")??de(e.options,"subcommand"),n=t.trim().toLowerCase(),o=y(e.args,"name")??y(e.options,"name"),r=lt({list:()=>sl(),show:()=>rl(o),lint:()=>il(o),apply:()=>al(o,{dryRun:e.args.dryRun===!0||e.options.dryRun===!0,author:y(e.args,"author")??y(e.options,"author"),force:e.args.force===!0||e.options.force===!0},e.global)},n);if(!r)throw me({command_path:"profile",token:t,allowed:ol,exit_code:64});return r()}async function Bg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=te(e.args,e.options);return oe(await Xc(D(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function Vg(e){let{changedFields:t,runnerOptions:n}=te(e.args,e.options);return oe(await dd(wo(n),e.global),{changedFields:t})}async function Wg(e){let{changedFields:t,runnerOptions:n}=te(e.args,e.options),o=y(e.args,"reason"),s=o!==void 0&&n.reason===void 0?{...n,reason:o}:{...n};return e.force&&s.force===void 0&&(s.force=!0),oe(await td(bo(s),e.global),{changedFields:t})}async function Kg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=te(e.args,e.options),s=y(o,"target")??de(e.args,"target");return oe(await je(D(e,o),s,o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function Yg(e){let t=E(process.cwd(),e.global.path),n=await R(t),o=hn(U(n.schema)),s=D(e),r=await Ao(s,e.force,e.global,e.options),i=await ve(s,St(e.options,{status:o,force:e.force},["assignee"]),e.global);return{id:s,action:"start_task",claim:r,update:i}}async function Jg(e){let t=E(process.cwd(),e.global.path),n=await R(t),o=D(e),s=U(n.schema).open_status,r=await ve(o,St(e.options,{status:s,force:e.force},["assignee"]),e.global),i=await fn(o,e.force,e.global,e.options);return{id:o,action:"pause_task",update:r,release:i}}async function Xg(e){let t=D(e),n=y(e.args,"reason")??y(e.args,"text")??y(e.options,"reason")??y(e.options,"text"),o=await Me(t,n,{...e.options,force:e.force},e.global),s=await fn(t,e.force,e.global,e.options);return{id:t,action:"close_task",close:o,release:s}}function Zg(e){let t={...e.args,...e.options};return _a(de(t,"subcommand"),y(t,"id")??e.id,y(t,"target"),va(t),e.global)}function Qg(e){return Sa(E(process.cwd(),e.global.path),{...e.args,...e.options})}var Ql={init:e=>yc(y(e.args,"prefix"),e.global,e.options),context:e=>xo(Je("context",e.options),e.global),next:e=>Ro(Je("next",e.options),e.global),eval:Fd,events:Ld,merge:Md,workspace:Dd,meet:xn,event:xn,remind:xn,list:Sg,get:e=>{let t=D(e);return $o(t,e.global,Je("get",e.options,[t]))},search:Ig,duplicates:e=>{let t=typeof e.options.status=="string"?[e.options.status]:B(e.options.status);return Mo(e.global,{...t.length===0?{}:{status:t},since:y(e.options,"since"),threshold:typeof e.options.threshold=="number"?e.options.threshold:void 0,limit:e.options.limit==="default"?void 0:ee(e.options.limit,"limit")})},create:Eg,copy:xg,focus:e=>fs(e.id,{clear:e.options.clear===!0||e.args.clear===!0},e.global),update:Rg,"item-reopen":yl,restore:Kg,claim:e=>e.options.next===!0||e.args.next===!0?ac(e.force,e.global,{...e.options,...e.args},{...e.options,...e.args}):Ao(D(e),e.force,e.global,e.options),release:e=>fn(D(e),e.force,e.global,e.options),"start-task":Yg,"pause-task":Jg,"close-task":Xg,close:gl,comments:Ag,notes:e=>sd(D(e),pn(e.options),e.global),learnings:e=>od(D(e),pn(e.options),e.global),files:Cg,docs:e=>ec(D(e),on(e.options),e.global),test:e=>Pc(D(e),e.options,e.global),"test-all":e=>Fc(e.options,e.global),telemetry:Tg,validate:e=>mn(e.options,e.global,{runUpdate:(t,n,o)=>ve(t,n,o)}),health:Og,assurance:e=>oc(e.args,e.options,e.global),contracts:e=>Fo(e.options,e.global),config:$g,activity:Pg,aggregate:e=>So(e.options,e.global),extension:e=>cn(Dn(e),e.options,e.global),package:e=>cn(Dn(e),e.options,e.global),install:e=>cn(Dn(e),{...e.options,install:!0},e.global),upgrade:e=>uc(Dn(e),e.options,e.global),delete:e=>us(D(e),e.options,e.global),deps:e=>fa(D(e),e.options,e.global),graph:Zg,"files-discover":e=>ko(D(e),e.options,e.global),"files-lookup":e=>Zl(e,B(e.options.paths)),history:e=>cc(D(e),e.options,e.global),"history-redact":e=>ca(D(e),e.options,e.global),"history-repair":ul,"history-compact":fl,"history-author-acknowledge":Qg,plan:Lg,schema:zg,profile:Hg,stats:e=>Lo(e.global,wl(e.options)),append:Bg,"update-many":Vg,"close-many":Wg,gc:e=>fc(e.global,e.options)};function TR(e=qr){return e.map(t=>{let n=we(t),o=lt(Uo,n),s=o?.action??n,r=lt(Ql,s)!==void 0;return{action:t,resolved_action:s,covered:r,route:r?o?"alias":"native":"missing"}})}async function Kl(e,t,n,o){let s=_o(t,e);zr(e,s),Hr(e,s);let r={action:e,args:t,options:s,id:y(t,"id"),force:t.force===!0||s.force===!0,global:n,activeExtensions:o},i=lt(Ql,e),a=i?await i(r):await gg(e,t,s,n,o);return s.resolvedOutputFormat="json",Vr(e,s,a)}var ey={closeManyOptionsFromFlat:bo,extensionOptionsFromArgs:yo,globalOptions:nn,mutationListOptions:wa,normalizeActionName:we,normalizeCommandPath:go,normalizeMcpUpdateOptions:ka,normalizeMcpOptionsArrays:ba,optionsWithAuthor:_o,readRequiredString:de,readScalarString:ha,readScalarStringAllowBlank:ga,readStringArray:B,updateManyOptionsFromFlat:wo,withAddNoteOption:on,withFilesDiscoveryOptions:ho,withMutationCompaction:te};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=ey);async function ty(e,t,n){let o=await Bn({pmRoot:e,settings:t,cwd:n??process.cwd(),noExtensions:!1}),s=await Wn(o);try{return s.registrations}finally{try{await Vn(o,s)}catch{}}}export{Hc as a,hm as b,Go as c,Ct as d,vn as e,Kc as f,cy as g,dy as h,ly as i,my as j,py as k,Mc as l,uy as m,om as n,rm as o,gn as p,No as q,jc as r,yn as s,pm as t,jo as u,Vo as v,Yc as w,Rm as x,Cm as y,Tm as z,Wo as A,Xc as B,je as C,td as D,nd as E,od as F,sd as G,dd as H,Kp as I,ld as J,ss as K,kd as L,ps as M,us as N,fs as O,Id as P,Ed as Q,Bu as R,Vu as S,Ad as T,Td as U,Od as V,$d as W,Pd as X,rt as Y,ks as Z,_f as _,Xw as $,Zw as aa,Es as ba,jd as ca,fv as da,_v as ea,Gd as fa,Hd as ga,Fv as ha,$f as ia,$s as ja,Ff as ka,Lf as la,ol as ma,sl as na,rl as oa,il as pa,al as qa,rk as ra,ik as sa,ak as ta,ck as ua,Ps as va,t_ as wa,ml as xa,pl as ya,Fs as za,c_ as Aa,d_ as Ba,l_ as Ca,G as Da,m_ as Ea,p_ as Fa,u_ as Ga,f_ as Ha,Ms as Ia,vl as Ja,at as Ka,Ls as La,kl as Ma,__ as Na,Sl as Oa,h_ as Pa,g_ as Qa,y_ as Ra,b_ as Sa,w_ as Ta,R_ as Ua,Rl as Va,A_ as Wa,L_ as Xa,q_ as Ya,H_ as Za,qh as _a,ug as $a,b as ab,ex as bb,tx as cb,nx as db,ox as eb,sx as fb,rx as gb,ix as hb,ax as ib,cx as jb,dx as kb,lx as lb,mx as mb,px as nb,ux as ob,fx as pb,_x as qb,hx as rb,gx as sb,yx as tb,bx as ub,wx as vb,vx as wb,kx as xb,Sx as yb,Ix as zb,Ex as Ab,xx as Bb,Rx as Cb,Ax as Db,Cx as Eb,Tx as Fb,Ox as Gb,$x as Hb,Px as Ib,Fx as Jb,Lx as Kb,Mx as Lb,Dx as Mb,Nx as Nb,jx as Ob,Ux as Pb,Gx as Qb,qx as Rb,zx as Sb,Hx as Tb,Bx as Ub,Vx as Vb,Wx as Wb,Kx as Xb,Yx as Yb,Jx as Zb,Xx as _b,Zx as $b,Qx as ac,eR as bc,tR as cc,nR as dc,oR as ec,sR as fc,rR as gc,iR as hc,aR as ic,cR as jc,dR as kc,lR as lc,mR as mc,pR as nc,uR as oc,fR as pc,_R as qc,hR as rc,gR as sc,yR as tc,bR as uc,wR as vc,vR as wc,kR as xc,SR as yc,IR as zc,ER as Ac,xR as Bc,RR as Cc,AR as Dc,de as Ec,CR as Fc,kg as Gc,TR as Hc};
2092
- //# sourceMappingURL=chunk-QLUORNIB.js.map
2092
+ //# sourceMappingURL=chunk-KBFP3E4E.js.map
@@ -1,3 +1,3 @@
1
- import{Ha as ce,na as le}from"./chunk-244MI4GS.js";import{$h as ie,Ah as R,Bj as se,C as s,E as l,Ha as I,Oa as G,Pa as x,Sh as ae,Wa as b,Ya as ee,Za as te,bi as w,c as P,da as J,ec as ne,ja as Z,ri as oe,uh as k,xd as re,zc as O}from"./chunk-QKGMHGEI.js";import{execFile as Le}from"node:child_process";import De from"node:path";import{promisify as Ue}from"node:util";(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]="cdfc451a-1148-50c5-934a-cd8bc2bb39e7")}catch{}})();var ze=Ue(Le),je="@unbrained/pm-cli",Fe="latest";function Me(e){let t=e.project===!0||e.local===!0,n=e.global===!0;if(t&&n)throw new l('Options "--project/--local" and "--global" are mutually exclusive.',s.USAGE);return n?"global":"project"}function E(e){return e.trim().toLowerCase()}function _e(e,t){let n=E(t);return[e.name,e.directory,e.source.input,e.source.location,e.source.package,e.source.repository,e.source.owner&&e.source.repo?`${e.source.owner}/${e.source.repo}`:void 0].some(i=>typeof i=="string"&&E(i)===n)}function Ve(e,t){let n=b(process.cwd(),t.path),r=ne(n,process.cwd());return{selected_root:e==="global"?r.global:r.project}}async function Ke(e,t,n){try{let r=await ze(e,t,{cwd:n?.cwd,encoding:"utf8"});return{stdout:r.stdout,stderr:r.stderr}}catch(r){let i=typeof r=="object"&&r!==null&&"stderr"in r?String(r.stderr??""):"",a=i.trim().length>0?i.trim():r instanceof Error?r.message:String(r);throw new l(`Command failed: ${e} ${t.join(" ")}
1
+ import{Ia as ce,na as le}from"./chunk-ZNRLJ54C.js";import{Ac as O,Bh as R,C as s,Cj as se,E as l,Ha as I,Oa as G,Pa as x,Th as ae,Wa as b,Ya as ee,Za as te,ai as ie,c as P,ci as w,da as J,fc as ne,ja as Z,si as oe,vh as k,yd as re}from"./chunk-ES25LX3D.js";import{execFile as Le}from"node:child_process";import De from"node:path";import{promisify as Ue}from"node:util";(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]="cdfc451a-1148-50c5-934a-cd8bc2bb39e7")}catch{}})();var ze=Ue(Le),je="@unbrained/pm-cli",Fe="latest";function Me(e){let t=e.project===!0||e.local===!0,n=e.global===!0;if(t&&n)throw new l('Options "--project/--local" and "--global" are mutually exclusive.',s.USAGE);return n?"global":"project"}function E(e){return e.trim().toLowerCase()}function _e(e,t){let n=E(t);return[e.name,e.directory,e.source.input,e.source.location,e.source.package,e.source.repository,e.source.owner&&e.source.repo?`${e.source.owner}/${e.source.repo}`:void 0].some(i=>typeof i=="string"&&E(i)===n)}function Ve(e,t){let n=b(process.cwd(),t.path),r=ne(n,process.cwd());return{selected_root:e==="global"?r.global:r.project}}async function Ke(e,t,n){try{let r=await ze(e,t,{cwd:n?.cwd,encoding:"utf8"});return{stdout:r.stdout,stderr:r.stderr}}catch(r){let i=typeof r=="object"&&r!==null&&"stderr"in r?String(r.stderr??""):"",a=i.trim().length>0?i.trim():r instanceof Error?r.message:String(r);throw new l(`Command failed: ${e} ${t.join(" ")}
2
2
  ${a}`,s.GENERIC_FAILURE)}}async function Ye(){return Z(import.meta.url,["../../.."])}function A(e){return typeof e.tag=="string"&&e.tag.trim().length>0?e.tag.trim():Fe}function C(e){return typeof e.packageName=="string"&&e.packageName.trim().length>0?e.packageName.trim():je}async function Be(e,t){let n=e.commandRunner??Ke,r=C(e),i=A(e),a=`${r}@${i}`,o=["npm","install","-g",a];e.repair===!0&&o.push("--force");let _=await Ye(),c={requested:!0,status:"planned",package:r,target:a,command:o,before_version:_,repair:e.repair===!0};if(t)return c;try{await n(o[0],o.slice(1));let d=await n("pm",["--version"]);return{...c,status:"updated",after_version:d.stdout.trim()||void 0}}catch(d){return{...c,status:"failed",error:d instanceof Error?d.message:String(d)}}}function We(e){return De.isAbsolute(e)||e.startsWith(".")||e.startsWith("..")||e.startsWith("file:")}function He(e,t){if(e.kind==="npm"){let n=e.input.startsWith("npm:")?e.input.slice(4).trim():e.input.trim();return!We(n)&&e.package&&e.package.trim().length>0?`npm:${e.package.trim()}@${t}`:e.input.startsWith("npm:")?e.input:`npm:${e.input}`}return e.input}async function Qe(e,t){let n=He(e,t);return e.kind!=="local"||await P(n)?n:await P(e.location)?e.location:n}function Xe(e,t,n,r){let i=["pm","install",t,n==="global"?"--global":"--project"];return e.kind==="github"&&r&&r.trim().length>0&&i.push("--ref",r.trim()),i}async function de(e,t){let n=Ve(e,t);return(await le(n.selected_root)).state.entries.filter(i=>i.scope===e)}async function Je(e,t,n){let r=await de(e,t);return r.find(i=>_e(i,n.name))??r.find(i=>E(i.directory)===E(n.directory))}async function Ze(e,t,n,r,i){let a=A(t),o=await Qe(e.source,a),_=Xe(e.source,o,r,e.source.ref),c={name:e.name,directory:e.directory,scope:r,source:e.source,status:"planned",command:_,previous_version:e.manifest_version};if(i)return c;try{await ce(o,{install:!0,project:r==="project",global:r==="global",ref:e.source.kind==="github"?e.source.ref:void 0},n);let d=await Je(r,n,e);return{...c,status:"updated",installed_version:d?.manifest_version}}catch(d){return{...c,status:"failed",error:d instanceof Error?d.message:String(d)}}}function xe(e,t,n,r){let i=[n?e.status:void 0,...t.map(a=>a.status)].filter(a=>typeof a=="string");return{requested_cli:n,requested_packages:r,planned:i.filter(a=>a==="planned").length,updated:i.filter(a=>a==="updated").length,skipped:i.filter(a=>a==="skipped").length,failed:i.filter(a=>a==="failed").length}}async function _n(e,t,n){if(t.cliOnly===!0&&t.packagesOnly===!0)throw new l('Options "--cli-only" and "--packages-only" are mutually exclusive.',s.USAGE);let r=Me(t),i=t.dryRun===!0,a=typeof e=="string"&&e.trim().length>0?e.trim():void 0;if(t.cliOnly===!0&&a)throw new l('A package target cannot be used with "--cli-only".',s.USAGE);let o=!(t.packagesOnly===!0||a),_=t.cliOnly!==!0,c=o?await Be(t,i):{requested:!1,status:"skipped",package:C(t),target:`${C(t)}@${A(t)}`,command:["npm","install","-g",`${C(t)}@${A(t)}`],repair:t.repair===!0,reason:"not_requested"},d=_?await de(r,n):[];if(a&&(d=d.filter(h=>_e(h,a)),d.length===0))throw new l(`Managed package "${a}" was not found in ${r} scope.`,s.NOT_FOUND);let g=[];for(let h of d)g.push(await Ze(h,t,n,r,i));let y=xe(c,g,o,_);return{ok:y.failed===0,action:"upgrade",dry_run:i,scope:r,target:a,cli:c,packages:g,summary:y}}(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]="09703f32-9491-5d3a-9f90-f038d9982e17")}catch{}})();var et=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u,T=128,tt=1e4;function ue(e){let t=e?.trim();if(!t||t==="__proto__"||t.length>T)throw new Error(`A legacy author must contain 1-${T} characters.`);return t}function nt(e){let t=e?.trim().toLowerCase();if(!t||!et.test(t))throw new Error("A canonical harness must be a lowercase dash-separated namespace.");return t}function rt(e){return Object.fromEntries(Object.entries(e).sort(([t],[n])=>t.localeCompare(n)))}function at(e,t){let n=new Set;for(let r of(e??[]).slice(0,tt)){let i=r.trim().slice(0,T);i.length===0||i.startsWith("harness:")||Object.hasOwn(t,i)||n.add(i)}return n.size}function it(e,t){let n=ue(t.legacy_author),r=nt(t.canonical_harness);if(n===r||n===`harness:${r}`||n.startsWith("harness:"))throw new Error(`The legacy author "${n}" is already canonical and must not be aliased.`);return e[n]===r?!1:(e[n]=r,!0)}function ot(e,t){if(t.operation==="add")return it(e,t);if(t.operation==="remove"){let r=ue(t.legacy_author);return Object.hasOwn(e,r)?(delete e[r],!0):!1}if(t.operation==="clear"){let r=Object.keys(e).length>0;for(let i of Object.keys(e))delete e[i];return r}let n=t.operation;throw new Error(`Unsupported vocabulary operation: ${String(n)}`)}function N(e){return{version:e?.version??1,alias_count:Object.keys(e?.aliases??{}).length}}function fe(e,t){let n=e?.version??1,r={...e?.aliases},i=ot(r,t),a={version:i?n+1:n,aliases:rt(r)};return{vocabulary:a,preview:{operation:t.operation,changed:i,version_before:n,version_after:a.version,alias_count:Object.keys(a.aliases).length,residual_author_count:at(t.observed_authors,a.aliases)}}}(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]="77fa2822-1681-59d5-8388-037cf13c45dd")}catch{}})();var ge=new Set(["item_format"]),me=new Set(["definition_of_done","metadata_required_fields","lifecycle_stale_blocker_reason_patterns","lifecycle_closure_like_blocked_reason_patterns","lifecycle_closure_like_resolution_patterns","lifecycle_closure_like_actual_result_patterns"]),st=new Set(["history_missing_stream_policy","sprint_release_format_policy","parent_reference_policy","metadata_validation_profile","governance_preset","governance_ownership_enforcement","governance_create_mode_default","governance_close_validation_default","governance_require_close_reason","governance_create_default_type","governance_workflow_enforcement","governance_parent_reference_policy","governance_metadata_validation_profile","governance_force_required_for_stale_lock","test_result_tracking","untrusted_linked_test_execution","telemetry_tracking","agent_identity_vocabulary"]),lt=new Set(["governance_require_close_reason","governance_force_required_for_stale_lock","test_result_tracking","untrusted_linked_test_execution","telemetry_tracking"]),ct={off:"disabled",on:"enabled",true:"enabled",false:"disabled",enabled:"enabled",disabled:"disabled"};function _t(e){let t=e.trim().toLowerCase().replaceAll("-","_");if(ge.has(t)||me.has(t)||st.has(t)||t==="context")return t}function dt(e){let t=e.trim().toLowerCase();return ct[t]??e}function pe(e,t){let n=_t(e);return n===void 0?{routable:!1,reason:`Unknown config key "${e}" cannot route a positional value.`}:n==="context"?{routable:!1,reason:"Config set context does not accept a positional value. Use --default-depth, --activity-limit, --stale-threshold-days, or --section-<name> flags."}:ge.has(n)?{routable:!0,flag:"format",value:t}:me.has(n)?{routable:!0,flag:"criterion",values:[t]}:{routable:!0,flag:"policy",value:lt.has(n)?dt(t):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]="4e50d57b-4502-5ce5-a6dd-0bdc8eba5af4")}catch{}})();var S=[{key:"search_provider",path:"search.provider",kind:"string",summary:"Search embedding provider name (e.g. openai, ollama, or an extension provider)."},{key:"search_mutation_refresh_policy",path:"search.mutation_refresh_policy",kind:"string",choices:["cache_only","semantic_configured","semantic_auto"],summary:"Mutation-time search refresh policy: cache_only, semantic_configured, or semantic_auto."},{key:"search_query_expansion_enabled",path:"search.query_expansion.enabled",kind:"boolean",summary:"Enable or disable query expansion for semantic/hybrid search."},{key:"search_query_expansion_provider",path:"search.query_expansion.provider",kind:"string",summary:"Query expansion provider name (built-in openai/ollama or extension provider)."},{key:"search_rerank_enabled",path:"search.rerank.enabled",kind:"boolean",summary:"Enable or disable post-retrieval reranking for hybrid search."},{key:"search_rerank_model",path:"search.rerank.model",kind:"string",summary:"Rerank model name override used by built-in providers."},{key:"search_rerank_top_k",path:"search.rerank.top_k",kind:"integer",min:1,summary:"Number of top hybrid candidates to rerank when rerank is enabled."},{key:"search_embedding_model",path:"search.embedding_model",kind:"string",summary:"Default embedding model name (overrides provider-specific model when set)."},{key:"search_embedding_corpus_max_characters",path:"search.embedding_corpus_max_characters",kind:"integer",min:1,summary:"Maximum semantic corpus characters per item before truncation."},{key:"search_embedding_batch_size",path:"search.embedding_batch_size",kind:"integer",min:1,summary:"Number of items embedded per request batch."},{key:"search_embedding_timeout_ms",path:"search.embedding_timeout_ms",kind:"integer",min:1,summary:"Per-request embedding timeout in milliseconds."},{key:"search_score_threshold",path:"search.score_threshold",kind:"number",summary:"Minimum score for a hit to be returned (0 keeps all matches)."},{key:"search_hybrid_semantic_weight",path:"search.hybrid_semantic_weight",kind:"ratio",summary:"Hybrid mode semantic weight in [0, 1] (1-weight goes to keyword)."},{key:"search_max_results",path:"search.max_results",kind:"integer",min:1,summary:"Default upper bound on search hits when --limit is not supplied."},{key:"search_bm25_k1",path:"search.bm25.k1",kind:"number",min:0,summary:"Offline BM25 term-frequency saturation (k1); higher saturates repeated terms slower (default 1.2)."},{key:"search_bm25_b",path:"search.bm25.b",kind:"ratio",summary:"Offline BM25 document-length normalization (b) in [0, 1]; 0 disables, 1 fully normalizes (default 0.75)."},{key:"openai_base_url",path:"providers.openai.base_url",kind:"string",summary:"OpenAI-compatible API base URL (LM Studio/vLLM also use this)."},{key:"openai_api_key",path:"providers.openai.api_key",kind:"string",summary:"OpenAI-compatible API key."},{key:"openai_model",path:"providers.openai.model",kind:"string",summary:"OpenAI-compatible embedding model name."},{key:"ollama_base_url",path:"providers.ollama.base_url",kind:"string",summary:"Ollama API base URL (typically http://localhost:11434)."},{key:"ollama_model",path:"providers.ollama.model",kind:"string",summary:"Ollama embedding model name (e.g. nomic-embed-text)."},{key:"vector_store_adapter",path:"vector_store.adapter",kind:"string",summary:"Vector store adapter name (lancedb, qdrant, or an extension adapter)."},{key:"vector_store_collection_name",path:"vector_store.collection_name",kind:"string",non_empty:!0,summary:"Vector collection/table name shared by Qdrant and LanceDB adapters."},{key:"qdrant_url",path:"vector_store.qdrant.url",kind:"string",summary:"Qdrant HTTP API URL."},{key:"qdrant_api_key",path:"vector_store.qdrant.api_key",kind:"string",summary:"Qdrant API key (empty if running unauthenticated)."},{key:"lancedb_path",path:"vector_store.lancedb.path",kind:"string",summary:"LanceDB storage path (relative to pm root or absolute)."},{key:"id_prefix",path:"id_prefix",kind:"string",non_empty:!0,summary:'Prefix for generated item IDs (e.g. "pm" produces pm-xxxx).'},{key:"author_default",path:"author_default",kind:"string",non_empty:!0,summary:"Default author recorded on mutations when --author is not supplied."},{key:"agent_identity_probes_enabled",path:"agent_identity.probes_enabled",kind:"boolean",summary:"Allow privacy-bounded local harness provenance probes; no network or subprocess access is permitted."},{key:"mutation_guard_require_attributed_author",path:"mutation_guard.require_attributed_author",kind:"boolean",summary:"Reject mutations whose effective author resolves to unknown."},{key:"mutation_guard_secret_guard",path:"mutation_guard.secret_guard",kind:"string",choices:["off","advise","block"],summary:"Detect credential-shaped mutation content: off, advise, or block."},{key:"mutation_guard_stale_in_progress_hours",path:"mutation_guard.stale_in_progress_hours",kind:"integer",min:1,summary:"Age threshold for unclaimed in-progress work surfaced by health."},{key:"governance_duplicate_detection_mode",path:"governance.duplicate_detection_mode",kind:"string",choices:["off","advisory","strict"],summary:"Create/copy duplicate governance: off, advisory, or strict explicit-bypass enforcement."},{key:"governance_duplicate_detection_threshold",path:"governance.duplicate_detection_threshold",kind:"ratio",summary:"Minimum shared similarity score in [0, 1] for create/copy duplicate governance."},{key:"governance_duplicate_detection_limit",path:"governance.duplicate_detection_limit",kind:"integer",min:0,max:20,summary:"Maximum likely duplicates returned by create/copy governance (0-20)."},{key:"output_default_format",path:"output.default_format",kind:"string",choices:["toon","json"],summary:"Default output format for commands that support it: toon or json."},{key:"ux_deprecation_hints",path:"ux.deprecation_hints",kind:"boolean",summary:"Emit one stderr migration hint for deprecated command aliases."},{key:"locks_ttl_seconds",path:"locks.ttl_seconds",kind:"integer",min:1,summary:"Claim/lock time-to-live in seconds before a stale lock can be reclaimed."},{key:"locks_wait_ms",path:"locks.wait_ms",kind:"integer",min:0,summary:"Bounded jittered wait in milliseconds before a contended item mutation fails with lock_conflict; 0 fails fast. PM_LOCK_WAIT_MS overrides per invocation."},{key:"ids_token_length",path:"ids.token_length",kind:"integer",min:4,max:12,summary:"Random base36 token length for newly minted item ids (4-12, default 4). Raise it to shrink cross-branch id collision odds in concurrent multi-agent workflows (pm-pibw)."},{key:"checkpoints_retention_days",path:"checkpoints.retention_days",kind:"integer",min:1,summary:"Age in days above which pm gc --scope checkpoints prunes bulk-mutation rollback checkpoints."},{key:"schema_unknown_field_policy",path:"schema.unknown_field_policy",kind:"string",choices:["allow","warn","reject"],summary:"How item I/O handles metadata keys not in the field registry: allow, warn, or reject."},{key:"history_compact_policy_enabled",path:"history.compact_policy.enabled",kind:"boolean",summary:"Enable the history-compaction advisory: pm health warns on over-threshold streams."},{key:"history_compact_policy_max_entries",path:"history.compact_policy.max_entries",kind:"integer",min:1,summary:"Entry count above which a history stream is flagged (and the default pm history-compact --all-over threshold)."},{key:"history_compact_policy_trigger",path:"history.compact_policy.trigger",kind:"string",choices:["health_warn","auto"],summary:"History-compaction policy intent: health_warn (advisory only) or auto (scheduled sweeps expected)."}],ut=new Map(S.flatMap(e=>[[e.key,e],[e.path.toLowerCase().replaceAll("-","_"),e]]));function ye(e){if(typeof e!="string")return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length!==0)return ut.get(t)}function ft(e,t){let n=t.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"||n==="on"?{ok:!0,parsed:{descriptor:e,value:!0}}:n==="false"||n==="0"||n==="no"||n==="off"?{ok:!0,parsed:{descriptor:e,value:!1}}:{ok:!1,error:{message:`Config set ${e.key} requires a boolean value (true|false), got "${t}"`}}}function gt(e,t,n){return e.non_empty===!0&&n.length===0?{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}}:e.choices&&!e.choices.includes(n)?{ok:!1,error:{message:`Config set ${e.key} must be one of ${e.choices.join("|")}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function mt(e,t,n){if(n.length===0)return{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}};let r=Number(n);return Number.isFinite(r)?{ok:!0,value:r}:{ok:!1,error:{message:`Config set ${e.key} requires a finite number, got "${t}"`}}}function pt(e,t,n){return!Number.isInteger(n)||n<0?{ok:!1,error:{message:`Config set ${e.key} requires a non-negative integer, got "${t}"`}}:e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires an integer >= ${e.min}, got "${t}" (the runtime silently ignores 0 here and falls back to the default)`}}:e.max!==void 0&&n>e.max?{ok:!1,error:{message:`Config set ${e.key} requires an integer <= ${e.max}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function yt(e,t,n){return n<0||n>1?{ok:!1,error:{message:`Config set ${e.key} requires a number in [0, 1], got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function ht(e,t,n){return e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires a number >= ${e.min}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function he(e,t){if(typeof t!="string")return{ok:!1,error:{message:`Config set ${e.key} requires a string value`}};let n=t.trim();if(e.kind==="boolean")return ft(e,t);if(e.kind==="string")return gt(e,t,n);let r=mt(e,t,n);return r.ok?e.kind==="integer"?pt(e,t,r.value):e.kind==="ratio"?yt(e,t,r.value):ht(e,t,r.value):{ok:!1,error:r.error}}function $(e,t){let n=t.path.split("."),r=e;for(let i of n){if(typeof r!="object"||r===null)return null;r=r[i]}return typeof r=="string"||typeof r=="number"||typeof r=="boolean"?r:null}function ve(e,t,n){let r=t.path.split("."),i=e;for(let _=0;_<r.length-1;_+=1){let c=r[_],d=i[c];if(typeof d!="object"||d===null||Array.isArray(d)){let g={};i[c]=g,i=g}else i=d}let a=r[r.length-1];return i[a]===n?!1:(i[a]=n,!0)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2f750f85-6c55-5f0f-b5c0-396764839d2a")}catch{}})();var we=["project","global"],p={definition_of_done:["definition-of-done","definition_of_done"],item_format:["item-format","item_format"],history_missing_stream_policy:["history-missing-stream-policy","history_missing_stream_policy"],sprint_release_format_policy:["sprint-release-format-policy","sprint_release_format_policy"],parent_reference_policy:["parent-reference-policy","parent_reference_policy"],metadata_validation_profile:["metadata-validation-profile","metadata_validation_profile"],metadata_required_fields:["metadata-required-fields","metadata_required_fields"],lifecycle_stale_blocker_reason_patterns:["lifecycle-stale-blocker-reason-patterns","lifecycle_stale_blocker_reason_patterns"],lifecycle_closure_like_blocked_reason_patterns:["lifecycle-closure-like-blocked-reason-patterns","lifecycle_closure_like_blocked_reason_patterns"],lifecycle_closure_like_resolution_patterns:["lifecycle-closure-like-resolution-patterns","lifecycle_closure_like_resolution_patterns"],lifecycle_closure_like_actual_result_patterns:["lifecycle-closure-like-actual-result-patterns","lifecycle_closure_like_actual_result_patterns"],governance_preset:["governance-preset","governance_preset"],governance_ownership_enforcement:["governance-ownership-enforcement","governance_ownership_enforcement"],governance_create_mode_default:["governance-create-mode-default","governance_create_mode_default"],governance_close_validation_default:["governance-close-validation-default","governance_close_validation_default"],governance_require_close_reason:["governance-require-close-reason","governance_require_close_reason"],governance_create_default_type:["governance-create-default-type","governance_create_default_type"],governance_workflow_enforcement:["governance-workflow-enforcement","governance_workflow_enforcement"],governance_parent_reference_policy:["governance-parent-reference-policy","governance_parent_reference_policy"],governance_metadata_validation_profile:["governance-metadata-validation-profile","governance_metadata_validation_profile"],governance_force_required_for_stale_lock:["governance-force-required-for-stale-lock","governance_force_required_for_stale_lock"],test_result_tracking:["test-result-tracking","test_result_tracking"],untrusted_linked_test_execution:["untrusted-linked-test-execution","untrusted_linked_test_execution"],telemetry_tracking:["telemetry-tracking","telemetry_tracking"],agent_identity_vocabulary:["agent-identity-vocabulary","agent_identity_vocabulary"],context:["context"]},vt=Object.keys(p).map(e=>p[e][0]),wt=Object.fromEntries(Object.keys(p).flatMap(e=>p[e].map(t=>[t,e]))),bt={definition_of_done:"Definition of Done criteria list.",item_format:"Default item file format.",history_missing_stream_policy:"Missing history stream handling policy.",sprint_release_format_policy:"Sprint/release format validation policy.",parent_reference_policy:"Parent reference validation policy.",metadata_validation_profile:"Validate metadata profile policy (core|strict|custom).",metadata_required_fields:"Validate custom metadata required-fields list.",lifecycle_stale_blocker_reason_patterns:"Validate lifecycle stale-blocker reason substring patterns (criteria list).",lifecycle_closure_like_blocked_reason_patterns:"Validate lifecycle closure-like blocked_reason substring patterns (criteria list).",lifecycle_closure_like_resolution_patterns:"Validate lifecycle closure-like resolution substring patterns (criteria list).",lifecycle_closure_like_actual_result_patterns:"Validate lifecycle closure-like actual_result substring patterns (criteria list).",governance_preset:"Governance preset policy (minimal|default|strict|custom).",governance_ownership_enforcement:"Governance ownership enforcement policy (none|warn|strict).",governance_create_mode_default:"Governance default create mode (progressive|strict).",governance_close_validation_default:"Governance default close validation mode (off|warn|strict).",governance_require_close_reason:"Governance close-reason requirement policy (enabled|disabled).",governance_create_default_type:"Governance default item type for `pm create` when --type is omitted.",governance_workflow_enforcement:"Governance per-type transition enforcement mode (off|warn|strict).",governance_parent_reference_policy:"Governance parent reference policy (warn|strict_error).",governance_metadata_validation_profile:"Governance metadata validation profile (core|strict|custom).",governance_force_required_for_stale_lock:"Governance stale-lock force policy (enabled|disabled).",test_result_tracking:"Item-level linked test result persistence policy.",untrusted_linked_test_execution:"Permit an explicit per-run override for commands not trusted by this clone.",telemetry_tracking:"Telemetry usage reporting policy.",agent_identity_vocabulary:"Versioned exact legacy-author interpretation vocabulary (summary only).",context:"Context command settings (depth, section toggles, limits)."},kt=["lifecycle_stale_blocker_reason_patterns","lifecycle_closure_like_blocked_reason_patterns","lifecycle_closure_like_resolution_patterns","lifecycle_closure_like_actual_result_patterns"],Ct=new Set(["metadata_required_fields",...kt]),Et=new Set(["test_result_tracking","untrusted_linked_test_execution","telemetry_tracking"]),At=new Set(["governance_require_close_reason","governance_force_required_for_stale_lock"]),St=new Set(["governance_ownership_enforcement","governance_create_mode_default","governance_close_validation_default"]),qt=new Set(["governance_parent_reference_policy","governance_metadata_validation_profile","governance_workflow_enforcement"]),Pt=new Set(["governance_preset","governance_create_default_type"]),Ce=e=>Ct.has(e),It=e=>St.has(e),Gt=e=>qt.has(e),Ot=e=>Pt.has(e);function L(e){return e==="definition_of_done"||Ce(e)}function Ee(e){if(we.includes(e))return e;throw new l(`Invalid config scope "${e}". Allowed: ${we.join(", ")}`,s.USAGE)}function Ae(e){if(e==="get"||e==="set"||e==="list"||e==="export")return e;throw J({command_path:"config",token:e.trim()||"<empty>",allowed:["export","get","list","set"],token_kind:"action"})}function Se(e){let t=wt[e];if(t)return t;let n=S.map(r=>r.key).join(", ");throw new l(`Invalid config key "${e}". Supported: ${vt.join(", ")} (underscore variants also accepted). Nested leaf settings: ${n}.`,s.USAGE)}function qe(e,t){let n=[...new Set((e??[]).map(r=>r.trim()).filter(r=>r.length>0))].sort((r,i)=>r.localeCompare(i));if(t){if(n.length>0)throw new l("Config set definition-of-done cannot combine --clear-criteria with --criterion values",s.USAGE);return[]}if(n.length===0)throw new l("Config set definition-of-done requires at least one non-empty --criterion value (or --clear-criteria to clear)",s.USAGE);return n}function Pe(e){let t=e?.trim().toLowerCase();if(t==="toon")return"toon";throw t==="json_markdown"?new l("Config set item-format no longer accepts json_markdown. Markdown item files are legacy read/migration input only.",s.USAGE):new l("Config set item-format requires --format toon",s.USAGE)}function j(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="auto_create"||t==="strict_error")return t;throw new l("Config set history-missing-stream-policy requires --policy with one of: auto_create, strict_error",s.USAGE)}function Ie(e){return F(e,"test-result-tracking")}function F(e,t){let n=e?.trim().toLowerCase().replaceAll("-","_");if(n==="enabled"||n==="disabled")return n;throw new l(`Config set ${t} requires --policy with one of: enabled, disabled`,s.USAGE)}function M(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new l("Config set telemetry-tracking requires --policy with one of: enabled, disabled",s.USAGE)}function q(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="core"||t==="strict"||t==="custom")return t;throw new l("Config set metadata-validation-profile requires --policy with one of: core, strict, custom",s.USAGE)}function V(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="minimal"||t==="default"||t==="strict"||t==="custom")return t;throw new l("Config set governance-preset requires --policy with one of: minimal, default, strict, custom",s.USAGE)}function K(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="none"||t==="warn"||t==="strict")return t;throw new l("Config set governance-ownership-enforcement requires --policy with one of: none, warn, strict",s.USAGE)}function Y(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="progressive"||t==="strict")return t;throw new l("Config set governance-create-mode-default requires --policy with one of: progressive, strict",s.USAGE)}function B(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="off"||t==="warn"||t==="strict")return t;if(t==="none"||t==="disabled")return"off";throw new l("Config set governance-close-validation-default requires --policy with one of: off, warn, strict",s.USAGE)}function W(e){let t=typeof e=="string"?e.trim().toLowerCase().replaceAll("-","_"):void 0;if(t==="off"||t==="warn"||t==="strict")return t;if(t==="none"||t==="disabled")return"off";throw new l("Config set governance-workflow-enforcement requires one of: off, warn, strict",s.USAGE)}function H(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new l("Config set governance-force-required-for-stale-lock requires --policy with one of: enabled, disabled",s.USAGE)}function Q(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new l("Config set governance-require-close-reason requires --policy with one of: enabled, disabled",s.USAGE)}var Rt={test_result_tracking:"test-result-tracking",untrusted_linked_test_execution:"untrusted-linked-test-execution"};function D(e,t){let n=Rt[e];if(n)return F(t,n);switch(e){case"history_missing_stream_policy":return j(t);case"sprint_release_format_policy":return R(t);case"parent_reference_policy":case"governance_parent_reference_policy":return k(t);case"metadata_validation_profile":case"governance_metadata_validation_profile":return q(t);case"governance_preset":return V(t);case"governance_ownership_enforcement":return K(t);case"governance_create_mode_default":return Y(t);case"governance_close_validation_default":return B(t);case"governance_require_close_reason":return Q(t);case"governance_workflow_enforcement":return W(t);case"governance_force_required_for_stale_lock":return H(t);case"telemetry_tracking":return M(t);default:return t.trim().toLowerCase().replaceAll("-","_")}}var be={author:"author",acceptance_criteria:"acceptance_criteria","acceptance-criteria":"acceptance_criteria",estimated_minutes:"estimated_minutes","estimated-minutes":"estimated_minutes",estimate:"estimated_minutes",close_reason:"close_reason","close-reason":"close_reason",reviewer:"reviewer",risk:"risk",confidence:"confidence",sprint:"sprint",release:"release"},Tt=["author","acceptance_criteria","estimated_minutes","close_reason","reviewer","risk","confidence","sprint","release"];function Ge(e,t){let n=[...new Set((e??[]).map(a=>a.trim()).filter(a=>a.length>0))];if(t){if(n.length>0)throw new l("Config set metadata-required-fields cannot combine --clear-criteria with --criterion values",s.USAGE);return[]}if(n.length===0)throw new l("Config set metadata-required-fields requires at least one --criterion value (or --clear-criteria to clear)",s.USAGE);let r=n.map(a=>a.toLowerCase().replaceAll("-","_")),i=r.filter(a=>be[a]===void 0);if(i.length>0)throw new l(`Config set metadata-required-fields received unsupported values: ${i.join(", ")}. Supported values: ${Tt.join(", ")}`,s.USAGE);return[...new Set(r.map(a=>be[a]))].sort((a,o)=>a.localeCompare(o))}function Nt(e,t,n){let r=[...new Set((t??[]).map(i=>i.trim().toLowerCase()).filter(i=>i.length>0))].sort((i,a)=>i.localeCompare(a));if(n){if(r.length>0)throw new l(`Config set ${p[e][0]} cannot combine --clear-criteria with --criterion values`,s.USAGE);return[]}if(r.length===0)throw new l(`Config set ${p[e][0]} requires at least one --criterion value (or --clear-criteria to clear)`,s.USAGE);return r}function Oe(e){return[...new Set(e)].sort((t,n)=>t.localeCompare(n))}function $t(e,t){if(e==="list"||e==="export"){if(typeof t=="string"&&t.trim().length>0)throw new l(`Config action "${e}" does not accept <key>`,s.USAGE);return}if(typeof t!="string"||t.trim().length===0)throw new l(`Config action "${e}" requires <key>`,s.USAGE);return Se(t)}function Re(e){if(!e)throw new l("Config action requires <key>",s.USAGE)}var Lt={definition_of_done:e=>[...e.workflow.definition_of_done],item_format:e=>e.item_format,history_missing_stream_policy:e=>e.history.missing_stream,sprint_release_format_policy:e=>e.validation.sprint_release_format,parent_reference_policy:e=>e.validation.parent_reference,metadata_validation_profile:e=>e.validation.metadata_profile,metadata_required_fields:e=>[...e.validation.metadata_required_fields],lifecycle_stale_blocker_reason_patterns:e=>[...e.validation.lifecycle_stale_blocker_reason_patterns],lifecycle_closure_like_blocked_reason_patterns:e=>[...e.validation.lifecycle_closure_like_blocked_reason_patterns],lifecycle_closure_like_resolution_patterns:e=>[...e.validation.lifecycle_closure_like_resolution_patterns],lifecycle_closure_like_actual_result_patterns:e=>[...e.validation.lifecycle_closure_like_actual_result_patterns],governance_preset:e=>e.governance.preset,governance_ownership_enforcement:e=>e.governance.ownership_enforcement,governance_create_mode_default:e=>e.governance.create_mode_default,governance_close_validation_default:e=>e.governance.close_validation_default,governance_require_close_reason:e=>e.governance.require_close_reason?"enabled":"disabled",governance_create_default_type:e=>e.governance.create_default_type??"",governance_workflow_enforcement:e=>e.governance.workflow_enforcement??"off",governance_parent_reference_policy:e=>e.governance.parent_reference,governance_metadata_validation_profile:e=>e.governance.metadata_profile,governance_force_required_for_stale_lock:e=>e.governance.force_required_for_stale_lock?"enabled":"disabled",test_result_tracking:e=>e.testing.record_results_to_items?"enabled":"disabled",untrusted_linked_test_execution:e=>e.testing.allow_untrusted_linked_tests?"enabled":"disabled",telemetry_tracking:e=>e.telemetry.enabled?"enabled":"disabled",agent_identity_vocabulary:e=>N(e.agent_identity?.identity_vocabulary),context:e=>({default_depth:e.context.default_depth,activity_limit:e.context.activity_limit,stale_threshold_days:e.context.stale_threshold_days,sections:{...e.context.sections}})};function X(e,t){return Lt[t](e)}function m(e,t){return t.length===0?e:{...e,warnings:t}}async function Dt(e,t){let n=process.cwd(),r=e==="project"?b(n,t.path):ee(n),i=te(r);return e==="project"&&await oe(r),{pmRoot:r,settingsPath:i}}function Ut(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(t==="true"||t==="enabled"||t==="on"||t==="1")return!0;if(t==="false"||t==="disabled"||t==="off"||t==="0")return!1;throw new l(`Context section toggle must be true|false|enabled|disabled, got "${e}"`,s.USAGE)}function ke(e,t){let n=e.trim(),r=Number(n);if(/^\d+$/u.test(n)&&Number.isSafeInteger(r)&&r>0)return r;throw new l(`Context ${t} must be a positive integer`,s.USAGE)}async function zt(e,t,n,r,i){let a=!1,o=e.context;if(t.defaultDepth!==void 0){let c=t.defaultDepth.trim().toLowerCase();if(!I.includes(c))throw new l(`Context --default-depth must be one of ${I.join("|")}`,s.USAGE);o.default_depth!==c&&(o.default_depth=c,a=!0)}if(t.activityLimit!==void 0){let c=ke(t.activityLimit,"--activity-limit");o.activity_limit!==c&&(o.activity_limit=c,a=!0)}if(t.staleThresholdDays!==void 0){let c=ke(t.staleThresholdDays,"--stale-threshold-days");o.stale_threshold_days!==c&&(o.stale_threshold_days=c,a=!0)}let _=[["hierarchy",t.sectionHierarchy],["activity",t.sectionActivity],["progress",t.sectionProgress],["blockers",t.sectionBlockers],["files",t.sectionFiles],["workload",t.sectionWorkload],["staleness",t.sectionStaleness],["tests",t.sectionTests]];for(let[c,d]of _){let g=Ut(d);if(g!==void 0){let y=c;o.sections[y]!==g&&(o.sections[y]=g,a=!0)}}return a&&await w(n.pmRoot,e,"config:set:context"),m({scope:r,key:"context",context_settings:{default_depth:o.default_depth,activity_limit:o.activity_limit,stale_threshold_days:o.stale_threshold_days,sections:{...o.sections}},settings_path:n.settingsPath,changed:a},i)}function jt(e,t,n){if(n.value!==void 0&&n.value!==t)throw new l(`Config set ${e} received both positional value "${t}" and --value "${n.value}". Pass only one.`,s.USAGE);return{...n,value:t}}function Te(e,t,n,r,i,a){if(i===void 0)return a;if(e!=="set")throw new l(`Config action "${e}" does not accept a positional value. Only "set" takes <value>.`,s.USAGE);if(typeof t!="string"||t.trim().length===0)throw new l('Config action "set" requires <key> before a positional <value>.',s.USAGE);if(r)return jt(t,i,a);Re(n);let o=pe(n,i);if(!o.routable)throw new l(o.reason,s.USAGE);if(o.flag==="criterion"){if(a.criterion!==void 0&&a.criterion.length>0)throw new l(`Config set ${t} received both positional value "${i}" and --criterion. Pass criteria via --criterion only when supplying more than one value.`,s.USAGE);return{...a,criterion:o.values}}if(o.flag==="format")return{...a,format:o.value};if(a.policy!==void 0&&D(n,a.policy)!==D(n,o.value))throw new l(`Config set ${t} received both positional value "${i}" and --policy "${a.policy}". Pass only one.`,s.USAGE);return{...a,policy:o.value}}function Ft(e){let t=Object.keys(p).map(r=>({key:r,aliases:p[r],value_kind:r==="context"||r==="agent_identity_vocabulary"?"object":L(r)?"string_array":"enum",set_flags:r==="context"?["--default-depth","--activity-limit","--stale-threshold-days","--section-<name>"]:r==="agent_identity_vocabulary"?["--policy","--value","--criterion"]:L(r)?["--criterion","--clear-criteria"]:r==="item_format"?["--format"]:["--policy"],summary:bt[r],value:X(e.settings,r)})),n=S.map(r=>({key:r.key,canonical_key:r.key.replaceAll("_","-"),path:r.path,kind:r.kind,value:$(e.settings,r),summary:r.summary,...r.choices?{choices:[...r.choices]}:{},...r.min===void 0?{}:{min:r.min},...r.max===void 0?{}:{max:r.max}}));return m({scope:e.scope,keys:t,nested_settings:n,count:t.length,settings_path:e.target.settingsPath,changed:!1},e.warnings)}function Mt(e){let t=Object.fromEntries(Object.keys(p).map(n=>[n,X(e.settings,n)]));return m({scope:e.scope,values:t,settings_path:e.target.settingsPath,changed:!1},e.warnings)}function Vt(e,t){let n=X(e.settings,t),r={scope:e.scope,key:t,settings_path:e.target.settingsPath,changed:!1};return t==="item_format"?m({...r,format:e.settings.item_format,has_explicit_item_format:e.metadata.has_explicit_item_format},e.warnings):t==="context"?m({...r,context_settings:n},e.warnings):t==="agent_identity_vocabulary"?m({...r,identity_vocabulary:n},e.warnings):Array.isArray(n)?m({...r,criteria:n},e.warnings):m({...r,policy:n},e.warnings)}async function Kt(e,t,n,r){if(t==="get"){let _=$(e.settings,n);return m({scope:e.scope,key:n.key,nested_setting:{key:n.key,path:n.path,kind:n.kind,value:_},settings_path:e.target.settingsPath,changed:!1},e.warnings)}let i=r.value;if(typeof i!="string")throw new l(`Config set ${n.key} requires a value. Pass it positionally (\`pm config ${e.scope} set ${n.key} <value>\`) or via --value.`,s.USAGE);let a=he(n,i);if(!a.ok)throw new l(a.error.message,s.USAGE);let o=ve(e.settings,n,a.parsed.value);return o&&await w(e.target.pmRoot,e.settings,`config:set:${n.path}`),m({scope:e.scope,key:n.key,nested_setting:{key:n.key,path:n.path,kind:n.kind,value:a.parsed.value},settings_path:e.target.settingsPath,changed:o},e.warnings)}async function u(e,t,n){t&&await w(e.target.pmRoot,e.settings,n)}function U(e,t,n){return e!==n||t!==n}function f(e,t,n,r){return m({scope:e.scope,key:t,policy:n,settings_path:e.target.settingsPath,changed:r},e.warnings)}function z(e,t,n,r){return m({scope:e.scope,key:t,criteria:n,settings_path:e.target.settingsPath,changed:r},e.warnings)}async function Yt(e,t){let n=Pe(t.format),r=e.settings.item_format!==n||!e.metadata.has_explicit_item_format,i;if(r){let a=G(e.settings,O()),o=await se(e.target.pmRoot,n,"config:set:item_format:migrate",a.type_to_folder,e.settings.schema);i={target_format:o.target_format,scanned:o.scanned,migrated:o.migrated,removed:o.removed,warnings:o.warnings},e.settings.item_format=n,await w(e.target.pmRoot,e.settings,"config:set:item_format")}return m({scope:e.scope,key:"item_format",format:e.settings.item_format,has_explicit_item_format:!0,migration:i,settings_path:e.target.settingsPath,changed:r},e.warnings)}async function Bt(e,t,n){if(t==="history_missing_stream_policy"){let a=j(n.policy),o=e.settings.history.missing_stream!==a;return e.settings.history.missing_stream=a,await u(e,o,"config:set:history_missing_stream_policy"),f(e,t,e.settings.history.missing_stream,o)}if(t==="sprint_release_format_policy"){let a=R(n.policy),o=e.settings.validation.sprint_release_format!==a;return e.settings.validation.sprint_release_format=a,await u(e,o,"config:set:sprint_release_format_policy"),f(e,t,e.settings.validation.sprint_release_format,o)}if(t==="parent_reference_policy"){let a=k(n.policy),o=e.settings.validation.parent_reference!==a||e.settings.governance.preset!=="custom"||e.settings.governance.parent_reference!==a;return e.settings.validation.parent_reference=a,e.settings.governance.preset="custom",e.settings.governance.parent_reference=a,await u(e,o,"config:set:parent_reference_policy"),f(e,t,e.settings.validation.parent_reference,o)}let r=q(n.policy),i=e.settings.validation.metadata_profile!==r||e.settings.governance.preset!=="custom"||e.settings.governance.metadata_profile!==r;return e.settings.validation.metadata_profile=r,e.settings.governance.preset="custom",e.settings.governance.metadata_profile=r,await u(e,i,"config:set:metadata_validation_profile"),f(e,t,e.settings.validation.metadata_profile,i)}async function Wt(e,t,n){if(t==="metadata_required_fields"){let _=Ge(n.criterion,n.clearCriteria),c=_.length!==e.settings.validation.metadata_required_fields.length||_.some((d,g)=>d!==e.settings.validation.metadata_required_fields[g]);return e.settings.validation.metadata_required_fields=_,await u(e,c,"config:set:metadata_required_fields"),z(e,t,[...e.settings.validation.metadata_required_fields],c)}let i={lifecycle_stale_blocker_reason_patterns:e.settings.validation.lifecycle_stale_blocker_reason_patterns,lifecycle_closure_like_blocked_reason_patterns:e.settings.validation.lifecycle_closure_like_blocked_reason_patterns,lifecycle_closure_like_resolution_patterns:e.settings.validation.lifecycle_closure_like_resolution_patterns,lifecycle_closure_like_actual_result_patterns:e.settings.validation.lifecycle_closure_like_actual_result_patterns}[t],a=Nt(t,n.criterion,n.clearCriteria),o=a.length!==i.length||a.some((_,c)=>_!==i[c]);return i.splice(0,i.length,...a),await u(e,o,`config:set:${t}`),z(e,t,[...i],o)}async function Ht(e,t,n){if(t==="governance_preset"){let c=V(n.policy),d=e.settings.governance.preset!==c;return e.settings.governance.preset=c,await u(e,d,"config:set:governance_preset"),f(e,t,e.settings.governance.preset,d)}let r=typeof n.policy=="string",i=r?n.policy.trim():"";if(r&&i.length===0){let c=e.settings.governance.create_default_type!==void 0;return delete e.settings.governance.create_default_type,await u(e,c,"config:set:governance_create_default_type"),f(e,t,e.settings.governance.create_default_type??"",c)}if(i.length===0)throw new l('Config set governance-create-default-type requires an item type value (or an empty value "" to clear it)',s.USAGE);let a=G(e.settings,O()),o=x(i,a);if(!o)throw new l(ae(i,a.types,re(e.target.pmRoot,e.settings.schema)),s.USAGE);let _=e.settings.governance.create_default_type!==o;return e.settings.governance.create_default_type=o,await u(e,_,"config:set:governance_create_default_type"),f(e,t,e.settings.governance.create_default_type,_)}async function Qt(e,t,n){if(t==="governance_ownership_enforcement"){let a=K(n.policy),o=e.settings.governance.preset!=="custom"||e.settings.governance.ownership_enforcement!==a;return e.settings.governance.preset="custom",e.settings.governance.ownership_enforcement=a,await u(e,o,"config:set:governance_ownership_enforcement"),f(e,t,e.settings.governance.ownership_enforcement,o)}if(t==="governance_create_mode_default"){let a=Y(n.policy),o=e.settings.governance.preset!=="custom"||e.settings.governance.create_mode_default!==a;return e.settings.governance.preset="custom",e.settings.governance.create_mode_default=a,await u(e,o,"config:set:governance_create_mode_default"),f(e,t,e.settings.governance.create_mode_default,o)}let r=B(n.policy),i=e.settings.governance.preset!=="custom"||e.settings.governance.close_validation_default!==r;return e.settings.governance.preset="custom",e.settings.governance.close_validation_default=r,await u(e,i,"config:set:governance_close_validation_default"),f(e,t,e.settings.governance.close_validation_default,i)}async function Xt(e,t,n){if(t==="governance_parent_reference_policy"){let a=k(n.policy),o=e.settings.governance.preset!=="custom"||U(e.settings.governance.parent_reference,e.settings.validation.parent_reference,a);return e.settings.governance.preset="custom",e.settings.governance.parent_reference=a,e.settings.validation.parent_reference=a,await u(e,o,"config:set:governance_parent_reference_policy"),f(e,t,e.settings.governance.parent_reference,o)}if(t==="governance_metadata_validation_profile"){let a=q(n.policy),o=e.settings.governance.preset!=="custom"||U(e.settings.governance.metadata_profile,e.settings.validation.metadata_profile,a);return e.settings.governance.preset="custom",e.settings.governance.metadata_profile=a,e.settings.validation.metadata_profile=a,await u(e,o,"config:set:governance_metadata_validation_profile"),f(e,t,e.settings.governance.metadata_profile,o)}let r=W(n.policy),i=(e.settings.governance.workflow_enforcement??"off")!==r;return e.settings.governance.workflow_enforcement=r,await u(e,i,"config:set:governance_workflow_enforcement"),f(e,t,e.settings.governance.workflow_enforcement,i)}async function Jt(e,t,n){if(t==="governance_require_close_reason"){let _=Q(n.policy)==="enabled",c=e.settings.governance.require_close_reason!==_;return e.settings.governance.require_close_reason=_,await u(e,c,"config:set:governance_require_close_reason"),f(e,t,e.settings.governance.require_close_reason?"enabled":"disabled",c)}let i=H(n.policy)==="enabled",a=e.settings.governance.preset!=="custom"||e.settings.governance.force_required_for_stale_lock!==i;return e.settings.governance.preset="custom",e.settings.governance.force_required_for_stale_lock=i,await u(e,a,"config:set:governance_force_required_for_stale_lock"),f(e,t,e.settings.governance.force_required_for_stale_lock?"enabled":"disabled",a)}async function Zt(e,t,n){if(t==="test_result_tracking"){let _=Ie(n.policy)==="enabled",c=e.settings.testing.record_results_to_items!==_;return e.settings.testing.record_results_to_items=_,await u(e,c,"config:set:test_result_tracking"),f(e,t,e.settings.testing.record_results_to_items?"enabled":"disabled",c)}if(t==="untrusted_linked_test_execution"){let _=F(n.policy,"untrusted-linked-test-execution")==="enabled",c=e.settings.testing.allow_untrusted_linked_tests!==_;return e.settings.testing.allow_untrusted_linked_tests=_,await u(e,c,"config:set:untrusted_linked_test_execution"),f(e,t,e.settings.testing.allow_untrusted_linked_tests?"enabled":"disabled",c)}let i=M(n.policy)==="enabled",a=e.settings.telemetry.enabled!==i||!e.settings.telemetry.first_run_prompt_completed;return e.settings.telemetry.enabled=i,e.settings.telemetry.first_run_prompt_completed=!0,await u(e,a,"config:set:telemetry_tracking"),f(e,t,e.settings.telemetry.enabled?"enabled":"disabled",a)}async function xt(e,t,n){let r=qe(n.criterion,n.clearCriteria),i=r.length!==e.settings.workflow.definition_of_done.length||r.some((a,o)=>a!==e.settings.workflow.definition_of_done[o]);return e.settings.workflow.definition_of_done=r,await u(e,i,"config:set:definition_of_done"),z(e,t,[...e.settings.workflow.definition_of_done],i)}function en(e){let t=e?.trim().toLowerCase().replaceAll("_","-"),n=t?.startsWith("preview-")===!0,r=n?t.slice(8):t;if(r==="add"||r==="remove"||r==="clear")return{operation:r,dryRun:n};throw new l("Config set agent-identity-vocabulary requires --policy add|remove|clear|preview-add|preview-remove|preview-clear",s.USAGE)}function tn(e,t){if(e==="add"){let n=t?.lastIndexOf("=")??-1;if(n<=0||n===t.length-1)throw new l('Config set agent-identity-vocabulary --policy add requires --value "<legacy-author>=<canonical-harness>"',s.USAGE);return{legacy_author:t.slice(0,n),canonical_harness:t.slice(n+1)}}if(e==="remove"){if(t===void 0)throw new l("Config set agent-identity-vocabulary --policy remove requires --value <legacy-author>",s.USAGE);return{legacy_author:t}}if(t!==void 0)throw new l("Config set agent-identity-vocabulary --policy clear does not accept --value",s.USAGE);return{}}async function nn(e,t){let{operation:n,dryRun:r}=en(t.policy),i=tn(n,t.value),a;try{a=fe(e.settings.agent_identity?.identity_vocabulary,{operation:n,...i,observed_authors:t.criterion})}catch(o){throw new l(o.message,s.USAGE)}return a.preview.changed&&!r&&(e.settings.agent_identity={...e.settings.agent_identity,identity_vocabulary:a.vocabulary},await u(e,!0,`config:set:agent_identity.identity_vocabulary:${n}:v${a.preview.version_after}`)),m({scope:e.scope,key:"agent_identity_vocabulary",identity_vocabulary:N(r?e.settings.agent_identity?.identity_vocabulary:a.vocabulary),vocabulary_mutation:a.preview,settings_path:e.target.settingsPath,changed:a.preview.changed&&!r},e.warnings)}async function rn(e,t,n){if(n.clearCriteria===!0&&!L(t))throw new l("--clear-criteria is only supported with config set criteria-list keys",s.USAGE);return t==="item_format"?Yt(e,n):t==="context"?zt(e.settings,n,e.target,e.scope,e.warnings):t==="agent_identity_vocabulary"?nn(e,n):t==="definition_of_done"?xt(e,t,n):Ce(t)?Wt(e,t,n):Et.has(t)?Zt(e,t,n):At.has(t)?Jt(e,t,n):It(t)?Qt(e,t,n):Gt(t)?Xt(e,t,n):Ot(t)?Ht(e,t,n):Bt(e,t,n)}async function Rn(e,t,n,r,i,a){let o=Ee(e),_=Ae(t),c=_==="get"||_==="set"?ye(n):void 0,d=c?void 0:$t(_,n),g=Te(_,n,d,c,a,r),y=await Dt(o,i),{settings:h,metadata:Ne,warnings:$e}=await ie(y.pmRoot),v={scope:o,target:y,settings:h,metadata:Ne,warnings:Oe($e)};return c?Kt(v,_,c,g):_==="list"?Ft(v):_==="export"?Mt(v):(Re(d),_==="get"?Vt(v,d):rn(v,d,g))}var Tn={hasGovernanceValidationMirrorChange:U,applyPositionalValue:Te,normalizeAction:Ae,normalizeCriteria:qe,normalizeGovernanceCloseValidationDefault:B,normalizeGovernanceCreateModeDefault:Y,normalizeGovernanceForceRequiredForStaleLockPolicy:H,normalizeGovernanceOwnershipEnforcement:K,normalizeGovernancePreset:V,normalizeGovernanceRequireCloseReasonPolicy:Q,normalizeGovernanceWorkflowEnforcement:W,normalizeHistoryMissingStreamPolicy:j,normalizeItemFormat:Pe,normalizeKey:Se,normalizeMetadataRequiredFields:Ge,normalizePolicyForConflict:D,normalizeScope:Ee,normalizeTelemetryTrackingPolicy:M,normalizeTestResultTrackingPolicy:Ie,normalizeValidateMetadataProfile:q,normalizeWarnings:Oe};export{_n as a,ye as b,he as c,$ as d,ve as e,N as f,fe as g,Rn as h,Tn as i};
3
- //# sourceMappingURL=chunk-T2ENPRXF.js.map
3
+ //# sourceMappingURL=chunk-MVYLQ67M.js.map