@unbrained/pm-cli 2026.11.23 → 2026.11.25

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 (209) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/error-guidance.js +5 -5
  3. package/dist/cli/main.js +5 -5
  4. package/dist/cli/register-annotations.js +1 -1
  5. package/dist/cli/runtime/invocation-options.js +1 -1
  6. package/dist/cli-bundle/bundle-manifest.json +1 -1
  7. package/dist/cli-bundle/chunks/chunk-4FZH5BTV.js +2 -0
  8. package/dist/cli-bundle/chunks/{chunk-YYT3MIRF.js → chunk-6OIHST4I.js} +1 -1
  9. package/dist/cli-bundle/chunks/chunk-7EPYCU7U.js +9 -0
  10. package/dist/cli-bundle/chunks/{chunk-AEOHUSUI.js → chunk-BVJMVU4Z.js} +68 -68
  11. package/dist/cli-bundle/chunks/{chunk-2UQU7HRR.js → chunk-C4KIZQHW.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-CNUFU454.js +113 -0
  13. package/dist/cli-bundle/chunks/chunk-CONBVY2O.js +2 -0
  14. package/dist/cli-bundle/chunks/{chunk-BSRIVYTM.js → chunk-CZEMEPPQ.js} +3 -3
  15. package/dist/cli-bundle/chunks/chunk-DF6A7C32.js +2 -0
  16. package/dist/cli-bundle/chunks/chunk-FHLOGAGA.js +8 -0
  17. package/dist/cli-bundle/chunks/chunk-FVY7U3SU.js +125 -0
  18. package/dist/cli-bundle/chunks/{chunk-F2Z6XLZB.js → chunk-GBVF2ZB3.js} +2 -2
  19. package/dist/cli-bundle/chunks/chunk-GZI7ZAB7.js +2 -0
  20. package/dist/cli-bundle/chunks/chunk-HZZLSBIJ.js +2 -0
  21. package/dist/cli-bundle/chunks/chunk-K34FR5CO.js +3 -0
  22. package/dist/cli-bundle/chunks/{chunk-D6PDUKUG.js → chunk-KHFUHGL3.js} +2 -2
  23. package/dist/cli-bundle/chunks/chunk-L6VS7F3R.js +2 -0
  24. package/dist/cli-bundle/chunks/chunk-LOX3VY4T.js +2 -0
  25. package/dist/cli-bundle/chunks/{chunk-H7JEXRIN.js → chunk-LPW7S5KA.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-5DUP4AZA.js → chunk-MGJMQSN4.js} +2 -2
  27. package/dist/cli-bundle/chunks/chunk-OS5W4ZG2.js +31 -0
  28. package/dist/cli-bundle/chunks/{chunk-O7JHS64G.js → chunk-OWK2JL4I.js} +2 -2
  29. package/dist/cli-bundle/chunks/chunk-SCIPT7WF.js +2 -0
  30. package/dist/cli-bundle/chunks/chunk-SX76UGEY.js +3 -0
  31. package/dist/cli-bundle/chunks/{chunk-CFWLQFJM.js → chunk-VA4T37Q4.js} +50 -51
  32. package/dist/cli-bundle/chunks/chunk-WQOEVGLQ.js +2 -0
  33. package/dist/cli-bundle/chunks/chunk-XHCIOLJP.js +3 -0
  34. package/dist/cli-bundle/chunks/{chunk-J2PDAVBC.js → chunk-XKWJONAO.js} +2 -2
  35. package/dist/cli-bundle/chunks/chunk-YIGBEY7K.js +2 -0
  36. package/dist/cli-bundle/chunks/chunk-ZBOQEZ2H.js +33 -0
  37. package/dist/cli-bundle/chunks/chunk-ZLICQPRG.js +3 -0
  38. package/dist/cli-bundle/chunks/field-option-collisions-QE65APSD.js +2 -0
  39. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-BPYKN5Q7.js → indexed-receipt-blobs-H3MMNXXG.js} +2 -2
  40. package/dist/cli-bundle/{focused-chunks/item-revision-YDACCDVY.js → chunks/item-revision-INDHJV6X.js} +2 -2
  41. package/dist/cli-bundle/chunks/item-transaction-LCKK4XXB.js +2 -0
  42. package/dist/cli-bundle/chunks/mutation-actor-KU7BMLUN.js +2 -0
  43. package/dist/cli-bundle/chunks/mutation-admission-3OMCTQD4.js +2 -0
  44. package/dist/cli-bundle/chunks/{register-list-query-L4IBU64P.js → register-list-query-3GV3LBOT.js} +2 -2
  45. package/dist/cli-bundle/chunks/register-mutation-GZLF47SX.js +21 -0
  46. package/dist/cli-bundle/chunks/register-operations-PBJZGCAL.js +2 -0
  47. package/dist/cli-bundle/chunks/register-setup-ZLJEF6NZ.js +2 -0
  48. package/dist/cli-bundle/chunks/runtime-schema-Y4SHTEXL.js +2 -0
  49. package/dist/cli-bundle/chunks/{settlement-hook-6MR32OOC.js → settlement-hook-ESAAEBRM.js} +2 -2
  50. package/dist/cli-bundle/chunks/stage-3WIZBD4N.js +2 -0
  51. package/dist/cli-bundle/focused-chunks/chunk-3Y5PTQ2F.js +27 -0
  52. package/dist/cli-bundle/focused-chunks/{chunk-Y2ESLKCF.js → chunk-4LQL4EO6.js} +3 -3
  53. package/dist/cli-bundle/focused-chunks/{chunk-RIE3SJSE.js → chunk-4SX2BN4V.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-ZHWPCVQL.js → chunk-5RBC4WSE.js} +39 -39
  55. package/dist/cli-bundle/focused-chunks/chunk-7SSGTGZO.js +91 -0
  56. package/dist/cli-bundle/focused-chunks/chunk-A4R57E4K.js +2 -0
  57. package/dist/cli-bundle/focused-chunks/chunk-BOIMP2AR.js +5 -0
  58. package/dist/cli-bundle/focused-chunks/chunk-BYQK5DGH.js +2 -0
  59. package/dist/cli-bundle/focused-chunks/chunk-C3FEDTSD.js +44 -0
  60. package/dist/cli-bundle/focused-chunks/chunk-IAOKVKWW.js +2 -0
  61. package/dist/cli-bundle/focused-chunks/chunk-JOKRDFMQ.js +2 -0
  62. package/dist/cli-bundle/focused-chunks/chunk-MB56Y4M6.js +8 -0
  63. package/dist/cli-bundle/focused-chunks/{chunk-A6VEMCRR.js → chunk-NGFDPEP7.js} +1 -1
  64. package/dist/cli-bundle/focused-chunks/chunk-OCKKIECS.js +3 -0
  65. package/dist/cli-bundle/focused-chunks/chunk-PKX2EHE3.js +26 -0
  66. package/dist/cli-bundle/focused-chunks/chunk-SXC2EO3E.js +3 -0
  67. package/dist/cli-bundle/focused-chunks/chunk-TQIKDFOD.js +2 -0
  68. package/dist/cli-bundle/focused-chunks/chunk-TRL4JDWX.js +8 -0
  69. package/dist/cli-bundle/focused-chunks/{chunk-IROZDIDX.js → chunk-UWWAVXG4.js} +2 -2
  70. package/dist/cli-bundle/focused-chunks/chunk-VMYVN36N.js +13 -0
  71. package/dist/cli-bundle/focused-chunks/chunk-VU2PH4PF.js +2 -0
  72. package/dist/cli-bundle/focused-chunks/chunk-WL2R7T5G.js +2 -0
  73. package/dist/cli-bundle/focused-chunks/chunk-WVA5KOXF.js +3 -0
  74. package/dist/cli-bundle/focused-chunks/{chunk-QQIIMMFU.js → chunk-X4EWD6TL.js} +2 -2
  75. package/dist/cli-bundle/focused-chunks/chunk-XKLBTDJ7.js +100 -0
  76. package/dist/cli-bundle/focused-chunks/chunk-YYEWIKNI.js +2 -0
  77. package/dist/cli-bundle/focused-chunks/chunk-ZLRRII55.js +2 -0
  78. package/dist/cli-bundle/focused-chunks/field-option-collisions-5ROXGUME.js +2 -0
  79. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-EGEJMG3G.js → indexed-receipt-blobs-PG2VJ3MB.js} +2 -2
  80. package/dist/cli-bundle/focused-chunks/item-revision-KYMSQVZE.js +2 -0
  81. package/dist/cli-bundle/focused-chunks/item-transaction-I4HLVHEJ.js +2 -0
  82. package/dist/cli-bundle/focused-chunks/mutation-actor-GGOQKAE6.js +2 -0
  83. package/dist/cli-bundle/focused-chunks/mutation-admission-OS36ZCMH.js +2 -0
  84. package/dist/cli-bundle/focused-chunks/runtime-schema-YXPYDD2C.js +2 -0
  85. package/dist/cli-bundle/focused-chunks/{settlement-hook-FMLGKG7J.js → settlement-hook-4MGRERCT.js} +2 -2
  86. package/dist/cli-bundle/focused-chunks/stage-4ZFWJUKO.js +2 -0
  87. package/dist/cli-bundle/main.js +26 -26
  88. package/dist/cli-bundle/sdk-authoring.js +1 -1
  89. package/dist/cli-bundle/sdk-contracts.js +4 -4
  90. package/dist/cli-bundle/sdk-core.js +1 -1
  91. package/dist/cli-bundle/sdk-governance.js +1 -1
  92. package/dist/cli-bundle/sdk-graph.js +1 -1
  93. package/dist/cli-bundle/sdk-merge.js +63 -63
  94. package/dist/cli-bundle/sdk-query.js +1 -1
  95. package/dist/cli-bundle/sdk-runtime.js +1 -1
  96. package/dist/cli-bundle/sdk-testing.js +1 -1
  97. package/dist/cli-bundle/sdk.js +12 -12
  98. package/dist/core/profile/profile-lint.d.ts +1 -1
  99. package/dist/core/profile/profile-lint.js +1 -1
  100. package/dist/core/schema/fields-file.js +2 -2
  101. package/dist/core/schema/runtime-field-values.js +1 -1
  102. package/dist/core/schema/runtime-schema.d.ts +2 -0
  103. package/dist/core/schema/runtime-schema.js +1 -1
  104. package/dist/core/shared/command-line.d.ts +54 -4
  105. package/dist/core/shared/command-line.js +1 -1
  106. package/dist/core/shared/errors.d.ts +9 -0
  107. package/dist/core/shared/secret-rules.js +5 -5
  108. package/dist/core/shared/url-credentials.d.ts +16 -3
  109. package/dist/core/shared/url-credentials.js +1 -1
  110. package/dist/core/store/item-store.d.ts +26 -4
  111. package/dist/core/store/item-store.js +1 -1
  112. package/dist/sdk/command-line.d.ts +1 -1
  113. package/dist/sdk/command-line.js +1 -1
  114. package/dist/sdk/context-intent-contracts.js +1 -1
  115. package/dist/sdk/extension/command-options.d.ts +26 -1
  116. package/dist/sdk/extension/command-options.js +1 -1
  117. package/dist/sdk/extension-command-context.js +2 -2
  118. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  119. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  120. package/dist/sdk/governance/tracked-runtime-cache.js +1 -1
  121. package/dist/sdk/index.d.ts +1 -1
  122. package/dist/sdk/lifecycle/claim.d.ts +21 -1
  123. package/dist/sdk/lifecycle/claim.js +1 -1
  124. package/dist/sdk/lifecycle/task-composition.js +1 -1
  125. package/dist/sdk/ownership-source.d.ts +15 -1
  126. package/dist/sdk/ownership-source.js +1 -1
  127. package/dist/sdk/public-surface.json +1 -1
  128. package/dist/sdk/read-output-contracts.d.ts +11 -0
  129. package/dist/sdk/read-output-contracts.js +1 -1
  130. package/dist/sdk/runtime-primitives.d.ts +1 -1
  131. package/dist/sdk/schema/field-flag-spelling.d.ts +22 -0
  132. package/dist/sdk/schema/field-flag-spelling.js +2 -0
  133. package/dist/sdk/schema/field-option-collisions.js +1 -1
  134. package/docs/AGENT_GUIDE.md +2 -2
  135. package/docs/COMMANDS.md +1 -1
  136. package/docs/CONFIGURATION.md +1 -0
  137. package/docs/EXTENSIONS.md +1 -1
  138. package/docs/MUTATION_INTEGRITY.md +97 -8
  139. package/docs/READ_OUTPUT_CONTRACTS.md +2 -0
  140. package/docs/SDK.md +60 -4
  141. package/docs/SDK_AUDITED_MUTATIONS.md +11 -0
  142. package/docs/WORKSPACE_POSITION_AND_LIFECYCLE.md +17 -4
  143. package/marketplace.json +1 -1
  144. package/package.json +1 -1
  145. package/packages/pm-beads/package.json +1 -1
  146. package/packages/pm-calendar/package.json +1 -1
  147. package/packages/pm-command-kit/package.json +1 -1
  148. package/packages/pm-digital-twin/package.json +1 -1
  149. package/packages/pm-governance-audit/package.json +1 -1
  150. package/packages/pm-guide-shell/package.json +1 -1
  151. package/packages/pm-kanban/package.json +1 -1
  152. package/packages/pm-lifecycle-hooks/package.json +1 -1
  153. package/packages/pm-linked-test-adapters/package.json +1 -1
  154. package/packages/pm-search-advanced/package.json +1 -1
  155. package/packages/pm-templates/package.json +1 -1
  156. package/packages/pm-todos/package.json +1 -1
  157. package/packages/pm-vcs/package.json +1 -1
  158. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  159. package/plugins/pm-claude/package.json +1 -1
  160. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  161. package/plugins/pm-codex/package.json +1 -1
  162. package/plugins/pm-codex/plugin.json +1 -1
  163. package/runtime-dependencies.json +1 -1
  164. package/dist/cli-bundle/chunks/chunk-5WZZ5XEN.js +0 -3
  165. package/dist/cli-bundle/chunks/chunk-6MYJLOSG.js +0 -2
  166. package/dist/cli-bundle/chunks/chunk-ENKXRSFZ.js +0 -31
  167. package/dist/cli-bundle/chunks/chunk-FJOEL75F.js +0 -2
  168. package/dist/cli-bundle/chunks/chunk-GDXCAC52.js +0 -2
  169. package/dist/cli-bundle/chunks/chunk-KE7HMBEW.js +0 -2
  170. package/dist/cli-bundle/chunks/chunk-KZHIBEJL.js +0 -33
  171. package/dist/cli-bundle/chunks/chunk-NGJ5ERBF.js +0 -115
  172. package/dist/cli-bundle/chunks/chunk-NQ54T7T2.js +0 -2
  173. package/dist/cli-bundle/chunks/chunk-OKEZF7HU.js +0 -2
  174. package/dist/cli-bundle/chunks/chunk-OKIKF4FD.js +0 -2
  175. package/dist/cli-bundle/chunks/chunk-OPJF254V.js +0 -9
  176. package/dist/cli-bundle/chunks/chunk-RWA5YZ5X.js +0 -2
  177. package/dist/cli-bundle/chunks/chunk-S32NGRQM.js +0 -2
  178. package/dist/cli-bundle/chunks/chunk-TZY5MVJF.js +0 -125
  179. package/dist/cli-bundle/chunks/chunk-ZPS4B6SI.js +0 -8
  180. package/dist/cli-bundle/chunks/item-revision-FMD4KWBB.js +0 -2
  181. package/dist/cli-bundle/chunks/item-transaction-SEHTH7N2.js +0 -2
  182. package/dist/cli-bundle/chunks/mutation-actor-SFGYIRPW.js +0 -2
  183. package/dist/cli-bundle/chunks/mutation-admission-57LBSKQI.js +0 -2
  184. package/dist/cli-bundle/chunks/register-mutation-6NUOPHZ3.js +0 -21
  185. package/dist/cli-bundle/chunks/register-operations-JGYVORNN.js +0 -2
  186. package/dist/cli-bundle/chunks/register-setup-C44SIXEH.js +0 -2
  187. package/dist/cli-bundle/chunks/stage-PQ7AB63N.js +0 -2
  188. package/dist/cli-bundle/focused-chunks/chunk-6LKTEKHS.js +0 -6
  189. package/dist/cli-bundle/focused-chunks/chunk-6LPXMFLM.js +0 -2
  190. package/dist/cli-bundle/focused-chunks/chunk-HMDQDRV2.js +0 -8
  191. package/dist/cli-bundle/focused-chunks/chunk-I66IKYKP.js +0 -2
  192. package/dist/cli-bundle/focused-chunks/chunk-IR2J3NOT.js +0 -2
  193. package/dist/cli-bundle/focused-chunks/chunk-ITKDHSBR.js +0 -2
  194. package/dist/cli-bundle/focused-chunks/chunk-LQYYPXUK.js +0 -26
  195. package/dist/cli-bundle/focused-chunks/chunk-NQTEE66P.js +0 -13
  196. package/dist/cli-bundle/focused-chunks/chunk-O7Z73ALG.js +0 -2
  197. package/dist/cli-bundle/focused-chunks/chunk-OTMMOKPM.js +0 -91
  198. package/dist/cli-bundle/focused-chunks/chunk-OXOCZJC6.js +0 -2
  199. package/dist/cli-bundle/focused-chunks/chunk-QLAHEDT6.js +0 -2
  200. package/dist/cli-bundle/focused-chunks/chunk-TD544C74.js +0 -8
  201. package/dist/cli-bundle/focused-chunks/chunk-UFTUNBMY.js +0 -27
  202. package/dist/cli-bundle/focused-chunks/chunk-XRS3VNC6.js +0 -44
  203. package/dist/cli-bundle/focused-chunks/chunk-XYPEZGTR.js +0 -2
  204. package/dist/cli-bundle/focused-chunks/chunk-YSJKQLFR.js +0 -2
  205. package/dist/cli-bundle/focused-chunks/chunk-Z2X7HH3C.js +0 -102
  206. package/dist/cli-bundle/focused-chunks/item-transaction-UKEQCTKB.js +0 -2
  207. package/dist/cli-bundle/focused-chunks/mutation-actor-AS465LRX.js +0 -2
  208. package/dist/cli-bundle/focused-chunks/mutation-admission-E5UHJZFE.js +0 -2
  209. package/dist/cli-bundle/focused-chunks/stage-36J7YLGI.js +0 -2
