@unbrained/pm-cli 2026.8.21 → 2026.8.23

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 (228) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +44 -0
  3. package/dist/cli/error-guidance.d.ts +22 -4
  4. package/dist/cli/error-guidance.js +73 -16
  5. package/dist/cli/main.d.ts +3 -0
  6. package/dist/cli/main.js +51 -9
  7. package/dist/cli/register-mutation.js +6 -6
  8. package/dist/cli/register-operations.d.ts +73 -0
  9. package/dist/cli/register-operations.js +39 -14
  10. package/dist/cli/register-setup.js +3 -3
  11. package/dist/cli/schema-registration-helpers.d.ts +8 -1
  12. package/dist/cli/schema-registration-helpers.js +14 -5
  13. package/dist/cli-bundle/bundle-manifest.json +149 -149
  14. package/dist/cli-bundle/chunks/chunk-3ENVHX6C.js +36 -0
  15. package/dist/cli-bundle/chunks/{chunk-LOVTQ52Z.js → chunk-DW2CGEMU.js} +2 -2
  16. package/dist/cli-bundle/chunks/chunk-EG6CLDZT.js +5 -0
  17. package/dist/cli-bundle/chunks/{chunk-LARJJ3RK.js → chunk-F3AI2JFL.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-N3DSV4CH.js → chunk-HWZ6CELB.js} +8 -8
  19. package/dist/cli-bundle/chunks/chunk-HZBMLSZI.js +201 -0
  20. package/dist/cli-bundle/chunks/chunk-JB4KZWBF.js +3 -0
  21. package/dist/cli-bundle/chunks/chunk-KPH73XXJ.js +2 -0
  22. package/dist/cli-bundle/chunks/{chunk-BKYB45NQ.js → chunk-KXPMB2YL.js} +50 -50
  23. package/dist/cli-bundle/chunks/{chunk-BUNIEJNE.js → chunk-QDVHNHAQ.js} +2 -2
  24. package/dist/cli-bundle/chunks/chunk-TFI5V5N2.js +13 -0
  25. package/dist/cli-bundle/chunks/{register-list-query-F57EWDEF.js → register-list-query-UJB5FMV2.js} +2 -2
  26. package/dist/cli-bundle/chunks/register-mutation-NX5XE4VX.js +20 -0
  27. package/dist/cli-bundle/chunks/register-operations-RXIJIYXC.js +2 -0
  28. package/dist/cli-bundle/chunks/{register-setup-HXU7IZZD.js → register-setup-GFUZEKRE.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-F4YEW5I2.js → chunk-37Z4OEAP.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/chunk-3UPTYG44.js +8 -0
  31. package/dist/cli-bundle/focused-chunks/chunk-5S7E72FY.js +16 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-4ERLO7QD.js → chunk-AUFH5H35.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-E7X25GC3.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-FQCSTBWE.js +4 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-FH6DYED3.js → chunk-FZS4H32O.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-IFLWKY2R.js +156 -0
  37. package/dist/cli-bundle/focused-chunks/{chunk-YKBKIEAJ.js → chunk-JOWDB2MH.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-LYVSW5VM.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-MRCNF3U6.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-UZE7XUZK.js → chunk-OFVUGTLJ.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-FJ22HNRP.js → chunk-OGLQBL46.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/chunk-OY7QAV4Y.js +51 -0
  43. package/dist/cli-bundle/focused-chunks/chunk-QGFNI65N.js +26 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-KDNG7TKQ.js → chunk-R27IDGHD.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/chunk-UYRFYCDQ.js +5 -0
  46. package/dist/cli-bundle/focused-chunks/{chunk-2NIY5NKG.js → chunk-ZHVA42R5.js} +9 -9
  47. package/dist/cli-bundle/main.js +13 -13
  48. package/dist/cli-bundle/sdk-authoring.js +1 -1
  49. package/dist/cli-bundle/sdk-contracts.js +2 -2
  50. package/dist/cli-bundle/sdk-core.js +40 -40
  51. package/dist/cli-bundle/sdk-governance.js +1 -1
  52. package/dist/cli-bundle/sdk-graph.js +1 -1
  53. package/dist/cli-bundle/sdk-merge.js +33 -32
  54. package/dist/cli-bundle/sdk-query.js +1 -1
  55. package/dist/cli-bundle/sdk-runtime.js +1 -1
  56. package/dist/cli-bundle/sdk-testing.js +1 -1
  57. package/dist/cli-bundle/sdk.js +5 -5
  58. package/dist/core/config/nested-settings.js +8 -2
  59. package/dist/core/config/positional-value.d.ts +1 -1
  60. package/dist/core/config/positional-value.js +5 -2
  61. package/dist/core/extensions/extension-hook-runtime.js +22 -20
  62. package/dist/core/extensions/extension-types.d.ts +8 -1
  63. package/dist/core/extensions/extension-types.js +2 -2
  64. package/dist/core/extensions/loader.js +7 -3
  65. package/dist/core/extensions/service-ownership.d.ts +8 -0
  66. package/dist/core/extensions/service-ownership.js +20 -0
  67. package/dist/core/history/history.js +3 -3
  68. package/dist/core/item/id.js +20 -5
  69. package/dist/core/item/item-format.js +81 -2
  70. package/dist/core/reproducibility/context.d.ts +4 -0
  71. package/dist/core/reproducibility/context.js +14 -8
  72. package/dist/core/shared/author.d.ts +55 -1
  73. package/dist/core/shared/author.js +333 -16
  74. package/dist/core/shared/constants.js +3 -2
  75. package/dist/core/shared/errors.d.ts +4 -0
  76. package/dist/core/shared/errors.js +2 -2
  77. package/dist/core/store/settings-validator.d.ts +1 -0
  78. package/dist/core/store/settings-validator.js +6 -3
  79. package/dist/core/store/settings.js +5 -2
  80. package/dist/mcp/server.d.ts +1 -1
  81. package/dist/mcp/server.js +30 -9
  82. package/dist/sdk/agent/identity-config.d.ts +63 -0
  83. package/dist/sdk/agent/identity-config.js +107 -0
  84. package/dist/sdk/agent/refusal-corpus-contracts.d.ts +76 -0
  85. package/dist/sdk/agent/refusal-corpus-contracts.js +194 -0
  86. package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
  87. package/dist/sdk/authoring.d.ts +1 -1
  88. package/dist/sdk/authoring.js +2 -2
  89. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +77 -0
  90. package/dist/sdk/cli-contracts/agent-output-contracts.js +326 -2
  91. package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -3
  92. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -0
  93. package/dist/sdk/cli-contracts/enum-contracts.js +9 -2
  94. package/dist/sdk/cli-contracts/flag-contracts.js +9 -2
  95. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +4 -4
  96. package/dist/sdk/cli-contracts/registration-helpers.js +5 -2
  97. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
  98. package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
  99. package/dist/sdk/cli-contracts/tool-parameter-tables.js +22 -2
  100. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  101. package/dist/sdk/cli-contracts/tool-schema.js +14 -3
  102. package/dist/sdk/cli-contracts.d.ts +4 -4
  103. package/dist/sdk/cli-contracts.js +5 -5
  104. package/dist/sdk/config.d.ts +6 -1
  105. package/dist/sdk/config.js +119 -14
  106. package/dist/sdk/context-intent-contracts.js +4 -2
  107. package/dist/sdk/core-governance.d.ts +1 -1
  108. package/dist/sdk/core-governance.js +3 -3
  109. package/dist/sdk/extension/install-sources.d.ts +1 -1
  110. package/dist/sdk/extension/install-sources.js +6 -3
  111. package/dist/sdk/extension/output-ownership.d.ts +1 -0
  112. package/dist/sdk/extension/output-ownership.js +3 -2
  113. package/dist/sdk/extension/scaffold.js +11 -5
  114. package/dist/sdk/flag-invocation-contracts.js +4 -2
  115. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +74 -2
  116. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +87 -26
  117. package/dist/sdk/governance/assurance-action.js +30 -10
  118. package/dist/sdk/governance/health.d.ts +3 -0
  119. package/dist/sdk/governance/health.js +39 -7
  120. package/dist/sdk/governance/hierarchy-validation.d.ts +29 -0
  121. package/dist/sdk/governance/hierarchy-validation.js +109 -0
  122. package/dist/sdk/governance/validate.d.ts +3 -9
  123. package/dist/sdk/governance/validate.js +84 -111
  124. package/dist/sdk/graph/assembly.d.ts +6 -1
  125. package/dist/sdk/graph/assembly.js +16 -22
  126. package/dist/sdk/graph/governance-contracts.d.ts +1 -1
  127. package/dist/sdk/graph/governance-contracts.js +8 -2
  128. package/dist/sdk/graph/governance.js +46 -2
  129. package/dist/sdk/graph/hierarchy-integrity.d.ts +94 -0
  130. package/dist/sdk/graph/hierarchy-integrity.js +311 -0
  131. package/dist/sdk/graph/index.d.ts +2 -1
  132. package/dist/sdk/graph/index.js +3 -2
  133. package/dist/sdk/graph/remediation.js +32 -2
  134. package/dist/sdk/graph/run.d.ts +31 -2
  135. package/dist/sdk/graph/run.js +80 -31
  136. package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +8 -0
  137. package/dist/sdk/graph/workspace-relationship-kind-registry.js +28 -0
  138. package/dist/sdk/index.d.ts +8 -3
  139. package/dist/sdk/index.js +9 -4
  140. package/dist/sdk/item-children.js +21 -8
  141. package/dist/sdk/lifecycle/create.js +129 -97
  142. package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +15 -0
  143. package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +25 -0
  144. package/dist/sdk/lifecycle/update.d.ts +2 -0
  145. package/dist/sdk/lifecycle/update.js +174 -84
  146. package/dist/sdk/merge/three-way.js +105 -26
  147. package/dist/sdk/query/complete-list.d.ts +3 -3
  148. package/dist/sdk/query/complete-list.js +46 -3
  149. package/dist/sdk/query/list.d.ts +4 -3
  150. package/dist/sdk/query/list.js +89 -49
  151. package/dist/sdk/read-output-budget.d.ts +21 -0
  152. package/dist/sdk/read-output-budget.js +39 -2
  153. package/dist/sdk/read-output-contracts.d.ts +10 -4
  154. package/dist/sdk/read-output-contracts.js +105 -32
  155. package/dist/sdk/relationship-context.js +3 -4
  156. package/dist/sdk/relationships.js +17 -10
  157. package/dist/sdk/reproducibility/process.d.ts +19 -0
  158. package/dist/sdk/reproducibility/process.js +88 -0
  159. package/dist/sdk/runtime-primitives.d.ts +1 -1
  160. package/dist/sdk/runtime-primitives.js +3 -3
  161. package/dist/sdk/runtime.d.ts +3 -2
  162. package/dist/sdk/runtime.js +7 -5
  163. package/dist/sdk/test/batch.d.ts +6 -0
  164. package/dist/sdk/test/batch.js +26 -6
  165. package/dist/sdk/test/entry.d.ts +1 -1
  166. package/dist/sdk/test/entry.js +3 -2
  167. package/dist/sdk/test/execution.d.ts +28 -3
  168. package/dist/sdk/test/execution.js +201 -34
  169. package/dist/sdk/test/parsers.d.ts +6 -0
  170. package/dist/sdk/test/parsers.js +21 -2
  171. package/dist/sdk/test/trust.d.ts +33 -0
  172. package/dist/sdk/test/trust.js +207 -0
  173. package/dist/types.d.ts +34 -0
  174. package/dist/types.js +2 -2
  175. package/docs/AGENT_PROVENANCE_ADR.md +41 -5
  176. package/docs/AGENT_UX_CONTRACTS.md +20 -4
  177. package/docs/COMMANDS.md +29 -14
  178. package/docs/CONFIGURATION.md +4 -0
  179. package/docs/DEPENDENCY_KIND_CONTRACT.md +31 -3
  180. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +115 -0
  181. package/docs/EXTENSIONS.md +2 -1
  182. package/docs/MERGE_SAFETY.md +15 -1
  183. package/docs/README.md +1 -0
  184. package/docs/READ_OUTPUT_CONTRACTS.md +19 -2
  185. package/docs/RELATIONSHIP_GRAPH.md +6 -3
  186. package/docs/REPRODUCIBLE_WORKSPACES.md +42 -8
  187. package/docs/SDK.md +9 -0
  188. package/docs/SDK_AGENT_SESSION_CONTEXT.md +6 -4
  189. package/docs/SDK_EVIDENCE_TRACEABILITY.md +1 -1
  190. package/docs/TESTING.md +83 -1
  191. package/docs/agent-task-token-baseline.json +2 -2
  192. package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
  193. package/marketplace.json +2 -2
  194. package/package.json +2 -2
  195. package/packages/pm-beads/package.json +1 -1
  196. package/packages/pm-calendar/package.json +1 -1
  197. package/packages/pm-command-kit/package.json +1 -1
  198. package/packages/pm-digital-twin/package.json +1 -1
  199. package/packages/pm-governance-audit/package.json +1 -1
  200. package/packages/pm-guide-shell/package.json +1 -1
  201. package/packages/pm-kanban/package.json +1 -1
  202. package/packages/pm-lifecycle-hooks/package.json +1 -1
  203. package/packages/pm-linked-test-adapters/package.json +1 -1
  204. package/packages/pm-search-advanced/package.json +1 -1
  205. package/packages/pm-templates/package.json +1 -1
  206. package/packages/pm-todos/package.json +1 -1
  207. package/packages/pm-vcs/package.json +1 -1
  208. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  209. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  210. package/sdk/public-surface.json +1021 -53
  211. package/dist/cli-bundle/chunks/chunk-2MA6ZQVZ.js +0 -197
  212. package/dist/cli-bundle/chunks/chunk-3AFAUHUE.js +0 -2
  213. package/dist/cli-bundle/chunks/chunk-7VHZS727.js +0 -5
  214. package/dist/cli-bundle/chunks/chunk-JSLOFXGA.js +0 -3
  215. package/dist/cli-bundle/chunks/chunk-OCLPLFAY.js +0 -35
  216. package/dist/cli-bundle/chunks/chunk-S4IRYKBU.js +0 -13
  217. package/dist/cli-bundle/chunks/register-mutation-7IY2D5KO.js +0 -20
  218. package/dist/cli-bundle/chunks/register-operations-FALL3YTU.js +0 -2
  219. package/dist/cli-bundle/focused-chunks/chunk-7WZRLCYF.js +0 -50
  220. package/dist/cli-bundle/focused-chunks/chunk-CKKQSJNN.js +0 -2
  221. package/dist/cli-bundle/focused-chunks/chunk-EEFKYMDR.js +0 -16
  222. package/dist/cli-bundle/focused-chunks/chunk-F2A56DHV.js +0 -8
  223. package/dist/cli-bundle/focused-chunks/chunk-FV5ACOK7.js +0 -2
  224. package/dist/cli-bundle/focused-chunks/chunk-JEAVFOWM.js +0 -2
  225. package/dist/cli-bundle/focused-chunks/chunk-NJ63LOP6.js +0 -155
  226. package/dist/cli-bundle/focused-chunks/chunk-NXRTQ7HI.js +0 -2
  227. package/dist/cli-bundle/focused-chunks/chunk-TJ7EMJ46.js +0 -4
  228. package/dist/cli-bundle/focused-chunks/chunk-ZOSEELYJ.js +0 -26
@@ -1,20 +0,0 @@
1
- import{a as ue,c as Ve,d as ce,f as ze,g as Je,h as Ke}from"./chunk-LOVTQ52Z.js";import{$ as re,B as Fe,Ba as le,C as Y,Ca as de,D as Pe,Da as je,E as Ne,F as $e,G as He,H as Ue,I as Ge,L as qe,M as Z,N as Q,O as ee,V as te,W as oe,Y as ie,Z as ne,_ as ae,qa as Ht,ra as Lt,sa as Bt,ta as Ut,ua as Gt,va as qt,wa as jt,xa as Vt,ya as zt,za as se}from"./chunk-BKYB45NQ.js";import"./chunk-JSLOFXGA.js";import"./chunk-7VHZS727.js";import"./chunk-QWRRFYK3.js";import{Ka as Re,La as Ie,Na as Te,Oa as Ee,Pa as Oe,bc as Le,ec as Be,ga as De,qa as X,yb as Me}from"./chunk-OCLPLFAY.js";import{$ as xt,I as rt,J as st,K as lt,L as dt,M as ut,N as ct,O as pt,P as ft,Q as mt,R as yt,S as gt,T as ht,U as vt,V as bt,W as wt,X as kt,Y as At,Z as St,_ as _t,aa as Ct,ba as Dt,ca as Rt,da as It,ea as Tt,fa as Et,ga as Ot,ha as Ft,ia as Mt,ja as Pt,ka as Nt,la as $t,w as W}from"./chunk-N3DSV4CH.js";import{T as xe,i as V}from"./chunk-S4IRYKBU.js";import"./chunk-WYRZZ5ZE.js";import{$i as q,C as c,Ch as G,Dm as v,E as f,Fa as ke,Gg as U,Uf as w,Ul as _e,Va as O,Wf as p,Xd as L,Xf as h,Yg as D,a as be,aj as Ae,ca as E,cm as F,de as B,gm as m,jm as d,ka as we,km as s,lm as _,mm as M,pm as z,qm as J,rh as at,rm as K,sm as Ce,vj as j,yj as Se}from"./chunk-2MA6ZQVZ.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="8bc9436f-c101-583d-ae42-02d51b5eb027")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="d79c73c8-07a5-5a39-aca5-4058264684d6")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f439176a-7297-5235-b96a-3e393af8602b")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="51b91e68-4bd6-521d-926e-e3b03f4b4956")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="e8b566c3-db93-54d7-a917-38bf317cb575")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="d9bb2d77-9ea1-51f9-a186-a2c222a6fbb3")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="41658a2a-e730-5c0c-9783-70b30ee9b2fc")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="890d56e2-d85f-5d29-90b3-1d832210ea09")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="2fa91bad-9a89-5c42-8b0f-dbcd2728c563")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="13a390ed-dac6-51bc-aeee-17f601e73282")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="c916e9b2-d840-585e-b7e2-120b677c7498")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f3dbfd7a-f028-5927-b62d-2f078389f06d")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="49eb11f2-6d0e-59e6-9b7d-3a1515229879")}catch{}})();var P={};be(P,{PROFILE_SUBCOMMANDS:()=>Ht,formatProfileApplyHuman:()=>zt,formatProfileLintHuman:()=>Vt,formatProfileListHuman:()=>qt,formatProfileShowHuman:()=>jt,runProfileApply:()=>Gt,runProfileLint:()=>Ut,runProfileList:()=>Lt,runProfileShow:()=>Bt});(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="faf8a076-fe77-5017-b570-a49e7031ee0d")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="bb095de1-0784-5659-9d73-91fd0a033c7d")}catch{}})();var N={};be(N,{SCHEMA_SUBCOMMANDS:()=>dt,_testOnlySchemaCommand:()=>$t,buildInvalidTypeHint:()=>at,ensureTypeFolderScaffold:()=>pt,formatSchemaAddFieldHuman:()=>Et,formatSchemaAddStatusHuman:()=>Ct,formatSchemaAddTypeHuman:()=>_t,formatSchemaApplyPresetHuman:()=>Pt,formatSchemaEvolutionMigrationHuman:()=>lt,formatSchemaInferTypesHuman:()=>Nt,formatSchemaListFieldsHuman:()=>Ft,formatSchemaListHuman:()=>Rt,formatSchemaRemoveFieldHuman:()=>Ot,formatSchemaRemoveStatusHuman:()=>Dt,formatSchemaRemoveTypeHuman:()=>xt,formatSchemaShowFieldHuman:()=>Mt,formatSchemaShowHuman:()=>It,formatSchemaShowStatusHuman:()=>Tt,planSchemaEvolutionMigration:()=>rt,runSchemaAddField:()=>vt,runSchemaAddStatus:()=>ft,runSchemaAddType:()=>ut,runSchemaApplyPreset:()=>At,runSchemaEvolutionMigration:()=>st,runSchemaInferTypes:()=>St,runSchemaList:()=>yt,runSchemaListFields:()=>wt,runSchemaRemoveField:()=>bt,runSchemaRemoveStatus:()=>mt,runSchemaRemoveType:()=>ct,runSchemaShow:()=>gt,runSchemaShowField:()=>kt,runSchemaShowStatus:()=>ht});(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="926afd8a-6d7c-503f-a82f-0ef1f4d66c85")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="8052e529-7849-58b1-8ff2-94be44af3ca9")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="e6b32b75-4618-5270-a79a-8564e97c7f3b")}catch{}})();async function pe(t){t.description==="-"&&(t.description=await D().resolveValue("-","--description")??"")}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="3b23ded4-a821-5ff0-8783-927875d0457b")}catch{}})();async function Jt(t,e,o,i){let n=m(i),r=await je(t,e,{status:typeof o.status=="string"?o.status:void 0,author:typeof o.author=="string"?o.author:n.author,message:typeof o.message=="string"?o.message:void 0,force:o.force===!0},n);await v(n,r),p(r,n)}async function Kt(t,e){let o=m(e),i=await D().resolveValue("-","--stdin-json");if(i===void 0||i.trim().length===0)throw new f("pm item mutate requires a non-empty JSON batch on stdin.",c.USAGE);let n=typeof t.transactionId=="string"?t.transactionId.trim():"";if(n.length===0)throw new f("pm item mutate requires --transaction-id <value>.",c.USAGE);let r=O(process.cwd(),o.path),a=await G(r),l=Ve(i,{transactionId:n,idPrefix:a.id_prefix}),{mutations:u,references:y}=l,b=ue(t);if(t.dryRun===!0){p({transaction_id:n,dry_run:!0,mutation_count:u.length,mutations:u,references:y},o);return}let k=await ze({pmRoot:r,transactionId:n,author:L(typeof t.author=="string"?t.author:o.author,a.author_default),mutations:u,...b});p({...k,mutation_count:u.length,references:y},o)}function Wt(t,e){return typeof t=="string"&&t.trim().length>0?t.trim():typeof e=="string"?e.trim():""}async function Xt(t,e,o,i){let n=m(i),r=typeof o.transactionId=="string"?o.transactionId.trim():"";if(r.length===0)throw new f("pm item complete requires --transaction-id <value>.",c.USAGE);let a=Wt(e,o.reason);if(a.length===0)throw new f("pm item complete requires a close reason.",c.USAGE);let u=Object.fromEntries(["file","doc","test","comment","note","learning"].filter(S=>o[S]!==void 0).map(S=>[S,o[S]])),y=o.force===!0,{lockTtlSeconds:b,lockWaitMs:k}=ue(o),g={...typeof o.resolution=="string"?{resolution:o.resolution}:{},...typeof o.expectedResult=="string"?{expectedResult:o.expectedResult}:{},...typeof o.actualResult=="string"?{actualResult:o.actualResult}:{},...typeof o.completedAt=="string"?{completedAt:o.completedAt}:{},...typeof o.validateClose=="string"?{validateClose:o.validateClose}:{},...y?{force:!0}:{}},R={id:t,reason:a,...Object.keys(u).length===0?{}:{evidence:u},...Object.keys(g).length===0?{}:{closeOptions:g},...y?{releaseOptions:{force:!0}}:{}};if(o.dryRun===!0){let S=Je(R);p({transaction_id:r,dry_run:!0,mutation_count:S.length,mutations:S},n);return}let A=O(process.cwd(),n.path),I=await Ke({pmRoot:A,transactionId:r,author:L(typeof o.author=="string"?o.author:n.author,(await G(A)).author_default),...R,lockTtlSeconds:b,lockWaitMs:k});p({...I,mutation_count:Object.keys(I.results).length},n)}function We(t){let e=t.commands.find(o=>o.name()==="item")??t.command("item").description("Run item lifecycle operations.");e.command("reopen <id> <reason>").option("--status <value>","Active target status: open or in_progress").option("--message <value>","Human-readable recurrence history message").option("--force","Override ownership or stale-lock conflicts").option("--author <value>","Mutation author").description("Reopen terminal work with recurrence evidence.").action(Jt),e.command("mutate").requiredOption("--transaction-id <value>","Stable idempotency key used to resume an interrupted batch").option("--stdin-json","Read the JSON mutation array from stdin",!0).option("--dry-run","Validate and preview the batch without writing").option("--create-compensation <mode>","Created-item compensation policy: close or delete","close").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--author <value>","Mutation author").description("Apply SDK-backed mutations atomically.").action(Kt),e.command("complete <id> [reason]").requiredOption("--transaction-id <value>","Stable idempotency key for the composed completion").option("--reason <value>","Close reason when omitted positionally").option("--file <value>","Linked file evidence",d).option("--doc <value>","Linked documentation evidence",d).option("--test <value>","Linked test evidence",d).option("--comment <value>","Evidence comment",d).option("--note <value>","Completion note",d).option("--learning <value>","Durable completion learning",d).option("--resolution <value>","Structured resolution evidence").option("--expected-result <value>","Expected result evidence").option("--actual-result <value>","Actual result evidence").option("--completed-at <value>","Actual completion time").option("--validate-close <mode>","Close validation: off, warn, or strict").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--dry-run","Validate and preview completion without writing").option("--force","Override lifecycle and ownership conflicts").option("--author <value>","Completion author").description("Close with evidence and release the claim.").action(Xt)}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="2745d577-4f6c-5b9e-b54a-e1451e022d63")}catch{}})();async function Yt(t,e){let o=m(e),i=Array.isArray(t.event)?t.event:[],n=await De(O(process.cwd(),o.path),{historyEvent:i,allActionable:t.allActionable===!0,dryRun:t.dryRun===!0,planFingerprint:s(t,"planFingerprint"),limit:t.limit,attributedAuthor:s(t,"attributedAuthor"),reviewer:s(t,"reviewer"),reason:s(t,"reason")});p(n,o)}function Xe(t){t.command("history-author-acknowledge").option("--event <item-id:line>","Unknown-author event coordinate (repeatable)",d).option("--all-actionable","Select all actionable events").option("--dry-run","Preview a deterministic source-bound plan").option("--plan-fingerprint <sha256>","Apply the exact fingerprint returned by --dry-run").option("--limit <n>","Maximum coordinate rows returned in the plan").option("--attributed-author <value>","Reviewed principal attribution").option("--reviewer <value>","Disposition reviewer").option("--reason <value>","Review evidence").description("Append audited dispositions for immutable unknown-author events.").action(Yt)}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="d436d524-7827-5ca7-8542-dd579813fae1")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="2d8a7e66-16e7-552f-b6d8-4cfbfb519a30")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="6bbab815-17b8-5f27-8842-41d6132488b2")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="8166a37c-7673-5ad4-a042-28ca34d65aa4")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="616fff4b-f86e-54e5-b569-0b9894da5221")}catch{}})();function fe(t,e,o,i){if(e.trim().toLowerCase()!=="add"||!o?.trim())return;let n=s(i,"add")??s(i,"note")??s(i,"body")??s(i,"comment"),r=s(i,"file"),a=[t,o.trim()];n!==void 0?a.push("--add",n):i.stdin===!0?a.push("--stdin"):r!==void 0?a.push("--file",r):a.push("--add","-");let l=B(a),u=B([t,o.trim(),"--add","-"]);throw new f(`The positional token "add" was parsed as the item id, while "${o.trim()}" was parsed as annotation text. ${t} does not use an add subcommand.`,c.USAGE,{code:"annotation_transposed_subcommand",reason:"noun_verb_object_transposition",required:`Place the item id immediately after ${t}, then use --add for annotation text.`,examples:[...new Set([l,u])],recovery:{attempted_command:`pm ${t} add ${o.trim()}`,normalized_args:[t,"add",o.trim()],parsed_positionals:[{role:"transposed_subcommand",value:"add"},{role:"item_id",value:o.trim()}],suggested_retry:l}})}function Zt(t,e){let o=typeof e.edit=="number"?e.edit:void 0,i=typeof e.delete=="number"?e.delete:void 0,n=s(e,"add")??s(e,"body")??s(e,"comment"),r=typeof t=="string"?t:void 0,a=e.stdin===!0,l=s(e,"file");if(+(n!==void 0)+ +(r!==void 0)+Number(a)+ +(l!==void 0)>1)throw n!==void 0&&r!==void 0&&!a&&l===void 0?new f("Specify comment text either as positional [text] or with --add, not both",c.USAGE):new f("Specify comment text with exactly one source: positional [text], --add, --stdin, or --file",c.USAGE);let y=n??r;return{add:y,readFromStdin:a,readFromFile:l,editIndex:o,deleteIndex:i,isMutation:typeof y=="string"||a||l!==void 0||o!==void 0||i!==void 0}}function Ye(t,e,o){let i=s(o,"add"),n=t==="note"?s(o,"note"):void 0;if(i!==void 0&&n!==void 0&&i!==n)throw new f("Specify note text with either --add or --note, not conflicting values for both aliases",c.USAGE,{code:"annotation_alias_conflict"});let r=i??n,a=typeof e=="string"?e:void 0;if(r!==void 0&&a!==void 0)throw new f(`Specify ${t} text either as positional [text] or with --add, not both`,c.USAGE);return r??a}async function Qt(t,e,o,i){let n=m(i),r=Date.now();fe("comments",t,e,o);let a=Zt(e,o),l=await Ne(t,{add:a.add,stdin:a.readFromStdin,file:a.readFromFile,edit:a.editIndex,delete:a.deleteIndex,limit:s(o,"limit"),fullHistory:o.fullHistory===!0,author:s(o,"author"),message:s(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},n);a.isMutation&&await v(n,l),me("comments",l,n,r)}async function eo(t,e,o,i){let n=m(i),r=Date.now();fe("notes",t,e,o);let a=Ye("note",e,o),l=await He(t,{add:a,addJson:s(o,"addJson"),stdin:o.stdin===!0,file:s(o,"file"),edit:typeof o.edit=="number"?o.edit:void 0,delete:typeof o.delete=="number"?o.delete:void 0,limit:s(o,"limit"),since:s(o,"since"),eventType:s(o,"eventType"),includeMeta:o.includeMeta===!0,fullHistory:o.fullHistory===!0,author:s(o,"author"),message:s(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},n);(typeof a=="string"||typeof o.addJson=="string"||o.stdin===!0||typeof o.file=="string"||typeof o.edit=="number"||typeof o.delete=="number")&&await v(n,l),me("notes",l,n,r)}async function to(t,e,o,i){let n=m(i),r=Date.now();fe("learnings",t,e,o);let a=Ye("learning",e,o),l=await $e(t,{add:a,stdin:o.stdin===!0,file:s(o,"file"),edit:typeof o.edit=="number"?o.edit:void 0,delete:typeof o.delete=="number"?o.delete:void 0,limit:s(o,"limit"),fullHistory:o.fullHistory===!0,author:s(o,"author"),message:s(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},n);(typeof a=="string"||o.stdin===!0||typeof o.file=="string"||typeof o.edit=="number"||typeof o.delete=="number")&&await v(n,l),me("learnings",l,n,r)}function me(t,e,o,i){p(e,o),o.profile&&h(`profile:command=${t} took_ms=${Date.now()-i}`)}function Ze(t,e){let o=t.command("comments").argument("<id>","Item id").argument("[text]","Optional comment text shorthand (equivalent to --add)").option("--add <text>","Add one comment entry (plain text fallback, text=<value>, markdown pairs, or - for stdin; CSV-like key fragments are preserved as plain text unless text is explicit)").option("--stdin","Read comment text from stdin (supports multiline markdown)").option("--file <path>","Read comment text from file (supports multiline markdown)").option("--edit <index>","Replace the comment at 1-based <index> (replacement text from positional [text], --add, --stdin, or --file)",e("--edit")).option("--delete <index>","Delete the comment at 1-based <index>",e("--delete")).option("--limit <n>","Return only latest n comments").option("--full-history","Return the complete post-mutation comment history instead of a bounded receipt").option("--author [value]","Comment author (optional; falls back to PM_AUTHOR/settings)").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete comments for an item.").action(Qt);_(o,"--body <text>","Alias for --add",!1),_(o,"--comment <text>","Alias for --add",!1),t.command("notes").argument("<id>","Item id").argument("[text]","Optional note text shorthand (equivalent to --add; use - for stdin)").option("--add <text>","Add a text note (- reads stdin)").option("--note <text>","Alias for --add").option("--add-json <json>","Append a merge-safe JSON event").option("--stdin","Read note text from stdin").option("--file <path>","Read note text from a UTF-8 file").option("--edit <index>","Replace a 1-based note using the selected text input",e("--edit")).option("--delete <index>","Delete the note at 1-based <index>",e("--delete")).option("--limit <n>","Return only latest n notes").option("--since <timestamp>","Filter JSON events from this ISO time").option("--event-type <value>","Filter JSON events by top-level type").option("--include-meta","Include count and truncation metadata").option("--full-history","Return the complete post-mutation note history instead of a bounded receipt").option("--author [value]","Author; defaults to PM_AUTHOR/settings").option("--message <value>","History message").option("--force","Force ownership override").description("Manage merge-safe text notes and JSON context events.").action(eo),t.command("learnings").argument("<id>","Item id").argument("[text]","Optional learning text shorthand (equivalent to --add; use - for stdin)").option("--add <text>","Add one learning entry (plain text fallback, text=<value>, markdown pairs, or - for stdin; CSV-like key fragments are preserved as plain text unless text is explicit)").option("--stdin","Read learning text from stdin (supports multiline markdown)").option("--file <path>","Read learning text from file (supports multiline markdown)").option("--edit <index>","Replace the learning at 1-based <index> (replacement text from positional [text], --add, --stdin, or --file)",e("--edit")).option("--delete <index>","Delete the learning at 1-based <index>",e("--delete")).option("--limit <n>","Return only latest n learnings").option("--full-history","Return the complete post-mutation learning history instead of a bounded receipt").option("--author [value]","Learning author (optional; falls back to PM_AUTHOR/settings)").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete learnings for an item.").action(to)}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="452f6689-f5bd-5398-915b-52ce7e2fd55e")}catch{}})();function ye(t,e){return o=>{let i=Number(o);if(!Number.isInteger(i)||i<e)throw new f(`${t} must be an integer greater than or equal to ${e}.`,c.USAGE);return i}}async function oo(t,e,o){let i=m(o);if(e.scope!==void 0&&e.scope!=="project"&&e.scope!=="global")throw new f("--scope must be either project or global.",c.USAGE);let n=await Ee({paths:t,scope:e.scope,limit:typeof e.limit=="number"?e.limit:void 0,offset:typeof e.offset=="number"?e.offset:void 0,noTruncate:e.noTruncate===!0,strictRead:e.strictRead===!0,explain:e.explain===!0,lineRange:typeof e.lines=="string"?Ie(e.lines):void 0,decisionDepth:typeof e.decisionDepth=="number"?e.decisionDepth:void 0},i);p(n,i)}function Qe(t){t.command("lookup").argument("<paths...>","Project-relative or absolute source paths").option("--scope <scope>","Restrict links to project or global scope").option("--limit <n>","Maximum referencing items to return",ye("--limit",1)).option("--offset <n>","Number of referencing items to skip",ye("--offset",0)).option("--no-truncate","Return every referencing item").option("--strict-read","Fail when any authoritative item cannot be read").option("--explain","Include ranked source-to-work rationale").option("--lines <start:end>","Attribute an inclusive source line range").option("--decision-depth <n>","Maximum governing-decision relationship depth",ye("--decision-depth",1)).description("Find and explain pm items that govern requested source paths.").action(oo)}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="af464386-4cc8-5110-b0b6-9f63224baa8e")}catch{}})();var io=["add-","apply-","list-","remove-","show-"],no=new Set(["field","fields","help","status","statuses","type","types"]);function ge(t){let e=t.trim().toLowerCase();return e.length===0?!1:no.has(e)||io.some(o=>e.startsWith(o))}function H(t){if(t!=null){if(typeof t=="number"){if(!Number.isInteger(t))throw new f("--order must be a finite integer.",c.USAGE);return t}if(typeof t=="string"){if(t.trim().length===0)return;let e=Number(t);if(!Number.isInteger(e))throw new f("--order must be a finite integer.",c.USAGE);return e}throw new f("--order must be a finite integer.",c.USAGE)}}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="07f3212f-c6d3-534e-8273-fae43a8fca18")}catch{}})();var ao=new Set(we.map(t=>t.toLowerCase())),ro=new Set(_e.map(t=>t==="estimate"?"estimatedMinutes":t));function so(t,e){let o=e.normalizedSubcommand;return o!=="rename-type"&&o!=="rename-field"&&o!=="remap-status"?null:t.runSchemaEvolutionMigration({kind:o,from:e.typeName,to:s(e.options,"to"),...o==="rename-field"&&typeof e.options.type=="string"?{type:e.options.type}:{}},{migrationId:s(e.options,"migrationId")??s(e.options,"migration_id"),dryRun:e.options.dryRun===!0,author:e.author,force:e.force},e.globalOptions)}function lo(t,e){let{normalizedSubcommand:o,typeName:i,globalOptions:n,author:r,force:a}=e;switch(o){case"list":return t.runSchemaList(n);case"show":return t.runSchemaShow(i,n);case"show-status":return t.runSchemaShowStatus(i,n);case"list-fields":return t.runSchemaListFields(n);case"show-field":return t.runSchemaShowField(i,n);case"remove-type":return t.runSchemaRemoveType(i,{author:r,force:a},n);case"remove-field":return t.runSchemaRemoveField(i,{author:r,force:a},n);case"remove-status":return t.runSchemaRemoveStatus(i,{author:r,force:a},n);case"apply-preset":return t.runSchemaApplyPreset(i,{author:r,force:a},n);default:return null}}async function uo(t,e){let{normalizedSubcommand:o,typeName:i,options:n,globalOptions:r}=e,{author:a,force:l,description:u}=e,y=so(t,e);if(y)return y;let b=lo(t,e);if(b)return b;switch(o){case"add-field":return t.runSchemaAddField(i,{type:typeof n.type=="string"?n.type:void 0,commands:e.commands,description:u,cliFlag:typeof n.cliFlag=="string"?n.cliFlag:void 0,alias:e.aliases,required:!!n.required,requiredOnCreate:!!n.requiredOnCreate,allowUnset:n.allowUnset!==!1,requiredTypes:e.requiredTypes,author:a,force:l},r);case"add-status":return t.runSchemaAddStatus(i,{role:e.roles,alias:e.aliases,description:u,order:e.order,author:a,force:l},r);default:return n.infer===!0?t.runSchemaInferTypes({minCount:e.minCount,apply:!!n.apply,author:a,force:l},r):t.runSchemaAddType(i,{description:u,defaultStatus:e.defaultStatus,folder:typeof n.folder=="string"?n.folder:void 0,alias:e.aliases,author:a,force:l},r)}}function co(t,e){if("migration_id"in e){w(`${t.formatSchemaEvolutionMigrationHuman(e)}
2
- `);return}switch(e.action){case"list":w(`${t.formatSchemaListHuman(e)}
3
- `);return;case"show":w(`${t.formatSchemaShowHuman(e)}
4
- `);return;case"show-status":w(`${t.formatSchemaShowStatusHuman(e)}
5
- `);return;case"list-fields":w(`${t.formatSchemaListFieldsHuman(e)}
6
- `);return;case"show-field":w(`${t.formatSchemaShowFieldHuman(e)}
7
- `);return;case"remove-type":w(`${t.formatSchemaRemoveTypeHuman(e)}
8
- `);break;case"remove-field":w(`${t.formatSchemaRemoveFieldHuman(e)}
9
- `);break;case"apply-preset":w(`${t.formatSchemaApplyPresetHuman(e)}
10
- `);break;case"infer-types":w(`${t.formatSchemaInferTypesHuman(e)}
11
- `);break;case"add-field":w(`${t.formatSchemaAddFieldHuman(e)}
12
- `);break;case"add-status":w(`${t.formatSchemaAddStatusHuman(e)}
13
- `);break;case"remove-status":w(`${t.formatSchemaRemoveStatusHuman(e)}
14
- `);break;default:w(`${t.formatSchemaAddTypeHuman(e)}
15
- `);break}e.warnings.length>0&&h(`schema ${e.action} warnings: ${z(e.warnings)}`)}async function po(t,e,o,i,n){switch(e){case"list":return t.runProfileList();case"show":return t.runProfileShow(o);case"lint":return t.runProfileLint(o);default:return t.runProfileApply(o,{dryRun:i.dryRun===!0,author:typeof i.author=="string"?i.author:void 0,force:i.force===!0},n)}}function fo(t,e){switch(e.action){case"list":w(`${t.formatProfileListHuman(e)}
16
- `);return;case"show":w(`${t.formatProfileShowHuman(e)}
17
- `);return;case"lint":w(`${t.formatProfileLintHuman(e)}
18
- `);return;default:w(`${t.formatProfileApplyHuman(e)}
19
- `),e.warnings.length>0&&h(`profile apply warnings: ${z(e.warnings)}`);break}}function mo(t){return e=>{let o=Number(e);if(!Number.isInteger(o)||o<1)throw new f(`${t} must be a positive integer (1-based index).`,c.USAGE);return o}}function et(t,e){t.option("--filter-has-notes",`Select only items that have notes before ${e}`).option("--filter-no-notes",`Select only items that have no notes before ${e}`).option("--filter-has-learnings",`Select only items that have learnings before ${e}`).option("--filter-no-learnings",`Select only items that have no learnings before ${e}`).option("--filter-has-files",`Select only items that have linked files before ${e}`).option("--filter-no-files",`Select only items that have no linked files before ${e}`).option("--filter-has-docs",`Select only items that have linked docs before ${e}`).option("--filter-no-docs",`Select only items that have no linked docs before ${e}`).option("--filter-has-tests",`Select only items that have linked tests before ${e}`).option("--filter-no-tests",`Select only items that have no linked tests before ${e}`).option("--filter-has-comments",`Select only items that have comments before ${e}`).option("--filter-no-comments",`Select only items that have no comments before ${e}`).option("--filter-has-deps",`Select only items that have dependencies before ${e}`).option("--filter-no-deps",`Select only items that have no dependencies before ${e}`).option("--filter-has-body",`Select only items that have a non-empty body before ${e}`).option("--filter-empty-body",`Select only items with an empty body before ${e}`).option("--filter-has-linked-command",`Select only items whose linked tests carry a runnable command before ${e}`).option("--filter-no-linked-command",`Select only items whose linked tests carry no runnable command before ${e}`).option("--filter-reviewer-missing",`Select only items missing reviewer before ${e}`).option("--filter-risk-missing",`Select only items missing risk before ${e}`).option("--filter-confidence-missing",`Select only items missing confidence before ${e}`).option("--filter-sprint-missing",`Select only items missing sprint before ${e}`).option("--filter-release-missing",`Select only items missing release before ${e}`)}var yo=[["filterHasNotes","filterNoNotes","--filter-has-notes","--filter-no-notes"],["filterHasLearnings","filterNoLearnings","--filter-has-learnings","--filter-no-learnings"],["filterHasFiles","filterNoFiles","--filter-has-files","--filter-no-files"],["filterHasDocs","filterNoDocs","--filter-has-docs","--filter-no-docs"],["filterHasTests","filterNoTests","--filter-has-tests","--filter-no-tests"],["filterHasComments","filterNoComments","--filter-has-comments","--filter-no-comments"],["filterHasDeps","filterNoDeps","--filter-has-deps","--filter-no-deps"],["filterHasBody","filterEmptyBody","--filter-has-body","--filter-empty-body"],["filterHasLinkedCommand","filterNoLinkedCommand","--filter-has-linked-command","--filter-no-linked-command"]];function it(t){let e=o=>t[o]===!0?!0:void 0;for(let[o,i,n,r]of yo)if(t[o]===!0&&t[i]===!0)throw new f(`Cannot combine ${n} with ${r} for the same field.`,c.USAGE);return{filterReviewerMissing:e("filterReviewerMissing"),filterRiskMissing:e("filterRiskMissing"),filterConfidenceMissing:e("filterConfidenceMissing"),filterSprintMissing:e("filterSprintMissing"),filterReleaseMissing:e("filterReleaseMissing"),hasNotes:e("filterHasNotes"),hasLearnings:e("filterHasLearnings"),hasFiles:e("filterHasFiles"),hasDocs:e("filterHasDocs"),hasTests:e("filterHasTests"),hasComments:e("filterHasComments"),hasDeps:e("filterHasDeps"),hasBody:e("filterHasBody"),hasLinkedCommand:e("filterHasLinkedCommand"),noNotes:e("filterNoNotes"),noLearnings:e("filterNoLearnings"),noFiles:e("filterNoFiles"),noDocs:e("filterNoDocs"),noTests:e("filterNoTests"),noComments:e("filterNoComments"),noDeps:e("filterNoDeps"),emptyBody:e("filterEmptyBody"),noLinkedCommand:e("filterNoLinkedCommand")}}function he(t,e){for(let o of e){let i=[],n=t.args,r=a=>(t.args!==n&&(i.length=0,n=t.args),i.push(a),i);o.required?t.requiredOption(o.option,o.description):o.repeatable?t.option(o.option,o.description,r):t.option(o.option,o.description);for(let a of o.aliasOptions??[])q(o.option,a.option)?_(t,a.option,a.description,o.repeatable===!0,o.repeatable?r:void 0):o.repeatable?t.option(a.option,a.description,r):t.option(a.option,a.description)}}function go(t){let e=o=>typeof t[o]=="string"?t[o]:void 0;return{type:e("filterType"),tag:e("filterTag"),priority:e("filterPriority"),deadlineBefore:e("filterDeadlineBefore"),deadlineAfter:e("filterDeadlineAfter"),updatedAfter:e("filterUpdatedAfter"),updatedBefore:e("filterUpdatedBefore"),createdAfter:e("filterCreatedAfter"),createdBefore:e("filterCreatedBefore"),ids:e("ids"),assignee:e("filterAssignee"),assigneeFilter:e("filterAssigneeFilter")??e("filterAssignee_filter"),parent:e("filterParent"),sprint:e("filterSprint"),release:e("filterRelease"),filterAcMissing:t.filterAcMissing===!0?!0:void 0,filterEstimatesMissing:t.filterEstimatesMissing===!0||t.filterEstimateMissing===!0?!0:void 0,filterResolutionMissing:t.filterResolutionMissing===!0?!0:void 0,filterMetadataMissing:t.filterMetadataMissing===!0?!0:void 0,...it(t),limit:e("limit"),offset:e("offset"),includeBody:!0}}function T(...t){for(let e of t)if(typeof e=="string")return e}function ve(t){if(Array.isArray(t))return t;if(typeof t=="string")return[t]}function ho(t,e,o){return typeof e=="string"&&e.length>0?{positionalType:t,positionalTitle:e}:typeof t!="string"||t.length===0?{positionalType:void 0,positionalTitle:void 0}:typeof o.title=="string"&&o.title.trim().length>0&&o.type===void 0?{positionalType:t,positionalTitle:void 0}:{positionalType:void 0,positionalTitle:t}}function vo(t,e,o){if(t!==void 0||typeof e!="string"||e.length===0||o.title!==void 0||o.type!==void 0||!ao.has(e.trim().toLowerCase()))return;let i=e.trim();throw new f(`pm create needs a title \u2014 "${i}" looks like an item type, not a title. Use either: pm create ${i} "<title>" or pm create "<title>" --type ${i}.`,c.USAGE,{code:"create_positional_type_without_title",why:'Without this guard the single positional is used as the title and the type defaults to Task \u2014 so the command would silently create a Task literally titled "'+i+'".',examples:[`pm create ${i} "Wire up SSO for the agent harness"`,`pm create "Wire up SSO for the agent harness" --type ${i}`],nextSteps:[`Re-run with both type and title: pm create ${i} "<title>"`]})}var bo=["body","description","dep","depRemove","comment","note","learning","file","test","doc","reminder","event","typeOption","field"];function nt(t){let e=bo.filter(o=>{let i=t[o];return i==="-"||Array.isArray(i)&&i.includes("-")}).map(o=>`--${o.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`)}`);if(e.length>0)throw new f(`--stdin-json cannot be combined with other stdin consumers: ${e.join(", ")}`,c.USAGE)}async function wo(t,e,o,i){let n=m(i),r=Date.now();if(o.stdinJson===!0){nt(o);let y=await D().resolveValue("-","--stdin-json");o=ce(y??"","create",o)}let a=ho(t,e,o);vo(a.positionalType,a.positionalTitle,o),typeof a.positionalType=="string"&&a.positionalType.length>0&&o.type===void 0&&(o.type=a.positionalType),typeof a.positionalTitle=="string"&&a.positionalTitle.length>0&&o.title===void 0&&(o.title=a.positionalTitle),await pe(o),typeof o.bodyFile=="string"&&(o.body=await U(o.bodyFile,o.body!==void 0?String(o.body):void 0),delete o.bodyFile);let l=J(o,{requireType:!1}),u=await Le(l,n);await v(n,u),p(u,n),n.profile&&h(`profile:command=create took_ms=${Date.now()-r}`)}function ko(t){return{type:s(t,"filterType"),tag:s(t,"filterTag"),priority:s(t,"filterPriority"),deadlineBefore:s(t,"filterDeadlineBefore"),deadlineAfter:s(t,"filterDeadlineAfter"),updatedAfter:s(t,"filterUpdatedAfter"),updatedBefore:s(t,"filterUpdatedBefore"),createdAfter:s(t,"filterCreatedAfter"),createdBefore:s(t,"filterCreatedBefore"),ids:s(t,"ids"),assignee:s(t,"filterAssignee"),assigneeFilter:T(t.filterAssigneeFilter,t.filterAssignee_filter),parent:s(t,"filterParent"),sprint:s(t,"filterSprint"),release:s(t,"filterRelease"),...it(t),limit:s(t,"limit"),offset:s(t,"offset")}}async function Ao(t,e){let o=m(e),i=Date.now(),n=await Pe({status:s(t,"filterStatus"),list:ko(t),reason:s(t,"reason"),completedAt:s(t,"completedAt"),resolution:s(t,"resolution"),expectedResult:T(t.expectedResult,t.expected_result,t.expected),actualResult:T(t.actualResult,t.actual_result,t.actual),validateClose:t.validateClose===!0?"warn":s(t,"validateClose"),author:s(t,"author"),message:s(t,"message"),force:!!t.force,dryRun:t.dryRun===!0?!0:void 0,rollback:s(t,"rollback"),checkpoint:t.checkpoint===!1?!1:void 0},o);await v(o,n),p(n,o),o.profile&&h(`profile:command=close-many took_ms=${Date.now()-i}`)}async function So(t,e){let o=m(e),i=Date.now(),n=await Ue({status:s(t,"filterStatus"),list:go(t),update:K(Ce(t)),dryRun:t.dryRun===!0?!0:void 0,rollback:s(t,"rollback"),checkpoint:t.checkpoint===!1?!1:void 0},o);await v(o,n),p(await F("update-many",[],t,o,n),o),o.profile&&h(`profile:command=update-many took_ms=${Date.now()-i}`)}async function _o(t,e,o,i){let n=m(i),r=Date.now(),a=typeof o.reason=="string"&&o.reason.trim().length>0&&o.reason||typeof o.closeReason=="string"&&o.closeReason.trim().length>0&&o.closeReason||void 0,l=typeof e=="string"&&e.length>0?e:a,u=await Me(t,l,{author:s(o,"author"),message:s(o,"message"),validateClose:o.validateClose===!0?"warn":s(o,"validateClose"),force:!!o.force,duplicateOf:s(o,"duplicateOf"),completedAt:s(o,"completedAt"),resolution:s(o,"resolution"),expectedResult:T(o.expectedResult,o.expected_result,o.expected),actualResult:T(o.actualResult,o.actual_result,o.actual)},n);await v(n,u),p(u,n),n.profile&&h(`profile:command=close took_ms=${Date.now()-r}`)}function xo(t){let e={...t},o=[["blocked_by","blockedBy"],["resume_context","resumeContext"],["from_search","fromSearch"],["step_title","stepTitle"],["step_body","stepBody"],["step_owner","stepOwner"],["step_status","stepStatus"],["step_evidence","stepEvidence"],["step_blocked_reason","stepBlockedReason"],["step_replacement","stepReplacement"],["depends_on","dependsOn"],["link_kind","linkKind"],["link_note","linkNote"],["promote_to_item_dep","promoteToItemDep"],["allow_multiple_active","allowMultipleActive"],["decision_text","decisionText"],["decision_rationale","decisionRationale"],["decision_evidence","decisionEvidence"],["discovery_text","discoveryText"],["validation_text","validationText"],["validation_command","validationCommand"],["validation_expected","validationExpected"],["materialize_type","materializeType"],["materialize_parent","materializeParent"],["materialize_tags","materializeTags"]];for(let[n,r]of o)e[n]!==void 0&&e[r]===void 0&&(e[r]=e[n]);let i=J(e,{requireType:!1});return i.blockedBy=e.blockedBy,i}function Co(t,e){if(!t)throw new f(`pm plan requires a subcommand. Allowed: ${e.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:['pm plan create --title "Refactor lock retry"',"pm plan show pm-a1b2 --depth standard",'pm plan add-step pm-a1b2 --step-title "Read lock.ts"']});if(e.includes(t))return;throw E({command_path:"plan",token:t,allowed:e,examples:t==="list"||t==="ls"?["pm list --type Plan","pm list-all --type Plan"]:void 0,retry_command:t==="list"||t==="ls"?"pm list --type Plan":void 0})}function Do(t,e){if(t!=="reorder-step"||typeof e!="string")return;let o=Number.parseInt(e,10);if(!Number.isFinite(o))throw new f(`reorder-step requires an integer new order, got "${e}"`,c.USAGE);return o}async function Ro(t,e,o,i,n,r){let a=m(r),l=Date.now(),u=(t??"").trim().toLowerCase();Co(u,Ge);let y=xo(n),b=Do(u,i),k=u==="create"&&typeof e=="string"&&e.length>0&&y.title===void 0?void 0:e;k===void 0&&typeof e=="string"&&e.length>0&&(y.title=e);let g=await qe({subcommand:u,id:k,stepRef:o,reorderTo:b,options:y,global:a});await v(a,g),p(g,a),a.profile&&h(`profile:command=plan took_ms=${Date.now()-l}`)}function tt(t,e){if(typeof t=="string"){if(!/^\d+$/.test(t.trim()))throw new f(`history-compact ${e} must be a non-negative integer.`,c.USAGE);return Number.parseInt(t,10)}}async function Io(t,e,o){if(t!==void 0)throw new f("merge reconcile takes no positional arguments.",c.USAGE);let i=await re({dryRun:e.dryRun===!0,force:e.force===!0,message:typeof e.message=="string"?e.message:void 0,author:o.author},o);p(i,o),i.ok||(process.exitCode=c.GENERIC_FAILURE)}async function To(t,e,o,i,n,r){if(t===void 0||e===void 0||o===void 0||i===void 0)throw new f("merge driver requires <artifact> <base> <ours> <theirs> (git supplies %O %A %B). Example: pm merge driver history %O %A %B",c.USAGE);let a=await oe({artifact:t,basePath:e,oursPath:o,theirsPath:i,outputPath:typeof n.output=="string"?n.output:void 0,itemPath:typeof n.itemPath=="string"?n.itemPath:void 0,prefer:typeof n.prefer=="string"?n.prefer:void 0},r);p(a,r),a.ok||(process.exitCode=c.GENERIC_FAILURE)}async function Eo(t,e,o,i,n,r,a){let l=m(a),u=Date.now();switch(t.trim().toLowerCase()){case"install":{if(e!==void 0)throw new f("merge install takes no positional arguments.",c.USAGE);let b=await W({dryRun:r.dryRun===!0},l);p(b,l);break}case"reconcile":await Io(e,r,l);break;case"report":{if(e!==void 0)throw new f("merge report takes no positional arguments.",c.USAGE);p(await X({includeReconciled:r.includeReconciled===!0}),l);break}case"driver":await To(e,o,i,n,r,l);break;default:throw E({command_path:"merge",token:t,allowed:["install","reconcile","report","driver"],display_name:"merge"})}l.profile&&h(`profile:command=merge took_ms=${Date.now()-u}`)}async function Oo(t,e,o){let i=m(o),n=Date.now(),r=typeof e.ids=="string"?Ae(e.ids):void 0,a=tt(e.allOver,"--all-over"),l=tt(e.minEntries,"--min-entries");if(e.closed===!0&&e.allStreams===!0)throw new f("history-compact: --closed and --all-streams are mutually exclusive; pick one lifecycle scope.",c.USAGE);let u=e.closed===!0?"closed":e.allStreams===!0?"all-streams":void 0;if((r!==void 0||a!==void 0||u!==void 0)&&typeof e.before=="string")throw new f("history-compact: --before applies only in single-id mode (bulk mode always compacts full streams).",c.USAGE);if(le(t,{ids:r,allOver:a,scope:u}),t===void 0){let b=await de({ids:r,scope:u,allOver:a,minEntries:l,dryRun:e.dryRun===!0,author:s(e,"author"),message:s(e,"message"),force:!!e.force},i);p(b,i),b.totals.items_errored>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let b=await se(t,{before:s(e,"before"),dryRun:e.dryRun===!0,author:s(e,"author"),message:s(e,"message"),force:!!e.force},i);p(b,i)}i.profile&&h(`profile:command=history-compact took_ms=${Date.now()-n}`)}function ot(t){if(Array.isArray(t))return t.flatMap(e=>e.split(",")).map(e=>e.trim()).filter(e=>e.length>0)}async function Fo(t,e,o,i){let n=m(i),r=Date.now(),{SCHEMA_SUBCOMMANDS:a}=N,l=(t??"").trim().toLowerCase(),u=e;if(Mo(l,a),!a.includes(l)&&u===void 0&&!ge(l)&&(u=t,l="add-type"),!a.includes(l))throw E({command_path:"schema",token:l,allowed:a});let y=await uo(N,{normalizedSubcommand:l,typeName:u,options:o,aliases:ve(o.alias),roles:ve(o.role),commands:ot(o.commands),requiredTypes:ot(o.requiredTypes),defaultStatus:T(o.defaultStatus,o.default_status),order:H(o.order),minCount:H(o.minCount),author:s(o,"author"),force:!!o.force,description:s(o,"description"),globalOptions:n});n.json===!0||n.defaultOutputFormat==="json"?p(y,n):n.quiet||co(N,y),n.profile&&h(`profile:command=schema took_ms=${Date.now()-r}`)}function Mo(t,e){if(!t)throw new f(`pm schema requires a subcommand. Allowed: ${e.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:["pm schema list","pm schema show Task","pm schema show-status open",'pm schema add-type Spike --description "Time-boxed investigation" --default-status open',"pm schema remove-type Spike","pm schema add-status review --role active --alias in_review","pm schema remove-status review","pm schema add-field severity_level --type string --commands create,update","pm schema list-fields","pm schema apply-preset agile","pm schema add-type --infer --min-count 10","pm schema rename-type Spike --to Experiment --migration-id spike-v2 --dry-run","pm schema rename-field severity --to impact --migration-id severity-v2","pm schema remap-status review --to verifying --migration-id review-v2"]})}async function Po(t,e,o){let i=m(o),n=Date.now(),r=await Z(t,{title:s(e,"title"),author:s(e,"author"),message:s(e,"message"),allowDuplicate:e.allowDuplicate===!0},i);await v(i,r),p(r,i),i.profile&&h(`profile:command=copy took_ms=${Date.now()-n}`)}async function No(t,e,o){let i=m(o),n=Date.now(),r=await ee(t,{clear:e.clear===!0},i);p(r,i),i.profile&&h(`profile:command=focus took_ms=${Date.now()-n}`)}async function $o(t,e,o){let i=m(o),n=Date.now();if(e.stdinJson===!0){nt(e);let a=await D().resolveValue("-","--stdin-json");e=ce(a??"","update",e)}await pe(e),typeof e.bodyFile=="string"&&(e.body=await U(e.bodyFile,e.body!==void 0?String(e.body):void 0),delete e.bodyFile);let r=await Be(t,K(e),i);await v(i,r),p(await F("update",[t],e,i,r),i),i.profile&&h(`profile:command=update took_ms=${Date.now()-n}`)}async function Ho(t,e,o){let i=m(o),n=Date.now(),r=await Q(t,{author:s(e,"author"),message:s(e,"message"),force:!!e.force,dryRun:e.dryRun===!0},i);r.dry_run!==!0&&await v(i,r),p(r,i),i.profile&&h(`profile:command=delete took_ms=${Date.now()-n}`)}function Lo(t,e){let o=s(e,"body"),i=s(e,"text"),n=typeof t=="string"?t:void 0;if([o,i,n].filter(l=>l!==void 0).length>1)throw new f("Specify append text with exactly one source: positional [text], --body, or --text",c.USAGE);let a=o??i??n;if(a===void 0)throw new f("Missing append text. Provide it as positional [text], --body <value>, or --text <value> (use - for stdin).",c.USAGE);return a}async function Bo(t,e,o,i){let n=m(i),r=Date.now(),a=await Fe(t,{body:Lo(e,o),author:s(o,"author"),message:s(o,"message"),force:!!o.force},n);await v(n,a),p(a,n),n.profile&&h(`profile:command=append took_ms=${Date.now()-r}`)}async function Uo(t,e,o,i){let n=m(i),r=Date.now(),a=await Y(t,e,{author:s(o,"author"),message:s(o,"message"),force:!!o.force},n);await v(n,a),p(a,n),n.profile&&h(`profile:command=restore took_ms=${Date.now()-r}`)}async function Go(t,e,o,i){let n=m(i),r=Date.now(),{PROFILE_SUBCOMMANDS:a}=P,l=(t??"").trim().toLowerCase();if(!l)throw new f(`pm profile requires a subcommand. Allowed: ${a.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:["pm profile list","pm profile show agile","pm profile apply agile --dry-run","pm profile lint agile"]});if(!a.includes(l))throw E({command_path:"profile",token:l,allowed:a});let u=await po(P,l,e,o,n);n.json===!0||n.defaultOutputFormat==="json"?p(u,n):n.quiet||fo(P,u),u.action==="lint"&&!u.ok&&(process.exitCode=c.GENERIC_FAILURE),n.profile&&h(`profile:command=profile took_ms=${Date.now()-r}`)}function C(t,e){return ve(t[e])??[]}async function qo(t,e,o){let i=m(o),n=Date.now(),r=C(e,"add"),a=C(e,"addGlob"),l=C(e,"remove"),u=C(e,"migrate"),y=await Te(t,{add:r,addGlob:a,remove:l,migrate:u,note:s(e,"note"),list:!!e.list,appendStable:!!e.appendStable,validatePaths:!!e.validatePaths,author:s(e,"author"),message:s(e,"message"),force:!!e.force},i);(r.length>0||a.length>0||l.length>0||u.length>0)&&await v(i,y),p(await F("files",[t],e,i,y),i),i.profile&&h(`profile:command=files took_ms=${Date.now()-n}`)}async function jo(t,e,o){let i=m(o),n=Date.now(),r={...o.optsWithGlobals(),...e},a=await Oe(t,{apply:!!r.apply,note:s(r,"note"),appendStable:!!r.appendStable,author:s(r,"author"),message:s(r,"message"),force:!!r.force},i);a.changed&&await v(i,a),p(a,i),i.profile&&h(`profile:command=files.discover took_ms=${Date.now()-n}`)}async function Vo(t,e,o){let i=m(o),n=Date.now(),r=C(e,"add"),a=C(e,"addGlob"),l=C(e,"remove"),u=C(e,"migrate"),y=await Re(t,{add:r,addGlob:a,remove:l,migrate:u,note:s(e,"note"),list:!!e.list,validatePaths:!!e.validatePaths,author:s(e,"author"),message:s(e,"message"),force:!!e.force},i);(r.length>0||a.length>0||l.length>0||u.length>0)&&await v(i,y),p(await F("docs",[t],e,i,y),i),i.profile&&h(`profile:command=docs took_ms=${Date.now()-n}`)}async function zo(t,e,o){let i=m(o),n=Date.now(),r=await xe(t,{format:e.format,maxDepth:s(e,"maxDepth"),collapse:e.collapse,summary:e.summary===!0,full:e.full===!0,nodeLimit:s(e,"nodeLimit"),edgeLimit:s(e,"edgeLimit"),tokenBudget:s(e,"tokenBudget"),cursor:s(e,"cursor"),direction:s(e,"direction"),...Array.isArray(e.kind)?{kind:e.kind}:{}},i);p(r,i),i.profile&&h(`profile:command=deps took_ms=${Date.now()-n}`)}function Gn(t,e={}){let o=t.command("create").argument("[type-or-title]",'Item title, or item type when a title follows (e.g. `pm create task "Fix bug"`)').argument("[title]","Item title when the first argument is an item type").description("Create a new project management item.");if(he(o,j),o.option("--stdin-json","Read a full item JSON document from stdin; explicit flags override document values").option("--body-file <path>","Load the item markdown body from a file (mutually exclusive with --body)").option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--allow-duplicate","Explicitly create even when strict similarity governance finds likely duplicates").action(wo),e.targetCommandName==="create")return;t.command("copy").argument("<id>","Source item id").option("--title <value>","Optional title override for the copied item").option("--author <value>","Mutation author").option("--message <value>","History message").option("--allow-duplicate","Explicitly copy even when strict similarity governance finds likely duplicates").description("Copy an item into a new item id while resetting lifecycle fields.").action(Po),t.command("focus").argument("[id]","Item id to focus (omit to show current focus)").option("--clear","Clear the focused item").description("Set/clear/show the session focused item that new items default --parent to.").action(No);let i=t.command("update").argument("<id>","Item id").description("Update item fields and metadata.");he(i,Se),i.option("--stdin-json","Read a full item JSON document from stdin; explicit flags override document values").option("--body-file <path>","Load the item markdown body from a file (mutually exclusive with --body)").option("--replace-deps","Atomically replace dependency entries with the provided --dep values").option("--replace-tests","Atomically replace linked test entries with the provided --test values").option("--replace-files","Atomically replace linked file entries with the provided --file values").option("--replace-docs","Atomically replace linked doc entries with the provided --doc values").option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--force","Force ownership override"),i.action($o),We(t);let n=t.command("update-many").description("Bulk-update matched items with dry-run plans and rollback checkpoints.").option("--filter-status <value>","Filter by status before applying updates").option("--filter-type <value>","Filter by item type before applying updates").option("--filter-tag <value>","Filter by tag before applying updates").option("--filter-priority <value>","Filter by priority before applying updates").option("--filter-deadline-before <value>","Filter by deadline upper bound before applying updates").option("--filter-deadline-after <value>","Filter by deadline lower bound before applying updates").option("--filter-updated-after <value>","Filter by updated_at lower bound before applying updates (ISO/relative)").option("--filter-updated-before <value>","Filter by updated_at upper bound before applying updates (ISO/relative)").option("--filter-created-after <value>","Filter by created_at lower bound before applying updates (ISO/relative)").option("--filter-created-before <value>","Filter by created_at upper bound before applying updates (ISO/relative)").option("--filter-assignee <value>","Filter by assignee before applying updates").option("--filter-assignee-filter <value>","Filter assignee presence: assigned|unassigned before applying updates").option("--filter-parent <value>","Filter by parent item ID before applying updates").option("--filter-sprint <value>","Filter by sprint before applying updates").option("--filter-release <value>","Filter by release before applying updates").option("--filter-ac-missing","Select only items missing acceptance_criteria (bulk backfill)").option("--filter-estimates-missing","Select only items missing estimated_minutes (bulk backfill)").option("--filter-resolution-missing","Select only terminal items missing resolution (bulk backfill)").option("--filter-metadata-missing","Select only items missing any tracked metadata (AC, estimate, or resolution)");et(n,"applying updates"),n.option("--ids <value>","Restrict to an explicit comma-separated ID allowlist (intersected with other filters)").option("--limit <n>","Limit matched item count before apply/preview").option("--offset <n>","Skip first n matched rows before apply/preview").option("--dry-run","Preview per-item diffs and checkpoint intent without mutating").option("--rollback <value>","Rollback a prior update-many checkpoint ID").option("--no-checkpoint","Disable checkpoint creation during apply mode").option("--title, -t <value>","Set title").option("--description, -d <value>","Set description").option("--body, -b <value>","Set body (allow empty string)").option("--status, -s <value>","Set status (use close command for closed)").option("--priority, -p <value>","Set priority").option("--type <value>","Set type").option("--tags <value>","Set comma-separated tags (replaces existing). Use --add-tags / --remove-tags to mutate additively.").option("--add-tags <value>","Add tags additively without replacing existing (repeatable; CSV accepted)",d).option("--remove-tags <value>","Remove tags from the existing list (repeatable; CSV accepted)",d).option("--deadline <value>","Set deadline (ISO/date string or relative)").option("--estimate, --estimated-minutes <value>","Set estimated minutes").option("--acceptance-criteria <value>","Set acceptance criteria").option("--ac <value>","Alias for --acceptance-criteria").option("--add-ac <value>","Add one semicolon-free acceptance criterion without replacing the existing list (repeatable)",d).option("--remove-ac <value>","Remove one semicolon-free acceptance criterion by exact text match (repeatable)",d).option("--definition-of-ready <value>","Set definition of ready").option("--order <value>","Set planning order/rank integer").option("--rank <value>","Alias for --order").option("--goal <value>","Set goal identifier").option("--objective <value>","Set objective identifier").option("--value <value>","Set business value summary").option("--impact <value>","Set business impact summary").option("--outcome <value>","Set expected outcome summary").option("--why-now <value>","Set why-now rationale").option("--assignee <value>","Set assignee").option("--parent <value>","Set parent item ID").option("--reviewer <value>","Set reviewer").option("--risk <value>","Set risk level").option("--confidence <value>","Set confidence level").option("--sprint <value>","Set sprint identifier").option("--release <value>","Set release identifier").option("--blocked-by <value>","Set blocked-by item ID or reason").option("--blocked-reason <value>","Set blocked reason").option("--unblock-note <value>","Set unblock rationale note").option("--reporter <value>","Set issue reporter").option("--severity <value>","Set issue severity").option("--environment <value>","Set issue environment context").option("--repro-steps <value>","Set issue reproduction steps").option("--resolution <value>","Set issue resolution summary").option("--expected-result <value>","Set issue expected behavior").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Set issue observed behavior").option("--actual <value>","Short alias for --actual-result").option("--affected-version <value>","Set affected version identifier").option("--fixed-version <value>","Set fixed version identifier").option("--component <value>","Set issue component ownership").option("--regression [value]","Set regression marker; bare flag means true, or pass true|false|1|0").option("--customer-impact <value>","Set customer impact summary").option("--dep <value>","Add dependency entry id=<id>,kind=<kind>,author=<author>,created_at=<timestamp>",d).option("--dep-remove <value>","Remove dependency entries by id/kind/author/timestamp signature",d).option("--replace-deps","Atomically replace dependency entries with provided --dep values").option("--replace-tests","Atomically replace linked tests with provided --test values").option("--replace-files","Atomically replace linked files with provided --file values").option("--replace-docs","Atomically replace linked docs with provided --doc values").option("--comment <value>","Add comment seed author=<value>,created_at=<iso|now>,text=<value>",d).option("--note <value>","Add note seed author=<value>,created_at=<iso|now>,text=<value>",d).option("--learning <value>","Add learning seed author=<value>,created_at=<iso|now>,text=<value>",d).option("--file <value>","Add linked file path=<value>,scope=<project|global>,note=<text>",d).option("--test <value>","Add linked test command=<value>,path=<value>,scope=<project|global>",d).option("--doc <value>","Add linked doc path=<value>,scope=<project|global>,note=<text>",d).option("--reminder <value>","Add reminder entry at=<iso|relative>|date=<iso|relative>,text=<text>|title=<text>",d).option("--event <value>","Add event entry start=<iso|relative>,end=<iso|relative>,recur_*",d).option("--type-option <value>","Set type options key=value (repeatable)",d).option("--unset <field>","Clear scalar metadata field by name (repeatable)",d).option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override"),M(n,[["--filter-assignee_filter <value>","Alias for --filter-assignee-filter"],["--estimated_minutes <value>","Alias for --estimated-minutes"],["--acceptance_criteria <value>","Alias for --acceptance-criteria"],["--definition_of_ready <value>","Alias for --definition-of-ready"],["--why_now <value>","Alias for --why-now"],["--blocked_by <value>","Alias for --blocked-by"],["--blocked_reason <value>","Alias for --blocked-reason"],["--unblock_note <value>","Alias for --unblock-note"],["--repro_steps <value>","Alias for --repro-steps"],["--expected_result <value>","Alias for --expected-result"],["--actual_result <value>","Alias for --actual-result"],["--affected_version <value>","Alias for --affected-version"],["--fixed_version <value>","Alias for --fixed-version"],["--customer_impact <value>","Alias for --customer-impact"],["--filter-estimate-missing","Alias for --filter-estimates-missing"]],!1),M(n,[["--dep_remove <value>","Alias for --dep-remove"],["--type_option <value>","Alias for --type-option"],["--add_tags <value>","Alias for --add-tags"],["--remove_tags <value>","Alias for --remove-tags"],["--add_ac <value>","Alias for --add-ac"],["--remove_ac <value>","Alias for --remove-ac"]],!0),n.action(So);let r=t.command("close").argument("<id>","Item id").argument("[text]","Close reason text (alias: --reason)").option("-r, --reason <value>","Close reason text (alias for positional <text>)").option("--close-reason <value>","Close reason text (alias for positional <text>)").option("--completed-at <value>","Actual completion timestamp (ISO or relative), distinct from tracker close time").option("-d, --duplicate-of <id>","Close as a duplicate of the canonical item id and auto-fill duplicate closure metadata").option("--author <value>","Mutation author").option("-m, --message <value>","History message").option("--validate-close [mode]",'Validate closure metadata before close: "off", "warn", or "strict" (default: settings governance preset)').option("--resolution <value>","Set the closure resolution summary inline (same field --validate-close strict checks; previously required a prior pm update)").option("--expected-result <value>","Set the expected-result note inline (closure validation field)").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Set the actual-result note inline (closure validation field)").option("--actual <value>","Short alias for --actual-result").option("--force","Force ownership override").description("Close an item. Close reason requirement follows governance.require_close_reason.");_(r,"--expected_result <value>","Alias for --expected-result",!1),_(r,"--actual_result <value>","Alias for --actual-result",!1),r.action(_o);let a=t.command("close-many").description("Bulk-close matched items with a shared reason and full runClose semantics (dry-run + rollback checkpoint).").option("--filter-status <value>","Filter by status before closing").option("--filter-type <value>","Filter by item type before closing").option("--filter-tag <value>","Filter by tag before closing").option("--filter-priority <value>","Filter by priority before closing").option("--filter-deadline-before <value>","Filter by deadline upper bound before closing").option("--filter-deadline-after <value>","Filter by deadline lower bound before closing").option("--filter-updated-after <value>","Filter by updated_at lower bound before closing (ISO/relative)").option("--filter-updated-before <value>","Filter by updated_at upper bound before closing (ISO/relative)").option("--filter-created-after <value>","Filter by created_at lower bound before closing (ISO/relative)").option("--filter-created-before <value>","Filter by created_at upper bound before closing (ISO/relative)").option("--filter-assignee <value>","Filter by assignee before closing").option("--filter-assignee-filter <value>","Filter assignee presence: assigned|unassigned before closing").option("--filter-parent <value>","Filter by parent item ID before closing").option("--filter-sprint <value>","Filter by sprint before closing").option("--filter-release <value>","Filter by release before closing");et(a,"closing"),a.option("--ids <value>","Restrict to an explicit comma-separated ID allowlist (intersected with other filters)").option("--limit <n>","Limit matched item count before apply/preview").option("--offset <n>","Skip first n matched rows before apply/preview").option("--reason <value>","Shared close reason applied to matched items (required when governance.require_close_reason is enabled)").option("--completed-at <value>","Actual completion timestamp (ISO or relative) applied to every matched item").option("--resolution <value>","Shared closure resolution applied to every matched item (closure-validation field)").option("--expected-result <value>","Shared expected-result note (closure-validation field)").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Shared actual-result note (closure-validation field)").option("--actual <value>","Short alias for --actual-result").option("--validate-close [mode]",'Validate closure metadata per item: "off", "warn", or "strict" (default: settings governance preset)').option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Re-close already-terminal matches and override ownership").option("--dry-run","Preview matched items + per-item skip/active-child plan without mutating").option("--rollback <value>","Rollback a prior close-many checkpoint ID").option("--no-checkpoint","Disable checkpoint creation during apply mode"),_(a,"--filter-assignee_filter <value>","Alias for --filter-assignee-filter",!1),_(a,"--expected_result <value>","Alias for --expected-result",!1),_(a,"--actual_result <value>","Alias for --actual-result",!1),a.action(Ao),t.command("delete").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").option("--dry-run","Preview the item file that would be deleted without mutating").description("Delete an item and record the change in history.").action(Ho),t.command("append").argument("<id>","Item id").argument("[text]","Body text; same as --body (- reads stdin)").option("--body <value>","Text to append to body (or - for stdin)").option("--text <value>","Alias for --body").option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override").description("Append text to an item's body. For concurrent writes, use pm notes.").action(Bo),t.command("restore").argument("<id>","Item id").argument("<target>","Restore target timestamp or version number").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership/lock override").description("Restore an item to an earlier timestamp or version.").action(Uo);let l=t.command("plan").description("Agent-optimized Plan item workflow: create, manage steps, link dependencies, approve, and materialize.").argument("[subcommand]","Required; Plan subcommand: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize").argument("[id]","Plan id (required for non-create subcommands); for create this may be the positional title").argument("[step]","Step reference: stable id (plan-step-001) or order integer").argument("[new-order]","New order integer for reorder-step").option("--title <value>","Plan title").option("--description <value>","Plan description").option("--scope <value>","Short scope statement of the target change or investigation").option("--parent <value>","Parent pm item id").option("--related <value>","Related pm item ids (repeatable, csv-friendly)",d).option("--blocks <value>","Pm item ids this plan blocks (repeatable, csv-friendly)",d).option("--blocked-by <value>","Pm item ids that block this plan (repeatable, csv-friendly)",d).option("--harness <value>","Plan harness provenance: codex|claude-code|cursor|generic").option("--mode <value>","Plan mode: draft|research|review|approved|executing|paused|completed|superseded").option("--resume-context <value>","Compact context summary for a future stateless agent").option("--tags <value>","Comma-separated tags").option("--priority <value>","Priority 0-4").option("--body <value>","Plan item body").option("--claim","Claim the plan on create for the author").option("--from-search <value>","Record the search query that led to plan creation").option("--template <value>","Seed plan steps from a built-in template: bug-investigation|feature-implementation|refactoring-sprint").option("--step-title <value>","Step title for add-step / update-step").option("--step <value>","Step title (repeatable on create: each --step appends an ordered step; elsewhere a single value aliases --step-title)",d).option("--step-body <value>","Step body text").option("--step-owner <value>","Step owner").option("--step-status <value>","Step status: pending|in_progress|completed|blocked|skipped|superseded").option("--step-evidence <value>","Step evidence text (used by update-step/complete-step)").option("--step-blocked-reason <value>","Step blocked reason (required when blocking)").option("--step-replacement <value>","Replacement reference for a superseded step").option("--depends-on <value>","Pm item ids the step depends on (repeatable, csv-friendly)",d).option("--link <value>","Pm item id to link (repeatable, csv-friendly)",d).option("--link-kind <value>",`Link kind: ${ke.join("|")}`).option("--link-note <value>","Optional note for the link").option("--promote-to-item-dep","Also add the linked id as a top-level item dependency when linking").option("--allow-multiple-active","Allow multiple steps to be in_progress at once").option("--file <value>","Step linked file path=<value>[,scope=project|global,note=<text>] (repeatable)",d).option("--test <value>","Step linked test command=<value>[,path=<value>,note=<text>] (repeatable)",d).option("--doc <value>","Step linked doc path=<value>[,scope=project|global,note=<text>] (repeatable)",d).option("--decision-text <value>","Decision log entry text").option("--decision <value>","Alias for --decision-text").option("--decision-rationale <value>","Decision log entry rationale").option("--decision-evidence <value>","Decision log entry evidence").option("--discovery-text <value>","Discovery log entry text").option("--discovery <value>","Alias for --discovery-text").option("--validation-text <value>","Validation log entry text").option("--validation <value>","Alias for --validation-text").option("--validation-command <value>","Validation log entry command").option("--validation-expected <value>","Validation log entry expected outcome").option("--depth <value>","Show depth: brief|standard|deep (default: brief)").option("--fields <value>","Comma-separated field projection for show output").option("--steps <value>","Comma-separated step ids/orders for materialize").option("--materialize-type <value>","Item type for materialized steps (default: Task)").option("--materialize-parent <value>","Parent item id for materialized children (default: the plan)").option("--materialize-tags <value>","Comma-separated tags for materialized children").option("--field <name=value>","Custom field value forwarded to every materialized child (repeatable)",d).option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override");he(l,j.filter(k=>ro.has(k.target))),M(l,[["--resume_context <value>","Alias for --resume-context"],["--from_search <value>","Alias for --from-search"],["--step_title <value>","Alias for --step-title"],["--step_body <value>","Alias for --step-body"],["--step_owner <value>","Alias for --step-owner"],["--step_status <value>","Alias for --step-status"],["--step_evidence <value>","Alias for --step-evidence"],["--step_blocked_reason <value>","Alias for --step-blocked-reason"],["--step_replacement <value>","Alias for --step-replacement"],["--link_kind <value>","Alias for --link-kind"],["--link_note <value>","Alias for --link-note"],["--promote_to_item_dep","Alias for --promote-to-item-dep"],["--allow_multiple_active","Alias for --allow-multiple-active"],["--decision_text <value>","Alias for --decision-text"],["--decision_rationale <value>","Alias for --decision-rationale"],["--decision_evidence <value>","Alias for --decision-evidence"],["--discovery_text <value>","Alias for --discovery-text"],["--validation_text <value>","Alias for --validation-text"],["--validation_command <value>","Alias for --validation-command"],["--validation_expected <value>","Alias for --validation-expected"],["--materialize_type <value>","Alias for --materialize-type"],["--materialize_parent <value>","Alias for --materialize-parent"],["--materialize_tags <value>","Alias for --materialize-tags"]],!1),M(l,[["--blocked_by <value>","Alias for --blocked-by"],["--depends_on <value>","Alias for --depends-on"]],!0),l.action(Ro),t.command("history-redact").argument("<id>","Item id").option("--literal <value>","Literal string to redact (repeatable)",d).option("--regex <value>","Regex pattern to redact (repeatable; accepts /pattern/flags or raw pattern)",d).option("--replacement <value>",'Replacement string (default: "[redacted]")').option("--dry-run","Preview redaction impact without writing item/history files").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the redaction marker entry").option("--force","Force ownership/lock override").description("Redact sensitive literals/patterns from an item history stream and recompute hashes.").action(async(k,g,R)=>{let A=m(R),I=Date.now(),S=Array.isArray(g.literal)?g.literal:void 0,$=Array.isArray(g.regex)?g.regex:void 0,x=await V(k,{literal:S,regex:$,replacement:typeof g.replacement=="string"?g.replacement:void 0,dryRun:g.dryRun===!0,author:typeof g.author=="string"?g.author:void 0,message:typeof g.message=="string"?g.message:void 0,force:!!g.force},A);x.changed&&!x.dry_run&&await v(A,x),p(x,A),A.profile&&h(`profile:command=history-redact took_ms=${Date.now()-I}`)}),t.command("history-repair").argument("[id]","Item id (omit with --all)").option("--all","Scan every stream for drift and repair each drifted stream in one audited pass").option("--dry-run","Preview the re-anchor impact without writing the history file").option("--normalize-provenance","Remove invalid provenance; return aggregate-only evidence").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the repair marker entry").option("--force","Force ownership/lock override").description("Re-anchor a drifted item history chain (recompute hashes, reconcile with the on-disk item) and record an audit marker. Use --all to repair every drifted stream.").action(async(k,g,R)=>{let A=m(R),I=Date.now(),S=g.all===!0;ne(k,S);let $={dryRun:g.dryRun===!0,author:typeof g.author=="string"?g.author:void 0,message:typeof g.message=="string"?g.message:void 0,force:!!g.force,normalizeProvenance:g.normalizeProvenance===!0};if(S){let x=await ae($,A);p(x,A),x.totals.failed>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let x=await ie(k,$,A);p(x,A)}A.profile&&h(`profile:command=history-repair took_ms=${Date.now()-I}`)}),Xe(t),t.command("history-compact").argument("[id]","Item id (omit when using a bulk selector)").option("--before <value>","Compact entries strictly before this version number or ISO timestamp (single-id mode only)").option("--ids <value>","Bulk: compact an explicit comma-separated list of item ids").option("--all-over <n>","Bulk: compact every stream with more than N entries").option("--closed","Bulk: compact only closed (terminal) items' streams").option("--all-streams","Bulk: compact every history stream regardless of lifecycle state").option("--min-entries <n>","Bulk: skip streams with at most N entries (already compact; default 3)").option("--dry-run","Preview compaction impact without writing the history file").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the compaction marker entry").option("--force","Force ownership/lock override").description("Compact item history streams into a synthetic baseline plus retained tail entries. Pass an item id for one stream, or a bulk selector (--ids/--all-over/--closed/--all-streams) to compact many.").action(Oo),t.command("merge").argument("<subcommand>","Merge subcommand: install, reconcile, report, driver").argument("[artifact]",`driver only: artifact class to merge (${te.join(", ")})`).argument("[base]","driver only: common-ancestor file path (git %O)").argument("[ours]","driver only: current-branch file path (git %A)").argument("[theirs]","driver only: other-branch file path (git %B)").option("--dry-run","install/reconcile: preview changes without writing").option("--message <text>","reconcile only: audit message recorded on repaired history streams").option("--force","reconcile only: permit the underlying audited history ownership override").option("--include-reconciled","report only: include clone-local receipts already recorded in history").option("--output <path>","driver only: write the merged content to this path instead of the ours path").option("--item-path <path>","driver only: original repository-relative path supplied by git as %P").option("--prefer <side>","driver only: side that wins unresolvable conflicts (ours|theirs; default ours)").description("Install merge drivers, reconcile or report post-merge history, or run a field-aware driver.").action(Eo);let u=t.command("schema").argument("[subcommand]","Required; Schema subcommand: list, show, show-status, add/remove type/status/field, rename-type, rename-field, remap-status, or a custom item type name shorthand").argument("[name]","Definition name, or source name for rename/remap migrations").option("--description <text>","Human description for the custom item type, status, or field").option("--default-status <status>","Default status hint recorded for the custom item type").option("--folder <dir>","Storage folder for items of this custom type").option("--alias <name>","Alias for the custom type, status, or field flag (repeatable, csv-friendly)",d).option("--role <value>","Lifecycle role for a custom status (repeatable): draft, active, blocked, terminal, terminal_done, terminal_canceled, default_open, default_close, default_cancel",d).option("--order <n>","Display/sort order for a custom status").option("--type <type>","Value type for a custom field (add-field): string, number, boolean, string_array, array, object").option("--commands <list>","Commands a custom field is wired onto (add-field; repeatable, comma-friendly): create, update, update_many, list, search, calendar, context",d).option("--cli-flag <flag>","Override the auto-derived CLI flag for a custom field (add-field)").option("--required","Mark a custom field as always required (add-field)").option("--required-on-create","Mark a custom field as required at create time (add-field)").option("--no-allow-unset","Disallow clearing a custom field via --unset (add-field)").option("--required-types <list>","Restrict a custom field's requirement to specific item types (add-field; repeatable, comma-friendly)",d).option("--infer","Infer custom item types from title-prefix conventions (add-type; preview unless --apply)").option("--min-count <n>","Minimum items sharing a prefix for add-type --infer (default 10)").option("--apply","Register inferred types (add-type --infer); without it the command previews only").option("--to <name>","Target definition name for rename/remap migrations").option("--migration-id <id>","Stable idempotency key for a resumable schema migration").option("--dry-run","Plan a schema migration without writing schema, items, or history").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("Inspect and manage config-driven runtime schema (types, statuses, fields, presets).");_(u,"--default_status <status>","Alias for --default-status",!1),_(u,"--migration_id <id>","Alias for --migration-id",!1),u.action(Fo),t.command("profile").argument("[subcommand]","Required; Profile subcommand: list, show, apply, or lint").argument("[name]","Profile name for show/apply/lint: agile, ops, or research").option("--dry-run","Preview the apply diff without writing any files (apply)").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("List, show, apply, and lint project profiles \u2014 archetype bundles of item types, statuses, fields, workflows, config, templates, and recommended packages.").action(Go),Ze(t,mo);let b=t.command("files").description("Manage files linked to an item.");b.argument("<id>","Item id").option("--add <value>","Add linked file entry (CSV/markdown pairs or - for stdin)",d).option("--add-glob <value>","Add linked file entries from a glob (plain glob or pattern=<glob>,scope=<scope>,note=<text>; repeatable)",d).option("--remove <value>","Remove linked file by path only (path=<value>, path:<value>, plain path, or - for stdin); does not accept note=/scope= \u2014 record removal context with --message",d).option("--migrate <value>","Migrate linked file paths in-place (from=<prefix>,to=<prefix>; repeatable)",d).option("--note <value>","Note attached to every link added by --add/--add-glob in this invocation (embedded note= wins)").option("--list","List linked files without mutating").option("--append-stable","Preserve existing linked-file order and append new links without full-array resorting").option("--validate-paths","Validate linked file paths for existence and file shape").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").action(qo),b.command("discover").argument("<id>","Item id").option("--apply","Add discovered missing files to the item").option("--note <value>","Note to attach to discovered file links").option("--append-stable","Preserve existing linked-file order and append discovered links without full-array resorting").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Discover existing file paths referenced in item text and optionally link missing files.").action(jo),Qe(b),t.command("docs").argument("<id>","Item id").option("--add <value>","Add linked doc entry (CSV/markdown pairs or - for stdin)",d).option("--add-glob <value>","Add linked doc entries from a glob (plain glob or pattern=<glob>,scope=<scope>,note=<text>; repeatable)",d).option("--remove <value>","Remove linked doc by path only (path=<value>, path:<value>, plain path, or - for stdin); does not accept note=/scope= \u2014 record removal context with --message",d).option("--migrate <value>","Migrate linked doc paths in-place (from=<prefix>,to=<prefix>; repeatable)",d).option("--note <value>","Note attached to every link added by --add/--add-glob in this invocation (embedded note= wins)").option("--list","List linked docs without mutating").option("--validate-paths","Validate linked doc paths for existence and file shape").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage docs linked to an item.").action(Vo),t.command("deps").argument("<id>","Item id").option("--format <value>","Output format (tree, graph, or context)","tree").option("--max-depth <value>","Maximum dependency traversal depth (0 keeps only the root)").option("--collapse <value>","Collapse mode (none or repeated)","none").option("--summary","Return counts only without full tree/graph payload").option("--full","Return the complete dependency row projection").option("--node-limit <value>","Maximum nodes in context output").option("--edge-limit <value>","Maximum edges and missing-reference rows in context output").option("--token-budget <value>","Maximum estimated tokens in context output").option("--cursor <value>","Continue an equivalent context query").option("--direction <value>","Context traversal direction (outgoing, incoming, or both)").option("--kind <value>","Restrict context traversal to registered relationship kinds (repeatable or comma-separated)",d).description("Show dependency relationships for an item.").action(zo)}export{ge as looksLikeSchemaSubcommandTypo,mo as parsePositiveIntOption,H as parseSchemaOrderOption,he as registerCommanderOptionContracts,Gn as registerMutationCommands};
20
- //# sourceMappingURL=register-mutation-7IY2D5KO.js.map
@@ -1,2 +0,0 @@
1
- import"./chunk-QWRRFYK3.js";import{Fd as re,Ta as N,Xc as ee,cb as $,ec as x,hc as q,ic as J,jc as z,kc as G,od as te,pb as B,pc as E,pd as ne,qb as H,qc as j,ra as V,rb as D,rc as W,rd as ae,sc as Y,tc as K,uc as X,wc as Q,xc as Z,xd as oe,yb as U,yd as ie,zd as T}from"./chunk-OCLPLFAY.js";import"./chunk-N3DSV4CH.js";import"./chunk-S4IRYKBU.js";import"./chunk-WYRZZ5ZE.js";import{Ac as C,C as m,Ch as I,Dm as p,E as b,Va as _,Wf as l,Xd as P,Xf as u,ca as S,cd as R,cm as M,gm as c,jm as w,km as s,lm as k,nm as F,om as L}from"./chunk-2MA6ZQVZ.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]="13159f49-7756-58b8-ac32-7ddd571e7d09")}catch{}})();var se=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"]]),fe=new Set(["higher","lower","target"]),pe=[...se.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function ye(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(n=>typeof n=="string"):e==="direction"&&fe.has(t)}function le(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(n){throw new b(`--analytics must be valid JSON: ${String(n)}`,m.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new b("--analytics must be a JSON object.",m.USAGE);for(let[n,a]of Object.entries(t)){let o=se.get(n);if(!ye(o,a))throw new b(o===void 0?`Unknown --analytics field "${n}". Accepted fields: ${pe}.`:`--analytics field "${n}" must be ${o.replace("_"," ")}.`,m.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]="eee25545-a7e9-54be-abc0-dbccc9b41e74")}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]="b0095f00-00bd-5b28-933c-b63a1711a73d")}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]="99355d20-090b-503e-8079-b858291938e3")}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]="35276f20-abc5-54e2-8251-35971f1fcb4f")}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]="8fa4af33-ba9f-5a19-a359-c64143287b5d")}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]="52c4154e-2761-5230-942c-6ac5e83a830c")}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]="c3fceb32-e0b9-5690-8653-4c699f865c0f")}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]="1e42a508-5568-522f-843d-61febc0bad27")}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]="43769e60-ed80-521d-9375-c28ee5b0ac06")}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]="3f1deb3b-e341-533a-a349-eca48f347600")}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]="91a42861-f8cb-575b-8596-53870f6275c6")}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]="c85956ff-383f-5482-96a9-0ef38949859c")}catch{}})();var ce=(e,t)=>N(e,t,{runUpdate:(n,a,o)=>x(n,a,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]="41d01430-1e95-5f09-9a2f-7e7f8fad8184")}catch{}})();async function ge(e,t,n,a,o){let i=c(o),r=e==="run",d=e==="verdicts",g=e==="presets"||e==="apply",f=e==="promote",h=await $({action:e,...r||d||g||f?{}:{kind:t},id:r||d||f?n??t:n,preset:g?n??t:void 0,definition:s(a,"definition"),trigger:s(a,"trigger"),tree:s(a,"tree"),gate:s(a,"gate"),limit:s(a,"limit"),dry_run:a.dryRun===!0,fullChangedFields:i.fullChangedFields,idOnly:i.idOnly,author:s(a,"author"),message:s(a,"message"),owner:s(a,"owner"),apply:a.apply===!0,enforcement:s(a,"enforcement")},i);l(h,i),typeof h=="object"&&h!==null&&"exit_code"in h&&h.exit_code===1&&(process.exitCode=1)}function de(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(ge)}(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]="975321a1-0375-5829-a012-f23e32e9c6bf")}catch{}})();function he(e,t){let n=e?.trim().toLowerCase(),a=t?.trim().toLowerCase();if(n===void 0||n.length===0)return a;if(n==="local-analytics")return a&&a.length>0?a:"status";if(a!==void 0&&a.length>0)throw S({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 n}function be(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 we(e,t){if(e.background===!0){if(e.run!==!0)throw new b("--background requires --run",m.USAGE);if(t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new b("--background does not support --add/--add-json/--remove/--remove-index; update linked tests first, then run in background",m.USAGE)}}async function ke(e,t,n,a){let o=await T({kind:"test",commandArgs:F(e,{...t,add:a.addValues,addJson:a.addJsonValues,remove:a.removeValues,removeIndex:a.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:n.noExtensions===!0},n);l(o,n)}function ve(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,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,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}}async function xe(e,t,n,a){let o=await oe(e,ve(t,a),n);(a.addValues.length>0||a.addJsonValues.length>0||a.removeValues.length>0||t.run===!0||a.removeIndexValues.length>0)&&await p(n,o),l(o,n),(o.run_results.some(i=>i.status==="failed")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=m.DEPENDENCY_FAILED)}async function Ae(e,t,n){let a=c(n),o=Date.now(),i=be(t);we(t,i),t.background===!0?await ke(e,t,a,i):await xe(e,t,a,i),a.profile&&u(`profile:command=test took_ms=${Date.now()-o}`)}function A(e){let t=s(e,"author"),n=s(e,"assignee");if(t!==void 0&&n!==void 0&&t!==n)throw new b("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",m.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm start-task pm-123","pm release pm-123"]});return{author:t??n,message:s(e,"message")}}async function _e(e,t){let n=c(t),a=Date.now();if(e.background===!0){let r=await T({kind:"test-all",commandArgs:L(e),statusFilter:s(e,"status"),noExtensions:n.noExtensions===!0},n);l(r,n),n.profile&&u(`profile:command=test-all took_ms=${Date.now()-a}`);return}let i=await ie({status:s(e,"status"),limit:s(e,"limit"),offset:s(e,"offset"),timeout:s(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:s(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext},n);await p(n,{ids:i.results.map(r=>r.id)}),l(i,n),(i.failed>0||i.fail_on_skipped_triggered===!0)&&(process.exitCode=m.DEPENDENCY_FAILED),n.profile&&u(`profile:command=test-all took_ms=${Date.now()-a}`)}async function Ie(e,t,n,a){let o=c(a),i=Date.now(),r=await ae({subcommand:he(e,t),limit:s(n,"limit")},o);l(r,o),o.profile&&u(`profile:command=telemetry took_ms=${Date.now()-i}`)}async function De(e,t){let n=c(t),a=Date.now(),o=le(s(e,"analytics")),i=await te(n,{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:s(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...o});i.recorded_observations?.some(r=>r.changed)===!0&&await p(n,{ids:i.recorded_observations?.flatMap(r=>r.observation.item_id?[r.observation.item_id]:[])}),l(i,n),n.profile&&u(`profile:command=stats took_ms=${Date.now()-a}`)}async function Se(e,t){let n=c(t),a=Date.now(),o=s(e,"threshold"),i=s(e,"limit"),r=await ne(n,{status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:s(e,"since"),...o===void 0?{}:{threshold:Number(o)},...i===void 0?{}:{limit:Number(i)}});l(r,n),n.profile&&u(`profile:command=duplicates took_ms=${Date.now()-a}`)}async function Ce(e,t){let n=c(t),a=Date.now(),o=!!e.strictExit||!!e.failOnWarn,i=await V(n,{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});l(i,n),o&&!i.ok&&(C({...i,exit_code:m.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=m.GENERIC_FAILURE),n.profile&&u(`profile:command=health took_ms=${Date.now()-a}`)}async function Re(e,t){let n=c(t),a=Date.now(),o=await ce({checkMetadata:!!e.checkMetadata,metadataProfile:s(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:s(e,"dependencyCycleSeverity"),parentCycleSeverity:s(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:s(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},n);l(o,n),(e.strictExit||e.failOnWarn)&&(o.has_warnings||!o.ok)&&(C({...o,exit_code:m.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=m.GENERIC_FAILURE),n.profile&&u(`profile:command=validate took_ms=${Date.now()-a}`)}async function Be(e,t){let n=c(t),a=Date.now(),o=await q(n,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});l(o,n),n.profile&&u(`profile:command=gc took_ms=${Date.now()-a}`)}async function Ee(e,t,n,a){let o=c(a),i=_(process.cwd(),o.path),r=e.trim().toLowerCase();if(!E.some(d=>d===r))throw S({command_path:"workspace snapshot",token:e,allowed:E,display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(r==="list"){l(await Y(i),o);return}if(r==="create"){l(await j(i,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new b(`pm workspace snapshot ${r} requires a snapshot name or fingerprint`,m.USAGE);if(r==="inspect"){l(await W(i,t),o);return}if(r==="restore"){if(n.dryRun===!0){l(await K(i,t),o);return}let d=await I(i);l(await X(i,t,{force:n.force===!0,author:P(s(n,"author"),d.author_default),message:s(n,"message"),lockTtlSeconds:d.locks.ttl_seconds,lockWaitMs:d.locks.wait_ms}),o);return}l(await Q(i,t),o)}async function Te(e,t){let n=c(t),a=Date.now(),o=await ee({action:s(e,"action"),command:s(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},n);l(o,n),n.profile&&u(`profile:command=contracts took_ms=${Date.now()-a}`)}async function Oe(e,t,n){let a=c(n),o=Date.now(),i={...A(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts};Pe(e,t.next===!0);let r=t.next===!0?await H(!!t.force,a,i,{type:typeof t.type=="string"?t.type:void 0,tag:typeof t.tag=="string"?t.tag:void 0,priority:t.priority,assigneeFilter:typeof t.assigneeFilter=="string"?t.assigneeFilter:void 0,parent:typeof t.parent=="string"?t.parent:void 0,sprint:typeof t.sprint=="string"?t.sprint:void 0,release:typeof t.release=="string"?t.release:void 0,includeDecisions:t.includeDecisions===!0,tokenBudget:t.tokenBudget??t.token_budget,explainRanking:t.explainRanking===!0||t.explain_ranking===!0}):await B(e,!!t.force,a,i);await p(a,r),l(r,a),a.profile&&u(`profile:command=claim took_ms=${Date.now()-o}`)}function Pe(e,t){if(!t&&!e)throw new b("Specify an item id or pass --next",m.USAGE);if(t&&e)throw new b("Specify either an item id or --next, not both",m.USAGE)}async function Me(e,t,n){let a=c(n),o=Date.now(),i=await D(e,!!t.force,a,{...A(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0});await p(a,i),l(await M("release",[e],t,a,i),a),a.profile&&u(`profile:command=release took_ms=${Date.now()-o}`)}async function Fe(e,t,n){let a=c(n),o=Date.now(),i=_(process.cwd(),a.path),r=await I(i),d=R(r.schema),g=Z(d),f=!!t.force,h=A(t),v=await B(e,f,a,h);await p(a,v);let O=await x(e,{...h,status:g,force:f},a);await p(a,O),l({id:e,action:"start_task",claim:v,update:O},a),a.profile&&u(`profile:command=start-task took_ms=${Date.now()-o}`)}async function Le(e,t,n){let a=c(n),o=Date.now(),i=_(process.cwd(),a.path),r=await I(i),d=R(r.schema),g=!!t.force,f=A(t),h=await x(e,{...f,status:d.open_status,force:g},a);await p(a,h);let v=await D(e,g,a,f);await p(a,v),l({id:e,action:"pause_task",update:h,release:v},a),a.profile&&u(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function Ve(e,t,n,a){let o=c(a),i=Date.now(),r=!!n.force,d=A(n),g=await U(e,t,{...d,validateClose:s(n,"validateClose"),force:r},o);await p(o,g);let f=await D(e,r,o,d);await p(o,f),l({id:e,action:"close_task",close:g,release:f},o),o.profile&&u(`profile:command=close-task took_ms=${Date.now()-i}`)}function ue(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds").option("--progress","Emit linked-test progress to stderr (always shown in TTY, opt-in for non-TTY)").option("--env-set <value>","Set environment variable(s) for linked-test runs (KEY=VALUE, repeatable)",w).option("--env-clear <value>","Clear environment variable(s) for linked-test runs (NAME, repeatable)",w).option("--shared-host-safe","Apply additive shared-host-safe runtime defaults for linked-test runs").option("--pm-context <mode>","PM linked-test context mode: schema|tracker|auto (default: schema)").option("--override-linked-pm-context","Force run-level --pm-context to override per-linked-test pm_context_mode metadata").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","Treat successful linked-test commands that report zero executed tests as failures").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Preflight linked PM command context diagnostics before executing commands").option("--auto-pm-context","Auto-remediate PM tracker-read context mismatches by routing those linked commands through tracker context")}function Vt(e){de(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add linked test entry (CSV/markdown pairs or - for stdin)",w).option("--add-json <value>","Add linked test entry from JSON object/array (or - for stdin)",w).option("--remove <value>","Remove linked test entry by exact command/path (command=<value> and path=<value> preserve commas and equals signs; or - for stdin)",w).option("--remove-index <n>","Remove the 1-based linked-test index from --list order (repeatable)",w).option("--list","List linked tests without mutating").option("--run","Run linked test commands").option("--match <value>","Run only linked tests whose command/path contains this substring").option("--only-index <n>","Run only the 1-based linked-test index from --list order").option("--only-last","Run only the most recently added linked test");ue(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...] evidence; repeatable",w).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(Ae);let n=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");ue(n).action(_e),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(g,f,h)=>{let v=c(h);await re(g,v)}),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(Ie),e.command("duplicates").description("Find existing duplicate clusters across all statuses without creating an item.").option("--status <value>","Lifecycle status to include (repeatable or comma-separated)",w,[]).option("--since <value>","Only inspect items created at or after this time").option("--threshold <value>","Minimum similarity score from 0 through 1").option("--limit <n>","Maximum duplicate clusters to return").action(Se),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(De),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(Ce),e.command("validate").description("Run standalone metadata, resolution, lifecycle, files, linked-command reference, and history drift validation checks.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Select metadata validation profile for --check-metadata (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").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 validate diagnostic ID lists instead of compact summaries").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 the safe, deterministic subset of fix-hint remediations (field backfills) automatically").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, lifecycle; comma-separated or repeatable). Default: metadata, resolution; lifecycle must be named explicitly",w).option("--prune-missing","Remove stale linked-file/doc LINKS whose paths classified as deleted (never touches 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(Re),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",w).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Be),e.command("workspace").description("Manage portable workspace-level SDK primitives.").command("snapshot").argument("<action>","Snapshot action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Create, inspect, list, restore, or delete 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(Ee),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(Te);let a=e.command("claim").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 silently when the item is already claimed by another author (returns 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("--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(Oe);k(a,"--assignee <value>","Alias for --author on lifecycle ownership commands"),k(a,"--token_budget <n>","Alias for --token-budget"),k(a,"--explain_ranking","Alias for --explain-ranking");let o=e.command("release").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force release override").description("Release an item's active claim.").action(Me);k(o,"--assignee <value>","Alias for --author on lifecycle ownership commands");let i=e.command("start-task").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(Fe);k(i,"--assignee <value>","Alias for --author on lifecycle ownership commands");let r=e.command("pause-task").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(Le);k(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let d=e.command("close-task").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(Ve);k(d,"--assignee <value>","Alias for --author on lifecycle ownership commands"),Ne(e)}function y(e){return typeof e=="string"?e:void 0}function me(e){return{parent:y(e.parent),allowMissingParent:e.allowMissingParent===!0?!0:void 0,tags:y(e.tags),priority:y(e.priority),body:y(e.body),description:y(e.description),author:y(e.author),message:y(e.message)}}function Ne(e){for(let{name:t,describe:n}of[{name:"meet",describe:"Shortcut: create a Meeting with a start time and duration."},{name:"event",describe:"Shortcut: create an Event with a start time and duration."}])e.command(t).argument("<title>","Item title").option("--start <when>","Start time (ISO, 'now', or relative like +1h/+2d); defaults to now").option("--duration <span>","Duration from start (relative like 1h/2d); defaults to 1h when --end is omitted").option("--end <when>","End time (ISO or relative); overrides --duration").option("--location <value>","Location").option("--timezone <value>","IANA timezone (for example America/New_York)").option("--all-day","Mark as an all-day event").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description(n).action(async(a,o,i)=>{let r=c(i),d=Date.now(),f=await(t==="meet"?J:z)(a,{...me(o),start:y(o.start),duration:y(o.duration),end:y(o.end),location:y(o.location),timezone:y(o.timezone),allDay:o.allDay===!0?!0:void 0},r);await p(r,f),l(f,r),r.profile&&u(`profile:command=${t} took_ms=${Date.now()-d}`)});e.command("remind").argument("<title>","Item title").option("--at <when>","Reminder time (ISO, 'now', or relative like +2d); defaults to +1d").option("--text <value>","Reminder text; defaults to the title").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description("Shortcut: create a Reminder from a single point in time.").action(async(t,n,a)=>{let o=c(a),i=Date.now(),r=await G(t,{...me(n),at:y(n.at),text:y(n.text)},o);await p(o,r),l(r,o),o.profile&&u(`profile:command=remind took_ms=${Date.now()-i}`)})}export{Vt as registerOperationCommands,Pe as requireClaimTarget};
2
- //# sourceMappingURL=register-operations-FALL3YTU.js.map