@unbrained/pm-cli 2026.9.29 → 2026.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +21 -0
  3. package/dist/cli/main.js +1 -1
  4. package/dist/cli/register-list-query.d.ts +8 -5
  5. package/dist/cli/register-list-query.js +2 -2
  6. package/dist/cli-bundle/bundle-manifest.json +153 -153
  7. package/dist/cli-bundle/chunks/{chunk-4DOL43PF.js → chunk-7E2EBJLY.js} +2 -2
  8. package/dist/cli-bundle/chunks/{chunk-SC6JHXFT.js → chunk-A2UPOCSW.js} +27 -27
  9. package/dist/cli-bundle/chunks/{chunk-OTLIM22J.js → chunk-AYHLUJKD.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-5KEPG36D.js → chunk-BNAT4EYR.js} +9 -9
  11. package/dist/cli-bundle/chunks/{chunk-S5A2UIRV.js → chunk-DGOIXJZJ.js} +46 -46
  12. package/dist/cli-bundle/chunks/{chunk-SJI55O65.js → chunk-HGJLVN56.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-U3QJGJYN.js → chunk-JAVO3Z42.js} +3 -3
  14. package/dist/cli-bundle/chunks/{chunk-GP6QTYSD.js → chunk-SCZMJ5DC.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-TV3YDE36.js +2 -0
  16. package/dist/cli-bundle/chunks/{chunk-SEJ53XDN.js → chunk-UIAH7UFK.js} +65 -65
  17. package/dist/cli-bundle/chunks/{chunk-2AQKVJMW.js → chunk-USTAFHIM.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-PJSQAWWQ.js → chunk-VWVFKPLX.js} +73 -73
  19. package/dist/cli-bundle/chunks/{chunk-P75SO5HO.js → chunk-YM342ELM.js} +2 -2
  20. package/dist/cli-bundle/chunks/{register-list-query-R3ELWWPY.js → register-list-query-L6HAHW7V.js} +6 -6
  21. package/dist/cli-bundle/chunks/{register-mutation-WHXJXIHJ.js → register-mutation-6OCZVTW5.js} +2 -2
  22. package/dist/cli-bundle/chunks/{register-operations-7ASWBYQG.js → register-operations-3E5U4TOE.js} +2 -2
  23. package/dist/cli-bundle/chunks/{register-setup-FDRTUG54.js → register-setup-VUD37N4A.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/{chunk-MRH4A542.js → chunk-3CAZ7Z4R.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/{chunk-5MC57KRC.js → chunk-4AORVUT4.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/{chunk-NY6FLQTN.js → chunk-6275G2AN.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/{chunk-T4H6Q44B.js → chunk-DJPP2HAK.js} +3 -3
  28. package/dist/cli-bundle/focused-chunks/{chunk-NXQZMKW5.js → chunk-EVMH4SKN.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-6OXJVE74.js → chunk-IDB6E3ZV.js} +27 -27
  30. package/dist/cli-bundle/focused-chunks/{chunk-2O3QFI3G.js → chunk-IQBFYQF2.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-KLKKCHWM.js → chunk-MOUCTR72.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-7URX7FMY.js → chunk-OMBDUJWZ.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/{chunk-AZE7KUHG.js → chunk-RIJQQOEZ.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-IFBA3ZAT.js → chunk-T4PZJQG4.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-DZVOCJFY.js → chunk-UPOMLSW7.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-AVP5C674.js → chunk-XB5Q2P7Z.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-K3AIMRIK.js → chunk-XUCXRZZZ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-FBIRNSYP.js → chunk-YBQ27KG7.js} +49 -49
  39. package/dist/cli-bundle/focused-chunks/{chunk-4A4DO5ZT.js → chunk-ZJ3CLTV4.js} +2 -2
  40. package/dist/cli-bundle/main.js +2 -2
  41. package/dist/cli-bundle/sdk-authoring.js +1 -1
  42. package/dist/cli-bundle/sdk-contracts.js +1 -1
  43. package/dist/cli-bundle/sdk-core.js +22 -22
  44. package/dist/cli-bundle/sdk-governance.js +1 -1
  45. package/dist/cli-bundle/sdk-graph.js +1 -1
  46. package/dist/cli-bundle/sdk-merge.js +37 -37
  47. package/dist/cli-bundle/sdk-query.js +1 -1
  48. package/dist/cli-bundle/sdk-runtime.js +1 -1
  49. package/dist/cli-bundle/sdk-testing.js +1 -1
  50. package/dist/cli-bundle/sdk.js +2 -2
  51. package/dist/core/extensions/extension-types.d.ts +13 -0
  52. package/dist/core/extensions/extension-types.js +1 -1
  53. package/dist/core/history/workspace-history.d.ts +17 -0
  54. package/dist/core/history/workspace-history.js +1 -1
  55. package/dist/sdk/extension-command-context.d.ts +1 -7
  56. package/dist/sdk/extension-command-context.js +1 -1
  57. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  58. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  59. package/dist/sdk/lifecycle/update.d.ts +2 -0
  60. package/dist/sdk/lifecycle/update.js +1 -1
  61. package/dist/sdk/merge/install.d.ts +2 -2
  62. package/dist/sdk/merge/install.js +1 -1
  63. package/dist/sdk/public-surface.json +1 -1
  64. package/dist/sdk/query/get.d.ts +19 -15
  65. package/dist/sdk/query/get.js +1 -1
  66. package/dist/sdk/runtime.js +1 -1
  67. package/dist/sdk/structured-mutations.js +1 -1
  68. package/dist/sdk/testing.js +1 -1
  69. package/docs/BOUNDED_CONTEXT_READS.md +10 -7
  70. package/docs/COMMANDS.md +1 -1
  71. package/docs/MERGE_SAFETY.md +17 -6
  72. package/docs/README.md +1 -0
  73. package/docs/RELEASE_RELIABILITY.md +26 -4
  74. package/docs/SDK_AUDITED_MUTATIONS.md +52 -0
  75. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +5 -3
  76. package/marketplace.json +2 -2
  77. package/package.json +1 -1
  78. package/packages/pm-beads/package.json +1 -1
  79. package/packages/pm-calendar/package.json +1 -1
  80. package/packages/pm-command-kit/package.json +1 -1
  81. package/packages/pm-digital-twin/package.json +1 -1
  82. package/packages/pm-governance-audit/package.json +1 -1
  83. package/packages/pm-guide-shell/package.json +1 -1
  84. package/packages/pm-kanban/package.json +1 -1
  85. package/packages/pm-lifecycle-hooks/package.json +1 -1
  86. package/packages/pm-linked-test-adapters/package.json +1 -1
  87. package/packages/pm-search-advanced/package.json +1 -1
  88. package/packages/pm-templates/package.json +1 -1
  89. package/packages/pm-todos/package.json +1 -1
  90. package/packages/pm-vcs/package.json +1 -1
  91. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  92. package/plugins/pm-claude/package.json +2 -2
  93. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  94. package/plugins/pm-codex/package.json +2 -2
  95. package/plugins/pm-codex/plugin.json +1 -1
  96. package/dist/cli-bundle/chunks/chunk-D32HVIB2.js +0 -2
@@ -1,3 +1,3 @@
1
- import{$ as y,O as W,Ob as X,P as K,Q as G,R as J,aa as _,q as x,r as $,s as P,sa as H,t as q,u as V,va as Y}from"./chunk-MRH4A542.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]="84305ac5-3641-52f5-80f2-22c0f0ae70ae")}catch{}})();var k=new Set(K),D=Object.freeze({get size(){return k.size},has(e){return k.has(e)},entries(){return k.entries()},keys(){return k.keys()},values(){return k.values()},forEach(e,t){k.forEach(r=>e.call(t,r,r,D))},[Symbol.iterator](){return k.values()}});function B(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Z(e){return typeof e!="string"?null:W(e)}function de(e){try{return structuredClone(e)}catch{return e}}function ue(e){let t=e.trim(),r=t.indexOf("=");if(r<=0)throw new _(`--field entries must use name=value syntax, received: ${e}`,y.USAGE);let n=t.slice(0,r).trim(),s=t.slice(r+1);return{key:n,value:s}}function fe(e){return`--${e.replaceAll("_","-")}`}function me(e,t,r){try{let n=JSON.parse(e);if(r==="array"&&Array.isArray(n)||r==="object"&&typeof n=="object"&&n!==null&&!Array.isArray(n))return n}catch{}throw new _(`--field ${t}=... must be valid JSON ${r}`,y.USAGE)}function ye(e,t,r){if(t==="string")return r;if(t==="number"){let n=r.trim();if(n.length===0)throw new _(`--field ${e}=... must be a number`,y.USAGE);let s=Number(n);if(!Number.isFinite(s))throw new _(`--field ${e}=... must be a number`,y.USAGE);return s}if(t==="boolean"){let n=r.trim().toLowerCase();if(n==="true"||n==="1"||n==="yes")return!0;if(n==="false"||n==="0"||n==="no")return!1;throw new _(`--field ${e}=... must be one of true|false|1|0|yes|no`,y.USAGE)}return t==="string_array"?r.split(/[\n,|]/u).map(n=>n.trim()).filter(n=>n.length>0):me(r,e,t)}function U(e){let t=new Map;if(!e)return t;for(let r of e.item_fields)for(let n of r.fields){let s=B(n.name),i=Z(n.type);if(!s||!i)continue;let l=t.get(s);if(l&&l.type!==i)throw new _(`Extension item field "${s}" is declared with conflicting types: ${l.type}, ${i}`,y.USAGE,{code:"extension_item_field_type_conflict",nextSteps:["Make every active extension declaration for this field use the same type."]});t.set(s,{name:s,type:i})}return t}function Q(e){if(D.has(e))throw new _(`Extension item field "${e}" collides with built-in item metadata "${e}"; rename the extension field with an extension-specific prefix. Reserved fields: ${[...D].sort((t,r)=>t.localeCompare(r)).join(", ")}.`,y.USAGE,{code:"extension_item_field_reserved",nextSteps:["Rename the extension item field, preferably with an extension-specific prefix."]})}function Qe(e){return[...U(e).keys()].sort((t,r)=>t.localeCompare(r))}function et(e,t){if(!e||e.length===0)return{};let r=U(t),n={};for(let s of e){let{key:i,value:l}=ue(s),a=r.get(i);if(!a){if(D.has(i)){let c=fe(i);throw new _(`--field ${i} is a core item field, not an extension field`,y.USAGE,{code:"core_item_field_requires_dedicated_flag",field:i,recovery:{provided_fields:[i],suggested_flags:[c]},nextSteps:[`Set the core field with its dedicated flag: pm update <id> ${c} <value>`,`When closing an item, pm close <id> also accepts ${c} <value>.`]})}let o=[...r.keys()].sort((c,u)=>c.localeCompare(u));throw new _(`--field ${i} is not declared by an active extension item-field registration`,y.USAGE,{code:"extension_item_field_unknown",recovery:{provided_fields:o},nextSteps:o.length>0?[`Use one of the declared fields: ${o.join(", ")}`]:["Activate an extension that calls registerItemFields before setting extension fields."]})}Q(a.name),n[a.name]=ye(a.name,a.type,l)}return n}function _e(e,t){return t==="string"?typeof e=="string":t==="number"?typeof e=="number"&&Number.isFinite(e):t==="boolean"?typeof e=="boolean":t==="array"?Array.isArray(e):t==="string_array"?Array.isArray(e)&&e.every(r=>typeof r=="string"):typeof e=="object"&&e!==null&&!Array.isArray(e)}function pe(e,t){return!t||t.length===0?!0:t.some(r=>Object.is(r,e))}function tt(e,t,r={}){if(t){U(t);for(let n of t.item_fields)for(let s of n.fields){let i=B(s.name);if(!i)continue;Q(i),!(i in e)&&!r.skipDefaultFields?.has(i)&&Object.prototype.hasOwnProperty.call(s,"default")&&(e[i]=de(s.default));let l=e[i];if(l===void 0)continue;let a=Z(s.type);if(a&&!_e(l,a))throw new TypeError(`Item field "${i}" must be of type ${a}`);let o=Array.isArray(s.values)?s.values:void 0;if(!pe(l,o))throw new TypeError(`Item field "${i}" must match one of the configured allowed values`)}}}(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]="d66d32f8-a5f2-5068-bcd0-b93094d7c6a4")}catch{}})();var we=2e3,z=new Map;function A(e){if(typeof e!="string")return"";let t=z.get(e);if(t!==void 0)return t;let r=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return z.size>=we&&X(z),z.set(e,r),r}import te from"node:path";import{link as he,mkdir as ge,mkdtemp as Se,rm as Ae,writeFile as be}from"node:fs/promises";import M 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]="fcbdb4d9-ea0e-5944-98c3-4d1944d2641d")}catch{}})();async function ee(e,t){let r=M.dirname(e);await ge(r,{recursive:!0});let n=await Se(M.join(r,".pm-seed-")),s=M.join(n,"value");try{await be(s,t,"utf8");try{return await he(s,e),!0}catch(i){if(i.code==="EEXIST")return!1;throw i}}finally{await Ae(n,{recursive:!0,force:!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]="5e083565-3e07-5fb3-81ce-c392feaa8630")}catch{}})();var p=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),se=J,j=G,ve=["create","update"],Ee=new Set($),ke=new Set(P),Fe=new Set(q),Te=new Set(V),Ie=new Set(["string","number","boolean","array","object"]),De=16;function ie(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ze=[e=>e.type===void 0||typeof e.type=="string"&&Ie.has(e.type),e=>!Object.hasOwn(e,"const")||N(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>N(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||ie(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function N(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(n=>N(n,t)):Object.values(e).every(n=>N(n,t));return t.delete(e),r}function R(e,t=0,r=new Set){if(!ie(e)||t>De||r.has(e))return;r.add(e);let n=e,s=n.type,i=n.enum,l=n.one_of,a=n.properties,o=n.items,c=n.required,u=n.min_length,d=n.min_items,w=n.format,g=n.additional_properties;if(!ze.every(m=>m(n))){r.delete(e);return}let b=a===void 0?void 0:Object.fromEntries(Object.entries(a).map(([m,O])=>[m,R(O,t+1,r)])),v=o===void 0?void 0:R(o,t+1,r),E=l===void 0?void 0:l.map(m=>R(m,t+1,r));if([...Object.values(b??{}),...o===void 0?[]:[v],...E??[]].some(m=>m===void 0)){r.delete(e);return}return r.delete(e),Object.fromEntries(Object.entries({type:s,const:Object.hasOwn(n,"const")?n.const:void 0,enum:i,min_length:u,min_items:d,format:w,properties:b,required:c===void 0?void 0:[...new Set(c)],additional_properties:g,items:v,one_of:E}).filter(([,m])=>m!==void 0))}function T(e){let t=Array.isArray(e)?e:[];return[...new Set(t.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0))].sort((r,n)=>r.localeCompare(n))}function f(e){if(typeof e!="string"||e.length===0)return;let t=A(e);return t.length>0?t:void 0}function Re(e){return e.startsWith("--")?e.slice(2):e}function re(e){return typeof e=="string"?Re(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function oe(e){return e.replaceAll("_","-")}function Ne(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(s=>s.length>0).map(s=>s.toLowerCase());if(t.length===0)return e;let[r,...n]=t;return`${r}${n.map(s=>`${s.slice(0,1).toUpperCase()}${s.slice(1)}`).join("")}`}function L(e,t){let r=f(e.id);if(!r)return null;let n=[...new Set(T(e.aliases).map(A).filter(a=>a.length>0))].sort((a,o)=>a.localeCompare(o)),s=T(e.roles).filter(a=>Ee.has(a)),i=e.description?.trim(),l=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:r,aliases:n,roles:s,description:i&&i.length>0?i:void 0,order:l}}function Oe(e){return{draft_status:f(e?.draft_status),open_status:f(e?.open_status),in_progress_status:f(e?.in_progress_status),blocked_status:f(e?.blocked_status),close_status:f(e?.close_status),canceled_status:f(e?.canceled_status)}}function ae(e,t){if(!Array.isArray(t)||t.length!==2)return;let r=A(t[0]),n=A(t[1]);r.length===0||n.length===0||e.pairs.some(s=>s[0]===r&&s[1]===n)||e.pairs.push([r,n])}function Ue(e){let t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;let r={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(let n of e.allowed_transitions)ae(r,n);return{typeKey:t.toLowerCase(),record:r}}function Me(e){if(!Array.isArray(e)||e.length===0)return;let t=new Map;for(let n of e){let s=Ue(n);if(s===null)continue;let i=t.get(s.typeKey)??s.record;i.denyAll||=s.record.denyAll;for(let l of s.record.pairs)ae(i,l);t.set(s.typeKey,i)}let r=[];for(let n of t.values())(n.pairs.length>0||n.denyAll)&&r.push({type:n.type,allowed_transitions:n.pairs});return r.sort((n,s)=>n.type.localeCompare(s.type)),r.length>0?r:void 0}function le(e){let t=A(e.key??"");if(!t)return null;let r=A(e.metadata_key??e.front_matter_key??t),n=re(e.cli_flag??oe(t));if(!n)return null;let s=T(e.cli_aliases).map(d=>re(d)).filter(d=>d.length>0&&d!==n),i=typeof e.type=="string"?e.type.trim().toLowerCase():"string",l=ke.has(i)?i:"string",a=(()=>{let d=T(e.commands).filter(w=>Fe.has(w));return d.length>0?d:[...ve]})(),o=e.description?.trim(),c=T(e.required_types),u=e.value_schema===void 0?void 0:R(e.value_schema);return e.value_schema!==void 0&&u===void 0?null:{key:t,metadata_key:r,cli_flag:n,cli_aliases:s,description:o&&o.length>0?o:void 0,type:l,commands:a,repeatable:[e.repeatable===!0,l==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:c,allow_unset:e.allow_unset!==!1,value_schema:u}}function Le(e){let t=new Map;for(let[n,s]of e.entries()){let i=L(s,n);i&&t.set(i.id,i)}let r=ne([...t.values()]);return r.length>0?r:ne(j.map((n,s)=>L(n,s)).filter(n=>n!==null))}function ne(e){return e.sort((t,r)=>t.order===r.order?t.id.localeCompare(r.id):t.order-r.order)}function je(e){let t=new Map;for(let r of e??[]){let n=le(r);n&&t.set(n.key,n)}return[...t.values()].sort((r,n)=>r.key.localeCompare(n.key))}function Ce(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function xe(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==oe(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function $e(e){let t=typeof e=="string"?e.trim().toLowerCase():"allow";return Te.has(t)?t:"allow"}function I(e){let t={...p,...e?.files},r=e?.statuses&&e.statuses.length>0?e.statuses:j,n=Le(r),s=je(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:n.map(Ce),fields:s.map(xe),workflow:{...se,...Oe(e?.workflow)},type_workflows:Me(e?.type_workflows),unknown_field_policy:$e(e?.unknown_field_policy)}}function Pe(e,t,r){try{return JSON.parse(e)}catch{r.push(t);return}}function qe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function Ve(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function We(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function Ke(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function Ge(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function h(e,t,r){let n=t?.trim()||r;return te.isAbsolute(n)?n:te.join(e,n)}function yt(e,t){return h(e,t.files.types,p.types)}async function _t(e,t){let r=I(t),n=[{path:h(e,r.files.types,p.types),seed:{definitions:[]}},{path:h(e,r.files.statuses,p.statuses),seed:{statuses:j}},{path:h(e,r.files.fields,p.fields),seed:{fields:[]}},{path:h(e,r.files.workflows,p.workflows),seed:{workflow:se}}],s=[];for(let i of n)await H(i.path)||await ee(i.path,`${JSON.stringify(i.seed,null,2)}
1
+ import{$ as y,O as W,Ob as X,P as K,Q as G,R as J,aa as _,q as x,r as $,s as P,sa as H,t as q,u as V,va as Y}from"./chunk-3CAZ7Z4R.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]="84305ac5-3641-52f5-80f2-22c0f0ae70ae")}catch{}})();var k=new Set(K),D=Object.freeze({get size(){return k.size},has(e){return k.has(e)},entries(){return k.entries()},keys(){return k.keys()},values(){return k.values()},forEach(e,t){k.forEach(r=>e.call(t,r,r,D))},[Symbol.iterator](){return k.values()}});function B(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Z(e){return typeof e!="string"?null:W(e)}function de(e){try{return structuredClone(e)}catch{return e}}function ue(e){let t=e.trim(),r=t.indexOf("=");if(r<=0)throw new _(`--field entries must use name=value syntax, received: ${e}`,y.USAGE);let n=t.slice(0,r).trim(),s=t.slice(r+1);return{key:n,value:s}}function fe(e){return`--${e.replaceAll("_","-")}`}function me(e,t,r){try{let n=JSON.parse(e);if(r==="array"&&Array.isArray(n)||r==="object"&&typeof n=="object"&&n!==null&&!Array.isArray(n))return n}catch{}throw new _(`--field ${t}=... must be valid JSON ${r}`,y.USAGE)}function ye(e,t,r){if(t==="string")return r;if(t==="number"){let n=r.trim();if(n.length===0)throw new _(`--field ${e}=... must be a number`,y.USAGE);let s=Number(n);if(!Number.isFinite(s))throw new _(`--field ${e}=... must be a number`,y.USAGE);return s}if(t==="boolean"){let n=r.trim().toLowerCase();if(n==="true"||n==="1"||n==="yes")return!0;if(n==="false"||n==="0"||n==="no")return!1;throw new _(`--field ${e}=... must be one of true|false|1|0|yes|no`,y.USAGE)}return t==="string_array"?r.split(/[\n,|]/u).map(n=>n.trim()).filter(n=>n.length>0):me(r,e,t)}function U(e){let t=new Map;if(!e)return t;for(let r of e.item_fields)for(let n of r.fields){let s=B(n.name),i=Z(n.type);if(!s||!i)continue;let l=t.get(s);if(l&&l.type!==i)throw new _(`Extension item field "${s}" is declared with conflicting types: ${l.type}, ${i}`,y.USAGE,{code:"extension_item_field_type_conflict",nextSteps:["Make every active extension declaration for this field use the same type."]});t.set(s,{name:s,type:i})}return t}function Q(e){if(D.has(e))throw new _(`Extension item field "${e}" collides with built-in item metadata "${e}"; rename the extension field with an extension-specific prefix. Reserved fields: ${[...D].sort((t,r)=>t.localeCompare(r)).join(", ")}.`,y.USAGE,{code:"extension_item_field_reserved",nextSteps:["Rename the extension item field, preferably with an extension-specific prefix."]})}function Qe(e){return[...U(e).keys()].sort((t,r)=>t.localeCompare(r))}function et(e,t){if(!e||e.length===0)return{};let r=U(t),n={};for(let s of e){let{key:i,value:l}=ue(s),a=r.get(i);if(!a){if(D.has(i)){let c=fe(i);throw new _(`--field ${i} is a core item field, not an extension field`,y.USAGE,{code:"core_item_field_requires_dedicated_flag",field:i,recovery:{provided_fields:[i],suggested_flags:[c]},nextSteps:[`Set the core field with its dedicated flag: pm update <id> ${c} <value>`,`When closing an item, pm close <id> also accepts ${c} <value>.`]})}let o=[...r.keys()].sort((c,u)=>c.localeCompare(u));throw new _(`--field ${i} is not declared by an active extension item-field registration`,y.USAGE,{code:"extension_item_field_unknown",recovery:{provided_fields:o},nextSteps:o.length>0?[`Use one of the declared fields: ${o.join(", ")}`]:["Activate an extension that calls registerItemFields before setting extension fields."]})}Q(a.name),n[a.name]=ye(a.name,a.type,l)}return n}function _e(e,t){return t==="string"?typeof e=="string":t==="number"?typeof e=="number"&&Number.isFinite(e):t==="boolean"?typeof e=="boolean":t==="array"?Array.isArray(e):t==="string_array"?Array.isArray(e)&&e.every(r=>typeof r=="string"):typeof e=="object"&&e!==null&&!Array.isArray(e)}function pe(e,t){return!t||t.length===0?!0:t.some(r=>Object.is(r,e))}function tt(e,t,r={}){if(t){U(t);for(let n of t.item_fields)for(let s of n.fields){let i=B(s.name);if(!i)continue;Q(i),!(i in e)&&!r.skipDefaultFields?.has(i)&&Object.prototype.hasOwnProperty.call(s,"default")&&(e[i]=de(s.default));let l=e[i];if(l===void 0)continue;let a=Z(s.type);if(a&&!_e(l,a))throw new TypeError(`Item field "${i}" must be of type ${a}`);let o=Array.isArray(s.values)?s.values:void 0;if(!pe(l,o))throw new TypeError(`Item field "${i}" must match one of the configured allowed values`)}}}(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]="d66d32f8-a5f2-5068-bcd0-b93094d7c6a4")}catch{}})();var we=2e3,z=new Map;function A(e){if(typeof e!="string")return"";let t=z.get(e);if(t!==void 0)return t;let r=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return z.size>=we&&X(z),z.set(e,r),r}import te from"node:path";import{link as he,mkdir as ge,mkdtemp as Se,rm as Ae,writeFile as be}from"node:fs/promises";import M 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]="fcbdb4d9-ea0e-5944-98c3-4d1944d2641d")}catch{}})();async function ee(e,t){let r=M.dirname(e);await ge(r,{recursive:!0});let n=await Se(M.join(r,".pm-seed-")),s=M.join(n,"value");try{await be(s,t,"utf8");try{return await he(s,e),!0}catch(i){if(i.code==="EEXIST")return!1;throw i}}finally{await Ae(n,{recursive:!0,force:!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]="5e083565-3e07-5fb3-81ce-c392feaa8630")}catch{}})();var p=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),se=J,j=G,ve=["create","update"],Ee=new Set($),ke=new Set(P),Fe=new Set(q),Te=new Set(V),Ie=new Set(["string","number","boolean","array","object"]),De=16;function ie(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ze=[e=>e.type===void 0||typeof e.type=="string"&&Ie.has(e.type),e=>!Object.hasOwn(e,"const")||N(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>N(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||ie(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function N(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(n=>N(n,t)):Object.values(e).every(n=>N(n,t));return t.delete(e),r}function R(e,t=0,r=new Set){if(!ie(e)||t>De||r.has(e))return;r.add(e);let n=e,s=n.type,i=n.enum,l=n.one_of,a=n.properties,o=n.items,c=n.required,u=n.min_length,d=n.min_items,w=n.format,g=n.additional_properties;if(!ze.every(m=>m(n))){r.delete(e);return}let b=a===void 0?void 0:Object.fromEntries(Object.entries(a).map(([m,O])=>[m,R(O,t+1,r)])),v=o===void 0?void 0:R(o,t+1,r),E=l===void 0?void 0:l.map(m=>R(m,t+1,r));if([...Object.values(b??{}),...o===void 0?[]:[v],...E??[]].some(m=>m===void 0)){r.delete(e);return}return r.delete(e),Object.fromEntries(Object.entries({type:s,const:Object.hasOwn(n,"const")?n.const:void 0,enum:i,min_length:u,min_items:d,format:w,properties:b,required:c===void 0?void 0:[...new Set(c)],additional_properties:g,items:v,one_of:E}).filter(([,m])=>m!==void 0))}function T(e){let t=Array.isArray(e)?e:[];return[...new Set(t.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0))].sort((r,n)=>r.localeCompare(n))}function f(e){if(typeof e!="string"||e.length===0)return;let t=A(e);return t.length>0?t:void 0}function Re(e){return e.startsWith("--")?e.slice(2):e}function re(e){return typeof e=="string"?Re(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function oe(e){return e.replaceAll("_","-")}function Ne(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(s=>s.length>0).map(s=>s.toLowerCase());if(t.length===0)return e;let[r,...n]=t;return`${r}${n.map(s=>`${s.slice(0,1).toUpperCase()}${s.slice(1)}`).join("")}`}function L(e,t){let r=f(e.id);if(!r)return null;let n=[...new Set(T(e.aliases).map(A).filter(a=>a.length>0))].sort((a,o)=>a.localeCompare(o)),s=T(e.roles).filter(a=>Ee.has(a)),i=e.description?.trim(),l=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:r,aliases:n,roles:s,description:i&&i.length>0?i:void 0,order:l}}function Oe(e){return{draft_status:f(e?.draft_status),open_status:f(e?.open_status),in_progress_status:f(e?.in_progress_status),blocked_status:f(e?.blocked_status),close_status:f(e?.close_status),canceled_status:f(e?.canceled_status)}}function ae(e,t){if(!Array.isArray(t)||t.length!==2)return;let r=A(t[0]),n=A(t[1]);r.length===0||n.length===0||e.pairs.some(s=>s[0]===r&&s[1]===n)||e.pairs.push([r,n])}function Ue(e){let t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;let r={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(let n of e.allowed_transitions)ae(r,n);return{typeKey:t.toLowerCase(),record:r}}function Me(e){if(!Array.isArray(e)||e.length===0)return;let t=new Map;for(let n of e){let s=Ue(n);if(s===null)continue;let i=t.get(s.typeKey)??s.record;i.denyAll||=s.record.denyAll;for(let l of s.record.pairs)ae(i,l);t.set(s.typeKey,i)}let r=[];for(let n of t.values())(n.pairs.length>0||n.denyAll)&&r.push({type:n.type,allowed_transitions:n.pairs});return r.sort((n,s)=>n.type.localeCompare(s.type)),r.length>0?r:void 0}function le(e){let t=A(e.key??"");if(!t)return null;let r=A(e.metadata_key??e.front_matter_key??t),n=re(e.cli_flag??oe(t));if(!n)return null;let s=T(e.cli_aliases).map(d=>re(d)).filter(d=>d.length>0&&d!==n),i=typeof e.type=="string"?e.type.trim().toLowerCase():"string",l=ke.has(i)?i:"string",a=(()=>{let d=T(e.commands).filter(w=>Fe.has(w));return d.length>0?d:[...ve]})(),o=e.description?.trim(),c=T(e.required_types),u=e.value_schema===void 0?void 0:R(e.value_schema);return e.value_schema!==void 0&&u===void 0?null:{key:t,metadata_key:r,cli_flag:n,cli_aliases:s,description:o&&o.length>0?o:void 0,type:l,commands:a,repeatable:[e.repeatable===!0,l==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:c,allow_unset:e.allow_unset!==!1,value_schema:u}}function Le(e){let t=new Map;for(let[n,s]of e.entries()){let i=L(s,n);i&&t.set(i.id,i)}let r=ne([...t.values()]);return r.length>0?r:ne(j.map((n,s)=>L(n,s)).filter(n=>n!==null))}function ne(e){return e.sort((t,r)=>t.order===r.order?t.id.localeCompare(r.id):t.order-r.order)}function je(e){let t=new Map;for(let r of e??[]){let n=le(r);n&&t.set(n.key,n)}return[...t.values()].sort((r,n)=>r.key.localeCompare(n.key))}function Ce(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function xe(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==oe(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function $e(e){let t=typeof e=="string"?e.trim().toLowerCase():"allow";return Te.has(t)?t:"allow"}function I(e){let t={...p,...e?.files},r=e?.statuses&&e.statuses.length>0?e.statuses:j,n=Le(r),s=je(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:n.map(Ce),fields:s.map(xe),workflow:{...se,...Oe(e?.workflow)},type_workflows:Me(e?.type_workflows),unknown_field_policy:$e(e?.unknown_field_policy)}}function Pe(e,t,r){try{return JSON.parse(e)}catch{r.push(t);return}}function qe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function Ve(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function We(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function Ke(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function Ge(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function h(e,t,r){let n=t?.trim()||r;return te.isAbsolute(n)?n:te.join(e,n)}function yt(e,t){return h(e,t.files.types,p.types)}async function _t(e,t){let r=I(t),n=[{path:h(e,r.files.types,p.types),seed:{definitions:[]}},{path:h(e,r.files.statuses,p.statuses),seed:{statuses:j}},{path:h(e,r.files.fields,p.fields),seed:{fields:[]}},{path:h(e,r.files.workflows,p.workflows),seed:{workflow:se}}],s=[];for(let i of n)await H(i.path)||await ee(i.path,`${JSON.stringify(i.seed,null,2)}
2
2
  `)&&s.push(i.path);return{created_paths:s}}async function pt(e,t){let r=I(t),n=[],s=h(e,r.files.types,p.types),i=h(e,r.files.statuses,p.statuses),l=h(e,r.files.fields,p.fields),a=h(e,r.files.workflows,p.workflows),o,c,u,d,w,g=async(O,ce)=>{let C=await Y(O);if(C!==null)return Pe(C,ce,n)},b=await g(s,"runtime_schema_types_invalid_json");b!==void 0&&(o=qe(b),o===void 0&&n.push("runtime_schema_types_invalid_shape"));let v=await g(i,"runtime_schema_statuses_invalid_json");v!==void 0&&(c=Ve(v),c===void 0&&n.push("runtime_schema_statuses_invalid_shape"));let E=await g(l,"runtime_schema_fields_invalid_json");E!==void 0&&(u=We(E),u===void 0&&n.push("runtime_schema_fields_invalid_shape"));let S=await g(a,"runtime_schema_workflows_invalid_json");return S!==void 0&&(d=Ke(S),d===void 0&&n.push("runtime_schema_workflows_invalid_shape"),w=Ge(S)),{schema:I({...r,statuses:[...r.statuses,...c??[]],fields:[...r.fields,...u??[]],workflow:{...r.workflow,...d},type_workflows:[...r.type_workflows??[],...w??[]]}),type_definitions_from_file:o,warnings:n,created_paths:[]}}function F(e,t,r,n=!1){let i=r.map(a=>f(a)).filter(a=>typeof a=="string").find(a=>e.some(o=>o.id===a));if(n&&i!==void 0)return i;let l=e.find(a=>a.roles.includes(t));return l!==void 0?l.id:i??e[0]?.id}function Je(e){let t=new Map,r=new Map;for(let n of e){r.set(n.id,n),t.set(n.id,n.id),t.set(n.id.replaceAll("_","-"),n.id),t.set(n.id.replaceAll("_"," "),n.id);for(let s of n.aliases)t.set(s,n.id),t.set(s.replaceAll("_","-"),n.id),t.set(s.replaceAll("_"," "),n.id)}return{aliasToId:t,byId:r}}function He(e){let t={activeStatuses:new Set,blockedStatuses:new Set,draftStatuses:new Set,terminalCanceledStatuses:new Set,terminalDoneStatuses:new Set,terminalStatuses:new Set};for(let r of e){let n=new Set(r.roles);(n.has("terminal")||n.has("terminal_done")||n.has("terminal_canceled"))&&t.terminalStatuses.add(r.id),n.has("terminal_done")&&t.terminalDoneStatuses.add(r.id),n.has("terminal_canceled")&&t.terminalCanceledStatuses.add(r.id),n.has("active")&&t.activeStatuses.add(r.id),n.has("blocked")&&t.blockedStatuses.add(r.id),n.has("draft")&&t.draftStatuses.add(r.id)}return t}function wt(e){let t=I(e),r=t.statuses.map((S,m)=>L(S,m)).filter(S=>S!==null),{aliasToId:n,byId:s}=Je(r),{activeStatuses:i,blockedStatuses:l,draftStatuses:a,terminalCanceledStatuses:o,terminalDoneStatuses:c,terminalStatuses:u}=He(r),d=t.workflow,w=f(d.open_status)??F(r,"default_open",["open","in_progress",x[0]]),g=f(d.in_progress_status)??F(r,"active",["in_progress","in-progress",w],!0),b=f(d.blocked_status)??F(r,"blocked",["blocked"]),v=f(d.close_status)??F(r,"default_close",["closed","done","complete"]),E=f(d.canceled_status)??F(r,"default_cancel",["canceled","cancelled"]);return{definitions:r,by_id:s,alias_to_id:n,terminal_statuses:u,terminal_done_statuses:c,terminal_canceled_statuses:o,active_statuses:i,blocked_statuses:l,draft_statuses:a,open_status:w,in_progress_status:g,blocked_status:b,close_status:v,canceled_status:E}}function Ye(e,t){let r=A(e);if(r)return t.alias_to_id.get(r)}function ht(e){let t=I(e),r=new Map,n=t.fields.map(o=>le(o)).filter(o=>o!==null);for(let o of n)r.set(o.key,o);let s=[...r.values()].sort((o,c)=>o.key.localeCompare(c.key)),i=new Map,l=new Map,a=new Map;for(let o of s){i.set(o.key,o),l.set(o.cli_flag,o);for(let c of o.cli_aliases)l.set(c,o);for(let c of o.commands){let u=a.get(c)??[];u.push(o),a.set(c,u)}}for(let[o,c]of a.entries())c.sort((u,d)=>u.key.localeCompare(d.key)),a.set(o,c);return{definitions:s,by_key:i,by_cli_token:l,command_to_fields:a}}function gt(e){return Ne(e.key)}function St(e,t){let r=Ye(e,t);return r?t.terminal_statuses.has(r):!1}export{D as a,Qe as b,et as c,tt as d,A as e,ee as f,p as g,j as h,I as i,h as j,yt as k,_t as l,pt as m,wt as n,Ye as o,ht as p,gt as q,St as r};
3
- //# sourceMappingURL=chunk-4A4DO5ZT.js.map
3
+ //# sourceMappingURL=chunk-ZJ3CLTV4.js.map
@@ -1,4 +1,4 @@
1
- import{B as Vi,D as Bi,E as hn,a as nn,b as ce,c as on,d as rn,e as an,f as sn,g as xi,k as ki,n as G,o as F,p as k,q as de,r as E,s as Gi,x as bt,y as Wi,z as gn}from"./chunks/chunk-2AQKVJMW.js";import{Wa as zi,f as gi,l as bi}from"./chunks/chunk-PJSQAWWQ.js";import"./chunks/chunk-4DOL43PF.js";import"./chunks/chunk-U3QJGJYN.js";import{F as Fi,Id as Hi,Nc as qi,d as wt,g as Di,h as Ni,i as Y,j as Mi}from"./chunks/chunk-SC6JHXFT.js";import{Fa as Li,f as Ci}from"./chunks/chunk-S5A2UIRV.js";import"./chunks/chunk-5KEPG36D.js";import"./chunks/chunk-DEZPZOQ7.js";import{$n as yt,Ac as ti,Bc as ae,Cc as ni,Dc as lt,Do as _t,Eb as zo,Ec as ve,Ef as le,Eo as vt,Fc as se,Ff as fi,Fo as un,Gf as be,Go as He,H as Lo,Ho as T,I as jo,Ic as oi,If as tn,Io as ji,Jc as ct,Jf as _,Jo as fn,L as De,Nb as Go,Ni as ut,Ob as Wo,Oi as vi,Ok as Ei,P as Jt,Pa as Yt,Pc as Zt,Pe as si,Pk as ft,Po as U,Qc as dt,Qe as li,Qk as cn,Rc as ii,Re as ci,Rk as dn,Sa as re,Sc as ri,Se as di,Sk as Le,Te as mi,Tk as mn,Ua as qo,Ub as Vo,Uk as Si,Va as st,Vk as je,Wb as Bo,Xg as hi,Ya as Xt,Yd as mt,Yg as yi,Yk as Ai,Za as Ho,Zk as Ti,_a as $,_n as $i,ad as A,bb as J,bd as Fe,bg as ln,bp as Ui,dm as gt,e as M,eh as pt,fm as qe,g as W,gm as ht,h as O,hc as Ko,ic as Ne,j as V,ji as wi,k as Kt,kc as Me,ki as Ce,kl as Ue,l as B,la as f,lc as Jo,li as D,m as Fo,ma as at,mi as _i,na as C,nl as Oi,oa as Uo,of as pi,ql as Ri,sf as ui,tb as Qt,uc as Yo,vc as Xo,vl as pn,wc as Qo,wl as Ii,x as K,xc as Zo,xl as Pi,yc as ne,ye as ai,zc as ei,ze as en}from"./chunks/chunk-SEJ53XDN.js";import{Command as Ro,CommanderError as ca}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1c4a4bc4-d26a-5f51-bac0-2a132dad1f56")}catch{}})();async function Ki(e,t){await Ii(e,{ok:t.ok,error:t.error,result:se(),exit_code:t.exit_code,error_code:t.error_code,error_category:t.error_category,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage})}async function Ji(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1")return;let t;try{await pi({pmRoot:e.pmRoot,result:se()})}catch(o){t=o}let n=await D(e.pmRoot);if(await ui({pmRoot:e.pmRoot,author:pt(e.author,n.author_default),itemIds:e.itemIds,intent:e.intent}),t!==void 0)throw t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0429ff6a-ec0d-5c20-9fa7-0ed05b154523")}catch{}})();function q(e){return`--${e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`}function me(e){if(!e.startsWith("--"))return;let t=e.includes("=")?e.slice(0,e.indexOf("=")):e;return q(t)}function X(e){let t=new Set,n=[];for(let o of e){let i=me(o);i&&(t.has(i)||n.push(i),t.add(i))}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="dacf3952-3ae1-57fa-840a-c8a43cf855a5")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="63db65f1-fdbe-513d-b71a-87490ec9b69e")}catch{}})();var Yi=new WeakMap;function Ct(e,t){Yi.set(e,t)}function pe(e){return Yi.get(e)}function Xi(e){return e.length>0?[e[0]]:[]}function Ha(e){let t=["","Intent:",` ${e.why}`],n=Xi(e.examples);return n.length>0&&(t.push("","Example:"),t.push(` ${n[0]}`)),t.push("","Need deeper rationale and more examples?"),t.push(" Re-run with --explain."),t.join(`
1
+ import{B as Vi,D as Bi,E as hn,a as nn,b as ce,c as on,d as rn,e as an,f as sn,g as xi,k as ki,n as G,o as F,p as k,q as de,r as E,s as Gi,x as bt,y as Wi,z as gn}from"./chunks/chunk-USTAFHIM.js";import{Wa as zi,f as gi,l as bi}from"./chunks/chunk-VWVFKPLX.js";import"./chunks/chunk-7E2EBJLY.js";import"./chunks/chunk-JAVO3Z42.js";import{F as Fi,Id as Hi,Nc as qi,d as wt,g as Di,h as Ni,i as Y,j as Mi}from"./chunks/chunk-A2UPOCSW.js";import{Fa as Li,f as Ci}from"./chunks/chunk-DGOIXJZJ.js";import"./chunks/chunk-BNAT4EYR.js";import"./chunks/chunk-DEZPZOQ7.js";import{$k as Ai,Ac as ti,Al as Pi,Bc as ae,Cc as ni,Dc as lt,Eb as zo,Ec as ve,Ef as le,Fc as se,Ff as fi,Gf as be,Go as _t,H as Lo,Ho as vt,I as jo,Ic as oi,If as tn,Io as un,Jc as ct,Jf as _,Jo as He,Ko as T,L as De,Lo as ji,Mo as fn,Nb as Go,Ob as Wo,P as Jt,Pa as Yt,Pc as Zt,Pe as si,Qc as dt,Qe as li,Qi as ut,Rc as ii,Re as ci,Ri as vi,Rk as Ei,Sa as re,Sc as ri,Se as di,Sk as ft,So as U,Te as mi,Tk as cn,Ua as qo,Ub as Vo,Uk as dn,Va as st,Vg as hi,Vk as Le,Wb as Bo,Wg as yi,Wk as mn,Xk as Si,Ya as Xt,Yd as mt,Yk as je,Za as Ho,_a as $,ad as A,al as Ti,bb as J,bd as Fe,bo as $i,ch as pt,co as yt,e as M,ep as Ui,fi as wi,g as W,gm as gt,h as O,hc as Ko,hg as ln,hi as Ce,ic as Ne,ii as D,im as qe,j as V,ji as _i,jm as ht,k as Kt,kc as Me,l as B,la as f,lc as Jo,m as Fo,ma as at,na as C,nl as Ue,oa as Uo,of as pi,ql as Oi,sf as ui,tb as Qt,tl as Ri,uc as Yo,vc as Xo,wc as Qo,x as K,xc as Zo,yc as ne,ye as ai,yl as pn,zc as ei,ze as en,zl as Ii}from"./chunks/chunk-UIAH7UFK.js";import{Command as Ro,CommanderError as ca}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1c4a4bc4-d26a-5f51-bac0-2a132dad1f56")}catch{}})();async function Ki(e,t){await Ii(e,{ok:t.ok,error:t.error,result:se(),exit_code:t.exit_code,error_code:t.error_code,error_category:t.error_category,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage})}async function Ji(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1")return;let t;try{await pi({pmRoot:e.pmRoot,result:se()})}catch(o){t=o}let n=await D(e.pmRoot);if(await ui({pmRoot:e.pmRoot,author:pt(e.author,n.author_default),itemIds:e.itemIds,intent:e.intent}),t!==void 0)throw t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0429ff6a-ec0d-5c20-9fa7-0ed05b154523")}catch{}})();function q(e){return`--${e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`}function me(e){if(!e.startsWith("--"))return;let t=e.includes("=")?e.slice(0,e.indexOf("=")):e;return q(t)}function X(e){let t=new Set,n=[];for(let o of e){let i=me(o);i&&(t.has(i)||n.push(i),t.add(i))}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="dacf3952-3ae1-57fa-840a-c8a43cf855a5")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="63db65f1-fdbe-513d-b71a-87490ec9b69e")}catch{}})();var Yi=new WeakMap;function Ct(e,t){Yi.set(e,t)}function pe(e){return Yi.get(e)}function Xi(e){return e.length>0?[e[0]]:[]}function Ha(e){let t=["","Intent:",` ${e.why}`],n=Xi(e.examples);return n.length>0&&(t.push("","Example:"),t.push(` ${n[0]}`)),t.push("","Need deeper rationale and more examples?"),t.push(" Re-run with --explain."),t.join(`
2
2
  `)}function za(e){let t=["","Why use this command:",` ${e.why}`,"","Examples:",...e.examples.map(n=>` ${n}`)];return e.tips&&e.tips.length>0&&(t.push("","Tips:"),t.push(...e.tips.map(n=>` - ${n}`))),t.join(`
3
3
  `)}function Qi(e,t){return t==="detailed"?za(e):Ha(e)}function N(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}var Ga={cal:"calendar",ctx:"context"};function Wa(e,t){return e.commands.find(n=>n.name()===t)??null}function Va(e,t){let n=e;for(let o of t){let i=Wa(n,o);if(!i)return null;n=i}return n}function yn(e,t,n,o){let i=Va(e,t.split(" ").filter(r=>r.length>0));i&&i.addHelpText("after",Qi(n,o))}function wn(e){return e.includes("--explain")?"detailed":"compact"}function oe(e){return e.includes("--all")||e.includes("--explain")}var ue={ops:{why:"Groups workspace diagnostics, quality checks, and maintenance under one discoverable command.",examples:["pm ops health --summary","pm ops validate --check-history-drift","pm ops --help"]},init:{why:"Bootstraps tracker storage and settings so all other commands can run safely.",examples:["pm init","pm init acme","pm init ./pm-sandbox --defaults","pm init --preset minimal","pm init --agent-guidance add","pm init --defaults --with-packages"],tips:["Run this once per repository before create/list/update commands.","A path-like positional (`./dir`, `/tmp/dir`) initializes that tracker path; a plain word remains an id prefix.","Rewriting id prefix, governance preset, or default author on an existing tracker requires --force.","Use --preset for non-interactive automation; omit it in a TTY to use the setup wizard.","Use --agent-guidance add to inject compact AGENTS/CLAUDE workflow guidance, or --agent-guidance status to inspect missing guidance without modifying files.","Use --with-packages when agents need bundled commands such as calendar and templates available immediately."]},config:{why:"Reads or updates project/global settings such as definition-of-done, item format, telemetry, and policy toggles.",examples:["pm config project get definition-of-done",'pm config project set definition-of-done --criterion "tests pass"',"pm config project set item-format --format toon","pm config project set sprint-release-format-policy --policy strict_error","pm config project set governance-preset --policy minimal","pm config project set governance-ownership-enforcement --policy none","pm config project set test-result-tracking --policy enabled","pm config global set telemetry-tracking --policy disabled"]},extension:{why:"Compatibility command for package-backed runtime extension lifecycle operations across project or global scope.",examples:["pm install ./my-package --project","pm install '*' --project","pm package doctor --project --detail summary","pm package manage --global","pm package activate sample-ext --project","pm package deactivate sample-ext --project","pm package uninstall sample-ext --global","pm extension explore --project","pm extension manage --global","pm extension describe sample-ext --project","pm extension doctor --detail deep"],tips:["Prefer pm install and pm package in new user-facing automation.","Use pm extension when maintaining existing extension-specific scripts or debugging the compatibility runtime directly.","Bundled aliases beads and todos resolve to package-shipped extension sources.","Use --gh/--github shorthand for GitHub sources and --ref to pin a branch, tag, or ref.","Install updates settings activation state automatically unless extension allowlist mode is unchanged.","Use --adopt for single-extension adoption and --adopt-all to bulk-register unmanaged installs as managed without reinstalling.","Use --manage for concise triage summaries and remediation-oriented diagnostics alongside full extension details.","Use --describe to map exactly what each loaded extension registers (commands, hooks, item types, providers, overrides) in one call.","Use --doctor for consolidated diagnostics with warning codes, remediation hints, and optional deep detail payloads."]},package:{why:"Installs, explores, manages, diagnoses, adopts, activates, deactivates, and refreshes package-backed pm runtime extensions.",examples:["pm install npm:@scope/pm-package --project","pm package install ./my-package --project","pm package doctor --project --detail deep","pm package manage --project --runtime-probe","pm package describe --project","pm package activate sample-ext --project","pm upgrade --packages-only --dry-run"],tips:["Prefer package vocabulary for user-facing workflows; extension vocabulary remains available for compatibility.","Use pm package describe [name] to map every surface a package registers without reading its manifest or running diagnostics.","Use pm upgrade to refresh the CLI/SDK and managed packages from their recorded sources.","Use --dry-run before upgrade when automation needs a deterministic plan."]},"package init":{why:"Generates an installable starter pm package with package metadata and a root extension entrypoint.",examples:["pm package init ./my-package","pm package init ./my-hook-package --capability hooks","pm package init ./my-search-package --capability search","pm package init ./my-sync-package --capability importers","pm package init ./my-domain-package --capability schema","pm package init ./my-output-package --capability renderers","pm install ./my-sync-package --project","pm package doctor --project --detail summary"],tips:["Use --capability hooks for a starter after_command lifecycle reactor with runnable SDK testing coverage.","Use --capability search for a starter search provider/vector-store adapter with runnable SDK testing coverage.","Use --capability importers for paired import/export commands that move project context across systems.","Use --capability schema for a starter custom item type, field, and migration so pm models your project domain.","Use --capability renderers/parser/preflight/services for starter override surfaces (output renderer, parsed-option rewrite, pre-run gate decision, built-in service) \u2014 one runnable starter per SDK capability.","The generated package is local-install safe; add SDK runtime imports only after declaring dependencies and validating with package doctor.","Use package doctor after changes to verify activation, policy, and collision diagnostics."]},"package install":{why:"Installs pm packages from local paths, npm sources, GitHub sources, bundled aliases, or wildcard/all aliases.",examples:["pm package install ./my-package --project","pm install npm:pm-changelog --project","pm package install --github org/repo/packages/my-pm-package --ref main"],tips:["Prefer the top-level pm install alias in scripts when only installation is needed.","Run pm package manage or pm package doctor after installing external packages."]},"package doctor":{why:"Diagnoses package activation, policy, collision, and managed-state health for project or global package scopes.",examples:["pm package doctor --project --detail summary","pm package doctor --project --detail deep --trace","pm package doctor --project --isolated --detail deep --trace"],tips:["Use --isolated (alias --ignore-global) for hermetic project smoke tests that must ignore globally installed package registrations.","Set PM_GLOBAL_PATH for a whole subprocess suite when every pm invocation must avoid machine-local global package state: PM_GLOBAL_PATH=$(mktemp -d) pm package doctor --project --detail deep --trace.","Non-isolated project diagnostics include global registrations and emit remediation when global package state can affect the result."]},"package catalog":{why:"Lists bundled first-party package catalog metadata and compact field projections.",examples:["pm package catalog --project","pm package catalog --project --fields alias,installed,install_command","pm package list --project --fields alias,package_name,category"],tips:["Use --fields for low-token package discovery in agent loops.","External npm package discovery still belongs to npm search."]},"extension init":{why:"Generates an installable starter runtime extension with manifest and entrypoint files.",examples:["pm extension init ./my-extension","pm extension init ./my-hook-extension --capability hooks","pm extension init ./my-search-extension --capability search","pm extension init ./my-sync-extension --capability importers","pm extension init ./my-domain-extension --capability schema","pm extension init ./my-output-extension --capability renderers","pm extension --install --project ./my-sync-extension","pm extension --doctor --project --detail summary"],tips:["Use --capability hooks when the extension should react to command lifecycle events.","Use --capability search when the extension should register retrieval primitives.","Use --capability importers when the extension should register project-context import/export commands.","Use --capability schema when the extension should register custom item types, fields, and migrations.","Use --capability renderers/parser/preflight/services to override pm's output rendering, parsed options, pre-run gate, or a built-in service.","Use package init for new distributable package workflows; extension init is the compatibility-level runtime scaffold."]},"extension install":{why:"Installs a compatibility runtime extension from local, npm, GitHub, bundled alias, or wildcard sources.",examples:["pm extension install ./my-extension --project","pm extension --install --project ./my-extension","pm extension doctor --project --detail summary"],tips:["Prefer pm install or pm package install for new package-first automation."]},"extension doctor":{why:"Diagnoses compatibility extension activation, policy, collision, and managed-state health for project or global extension scopes.",examples:["pm extension doctor --project --detail summary","pm extension doctor --project --detail deep --trace","pm extension doctor --project --isolated --detail deep --trace"],tips:["Use --isolated (alias --ignore-global) for hermetic project smoke tests that must ignore globally installed extension registrations.","Set PM_GLOBAL_PATH for a whole subprocess suite when every pm invocation must avoid machine-local global extension state: PM_GLOBAL_PATH=$(mktemp -d) pm extension doctor --project --detail deep --trace.","Prefer pm package doctor in new package-first workflows."]},"extension catalog":{why:"Compatibility view of bundled package catalog metadata.",examples:["pm extension catalog --project","pm extension catalog --project --fields alias,installed,install_command"],tips:["Prefer pm package catalog in new user-facing workflows."]},install:{why:"Installs a pm package into project scope by default, using local, npm, GitHub, or bundled alias sources.",examples:["pm install '*' --project","pm install ./packages/pm-todos --project","pm install npm:@scope/pm-package --global","pm install --github org/repo/packages/my-pm-package --ref main"],tips:["Installed packages are recorded in managed state and can be inspected with pm package manage."]},upgrade:{why:"Updates the global pm CLI/SDK and refreshes managed pm packages from recorded install sources.",examples:["pm upgrade --dry-run","pm upgrade --packages-only --project","pm upgrade todos --dry-run","pm upgrade --cli-only --repair","pm upgrade --tag next --dry-run"],tips:["Omit target to include the CLI/SDK plus all managed packages in the selected scope.","Pass a target to refresh one managed package by name, directory, package name, or source.","Use --packages-only in repository automation when the global CLI should not be changed."]},create:{why:"Creates a new planning item with deterministic metadata and history.",examples:['pm create --title "Harden lock flow" --description "Improve stale lock handling" --type Task --status open --priority 1 --message "Create lock hardening task" --create-mode progressive','pm create --title "Weekly planning sync" --description "Recurring coordination meeting" --type Meeting --schedule-preset lightweight','pm create --title "Asset: Hero model" --description "Track playable model asset" --type Asset --status open --priority 1 --message "Create asset item" --type-option category=Character --dep "id=pm-epic01,kind=parent,created_at=now" --comment "created_at=now,text=Why this asset item exists." --note "created_at=now,text=Initial implementation note." --learning "created_at=now,text=Durable lesson placeholder." --file "path=src/assets/hero.glb,note=tracked asset" --test "command=node scripts/run-tests.mjs test,timeout_seconds=240" --doc "path=README.md,note=asset docs"'],tips:["Use --schedule-preset lightweight for Reminder/Meeting/Event when you want minimal required create inputs.","Use --type <value> to load type-aware policy guidance in --help output."]},focus:{why:"Sets a session focused item so new pm create items default their --parent to it (project management = context management).",examples:["pm focus pm-epic1","pm focus","pm focus --clear"],tips:["Focus is session-local (stored in .agents/pm/runtime/session.json, gitignored) \u2014 it never affects teammates.",'An explicit --parent on pm create always overrides the focused item; use --parent "" to create with no parent.',"A stale focused item produces the same missing-parent validation as an explicit stale --parent."]},update:{why:"Mutates existing item fields while preserving history and lock safety.",examples:['pm update pm-a1b2 --status in_progress --message "Start implementation"','pm update pm-a1b2 --unset close-reason --message "Clear stale close reason after reopen"','pm update pm-a1b2 --unset assignee --deadline +2d --message "Replan ownership and deadline"','pm update pm-a1b2 --body "Backfilled body text for legacy item" --message "Normalize missing body"'],tips:['Use "pm close <ID> <TEXT>" to close items instead of --status closed.',"When reopening from closed to a non-terminal status, update clears stale close_reason unless explicitly set via --close-reason.",'Use "pm append <ID> --body <text>" for additive notes; use update --body to replace body content.']},"update-many":{why:"Bulk-updates matched item sets with dry-run previews and rollback checkpoints for safe large-scale metadata changes.",examples:["pm update-many --filter-status open --status in_progress --dry-run",'pm update-many --filter-tag wave:7 --replace-tests --test "command=node scripts/run-tests.mjs test -- tests/core/history.spec.ts,timeout_seconds=240"','pm update-many --filter-tag governance --reviewer maintainer-review --message "Normalize reviewer metadata"',"pm update-many --rollback ckpt-abc123"],tips:["Use --dry-run first to inspect proposed changes before apply mode.","Linked-array mutation flags mirror pm update semantics (for example --replace-tests, --clear-files, and repeatable --doc/--note seeds).","Checkpoints are enabled by default for apply mode and can be restored with --rollback."]},"close-many":{why:"Bulk-closes matched items with a shared reason routed through full pm close semantics (close validation, active-child orphan checks, blocked-edge cleanup) plus dry-run previews and rollback checkpoints \u2014 unlike update-many --status closed, which bypasses close validation.",examples:['pm close-many --filter-sprint S-12 --reason "Sprint S-12 acceptance criteria met" --dry-run','pm close-many --filter-tag wave:7 --reason "Superseded by redesign" --validate-close warn','pm close-many --ids pm-a,pm-b,pm-c --reason "Closed in batch" --resolution "Verified by integration suite"',"pm close-many --rollback close-many-20260604-abc123"],tips:["At least one filter (--filter-* or --ids) is required so close-many never matches every item.","Already-terminal matches are skipped by default; pass --force to re-close them.","Use --dry-run to preview matches plus per-item skip reasons and active-child orphan warnings before applying.","Checkpoints are enabled by default for apply mode; restore with --rollback <checkpoint-id>."]},templates:{why:"Saves, lists, and inspects reusable create option bundles for repeatable workflows.",examples:['pm templates save triage-default --title "Triage item" --description "..." --type Task --status open --priority 2 --message "Seed triage template"',"pm templates list","pm templates show triage-default"],tips:["Template names are positional arguments (`pm templates save <name>` and `pm templates show <name>`), not --name flags.","Combine templates with explicit create flags; explicit flags always override template defaults."]},deps:{why:"Inspects an item dependency graph as a tree or graph payload to understand blockers and hierarchy links.",examples:["pm deps pm-a1b2","pm deps pm-a1b2 --format graph","pm deps pm-a1b2 --max-depth 2 --collapse repeated --summary"],tips:["Use --summary for lightweight counts when full graph payloads are unnecessary."]},list:{why:"Lists active items with deterministic filtering and ordering.",examples:["pm list --limit 20","pm list --type Task --priority 0 --tag release --status in_progress","pm list --compact --sort deadline --order asc","pm list --fields id,title,parent,type --sort parent --order asc"]},"list-all":{why:"Lists all item states (including terminal states) when you need full visibility.",examples:["pm list-all --limit 50","pm list-all --type Issue --include-body"]},"list-open":{why:"Shows work that is ready to claim and start.",examples:["pm list-open --priority 0 --limit 10"]},"list-in-progress":{why:"Tracks active execution and owner progress.",examples:["pm list-in-progress --priority 0 --limit 20"]},"list-blocked":{why:"Surfaces blocked work that needs intervention.",examples:["pm list-blocked --limit 20"]},"list-closed":{why:"Reviews completed work and closure outcomes.",examples:["pm list-closed --limit 20 --type Task"]},"list-canceled":{why:"Audits intentionally discontinued work.",examples:["pm list-canceled --limit 20"]},"list-draft":{why:"Finds incompletely defined items that need refinement before execution.",examples:["pm list-draft --limit 20"]},aggregate:{why:"Runs grouped aggregation queries for governance checks such as decomposition by parent/type or triage by status/priority.",examples:["pm aggregate --group-by parent,type --count","pm aggregate --group-by type,status --count","pm aggregate --group-by parent,type --count --status open --parent pm-feature01"],tips:["Current aggregate mode is grouped counts only, so pass --count explicitly."]},guide:{why:"Routes local progressive-disclosure documentation so agents can fetch only the context they need.",examples:["pm install guide-shell --project","pm guide","pm guide quickstart","pm guide commands --depth standard","pm guide skills --depth deep --format markdown","pm guide release --json"],tips:["Use brief depth for minimal token footprint, standard for excerpted docs, and deep for full local document rendering.","Use --list to force topic index output even when topic parsing is ambiguous."]},calendar:{why:"Provides deadline/reminder/event scheduling views for planning and coordination.",examples:["pm calendar","pm calendar --view agenda --from +0d --to +7d --tag release","pm calendar --view week --date 2026-04-06 --full-period --include deadlines,events","pm calendar --view month --tag release --format json"],tips:["Day/week/month views are anchored period windows; default mode clips the start to now unless --past or --full-period is set.","--full-period applies only to day/week/month views; use --from/--to to bound agenda windows."]},context:{why:"Builds an agent-optimized snapshot of critical active work plus near-term agenda context with progressive depth levels.",examples:["pm context","pm ctx --depth standard --limit 10","pm ctx --depth deep --tag release","pm ctx --section hierarchy --section progress --section blockers","pm context --depth standard --activity-limit 20 --stale-threshold 14d","pm context --from +0d --to +7d --format markdown --depth deep"],tips:["High-level focus contains Epics/Features and low-level focus contains Tasks/Issues/Chores/Decisions/Event/Reminder/Milestone/Meeting/Plan.","When no open or in-progress work exists, blocked items are shown as fallback context.","--depth brief (default) shows focus+agenda; standard adds hierarchy/activity/progress/workload; deep adds blockers/files/staleness/tests.","--section overrides --depth and selects specific sections: hierarchy, activity, progress, blockers, files, workload, staleness, tests.","Configure defaults via pm config project set context --default-depth standard --activity-limit 15."]},next:{why:"Answers 'what should I work on now?' with the highest-priority ready item, rationale, and ranked ready and blocked queues.",examples:["pm next","pm next --json","pm next --limit 3 --ready-only","pm next --parent pm-mpbb","pm next --tag release --format markdown"],tips:["Ready = active status, no open blockers, and no open children (a concrete leaf); the recommendation resumes in-progress work before starting new work.","An item is blocked when its scalar blocked_by or a blocked_by dependency points at a non-terminal item; the blocked list names the blockers to clear.","Containers (Epics/Features with open children) are never recommended directly \u2014 the actionable leaf beneath them is.","Use --parent to scope to one epic's subtree, or --ready-only to drop the blocked companion list for the tightest output."]},search:{why:"Finds relevant items by keyword, semantic, or hybrid retrieval modes.",examples:['pm search "lock stale retry" --mode keyword --limit 10','pm search "extension migration blockers" --mode hybrid --type Task --priority 0','pm search "Cross-Epic Realism Dependency Council" --mode keyword --title-exact'],tips:["Use --title-exact to require exact normalized title parity, or --phrase-exact to require full-phrase matches in item text fields.","Use --include-linked when linked docs/files/tests should influence scoring."]},eval:{why:"Measures search relevance against a curated golden-query set so retrieval regressions are caught, not guessed.",examples:["pm eval --json","pm eval --mode hybrid --k 10","pm eval --fail-under 0.6 --json","pm eval --queries ./my-eval.json --mode semantic"],tips:["Curate ground truth in <pmRoot>/search/eval-queries.json as an array of {query, relevant_ids, mode?} objects.","Wire --fail-under into CI to fail the build when aggregate nDCG@k drops below your baseline."]},reindex:{why:"Rebuilds search artifacts after large changes to item corpus or provider/vector config.",examples:["pm reindex --mode keyword","pm reindex --mode hybrid --progress --json"],tips:["Use --progress for non-interactive visibility during local embedding runs.","JSON output includes semantic stale/unchanged/embed/upsert counts so agents can gate long reindex work without parsing stderr."]},get:{why:"Shows details for one item by ID, with optional lower-token projections for agent loops.",examples:["pm get pm-a1b2","pm get pm-a1b2 --depth brief --json","pm get pm-a1b2 --fields id,title,status,parent,type --json","pm get pm-a1b2 --at 7 --fields id,title,status,body --json"],tips:["Default depth is standard for body plus linked artifacts without append-only logs; use brief for metadata-only checks or --full for complete history-heavy metadata.","Use --fields for the smallest deterministic item metadata payload when an agent only needs specific fields.","Schedule metadata is normalized under schedule; request schedule.start_at or schedule.location for narrow calendar reads.","Children are type-agnostic and include bounded deterministic samples plus continuation metadata when a parent has direct children.","Use --at <version|timestamp> for a verified read-only historical projection; reconstructed/as_of fields distinguish it from current state.","JSON output shape is { item, linked, claim_state, schedule, children }; body is nested at item.body (parity with list --include-body)."]},history:{why:"Inspects item mutation timeline and audit trail.",examples:["pm history pm-a1b2 --limit 20","pm history pm-a1b2 --full --verify"]},"history-compact":{why:"Compacts long history streams into a synthetic checkpoint while preserving replay integrity. Pass an item id for one stream, or a bulk selector (--ids/--all-over/--closed/--all-streams) to sweep many.",examples:["pm history-compact pm-a1b2 --dry-run",'pm history-compact pm-a1b2 --before 25 --message "Compact early history"',"pm history-compact --all-over 500 --dry-run","pm history-compact --closed","pm history-compact --ids pm-a1b2,pm-c3d4 --dry-run"]},activity:{why:"Reviews recent tracker-wide activity across items.",examples:["pm activity --limit 50","pm activity --full --id pm-a1b2 --limit 50","pm activity --id pm-a1b2 --op update --from -7d --to now","pm activity --json --stream rows --limit 200"],tips:["Use --stream with --json for line-delimited automation output; --from is inclusive and --to is exclusive."]},restore:{why:"Restores an item to a prior timestamp/version with history replay safety.",examples:['pm restore pm-a1b2 2026-04-01T00:00:00.000Z --message "Rollback to known-good state"']},close:{why:"Transitions work to terminal closed state with explicit rationale.",examples:['pm close pm-a1b2 "Done" --release-assignment --validate-close warn','pm close pm-a1b2 "Done" --validate-close','pm close pm-a1b2 "Done" --validate-close off','pm close pm-a1b2 "Done" --validate-close strict']},delete:{why:"Removes an item while preserving history evidence and lock/ownership checks.",examples:['pm delete pm-a1b2 --message "Remove duplicate item"']},append:{why:"Adds implementation notes to body without replacing existing content.",examples:['pm append pm-a1b2 --body "Implemented retry with bounded backoff." --message "Record implementation detail"']},comments:{why:"Adds or reviews lightweight status updates linked to an item.",examples:['pm comments pm-a1b2 "Verified fix on Linux and macOS"','pm comments pm-a1b2 --add "Verified fix on Linux and macOS"','printf "%s\\n" "## Verification" "- linux pass" "- mac pass" | pm comments pm-a1b2 --stdin',"pm comments pm-a1b2 --file docs/release-evidence.md",'pm comments pm-a1b2 --add "text: verification note with commas, key-like words, and parser details"','pm comments pm-a1b2 --add "Follow-up needed after review" --force',"pm comments pm-a1b2 --limit 10"],tips:["Use exactly one comment source at a time: positional [text], --add, --stdin, or --file.","Use --force when adding comments to items currently assigned to a different owner.","When --add payload resembles CSV-like key fragments (for example text=hello,scope:project), plain-text fallback is intentional; use explicit text=..., markdown text: ..., or stdin token - for structured intent."]},notes:{why:"Adds or reviews durable implementation notes linked to an item.",examples:['pm notes pm-a1b2 --add "Investigated parser edge case and documented fallback logic."','pm notes pm-a1b2 --add "text: parser rationale with commas, colons, and key-like wording"','pm notes pm-a1b2 --edit 1 --add "Corrected durable note"',"pm notes pm-a1b2 --delete 2","pm notes pm-a1b2 --limit 10"],tips:["CSV-like add payloads with extra key fragments are treated as plain text by design; use explicit text keys (text= or text:) when structured parsing is required."]},learnings:{why:"Adds or reviews post-implementation learnings for future work.",examples:['pm learnings pm-a1b2 --add "Avoid direct test-runner commands in linked tests; use sandbox runner."','pm learnings pm-a1b2 --add "text: lesson with commas, key-like words, and punctuation-safe context"',"pm learnings pm-a1b2 --edit 1 --file docs/corrected-learning.md","pm learnings pm-a1b2 --delete 2","pm learnings pm-a1b2 --limit 10"],tips:["If you intended structured parsing for a key-like payload, prefer explicit text=..., markdown text: ..., or stdin token -; ambiguous CSV-like forms intentionally remain plain text."]},files:{why:"Associates changed source files with tracker items for reproducibility.",examples:['pm files pm-a1b2 --add "path=src/cli/main.ts,note=help orchestration"','pm files pm-a1b2 --add src/cli/main.ts --note "help orchestration"',"pm files discover pm-a1b2",'pm files discover pm-a1b2 --apply --note "discovered from item text"']},docs:{why:"Associates relevant documentation paths with tracker items.",examples:['pm docs pm-a1b2 --add "path=README.md,note=user-facing command guidance"','pm docs pm-a1b2 --add README.md --note "user-facing command guidance"']},test:{why:"Links test commands/paths and optionally executes them for one item.",examples:['pm test pm-a1b2 --add "command=node scripts/run-tests.mjs test -- tests/unit/output.spec.ts,timeout_seconds=2400"','pm test pm-a1b2 --add "command=pm list-all --type Task --limit 200,assert_stdout_contains=count:,assert_stdout_regex=count:\\s+\\d+"','pm test pm-a1b2 --add "command=pm list-all --type Task --limit 200,pm_context_mode=auto"',"pm test pm-a1b2 --run --timeout 2400 --env-set PORT=0 --env-clear PLAYWRIGHT_BASE_URL --shared-host-safe --pm-context tracker --fail-on-context-mismatch --fail-on-skipped","pm test pm-a1b2 --run --timeout 2400 --pm-context auto","pm test pm-a1b2 --run --background --timeout 2400 --progress"]},"test-all":{why:"Runs linked tests in bulk for release/readiness sweeps.",examples:["pm test-all --status in_progress --limit 5 --offset 10 --timeout 2400","pm test-all --status closed --timeout 3600 --progress --env-set PORT=0 --shared-host-safe --fail-on-skipped","pm test-all --status in_progress --pm-context tracker --fail-on-context-mismatch --require-assertions-for-pm","pm test-all --status in_progress --pm-context auto --fail-on-context-mismatch","pm test-all --status in_progress --background --timeout 3600"]},"test-runs":{why:"Manages background linked-test runs with lifecycle controls and log/status inspection.",examples:["pm test-runs list --status running --limit 20","pm test-runs status tr-abc123","pm test-runs logs tr-abc123 --stream stderr --tail 200","pm test-runs stop tr-abc123","pm test-runs resume tr-abc123"]},stats:{why:"Reports tracker-level totals and distribution by type/status.",examples:["pm stats","pm stats --json"]},telemetry:{why:"Inspects and manages local telemetry queue/runtime state for observability diagnostics.",examples:["pm telemetry status","pm telemetry stats --limit 10","pm telemetry flush","pm telemetry clear"]},health:{why:"Validates tracker/runtime health including extension triage, migration, and integrity diagnostics.",examples:["pm health","pm health --check-only --summary --json","pm health --brief --json","pm health --no-refresh","pm health --refresh-vectors"]},validate:{why:"Runs standalone metadata, resolution, lifecycle (including dependency-cycle diagnostics), linked-file, linked-command reference, and history drift checks with default remediation hints for resolution gaps.",examples:["pm validate","pm validate --check-resolution --json","pm validate --check-lifecycle --dependency-cycle-severity error","pm validate --check-lifecycle --parent-cycle-severity error","pm validate --check-files --scan-mode tracked-all","pm validate --check-files --scan-mode tracked-all-strict --include-pm-internals","pm validate --check-command-references","pm validate --check-resolution --fail-on-warn --json"],tips:["Resolution-gap warnings include default `pm update <id> ...` remediation hint templates in check details."]},gc:{why:"Deletes optional cache artifacts by default to keep local tracker state tidy; use --dry-run to preview targets without deleting files.",examples:["pm gc --dry-run","pm gc"]},claim:{why:"Claims an item to signal active ownership and reduce conflicts.",examples:["pm claim pm-a1b2 --start",'pm claim pm-a1b2 --force --message "Take over terminal item"','pm claim pm-a1b2 --author "release-service" --message "Explicit non-agent identity override"'],tips:["Claim takeover for non-terminal items does not require --force; --force is reserved for terminal/lock overrides.","Harness identity is automatic; use --author only to assert an intentional external principal."]},release:{why:"Releases an active claim when paused, handed off, or completed.",examples:["pm release pm-a1b2 --pause"]},"start-task":{why:"Lifecycle alias that claims an item and sets status to in_progress.",examples:['pm start-task pm-a1b2 --message "Start implementation"']},"pause-task":{why:"Lifecycle alias that sets status to open and releases active assignment.",examples:['pm pause-task pm-a1b2 --message "Pause for dependency unblock"']},"close-task":{why:"Lifecycle alias that closes with reason text and clears assignment metadata.",examples:['pm close-task pm-a1b2 "All acceptance criteria met" --message "Close and handoff"']},meet:{why:"Shortcut to create a Meeting from friendly time flags (start/duration) without structured --event CSV.",examples:['pm meet "Sprint Planning" --start +1h --duration 1h','pm meet "1:1" --start 2026-07-01T15:00:00Z --end 2026-07-01T15:30:00Z --location "Room A"'],tips:["Start defaults to now and duration to 1h; pass --end to set an explicit end instead of --duration.","--duration accepts relative tokens (h/d/w/m where m is months) plus sub-hour forms like 30min or PT30M."]},event:{why:"Shortcut to create an Event from friendly time flags (start/duration) without structured --event CSV.",examples:['pm event "Release v2" --start 2026-07-01T10:00:00Z --duration 2h','pm event "Conference" --start 2026-08-01 --all-day'],tips:["Start defaults to now and duration to 1h; pass --end to set an explicit end instead of --duration.","--duration accepts relative tokens (h/d/w/m where m is months) plus sub-hour forms like 30min or PT30M."]},remind:{why:"Shortcut to create a Reminder from a single point in time without structured --reminder CSV.",examples:['pm remind "Review PR" --at +2d','pm remind "Follow up" --at 2026-07-01T09:00:00Z --text "Ping the team"'],tips:["The reminder time defaults to +1d and the reminder text defaults to the title."]},completion:{why:"Generates shell completion scripts for faster and more reliable command entry.",examples:["pm completion bash","pm completion zsh","pm completion fish","pm completion bash --eager-tags"],tips:["Default scripts resolve tag suggestions lazily at completion time; use --eager-tags to embed current tags directly."]},contracts:{why:"Exposes machine-readable CLI command and tool schema contracts for agent integrations.",examples:["pm contracts","pm contracts --command list --runtime-only","pm contracts --command update --flags-only","pm contracts --availability-only --runtime-only","pm contracts --action create","pm contracts --schema-only"],tips:["Use --command to narrow actions/schema to one CLI surface; combine with --flags-only or --availability-only for lighter payloads."]}};for(let{alias:e,canonical:t}of M){let n=ue[e];n&&(ue[t]={...n,examples:n.examples.map(o=>o.replace(`pm ${e}`,`pm ${t}`))})}var xe={why:"Provides deterministic project management workflows for humans and coding agents.",examples:["pm init","pm install guide-shell --project","pm list-open --limit 10",'pm create --title "..." --description "..." --type Task --status open --priority 1 --message "..." --create-mode progressive'],tips:["Use <command> --help for command-specific guidance and examples.","Install guide-shell before using pm guide for local docs and skills routing.","Use --json for machine parsing and integration flows.","Use --no-pager to force direct help output in CI and other non-interactive shells."]},Zi=V.filter(e=>e.lifecycle==="deprecated");for(let e of Zi){let t=ue[e.alias];ue[e.alias]={...t,why:`Deprecated: use pm ${e.canonical_argv.join(" ")}. ${t.why}`}}for(let e of[xe,...Object.values(ue)])e.examples=e.examples.map(t=>{for(let n of Zi){let o=n.alias.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replaceAll(new RegExp(`\\bpm ${o}(?![\\w-])`,"g"),`pm ${n.canonical_argv.join(" ")}`)}return t});function Ba(e){let t=N(e??"");return t?Ga[t]??t:""}function _n(e){let t=Ba(e);return t?ue[t]??xe:xe}function er(e,t){let n=_n(e);return{intent:n.why,examples:t==="detailed"?[...n.examples]:Xi(n.examples),tips:t==="detailed"?[...n.tips??[]]:[],detail_mode:t}}function Ka(){let e=V.filter(({lifecycle:n})=>n==="permanent"),t=V.filter(({lifecycle:n})=>n==="deprecated");return["","Command aliases:",...e.map(({alias:n,canonical_argv:o})=>` ${n} -> pm ${o.join(" ")}`),"","Deprecated aliases:",...t.map(n=>` ${n.alias} -> pm ${n.canonical_argv.join(" ")} (${Fo(n)})`)].join(`
4
4
  `)}function Ja(e,t,n,o){let i=new Set(Di);e.configureHelp({visibleCommands(r){let a=t.visibleCommands(r);return n?a.filter(s=>(pe(s)??Y(s.name()))!=="internal"):r!==e?a:a.filter(s=>o.has(s))},visibleOptions(r){let a=t.visibleOptions(r);return r!==e||n?a:a.filter(s=>i.has(s.flags))}})}function Ya(e,t,n,o){let i=new Set(Mi("core")),r=e.createHelp();r.prepareContext({error:!1,helpWidth:80,outputHasColors:!1});let a=()=>`${r.formatHelp(e,r)}${o}
@@ -30,7 +30,7 @@ Extension command metadata:
30
30
  `)}return process.exitCode=f.SUCCESS,!0}function Yl(e,t){let n=["","Type-aware option policies:"," pass --type <value> with --help to render required/disabled/hidden option policy details for that type.",` active type values: ${t.types.join("|")}`];return e==="create"&&n.push(" scheduling shortcut: use --schedule-preset lightweight for Reminder/Meeting/Event minimal create flows."),n.join(`
31
31
  `)}function Xl(e,t){if(t.options.length===0){e.push(" type options: none");return}e.push(" type options:");for(let n of t.options){let o=n.required?" (required)":"",i=n.aliases??[];e.push(` - ${n.key}${o}`),e.push(` values: ${n.values.length>0?n.values.join("|"):"any non-empty string"}`),e.push(` aliases: ${i.length>0?i.join("|"):"none"}`),n.description&&n.description.trim().length>0&&e.push(` description: ${n.description.trim()}`)}}function Ql(e,t){let n=e==="create"?new Set(["title","type"]):new Set,o=new Set(n);if(e==="create")for(let i of[...t.required_create_fields,...t.required_create_repeatables])o.add(i);return{progressive:n,strict:o}}function Zl(e,t,n,o){let i=new Set(n),r=o.filter(l=>!i.has(l)),a=l=>l.length>0?l.map(d=>Yt("create",d)).join(", "):"none";e.push(` required in strict mode: ${a(r)}`);let s=r.map(qi).filter(l=>l!==void 0);e.push(` explicit empty assertion: ${s.length>0?s.join(", "):"none"}`),["Reminder","Meeting","Event"].includes(t.name)&&(e.push(" schedule preset: --schedule-preset lightweight switches schedule artifacts to progressive required-option policy."),e.push(" strict parity remains available via --create-mode strict."))}function ec(e,t,n){let o=Wi(n);if(!o)return Yl(e,t);let i=qo(o,t);if(!i){let h=t.types.join("|");return["",`Type-aware option policies: type "${o}" is not in the active registry.`,` active type values: ${h}`].join(`
32
32
  `)}let r=n.indexOf("--"),a=r<0?n:n.slice(0,r),s=a.findIndex(h=>h==="--create-mode"||h.startsWith("--create-mode=")),l=s<0?void 0:a[s]?.startsWith("--create-mode=")?a[s]?.slice(14):a[s+1],d=e==="create"&&l?.toLowerCase()==="strict",c=Ql(e,i),m=st(i,e,c.progressive),p=st(i,e,d?c.strict:c.progressive),u=h=>h.length>0?h.map(y=>Yt(e,y)).join(", "):"none",g=["",`Type-aware option policies for ${i.name}:`,` required: ${u(p.required)}`,` disabled: ${u(p.disabled)}`,` hidden: ${u(p.hidden)}`];if(e==="create"){let h=st(i,e,c.strict);Zl(g,i,m.required,h.required)}return Xl(g,i),p.errors.length>0&&g.push(` config errors: ${p.errors.join("; ")}`),g.join(`
33
- `)}function Jr(e,t,n){let o=E(n);if(o!=="create"&&o!=="update")return;let i=Be(e,o);i&&i.addHelpText("after",ec(o,t,n))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="840b471e-c996-57e2-b97c-3a84bd68f050")}catch{}})();function tc(e,t){let n=De(e.id);return n||`migration-${String(t+1).padStart(3,"0")}`}function nc(e){return De(e.status)?.toLowerCase()??"pending"}function oc(e){return e.mandatory===!0}function ic(e,t){let n=e.layer.localeCompare(t.layer);if(n!==0)return n;let o=e.name.localeCompare(t.name);return o!==0?o:e.id.localeCompare(t.id)}function Qr(e){let t=[];return e.forEach((n,o)=>{if(!oc(n.definition))return;let i=nc(n.definition);i!=="applied"&&t.push({layer:n.layer,name:n.name,id:tc(n.definition,o),status:i})}),t.sort(ic),t}function Yr(e){return Array.isArray(e)&&e.length>0}var rc=new Set(["create","beads import","todos import"]),ac=new Set(["restore","update","close","delete","append","claim","release"]),sc=new Set(["comments","notes","learnings"]),lc=new Set(["files","docs","test"]),cc=new Set(["activate","add","add-field","add-status","add-type","apply","compact","create","deactivate","delete","disable","edit","enable","import","infer","install","materialize","migrate","redact","remove","remove-field","remove-status","remove-type","remap-status","rename-field","rename-type","repair","run","save","set","unset","update","upgrade"]);function Bn(e,t){let n=t.force===!0;return rc.has(e)?{isMutation:!0,forceCapable:!1,forceRequested:!1}:ac.has(e)?{isMutation:!0,forceCapable:!0,forceRequested:n}:sc.has(e)?{isMutation:typeof t.add=="string",forceCapable:!0,forceRequested:n}:lc.has(e)?{isMutation:Yr(t.add)||Yr(t.remove),forceCapable:!0,forceRequested:n}:{isMutation:!1,forceCapable:!1,forceRequested:!1}}function dc(e,t,n){if(Bn(e,n).isMutation)return!0;let o=e.trim().toLowerCase();return Ti(o)?["close-many","close-task","copy","delete","discover","focus","pause-task","start-task","update-many"].includes(o)?!0:t.some(i=>cc.has(i.trim().toLowerCase())):!1}function Xr(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function mc(e,t,n){let o=t[0]?.trim().toLowerCase()??"";if(e.trim().toLowerCase()!=="schema"||!["rename-type","rename-field","remap-status"].includes(o))return;let i=[];if(De(t[1])||i.push("source"),De(n.to)||i.push("--to"),i.length!==0)throw new C(`Schema migration requires ${i.join(", ")}.`,f.USAGE,{code:"schema_migration_input_required",required:i.join(","),why:"Schema migrations require a source and target. A workspace-bound stable migration id is derived automatically when --migration-id is omitted.",recovery:{recovery_mode:"compact",missing_required_fields:i,suggested_flags:i.filter(r=>r.startsWith("--")),suggested_retry:`pm schema ${o} <source> --to <target>`}})}async function pc(e,t,n,o,i){if(e.trim().toLowerCase()!=="update"||typeof n.status!="string"||Xr(n.status)!==Xr(i.schema.workflow.in_progress_status))return;let r=t[0];if(!r)return;let a=re(i,ae()),s=await ut(o,r,i.id_prefix,i.item_format,a.type_to_folder);if(!s)return;let l=await vi(s,{schema:i.schema}),d=typeof n.assignee=="string"?n.assignee.trim():void 0;(d===void 0?l.document.metadata.assignee?.trim():!["","none","null","undefined"].includes(d.toLowerCase())&&d)||_(`warning:in_progress_item_unclaimed:${s.id}:claim_with=pm claim ${s.id}`)}async function Kn(e,t,n,o,i){if(!dc(e,t,n)||(mc(e,t,n),!await K(J(i))))return;let r=await Ce(i);o.json!==!0&&await pc(e,t,n,i,r.settings);let a=Ai({author:pt(o.author,r.settings.author_default),payload:{command:e,args:t,options:n},settings:r.settings.mutation_guard,force:o.force===!0||n.force===!0});for(let s of a.warnings)_(`warning:${s}`)}function Zr(e,t,n){if(n.length===0)return;let o=Bn(e,t);if(!o.isMutation||o.forceCapable&&o.forceRequested)return;let i=n.map(a=>`extension_migration_blocking:${a.layer}:${a.name}:${a.id}:${a.status}`),r=o.forceCapable?"Re-run this command with --force to bypass.":"This command path does not support --force bypass.";throw new C(`Write command "${e}" blocked by unresolved mandatory extension migrations (${i.join(",")}). ${r}`,f.CONFLICT)}async function Jn(e,t,n,o){if(!Bn(e,t).isMutation||!o.enforce_item_format_gate&&!o.run_preflight_item_format_sync||!await K(J(n)))return;let{settings:r,metadata:a,warnings:s}=await Ce(n);for(let l of s)_(`warning:${l}`);if(o.enforce_item_format_gate&&!a.has_explicit_item_format&&(wi(r),await _i(n,r,"item_format:auto_select_default")),o.run_preflight_item_format_sync){let l=re(r,ae());await Oi(n,r.item_format,"item_format:pre_mutation_sync",l.type_to_folder,r.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]="697f96fe-38a0-5530-b54b-22cb442c130f")}catch{}})();function Yn(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=v(n);o.length!==0&&t.push(o)}return t}function Te(e){let t=v(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(i=>i.length>0);for(let i of Yn(e.commandArgs))o.push(...i.split(" ").filter(r=>r.length>0)),n.push(o.join(" "));return[...new Set(n.flatMap(i=>[i,O(i)]))]}function Xn(e,t){let n=v(e);if(n.length===0)return!1;let o=Te(t);for(let i of o)if(i===n||i.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(i=>n.startsWith(`${i} `)):!1}function $t(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...R(n.commands),...R(n.command_handlers),...R(n.command_overrides),...R(n.flag_commands),...R(n.parser_overrides),...ea(n.preflight_ownership),...ea(n.renderer_ownership)]:[]}function R(e){return e??[]}function ea(e){return R(e).flatMap(t=>t.commands)}function Ye(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var ta=new Set(["hooks","parser","preflight","renderers"]),na=new Set(["commands","schema","services","importers"]),uc=new Set(["reindex","search","search-advanced"]),fc=new Set(["--template"]);function Ae(e,t){for(let n of t)if(e.has(n))return!0;return!1}function Qn(e){let t=v(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return uc.has(n??t)}function Zn(e,t){for(let n of e.commandArgs??[]){if(!n.startsWith("--"))continue;let[o]=n.split("=",1);if(t.has(o))return!0}return!1}function Dt(e){return v(e.commandPath??"")==="create"&&Zn(e,fc)}function eo(e){return e.some(t=>{let n=v(t);return n==="templates"||n.startsWith("templates ")})}function Pt(e,t){return e.some(n=>Xn(n,t))||Dt(t)&&eo(e)}function to(e){return[R(e.hooks).length,(e.preflight_overrides??0)-R(e.preflight_ownership).length,R(e.item_types).length,R(e.item_fields).length,R(e.relationship_kinds).length,R(e.service_overrides).length,R(e.assurance_providers).length,R(e.renderer_overrides).length-R(e.renderer_ownership).length].some(n=>n>0)}function no(e,t){let n=e.activation?.commands??[];if(n.length>0)return Pt(n,t);let o=$t(e);if(Pt(o,t)||Ye(e).has("search")&&Qn(t.commandPath))return!0;if(e.contributions)return to(e.contributions)}function Nt(e,t){let n=no(e,t);if(n!==void 0)return n;let o=Ye(e);return!!(Ae(o,ta)||Ae(o,na))}function Xe(e,t){return e.effective.length===0?!1:Qe(t)!=="all"?e.effective.some(o=>Nt(o,t)):e.effective.some(o=>{let i=Ye(o);return $t(o).length>0||Ae(i,ta)||Ae(i,na)||i.has("search")})}function Qe(e){if(v(e.commandPath??"").split(" ")[0]==="completion")return"all";let t=Te(e).filter(i=>i.split(" ").every(r=>!r.startsWith("-"))).sort((i,r)=>r.length-i.length)[0]??v(e.commandPath??"");if(t.length===0)return"all";let n=Dt(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function oo(e){return Qe(e)==="all"?void 0:t=>Nt(t,e)}function Oe(e){let t=k(e);if(t.requested&&t.commandPathTokens.length>0){let[i,...r]=t.commandPathTokens;return{commandPath:i,commandArgs:r,allowCommandPrefixMatch:!0}}let n=F(e),o=n.findIndex(i=>i.trim().length>0&&!i.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function io(e){let t=e.args.map(String);if(v(T(e))==="create"){let o=e.optsWithGlobals();typeof o.template=="string"&&o.template.trim().length>0&&t.push("--template")}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2b424635-df90-55ee-beb0-d39a79d242f3")}catch{}})();var Mt=Symbol.for("pm.readOutputInvocationProvenance");function ie(e,t){let n=Reflect.get(e,Mt);n!==void 0&&Reflect.set(t,Mt,n)}function ro(e,t,n){let o=li(t,n);if(!o)return;let i=e;for(;i.parent;)i=i.parent;let r=i.rawArgs,a=new Set(X(r.slice(2))),s=si.find(c=>c.command===o),l=Object.values(s.dimensions).flatMap(c=>c.legacy_aliases.flatMap(m=>a.has(m.flag)?[m.flag]:[])),d=Reflect.get(n,Mt);Reflect.set(n,Mt,{canonical_include_modes:d?.canonical_include_modes??[],explicit_legacy_aliases:l,cli_invocation_observed:!0}),ie(n,e)}function ao(e,t,n,o){ro(e,t,o);let i=n.outputInclude;if(i===void 0)return;let{selectors:r,modes:a}=mi(t,i,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),a.length===0)return;ie(o,e);let s=di(t);for(let d of a){let c=s.get(d),m=o[c];e.setOptionValueWithSource(c,m,"cli")}let l=r.length>0?r.join(","):void 0;l===void 0?delete n.outputInclude:n.outputInclude=l;for(let d=e;d;d=d.parent)d.setOptionValueWithSource("outputInclude",l,"cli");vt(e,n)}function gc(e){let t=e.optsWithGlobals(),n=T(e);if(O(n)===n)return t;let o=e.opts();for(let i=e.parent;i?.parent;i=i.parent)for(let r of Object.keys(i.opts()))!(r in o)&&i.getOptionValueSource(r)==="default"&&delete t[r];return t}function Re(e,t,n=[]){let i={...gc(e)};ie(e,i),delete i.json,delete i.quiet,delete i.path,delete i.pmPath,delete i.noExtensions,delete i.extensions,delete i.profile,delete i.pager,delete i.changedFields,delete i.fullChangedFields,delete i.idOnly,delete i.lean,delete i.tokenAccounting,delete i.outputInclude,delete i.outputLimit,delete i.outputBudget,delete i.outputFormat,delete i.outputSession;let r=qr(t);for(let[a,s]of Object.entries(r))i[a]===void 0&&(i[a]=s);if(n.length>0){let a=Lr(n),s=yt(T(e)).map(c=>({long:c.flag,short:c.short,aliases:c.aliases})),l={...r};for(let c of a)i[c]!==void 0&&(l[c]=i[c]);Gn(l,[...s,...n],T(e));let d=Ur(i,n,r);return ie(i,d),d}return i}function Ft(e,t){let n=v(t);return n.length===0?[]:e.flags.filter(o=>O(v(o.target_command))===O(n)).flatMap(o=>o.flags)}function Ze(e,t,n){let o=Ft(e,t),i=[t],r=[];for(let a of n){if(a.startsWith("-"))break;i.push(a);let s=Ft(e,i.join(" "));s.length>0&&(r=s)}return r.length>0?r:o}function Lt(e){return e.arguments??[]}function oa(e){let t=Lt(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function so(e,t){if(!e)return!1;let n=v(t);return e.importers.some(o=>v(`${o.importer} import`)===n)||e.exporters.some(o=>v(`${o.exporter} export`)===n)}function lo(e,t){let n=Lt(e),o=n.filter(l=>l.required).length,r=n.some(l=>l.variadic)?Number.POSITIVE_INFINITY:n.length,a=e.failure_hints??[],s=a.length>0?` ${a.join(" ")}`:"";if(t.length<o)throw new C(`Missing required argument for extension command '${e.command}'. Usage: ${oa(e)}${s}`,f.USAGE);if(t.length>r){let l=t.slice(r).join(" ");throw new C(`Too many arguments for extension command '${e.command}': ${l}. Usage: ${oa(e)}${s}`,f.USAGE)}}function hc(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function yc(e,t,n){if(n.length>0){Gn(t,n,e.command);return}let o=Object.keys(t).filter(i=>t[i]!==void 0).sort();if(o.length!==0)throw new C(`Unknown option '${o.map(hc).join(", ")}' for extension command '${e.command}'. This command does not define extension flags.`,f.USAGE)}function co(e,t,n,o){e&&(lo(e,t),yc(e,n,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]="48c16121-f941-50e9-9945-3a14ceddb08f")}catch{}})();var wc=new Set(["--version","-V"]);function et(e){let t=F(e);return["package","packages","extension"].includes(t[0]??"")&&t[1]==="inventory"}var _c=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),mo=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]),ia=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]),vc=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),bc=new Set(["claim","close-task","pause-task","release","start-task","test"]),jt={setup:!0,listQuery:!0,mutation:!0,operation:!0},Cc=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function tt(e){return e.some(t=>wc.has(t))}function po(e){if(tt(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||k(e).requested)return jt;let t=E(e);if(!t)return jt;let n=t.trim().toLowerCase(),o=F(e),i=W(o)?.alias;return M.some(r=>r.alias===i)?{...jt,targetCommandName:i}:_c.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:mo.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:ia.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:vc.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:jt}function uo(e){return e.length===0||k(e).requested||e.includes("--explain")&&E(e)===void 0}function fo(e,t){return et(t)||tt(t)?!1:oe(t)||k(t).requested?!0:!!E(t)}function go(e){if(tt(e))return!1;let t=E(e);return t?Cc.has(t):!1}function xc(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,i=e.normalizedTokens.map(d=>{let c=d.indexOf("=");return c>=0?d.slice(0,c):d}).find(d=>d==="--literal"||d==="--regex"||d==="--replacement"),r=i?e.argv.map(d=>{let c=d.indexOf("=");return(c>=0?d.slice(0,c):d)===o?c>=0?`${i}${d.slice(c)}`:i:d}):e.argv,a=Fe(r),s=i&&n>=0?`${o}=[redacted]`:t,l=i&&e.normalizedDisplay.includes("=")?`${i}=[redacted]`:e.normalizedDisplay;return{argv:a,normalizedDisplay:l,sourceDisplay:s}}function ho(e){let t=e.commandName;if(!t)return;let n=e.trace.find(d=>d.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(d=>d.length>0),i=o.length>0?o.join(" "):"the canonical flag",r=ia.has(t)||bc.has(t),a=r?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=r?"mutating option":"option",l=xc({argv:e.argv,normalizedDisplay:i,normalizedTokens:o,rawFrom:n.from});throw new C(`Refusing to auto-correct ${s} ${l.sourceDisplay} to ${l.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,f.USAGE,{code:a,examples:[A(l.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:l.argv,suggested_retry:A(l.argv)}})}(function(){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]="afcf2608-3360-5030-b5ea-b101df5829e7")}catch{}})();var kc=new Set(["success","nonexistent_command","invalid_option","missing_required_option","missing_required_argument","invalid_usage","validation_failed","health_findings","validation_findings","conflict","runtime_failed","unknown_failed"]),Ec=new Set(["parse","preflight","execute","unknown"]),Sc=new Set(["usage","validation","conflict","runtime","unknown"]);function he(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let i=o.trim();if(i.length>0)return i}}}function yo(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Ut(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="number"&&Number.isFinite(o))return Math.max(0,Math.trunc(o))}}function wo(e){if(!e)return;let t=e.trim().toLowerCase();if(kc.has(t))return t}function _o(e){if(!e)return;let t=e.trim().toLowerCase();if(Ec.has(t))return t}function vo(e){if(!e)return;let t=e.trim().toLowerCase();if(Sc.has(t))return t}function bo(e){let t=he(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let a=n.find(s=>typeof s=="string"&&s.trim().length>0);if(typeof a=="string")return a.trim()}if(yo(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let i=Ut(e,"failed");if(typeof i=="number"&&i>0)return`failed_runs:${i}`;let r=e?.run_results;if(Array.isArray(r)){let a=r.filter(s=>Jt(s)?.status==="failed").length;if(a>0)return`failed_runs:${a}`}}function Co(e,t){if(!e)return t===f.USAGE?"invalid_command_usage":t===f.NOT_FOUND?"item_not_found":t===f.CONFLICT?"lock_conflict":t===f.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function xo(){let e=Jt(se()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Ut(e,"exit_code","exitCode"),o=t??n??f.SUCCESS,i=Fi(o),r=he(e,"error_code","errorCode")??Co(i,o),a=vo(he(e,"error_category","errorCategory"))??(i?void 0:at(r)),s=i?void 0:bo(e)??`command_exit_${o}`,l=wo(he(e,"command_resolution","commandResolution"))??ft({ok:i,errorCode:r,errorCategory:a}),d=_o(he(e,"resolution_stage","resolutionStage"))??"execute";return{ok:i,error:s,exit_code:o,error_code:r,error_category:a,command_resolution:l,resolution_stage:d}}(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]="ba7eacd0-c95f-594c-8e26-1a3e0851ab3f")}catch{}})();var ko="PM_CLI_PACKAGE_ROOT",da=Symbol("pm.deprecatedAliasInvocation"),zt=new Map;for(let e of V){let t=e.alias.split(" ")[0],n=zt.get(t)??[];n.push(e),zt.set(t,n)}for(let e of zt.values())e.sort((t,n)=>n.alias.split(" ").length-t.alias.split(" ").length);function Ac(){return Lo(import.meta.url,["../.."])}(typeof process.env[ko]!="string"||process.env[ko]?.trim().length===0)&&(process.env[ko]=Ac());var Ie=null,L=null;function Tc(e){Ie=e}function Oc(e){P=e}var nt=null,ye=null,P=new Map,Io=250,Rc=new Set([f.USAGE,f.NOT_FOUND,f.CONFLICT]),Ic=new Set(["1","true","yes","on"]),Pc=Ue(()=>import("./chunks/register-setup-FDRTUG54.js")),$c=Ue(()=>import("./chunks/register-list-query-R3ELWWPY.js")),Dc=Ue(()=>import("./chunks/register-mutation-WHXJXIHJ.js")),Nc=Ue(()=>import("./chunks/register-operations-7ASWBYQG.js"));function Ht(e){return A(e)}function ma(e){let t=e.match(/--[a-zA-Z0-9][a-zA-Z0-9_-]*/g);if(!t||t.length===0)return;let n=[...new Set(t.map(o=>me(o)??o))];return n.length>0?n:void 0}function Mc(e,t,n){if(n?.suggested_retry||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let o=X(t),i=new Set(o.map(c=>me(c)??c)),r=ma(e),a=t.find(c=>w.commands.some(m=>m.name()===c)),s=a?w.commands.find(c=>c.name()===a):void 0,l=new Set([...w.options,...s?.options??[]].flatMap(c=>c.flags.split(/[ ,|]+/).map(m=>me(m)).filter(m=>m!==void 0))),d=r?.filter(c=>{let m=me(c)??c;return i.has(m)?!1:l.has(m)||Ln(t,a,m,P)!==void 0});return d&&d.length>0?d:void 0}function Fc(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let i=n?.[0],r=i?me(i):void 0,a=e.find(p=>w.commands.some(u=>u.name()===p)),s=a?w.commands.find(p=>p.name()===a):void 0,l=r?s?.options.find(p=>p.flags.split(/[ ,|]+/).includes(r)):void 0,d=Ln(e,a,r,P),c=r?l?.isBoolean()===!0||d===!1?[r]:[r,"<value>"]:[],m=r?Ht([...e,...c]):t;return m===t?void 0:m}function Lc(e){if(!e)return{};let t=["recovery_mode","missing_required_fields","suggested_flags","suggested_retry_args","allowed_values","candidate_commands","candidate_commands_total","candidate_commands_truncated","fallback_candidates","next_best_command"],n={};for(let o of t){let i=e[o];i!=null&&(n[o]=i)}return n}function jc(e){let t=e.existingRecovery;return{attempted_command:t?.attempted_command??e.attemptedCommand,normalized_args:t?.normalized_args??[...e.invocationArgv],provided_fields:t?.provided_fields??(e.providedFields.length>0?e.providedFields:void 0),missing:t?.missing??e.inferredMissing,...Lc(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function pa(e,t,n){let o=Fe(t),i=F(o),r=de(i),[a,s]=r===void 0?[]:i.slice(r,r+2),l=o.includes("--explain"),d=e?.recovery,c=d&&(a==="history-redact"||a==="history"&&s==="redact")?{...d,...d.attempted_command?{attempted_command:Ht(o)}:{},...d.normalized_args?{normalized_args:[...o]}:{},...d.suggested_retry?{suggested_retry:Ht(o)}:{},...d.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:d;if(c?.recovery_mode==="compact"&&!l)return{...e,recovery:c};let m=Ht(o),p=X(o),u=Mc(n,o,c),g=Fc(o,m,u,c),h=jc({invocationArgv:o,attemptedCommand:m,providedFields:p,inferredMissing:u,suggestedRetry:g,existingRecovery:c});return{...e,recovery:h}}async function it(e){let t=L;L=null,await Ki(t,e);let n=Ie;if(Ie=null,!n){ct();return}let o=[],i=oi();try{await Ji({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?i?.map(r=>r.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await Bo(n.hooks,{command:n.commandName,args:n.commandArgs,options:{...n.commandOptions},global:{...n.globalOptions},pm_root:n.pmRoot,ok:e.ok,error:e.error,result:se(),affected:i}))}catch(r){o=[`afterCommand hooks failed: ${r instanceof Error?r.message:String(r)}`]}finally{ct()}!n.globalOptions.json&&o.length>0&&_(`[pm] warning: afterCommand hook_warnings=${U(o)}`),n.profileEnabled&&o.length>0&&_(`profile:extensions hook_warnings=${U(o)}`)}async function ua(){await Ei()}function fa(e){return Ic.has((process.env[e]??"").trim().toLowerCase())}function ga(e){return fa("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!Rc.has(Math.trunc(e))}async function Gt(e){return ga(e.exit_code)?(await ua(),Si(e),!0):!1}async function ha(e){let t=ce(e.error),n=fr(t);e.bootstrapGlobal.json?_(JSON.stringify(pr(t,f.GENERIC_FAILURE),null,2)):_(t),process.exitCode=f.GENERIC_FAILURE;let o="runtime",i="runtime_failed";try{await ua(),mn(e.error);let r=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:f.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=r.errorCategory,i=r.commandResolution,Le(!1,t,{error_code:n.code,error_category:o,exit_code:f.GENERIC_FAILURE,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||_(`Failed to report error: ${ce(r)}`)}try{await it({ok:!1,error:t,exit_code:f.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||_(`Failed to run error hooks: ${ce(r)}`)}try{await je()}catch(r){e.bootstrapGlobal.json||_(`Failed to flush error reporting: ${ce(r)}`)}}var Uc={create:"create",update:"update","update-many":"update_many",list:"list","list-all":"list","list-draft":"list","list-open":"list","list-in-progress":"list","list-blocked":"list","list-closed":"list","list-canceled":"list",search:"search",calendar:"calendar",context:"context","templates save":"create"},Eo=new Map;function So(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function ya(e,t){return e.options.some(n=>n.long===t)}function wa(e,t){return e.options.some(n=>n.short===t)}function Ao(e,t,n,o){let i=t.trim();if(!i)return;let r=n.length>0?n:`Runtime schema field (${t})`;if(i.startsWith("-")&&!i.startsWith("--")){if(wa(e,i))return;if(o){e.option(`${i} <value>`,`${r} (repeatable)`,fn);return}e.option(`${i} <value>`,r);return}let a=i.startsWith("--")?i:`--${i}`;if(!ya(e,a)){if(o){e.option(`${a} <value>`,`${r} (repeatable)`,fn);return}e.option(`${a} <value>`,r)}}async function _a(e,t){let n=Uc[e];if(!n)return[];let o=`${t}:${n}`,i=Eo.get(o);if(i)return i;if(!await K(J(t)))return Eo.set(o,[]),[];let r=await D(t),s=(ln(r.schema).command_to_fields.get(n)??[]).flatMap(l=>[l.cli_flag,...l.cli_aliases].map(c=>({long:`--${c}`,type:So(l.type),value_type:So(l.type)})));return Eo.set(o,s),s}async function va(e,t){let n=G(t),o=$(process.cwd(),n.path);if(!await K(J(o)))return;let i=ye?.key===Do(o)?ye.snapshot:null,r=i===null?await D(o):i.settings,a=ln(r.schema),s=[{path:"create",command:"create"},{path:"update",command:"update"},{path:"update-many",command:"update_many"},{path:"list",command:"list"},{path:"list-all",command:"list"},{path:"list-draft",command:"list"},{path:"list-open",command:"list"},{path:"list-in-progress",command:"list"},{path:"list-blocked",command:"list"},{path:"list-closed",command:"list"},{path:"list-canceled",command:"list"},{path:"search",command:"search"},{path:"calendar",command:"calendar"},{path:"context",command:"context"},{path:"templates save",command:"create"}];for(let l of s){let d=te(e,l.path.split(" "));if(d)for(let c of a.command_to_fields.get(l.command)??[]){let m=c.description??"";Ao(d,c.cli_flag,m,c.repeatable);for(let p of c.cli_aliases)Ao(d,p,`Alias for --${c.cli_flag}`,c.repeatable)}}}async function Po(e,t,n,o,i){let r=E(n);if(!(r!=="create"&&r!=="update"))try{let a=i??await D(t),s=re(a,o);Jr(e,s,n)}catch{}}function To(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function ba(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function $o(e){return e.some(t=>t==="--profile")}function Do(e){return`pm-root:${e}`}function Oo(e){for(let t of e)t.startsWith("settings_read_")&&_(`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function Ca(e,t){e.profile&&(_(`profile:extensions loaded=${t.loadedCount} failed=${t.loadFailedCount} warnings=${t.loadWarnings.length} activation_failed=${t.activationFailedCount} hook_counts=before:${t.hooks.beforeCommand.length}|after:${t.hooks.afterCommand.length}|write:${t.hooks.onWrite.length}|read:${t.hooks.onRead.length}|index:${t.hooks.onIndex.length} command_overrides=${t.commands.overrides.length} command_handlers=${t.commands.handlers.length} parser_overrides=${t.parsers.overrides.length} preflight_overrides=${t.preflight.overrides.length} service_overrides=${t.services.overrides.length} renderer_overrides=${t.renderers.overrides.length}`),t.activationWarnings.length>0&&_(`profile:extensions activation_warnings=${U(t.activationWarnings)}`))}function Wt(e,t,n){if(!e)return;let o=v(n.commandPath??"")||"<none>";_(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function Vt(e,t=Ce){let n=Do(e);if(ye?.key===n)return ye.snapshot;try{let o=Date.now(),{settings:i,warnings:r}=await t(e),a=await Ko({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:i,discovery:a,discoveryMs:Date.now()-o,settingsReadWarnings:[...r]};return ye={key:n,snapshot:s},s}catch{return ye={key:n,snapshot:null},null}}async function Pe(e,t,n=D){let o=t?Qe(t):"all",i=ba(e,o);if(nt?.key===i)return nt.snapshot;try{let r=await n(e),a=await Ne({pmRoot:e,settings:r,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?oo(t):void 0}),s=await Me({...a,loaded:a.loaded}),l=[...new Set(s.commands.handlers.map(u=>v(u.command)))].filter(u=>u.length>0).sort((u,g)=>u.localeCompare(g)),d=xr(s.registrations.flags),c=br(s.commands.handlers,s.registrations.commands),m=Er(l,s.registrations.commands,s.registrations.flags,c),p={hooks:s.hooks,commands:s.commands,parsers:s.parsers,preflight:s.preflight,services:s.services,renderers:s.renderers,registrations:s.registrations,pmRoot:e,settings:r,commandHandlers:l,commandFlagHelp:d,commandDescriptors:m,commandAliases:c,loadWarnings:[...a.warnings],activationWarnings:[...s.warnings],loadedCount:a.loaded.length,loadFailedCount:a.failed.length,activationFailedCount:s.failed.length,contextIntentPackages:a.loaded.map(({name:u,module:g})=>({name:u,module:g}))};return nt={key:i,snapshot:p},p}catch{return nt={key:i,snapshot:null},null}}async function xa(e){let t=He(e);if(t.noExtensions){let a=$(process.cwd(),t.path);return await K(J(a))&&Oo((await Ce(a)).warnings),null}let n=$(process.cwd(),t.path),o=await Vt(n);if(!o)return null;Oo(o.settingsReadWarnings);let i={commandPath:T(e),commandArgs:io(e)};if(!Xe(o.discovery,i))return Wt(t.profile,o,i),null;let r=await Pe(n,i);return r?(Ca(t,r),{hooks:r.hooks,commands:r.commands,parsers:r.parsers,preflight:r.preflight,services:r.services,renderers:r.renderers,registrations:r.registrations,pmRoot:n}):null}async function ka(e){let t=await Pe(e);return t?new Map(t.commandDescriptors):P}async function Ea(e,t){return(await Ci({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(o=>o.outcome==="failed").map(o=>`extension_migration_failed:${o.layer}:${o.extension}:${o.id}`)}function Sa(e,t){let n=typeof t.author=="string"&&t.author.trim()?t.author.trim():"pm-extension";return bi(e,zi.forActiveExtensionHost({pmRoot:e,author:n}))}async function Aa(e,t,n,o=[]){let i=T(e),r=Wn(e.args.map(String),o),a={...t},s={...n},l=$(process.cwd(),n.path),d=await dt({command:i,args:r,options:a,global:s,pm_root:l});n.profile&&d.warnings.length>0&&_(`profile:extensions parser_warnings=${U(d.warnings)}`),r=d.context.args,a=d.context.options,s=d.context.global,co(P.get(v(i)),r,a,o),ve(void 0),lt({command:i,args:r,options:{...a},global:{...s},pm_root:l});let c=await Zt({command:i,args:r,options:a,global:s,pm_root:l,sdk:Sa(l,s)});if(s.profile&&c.warnings.length>0&&_(`profile:extensions command_handler_warnings=${U(c.warnings)}`),!c.handled){if(c.warnings.length>0){let m=c.warnings[0],p=c.errorMessage?.trim(),u=p?` ${p}`:"";throw new C(`Command "${i}" failed in extension handler (${m}).${u}`,f.GENERIC_FAILURE,{code:c.errorCode??"command_failed",nextSteps:c.remediation?[c.remediation]:void 0})}throw new C(`Command "${i}" is provided by extensions and is not currently available.`,f.NOT_FOUND)}return c.exitCode!==void 0&&(process.exitCode=c.exitCode),ve(c.result),c.result}var ra=Symbol("pm.wrappedActionHandler");function qc(e,t){let n=e[e.length-1];return n instanceof Ro?n:t}function aa(e,t,n){e&&n.length>0&&_(`profile:extensions ${t}=${U(n)}`)}function Hc(e){let t=P.get(v(e.commandPath));if(!t||!so(e.activeRegistrations,e.commandPath))return;let n=Lt(t).length===0?Hr(e.commandArgs):Wn(e.commandArgs,e.extensionFlagDefinitions);lo(t,n)}function zc(e,t,n){e.args=[...n],"_processArguments"in e&&typeof e._processArguments=="function"&&e._processArguments(),t.length>0&&Array.isArray(t[0])&&(t[0]=[...e.processedArgs])}function Ta(e){let t=n=>{let o=n;if(typeof o._actionHandler=="function"&&o[ra]!==!0){let i=o._actionHandler;o._actionHandler=async function(...a){let s=qc(a,n),l=Date.now();un(s);let d=He(s),c=O(T(s));if(["package inventory","packages inventory","extension inventory"].includes(c))return await i.apply(this,a);let m=$(process.cwd(),d.path),p=s.args.map(String),u=ae(),g=u?Ze(u,c,p):[],h=await _a(c,m),y=Re(s,p,[...g,...h]),x=await dt({command:c,args:p,options:y,global:d,pm_root:m});aa(d.profile,"parser_warnings",x.warnings),p=x.context.args,y=x.context.options,ie(s,y),d=x.context.global,Hc({activeRegistrations:u,commandPath:c,commandArgs:p,extensionFlagDefinitions:g}),d=await ji(d),vt(s,d),zc(s,a,p),_t(s,y),ve(void 0),lt({command:c,args:p,options:{...y},global:{...d},pm_root:m});let S=await Zt({command:c,args:p,options:y,global:d,pm_root:m,sdk:Sa(m,d)});if(aa(d.profile,"command_handler_warnings",S.warnings),S.handled){ve(S.result),tn(S.result,{...d,command:c,commandArgs:p,commandOptions:y,pmRoot:m}),d.profile&&_(`profile:command=${c} took_ms=${Date.now()-l}`);return}return await i.apply(this,a)},o[ra]=!0}for(let i of n.commands)t(i)};t(e)}async function qt(e){P=new Map,ne({overrides:[]}),e&&await Po(e.rootProgram,e.pmRoot,e.invocationArgv,zo(),e.settings)}function Gc(e,t,n,o){if(t?.flags&&t.flags.length>0){jn(e,t.flags);let i=Un(e,t.flags);i&&e.addHelpText("after",i)}else n&&e.addHelpText("after",n);o&&e.addHelpText("after",o)}function Oa(e,t,n){let o={core:0,standard:1,full:2,internal:3},i=(r,a)=>{let s=a.join(" "),l=[...n.entries()].filter(([c])=>c===s||c.startsWith(`${s} `)).map(([,c])=>c),d=l.length===0?"standard":l.reduce((c,m)=>o[m.tier]<o[c]?m.tier:c,"internal");Ct(r,d);for(let c of r.commands)i(c,[...a,c.name()])};for(let r of e.commands)t.has(r.name())||i(r,[r.name()])}async function Ra(e,t){let n=G(t),o=$(process.cwd(),n.path);if(n.noExtensions){await qt({rootProgram:e,pmRoot:o,invocationArgv:t});return}let i=await Vt(o),r=Oe(t);if(!i){await qt();return}if(!Xe(i.discovery,r)){await qt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings}),Wt($o(t),i,r);return}let a=await Pe(o,r);if(!a){await qt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings});return}ne(a.services),P=new Map(a.commandDescriptors),await Po(e,o,t,a.registrations,a.settings);let s=Dr(e,a.commandHandlers,a.commandDescriptors,a.commandAliases,c=>Nr(a.activationWarnings,_,c)),l=new Set(e.commands.map(c=>c.name())),d=c=>{let m=c.split(" ").filter(S=>S.length>0),p=a.commandDescriptors.get(c),u=te(e,m),g=a.commandFlagHelp.get(c),h=p?Pr(p):null;if(u){Gc(u,p,g,h);return}let y=$r(e,m);p?.description&&y.description(p.description);let x=g;p&&(Sr(y,p),p.flags.length>0&&(jn(y,p.flags),x=Un(y,p.flags)??void 0)),x&&y.addHelpText("after",x),h&&y.addHelpText("after",h),y.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...S)=>{let z=S[S.length-1],j=z instanceof Ro?z:y,we=He(j),Bt=Date.now(),rt=Ze(a.registrations,c,j.args.map(String)),$e=Re(j,j.args.map(String),rt),_e=await Aa(j,$e,we,rt);await Ui(we,_e),tn(_e,{...we,command:c,commandArgs:j.args.map(String),commandOptions:$e,pmRoot:o}),we.profile&&_(`profile:command=${c} took_ms=${Date.now()-Bt}`)})};for(let c of s)d(c);Oa(e,l,a.commandDescriptors)}var ot=jo(import.meta.url,["../.."])??"0.0.0",w=nn(ot);async function sa(e){if(!L)return;let t=Reflect.get(e,da);typeof t=="string"&&await Hi(t)}function Ia(e,t){t&&et(t)||(e.hook("preAction",async(n,o)=>{Ie=null,L=null,ct(),un(o);let i=o.optsWithGlobals(),r=He(o),a=O(T(o)),s=o.args.map(String),l=Re(o,s),d={...r};ci(a,{...l,outputInclude:i.outputInclude,outputLimit:i.outputLimit,outputBudget:i.outputBudget,outputFormat:i.outputFormat,outputSession:i.outputSession,outputCursor:i.outputCursor}),ao(o,a,d,l),await Ri(a,d);let c=$(process.cwd(),r.path),m=await xa(o);if(!m){Ie=Jo({commandName:a,commandArgs:s,commandOptions:l,globalOptions:d,pmRoot:c}),L=await pn({command:a,pm_version:ot,args:s,options:l,global:d,pm_root:c}),await sa(e),cn(a,s,l,{source_context:L?.source_context,source_context_source:L?.source_context_source}),dn(a),await Jn(a,l,c,To()),await Kn(a,s,l,d,c);return}Yo(m.hooks),Xo(m.commands),Qo(m.parsers),Zo(m.preflight),ne(m.services),ei(m.renderers),ti(m.registrations);let p=Ze(m.registrations,a,s);l=Re(o,s,p),ao(o,a,d,l);let u=await dt({command:a,args:s,options:l,global:d,pm_root:m.pmRoot});d.profile&&u.warnings.length>0&&_(`profile:extensions parser_warnings=${U(u.warnings)}`),s=u.context.args,l=u.context.options,ie(o,l),d=u.context.global,_t(o,l);let g=await ii({command:a,args:s,options:l,global:d,pm_root:m.pmRoot,decision:To()});d.profile&&g.warnings.length>0&&_(`profile:extensions preflight_warnings=${U(g.warnings)}`),s=g.context.args,l=g.context.options,ie(o,l),d=g.context.global,_t(o,l);let h=g.decision;await Jn(a,l,m.pmRoot,h),await Kn(a,s,l,d,m.pmRoot);let y=h.run_extension_migrations?await Ea(m.registrations.migrations,m.pmRoot):[];d.profile&&y.length>0&&_(`profile:extensions migration_warnings=${U(y)}`);let x=Qr(m.registrations.migrations);Ie={hooks:m.hooks,commandName:a,commandArgs:s,commandOptions:{...l},globalOptions:{...d},pmRoot:m.pmRoot,profileEnabled:!!d.profile,migrationBlockers:x},ve(void 0),lt({command:a,args:s,options:{...l},global:{...d},pm_root:m.pmRoot}),L=await pn({command:a,pm_version:ot,args:s,options:l,global:d,pm_root:m.pmRoot}),await sa(e),cn(a,s,l,{source_context:L?.source_context,source_context_source:L?.source_context_source}),dn(a);let S=await Vo(m.hooks,{command:a,args:s,options:{...l},global:{...d},pm_root:m.pmRoot});d.profile&&S.length>0&&_(`profile:extensions hook_warnings=${U(S)}`),h.enforce_mandatory_migration_gate&&Zr(a,l,x)}),e.hook("postAction",async()=>{let n=xo();Le(n.ok,n.error,{error_code:n.error_code,error_category:n.error_category,exit_code:n.exit_code,command_resolution:n.command_resolution,resolution_stage:n.resolution_stage}),await it(n)}))}Ia(w);var la=Symbol("pmCliIdempotentTopLevelRegistration");function Pa(e){let t=e;if(t[la])return;t[la]=!0;let n=e.command.bind(e);e.command=((o,...i)=>{let r=o.split(/\s+/u)[0];return e.commands.some(a=>a.name()===r||a.aliases().includes(r))?new Ro(r):n(o,...i)})}async function Wc(e,t){if(Pa(e),t.setup){let{registerSetupCommands:n}=await Pc();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await $c(),o=typeof t.targetCommandName=="string"&&mo.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await Dc();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await Nc();n(e)}}function Vc(e){return async t=>{let n=at(t.errorCode),o=ft({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Pi({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:ot,pm_root:e.bootstrapPmRoot,error_code:t.errorCode,error_message:t.errorMessage,exit_code:t.exitCode,error_category:n,command_resolution:o,resolution_stage:t.resolutionStage}),{errorCategory:n,commandResolution:o}}}async function $a(e){if(e.bootstrapGlobal.noExtensions||et(e.invocationArgv))return;let t=Oe(e.invocationArgv),n=await Vt(e.bootstrapPmRoot);if(n&&Xe(n.discovery,t)){let o=await Pe(e.bootstrapPmRoot,t);Da(o);return}n&&Wt($o(e.invocationArgv),n,t),ne({overrides:[]})}function Da(e){if(!e){ne({overrides:[]});return}ne(e.services)}async function No(e){Le(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await it({ok:!1,error:e.errorMessage,exit_code:e.exitCode,error_code:e.classificationCode,error_category:e.errorCategory,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage})}async function Na(){Le(!0,void 0,{exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await it({ok:!0,exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=f.SUCCESS}async function Ma(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof C)&&(an(e.error)||!n))return!1;let o=ce(e.error),i=e.error instanceof C?e.error.exitCode:rn(t),r=e.error instanceof C?e.error.context:void 0,a=pa(r,e.invocationArgv,o),s=dr(o,a),l=e.bootstrapGlobal.lean?Et(Rn(o,i,a)):Rn(o,i,a),d=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?le(l,u=>`${JSON.stringify(u,null,2)}
33
+ `)}function Jr(e,t,n){let o=E(n);if(o!=="create"&&o!=="update")return;let i=Be(e,o);i&&i.addHelpText("after",ec(o,t,n))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="840b471e-c996-57e2-b97c-3a84bd68f050")}catch{}})();function tc(e,t){let n=De(e.id);return n||`migration-${String(t+1).padStart(3,"0")}`}function nc(e){return De(e.status)?.toLowerCase()??"pending"}function oc(e){return e.mandatory===!0}function ic(e,t){let n=e.layer.localeCompare(t.layer);if(n!==0)return n;let o=e.name.localeCompare(t.name);return o!==0?o:e.id.localeCompare(t.id)}function Qr(e){let t=[];return e.forEach((n,o)=>{if(!oc(n.definition))return;let i=nc(n.definition);i!=="applied"&&t.push({layer:n.layer,name:n.name,id:tc(n.definition,o),status:i})}),t.sort(ic),t}function Yr(e){return Array.isArray(e)&&e.length>0}var rc=new Set(["create","beads import","todos import"]),ac=new Set(["restore","update","close","delete","append","claim","release"]),sc=new Set(["comments","notes","learnings"]),lc=new Set(["files","docs","test"]),cc=new Set(["activate","add","add-field","add-status","add-type","apply","compact","create","deactivate","delete","disable","edit","enable","import","infer","install","materialize","migrate","redact","remove","remove-field","remove-status","remove-type","remap-status","rename-field","rename-type","repair","run","save","set","unset","update","upgrade"]);function Bn(e,t){let n=t.force===!0;return rc.has(e)?{isMutation:!0,forceCapable:!1,forceRequested:!1}:ac.has(e)?{isMutation:!0,forceCapable:!0,forceRequested:n}:sc.has(e)?{isMutation:typeof t.add=="string",forceCapable:!0,forceRequested:n}:lc.has(e)?{isMutation:Yr(t.add)||Yr(t.remove),forceCapable:!0,forceRequested:n}:{isMutation:!1,forceCapable:!1,forceRequested:!1}}function dc(e,t,n){if(Bn(e,n).isMutation)return!0;let o=e.trim().toLowerCase();return Ti(o)?["close-many","close-task","copy","delete","discover","focus","pause-task","start-task","update-many"].includes(o)?!0:t.some(i=>cc.has(i.trim().toLowerCase())):!1}function Xr(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function mc(e,t,n){let o=t[0]?.trim().toLowerCase()??"";if(e.trim().toLowerCase()!=="schema"||!["rename-type","rename-field","remap-status"].includes(o))return;let i=[];if(De(t[1])||i.push("source"),De(n.to)||i.push("--to"),i.length!==0)throw new C(`Schema migration requires ${i.join(", ")}.`,f.USAGE,{code:"schema_migration_input_required",required:i.join(","),why:"Schema migrations require a source and target. A workspace-bound stable migration id is derived automatically when --migration-id is omitted.",recovery:{recovery_mode:"compact",missing_required_fields:i,suggested_flags:i.filter(r=>r.startsWith("--")),suggested_retry:`pm schema ${o} <source> --to <target>`}})}async function pc(e,t,n,o,i){if(e.trim().toLowerCase()!=="update"||typeof n.status!="string"||Xr(n.status)!==Xr(i.schema.workflow.in_progress_status))return;let r=t[0];if(!r)return;let a=re(i,ae()),s=await ut(o,r,i.id_prefix,i.item_format,a.type_to_folder);if(!s)return;let l=await vi(s,{schema:i.schema}),d=typeof n.assignee=="string"?n.assignee.trim():void 0;(d===void 0?l.document.metadata.assignee?.trim():!["","none","null","undefined"].includes(d.toLowerCase())&&d)||_(`warning:in_progress_item_unclaimed:${s.id}:claim_with=pm claim ${s.id}`)}async function Kn(e,t,n,o,i){if(!dc(e,t,n)||(mc(e,t,n),!await K(J(i))))return;let r=await Ce(i);o.json!==!0&&await pc(e,t,n,i,r.settings);let a=Ai({author:pt(o.author,r.settings.author_default),payload:{command:e,args:t,options:n},settings:r.settings.mutation_guard,force:o.force===!0||n.force===!0});for(let s of a.warnings)_(`warning:${s}`)}function Zr(e,t,n){if(n.length===0)return;let o=Bn(e,t);if(!o.isMutation||o.forceCapable&&o.forceRequested)return;let i=n.map(a=>`extension_migration_blocking:${a.layer}:${a.name}:${a.id}:${a.status}`),r=o.forceCapable?"Re-run this command with --force to bypass.":"This command path does not support --force bypass.";throw new C(`Write command "${e}" blocked by unresolved mandatory extension migrations (${i.join(",")}). ${r}`,f.CONFLICT)}async function Jn(e,t,n,o){if(!Bn(e,t).isMutation||!o.enforce_item_format_gate&&!o.run_preflight_item_format_sync||!await K(J(n)))return;let{settings:r,metadata:a,warnings:s}=await Ce(n);for(let l of s)_(`warning:${l}`);if(o.enforce_item_format_gate&&!a.has_explicit_item_format&&(wi(r),await _i(n,r,"item_format:auto_select_default")),o.run_preflight_item_format_sync){let l=re(r,ae());await Oi(n,r.item_format,"item_format:pre_mutation_sync",l.type_to_folder,r.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]="697f96fe-38a0-5530-b54b-22cb442c130f")}catch{}})();function Yn(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=v(n);o.length!==0&&t.push(o)}return t}function Te(e){let t=v(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(i=>i.length>0);for(let i of Yn(e.commandArgs))o.push(...i.split(" ").filter(r=>r.length>0)),n.push(o.join(" "));return[...new Set(n.flatMap(i=>[i,O(i)]))]}function Xn(e,t){let n=v(e);if(n.length===0)return!1;let o=Te(t);for(let i of o)if(i===n||i.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(i=>n.startsWith(`${i} `)):!1}function $t(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...R(n.commands),...R(n.command_handlers),...R(n.command_overrides),...R(n.flag_commands),...R(n.parser_overrides),...ea(n.preflight_ownership),...ea(n.renderer_ownership)]:[]}function R(e){return e??[]}function ea(e){return R(e).flatMap(t=>t.commands)}function Ye(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var ta=new Set(["hooks","parser","preflight","renderers"]),na=new Set(["commands","schema","services","importers"]),uc=new Set(["reindex","search","search-advanced"]),fc=new Set(["--template"]);function Ae(e,t){for(let n of t)if(e.has(n))return!0;return!1}function Qn(e){let t=v(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return uc.has(n??t)}function Zn(e,t){for(let n of e.commandArgs??[]){if(!n.startsWith("--"))continue;let[o]=n.split("=",1);if(t.has(o))return!0}return!1}function Dt(e){return v(e.commandPath??"")==="create"&&Zn(e,fc)}function eo(e){return e.some(t=>{let n=v(t);return n==="templates"||n.startsWith("templates ")})}function Pt(e,t){return e.some(n=>Xn(n,t))||Dt(t)&&eo(e)}function to(e){return[R(e.hooks).length,(e.preflight_overrides??0)-R(e.preflight_ownership).length,R(e.item_types).length,R(e.item_fields).length,R(e.relationship_kinds).length,R(e.service_overrides).length,R(e.assurance_providers).length,R(e.renderer_overrides).length-R(e.renderer_ownership).length].some(n=>n>0)}function no(e,t){let n=e.activation?.commands??[];if(n.length>0)return Pt(n,t);let o=$t(e);if(Pt(o,t)||Ye(e).has("search")&&Qn(t.commandPath))return!0;if(e.contributions)return to(e.contributions)}function Nt(e,t){let n=no(e,t);if(n!==void 0)return n;let o=Ye(e);return!!(Ae(o,ta)||Ae(o,na))}function Xe(e,t){return e.effective.length===0?!1:Qe(t)!=="all"?e.effective.some(o=>Nt(o,t)):e.effective.some(o=>{let i=Ye(o);return $t(o).length>0||Ae(i,ta)||Ae(i,na)||i.has("search")})}function Qe(e){if(v(e.commandPath??"").split(" ")[0]==="completion")return"all";let t=Te(e).filter(i=>i.split(" ").every(r=>!r.startsWith("-"))).sort((i,r)=>r.length-i.length)[0]??v(e.commandPath??"");if(t.length===0)return"all";let n=Dt(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function oo(e){return Qe(e)==="all"?void 0:t=>Nt(t,e)}function Oe(e){let t=k(e);if(t.requested&&t.commandPathTokens.length>0){let[i,...r]=t.commandPathTokens;return{commandPath:i,commandArgs:r,allowCommandPrefixMatch:!0}}let n=F(e),o=n.findIndex(i=>i.trim().length>0&&!i.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function io(e){let t=e.args.map(String);if(v(T(e))==="create"){let o=e.optsWithGlobals();typeof o.template=="string"&&o.template.trim().length>0&&t.push("--template")}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2b424635-df90-55ee-beb0-d39a79d242f3")}catch{}})();var Mt=Symbol.for("pm.readOutputInvocationProvenance");function ie(e,t){let n=Reflect.get(e,Mt);n!==void 0&&Reflect.set(t,Mt,n)}function ro(e,t,n){let o=li(t,n);if(!o)return;let i=e;for(;i.parent;)i=i.parent;let r=i.rawArgs,a=new Set(X(r.slice(2))),s=si.find(c=>c.command===o),l=Object.values(s.dimensions).flatMap(c=>c.legacy_aliases.flatMap(m=>a.has(m.flag)?[m.flag]:[])),d=Reflect.get(n,Mt);Reflect.set(n,Mt,{canonical_include_modes:d?.canonical_include_modes??[],explicit_legacy_aliases:l,cli_invocation_observed:!0}),ie(n,e)}function ao(e,t,n,o){ro(e,t,o);let i=n.outputInclude;if(i===void 0)return;let{selectors:r,modes:a}=mi(t,i,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),a.length===0)return;ie(o,e);let s=di(t);for(let d of a){let c=s.get(d),m=o[c];e.setOptionValueWithSource(c,m,"cli")}let l=r.length>0?r.join(","):void 0;l===void 0?delete n.outputInclude:n.outputInclude=l;for(let d=e;d;d=d.parent)d.setOptionValueWithSource("outputInclude",l,"cli");vt(e,n)}function gc(e){let t=e.optsWithGlobals(),n=T(e);if(O(n)===n)return t;let o=e.opts();for(let i=e.parent;i?.parent;i=i.parent)for(let r of Object.keys(i.opts()))!(r in o)&&i.getOptionValueSource(r)==="default"&&delete t[r];return t}function Re(e,t,n=[]){let i={...gc(e)};ie(e,i),delete i.json,delete i.quiet,delete i.path,delete i.pmPath,delete i.noExtensions,delete i.extensions,delete i.profile,delete i.pager,delete i.changedFields,delete i.fullChangedFields,delete i.idOnly,delete i.lean,delete i.tokenAccounting,delete i.outputInclude,delete i.outputLimit,delete i.outputBudget,delete i.outputFormat,delete i.outputSession;let r=qr(t);for(let[a,s]of Object.entries(r))i[a]===void 0&&(i[a]=s);if(n.length>0){let a=Lr(n),s=yt(T(e)).map(c=>({long:c.flag,short:c.short,aliases:c.aliases})),l={...r};for(let c of a)i[c]!==void 0&&(l[c]=i[c]);Gn(l,[...s,...n],T(e));let d=Ur(i,n,r);return ie(i,d),d}return i}function Ft(e,t){let n=v(t);return n.length===0?[]:e.flags.filter(o=>O(v(o.target_command))===O(n)).flatMap(o=>o.flags)}function Ze(e,t,n){let o=Ft(e,t),i=[t],r=[];for(let a of n){if(a.startsWith("-"))break;i.push(a);let s=Ft(e,i.join(" "));s.length>0&&(r=s)}return r.length>0?r:o}function Lt(e){return e.arguments??[]}function oa(e){let t=Lt(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function so(e,t){if(!e)return!1;let n=v(t);return e.importers.some(o=>v(`${o.importer} import`)===n)||e.exporters.some(o=>v(`${o.exporter} export`)===n)}function lo(e,t){let n=Lt(e),o=n.filter(l=>l.required).length,r=n.some(l=>l.variadic)?Number.POSITIVE_INFINITY:n.length,a=e.failure_hints??[],s=a.length>0?` ${a.join(" ")}`:"";if(t.length<o)throw new C(`Missing required argument for extension command '${e.command}'. Usage: ${oa(e)}${s}`,f.USAGE);if(t.length>r){let l=t.slice(r).join(" ");throw new C(`Too many arguments for extension command '${e.command}': ${l}. Usage: ${oa(e)}${s}`,f.USAGE)}}function hc(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function yc(e,t,n){if(n.length>0){Gn(t,n,e.command);return}let o=Object.keys(t).filter(i=>t[i]!==void 0).sort();if(o.length!==0)throw new C(`Unknown option '${o.map(hc).join(", ")}' for extension command '${e.command}'. This command does not define extension flags.`,f.USAGE)}function co(e,t,n,o){e&&(lo(e,t),yc(e,n,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]="48c16121-f941-50e9-9945-3a14ceddb08f")}catch{}})();var wc=new Set(["--version","-V"]);function et(e){let t=F(e);return["package","packages","extension"].includes(t[0]??"")&&t[1]==="inventory"}var _c=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),mo=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]),ia=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]),vc=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),bc=new Set(["claim","close-task","pause-task","release","start-task","test"]),jt={setup:!0,listQuery:!0,mutation:!0,operation:!0},Cc=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function tt(e){return e.some(t=>wc.has(t))}function po(e){if(tt(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||k(e).requested)return jt;let t=E(e);if(!t)return jt;let n=t.trim().toLowerCase(),o=F(e),i=W(o)?.alias;return M.some(r=>r.alias===i)?{...jt,targetCommandName:i}:_c.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:mo.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:ia.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:vc.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:jt}function uo(e){return e.length===0||k(e).requested||e.includes("--explain")&&E(e)===void 0}function fo(e,t){return et(t)||tt(t)?!1:oe(t)||k(t).requested?!0:!!E(t)}function go(e){if(tt(e))return!1;let t=E(e);return t?Cc.has(t):!1}function xc(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,i=e.normalizedTokens.map(d=>{let c=d.indexOf("=");return c>=0?d.slice(0,c):d}).find(d=>d==="--literal"||d==="--regex"||d==="--replacement"),r=i?e.argv.map(d=>{let c=d.indexOf("=");return(c>=0?d.slice(0,c):d)===o?c>=0?`${i}${d.slice(c)}`:i:d}):e.argv,a=Fe(r),s=i&&n>=0?`${o}=[redacted]`:t,l=i&&e.normalizedDisplay.includes("=")?`${i}=[redacted]`:e.normalizedDisplay;return{argv:a,normalizedDisplay:l,sourceDisplay:s}}function ho(e){let t=e.commandName;if(!t)return;let n=e.trace.find(d=>d.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(d=>d.length>0),i=o.length>0?o.join(" "):"the canonical flag",r=ia.has(t)||bc.has(t),a=r?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=r?"mutating option":"option",l=xc({argv:e.argv,normalizedDisplay:i,normalizedTokens:o,rawFrom:n.from});throw new C(`Refusing to auto-correct ${s} ${l.sourceDisplay} to ${l.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,f.USAGE,{code:a,examples:[A(l.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:l.argv,suggested_retry:A(l.argv)}})}(function(){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]="afcf2608-3360-5030-b5ea-b101df5829e7")}catch{}})();var kc=new Set(["success","nonexistent_command","invalid_option","missing_required_option","missing_required_argument","invalid_usage","validation_failed","health_findings","validation_findings","conflict","runtime_failed","unknown_failed"]),Ec=new Set(["parse","preflight","execute","unknown"]),Sc=new Set(["usage","validation","conflict","runtime","unknown"]);function he(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let i=o.trim();if(i.length>0)return i}}}function yo(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Ut(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="number"&&Number.isFinite(o))return Math.max(0,Math.trunc(o))}}function wo(e){if(!e)return;let t=e.trim().toLowerCase();if(kc.has(t))return t}function _o(e){if(!e)return;let t=e.trim().toLowerCase();if(Ec.has(t))return t}function vo(e){if(!e)return;let t=e.trim().toLowerCase();if(Sc.has(t))return t}function bo(e){let t=he(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let a=n.find(s=>typeof s=="string"&&s.trim().length>0);if(typeof a=="string")return a.trim()}if(yo(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let i=Ut(e,"failed");if(typeof i=="number"&&i>0)return`failed_runs:${i}`;let r=e?.run_results;if(Array.isArray(r)){let a=r.filter(s=>Jt(s)?.status==="failed").length;if(a>0)return`failed_runs:${a}`}}function Co(e,t){if(!e)return t===f.USAGE?"invalid_command_usage":t===f.NOT_FOUND?"item_not_found":t===f.CONFLICT?"lock_conflict":t===f.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function xo(){let e=Jt(se()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Ut(e,"exit_code","exitCode"),o=t??n??f.SUCCESS,i=Fi(o),r=he(e,"error_code","errorCode")??Co(i,o),a=vo(he(e,"error_category","errorCategory"))??(i?void 0:at(r)),s=i?void 0:bo(e)??`command_exit_${o}`,l=wo(he(e,"command_resolution","commandResolution"))??ft({ok:i,errorCode:r,errorCategory:a}),d=_o(he(e,"resolution_stage","resolutionStage"))??"execute";return{ok:i,error:s,exit_code:o,error_code:r,error_category:a,command_resolution:l,resolution_stage:d}}(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]="4cfcafe6-c6d5-579b-9b12-4b47c89f2355")}catch{}})();var ko="PM_CLI_PACKAGE_ROOT",da=Symbol("pm.deprecatedAliasInvocation"),zt=new Map;for(let e of V){let t=e.alias.split(" ")[0],n=zt.get(t)??[];n.push(e),zt.set(t,n)}for(let e of zt.values())e.sort((t,n)=>n.alias.split(" ").length-t.alias.split(" ").length);function Ac(){return Lo(import.meta.url,["../.."])}(typeof process.env[ko]!="string"||process.env[ko]?.trim().length===0)&&(process.env[ko]=Ac());var Ie=null,L=null;function Tc(e){Ie=e}function Oc(e){P=e}var nt=null,ye=null,P=new Map,Io=250,Rc=new Set([f.USAGE,f.NOT_FOUND,f.CONFLICT]),Ic=new Set(["1","true","yes","on"]),Pc=Ue(()=>import("./chunks/register-setup-VUD37N4A.js")),$c=Ue(()=>import("./chunks/register-list-query-L6HAHW7V.js")),Dc=Ue(()=>import("./chunks/register-mutation-6OCZVTW5.js")),Nc=Ue(()=>import("./chunks/register-operations-3E5U4TOE.js"));function Ht(e){return A(e)}function ma(e){let t=e.match(/--[a-zA-Z0-9][a-zA-Z0-9_-]*/g);if(!t||t.length===0)return;let n=[...new Set(t.map(o=>me(o)??o))];return n.length>0?n:void 0}function Mc(e,t,n){if(n?.suggested_retry||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let o=X(t),i=new Set(o.map(c=>me(c)??c)),r=ma(e),a=t.find(c=>w.commands.some(m=>m.name()===c)),s=a?w.commands.find(c=>c.name()===a):void 0,l=new Set([...w.options,...s?.options??[]].flatMap(c=>c.flags.split(/[ ,|]+/).map(m=>me(m)).filter(m=>m!==void 0))),d=r?.filter(c=>{let m=me(c)??c;return i.has(m)?!1:l.has(m)||Ln(t,a,m,P)!==void 0});return d&&d.length>0?d:void 0}function Fc(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let i=n?.[0],r=i?me(i):void 0,a=e.find(p=>w.commands.some(u=>u.name()===p)),s=a?w.commands.find(p=>p.name()===a):void 0,l=r?s?.options.find(p=>p.flags.split(/[ ,|]+/).includes(r)):void 0,d=Ln(e,a,r,P),c=r?l?.isBoolean()===!0||d===!1?[r]:[r,"<value>"]:[],m=r?Ht([...e,...c]):t;return m===t?void 0:m}function Lc(e){if(!e)return{};let t=["recovery_mode","missing_required_fields","suggested_flags","suggested_retry_args","allowed_values","candidate_commands","candidate_commands_total","candidate_commands_truncated","fallback_candidates","next_best_command"],n={};for(let o of t){let i=e[o];i!=null&&(n[o]=i)}return n}function jc(e){let t=e.existingRecovery;return{attempted_command:t?.attempted_command??e.attemptedCommand,normalized_args:t?.normalized_args??[...e.invocationArgv],provided_fields:t?.provided_fields??(e.providedFields.length>0?e.providedFields:void 0),missing:t?.missing??e.inferredMissing,...Lc(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function pa(e,t,n){let o=Fe(t),i=F(o),r=de(i),[a,s]=r===void 0?[]:i.slice(r,r+2),l=o.includes("--explain"),d=e?.recovery,c=d&&(a==="history-redact"||a==="history"&&s==="redact")?{...d,...d.attempted_command?{attempted_command:Ht(o)}:{},...d.normalized_args?{normalized_args:[...o]}:{},...d.suggested_retry?{suggested_retry:Ht(o)}:{},...d.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:d;if(c?.recovery_mode==="compact"&&!l)return{...e,recovery:c};let m=Ht(o),p=X(o),u=Mc(n,o,c),g=Fc(o,m,u,c),h=jc({invocationArgv:o,attemptedCommand:m,providedFields:p,inferredMissing:u,suggestedRetry:g,existingRecovery:c});return{...e,recovery:h}}async function it(e){let t=L;L=null,await Ki(t,e);let n=Ie;if(Ie=null,!n){ct();return}let o=[],i=oi();try{await Ji({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?i?.map(r=>r.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await Bo(n.hooks,{command:n.commandName,args:n.commandArgs,options:{...n.commandOptions},global:{...n.globalOptions},pm_root:n.pmRoot,ok:e.ok,error:e.error,result:se(),affected:i}))}catch(r){o=[`afterCommand hooks failed: ${r instanceof Error?r.message:String(r)}`]}finally{ct()}!n.globalOptions.json&&o.length>0&&_(`[pm] warning: afterCommand hook_warnings=${U(o)}`),n.profileEnabled&&o.length>0&&_(`profile:extensions hook_warnings=${U(o)}`)}async function ua(){await Ei()}function fa(e){return Ic.has((process.env[e]??"").trim().toLowerCase())}function ga(e){return fa("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!Rc.has(Math.trunc(e))}async function Gt(e){return ga(e.exit_code)?(await ua(),Si(e),!0):!1}async function ha(e){let t=ce(e.error),n=fr(t);e.bootstrapGlobal.json?_(JSON.stringify(pr(t,f.GENERIC_FAILURE),null,2)):_(t),process.exitCode=f.GENERIC_FAILURE;let o="runtime",i="runtime_failed";try{await ua(),mn(e.error);let r=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:f.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=r.errorCategory,i=r.commandResolution,Le(!1,t,{error_code:n.code,error_category:o,exit_code:f.GENERIC_FAILURE,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||_(`Failed to report error: ${ce(r)}`)}try{await it({ok:!1,error:t,exit_code:f.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||_(`Failed to run error hooks: ${ce(r)}`)}try{await je()}catch(r){e.bootstrapGlobal.json||_(`Failed to flush error reporting: ${ce(r)}`)}}var Uc={create:"create",update:"update","update-many":"update_many",list:"list","list-all":"list","list-draft":"list","list-open":"list","list-in-progress":"list","list-blocked":"list","list-closed":"list","list-canceled":"list",search:"search",calendar:"calendar",context:"context","templates save":"create"},Eo=new Map;function So(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function ya(e,t){return e.options.some(n=>n.long===t)}function wa(e,t){return e.options.some(n=>n.short===t)}function Ao(e,t,n,o){let i=t.trim();if(!i)return;let r=n.length>0?n:`Runtime schema field (${t})`;if(i.startsWith("-")&&!i.startsWith("--")){if(wa(e,i))return;if(o){e.option(`${i} <value>`,`${r} (repeatable)`,fn);return}e.option(`${i} <value>`,r);return}let a=i.startsWith("--")?i:`--${i}`;if(!ya(e,a)){if(o){e.option(`${a} <value>`,`${r} (repeatable)`,fn);return}e.option(`${a} <value>`,r)}}async function _a(e,t){let n=Uc[e];if(!n)return[];let o=`${t}:${n}`,i=Eo.get(o);if(i)return i;if(!await K(J(t)))return Eo.set(o,[]),[];let r=await D(t),s=(ln(r.schema).command_to_fields.get(n)??[]).flatMap(l=>[l.cli_flag,...l.cli_aliases].map(c=>({long:`--${c}`,type:So(l.type),value_type:So(l.type)})));return Eo.set(o,s),s}async function va(e,t){let n=G(t),o=$(process.cwd(),n.path);if(!await K(J(o)))return;let i=ye?.key===Do(o)?ye.snapshot:null,r=i===null?await D(o):i.settings,a=ln(r.schema),s=[{path:"create",command:"create"},{path:"update",command:"update"},{path:"update-many",command:"update_many"},{path:"list",command:"list"},{path:"list-all",command:"list"},{path:"list-draft",command:"list"},{path:"list-open",command:"list"},{path:"list-in-progress",command:"list"},{path:"list-blocked",command:"list"},{path:"list-closed",command:"list"},{path:"list-canceled",command:"list"},{path:"search",command:"search"},{path:"calendar",command:"calendar"},{path:"context",command:"context"},{path:"templates save",command:"create"}];for(let l of s){let d=te(e,l.path.split(" "));if(d)for(let c of a.command_to_fields.get(l.command)??[]){let m=c.description??"";Ao(d,c.cli_flag,m,c.repeatable);for(let p of c.cli_aliases)Ao(d,p,`Alias for --${c.cli_flag}`,c.repeatable)}}}async function Po(e,t,n,o,i){let r=E(n);if(!(r!=="create"&&r!=="update"))try{let a=i??await D(t),s=re(a,o);Jr(e,s,n)}catch{}}function To(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function ba(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function $o(e){return e.some(t=>t==="--profile")}function Do(e){return`pm-root:${e}`}function Oo(e){for(let t of e)t.startsWith("settings_read_")&&_(`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function Ca(e,t){e.profile&&(_(`profile:extensions loaded=${t.loadedCount} failed=${t.loadFailedCount} warnings=${t.loadWarnings.length} activation_failed=${t.activationFailedCount} hook_counts=before:${t.hooks.beforeCommand.length}|after:${t.hooks.afterCommand.length}|write:${t.hooks.onWrite.length}|read:${t.hooks.onRead.length}|index:${t.hooks.onIndex.length} command_overrides=${t.commands.overrides.length} command_handlers=${t.commands.handlers.length} parser_overrides=${t.parsers.overrides.length} preflight_overrides=${t.preflight.overrides.length} service_overrides=${t.services.overrides.length} renderer_overrides=${t.renderers.overrides.length}`),t.activationWarnings.length>0&&_(`profile:extensions activation_warnings=${U(t.activationWarnings)}`))}function Wt(e,t,n){if(!e)return;let o=v(n.commandPath??"")||"<none>";_(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function Vt(e,t=Ce){let n=Do(e);if(ye?.key===n)return ye.snapshot;try{let o=Date.now(),{settings:i,warnings:r}=await t(e),a=await Ko({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:i,discovery:a,discoveryMs:Date.now()-o,settingsReadWarnings:[...r]};return ye={key:n,snapshot:s},s}catch{return ye={key:n,snapshot:null},null}}async function Pe(e,t,n=D){let o=t?Qe(t):"all",i=ba(e,o);if(nt?.key===i)return nt.snapshot;try{let r=await n(e),a=await Ne({pmRoot:e,settings:r,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?oo(t):void 0}),s=await Me({...a,loaded:a.loaded}),l=[...new Set(s.commands.handlers.map(u=>v(u.command)))].filter(u=>u.length>0).sort((u,g)=>u.localeCompare(g)),d=xr(s.registrations.flags),c=br(s.commands.handlers,s.registrations.commands),m=Er(l,s.registrations.commands,s.registrations.flags,c),p={hooks:s.hooks,commands:s.commands,parsers:s.parsers,preflight:s.preflight,services:s.services,renderers:s.renderers,registrations:s.registrations,pmRoot:e,settings:r,commandHandlers:l,commandFlagHelp:d,commandDescriptors:m,commandAliases:c,loadWarnings:[...a.warnings],activationWarnings:[...s.warnings],loadedCount:a.loaded.length,loadFailedCount:a.failed.length,activationFailedCount:s.failed.length,contextIntentPackages:a.loaded.map(({name:u,module:g})=>({name:u,module:g}))};return nt={key:i,snapshot:p},p}catch{return nt={key:i,snapshot:null},null}}async function xa(e){let t=He(e);if(t.noExtensions){let a=$(process.cwd(),t.path);return await K(J(a))&&Oo((await Ce(a)).warnings),null}let n=$(process.cwd(),t.path),o=await Vt(n);if(!o)return null;Oo(o.settingsReadWarnings);let i={commandPath:T(e),commandArgs:io(e)};if(!Xe(o.discovery,i))return Wt(t.profile,o,i),null;let r=await Pe(n,i);return r?(Ca(t,r),{hooks:r.hooks,commands:r.commands,parsers:r.parsers,preflight:r.preflight,services:r.services,renderers:r.renderers,registrations:r.registrations,pmRoot:n}):null}async function ka(e){let t=await Pe(e);return t?new Map(t.commandDescriptors):P}async function Ea(e,t){return(await Ci({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(o=>o.outcome==="failed").map(o=>`extension_migration_failed:${o.layer}:${o.extension}:${o.id}`)}function Sa(e,t,n){let o=typeof t.author=="string"&&t.author.trim()?t.author.trim():"pm-extension";return bi(e,zi.forActiveExtensionHost({pmRoot:e,author:o}),o,v(n))}async function Aa(e,t,n,o=[]){let i=T(e),r=Wn(e.args.map(String),o),a={...t},s={...n},l=$(process.cwd(),n.path),d=await dt({command:i,args:r,options:a,global:s,pm_root:l});n.profile&&d.warnings.length>0&&_(`profile:extensions parser_warnings=${U(d.warnings)}`),r=d.context.args,a=d.context.options,s=d.context.global,co(P.get(v(i)),r,a,o),ve(void 0),lt({command:i,args:r,options:{...a},global:{...s},pm_root:l});let c=await Zt({command:i,args:r,options:a,global:s,pm_root:l,sdk:Sa(l,s,i)});if(s.profile&&c.warnings.length>0&&_(`profile:extensions command_handler_warnings=${U(c.warnings)}`),!c.handled){if(c.warnings.length>0){let m=c.warnings[0],p=c.errorMessage?.trim(),u=p?` ${p}`:"";throw new C(`Command "${i}" failed in extension handler (${m}).${u}`,f.GENERIC_FAILURE,{code:c.errorCode??"command_failed",nextSteps:c.remediation?[c.remediation]:void 0})}throw new C(`Command "${i}" is provided by extensions and is not currently available.`,f.NOT_FOUND)}return c.exitCode!==void 0&&(process.exitCode=c.exitCode),ve(c.result),c.result}var ra=Symbol("pm.wrappedActionHandler");function qc(e,t){let n=e[e.length-1];return n instanceof Ro?n:t}function aa(e,t,n){e&&n.length>0&&_(`profile:extensions ${t}=${U(n)}`)}function Hc(e){let t=P.get(v(e.commandPath));if(!t||!so(e.activeRegistrations,e.commandPath))return;let n=Lt(t).length===0?Hr(e.commandArgs):Wn(e.commandArgs,e.extensionFlagDefinitions);lo(t,n)}function zc(e,t,n){e.args=[...n],"_processArguments"in e&&typeof e._processArguments=="function"&&e._processArguments(),t.length>0&&Array.isArray(t[0])&&(t[0]=[...e.processedArgs])}function Ta(e){let t=n=>{let o=n;if(typeof o._actionHandler=="function"&&o[ra]!==!0){let i=o._actionHandler;o._actionHandler=async function(...a){let s=qc(a,n),l=Date.now();un(s);let d=He(s),c=O(T(s));if(["package inventory","packages inventory","extension inventory"].includes(c))return await i.apply(this,a);let m=$(process.cwd(),d.path),p=s.args.map(String),u=ae(),g=u?Ze(u,c,p):[],h=await _a(c,m),y=Re(s,p,[...g,...h]),x=await dt({command:c,args:p,options:y,global:d,pm_root:m});aa(d.profile,"parser_warnings",x.warnings),p=x.context.args,y=x.context.options,ie(s,y),d=x.context.global,Hc({activeRegistrations:u,commandPath:c,commandArgs:p,extensionFlagDefinitions:g}),d=await ji(d),vt(s,d),zc(s,a,p),_t(s,y),ve(void 0),lt({command:c,args:p,options:{...y},global:{...d},pm_root:m});let S=await Zt({command:c,args:p,options:y,global:d,pm_root:m,sdk:Sa(m,d,c)});if(aa(d.profile,"command_handler_warnings",S.warnings),S.handled){ve(S.result),tn(S.result,{...d,command:c,commandArgs:p,commandOptions:y,pmRoot:m}),d.profile&&_(`profile:command=${c} took_ms=${Date.now()-l}`);return}return await i.apply(this,a)},o[ra]=!0}for(let i of n.commands)t(i)};t(e)}async function qt(e){P=new Map,ne({overrides:[]}),e&&await Po(e.rootProgram,e.pmRoot,e.invocationArgv,zo(),e.settings)}function Gc(e,t,n,o){if(t?.flags&&t.flags.length>0){jn(e,t.flags);let i=Un(e,t.flags);i&&e.addHelpText("after",i)}else n&&e.addHelpText("after",n);o&&e.addHelpText("after",o)}function Oa(e,t,n){let o={core:0,standard:1,full:2,internal:3},i=(r,a)=>{let s=a.join(" "),l=[...n.entries()].filter(([c])=>c===s||c.startsWith(`${s} `)).map(([,c])=>c),d=l.length===0?"standard":l.reduce((c,m)=>o[m.tier]<o[c]?m.tier:c,"internal");Ct(r,d);for(let c of r.commands)i(c,[...a,c.name()])};for(let r of e.commands)t.has(r.name())||i(r,[r.name()])}async function Ra(e,t){let n=G(t),o=$(process.cwd(),n.path);if(n.noExtensions){await qt({rootProgram:e,pmRoot:o,invocationArgv:t});return}let i=await Vt(o),r=Oe(t);if(!i){await qt();return}if(!Xe(i.discovery,r)){await qt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings}),Wt($o(t),i,r);return}let a=await Pe(o,r);if(!a){await qt({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings});return}ne(a.services),P=new Map(a.commandDescriptors),await Po(e,o,t,a.registrations,a.settings);let s=Dr(e,a.commandHandlers,a.commandDescriptors,a.commandAliases,c=>Nr(a.activationWarnings,_,c)),l=new Set(e.commands.map(c=>c.name())),d=c=>{let m=c.split(" ").filter(S=>S.length>0),p=a.commandDescriptors.get(c),u=te(e,m),g=a.commandFlagHelp.get(c),h=p?Pr(p):null;if(u){Gc(u,p,g,h);return}let y=$r(e,m);p?.description&&y.description(p.description);let x=g;p&&(Sr(y,p),p.flags.length>0&&(jn(y,p.flags),x=Un(y,p.flags)??void 0)),x&&y.addHelpText("after",x),h&&y.addHelpText("after",h),y.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...S)=>{let z=S[S.length-1],j=z instanceof Ro?z:y,we=He(j),Bt=Date.now(),rt=Ze(a.registrations,c,j.args.map(String)),$e=Re(j,j.args.map(String),rt),_e=await Aa(j,$e,we,rt);await Ui(we,_e),tn(_e,{...we,command:c,commandArgs:j.args.map(String),commandOptions:$e,pmRoot:o}),we.profile&&_(`profile:command=${c} took_ms=${Date.now()-Bt}`)})};for(let c of s)d(c);Oa(e,l,a.commandDescriptors)}var ot=jo(import.meta.url,["../.."])??"0.0.0",w=nn(ot);async function sa(e){if(!L)return;let t=Reflect.get(e,da);typeof t=="string"&&await Hi(t)}function Ia(e,t){t&&et(t)||(e.hook("preAction",async(n,o)=>{Ie=null,L=null,ct(),un(o);let i=o.optsWithGlobals(),r=He(o),a=O(T(o)),s=o.args.map(String),l=Re(o,s),d={...r};ci(a,{...l,outputInclude:i.outputInclude,outputLimit:i.outputLimit,outputBudget:i.outputBudget,outputFormat:i.outputFormat,outputSession:i.outputSession,outputCursor:i.outputCursor}),ao(o,a,d,l),await Ri(a,d);let c=$(process.cwd(),r.path),m=await xa(o);if(!m){Ie=Jo({commandName:a,commandArgs:s,commandOptions:l,globalOptions:d,pmRoot:c}),L=await pn({command:a,pm_version:ot,args:s,options:l,global:d,pm_root:c}),await sa(e),cn(a,s,l,{source_context:L?.source_context,source_context_source:L?.source_context_source}),dn(a),await Jn(a,l,c,To()),await Kn(a,s,l,d,c);return}Yo(m.hooks),Xo(m.commands),Qo(m.parsers),Zo(m.preflight),ne(m.services),ei(m.renderers),ti(m.registrations);let p=Ze(m.registrations,a,s);l=Re(o,s,p),ao(o,a,d,l);let u=await dt({command:a,args:s,options:l,global:d,pm_root:m.pmRoot});d.profile&&u.warnings.length>0&&_(`profile:extensions parser_warnings=${U(u.warnings)}`),s=u.context.args,l=u.context.options,ie(o,l),d=u.context.global,_t(o,l);let g=await ii({command:a,args:s,options:l,global:d,pm_root:m.pmRoot,decision:To()});d.profile&&g.warnings.length>0&&_(`profile:extensions preflight_warnings=${U(g.warnings)}`),s=g.context.args,l=g.context.options,ie(o,l),d=g.context.global,_t(o,l);let h=g.decision;await Jn(a,l,m.pmRoot,h),await Kn(a,s,l,d,m.pmRoot);let y=h.run_extension_migrations?await Ea(m.registrations.migrations,m.pmRoot):[];d.profile&&y.length>0&&_(`profile:extensions migration_warnings=${U(y)}`);let x=Qr(m.registrations.migrations);Ie={hooks:m.hooks,commandName:a,commandArgs:s,commandOptions:{...l},globalOptions:{...d},pmRoot:m.pmRoot,profileEnabled:!!d.profile,migrationBlockers:x},ve(void 0),lt({command:a,args:s,options:{...l},global:{...d},pm_root:m.pmRoot}),L=await pn({command:a,pm_version:ot,args:s,options:l,global:d,pm_root:m.pmRoot}),await sa(e),cn(a,s,l,{source_context:L?.source_context,source_context_source:L?.source_context_source}),dn(a);let S=await Vo(m.hooks,{command:a,args:s,options:{...l},global:{...d},pm_root:m.pmRoot});d.profile&&S.length>0&&_(`profile:extensions hook_warnings=${U(S)}`),h.enforce_mandatory_migration_gate&&Zr(a,l,x)}),e.hook("postAction",async()=>{let n=xo();Le(n.ok,n.error,{error_code:n.error_code,error_category:n.error_category,exit_code:n.exit_code,command_resolution:n.command_resolution,resolution_stage:n.resolution_stage}),await it(n)}))}Ia(w);var la=Symbol("pmCliIdempotentTopLevelRegistration");function Pa(e){let t=e;if(t[la])return;t[la]=!0;let n=e.command.bind(e);e.command=((o,...i)=>{let r=o.split(/\s+/u)[0];return e.commands.some(a=>a.name()===r||a.aliases().includes(r))?new Ro(r):n(o,...i)})}async function Wc(e,t){if(Pa(e),t.setup){let{registerSetupCommands:n}=await Pc();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await $c(),o=typeof t.targetCommandName=="string"&&mo.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await Dc();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await Nc();n(e)}}function Vc(e){return async t=>{let n=at(t.errorCode),o=ft({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Pi({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:ot,pm_root:e.bootstrapPmRoot,error_code:t.errorCode,error_message:t.errorMessage,exit_code:t.exitCode,error_category:n,command_resolution:o,resolution_stage:t.resolutionStage}),{errorCategory:n,commandResolution:o}}}async function $a(e){if(e.bootstrapGlobal.noExtensions||et(e.invocationArgv))return;let t=Oe(e.invocationArgv),n=await Vt(e.bootstrapPmRoot);if(n&&Xe(n.discovery,t)){let o=await Pe(e.bootstrapPmRoot,t);Da(o);return}n&&Wt($o(e.invocationArgv),n,t),ne({overrides:[]})}function Da(e){if(!e){ne({overrides:[]});return}ne(e.services)}async function No(e){Le(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await it({ok:!1,error:e.errorMessage,exit_code:e.exitCode,error_code:e.classificationCode,error_category:e.errorCategory,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage})}async function Na(){Le(!0,void 0,{exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await it({ok:!0,exit_code:f.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=f.SUCCESS}async function Ma(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof C)&&(an(e.error)||!n))return!1;let o=ce(e.error),i=e.error instanceof C?e.error.exitCode:rn(t),r=e.error instanceof C?e.error.context:void 0,a=pa(r,e.invocationArgv,o),s=dr(o,a),l=e.bootstrapGlobal.lean?Et(Rn(o,i,a)):Rn(o,i,a),d=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?le(l,u=>`${JSON.stringify(u,null,2)}
34
34
  `):l,null,2):cr(o,a);e.jsonErrors?be(`${d}
35
35
  `):_(d);let{errorCategory:c,commandResolution:m}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:s.code,errorMessage:s.detail,exitCode:i,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"}),p=await Gt({command:e.attemptedCommand,error_code:s.code,error_category:c,exit_code:i,error_message:s.detail,command_resolution:m,resolution_stage:"execute",source_context:L?.source_context});return await No({errorMessage:o,exitCode:i,classificationCode:s.code,errorCategory:c,commandResolution:m,resolutionStage:"execute"}),p&&(mn(sn(e.error,o)),await je(Io)),process.exitCode=i,!0}async function Fa(e,t){let n=O(k(e.invocationArgv).commandPathTokens.join(" "))||$n(e.invocationArgv),o=`unknown command '${n}'`,i=$(process.cwd(),e.bootstrapGlobal.path),r=await ka(i),a=Oe(e.invocationArgv),s=await Vn(i,{},Te(a)),l=await Ve({message:o},w,r,{failedExtensions:s}),d=In(l.message,l.commandName,l.allowedTypes,{unknownCommandExamples:l.unknownCommandExamples,unknownCommandNextSteps:l.unknownCommandNextSteps,attemptedCommand:l.attemptedCommand,normalizedInvocationArgs:l.normalizedInvocationArgs,providedOptionFlags:l.providedOptionFlags,unknownOptionSuggestions:l.unknownOptionSuggestions,suggestedRetryCommand:l.suggestedRetryCommand,failedExtensions:s}),{errorCategory:c,commandResolution:m}=await e.emitTelemetryCommandError({command:n,errorCode:d.code,errorMessage:d.detail,exitCode:f.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t??"commander.helpDisplayed"},resolutionStage:"parse"}),p=await Gt({command:n,error_code:d.code,error_category:c,exit_code:f.USAGE,error_message:d.detail,command_resolution:m,resolution_stage:"parse"}),u=e.jsonErrors?await Fn({message:o},w,r,e.bootstrapGlobal.lean===!0,{failedExtensions:s}):await Mn({message:o},w,r,{failedExtensions:s}),g=Pn(u,e.jsonErrors,s);await No({errorMessage:o,exitCode:f.USAGE,classificationCode:d.code,errorCategory:c,commandResolution:m,resolutionStage:"parse"}),e.jsonErrors?be(`${g}
36
36
  `):_(g),p&&await je(Io),process.exitCode=f.USAGE}async function La(e,t,n){if(!(t==="commander.helpDisplayed"||t==="commander.help"||t==="commander.helpCommand")&&!n.includes("(outputHelp)"))return!1;let i=k(e.invocationArgv);return i.requested&&!We(w,i.commandPathTokens)?(await Fa(e,t),!0):(await Na(),!0)}async function ja(e,t){let n=await Ve(e.error,w,P),o=In(n.message,n.commandName,n.allowedTypes,{unknownCommandExamples:n.unknownCommandExamples,unknownCommandNextSteps:n.unknownCommandNextSteps,attemptedCommand:n.attemptedCommand,normalizedInvocationArgs:n.normalizedInvocationArgs,providedOptionFlags:n.providedOptionFlags,unknownOptionSuggestions:n.unknownOptionSuggestions,suggestedRetryCommand:n.suggestedRetryCommand}),{errorCategory:i,commandResolution:r}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:o.code,errorMessage:o.detail,exitCode:f.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t},resolutionStage:"parse"}),a=await Gt({command:e.attemptedCommand,error_code:o.code,error_category:i,exit_code:f.USAGE,error_message:o.detail,command_resolution:r,resolution_stage:"parse",source_context:L?.source_context}),s=e.jsonErrors?await Fn(e.error,w,P,e.bootstrapGlobal.lean===!0):await Mn(e.error,w,P),l=await zr(o.code,e.bootstrapPmRoot,{},Te(Oe(e.invocationArgv))),d=Pn(s,e.jsonErrors,l);await No({errorMessage:n.message,exitCode:f.USAGE,classificationCode:o.code,errorCategory:i,commandResolution:r,resolutionStage:"parse"}),e.jsonErrors?be(`${d}
@@ -1,2 +1,2 @@
1
- import{a as Pe,b as Oe,c as Fe,d as Ae,e as Re,f as Te,g as Me,h as Be,i as L,j as $,k as j,l as K,m as H,p as U,q,w as G,x as Y,y as X,z as J}from"./focused-chunks/chunk-K3AIMRIK.js";import{a as M,b as B,c as D,d as N,u as Q}from"./focused-chunks/chunk-IFBA3ZAT.js";import"./focused-chunks/chunk-5MC57KRC.js";import"./focused-chunks/chunk-2O3QFI3G.js";import"./focused-chunks/chunk-AVP5C674.js";import{a as h}from"./focused-chunks/chunk-4A4DO5ZT.js";import{b as Ie,c as we,ca as x,d as Se,da as C,ea as b,fa as I,fb as R,ga as A,gb as T,ha as w,j as E,k,n as d,wc as V,yc as z,zc as W}from"./focused-chunks/chunk-MRH4A542.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="c06f3fb3-4b1f-5fdb-a9ce-bce8f88704aa")}catch{}})();function He(e){return e}function Ue(e){return e}function Z(e,o){for(let r of o.commands??[])e.registerCommand(r);for(let[r,t]of Object.entries(o.commandOverrides??{}))e.registerCommand(r,t);for(let[r,t]of Object.entries(o.flags??{}))e.registerFlags(r,t);for(let[r,t]of Object.entries(o.parsers??{}))e.registerParser(r,t);for(let[r,t]of Object.entries(o.renderers??{}))if(typeof t=="function")e.registerRenderer(r,t);else{let{run:i,...s}=t;e.registerRenderer(r,i,s)}for(let[r,t]of Object.entries(o.services??{}))e.registerService(r,t)}function ee(e,o){for(let s of o.preflights??[])e.registerPreflight(s);let r=o.itemTypes??[];r.length>0&&e.registerItemTypes(r);let t=o.itemFields??[];t.length>0&&e.registerItemFields(t);let i=o.relationshipKinds??[];i.length>0&&e.registerRelationshipKinds(i);for(let s of o.migrations??[])e.registerMigration(s);for(let s of o.profiles??[])e.registerProfile(s)}function re(e,o){for(let r of o.searchProviders??[])e.registerSearchProvider(r);for(let r of o.vectorStoreAdapters??[])e.registerVectorStoreAdapter(r);for(let r of o.assuranceProviders??[])e.registerAssuranceMeasurementProvider(r);for(let r of o.importers??[])e.registerImporter(r.name,r.importer,r.options);for(let r of o.exporters??[])e.registerExporter(r.name,r.exporter,r.options)}function oe(e,o){for(let r of o.beforeCommand??[])e.hooks.beforeCommand(r);for(let r of o.beforeMutation??[])e.hooks.beforeMutation(r);for(let r of o.afterCommand??[])e.hooks.afterCommand(r);for(let r of o.onWrite??[])e.hooks.onWrite(r);for(let r of o.onRead??[])e.hooks.onRead(r);for(let r of o.onIndex??[])e.hooks.onIndex(r)}function te(e){let r={activate:async t=>{Z(t,e),ee(t,e),re(t,e),oe(t,e.hooks??{}),await e.activate?.(t)}};return e.manifest&&(r.manifest=e.manifest),e.deactivate&&(r.deactivate=e.deactivate),r}function f(e){let o=e.flatMap(r=>r??[]);return o.length>0?o:void 0}function u(e){let o=Object.assign({},...e.map(r=>r??{}));return Object.keys(o).length>0?o:void 0}function ne(e){let o={};for(let r of e)for(let[t,i]of Object.entries(r??{}))o[t]=[...o[t]??[],...i];return Object.keys(o).length>0?o:void 0}var ie=["beforeCommand","beforeMutation","afterCommand","onWrite","onRead","onIndex"];function se(e,o,r){let t=o.map(s=>s?.[r]),i=f(t);if(i!==void 0){let s=e;s[r]=i}}function ae(e){let o={};for(let r of ie)se(o,e,r);return Object.keys(o).length>0?o:void 0}function qe(...e){let o={},r=(n,a)=>{a!==void 0&&(o[n]=a)};r("commands",f(e.map(n=>n.commands))),r("commandOverrides",u(e.map(n=>n.commandOverrides))),r("flags",ne(e.map(n=>n.flags))),r("parsers",u(e.map(n=>n.parsers))),r("renderers",u(e.map(n=>n.renderers))),r("services",u(e.map(n=>n.services))),r("preflights",f(e.map(n=>n.preflights))),r("itemTypes",f(e.map(n=>n.itemTypes))),r("itemFields",f(e.map(n=>n.itemFields))),r("relationshipKinds",f(e.map(n=>n.relationshipKinds))),r("migrations",f(e.map(n=>n.migrations))),r("profiles",f(e.map(n=>n.profiles))),r("searchProviders",f(e.map(n=>n.searchProviders))),r("vectorStoreAdapters",f(e.map(n=>n.vectorStoreAdapters))),r("assuranceProviders",f(e.map(n=>n.assuranceProviders))),r("importers",f(e.map(n=>n.importers))),r("exporters",f(e.map(n=>n.exporters))),r("hooks",ae(e.map(n=>n.hooks)));let t;for(let n of e)n.manifest&&(t=n.manifest);r("manifest",t);let i=e.some(n=>n.activate);r("activate",i?async n=>{for(let a of e)a.activate&&await a.activate(n)}:void 0);let s=e.some(n=>n.deactivate);return r("deactivate",s?async()=>{let n=[];for(let a of[...e].reverse())if(a.deactivate)try{await a.deactivate()}catch(c){n.push(c)}if(n.length>0)throw n.length>1?new AggregateError(n,"Multiple extension blueprint deactivate hooks failed."):n[0]}:void 0),o}var ce=[["commands","commands"],["commandOverrides","commands"],["flags","schema"],["itemTypes","schema"],["itemFields","schema"],["relationshipKinds","schema"],["migrations","schema"],["profiles","schema"],["parsers","parser"],["renderers","renderers"],["services","services"],["preflights","preflight"],["searchProviders","search"],["vectorStoreAdapters","search"],["assuranceProviders","services"],["importers","importers"],["exporters","importers"]];function g(e){return e?Array.isArray(e)?e.length>0:Object.keys(e).length>0:!1}function v(e){let o=new Set;for(let[i,s]of ce)g(e[i])&&o.add(s);(e.commands??[]).filter(p).some(i=>i.flags!==void 0)&&o.add("schema");let r=[...e.importers??[],...e.exporters??[]].filter(p);r.some(i=>i?.options?.flags!==void 0)&&o.add("schema"),r.some(i=>typeof i=="object")&&o.add("commands");let t=e.hooks??{};return[t.beforeCommand,t.beforeMutation,t.afterCommand,t.onWrite,t.onRead,t.onIndex].some(g)&&o.add("hooks"),[...o].sort((i,s)=>i.localeCompare(s))}var me=[["beforeCommand","before_command"],["beforeMutation","before_mutation"],["afterCommand","after_command"],["onWrite","on_write"],["onRead","on_read"],["onIndex","on_index"]];function m(e){return[...new Set(e)].sort((o,r)=>o.localeCompare(r))}function p(e){return e!=null}function _(e){return d(`${e.name} import`)}function y(e){return d(`${e.name} export`)}function de(e,o,r){return[...e.map(t=>d(t.name)),...o.filter(t=>t.options!==void 0).map(_),...r.filter(t=>t.options!==void 0).map(y)]}function fe(e,o,r,t){return[...Object.keys(e.flags??{}).map(i=>d(i)),...o.filter(i=>i.flags!==void 0).map(i=>d(i.name)),...r.filter(i=>i.options?.flags!==void 0).map(_),...t.filter(i=>i.options?.flags!==void 0).map(y)]}function le(e){return me.filter(([o])=>(e[o]?.length??0)>0).map(([,o])=>o)}function pe(e){let o=Object.entries(e??{}).filter(([,r])=>typeof r!="function"&&((r.commands?.length??0)>0||r.resultDiscriminator!==void 0)).map(([r,t])=>{let i=t;return{format:r,commands:m((i.commands??[]).map(s=>d(s))),result_discriminator:i.resultDiscriminator!==void 0}}).sort((r,t)=>r.format.localeCompare(t.format));return o.length>0?{renderer_ownership:o}:{}}function ue(e){return!e||e.length===0?{}:{assurance_providers:m(e.map(o=>o.id))}}function ge(e,o,r){return{item_types:m((e.itemTypes??[]).map(t=>t.name)),item_fields:m((e.itemFields??[]).map(t=>t.name)),...(e.relationshipKinds?.length??0)>0?{relationship_kinds:m(e.relationshipKinds.map(t=>t.kind))}:{},migrations:m((e.migrations??[]).flatMap(t=>typeof t.id=="string"?[t.id]:[])),profiles:m((e.profiles??[]).map(t=>t.name)),importers:m(o.map(t=>d(t.name))),exporters:m(r.map(t=>d(t.name))),search_providers:m((e.searchProviders??[]).map(t=>t.name)),vector_store_adapters:m((e.vectorStoreAdapters??[]).map(t=>t.name)),...ue(e.assuranceProviders),parser_overrides:m(Object.keys(e.parsers??{}).map(t=>d(t))),service_overrides:m(Object.keys(e.services??{}).map(t=>String(t).trim().toLowerCase())),renderer_overrides:m(Object.keys(e.renderers??{}).map(t=>String(t).trim().toLowerCase())),...pe(e.renderers),preflight_overrides:(e.preflights??[]).length,preflight_ownership:(e.preflights??[]).map(t=>({commands:[...t.commands??[]]}))}}function Ve(e){let o=(e.commands??[]).filter(p),r=(e.importers??[]).filter(p),t=(e.exporters??[]).filter(p),i=r.map(_),s=t.map(y),n=de(o,r,t),a=fe(e,o,r,t),c=e.hooks??{},l=ge(e,r,t);return{capabilities:v(e),commands:m(n),command_overrides:m(Object.keys(e.commandOverrides??{}).map(F=>d(F))),command_handlers:m([...n,...i,...s]),hooks:le(c),flag_commands:m(a),...l}}var he=["commands","commandOverrides","flags","parsers","renderers","services","preflights","itemTypes","itemFields","relationshipKinds","migrations","profiles","searchProviders","vectorStoreAdapters","assuranceProviders","importers","exporters"];function ve(e){return(e.itemFields??[]).filter(o=>typeof o?.name=="string"&&h.has(o.name.trim())).map(o=>({code:"reserved_item_field",severity:"error",message:`Item field "${o.name}" collides with reserved item metadata; rename it with an extension-specific prefix before publishing.`,field:o.name}))}function _e(e){return[...Object.values(e.flags??{}).flat(),...(e.commands??[]).flatMap(r=>r.flags??[]),...(e.importers??[]).flatMap(r=>r.options?.flags??[]),...(e.exporters??[]).flatMap(r=>r.options?.flags??[])].flatMap(r=>{if(typeof r?.long!="string"&&typeof r?.short!="string")return[];let t=x(r.long,r.short);if(t===null)return[];let{token:i,failure:s}=t;return[{code:s,severity:"error",message:`Flag "${i}" ${C(i,s)}.`,field:i}]})}function P(e){let o=new Set;for(let r of e){let t=k(r)??E(r);t!==null&&o.add(t)}return[...o].sort((r,t)=>r.localeCompare(t))}function ye(e,o){let r=[];if(o===null)return e.length>0&&r.push({code:"manifest_capabilities_absent",severity:"warning",message:`Blueprint exercises ${e.length===1?"capability":"capabilities"} [${e.join(", ")}] but declares none; set capabilities to deriveExtensionCapabilities(blueprint) so the manifest grant matches.`}),r;let t=new Set(o),i=new Set(e);for(let s of e)t.has(s)||r.push({code:"capability_undeclared",severity:"error",message:`Blueprint exercises capability "${s}" but it is absent from the declared capabilities; activation throws extension_capability_missing \u2014 add "${s}" to the manifest capabilities.`,capability:s});for(let s of o)i.has(s)||r.push({code:"capability_unused",severity:"warning",message:`Capability "${s}" is declared but no blueprint surface exercises it; drop it to keep the manifest least-privilege (pm package doctor reports this as extension_capability_unused).`,capability:s});return r}function Ee(e){let o=[],r=new Map;for(let i of e.commands??[]){let s=d(i.name);r.set(s,(r.get(s)??0)+1)}for(let[i,s]of r)s>1&&o.push({code:"duplicate_command",severity:"warning",message:`Command "${i}" is declared ${s} times in commands; the later registration shadows the earlier one at dispatch.`,command:i});let t=new Set(Object.keys(e.commandOverrides??{}).map(i=>d(i)));for(let i of r.keys())t.has(i)&&o.push({code:"command_override_conflict",severity:"warning",message:`Command "${i}" is declared both as a new command definition and as a command override; register one or the other.`,command:i});return o}function ke(e){let o=[];for(let r of he)r in e&&!g(e[r])&&o.push({code:"empty_surface",severity:"warning",message:`Blueprint field "${r}" is present but empty; remove it or populate it.`,field:r});if("hooks"in e){let r=e.hooks??{};[r.beforeCommand,r.beforeMutation,r.afterCommand,r.onWrite,r.onRead,r.onIndex].some(g)||o.push({code:"empty_surface",severity:"warning",message:'Blueprint field "hooks" is present but registers no lifecycle hooks; remove it or populate it.',field:"hooks"})}return o}function xe(e,o={}){let r=v(e),t=o.declaredCapabilities??e.manifest?.capabilities,i=Array.isArray(t)?P(t):null,s=[...ye(r,i),...Ee(e),..._e(e),...ve(e),...ke(e)];return{ok:s.every(n=>n.severity!=="error"),findings:s,used:r,declared:i}}function O(e,o){let{additionalCapabilities:r,...t}=o,i=Array.isArray(r)?P(r):[],s=[...new Set([...v(e),...i])].sort((n,a)=>n.localeCompare(a));return{...t,capabilities:s}}function ze(e,o){let r=O(e,o);return{module:te({...e,manifest:r}),manifest:r}}function S(e,o){if(e.status==="absent"||e.status==="ok")return null;let r=`${e.kind}_${e.status}`,t="";switch(r){case"pm_min_version_invalid":t=`pm_min_version "${e.required}" is not a valid version; the extension is treated as incompatible and the loader skips it.`;break;case"pm_min_version_unchecked":t=`pm_min_version "${e.required}" could not be compared against pm ${o}; compatibility is unverified.`;break;case"pm_min_version_unmet":t=`Requires pm >= ${e.required} but the target is pm ${o}; the loader skips the extension.`;break;case"pm_max_version_invalid":t=`pm_max_version "${e.required}" is not a valid inclusive upper bound (version ranges are not allowed); the extension is treated as incompatible and the loader skips it.`;break;case"pm_max_version_unchecked":t=`pm_max_version "${e.required}" could not be compared against pm ${o}; compatibility is unverified.`;break;case"pm_max_version_exceeded":t=`Allows pm <= ${e.required} but the target is pm ${o}; the loader skips the extension.`;break;case"pm_max_version_exceeded_warn":t=`Target pm ${o} is newer than pm_max_version ${e.required}, but the "warn" exceeded mode lets it load with a warning.`;break}return{code:r,severity:e.allowed?"warning":"error",constraint:e.kind,required:e.required,current:o,message:t}}function Ce(e,o){let r=b(e.pm_min_version,o.pmVersion),t=I(e.pm_max_version,o.pmVersion,o.pmMaxVersionExceededMode??"block"),s=w(e).findings.map(l=>({code:l.code,severity:"warning",constraint:"manifest",required:l.code==="manifest_unknown_key"?l.path:"pm_min_version",current:o.pmVersion,path:l.path,...l.suggested_key?{suggested_key:l.suggested_key}:{},message:l.message})),n=[],a=S(r,o.pmVersion);a!==null&&n.push(a);let c=S(t,o.pmVersion);return c!==null&&n.push(c),{compatible:r.allowed&&t.allowed,findings:[...s,...n],pmVersion:o.pmVersion}}var be=new Set(["capability_undeclared","capability_unused","manifest_capabilities_absent"]);function We(e,o={}){let r=xe(e,{declaredCapabilities:o.declaredCapabilities}),t=o.identity?O(e,o.identity):null,i=o.target?Ce(t??e.manifest??{},o.target):null,a=[...(t!==null&&o.declaredCapabilities===void 0?r.findings.filter(c=>!be.has(c.code)):r.findings).map(c=>({source:"blueprint",severity:c.severity,code:c.code,message:c.message})),...(i?.findings??[]).map(c=>({source:"compatibility",severity:c.severity,code:c.code,message:c.message}))];return{ok:a.every(c=>c.severity!=="error"),capabilities:r.used,blueprint:r,manifest:t,compatibility:i,findings:a}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="a169a68c-13d0-5a3a-b231-abdf1a34ef6a")}catch{}})();function Ye(e){return e}function Xe(e){return e}function Je(e){return e}function Qe(e){return e}function Ze(e){return e}function er(e){return e}function rr(e){return e}function or(e){return e}function tr(e){return e}function nr(e){return e}function ir(e){return e}function sr(e){return e}function ar(e){return e}function cr(e){return{handled:!0,result:e}}function mr(){return{handled:!1}}function dr(e){return e}function fr(e){return e}function lr(e){return e}function pr(e){return e}function ur(e){return e}function gr(e){return e}function hr(e){return e}function vr(e){return e}function _r(e){return e}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="af4da99c-f557-5bf7-a439-c14878e4970d")}catch{}})();export{$ as BUILTIN_PROFILES,Pe as EXTENSION_CAPABILITIES,Se as EXTENSION_CAPABILITY_CONTRACT,Ie as EXTENSION_CAPABILITY_CONTRACT_VERSION,we as EXTENSION_CAPABILITY_LEGACY_ALIASES,V as EXTENSION_CAPABILITY_REGISTRATION_SURFACES,Oe as EXTENSION_POLICY_MODES,Fe as EXTENSION_POLICY_SURFACES,Re as EXTENSION_SANDBOX_PROFILES,Ae as EXTENSION_TRUST_MODES,Me as LIST_FILTER_EXTENSION_FLAG_DEFINITIONS,B as PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS,M as PM_PACKAGE_RESOURCE_KINDS,Y as PROFILE_LINT_CODES,G as PROFILE_LINT_DIMENSIONS,L as PROFILE_NAMES,h as RESERVED_ITEM_FIELD_NAMES,Be as SEARCH_EXTENSION_FLAG_DEFINITIONS,Ce as checkExtensionManifestCompatibility,N as collectPackageExtensionDirectories,z as collectUsedExtensionCapabilities,te as composeExtension,ze as composeExtensionPackage,T as createExtensionContributionInventory,mr as declineServiceOverride,gr as defineAfterCommandHook,pr as defineBeforeCommandHook,ur as defineBeforeMutationHook,Je as defineCommand,nr as defineCommandOverride,lr as defineExporter,He as defineExtension,Ue as defineExtensionBlueprint,Ye as defineExtensionManifest,Qe as defineFlag,fr as defineImporter,er as defineItemField,Ze as defineItemType,rr as defineMigration,_r as defineOnIndexHook,vr as defineOnReadHook,hr as defineOnWriteHook,ir as defineParserOverride,sr as definePreflightOverride,Xe as defineProjectProfile,dr as defineRendererOverride,or as defineSearchProvider,ar as defineServiceOverride,tr as defineVectorStoreAdapter,v as deriveExtensionCapabilities,Ve as describeExtensionBlueprint,U as describeProfileComposition,q as describeProjectProfile,cr as handleServiceOverride,A as inspectExtensionManifestSchema,xe as lintExtensionBlueprint,w as lintExtensionManifestSchema,X as lintProjectProfile,H as listProfiles,qe as mergeExtensionBlueprints,R as normalizeExtensionContributionInventory,j as normalizeProfileName,J as planProfileApplication,We as preflightExtension,D as readPmPackageManifest,W as reconcileExtensionCapabilityUsage,Q as renderExtensionSurfaceMarkdown,K as resolveProfile,O as synthesizeExtensionManifest,Te as toExtensionFlagDefinitions};
1
+ import{a as Pe,b as Oe,c as Fe,d as Ae,e as Re,f as Te,g as Me,h as Be,i as L,j as $,k as j,l as K,m as H,p as U,q,w as G,x as Y,y as X,z as J}from"./focused-chunks/chunk-XUCXRZZZ.js";import{a as M,b as B,c as D,d as N,u as Q}from"./focused-chunks/chunk-T4PZJQG4.js";import"./focused-chunks/chunk-4AORVUT4.js";import"./focused-chunks/chunk-IQBFYQF2.js";import"./focused-chunks/chunk-XB5Q2P7Z.js";import{a as h}from"./focused-chunks/chunk-ZJ3CLTV4.js";import{b as Ie,c as we,ca as x,d as Se,da as C,ea as b,fa as I,fb as R,ga as A,gb as T,ha as w,j as E,k,n as d,wc as V,yc as z,zc as W}from"./focused-chunks/chunk-3CAZ7Z4R.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="c06f3fb3-4b1f-5fdb-a9ce-bce8f88704aa")}catch{}})();function He(e){return e}function Ue(e){return e}function Z(e,o){for(let r of o.commands??[])e.registerCommand(r);for(let[r,t]of Object.entries(o.commandOverrides??{}))e.registerCommand(r,t);for(let[r,t]of Object.entries(o.flags??{}))e.registerFlags(r,t);for(let[r,t]of Object.entries(o.parsers??{}))e.registerParser(r,t);for(let[r,t]of Object.entries(o.renderers??{}))if(typeof t=="function")e.registerRenderer(r,t);else{let{run:i,...s}=t;e.registerRenderer(r,i,s)}for(let[r,t]of Object.entries(o.services??{}))e.registerService(r,t)}function ee(e,o){for(let s of o.preflights??[])e.registerPreflight(s);let r=o.itemTypes??[];r.length>0&&e.registerItemTypes(r);let t=o.itemFields??[];t.length>0&&e.registerItemFields(t);let i=o.relationshipKinds??[];i.length>0&&e.registerRelationshipKinds(i);for(let s of o.migrations??[])e.registerMigration(s);for(let s of o.profiles??[])e.registerProfile(s)}function re(e,o){for(let r of o.searchProviders??[])e.registerSearchProvider(r);for(let r of o.vectorStoreAdapters??[])e.registerVectorStoreAdapter(r);for(let r of o.assuranceProviders??[])e.registerAssuranceMeasurementProvider(r);for(let r of o.importers??[])e.registerImporter(r.name,r.importer,r.options);for(let r of o.exporters??[])e.registerExporter(r.name,r.exporter,r.options)}function oe(e,o){for(let r of o.beforeCommand??[])e.hooks.beforeCommand(r);for(let r of o.beforeMutation??[])e.hooks.beforeMutation(r);for(let r of o.afterCommand??[])e.hooks.afterCommand(r);for(let r of o.onWrite??[])e.hooks.onWrite(r);for(let r of o.onRead??[])e.hooks.onRead(r);for(let r of o.onIndex??[])e.hooks.onIndex(r)}function te(e){let r={activate:async t=>{Z(t,e),ee(t,e),re(t,e),oe(t,e.hooks??{}),await e.activate?.(t)}};return e.manifest&&(r.manifest=e.manifest),e.deactivate&&(r.deactivate=e.deactivate),r}function f(e){let o=e.flatMap(r=>r??[]);return o.length>0?o:void 0}function u(e){let o=Object.assign({},...e.map(r=>r??{}));return Object.keys(o).length>0?o:void 0}function ne(e){let o={};for(let r of e)for(let[t,i]of Object.entries(r??{}))o[t]=[...o[t]??[],...i];return Object.keys(o).length>0?o:void 0}var ie=["beforeCommand","beforeMutation","afterCommand","onWrite","onRead","onIndex"];function se(e,o,r){let t=o.map(s=>s?.[r]),i=f(t);if(i!==void 0){let s=e;s[r]=i}}function ae(e){let o={};for(let r of ie)se(o,e,r);return Object.keys(o).length>0?o:void 0}function qe(...e){let o={},r=(n,a)=>{a!==void 0&&(o[n]=a)};r("commands",f(e.map(n=>n.commands))),r("commandOverrides",u(e.map(n=>n.commandOverrides))),r("flags",ne(e.map(n=>n.flags))),r("parsers",u(e.map(n=>n.parsers))),r("renderers",u(e.map(n=>n.renderers))),r("services",u(e.map(n=>n.services))),r("preflights",f(e.map(n=>n.preflights))),r("itemTypes",f(e.map(n=>n.itemTypes))),r("itemFields",f(e.map(n=>n.itemFields))),r("relationshipKinds",f(e.map(n=>n.relationshipKinds))),r("migrations",f(e.map(n=>n.migrations))),r("profiles",f(e.map(n=>n.profiles))),r("searchProviders",f(e.map(n=>n.searchProviders))),r("vectorStoreAdapters",f(e.map(n=>n.vectorStoreAdapters))),r("assuranceProviders",f(e.map(n=>n.assuranceProviders))),r("importers",f(e.map(n=>n.importers))),r("exporters",f(e.map(n=>n.exporters))),r("hooks",ae(e.map(n=>n.hooks)));let t;for(let n of e)n.manifest&&(t=n.manifest);r("manifest",t);let i=e.some(n=>n.activate);r("activate",i?async n=>{for(let a of e)a.activate&&await a.activate(n)}:void 0);let s=e.some(n=>n.deactivate);return r("deactivate",s?async()=>{let n=[];for(let a of[...e].reverse())if(a.deactivate)try{await a.deactivate()}catch(c){n.push(c)}if(n.length>0)throw n.length>1?new AggregateError(n,"Multiple extension blueprint deactivate hooks failed."):n[0]}:void 0),o}var ce=[["commands","commands"],["commandOverrides","commands"],["flags","schema"],["itemTypes","schema"],["itemFields","schema"],["relationshipKinds","schema"],["migrations","schema"],["profiles","schema"],["parsers","parser"],["renderers","renderers"],["services","services"],["preflights","preflight"],["searchProviders","search"],["vectorStoreAdapters","search"],["assuranceProviders","services"],["importers","importers"],["exporters","importers"]];function g(e){return e?Array.isArray(e)?e.length>0:Object.keys(e).length>0:!1}function v(e){let o=new Set;for(let[i,s]of ce)g(e[i])&&o.add(s);(e.commands??[]).filter(p).some(i=>i.flags!==void 0)&&o.add("schema");let r=[...e.importers??[],...e.exporters??[]].filter(p);r.some(i=>i?.options?.flags!==void 0)&&o.add("schema"),r.some(i=>typeof i=="object")&&o.add("commands");let t=e.hooks??{};return[t.beforeCommand,t.beforeMutation,t.afterCommand,t.onWrite,t.onRead,t.onIndex].some(g)&&o.add("hooks"),[...o].sort((i,s)=>i.localeCompare(s))}var me=[["beforeCommand","before_command"],["beforeMutation","before_mutation"],["afterCommand","after_command"],["onWrite","on_write"],["onRead","on_read"],["onIndex","on_index"]];function m(e){return[...new Set(e)].sort((o,r)=>o.localeCompare(r))}function p(e){return e!=null}function _(e){return d(`${e.name} import`)}function y(e){return d(`${e.name} export`)}function de(e,o,r){return[...e.map(t=>d(t.name)),...o.filter(t=>t.options!==void 0).map(_),...r.filter(t=>t.options!==void 0).map(y)]}function fe(e,o,r,t){return[...Object.keys(e.flags??{}).map(i=>d(i)),...o.filter(i=>i.flags!==void 0).map(i=>d(i.name)),...r.filter(i=>i.options?.flags!==void 0).map(_),...t.filter(i=>i.options?.flags!==void 0).map(y)]}function le(e){return me.filter(([o])=>(e[o]?.length??0)>0).map(([,o])=>o)}function pe(e){let o=Object.entries(e??{}).filter(([,r])=>typeof r!="function"&&((r.commands?.length??0)>0||r.resultDiscriminator!==void 0)).map(([r,t])=>{let i=t;return{format:r,commands:m((i.commands??[]).map(s=>d(s))),result_discriminator:i.resultDiscriminator!==void 0}}).sort((r,t)=>r.format.localeCompare(t.format));return o.length>0?{renderer_ownership:o}:{}}function ue(e){return!e||e.length===0?{}:{assurance_providers:m(e.map(o=>o.id))}}function ge(e,o,r){return{item_types:m((e.itemTypes??[]).map(t=>t.name)),item_fields:m((e.itemFields??[]).map(t=>t.name)),...(e.relationshipKinds?.length??0)>0?{relationship_kinds:m(e.relationshipKinds.map(t=>t.kind))}:{},migrations:m((e.migrations??[]).flatMap(t=>typeof t.id=="string"?[t.id]:[])),profiles:m((e.profiles??[]).map(t=>t.name)),importers:m(o.map(t=>d(t.name))),exporters:m(r.map(t=>d(t.name))),search_providers:m((e.searchProviders??[]).map(t=>t.name)),vector_store_adapters:m((e.vectorStoreAdapters??[]).map(t=>t.name)),...ue(e.assuranceProviders),parser_overrides:m(Object.keys(e.parsers??{}).map(t=>d(t))),service_overrides:m(Object.keys(e.services??{}).map(t=>String(t).trim().toLowerCase())),renderer_overrides:m(Object.keys(e.renderers??{}).map(t=>String(t).trim().toLowerCase())),...pe(e.renderers),preflight_overrides:(e.preflights??[]).length,preflight_ownership:(e.preflights??[]).map(t=>({commands:[...t.commands??[]]}))}}function Ve(e){let o=(e.commands??[]).filter(p),r=(e.importers??[]).filter(p),t=(e.exporters??[]).filter(p),i=r.map(_),s=t.map(y),n=de(o,r,t),a=fe(e,o,r,t),c=e.hooks??{},l=ge(e,r,t);return{capabilities:v(e),commands:m(n),command_overrides:m(Object.keys(e.commandOverrides??{}).map(F=>d(F))),command_handlers:m([...n,...i,...s]),hooks:le(c),flag_commands:m(a),...l}}var he=["commands","commandOverrides","flags","parsers","renderers","services","preflights","itemTypes","itemFields","relationshipKinds","migrations","profiles","searchProviders","vectorStoreAdapters","assuranceProviders","importers","exporters"];function ve(e){return(e.itemFields??[]).filter(o=>typeof o?.name=="string"&&h.has(o.name.trim())).map(o=>({code:"reserved_item_field",severity:"error",message:`Item field "${o.name}" collides with reserved item metadata; rename it with an extension-specific prefix before publishing.`,field:o.name}))}function _e(e){return[...Object.values(e.flags??{}).flat(),...(e.commands??[]).flatMap(r=>r.flags??[]),...(e.importers??[]).flatMap(r=>r.options?.flags??[]),...(e.exporters??[]).flatMap(r=>r.options?.flags??[])].flatMap(r=>{if(typeof r?.long!="string"&&typeof r?.short!="string")return[];let t=x(r.long,r.short);if(t===null)return[];let{token:i,failure:s}=t;return[{code:s,severity:"error",message:`Flag "${i}" ${C(i,s)}.`,field:i}]})}function P(e){let o=new Set;for(let r of e){let t=k(r)??E(r);t!==null&&o.add(t)}return[...o].sort((r,t)=>r.localeCompare(t))}function ye(e,o){let r=[];if(o===null)return e.length>0&&r.push({code:"manifest_capabilities_absent",severity:"warning",message:`Blueprint exercises ${e.length===1?"capability":"capabilities"} [${e.join(", ")}] but declares none; set capabilities to deriveExtensionCapabilities(blueprint) so the manifest grant matches.`}),r;let t=new Set(o),i=new Set(e);for(let s of e)t.has(s)||r.push({code:"capability_undeclared",severity:"error",message:`Blueprint exercises capability "${s}" but it is absent from the declared capabilities; activation throws extension_capability_missing \u2014 add "${s}" to the manifest capabilities.`,capability:s});for(let s of o)i.has(s)||r.push({code:"capability_unused",severity:"warning",message:`Capability "${s}" is declared but no blueprint surface exercises it; drop it to keep the manifest least-privilege (pm package doctor reports this as extension_capability_unused).`,capability:s});return r}function Ee(e){let o=[],r=new Map;for(let i of e.commands??[]){let s=d(i.name);r.set(s,(r.get(s)??0)+1)}for(let[i,s]of r)s>1&&o.push({code:"duplicate_command",severity:"warning",message:`Command "${i}" is declared ${s} times in commands; the later registration shadows the earlier one at dispatch.`,command:i});let t=new Set(Object.keys(e.commandOverrides??{}).map(i=>d(i)));for(let i of r.keys())t.has(i)&&o.push({code:"command_override_conflict",severity:"warning",message:`Command "${i}" is declared both as a new command definition and as a command override; register one or the other.`,command:i});return o}function ke(e){let o=[];for(let r of he)r in e&&!g(e[r])&&o.push({code:"empty_surface",severity:"warning",message:`Blueprint field "${r}" is present but empty; remove it or populate it.`,field:r});if("hooks"in e){let r=e.hooks??{};[r.beforeCommand,r.beforeMutation,r.afterCommand,r.onWrite,r.onRead,r.onIndex].some(g)||o.push({code:"empty_surface",severity:"warning",message:'Blueprint field "hooks" is present but registers no lifecycle hooks; remove it or populate it.',field:"hooks"})}return o}function xe(e,o={}){let r=v(e),t=o.declaredCapabilities??e.manifest?.capabilities,i=Array.isArray(t)?P(t):null,s=[...ye(r,i),...Ee(e),..._e(e),...ve(e),...ke(e)];return{ok:s.every(n=>n.severity!=="error"),findings:s,used:r,declared:i}}function O(e,o){let{additionalCapabilities:r,...t}=o,i=Array.isArray(r)?P(r):[],s=[...new Set([...v(e),...i])].sort((n,a)=>n.localeCompare(a));return{...t,capabilities:s}}function ze(e,o){let r=O(e,o);return{module:te({...e,manifest:r}),manifest:r}}function S(e,o){if(e.status==="absent"||e.status==="ok")return null;let r=`${e.kind}_${e.status}`,t="";switch(r){case"pm_min_version_invalid":t=`pm_min_version "${e.required}" is not a valid version; the extension is treated as incompatible and the loader skips it.`;break;case"pm_min_version_unchecked":t=`pm_min_version "${e.required}" could not be compared against pm ${o}; compatibility is unverified.`;break;case"pm_min_version_unmet":t=`Requires pm >= ${e.required} but the target is pm ${o}; the loader skips the extension.`;break;case"pm_max_version_invalid":t=`pm_max_version "${e.required}" is not a valid inclusive upper bound (version ranges are not allowed); the extension is treated as incompatible and the loader skips it.`;break;case"pm_max_version_unchecked":t=`pm_max_version "${e.required}" could not be compared against pm ${o}; compatibility is unverified.`;break;case"pm_max_version_exceeded":t=`Allows pm <= ${e.required} but the target is pm ${o}; the loader skips the extension.`;break;case"pm_max_version_exceeded_warn":t=`Target pm ${o} is newer than pm_max_version ${e.required}, but the "warn" exceeded mode lets it load with a warning.`;break}return{code:r,severity:e.allowed?"warning":"error",constraint:e.kind,required:e.required,current:o,message:t}}function Ce(e,o){let r=b(e.pm_min_version,o.pmVersion),t=I(e.pm_max_version,o.pmVersion,o.pmMaxVersionExceededMode??"block"),s=w(e).findings.map(l=>({code:l.code,severity:"warning",constraint:"manifest",required:l.code==="manifest_unknown_key"?l.path:"pm_min_version",current:o.pmVersion,path:l.path,...l.suggested_key?{suggested_key:l.suggested_key}:{},message:l.message})),n=[],a=S(r,o.pmVersion);a!==null&&n.push(a);let c=S(t,o.pmVersion);return c!==null&&n.push(c),{compatible:r.allowed&&t.allowed,findings:[...s,...n],pmVersion:o.pmVersion}}var be=new Set(["capability_undeclared","capability_unused","manifest_capabilities_absent"]);function We(e,o={}){let r=xe(e,{declaredCapabilities:o.declaredCapabilities}),t=o.identity?O(e,o.identity):null,i=o.target?Ce(t??e.manifest??{},o.target):null,a=[...(t!==null&&o.declaredCapabilities===void 0?r.findings.filter(c=>!be.has(c.code)):r.findings).map(c=>({source:"blueprint",severity:c.severity,code:c.code,message:c.message})),...(i?.findings??[]).map(c=>({source:"compatibility",severity:c.severity,code:c.code,message:c.message}))];return{ok:a.every(c=>c.severity!=="error"),capabilities:r.used,blueprint:r,manifest:t,compatibility:i,findings:a}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="a169a68c-13d0-5a3a-b231-abdf1a34ef6a")}catch{}})();function Ye(e){return e}function Xe(e){return e}function Je(e){return e}function Qe(e){return e}function Ze(e){return e}function er(e){return e}function rr(e){return e}function or(e){return e}function tr(e){return e}function nr(e){return e}function ir(e){return e}function sr(e){return e}function ar(e){return e}function cr(e){return{handled:!0,result:e}}function mr(){return{handled:!1}}function dr(e){return e}function fr(e){return e}function lr(e){return e}function pr(e){return e}function ur(e){return e}function gr(e){return e}function hr(e){return e}function vr(e){return e}function _r(e){return e}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="af4da99c-f557-5bf7-a439-c14878e4970d")}catch{}})();export{$ as BUILTIN_PROFILES,Pe as EXTENSION_CAPABILITIES,Se as EXTENSION_CAPABILITY_CONTRACT,Ie as EXTENSION_CAPABILITY_CONTRACT_VERSION,we as EXTENSION_CAPABILITY_LEGACY_ALIASES,V as EXTENSION_CAPABILITY_REGISTRATION_SURFACES,Oe as EXTENSION_POLICY_MODES,Fe as EXTENSION_POLICY_SURFACES,Re as EXTENSION_SANDBOX_PROFILES,Ae as EXTENSION_TRUST_MODES,Me as LIST_FILTER_EXTENSION_FLAG_DEFINITIONS,B as PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS,M as PM_PACKAGE_RESOURCE_KINDS,Y as PROFILE_LINT_CODES,G as PROFILE_LINT_DIMENSIONS,L as PROFILE_NAMES,h as RESERVED_ITEM_FIELD_NAMES,Be as SEARCH_EXTENSION_FLAG_DEFINITIONS,Ce as checkExtensionManifestCompatibility,N as collectPackageExtensionDirectories,z as collectUsedExtensionCapabilities,te as composeExtension,ze as composeExtensionPackage,T as createExtensionContributionInventory,mr as declineServiceOverride,gr as defineAfterCommandHook,pr as defineBeforeCommandHook,ur as defineBeforeMutationHook,Je as defineCommand,nr as defineCommandOverride,lr as defineExporter,He as defineExtension,Ue as defineExtensionBlueprint,Ye as defineExtensionManifest,Qe as defineFlag,fr as defineImporter,er as defineItemField,Ze as defineItemType,rr as defineMigration,_r as defineOnIndexHook,vr as defineOnReadHook,hr as defineOnWriteHook,ir as defineParserOverride,sr as definePreflightOverride,Xe as defineProjectProfile,dr as defineRendererOverride,or as defineSearchProvider,ar as defineServiceOverride,tr as defineVectorStoreAdapter,v as deriveExtensionCapabilities,Ve as describeExtensionBlueprint,U as describeProfileComposition,q as describeProjectProfile,cr as handleServiceOverride,A as inspectExtensionManifestSchema,xe as lintExtensionBlueprint,w as lintExtensionManifestSchema,X as lintProjectProfile,H as listProfiles,qe as mergeExtensionBlueprints,R as normalizeExtensionContributionInventory,j as normalizeProfileName,J as planProfileApplication,We as preflightExtension,D as readPmPackageManifest,W as reconcileExtensionCapabilityUsage,Q as renderExtensionSurfaceMarkdown,K as resolveProfile,O as synthesizeExtensionManifest,Te as toExtensionFlagDefinitions};
2
2
  //# sourceMappingURL=sdk-authoring.js.map