@unbrained/pm-cli 2026.11.3 → 2026.11.4

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 (203) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +10 -0
  3. package/dist/cli/error-guidance.d.ts +14 -35
  4. package/dist/cli/error-guidance.js +2 -2
  5. package/dist/cli/expected-revisions.d.ts +55 -0
  6. package/dist/cli/expected-revisions.js +2 -0
  7. package/dist/cli/main.js +2 -2
  8. package/dist/cli/runtime/invocation-options.js +1 -1
  9. package/dist/cli-bundle/bundle-manifest.json +1 -1
  10. package/dist/cli-bundle/chunks/{chunk-UYNMKUGA.js → chunk-2GW662DP.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-32BCU6HN.js → chunk-3OXQGGRD.js} +46 -46
  12. package/dist/cli-bundle/chunks/chunk-5BVZ32G7.js +2 -0
  13. package/dist/cli-bundle/chunks/chunk-5S6RT5LX.js +9 -0
  14. package/dist/cli-bundle/chunks/chunk-5Z6LWFDL.js +31 -0
  15. package/dist/cli-bundle/chunks/{chunk-MQJXZX3Q.js → chunk-6T2V3UIK.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-5JZMF4M5.js → chunk-7PGNAHNW.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-7RCI7AAA.js +20 -0
  18. package/dist/cli-bundle/chunks/chunk-AQ5UHHQS.js +2 -0
  19. package/dist/cli-bundle/chunks/chunk-BK2XAQVC.js +2 -0
  20. package/dist/cli-bundle/chunks/{chunk-TZ3D3DPQ.js → chunk-BRIPGUAO.js} +2 -2
  21. package/dist/cli-bundle/chunks/chunk-BWAXA6S4.js +6 -0
  22. package/dist/cli-bundle/chunks/{chunk-5IPXDZKU.js → chunk-CERNIZLB.js} +66 -66
  23. package/dist/cli-bundle/chunks/chunk-DSCFJTHB.js +122 -0
  24. package/dist/cli-bundle/chunks/{chunk-JPKIUWLG.js → chunk-L4BKTPJ6.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-Y7H55PCY.js → chunk-NPEDFOVQ.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-2CBHQXYJ.js → chunk-ODMJ3HIB.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-DEJHTFEF.js → chunk-QN7VCOUU.js} +2 -2
  28. package/dist/cli-bundle/chunks/chunk-QQHMNUZT.js +2 -0
  29. package/dist/cli-bundle/chunks/chunk-SRDO2NJU.js +2 -0
  30. package/dist/cli-bundle/chunks/chunk-T56MB6SF.js +2 -0
  31. package/dist/cli-bundle/chunks/chunk-TX2W6G37.js +3 -0
  32. package/dist/cli-bundle/chunks/item-revision-UAZOBP2Q.js +2 -0
  33. package/dist/cli-bundle/chunks/item-transaction-N5F4LXYV.js +2 -0
  34. package/dist/cli-bundle/chunks/mutation-admission-QZQI2NN5.js +2 -0
  35. package/dist/cli-bundle/chunks/{register-list-query-I6AZA3IX.js → register-list-query-P3NOKQUA.js} +2 -2
  36. package/dist/cli-bundle/chunks/{register-mutation-3DAXCLXR.js → register-mutation-A6I5K5N6.js} +2 -2
  37. package/dist/cli-bundle/chunks/register-operations-SPKB3TNM.js +2 -0
  38. package/dist/cli-bundle/chunks/register-setup-ZZRHJ4IS.js +2 -0
  39. package/dist/cli-bundle/chunks/{stage-7H36OTDJ.js → stage-L3T725DS.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/chunk-5NGNO54M.js +44 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-ZQRCVRGS.js → chunk-A2246ZM7.js} +54 -54
  42. package/dist/cli-bundle/focused-chunks/chunk-B6U44WPW.js +2 -0
  43. package/dist/cli-bundle/focused-chunks/chunk-BAW3DGQO.js +91 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-BHNY3KPJ.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/chunk-C3O6JJPO.js +2 -0
  46. package/dist/cli-bundle/focused-chunks/{chunk-LKN2WGGB.js → chunk-C7UX2ZI3.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/{chunk-YVLAP3BL.js → chunk-CBG67HUP.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/{chunk-TYHDZUL4.js → chunk-CO2DNPH7.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-CXTDEQ3N.js +8 -0
  50. package/dist/cli-bundle/focused-chunks/chunk-FEPE2CE4.js +2 -0
  51. package/dist/cli-bundle/focused-chunks/{chunk-RY4QEMAE.js → chunk-FFO7RBLN.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{chunk-I5FODKYB.js → chunk-FXFDVM5O.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/chunk-I5LGPUWH.js +2 -0
  54. package/dist/cli-bundle/focused-chunks/chunk-J3YOATXR.js +80 -0
  55. package/dist/cli-bundle/focused-chunks/{chunk-HOXIIZEO.js → chunk-J6FDCAMH.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/chunk-J7M52SCZ.js +2 -0
  57. package/dist/cli-bundle/focused-chunks/chunk-JQS7TYQ6.js +12 -0
  58. package/dist/cli-bundle/focused-chunks/chunk-MEJKELWC.js +26 -0
  59. package/dist/cli-bundle/focused-chunks/chunk-PMKR4MJI.js +2 -0
  60. package/dist/cli-bundle/focused-chunks/chunk-PNPYQDHU.js +2 -0
  61. package/dist/cli-bundle/focused-chunks/chunk-Q4OIRSKL.js +2 -0
  62. package/dist/cli-bundle/focused-chunks/{chunk-F3X6UWMI.js → chunk-QEVJ3Y67.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{chunk-HJ27QLZV.js → chunk-SDLIUZEL.js} +2 -2
  64. package/dist/cli-bundle/focused-chunks/chunk-TFYTTDAK.js +2 -0
  65. package/dist/cli-bundle/focused-chunks/chunk-W3CSX6GI.js +3 -0
  66. package/dist/cli-bundle/focused-chunks/{chunk-D4XQOMG4.js → chunk-Y5GOUUYJ.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/item-revision-L6GVT42D.js +2 -0
  68. package/dist/cli-bundle/focused-chunks/item-transaction-GYGP264N.js +2 -0
  69. package/dist/cli-bundle/focused-chunks/mutation-admission-UWTH56OD.js +2 -0
  70. package/dist/cli-bundle/focused-chunks/{stage-4SQHVI3O.js → stage-WRSNJ7VI.js} +2 -2
  71. package/dist/cli-bundle/main.js +25 -25
  72. package/dist/cli-bundle/sdk-authoring.js +1 -1
  73. package/dist/cli-bundle/sdk-contracts.js +5 -5
  74. package/dist/cli-bundle/sdk-core.js +1 -1
  75. package/dist/cli-bundle/sdk-governance.js +1 -1
  76. package/dist/cli-bundle/sdk-graph.js +1 -1
  77. package/dist/cli-bundle/sdk-merge.js +57 -57
  78. package/dist/cli-bundle/sdk-query.js +1 -1
  79. package/dist/cli-bundle/sdk-runtime.js +1 -1
  80. package/dist/cli-bundle/sdk-testing.js +1 -1
  81. package/dist/cli-bundle/sdk.js +11 -11
  82. package/dist/core/config/positional-value.d.ts +1 -1
  83. package/dist/core/config/positional-value.js +1 -1
  84. package/dist/core/extensions/reserved-host-flags.js +1 -1
  85. package/dist/core/history/history-rewrite.js +1 -1
  86. package/dist/core/shared/command-types.d.ts +7 -0
  87. package/dist/core/store/item-mutation-precondition.d.ts +70 -6
  88. package/dist/core/store/item-mutation-precondition.js +1 -1
  89. package/dist/core/store/item-store.js +1 -1
  90. package/dist/core/store/settings-validator.js +1 -1
  91. package/dist/core/store/settings.js +1 -1
  92. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -1
  93. package/dist/sdk/cli-contracts/completeness.js +1 -1
  94. package/dist/sdk/cli-contracts/enum-contracts.d.ts +11 -0
  95. package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
  96. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  97. package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
  98. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  99. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  100. package/dist/sdk/cli-program.js +1 -1
  101. package/dist/sdk/config.d.ts +1 -1
  102. package/dist/sdk/config.js +1 -1
  103. package/dist/sdk/environment/project-runtime-compatibility.js +1 -1
  104. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  105. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  106. package/dist/sdk/governance/validate.js +1 -1
  107. package/dist/sdk/history/salvage.js +3 -3
  108. package/dist/sdk/history-compact.d.ts +7 -1
  109. package/dist/sdk/history-compact.js +1 -1
  110. package/dist/sdk/history-repair.d.ts +2 -1
  111. package/dist/sdk/history-repair.js +1 -1
  112. package/dist/sdk/index.d.ts +3 -0
  113. package/dist/sdk/index.js +1 -1
  114. package/dist/sdk/lifecycle/checkpoint-rollback.d.ts +10 -2
  115. package/dist/sdk/lifecycle/checkpoint-rollback.js +1 -1
  116. package/dist/sdk/lifecycle/claim.js +1 -1
  117. package/dist/sdk/lifecycle/close-many.d.ts +11 -2
  118. package/dist/sdk/lifecycle/close-many.js +1 -1
  119. package/dist/sdk/lifecycle/close.d.ts +15 -0
  120. package/dist/sdk/lifecycle/close.js +1 -1
  121. package/dist/sdk/lifecycle/item-revision.d.ts +162 -0
  122. package/dist/sdk/lifecycle/item-revision.js +2 -0
  123. package/dist/sdk/lifecycle/restore.js +1 -1
  124. package/dist/sdk/lifecycle/start-blockers.d.ts +52 -0
  125. package/dist/sdk/lifecycle/start-blockers.js +2 -0
  126. package/dist/sdk/lifecycle/task-composition.d.ts +11 -0
  127. package/dist/sdk/lifecycle/task-composition.js +1 -1
  128. package/dist/sdk/lifecycle/update-many.d.ts +11 -2
  129. package/dist/sdk/lifecycle/update-many.js +1 -1
  130. package/dist/sdk/lifecycle/update.js +2 -2
  131. package/dist/sdk/public-surface.json +1 -1
  132. package/dist/sdk/query/declared-blockers.d.ts +16 -0
  133. package/dist/sdk/query/declared-blockers.js +2 -0
  134. package/dist/sdk/query/get.d.ts +7 -0
  135. package/dist/sdk/query/get.js +1 -1
  136. package/dist/sdk/query/projection-contracts.js +1 -1
  137. package/dist/sdk/runtime-input.d.ts +12 -0
  138. package/dist/sdk/runtime-input.js +1 -1
  139. package/dist/sdk/runtime.d.ts +10 -0
  140. package/dist/sdk/runtime.js +1 -1
  141. package/dist/sdk/structured-mutations.js +1 -1
  142. package/dist/sdk/test/batch.js +2 -2
  143. package/dist/sdk/test/execution.js +2 -2
  144. package/dist/sdk/test/linked-command-detection.js +1 -1
  145. package/dist/sdk/workspace-transaction.d.ts +17 -6
  146. package/dist/sdk/workspace-transaction.js +1 -1
  147. package/dist/types.d.ts +6 -0
  148. package/dist/types.js +1 -1
  149. package/docs/COMMANDS.md +91 -0
  150. package/docs/CONFIGURATION.md +1 -0
  151. package/docs/SDK.md +110 -1
  152. package/docs/agent-task-token-baseline.json +1 -1
  153. package/docs/generated/FLAG_LEXICON_BUDGETS.md +111 -111
  154. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +12 -3
  155. package/marketplace.json +1 -1
  156. package/package.json +1 -1
  157. package/packages/pm-beads/package.json +1 -1
  158. package/packages/pm-calendar/package.json +1 -1
  159. package/packages/pm-command-kit/package.json +1 -1
  160. package/packages/pm-digital-twin/package.json +1 -1
  161. package/packages/pm-governance-audit/package.json +1 -1
  162. package/packages/pm-guide-shell/package.json +1 -1
  163. package/packages/pm-kanban/package.json +1 -1
  164. package/packages/pm-lifecycle-hooks/package.json +1 -1
  165. package/packages/pm-linked-test-adapters/package.json +1 -1
  166. package/packages/pm-search-advanced/package.json +1 -1
  167. package/packages/pm-templates/package.json +1 -1
  168. package/packages/pm-todos/package.json +1 -1
  169. package/packages/pm-vcs/package.json +1 -1
  170. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  171. package/plugins/pm-claude/package.json +1 -1
  172. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  173. package/plugins/pm-codex/package.json +1 -1
  174. package/plugins/pm-codex/plugin.json +1 -1
  175. package/runtime-dependencies.json +1 -1
  176. package/dist/cli-bundle/chunks/chunk-7ZEFHFAU.js +0 -2
  177. package/dist/cli-bundle/chunks/chunk-B6UTLYLM.js +0 -3
  178. package/dist/cli-bundle/chunks/chunk-HBKD5HZB.js +0 -2
  179. package/dist/cli-bundle/chunks/chunk-L6LCLC37.js +0 -2
  180. package/dist/cli-bundle/chunks/chunk-NR4KABHC.js +0 -31
  181. package/dist/cli-bundle/chunks/chunk-PWD5RY2D.js +0 -2
  182. package/dist/cli-bundle/chunks/chunk-XRMYA4R7.js +0 -20
  183. package/dist/cli-bundle/chunks/chunk-YWS4XV4I.js +0 -6
  184. package/dist/cli-bundle/chunks/chunk-ZOAJNPBL.js +0 -129
  185. package/dist/cli-bundle/chunks/item-transaction-ZHLJTBD7.js +0 -2
  186. package/dist/cli-bundle/chunks/mutation-admission-ZQMRMGIB.js +0 -2
  187. package/dist/cli-bundle/chunks/register-operations-G3QGGQ5Z.js +0 -2
  188. package/dist/cli-bundle/chunks/register-setup-LDXHMNOT.js +0 -2
  189. package/dist/cli-bundle/focused-chunks/chunk-3XGKBVJ3.js +0 -2
  190. package/dist/cli-bundle/focused-chunks/chunk-4HY6EGPB.js +0 -2
  191. package/dist/cli-bundle/focused-chunks/chunk-AK2CI2GI.js +0 -2
  192. package/dist/cli-bundle/focused-chunks/chunk-HUXZCPWT.js +0 -26
  193. package/dist/cli-bundle/focused-chunks/chunk-IKXJ57XA.js +0 -8
  194. package/dist/cli-bundle/focused-chunks/chunk-MOY6KZGJ.js +0 -44
  195. package/dist/cli-bundle/focused-chunks/chunk-PWUTFKSI.js +0 -2
  196. package/dist/cli-bundle/focused-chunks/chunk-PZRB7IXH.js +0 -91
  197. package/dist/cli-bundle/focused-chunks/chunk-WSYPVBKS.js +0 -80
  198. package/dist/cli-bundle/focused-chunks/chunk-WXLG7HZ5.js +0 -3
  199. package/dist/cli-bundle/focused-chunks/chunk-WZDFCVLX.js +0 -12
  200. package/dist/cli-bundle/focused-chunks/chunk-YGO3FWA2.js +0 -2
  201. package/dist/cli-bundle/focused-chunks/chunk-ZYXQACPB.js +0 -2
  202. package/dist/cli-bundle/focused-chunks/item-transaction-PZ2FQ6B2.js +0 -2
  203. package/dist/cli-bundle/focused-chunks/mutation-admission-XOOK6XFH.js +0 -2
@@ -1,2 +0,0 @@
1
- import{i as a,j as b,k as c,l as d,m as e,n as f,o as g,p as h,q as i,r as j}from"./chunk-7ZEFHFAU.js";import"./chunk-5IPXDZKU.js";import"./chunk-B6UTLYLM.js";import"./chunk-YWS4XV4I.js";import"./chunk-NR4KABHC.js";import"./chunk-PWD5RY2D.js";import"./chunk-MQJXZX3Q.js";import"./chunk-XRMYA4R7.js";import"./chunk-L6LCLC37.js";import"./chunk-ZOAJNPBL.js";import"./chunk-SPPHDVZE.js";import"./chunk-UJMQP2HP.js";import"./chunk-2CBHQXYJ.js";import"./chunk-IB7UB5TE.js";import"./chunk-32BCU6HN.js";import"./chunk-RSAN2YUU.js";import"./chunk-VS565KBX.js";import"./chunk-O4ZLEN4T.js";import"./chunk-XAWE4EAK.js";export{h as _testOnlyItemTransaction,j as abandonItemTransaction,f as buildItemCompletionMutations,g as commitItemCompletion,e as commitItemMutations,b as listUpsertKeyCandidates,c as loadGuardedRuntimeSchema,d as previewItemMutations,i as readItemTransaction,a as resolveTransactionSchema};
2
- //# sourceMappingURL=item-transaction-ZHLJTBD7.js.map
@@ -1,2 +0,0 @@
1
- import{f as E,k as N}from"./chunk-PWD5RY2D.js";import{Fe as y,Le as C,nf as R,qf as A}from"./chunk-ZOAJNPBL.js";import{Ma as g,Qb as _,Ti as O,Xd as h,Yd as w,ce as T}from"./chunk-32BCU6HN.js";import{C as f}from"./chunk-O4ZLEN4T.js";import"./chunk-XAWE4EAK.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="d19ff816-7570-5e8a-a4de-ad2ca48f0df0")}catch{}})();function b(t,o,r,a=!1){let d=[...r].map(n=>({candidate:n,distance:_(o,n,3)})).filter(n=>n.distance!==null).sort((n,i)=>n.distance-i.distance||n.candidate.localeCompare(i.candidate))[0]?.candidate,s=a?`Put mutation fields under options (options.${o}).`:d?`Did you mean "${d}"?`:"Use the declared command options or the field option for registered item fields.";throw new f(`Unknown ${t} ${a?"argument":"option"} "${o}". ${s} No changes were made.`,2,{code:"invalid_argument_value",reason:"unknown_mutation_option",changed:!1,field:o,required:s,nextSteps:[s]})}async function j(t,o,r,a,d){if(E(o))return;let s=t==="create"?R:A,n=(t==="create"?y:C).map(({flag:e})=>e.slice(2).replace(/-([a-z])/gu,(m,v)=>v.toUpperCase())),i=new Set([...s.flatMap(e=>[e.target,...e.keys]),...n]),l=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];for(let e of["author","message","force","fullChangedFields","idOnly",...l])i.add(e);let S=new Set(["action","options","path","cwd","author","force","noExtensions","no_extensions","fullChangedFields","idOnly",...l,...d,...t==="update"?["id"]:[]]);for(let e of Object.keys(o))S.has(e)||b(t,e,i,i.has(e));let u=o.options;if(u!==void 0&&!N(u))throw new f("Mutation options must be an object. No changes were made.",2,{code:"invalid_argument_value",changed:!1});let c=[...new Set([...Object.keys(u??{}),...Object.keys(r)])].filter(e=>!i.has(e));if(c.length===0)return;let p=h((await O(g(process.cwd(),a))).schema).command_to_fields.get(t)??[];for(let e of p)i.add(w(e));for(let e of c)p.some(m=>T({[e]:!0},m)===!0)||b(t,e,i)}export{j as assertNativeMutationOptions};
2
- //# sourceMappingURL=mutation-admission-ZQMRMGIB.js.map
@@ -1,2 +0,0 @@
1
- import{a as se}from"./chunk-TZ3D3DPQ.js";import"./chunk-DEZPZOQ7.js";import{Ad as re,Bd as C,Ec as U,Fc as $,Gc as H,Hc as W,Hd as ie,Ic as j,Jb as N,Jc as G,Kc as B,Mc as I,Nc as z,Oc as Y,Pb as q,Pc as K,Qc as X,Rc as Q,Sb as J,Tc as Z,Uc as ee,Xa as F,ga as M,nd as te,qd as ae,rb as V,sd as ne,zd as oe}from"./chunk-NR4KABHC.js";import"./chunk-PWD5RY2D.js";import"./chunk-MQJXZX3Q.js";import"./chunk-XRMYA4R7.js";import"./chunk-L6LCLC37.js";import{Kg as y,N as x,jg as O,kg as P,lg as L,pg as c,sg as f,tg as i,ug as g}from"./chunk-ZOAJNPBL.js";import"./chunk-SPPHDVZE.js";import"./chunk-UJMQP2HP.js";import"./chunk-2CBHQXYJ.js";import"./chunk-IB7UB5TE.js";import{Ma as v,Rh as s,Sh as d,Ti as _,of as R,sd as A,y as T,z as E}from"./chunk-32BCU6HN.js";import"./chunk-RSAN2YUU.js";import"./chunk-VS565KBX.js";import{A as u,C as p}from"./chunk-O4ZLEN4T.js";import"./chunk-XAWE4EAK.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]="c3d9f24a-7089-5d60-ab12-93d03b86da80")}catch{}})();var le=new Map([["measurements","boolean"],["metric","string"],["measurementLimit","number"],["observe","string_array"],["direction","direction"],["measurementSource","string"],["measurementItem","string"],["measurementRevision","string"],["author","string"],["message","string"],["provenanceCoverage","boolean"],["fleetAttribution","boolean"],["since","string"],["eventLimit","number"],["minimumSample","number"]]),ke=new Set(["higher","lower","target"]),ve=[...le.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function xe(e,t){return e==="boolean"?typeof t=="boolean":e==="string"?typeof t=="string":e==="number"?typeof t=="number":e==="string_array"?Array.isArray(t)&&t.every(a=>typeof a=="string"):e==="direction"&&ke.has(t)}function ce(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(a){throw new p(`--analytics must be valid JSON: ${String(a)}`,u.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new p("--analytics must be a JSON object.",u.USAGE);for(let[a,n]of Object.entries(t)){let o=le.get(a);if(!xe(o,n))throw new p(o===void 0?`Unknown --analytics field "${a}". Accepted fields: ${ve}.`:`--analytics field "${a}" must be ${o.replace("_"," ")}.`,u.USAGE)}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]="dcd8c925-34ee-5faa-9132-1be43961c749")}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]="29db968f-30ad-5f3c-bf95-e33be18614c6")}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]="524ade8e-33d6-5353-b01d-c7baddc956e8")}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]="02e10fe1-c111-5c09-8dbe-a67f2b97f0d0")}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]="3d4a8db3-8a53-50b4-a96c-1affff2207a3")}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]="d008ca8f-41bf-54fb-9b56-bc1d4af9f226")}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]="de197522-9007-5e21-8f9c-06cbf63707d1")}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]="a5e0162a-bbf1-50fe-8912-a820de155e90")}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]="9ee008b9-3751-5794-8d01-1f6d3123d6cd")}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]="b6fa277d-ccf2-5413-95d5-0790283203d5")}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]="2d59e10e-c85b-542a-8859-b20a08e809fa")}catch{}})();var de=(e,t)=>N(e,t,{runUpdate:(a,n,o)=>se(a,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]="3952425a-adce-59dd-84b6-97ac571eaa73")}catch{}})();async function Ae(e,t,a,n,o){let r=c(o),l=e==="run",m=e==="verdicts",h=e==="presets"||e==="apply",k=e==="promote",b=await q({action:e,...l||m||h||k?{}:{kind:t},id:l||m||k?a??t:a,preset:h?a??t:void 0,definition:i(n,"definition"),trigger:i(n,"trigger"),tree:i(n,"tree"),gate:i(n,"gate"),limit:i(n,"limit"),dry_run:n.dryRun===!0,fullChangedFields:r.fullChangedFields,idOnly:r.idOnly,author:i(n,"author"),message:i(n,"message"),owner:i(n,"owner"),apply:n.apply===!0,enforcement:i(n,"enforcement")},r);s(b,r),typeof b=="object"&&b!==null&&"exit_code"in b&&b.exit_code===1&&(process.exitCode=1)}function ue(e){e.command("assurance").argument("<action>","Action; inspect `pm contracts --command assurance`").argument("[kind]","Declaration kind or run gate id").argument("[id]","Declaration/gate id").description("Manage SDK-owned assurance contracts.").option("--definition <json>","Put declaration JSON").option("--trigger <value>","Gate trigger").option("--tree <value>","Revision identity").option("--gate <id>","Verdict gate filter").option("--limit <number>","Verdict limit").option("--dry-run","Evaluate without recording").option("--author <value>","Mutation author").option("--message <value>","Mutation rationale").option("--owner <item-id>","Preset/derivation owner").option("--apply","Persist derived proposals").option("--enforcement <level>","Promote to warn or block").action(Ae)}(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]="ceafed0d-5fd4-5a90-a4f3-bf0600e64bf9")}catch{}})();function _e(e,t){let a=e?.trim().toLowerCase(),n=t?.trim().toLowerCase();if(a===void 0||a.length===0)return n;if(a==="local-analytics")return n&&n.length>0?n:"status";if(n!==void 0&&n.length>0)throw x({command_path:"telemetry",token:`${e} ${t}`,allowed:["status","flush","stats","clear","local-analytics"],token_kind:"path",examples:["pm telemetry stats --limit 10","pm telemetry local-analytics status --json"]});return a}function Ie(e){return{addValues:Array.isArray(e.add)?e.add:[],addJsonValues:Array.isArray(e.addJson)?e.addJson:[],removeValues:Array.isArray(e.remove)?e.remove:[],removeIndexValues:Array.isArray(e.removeIndex)?e.removeIndex:[]}}function fe(e,t){if(e.background===!0){if(e.run!==!0)throw new p("--background requires --run",u.USAGE);if(e.acknowledgeLinkedTests===!0)throw new p("--background cannot be combined with --acknowledge-linked-tests; acknowledgement is a non-executing foreground operation",u.USAGE);if(e.update!==void 0||e.updateIndex!==void 0||e.setJson!==void 0||t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new p("--background does not support --add/--add-json/--remove/--remove-index or metadata edits; update linked tests first, then run in background",u.USAGE)}}async function Ce(e,t,a,n){let o=await C({kind:"test",commandArgs:O(e,{...t,add:n.addValues,addJson:n.addJsonValues,remove:n.removeValues,removeIndex:n.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:a.noExtensions===!0},a);s(o,a)}function De(e){return{update:typeof e.update=="string"?e.update:void 0,updateIndex:typeof e.updateIndex=="string"||typeof e.updateIndex=="number"?e.updateIndex:void 0,setJson:typeof e.setJson=="string"?e.setJson:void 0}}function D(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,...De(e),list:!!e.list,run:!!e.run,match:typeof e.match=="string"?e.match:void 0,onlyIndex:typeof e.onlyIndex=="string"||typeof e.onlyIndex=="number"?e.onlyIndex:void 0,onlyLast:!!e.onlyLast,timeout:typeof e.timeout=="string"?e.timeout:void 0,progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:typeof e.pmContext=="string"?e.pmContext:void 0,overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:typeof e.workspaceContext=="string"?e.workspaceContext:void 0,overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,acknowledgeLinkedTests:!!e.acknowledgeLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext,author:typeof e.author=="string"?e.author:void 0,message:typeof e.message=="string"?e.message:void 0,force:!!e.force,measure:Array.isArray(e.measure)?e.measure:[],metricBelow:typeof e.metricBelow=="string"?e.metricBelow:void 0,metricDiff:typeof e.metricDiff=="string"?e.metricDiff:void 0}}var qt={buildRunTestOptions:D,buildRunTestAllOptions:pe,runWorkspacePositionAction:ye,validateBackgroundTestOptions:fe};async function Se(e,t,a,n){let o=await oe(e,D(t,n),a);(t.update!==void 0||t.updateIndex!==void 0||t.setJson!==void 0||n.addValues.length>0||n.addJsonValues.length>0||n.removeValues.length>0||t.run===!0||n.removeIndexValues.length>0)&&await y(a,o),s(o,a),(o.run_results.some(r=>r.status==="failed"||r.status==="refused")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED)}async function Te(e,t,a){let n=c(a),o=Date.now(),r=Ie(t);t.background===!0&&ne(e,D(t,r),n,v(process.cwd(),n.path),!0),fe(t,r),t.background===!0?await Ce(e,t,n,r):await Se(e,t,n,r),n.profile&&d(`profile:command=test took_ms=${Date.now()-o}`)}function w(e){let t=i(e,"author"),a=i(e,"assignee");if(t!==void 0&&a!==void 0&&t!==a)throw new p("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",u.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm claim pm-123 --start","pm release pm-123"]});return{author:t??a,message:i(e,"message")}}async function Ee(e,t){let a=c(t),n=Date.now();if(e.background===!0){let r=await C({kind:"test-all",commandArgs:P(e),statusFilter:i(e,"status"),noExtensions:a.noExtensions===!0},a);s(r,a),a.profile&&d(`profile:command=test-all took_ms=${Date.now()-n}`);return}let o=await re(pe(e),a);await y(a,{ids:o.results.map(r=>r.id)}),s(o,a),(o.failed>0||o.fail_on_skipped_triggered===!0)&&(process.exitCode=u.DEPENDENCY_FAILED),a.profile&&d(`profile:command=test-all took_ms=${Date.now()-n}`)}function pe(e){return{status:i(e,"status"),limit:i(e,"limit"),offset:i(e,"offset"),timeout:i(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:i(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:i(e,"workspaceContext"),overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext}}async function Re(e,t,a,n){let o=c(n),r=Date.now(),l=await ae({subcommand:_e(e,t),limit:i(a,"limit")},o);s(l,o),o.profile&&d(`profile:command=telemetry took_ms=${Date.now()-r}`)}async function Oe(e,t){let a=c(t),n=Date.now(),o=ce(i(e,"analytics")),r=await te(a,{includeEmpty:e.includeEmpty===!0,storage:e.storage===!0,metadataCoverage:e.metadataCoverage===!0,byAssignee:e.byAssignee===!0,byTag:e.byTag===!0,byPriority:e.byPriority===!0,tagPrefix:i(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...o});r.recorded_observations?.some(l=>l.changed)===!0&&await y(a,{ids:r.recorded_observations?.flatMap(l=>l.observation.item_id?[l.observation.item_id]:[])}),s(r,a),a.profile&&d(`profile:command=stats took_ms=${Date.now()-n}`)}async function Pe(e,t){let a=c(t),n=Date.now(),o=i(e,"threshold"),r=i(e,"limit"),l=await F(a,{...e.exhaustive===!0?{exhaustive:!0}:{},status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:i(e,"since"),...o===void 0?{}:{threshold:Number(o)},...r===void 0?{}:{limit:Number(r)}});s(l,a),a.profile&&d(`profile:command=duplicates took_ms=${Date.now()-n}`)}async function Le(e,t){let a=c(t),n=Date.now(),o=!!e.strictExit||!!e.failOnWarn,r=await V(a,{strictExit:o,strictDirectories:!!e.strictDirectories,requireMergeDrivers:!!e.requireMergeDrivers,checkOnly:!!e.checkOnly,checkTelemetry:!!e.checkTelemetry,noRefresh:!!e.noRefresh,refreshVectors:!!e.refreshVectors,verboseStaleItems:!!e.verboseStaleItems,verboseAuthorEvents:!!e.verboseAuthorEvents,brief:!!e.brief,summary:!!e.summary||o,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});s(r,a),o&&!r.ok&&(A({...r,exit_code:u.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),a.profile&&d(`profile:command=health took_ms=${Date.now()-n}`)}async function Me(e,t){let a=c(t),n=Date.now(),o=await de({checkMetadata:!!e.checkMetadata,metadataProfile:i(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkCompleteness:!!e.checkCompleteness,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:i(e,"dependencyCycleSeverity"),parentCycleSeverity:i(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:i(e,"scanMode"),includePmInternals:!!e.includePmInternals,verboseFileLists:!!e.verboseFileLists,verboseDiagnostics:!!e.verboseDiagnostics,allAffectedIds:!!e.allAffectedIds,checkHistoryDrift:!!e.checkHistoryDrift,checkStorageIntegrity:!!e.checkStorageIntegrity,fixHints:!!e.fixHints,autoFix:!!e.autoFix,dryRun:!!e.dryRun,fixScope:Array.isArray(e.fixScope)?e.fixScope:void 0,pruneMissing:!!e.pruneMissing,counts:!!e.counts,full:!!e.full},a);s(o,a),(e.strictExit||e.failOnWarn)&&(o.has_warnings||!o.ok)&&(A({...o,exit_code:u.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=u.GENERIC_FAILURE),a.profile&&d(`profile:command=validate took_ms=${Date.now()-n}`)}async function Fe(e,t){let a=c(t),n=Date.now(),o=await J(a,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});s(o,a),a.profile&&d(`profile:command=gc took_ms=${Date.now()-n}`)}async function Ve(e,t,a,n){let o=c(n),r=v(process.cwd(),o.path),l=e.trim().toLowerCase();if(!I.some(m=>m===l))throw x({command_path:"workspace snapshot",token:e,allowed:I,display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(l==="list"){s(await K(r),o);return}if(l==="create"){s(await z(r,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new p(`pm workspace snapshot ${l} requires a snapshot name or fingerprint`,u.USAGE);if(l==="inspect"){s(await Y(r,t),o);return}if(l==="restore"){if(a.dryRun===!0){s(await X(r,t),o);return}let m=await _(r);s(await Q(r,t,{force:a.force===!0,author:R(i(a,"author"),m.author_default),message:i(a,"message"),lockTtlSeconds:m.locks.ttl_seconds,lockWaitMs:m.locks.wait_ms}),o);return}s(await Z(r,t),o)}async function ye(e,t){let a=c(t);s(await ee(a),a)}async function Ne(e,t){let a=c(t),n=Date.now(),o=await M({action:i(e,"action"),command:i(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},a);s(o,a),a.profile&&d(`profile:command=contracts took_ms=${Date.now()-n}`)}async function qe(e,t,a){let n=t.next===!0,o=t.start===!0;if(o&&e){await ge(e,t,a);return}$(e,n,o);let r=c(a),l=Date.now(),m={...w(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts,...o?{start:!0}:{}},h=n?await H(!!t.force,r,m,Je(t)):await U(e,!!t.force,r,m);await y(r,h),s(h,r),r.profile&&d(`profile:command=claim took_ms=${Date.now()-l}`)}function Je(e){return{type:i(e,"type"),tag:i(e,"tag"),priority:e.priority,assigneeFilter:i(e,"assigneeFilter"),parent:i(e,"parent"),sprint:i(e,"sprint"),release:i(e,"release"),includeDecisions:e.includeDecisions===!0,includeGates:e.includeGates===!0,includeContainers:e.includeContainers===!0,tokenBudget:e.tokenBudget??e.token_budget,explainRanking:e.explainRanking===!0||e.explain_ranking===!0}}async function Ue(e,t,a){if(t.pause===!0){await he(e,t,a);return}let n=c(a),o=Date.now(),r=await W(e,!!t.force,n,{...w(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0,handoff:t.handoff});await y(n,r),s(await L("release",[e],t,n,r),n),n.profile&&d(`profile:command=release took_ms=${Date.now()-o}`)}async function S(e){let t=c(e),a=T(e.name());!a||t.json||t.quiet||(await _(v(process.cwd(),t.path))).ux?.deprecation_hints&&d(E(a))}async function ge(e,t,a){await S(a);let n=c(a),o=Date.now(),r=await j(e,{...w(t),force:!!t.force,next:t.next===!0,ifAvailable:t.ifAvailable===!0},n);await y(n,r.update),s(r,n),n.profile&&d(`profile:command=start-task took_ms=${Date.now()-o}`)}async function he(e,t,a){await S(a);let n=c(a),o=Date.now(),r=await G(e,{...w(t),handoff:i(t,"handoff"),force:!!t.force},n);await y(n,r.release),s(r,n),n.profile&&d(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function $e(e,t,a,n){await S(n);let o=c(n),r=Date.now(),l=await B(e,t,{...w(a),validateClose:i(a,"validateClose"),force:!!a.force},o);await y(o,l.release),s(l,o),o.profile&&d(`profile:command=close-task took_ms=${Date.now()-r}`)}function me(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds (requires --run)").option("--progress","Emit stderr run progress (requires --run; automatic in TTY)").option("--env-set <value>","Set run environment (KEY=VALUE, repeatable)",f).option("--env-clear <value>","Clear run environment (NAME, repeatable)",f).option("--shared-host-safe","Apply additive shared-host-safe run defaults").option("--pm-context <mode>","PM test context: schema|tracker|auto|none (default: schema)").option("--override-linked-pm-context","Override stored context with --pm-context").option("--workspace-context <mode>","Source-workspace mode: source|isolated|snapshot (default: source)").option("--override-linked-workspace-context","Override stored context with --workspace-context").option("--allow-untrusted-linked-tests","Execute untrusted linked commands when project policy also permits it").option("--fail-on-context-mismatch","Fail linked PM commands when context item counts differ").option("--fail-on-skipped","Treat skipped linked tests as dependency failures").option("--fail-on-empty-test-run","Fail successful commands reporting zero executed tests").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Check PM context before execution").option("--auto-pm-context","Route mismatched PM tracker reads through tracker context")}function Jt(e){ue(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add verified isolated test (CSV/markdown or stdin)",f).option("--add-json <value>","Add verified isolated test (JSON object/array or stdin)",f).option("--remove <value>","Remove exact command/path (command=<value>, path=<value>, or stdin -)",f).option("--remove-index <n>","Remove 1-based --list position (repeatable)",f).option("--list","List linked tests without mutating").option("--update <value>","Edit exact command or path=<value>").option("--update-index <n>","Edit current 1-based --list position").option("--set-json <value>","Metadata patch; null clears optional fields").option("--run","Run linked test commands").option("--match <value>","Run matching command/path substring").option("--only-index <n>","Run 1-based --list position").option("--only-last","Run most recently added test");t.option("--acknowledge-linked-tests","Trust current commands in this clone without execution"),me(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...]; requires --run",f).option("--metric-below <value>","Return evidence below name=value").option("--metric-diff <name>","Diff the latest two values").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage tests linked to an item and optionally run them.").action(Te);let a=e.command("test-all").description("Run linked tests across matching items.").option("--status <value>","Filter items by status before running tests").option("--limit <n>","Limit matching items before running linked tests").option("--offset <n>","Skip matching items before running linked tests");me(a).action(Ee),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(k,b,be)=>{let we=c(be);await ie(k,we)}),e.command("telemetry").argument("[namespace-or-subcommand]","Telemetry subcommand: status, flush, stats, clear (default: status)").argument("[subcommand]","Compatibility alias target for local-analytics: status, flush, stats, clear").option("--limit <n>","Maximum command groups returned by telemetry stats").description("Inspect and manage local telemetry queue/runtime state.").action(Re),e.command("duplicates").description("Find duplicate clusters across all statuses.").option("--status <value>","Statuses (repeatable or comma-separated)",f,[]).option("--since <value>","Created at or after this time").option("--threshold <value>","Minimum similarity (0-1)").option("--limit <n>","Maximum clusters").option("--exhaustive","Score all pairs within the safety bound").action(Pe),e.command("stats").description("Show project tracker statistics.").option("--include-empty","Restore zero-count registered item-type and lifecycle-status buckets").option("--storage","Include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries)").option("--metadata-coverage","Include metadata coverage % (acceptance_criteria, estimated_minutes, resolution, tags, parent) overall and by type").option("--by-assignee","Include a lifecycle-bucketed item breakdown grouped by assignee").option("--by-tag","Include a lifecycle-bucketed item breakdown grouped by tag").option("--by-priority","Include a lifecycle-bucketed item breakdown grouped by priority").option("--tag-prefix <value>","With --by-tag: only count tags starting with this prefix (e.g. domain:)").option("--field-utilization","Report content-field utilization rates (notes/learnings/files/docs/tests/comments/deps/body) for governance analysis").option("--analytics <json>","Improvement ledger/history analytics JSON").action(Oe),e.command("health").description("Show project tracker health checks.").option("--strict-directories","Treat optional item-type directories as required failures").option("--require-merge-drivers","Treat absent clone-local merge drivers as a required health failure").option("--check-only","Run read-only health diagnostics without refreshing vectors").option("--check-telemetry","Probe telemetry endpoint health and include network diagnostics").option("--no-refresh","Disable automatic vector refresh attempts during health checks").option("--refresh-vectors","Explicitly enable vector refresh attempts during health checks").option("--verbose-stale-items","Include full stale vectorization ID lists in health output").option("--verbose-author-events","Include every actionable unknown-author event coordinate for review or disposition").option("--brief","Emit compact health details for low-token agent checks").option("--summary","Emit one-line-style health status with check names and warning count").option("--skip-vectors","Skip vectorization check for a faster run").option("--skip-integrity","Skip item/history file integrity check for a faster run").option("--skip-drift","Skip history drift hash check for a faster run").option("--full","Run all checks including slow integrity, drift, and vectorization checks").option("--strict-exit","Return non-zero exit when health is not ok and default to actionable summary output; use --full for complete details").option("--fail-on-warn","Alias for --strict-exit").action(Le),e.command("validate").description("Validate metadata, lifecycle policies, files, command references, and history.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Metadata profile (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-completeness","Check declarative lifecycle field requirements").option("--check-lifecycle","Run active-item lifecycle governance drift checks").option("--check-stale-blockers","Include stale blocker-pattern diagnostics in lifecycle checks").option("--dependency-cycle-severity <value>","Set dependency-cycle warning policy for lifecycle checks (off|warn|error)").option("--parent-cycle-severity <value>","Set parent-hierarchy cycle warning policy for lifecycle checks (off|warn|error)").option("--check-files","Run linked-file and orphaned-file checks").option("--check-command-references","Run linked-command PM-ID reference checks").option("--scan-mode <value>","Select file candidate scan mode for --check-files (default|tracked-all|tracked-all-strict)").option("--include-pm-internals","Include PM storage internals in tracked-all candidate scans").option("--verbose-file-lists","Include full file-path lists for validate --check-files details").option("--verbose-diagnostics","Include full diagnostic ID lists").option("--all-affected-ids","Emit complete missing_* affected-ID lists with no truncation (implied by --json)").option("--strict-exit","Return non-zero exit when validation warnings are present").option("--fail-on-warn","Alias for --strict-exit").option("--fix-hints","Add a machine-executable fix_hints[] of pm commands to each failing check's details").option("--auto-fix","Apply safe, deterministic field backfills").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, estimates, timestamps, lifecycle; comma-separated or repeatable). Default: metadata, resolution; other scopes require explicit opt-in",f).option("--prune-missing","Remove deleted-path file/doc links; preserves real files").option("--check-history-drift","Run item/history hash drift checks").option("--check-storage-integrity","Run the post-merge storage-integrity check (unreadable items, history conflict markers, resurrected deletes, unparseable config/schema)").option("--counts","Keep validation counts and totals while omitting per-item diagnostic arrays").option("--full","Return the complete validation diagnostic projection").action(Me),e.command("gc").option("--dry-run","Preview cleanup targets without deleting files; without this flag, pm gc deletes matched artifacts").option("--scope <value>","Limit cleanup to one or more scopes (comma-separated or repeatable): index, embeddings, runtime, locks, checkpoints, transactions",f).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Fe);let n=e.command("workspace").description("Inspect workspace state and snapshots.");n.command("position").description("Show merge and history readiness.").action(ye),n.command("snapshot").argument("<action>","Action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Manage content-addressed tracker snapshots.").option("--dry-run","Preview restore file, item, stream, and history-entry impact without mutating state").option("--force","Explicitly confirm a whole-workspace snapshot restore").option("--author <value>","Actor recorded on the restore audit event").option("--message <value>","Human-readable restore rationale").action(Ve),e.command("contracts").description("Show machine-readable command and schema contracts for agents.").option("--action <value>","Filter tool schema branches to a specific action").option("--command <value>","Scope contracts output to one CLI command (narrow-by-default)").option("--summary","Return one command+intent row per top-level command for cheap agent bootstrap").option("--schema-only","Return schema-focused output only").option("--flags-only","Return command flag contracts only").option("--availability-only","Return action availability surface only").option("--runtime-only","Include only actions invocable in the current runtime").option("--active-only","Alias for --runtime-only").option("--full","Include full schema and command-flag surfaces (large; default brief output omits heavy sections for unfiltered queries)").action(Ne);let o=e.command("claim").option("--start","Claim and start (id or --next)").argument("[id]","Item id (omit with --next)").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force claim override").option("--if-available","Skip another author's claim (skipped=true)").option("--next","Atomically claim the next caller-available actionable item").option("--type <value>","Filter --next candidates by type").option("--tag <value>","Filter --next candidates by tag").option("--priority <value>","Filter --next candidates by priority").option("--assignee-filter <value>","Filter --next candidates: assigned|unassigned").option("--parent <id>","Scope --next candidates to a subtree").option("--sprint <value>","Filter --next candidates by sprint").option("--release <value>","Filter --next candidates by release").option("--max-attempts <n>","Bound the --next candidate walk (default 10; maximum 100)").option("--include-decisions","Allow --next to claim human-gated Decision items").option("--include-gates","Allow --next to claim outcome gates").option("--include-containers","Allow --next to claim containers with unfinished descendants").option("--token-budget <n>","Bound the estimated tokens used to rank --next candidates").option("--explain-ranking","Include ranking provenance for --next selection").description("Claim an item for active work.").action(qe);g(o,"--assignee <value>","Alias for --author on lifecycle ownership commands"),g(o,"--token_budget <n>","Alias for --token-budget"),g(o,"--explain_ranking","Alias for --explain-ranking");let r=e.command("release").option("--pause","Use open status").option("--handoff <status>","Needs --message").argument("<id>","Item id").option("--author <value>","Author").option("--message <value>","Message").option("--force","Override ownership").description("Release ownership.").action(Ue);g(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let l=e.command("start-task",{hidden:!0}).argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: claim an item and move it to in_progress.").action(ge);g(l,"--assignee <value>","Alias for --author on lifecycle ownership commands");let m=e.command("pause-task",{hidden:!0}).argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override when required").description("Lifecycle alias: move an item to open and release its claim.").action(he);g(m,"--assignee <value>","Alias for --author on lifecycle ownership commands");let h=e.command("close-task",{hidden:!0}).argument("<id>","Item id").argument("[reason]","Close reason text").option("--author <value>","Mutation author").option("--message <value>","History message").option("--validate-close <value>","Close-time validation mode: off|warn|strict").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: close an item and release assignment metadata.").action($e);g(h,"--assignee <value>","Alias for --author on lifecycle ownership commands")}export{qt as _testOnlyRegisterOperations,Jt as registerOperationCommands,$ as requireClaimTarget};
2
- //# sourceMappingURL=register-operations-G3QGGQ5Z.js.map
@@ -1,2 +0,0 @@
1
- import"./chunk-DEZPZOQ7.js";import{a as P}from"./chunk-Y7H55PCY.js";import{g as j,i as T}from"./chunk-B6UTLYLM.js";import{Da as I,Ia as O,Ka as L,qa as R,ta as U}from"./chunk-MQJXZX3Q.js";import"./chunk-L6LCLC37.js";import{pg as b,sg as v}from"./chunk-ZOAJNPBL.js";import"./chunk-2CBHQXYJ.js";import"./chunk-IB7UB5TE.js";import{Ma as E,Oh as D,Rh as w,Sh as y,Ti as S,y as $,z as G}from"./chunk-32BCU6HN.js";import"./chunk-RSAN2YUU.js";import"./chunk-VS565KBX.js";import{A as d,C as h}from"./chunk-O4ZLEN4T.js";import"./chunk-XAWE4EAK.js";import C from"node:fs/promises";import W 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]="26ea7f42-d5f7-5ada-afd9-389dadc4d138")}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]="0b0e08e0-f6e7-59c4-ac96-9f47b172727a")}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]="d975120a-964e-5b19-ae10-8ba011ba9bf8")}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]="108609fa-51fc-5bd0-ac54-de2ad14a66c6")}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]="b36466e6-5574-5509-909a-e8599f11664c")}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]="e5e1e242-6864-5a72-adb9-0eda4c65a0c3")}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]="d41d82cb-8b54-5b72-936e-217cde14c4b5")}catch{}})();var M={extension:"extension",package:void 0};async function _(e,t){if(!e)return;let o=$(e),i=b(t);await S(E(process.cwd(),i.path)).then(a=>a.ux.deprecation_hints)&&y(G(o))}var V={init:"init",install:"install",uninstall:"uninstall",explore:"explore",manage:"manage",describe:"describe",reload:"reload",doctor:"doctor",catalog:"catalog",adopt:"adopt","adopt-all":"adoptAll",activate:"activate",deactivate:"deactivate",migrate:"migrate"};function X(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(a=>typeof a=="string"):[],i=[...new Set(o.map(a=>a.trim().toLowerCase()).filter(a=>a.length>0))];if(i.length>1)throw new h(`Multiple scaffold capabilities cannot be combined yet: ${i.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return i[0]}function A(e,t,o="extension"){let i={...e};t!==void 0&&(i[V[t]]=!0);let a=(...c)=>c.some(s=>i[s]===!0),r=(...c)=>{for(let s of c)if(typeof i[s]=="string")return i[s]};return{init:a("init"),scaffold:a("scaffold"),install:a("install"),uninstall:a("uninstall"),explore:a("explore","list"),manage:a("manage"),describe:a("describe"),markdown:a("markdown"),reload:a("reload"),doctor:a("doctor"),catalog:a("catalog"),adopt:a("adopt"),adoptAll:a("adoptAll","adopt_all","adopt-all"),activate:a("activate"),deactivate:a("deactivate"),migrate:a("migrate"),project:a("project"),local:a("local"),global:a("global"),gh:r("gh"),github:r("github"),ref:r("ref"),capability:X(e),declarative:a("declarative"),fields:r("fields"),detail:r("detail"),output:r("output"),trace:a("trace"),watch:a("watch"),runtimeProbe:a("runtimeProbe","runtime_probe","runtime-probe"),offline:a("offline"),fixManagedState:a("fixManagedState","fix_managed_state","fix-managed-state"),isolated:a("isolated"),ignoreGlobal:a("ignoreGlobal","ignore_global","ignore-global"),strictExit:a("strictExit","strict_exit","strict-exit"),failOnWarn:a("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:a("dryRun","dry_run","dry-run"),vocabulary:o}}async function Y(e){let t=(await C.readdir(process.cwd())).filter(i=>!i.startsWith(".")).sort((i,a)=>i.localeCompare(a)),o=[...e].sort((i,a)=>i.localeCompare(a));return t.length===o.length&&t.every((i,a)=>i===o[a])}async function J(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await Y(t)?["*"]:t}function H(e,t,o){let i=e.markdown===!0;if(o!==void 0&&o==="")throw new h("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!i)throw new h("--output is only supported with --markdown describe output.",d.USAGE);if(i){if(t.json)throw new h("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new h("--markdown is only supported by the describe action.",d.USAGE)}}async function Q(e){let t=U(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=W.resolve(e.outputPath);await C.mkdir(W.dirname(o),{recursive:!0}),await C.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)y(`warning: ${o}`);e.outputPath===void 0&&D(t)}}function Z(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let i=e.details!==null&&typeof e.details=="object"?e.details:{},a=i.summary!==null&&typeof i.summary=="object"?i.summary:null,r=a&&typeof a.status=="string"?a.status:void 0;(e.warnings.length>0||r!==void 0&&r!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function g(e,t,o,i,a="extension"){let r=b(o),c=Date.now(),s=a==="extension"?"package":a;await _(M[a],o);let n=A(t,i,s),l=(typeof n.output=="string"?n.output:void 0)?.trim();H(n,r,l);let f=await I(e,n,r);n.markdown===!0?await Q({result:f,vocabulary:s,outputPath:l,globalOptions:r}):w(f,r),Z(f,n),f.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),r.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function ee(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function te(e){return e instanceof h?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function oe(e,t,o){let i=[],a=[],r=d.GENERIC_FAILURE;for(let c of e)try{let s=await I(c,t,o),n=ee(s),l=Array.isArray(s.warnings)?s.warnings:[];a.push(...l);let f=s.ok===!0;i.push({target:c,ok:f,extension:n.extension,source:n.source,install_plan:n.install_plan,dry_run:n.dry_run,destination_path:n.destination_path,activated:n.activated,settings_changed:n.settings_changed,previous_state_preserved:n.previous_state_preserved,rollback:n.rollback,command_paths:n.command_paths,action_paths:n.action_paths,runtime_activation_status:n.runtime_activation_status,activation_diagnostics:n.activation_diagnostics,command_discovery:n.command_discovery,verification:n.verification,warnings:l,...f?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(s){let n=te(s),l=n.exit_code;typeof l=="number"&&r===d.GENERIC_FAILURE&&l!==d.GENERIC_FAILURE&&(r=l),i.push({target:c,ok:!1,error:n})}return{rows:i,warnings:a,failureExitCode:r}}async function z(e,t,o,i){let a=i==="extension"?"package":i;await _(M[i],o);let r=await J(e);if(r===void 0||r.length<=1){await g(r?.[0],t,o,"install",a);return}let c=b(o),s=Date.now(),n=A(t,"install",a);if(H(n,c,void 0),[n.gh,n.github].some(k=>typeof k=="string"&&k.trim().length>0))throw new h("Multiple install targets cannot be combined with --gh/--github. Install one GitHub source per command, or pass multiple explicit local, bundled, or npm: targets.",d.USAGE,{code:"multi_target_github_install_ambiguous",required:"Use exactly one positional target with --gh/--github, or omit --gh/--github when installing multiple targets.",examples:["pm package install --gh owner/repo","pm package install npm:pm-guide-shell pm-todos"]});let{rows:l,warnings:f,failureExitCode:m}=await oe(r,n,c),u=l.filter(k=>k.ok!==!0).length,K={ok:u===0,action:"install",scope:n.global===!0?"global":"project",installed_count:n.dryRun===!0?0:l.length-u,...n.dryRun===!0?{dry_run:!0,planned_count:l.length-u}:{},failed_count:u,targets:l,warnings:[...new Set(f)].sort((k,B)=>k.localeCompare(B))};w(K,c),u>0&&(process.exitCode=m),c.profile&&y(`profile:command=extension took_ms=${Date.now()-s}`)}function ae(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function x(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function p(e,t){return t==="package"?x(e):ae(e)}function N(e){return e.option("--dry-run","Plan CLI/package upgrades without running npm or reinstalling packages").option("--cli-only","Upgrade only the pm CLI/SDK npm package").option("--packages-only","Upgrade only managed pm packages").option("--repair","Force npm global reinstall when upgrading the pm CLI/SDK").option("--tag <value>","npm dist-tag/version for CLI and registry package upgrades").option("--package-name <value>","Override the CLI package name for self-upgrade testing")}async function q(e,t,o){let i=b(t),a=Date.now();o&&await _("upgrade",t);let r=await T(e,t.optsWithGlobals(),i);w(r,i),r.ok||(process.exitCode=d.GENERIC_FAILURE),i.profile&&y(`profile:command=package-upgrade took_ms=${Date.now()-a}`)}function F(e,t){let o=t==="package"?"package":"extension",i=t==="package"?"packages":"extensions",a=t,r=e.command(a,{hidden:t==="extension"}).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source, name, or scaffold path`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>","Starter capability for --init (default: commands)",v).option("--install",`Install a ${o} source`).option("--dry-run","Preview install without writes or activation").option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${i} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${i} and updates`).option("--offline","Skip remote freshness checks during manage").option("--describe",`Show surfaces registered by a loaded ${o}`).option("--markdown","Render describe as Markdown").option("--output <path>","Write Markdown to a file").option("--reload",`Reload ${i} without import cache`).option("--watch","Use watch mode with --reload").option("--doctor",`Run ${o} diagnostics`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt unmanaged ${o}`).option("--adopt-all",`Adopt all unmanaged ${i}`).option("--activate",`Activate a ${o} in selected scope settings`).option("--deactivate",`Deactivate a ${o} in selected scope settings`).option("--project",`Use project ${o} scope (default)`).option("--local","Alias for --project").option("--global",`Use global ${o} scope`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").option("--detail <mode>",`${o[0].toUpperCase()}${o.slice(1)} diagnostics detail mode (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(t==="package"?"Manage package lifecycle in project or global scope.":"Manage extension lifecycle in project or global scope.").action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,void 0,t)});t==="package"&&(r.alias("packages"),r.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=r.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${R.join("|")}; default commands)`,v).description(t==="package"?"Generate a starter package scaffold with package metadata, manifest, and entrypoint.":"Generate a starter extension scaffold with manifest and entrypoint.");t==="package"&&c.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"),p(c,t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"init",t)}),p(r.command("install").option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]",`${o[0].toUpperCase()}${o.slice(1)} source (local path, bundled alias, npm: source, wildcard, or GitHub source)`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description(`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source.`),t).action(async(s,n,l)=>{await z(s,l.optsWithGlobals(),l,t)}),p(r.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"uninstall",t)}),p(r.command("explore").description(`List discovered ${i} in selected scope.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"explore",t)}),p(r.command("inventory").argument("[name]",`${o[0].toUpperCase()}${o.slice(1)} name or directory to inspect`).description(`Read configured ${o} install and enablement state without activating extension code.`),t).action(async(s,n,l)=>{let f=b(l),m=l.optsWithGlobals();if(m.global===!0&&(m.project===!0||m.local===!0))throw new h("--global and --project/--local are mutually exclusive.",d.USAGE);let u=await P({pmRoot:E(process.cwd(),f.path),scope:m.global===!0?"global":"project",name:s});w(u,f),u.complete||(process.exitCode=d.GENERIC_FAILURE)}),p(r.command("manage").option("--offline","Skip remote freshness checks and report unknown update availability").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).description(`List managed ${i} with update-check metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"manage",t)}),p(r.command("describe").argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} name to describe (omit for every loaded ${o})`).option("--markdown","Render the surface map as a Markdown reference document instead of toon/json").option("--output <path>","Write Markdown output to a file (requires --markdown)").description(`Map every surface a loaded ${o} registers (commands, hooks, item types, providers, overrides, ...).`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"describe",t)}),p(r.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${i} with cache-busted module imports.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"reload",t)}),p(r.command("doctor").option("--detail <mode>",`Detail mode for ${o} diagnostics (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(`Run consolidated ${o} diagnostics (summary/deep modes).`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"doctor",t)}),p(r.command("catalog").alias("list").option("--fields <value>","Render compact comma-separated catalog fields, for example: alias,installed,install_command").description(`List bundled first-party ${o} catalog metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"catalog",t)}),p(r.command("adopt").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).option("--gh <owner/repo[/path]>",`GitHub provenance shorthand for adopted ${o}`).option("--github <owner/repo[/path]>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub shorthand source").description(`Adopt an existing unmanaged ${o} into managed metadata.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"adopt",t)}),p(r.command("adopt-all").description(`Adopt all unmanaged ${i} into managed metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"adopt-all",t)}),p(r.command("migrate").option("--dry-run","Plan active migrations without invoking extension code").description(`Plan or apply active ${o} migrations with durable receipts.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"migrate",t)}),p(r.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"activate",t)}),p(r.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"deactivate",t)}),t==="package"&&N(x(r.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(s,n,l)=>{await q(s,l,!1)})}async function ie(e,t,o){let i=b(o),a=Date.now(),r=await L(e,i,{idPrefix:typeof t.idPrefix=="string"?t.idPrefix:void 0,preset:typeof t.preset=="string"?t.preset:void 0,defaults:t.defaults===!0||t.yes===!0,author:typeof t.author=="string"?t.author:void 0,agentGuidance:typeof t.agentGuidance=="string"?t.agentGuidance:void 0,typePreset:typeof t.typePreset=="string"?t.typePreset:void 0,withPackages:t.withPackages===!0,mergeFence:t.mergeFence!==!1,force:t.force===!0,workspace:typeof t.workspace=="string"?t.workspace:void 0}),c=t.verbose===!0||i.json===!0;w(c?r:O(r,!0),i),i.profile&&y(`profile:command=init took_ms=${Date.now()-a}`)}function ne(e,t,o,i){let a=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:a?"project":e??"project",resolvedAction:a?e:t??"list",resolvedKey:a?t:o,resolvedValue:a?o:i}}function re(e){return{criterion:Array.isArray(e.criterion)?e.criterion:[],format:typeof e.format=="string"?e.format:void 0,policy:typeof e.policy=="string"?e.policy:void 0,value:typeof e.value=="string"?e.value:void 0,clearCriteria:e.clearCriteria===!0,defaultDepth:typeof e.defaultDepth=="string"?e.defaultDepth:void 0,activityLimit:typeof e.activityLimit=="string"?e.activityLimit:void 0,staleThresholdDays:typeof e.staleThresholdDays=="string"?e.staleThresholdDays:void 0,sectionHierarchy:typeof e.sectionHierarchy=="string"?e.sectionHierarchy:void 0,sectionActivity:typeof e.sectionActivity=="string"?e.sectionActivity:void 0,sectionProgress:typeof e.sectionProgress=="string"?e.sectionProgress:void 0,sectionBlockers:typeof e.sectionBlockers=="string"?e.sectionBlockers:void 0,sectionFiles:typeof e.sectionFiles=="string"?e.sectionFiles:void 0,sectionWorkload:typeof e.sectionWorkload=="string"?e.sectionWorkload:void 0,sectionStaleness:typeof e.sectionStaleness=="string"?e.sectionStaleness:void 0,sectionTests:typeof e.sectionTests=="string"?e.sectionTests:void 0}}async function se(e,t,o,i,a,r){let c=b(r),s=Date.now(),{resolvedScope:n,resolvedAction:l,resolvedKey:f,resolvedValue:m}=ne(e,t,o,i),u=await j(n,l,f,re(a),c,typeof m=="string"?m:void 0);w(u,c),c.profile&&y(`profile:command=config took_ms=${Date.now()-s}`)}var Re={normalizeExtensionOptions:A};function Ue(e){e.command("init").argument("[prefix-or-path]","Optional id prefix, or path-like tracker target such as ./pm-sandbox").option("--prefix, --id-prefix <value>","Set the item ID prefix (alias for the positional prefix)").option("--preset <value>","Governance preset for new setups: minimal|default|strict").option("--defaults","Use non-interactive setup defaults without opening the wizard").option("-y, --yes","Alias for --defaults (non-interactive setup)").option("--author <value>","Set the default mutation author for this project").option("--agent-guidance <mode>","Agent guidance mode: ask|add|skip|status").option("--type-preset <name>","Register domain item types during init: agile|ops|research").option("--with-packages","Install all bundled first-party packages during initialization").option("--no-merge-fence","Skip automatic merge-driver installation for a fresh Git-backed tracker").option("--workspace <dir>","Initialize repository-local tracker storage at <dir>/.agents/pm").option("--force","Allow initializing tracker files directly in a directory that looks like a workspace root").option("--verbose","Include the full resolved settings tree in the output (default output is a concise summary)").description("Initialize pm storage and defaults for the current workspace or a path-like tracker target.").action(async(t,o,i)=>{await ie(t,o,i)}),e.command("config").argument("[scope]","Config scope: project|global, or action shorthand list|export|get|set for project scope").argument("[action]","Config action: get|set|list|export").argument("[key]","Config key for get|set; use `pm config project list` for the complete typed inventory, including mutation-guard-* policies").argument("[value]",'Optional value for set: routed to the right typed flag by key (e.g. config set telemetry-tracking off, config set item-format toon, config set definition-of-done "Tests pass"). Equivalent to --policy/--format/--criterion. context keys still require --default-depth/--section-* flags.').option("--criterion <text>","Criteria value for definition-of-done, metadata-required-fields, or lifecycle pattern keys (repeatable for set)",v).option("--clear-criteria","Clear criteria-list keys for config set operations").option("--format <value>","Item format for item-format key: toon").option("--policy <value>","Policy key values: history-missing-stream-policy=auto_create|strict_error; sprint-release-format-policy=warn|strict_error; parent-reference-policy=warn|strict_error; governance-preset=minimal|default|strict|custom; governance-ownership-enforcement=none|warn|strict; governance-create-mode-default=progressive|strict; governance-close-validation-default=off|warn|strict; governance-require-close-reason=enabled|disabled; governance-parent-reference-policy=warn|strict_error; governance-metadata-validation-profile=core|strict|custom; governance-force-required-for-stale-lock=enabled|disabled; governance-duplicate-detection-mode=off|advisory|strict; test-result-tracking=enabled|disabled; untrusted-linked-test-execution=enabled|disabled; telemetry-tracking=enabled|disabled").option("--value <value>","Typed nested setting value. Mutation guards: require-attributed-author=true|false, secret-guard=off|advise|block, stale-in-progress-hours=integer>=1. Kebab-case is preferred; underscore aliases remain accepted.").option("--default-depth <value>","Context default depth: brief|standard|deep").option("--activity-limit <n>","Context default activity limit").option("--stale-threshold-days <n>","Context staleness cutoff in days").option("--section-hierarchy <value>","Enable/disable context hierarchy section (true|false)").option("--section-activity <value>","Enable/disable context activity section (true|false)").option("--section-progress <value>","Enable/disable context progress section (true|false)").option("--section-blockers <value>","Enable/disable context blockers section (true|false)").option("--section-files <value>","Enable/disable context files section (true|false)").option("--section-workload <value>","Enable/disable context workload section (true|false)").option("--section-staleness <value>","Enable/disable context staleness section (true|false)").option("--section-tests <value>","Enable/disable context tests section (true|false)").description("Read or update pm settings for the current workspace or global profile.").action(async(t,o,i,a,r,c)=>{await se(t,o,i,a,r,c)}),F(e,"extension"),F(e,"package"),x(e.command("install",{hidden:!0}).option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]","Package source (local path, bundled alias, npm: source, wildcard, or GitHub source)").option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description("Install a pm package into the project package scope by default.")).action(async(t,o,i)=>{await _("install",i),await z(t,i.optsWithGlobals(),i,"package")}),N(x(e.command("upgrade",{hidden:!0}).argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(t,o,i)=>{await q(t,i,!0)})}export{Re as _testOnlyRegisterSetup,Ue as registerSetupCommands};
2
- //# sourceMappingURL=register-setup-LDXHMNOT.js.map
@@ -1,2 +0,0 @@
1
- import{Pa as X,Qa as Y,Ra as Q,Sa as J,aa as ke,ba as Ke,ea as xe,fa as Oe}from"./chunk-YVLAP3BL.js";import{t as ye}from"./chunk-F3X6UWMI.js";import{g as He,m as qe,n as Ve,q as We}from"./chunk-PWUTFKSI.js";import{A as Be,C as D,F as Ge,I as $e,J as k,K as ze,e as q,f as De,h as Ne,i as Pe,k as Ue,l as je,w as V,y as W}from"./chunk-PZRB7IXH.js";import{Ga as Ae,Ka as Re,d as Fe,fb as w,ha as Te,kb as C,v as Ee,wa as Ce,x as T,xa as Le,ya as Me}from"./chunk-WSYPVBKS.js";import{b as fe}from"./chunk-RY4QEMAE.js";import{j as A,l as ge}from"./chunk-HJ27QLZV.js";import{Bc as _e,Ca as N,Ed as be,Fd as we,Gd as z,Kd as Ie,Nc as he,Od as Se,Sd as R,Td as ve,Ud as H,Wb as B,Xb as G,Zb as $,aa as h,qa as I,ra as O,uc as F,wa as b}from"./chunk-HUXZCPWT.js";import{A as f,C as pe,z as m}from"./chunk-G6ERMFJ5.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]="738a98bc-eaf0-578d-88e3-1c5f83c8894b")}catch{}})();function P(e,t="--limit"){if(e===void 0)return;let r=String(e).trim(),i=r.length===0?Number.NaN:Number(r);if(!Number.isInteger(i)||i<0)throw new f(`${t} must be a non-negative integer`,m.USAGE);return i}function Xe(e,t="--priority"){if(e===void 0)return;let r=String(e).trim(),i=r.length===0?Number.NaN:Number(r);if(!Number.isInteger(i)||i<0||i>4)throw new f(`${t} filter must be 0..4`,m.USAGE);return i}function oi(e,t,r="--type"){if(e===void 0)return;let i=O(e,t);if(!i)throw new f(`${r} filter must be one of ${t.types.join("|")}`,m.USAGE);return i}(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]="75ecca0c-fac8-5a9b-9043-c65731daad4a")}catch{}})();function Z(e,t){if(e===void 0)return;let r=[],i="";for(let o=0;o<e.length;o+=1){let a=e[o];if(a==="\\"){let l=e[o+1];if(l===","||l==="\\"){i+=l,o+=1;continue}i+=a;continue}if(a===","){r.push(i),i="";continue}i+=a}r.push(i);let n=r.map(o=>o.trim());if(n.some(o=>o.length===0))throw new f(`${t.label} requires at least one non-empty value`,m.USAGE);let s=n.map(o=>t.normalize?.(o)??o);return[...new Set(s)]}function K(e,t){let r=Z(e,t);return r===void 0?void 0:new Set(r)}function Ye(e,t,r="--type"){let i=Z(e,{label:r});if(i===void 0)return;let n=i.map(s=>{let o=O(s,t);if(!o)throw new f(`${r} filter token "${s}" must be one of ${t.types.join("|")}`,m.USAGE);return o});return new Set(n)}function Qe(e,t="--priority"){let r=Z(e,{label:t});if(r!==void 0)return new Set(r.map(i=>Xe(i,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]="f9d73d74-7c4e-5ea9-b34c-c984b4c15ab3")}catch{}})();function Je(e,t){let r=e.trim().toLowerCase();return t.alias_to_id.get(r)??r}function rt(e){return{isTerminal(t){return e.terminal_statuses.has(Je(t,e))},classify(t){let r=Je(t,e);return e.terminal_canceled_statuses.has(r)?"canceled":e.terminal_statuses.has(r)?"closed":e.blocked_statuses.has(r)?"blocked":e.draft_statuses.has(r)?"draft":r===e.open_status?"open":e.active_statuses.has(r)?"in_progress":"other"}}}function ee(e){return h(e.acceptance_criteria)===void 0}function te(e){return!Number.isFinite(e.estimated_minutes)}function it(e,t){return t.isTerminal(e.status)?h(e.resolution)===void 0:!1}function Qt(e){return h(e.reviewer)===void 0}function Jt(e){return h(e.risk)===void 0}function Zt(e){return typeof e.confidence=="number"?!Number.isFinite(e.confidence):h(e.confidence)===void 0}function er(e){return h(e.sprint)===void 0}function tr(e){return h(e.release)===void 0}function re(e){return!!(e.acMissing||e.estimatesMissing||e.resolutionMissing||e.reviewerMissing||e.riskMissing||e.confidenceMissing||e.sprintMissing||e.releaseMissing||e.metadataMissing)}function rr(e,t,r){return[[t.acMissing,ee(e)],[t.estimatesMissing,te(e)],[t.resolutionMissing,it(e,r)],[t.reviewerMissing,Qt(e)],[t.riskMissing,Jt(e)],[t.confidenceMissing,Zt(e)],[t.sprintMissing,er(e)],[t.releaseMissing,tr(e)]].every(([i,n])=>i!==!0||n)}function ir(e,t){return ee(e)||te(e)||it(e,t)}function nt(e,t,r){return re(t)?!(!rr(e,t,r)||t.metadataMissing&&!ir(e,r)):!0}var ie=["acceptance_criteria","estimated_minutes","resolution","tags","parent"];function nr(e,t){switch(t){case"acceptance_criteria":return!ee(e);case"estimated_minutes":return!te(e);case"resolution":return h(e.resolution)!==void 0;case"tags":return Array.isArray(e.tags)&&e.tags.length>0;default:return h(e.parent)!==void 0}}function sr(e,t,r){return t==="resolution"?r.isTerminal(e.status):!0}function or(e,t){return t===0?100:Math.round(e/t*1e3)/10}function Ze(){let e={};for(let t of ie)e[t]={present:0,applicable:0,percent:100};return e}function et(e,t,r){for(let i of ie){if(!sr(t,i,r))continue;let n=e[i];n.applicable+=1,nr(t,i)&&(n.present+=1)}}function tt(e){for(let t of ie){let r=e[t];r.percent=or(r.present,r.applicable)}}function pi(e,t){let r=Ze(),i={};for(let n of e){et(r,n,t);let s=i[n.type]??(i[n.type]=Ze());et(s,n,t)}tt(r);for(let n of Object.values(i))tt(n);return{overall:r,by_type:i}}var ar={assignee:"(unassigned)",priority:"(no priority)",tag:"(untagged)",parent:"(unparented)",type:"(untyped)",status:"(no status)"};function lr(e){return ar[e]}function dr(){return{open:0,in_progress:0,blocked:0,draft:0,closed:0,canceled:0,other:0}}function cr(e,t,r){switch(t){case"assignee":return[h(e.assignee)??null];case"parent":return[h(e.parent)??null];case"type":return[h(e.type)??null];case"status":return[h(e.status)??null];case"priority":return[typeof e.priority=="number"?`P${e.priority}`:null];default:{let i=r.tagPrefix?.trim(),n=(Array.isArray(e.tags)?e.tags:[]).filter(s=>typeof s=="string"&&s.length>0&&(!i||s.startsWith(i)));return n.length>0?n:[null]}}}function yi(e,t,r,i={}){let n=new Map,s=0;for(let a of e){s+=1;let l=r.classify(a.status);for(let d of cr(a,t,i)){let c=d??"\0empty",u=n.get(c);u||(u={label:d??lr(t),key:d,buckets:dr(),total:0},n.set(c,u)),u.buckets[l]+=1,u.total+=1}}let o=[...n.values()].sort((a,l)=>l.total!==a.total?l.total-a.total:a.key===null?1:l.key===null?-1:a.label.localeCompare(l.label));return{dimension:t,rows:o,total_items:s}}(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]="67f9184e-08b6-5f21-9f92-e60974adbf1e")}catch{}})();var L=["notes","learnings","files","docs","tests","comments","deps","body","linked_command"];function E(e){return Array.isArray(e)&&e.length>0}function ur(e){return typeof e=="string"&&e.trim().length>0}function mr(e){return Array.isArray(e)?e.some(t=>{if(typeof t!="object"||t===null)return!1;let r=t.command;return typeof r=="string"&&r.trim().length>0}):!1}function ot(e,t){switch(t){case"notes":return E(e.notes);case"learnings":return E(e.learnings);case"files":return E(e.files);case"docs":return E(e.docs);case"tests":return E(e.tests);case"comments":return E(e.comments);case"deps":return E(e.dependencies);case"body":return ur(e.body);case"linked_command":return mr(e.tests)}}function at(e){return L.some(t=>e[t]!==void 0)}function lt(e,t){for(let r of L){let i=t[r];if(i===void 0)continue;let n=ot(e,r);if(i==="present"&&!n||i==="absent"&&n)return!1}return!0}function dt(e){return L.some(t=>t!=="body"&&e[t]!==void 0)}function ct(e){return e.body!==void 0}function st(e,t){return t===0?100:Math.round(e/t*1e3)/10}function fr(){let e={};for(let t of L)e[t]={present:0,total:0,percent:100};return e}function _i(e){let t=fr(),r=e.length;for(let o of e)for(let a of L)ot(o,a)&&(t[a].present+=1);for(let o of L)t[o].total=r,t[o].percent=st(t[o].present,r);let i=t.body,n=r-i.present,s={present:n,total:r,percent:st(n,r)};return{total_items:r,fields:t,body_populated:i,empty_body:s}}(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]="084aad9c-485f-5bdc-8da7-225c9c4f695c")}catch{}})();var gt=e=>({acMissing:e.filterAcMissing===!0,estimatesMissing:e.filterEstimatesMissing===!0,resolutionMissing:e.filterResolutionMissing===!0,metadataMissing:e.filterMetadataMissing===!0,reviewerMissing:e.filterReviewerMissing===!0,riskMissing:e.filterRiskMissing===!0,confidenceMissing:e.filterConfidenceMissing===!0,sprintMissing:e.filterSprintMissing===!0,releaseMissing:e.filterReleaseMissing===!0}),ut=[{field:"notes",presentKey:"hasNotes",absentKey:"noNotes",presentFlag:"--has-notes",absentFlag:"--no-notes"},{field:"learnings",presentKey:"hasLearnings",absentKey:"noLearnings",presentFlag:"--has-learnings",absentFlag:"--no-learnings"},{field:"files",presentKey:"hasFiles",absentKey:"noFiles",presentFlag:"--has-files",absentFlag:"--no-files"},{field:"docs",presentKey:"hasDocs",absentKey:"noDocs",presentFlag:"--has-docs",absentFlag:"--no-docs"},{field:"tests",presentKey:"hasTests",absentKey:"noTests",presentFlag:"--has-tests",absentFlag:"--no-tests"},{field:"comments",presentKey:"hasComments",absentKey:"noComments",presentFlag:"--has-comments",absentFlag:"--no-comments"},{field:"deps",presentKey:"hasDeps",absentKey:"noDeps",presentFlag:"--has-deps",absentFlag:"--no-deps"},{field:"body",presentKey:"hasBody",absentKey:"emptyBody",presentFlag:"--has-body",absentFlag:"--empty-body"},{field:"linked_command",presentKey:"hasLinkedCommand",absentKey:"noLinkedCommand",presentFlag:"--has-linked-command",absentFlag:"--no-linked-command"}],se=e=>{let t=ut.find(r=>e[r.presentKey]===!0&&e[r.absentKey]===!0);if(t)throw new f(`Cannot combine ${t.presentFlag} with ${t.absentFlag} for the same field.`,m.USAGE);return Object.fromEntries(ut.flatMap(r=>e[r.presentKey]===!0?[[r.field,"present"]]:e[r.absentKey]===!0?[[r.field,"absent"]]:[]))},mt=["priority","deadline","updated_at","created_at","title","parent"],ft=["asc","desc"],_t=new Set(Be);function pr(e,t,r){let i=e.filter(o=>o.startsWith("item_list_item_read_failed:")).length,n=e.filter(o=>o.startsWith("item_list_directory_read_failed:")).length,s={status:t?"unchecked":i+n>0?"partial":"complete",unreadable_item_count:i,unreadable_directory_count:n};if(r&&s.status==="partial")throw new f(`List source is incomplete: ${i} item document(s) and ${n} item directory/directories could not be read.`,m.GENERIC_FAILURE,{code:"list_source_incomplete",why:"Strict list reads fail closed so agents and SDK consumers never treat an omitted item as a complete workspace.",nextSteps:["Run pm validate --check-storage-integrity to locate unreadable tracker artifacts.","Repair the reported files or align the installed decoder version, then retry."]});return s}function yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length>0}var gr=[{key:"hasNotes",summaryKey:"has_notes"},{key:"hasLearnings",summaryKey:"has_learnings"},{key:"hasFiles",summaryKey:"has_files"},{key:"hasDocs",summaryKey:"has_docs"},{key:"hasTests",summaryKey:"has_tests"},{key:"hasComments",summaryKey:"has_comments"},{key:"hasDeps",summaryKey:"has_deps"},{key:"hasBody",summaryKey:"has_body"},{key:"hasLinkedCommand",summaryKey:"has_linked_command"},{key:"noNotes",summaryKey:"no_notes"},{key:"noLearnings",summaryKey:"no_learnings"},{key:"noFiles",summaryKey:"no_files"},{key:"noDocs",summaryKey:"no_docs"},{key:"noTests",summaryKey:"no_tests"},{key:"noComments",summaryKey:"no_comments"},{key:"noDeps",summaryKey:"no_deps"},{key:"emptyBody",summaryKey:"empty_body"},{key:"noLinkedCommand",summaryKey:"no_linked_command"}],_r=[{key:"filterReviewerMissing",summaryKey:"filter_reviewer_missing"},{key:"filterRiskMissing",summaryKey:"filter_risk_missing"},{key:"filterConfidenceMissing",summaryKey:"filter_confidence_missing"},{key:"filterSprintMissing",summaryKey:"filter_sprint_missing"},{key:"filterReleaseMissing",summaryKey:"filter_release_missing"}];function ht(e,t){for(let r of gr)t[r.key]===!0&&(e[r.summaryKey]=!0)}function bt(e,t){for(let r of _r)t[r.key]===!0&&(e[r.summaryKey]=!0)}function hr(e,t,r){for(let i of r){let n=t[i.optionKey];n!==void 0&&(e[i.summaryKey]=i.normalize?i.normalize(n):n)}}function wt(e){let t={};return ht(t,e),t}function It(e){let t={};return bt(t,e),t}var br=[{optionKey:"type",summaryKey:"type"},{optionKey:"tag",summaryKey:"tag"},{optionKey:"priority",summaryKey:"priority"},{optionKey:"deadlineBefore",summaryKey:"deadline_before"},{optionKey:"deadlineAfter",summaryKey:"deadline_after"},{optionKey:"updatedAfter",summaryKey:"updated_after"},{optionKey:"updatedBefore",summaryKey:"updated_before"},{optionKey:"createdAfter",summaryKey:"created_after"},{optionKey:"createdBefore",summaryKey:"created_before"},{optionKey:"ids",summaryKey:"ids"},{optionKey:"assignee",summaryKey:"assignee"},{optionKey:"assigneeFilter",summaryKey:"assignee_filter"},{optionKey:"parent",summaryKey:"parent"},{optionKey:"sprint",summaryKey:"sprint"},{optionKey:"release",summaryKey:"release"}],wr=[{optionKey:"type",summaryKey:"type"},{optionKey:"tag",summaryKey:"tag"},{optionKey:"priority",summaryKey:"priority"},{optionKey:"deadlineBefore",summaryKey:"deadline_before"},{optionKey:"deadlineAfter",summaryKey:"deadline_after"},{optionKey:"updatedAfter",summaryKey:"updated_after"},{optionKey:"updatedBefore",summaryKey:"updated_before"},{optionKey:"createdAfter",summaryKey:"created_after"},{optionKey:"createdBefore",summaryKey:"created_before"},{optionKey:"ids",summaryKey:"ids"},{optionKey:"assignee",summaryKey:"assignee"},{optionKey:"assigneeFilter",summaryKey:"assignee_filter"},{optionKey:"parent",summaryKey:"parent"},{optionKey:"sprint",summaryKey:"sprint"},{optionKey:"release",summaryKey:"release"},{optionKey:"limit",summaryKey:"limit"},{optionKey:"offset",summaryKey:"offset"},{optionKey:"includeBody",summaryKey:"include_body"},{optionKey:"compact",summaryKey:"compact"},{optionKey:"fields",summaryKey:"fields"}],Ir=[{key:"filterAcMissing",summaryKey:"filter_ac_missing"},{key:"filterEstimatesMissing",summaryKey:"filter_estimates_missing"},{key:"filterResolutionMissing",summaryKey:"filter_resolution_missing"},{key:"filterMetadataMissing",summaryKey:"filter_metadata_missing"}],Sr="-7d";function St(e){let{filtersStatus:t,options:r,treeEnabled:i,treeDepth:n,sortField:s,sortOrder:o,runtimeFieldFilters:a}=e,l={};return t!==null&&(l.status=t),r.dependencyBlocked===!0&&(l.blocked_semantics="status_or_dependency"),hr(l,r,br),Ft(l,r),r.filterAcMissing===!0&&(l.filter_ac_missing=!0),r.filterEstimatesMissing===!0&&(l.filter_estimates_missing=!0),r.filterResolutionMissing===!0&&(l.filter_resolution_missing=!0),r.filterMetadataMissing===!0&&(l.filter_metadata_missing=!0),bt(l,r),ht(l,r),r.limit!==void 0&&(l.limit=r.limit),r.offset!==void 0&&(l.offset=r.offset),r.includeBody===!0&&(l.include_body=!0),r.fields!==void 0&&(l.fields=r.fields),i&&(l.tree=!0,n!==void 0&&(l.tree_depth=n)),s!==void 0&&(l.sort=s,l.order=o),yr(a)&&(l.runtime_filters=a),l}function oe(e,t,r){let i=T(e.status,r),n=T(t.status,r);if(i!==n)return i?1:-1;let s=e.priority-t.priority;if(s!==0)return s;let o=R(t.updated_at,e.updated_at);return o!==0?o:(e.id??"").localeCompare(t.id??"")}function vr(e,t){return[...e].sort((r,i)=>oe(r,i,t))}function pt(e,t){if(e!==void 0)return H(e,new Date,t)}function x(e,t){if(e==null)return;let r=String(e).trim();if(r.length!==0)return H(r,new Date,t)}function vt(e){let t=e.updatedAfter!=null&&String(e.updatedAfter).trim().length>0;if([e.today===!0,e.recent===!0,t].filter(r=>r).length>1)throw new f("Choose only one updated_at window: --today, --recent, or --updated-after.",m.USAGE);if(e.today===!0){let r=new Date;return r.setHours(0,0,0,0),r.toISOString()}return e.recent===!0?x(Sr,"recent"):x(e.updatedAfter,"updated-after")}function Ft(e,t){t.today===!0&&(e.today=!0),t.recent===!0&&(e.recent=!0)}function Et(e){if(e==null)return;let t=String(e).trim();if(t.length===0)throw new f("--ids requires at least one non-empty item ID",m.USAGE);let r=t.split(",").map(i=>i.trim()).filter(i=>i.length>0);if(r.length===0)throw new f("--ids requires at least one non-empty item ID",m.USAGE);return new Set(r)}function ae(e){if(e===void 0)return;let t=String(e).trim(),r=t.length===0?Number.NaN:Number(t);if(!Number.isInteger(r)||r<0)throw new f("Offset filter must be a non-negative integer",m.USAGE);return r}function Tt(e){if(e===void 0)return;let t=e.split(",").map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0)throw new f("List --fields requires a comma-separated list of field names",m.USAGE);return[...new Set(t)]}function Ct(e,t=e.projectionCommand??"list"){let r=e.compact===!0,i=e.brief===!0,n=e.full===!0,s=Tt(e.fields);if(Number(r)+Number(i)+Number(n)+ +(s!==void 0)>1)throw new f("List projection options are mutually exclusive. Use one of --compact, --brief, --full, or --fields.",m.USAGE,{code:"projection_options_mutually_exclusive",recovery:{suggested_retry:`pm ${t} --brief`,suggested_retry_args:[t,"--brief"]}});if(n)return{mode:"full",fields:[]};if(i){let o=le(e.sort);return{mode:"brief",fields:[...new Set([...G,o??"priority"])]}}return r?{mode:"compact",fields:[...B]}:s?{mode:"fields",fields:[...new Set(s.map(o=>v(o)))]}:{mode:"full",fields:[]}}function v(e){return e.startsWith("item.")?e.slice(5):e}function Fr(e,t,r){if(e.mode!=="fields")return;let i=$(t),n=new Set(i.map(o=>v(o))),s=e.fields.filter(o=>!n.has(v(o)));if(s.length>0){let o=[r,"--fields",e.fields.filter(a=>!s.includes(a)).join(",")||"id,title,status"];throw new f(`Unknown list --fields value(s): ${s.join(", ")}`,m.USAGE,{code:"unknown_field_projection",examples:["pm list --status open --fields id,title,status","pm list --fields id,title,parent,priority --limit 10","pm list --all --fields id,title,body --limit 5"],recovery:{allowed_values:i,suggested_retry:he(o),suggested_retry_args:o}})}}var Er=new Map([["updated","updated_at"],["update","updated_at"],["modified","updated_at"],["created","created_at"],["create","created_at"]]);function le(e){if(e===void 0)return;let t=e.trim().toLowerCase(),r=Er.get(t);if(r)return r;if(!mt.includes(t))throw new f(`Sort field must be one of ${mt.join("|")} (aliases: updated->updated_at, created->created_at)`,m.USAGE);return t}function Lt(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!ft.includes(t))throw new f(`Sort order must be one of ${ft.join("|")}`,m.USAGE);return t}function Tr(e){return P(e,"--tree-depth")}function Mt(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!t)throw new f("Assignee filter must be one of assigned|unassigned",m.USAGE);if(t!=="assigned"&&t!=="unassigned")throw new f(`Invalid assignee filter "${e}". Allowed: assigned|unassigned`,m.USAGE);return t}function yt(e,t){return Ke(e,t,{strict:!0})}function At(e){return K(e,{label:"--tag",normalize:t=>t.toLowerCase()})}function Cr(e,t,r){let i=At(t);if(i===void 0)return;let n=new Set(e.flatMap(o=>o.tags.map(a=>a.trim().toLowerCase()))),s=[...i].filter(o=>!n.has(o));s.length>0&&r.push(`unknown_tags:${s.join(",")}`)}function Lr(e,t){if(e&&[...e].some(r=>r.toLowerCase()==="none"||r.toLowerCase()==="null"))throw new f('--assignee no longer accepts "none" or "null". Use --assignee-filter unassigned.',m.USAGE);if(e!==void 0&&t==="unassigned")throw new f("Cannot combine --assignee with --assignee-filter unassigned",m.USAGE)}function Mr(e,t,r,i){let n=K(t.assignee,{label:"--assignee"}),s=Mt(t.assigneeFilter);Lr(n,s);let o=gt(t),a=se(t);return{idsFilter:Et(t.ids),statusSet:e&&e.length>0?new Set(e):void 0,excludeTerminal:t.excludeTerminal===!0,typeFilter:Ye(t.type,r),tagFilters:At(t.tag),priorityFilter:Qe(t.priority),deadlineBefore:pt(t.deadlineBefore,"deadline-before"),deadlineAfter:pt(t.deadlineAfter,"deadline-after"),updatedAfter:vt(t),updatedBefore:x(t.updatedBefore,"updated-before"),createdAfter:x(t.createdAfter,"created-after"),createdBefore:x(t.createdBefore,"created-before"),assigneeFilter:n,assigneeModeFilter:s,parentFilter:t.parent?.trim(),treeEnabled:t.tree===!0,sprintFilter:K(t.sprint,{label:"--sprint"}),releaseFilter:K(t.release,{label:"--release"}),missingMetadataFilters:o,missingMetadataActive:re(o),lifecycleClassifier:rt(i),contentFieldFilters:a,contentFiltersActive:at(a)}}function Ar(e,t,r){return t.idsFilter&&!t.idsFilter.has(e.id)||t.statusSet&&!t.statusSet.has(e.status)||t.excludeTerminal&&T(e.status,r)||t.typeFilter&&!t.typeFilter.has(e.type)||t.tagFilters&&![...t.tagFilters].some(i=>(e.tags??[]).some(n=>n.trim().toLowerCase()===i))?!1:t.priorityFilter===void 0||t.priorityFilter.has(e.priority)}function Rr(e,t){return ve(e,t)}function Dr(e,t){return t.assigneeModeFilter==="assigned"&&!e.assignee||t.assigneeModeFilter==="unassigned"&&e.assignee?!1:t.assigneeFilter===void 0||e.assignee!==void 0&&t.assigneeFilter.has(e.assignee)}function kr(e,t,r){let i=e.parent?.trim().toLowerCase(),n=[...new Set([...r?.get(e.id.trim().toLowerCase())??[],...i?[i]:[]])];return t.parentFilter!==void 0&&!t.treeEnabled&&!n.includes(t.parentFilter.trim().toLowerCase())||t.sprintFilter!==void 0&&(e.sprint===void 0||!t.sprintFilter.has(e.sprint))?!1:t.releaseFilter===void 0||e.release!==void 0&&t.releaseFilter.has(e.release)}function Kr(e,t,r,i,n){return!(!Ar(e,t,r)||!Rr(e,t)||!Dr(e,t)||!kr(e,t,n)||t.missingMetadataActive&&!nt(e,t.missingMetadataFilters,t.lifecycleClassifier)||t.contentFiltersActive&&!lt(e,t.contentFieldFilters)||!Oe(e,i))}function Rt(e,t,r,i,n,s,o){let a=Mr(t,r,i,n);return e.filter(l=>Kr(l,a,n,s,o))}function M(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function ne(e,t,r,i){let n=e,s=typeof n.title=="string"?n.title:"",o=i??M(typeof n.parent=="string"?n.parent:void 0)??null;return{...e,tree_depth:t,tree_parent:o,tree_children:r,tree_title:`${" ".repeat(t)}${s}`}}function xr(e,t){let r=new Map,i=new Map;for(let n of e){let s=n.id.trim().toLowerCase();r.set(s,n);let o=t?t.parents_by_child.get(s)??[]:[M(n.parent)?.toLowerCase()].filter(a=>a!==void 0);for(let a of o){let l=i.get(a)??[];l.push(n),i.set(a,l)}}return{byId:r,childrenByParent:i}}function Or(e,t,r,i,n){return t?[...i.get(t.toLowerCase())??[]]:e.filter(s=>(n?n.parents_by_child.get(s.id.trim().toLowerCase())??[]:[M(s.parent)?.toLowerCase()].filter(o=>o!==void 0)).every(o=>!r.has(o)))}function Dt(e,t,r,i,n=e){let{byId:s,childrenByParent:o}=xr(e,i),a=Or(e,t,s,o,i),l=[],d=new Set,c=new Map(n.map(p=>[p.id.trim().toLowerCase(),p.id.trim()])),u=[...a].reverse().map(p=>({node:p,depth:0,parentId:t===void 0?void 0:c.get(t.trim().toLowerCase())??t.trim()}));for(;u.length>0;){let{node:p,depth:y,parentId:g}=u.pop(),_=p.id.trim().toLowerCase();if(d.has(_))continue;d.add(_);let S=o.get(_)??[];if(l.push(ne(p,y,S.length,g)),!(r!==void 0&&y>=r))for(let j of[...S].reverse())u.push({node:j,depth:y+1,parentId:c.get(_)})}if(t===void 0&&r===void 0)for(let p of e){let y=p.id.trim().toLowerCase();d.has(y)||(d.add(y),l.push(ne(p,0,o.get(y)?.length??0)))}return l}function kt(e,t){return e===t?0:e===null?1:t===null?-1:e.localeCompare(t)}function Kt(e,t){return e===t?0:e===null?1:t===null?-1:R(e,t)}function xt(e,t,r){switch(r){case"priority":return e.priority-t.priority;case"deadline":return Kt(e.deadline??null,t.deadline??null);case"updated_at":return R(e.updated_at,t.updated_at);case"created_at":return R(e.created_at,t.created_at);case"title":return(e.title??"").localeCompare(t.title??"");case"parent":return kt(e.parent??null,t.parent??null);default:return 0}}function Ot(e,t,r,i){return t?[...e].sort((n,s)=>{let o=xt(n,s,t);if(o!==0)return r==="desc"?-o:o;let a=oe(n,s,i);return r==="desc"?-a:a}):vr(e,i)}function Nt(e,t,r=!1){let i=v(t.trim());if(i.length===0)return null;let n=e;return r&&i==="title"&&typeof n.tree_title=="string"?n.tree_title:Object.prototype.hasOwnProperty.call(n,i)?n[i]??null:null}function de(e,t,r=!1){return t.mode==="full"?e:e.map(i=>{let n={};for(let s of t.fields)n[s]=Nt(i,s,r);return n})}function Pt(e){let t=[];for(let r of e)t.push(r.metadata_key);return[...t,...fe(F())]}function Ut(e,t){let r=P(e.limit);if(r!==void 0)return r;if(e.noTruncate!==!0)return t>=1e4?20:void 0}function Nr(e,t,r){return t.after===void 0?ae(t.offset)??0:Ie(e,t.after,r,i=>i.id)}function jt(e,t,r){return{...e!==void 0?{applied_limit:e}:{},has_more:t,truncated:t,next_cursor:r??null}}async function Pr(e,t){let r=b(process.cwd(),t.path);await C(r);let i=await w(r),n=A(i.schema),s=ge(i.schema),o=e.projectionCommand??"list",a=Ct(e,o);return Fr(a,Pt(s.definitions),o),{pmRoot:r,settings:i,statusRegistry:n,runtimeFieldFilters:xe(e,s,"list"),typeRegistry:I(i,F()),projection:a}}async function Ur(e,t,r){let i=t.projection.fields.some(l=>v(l)==="body"),n=t.projection.mode==="full"||t.projection.fields.some(l=>_t.has(v(l))),s=se(e),o=dt(s),a=ct(s);return e.includeBody||i||a?await ze(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema):n||o?await $e(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema):await k(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema)}function jr(e){let t=le(e.sort),r=Lt(e.order)??"asc",i=e.tree===!0;if(!i&&e.treeDepth!==void 0)throw new f("List --tree-depth requires --tree",m.USAGE);if(!t&&e.order!==void 0)throw new f("List --order requires --sort",m.USAGE);return{sortField:t,sortOrder:r,treeEnabled:i,treeDepth:i?Tr(e.treeDepth):void 0,parentRoot:i?M(e.parent):void 0}}function Br(e,t,r){let i=yt(t.status,r),n;t.lifecycleBucket==="in_progress"?n=[r.in_progress_status]:t.lifecycleBucket==="open"&&(n=[...r.active_statuses].filter(d=>d!==r.in_progress_status).sort((d,c)=>d.localeCompare(c)));let s=i??n??yt(e,r),o=ke(t.status),a=i||o?{...t,excludeTerminal:!1}:t,l="all";return o?l="all":i!==void 0?l=i.length===1?i[0]:i:t.lifecycleBucket!==void 0?l=t.lifecycleBucket:s!==void 0?l=s.length===1?s[0]:s:a.excludeTerminal===!0&&(l=null),{resolvedStatus:s,explicitAllStatuses:o,effectiveOptions:a,filtersStatus:l}}function Gr(e,t,r,i,n){if(t.after!==void 0&&t.offset!==void 0)throw new f("List --after cannot be combined with --offset.",m.USAGE);let s=Ut(t,e.length),o=Nr(e,t,n),a=s===void 0?e.slice(o):e.slice(o,o+s),l=de(a,r,i),d=e.length,c=a.length>0&&o+a.length<d,u=c&&a.length>0?z(n,a[a.length-1].id,o+a.length-1):void 0;return{projected:l,totalMatched:d,pageExtras:jt(s,c,u)}}function Bt(e,t,r,i){return we("list",{pmRoot:i,status:e,options:be(t,ye),sort:r.sortField??"default",order:r.sortOrder,tree:r.treeEnabled,tree_depth:r.treeDepth??null})}async function $r(e){let{options:t,runtime:r,statusSelection:i,ordering:n}=e,s=new Set(["status","limit","offset","compact","brief","full","fields","format","stream","includeBody","excludeTerminal","dependencyBlocked","lifecycleBucket","noTruncate","projectionCommand","truncate","notes","learnings","files","docs","tests","comments","deps","linkedCommand"]),o=[r.projection.mode==="full",r.projection.fields.some(y=>{let g=v(y);return g==="body"||_t.has(g)})].includes(!0);if([t.limit===void 0,t.after!==void 0,t.noTruncate===!0,t.includeBody===!0,t.dependencyBlocked===!0,t.strictRead===!0,n.treeEnabled,n.sortField!==void 0,o,_e(),Object.keys(r.runtimeFieldFilters).length>0,Object.entries(t).some(([y,g])=>g!==void 0&&!s.has(y))].includes(!0))return null;let a=await D(r.pmRoot,[...new Set(Object.values(r.typeRegistry.type_to_folder))]);if(!a)return null;let l=P(t.limit),d=ae(t.offset)??0,c=await V({pmRoot:r.pmRoot,expectedSourceCursor:a.source_cursor,query:{statuses:i.resolvedStatus,excludeStatuses:i.resolvedStatus===void 0&&i.effectiveOptions.excludeTerminal===!0?[...r.statusRegistry.terminal_statuses]:void 0,terminalStatuses:[...r.statusRegistry.terminal_statuses],limit:l,offset:d}});if(!c)return null;let u=c.items.length>0&&d+c.items.length<c.total,p=u?z(Bt(i.filtersStatus,t,n,r.pmRoot),c.items.at(-1).id,d+c.items.length-1):void 0;return{projected:de(c.items,r.projection,!1),totalMatched:c.total,pageExtras:jt(l,u,p)}}function zr(e){let{filtersStatus:t,options:r,noTruncate:i,treeEnabled:n,treeDepth:s,sortField:o,sortOrder:a,runtimeFieldFilters:l}=e,d={};t!==null&&(d.status=t),r.dependencyBlocked===!0&&(d.blocked_semantics="status_or_dependency");let c=r;for(let u of wr){let p=c[u.optionKey];p!=null&&(d[u.summaryKey]=p)}for(let u of Ir)c[u.key]===!0&&(d[u.summaryKey]=!0);return Object.assign(d,It(r),wt(r)),Ft(d,r),i&&(d.no_truncate=!0),r.strictRead===!0&&(d.strict_read=!0),n&&(d.tree=!0,s!==void 0&&(d.tree_depth=s)),o!==void 0&&(d.sort=o,d.order=a),d.runtime_filters=l,d}async function Yi(e,t,r){let i=await Pr(t,r),n=[],s=jr(t),o=Br(e,t,i.statusRegistry),a=t.noTruncate===!0,l=await $r({options:t,runtime:i,statusSelection:o,ordering:s}),d=l;if(!d){let g=await Ur(t,i,n),_=s.treeEnabled||M(t.parent)!==void 0?We(Ve(g,qe())):void 0;Cr(g,t.tag,n);let S=Rt(g,o.resolvedStatus,o.effectiveOptions,i.typeRegistry,i.statusRegistry,i.runtimeFieldFilters,_?.parents_by_child),j=t.dependencyBlocked===!0?(()=>{let Xt=He(g,i.statusRegistry);return S.filter(Yt=>Xt.has(Yt.id.trim().toLowerCase()))})():S,me=Ot(j,s.sortField,s.sortOrder,i.statusRegistry),Wt=s.treeEnabled?Dt(me,s.parentRoot,s.treeDepth,_,g):me;d=Gr(Wt,t,i.projection,s.treeEnabled,Bt(o.filtersStatus,t,s,i.pmRoot))}let c=Se(),u=[...new Set(n)].sort((g,_)=>g.localeCompare(_)),p=pr(u,l!==null,t.strictRead===!0),y=i.projection.mode==="full"?null:[...i.projection.fields];if(i.projection.mode==="compact"&&t.compact===!0){let g=St({filtersStatus:o.filtersStatus,options:t,treeEnabled:s.treeEnabled,treeDepth:s.treeDepth,sortField:s.sortField,sortOrder:s.sortOrder,runtimeFieldFilters:i.runtimeFieldFilters});return{items:d.projected,count:d.projected.length,total:d.totalMatched,...d.pageExtras,completeness:p,filters:g,projection:{mode:"compact",fields:y},...u.length>0?{warnings:u}:{}}}return{items:d.projected,count:d.projected.length,total:d.totalMatched,...d.pageExtras,completeness:p,filters:zr({filtersStatus:o.filtersStatus,options:t,noTruncate:a,treeEnabled:s.treeEnabled,treeDepth:s.treeDepth,sortField:s.sortField,sortOrder:s.sortOrder,runtimeFieldFilters:i.runtimeFieldFilters}),projection:{mode:i.projection.mode,fields:y},sorting:{sort:s.sortField??"default",order:s.sortField?s.sortOrder:"asc",...s.sortField===void 0&&!s.treeEnabled?{effective_keys:[["status_registry:nonterminal_before_terminal","asc"],["priority","asc"],["updated_at","desc"],["id","asc"]]}:{}},now:c,...u.length>0?{warnings:u}:{}}}var Qi={applyFilters:Rt,buildCompactListFilterSummary:St,buildContentFilterEcho:wt,buildGovernanceMissingFilterEcho:It,resolveContentFieldFilters:se,resolveMissingMetadataFilters:gt,compareBySortField:xt,compareDefaultSort:oe,compareNullableString:kt,compareNullableTimestamp:Kt,normalizeProjectionField:v,parseAssigneeFilter:Mt,parseFieldSelectors:Tt,parseIdsFilter:Et,parseOffset:ae,parseProjectionConfig:Ct,resolveListUpdatedAfter:vt,resolveListPageLimit:Ut,parseSortField:le,parseSortOrder:Lt,orderItemsAsTree:Dt,projectListItems:de,readListFieldValue:Nt,runtimeMetadataKeysForProjection:Pt,sortItems:Ot,trimNonEmpty:M,withTreeMetadata:ne};(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]="59842825-3a81-53f4-845d-db2257ec6286")}catch{}})();async function un(e){let t=b(process.cwd(),e);await C(t);let r=await w(t),i=I(r,F());return{pmRoot:t,settings:r,typeRegistry:i}}async function Gt(e,t,r,i){N(e,q(t));let n=await Ge(e,t,r.id_prefix,r.item_format,i);if(n)return{id:n.id,historyPath:N(e,n.id),located:n};let s=De(t,r.id_prefix),o=q(t),a=s===o?[s]:[s,o];for(let l of a){let d=N(e,l);if(await pe(d))return{id:l,historyPath:d,located:null}}throw new f(`Item ${t} not found`,m.NOT_FOUND)}(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]="eb2e6046-156c-56ee-a03a-ecaa1cccfb45")}catch{}})();function Rn(e,t){let r=Re(e),i=e.length>0?e[e.length-1].after_hash:Me(),n=t===void 0||r.item_hash_version===void 0?void 0:Le(t,r.item_hash_version,Fe(e.at(-1)?.hash_algorithm)),s=t===void 0?void 0:n===void 0?Ce(t):n[Math.max(0,n.indexOf(i))],o=s===void 0?void 0:s===i,a=[...r.errors];return o===!1&&a.push("verify_failed:current_item_hash_mismatch"),{ok:a.length===0,entries:e.length,errors:a,latest_after_hash:e.length>0?e[e.length-1].after_hash:void 0,current_item_hash:s,current_matches_latest:o}}async function Dn(e,t,r={}){let i=b(r.cwd??process.cwd(),r.pmRoot);await C(i);let n=await w(i),s=I(n,F()),o=await Gt(i,e,n,s.type_to_folder),a=await Te(o.historyPath,o.id);if(a.length===0)throw new f(`No history exists for ${o.id}; point-in-time reads are unavailable.`,m.NOT_FOUND);let l=Pe(t,a),d=je(Ue(a,l.historyIndex),l),c=Ae(d,{schema:n.schema});if(c.metadata.id!==o.id)throw new f(`History target resolved to item ${c.metadata.id}, expected ${o.id}.`,m.GENERIC_FAILURE);let u=a[l.historyIndex],p=Ne(a,!0);return{document:c,reconstructed:!0,as_of_version:p===null?null:p+l.historyIndex+1,as_of_timestamp:u.ts,target:l,history_length:a.length}}(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]="e524f0ad-faad-5d89-b8f5-1283979919ad")}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]="67d97df8-6551-52ed-9307-8b573a087831")}catch{}})();var U=1e6;function ce(e,t=U,r=.8,i=!1){let n=new Set,s=(c,u)=>{if(n.add(`${c}:${u}`),n.size>t)throw new f(`Duplicate sweep exceeded ${t} candidate pairs; narrow it with statuses or since.`,m.CONFLICT,{code:"duplicate_sweep_cost_limit",required:"Narrow the duplicate query or increase its similarity threshold. No partial result was returned."})};if(i||r===0){for(let c=0;c<e.length;c+=1)for(let u=0;u<c;u+=1)s(u,c);return n}let o=new Map;for(let{prepared:c}of e)for(let u of c.tokens)o.set(u,(o.get(u)??0)+1);let a=new Map,l=new Map,d=new Map;for(let[c,{prepared:u}]of e.entries()){let p=[...u.tokens].sort((_,S)=>o.get(_)-o.get(S)||_.localeCompare(S)),y=p.length-Math.ceil(r*p.length-1e-12)+1,g=[{index:a,keys:[u.normalized],lengthFilter:!1},{index:l,keys:r<=.99?u.issueCodes:[],lengthFilter:!1},{index:d,keys:p.length===0?[""]:p.slice(0,y),lengthFilter:!0}];for(let _ of g)Hr(e,c,_,r,s)}return n}function Hr(e,t,r,i,n){let s=e[t].prepared.tokens.length;for(let o of r.keys){let a=r.index.get(o)??[];for(let l of a){let d=e[l].prepared.tokens.length;r.lengthFilter&&Math.min(d,s)/Math.max(d,s)+1e-12<i||n(l,t)}a.push(t),r.index.set(o,a)}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a5f450bd-8970-5b1b-8250-b76b7818e6e1")}catch{}})();var qr=3,$t=20,Vr=.8,Wr=100,zt=1e3;function ss(e){return e===void 0?[]:[`likely_duplicates:${e.result.items.map(t=>t.id).join(",")}`,`likely_duplicate_recovery:${e.recovery.action}:${e.recovery.item_id}`]}async function Xr(e,t){let r=e.items[0],i=b(t.cwd??process.cwd(),t.pmRoot),n=A((await w(i)).schema);return T(r.status,n)?{action:"reopen",item_id:r.id,command:`pm item reopen ${r.id} "<recurrence reason>"`,args:["item","reopen",r.id,"<recurrence reason>"]}:{action:"reuse",item_id:r.id,command:`pm get ${r.id} --full`,args:["get",r.id,"--full"]}}function ue(e){let t=e.limit??qr,r=e.threshold??Vr;if(!Number.isSafeInteger(t)||t<0||t>$t)throw new f(`Similarity limit must be an integer from 0 to ${$t}.`,m.USAGE);if(!Number.isFinite(r)||r<0||r>1)throw new f("Similarity threshold must be a number from 0 to 1.",m.USAGE);return{limit:t,threshold:r}}function Ht(e){let t=e.limit??Wr;if(!Number.isSafeInteger(t)||t<0||t>zt)throw new f(`Duplicate cluster limit must be an integer from 0 to ${zt}.`,m.USAGE);let r=e.since===void 0?void 0:new Date(e.since);if(r&&Number.isNaN(r.getTime()))throw new f("Duplicate cluster --since must be a valid ISO timestamp.",m.USAGE);return{limit:t,since:r}}async function Yr(e,t){let r=b(e.cwd??process.cwd(),e.pmRoot),i=await w(r),n=I(i),s=e.statuses?.map(u=>u.trim().toLowerCase()).filter(Boolean);if(e.statuses!==void 0&&s?.length===0)throw new f("Duplicate cluster statuses must include at least one lifecycle status or all.",m.USAGE);let o=A(i.schema),a=s?.map(u=>{if(u==="all")return u;let p=Ee(u,o);if(!p)throw new f(`Unknown duplicate-cluster status "${u}". Allowed: all, ${o.definitions.map(y=>y.id).join(", ")}.`,m.USAGE);return p}),l=a?.includes("all")===!0;if(l&&a?.some(u=>u!=="all"))throw new f('The "all" status cannot be combined with other statuses.',m.USAGE);let d=l?void 0:a,c=d?new Set(d):void 0;return{items:(await k(r,i.item_format,n.type_to_folder,void 0,i.schema)).filter(u=>(!c||c.has(u.status))&&(!t||new Date(u.created_at).getTime()>=t.getTime())),statuses:d}}var os={buildDuplicateClusters:Vt,collectDuplicateCandidatePairs:ce,createDuplicateUnionFind:qt};function qt(e){let t=Array.from({length:e},(r,i)=>i);return{parent:t,findRoot:r=>{let i=r;for(;t[i]!==i;)i=t[i];for(;t[r]!==r;){let n=t[r];t[r]=i,r=n}return i}}}function Qr(e,t,r,i){let n=[];for(let s of t){let[o,a]=s.split(":").map(u=>Number.parseInt(u,10)),l=J(e[o].prepared,e[a].prepared);if(l.score<r)continue;let d=i.findRoot(o),c=i.findRoot(a);d!==c&&(i.parent[c]=d),n.push({left_id:e[o].item.id,right_id:e[a].item.id,...l})}return n}function Vt(e,t,r,i){let n=new Map;for(let a of e.keys()){let l=r.findRoot(a),d=n.get(l)??[];d.push(a),n.set(l,d)}let s=new Map(e.map(({item:a},l)=>[a.id,r.findRoot(l)])),o=new Map;for(let a of t){let l=s.get(a.left_id),d=o.get(l)??[];d.push(a),o.set(l,d)}return[...n.values()].filter(a=>a.length>1).map(a=>{let l=(o.get(r.findRoot(a[0]))??[]).sort((d,c)=>c.score-d.score||d.left_id.localeCompare(c.left_id)||d.right_id.localeCompare(c.right_id));return{id:e[a[0]].item.id,items:a.map(d=>{let c=e[d].item;return{id:c.id,title:c.title,status:c.status,type:c.type}}),matches:l,max_score:l[0]?.score??0}}).sort((a,l)=>l.max_score-a.max_score||a.id.localeCompare(l.id)).slice(0,i)}function Jr(e,t,r,i,n){return t.filter(s=>!r.has(s.id)).map(s=>({id:s.id,title:s.title,status:s.status,type:s.type,...Q(e,s.title)})).filter(s=>s.score>=i).sort((s,o)=>o.score-s.score||s.id.localeCompare(o.id)).slice(0,n)}async function Zr(e,t={}){let r=e.title.trim();if(r.length===0)throw new f("Similarity candidate title must not be empty.",m.USAGE);let{limit:i,threshold:n}=ue(t),s=b(t.cwd??process.cwd(),t.pmRoot),o=await w(s),a=I(o),l=await D(s,Object.values(a.type_to_folder)),d=X(r),c=l&&d.length>0?await W({pmRoot:s,expectedSourceCursor:l.source_cursor,query:d.map(y=>`"${y.replaceAll('"','""')}"`).join(" OR "),limit:Math.max(i*10,50)}):null,u=c===null?await k(s,o.item_format,a.type_to_folder,void 0,o.schema):c.items,p=Jr(r,u,new Set(e.excludeIds??[]),n,i);return{items:p,count:p.length,threshold:n,source:c?"persistent_index":"metadata_fallback"}}function ei(e,t={}){let{threshold:r}=ue({...t,limit:void 0}),{limit:i}=Ht(t),n=new Set;for(let c of e){if(!c.id.trim()||n.has(c.id))throw new f("Duplicate analysis requires unique non-empty item ids.",m.USAGE);n.add(c.id)}let s=[...e].sort((c,u)=>c.id.localeCompare(u.id)).map(c=>({item:c,prepared:Y(c.title)})),o=ce(s,U,r,t.exhaustive===!0),a=qt(s.length),l=Qr(s,o,r,a),d=Vt(s,l,a,i);return{clusters:d,count:d.length,threshold:r,cost:{item_count:s.length,algorithm:t.exhaustive===!0||r===0?"exhaustive":"prefix_exact",possible_pairs:s.length*(s.length-1)/2,pair_limit:U,recall_guarantee:"exact",candidate_pairs:o.size,scored_pairs:o.size}}}async function as(e={}){ue({...e,limit:void 0});let{since:t}=Ht(e),{items:r,statuses:i}=await Yr(e,t);return{...ei(r,e),source:"metadata_scan",filters:{statuses:i??null,since:e.since??null}}}async function ls(e,t){if(t.mode==="off")return;let r=await Zr(e,t);if(r.count===0)return;let i=await Xr(r,t),n=t.mode==="strict"&&t.allowDuplicate===!0;if(t.mode==="strict"&&!n){let s=r.items.map(a=>`${a.id} (${a.status}): ${a.title}`).join("; "),o=i.action==="reopen"?"Reopen the canonical item":"Reuse the canonical item";throw new f(`Likely duplicate item(s) found: ${s}. ${o} or pass --allow-duplicate with explicit intent.`,m.CONFLICT,{code:"likely_duplicate",required:`${o}, or explicitly acknowledge the duplicate with --allow-duplicate.`,recovery:{suggested_flags:["--allow-duplicate"],suggested_retry:i.command,suggested_retry_args:i.args}})}return{mode:t.mode,bypassed:n,result:r,recovery:i}}(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]="f091d0c3-f2a7-5d76-8656-4aebe82e9798")}catch{}})();function cs(e,t){let r=t??{};return e.filter(i=>r[i.id]!==i.updated_at).map(i=>i.id).sort((i,n)=>i.localeCompare(n))}export{P as a,Xe as b,oi as c,Z as d,K as e,Ye as f,Qe as g,rt as h,re as i,nt as j,pi as k,yi as l,at as m,lt as n,_i as o,gt as p,se as q,mt as r,ft as s,hr as t,wt as u,It as v,Yi as w,Qi as x,un as y,Gt as z,Rn as A,Dn as B,ss as C,os as D,Zr as E,ei as F,as as G,ls as H,cs as I};
2
- //# sourceMappingURL=chunk-3XGKBVJ3.js.map
@@ -1,2 +0,0 @@
1
- import{M as C,N as L,O as x,P as E,Q as B,R as U,S as M,X as j,a as Q,g as P,i as $,o as R,q as D,s as F}from"./chunk-WXLG7HZ5.js";import{E as ne,R as Y,c as z,h as k,t as ee,u as te,w as S,x as re}from"./chunk-YVLAP3BL.js";import{ia as T}from"./chunk-HUXZCPWT.js";import{A as y,z as m}from"./chunk-G6ERMFJ5.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]="39aa8f48-11f9-528b-b5a2-ff4272a6b644")}catch{}})();var Te={create:'client.create({ type: "Task", title: "Example", createMode: "progressive" })',update:'client.update(id, { estimatedMinutes: "45", force: false })',append:'client.append(id, "Body text")',reopen:'client.reopen(id, "The work recurred", { expectedResult: "Verified recovery" })'};function b(e,t,r){let n=`${e} ${t} must be ${r}.`;throw new y(n,m.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",field:t,changed:!1,required:n,examples:[Te[e]]})}function w(e,t,r){typeof e!="string"&&b(t,r,"a string")}function J(e,t){(e===null||typeof e!="object"||Array.isArray(e))&&b(t,"options","an object")}function ie(e,t){(e==="append"||e==="update")&&t.id!==void 0&&w(t.id,e,"id"),e==="item-reopen"&&(t.id!==void 0&&w(t.id,"reopen","id"),t.reason!==void 0&&w(t.reason,"reopen","reason"),t.options!==void 0&&ve(t.options))}function at(e){J(e,"append");for(let t of["body","author","message"])e[t]!==void 0&&w(e[t],"append",t);e.force!==void 0&&typeof e.force!="boolean"&&b("append","force","a boolean")}function ve(e){J(e,"reopen");for(let t of j["item-reopen"].optional){let r=e[t];r!==void 0&&(T(Reflect.get(C,t)).type==="boolean"?typeof r!="boolean"&&b("reopen",t,"a boolean"):w(r,"reopen",t))}}function _e(e,t){return e?t?"a string or string array":"a string array":"a string"}function Re(e,t,r,n,s,a){r===void 0||typeof r=="string"&&(!s||a)||n==="priority"&&typeof r=="number"&&Number.isFinite(r)||s&&Array.isArray(r)&&Array.from(r).every(i=>typeof i=="string")||b(e,t,_e(s,a))}function Ce(e,t,r){let n=e==="create"?D:F;for(let{param:s}of[...n,...R,{param:"force"}]){if(T(Reflect.get(C,s)).type!=="boolean")continue;let a=r.find(i=>i.keys.includes(s))?.keys??[s];for(let i of a)t[i]!==void 0&&typeof t[i]!="boolean"&&b(e,i,"a boolean")}}function W(e,t,r=!0,n=!1){let s=e==="create"?L:B;for(let{target:a,keys:i,repeatable:l}of s)if(T(Reflect.get(C,a)).type!=="boolean")for(let f of i){let g=n&&f!==a,Oe=l===!0&&(a!=="acceptanceCriteria"||g);Re(e,f,t[f],a,Oe,r||g)}Ce(e,t,s)}function ot(e,t){J(t,e);let r=ee(t);return W(e,r,!1,k(r)),r}import{Option as Et}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]="201134b5-01e8-55ae-a099-137b9b6fae92")}catch{}})();function A(e,t,r){if(typeof r!="string")return;let n=r.trim();n.length!==0&&e.push(t,n)}function p(e,t,r){r===!0&&e.push(t)}function v(e,t,r){if(Array.isArray(r))for(let n of r){if(typeof n!="string")continue;let s=n.trim();s.length!==0&&e.push(t,s)}}function Se(e,t){let r=["test",e,"--run","--json","--progress"];return v(r,"--add",t.add),v(r,"--add-json",t.addJson),v(r,"--remove",t.remove),v(r,"--remove-index",Array.isArray(t.removeIndex)?t.removeIndex.map(n=>typeof n=="number"?String(n):n):t.removeIndex),A(r,"--match",t.match),A(r,"--only-index",typeof t.onlyIndex=="number"?String(t.onlyIndex):t.onlyIndex),p(r,"--only-last",t.onlyLast),v(r,"--measure",t.measure),A(r,"--metric-below",t.metricBelow),A(r,"--metric-diff",t.metricDiff),be(r,t),A(r,"--author",t.author),A(r,"--message",t.message),p(r,"--force",t.force),r}function be(e,t){A(e,"--timeout",t.timeout),v(e,"--env-set",t.envSet),v(e,"--env-clear",t.envClear),p(e,"--shared-host-safe",t.sharedHostSafe),A(e,"--pm-context",t.pmContext),p(e,"--override-linked-pm-context",t.overrideLinkedPmContext),A(e,"--workspace-context",t.workspaceContext),p(e,"--override-linked-workspace-context",t.overrideLinkedWorkspaceContext),p(e,"--allow-untrusted-linked-tests",t.allowUntrustedLinkedTests),p(e,"--fail-on-context-mismatch",t.failOnContextMismatch),p(e,"--fail-on-skipped",t.failOnSkipped),p(e,"--fail-on-empty-test-run",t.failOnEmptyTestRun),p(e,"--require-assertions-for-pm",t.requireAssertionsForPm),p(e,"--check-context",t.checkContext),p(e,"--auto-pm-context",t.autoPmContext)}(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]="744840e4-d430-54d3-b681-7244a58d86cb")}catch{}})();function ae(e,t){let r=[],n=new Set;for(let s of t.keys){if(!Object.hasOwn(e,s))continue;let a=e[s];if(a!=null){if(typeof a=="string"){r.push(a);continue}if(!Array.isArray(a)||!a.every(i=>typeof i=="string"))return;n.has(a)||(n.add(a),r.push(...a))}}return r.length>0?r.join("; "):void 0}function _(e,t){return e.find(r=>r.target===t)??{target:t,keys:[t]}}function o(e,t){return e[t]===!0?!0:void 0}function h(e,t){return e[t]===!1?!0:void 0}function V(e,t){return t.some(r=>e[r]===!0)?!0:void 0}function K(e,t){for(let[r,n]of Object.entries(t))r==="__proto__"||r==="constructor"||r==="prototype"||Object.hasOwn(e,r)||(e[r]=n)}function oe(e,t={}){let r=i=>P(e,_(x,i)),n=i=>$(e,_(E,i)),s=r("type");if(t.requireType!==!1&&s===void 0)throw new y("Missing required option --type <value>. Why required: create resolves runtime schema fields/workflow from item type. Retry: add --type <built-in or configured custom type> (example: --type Task).",m.USAGE);let a={title:r("title"),description:r("description"),type:s,template:r("template"),createMode:r("createMode"),schedulePreset:r("schedulePreset"),status:r("status"),closeReason:r("closeReason"),completedAt:r("completedAt"),priority:r("priority"),tags:r("tags"),addTags:n("addTags"),body:r("body"),deadline:r("deadline"),estimatedMinutes:r("estimatedMinutes"),acceptanceCriteria:ae(e,_(E,"acceptanceCriteria")),definitionOfReady:r("definitionOfReady"),order:r("order"),rank:r("rank"),goal:r("goal"),objective:r("objective"),value:r("value"),impact:r("impact"),outcome:r("outcome"),whyNow:r("whyNow"),author:r("author"),message:r("message"),assignee:r("assignee"),parent:r("parent"),inheritFocus:e.inheritFocus,allowMissingParent:V(e,["allowMissingParent","allow_missing_parent"])===!0,allowUnresolvedDeps:V(e,["allowUnresolvedDeps","allow_unresolved_deps"])===!0,allowDuplicate:o(e,"allowDuplicate")===!0,reviewer:r("reviewer"),risk:r("risk"),confidence:r("confidence"),sprint:r("sprint"),release:r("release"),blockedBy:r("blockedBy"),blockedReason:r("blockedReason"),unblockNote:r("unblockNote"),reporter:r("reporter"),severity:r("severity"),environment:r("environment"),reproSteps:r("reproSteps"),resolution:r("resolution"),expectedResult:r("expectedResult"),actualResult:r("actualResult"),affectedVersion:r("affectedVersion"),fixedVersion:r("fixedVersion"),component:r("component"),regression:e.regression===!0?"true":r("regression"),customerImpact:r("customerImpact"),dep:n("dep"),comment:n("comment"),note:n("note"),learning:n("learning"),file:n("file"),test:n("test"),doc:n("doc"),reminder:n("reminder"),event:n("event"),typeOption:n("typeOption"),field:n("field"),unset:n("unset"),clearDeps:o(e,"clearDeps"),clearComments:o(e,"clearComments"),clearNotes:o(e,"clearNotes"),clearLearnings:o(e,"clearLearnings"),clearFiles:o(e,"clearFiles"),clearTests:o(e,"clearTests"),clearDocs:o(e,"clearDocs"),clearReminders:o(e,"clearReminders"),clearEvents:o(e,"clearEvents"),clearTypeOptions:o(e,"clearTypeOptions")};return K(a,e),S(e,a)}function se(e){let t=s=>P(e,_(U,s)),r=s=>$(e,_(M,s)),n={title:t("title"),description:t("description"),body:t("body"),status:t("status"),closeReason:t("closeReason"),priority:t("priority"),type:t("type"),tags:t("tags"),addTags:r("addTags"),removeTags:r("removeTags"),deadline:t("deadline"),estimatedMinutes:t("estimatedMinutes"),acceptanceCriteria:ae(e,_(M,"acceptanceCriteria")),addAc:r("addAc"),removeAc:r("removeAc"),definitionOfReady:t("definitionOfReady"),order:t("order"),rank:t("rank"),goal:t("goal"),objective:t("objective"),value:t("value"),impact:t("impact"),outcome:t("outcome"),whyNow:t("whyNow"),author:t("author"),message:t("message"),force:!!e.force,ownershipMetadataBypass:e.ownershipMetadataBypass===!0?!0:void 0,ownershipDependencyBypass:e.ownershipDependencyBypass===!0?!0:void 0,assignee:t("assignee"),parent:t("parent"),allowUnresolvedDeps:V(e,["allowUnresolvedDeps","allow_unresolved_deps"])===!0,reviewer:t("reviewer"),risk:t("risk"),confidence:t("confidence"),sprint:t("sprint"),release:t("release"),blockedBy:t("blockedBy"),blockedReason:t("blockedReason"),unblockNote:t("unblockNote"),reporter:t("reporter"),severity:t("severity"),environment:t("environment"),reproSteps:t("reproSteps"),resolution:t("resolution"),expectedResult:t("expectedResult"),actualResult:t("actualResult"),affectedVersion:t("affectedVersion"),fixedVersion:t("fixedVersion"),component:t("component"),regression:e.regression===!0?"true":t("regression"),customerImpact:t("customerImpact"),dep:r("dep"),depRemove:r("depRemove"),replaceDeps:o(e,"replaceDeps"),replaceTests:o(e,"replaceTests"),replaceFiles:o(e,"replaceFiles"),replaceDocs:o(e,"replaceDocs"),comment:r("comment"),note:r("note"),learning:r("learning"),file:r("file"),test:r("test"),doc:r("doc"),reminder:r("reminder"),event:r("event"),typeOption:r("typeOption"),field:r("field"),unset:r("unset"),clearDeps:o(e,"clearDeps"),clearComments:o(e,"clearComments"),clearNotes:o(e,"clearNotes"),clearLearnings:o(e,"clearLearnings"),clearFiles:o(e,"clearFiles"),clearTests:o(e,"clearTests"),clearDocs:o(e,"clearDocs"),clearReminders:o(e,"clearReminders"),clearEvents:o(e,"clearEvents"),clearTypeOptions:o(e,"clearTypeOptions")};return K(n,e),S(e,n)}function c(e,t){let r=_(Q,t),n=P(e,r);if(n!==void 0)return n;for(let s of r.keys){let a=e[s];if(Array.isArray(a)){let i=a.filter(l=>typeof l=="string");if(i.length>0)return i.join(",")}if(t==="ids"&&typeof a=="string")return a;if(typeof a=="number"&&Number.isFinite(a))return String(a)}}function Ne(e){let t=o(e,"filterFilesMissing"),r=o(e,"filterDocsMissing");return{filterReviewerMissing:o(e,"filterReviewerMissing"),filterRiskMissing:o(e,"filterRiskMissing"),filterConfidenceMissing:o(e,"filterConfidenceMissing"),filterSprintMissing:o(e,"filterSprintMissing"),filterReleaseMissing:o(e,"filterReleaseMissing"),hasNotes:o(e,"hasNotes"),hasLearnings:o(e,"hasLearnings"),hasFiles:o(e,"hasFiles"),hasDocs:o(e,"hasDocs"),hasTests:o(e,"hasTests"),hasComments:o(e,"hasComments"),hasDeps:o(e,"hasDeps"),hasBody:o(e,"hasBody"),hasLinkedCommand:o(e,"hasLinkedCommand"),noNotes:h(e,"notes"),noLearnings:h(e,"learnings"),noFiles:h(e,"files")??t,filterFilesMissing:t,noDocs:h(e,"docs")??r,filterDocsMissing:r,noTests:h(e,"tests"),noComments:h(e,"comments"),noDeps:h(e,"deps"),emptyBody:o(e,"emptyBody"),noLinkedCommand:h(e,"linkedCommand")}}function le(e){let t={status:c(e,"status"),type:c(e,"type"),tag:c(e,"tag"),priority:c(e,"priority"),deadlineBefore:c(e,"deadlineBefore"),deadlineAfter:c(e,"deadlineAfter"),updatedAfter:c(e,"updatedAfter"),updatedBefore:c(e,"updatedBefore"),createdAfter:c(e,"createdAfter"),createdBefore:c(e,"createdBefore"),today:o(e,"today"),recent:o(e,"recent"),ids:c(e,"ids"),assignee:c(e,"assignee"),assigneeFilter:c(e,"assigneeFilter"),parent:c(e,"parent"),sprint:c(e,"sprint"),release:c(e,"release"),limit:c(e,"limit"),offset:c(e,"offset"),noTruncate:h(e,"truncate"),includeBody:o(e,"includeBody"),strictRead:o(e,"strictRead"),compact:o(e,"compact"),brief:o(e,"brief"),full:o(e,"full"),fields:c(e,"fields"),sort:c(e,"sort"),order:c(e,"order"),tree:o(e,"tree"),treeDepth:c(e,"treeDepth"),filterAcMissing:o(e,"filterAcMissing"),filterEstimatesMissing:V(e,["filterEstimatesMissing","filterEstimateMissing"]),filterResolutionMissing:o(e,"filterResolutionMissing"),filterMetadataMissing:o(e,"filterMetadataMissing"),...Ne(e)};return K(t,e),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]="29b6b04b-c4f9-5b83-b7e3-5b88a91106e9")}catch{}})();var Ee=Symbol("pm.mcp-mutation-transport"),Me=new Set(["create","update","append"]),q={create:{parameters:D,aliases:L,strings:x,repeatables:E},update:{parameters:F,aliases:B,strings:U,repeatables:M}},ke=new Set(["activity","aggregate","context","contracts","deps","files-discover","files-lookup","get","graph","health","history","history-attest","list","next","search","stats","telemetry","validate"]);function I(e){return Ee in e}function H(e,t){return I(e)?te(t):S(e,t)}function Jt(e,t,r=[]){let n=S(e,{...e,...t});for(let s of r)Reflect.deleteProperty(n,s);return n}function d(e,t){let r=e[t];return typeof r=="string"&&r.trim().length>0?r:void 0}function u(e,t){let r=e[t];return typeof r=="string"?r.trim().length>0?r:void 0:typeof r=="number"&&Number.isFinite(r)?String(r):void 0}function Wt(e,t){let r=e[t];return typeof r=="string"?r:typeof r=="number"&&Number.isFinite(r)?String(r):void 0}function O(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Kt(e,t){if(typeof e=="number"){if(!Number.isInteger(e))throw new y(`${t} must be a finite integer.`,m.USAGE);return e}if(typeof e=="string"&&e.trim().length>0){let r=Number(e);if(!Number.isInteger(r))throw new y(`${t} must be a finite integer.`,m.USAGE);return r}}function Xt(e,t){return typeof e.limit=="number"&&Number.isFinite(e.limit)?e.limit:typeof t.limit=="number"&&Number.isFinite(t.limit)?t.limit:d(e,"limit")??d(t,"limit")}function Zt(e){let t=d(e,"outputFormat");return{json:!0,quiet:!0,author:d(e,"author"),path:d(e,"path"),noExtensions:e.noExtensions===!0||e.no_extensions===!0,noPager:!0,outputInclude:d(e,"outputInclude"),outputLimit:u(e,"outputLimit"),outputBudget:u(e,"outputBudget"),outputSession:d(e,"outputSession"),outputCursor:d(e,"outputCursor"),outputFormat:t==="json"||t==="toon"?t:void 0}}var ce=new Set(["tags","blockedBy","blocked_by","skills","fields"]),ue=new Set(["comment","note","learning","reminder","event","dep","depRemove","dep_remove","file","doc","test","unset","addGlob","add_glob","migrate","envSet","env_set","envClear","env_clear"]),we=new Set([...ue].filter(e=>e!=="file")),Ie=new Set(["files","files-discover","docs","test","test-all"]),fe=new Set(["comments","notes","learnings"]);function Pe(e,t){if(!(!fe.has(e)||!Object.prototype.hasOwnProperty.call(t,"file")))throw new y(`MCP ${e} does not accept options.file. Pass annotation text in options.add instead.`,m.USAGE,{code:"mcp_annotation_file_unavailable",required:"Pass annotation text as JSON data; MCP annotation actions cannot read server-local files."})}var De=new Set(["claim","release","start-task","pause-task","close-task"]),pe={history:["order"],"history-attest":["verify","output","hashAlgorithm"],list:["status","type","tag","priority","limit","offset"],search:["mode","status","type","tag","priority","limit"],create:["title","type","status","description","body","priority","tags","parent","createMode","create_mode","allowMissingParent","allowDuplicate","inheritFocus"],update:["parent","allowMissingParent","completedAt"],copy:["allowDuplicate"],close:["duplicateOf","completedAt","releaseAssignment"],claim:["start","next","ifAvailable"],release:["pause","handoff"],comments:["ifAbsent"],notes:["ifAbsent"],learnings:["ifAbsent"],extension:["dryRun","offline"],package:["dryRun","offline"],install:["dryRun"],upgrade:["scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"],append:["body"]},Fe=new Set(["context","get","list","next","search"]),Le=new Set(["query","keywords"]);function xe(e){return Fe.has(e)?j[e].optional.filter(t=>!Le.has(t)):[]}function Be(e,t){let r=t.replace(/[A-Z]/gu,n=>`_${n.toLowerCase()}`);return e[t]!==void 0||e[r]!==void 0}function Ue(e){return[...pe[e]??[],...xe(e),...me]}var me=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];function ye(e,t=""){let r={},n=Ie.has(t),s=t==="files"||t==="files-discover"||t==="docs",a=fe.has(t)?we:ue;for(let[i,l]of Object.entries(e)){if(Array.isArray(l)&&ce.has(i)){r[i]=l.join(",");continue}if(i==="note"&&s){r[i]=l;continue}if(typeof l=="string"&&a.has(i)){r[i]=[l];continue}if(typeof l=="string"&&n&&(i==="add"||i==="remove")){r[i]=[l];continue}r[i]=l}return Object.assign(r,Object.fromEntries(Object.getOwnPropertySymbols(e).map(i=>[i,Reflect.get(e,i)]))),r}function je(e,t,r){let n=d(e,"author");return n!==void 0?n:r!==void 0&&De.has(r)?d(e,"assignee")??d(t,"assignee"):void 0}function ze(e,t){return t!==void 0&&e.author===void 0?{...e,author:t}:e}function Ve(e,t,r){let n={},s=q[e],a=new Set([...s.parameters.map(({param:i})=>i),...R.map(({param:i})=>i),...pe[e],...me,"force"]);for(let i of a){let l=s.aliases.find(f=>f.keys.includes(i))?.keys??[i];t[i]===void 0||l.some(f=>r[f]!==void 0)||(n[i]=t[i])}return n}function N(e,t){throw new y(`Invalid MCP ${e} value for "${t}". No changes were made.`,m.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:t,required:`Provide valid ${e} field values and an options object; inspect the pm_${e} input schema for supported types.`})}function Ge(e,t,r){let n=q[e],s=[...n.parameters,...R,{param:"force"}];for(let{param:a}of s){if(T(C[a]).type!=="boolean")continue;let i=(n.aliases.find(l=>l.keys.includes(a))?.keys??[a]).find(l=>r[l]!==void 0&&typeof r[l]!="boolean");i!==void 0&&N(e,i)}for(let a of["idOnly","fullChangedFields"])t[a]!==void 0&&typeof t[a]!="boolean"&&N(e,a)}function He(e,t,r){t.options!==void 0&&!O(t.options)&&N(e,"options"),Ge(e,t,r);for(let i of ce){let l=r[i];Array.isArray(l)&&l.some(f=>typeof f!="string")&&N(e,i)}let n=he(r,e),s=q[e];for(let{keys:i,target:l}of s.strings)i.some(f=>r[f]!==void 0)&&n[l]===void 0&&N(e,l);let a=s.repeatables.flatMap(({keys:i})=>i).find(i=>{let l=r[i];return l!==void 0&&typeof l!="string"&&(!Array.isArray(l)||l.some(f=>typeof f!="string"))});return a!==void 0&&N(e,a),n}function qe(e,t,r,n){let s=(t==="create"||t==="update")&&I(e),a={...s?Ve(t,e,n):r,...n};return(t==="create"||t==="update")&&!s&&W(t,a,!0,O(e.options)&&k(e.options)),s?He(t,e,a):ye(a,t)}function $e(e,t){return!Me.has(e??"")||k(t)?t:ne(t)}function Qt(e,t){ie(t,e);let r=O(e.options)?e.options:void 0,n=T(e.options),s={},a=g=>{Be(n,g)||e[g]===void 0||(s[g]=e[g])};for(let g of Ue(t??""))a(g);t!==void 0&&I(e)&&Pe(t,n);let i=qe(e,t,s,n);if(t==="history-attest"&&I(e)&&(i.output!==void 0||typeof i.verify=="string"))throw new y("MCP history attest does not accept server-local proof paths. Export the returned JSON bundle and pass that JSON object as verify.",m.USAGE);let l=I(e)?e:r??e,f=H(l,ze(i,je(e,i,t)));return $e(t,f)}function er(e){if(e.addNote===void 0)return e;let t={...e};return t.note===void 0&&typeof t.addNote=="string"&&(t.note=t.addNote),delete t.addNote,t}function tr(e){let t={...e};return t.discoveryNote!==void 0&&t.note===void 0&&typeof t.discoveryNote=="string"&&(t.note=t.discoveryNote),delete t.discover,delete t.discoveryNote,t}function Ye(e){let t=[],r=!0;for(let n of e.trim().toLowerCase()){if(n>="a"&&n<="z"||n>="0"&&n<="9"){t.push(n),r=!1;continue}r||(t.push("-"),r=!0)}return t.at(-1)==="-"&&t.pop(),t.join("")}function rr(e){return!ke.has(Ye(e))}function nr(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean).join(" ")}function Je(e){return Array.isArray(e)?e.map(t=>String(t)).filter(t=>t.length>0):[]}function ir(e,t){let r=new Set(["action","args","author","cwd","fullChangedFields","id","options","path","query","reason","target"]),n={};for(let[a,i]of Object.entries(e))r.has(a)||(n[a]=i);let s={...n,...t};return delete s.args,delete s.author,s}function ar(e,t){let r=H(t??{},{...t});return{changedFields:e.fullChangedFields===!0?"full":"compact",idOnly:e.idOnly===!0,runnerOptions:r}}function Z(e){return{type:u(e,"filterType"),tag:u(e,"filterTag"),priority:u(e,"filterPriority"),deadlineBefore:u(e,"filterDeadlineBefore"),deadlineAfter:u(e,"filterDeadlineAfter"),updatedAfter:u(e,"filterUpdatedAfter"),updatedBefore:u(e,"filterUpdatedBefore"),createdAfter:u(e,"filterCreatedAfter"),createdBefore:u(e,"filterCreatedBefore"),ids:Y(e.ids),assignee:u(e,"filterAssignee"),assigneeFilter:u(e,"filterAssigneeFilter")??u(e,"filterAssignee_filter"),parent:u(e,"filterParent"),sprint:u(e,"filterSprint"),release:u(e,"filterRelease"),limit:u(e,"limit"),offset:u(e,"offset")}}function X(e){if(typeof e=="string"&&e.trim().length>0)return e;if(Array.isArray(e))return Je(e)}function G(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&e.trim().length>0)return e}function or(e){let t=X(e.kind),r=X(e.exemptIsolate),n=X(e.exemptIsolateType);return{...t===void 0?{}:{kind:t},maxDepth:G(e.maxDepth),limit:G(e.limit),after:d(e,"after"),direction:d(e,"direction"),maxPaths:G(e.maxPaths),sample:G(e.sample),...r===void 0?{}:{exemptIsolate:r},...n===void 0?{}:{exemptIsolateType:n},saveBaseline:e.saveBaseline===!0,rebuild:e.rebuild===!0,clear:e.clear===!0,summary:e.summary===!0,...e.full===!0?{full:!0}:{}}}function ge(e){let t=le(e);return e.ids!==void 0&&(t.ids=Y(e.ids)),t}function sr(e){return{status:d(e,"filterStatus"),list:O(e.list)?ge(e.list):Z(e),reason:d(e,"reason"),completedAt:d(e,"completedAt")??d(e,"completed_at"),resolution:d(e,"resolution"),expectedResult:d(e,"expectedResult")??d(e,"expected_result")??d(e,"expected"),actualResult:d(e,"actualResult")??d(e,"actual_result")??d(e,"actual"),validateClose:d(e,"validateClose")??d(e,"validate_close"),author:d(e,"author"),message:d(e,"message"),force:e.force===!0?!0:void 0,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:z(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}var We=new Set(["filterStatus","filterType","filterTag","filterPriority","filterDeadlineBefore","filterDeadlineAfter","filterUpdatedAfter","filterUpdatedBefore","filterCreatedAfter","filterCreatedBefore","filterAssignee","filterAssigneeFilter","filterAssignee_filter","filterParent","filterSprint","filterRelease","ids","list","update","limit","offset","dryRun","dry_run","rollback","checkpoint","noCheckpoint","no_checkpoint"]);function de(e){let t={};for(let[r,n]of Object.entries(e))We.has(r)||(t[r]=n);return Ae(t)}function Ae(e){return he(e,"update")}function he(e,t){let r=ye(e,t),n=q[t],s=new Set([...n.parameters,...R].filter(({booleanish:a})=>a===!0).map(({param:a})=>a));for(let{keys:a}of n.repeatables)for(let i of a)typeof r[i]=="string"&&(r[i]=[r[i]]);for(let a of n.strings)for(let i of a.keys){let l=r[i];(typeof l=="number"&&Number.isFinite(l)||l===!1&&s.has(i))&&(r[i]=String(l))}return t==="create"?{...oe(r,{requireType:!1})}:se(r)}function lr(e){if(O(e.list)||O(e.update)){let t=O(e.update)?e.update:de(e),r=H(e,Ae(t));return{status:u(e,"filterStatus"),list:O(e.list)?ge(e.list):Z(e),update:re(t,r),dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:z(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}return{status:u(e,"filterStatus"),list:Z(e),update:H(e,de(e)),dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:z(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}export{w as a,J as b,at as c,ve as d,ot as e,Se as f,I as g,Jt as h,d as i,u as j,Wt as k,O as l,Kt as m,Xt as n,Zt as o,pe as p,ye as q,Qt as r,er as s,tr as t,Ye as u,rr as v,nr as w,Je as x,ir as y,ar as z,Z as A,or as B,sr as C,Ae as D,lr as E};
2
- //# sourceMappingURL=chunk-4HY6EGPB.js.map
@@ -1,2 +0,0 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bfaa3455-3237-5c98-8ef4-b353ce9530fe")}catch{}})();var o=Object.freeze({rows:10,paths:5,samples:10,path_depth:8,visited_paths:1e4});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e216fd39-09ee-5a04-b0b5-44f518db4f93")}catch{}})();function s(e){let n=e?.trim()??"";return/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(n)||/^(?:github|gitlab|jira|linear):/iu.test(n)}function d(e){let n=e?.trim().toLowerCase();return n==="global"||n==="external"}export{o as a,s as b,d as c};
2
- //# sourceMappingURL=chunk-AK2CI2GI.js.map