@@ -0,0 +1,3 @@
1
+ import{Aa as ye,ha as pe}from"./chunk-VA4T37Q4.js";import{La as de,R as oe,W as _e,ma as S,pd as ge,ua as N}from"./chunk-FVY7U3SU.js";import{I as me,r as v,u as ue,v as fe,w as k}from"./chunk-C4KIZQHW.js";import{Dh as T,Qa as ie,V as I,W as te,ba as A,da as re,ea as ne,ih as le,va as ae,xg as ce}from"./chunk-CNUFU454.js";import{x as C}from"./chunk-XHCIOLJP.js";import{L as se,z as b}from"./chunk-SX76UGEY.js";import{A as c,C as l,E as $}from"./chunk-6OIHST4I.js";var He=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u;function he(e){let t=e?.trim();if(!t||t==="__proto__"||t.length>128)throw new Error("A legacy author must contain 1-128 characters.");return t}function Ye(e){let t=e?.trim().toLowerCase();if(!t||!He.test(t))throw new Error("A canonical harness must be a lowercase dash-separated namespace.");return t}function We(e){return Object.fromEntries(Object.entries(e).sort(([t],[r])=>t.localeCompare(r)))}function Be(e,t){let r=new Set;for(let n of(e??[]).slice(0,1e4)){let i=n.trim().slice(0,128);i.length===0||i.startsWith("harness:")||Object.hasOwn(t,i)||r.add(i)}return r.size}function Xe(e,t){let r=he(t.legacy_author),n=Ye(t.canonical_harness);if(r===n||r===`harness:${n}`||r.startsWith("harness:"))throw new Error(`The legacy author "${r}" is already canonical and must not be aliased.`);return e[r]===n?!1:(e[r]=n,!0)}function Qe(e,t){if(t.operation==="add")return Xe(e,t);if(t.operation==="remove"){let n=he(t.legacy_author);return Object.hasOwn(e,n)?(delete e[n],!0):!1}if(t.operation==="clear"){let n=Object.keys(e).length>0;for(let i of Object.keys(e))delete e[i];return n}let r=t.operation;throw new Error(`Unsupported vocabulary operation: ${String(r)}`)}function U(e){return{version:e?.version??1,alias_count:Object.keys(e?.aliases??{}).length}}function ve(e,t){let r=e?.version??1,n={...e?.aliases},i=Qe(n,t),a={version:i?r+1:r,aliases:We(n)};return{vocabulary:a,preview:{operation:t.operation,changed:i,version_before:r,version_after:a.version,alias_count:Object.keys(a.aliases).length,residual_author_count:Be(t.observed_authors,a.aliases)}}}var E=[{key:"context_default_depth",path:"context.default_depth",kind:"string",choices:b,summary:"Default context depth."},{key:"context_activity_limit",path:"context.activity_limit",kind:"integer",min:1,max:Number.MAX_SAFE_INTEGER,decimal_only:!0,summary:"Default context activity row limit; positive decimal integer."},{key:"context_stale_threshold_days",path:"context.stale_threshold_days",kind:"integer",min:1,max:Number.MAX_SAFE_INTEGER,decimal_only:!0,summary:"Days before context marks an item stale; positive decimal integer."},...["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"].map(e=>({key:`context_sections_${e}`,path:`context.sections.${e}`,kind:"boolean",summary:`Include ${e} in default context output.`})),{key:"context_next_ranking_policy",path:"context.next_ranking_policy",kind:"string",choices:["priority_floor","weighted"],summary:"Ready-queue order for pm next with the built-in scorer: priority_floor (resume in-progress work, then priority tiers, relevance within a tier) or weighted (blended relevance order). An extension context_relevance scorer keeps its own order."},{key:"search_provider",path:"search.provider",kind:"string",summary:"Search embedding provider name (e.g. openai, ollama, or an extension provider)."},{key:"search_default_mode",path:"search.default_mode",kind:"string",choices:["auto","keyword","semantic","hybrid"],summary:"Mode a bare pm search runs in: auto (hybrid when semantic search is explicitly configured and runnable, else keyword), or a pinned keyword, semantic, or hybrid."},{key:"search_mutation_refresh_policy",path:"search.mutation_refresh_policy",kind:"string",choices:["cache_only","semantic_configured","semantic_auto"],summary:"Mutation-time search refresh policy: cache_only, semantic_configured, or semantic_auto."},{key:"search_query_expansion_enabled",path:"search.query_expansion.enabled",kind:"boolean",summary:"Enable or disable query expansion for semantic/hybrid search."},{key:"search_query_expansion_provider",path:"search.query_expansion.provider",kind:"string",summary:"Query expansion provider name (built-in openai/ollama or extension provider)."},{key:"search_rerank_enabled",path:"search.rerank.enabled",kind:"boolean",summary:"Enable or disable post-retrieval reranking for hybrid search."},{key:"search_rerank_model",path:"search.rerank.model",kind:"string",summary:"Rerank model name override used by built-in providers."},{key:"search_rerank_top_k",path:"search.rerank.top_k",kind:"integer",min:1,summary:"Number of top hybrid candidates to rerank when rerank is enabled."},{key:"search_embedding_model",path:"search.embedding_model",kind:"string",summary:"Default embedding model name (overrides provider-specific model when set)."},{key:"search_embedding_corpus_max_characters",path:"search.embedding_corpus_max_characters",kind:"integer",min:1,summary:"Maximum semantic corpus characters per item before truncation."},{key:"search_embedding_batch_size",path:"search.embedding_batch_size",kind:"integer",min:1,summary:"Number of items embedded per request batch."},{key:"search_embedding_timeout_ms",path:"search.embedding_timeout_ms",kind:"integer",min:1,summary:"Per-request embedding timeout in milliseconds."},{key:"search_score_threshold",path:"search.score_threshold",kind:"number",summary:"Minimum score for a hit to be returned (0 keeps all matches)."},{key:"search_hybrid_semantic_weight",path:"search.hybrid_semantic_weight",kind:"ratio",summary:"Hybrid mode semantic weight in [0, 1] (1-weight goes to keyword)."},{key:"search_max_results",path:"search.max_results",kind:"integer",min:1,summary:"Default upper bound on search hits when --limit is not supplied."},{key:"search_bm25_k1",path:"search.bm25.k1",kind:"number",min:0,summary:"Offline BM25 term-frequency saturation (k1); higher saturates repeated terms slower (default 1.2)."},{key:"search_bm25_b",path:"search.bm25.b",kind:"ratio",summary:"Offline BM25 document-length normalization (b) in [0, 1]; 0 disables, 1 fully normalizes (default 0.75)."},{key:"openai_base_url",path:"providers.openai.base_url",kind:"string",summary:"OpenAI-compatible API base URL (LM Studio/vLLM also use this)."},{key:"openai_api_key",path:"providers.openai.api_key",kind:"string",summary:"OpenAI-compatible API key."},{key:"openai_model",path:"providers.openai.model",kind:"string",summary:"OpenAI-compatible embedding model name."},{key:"ollama_base_url",path:"providers.ollama.base_url",kind:"string",summary:"Ollama API base URL (typically http://localhost:11434)."},{key:"ollama_model",path:"providers.ollama.model",kind:"string",summary:"Ollama embedding model name (e.g. nomic-embed-text)."},{key:"vector_store_adapter",path:"vector_store.adapter",kind:"string",summary:"Vector store adapter name (lancedb, qdrant, or an extension adapter)."},{key:"vector_store_collection_name",path:"vector_store.collection_name",kind:"string",non_empty:!0,summary:"Vector collection/table name shared by Qdrant and LanceDB adapters."},{key:"qdrant_url",path:"vector_store.qdrant.url",kind:"string",summary:"Qdrant HTTP API URL."},{key:"qdrant_api_key",path:"vector_store.qdrant.api_key",kind:"string",summary:"Qdrant API key (empty if running unauthenticated)."},{key:"lancedb_path",path:"vector_store.lancedb.path",kind:"string",summary:"LanceDB storage path (relative to pm root or absolute)."},{key:"id_prefix",path:"id_prefix",kind:"string",non_empty:!0,summary:'Prefix for generated item IDs (e.g. "pm" produces pm-xxxx).'},{key:"author_default",path:"author_default",kind:"string",non_empty:!0,summary:"Default author recorded on mutations when --author is not supplied."},{key:"agent_identity_probes_enabled",path:"agent_identity.probes_enabled",kind:"boolean",summary:"Allow privacy-bounded local harness provenance probes; no network or subprocess access is permitted."},{key:"mutation_guard_require_attributed_author",path:"mutation_guard.require_attributed_author",kind:"boolean",summary:"Reject mutations whose effective author resolves to unknown."},{key:"mutation_guard_secret_guard",path:"mutation_guard.secret_guard",kind:"string",choices:["off","advise","block"],summary:"Detect credential-shaped mutation content: off, advise, or block."},{key:"mutation_guard_stale_in_progress_hours",path:"mutation_guard.stale_in_progress_hours",kind:"integer",min:1,summary:"Age threshold for unclaimed in-progress work surfaced by health."},{key:"governance_duplicate_detection_mode",path:"governance.duplicate_detection_mode",kind:"string",choices:["off","advisory","strict"],summary:"Create/copy duplicate governance: off, advisory, or strict explicit-bypass enforcement."},{key:"governance_duplicate_detection_threshold",path:"governance.duplicate_detection_threshold",kind:"ratio",summary:"Minimum shared similarity score in [0, 1] for create/copy duplicate governance."},{key:"governance_duplicate_detection_limit",path:"governance.duplicate_detection_limit",kind:"integer",min:0,max:20,summary:"Maximum likely duplicates returned by create/copy governance (0-20)."},{key:"output_default_format",path:"output.default_format",kind:"string",choices:["toon","json"],summary:"Default output format for commands that support it: toon or json."},{key:"ux_deprecation_hints",path:"ux.deprecation_hints",kind:"boolean",summary:"Emit one stderr migration hint for deprecated command aliases."},{key:"locks_ttl_seconds",path:"locks.ttl_seconds",kind:"integer",min:1,summary:"Claim/lock time-to-live in seconds before a stale lock can be reclaimed."},{key:"locks_wait_ms",path:"locks.wait_ms",kind:"integer",min:0,summary:"Wait budget in milliseconds before a contended lock fails with lock_conflict; item-store mutations, restore and the hierarchy lock treat it as a no-progress window that each observed owner handoff restarts (120 s total cap), other locks as a fixed total; 0 fails fast. PM_LOCK_WAIT_MS overrides per invocation."},{key:"ids_token_length",path:"ids.token_length",kind:"integer",min:4,max:12,summary:"Random base36 token length for newly minted item ids (4-12, default 4). Raise it to shrink cross-branch id collision odds in concurrent multi-agent workflows (pm-pibw)."},{key:"checkpoints_retention_days",path:"checkpoints.retention_days",kind:"integer",min:1,summary:"Age in days above which pm gc --scope checkpoints prunes bulk-mutation rollback checkpoints."},{key:"schema_unknown_field_policy",path:"schema.unknown_field_policy",kind:"string",choices:["allow","warn","reject"],summary:"How item I/O handles metadata keys not in the field registry: allow, warn, or reject."},{key:"history_compact_policy_enabled",path:"history.compact_policy.enabled",kind:"boolean",summary:"Enable the history-compaction advisory: pm health warns on over-threshold streams."},{key:"history_compact_policy_max_entries",path:"history.compact_policy.max_entries",kind:"integer",min:1,summary:"Entry count above which a history stream is flagged (and the default pm history-compact --all-over threshold)."},{key:"history_compact_policy_trigger",path:"history.compact_policy.trigger",kind:"string",choices:["health_warn","auto"],summary:"History-compaction policy intent: health_warn (advisory only) or auto (scheduled sweeps expected)."}],Je=new Map(E.flatMap(e=>[[e.key,e],[e.path.toLowerCase().replaceAll("-","_"),e]]));function L(e){if(typeof e!="string")return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length!==0)return Je.get(t)}function Ze(e,t){let r=t.trim().toLowerCase();return r==="true"||r==="1"||r==="yes"||r==="on"?{ok:!0,parsed:{descriptor:e,value:!0}}:r==="false"||r==="0"||r==="no"||r==="off"?{ok:!0,parsed:{descriptor:e,value:!1}}:{ok:!1,error:{message:`Config set ${e.key} requires a boolean value (true|false), got "${t}"`}}}function xe(e,t,r){return e.key==="context_default_depth"&&(r=r.toLowerCase()),e.non_empty===!0&&r.length===0?{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}}:e.choices&&!e.choices.includes(r)?{ok:!1,error:{message:`Config set ${e.key} must be one of ${e.choices.join("|")}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:r}}}function ke(e,t){let r=[e.min===void 0?"":`minimum ${e.min}`,e.max===void 0?"":`maximum ${e.max}`].filter(Boolean).join(", ");return{message:`Config set ${e.key} requires non-empty decimal integer digits${r?` (${r})`:""}, got "${t}"`}}function et(e,t,r){if(e.decimal_only&&!/^\d+$/u.test(r))return{ok:!1,error:ke(e,t)};if(r.length===0)return{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}};let n=Number(r);return Number.isFinite(n)?{ok:!0,value:n}:{ok:!1,error:e.decimal_only?ke(e,t):{message:`Config set ${e.key} requires a finite number, got "${t}"`}}}function tt(e,t,r){return!Number.isInteger(r)||r<0?{ok:!1,error:{message:`Config set ${e.key} requires a non-negative integer, got "${t}"`}}:e.min!==void 0&&r<e.min?{ok:!1,error:{message:`Config set ${e.key} requires an integer >= ${e.min}, got "${t}" (the runtime silently ignores 0 here and falls back to the default)`}}:e.max!==void 0&&r>e.max?{ok:!1,error:{message:`Config set ${e.key} requires an integer <= ${e.max}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:r}}}function rt(e,t,r){return r<0||r>1?{ok:!1,error:{message:`Config set ${e.key} requires a number in [0, 1], got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:r}}}function nt(e,t,r){return e.min!==void 0&&r<e.min?{ok:!1,error:{message:`Config set ${e.key} requires a number >= ${e.min}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:r}}}function j(e,t){if(typeof t!="string")return{ok:!1,error:{message:`Config set ${e.key} requires a string value`}};let r=t.trim();if(e.kind==="boolean")return Ze(e,t);if(e.kind==="string")return xe(e,t,r);let n=et(e,t,r);return n.ok?e.kind==="integer"?tt(e,t,n.value):e.kind==="ratio"?rt(e,t,n.value):nt(e,t,n.value):{ok:!1,error:n.error}}function D(e,t){let r=t.path.split("."),n=e;for(let i of r){if(typeof n!="object"||n===null)return null;let a=Object.getOwnPropertyDescriptor(n,i);if(!a||!Object.hasOwn(a,"value"))return null;n=a.value}return typeof n=="string"||typeof n=="number"||typeof n=="boolean"?n:null}function we(e,t,r){let n=t.path.split(".");if(n.some(s=>s.length===0||["__proto__","constructor","prototype"].includes(s)))throw new Error("Unsafe settings path");let i=e;for(let s=0;s<n.length-1;s+=1){let d=n[s],_=Object.getOwnPropertyDescriptor(i,d)?.value;if(typeof _!="object"||_===null||Array.isArray(_)){let u={};Object.defineProperty(i,d,{value:u,writable:!0,enumerable:!0,configurable:!0}),i=u}else i=_}let a=n[n.length-1];return Object.getOwnPropertyDescriptor(i,a)?.value===r?!1:(Object.defineProperty(i,a,{value:r,writable:!0,enumerable:!0,configurable:!0}),!0)}var be=["project","global"],h={definition_of_done:["definition-of-done","definition_of_done","workflow.definition_of_done"],item_format:["item-format","item_format"],history_missing_stream_policy:["history-missing-stream-policy","history_missing_stream_policy","history.missing_stream"],sprint_release_format_policy:["sprint-release-format-policy","sprint_release_format_policy","validation.sprint_release_format"],parent_reference_policy:["parent-reference-policy","parent_reference_policy","validation.parent_reference"],metadata_validation_profile:["metadata-validation-profile","metadata_validation_profile","validation.metadata_profile"],metadata_required_fields:["metadata-required-fields","metadata_required_fields","validation.metadata_required_fields"],lifecycle_stale_blocker_reason_patterns:["lifecycle-stale-blocker-reason-patterns","lifecycle_stale_blocker_reason_patterns","validation.lifecycle_stale_blocker_reason_patterns"],lifecycle_closure_like_blocked_reason_patterns:["lifecycle-closure-like-blocked-reason-patterns","lifecycle_closure_like_blocked_reason_patterns","validation.lifecycle_closure_like_blocked_reason_patterns"],lifecycle_closure_like_resolution_patterns:["lifecycle-closure-like-resolution-patterns","lifecycle_closure_like_resolution_patterns","validation.lifecycle_closure_like_resolution_patterns"],lifecycle_closure_like_actual_result_patterns:["lifecycle-closure-like-actual-result-patterns","lifecycle_closure_like_actual_result_patterns","validation.lifecycle_closure_like_actual_result_patterns"],governance_preset:["governance-preset","governance_preset","governance.preset"],governance_ownership_enforcement:["governance-ownership-enforcement","governance_ownership_enforcement","governance.ownership_enforcement"],governance_create_mode_default:["governance-create-mode-default","governance_create_mode_default","governance.create_mode_default"],governance_close_validation_default:["governance-close-validation-default","governance_close_validation_default","governance.close_validation_default"],governance_require_close_reason:["governance-require-close-reason","governance_require_close_reason","governance.require_close_reason"],governance_create_default_type:["governance-create-default-type","governance_create_default_type","governance.create_default_type"],governance_workflow_enforcement:["governance-workflow-enforcement","governance_workflow_enforcement","governance.workflow_enforcement"],governance_start_blocker_enforcement:["governance-start-blocker-enforcement","governance_start_blocker_enforcement","governance.start_blocker_enforcement"],governance_parent_reference_policy:["governance-parent-reference-policy","governance_parent_reference_policy","governance.parent_reference"],governance_metadata_validation_profile:["governance-metadata-validation-profile","governance_metadata_validation_profile","governance.metadata_profile"],governance_force_required_for_stale_lock:["governance-force-required-for-stale-lock","governance_force_required_for_stale_lock","governance.force_required_for_stale_lock"],test_result_tracking:["test-result-tracking","test_result_tracking","testing.record_results_to_items"],untrusted_linked_test_execution:["untrusted-linked-test-execution","untrusted_linked_test_execution","testing.allow_untrusted_linked_tests"],telemetry_tracking:["telemetry-tracking","telemetry_tracking","telemetry.enabled"],agent_identity_vocabulary:["agent-identity-vocabulary","agent_identity_vocabulary","agent_identity.identity_vocabulary"],context:["context"]},Ce=Object.fromEntries(Object.keys(h).flatMap(e=>h[e].map(t=>[t,e]))),at={definition_of_done:"Definition of Done criteria list.",item_format:"Default item file format.",history_missing_stream_policy:"Missing history stream handling policy.",sprint_release_format_policy:"Sprint/release format validation policy.",parent_reference_policy:"Parent reference validation policy.",metadata_validation_profile:"Validate metadata profile policy (core|strict|custom).",metadata_required_fields:"Validate custom metadata required-fields list.",lifecycle_stale_blocker_reason_patterns:"Validate lifecycle stale-blocker reason substring patterns (criteria list).",lifecycle_closure_like_blocked_reason_patterns:"Validate lifecycle closure-like blocked_reason substring patterns (criteria list).",lifecycle_closure_like_resolution_patterns:"Validate lifecycle closure-like resolution substring patterns (criteria list).",lifecycle_closure_like_actual_result_patterns:"Validate lifecycle closure-like actual_result substring patterns (criteria list).",governance_preset:"Governance preset policy (minimal|default|strict|custom).",governance_ownership_enforcement:"Governance ownership enforcement policy (none|warn|strict).",governance_create_mode_default:"Governance default create mode (progressive|strict).",governance_close_validation_default:"Governance default close validation mode (off|warn|strict).",governance_require_close_reason:"Governance close-reason requirement policy (enabled|disabled).",governance_create_default_type:"Governance default item type for `pm create` when --type is omitted.",governance_workflow_enforcement:"Governance per-type transition enforcement mode (off|warn|strict).",governance_start_blocker_enforcement:"Governance admission for starting an item whose declared blocker is still open (off|warn|strict; strict by default).",governance_parent_reference_policy:"Governance parent reference policy (warn|strict_error).",governance_metadata_validation_profile:"Governance metadata validation profile (core|strict|custom).",governance_force_required_for_stale_lock:"Governance stale-lock force policy (enabled|disabled).",test_result_tracking:"Item-level linked test result persistence policy.",untrusted_linked_test_execution:"Permit an explicit per-run override for commands not trusted by this clone.",telemetry_tracking:"Telemetry usage reporting policy.",agent_identity_vocabulary:"Versioned exact legacy-author interpretation vocabulary (summary only).",context:"Context command settings (depth, section toggles, limits)."},it=["lifecycle_stale_blocker_reason_patterns","lifecycle_closure_like_blocked_reason_patterns","lifecycle_closure_like_resolution_patterns","lifecycle_closure_like_actual_result_patterns"],ot=new Set(["metadata_required_fields",...it]),st=new Set(["test_result_tracking","untrusted_linked_test_execution","telemetry_tracking"]),ct=new Set(["governance_require_close_reason","governance_force_required_for_stale_lock"]),lt=new Set(["governance_ownership_enforcement","governance_create_mode_default","governance_close_validation_default"]),_t=new Set(["governance_parent_reference_policy","governance_metadata_validation_profile","governance_workflow_enforcement","governance_start_blocker_enforcement"]),dt=new Set(["governance_preset","governance_create_default_type"]),Pe=e=>ot.has(e),ut=e=>lt.has(e),ft=e=>_t.has(e),mt=e=>dt.has(e);function z(e){return e==="definition_of_done"||Pe(e)}function qe(e){if(be.includes(e))return e;throw new l(`Invalid config scope "${e}". Allowed: ${be.join(", ")}`,c.USAGE)}function Ge(e){if(e==="get"||e==="set"||e==="list"||e==="export")return e;throw oe({command_path:"config",token:e.trim()||"<empty>",allowed:["export","get","list","set"],token_kind:"action"})}function Re(e,t="global",r){let n=Object.hasOwn(Ce,e)?Ce[e]:void 0;if(n)return n;let i=[...Object.values(h),...E.map(u=>[u.key.replaceAll("_","-"),u.path])],a=e.toLowerCase().replaceAll(/[_.]/gu,"-"),o=i.map(u=>({key:u[0],distance:Math.min(...u.map(g=>ie(a,g.replaceAll(/[_.]/gu,"-"),3)??1/0))})).filter(({distance:u})=>Number.isFinite(u)).sort((u,g)=>u.distance-g.distance||u.key.localeCompare(g.key)).slice(0,3).map(({key:u})=>u),s=r?ae(r):[],d=C([...s,"config",t,"list","--json"]),_=o.length>0?` Did you mean ${o.map(u=>u==="telemetry-tracking"&&t==="project"?`${u} (global only)`:u).join(", ")}?`:"";throw new l(`Invalid config key "${e}".${_} Inspect keys and aliases with ${d}.`,c.USAGE,{code:"config_key_unknown",changed:!1,required:`Use a key or settings path from ${d}.`,examples:[d],recovery:{allowed_values:[...new Set([...ee(t).flatMap(u=>h[u]),...E.flatMap(u=>[u.key,u.key.replaceAll("_","-"),u.path])])],candidate_commands:o.map(u=>C([...s,"config",u==="telemetry-tracking"?"global":t,"get",u,"--json"])),next_best_command:d}})}function Oe(e,t){let r=[...new Set((e??[]).map(n=>n.trim()).filter(n=>n.length>0))].sort((n,i)=>n.localeCompare(i));if(t){if(r.length>0)throw new l("Config set definition-of-done cannot combine --clear-criteria with --criterion values",c.USAGE);return[]}if(r.length===0)throw new l("Config set definition-of-done requires at least one non-empty --criterion value (or --clear-criteria to clear)",c.USAGE);return r}function $e(e){let t=e?.trim().toLowerCase();if(t==="toon")return"toon";throw t==="json_markdown"?new l("Config set item-format no longer accepts json_markdown. Markdown item files are legacy read/migration input only.",c.USAGE):new l("Config set item-format requires --format toon",c.USAGE)}function K(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="auto_create"||t==="strict_error")return t;throw new l("Config set history-missing-stream-policy requires --policy with one of: auto_create, strict_error",c.USAGE)}function Ie(e){return H(e,"test-result-tracking")}function H(e,t){let r=e?.trim().toLowerCase().replaceAll("-","_");if(r==="enabled"||r==="disabled")return r;throw new l(`Config set ${t} requires --policy with one of: enabled, disabled`,c.USAGE)}function Y(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new l("Config set telemetry-tracking requires --policy with one of: enabled, disabled",c.USAGE)}function q(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="core"||t==="strict"||t==="custom")return t;throw new l("Config set metadata-validation-profile requires --policy with one of: core, strict, custom",c.USAGE)}function W(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="minimal"||t==="default"||t==="strict"||t==="custom")return t;throw new l("Config set governance-preset requires --policy with one of: minimal, default, strict, custom",c.USAGE)}function B(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="none"||t==="warn"||t==="strict")return t;throw new l("Config set governance-ownership-enforcement requires --policy with one of: none, warn, strict",c.USAGE)}function X(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="progressive"||t==="strict")return t;throw new l("Config set governance-create-mode-default requires --policy with one of: progressive, strict",c.USAGE)}function Q(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="off"||t==="warn"||t==="strict")return t;if(t==="none"||t==="disabled")return"off";throw new l("Config set governance-close-validation-default requires --policy with one of: off, warn, strict",c.USAGE)}function P(e,t="governance-workflow-enforcement"){let r=typeof e=="string"?e.trim().toLowerCase().replaceAll("-","_"):void 0;if(r==="off"||r==="warn"||r==="strict")return r;if(r==="none"||r==="disabled")return"off";throw new l(`Config set ${t} requires one of: off, warn, strict`,c.USAGE)}function J(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new l("Config set governance-force-required-for-stale-lock requires --policy with one of: enabled, disabled",c.USAGE)}function Z(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new l("Config set governance-require-close-reason requires --policy with one of: enabled, disabled",c.USAGE)}var gt={test_result_tracking:"test-result-tracking",untrusted_linked_test_execution:"untrusted-linked-test-execution"},pt={governance_workflow_enforcement:"governance-workflow-enforcement",governance_start_blocker_enforcement:"governance-start-blocker-enforcement"};function M(e,t){let r=gt[e];if(r)return H(t,r);let n=pt[e];if(n)return P(t,n);switch(e){case"history_missing_stream_policy":return K(t);case"sprint_release_format_policy":return N(t);case"parent_reference_policy":case"governance_parent_reference_policy":return S(t);case"metadata_validation_profile":case"governance_metadata_validation_profile":return q(t);case"governance_preset":return W(t);case"governance_ownership_enforcement":return B(t);case"governance_create_mode_default":return X(t);case"governance_close_validation_default":return Q(t);case"governance_require_close_reason":return Z(t);case"governance_force_required_for_stale_lock":return J(t);case"telemetry_tracking":return Y(t);default:return t.trim().toLowerCase().replaceAll("-","_")}}var Ee={author:"author",acceptance_criteria:"acceptance_criteria","acceptance-criteria":"acceptance_criteria",estimated_minutes:"estimated_minutes","estimated-minutes":"estimated_minutes",estimate:"estimated_minutes",close_reason:"close_reason","close-reason":"close_reason",reviewer:"reviewer",risk:"risk",confidence:"confidence",sprint:"sprint",release:"release"},yt=["author","acceptance_criteria","estimated_minutes","close_reason","reviewer","risk","confidence","sprint","release"];function Te(e,t){let r=[...new Set((e??[]).map(a=>a.trim()).filter(a=>a.length>0))];if(t){if(r.length>0)throw new l("Config set metadata-required-fields cannot combine --clear-criteria with --criterion values",c.USAGE);return[]}if(r.length===0)throw new l("Config set metadata-required-fields requires at least one --criterion value (or --clear-criteria to clear)",c.USAGE);let n=r.map(a=>a.toLowerCase().replaceAll("-","_")),i=n.filter(a=>Ee[a]===void 0);if(i.length>0)throw new l(`Config set metadata-required-fields received unsupported values: ${i.join(", ")}. Supported values: ${yt.join(", ")}`,c.USAGE);return[...new Set(n.map(a=>Ee[a]))].sort((a,o)=>a.localeCompare(o))}function ht(e,t,r){let n=[...new Set((t??[]).map(i=>i.trim().toLowerCase()).filter(i=>i.length>0))].sort((i,a)=>i.localeCompare(a));if(r){if(n.length>0)throw new l(`Config set ${h[e][0]} cannot combine --clear-criteria with --criterion values`,c.USAGE);return[]}if(n.length===0)throw new l(`Config set ${h[e][0]} requires at least one --criterion value (or --clear-criteria to clear)`,c.USAGE);return n}function Ne(e){return[...new Set(e)].sort((t,r)=>t.localeCompare(r))}function vt(e,t,r,n){if(e==="list"||e==="export"){if(typeof t=="string"&&t.trim().length>0)throw new l(`Config action "${e}" does not accept <key>`,c.USAGE);return}if(typeof t!="string"||t.trim().length===0)throw new l(`Config action "${e}" requires <key>`,c.USAGE);return Re(t,r,n)}function Ue(e){if(!e)throw new l("Config action requires <key>",c.USAGE)}var kt={definition_of_done:e=>[...e.workflow.definition_of_done],item_format:e=>e.item_format,history_missing_stream_policy:e=>e.history.missing_stream,sprint_release_format_policy:e=>e.validation.sprint_release_format,parent_reference_policy:e=>e.validation.parent_reference,metadata_validation_profile:e=>e.validation.metadata_profile,metadata_required_fields:e=>[...e.validation.metadata_required_fields],lifecycle_stale_blocker_reason_patterns:e=>[...e.validation.lifecycle_stale_blocker_reason_patterns],lifecycle_closure_like_blocked_reason_patterns:e=>[...e.validation.lifecycle_closure_like_blocked_reason_patterns],lifecycle_closure_like_resolution_patterns:e=>[...e.validation.lifecycle_closure_like_resolution_patterns],lifecycle_closure_like_actual_result_patterns:e=>[...e.validation.lifecycle_closure_like_actual_result_patterns],governance_preset:e=>e.governance.preset,governance_ownership_enforcement:e=>e.governance.ownership_enforcement,governance_create_mode_default:e=>e.governance.create_mode_default,governance_close_validation_default:e=>e.governance.close_validation_default,governance_require_close_reason:e=>e.governance.require_close_reason?"enabled":"disabled",governance_create_default_type:e=>e.governance.create_default_type??"",governance_workflow_enforcement:e=>e.governance.workflow_enforcement??"off",governance_start_blocker_enforcement:e=>e.governance.start_blocker_enforcement??"strict",governance_parent_reference_policy:e=>e.governance.parent_reference,governance_metadata_validation_profile:e=>e.governance.metadata_profile,governance_force_required_for_stale_lock:e=>e.governance.force_required_for_stale_lock?"enabled":"disabled",test_result_tracking:e=>e.testing.record_results_to_items?"enabled":"disabled",untrusted_linked_test_execution:e=>e.testing.allow_untrusted_linked_tests?"enabled":"disabled",telemetry_tracking:e=>e.telemetry.enabled?"enabled":"disabled",agent_identity_vocabulary:e=>U(e.agent_identity?.identity_vocabulary),context:e=>({default_depth:e.context.default_depth,activity_limit:e.context.activity_limit,stale_threshold_days:e.context.stale_threshold_days,next_ranking_policy:e.context.next_ranking_policy,sections:{...e.context.sections}})};function x(e,t){return kt[t](e)}function p(e,t){return t.length===0?e:{...e,warnings:t}}async function wt(e,t){let r=process.cwd(),n=e==="project"?A(r,t.path):re(r),i=ne(n);return e==="project"&&await me(n),{pmRoot:n,settingsPath:i}}function bt(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(t==="true"||t==="enabled"||t==="on"||t==="1")return!0;if(t==="false"||t==="disabled"||t==="off"||t==="0")return!1;throw new l(`Context section toggle must be true|false|enabled|disabled, got "${e}"`,c.USAGE)}function Ae(e,t){let r=L(t==="--activity-limit"?"context_activity_limit":"context_stale_threshold_days"),n=j(r,e);if(n.ok)return n.parsed.value;throw new l(`Context ${t}: ${n.error.message}`,c.USAGE)}async function Ct(e,t,r,n,i){let a=!1,o=e.context,s=[];if(t.defaultDepth!==void 0){let _=t.defaultDepth.trim().toLowerCase();if(!b.includes(_))throw new l(`Context --default-depth must be one of ${b.join("|")}`,c.USAGE);s.push("context.default_depth"),o.default_depth!==_&&(o.default_depth=_,a=!0)}if(t.activityLimit!==void 0){let _=Ae(t.activityLimit,"--activity-limit");s.push("context.activity_limit"),o.activity_limit!==_&&(o.activity_limit=_,a=!0)}if(t.staleThresholdDays!==void 0){let _=Ae(t.staleThresholdDays,"--stale-threshold-days");s.push("context.stale_threshold_days"),o.stale_threshold_days!==_&&(o.stale_threshold_days=_,a=!0)}let d=[["hierarchy",t.sectionHierarchy],["activity",t.sectionActivity],["progress",t.sectionProgress],["blockers",t.sectionBlockers],["files",t.sectionFiles],["workload",t.sectionWorkload],["staleness",t.sectionStaleness],["tests",t.sectionTests]];for(let[_,u]of d){let g=bt(u);if(g!==void 0){let y=_;s.push(`context.sections.${_}`),o.sections[y]!==g&&(o.sections[y]=g,a=!0)}}return(a||v(e))&&(await k(r.pmRoot,e,"config:set:context",{assignedPaths:s}),a=!0),p({scope:n,key:"context",context_settings:{default_depth:o.default_depth,activity_limit:o.activity_limit,stale_threshold_days:o.stale_threshold_days,next_ranking_policy:o.next_ranking_policy,sections:{...o.sections}},settings_path:r.settingsPath,changed:a},i)}function Et(e,t,r){if(r.value!==void 0&&r.value!==t)throw new l(`Config set ${e} received both positional value "${t}" and --value "${r.value}". Pass only one.`,c.USAGE);return{...r,value:t}}function Le(e,t,r,n,i,a){if(i===void 0)return a;if(e!=="set")throw new l(`Config action "${e}" does not accept a positional value. Only "set" takes <value>.`,c.USAGE);if(typeof t!="string"||t.trim().length===0)throw new l('Config action "set" requires <key> before a positional <value>.',c.USAGE);if(n)return Et(t,i,a);Ue(r);let o=_e(r,i);if(!o.routable)throw new l(o.reason,c.USAGE);if(o.flag==="criterion"){if(a.criterion!==void 0&&a.criterion.length>0)throw new l(`Config set ${t} received both positional value "${i}" and --criterion. Pass criteria via --criterion only when supplying more than one value.`,c.USAGE);return{...a,criterion:o.values}}if(o.flag==="format")return{...a,format:o.value};if(a.policy!==void 0&&M(r,a.policy)!==M(r,o.value))throw new l(`Config set ${t} received both positional value "${i}" and --policy "${a.policy}". Pass only one.`,c.USAGE);return{...a,policy:o.value}}function je(e,t){let r=`pm config global ${e} telemetry-tracking${t}`;throw new l(`Config ${e} telemetry-tracking applies to this CLI install, not one project. Run: ${r}`,c.USAGE,{code:"invalid_argument_value",reason:"telemetry_consent_is_global",field:"scope",changed:!1,required:`Run: ${r}`,examples:[r]})}function ee(e){return Object.keys(h).filter(t=>e==="global"||t!=="telemetry_tracking")}function At(e){let t=ee(e.scope).map(n=>({key:n,aliases:h[n],value_kind:n==="context"||n==="agent_identity_vocabulary"?"object":z(n)?"string_array":"enum",set_flags:n==="context"?["--default-depth","--activity-limit","--stale-threshold-days","--section-<name>"]:n==="agent_identity_vocabulary"?["--policy","--value","--criterion"]:z(n)?["--criterion","--clear-criteria"]:n==="item_format"?["--format"]:["--policy"],summary:at[n],value:x(e.settings,n)})),r=E.map(n=>({key:n.key,canonical_key:n.key.replaceAll("_","-"),path:n.path,kind:n.kind,value:D(e.settings,n),summary:n.summary,...n.choices?{choices:[...n.choices]}:{},...n.min===void 0?{}:{min:n.min},...n.max===void 0?{}:{max:n.max}}));return p({scope:e.scope,keys:t,nested_settings:r,count:t.length,settings_path:e.target.settingsPath,changed:!1},e.warnings)}function St(e){let t=Object.fromEntries(ee(e.scope).map(r=>[r,x(e.settings,r)]));return p({scope:e.scope,values:t,settings_path:e.target.settingsPath,changed:!1},e.warnings)}function Pt(e,t){let r=x(e.settings,t),n={scope:e.scope,key:t,settings_path:e.target.settingsPath,changed:!1};return t==="item_format"?p({...n,format:e.settings.item_format,has_explicit_item_format:e.metadata.has_explicit_item_format},e.warnings):t==="context"?p({...n,context_settings:r},e.warnings):t==="agent_identity_vocabulary"?p({...n,identity_vocabulary:r},e.warnings):Array.isArray(r)?p({...n,criteria:r},e.warnings):p({...n,policy:r},e.warnings)}async function qt(e,t,r,n){if(t==="get"){let s=D(e.settings,r);return p({scope:e.scope,key:r.key,nested_setting:{key:r.key,path:r.path,kind:r.kind,value:s},settings_path:e.target.settingsPath,changed:!1},e.warnings)}let i=n.value;if(typeof i!="string")throw new l(`Config set ${r.key} requires a value. Pass it positionally (\`pm config ${e.scope} set ${r.key} <value>\`) or via --value.`,c.USAGE);let a=j(r,i);if(!a.ok)throw new l(a.error.message,c.USAGE);let o=we(e.settings,r,a.parsed.value)||v(e.settings);return o&&await k(e.target.pmRoot,e.settings,`config:set:${r.path}`,{assignedPaths:[r.path]}),p({scope:e.scope,key:r.key,nested_setting:{key:r.key,path:r.path,kind:r.kind,value:a.parsed.value},settings_path:e.target.settingsPath,changed:o},e.warnings)}async function f(e,t,r,n=[]){(t||v(e.settings))&&(await k(e.target.pmRoot,e.settings,r,{assignedPaths:n}),v(e.settings)&&(e.fallbackRepairWritten=!0))}function F(e,t,r){return e!==r||t!==r}function m(e,t,r,n){return p({scope:e.scope,key:t,policy:r,settings_path:e.target.settingsPath,changed:n},e.warnings)}function V(e,t,r,n){return p({scope:e.scope,key:t,criteria:r,settings_path:e.target.settingsPath,changed:n},e.warnings)}async function Se(e,t,r){let n=I(t,T()),i=await ge(e,r,"config:set:item_format:migrate",n.type_to_folder,t.schema);return{target_format:i.target_format,scanned:i.scanned,migrated:i.migrated,removed:i.removed,warnings:i.warnings}}async function Gt(e,t){let r=$e(t.format),n=e.settings.item_format!==r||!e.metadata.has_explicit_item_format,i;if(n){e.settings.item_format=r;let a={assignedPaths:["item_format"]};v(e.settings)?(await k(e.target.pmRoot,e.settings,"config:set:item_format",a),e.fallbackRepairWritten=!0,i=await Se(e.target.pmRoot,await fe(e.target.pmRoot),r)):(i=await Se(e.target.pmRoot,e.settings,r),await k(e.target.pmRoot,e.settings,"config:set:item_format",a))}return p({scope:e.scope,key:"item_format",format:e.settings.item_format,has_explicit_item_format:!0,migration:i,settings_path:e.target.settingsPath,changed:n},e.warnings)}async function Rt(e,t,r){if(t==="history_missing_stream_policy"){let a=K(r.policy),o=e.settings.history.missing_stream!==a;return e.settings.history.missing_stream=a,await f(e,o,"config:set:history_missing_stream_policy",["history.missing_stream"]),m(e,t,e.settings.history.missing_stream,o)}if(t==="sprint_release_format_policy"){let a=N(r.policy),o=e.settings.validation.sprint_release_format!==a;return e.settings.validation.sprint_release_format=a,await f(e,o,"config:set:sprint_release_format_policy",["validation.sprint_release_format"]),m(e,t,e.settings.validation.sprint_release_format,o)}if(t==="parent_reference_policy"){let a=S(r.policy),o=e.settings.validation.parent_reference!==a||e.settings.governance.preset!=="custom"||e.settings.governance.parent_reference!==a;return e.settings.validation.parent_reference=a,e.settings.governance.preset="custom",e.settings.governance.parent_reference=a,await f(e,o,"config:set:parent_reference_policy",["validation.parent_reference","governance.preset","governance.parent_reference"]),m(e,t,e.settings.validation.parent_reference,o)}let n=q(r.policy),i=e.settings.validation.metadata_profile!==n||e.settings.governance.preset!=="custom"||e.settings.governance.metadata_profile!==n;return e.settings.validation.metadata_profile=n,e.settings.governance.preset="custom",e.settings.governance.metadata_profile=n,await f(e,i,"config:set:metadata_validation_profile",["validation.metadata_profile","governance.preset","governance.metadata_profile"]),m(e,t,e.settings.validation.metadata_profile,i)}async function Ot(e,t,r){if(t==="metadata_required_fields"){let s=Te(r.criterion,r.clearCriteria),d=s.length!==e.settings.validation.metadata_required_fields.length||s.some((_,u)=>_!==e.settings.validation.metadata_required_fields[u]);return e.settings.validation.metadata_required_fields=s,await f(e,d,"config:set:metadata_required_fields",["validation.metadata_required_fields"]),V(e,t,[...e.settings.validation.metadata_required_fields],d)}let i={lifecycle_stale_blocker_reason_patterns:e.settings.validation.lifecycle_stale_blocker_reason_patterns,lifecycle_closure_like_blocked_reason_patterns:e.settings.validation.lifecycle_closure_like_blocked_reason_patterns,lifecycle_closure_like_resolution_patterns:e.settings.validation.lifecycle_closure_like_resolution_patterns,lifecycle_closure_like_actual_result_patterns:e.settings.validation.lifecycle_closure_like_actual_result_patterns}[t],a=ht(t,r.criterion,r.clearCriteria),o=a.length!==i.length||a.some((s,d)=>s!==i[d]);return i.splice(0,i.length,...a),await f(e,o,`config:set:${t}`,[`validation.${t}`]),V(e,t,[...i],o)}async function $t(e,t,r){if(t==="governance_preset"){let d=W(r.policy),_=e.settings.governance.preset!==d;return e.settings.governance.preset=d,await f(e,_,"config:set:governance_preset",["governance.preset"]),m(e,t,e.settings.governance.preset,_)}let n=typeof r.policy=="string",i=n?r.policy.trim():"";if(n&&i.length===0){let d=e.settings.governance.create_default_type!==void 0;return delete e.settings.governance.create_default_type,await f(e,d,"config:set:governance_create_default_type",["governance.create_default_type"]),m(e,t,e.settings.governance.create_default_type??"",d)}if(i.length===0)throw new l('Config set governance-create-default-type requires an item type value (or an empty value "" to clear it)',c.USAGE);let a=I(e.settings,T()),o=te(i,a);if(!o)throw new l(de(i,a.types,se(e.target.pmRoot,e.settings.schema)),c.USAGE);let s=e.settings.governance.create_default_type!==o;return e.settings.governance.create_default_type=o,await f(e,s,"config:set:governance_create_default_type",["governance.create_default_type"]),m(e,t,e.settings.governance.create_default_type,s)}async function It(e,t,r){if(t==="governance_ownership_enforcement"){let a=B(r.policy),o=e.settings.governance.preset!=="custom"||e.settings.governance.ownership_enforcement!==a;return e.settings.governance.preset="custom",e.settings.governance.ownership_enforcement=a,await f(e,o,"config:set:governance_ownership_enforcement",["governance.preset","governance.ownership_enforcement"]),m(e,t,e.settings.governance.ownership_enforcement,o)}if(t==="governance_create_mode_default"){let a=X(r.policy),o=e.settings.governance.preset!=="custom"||e.settings.governance.create_mode_default!==a;return e.settings.governance.preset="custom",e.settings.governance.create_mode_default=a,await f(e,o,"config:set:governance_create_mode_default",["governance.preset","governance.create_mode_default"]),m(e,t,e.settings.governance.create_mode_default,o)}let n=Q(r.policy),i=e.settings.governance.preset!=="custom"||e.settings.governance.close_validation_default!==n;return e.settings.governance.preset="custom",e.settings.governance.close_validation_default=n,await f(e,i,"config:set:governance_close_validation_default",["governance.preset","governance.close_validation_default"]),m(e,t,e.settings.governance.close_validation_default,i)}async function Tt(e,t,r){if(t==="governance_parent_reference_policy"){let a=S(r.policy),o=e.settings.governance.preset!=="custom"||F(e.settings.governance.parent_reference,e.settings.validation.parent_reference,a);return e.settings.governance.preset="custom",e.settings.governance.parent_reference=a,e.settings.validation.parent_reference=a,await f(e,o,"config:set:governance_parent_reference_policy",["governance.preset","governance.parent_reference","validation.parent_reference"]),m(e,t,e.settings.governance.parent_reference,o)}if(t==="governance_metadata_validation_profile"){let a=q(r.policy),o=e.settings.governance.preset!=="custom"||F(e.settings.governance.metadata_profile,e.settings.validation.metadata_profile,a);return e.settings.governance.preset="custom",e.settings.governance.metadata_profile=a,e.settings.validation.metadata_profile=a,await f(e,o,"config:set:governance_metadata_validation_profile",["governance.preset","governance.metadata_profile","validation.metadata_profile"]),m(e,t,e.settings.governance.metadata_profile,o)}if(t==="governance_start_blocker_enforcement"){let a=P(r.policy,"governance-start-blocker-enforcement"),o=(e.settings.governance.start_blocker_enforcement??"strict")!==a;return e.settings.governance.start_blocker_enforcement=a,await f(e,o,"config:set:governance_start_blocker_enforcement",["governance.start_blocker_enforcement"]),m(e,t,a,o)}let n=P(r.policy),i=(e.settings.governance.workflow_enforcement??"off")!==n;return e.settings.governance.workflow_enforcement=n,await f(e,i,"config:set:governance_workflow_enforcement",["governance.workflow_enforcement"]),m(e,t,e.settings.governance.workflow_enforcement,i)}async function Nt(e,t,r){if(t==="governance_require_close_reason"){let s=Z(r.policy)==="enabled",d=e.settings.governance.require_close_reason!==s;return e.settings.governance.require_close_reason=s,await f(e,d,"config:set:governance_require_close_reason",["governance.require_close_reason"]),m(e,t,e.settings.governance.require_close_reason?"enabled":"disabled",d)}let i=J(r.policy)==="enabled",a=e.settings.governance.preset!=="custom"||e.settings.governance.force_required_for_stale_lock!==i;return e.settings.governance.preset="custom",e.settings.governance.force_required_for_stale_lock=i,await f(e,a,"config:set:governance_force_required_for_stale_lock",["governance.preset","governance.force_required_for_stale_lock"]),m(e,t,e.settings.governance.force_required_for_stale_lock?"enabled":"disabled",a)}async function Ut(e,t,r){if(t==="test_result_tracking"){let s=Ie(r.policy)==="enabled",d=e.settings.testing.record_results_to_items!==s;return e.settings.testing.record_results_to_items=s,await f(e,d,"config:set:test_result_tracking",["testing.record_results_to_items"]),m(e,t,e.settings.testing.record_results_to_items?"enabled":"disabled",d)}if(t==="untrusted_linked_test_execution"){let s=H(r.policy,"untrusted-linked-test-execution")==="enabled",d=e.settings.testing.allow_untrusted_linked_tests!==s;return e.settings.testing.allow_untrusted_linked_tests=s,await f(e,d,"config:set:untrusted_linked_test_execution",["testing.allow_untrusted_linked_tests"]),m(e,t,e.settings.testing.allow_untrusted_linked_tests?"enabled":"disabled",d)}let n=Y(r.policy);e.scope==="project"&&je("set",` --policy ${n}`);let i=n==="enabled",a=e.settings.telemetry.enabled!==i||!e.settings.telemetry.first_run_prompt_completed;return e.settings.telemetry.enabled=i,e.settings.telemetry.first_run_prompt_completed=!0,await f(e,a,"config:set:telemetry_tracking",["telemetry.enabled","telemetry.first_run_prompt_completed"]),m(e,t,e.settings.telemetry.enabled?"enabled":"disabled",a)}async function Lt(e,t,r){let n=Oe(r.criterion,r.clearCriteria),i=n.length!==e.settings.workflow.definition_of_done.length||n.some((a,o)=>a!==e.settings.workflow.definition_of_done[o]);return e.settings.workflow.definition_of_done=n,await f(e,i,"config:set:definition_of_done",["workflow.definition_of_done"]),V(e,t,[...e.settings.workflow.definition_of_done],i)}function jt(e){let t=e?.trim().toLowerCase().replaceAll("_","-"),r=t?.startsWith("preview-")===!0,n=r?t.slice(8):t;if(n==="add"||n==="remove"||n==="clear")return{operation:n,dryRun:r};throw new l("Config set agent-identity-vocabulary requires --policy add|remove|clear|preview-add|preview-remove|preview-clear",c.USAGE)}function Dt(e,t){if(e==="add"){let r=t?.lastIndexOf("=")??-1;if(r<=0||r===t.length-1)throw new l('Config set agent-identity-vocabulary --policy add requires --value "<legacy-author>=<canonical-harness>"',c.USAGE);return{legacy_author:t.slice(0,r),canonical_harness:t.slice(r+1)}}if(e==="remove"){if(t===void 0)throw new l("Config set agent-identity-vocabulary --policy remove requires --value <legacy-author>",c.USAGE);return{legacy_author:t}}if(t!==void 0)throw new l("Config set agent-identity-vocabulary --policy clear does not accept --value",c.USAGE);return{}}async function zt(e,t){let{operation:r,dryRun:n}=jt(t.policy),i=Dt(r,t.value),a;try{a=ve(e.settings.agent_identity?.identity_vocabulary,{operation:r,...i,observed_authors:t.criterion})}catch(o){throw new l(o.message,c.USAGE)}return a.preview.changed&&!n&&(e.settings.agent_identity={...e.settings.agent_identity,identity_vocabulary:a.vocabulary},await f(e,!0,`config:set:agent_identity.identity_vocabulary:${r}:v${a.preview.version_after}`,["agent_identity"])),p({scope:e.scope,key:"agent_identity_vocabulary",identity_vocabulary:U(n?e.settings.agent_identity?.identity_vocabulary:a.vocabulary),vocabulary_mutation:a.preview,settings_path:e.target.settingsPath,changed:a.preview.changed&&!n},e.warnings)}async function Mt(e,t,r){let n=await Ft(e,t,r);return e.fallbackRepairWritten===!0?{...n,changed:!0}:n}async function Ft(e,t,r){if(r.clearCriteria===!0&&!z(t))throw new l("--clear-criteria is only supported with config set criteria-list keys",c.USAGE);return t==="item_format"?Gt(e,r):t==="context"?Ct(e.settings,r,e.target,e.scope,e.warnings):t==="agent_identity_vocabulary"?zt(e,r):t==="definition_of_done"?Lt(e,t,r):Pe(t)?Ot(e,t,r):st.has(t)?Ut(e,t,r):ct.has(t)?Nt(e,t,r):ut(t)?It(e,t,r):ft(t)?Tt(e,t,r):mt(t)?$t(e,t,r):Rt(e,t,r)}async function Pr(e,t,r,n,i,a){let o=qe(e),s=Ge(t),d=s==="get"||s==="set"?L(r):void 0,_=d?void 0:vt(s,r,o,i),u=Le(s,r,_,d,a,n),g=await wt(o,i),{settings:y,metadata:Ve,warnings:Ke}=await ue(g.pmRoot),w={scope:o,target:g,settings:y,metadata:Ve,warnings:Ne(Ke)};return d?qt(w,s,d,u):s==="list"?At(w):s==="export"?St(w):(Ue(_),s==="get"&&_==="telemetry_tracking"&&o==="project"&&je("get",""),s==="get"?Pt(w,_):Mt(w,_,u))}var qr={hasGovernanceValidationMirrorChange:F,applyPositionalValue:Le,normalizeAction:Ge,normalizeCriteria:Oe,normalizeGovernanceCloseValidationDefault:Q,normalizeGovernanceCreateModeDefault:X,normalizeGovernanceForceRequiredForStaleLockPolicy:J,normalizeGovernanceOwnershipEnforcement:B,normalizeGovernancePreset:W,normalizeGovernanceRequireCloseReasonPolicy:Z,normalizeGovernanceWorkflowEnforcement:P,normalizeHistoryMissingStreamPolicy:K,normalizeItemFormat:$e,normalizeKey:Re,normalizeMetadataRequiredFields:Te,normalizePolicyForConflict:M,normalizeScope:qe,normalizeTelemetryTrackingPolicy:Y,normalizeTestResultTrackingPolicy:Ie,normalizeValidateMetadataProfile:q,normalizeWarnings:Ne};import{execFile as Vt}from"node:child_process";import Kt from"node:path";import{promisify as Ht}from"node:util";var Yt=Ht(Vt),ze="@unbrained/pm-cli",Wt="latest",Bt={global:["--global"],project:[]};function De(e){let t=e.project===!0||e.local===!0||e.scope==="project",r=e.global===!0||e.scope==="global";if(t&&r)throw new l('Options "--project/--local" and "--global" are mutually exclusive.',c.USAGE);return r?"global":"project"}function R(e){return e.trim().toLowerCase()}function Me(e,t){let r=R(t);return[e.name,e.directory,e.source.input,e.source.location,e.source.package,e.source.repository,e.source.owner&&e.source.repo?`${e.source.owner}/${e.source.repo}`:void 0].some(i=>typeof i=="string"&&R(i)===r)}function Xt(e,t){let r=A(process.cwd(),t.path),n=le(r,process.cwd());return{selected_root:e==="global"?n.global:n.project}}async function Qt(e,t,r){try{let n=await Yt(e,t,{cwd:r?.cwd,encoding:"utf8"});return{stdout:n.stdout,stderr:n.stderr}}catch(n){let i=typeof n=="object"&&n!==null&&"stderr"in n?String(n.stderr??""):"",a=i.trim().length>0?i.trim():n instanceof Error?n.message:String(n);throw new l(`Command failed: ${e} ${t.join(" ")}
2
+ ${a}`,c.GENERIC_FAILURE)}}function O(e){return typeof e.tag=="string"&&e.tag.trim().length>0?e.tag.trim():Wt}function G(e){return typeof e.packageName=="string"&&e.packageName.trim().length>0?e.packageName.trim():ze}async function Jt(e,t){let r=e.commandRunner??Qt,n=G(e),i=O(e),a=`${n}@${i}`,o=["npm","install","-g",a];e.repair===!0&&o.push("--force");let s=ce(import.meta.url,["../../.."]),d={requested:!0,status:"planned",package:n,target:a,command:o,before_version:s,...n===ze?{migration_guidance:["Calendar scheduling commands are package-owned. If calendar is absent, run pm package install calendar --project; use pm calendar meet, pm calendar event, or pm calendar remind."]}:{},repair:e.repair===!0};if(t)return d;try{await r(o[0],o.slice(1));let _=await r("pm",["--version"]);return{...d,status:"updated",after_version:_.stdout.trim()||void 0}}catch(_){return{...d,status:"failed",error:_ instanceof Error?_.message:String(_)}}}function Zt(e){return Kt.isAbsolute(e)||e.startsWith(".")||e.startsWith("..")||e.startsWith("file:")}function xt(e,t){if(e.kind==="npm"){let r=e.input.startsWith("npm:")?e.input.slice(4).trim():e.input.trim();return!Zt(r)&&e.package&&e.package.trim().length>0?`npm:${e.package.trim()}@${t}`:e.input.startsWith("npm:")?e.input:`npm:${e.input}`}return e.input}async function er(e,t){let r=xt(e,t);return e.kind!=="local"||await $(r)?r:await $(e.location)?e.location:r}function tr(e,t,r,n){let i=["pm","package","install",t,r==="global"?"--global":"--project"];return e.kind==="github"&&n&&n.trim().length>0&&i.push("--ref",n.trim()),i}async function Fe(e,t){let r=Xt(e,t);return(await pe(r.selected_root)).state.entries.filter(i=>i.scope===e)}async function rr(e,t,r){let n=await Fe(e,t);return n.find(i=>Me(i,r.name))??n.find(i=>R(i.directory)===R(r.directory))}async function nr(e,t,r,n,i){let a=O(t),o=await er(e.source,a),s=tr(e.source,o,n,e.source.ref),d={name:e.name,directory:e.directory,scope:n,source:e.source,status:"planned",command:s,previous_version:e.manifest_version};if(i)return d;try{await ye(o,{install:!0,project:n==="project",global:n==="global",ref:e.source.kind==="github"?e.source.ref:void 0},r);let _=await rr(n,r,e);return{...d,status:"updated",installed_version:_?.manifest_version}}catch(_){return{...d,status:"failed",error:_ instanceof Error?_.message:String(_)}}}function ar(e,t,r,n){let i=[r?e.status:void 0,...t.map(a=>a.status)].filter(a=>typeof a=="string");return{requested_cli:r,requested_packages:n,planned:i.filter(a=>a==="planned").length,updated:i.filter(a=>a==="updated").length,skipped:i.filter(a=>a==="skipped").length,failed:i.filter(a=>a==="failed").length}}async function Ur(e,t,r){let n=typeof e=="string"&&e.trim().length>0?e.trim():void 0;if(t.cliOnly===!0&&t.packagesOnly===!0){let y=["package","upgrade",...n?[n]:[],"--packages-only","--dry-run",...Bt[De(t)]];throw new l('Options "--cli-only" and "--packages-only" are mutually exclusive.',c.USAGE,{code:"package_upgrade_modes_mutually_exclusive",recovery:{suggested_retry:C(y),suggested_retry_args:y}})}let i=De(t),a=t.dryRun===!0;if(t.cliOnly===!0&&n)throw new l('A package target cannot be used with "--cli-only".',c.USAGE);let o=!(t.packagesOnly===!0||n),s=t.cliOnly!==!0,d=o?await Jt(t,a):{requested:!1,status:"skipped",package:G(t),target:`${G(t)}@${O(t)}`,command:["npm","install","-g",`${G(t)}@${O(t)}`],repair:t.repair===!0,reason:"not_requested"},_=s?await Fe(i,r):[];if(n&&(_=_.filter(y=>Me(y,n)),_.length===0))throw new l(`Managed package "${n}" was not found in ${i} scope.`,c.NOT_FOUND);let u=[];for(let y of _)u.push(await nr(y,t,r,i,a));let g=ar(d,u,o,s);return{ok:g.failed===0,action:"upgrade",dry_run:a,scope:i,target:n,cli:d,packages:u,summary:g}}export{L as a,j as b,D as c,we as d,U as e,ve as f,Pr as g,qr as h,Ur as i};
3
+ //# sourceMappingURL=chunk-ZLICQPRG.js.map
@@ -0,0 +1,2 @@
1
+ import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i}from"./chunk-K34FR5CO.js";import"./chunk-4FZH5BTV.js";import"./chunk-XHCIOLJP.js";import"./chunk-SX76UGEY.js";import"./chunk-6OIHST4I.js";import"./chunk-XAWE4EAK.js";export{i as assertFieldDefinitionOptionsAvailable,h as assertFieldOptionsAvailable,e as describeFieldFlagSpellingDefectLine,f as describeFieldOptionCollision,d as resolveAddFieldFlagSpellingDefects,b as resolveAddFieldOptionCollisions,c as resolveFieldFlagSpellingDefects,a as resolveFieldOptionCollisions,g as scanFieldOptionCollisions};
2
+ //# sourceMappingURL=field-option-collisions-QE65APSD.js.map
@@ -1,4 +1,4 @@
1
- import{d as E}from"./chunk-D6PDUKUG.js";import{c as I}from"./chunk-AA52P34H.js";import"./chunk-YYT3MIRF.js";import"./chunk-XAWE4EAK.js";import{execFile as M}from"node:child_process";import{realpath as x}from"node:fs/promises";import w from"node:path";import{promisify as N}from"node:util";var b=N(M),_="[a-f0-9]{40}(?:[a-f0-9]{24})?",R=new RegExp(`^100(?:644|755) (${_}) 0$`,"u"),B=new RegExp(`^(${_}) blob (\\d+)$`,"u");async function v(o,a,r){let t=b("git",o,{...r,encoding:"buffer"}),e=t.child.stdin;return e!==null&&(e.on("error",()=>{t.child.kill()}),e.end(`${a.join(`
1
+ import{d as E}from"./chunk-KHFUHGL3.js";import{c as I}from"./chunk-AA52P34H.js";import"./chunk-6OIHST4I.js";import"./chunk-XAWE4EAK.js";import{execFile as M}from"node:child_process";import{realpath as x}from"node:fs/promises";import w from"node:path";import{promisify as N}from"node:util";var b=N(M),_="[a-f0-9]{40}(?:[a-f0-9]{24})?",R=new RegExp(`^100(?:644|755) (${_}) 0$`,"u"),B=new RegExp(`^(${_}) blob (\\d+)$`,"u");async function v(o,a,r){let t=b("git",o,{...r,encoding:"buffer"}),e=t.child.stdin;return e!==null&&(e.on("error",()=>{t.child.kill()}),e.end(`${a.join(`
2
2
  `)}
3
3
  `)),(await t).stdout}function S(o,a){let r=new Map;for(let t of o.split("\0")){let e=t.indexOf(" "),i=t.slice(e+1),n=R.exec(t.slice(0,e));n!==null&&a.has(i)&&r.set(i,n[1])}return r}function y(o,a,r){let t=[],e=[],i=0;for(let n of o.trimEnd().split(/\r?\n/u)){let s=B.exec(n);if(s===null||!a.has(s[1]))continue;let c=Number(s[2]);!Number.isSafeInteger(c)||c>r||(e.length>0&&i+c+128>r&&(t.push(e),e=[],i=0),e.push({id:s[1],size:c}),i+=c+128)}return e.length>0&&t.push(e),t}function z(o,a,r){let t=0;for(let{id:e,size:i}of a){let n=o.indexOf(10,t)+1;if(n===0||o.subarray(t,n-1).toString("ascii")!==`${e} blob ${i}`||o[n+i]!==10)throw new Error("Invalid indexed receipt batch framing");r.set(e,o.subarray(n,n+i).toString("utf8")),t=n+i+1}if(t!==o.length)throw new Error("Unexpected indexed receipt batch data")}async function C(o,a,r,t,e,i={}){let n=I();n.GIT_NO_REPLACE_OBJECTS="1",e===void 0&&process.env.GIT_INDEX_FILE!==void 0&&(n.GIT_INDEX_FILE=w.resolve(process.env.GIT_INDEX_FILE));let s={cwd:o,env:n,windowsHide:!0,timeout:1e4,maxBuffer:t+256};try{let c=(await b("git",["rev-parse","--show-toplevel"],{...s,encoding:"utf8"})).stdout.trim(),[g,$]=await Promise.all([x(c),x(e??a)]),d=w.relative(g,e===void 0?$:w.resolve(e)).replaceAll("\\","/");if(E(d))return new Map;s.cwd=g;let m=new Map(r.map(f=>[`${d}/${f}`,f])),O=(await b("git",["ls-files","--stage","-z","--",`:(literal)${d}/`],{...s,encoding:"utf8"})).stdout,p=S(O,new Set(m.keys()));if(p.size===0)return new Map;let u=new Set(p.values()),T=(await v(["cat-file","--batch-check"],[...u],s)).toString("utf8"),l=new Map;for(let f of y(T,u,t))z(await v(["cat-file","--batch"],f.map(h=>h.id),s),f,l);if(i.failOnReadError&&l.size!==u.size)throw new Error("Unable to read every indexed receipt blob");return new Map([...p].filter(([,f])=>l.has(f)).map(([f,h])=>[m.get(f),l.get(h)]))}catch(c){if(i.failOnReadError)throw c;return new Map}}export{C as readIndexedReceiptBlobs};
4
- //# sourceMappingURL=indexed-receipt-blobs-BPYKN5Q7.js.map
4
+ //# sourceMappingURL=indexed-receipt-blobs-H3MMNXXG.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,b as f,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w,t as x,u as y}from"./chunk-O7Z73ALG.js";import"./chunk-6LPXMFLM.js";import"./chunk-UFTUNBMY.js";import"./chunk-QLAHEDT6.js";import"./chunk-BKPUUW5O.js";import"./chunk-OTMMOKPM.js";import"./chunk-HMDQDRV2.js";import"./chunk-X6CXWWNB.js";import{lf as a,mf as b,nf as c,of as d}from"./chunk-Z2X7HH3C.js";import"./chunk-A6VEMCRR.js";export{f as ITEM_REVISION_CONFLICT_CHANGE_LIMIT,e as ITEM_REVISION_CONFLICT_CODE,w as assertExpectHashAdmissible,t as bindExpectedItemRevisions,c as bindItemRevisionScope,a as createItemRevisionScope,k as describeItemRevisionChanges,y as dispatchWithExpectedItemRevisions,q as enrichItemRevisionConflict,o as expectHashInvocationRewrittenError,x as expectHashRequiresMutationError,m as isItemRevisionConflict,u as isTrackerRevisionGuarded,l as itemRevisionConflictRowFields,d as itemRevisionScopeReceipt,v as itemRevisionUncheckedWarning,g as normalizeExpectedItemHash,h as parseExpectHashSpecs,i as readItemRevision,j as resolveExpectedItemRevisions,r as runWithBoundItemRevisionScope,b as runWithItemRevisionScope,p as scopeItemRevisionConflict,n as throwFirstItemRevisionConflict,s as withExpectedItemRevisions};
2
- //# sourceMappingURL=item-revision-YDACCDVY.js.map
1
+ import{A as u,B as v,C as w,D as x,E as y,k as e,l as f,m as g,n as h,o as i,p as j,q as k,r as l,s as m,t as n,u as o,v as p,w as q,x as r,y as s,z as t}from"./chunk-DF6A7C32.js";import"./chunk-CONBVY2O.js";import"./chunk-PZA7QECY.js";import"./chunk-FVY7U3SU.js";import"./chunk-C4KIZQHW.js";import{Wf as a,Xf as b,Yf as c,Zf as d}from"./chunk-CNUFU454.js";import"./chunk-XHCIOLJP.js";import"./chunk-SX76UGEY.js";import"./chunk-6OIHST4I.js";import"./chunk-XAWE4EAK.js";export{f as ITEM_REVISION_CONFLICT_CHANGE_LIMIT,e as ITEM_REVISION_CONFLICT_CODE,w as assertExpectHashAdmissible,t as bindExpectedItemRevisions,c as bindItemRevisionScope,a as createItemRevisionScope,k as describeItemRevisionChanges,y as dispatchWithExpectedItemRevisions,q as enrichItemRevisionConflict,o as expectHashInvocationRewrittenError,x as expectHashRequiresMutationError,m as isItemRevisionConflict,u as isTrackerRevisionGuarded,l as itemRevisionConflictRowFields,d as itemRevisionScopeReceipt,v as itemRevisionUncheckedWarning,g as normalizeExpectedItemHash,h as parseExpectHashSpecs,i as readItemRevision,j as resolveExpectedItemRevisions,r as runWithBoundItemRevisionScope,b as runWithItemRevisionScope,p as scopeItemRevisionConflict,n as throwFirstItemRevisionConflict,s as withExpectedItemRevisions};
2
+ //# sourceMappingURL=item-revision-INDHJV6X.js.map
@@ -0,0 +1,2 @@
1
+ import{i as a,j as b,k as c,l as d,m as e,n as f,o as g,p as h,q as i,r as j}from"./chunk-YIGBEY7K.js";import"./chunk-BVJMVU4Z.js";import"./chunk-OS5W4ZG2.js";import"./chunk-MGJMQSN4.js";import"./chunk-L6VS7F3R.js";import"./chunk-ZLICQPRG.js";import"./chunk-VA4T37Q4.js";import"./chunk-CZEMEPPQ.js";import"./chunk-KHFUHGL3.js";import"./chunk-AA52P34H.js";import"./chunk-LPW7S5KA.js";import"./chunk-ZBOQEZ2H.js";import"./chunk-6H36ZHMI.js";import"./chunk-WQOEVGLQ.js";import"./chunk-7EPYCU7U.js";import"./chunk-DF6A7C32.js";import"./chunk-CONBVY2O.js";import"./chunk-PZA7QECY.js";import"./chunk-FVY7U3SU.js";import"./chunk-C4KIZQHW.js";import"./chunk-CNUFU454.js";import"./chunk-K34FR5CO.js";import"./chunk-4FZH5BTV.js";import"./chunk-XHCIOLJP.js";import"./chunk-SX76UGEY.js";import"./chunk-6OIHST4I.js";import"./chunk-XAWE4EAK.js";export{h as _testOnlyItemTransaction,j as abandonItemTransaction,f as buildItemCompletionMutations,g as commitItemCompletion,e as commitItemMutations,b as listUpsertKeyCandidates,c as loadGuardedRuntimeSchema,d as previewItemMutations,i as readItemTransaction,a as resolveTransactionSchema};
2
+ //# sourceMappingURL=item-transaction-LCKK4XXB.js.map
@@ -0,0 +1,2 @@
1
+ import{kc as t,lc as r,mc as s}from"./chunk-CNUFU454.js";import"./chunk-XHCIOLJP.js";import"./chunk-SX76UGEY.js";import"./chunk-6OIHST4I.js";import"./chunk-XAWE4EAK.js";function c(n){let e=r(n),o={...e.harness===void 0?{}:{harness:e.harness},...e.model===void 0?{}:{model:e.model},...e.model_source===void 0?{}:{model_source:e.model_source},...e.instance===void 0?{}:{instance:e.instance}};return Object.freeze({author:n,author_source:t(n),principal:s(n),...Object.keys(o).length===0?{}:{agent:Object.freeze(o)}})}export{c as resolveMutationActor};
2
+ //# sourceMappingURL=mutation-actor-KU7BMLUN.js.map
@@ -0,0 +1,2 @@
1
+ import{P as y,s as _,x as f}from"./chunk-L6VS7F3R.js";import{a as A,j as L,m as M}from"./chunk-7EPYCU7U.js";import"./chunk-FVY7U3SU.js";import{v as E}from"./chunk-C4KIZQHW.js";import{Qa as S,ba as w}from"./chunk-CNUFU454.js";import{G as R,Pa as N,Va as b}from"./chunk-4FZH5BTV.js";import{ca as C}from"./chunk-XHCIOLJP.js";import{Q as T,R as g}from"./chunk-SX76UGEY.js";import{C as m}from"./chunk-6OIHST4I.js";import"./chunk-XAWE4EAK.js";function l(e,t,n,i=!1){let s=[...n].map(o=>({candidate:o,distance:S(t,o,3)})).filter(o=>o.distance!==null).sort((o,d)=>o.distance-d.distance||o.candidate.localeCompare(d.candidate))[0]?.candidate,a=i?`Put mutation fields under options (options.${t}).`:s?`Did you mean "${s}"?`:"Use the declared command options or the field option for registered item fields.";throw new m(`Unknown ${e} ${i?"argument":"option"} "${t}". ${a} No changes were made.`,2,{code:"invalid_argument_value",reason:"unknown_mutation_option",changed:!1,field:t,required:a,nextSteps:[a]})}var p=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];function $(e){let t=e==="create"?L:M,i=(e==="create"?N:b).map(({flag:s})=>s.slice(2).replace(/-([a-z])/gu,(a,o)=>o.toUpperCase()));return new Set([...t.flatMap(s=>[s.target,...s.keys]),...i,"author","message","force","fullChangedFields","idOnly",...p])}function F(e){if(e!==void 0&&!f(e))throw new m("Mutation options must be an object. No changes were made.",2,{code:"invalid_argument_value",changed:!1})}async function v(e,t){let i=T((await E(w(process.cwd(),t))).schema).command_to_fields.get(e)??[];return{targets:i.map(s=>g(s)),reads:s=>i.some(a=>C({[s]:!0},a)===!0)}}async function h(e,t,n,i,s,a=(o,d)=>l(e,o,d)){let o=[...n].filter(r=>!i.has(r));if(o.length===0)return;let d=await v(t,s);for(let r of d.targets)i.add(r);for(let r of o)d.reads(r)||a(r,i)}async function ee(e,t,n,i,s){if(_(t))return;let a=$(e),o=new Set(["action","options","path","cwd","author","force","noExtensions","no_extensions","fullChangedFields","idOnly",...p,...s,...e==="update"?["id"]:[]]);for(let r of Object.keys(t))o.has(r)||l(e,r,a,a.has(r));let d=t.options;F(d),await h(e,e,new Set([...Object.keys(d??{}),...Object.keys(n)]),a,i)}var I=new Set([...y].filter(e=>e!=="filterStatus"&&(e.startsWith("filter")||e==="ids"||e==="limit"||e==="offset"))),k=e=>e.replace(/_([a-z])/gu,(t,n)=>n.toUpperCase()),O=new Map([["for","Bound the selection with list.limit."],["tokenBudget","Bound the selection with list.limit."],["token_budget","Bound the selection with list.limit."],["all",'State the status selection as filterStatus: "all" beside the list record.'],["status","State the status selection as filterStatus beside the list record."]]),K=["compact","brief","fields","includeBody","full"];async function U(e,t){let n=K.filter(s=>Object.hasOwn(e,s));if(n.length===0)return;let i=await v("list",t);for(let s of n)i.reads(s)&&c(`update-many "list.${s}" is not read beside this selection.`,`list.${s}`,"The bulk selection clears this list option, so the schema field's filter under that name is not applied; select the rows another way.")}var j=["excludeTerminal","lifecycleBucket","dependencyBlocked"];function P(){let e=R.map(({flag:n})=>n.replace(/^--(?:no-)?/u,"").replace(/-([a-z])/gu,(i,s)=>s.toUpperCase())),t=new Set([...e,...A.flatMap(n=>n.keys),"filterEstimateMissing",...j]);for(let n of O.keys())t.delete(n);return t}function c(e,t,n,i="unknown_mutation_option"){throw new m(`${e} ${n} No changes were made.`,2,{code:"invalid_argument_value",reason:i,changed:!1,field:t,required:n,nextSteps:[n]})}function D(){let e=$("update");e.delete("id");for(let t of e)/File$|^stdin/u.test(t)&&e.delete(t);return e.add("documentAnnotationSnapshot"),e}function B(e){for(let t of["list","update"]){let n=e[t];n!=null&&!f(n)&&c(`update-many "${t}" must be an object.`,t,`Pass ${t} as an object, or omit it.`,"invalid_mutation_option_value")}}async function x(e,t,n){Object.hasOwn(e,"id")&&l("update-many list","id",new Set(["ids"])),Object.hasOwn(e,"status")&&c('update-many "list.status" is not read beside this selection.',"list.status",O.get("status"));let i=[...t].find(s=>I.has(s));i!==void 0&&c(`update-many "${i}" is not read beside this selection.`,i,`Put the selection inside list, or drop the list record; a flat "${i}" beside it is not read.`),await U(e,n),await h("update-many list","list",Object.keys(e),P(),n,(s,a)=>{let o=O.get(s);o===void 0&&l("update-many list",s,a),c(`update-many "list.${s}" is not read beside this selection.`,`list.${s}`,o)})}function Y(e,t,n){for(let i of e)t.has(i)||(n.has(i)&&c(`Unknown update-many option "${i}".`,i,`Put update fields inside update (update.${i}); beside a nested update record an outer key selects rows or controls the run.`),l("update-many",i,t))}async function te(e,t,n){if(_(e))return;let i=e.options;F(i);let s=D(),a=new Set([...y,"author","message","force","fullChangedFields","idOnly",...p]),o=new Set([...s,...a]),d=new Set(["action","options","path","cwd","author","noExtensions","no_extensions","fullChangedFields","idOnly",...p]);for(let u of Object.keys(e))d.has(u)||l("update-many",u,o,o.has(u));let r=new Set([...Object.keys(i??{}),...Object.keys(t)].map(u=>p.includes(k(u))?k(u):u));if(B(t),f(t.list)&&await x(t.list,r,n),!f(t.update)){await h("update-many","update_many",r,o,n);return}Y(r,a,s),await h("update-many","update_many",Object.keys(t.update),s,n)}export{ee as assertNativeMutationOptions,te as assertNativeUpdateManyOptions};
2
+ //# sourceMappingURL=mutation-admission-3OMCTQD4.js.map
@@ -1,4 +1,4 @@
1
- import{a as ce}from"./chunk-F2Z6XLZB.js";import"./chunk-SLFRSZK6.js";import{b as g,c as _,d as O}from"./chunk-O7JHS64G.js";import{L as ie,P as re,U as ae,n as oe,u as I,w as ne}from"./chunk-H7JEXRIN.js";import{Gc as X,Ha as V,Ic as Y,Kc as Z,Lb as K,Nc as ee,Oc as te,Qc as se,Rc as le,Sc as de,U as Q,uc as W}from"./chunk-KZHIBEJL.js";import"./chunk-S32NGRQM.js";import{Cc as y,Fc as s,Hc as l,Nc as $,Oc as M,Pc as B,Qc as N,Rc as T,Sc as U,Tc as P,Uc as z,Vc as H,Wc as J,d as L}from"./chunk-OPJF254V.js";import"./chunk-6MYJLOSG.js";import"./chunk-NQ54T7T2.js";import"./chunk-PZA7QECY.js";import{Aa as q,za as R}from"./chunk-TZY5MVJF.js";import{v as G}from"./chunk-2UQU7HRR.js";import{A as E,Sa as D,Ug as F,gh as v,lh as h,mh as p,uj as k,z as C}from"./chunk-NGJ5ERBF.js";import"./chunk-6H36ZHMI.js";import{A as c,C as u}from"./chunk-YYT3MIRF.js";import"./chunk-XAWE4EAK.js";async function he(e,i){let n=y(i),o=Date.now();if([e.raw,e.compact,e.full,e.provenance].filter(d=>d===!0).length>1)throw new u("Activity projection options are mutually exclusive. Use --raw, --compact, --provenance, or --full.",c.USAGE);let r=z(e.stream);if(r&&!n.json)throw new u("--stream requires --json output mode.",c.USAGE);let t=P(e),a=await K(r&&e.full!==!0&&e.provenance!==!0?{...t,raw:!0,compact:!0}:t,n);r?N(a,t,n):h(a,n),n.profile&&p(`profile:command=activity took_ms=${Date.now()-o}`)}function j(e){e.option("--id <value>","Filter by item ID").option("--op <value>","Filter by history operation").option("--author <value>","Filter by history author").option("--from <value>","Inclusive lower time bound (ISO or relative)").option("--to <value>","Exclusive upper time bound (ISO or relative)").option("--limit <n>","Maximum activity rows").option("--after <cursor>","Continue a fixed-window page").option("--unbounded","Return every matching row").option("--compact","Show compact event rows").option("--raw","Show the legacy compact per-event stream instead of the item digest").option("--full","Show full activity entries with JSON Patch payloads").option("--provenance","Show patch-free author, harness, instance, and extensible provenance").option("--provenance-summary","Include provenance counts").option("--harness <value>","Filter by harness (repeatable)",s).option("--agent-instance <value>","Filter by agent instance (repeatable)",s).option("--provenance-filter <dimension=value>","Filter exact provenance values (repeatable)",s).option("--stream [mode]","Emit line-delimited JSON rows (requires --json): rows|ndjson|jsonl").description("Show recent activity across items.").action(he)}function ye(e,i){return!i||i.size===0?!0:e==="context"?i.has("context")||i.has("ctx"):i.has(e)}function ue(e){if(e===void 0)return;if(typeof e!="string")throw new u("List --format must be one of csv|table|json|ndjson|toon",c.USAGE);let i=e.trim().toLowerCase();if(i==="csv"||i==="table"||i==="json"||i==="ndjson"||i==="toon")return i;throw new u("List --format must be one of csv|table|json|ndjson|toon",c.USAGE)}function S(e,i,n,o=!1){if(i===void 0)return n;if(typeof i!="string")throw new u(`${e} --format must be one of ${o?"json|ndjson|toon":"json|toon"}`,c.USAGE);let r=i.trim().toLowerCase();if(r!=="json"&&(r!=="ndjson"||!o)&&r!=="toon")throw new u(`${e} --format must be one of ${o?"json|ndjson|toon":"json|toon"}`,c.USAGE);if(n.json===!0&&r==="toon")throw new u(`${e} cannot combine --json with --format toon`,c.USAGE);return{...n,json:r==="json"||r==="ndjson"}}function ve(e,i){L[i]==="brief"&&e.includeBody!==!0&&e.compact!==!0&&e.brief!==!0&&e.full!==!0&&e.fields===void 0&&(e.brief=!0)}function pe(e){e.option("--has-notes","Show only items that have notes").option("--has-learnings","Show only items that have learnings").option("--has-files","Show only items that have linked files").option("--has-docs","Show only items that have linked docs").option("--has-tests","Show only items that have linked tests").option("--has-comments","Show only items that have comments").option("--has-deps","Show only items that have dependencies").option("--has-body","Show only items that have a non-empty body").option("--has-linked-command","Show only items whose linked tests carry a runnable command").option("--no-notes","Show only items that have no notes").option("--no-learnings","Show only items that have no learnings").option("--no-files","Show only items that have no linked files").option("--filter-files-missing","Alias for --no-files").option("--no-docs","Show only items that have no linked docs").option("--filter-docs-missing","Alias for --no-docs").option("--no-tests","Show only items that have no linked tests").option("--no-comments","Show only items that have no comments").option("--no-deps","Show only items that have no dependencies").option("--empty-body","Show only items with an empty body").option("--no-linked-command","Show only items whose linked tests carry no runnable command").option("--filter-reviewer-missing","Show only items missing reviewer").option("--filter-risk-missing","Show only items missing risk").option("--filter-confidence-missing","Show only items missing confidence").option("--filter-sprint-missing","Show only items missing sprint").option("--filter-release-missing","Show only items missing release")}var ge={draft:{name:"list-draft",dependencyBlocked:!1},open:{name:"list-open",dependencyBlocked:!1},in_progress:{name:"list-in-progress",dependencyBlocked:!1},blocked:{name:"list-blocked",dependencyBlocked:!0},closed:{name:"list-closed",dependencyBlocked:!1},canceled:{name:"list-canceled",dependencyBlocked:!1}};function be(e,i){let n=e.stream===!0,o=ue(e.format),r=o==="csv"||o==="table",t=o==="json"||o==="ndjson"||o==="toon"?S("List",e.format,i,!0):i;if(n&&!t.json)throw new u("--stream requires --json output mode.",c.USAGE);if((r||o==="ndjson")&&n)throw new u("--format csv|table|ndjson cannot be combined with --stream.",c.USAGE);return{streamMode:n,listFormat:o,effectiveGlobal:t}}function we(e,i,n){if(n.listFormat==="csv"||n.listFormat==="table"){k(i);let o=i.items,r=n.listFormat==="csv"?R(o):q(o);!n.effectiveGlobal.quiet&&r.length>0&&v(`${r}
1
+ import{a as ce}from"./chunk-GBVF2ZB3.js";import"./chunk-SLFRSZK6.js";import{b as g,c as _,d as O}from"./chunk-OWK2JL4I.js";import{L as ie,P as re,U as ae,n as oe,u as I,w as ne}from"./chunk-LPW7S5KA.js";import{Ha as V,Hc as X,Jc as Y,Lc as Z,Mb as K,Oc as ee,Pc as te,Rc as se,Sc as le,Tc as de,U as Q,vc as W}from"./chunk-ZBOQEZ2H.js";import"./chunk-6H36ZHMI.js";import"./chunk-WQOEVGLQ.js";import{Aa as $,Ba as M,Ca as B,Da as N,Ea as T,Fa as U,Ga as P,Ha as z,Ia as H,Ja as J,pa as y,sa as s,ua as l}from"./chunk-7EPYCU7U.js";import"./chunk-DF6A7C32.js";import"./chunk-CONBVY2O.js";import"./chunk-PZA7QECY.js";import{Aa as q,za as R}from"./chunk-FVY7U3SU.js";import{v as G}from"./chunk-C4KIZQHW.js";import{Af as p,Ih as k,ba as D,gf as F,uf as v,zf as h}from"./chunk-CNUFU454.js";import{e as L}from"./chunk-4FZH5BTV.js";import{o as C,p as E}from"./chunk-XHCIOLJP.js";import"./chunk-SX76UGEY.js";import{A as c,C as u}from"./chunk-6OIHST4I.js";import"./chunk-XAWE4EAK.js";async function he(e,i){let n=y(i),o=Date.now();if([e.raw,e.compact,e.full,e.provenance].filter(d=>d===!0).length>1)throw new u("Activity projection options are mutually exclusive. Use --raw, --compact, --provenance, or --full.",c.USAGE);let r=z(e.stream);if(r&&!n.json)throw new u("--stream requires --json output mode.",c.USAGE);let t=P(e),a=await K(r&&e.full!==!0&&e.provenance!==!0?{...t,raw:!0,compact:!0}:t,n);r?N(a,t,n):h(a,n),n.profile&&p(`profile:command=activity took_ms=${Date.now()-o}`)}function j(e){e.option("--id <value>","Filter by item ID").option("--op <value>","Filter by history operation").option("--author <value>","Filter by history author").option("--from <value>","Inclusive lower time bound (ISO or relative)").option("--to <value>","Exclusive upper time bound (ISO or relative)").option("--limit <n>","Maximum activity rows").option("--after <cursor>","Continue a fixed-window page").option("--unbounded","Return every matching row").option("--compact","Show compact event rows").option("--raw","Show the legacy compact per-event stream instead of the item digest").option("--full","Show full activity entries with JSON Patch payloads").option("--provenance","Show patch-free author, harness, instance, and extensible provenance").option("--provenance-summary","Include provenance counts").option("--harness <value>","Filter by harness (repeatable)",s).option("--agent-instance <value>","Filter by agent instance (repeatable)",s).option("--provenance-filter <dimension=value>","Filter exact provenance values (repeatable)",s).option("--stream [mode]","Emit line-delimited JSON rows (requires --json): rows|ndjson|jsonl").description("Show recent activity across items.").action(he)}function ye(e,i){return!i||i.size===0?!0:e==="context"?i.has("context")||i.has("ctx"):i.has(e)}function ue(e){if(e===void 0)return;if(typeof e!="string")throw new u("List --format must be one of csv|table|json|ndjson|toon",c.USAGE);let i=e.trim().toLowerCase();if(i==="csv"||i==="table"||i==="json"||i==="ndjson"||i==="toon")return i;throw new u("List --format must be one of csv|table|json|ndjson|toon",c.USAGE)}function S(e,i,n,o=!1){if(i===void 0)return n;if(typeof i!="string")throw new u(`${e} --format must be one of ${o?"json|ndjson|toon":"json|toon"}`,c.USAGE);let r=i.trim().toLowerCase();if(r!=="json"&&(r!=="ndjson"||!o)&&r!=="toon")throw new u(`${e} --format must be one of ${o?"json|ndjson|toon":"json|toon"}`,c.USAGE);if(n.json===!0&&r==="toon")throw new u(`${e} cannot combine --json with --format toon`,c.USAGE);return{...n,json:r==="json"||r==="ndjson"}}function ve(e,i){L[i]==="brief"&&e.includeBody!==!0&&e.compact!==!0&&e.brief!==!0&&e.full!==!0&&e.fields===void 0&&(e.brief=!0)}function pe(e){e.option("--has-notes","Show only items that have notes").option("--has-learnings","Show only items that have learnings").option("--has-files","Show only items that have linked files").option("--has-docs","Show only items that have linked docs").option("--has-tests","Show only items that have linked tests").option("--has-comments","Show only items that have comments").option("--has-deps","Show only items that have dependencies").option("--has-body","Show only items that have a non-empty body").option("--has-linked-command","Show only items whose linked tests carry a runnable command").option("--no-notes","Show only items that have no notes").option("--no-learnings","Show only items that have no learnings").option("--no-files","Show only items that have no linked files").option("--filter-files-missing","Alias for --no-files").option("--no-docs","Show only items that have no linked docs").option("--filter-docs-missing","Alias for --no-docs").option("--no-tests","Show only items that have no linked tests").option("--no-comments","Show only items that have no comments").option("--no-deps","Show only items that have no dependencies").option("--empty-body","Show only items with an empty body").option("--no-linked-command","Show only items whose linked tests carry no runnable command").option("--filter-reviewer-missing","Show only items missing reviewer").option("--filter-risk-missing","Show only items missing risk").option("--filter-confidence-missing","Show only items missing confidence").option("--filter-sprint-missing","Show only items missing sprint").option("--filter-release-missing","Show only items missing release")}var ge={draft:{name:"list-draft",dependencyBlocked:!1},open:{name:"list-open",dependencyBlocked:!1},in_progress:{name:"list-in-progress",dependencyBlocked:!1},blocked:{name:"list-blocked",dependencyBlocked:!0},closed:{name:"list-closed",dependencyBlocked:!1},canceled:{name:"list-canceled",dependencyBlocked:!1}};function be(e,i){let n=e.stream===!0,o=ue(e.format),r=o==="csv"||o==="table",t=o==="json"||o==="ndjson"||o==="toon"?S("List",e.format,i,!0):i;if(n&&!t.json)throw new u("--stream requires --json output mode.",c.USAGE);if((r||o==="ndjson")&&n)throw new u("--format csv|table|ndjson cannot be combined with --stream.",c.USAGE);return{streamMode:n,listFormat:o,effectiveGlobal:t}}function we(e,i,n){if(n.listFormat==="csv"||n.listFormat==="table"){k(i);let o=i.items,r=n.listFormat==="csv"?R(o):q(o);!n.effectiveGlobal.quiet&&r.length>0&&v(`${r}
2
2
  `)}else if(n.listFormat==="ndjson"){k(i);let o=_(i.items);!n.effectiveGlobal.quiet&&o.length>0&&v(`${o}
3
3
  `)}else n.streamMode?B(e,i,n.effectiveGlobal):h(i,n.effectiveGlobal)}function A(e,i,n,o=[]){if(n.outputBudget===void 0)return F(e,i,o);let{outputBudget:r,...t}=F(e,{...i,outputBudget:n.outputBudget},o);return t}async function xe(e){let i=y(e.actionCommand),n=e.aliasContract?{...i,command:e.aliasContract.canonical}:i,o=Date.now();e.aliasContract?.lifecycle==="deprecated"&&await G(D(process.cwd(),n.path)).then(fe=>fe.ux.deprecation_hints)&&p(E(e.aliasContract));let r=A("list",e.options,n),t=$(r),a=ke(e,t),{effectiveName:d,effectiveStatus:m,effectiveDependencyBlocked:f,effectiveExcludeTerminal:w}=a;ve(t,e.name),Object.assign(t,{projectionCommand:d}),w&&(t.excludeTerminal=!0),t.dependencyBlocked=f;let x=be(r,n),me=await Q(f?void 0:m,t,n);we("list",me,x),n.profile&&p(`profile:command=list took_ms=${Date.now()-o}`)}function ke(e,i){let n=e.name,o=e.status,r=e.dependencyBlocked===!0,t=e.excludeTerminal===!0,a=i.status?.trim().toLowerCase(),d=e.name==="list"&&a!==void 0?ge[a]:void 0;return e.name==="list"&&(e.options.all===!0||a==="all"?(n="list-all",t=!1,i.status=void 0):a!==void 0&&d!==void 0&&(n=d.name,o=a,r=d.dependencyBlocked,t=!1,i.status=void 0)),(n==="list-open"||n==="list-in-progress")&&(i.lifecycleBucket=n==="list-open"?"open":"in_progress",o=void 0),{effectiveName:n,effectiveStatus:o,effectiveDependencyBlocked:r,effectiveExcludeTerminal:t}}function Se(e,i){let{name:n,description:o,status:r,excludeTerminal:t,allowStatusFilter:a,dependencyBlocked:d,aliasContract:m}=i,f=e.command(n,{hidden:m?.hidden===!0}).description(o);a&&f.option("--status <value>","Filter by status (repeatable or comma-separated; matches any; all selects every status)",s),n==="list"&&f.option("--all","Include every lifecycle status"),f.option("--for <intent>",`Apply a declared context intent projection. ${g("list","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--type <value>","Filter by item type (repeatable or comma-separated; matches any)",s).option("--tag <value>","Filter by tag (repeatable or comma-separated; matches any)",s).option("--priority <value>","Filter by priority (repeatable or comma-separated; matches any)",s).option("--deadline-before <value>","Filter by deadline upper bound (ISO/date string or relative)").option("--deadline-after <value>","Filter by deadline lower bound (ISO/date string or relative)").option("--today","Filter to items updated since local midnight today").option("--recent","Filter to items updated in the last 7 days").option("--updated-after <value>","Updated since ISO timestamp or signed relative (-2h/-7d for past); use last-window ISO").option("--updated-before <value>","Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-after <value>","Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-before <value>","Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--ids <value>","Filter by explicit item IDs (comma-separated or repeatable)").option("--assignee <value>","Filter by assignee",s).option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--parent <value>","Filter by parent item ID").option("--sprint <value>","Filter by sprint",s).option("--release <value>","Filter by release",s).option("--filter-ac-missing","Show only items missing acceptance_criteria").option("--filter-estimates-missing","Show only items missing estimated_minutes").option("--filter-resolution-missing","Show only terminal items missing resolution").option("--filter-metadata-missing","Show only items missing any tracked metadata (AC, estimate, or resolution)").option("--limit <n>","Alias for --output-limit; --output-budget may cap rows").option("--offset <n>","Skip the first n matching rows before limit is applied").option("--after <cursor>","Query next_cursor; output_cursor uses --output-cursor").option("--no-truncate","Disable default token cap; explicit --limit and --output-budget apply").option("--include-body","Include item body in each returned list row").option("--strict-read","Fail closed if any item document or item directory cannot be read").option("--compact","Render compact list projection fields (mutually exclusive with --brief/--full/--fields)").option("--brief","Brief rows: id, status, type, title and leading sort field (priority by default; excludes --compact/--full/--fields)").option("--full","Render full list projection fields (mutually exclusive with --compact/--brief/--fields)").option("--fields <value>",`Render custom comma-separated list fields (mutually exclusive with --compact/--brief/--full). ${g(n,"--fields")}`).option("--sort <value>","Sort field: priority|deadline|updated_at|created_at|title|parent (aliases: updated, created)").option("--order <value>","Sort order: asc|desc (requires --sort)").option("--tree","Render rows in parent/child tree order").option("--tree-depth <n>","Maximum recursion depth with --tree (0 keeps root rows only)").option("--format <value>","Output render mode: csv|table (human export) or json|ndjson|toon (machine output override)").option("--stream","Emit line-delimited JSON rows (requires --json)"),pe(f),f.action(async(w,x)=>{await xe({name:n,status:r,excludeTerminal:t,dependencyBlocked:d,options:w,actionCommand:x,aliasContract:m})}),l(f,"--tags <value>","Alias for --tag"),l(f,"--assignee_filter <value>","Alias for --assignee-filter"),l(f,"--tree_depth <n>","Alias for --tree-depth"),l(f,"--token_budget <n>","Alias for --token-budget"),l(f,"--filter-estimate-missing","Alias for --filter-estimates-missing")}async function _e(e,i){let n=y(i),o=Date.now(),r=await oe(M(e),n);h(r,n),n.profile&&p(`profile:command=aggregate took_ms=${Date.now()-o}`)}async function Ae(e,i){let n=y(i),o=Date.now(),r=H(A("context",e,n)),t=await Y(r,n),a=W(r,n);if(a==="markdown")n.quiet||v(`${X(t)}
4
4
  `);else if(a==="ndjson"){k(t);let d=_([...t.high_level,...t.low_level,...t.blocked_fallback]);!n.quiet&&d.length>0&&v(`${d}
@@ -8,4 +8,4 @@ import{a as ce}from"./chunk-F2Z6XLZB.js";import"./chunk-SLFRSZK6.js";import{b as
8
8
  `);return}for await(let r of le({...e,intervalMs:o}))n||v(`${O(r.events,{count:r.count,has_more:r.has_more,next_cursor:r.next_cursor??null,source:r.source,integrity:r.integrity,...r.verified_streams===void 0?{}:{verified_streams:r.verified_streams},heartbeat:r.count===0})}
9
9
  `)}function Re(e){return e.cursor_mode==="row"?_(e.events):O(e.events,{count:e.count,has_more:e.has_more,next_cursor:e.next_cursor??null,source:e.source,integrity:e.integrity,...e.verified_streams===void 0?{}:{verified_streams:e.verified_streams},...e.provenance_summary===void 0?{}:{provenance_summary:e.provenance_summary}})}async function qe(e,i){let n=y(i),o=Date.now(),r=Ee(e,n.path);if(e.follow===!0){await De(r,e,n.quiet===!0);return}let t=await se(r);if(k(t),n.json){h(t,n),n.profile&&p(`profile:command=events took_ms=${Date.now()-o}`);return}let a=Re(t);!n.quiet&&a.length>0&&v(`${a}
10
10
  `),n.profile&&p(`profile:command=events took_ms=${Date.now()-o}`)}async function Ge(e,i,n,o,r){let t=y(r),a=Date.now(),d=await V(e,i,n,{...Array.isArray(o.kind)?{kind:o.kind}:{},maxDepth:typeof o.maxDepth=="string"?o.maxDepth:void 0,limit:typeof o.limit=="string"?o.limit:void 0,after:typeof o.after=="string"?o.after:void 0,direction:typeof o.direction=="string"?o.direction:void 0,maxPaths:typeof o.maxPaths=="string"?o.maxPaths:void 0,sample:typeof o.sample=="string"?o.sample:void 0,...Array.isArray(o.exemptIsolate)?{exemptIsolate:o.exemptIsolate}:{},...Array.isArray(o.exemptIsolateType)?{exemptIsolateType:o.exemptIsolateType}:{},saveBaseline:o.saveBaseline===!0,rebuild:o.rebuild===!0,clear:o.clear===!0,summary:o.summary===!0,full:o.full===!0},t);h(d,t),t.profile&&p(`profile:command=graph took_ms=${Date.now()-a}`)}function Ot(e,i){let n=i?.commandFilter,o=t=>ye(t,n),r=[{name:"list",description:"List active items with optional lifecycle-status and project filters.",excludeTerminal:!0,allowStatusFilter:!0},{name:"list-all",description:"List all items with optional filters.",excludeTerminal:!1,allowStatusFilter:!0},{name:"list-draft",description:"List draft items with optional filters.",status:"draft"},{name:"list-open",description:"List open items with optional filters.",status:"open",excludeTerminal:!1,allowStatusFilter:!1},{name:"list-in-progress",description:"List in-progress items with optional filters.",status:"in_progress",excludeTerminal:!1,allowStatusFilter:!1},{name:"list-blocked",description:"List blocked items (blocked status or open blocked_by dependencies, matching pm next) with optional filters.",dependencyBlocked:!0,excludeTerminal:!1,allowStatusFilter:!1},{name:"list-closed",description:"List closed items with optional filters.",status:"closed"},{name:"list-canceled",description:"List canceled items with optional filters.",status:"canceled"}];for(let t of r)if(o(t.name)){let a=C(t.name);Se(e,{...t,...a?.registration==="commander"?{aliasContract:a}:{}})}if(o("aggregate")){let t=e.command("aggregate").description("Group item counts and numeric measures.").option("--set-mode <value>","Set grouping: element (default)|tuple").option("--limit <value>","Group page size (default: 50)").option("--after <value>","Continue with next_after cursor").option("--group-by <value>","Fields: parent,type,priority,status,assignee,tags,sprint,release (comma-separated)").option("--count","Counts (default)").option("--completion","Status counts and completion_pct").option("--sum <field>","Group numeric sum").option("--avg <field>","Group numeric average").option("--include-unparented","Keep unparented group").option("--status <value>","Item status").option("--type <value>","Item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--deadline-before <value>","Latest deadline (ISO/date or relative)").option("--deadline-after <value>","Earliest deadline (ISO/date or relative)").option("--assignee <value>","Filter by assignee").option("--assignee-filter <value>","Assignee presence: assigned|unassigned").option("--parent <value>","Parent ID").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release");l(t,"--include_unparented","Alias for --include-unparented"),l(t,"--assignee_filter <value>","Alias for --assignee-filter"),t.action(_e)}if(o("context")){let t=e.command("context").alias("ctx").description("Show a token-efficient project context snapshot for next-work decisions.").option("--for <intent>",`Apply a declared context intent projection. ${g("context","--for")}`).option("--date <value>","Anchor date/time for agenda window calculations (ISO/date string or relative)").option("--from <value>","Agenda lower bound (ISO/date string or relative)").option("--to <value>","Agenda upper bound (ISO/date string or relative)").option("--past","Include past agenda entries in bounded windows").option("--type <value>","Filter by item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--assignee <value>","Filter by assignee").option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release").option("--parent <id>","Scope the snapshot to one item's subtree (the item plus all descendants)").option("--limit <n>","Limit focus and agenda rows per section").option("--after <cursor>","Query next_cursor; output_cursor uses --output-cursor").option("--format <value>","Context output format override: markdown|toon|json|ndjson").option("--depth <value>","Context depth: brief|standard|deep|full (full = every section, no per-section cap)").option("--section <value...>","Include specific sections (repeatable; overrides --depth)").option("--fields <value>","Project focus rows to a comma-separated field subset (e.g. id,title,priority)").option("--activity-limit <n>","Limit recent activity entries (default: settings or 10)").option("--stale-threshold <value>","Staleness cutoff in days (e.g. 7 or 7d; default: settings or 7)").option("--explain-ranking","Include the scorer model, per-signal contributions, and ranked candidate ids").option("--token-budget <n>","Complete JSON/TOON response token ceiling").option("--no-extension-health","Omit the installed extension health summary").option("--no-tags","Omit tag arrays from context focus rows");l(t,"--assignee_filter <value>","Alias for --assignee-filter"),l(t,"--max-items <n>","Alias for --limit"),l(t,"--explain_ranking","Alias for --explain-ranking"),l(t,"--token_budget <n>","Alias for --token-budget"),t.action(Ae)}if(o("next")){let t=e.command("next").description("Recommend the next actionable (unblocked, ready) work item with rationale + blocked companion.").option("--for <intent>",`Apply a declared context intent projection. ${g("next","--for")}`).option("--type <value>","Filter candidate items by type").option("--tag <value>","Filter candidate items by tag").option("--priority <value>","Filter candidate items by priority").option("--assignee <value>","Filter candidate items by assignee").option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--sprint <value>","Filter candidate items by sprint").option("--release <value>","Filter candidate items by release").option("--parent <id>","Scope to one item's subtree (the item plus all descendants)").option("--limit <n>","Limit ready rows (default: 5; non-positive falls back to default)").option("--blocked-limit <n>","Limit blocked rows (default: same as --limit)").option("--ready-only","Omit the blocked companion list").option("--include-decisions","Include human-gated Decision items in the claimable ready queue").option("--include-gates","Include outcome gates in the ready queue").option("--include-containers","Include containers with unfinished descendants in the ready queue").option("--format <value>","Next output format override: markdown|toon|json").option("--explain-ranking","Include the scorer model, per-signal contributions, and ranked ready ids").option("--token-budget <n>","Maximum estimated tokens spent on the ranked ready queue");l(t,"--assignee_filter <value>","Alias for --assignee-filter"),l(t,"--blocked_limit <n>","Alias for --blocked-limit"),l(t,"--ready_only","Alias for --ready-only"),l(t,"--explain_ranking","Alias for --explain-ranking"),l(t,"--token_budget <n>","Alias for --token-budget"),t.action(Fe)}if(o("search")){let t=e.command("search").argument("<keywords...>","Keyword query tokens").description("Search items with keyword, semantic, or hybrid retrieval. Inline field:value tokens (tag:/status:/type:/priority:) in the query are parsed as filters, e.g. 'auth tag:area:search status:open'.").option("--for <intent>",`Apply a declared context intent projection. ${g("search","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--mode <value>","Search mode: keyword|semantic|hybrid (default: auto)").option("--semantic","Shorthand for --mode semantic").option("--hybrid","Shorthand for --mode hybrid").option("--match-mode <value>","Token match mode: and|or|exact (default: or with all-terms ranking bonus; and = hard-require every token; exact = exact phrase)").option("--min-score <value>","Per-query minimum score threshold (finite number >= 0); overrides settings search.score_threshold for this query only").option("--count","Return only the count of matching items (post-filter/threshold, pre-limit); skips hit rows").option("--semantic-weight <value>","Override hybrid semantic weight for this query (0..1); invalid values fall back to settings").option("--include-linked","Include linked files, docs, and tests in the searchable corpus").option("--title-exact","Require exact normalized title match for the full query string").option("--phrase-exact","Require exact normalized phrase match in searchable text").option("--highlight","Emit per-field matched-text snippets (wrapped in \xAB\u2026\xBB) on each hit; off by default").option("--status <value>","Filter by status before query (all, open/closed/canceled aliases, or configured status id; CSV)").option("--type <value>","Filter by item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--deadline-before <value>","Filter by deadline upper bound (ISO/date string or relative)").option("--deadline-after <value>","Filter by deadline lower bound (ISO/date string or relative)").option("--updated-after <value>",'Filter by updated_at lower bound: ISO timestamp or signed relative (e.g. "-2h"/"-7d" for the past)').option("--updated-before <value>","Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-after <value>","Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-before <value>","Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--assignee <value>","Filter by assignee").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release").option("--parent <value>","Filter by parent item ID").option("--compact","Render compact search hits (default; mutually exclusive with --full/--fields)").option("--full","Render full search hits with nested item payloads (mutually exclusive with --compact/--fields)").option("--fields <value>",`Render custom comma-separated search hit fields (mutually exclusive with --compact/--full). ${g("search","--fields")}`).option("--format <value>","Search output format override: json|ndjson|toon").option("--limit <n>","Limit returned item count").option("--after <cursor>","Query next_cursor; output_cursor uses --output-cursor");pe(t),t.action(Ie),l(t,"--tags <value>","Alias for --tag"),l(t,"--token_budget <n>","Alias for --token-budget")}if(o("eval")&&e.command("eval").description("Evaluate search relevance against a curated golden-query set: reports nDCG@k, MRR@k, precision@k, and recall@k per query plus the macro average. Use --fail-under as a CI gate.").option("--mode <value>","Default retrieval mode for queries without their own: keyword|semantic|hybrid (default: keyword)").option("--k <n>","Metric cutoff @k (positive integer; default: 10)").option("--fail-under <value>","Exit non-zero when aggregate nDCG@k falls below this threshold (0..1); CI gate").option("--queries <path>",`Query JSON (${re}); default: search/eval-queries.json; errors show an example`).option("--format <value>","Eval output format override: json|toon").action(Oe),o("get")){let t=e.command("get").argument("<id>","Item id").option("--for <intent>",`Apply a declared context intent projection. ${g("get","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--depth <value>","brief|standard|deep|full (default: standard)").option("--full","Full details and children for any type; excludes --depth/--fields").option("--fields <value>",`Render custom comma-separated item metadata fields. ${g("get","--fields")}`).option("--tree","Include descendants rooted at the requested item").option("--tree-depth <n>","Maximum subtree depth for --tree descendants").option("--at <version-or-timestamp>","Reconstruct a verified historical item state without mutating it").option("--format <value>","Get output format override: json|toon").description("Show item details by ID.").action(je);l(t,"--tree_depth <n>","Alias for --tree-depth"),l(t,"--token_budget <n>","Alias for --token-budget")}if(o("history")){let t=e.command("history").enablePositionalOptions().argument("<id>","Item id").option("--limit <n>","Latest N; keeps order").option("--order <value>","oldest_first|newest_first").option("--compact","Summary (default newest_first)").option("--full","Patches (default oldest_first)").option("--provenance","Authors (default newest_first)").option("--provenance-summary","Count provenance completeness").option("--harness <value>","Harness (repeatable)",s).option("--agent-instance <value>","Instance (repeatable)",s).option("--provenance-filter <dimension=value>","Provenance (repeatable)",s).option("--diff","Before/after field diffs").option("--field <name>","Filter changed field; implies --diff").option("--verify","Verify full chain and replay").option("--strict-exit","With --verify, fail on integrity errors").option("--fail-on-warn","Alias for --strict-exit").option("--format <value>","Output: json|toon").description("Read history.").action(Ce);ce(t,!0),j(t.command("activity"))}o("events")&&e.command("events").option("--since <cursor-or-timestamp>","Resume strictly after a durable cursor, or include events from an ISO timestamp").option("--type <value>","Filter by mutation operation (repeatable or comma-separated)",s).option("--author <value>","Filter by mutation author (repeatable or comma-separated)",s).option("--item <value>","Filter by item or workspace stream id (repeatable or comma-separated)",s).option("--limit <n>","Return at most 1,000 events (default: 100)").option("--cursor-mode <mode>","Cursors: batch trailer (default) or per-row").option("--full","Include each complete authoritative history entry").option("--verify","Verify selected authoritative history chains").option("--provenance","Include patch-free author, harness, instance, and extensible provenance").option("--provenance-summary","Include bounded provenance completeness counts").option("--harness <value>","Filter by recorded or vocabulary-resolved harness (repeatable)",s).option("--agent-instance <value>","Filter by privacy-safe agent instance (repeatable)",s).option("--provenance-filter <dimension=value>","Filter by an exact declared provenance value (repeatable)",s).option("--follow","Follow committed events as NDJSON").option("--interval-ms <n>","Empty-read delay while following (minimum: 10ms; default: 250ms)").description("Read mutation events as NDJSON with resumable cursors.").action(qe),o("activity")&&j(e.command("activity",{hidden:!0})),o("graph")&&e.command("graph").argument("<subcommand>","Graph query (ancestors, descendants, predecessors, successors, paths, impact, analyze, audit, communities, redundancy, dominators, slack, centrality, articulation, plan, index)").argument("[id]","Root item id (traversals, paths, impact, and dominators)").argument("[target]","Target item id (paths only)").option("--kind <value>","Restrict traversal to registered relationship kinds (repeatable or comma-separated)",s).option("--max-depth <value>","Maximum traversal depth (non-negative integer)").option("--limit <value>","Maximum returned rows per bounded collection").option("--after <value>","Resume a traversal after this previously returned node id").option("--direction <value>","Edge orientation for paths/impact (outgoing, incoming, or both)").option("--max-paths <value>","Maximum enumerated paths (paths only)").option("--sample <value>","Maximum evidence sample entries per audit finding (audit only)").option("--exempt-isolate <value>","Item ids treated as explicitly valid isolates by the audit (repeatable or comma-separated)",s).option("--exempt-isolate-type <value>","Item types whose active isolates are policy-valid for the audit (repeatable or comma-separated)",s).option("--save-baseline","Persist the audit census as the change-since-baseline comparison point (audit only)").option("--rebuild","Rebuild and warm the durable graph index (index only)").option("--clear","Delete the durable graph index (index only)").option("--summary","Return counts-first envelopes without row collections").option("--full","Return the complete graph row projection").description("Bounded workspace relationship-graph queries, analytics, and governance audit.").action(Ge)}var jt={resolveReadCommandOutputFormat:S,parseListFormat:ue};export{jt as _testOnlyRegisterListQuery,Ot as registerListQueryCommands};
11
- //# sourceMappingURL=register-list-query-L4IBU64P.js.map
11
+ //# sourceMappingURL=register-list-query-3GV3LBOT.js.map
@@ -0,0 +1,21 @@
1
+ import{a as It}from"./chunk-LOX3VY4T.js";import{a as Tt}from"./chunk-GBVF2ZB3.js";import{b as Et}from"./chunk-HZZLSBIJ.js";import"./chunk-SLFRSZK6.js";import{a as Dt,b as Pt}from"./chunk-SCIPT7WF.js";import{c as le,g as Ct,l as Rt,m as Ot,n as Ft,o as Mt}from"./chunk-YIGBEY7K.js";import{$ as so,A as At,C as kt,D as xt,E as _t,V as to,W as oo,X as io,Y as no,Z as ao,_ as ro,aa as lo,ba as uo,ca as ae,da as re,ea as se,s as dt,t as ht,u as yt,v as gt,w as oe,x as ie,y as ne,z as bt}from"./chunk-BVJMVU4Z.js";import{Oa as lt,Sc as wt,ib as ct,kd as St,m as Re,n as Oe,qb as pt,sb as mt,tb as ft,ub as vt,vc as te}from"./chunk-OS5W4ZG2.js";import"./chunk-MGJMQSN4.js";import"./chunk-L6VS7F3R.js";import"./chunk-ZLICQPRG.js";import{$ as nt,A as Te,B as Ie,C as De,D as Pe,E as Ne,G as $e,H as Le,I as He,J as Ue,K as Be,L as Ge,M as je,N as qe,O as Ve,P as ze,Q as Je,R as Ke,S as We,T as Xe,U as Ye,V as Ze,W as Qe,X as et,Y as tt,Z as ot,_ as it,aa as at,ba as rt,ca as st,x as B}from"./chunk-VA4T37Q4.js";import{o as Q}from"./chunk-CZEMEPPQ.js";import"./chunk-KHFUHGL3.js";import"./chunk-AA52P34H.js";import"./chunk-LPW7S5KA.js";import{aa as ut,hb as ee}from"./chunk-ZBOQEZ2H.js";import"./chunk-6H36ZHMI.js";import"./chunk-WQOEVGLQ.js";import{$ as Me,Ka as w,j as X,la as D,m as Fe,pa as v,sa as d,ta as s,ua as b,va as P,wa as U,xa as Y,ya as Z,za as Ee}from"./chunk-7EPYCU7U.js";import"./chunk-DF6A7C32.js";import"./chunk-CONBVY2O.js";import"./chunk-PZA7QECY.js";import{A as C,R as F,a as be,ca as J,ha as K,nd as W,sa as x,t as V,u as Se,uc as Ce}from"./chunk-FVY7U3SU.js";import{v as I}from"./chunk-C4KIZQHW.js";import{Af as y,a as we,ba as R,nc as z,t as q,uf as g,va as xe,zf as f}from"./chunk-CNUFU454.js";import"./chunk-K34FR5CO.js";import"./chunk-4FZH5BTV.js";import{x as O}from"./chunk-XHCIOLJP.js";import{Q as _e,a as Ae,y as ke}from"./chunk-SX76UGEY.js";import{A as c,C as m}from"./chunk-6OIHST4I.js";import{a as ge}from"./chunk-XAWE4EAK.js";function Nt(t,e,o){return yt(t,x(e),o)}function $t(t,e){return wt(x(t),e)}var N={};ge(N,{PROFILE_SUBCOMMANDS:()=>to,formatProfileApplyHuman:()=>uo,formatProfileLintHuman:()=>lo,formatProfileListHuman:()=>ro,formatProfileShowHuman:()=>so,runProfileApply:()=>ao,runProfileLint:()=>no,runProfileList:()=>oo,runProfileShow:()=>io});function Lt(t,e){let o=x(t.update);return xt({...t,update:o},e)}async function de(t){typeof t.description=="string"&&t.description.trim()==="-"&&(t.description=await C().resolveValue(t.description,"--description")??"")}import{readFile as co}from"node:fs/promises";import po from"node:path";async function mo(t,e,o,n){let i=v(n),r=o.expectedResult??o.expected,a=await bt(t,e,{status:typeof o.status=="string"?o.status:void 0,expectedResult:typeof r=="string"?r:void 0,author:typeof o.author=="string"?o.author:i.author,message:typeof o.message=="string"?o.message:void 0,force:o.force===!0},i);await w(i,a),f(a,i)}async function fo(t,e){let o=typeof t.from=="string"?t.from.trim():"";if(o.length>0&&o!=="-"){if(e.getOptionValueSource("stdinJson")==="cli")throw new m("pm item mutate cannot combine --from <path> with explicit --stdin-json. Select one input source.",c.USAGE);try{return await co(po.resolve(process.cwd(),o),"utf8")}catch(i){throw new m(`pm item mutate could not read --from ${o}: ${Ce(i)}`,c.USAGE,{code:"mutation_document_unreadable",required:"Pass a readable JSON, JSON Lines, or envelope document path, or `-` for stdin.",why:"The whole document must be available before any tracker write begins."})}}return await C().resolveValue("-","--stdin-json")??""}async function vo(t,e){let o=v(e),n=await fo(t,e);if(n.trim().length===0)throw new m("pm item mutate requires a non-empty JSON batch on stdin or via --from <path>.",c.USAGE);if(t.transactionId!==void 0&&(typeof t.transactionId!="string"||t.transactionId.trim().length===0))throw new m("pm item mutate requires --transaction-id <value> to be non-empty when provided.",c.USAGE);let i=R(process.cwd(),o.path),r=await I(i),a=await Pt({pmRoot:i,input:n,settings:r,...typeof t.transactionId=="string"?{transactionId:t.transactionId}:{},...typeof t.upsertKey=="string"?{upsertKey:t.upsertKey}:{}}),{mutations:l,references:u,rows:p}=a,h=a.transaction_id,S={transaction_id:h,transaction_id_source:a.transaction_id_source,...a.upsert_key===void 0?{}:{upsert_key:a.upsert_key}},A=le(t),M=z(typeof t.author=="string"?t.author:o.author,r.author_default);if(t.dryRun===!0){let T=await Dt({pmRoot:i,author:M,plan:a});f({...S,dry_run:!0,validation:T.validation,mutation_count:l.length,mutations:l,references:u,rows:T.rows},o);return}let E=await Ot({pmRoot:i,transactionId:h,author:M,mutations:l,...A});f({...E,...S,mutation_count:l.length,references:u,rows:p},o)}function ho(t,e){return typeof t=="string"&&t.trim().length>0?t.trim():typeof e=="string"?e.trim():""}async function yo(t,e,o,n){let i=v(n),r=typeof o.transactionId=="string"?o.transactionId.trim():"";if(r.length===0)throw new m("pm item complete requires --transaction-id <value>.",c.USAGE);let a=ho(e,o.reason);if(a.length===0)throw new m("pm item complete requires a close reason.",c.USAGE);let u=Object.fromEntries(["file","doc","test","comment","note","learning"].filter(k=>o[k]!==void 0).map(k=>[k,o[k]])),p=o.force===!0,{lockTtlSeconds:h,lockWaitMs:S}=le(o),A={...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}:{},...p?{force:!0}:{}},M={id:t,reason:a,...Object.keys(u).length===0?{}:{evidence:u},...Object.keys(A).length===0?{}:{closeOptions:A},...p?{releaseOptions:{force:!0}}:{}},E=R(process.cwd(),i.path),T=z(typeof o.author=="string"?o.author:i.author,(await I(E)).author_default);if(o.dryRun===!0){let k=Ft(M),eo=await Rt({pmRoot:E,transactionId:r,author:T,mutations:k});f({transaction_id:r,dry_run:!0,validation:eo,mutation_count:k.length,mutations:k},i);return}let ye=await Mt({pmRoot:E,transactionId:r,author:T,...M,lockTtlSeconds:h,lockWaitMs:S});f({...ye,mutation_count:Object.keys(ye.results).length},i)}function Ht(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("--expected-result <value>","Current active planning expectation; otherwise the receipt offers recovery").option("--expected <value>","Alias for --expected-result").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(mo),e.command("mutate").option("--transaction-id <value>","Stable idempotency key used to resume an interrupted batch; derived from the document when omitted").option("--stdin-json","Read the JSON mutation array from stdin",!0).option("--from <path>","Read the JSON, JSON Lines, or envelope document from a file (- for stdin)").option("--upsert-key <field>","Update the existing item whose field matches instead of creating a duplicate").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(vo),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(yo)}async function go(t,e){let o=v(e),n=Array.isArray(t.event)?t.event:[],i=await lt(R(process.cwd(),o.path),{historyEvent:n,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")});f(i,o)}function Ut(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(go)}function Bt(t){let e=x(t.options);return kt({...t,options:e})}function ue(t,e,o,n){if(e.trim().toLowerCase()!=="add"||!o?.trim())return;let i=s(n,"add")??s(n,"text")??s(n,"note")??s(n,"body")??s(n,"comment"),r=s(n,"file"),a=[t,o.trim()];i!==void 0?a.push("--add",i):n.stdin===!0?a.push("--stdin"):r!==void 0?a.push("--file",r):a.push("--add","-");let l=O(a),u=O([t,o.trim(),"--add","-"]);throw new m(`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}})}var Gt={comments:["add","text","body","comment"],notes:["add","text","note"],learnings:["add","text"]};function wo(t,e,o,n,i){let r=Gt[t].some(l=>`--${l}`!==e&&s(i,l)!==void 0),a=i.delete!==void 0||i.edit!==void 0&&i.ifAbsent===!0;if(!(r||a||i.stdin===!0||s(i,"file")!==void 0||s(i,"addJson")!==void 0)){if(o==="--file")return n===void 0?void 0:["--file",n];if(o==="--stdin"||o.startsWith("--file="))return n===void 0?[o]:void 0}}function ce(t,e,o,n){let i=Gt[t].map(l=>({flag:`--${l}`,value:s(n,l)?.trim()})).find(l=>l.value!==void 0&&Re(l.value));if(i===void 0)return;let r=[t,e,...typeof n.edit=="number"?["--edit",String(n.edit)]:[]],a=wo(t,i.flag,i.value,o,n);throw Oe({collectionKey:t,textFlag:i.flag,value:i.value,commandPrefix:O(r),...a===void 0?{}:{retryArgs:[...r,...a]},...a===void 0&&o!==void 0&&i.value!=="--file"?{conflictingOperand:o}:{}})}function jt(t,e,o){let n=o.flatMap(r=>{let a=s(e,r);return a===void 0?[]:[{alias:r,value:a}]});if([...new Set(n.map(({value:r})=>r))].length>1)throw new m(`Specify ${t} text with one alias or the same value across aliases: ${n.map(({alias:r})=>`--${r}`).join(", ")}`,c.USAGE,{code:"annotation_alias_conflict"});return n[0]?.value}function bo(t,e){let o=typeof e.edit=="number"?e.edit:void 0,n=typeof e.delete=="number"?e.delete:void 0,i=jt("comment",e,["add","text","body","comment"]),r=typeof t=="string"?t:void 0,a=e.stdin===!0,l=s(e,"file");if(+(i!==void 0)+ +(r!==void 0)+Number(a)+ +(l!==void 0)>1)throw i!==void 0&&r!==void 0&&!a&&l===void 0?new m("Specify comment text either as positional [text] or with --add, not both",c.USAGE):new m("Specify comment text with exactly one source: positional [text], --add, --stdin, or --file",c.USAGE);let p=i??r;return{add:p,readFromStdin:a,readFromFile:l,editIndex:o,deleteIndex:n,isMutation:typeof p=="string"||a||l!==void 0||o!==void 0||n!==void 0}}function qt(t,e,o){let n=jt(t,o,t==="note"?["add","text","note"]:["add","text"]),i=typeof e=="string"?e:void 0;if(n!==void 0&&i!==void 0)throw new m(`Specify ${t} text either as positional [text] or with --add, not both`,c.USAGE);let r=n??i,a=t==="note"?s(o,"addJson"):void 0,l=o.stdin===!0,u=s(o,"file"),p=typeof o.edit=="number"?o.edit:void 0,h=typeof o.delete=="number"?o.delete:void 0;return{add:r,addJson:a,readFromStdin:l,readFromFile:u,editIndex:p,deleteIndex:h,isMutation:typeof r=="string"||a!==void 0||l||u!==void 0||p!==void 0||h!==void 0}}function pe(t){return{fullHistory:t.fullHistory===!0,ifAbsent:t.ifAbsent===!0,expectAt:s(t,"expectAt"),author:s(t,"author"),message:s(t,"message"),ownershipAppendBypass:t.ownershipAppendBypass===!0,force:!!t.force}}async function So(t,e,o,n){let i=v(n),r=Date.now();ue("comments",t,e,o),ce("comments",t,e,o);let a=bo(e,o),l=await dt(t,{add:a.add,stdin:a.readFromStdin,file:a.readFromFile,edit:a.editIndex,delete:a.deleteIndex,limit:s(o,"limit"),...pe(o)},i);a.isMutation&&l.changed!==!1&&await w(i,l),me("comments",l,i,r)}async function Ao(t,e,o,n){let i=v(n),r=Date.now();ue("notes",t,e,o),ce("notes",t,e,o);let a=qt("note",e,o),l=await _t(t,{add:a.add,addJson:a.addJson,stdin:a.readFromStdin,file:a.readFromFile,edit:a.editIndex,delete:a.deleteIndex,limit:s(o,"limit"),since:s(o,"since"),eventType:s(o,"eventType"),includeMeta:o.includeMeta===!0,...pe(o)},i);a.isMutation&&l.changed!==!1&&await w(i,l),me("notes",l,i,r)}async function ko(t,e,o,n){let i=v(n),r=Date.now();ue("learnings",t,e,o),ce("learnings",t,e,o);let a=qt("learning",e,o),l=await ht(t,{add:a.add,stdin:a.readFromStdin,file:a.readFromFile,edit:a.editIndex,delete:a.deleteIndex,limit:s(o,"limit"),...pe(o)},i);a.isMutation&&l.changed!==!1&&await w(i,l),me("learnings",l,i,r)}function me(t,e,o,n){f(e,o),o.profile&&y(`profile:command=${t} took_ms=${Date.now()-n}`)}function Vt(t,e){let o=t.command("comments").argument("<id>","Item id").argument("[text]","Optional comment text shorthand (equivalent to --add)").option("--add <text>","Append comment text; use text=<value> for structured input or - for stdin").option("--stdin","Read comment text from stdin (supports multiline markdown)").option("--file <path>","Read comment text from a file or stdin (-)").option("--edit <index>","Replace one comment using positional text, --add, --stdin, or --file",e("--edit")).option("--delete <index>","Delete the comment at 1-based <index>",e("--delete")).option("--expect-at <ts>","Edit/delete only if the entry's created_at is <ts>").option("--limit <n>","Return only latest n comments").option("--full-history","Return complete comment history instead of a bounded mutation receipt").option("--if-absent","Append only when resolved author and text are absent").option("--author [value]","Comment author; defaults to PM_AUTHOR or settings").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete comments for an item.").action(So);b(o,"--body <text>","Alias for --add",!1),b(o,"--text <text>","Alias for --add",!1),b(o,"--comment <text>","Alias for --add",!1);let n=t.command("notes").argument("<id>","Item id").argument("[text]","Optional note text shorthand for --add").option("--add <text>","Add a text note (- reads stdin)").option("--note <text>","Alias for --add").option("--add-json <json>","Append a JSON event").option("--stdin","Read note text from stdin").option("--file <path>","Read note from file or stdin (-)").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("--expect-at <ts>","Edit/delete only if the entry's created_at is <ts>").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 complete note history instead of a bounded receipt").option("--if-absent","Append only when resolved author and text are absent").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(Ao);b(n,"--text <text>","Alias for --add",!1);let i=t.command("learnings").argument("<id>","Item id").argument("[text]","Optional learning text shorthand for --add").option("--add <text>","Append learning text; use text=<value> or - for stdin").option("--stdin","Read learning text from stdin").option("--file <path>","Read learning text from a file or stdin (-)").option("--edit <index>","Replace one learning using positional text, --add, --stdin, or --file",e("--edit")).option("--delete <index>","Delete the learning at 1-based <index>",e("--delete")).option("--expect-at <ts>","Edit/delete only if the entry's created_at is <ts>").option("--limit <n>","Return only latest n learnings").option("--full-history","Return complete learning history instead of a bounded receipt").option("--if-absent","Append only when resolved author and text are absent").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(ko);b(i,"--text <text>","Alias for --add",!1)}function fe(t,e){return o=>{let n=Number(o);if(!Number.isInteger(n)||n<e)throw new m(`${t} must be an integer greater than or equal to ${e}.`,c.USAGE);return n}}async function xo(t,e,o){let n=v(o);if(e.scope!==void 0&&e.scope!=="project"&&e.scope!=="global")throw new m("--scope must be either project or global.",c.USAGE);let i=await ft({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"?pt(e.lines):void 0,decisionDepth:typeof e.decisionDepth=="number"?e.decisionDepth:void 0},n);f(i,n)}function zt(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",fe("--limit",1)).option("--offset <n>","Number of referencing items to skip",fe("--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",fe("--decision-depth",1)).description("Find and explain pm items that govern requested source paths.").action(xo)}var _o=["add-","apply-","list-","remove-","show-"],Co=new Set(["field","fields","help","status","statuses","type","types"]);function ve(t){let e=t.trim(),o=e.toLowerCase();return o.length===0?!1:e[0]===o[0]||Co.has(o)||_o.some(n=>o.startsWith(n))}function G(t){if(t!=null){if(typeof t=="number"){if(!Number.isInteger(t))throw new m("--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 m("--order must be a finite integer.",c.USAGE);return e}throw new m("--order must be a finite integer.",c.USAGE)}}function $(t){if(Array.isArray(t))return t;if(typeof t=="string")return[t]}var L={};ge(L,{SCHEMA_SUBCOMMANDS:()=>De,_testOnlySchemaCommand:()=>st,formatSchemaAddFieldHuman:()=>tt,formatSchemaAddStatusHuman:()=>Xe,formatSchemaAddTypeHuman:()=>Ke,formatSchemaApplyPresetHuman:()=>at,formatSchemaEvolutionMigrationHuman:()=>Ie,formatSchemaInferTypesHuman:()=>rt,formatSchemaListFieldsHuman:()=>it,formatSchemaListHuman:()=>Ze,formatSchemaRemoveFieldHuman:()=>ot,formatSchemaRemoveStatusHuman:()=>Ye,formatSchemaRemoveTypeHuman:()=>We,formatSchemaShowFieldHuman:()=>nt,formatSchemaShowHuman:()=>Qe,formatSchemaShowStatusHuman:()=>et,runSchemaAddField:()=>Ge,runSchemaAddStatus:()=>$e,runSchemaAddType:()=>Pe,runSchemaApplyPreset:()=>ze,runSchemaEvolutionMigration:()=>Te,runSchemaInferTypes:()=>Je,runSchemaList:()=>He,runSchemaListFields:()=>qe,runSchemaRemoveField:()=>je,runSchemaRemoveStatus:()=>Le,runSchemaRemoveType:()=>Ne,runSchemaShow:()=>Ue,runSchemaShowField:()=>Ve,runSchemaShowStatus:()=>Be,runWorkflowPolicyAction:()=>B});function Ro(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 Oo(t,e){let{normalizedSubcommand:o,typeName:n,globalOptions:i,author:r,force:a}=e;switch(o){case"list":return t.runSchemaList(i);case"show":return t.runSchemaShow(n,i);case"show-status":return t.runSchemaShowStatus(n,i);case"list-fields":return t.runSchemaListFields(i);case"show-field":return t.runSchemaShowField(n,i);case"remove-type":return t.runSchemaRemoveType(n,{author:r,force:a},i);case"remove-field":return t.runSchemaRemoveField(n,{author:r,force:a},i);case"remove-status":return t.runSchemaRemoveStatus(n,{author:r,force:a},i);case"apply-preset":return t.runSchemaApplyPreset(n,{author:r,force:a},i);default:return null}}async function Fo(t,e){let{normalizedSubcommand:o,typeName:n,options:i,globalOptions:r}=e,{author:a,force:l,description:u}=e,p=Ro(t,e);if(p)return p;let h=Oo(t,e);if(h)return h;switch(o){case"add-field":return t.runSchemaAddField(n,{type:typeof i.type=="string"?i.type:void 0,commands:e.commands,description:u,cliFlag:typeof i.cliFlag=="string"?i.cliFlag:void 0,alias:e.aliases,required:!!i.required,requiredOnCreate:!!i.requiredOnCreate,allowUnset:i.allowUnset!==!1,requiredTypes:e.requiredTypes,author:a,force:l},r);case"add-status":return t.runSchemaAddStatus(n,{role:e.roles,alias:e.aliases,description:u,order:e.order,author:a,force:l},r);default:return i.infer===!0?t.runSchemaInferTypes({minCount:e.minCount,apply:!!i.apply,author:a,force:l},r):t.runSchemaAddType(n,{description:u,defaultStatus:e.defaultStatus,folder:typeof i.folder=="string"?i.folder:void 0,alias:e.aliases,author:a,force:l},r)}}function Mo(t,e){if("migration_id"in e){g(`${t.formatSchemaEvolutionMigrationHuman(e)}
2
+ `);return}switch(e.action){case"list":g(`${t.formatSchemaListHuman(e)}
3
+ `);return;case"show":g(`${t.formatSchemaShowHuman(e)}
4
+ `);return;case"show-status":g(`${t.formatSchemaShowStatusHuman(e)}
5
+ `);return;case"list-fields":g(`${t.formatSchemaListFieldsHuman(e)}
6
+ `);return;case"show-field":g(`${t.formatSchemaShowFieldHuman(e)}
7
+ `);return;case"remove-type":g(`${t.formatSchemaRemoveTypeHuman(e)}
8
+ `);break;case"remove-field":g(`${t.formatSchemaRemoveFieldHuman(e)}
9
+ `);break;case"apply-preset":g(`${t.formatSchemaApplyPresetHuman(e)}
10
+ `);break;case"infer-types":g(`${t.formatSchemaInferTypesHuman(e)}
11
+ `);break;case"add-field":g(`${t.formatSchemaAddFieldHuman(e)}
12
+ `);break;case"add-status":g(`${t.formatSchemaAddStatusHuman(e)}
13
+ `);break;case"remove-status":g(`${t.formatSchemaRemoveStatusHuman(e)}
14
+ `);break;default:g(`${t.formatSchemaAddTypeHuman(e)}
15
+ `);break}e.warnings.length>0&&y(`schema ${e.action} warnings: ${U(e.warnings)}`)}function Jt(t){if(Array.isArray(t))return t.flatMap(e=>e.split(",")).map(e=>e.trim()).filter(e=>e.length>0)}async function Eo(t,e,o,n){let i=v(n),r=Date.now(),{SCHEMA_SUBCOMMANDS:a}=L,l=(t??"").trim().toLowerCase(),u=e;if(To(l,a),!a.includes(l)&&u===void 0&&!ve(t)&&(u=t,l="add-type"),!a.includes(l))throw F({command_path:"schema",token:l,allowed:a});let p=we.find(h=>h===l);if(be(l,o.dryRun===!0),p)f(await B(p,e,{definition:o.definition,policy:s(o,"policy"),message:s(o,"message"),author:s(o,"author"),dryRun:o.dryRun===!0},i),i);else{let h=await Fo(L,{normalizedSubcommand:l,typeName:u,options:o,aliases:$(o.alias),roles:$(o.role),commands:Jt(o.commands),requiredTypes:Jt(o.requiredTypes),defaultStatus:s(o,"defaultStatus")??s(o,"default_status"),order:G(o.order),minCount:G(o.minCount),author:s(o,"author"),force:!!o.force,description:s(o,"description"),globalOptions:i});i.json===!0||i.defaultOutputFormat==="json"?f(h,i):i.quiet||Mo(L,h)}i.profile&&y(`profile:command=schema took_ms=${Date.now()-r}`)}function To(t,e){if(!t)throw new m(`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"]})}function Kt(t){let e=t.command("schema").option("--definition <json>","Policy or proposed fields JSON").option("--policy <id>","Policy id for policy-approve").option("--message <text>","Audit rationale for a policy mutation").argument("[subcommand]","Required; schema verb (list/show, add/remove, rename/remap, policy-*), or custom type shorthand").argument("[name]","Definition/source name or item id; policy-mode: advise|refuse").option("--description <text>","Type, status, or field description").option("--default-status <status>","Default status for this 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").optionsGroup("Field options (add-field):").option("--type <type>","Value type for a custom field (add-field): string, number, boolean, string_array, array, object").option("--commands <list>","Field commands (repeatable/csv): 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).optionsGroup("Type inference and migration options:").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","Preview rename/remap migrations and workflow-policy actions without writes").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("Manage types, statuses, fields, presets, and workflow policies.");b(e,"--default_status <status>","Alias for --default-status",!1),b(e,"--migration_id <id>","Alias for --migration-id",!1),e.action(Eo)}var Io=new Set(Ae.map(t=>t.toLowerCase())),Do=new Set(Me.map(t=>t==="estimate"?"estimatedMinutes":t));async function Po(t,e,o,n,i){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:n.dryRun===!0,author:typeof n.author=="string"?n.author:void 0,force:n.force===!0},i)}}function No(t,e){switch(e.action){case"list":g(`${t.formatProfileListHuman(e)}
16
+ `);return;case"show":g(`${t.formatProfileShowHuman(e)}
17
+ `);return;case"lint":g(`${t.formatProfileLintHuman(e)}
18
+ `);return;default:g(`${t.formatProfileApplyHuman(e)}
19
+ `),e.warnings.length>0&&y(`profile apply warnings: ${U(e.warnings)}`);break}}function $o(t){return e=>{let o=Number(e);if(!Number.isInteger(o)||o<1)throw new m(`${t} must be a positive integer (1-based index).`,c.USAGE);return o}}function Wt(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 Lo=[["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 Xt(t){let e=o=>t[o]===!0?!0:void 0;for(let[o,n,i,r]of Lo)if(t[o]===!0&&t[n]===!0)throw new m(`Cannot combine ${i} 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 n=[],i=t.args,r=a=>(t.args!==i&&(n.length=0,i=t.args),n.push(a),n);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??[])W(o.option,a.option)?b(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 Ho(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,...Xt(t),limit:e("limit"),offset:e("offset"),includeBody:!0}}function H(...t){for(let e of t)if(typeof e=="string")return e}function Uo(t,e,o){if(!(t!=="many"||e!==void 0||o.title!==void 0||o.type!==void 0))throw new m("pm create many is not a command; bulk creation is pm item mutate.",c.USAGE,{code:"bulk_create_route",required:"Pipe a JSON array, JSON Lines, or {schema_version, mutations} document to pm item mutate, or pass --from <path>.",why:"pm item mutate commits every record in one workspace transaction with a replay-safe transaction id, so an interrupted or repeated import never duplicates items.",nextSteps:["pm item mutate --from items.jsonl --dry-run --json","pm item mutate --from items.jsonl --upsert-key external_id --json","pm guide lifecycle"],examples:["pm item mutate --from items.jsonl --json",`printf '%s\\n' '{"title":"First","type":"Task"}' '{"title":"Second","type":"Task"}' | pm item mutate --json`]})}function Bo(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 Go(t,e,o,n){if(t!==void 0||typeof e!="string"||e.length===0||o.title!==void 0||o.type!==void 0||!Io.has(e.trim().toLowerCase()))return;let i=e.trim(),r=Et(),a=r.length===0?"":`
20
+ The CLI read ${r.map(l=>`"${l.from}" as ${l.flag}`).join(", ")}; pass --title to keep text as the title.`;throw new m(`pm create needs a title: "${i}" looks like an item type. Pass the title with --title or as a second positional.${a}`,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} --title "Wire up SSO for the agent harness"`,`pm create ${i} "Wire up SSO for the agent harness"`,`pm create "Wire up SSO for the agent harness" --type ${i}`],nextSteps:r.length===0?[`Pass the title as an option: ${O(["create",i,"--title","<title>",...n])}`]:r.map(l=>`Keep "${l.from}" as the title: ${O(["create",i,"--title",l.from,...n])}`)})}var jo=["body","bodyFile","description","dep","depRemove","comment","note","learning","file","test","doc","reminder","event","typeOption","field","ids"];function j(t){let e=jo.flatMap(o=>{let n=t[o],i=typeof n=="string"&&n.trim()==="-"?1:Array.isArray(n)?n.filter(a=>typeof a=="string"&&a.trim()==="-").length:0,r=`--${o.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}`;return Array.from({length:i},()=>r)});if(t.stdinJson===!0&&e.unshift("--stdin-json"),e.length>1)throw new m(`Only one option may consume stdin per command invocation. Found: ${e.join(", ")}.`,c.USAGE)}function Yt(t,e,o){let n=[];e&&n.push("body"),o&&n.push("description"),Se(t,n)}function Zt(t,e){return!e&&typeof t.description=="string"&&t.description.trim()==="-"}async function Qt(t,e,o,n){let i=await I(R(process.cwd(),n.path));return Ct(t,e,o,_e(i.schema).definitions)}async function qo(t,e,o,n){let i=v(n),r=Date.now();j(o);let a=o.stdinJson===!0;if(a){let A=await C().resolveValue("-","--stdin-json");o=await Qt(A??"","create",o,i)}Uo(t,e,o);let l=Bo(t,e,o);Go(l.positionalType,l.positionalTitle,o,xe(i)),typeof l.positionalType=="string"&&l.positionalType.length>0&&o.type===void 0&&(o.type=l.positionalType),typeof l.positionalTitle=="string"&&l.positionalTitle.length>0&&o.title===void 0&&(o.title=l.positionalTitle);let u=Zt(o,a);a||await de(o);let p=typeof o.bodyFile=="string";p&&(o.body=await K(String(o.bodyFile),o.body!==void 0?String(o.body):void 0),delete o.bodyFile);let h=Y(o,{requireType:!1});Yt(h,p,u),a&&V(h);let S=await $t(h,i);await w(i,S),f(S,i),i.profile&&y(`profile:command=create took_ms=${Date.now()-r}`)}function Vo(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:H(t.filterAssigneeFilter,t.filterAssignee_filter),parent:s(t,"filterParent"),sprint:s(t,"filterSprint"),release:s(t,"filterRelease"),...Xt(t),limit:s(t,"limit"),offset:s(t,"offset")}}async function zo(t,e){let o=v(e),n=Date.now();j(t),t.ids=await J(s(t,"ids"));let i=await gt({status:s(t,"filterStatus"),list:Vo(t),reason:s(t,"reason"),completedAt:s(t,"completedAt"),resolution:s(t,"resolution"),expectedResult:H(t.expectedResult,t.expected_result,t.expected),actualResult:H(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 w(o,i),f(i,o),o.profile&&y(`profile:command=close-many took_ms=${Date.now()-n}`)}async function Jo(t,e){let o=v(e),n=Date.now();j(t),t.ids=await J(s(t,"ids"));let i=await Lt({status:s(t,"filterStatus"),list:Ho(t),update:Z(Ee(t)),dryRun:t.dryRun===!0?!0:void 0,rollback:s(t,"rollback"),checkpoint:t.checkpoint===!1?!1:void 0},o);await w(o,i),f(await D("update-many",[],t,o,i),o),o.profile&&y(`profile:command=update-many took_ms=${Date.now()-n}`)}async function Ko(t,e,o,n){let i=v(n),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,p=await(o.releaseAssignment===!0?St:te)(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:H(o.expectedResult,o.expected_result,o.expected),actualResult:H(o.actualResult,o.actual_result,o.actual)},i);await w(i,p),f(p,i),i.profile&&y(`profile:command=close took_ms=${Date.now()-r}`)}function Wo(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[i,r]of o)e[i]!==void 0&&e[r]===void 0&&(e[r]=e[i]);let n=Y(e,{requireType:!1});return n.blockedBy=e.blockedBy,n}function Xo(t,e){if(!t)throw new m(`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 F({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 Yo(t,e){if(t!=="reorder-step"||typeof e!="string")return;let o=Number.parseInt(e,10);if(!Number.isFinite(o))throw new m(`reorder-step requires an integer new order, got "${e}"`,c.USAGE);return o}async function Zo(t,e,o,n,i,r){let a=v(r),l=Date.now(),u=(t??"").trim().toLowerCase();Xo(u,At);let p=Wo(i),h=Yo(u,n),S=u==="create"&&typeof e=="string"&&e.length>0&&p.title===void 0?void 0:e;S===void 0&&typeof e=="string"&&e.length>0&&(p.title=e);let A=await Bt({subcommand:u,id:S,stepRef:o,reorderTo:h,options:p,global:a});await w(a,A),f(A,a),a.profile&&y(`profile:command=plan took_ms=${Date.now()-l}`)}async function Qo(t,e,o){if(t!==void 0)throw new m("merge reconcile takes no positional arguments.",c.USAGE);let n=await se({dryRun:e.dryRun===!0,force:e.force===!0,stage:e.stage===!0,message:typeof e.message=="string"?e.message:void 0,author:o.author},o);f(n,o),n.ok||(process.exitCode=c.GENERIC_FAILURE)}async function ei(t,e,o,n,i,r){if(t===void 0||e===void 0||o===void 0||n===void 0)throw new m("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 re({artifact:t,basePath:e,oursPath:o,theirsPath:n,outputPath:typeof i.output=="string"?i.output:void 0,itemPath:typeof i.itemPath=="string"?i.itemPath:void 0,prefer:typeof i.prefer=="string"?i.prefer:void 0},r);f(a,r),a.ok||(process.exitCode=c.GENERIC_FAILURE)}async function ti(t,e,o,n,i,r,a){let l=v(a),u=Date.now();switch(t.trim().toLowerCase()){case"install":{if(e!==void 0)throw new m("merge install takes no positional arguments.",c.USAGE);let h=await Q({dryRun:r.dryRun===!0,preCommitHook:r.preCommitHook===!0},l);f(h,l);break}case"reconcile":await Qo(e,r,l);break;case"report":{if(e!==void 0)throw new m("merge report takes no positional arguments.",c.USAGE);let h=await ee({includeReconciled:r.includeReconciled===!0});f(h,l),h.ok||(process.exitCode=c.GENERIC_FAILURE);break}case"driver":await ei(e,o,n,i,r,l);break;default:throw F({command_path:"merge",token:t,allowed:q,display_name:"merge"})}l.profile&&y(`profile:command=merge took_ms=${Date.now()-u}`)}async function oi(t,e,o){let n=v(o),i=Date.now(),r=await oe(t,{title:s(e,"title"),author:s(e,"author"),message:s(e,"message"),allowDuplicate:e.allowDuplicate===!0},n);await w(n,r),f(r,n),n.profile&&y(`profile:command=copy took_ms=${Date.now()-i}`)}async function ii(t,e,o){let n=v(o),i=Date.now(),r=await ne(t,{clear:e.clear===!0},n);f(r,n),n.profile&&y(`profile:command=focus took_ms=${Date.now()-i}`)}async function ni(t,e,o){let n=v(o),i=Date.now();j(e);let r=e.stdinJson===!0;if(r){let h=await C().resolveValue("-","--stdin-json");e=await Qt(h??"","update",e,n)}let a=Zt(e,r);r||await de(e);let l=typeof e.bodyFile=="string";l&&(e.body=await K(String(e.bodyFile),e.body!==void 0?String(e.body):void 0),delete e.bodyFile);let u=Z(e);Yt(u,l,a),r&&V(u);let p=await It(t,u,n);await w(n,p),f(await D("update",[t],e,n,p),n),n.profile&&y(`profile:command=update took_ms=${Date.now()-i}`)}async function ai(t,e,o){let n=v(o),i=Date.now(),r=await ie(t,{author:s(e,"author"),message:s(e,"message"),force:!!e.force,dryRun:e.dryRun===!0},n);r.dry_run!==!0&&await w(n,r),f(r,n),n.profile&&y(`profile:command=delete took_ms=${Date.now()-i}`)}function ri(t,e){let o=s(e,"body"),n=s(e,"text"),i=typeof t=="string"?t:void 0;if([o,n,i].filter(l=>l!==void 0).length>1)throw new m("Specify append text with exactly one source: positional [text], --body, or --text",c.USAGE);let a=o??n??i;if(a===void 0)throw new m("Missing append text. Provide it as positional [text], --body <value>, or --text <value> (use - for stdin).",c.USAGE);return a}async function si(t,e,o,n){let i=v(n),r=Date.now(),a=await Nt(t,{body:ri(e,o),author:s(o,"author"),message:s(o,"message"),force:!!o.force},i);await w(i,a),f(a,i),i.profile&&y(`profile:command=append took_ms=${Date.now()-r}`)}async function li(t,e,o,n){let i=v(n),r=Date.now(),{PROFILE_SUBCOMMANDS:a}=N,l=(t??"").trim().toLowerCase();if(!l)throw new m(`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 F({command_path:"profile",token:l,allowed:a});let u=await Po(N,l,e,o,i);i.json===!0||i.defaultOutputFormat==="json"?f(u,i):i.quiet||No(N,u),u.action==="lint"&&!u.ok&&(process.exitCode=c.GENERIC_FAILURE),i.profile&&y(`profile:command=profile took_ms=${Date.now()-r}`)}function _(t,e){return $(t[e])??[]}async function di(t,e,o){let n=v(o),i=Date.now(),r=_(e,"add"),a=_(e,"addGlob"),l=_(e,"remove"),u=_(e,"migrate"),p=await mt(t,{add:r,addGlob:a,remove:l,migrate:u,note:s(e,"note"),noteConflict:s(e,"noteConflict"),list:!!e.list,appendStable:!!e.appendStable,validatePaths:!!e.validatePaths,fullHistory:e.fullHistory===!0,author:s(e,"author"),message:s(e,"message"),force:!!e.force},n);(r.length>0||a.length>0||l.length>0||u.length>0)&&await w(n,p),f(await D("files",[t],e,n,p),n),n.profile&&y(`profile:command=files took_ms=${Date.now()-i}`)}async function ui(t,e,o){let n=v(o),i=Date.now(),r={...o.optsWithGlobals(),...e},a=await vt(t,{apply:!!r.apply,note:s(r,"note"),appendStable:!!r.appendStable,author:s(r,"author"),message:s(r,"message"),force:!!r.force},n);a.changed&&await w(n,a),f(a,n),n.profile&&y(`profile:command=files.discover took_ms=${Date.now()-i}`)}async function ci(t,e,o){let n=v(o),i=Date.now(),r=_(e,"add"),a=_(e,"addGlob"),l=_(e,"remove"),u=_(e,"migrate"),p=await ct(t,{add:r,addGlob:a,remove:l,migrate:u,note:s(e,"note"),noteConflict:s(e,"noteConflict"),list:!!e.list,validatePaths:!!e.validatePaths,fullHistory:e.fullHistory===!0,author:s(e,"author"),message:s(e,"message"),force:!!e.force},n);(r.length>0||a.length>0||l.length>0||u.length>0)&&await w(n,p),f(await D("docs",[t],e,n,p),n),n.profile&&y(`profile:command=docs took_ms=${Date.now()-i}`)}async function pi(t,e,o){let n=v(o),i=Date.now(),r=await ut(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}:{}},n);f(r,n),n.profile&&y(`profile:command=deps took_ms=${Date.now()-i}`)}function wa(t,e={}){let o=t.command("create").argument("[type-or-title]",'Title, or type followed by title (e.g. task "Fix bug")').argument("[title]","Title following an item type").description("Create a new project management item.");if(he(o,X),o.option("--stdin-json","Item JSON from stdin; explicit flags override").option("--body-file <path>","Load body from a file or stdin (-); conflicts 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").option("--inherit-focus","Use saved focus as parent (CLI default; SDK/MCP opt in)",!0).option("--no-inherit-focus","Ignore saved focus; --unset parent also suppresses it").action(qo),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(oi),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(ii);let n=t.command("update").argument("<id>","Item id").description("Update item fields and metadata.");he(n,Fe),n.option("--stdin-json","Read a full item JSON document from stdin; explicit flags override document values").option("--body-file <path>","Load body from a file or stdin (-); conflicts 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"),n.action(ni),Ht(t);let i=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)");Wt(i,"applying updates"),i.option("--ids <value>","Explicit ID allowlist: comma/newline text, - stdin, or @path file").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 fields by name (repeatable or csv)",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"),P(i,[["--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),P(i,[["--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),i.action(Jo);let r=t.command("close").option("--release-assignment","Release ownership after closure").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>","Closure resolution summary (checked by --validate-close strict)").option("--expected-result <value>","Expected outcome for closure validation").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Observed outcome for closure validation").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.");b(r,"--expected_result <value>","Alias for --expected-result",!1),b(r,"--actual_result <value>","Alias for --actual-result",!1),r.action(Ko);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");Wt(a,"closing"),a.option("--ids <value>","Explicit ID allowlist: comma/newline text, - stdin, or @path file").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"),b(a,"--filter-assignee_filter <value>","Alias for --filter-assignee-filter",!1),b(a,"--expected_result <value>","Alias for --expected-result",!1),b(a,"--actual_result <value>","Alias for --actual-result",!1),a.action(zo),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(ai),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(si);let l=t.command("plan").description("Plan workflow: create, manage steps and 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 (non-create); positional title for create").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>","Change or investigation scope").option("--parent <value>","Parent pm item id").option("--inherit-focus","Create under saved focus (CLI default)",!0).option("--no-inherit-focus","Create without saved focus").option("--related <value>","Related item ids (repeatable CSV)",d).option("--blocks <value>","Blocked item ids (repeatable CSV)",d).option("--blocked-by <value>","Blocking item ids (repeatable CSV)",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,X.filter(h=>Do.has(h.target))),P(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),P(l,[["--blocked_by <value>","Alias for --blocked-by"],["--depends_on <value>","Alias for --depends-on"]],!0),l.action(Zo),Tt(t,!1),Ut(t),t.command("merge").argument("<subcommand>",`${q.join(" | ")}`).argument("[artifact]",`driver: ${ae.join(" | ")}`).argument("[base]","driver: ancestor file (%O)").argument("[ours]","driver: current file (%A)").argument("[theirs]","driver: incoming file (%B)").option("--dry-run","install/reconcile: preview").option("--pre-commit-hook","install: opt into merge settlement hook").option("--stage","reconcile: stage lossless audit evidence").option("--message <text>","reconcile: audit message").option("--force","reconcile: accept reviewed decisions").option("--include-reconciled","report: include settled receipts").option("--output <path>","driver: alternate output").option("--item-path <path>","driver: repository-relative path (%P)").option("--prefer <side>","driver: ours|theirs (default ours)").description("Manage tracker merges.").action(ti),Kt(t),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(li),Vt(t,$o);let p=t.command("files").description("Manage files linked to an item.");p.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("--note-conflict <mode>","On a different stored note: refuse (default)|replace|append").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("--full-history","Return all linked files after a write").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").action(di),p.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(ui),zt(p),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("--note-conflict <mode>","On a different stored note: refuse (default)|replace|append").option("--list","List linked docs without mutating").option("--validate-paths","Validate linked doc paths for existence and file shape").option("--full-history","Return all linked docs after a write").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage docs linked to an item.").action(ci),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(pi)}export{ve as looksLikeSchemaSubcommandTypo,$o as parsePositiveIntOption,G as parseSchemaOrderOption,he as registerCommanderOptionContracts,wa as registerMutationCommands};
21
+ //# sourceMappingURL=register-mutation-GZLF47SX.js.map