@unbrained/pm-cli 2026.8.18 → 2026.8.20

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 (186) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +35 -2
  3. package/dist/cli/error-guidance.js +3 -2
  4. package/dist/cli/help-content.js +32 -13
  5. package/dist/cli/help-json-payload.d.ts +15 -0
  6. package/dist/cli/help-json-payload.js +101 -23
  7. package/dist/cli/main.js +6 -2
  8. package/dist/cli/register-list-query.js +18 -13
  9. package/dist/cli/register-mutation.js +8 -8
  10. package/dist/cli/register-operations.js +6 -6
  11. package/dist/cli/register-structured-mutation.d.ts +2 -0
  12. package/dist/cli/register-structured-mutation.js +29 -6
  13. package/dist/cli-bundle/bundle-manifest.json +151 -143
  14. package/dist/cli-bundle/chunks/{chunk-UYCLQVL2.js → chunk-2RDVGYWE.js} +12 -12
  15. package/dist/cli-bundle/chunks/{chunk-BSK2IN3C.js → chunk-4GB2LTOQ.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-RZQTVMRQ.js → chunk-7BRF2BX2.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-BLVQHFSY.js +35 -0
  18. package/dist/cli-bundle/chunks/chunk-CU25EQVV.js +5 -0
  19. package/dist/cli-bundle/chunks/chunk-K3EN3LK2.js +2 -0
  20. package/dist/cli-bundle/chunks/{chunk-YRGOLZA7.js → chunk-L4LGPBJU.js} +49 -49
  21. package/dist/cli-bundle/chunks/chunk-RS3IV2R6.js +197 -0
  22. package/dist/cli-bundle/chunks/chunk-TSMWLCHS.js +3 -0
  23. package/dist/cli-bundle/chunks/chunk-US2ZQW2M.js +77 -0
  24. package/dist/cli-bundle/chunks/{chunk-5UZZAJKR.js → chunk-XYDDWBZN.js} +2 -2
  25. package/dist/cli-bundle/chunks/register-list-query-JSAQCVOC.js +11 -0
  26. package/dist/cli-bundle/chunks/register-mutation-XJPAW63D.js +20 -0
  27. package/dist/cli-bundle/chunks/register-operations-DSOSB2XQ.js +2 -0
  28. package/dist/cli-bundle/chunks/{register-setup-PPPEF3SN.js → register-setup-QUR6QL2C.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-325UXIO7.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-5L7M4AI7.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-ODOVCP45.js → chunk-6AHG2YW7.js} +44 -44
  32. package/dist/cli-bundle/focused-chunks/chunk-AZBACT5T.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-TN4AE665.js → chunk-BLJCGGID.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/chunk-FUREQLQN.js +18 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-M62NO7EI.js → chunk-G3C5ERXG.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-K43KKAFS.js → chunk-GXWQBE3T.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-UI6AJ5TD.js → chunk-JWKEDZJI.js} +3 -3
  38. package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +155 -0
  39. package/dist/cli-bundle/focused-chunks/{chunk-EX6MKP2X.js → chunk-M32HFIQB.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-EUEGXZ2A.js → chunk-OM65KHGF.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-V5XTGLK7.js → chunk-RIHDMCUM.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-T4ZFY7ZJ.js +16 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-TDR5OGG3.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/chunk-UGSS4F5X.js +2 -0
  46. package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +2 -0
  47. package/dist/cli-bundle/main.js +13 -13
  48. package/dist/cli-bundle/sdk-authoring.js +1 -1
  49. package/dist/cli-bundle/sdk-contracts.js +2 -1
  50. package/dist/cli-bundle/sdk-core.js +41 -41
  51. package/dist/cli-bundle/sdk-governance.js +1 -1
  52. package/dist/cli-bundle/sdk-graph.js +1 -1
  53. package/dist/cli-bundle/sdk-merge.js +32 -32
  54. package/dist/cli-bundle/sdk-query.js +1 -1
  55. package/dist/cli-bundle/sdk-runtime.js +1 -1
  56. package/dist/cli-bundle/sdk-testing.js +1 -1
  57. package/dist/cli-bundle/sdk.js +5 -4
  58. package/dist/core/output/mutation-projection.js +26 -2
  59. package/dist/core/shared/constants.d.ts +1 -5
  60. package/dist/core/shared/constants.js +3 -81
  61. package/dist/core/shared/errors.d.ts +2 -0
  62. package/dist/core/shared/errors.js +2 -2
  63. package/dist/core/shared/item-metadata-contract.d.ts +14 -0
  64. package/dist/core/shared/item-metadata-contract.js +90 -0
  65. package/dist/core/store/item-store.d.ts +60 -0
  66. package/dist/core/store/item-store.js +22 -5
  67. package/dist/sdk/agent/closed-domain-contracts.d.ts +25 -0
  68. package/dist/sdk/agent/closed-domain-contracts.js +140 -0
  69. package/dist/sdk/agent/refusal-closure.d.ts +53 -0
  70. package/dist/sdk/agent/refusal-closure.js +134 -0
  71. package/dist/sdk/agent/refusal-reachability.d.ts +27 -1
  72. package/dist/sdk/agent/refusal-reachability.js +26 -2
  73. package/dist/sdk/agent-capability-contracts.d.ts +13 -0
  74. package/dist/sdk/agent-capability-contracts.js +101 -9
  75. package/dist/sdk/cli-contracts/command-aliases.js +18 -2
  76. package/dist/sdk/cli-contracts/commander-mutation-options.js +30 -6
  77. package/dist/sdk/cli-contracts/commander-types.js +5 -4
  78. package/dist/sdk/cli-contracts/completeness.js +8 -2
  79. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -2
  80. package/dist/sdk/cli-contracts/enum-contracts.js +16 -6
  81. package/dist/sdk/cli-contracts/flag-contracts.d.ts +7 -0
  82. package/dist/sdk/cli-contracts/flag-contracts.js +84 -8
  83. package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +72 -0
  84. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +340 -0
  85. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +83 -2
  86. package/dist/sdk/cli-contracts/grammar-contracts.js +618 -2
  87. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +15 -4
  88. package/dist/sdk/cli-contracts/runtime-contracts.js +47 -13
  89. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +28 -1
  90. package/dist/sdk/cli-contracts/tool-option-contracts.js +38 -3
  91. package/dist/sdk/cli-contracts/tool-schema.js +7 -2
  92. package/dist/sdk/cli-contracts.d.ts +4 -3
  93. package/dist/sdk/cli-contracts.js +6 -5
  94. package/dist/sdk/context-intent-contracts.d.ts +2 -2
  95. package/dist/sdk/context-intent-contracts.js +22 -7
  96. package/dist/sdk/contracts.d.ts +3 -0
  97. package/dist/sdk/contracts.js +5 -2
  98. package/dist/sdk/core.d.ts +1 -1
  99. package/dist/sdk/core.js +3 -3
  100. package/dist/sdk/flag-invocation-contracts.d.ts +37 -0
  101. package/dist/sdk/flag-invocation-contracts.js +218 -9
  102. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +206 -2
  103. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +244 -40
  104. package/dist/sdk/index.d.ts +11 -7
  105. package/dist/sdk/index.js +10 -6
  106. package/dist/sdk/init-agent-guidance.d.ts +5 -3
  107. package/dist/sdk/init-agent-guidance.js +69 -9
  108. package/dist/sdk/lifecycle/mcp-actions.d.ts +18 -0
  109. package/dist/sdk/lifecycle/mcp-actions.js +52 -0
  110. package/dist/sdk/lifecycle/reopen.d.ts +44 -0
  111. package/dist/sdk/lifecycle/reopen.js +69 -0
  112. package/dist/sdk/lifecycle/update.d.ts +31 -0
  113. package/dist/sdk/lifecycle/update.js +95 -13
  114. package/dist/sdk/output-projection.d.ts +2 -0
  115. package/dist/sdk/output-projection.js +11 -5
  116. package/dist/sdk/query/get.d.ts +1 -1
  117. package/dist/sdk/query/get.js +34 -49
  118. package/dist/sdk/query/list.d.ts +7 -21
  119. package/dist/sdk/query/list.js +44 -44
  120. package/dist/sdk/query/projection-contracts.d.ts +33 -0
  121. package/dist/sdk/query/projection-contracts.js +185 -0
  122. package/dist/sdk/query/search-contracts.d.ts +3 -2
  123. package/dist/sdk/query/search-contracts.js +30 -85
  124. package/dist/sdk/query/search.d.ts +15 -0
  125. package/dist/sdk/query/search.js +32 -6
  126. package/dist/sdk/read-output/continuation.d.ts +1 -1
  127. package/dist/sdk/read-output/continuation.js +7 -24
  128. package/dist/sdk/read-output-contracts.js +55 -6
  129. package/dist/sdk/read-output-rows.d.ts +4 -0
  130. package/dist/sdk/read-output-rows.js +47 -18
  131. package/dist/sdk/runtime-primitives.d.ts +1 -1
  132. package/dist/sdk/runtime-primitives.js +3 -3
  133. package/dist/sdk/runtime.d.ts +6 -0
  134. package/dist/sdk/runtime.js +25 -17
  135. package/dist/sdk/similarity.d.ts +13 -0
  136. package/dist/sdk/similarity.js +32 -6
  137. package/dist/sdk/workspace-snapshot.d.ts +2 -0
  138. package/dist/sdk/workspace-snapshot.js +10 -2
  139. package/docs/COMMANDS.md +29 -5
  140. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +11 -2
  141. package/docs/README.md +1 -0
  142. package/docs/READ_OUTPUT_CONTRACTS.md +10 -6
  143. package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +114 -0
  144. package/docs/SDK.md +16 -2
  145. package/docs/SDK_CONTEXT_INTEGRITY.md +45 -0
  146. package/docs/TESTING.md +14 -1
  147. package/docs/generated/AGENT_COMMAND_SURFACE.md +78 -78
  148. package/docs/generated/FLAG_LEXICON_BUDGETS.md +76 -0
  149. package/docs/performance/sdk-entrypoint-import-costs.md +14 -21
  150. package/marketplace.json +2 -2
  151. package/package.json +9 -7
  152. package/packages/pm-beads/package.json +1 -1
  153. package/packages/pm-calendar/package.json +1 -1
  154. package/packages/pm-command-kit/package.json +1 -1
  155. package/packages/pm-digital-twin/package.json +1 -1
  156. package/packages/pm-governance-audit/package.json +1 -1
  157. package/packages/pm-guide-shell/package.json +1 -1
  158. package/packages/pm-kanban/package.json +1 -1
  159. package/packages/pm-lifecycle-hooks/package.json +1 -1
  160. package/packages/pm-linked-test-adapters/package.json +1 -1
  161. package/packages/pm-search-advanced/package.json +1 -1
  162. package/packages/pm-templates/package.json +1 -1
  163. package/packages/pm-todos/package.json +1 -1
  164. package/packages/pm-vcs/package.json +1 -1
  165. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  166. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  167. package/scripts/generate-agent-capability-surfaces.mjs +20 -14
  168. package/sdk/public-surface.json +950 -24
  169. package/dist/cli-bundle/chunks/chunk-ALDJGKAK.js +0 -2
  170. package/dist/cli-bundle/chunks/chunk-DY4DMUMC.js +0 -197
  171. package/dist/cli-bundle/chunks/chunk-GNFAFIJI.js +0 -77
  172. package/dist/cli-bundle/chunks/chunk-L5Q2CLPE.js +0 -35
  173. package/dist/cli-bundle/chunks/chunk-PVRUN5ZS.js +0 -5
  174. package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +0 -3
  175. package/dist/cli-bundle/chunks/register-list-query-I23LALEE.js +0 -11
  176. package/dist/cli-bundle/chunks/register-mutation-6YGU3GPH.js +0 -20
  177. package/dist/cli-bundle/chunks/register-operations-4HTFC6J7.js +0 -2
  178. package/dist/cli-bundle/focused-chunks/chunk-2PN4TJXH.js +0 -2
  179. package/dist/cli-bundle/focused-chunks/chunk-3TKWMNKF.js +0 -18
  180. package/dist/cli-bundle/focused-chunks/chunk-5AF3ZBNB.js +0 -155
  181. package/dist/cli-bundle/focused-chunks/chunk-C5IW2NDA.js +0 -2
  182. package/dist/cli-bundle/focused-chunks/chunk-RNDNMARJ.js +0 -16
  183. package/dist/cli-bundle/focused-chunks/chunk-TVV2DONO.js +0 -2
  184. package/dist/cli-bundle/focused-chunks/chunk-WGHQVU6P.js +0 -2
  185. package/dist/cli-bundle/focused-chunks/chunk-XYNBXTDQ.js +0 -2
  186. package/dist/cli-bundle/focused-chunks/chunk-Z56ECT7I.js +0 -2
@@ -1,3 +1,3 @@
1
- import{Ka as oe,ra as ie}from"./chunk-GNFAFIJI.js";import{C as l,E as c,Eg as C,Ga as G,Na as I,Oa as J,Ri as ae,Va as b,Vg as N,Xa as Z,Ya as x,ad as te,c as w,ca as Q,cc as ee,ia as X,lh as re,uh as ne,wh as k,xc as R}from"./chunk-DY4DMUMC.js";import{execFile as Ie}from"node:child_process";import Re from"node:path";import{promisify as Ne}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cdfc451a-1148-50c5-934a-cd8bc2bb39e7")}catch{}})();var Te=Ne(Ie),$e="@unbrained/pm-cli",Oe="latest";function Le(e){let t=e.project===!0||e.local===!0,r=e.global===!0;if(t&&r)throw new c('Options "--project/--local" and "--global" are mutually exclusive.',l.USAGE);return r?"global":"project"}function S(e){return e.trim().toLowerCase()}function se(e,t){let r=S(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"&&S(i)===r)}function De(e,t){let r=b(process.cwd(),t.path),n=ee(r,process.cwd());return{selected_root:e==="global"?n.global:n.project}}async function Ue(e,t,r){try{let n=await Te(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 c(`Command failed: ${e} ${t.join(" ")}
1
+ import{Ga as oe,na as ie}from"./chunk-US2ZQW2M.js";import{Bh as ne,C as l,Dh as k,E as c,Ga as G,Lg as C,Na as I,Oa as J,Va as b,Xa as Z,Ya as x,_i as ae,ad as te,ah as N,c as w,ca as Q,cc as ee,ia as X,sh as re,xc as R}from"./chunk-RS3IV2R6.js";import{execFile as Ie}from"node:child_process";import Re from"node:path";import{promisify as Ne}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cdfc451a-1148-50c5-934a-cd8bc2bb39e7")}catch{}})();var Te=Ne(Ie),$e="@unbrained/pm-cli",Oe="latest";function Le(e){let t=e.project===!0||e.local===!0,r=e.global===!0;if(t&&r)throw new c('Options "--project/--local" and "--global" are mutually exclusive.',l.USAGE);return r?"global":"project"}function S(e){return e.trim().toLowerCase()}function se(e,t){let r=S(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"&&S(i)===r)}function De(e,t){let r=b(process.cwd(),t.path),n=ee(r,process.cwd());return{selected_root:e==="global"?n.global:n.project}}async function Ue(e,t,r){try{let n=await Te(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 c(`Command failed: ${e} ${t.join(" ")}
2
2
  ${a}`,l.GENERIC_FAILURE)}}async function ze(){return X(import.meta.url,["../../.."])}function A(e){return typeof e.tag=="string"&&e.tag.trim().length>0?e.tag.trim():Oe}function E(e){return typeof e.packageName=="string"&&e.packageName.trim().length>0?e.packageName.trim():$e}async function Fe(e,t){let r=e.commandRunner??Ue,n=E(e),i=A(e),a=`${n}@${i}`,o=["npm","install","-g",a];e.repair===!0&&o.push("--force");let _=await ze(),s={requested:!0,status:"planned",package:n,target:a,command:o,before_version:_,repair:e.repair===!0};if(t)return s;try{await r(o[0],o.slice(1));let f=await r("pm",["--version"]);return{...s,status:"updated",after_version:f.stdout.trim()||void 0}}catch(f){return{...s,status:"failed",error:f instanceof Error?f.message:String(f)}}}function je(e){return Re.isAbsolute(e)||e.startsWith(".")||e.startsWith("..")||e.startsWith("file:")}function Me(e,t){if(e.kind==="npm"){let r=e.input.startsWith("npm:")?e.input.slice(4).trim():e.input.trim();return!je(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 Ke(e,t){let r=Me(e,t);return e.kind!=="local"||await w(r)?r:await w(e.location)?e.location:r}function Ve(e,t,r,n){let i=["pm","install",t,r==="global"?"--global":"--project"];return e.kind==="github"&&n&&n.trim().length>0&&i.push("--ref",n.trim()),i}async function le(e,t){let r=De(e,t);return(await ie(r.selected_root)).state.entries.filter(i=>i.scope===e)}async function Ye(e,t,r){let n=await le(e,t);return n.find(i=>se(i,r.name))??n.find(i=>S(i.directory)===S(r.directory))}async function Be(e,t,r,n,i){let a=A(t),o=await Ke(e.source,a),_=Ve(e.source,o,n,e.source.ref),s={name:e.name,directory:e.directory,scope:n,source:e.source,status:"planned",command:_,previous_version:e.manifest_version};if(i)return s;try{await oe(o,{install:!0,project:n==="project",global:n==="global",ref:e.source.kind==="github"?e.source.ref:void 0},r);let f=await Ye(n,r,e);return{...s,status:"updated",installed_version:f?.manifest_version}}catch(f){return{...s,status:"failed",error:f instanceof Error?f.message:String(f)}}}function We(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 Bt(e,t,r){if(t.cliOnly===!0&&t.packagesOnly===!0)throw new c('Options "--cli-only" and "--packages-only" are mutually exclusive.',l.USAGE);let n=Le(t),i=t.dryRun===!0,a=typeof e=="string"&&e.trim().length>0?e.trim():void 0;if(t.cliOnly===!0&&a)throw new c('A package target cannot be used with "--cli-only".',l.USAGE);let o=!(t.packagesOnly===!0||a),_=t.cliOnly!==!0,s=o?await Fe(t,i):{requested:!1,status:"skipped",package:E(t),target:`${E(t)}@${A(t)}`,command:["npm","install","-g",`${E(t)}@${A(t)}`],repair:t.repair===!0,reason:"not_requested"},f=_?await le(n,r):[];if(a&&(f=f.filter(h=>se(h,a)),f.length===0))throw new c(`Managed package "${a}" was not found in ${n} scope.`,l.NOT_FOUND);let m=[];for(let h of f)m.push(await Be(h,t,r,n,i));let y=We(s,m,o,_);return{ok:y.failed===0,action:"upgrade",dry_run:i,scope:n,target:a,cli:s,packages:m,summary:y}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4f4f5f10-793d-5baa-8985-c0ec855b16c4")}catch{}})();var ce=new Set(["item_format"]),_e=new Set(["definition_of_done","metadata_required_fields","lifecycle_stale_blocker_reason_patterns","lifecycle_closure_like_blocked_reason_patterns","lifecycle_closure_like_resolution_patterns","lifecycle_closure_like_actual_result_patterns"]),He=new Set(["history_missing_stream_policy","sprint_release_format_policy","parent_reference_policy","metadata_validation_profile","governance_preset","governance_ownership_enforcement","governance_create_mode_default","governance_close_validation_default","governance_require_close_reason","governance_create_default_type","governance_workflow_enforcement","governance_parent_reference_policy","governance_metadata_validation_profile","governance_force_required_for_stale_lock","test_result_tracking","telemetry_tracking"]),Qe=new Set(["governance_require_close_reason","governance_force_required_for_stale_lock","test_result_tracking","telemetry_tracking"]),Xe={off:"disabled",on:"enabled",true:"enabled",false:"disabled",enabled:"enabled",disabled:"disabled"};function Je(e){let t=e.trim().toLowerCase().replaceAll("-","_");if(ce.has(t)||_e.has(t)||He.has(t)||t==="context")return t}function Ze(e){let t=e.trim().toLowerCase();return Xe[t]??e}function fe(e,t){let r=Je(e);return r===void 0?{routable:!1,reason:`Unknown config key "${e}" cannot route a positional value.`}:r==="context"?{routable:!1,reason:"Config set context does not accept a positional value. Use --default-depth, --activity-limit, --stale-threshold-days, or --section-<name> flags."}:ce.has(r)?{routable:!0,flag:"format",value:t}:_e.has(r)?{routable:!0,flag:"criterion",values:[t]}:{routable:!0,flag:"policy",value:Qe.has(r)?Ze(t):t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="be95f220-5f66-5e8c-8447-996696d02e43")}catch{}})();var q=[{key:"search_provider",path:"search.provider",kind:"string",summary:"Search embedding provider name (e.g. openai, ollama, or an extension provider)."},{key:"search_mutation_refresh_policy",path:"search.mutation_refresh_policy",kind:"string",choices:["cache_only","semantic_configured","semantic_auto"],summary:"Mutation-time search refresh policy: cache_only, semantic_configured, or semantic_auto."},{key:"search_query_expansion_enabled",path:"search.query_expansion.enabled",kind:"boolean",summary:"Enable or disable query expansion for semantic/hybrid search."},{key:"search_query_expansion_provider",path:"search.query_expansion.provider",kind:"string",summary:"Query expansion provider name (built-in openai/ollama or extension provider)."},{key:"search_rerank_enabled",path:"search.rerank.enabled",kind:"boolean",summary:"Enable or disable post-retrieval reranking for hybrid search."},{key:"search_rerank_model",path:"search.rerank.model",kind:"string",summary:"Rerank model name override used by built-in providers."},{key:"search_rerank_top_k",path:"search.rerank.top_k",kind:"integer",min:1,summary:"Number of top hybrid candidates to rerank when rerank is enabled."},{key:"search_embedding_model",path:"search.embedding_model",kind:"string",summary:"Default embedding model name (overrides provider-specific model when set)."},{key:"search_embedding_corpus_max_characters",path:"search.embedding_corpus_max_characters",kind:"integer",min:1,summary:"Maximum semantic corpus characters per item before truncation."},{key:"search_embedding_batch_size",path:"search.embedding_batch_size",kind:"integer",min:1,summary:"Number of items embedded per request batch."},{key:"search_embedding_timeout_ms",path:"search.embedding_timeout_ms",kind:"integer",min:1,summary:"Per-request embedding timeout in milliseconds."},{key:"search_score_threshold",path:"search.score_threshold",kind:"number",summary:"Minimum score for a hit to be returned (0 keeps all matches)."},{key:"search_hybrid_semantic_weight",path:"search.hybrid_semantic_weight",kind:"ratio",summary:"Hybrid mode semantic weight in [0, 1] (1-weight goes to keyword)."},{key:"search_max_results",path:"search.max_results",kind:"integer",min:1,summary:"Default upper bound on search hits when --limit is not supplied."},{key:"search_bm25_k1",path:"search.bm25.k1",kind:"number",min:0,summary:"Offline BM25 term-frequency saturation (k1); higher saturates repeated terms slower (default 1.2)."},{key:"search_bm25_b",path:"search.bm25.b",kind:"ratio",summary:"Offline BM25 document-length normalization (b) in [0, 1]; 0 disables, 1 fully normalizes (default 0.75)."},{key:"openai_base_url",path:"providers.openai.base_url",kind:"string",summary:"OpenAI-compatible API base URL (LM Studio/vLLM also use this)."},{key:"openai_api_key",path:"providers.openai.api_key",kind:"string",summary:"OpenAI-compatible API key."},{key:"openai_model",path:"providers.openai.model",kind:"string",summary:"OpenAI-compatible embedding model name."},{key:"ollama_base_url",path:"providers.ollama.base_url",kind:"string",summary:"Ollama API base URL (typically http://localhost:11434)."},{key:"ollama_model",path:"providers.ollama.model",kind:"string",summary:"Ollama embedding model name (e.g. nomic-embed-text)."},{key:"vector_store_adapter",path:"vector_store.adapter",kind:"string",summary:"Vector store adapter name (lancedb, qdrant, or an extension adapter)."},{key:"vector_store_collection_name",path:"vector_store.collection_name",kind:"string",non_empty:!0,summary:"Vector collection/table name shared by Qdrant and LanceDB adapters."},{key:"qdrant_url",path:"vector_store.qdrant.url",kind:"string",summary:"Qdrant HTTP API URL."},{key:"qdrant_api_key",path:"vector_store.qdrant.api_key",kind:"string",summary:"Qdrant API key (empty if running unauthenticated)."},{key:"lancedb_path",path:"vector_store.lancedb.path",kind:"string",summary:"LanceDB storage path (relative to pm root or absolute)."},{key:"id_prefix",path:"id_prefix",kind:"string",non_empty:!0,summary:'Prefix for generated item IDs (e.g. "pm" produces pm-xxxx).'},{key:"author_default",path:"author_default",kind:"string",non_empty:!0,summary:"Default author recorded on mutations when --author is not supplied."},{key:"mutation_guard_require_attributed_author",path:"mutation_guard.require_attributed_author",kind:"boolean",summary:"Reject mutations whose effective author resolves to unknown."},{key:"mutation_guard_secret_guard",path:"mutation_guard.secret_guard",kind:"string",choices:["off","advise","block"],summary:"Detect credential-shaped mutation content: off, advise, or block."},{key:"mutation_guard_stale_in_progress_hours",path:"mutation_guard.stale_in_progress_hours",kind:"integer",min:1,summary:"Age threshold for unclaimed in-progress work surfaced by health."},{key:"governance_duplicate_detection_mode",path:"governance.duplicate_detection_mode",kind:"string",choices:["off","advisory","strict"],summary:"Create/copy duplicate governance: off, advisory, or strict explicit-bypass enforcement."},{key:"governance_duplicate_detection_threshold",path:"governance.duplicate_detection_threshold",kind:"ratio",summary:"Minimum shared similarity score in [0, 1] for create/copy duplicate governance."},{key:"governance_duplicate_detection_limit",path:"governance.duplicate_detection_limit",kind:"integer",min:0,max:20,summary:"Maximum likely duplicates returned by create/copy governance (0-20)."},{key:"output_default_format",path:"output.default_format",kind:"string",choices:["toon","json"],summary:"Default output format for commands that support it: toon or json."},{key:"ux_deprecation_hints",path:"ux.deprecation_hints",kind:"boolean",summary:"Emit one stderr migration hint for deprecated command aliases."},{key:"locks_ttl_seconds",path:"locks.ttl_seconds",kind:"integer",min:1,summary:"Claim/lock time-to-live in seconds before a stale lock can be reclaimed."},{key:"locks_wait_ms",path:"locks.wait_ms",kind:"integer",min:0,summary:"Bounded jittered wait in milliseconds before a contended item mutation fails with lock_conflict; 0 fails fast. PM_LOCK_WAIT_MS overrides per invocation."},{key:"ids_token_length",path:"ids.token_length",kind:"integer",min:4,max:12,summary:"Random base36 token length for newly minted item ids (4-12, default 4). Raise it to shrink cross-branch id collision odds in concurrent multi-agent workflows (pm-pibw)."},{key:"checkpoints_retention_days",path:"checkpoints.retention_days",kind:"integer",min:1,summary:"Age in days above which pm gc --scope checkpoints prunes bulk-mutation rollback checkpoints."},{key:"schema_unknown_field_policy",path:"schema.unknown_field_policy",kind:"string",choices:["allow","warn","reject"],summary:"How item I/O handles metadata keys not in the field registry: allow, warn, or reject."},{key:"history_compact_policy_enabled",path:"history.compact_policy.enabled",kind:"boolean",summary:"Enable the history-compaction advisory: pm health warns on over-threshold streams."},{key:"history_compact_policy_max_entries",path:"history.compact_policy.max_entries",kind:"integer",min:1,summary:"Entry count above which a history stream is flagged (and the default pm history-compact --all-over threshold)."},{key:"history_compact_policy_trigger",path:"history.compact_policy.trigger",kind:"string",choices:["health_warn","auto"],summary:"History-compaction policy intent: health_warn (advisory only) or auto (scheduled sweeps expected)."}],xe=new Map(q.flatMap(e=>[[e.key,e],[e.path.toLowerCase().replaceAll("-","_"),e]]));function de(e){if(typeof e!="string")return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length!==0)return xe.get(t)}function et(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 tt(e,t,r){return 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 rt(e,t,r){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:{message:`Config set ${e.key} requires a finite number, got "${t}"`}}}function nt(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 at(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 it(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 ue(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 et(e,t);if(e.kind==="string")return tt(e,t,r);let n=rt(e,t,r);return n.ok?e.kind==="integer"?nt(e,t,n.value):e.kind==="ratio"?at(e,t,n.value):it(e,t,n.value):{ok:!1,error:n.error}}function T(e,t){let r=t.path.split("."),n=e;for(let i of r){if(typeof n!="object"||n===null)return null;n=n[i]}return typeof n=="string"||typeof n=="number"||typeof n=="boolean"?n:null}function me(e,t,r){let n=t.path.split("."),i=e;for(let _=0;_<n.length-1;_+=1){let s=n[_],f=i[s];if(typeof f!="object"||f===null||Array.isArray(f)){let m={};i[s]=m,i=m}else i=f}let a=n[n.length-1];return i[a]===r?!1:(i[a]=r,!0)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a9a8d99c-df4e-55b3-81f5-27124d598c5f")}catch{}})();var ge=["project","global"],p={definition_of_done:["definition-of-done","definition_of_done"],item_format:["item-format","item_format"],history_missing_stream_policy:["history-missing-stream-policy","history_missing_stream_policy"],sprint_release_format_policy:["sprint-release-format-policy","sprint_release_format_policy"],parent_reference_policy:["parent-reference-policy","parent_reference_policy"],metadata_validation_profile:["metadata-validation-profile","metadata_validation_profile"],metadata_required_fields:["metadata-required-fields","metadata_required_fields"],lifecycle_stale_blocker_reason_patterns:["lifecycle-stale-blocker-reason-patterns","lifecycle_stale_blocker_reason_patterns"],lifecycle_closure_like_blocked_reason_patterns:["lifecycle-closure-like-blocked-reason-patterns","lifecycle_closure_like_blocked_reason_patterns"],lifecycle_closure_like_resolution_patterns:["lifecycle-closure-like-resolution-patterns","lifecycle_closure_like_resolution_patterns"],lifecycle_closure_like_actual_result_patterns:["lifecycle-closure-like-actual-result-patterns","lifecycle_closure_like_actual_result_patterns"],governance_preset:["governance-preset","governance_preset"],governance_ownership_enforcement:["governance-ownership-enforcement","governance_ownership_enforcement"],governance_create_mode_default:["governance-create-mode-default","governance_create_mode_default"],governance_close_validation_default:["governance-close-validation-default","governance_close_validation_default"],governance_require_close_reason:["governance-require-close-reason","governance_require_close_reason"],governance_create_default_type:["governance-create-default-type","governance_create_default_type"],governance_workflow_enforcement:["governance-workflow-enforcement","governance_workflow_enforcement"],governance_parent_reference_policy:["governance-parent-reference-policy","governance_parent_reference_policy"],governance_metadata_validation_profile:["governance-metadata-validation-profile","governance_metadata_validation_profile"],governance_force_required_for_stale_lock:["governance-force-required-for-stale-lock","governance_force_required_for_stale_lock"],test_result_tracking:["test-result-tracking","test_result_tracking"],telemetry_tracking:["telemetry-tracking","telemetry_tracking"],context:["context"]},ot=Object.keys(p).map(e=>p[e][0]),st=Object.fromEntries(Object.keys(p).flatMap(e=>p[e].map(t=>[t,e]))),lt={definition_of_done:"Definition of Done criteria list.",item_format:"Default item file format.",history_missing_stream_policy:"Missing history stream handling policy.",sprint_release_format_policy:"Sprint/release format validation policy.",parent_reference_policy:"Parent reference validation policy.",metadata_validation_profile:"Validate metadata profile policy (core|strict|custom).",metadata_required_fields:"Validate custom metadata required-fields list.",lifecycle_stale_blocker_reason_patterns:"Validate lifecycle stale-blocker reason substring patterns (criteria list).",lifecycle_closure_like_blocked_reason_patterns:"Validate lifecycle closure-like blocked_reason substring patterns (criteria list).",lifecycle_closure_like_resolution_patterns:"Validate lifecycle closure-like resolution substring patterns (criteria list).",lifecycle_closure_like_actual_result_patterns:"Validate lifecycle closure-like actual_result substring patterns (criteria list).",governance_preset:"Governance preset policy (minimal|default|strict|custom).",governance_ownership_enforcement:"Governance ownership enforcement policy (none|warn|strict).",governance_create_mode_default:"Governance default create mode (progressive|strict).",governance_close_validation_default:"Governance default close validation mode (off|warn|strict).",governance_require_close_reason:"Governance close-reason requirement policy (enabled|disabled).",governance_create_default_type:"Governance default item type for `pm create` when --type is omitted.",governance_workflow_enforcement:"Governance per-type transition enforcement mode (off|warn|strict).",governance_parent_reference_policy:"Governance parent reference policy (warn|strict_error).",governance_metadata_validation_profile:"Governance metadata validation profile (core|strict|custom).",governance_force_required_for_stale_lock:"Governance stale-lock force policy (enabled|disabled).",test_result_tracking:"Item-level linked test result persistence policy.",telemetry_tracking:"Telemetry usage reporting policy.",context:"Context command settings (depth, section toggles, limits)."},ct=["lifecycle_stale_blocker_reason_patterns","lifecycle_closure_like_blocked_reason_patterns","lifecycle_closure_like_resolution_patterns","lifecycle_closure_like_actual_result_patterns"],_t=new Set(["metadata_required_fields",...ct]),ft=new Set(["test_result_tracking","telemetry_tracking"]),dt=new Set(["governance_require_close_reason","governance_force_required_for_stale_lock"]),ut=new Set(["governance_ownership_enforcement","governance_create_mode_default","governance_close_validation_default"]),mt=new Set(["governance_parent_reference_policy","governance_metadata_validation_profile","governance_workflow_enforcement"]),gt=new Set(["governance_preset","governance_create_default_type"]),he=e=>_t.has(e),pt=e=>ut.has(e),yt=e=>mt.has(e),ht=e=>gt.has(e);function $(e){return e==="definition_of_done"||he(e)}function ve(e){if(ge.includes(e))return e;throw new c(`Invalid config scope "${e}". Allowed: ${ge.join(", ")}`,l.USAGE)}function we(e){if(e==="get"||e==="set"||e==="list"||e==="export")return e;throw Q({command_path:"config",token:e.trim()||"<empty>",allowed:["export","get","list","set"],token_kind:"action"})}function ke(e){let t=st[e];if(t)return t;let r=q.map(n=>n.key).join(", ");throw new c(`Invalid config key "${e}". Supported: ${ot.join(", ")} (underscore variants also accepted). Nested leaf settings: ${r}.`,l.USAGE)}function be(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 c("Config set definition-of-done cannot combine --clear-criteria with --criterion values",l.USAGE);return[]}if(r.length===0)throw new c("Config set definition-of-done requires at least one non-empty --criterion value (or --clear-criteria to clear)",l.USAGE);return r}function Ce(e){let t=e?.trim().toLowerCase();if(t==="toon")return"toon";throw t==="json_markdown"?new c("Config set item-format no longer accepts json_markdown. Markdown item files are legacy read/migration input only.",l.USAGE):new c("Config set item-format requires --format toon",l.USAGE)}function U(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="auto_create"||t==="strict_error")return t;throw new c("Config set history-missing-stream-policy requires --policy with one of: auto_create, strict_error",l.USAGE)}function z(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new c("Config set test-result-tracking requires --policy with one of: enabled, disabled",l.USAGE)}function F(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new c("Config set telemetry-tracking requires --policy with one of: enabled, disabled",l.USAGE)}function P(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="core"||t==="strict"||t==="custom")return t;throw new c("Config set metadata-validation-profile requires --policy with one of: core, strict, custom",l.USAGE)}function j(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="minimal"||t==="default"||t==="strict"||t==="custom")return t;throw new c("Config set governance-preset requires --policy with one of: minimal, default, strict, custom",l.USAGE)}function M(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="none"||t==="warn"||t==="strict")return t;throw new c("Config set governance-ownership-enforcement requires --policy with one of: none, warn, strict",l.USAGE)}function K(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="progressive"||t==="strict")return t;throw new c("Config set governance-create-mode-default requires --policy with one of: progressive, strict",l.USAGE)}function V(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 c("Config set governance-close-validation-default requires --policy with one of: off, warn, strict",l.USAGE)}function Y(e){let t=typeof e=="string"?e.trim().toLowerCase().replaceAll("-","_"):void 0;if(t==="off"||t==="warn"||t==="strict")return t;if(t==="none"||t==="disabled")return"off";throw new c("Config set governance-workflow-enforcement requires one of: off, warn, strict",l.USAGE)}function B(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new c("Config set governance-force-required-for-stale-lock requires --policy with one of: enabled, disabled",l.USAGE)}function W(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new c("Config set governance-require-close-reason requires --policy with one of: enabled, disabled",l.USAGE)}function O(e,t){switch(e){case"history_missing_stream_policy":return U(t);case"sprint_release_format_policy":return N(t);case"parent_reference_policy":case"governance_parent_reference_policy":return C(t);case"metadata_validation_profile":case"governance_metadata_validation_profile":return P(t);case"governance_preset":return j(t);case"governance_ownership_enforcement":return M(t);case"governance_create_mode_default":return K(t);case"governance_close_validation_default":return V(t);case"governance_require_close_reason":return W(t);case"governance_workflow_enforcement":return Y(t);case"governance_force_required_for_stale_lock":return B(t);case"test_result_tracking":return z(t);case"telemetry_tracking":return F(t);default:return t.trim().toLowerCase().replaceAll("-","_")}}var pe={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"},vt=["author","acceptance_criteria","estimated_minutes","close_reason","reviewer","risk","confidence","sprint","release"];function Ee(e,t){let r=[...new Set((e??[]).map(a=>a.trim()).filter(a=>a.length>0))];if(t){if(r.length>0)throw new c("Config set metadata-required-fields cannot combine --clear-criteria with --criterion values",l.USAGE);return[]}if(r.length===0)throw new c("Config set metadata-required-fields requires at least one --criterion value (or --clear-criteria to clear)",l.USAGE);let n=r.map(a=>a.toLowerCase().replaceAll("-","_")),i=n.filter(a=>pe[a]===void 0);if(i.length>0)throw new c(`Config set metadata-required-fields received unsupported values: ${i.join(", ")}. Supported values: ${vt.join(", ")}`,l.USAGE);return[...new Set(n.map(a=>pe[a]))].sort((a,o)=>a.localeCompare(o))}function wt(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 c(`Config set ${p[e][0]} cannot combine --clear-criteria with --criterion values`,l.USAGE);return[]}if(n.length===0)throw new c(`Config set ${p[e][0]} requires at least one --criterion value (or --clear-criteria to clear)`,l.USAGE);return n}function Se(e){return[...new Set(e)].sort((t,r)=>t.localeCompare(r))}function kt(e,t){if(e==="list"||e==="export"){if(typeof t=="string"&&t.trim().length>0)throw new c(`Config action "${e}" does not accept <key>`,l.USAGE);return}if(typeof t!="string"||t.trim().length===0)throw new c(`Config action "${e}" requires <key>`,l.USAGE);return ke(t)}function Ae(e){if(!e)throw new c("Config action requires <key>",l.USAGE)}var bt={definition_of_done:e=>[...e.workflow.definition_of_done],item_format:e=>e.item_format,history_missing_stream_policy:e=>e.history.missing_stream,sprint_release_format_policy:e=>e.validation.sprint_release_format,parent_reference_policy:e=>e.validation.parent_reference,metadata_validation_profile:e=>e.validation.metadata_profile,metadata_required_fields:e=>[...e.validation.metadata_required_fields],lifecycle_stale_blocker_reason_patterns:e=>[...e.validation.lifecycle_stale_blocker_reason_patterns],lifecycle_closure_like_blocked_reason_patterns:e=>[...e.validation.lifecycle_closure_like_blocked_reason_patterns],lifecycle_closure_like_resolution_patterns:e=>[...e.validation.lifecycle_closure_like_resolution_patterns],lifecycle_closure_like_actual_result_patterns:e=>[...e.validation.lifecycle_closure_like_actual_result_patterns],governance_preset:e=>e.governance.preset,governance_ownership_enforcement:e=>e.governance.ownership_enforcement,governance_create_mode_default:e=>e.governance.create_mode_default,governance_close_validation_default:e=>e.governance.close_validation_default,governance_require_close_reason:e=>e.governance.require_close_reason?"enabled":"disabled",governance_create_default_type:e=>e.governance.create_default_type??"",governance_workflow_enforcement:e=>e.governance.workflow_enforcement??"off",governance_parent_reference_policy:e=>e.governance.parent_reference,governance_metadata_validation_profile:e=>e.governance.metadata_profile,governance_force_required_for_stale_lock:e=>e.governance.force_required_for_stale_lock?"enabled":"disabled",test_result_tracking:e=>e.testing.record_results_to_items?"enabled":"disabled",telemetry_tracking:e=>e.telemetry.enabled?"enabled":"disabled",context:e=>({default_depth:e.context.default_depth,activity_limit:e.context.activity_limit,stale_threshold_days:e.context.stale_threshold_days,sections:{...e.context.sections}})};function H(e,t){return bt[t](e)}function g(e,t){return t.length===0?e:{...e,warnings:t}}async function Ct(e,t){let r=process.cwd(),n=e==="project"?b(r,t.path):Z(r),i=x(n);if(e==="project"&&!await w(i))throw new c(`Tracker is not initialized at ${n}. Run pm init first.`,l.NOT_FOUND);return{pmRoot:n,settingsPath:i}}function Et(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 c(`Context section toggle must be true|false|enabled|disabled, got "${e}"`,l.USAGE)}function ye(e,t){let r=e.trim(),n=Number(r);if(/^\d+$/u.test(r)&&Number.isSafeInteger(n)&&n>0)return n;throw new c(`Context ${t} must be a positive integer`,l.USAGE)}async function St(e,t,r,n,i){let a=!1,o=e.context;if(t.defaultDepth!==void 0){let s=t.defaultDepth.trim().toLowerCase();if(!G.includes(s))throw new c(`Context --default-depth must be one of ${G.join("|")}`,l.USAGE);o.default_depth!==s&&(o.default_depth=s,a=!0)}if(t.activityLimit!==void 0){let s=ye(t.activityLimit,"--activity-limit");o.activity_limit!==s&&(o.activity_limit=s,a=!0)}if(t.staleThresholdDays!==void 0){let s=ye(t.staleThresholdDays,"--stale-threshold-days");o.stale_threshold_days!==s&&(o.stale_threshold_days=s,a=!0)}let _=[["hierarchy",t.sectionHierarchy],["activity",t.sectionActivity],["progress",t.sectionProgress],["blockers",t.sectionBlockers],["files",t.sectionFiles],["workload",t.sectionWorkload],["staleness",t.sectionStaleness],["tests",t.sectionTests]];for(let[s,f]of _){let m=Et(f);if(m!==void 0){let y=s;o.sections[y]!==m&&(o.sections[y]=m,a=!0)}}return a&&await k(r.pmRoot,e,"config:set:context"),g({scope:n,key:"context",context_settings:{default_depth:o.default_depth,activity_limit:o.activity_limit,stale_threshold_days:o.stale_threshold_days,sections:{...o.sections}},settings_path:r.settingsPath,changed:a},i)}function At(e,t,r){if(r.value!==void 0&&r.value!==t)throw new c(`Config set ${e} received both positional value "${t}" and --value "${r.value}". Pass only one.`,l.USAGE);return{...r,value:t}}function qe(e,t,r,n,i,a){if(i===void 0)return a;if(e!=="set")throw new c(`Config action "${e}" does not accept a positional value. Only "set" takes <value>.`,l.USAGE);if(typeof t!="string"||t.trim().length===0)throw new c('Config action "set" requires <key> before a positional <value>.',l.USAGE);if(n)return At(t,i,a);Ae(r);let o=fe(r,i);if(!o.routable)throw new c(o.reason,l.USAGE);if(o.flag==="criterion"){if(a.criterion!==void 0&&a.criterion.length>0)throw new c(`Config set ${t} received both positional value "${i}" and --criterion. Pass criteria via --criterion only when supplying more than one value.`,l.USAGE);return{...a,criterion:o.values}}if(o.flag==="format")return{...a,format:o.value};if(a.policy!==void 0&&O(r,a.policy)!==O(r,o.value))throw new c(`Config set ${t} received both positional value "${i}" and --policy "${a.policy}". Pass only one.`,l.USAGE);return{...a,policy:o.value}}function qt(e){let t=Object.keys(p).map(n=>({key:n,aliases:p[n],value_kind:n==="context"?"object":$(n)?"string_array":"enum",set_flags:n==="context"?["--default-depth","--activity-limit","--stale-threshold-days","--section-<name>"]:$(n)?["--criterion","--clear-criteria"]:n==="item_format"?["--format"]:["--policy"],summary:lt[n],value:H(e.settings,n)})),r=q.map(n=>({key:n.key,canonical_key:n.key.replaceAll("_","-"),path:n.path,kind:n.kind,value:T(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 g({scope:e.scope,keys:t,nested_settings:r,count:t.length,settings_path:e.target.settingsPath,changed:!1},e.warnings)}function Pt(e){let t=Object.fromEntries(Object.keys(p).map(r=>[r,H(e.settings,r)]));return g({scope:e.scope,values:t,settings_path:e.target.settingsPath,changed:!1},e.warnings)}function Gt(e,t){let r=H(e.settings,t),n={scope:e.scope,key:t,settings_path:e.target.settingsPath,changed:!1};return t==="item_format"?g({...n,format:e.settings.item_format,has_explicit_item_format:e.metadata.has_explicit_item_format},e.warnings):t==="context"?g({...n,context_settings:r},e.warnings):Array.isArray(r)?g({...n,criteria:r},e.warnings):g({...n,policy:r},e.warnings)}async function It(e,t,r,n){if(t==="get"){let _=T(e.settings,r);return g({scope:e.scope,key:r.key,nested_setting:{key:r.key,path:r.path,kind:r.kind,value:_},settings_path:e.target.settingsPath,changed:!1},e.warnings)}let i=n.value;if(typeof i!="string")throw new c(`Config set ${r.key} requires a value. Pass it positionally (\`pm config ${e.scope} set ${r.key} <value>\`) or via --value.`,l.USAGE);let a=ue(r,i);if(!a.ok)throw new c(a.error.message,l.USAGE);let o=me(e.settings,r,a.parsed.value);return o&&await k(e.target.pmRoot,e.settings,`config:set:${r.path}`),g({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 d(e,t,r){t&&await k(e.target.pmRoot,e.settings,r)}function L(e,t,r){return e!==r||t!==r}function u(e,t,r,n){return g({scope:e.scope,key:t,policy:r,settings_path:e.target.settingsPath,changed:n},e.warnings)}function D(e,t,r,n){return g({scope:e.scope,key:t,criteria:r,settings_path:e.target.settingsPath,changed:n},e.warnings)}async function Rt(e,t){let r=Ce(t.format),n=e.settings.item_format!==r||!e.metadata.has_explicit_item_format,i;if(n){let a=I(e.settings,R()),o=await ae(e.target.pmRoot,r,"config:set:item_format:migrate",a.type_to_folder,e.settings.schema);i={target_format:o.target_format,scanned:o.scanned,migrated:o.migrated,removed:o.removed,warnings:o.warnings},e.settings.item_format=r,await k(e.target.pmRoot,e.settings,"config:set:item_format")}return g({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 Nt(e,t,r){if(t==="history_missing_stream_policy"){let a=U(r.policy),o=e.settings.history.missing_stream!==a;return e.settings.history.missing_stream=a,await d(e,o,"config:set:history_missing_stream_policy"),u(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 d(e,o,"config:set:sprint_release_format_policy"),u(e,t,e.settings.validation.sprint_release_format,o)}if(t==="parent_reference_policy"){let a=C(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 d(e,o,"config:set:parent_reference_policy"),u(e,t,e.settings.validation.parent_reference,o)}let n=P(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 d(e,i,"config:set:metadata_validation_profile"),u(e,t,e.settings.validation.metadata_profile,i)}async function Tt(e,t,r){if(t==="metadata_required_fields"){let _=Ee(r.criterion,r.clearCriteria),s=_.length!==e.settings.validation.metadata_required_fields.length||_.some((f,m)=>f!==e.settings.validation.metadata_required_fields[m]);return e.settings.validation.metadata_required_fields=_,await d(e,s,"config:set:metadata_required_fields"),D(e,t,[...e.settings.validation.metadata_required_fields],s)}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=wt(t,r.criterion,r.clearCriteria),o=a.length!==i.length||a.some((_,s)=>_!==i[s]);return i.splice(0,i.length,...a),await d(e,o,`config:set:${t}`),D(e,t,[...i],o)}async function $t(e,t,r){if(t==="governance_preset"){let s=j(r.policy),f=e.settings.governance.preset!==s;return e.settings.governance.preset=s,await d(e,f,"config:set:governance_preset"),u(e,t,e.settings.governance.preset,f)}let n=typeof r.policy=="string",i=n?r.policy.trim():"";if(n&&i.length===0){let s=e.settings.governance.create_default_type!==void 0;return delete e.settings.governance.create_default_type,await d(e,s,"config:set:governance_create_default_type"),u(e,t,e.settings.governance.create_default_type??"",s)}if(i.length===0)throw new c('Config set governance-create-default-type requires an item type value (or an empty value "" to clear it)',l.USAGE);let a=I(e.settings,R()),o=J(i,a);if(!o)throw new c(re(i,a.types,te(e.target.pmRoot,e.settings.schema)),l.USAGE);let _=e.settings.governance.create_default_type!==o;return e.settings.governance.create_default_type=o,await d(e,_,"config:set:governance_create_default_type"),u(e,t,e.settings.governance.create_default_type,_)}async function Ot(e,t,r){if(t==="governance_ownership_enforcement"){let a=M(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 d(e,o,"config:set:governance_ownership_enforcement"),u(e,t,e.settings.governance.ownership_enforcement,o)}if(t==="governance_create_mode_default"){let a=K(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 d(e,o,"config:set:governance_create_mode_default"),u(e,t,e.settings.governance.create_mode_default,o)}let n=V(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 d(e,i,"config:set:governance_close_validation_default"),u(e,t,e.settings.governance.close_validation_default,i)}async function Lt(e,t,r){if(t==="governance_parent_reference_policy"){let a=C(r.policy),o=e.settings.governance.preset!=="custom"||L(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 d(e,o,"config:set:governance_parent_reference_policy"),u(e,t,e.settings.governance.parent_reference,o)}if(t==="governance_metadata_validation_profile"){let a=P(r.policy),o=e.settings.governance.preset!=="custom"||L(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 d(e,o,"config:set:governance_metadata_validation_profile"),u(e,t,e.settings.governance.metadata_profile,o)}let n=Y(r.policy),i=(e.settings.governance.workflow_enforcement??"off")!==n;return e.settings.governance.workflow_enforcement=n,await d(e,i,"config:set:governance_workflow_enforcement"),u(e,t,e.settings.governance.workflow_enforcement,i)}async function Dt(e,t,r){if(t==="governance_require_close_reason"){let _=W(r.policy)==="enabled",s=e.settings.governance.require_close_reason!==_;return e.settings.governance.require_close_reason=_,await d(e,s,"config:set:governance_require_close_reason"),u(e,t,e.settings.governance.require_close_reason?"enabled":"disabled",s)}let i=B(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 d(e,a,"config:set:governance_force_required_for_stale_lock"),u(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 _=z(r.policy)==="enabled",s=e.settings.testing.record_results_to_items!==_;return e.settings.testing.record_results_to_items=_,await d(e,s,"config:set:test_result_tracking"),u(e,t,e.settings.testing.record_results_to_items?"enabled":"disabled",s)}let i=F(r.policy)==="enabled",a=e.settings.telemetry.enabled!==i||!e.settings.telemetry.first_run_prompt_completed;return e.settings.telemetry.enabled=i,e.settings.telemetry.first_run_prompt_completed=!0,await d(e,a,"config:set:telemetry_tracking"),u(e,t,e.settings.telemetry.enabled?"enabled":"disabled",a)}async function zt(e,t,r){let n=be(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 d(e,i,"config:set:definition_of_done"),D(e,t,[...e.settings.workflow.definition_of_done],i)}async function Ft(e,t,r){if(r.clearCriteria===!0&&!$(t))throw new c("--clear-criteria is only supported with config set criteria-list keys",l.USAGE);return t==="item_format"?Rt(e,r):t==="context"?St(e.settings,r,e.target,e.scope,e.warnings):t==="definition_of_done"?zt(e,t,r):he(t)?Tt(e,t,r):ft.has(t)?Ut(e,t,r):dt.has(t)?Dt(e,t,r):pt(t)?Ot(e,t,r):yt(t)?Lt(e,t,r):ht(t)?$t(e,t,r):Nt(e,t,r)}async function dr(e,t,r,n,i,a){let o=ve(e),_=we(t),s=_==="get"||_==="set"?de(r):void 0,f=s?void 0:kt(_,r),m=qe(_,r,f,s,a,n),y=await Ct(o,i),{settings:h,metadata:Pe,warnings:Ge}=await ne(y.pmRoot),v={scope:o,target:y,settings:h,metadata:Pe,warnings:Se(Ge)};return s?It(v,_,s,m):_==="list"?qt(v):_==="export"?Pt(v):(Ae(f),_==="get"?Gt(v,f):Ft(v,f,m))}var ur={hasGovernanceValidationMirrorChange:L,applyPositionalValue:qe,normalizeAction:we,normalizeCriteria:be,normalizeGovernanceCloseValidationDefault:V,normalizeGovernanceCreateModeDefault:K,normalizeGovernanceForceRequiredForStaleLockPolicy:B,normalizeGovernanceOwnershipEnforcement:M,normalizeGovernancePreset:j,normalizeGovernanceRequireCloseReasonPolicy:W,normalizeGovernanceWorkflowEnforcement:Y,normalizeHistoryMissingStreamPolicy:U,normalizeItemFormat:Ce,normalizeKey:ke,normalizeMetadataRequiredFields:Ee,normalizePolicyForConflict:O,normalizeScope:ve,normalizeTelemetryTrackingPolicy:F,normalizeTestResultTrackingPolicy:z,normalizeValidateMetadataProfile:P,normalizeWarnings:Se};export{Bt as a,de as b,ue as c,T as d,me as e,dr as f,ur as g};
3
- //# sourceMappingURL=chunk-5UZZAJKR.js.map
3
+ //# sourceMappingURL=chunk-XYDDWBZN.js.map
@@ -0,0 +1,11 @@
1
+ import{b,c as I,d as F}from"./chunk-TSMWLCHS.js";import{C as oe,E as ie,b as V,d as te,j as A,l as ne}from"./chunk-CU25EQVV.js";import{B as T,Ua as J,ac as W,fb as Q,mc as K,oc as X,qc as Y,tc as Z,uc as ee,wc as ae,xa as q,xc as re,yc as se}from"./chunk-2RDVGYWE.js";import"./chunk-WYRZZ5ZE.js";import{Ac as k,C as u,Ch as R,E as p,Ke as O,Le as j,Of as S,Uf as v,Va as D,Wf as y,Xf as f,dm as h,fh as E,gh as C,gm as s,im as l,qm as L,rm as $,sm as G,tm as M,um as U,vm as N,wm as B,xm as z,ym as P,zm as H}from"./chunk-RS3IV2R6.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6ed80dad-480c-584f-9977-f0058fcfe5a3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb98131e-c0d5-5055-8ad4-b0df3824cfbb")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="72332f20-83db-5566-b130-ad4c21267fa9")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="85050f31-1e96-5ae9-88a3-77ce4b042cca")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ac3636d0-67b6-58f6-9f0a-a478f20b0ac5")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d6123f68-21a1-5a33-ac06-4893ca6ba20d")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b1affe9d-1c93-5641-be3b-c46a68b93e09")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f76a3502-b942-530f-95f5-b37f4c365e3c")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="35fa89cf-806d-5d6a-ad6b-dad1dc3f1457")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="14619397-8d05-59fb-9744-f78532b98d26")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="102d4534-fb3a-57a3-91d1-db344492b812")}catch{}})();function fe(e,t){return!t||t.size===0?!0:e==="context"?t.has("context")||t.has("ctx"):t.has(e)}function le(e){if(e===void 0)return;if(typeof e!="string")throw new p("List --format must be one of csv|table|json|ndjson|toon",u.USAGE);let t=e.trim().toLowerCase();if(t==="csv"||t==="table"||t==="json"||t==="ndjson"||t==="toon")return t;throw new p("List --format must be one of csv|table|json|ndjson|toon",u.USAGE)}function _(e,t,n,i=!1){if(t===void 0)return n;if(typeof t!="string")throw new p(`${e} --format must be one of ${i?"json|ndjson|toon":"json|toon"}`,u.USAGE);let a=t.trim().toLowerCase();if(a!=="json"&&(a!=="ndjson"||!i)&&a!=="toon")throw new p(`${e} --format must be one of ${i?"json|ndjson|toon":"json|toon"}`,u.USAGE);if(n.json===!0&&a==="toon")throw new p(`${e} cannot combine --json with --format toon`,u.USAGE);return{...n,json:a==="json"||a==="ndjson"}}function me(e,t){J[t]==="brief"&&e.includeBody!==!0&&e.compact!==!0&&e.brief!==!0&&e.full!==!0&&e.fields===void 0&&(e.brief=!0)}function de(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 ye={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 he(e,t){let n=e.stream===!0,i=le(e.format),a=i==="csv"||i==="table",o=i==="json"||i==="ndjson"||i==="toon"?_("List",e.format,t,!0):t;if(n&&!o.json)throw new p("--stream requires --json output mode.",u.USAGE);if((a||i==="ndjson")&&n)throw new p("--format csv|table|ndjson cannot be combined with --stream.",u.USAGE);return{streamMode:n,listFormat:i,effectiveGlobal:o}}function ge(e,t,n){if(n.listFormat==="csv"||n.listFormat==="table"){k(t);let i=t.items,a=n.listFormat==="csv"?E(i):C(i);!n.effectiveGlobal.quiet&&a.length>0&&v(`${a}
2
+ `)}else if(n.listFormat==="ndjson"){k(t);let i=I(t.items);!n.effectiveGlobal.quiet&&i.length>0&&v(`${i}
3
+ `)}else n.streamMode?G(e,t,n.effectiveGlobal):y(t,n.effectiveGlobal)}async function ve(e){let t=h(e.actionCommand),n=e.aliasContract?{...t,command:e.aliasContract.canonical}:t,i=Date.now();e.aliasContract?.lifecycle==="deprecated"&&await R(D(process.cwd(),n.path)).then(pe=>pe.ux.deprecation_hints)&&f(j(e.aliasContract));let a=S("list",e.options),o=L(a),r=e.name,d=e.status,m=e.dependencyBlocked===!0,c=e.excludeTerminal===!0,g=o.status?.trim().toLowerCase(),x=e.name==="list"&&g!==void 0?ye[g]:void 0;e.name==="list"&&(e.options.all===!0||g==="all"?(r="list-all",c=!1,o.status=void 0):g!==void 0&&x!==void 0&&(r=x.name,d=g,m=x.dependencyBlocked,c=!1,o.status=void 0)),me(o,r),Object.assign(o,{projectionCommand:r}),c&&(o.excludeTerminal=!0),o.dependencyBlocked=m;let ce=he(a,n),ue=await Q(m?void 0:d,o,n);ge("list",ue,ce),n.profile&&f(`profile:command=list took_ms=${Date.now()-i}`)}function be(e,t){let{name:n,description:i,status:a,excludeTerminal:o,allowStatusFilter:r,dependencyBlocked:d,aliasContract:m}=t,c=e.command(n,{hidden:m?.hidden===!0}).description(i);r&&c.option("--status <value>","Filter by status (repeatable or comma-separated; matches any; all selects every status)",s),n==="list"&&c.option("--all","Include every lifecycle status"),c.option("--for <intent>",`Apply a declared context intent projection. ${b("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>",'Filter by updated_at lower bound: ISO timestamp or signed relative (e.g. "-2h"/"-7d" for the past). "Changed since my last window" \u2192 --updated-after <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>","Limit returned item count").option("--offset <n>","Skip the first n matching rows before limit is applied").option("--after <cursor>","Continue after an opaque next_cursor from a previous list response").option("--no-truncate","Return every matched row after the explicit status and field filters").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","Ultra-compact output: id, status, type, title only (agent-optimized, mutually exclusive with --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). ${b(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)"),de(c),c.action(async(g,x)=>{await ve({name:n,status:a,excludeTerminal:o,dependencyBlocked:d,options:g,actionCommand:x,aliasContract:m})}),l(c,"--tags <value>","Alias for --tag"),l(c,"--assignee_filter <value>","Alias for --assignee-filter"),l(c,"--tree_depth <n>","Alias for --tree-depth"),l(c,"--token_budget <n>","Alias for --token-budget"),l(c,"--filter-estimate-missing","Alias for --filter-estimates-missing")}async function we(e,t){let n=h(t),i=Date.now(),a=await V($(e),n);y(a,n),n.profile&&f(`profile:command=aggregate took_ms=${Date.now()-i}`)}async function xe(e,t){let n=h(t),i=Date.now(),a=P(S("context",e)),o=await X(a,n),r=W(a,n);if(r==="markdown")n.quiet||v(`${K(o)}
4
+ `);else if(r==="ndjson"){k(o);let d=I([...o.high_level,...o.low_level,...o.blocked_fallback]);!n.quiet&&d.length>0&&v(`${d}
5
+ `)}else y(o,{...n,json:r==="json"});n.profile&&f(`profile:command=context took_ms=${Date.now()-i}`)}async function ke(e,t){let n=h(t),i=Date.now(),a=H(S("next",e)),o=await Z(a,n),r=Y(a,n);r==="markdown"?n.quiet||v(`${ee(o)}
6
+ `):y(o,{...n,json:r==="json"}),n.profile&&f(`profile:command=next took_ms=${Date.now()-i}`)}async function Se(e,t,n){let i=h(n),a=Date.now(),o=N(e),r=S("search",t,[o]),d=U(r),m=await oe(o,{...d,mode:typeof d.mode=="string"&&d.mode.trim().length>0?d.mode:"keyword"},i),c=typeof r.format=="string"?r.format.trim().toLowerCase():void 0,g=_("Search",r.format,i,!0);if(c==="ndjson"){k(m);let x=I(m.items);!g.quiet&&x.length>0&&v(`${x}
7
+ `)}else y(m,g);i.profile&&f(`profile:command=search took_ms=${Date.now()-a}`)}async function _e(e,t){let n=h(t),i=Date.now(),a=await ie({mode:typeof e.mode=="string"?e.mode:void 0,k:typeof e.k=="string"?e.k:void 0,failUnder:typeof e.failUnder=="string"?e.failUnder:void 0,queries:typeof e.queries=="string"?e.queries:void 0,format:typeof e.format=="string"?e.format:void 0},n);if(y(a,_("Eval",e.format,n)),n.profile&&f(`profile:command=eval took_ms=${Date.now()-i}`),!a.passed)throw new p(`Eval gate failed: aggregate nDCG@${a.k} ${a.aggregate.ndcg} is below --fail-under ${a.fail_under}`,u.GENERIC_FAILURE)}async function Ie(e,t,n){let i=h(n),a=Date.now(),o=S("get",t,[e]),r=await A(e,i,{depth:typeof o.depth=="string"?o.depth:void 0,fields:typeof o.fields=="string"?o.fields:void 0,full:!!o.full,tree:o.tree===!0,treeDepth:typeof o.treeDepth=="string"?o.treeDepth:typeof o.tree_depth=="string"?o.tree_depth:void 0,at:typeof o.at=="string"?o.at:void 0});y(r,_("Get",o.format,i)),i.profile&&f(`profile:command=get took_ms=${Date.now()-a}`)}async function Ae(e,t,n){let i=h(n),a=Date.now();if([t.compact,t.raw,t.full,t.provenance].filter(m=>m===!0).length>1)throw new p("History projection options are mutually exclusive. Use --compact, --provenance, or --full.",u.USAGE);let o=typeof t.field=="string"?t.field:void 0,r=!!t.strictExit||!!t.failOnWarn;if(r&&!t.verify)throw new p("--strict-exit requires --verify (it gates on the verification result).",u.USAGE);let d=await te(e,{limit:typeof t.limit=="string"?t.limit:void 0,compact:!(t.full===!0||t.provenance===!0),provenance:t.provenance===!0,provenanceSummary:t.provenanceSummary===!0,harness:w(t,"harness"),agentInstance:w(t,"agentInstance"),provenanceFilter:w(t,"provenanceFilter"),diff:!!t.diff||o!==void 0,field:o,verify:!!t.verify},i);y(d,_("History",t.format,i)),r&&d.verification&&!d.verification.ok&&(process.exitCode=u.GENERIC_FAILURE),i.profile&&f(`profile:command=history took_ms=${Date.now()-a}`)}function w(e,t){let n=e[t];return Array.isArray(n)?n:void 0}function Fe(e,t){let n=w(e,"harness"),i=w(e,"agentInstance"),a=w(e,"provenanceFilter"),o=typeof e.cursorMode=="string"?e.cursorMode:void 0;if(o!==void 0&&o!=="batch"&&o!=="row")throw new p("Events --cursor-mode must be batch or row.",u.USAGE,{code:"invalid_event_cursor_mode"});let r=o;return{pmRoot:t,since:typeof e.since=="string"?e.since:void 0,type:w(e,"type"),author:w(e,"author"),item:w(e,"item"),limit:typeof e.limit=="string"?Number(e.limit):void 0,full:e.full===!0,...e.provenance===!0?{provenance:!0}:{},...e.provenanceSummary===!0?{provenanceSummary:!0}:{},...n===void 0?{}:{harness:n},...i===void 0?{}:{agentInstance:i},...a===void 0?{}:{provenanceFilter:a},cursorMode:r}}async function De(e,t,n){if(t.provenanceSummary===!0)throw new p("Events --provenance-summary is bounded to one page and cannot be combined with --follow.",u.USAGE);let i=typeof t.intervalMs=="string"?Number(t.intervalMs):void 0;if(e.cursorMode==="row"){for await(let a of se({...e,intervalMs:i}))n||v(`${JSON.stringify(a)}
8
+ `);return}for await(let a of re({...e,intervalMs:i}))n||v(`${F(a.events,{count:a.count,has_more:a.has_more,next_cursor:a.next_cursor??null,source:a.source,heartbeat:a.count===0})}
9
+ `)}function Oe(e){return e.cursor_mode==="row"?I(e.events):F(e.events,{count:e.count,has_more:e.has_more,next_cursor:e.next_cursor??null,source:e.source,...e.provenance_summary===void 0?{}:{provenance_summary:e.provenance_summary}})}async function je(e,t){let n=h(t),i=Date.now(),a=Fe(e,n.path);if(e.follow===!0){await De(a,e,n.quiet===!0);return}let o=await ae(a);if(k(o),n.json){y(o,n),n.profile&&f(`profile:command=events took_ms=${Date.now()-i}`);return}let r=Oe(o);!n.quiet&&r.length>0&&v(`${r}
10
+ `),n.profile&&f(`profile:command=events took_ms=${Date.now()-i}`)}async function Ee(e,t){let n=h(t),i=Date.now();if([e.raw,e.compact,e.full,e.provenance].filter(d=>d===!0).length>1)throw new p("Activity projection options are mutually exclusive. Use --raw, --compact, --provenance, or --full.",u.USAGE);let a=z(e.stream);if(a&&!n.json)throw new p("--stream requires --json output mode.",u.USAGE);let o=B(e),r=await T(a&&e.full!==!0&&e.provenance!==!0?{...o,raw:!0,compact:!0}:o,n);a?M(r,o,n):y(r,n),n.profile&&f(`profile:command=activity took_ms=${Date.now()-i}`)}async function Ce(e,t,n,i,a){let o=h(a),r=Date.now(),d=await q(e,t,n,{...Array.isArray(i.kind)?{kind:i.kind}:{},maxDepth:typeof i.maxDepth=="string"?i.maxDepth:void 0,limit:typeof i.limit=="string"?i.limit:void 0,after:typeof i.after=="string"?i.after:void 0,direction:typeof i.direction=="string"?i.direction:void 0,maxPaths:typeof i.maxPaths=="string"?i.maxPaths:void 0,sample:typeof i.sample=="string"?i.sample:void 0,...Array.isArray(i.exemptIsolate)?{exemptIsolate:i.exemptIsolate}:{},...Array.isArray(i.exemptIsolateType)?{exemptIsolateType:i.exemptIsolateType}:{},saveBaseline:i.saveBaseline===!0,rebuild:i.rebuild===!0,clear:i.clear===!0,summary:i.summary===!0,full:i.full===!0},o);y(d,o),o.profile&&f(`profile:command=graph took_ms=${Date.now()-r}`)}function wt(e,t){let n=t?.commandFilter,i=o=>fe(o,n),a=[{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 o of a)if(i(o.name)){let r=O(o.name);be(e,{...o,...r?.registration==="commander"?{aliasContract:r}:{}})}if(i("aggregate")){let o=e.command("aggregate").description("Aggregate grouped item counts for governance queries.").option("--group-by <value>","Comma-separated group-by fields (supported: parent,type,priority,status,assignee,tags,sprint,release)").option("--count","Return grouped counts (default behavior)").option("--completion","Add open/in_progress/closed/other counts and completion_pct per group").option("--sum <field>","Sum a numeric field per group").option("--avg <field>","Average a numeric field per group").option("--include-unparented","Include unparented rows when grouping by parent").option("--status <value>","Filter by item status").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("--assignee <value>","Filter by assignee").option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--parent <value>","Filter by parent item ID").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release");l(o,"--include_unparented","Alias for --include-unparented"),l(o,"--assignee_filter <value>","Alias for --assignee-filter"),o.action(we)}if(i("context")){let o=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. ${b("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>","Continue ranked focus after a next_cursor from a previous context response").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>","Maximum estimated tokens spent on ranked focus rows").option("--no-extension-health","Omit the installed extension health summary").option("--no-tags","Omit tag arrays from context focus rows");l(o,"--assignee_filter <value>","Alias for --assignee-filter"),l(o,"--max-items <n>","Alias for --limit"),l(o,"--explain_ranking","Alias for --explain-ranking"),l(o,"--token_budget <n>","Alias for --token-budget"),o.action(xe)}if(i("next")){let o=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. ${b("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("--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(o,"--assignee_filter <value>","Alias for --assignee-filter"),l(o,"--blocked_limit <n>","Alias for --blocked-limit"),l(o,"--ready_only","Alias for --ready-only"),l(o,"--explain_ranking","Alias for --explain-ranking"),l(o,"--token_budget <n>","Alias for --token-budget"),o.action(ke)}if(i("search")){let o=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. ${b("search","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--mode <value>","Search mode: keyword|semantic|hybrid (default: keyword)").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). ${b("search","--fields")}`).option("--format <value>","Search output format override: json|ndjson|toon").option("--limit <n>","Limit returned item count").option("--after <cursor>","Continue after an opaque next_cursor from a previous search response");de(o),o.action(Se),l(o,"--tags <value>","Alias for --tag"),l(o,"--token_budget <n>","Alias for --token-budget")}if(i("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 (${ne}); default: search/eval-queries.json; errors show an example`).option("--format <value>","Eval output format override: json|toon").action(_e),i("get")){let o=e.command("get").argument("<id>","Item id").option("--for <intent>",`Apply a declared context intent projection. ${b("get","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--depth <value>","Detail depth: brief|standard|deep|full (full aliases deep; default: standard)").option("--full","Explicit full item read; equivalent to --depth deep (mutually exclusive with --depth/--fields)").option("--fields <value>",`Render custom comma-separated item metadata fields. ${b("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(Ie);l(o,"--tree_depth <n>","Alias for --tree-depth"),l(o,"--token_budget <n>","Alias for --token-budget")}i("history")&&e.command("history").argument("<id>","Item id").option("--limit <n>","Return only the latest n history entries").option("--compact","Condensed output: show entry index, timestamp, op, author, patch count, and changed fields").option("--full","Show full history entries with JSON Patch payloads").option("--provenance","Show 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("--diff","Include per-entry field-level before/after value diffs computed by replaying the history chain").option("--field <name>","With --diff, show only entries that changed this field (implies --diff)").option("--verify","Verify hash chain and replay integrity for the full history stream").option("--strict-exit","With --verify, exit nonzero when verification fails (merge-safety gate parity with pm validate)").option("--fail-on-warn","Alias for --strict-exit").option("--format <value>","History output format override: json|toon").description("Show item history entries.").action(Ae),i("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>","Cursor framing: batch emits one terminal trailer (default); row preserves one cursor per event").option("--full","Include each complete authoritative history entry").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","Continue emitting committed events as newline-delimited JSON").option("--interval-ms <n>","Empty-read delay while following (minimum: 10ms; default: 250ms)").description("Emit cursor-resumable committed mutation facts as newline-delimited JSON.").action(je),i("activity")&&e.command("activity").option("--id <value>","Filter by item ID").option("--op <value>","Filter by history operation").option("--author <value>","Filter by history author").option("--from <value>","Lower timestamp bound (ISO/date string or relative)").option("--to <value>","Upper timestamp bound (ISO/date string or relative)").option("--limit <n>","Return only the latest n activity entries").option("--unbounded","Explicitly return every matching activity entry (disables the default bound)").option("--compact","Condensed output: show only id, op, ts, author, msg per entry").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 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("--stream [mode]","Emit line-delimited JSON rows (requires --json). Optional mode: rows|ndjson|jsonl").description("Show recent activity across items.").action(Ee),i("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(Ce)}var xt={resolveReadCommandOutputFormat:_,parseListFormat:le};export{xt as _testOnlyRegisterListQuery,wt as registerListQueryCommands};
11
+ //# sourceMappingURL=register-list-query-JSAQCVOC.js.map
@@ -0,0 +1,20 @@
1
+ import{a as ue,c as Ve,d as ce,f as ze,g as Je,h as Ke}from"./chunk-7BRF2BX2.js";import{$ as re,B as Fe,Ba as le,C as Y,Ca as de,D as Pe,Da as je,E as Ne,F as $e,G as He,H as Ue,I as Ge,L as qe,M as Z,N as Q,O as ee,V as te,W as oe,Y as ie,Z as ne,_ as ae,qa as Ht,ra as Lt,sa as Bt,ta as Ut,ua as Gt,va as qt,wa as jt,xa as Vt,ya as zt,za as se}from"./chunk-L4LGPBJU.js";import"./chunk-XYDDWBZN.js";import"./chunk-CU25EQVV.js";import"./chunk-QWRRFYK3.js";import{Ka as Re,La as Ie,Na as Te,Oa as Ee,Pa as Oe,bc as Le,ec as Be,ga as De,qa as X,yb as Me}from"./chunk-BLVQHFSY.js";import{$ as xt,I as rt,J as st,K as lt,L as dt,M as ut,N as ct,O as pt,P as ft,Q as mt,R as yt,S as gt,T as ht,U as vt,V as bt,W as wt,X as kt,Y as At,Z as St,_ as _t,aa as Ct,ba as Dt,ca as Rt,da as It,ea as Tt,fa as Et,ga as Ot,ha as Ft,ia as Mt,ja as Pt,ka as Nt,la as $t,w as W}from"./chunk-US2ZQW2M.js";import{T as xe,i as V}from"./chunk-2RDVGYWE.js";import"./chunk-WYRZZ5ZE.js";import{$l as F,Am as v,C as c,Ch as G,E as f,Fa as ke,Gg as U,Rl as _e,Uf as w,Va as O,Wf as p,Xd as L,Xf as h,Yg as D,Yi as q,Zi as Ae,a as be,ca as E,de as B,dm as m,gm as d,hm as s,im as _,jm as M,ka as we,mm as z,nm as J,om as K,pm as Ce,rh as at,sj as j,vj as Se}from"./chunk-RS3IV2R6.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="8bc9436f-c101-583d-ae42-02d51b5eb027")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="d79c73c8-07a5-5a39-aca5-4058264684d6")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f439176a-7297-5235-b96a-3e393af8602b")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="51b91e68-4bd6-521d-926e-e3b03f4b4956")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="e8b566c3-db93-54d7-a917-38bf317cb575")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="d9bb2d77-9ea1-51f9-a186-a2c222a6fbb3")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="41658a2a-e730-5c0c-9783-70b30ee9b2fc")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="890d56e2-d85f-5d29-90b3-1d832210ea09")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="2fa91bad-9a89-5c42-8b0f-dbcd2728c563")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="13a390ed-dac6-51bc-aeee-17f601e73282")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="c916e9b2-d840-585e-b7e2-120b677c7498")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f3dbfd7a-f028-5927-b62d-2f078389f06d")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="49eb11f2-6d0e-59e6-9b7d-3a1515229879")}catch{}})();var P={};be(P,{PROFILE_SUBCOMMANDS:()=>Ht,formatProfileApplyHuman:()=>zt,formatProfileLintHuman:()=>Vt,formatProfileListHuman:()=>qt,formatProfileShowHuman:()=>jt,runProfileApply:()=>Gt,runProfileLint:()=>Ut,runProfileList:()=>Lt,runProfileShow:()=>Bt});(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="faf8a076-fe77-5017-b570-a49e7031ee0d")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="bb095de1-0784-5659-9d73-91fd0a033c7d")}catch{}})();var N={};be(N,{SCHEMA_SUBCOMMANDS:()=>dt,_testOnlySchemaCommand:()=>$t,buildInvalidTypeHint:()=>at,ensureTypeFolderScaffold:()=>pt,formatSchemaAddFieldHuman:()=>Et,formatSchemaAddStatusHuman:()=>Ct,formatSchemaAddTypeHuman:()=>_t,formatSchemaApplyPresetHuman:()=>Pt,formatSchemaEvolutionMigrationHuman:()=>lt,formatSchemaInferTypesHuman:()=>Nt,formatSchemaListFieldsHuman:()=>Ft,formatSchemaListHuman:()=>Rt,formatSchemaRemoveFieldHuman:()=>Ot,formatSchemaRemoveStatusHuman:()=>Dt,formatSchemaRemoveTypeHuman:()=>xt,formatSchemaShowFieldHuman:()=>Mt,formatSchemaShowHuman:()=>It,formatSchemaShowStatusHuman:()=>Tt,planSchemaEvolutionMigration:()=>rt,runSchemaAddField:()=>vt,runSchemaAddStatus:()=>ft,runSchemaAddType:()=>ut,runSchemaApplyPreset:()=>At,runSchemaEvolutionMigration:()=>st,runSchemaInferTypes:()=>St,runSchemaList:()=>yt,runSchemaListFields:()=>wt,runSchemaRemoveField:()=>bt,runSchemaRemoveStatus:()=>mt,runSchemaRemoveType:()=>ct,runSchemaShow:()=>gt,runSchemaShowField:()=>kt,runSchemaShowStatus:()=>ht});(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="926afd8a-6d7c-503f-a82f-0ef1f4d66c85")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="8052e529-7849-58b1-8ff2-94be44af3ca9")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="e6b32b75-4618-5270-a79a-8564e97c7f3b")}catch{}})();async function pe(t){t.description==="-"&&(t.description=await D().resolveValue("-","--description")??"")}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="3b23ded4-a821-5ff0-8783-927875d0457b")}catch{}})();async function Jt(t,e,o,i){let n=m(i),r=await je(t,e,{status:typeof o.status=="string"?o.status:void 0,author:typeof o.author=="string"?o.author:n.author,message:typeof o.message=="string"?o.message:void 0,force:o.force===!0},n);await v(n,r),p(r,n)}async function Kt(t,e){let o=m(e),i=await D().resolveValue("-","--stdin-json");if(i===void 0||i.trim().length===0)throw new f("pm item mutate requires a non-empty JSON batch on stdin.",c.USAGE);let n=typeof t.transactionId=="string"?t.transactionId.trim():"";if(n.length===0)throw new f("pm item mutate requires --transaction-id <value>.",c.USAGE);let r=O(process.cwd(),o.path),a=await G(r),l=Ve(i,{transactionId:n,idPrefix:a.id_prefix}),{mutations:u,references:y}=l,b=ue(t);if(t.dryRun===!0){p({transaction_id:n,dry_run:!0,mutation_count:u.length,mutations:u,references:y},o);return}let k=await ze({pmRoot:r,transactionId:n,author:L(typeof t.author=="string"?t.author:o.author,a.author_default),mutations:u,...b});p({...k,mutation_count:u.length,references:y},o)}function Wt(t,e){return typeof t=="string"&&t.trim().length>0?t.trim():typeof e=="string"?e.trim():""}async function Xt(t,e,o,i){let n=m(i),r=typeof o.transactionId=="string"?o.transactionId.trim():"";if(r.length===0)throw new f("pm item complete requires --transaction-id <value>.",c.USAGE);let a=Wt(e,o.reason);if(a.length===0)throw new f("pm item complete requires a close reason.",c.USAGE);let u=Object.fromEntries(["file","doc","test","comment","note","learning"].filter(S=>o[S]!==void 0).map(S=>[S,o[S]])),y=o.force===!0,{lockTtlSeconds:b,lockWaitMs:k}=ue(o),g={...typeof o.resolution=="string"?{resolution:o.resolution}:{},...typeof o.expectedResult=="string"?{expectedResult:o.expectedResult}:{},...typeof o.actualResult=="string"?{actualResult:o.actualResult}:{},...typeof o.completedAt=="string"?{completedAt:o.completedAt}:{},...typeof o.validateClose=="string"?{validateClose:o.validateClose}:{},...y?{force:!0}:{}},R={id:t,reason:a,...Object.keys(u).length===0?{}:{evidence:u},...Object.keys(g).length===0?{}:{closeOptions:g},...y?{releaseOptions:{force:!0}}:{}};if(o.dryRun===!0){let S=Je(R);p({transaction_id:r,dry_run:!0,mutation_count:S.length,mutations:S},n);return}let A=O(process.cwd(),n.path),I=await Ke({pmRoot:A,transactionId:r,author:L(typeof o.author=="string"?o.author:n.author,(await G(A)).author_default),...R,lockTtlSeconds:b,lockWaitMs:k});p({...I,mutation_count:Object.keys(I.results).length},n)}function We(t){let e=t.commands.find(o=>o.name()==="item")??t.command("item").description("Run item lifecycle operations.");e.command("reopen <id> <reason>").option("--status <value>","Active target status: open or in_progress").option("--message <value>","Human-readable recurrence history message").option("--force","Override ownership or stale-lock conflicts").option("--author <value>","Mutation author").description("Reopen terminal work with recurrence evidence.").action(Jt),e.command("mutate").requiredOption("--transaction-id <value>","Stable idempotency key used to resume an interrupted batch").option("--stdin-json","Read the JSON mutation array from stdin",!0).option("--dry-run","Validate and preview the batch without writing").option("--create-compensation <mode>","Created-item compensation policy: close or delete","close").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--author <value>","Mutation author").description("Apply SDK-backed mutations atomically.").action(Kt),e.command("complete <id> [reason]").requiredOption("--transaction-id <value>","Stable idempotency key for the composed completion").option("--reason <value>","Close reason when omitted positionally").option("--file <value>","Linked file evidence",d).option("--doc <value>","Linked documentation evidence",d).option("--test <value>","Linked test evidence",d).option("--comment <value>","Evidence comment",d).option("--note <value>","Completion note",d).option("--learning <value>","Durable completion learning",d).option("--resolution <value>","Structured resolution evidence").option("--expected-result <value>","Expected result evidence").option("--actual-result <value>","Actual result evidence").option("--completed-at <value>","Actual completion time").option("--validate-close <mode>","Close validation: off, warn, or strict").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--dry-run","Validate and preview completion without writing").option("--force","Override lifecycle and ownership conflicts").option("--author <value>","Completion author").description("Close with evidence and release the claim.").action(Xt)}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="2745d577-4f6c-5b9e-b54a-e1451e022d63")}catch{}})();async function Yt(t,e){let o=m(e),i=Array.isArray(t.event)?t.event:[],n=await De(O(process.cwd(),o.path),{historyEvent:i,allActionable:t.allActionable===!0,dryRun:t.dryRun===!0,planFingerprint:s(t,"planFingerprint"),limit:t.limit,attributedAuthor:s(t,"attributedAuthor"),reviewer:s(t,"reviewer"),reason:s(t,"reason")});p(n,o)}function Xe(t){t.command("history-author-acknowledge").option("--event <item-id:line>","Unknown-author event coordinate (repeatable)",d).option("--all-actionable","Select all actionable events").option("--dry-run","Preview a deterministic source-bound plan").option("--plan-fingerprint <sha256>","Apply the exact fingerprint returned by --dry-run").option("--limit <n>","Maximum coordinate rows returned in the plan").option("--attributed-author <value>","Reviewed principal attribution").option("--reviewer <value>","Disposition reviewer").option("--reason <value>","Review evidence").description("Append audited dispositions for immutable unknown-author events.").action(Yt)}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="d436d524-7827-5ca7-8542-dd579813fae1")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="2d8a7e66-16e7-552f-b6d8-4cfbfb519a30")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="6bbab815-17b8-5f27-8842-41d6132488b2")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="8166a37c-7673-5ad4-a042-28ca34d65aa4")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="616fff4b-f86e-54e5-b569-0b9894da5221")}catch{}})();function fe(t,e,o,i){if(e.trim().toLowerCase()!=="add"||!o?.trim())return;let n=s(i,"add")??s(i,"note")??s(i,"body")??s(i,"comment"),r=s(i,"file"),a=[t,o.trim()];n!==void 0?a.push("--add",n):i.stdin===!0?a.push("--stdin"):r!==void 0?a.push("--file",r):a.push("--add","-");let l=B(a),u=B([t,o.trim(),"--add","-"]);throw new f(`The positional token "add" was parsed as the item id, while "${o.trim()}" was parsed as annotation text. ${t} does not use an add subcommand.`,c.USAGE,{code:"annotation_transposed_subcommand",reason:"noun_verb_object_transposition",required:`Place the item id immediately after ${t}, then use --add for annotation text.`,examples:[...new Set([l,u])],recovery:{attempted_command:`pm ${t} add ${o.trim()}`,normalized_args:[t,"add",o.trim()],parsed_positionals:[{role:"transposed_subcommand",value:"add"},{role:"item_id",value:o.trim()}],suggested_retry:l}})}function Zt(t,e){let o=typeof e.edit=="number"?e.edit:void 0,i=typeof e.delete=="number"?e.delete:void 0,n=s(e,"add")??s(e,"body")??s(e,"comment"),r=typeof t=="string"?t:void 0,a=e.stdin===!0,l=s(e,"file");if(+(n!==void 0)+ +(r!==void 0)+Number(a)+ +(l!==void 0)>1)throw n!==void 0&&r!==void 0&&!a&&l===void 0?new f("Specify comment text either as positional [text] or with --add, not both",c.USAGE):new f("Specify comment text with exactly one source: positional [text], --add, --stdin, or --file",c.USAGE);let y=n??r;return{add:y,readFromStdin:a,readFromFile:l,editIndex:o,deleteIndex:i,isMutation:typeof y=="string"||a||l!==void 0||o!==void 0||i!==void 0}}function Ye(t,e,o){let i=s(o,"add"),n=t==="note"?s(o,"note"):void 0;if(i!==void 0&&n!==void 0&&i!==n)throw new f("Specify note text with either --add or --note, not conflicting values for both aliases",c.USAGE,{code:"annotation_alias_conflict"});let r=i??n,a=typeof e=="string"?e:void 0;if(r!==void 0&&a!==void 0)throw new f(`Specify ${t} text either as positional [text] or with --add, not both`,c.USAGE);return r??a}async function Qt(t,e,o,i){let n=m(i),r=Date.now();fe("comments",t,e,o);let a=Zt(e,o),l=await Ne(t,{add:a.add,stdin:a.readFromStdin,file:a.readFromFile,edit:a.editIndex,delete:a.deleteIndex,limit:s(o,"limit"),fullHistory:o.fullHistory===!0,author:s(o,"author"),message:s(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},n);a.isMutation&&await v(n,l),me("comments",l,n,r)}async function eo(t,e,o,i){let n=m(i),r=Date.now();fe("notes",t,e,o);let a=Ye("note",e,o),l=await He(t,{add:a,addJson:s(o,"addJson"),stdin:o.stdin===!0,file:s(o,"file"),edit:typeof o.edit=="number"?o.edit:void 0,delete:typeof o.delete=="number"?o.delete:void 0,limit:s(o,"limit"),since:s(o,"since"),eventType:s(o,"eventType"),includeMeta:o.includeMeta===!0,fullHistory:o.fullHistory===!0,author:s(o,"author"),message:s(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},n);(typeof a=="string"||typeof o.addJson=="string"||o.stdin===!0||typeof o.file=="string"||typeof o.edit=="number"||typeof o.delete=="number")&&await v(n,l),me("notes",l,n,r)}async function to(t,e,o,i){let n=m(i),r=Date.now();fe("learnings",t,e,o);let a=Ye("learning",e,o),l=await $e(t,{add:a,stdin:o.stdin===!0,file:s(o,"file"),edit:typeof o.edit=="number"?o.edit:void 0,delete:typeof o.delete=="number"?o.delete:void 0,limit:s(o,"limit"),fullHistory:o.fullHistory===!0,author:s(o,"author"),message:s(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},n);(typeof a=="string"||o.stdin===!0||typeof o.file=="string"||typeof o.edit=="number"||typeof o.delete=="number")&&await v(n,l),me("learnings",l,n,r)}function me(t,e,o,i){p(e,o),o.profile&&h(`profile:command=${t} took_ms=${Date.now()-i}`)}function Ze(t,e){let o=t.command("comments").argument("<id>","Item id").argument("[text]","Optional comment text shorthand (equivalent to --add)").option("--add <text>","Add one comment entry (plain text fallback, text=<value>, markdown pairs, or - for stdin; CSV-like key fragments are preserved as plain text unless text is explicit)").option("--stdin","Read comment text from stdin (supports multiline markdown)").option("--file <path>","Read comment text from file (supports multiline markdown)").option("--edit <index>","Replace the comment at 1-based <index> (replacement text from positional [text], --add, --stdin, or --file)",e("--edit")).option("--delete <index>","Delete the comment at 1-based <index>",e("--delete")).option("--limit <n>","Return only latest n comments").option("--full-history","Return the complete post-mutation comment history instead of a bounded receipt").option("--author [value]","Comment author (optional; falls back to PM_AUTHOR/settings)").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete comments for an item.").action(Qt);_(o,"--body <text>","Alias for --add",!1),_(o,"--comment <text>","Alias for --add",!1),t.command("notes").argument("<id>","Item id").argument("[text]","Optional note text shorthand (equivalent to --add; use - for stdin)").option("--add <text>","Add a text note (- reads stdin)").option("--note <text>","Alias for --add").option("--add-json <json>","Append a merge-safe JSON event").option("--stdin","Read note text from stdin").option("--file <path>","Read note text from a UTF-8 file").option("--edit <index>","Replace a 1-based note using the selected text input",e("--edit")).option("--delete <index>","Delete the note at 1-based <index>",e("--delete")).option("--limit <n>","Return only latest n notes").option("--since <timestamp>","Filter JSON events from this ISO time").option("--event-type <value>","Filter JSON events by top-level type").option("--include-meta","Include count and truncation metadata").option("--full-history","Return the complete post-mutation note history instead of a bounded receipt").option("--author [value]","Author; defaults to PM_AUTHOR/settings").option("--message <value>","History message").option("--force","Force ownership override").description("Manage merge-safe text notes and JSON context events.").action(eo),t.command("learnings").argument("<id>","Item id").argument("[text]","Optional learning text shorthand (equivalent to --add; use - for stdin)").option("--add <text>","Add one learning entry (plain text fallback, text=<value>, markdown pairs, or - for stdin; CSV-like key fragments are preserved as plain text unless text is explicit)").option("--stdin","Read learning text from stdin (supports multiline markdown)").option("--file <path>","Read learning text from file (supports multiline markdown)").option("--edit <index>","Replace the learning at 1-based <index> (replacement text from positional [text], --add, --stdin, or --file)",e("--edit")).option("--delete <index>","Delete the learning at 1-based <index>",e("--delete")).option("--limit <n>","Return only latest n learnings").option("--full-history","Return the complete post-mutation learning history instead of a bounded receipt").option("--author [value]","Learning author (optional; falls back to PM_AUTHOR/settings)").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete learnings for an item.").action(to)}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="452f6689-f5bd-5398-915b-52ce7e2fd55e")}catch{}})();function ye(t,e){return o=>{let i=Number(o);if(!Number.isInteger(i)||i<e)throw new f(`${t} must be an integer greater than or equal to ${e}.`,c.USAGE);return i}}async function oo(t,e,o){let i=m(o);if(e.scope!==void 0&&e.scope!=="project"&&e.scope!=="global")throw new f("--scope must be either project or global.",c.USAGE);let n=await Ee({paths:t,scope:e.scope,limit:typeof e.limit=="number"?e.limit:void 0,offset:typeof e.offset=="number"?e.offset:void 0,noTruncate:e.noTruncate===!0,strictRead:e.strictRead===!0,explain:e.explain===!0,lineRange:typeof e.lines=="string"?Ie(e.lines):void 0,decisionDepth:typeof e.decisionDepth=="number"?e.decisionDepth:void 0},i);p(n,i)}function Qe(t){t.command("lookup").argument("<paths...>","Project-relative or absolute source paths").option("--scope <scope>","Restrict links to project or global scope").option("--limit <n>","Maximum referencing items to return",ye("--limit",1)).option("--offset <n>","Number of referencing items to skip",ye("--offset",0)).option("--no-truncate","Return every referencing item").option("--strict-read","Fail when any authoritative item cannot be read").option("--explain","Include ranked source-to-work rationale").option("--lines <start:end>","Attribute an inclusive source line range").option("--decision-depth <n>","Maximum governing-decision relationship depth",ye("--decision-depth",1)).description("Find and explain pm items that govern requested source paths.").action(oo)}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="af464386-4cc8-5110-b0b6-9f63224baa8e")}catch{}})();var io=["add-","apply-","list-","remove-","show-"],no=new Set(["field","fields","help","status","statuses","type","types"]);function ge(t){let e=t.trim().toLowerCase();return e.length===0?!1:no.has(e)||io.some(o=>e.startsWith(o))}function H(t){if(t!=null){if(typeof t=="number"){if(!Number.isInteger(t))throw new f("--order must be a finite integer.",c.USAGE);return t}if(typeof t=="string"){if(t.trim().length===0)return;let e=Number(t);if(!Number.isInteger(e))throw new f("--order must be a finite integer.",c.USAGE);return e}throw new f("--order must be a finite integer.",c.USAGE)}}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="07f3212f-c6d3-534e-8273-fae43a8fca18")}catch{}})();var ao=new Set(we.map(t=>t.toLowerCase())),ro=new Set(_e.map(t=>t==="estimate"?"estimatedMinutes":t));function so(t,e){let o=e.normalizedSubcommand;return o!=="rename-type"&&o!=="rename-field"&&o!=="remap-status"?null:t.runSchemaEvolutionMigration({kind:o,from:e.typeName,to:s(e.options,"to"),...o==="rename-field"&&typeof e.options.type=="string"?{type:e.options.type}:{}},{migrationId:s(e.options,"migrationId")??s(e.options,"migration_id"),dryRun:e.options.dryRun===!0,author:e.author,force:e.force},e.globalOptions)}function lo(t,e){let{normalizedSubcommand:o,typeName:i,globalOptions:n,author:r,force:a}=e;switch(o){case"list":return t.runSchemaList(n);case"show":return t.runSchemaShow(i,n);case"show-status":return t.runSchemaShowStatus(i,n);case"list-fields":return t.runSchemaListFields(n);case"show-field":return t.runSchemaShowField(i,n);case"remove-type":return t.runSchemaRemoveType(i,{author:r,force:a},n);case"remove-field":return t.runSchemaRemoveField(i,{author:r,force:a},n);case"remove-status":return t.runSchemaRemoveStatus(i,{author:r,force:a},n);case"apply-preset":return t.runSchemaApplyPreset(i,{author:r,force:a},n);default:return null}}async function uo(t,e){let{normalizedSubcommand:o,typeName:i,options:n,globalOptions:r}=e,{author:a,force:l,description:u}=e,y=so(t,e);if(y)return y;let b=lo(t,e);if(b)return b;switch(o){case"add-field":return t.runSchemaAddField(i,{type:typeof n.type=="string"?n.type:void 0,commands:e.commands,description:u,cliFlag:typeof n.cliFlag=="string"?n.cliFlag:void 0,alias:e.aliases,required:!!n.required,requiredOnCreate:!!n.requiredOnCreate,allowUnset:n.allowUnset!==!1,requiredTypes:e.requiredTypes,author:a,force:l},r);case"add-status":return t.runSchemaAddStatus(i,{role:e.roles,alias:e.aliases,description:u,order:e.order,author:a,force:l},r);default:return n.infer===!0?t.runSchemaInferTypes({minCount:e.minCount,apply:!!n.apply,author:a,force:l},r):t.runSchemaAddType(i,{description:u,defaultStatus:e.defaultStatus,folder:typeof n.folder=="string"?n.folder:void 0,alias:e.aliases,author:a,force:l},r)}}function co(t,e){if("migration_id"in e){w(`${t.formatSchemaEvolutionMigrationHuman(e)}
2
+ `);return}switch(e.action){case"list":w(`${t.formatSchemaListHuman(e)}
3
+ `);return;case"show":w(`${t.formatSchemaShowHuman(e)}
4
+ `);return;case"show-status":w(`${t.formatSchemaShowStatusHuman(e)}
5
+ `);return;case"list-fields":w(`${t.formatSchemaListFieldsHuman(e)}
6
+ `);return;case"show-field":w(`${t.formatSchemaShowFieldHuman(e)}
7
+ `);return;case"remove-type":w(`${t.formatSchemaRemoveTypeHuman(e)}
8
+ `);break;case"remove-field":w(`${t.formatSchemaRemoveFieldHuman(e)}
9
+ `);break;case"apply-preset":w(`${t.formatSchemaApplyPresetHuman(e)}
10
+ `);break;case"infer-types":w(`${t.formatSchemaInferTypesHuman(e)}
11
+ `);break;case"add-field":w(`${t.formatSchemaAddFieldHuman(e)}
12
+ `);break;case"add-status":w(`${t.formatSchemaAddStatusHuman(e)}
13
+ `);break;case"remove-status":w(`${t.formatSchemaRemoveStatusHuman(e)}
14
+ `);break;default:w(`${t.formatSchemaAddTypeHuman(e)}
15
+ `);break}e.warnings.length>0&&h(`schema ${e.action} warnings: ${z(e.warnings)}`)}async function po(t,e,o,i,n){switch(e){case"list":return t.runProfileList();case"show":return t.runProfileShow(o);case"lint":return t.runProfileLint(o);default:return t.runProfileApply(o,{dryRun:i.dryRun===!0,author:typeof i.author=="string"?i.author:void 0,force:i.force===!0},n)}}function fo(t,e){switch(e.action){case"list":w(`${t.formatProfileListHuman(e)}
16
+ `);return;case"show":w(`${t.formatProfileShowHuman(e)}
17
+ `);return;case"lint":w(`${t.formatProfileLintHuman(e)}
18
+ `);return;default:w(`${t.formatProfileApplyHuman(e)}
19
+ `),e.warnings.length>0&&h(`profile apply warnings: ${z(e.warnings)}`);break}}function mo(t){return e=>{let o=Number(e);if(!Number.isInteger(o)||o<1)throw new f(`${t} must be a positive integer (1-based index).`,c.USAGE);return o}}function et(t,e){t.option("--filter-has-notes",`Select only items that have notes before ${e}`).option("--filter-no-notes",`Select only items that have no notes before ${e}`).option("--filter-has-learnings",`Select only items that have learnings before ${e}`).option("--filter-no-learnings",`Select only items that have no learnings before ${e}`).option("--filter-has-files",`Select only items that have linked files before ${e}`).option("--filter-no-files",`Select only items that have no linked files before ${e}`).option("--filter-has-docs",`Select only items that have linked docs before ${e}`).option("--filter-no-docs",`Select only items that have no linked docs before ${e}`).option("--filter-has-tests",`Select only items that have linked tests before ${e}`).option("--filter-no-tests",`Select only items that have no linked tests before ${e}`).option("--filter-has-comments",`Select only items that have comments before ${e}`).option("--filter-no-comments",`Select only items that have no comments before ${e}`).option("--filter-has-deps",`Select only items that have dependencies before ${e}`).option("--filter-no-deps",`Select only items that have no dependencies before ${e}`).option("--filter-has-body",`Select only items that have a non-empty body before ${e}`).option("--filter-empty-body",`Select only items with an empty body before ${e}`).option("--filter-has-linked-command",`Select only items whose linked tests carry a runnable command before ${e}`).option("--filter-no-linked-command",`Select only items whose linked tests carry no runnable command before ${e}`).option("--filter-reviewer-missing",`Select only items missing reviewer before ${e}`).option("--filter-risk-missing",`Select only items missing risk before ${e}`).option("--filter-confidence-missing",`Select only items missing confidence before ${e}`).option("--filter-sprint-missing",`Select only items missing sprint before ${e}`).option("--filter-release-missing",`Select only items missing release before ${e}`)}var yo=[["filterHasNotes","filterNoNotes","--filter-has-notes","--filter-no-notes"],["filterHasLearnings","filterNoLearnings","--filter-has-learnings","--filter-no-learnings"],["filterHasFiles","filterNoFiles","--filter-has-files","--filter-no-files"],["filterHasDocs","filterNoDocs","--filter-has-docs","--filter-no-docs"],["filterHasTests","filterNoTests","--filter-has-tests","--filter-no-tests"],["filterHasComments","filterNoComments","--filter-has-comments","--filter-no-comments"],["filterHasDeps","filterNoDeps","--filter-has-deps","--filter-no-deps"],["filterHasBody","filterEmptyBody","--filter-has-body","--filter-empty-body"],["filterHasLinkedCommand","filterNoLinkedCommand","--filter-has-linked-command","--filter-no-linked-command"]];function it(t){let e=o=>t[o]===!0?!0:void 0;for(let[o,i,n,r]of yo)if(t[o]===!0&&t[i]===!0)throw new f(`Cannot combine ${n} with ${r} for the same field.`,c.USAGE);return{filterReviewerMissing:e("filterReviewerMissing"),filterRiskMissing:e("filterRiskMissing"),filterConfidenceMissing:e("filterConfidenceMissing"),filterSprintMissing:e("filterSprintMissing"),filterReleaseMissing:e("filterReleaseMissing"),hasNotes:e("filterHasNotes"),hasLearnings:e("filterHasLearnings"),hasFiles:e("filterHasFiles"),hasDocs:e("filterHasDocs"),hasTests:e("filterHasTests"),hasComments:e("filterHasComments"),hasDeps:e("filterHasDeps"),hasBody:e("filterHasBody"),hasLinkedCommand:e("filterHasLinkedCommand"),noNotes:e("filterNoNotes"),noLearnings:e("filterNoLearnings"),noFiles:e("filterNoFiles"),noDocs:e("filterNoDocs"),noTests:e("filterNoTests"),noComments:e("filterNoComments"),noDeps:e("filterNoDeps"),emptyBody:e("filterEmptyBody"),noLinkedCommand:e("filterNoLinkedCommand")}}function he(t,e){for(let o of e){let i=[],n=t.args,r=a=>(t.args!==n&&(i.length=0,n=t.args),i.push(a),i);o.required?t.requiredOption(o.option,o.description):o.repeatable?t.option(o.option,o.description,r):t.option(o.option,o.description);for(let a of o.aliasOptions??[])q(o.option,a.option)?_(t,a.option,a.description,o.repeatable===!0,o.repeatable?r:void 0):o.repeatable?t.option(a.option,a.description,r):t.option(a.option,a.description)}}function go(t){let e=o=>typeof t[o]=="string"?t[o]:void 0;return{type:e("filterType"),tag:e("filterTag"),priority:e("filterPriority"),deadlineBefore:e("filterDeadlineBefore"),deadlineAfter:e("filterDeadlineAfter"),updatedAfter:e("filterUpdatedAfter"),updatedBefore:e("filterUpdatedBefore"),createdAfter:e("filterCreatedAfter"),createdBefore:e("filterCreatedBefore"),ids:e("ids"),assignee:e("filterAssignee"),assigneeFilter:e("filterAssigneeFilter")??e("filterAssignee_filter"),parent:e("filterParent"),sprint:e("filterSprint"),release:e("filterRelease"),filterAcMissing:t.filterAcMissing===!0?!0:void 0,filterEstimatesMissing:t.filterEstimatesMissing===!0||t.filterEstimateMissing===!0?!0:void 0,filterResolutionMissing:t.filterResolutionMissing===!0?!0:void 0,filterMetadataMissing:t.filterMetadataMissing===!0?!0:void 0,...it(t),limit:e("limit"),offset:e("offset"),includeBody:!0}}function T(...t){for(let e of t)if(typeof e=="string")return e}function ve(t){if(Array.isArray(t))return t;if(typeof t=="string")return[t]}function ho(t,e,o){return typeof e=="string"&&e.length>0?{positionalType:t,positionalTitle:e}:typeof t!="string"||t.length===0?{positionalType:void 0,positionalTitle:void 0}:typeof o.title=="string"&&o.title.trim().length>0&&o.type===void 0?{positionalType:t,positionalTitle:void 0}:{positionalType:void 0,positionalTitle:t}}function vo(t,e,o){if(t!==void 0||typeof e!="string"||e.length===0||o.title!==void 0||o.type!==void 0||!ao.has(e.trim().toLowerCase()))return;let i=e.trim();throw new f(`pm create needs a title \u2014 "${i}" looks like an item type, not a title. Use either: pm create ${i} "<title>" or pm create "<title>" --type ${i}.`,c.USAGE,{code:"create_positional_type_without_title",why:'Without this guard the single positional is used as the title and the type defaults to Task \u2014 so the command would silently create a Task literally titled "'+i+'".',examples:[`pm create ${i} "Wire up SSO for the agent harness"`,`pm create "Wire up SSO for the agent harness" --type ${i}`],nextSteps:[`Re-run with both type and title: pm create ${i} "<title>"`]})}var bo=["body","description","dep","depRemove","comment","note","learning","file","test","doc","reminder","event","typeOption","field"];function nt(t){let e=bo.filter(o=>{let i=t[o];return i==="-"||Array.isArray(i)&&i.includes("-")}).map(o=>`--${o.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`)}`);if(e.length>0)throw new f(`--stdin-json cannot be combined with other stdin consumers: ${e.join(", ")}`,c.USAGE)}async function wo(t,e,o,i){let n=m(i),r=Date.now();if(o.stdinJson===!0){nt(o);let y=await D().resolveValue("-","--stdin-json");o=ce(y??"","create",o)}let a=ho(t,e,o);vo(a.positionalType,a.positionalTitle,o),typeof a.positionalType=="string"&&a.positionalType.length>0&&o.type===void 0&&(o.type=a.positionalType),typeof a.positionalTitle=="string"&&a.positionalTitle.length>0&&o.title===void 0&&(o.title=a.positionalTitle),await pe(o),typeof o.bodyFile=="string"&&(o.body=await U(o.bodyFile,o.body!==void 0?String(o.body):void 0),delete o.bodyFile);let l=J(o,{requireType:!1}),u=await Le(l,n);await v(n,u),p(u,n),n.profile&&h(`profile:command=create took_ms=${Date.now()-r}`)}function ko(t){return{type:s(t,"filterType"),tag:s(t,"filterTag"),priority:s(t,"filterPriority"),deadlineBefore:s(t,"filterDeadlineBefore"),deadlineAfter:s(t,"filterDeadlineAfter"),updatedAfter:s(t,"filterUpdatedAfter"),updatedBefore:s(t,"filterUpdatedBefore"),createdAfter:s(t,"filterCreatedAfter"),createdBefore:s(t,"filterCreatedBefore"),ids:s(t,"ids"),assignee:s(t,"filterAssignee"),assigneeFilter:T(t.filterAssigneeFilter,t.filterAssignee_filter),parent:s(t,"filterParent"),sprint:s(t,"filterSprint"),release:s(t,"filterRelease"),...it(t),limit:s(t,"limit"),offset:s(t,"offset")}}async function Ao(t,e){let o=m(e),i=Date.now(),n=await Pe({status:s(t,"filterStatus"),list:ko(t),reason:s(t,"reason"),completedAt:s(t,"completedAt"),resolution:s(t,"resolution"),expectedResult:T(t.expectedResult,t.expected_result,t.expected),actualResult:T(t.actualResult,t.actual_result,t.actual),validateClose:t.validateClose===!0?"warn":s(t,"validateClose"),author:s(t,"author"),message:s(t,"message"),force:!!t.force,dryRun:t.dryRun===!0?!0:void 0,rollback:s(t,"rollback"),checkpoint:t.checkpoint===!1?!1:void 0},o);await v(o,n),p(n,o),o.profile&&h(`profile:command=close-many took_ms=${Date.now()-i}`)}async function So(t,e){let o=m(e),i=Date.now(),n=await Ue({status:s(t,"filterStatus"),list:go(t),update:K(Ce(t)),dryRun:t.dryRun===!0?!0:void 0,rollback:s(t,"rollback"),checkpoint:t.checkpoint===!1?!1:void 0},o);await v(o,n),p(await F("update-many",[],t,o,n),o),o.profile&&h(`profile:command=update-many took_ms=${Date.now()-i}`)}async function _o(t,e,o,i){let n=m(i),r=Date.now(),a=typeof o.reason=="string"&&o.reason.trim().length>0&&o.reason||typeof o.closeReason=="string"&&o.closeReason.trim().length>0&&o.closeReason||void 0,l=typeof e=="string"&&e.length>0?e:a,u=await Me(t,l,{author:s(o,"author"),message:s(o,"message"),validateClose:o.validateClose===!0?"warn":s(o,"validateClose"),force:!!o.force,duplicateOf:s(o,"duplicateOf"),completedAt:s(o,"completedAt"),resolution:s(o,"resolution"),expectedResult:T(o.expectedResult,o.expected_result,o.expected),actualResult:T(o.actualResult,o.actual_result,o.actual)},n);await v(n,u),p(u,n),n.profile&&h(`profile:command=close took_ms=${Date.now()-r}`)}function xo(t){let e={...t},o=[["blocked_by","blockedBy"],["resume_context","resumeContext"],["from_search","fromSearch"],["step_title","stepTitle"],["step_body","stepBody"],["step_owner","stepOwner"],["step_status","stepStatus"],["step_evidence","stepEvidence"],["step_blocked_reason","stepBlockedReason"],["step_replacement","stepReplacement"],["depends_on","dependsOn"],["link_kind","linkKind"],["link_note","linkNote"],["promote_to_item_dep","promoteToItemDep"],["allow_multiple_active","allowMultipleActive"],["decision_text","decisionText"],["decision_rationale","decisionRationale"],["decision_evidence","decisionEvidence"],["discovery_text","discoveryText"],["validation_text","validationText"],["validation_command","validationCommand"],["validation_expected","validationExpected"],["materialize_type","materializeType"],["materialize_parent","materializeParent"],["materialize_tags","materializeTags"]];for(let[n,r]of o)e[n]!==void 0&&e[r]===void 0&&(e[r]=e[n]);let i=J(e,{requireType:!1});return i.blockedBy=e.blockedBy,i}function Co(t,e){if(!t)throw new f(`pm plan requires a subcommand. Allowed: ${e.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:['pm plan create --title "Refactor lock retry"',"pm plan show pm-a1b2 --depth standard",'pm plan add-step pm-a1b2 --step-title "Read lock.ts"']});if(e.includes(t))return;throw E({command_path:"plan",token:t,allowed:e,examples:t==="list"||t==="ls"?["pm list --type Plan","pm list-all --type Plan"]:void 0,retry_command:t==="list"||t==="ls"?"pm list --type Plan":void 0})}function Do(t,e){if(t!=="reorder-step"||typeof e!="string")return;let o=Number.parseInt(e,10);if(!Number.isFinite(o))throw new f(`reorder-step requires an integer new order, got "${e}"`,c.USAGE);return o}async function Ro(t,e,o,i,n,r){let a=m(r),l=Date.now(),u=(t??"").trim().toLowerCase();Co(u,Ge);let y=xo(n),b=Do(u,i),k=u==="create"&&typeof e=="string"&&e.length>0&&y.title===void 0?void 0:e;k===void 0&&typeof e=="string"&&e.length>0&&(y.title=e);let g=await qe({subcommand:u,id:k,stepRef:o,reorderTo:b,options:y,global:a});await v(a,g),p(g,a),a.profile&&h(`profile:command=plan took_ms=${Date.now()-l}`)}function tt(t,e){if(typeof t=="string"){if(!/^\d+$/.test(t.trim()))throw new f(`history-compact ${e} must be a non-negative integer.`,c.USAGE);return Number.parseInt(t,10)}}async function Io(t,e,o){if(t!==void 0)throw new f("merge reconcile takes no positional arguments.",c.USAGE);let i=await re({dryRun:e.dryRun===!0,force:e.force===!0,message:typeof e.message=="string"?e.message:void 0,author:o.author},o);p(i,o),i.ok||(process.exitCode=c.GENERIC_FAILURE)}async function To(t,e,o,i,n,r){if(t===void 0||e===void 0||o===void 0||i===void 0)throw new f("merge driver requires <artifact> <base> <ours> <theirs> (git supplies %O %A %B). Example: pm merge driver history %O %A %B",c.USAGE);let a=await oe({artifact:t,basePath:e,oursPath:o,theirsPath:i,outputPath:typeof n.output=="string"?n.output:void 0,itemPath:typeof n.itemPath=="string"?n.itemPath:void 0,prefer:typeof n.prefer=="string"?n.prefer:void 0},r);p(a,r),a.ok||(process.exitCode=c.GENERIC_FAILURE)}async function Eo(t,e,o,i,n,r,a){let l=m(a),u=Date.now();switch(t.trim().toLowerCase()){case"install":{if(e!==void 0)throw new f("merge install takes no positional arguments.",c.USAGE);let b=await W({dryRun:r.dryRun===!0},l);p(b,l);break}case"reconcile":await Io(e,r,l);break;case"report":{if(e!==void 0)throw new f("merge report takes no positional arguments.",c.USAGE);p(await X({includeReconciled:r.includeReconciled===!0}),l);break}case"driver":await To(e,o,i,n,r,l);break;default:throw E({command_path:"merge",token:t,allowed:["install","reconcile","report","driver"],display_name:"merge"})}l.profile&&h(`profile:command=merge took_ms=${Date.now()-u}`)}async function Oo(t,e,o){let i=m(o),n=Date.now(),r=typeof e.ids=="string"?Ae(e.ids):void 0,a=tt(e.allOver,"--all-over"),l=tt(e.minEntries,"--min-entries");if(e.closed===!0&&e.allStreams===!0)throw new f("history-compact: --closed and --all-streams are mutually exclusive; pick one lifecycle scope.",c.USAGE);let u=e.closed===!0?"closed":e.allStreams===!0?"all-streams":void 0;if((r!==void 0||a!==void 0||u!==void 0)&&typeof e.before=="string")throw new f("history-compact: --before applies only in single-id mode (bulk mode always compacts full streams).",c.USAGE);if(le(t,{ids:r,allOver:a,scope:u}),t===void 0){let b=await de({ids:r,scope:u,allOver:a,minEntries:l,dryRun:e.dryRun===!0,author:s(e,"author"),message:s(e,"message"),force:!!e.force},i);p(b,i),b.totals.items_errored>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let b=await se(t,{before:s(e,"before"),dryRun:e.dryRun===!0,author:s(e,"author"),message:s(e,"message"),force:!!e.force},i);p(b,i)}i.profile&&h(`profile:command=history-compact took_ms=${Date.now()-n}`)}function ot(t){if(Array.isArray(t))return t.flatMap(e=>e.split(",")).map(e=>e.trim()).filter(e=>e.length>0)}async function Fo(t,e,o,i){let n=m(i),r=Date.now(),{SCHEMA_SUBCOMMANDS:a}=N,l=(t??"").trim().toLowerCase(),u=e;if(Mo(l,a),!a.includes(l)&&u===void 0&&!ge(l)&&(u=t,l="add-type"),!a.includes(l))throw E({command_path:"schema",token:l,allowed:a});let y=await uo(N,{normalizedSubcommand:l,typeName:u,options:o,aliases:ve(o.alias),roles:ve(o.role),commands:ot(o.commands),requiredTypes:ot(o.requiredTypes),defaultStatus:T(o.defaultStatus,o.default_status),order:H(o.order),minCount:H(o.minCount),author:s(o,"author"),force:!!o.force,description:s(o,"description"),globalOptions:n});n.json===!0||n.defaultOutputFormat==="json"?p(y,n):n.quiet||co(N,y),n.profile&&h(`profile:command=schema took_ms=${Date.now()-r}`)}function Mo(t,e){if(!t)throw new f(`pm schema requires a subcommand. Allowed: ${e.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:["pm schema list","pm schema show Task","pm schema show-status open",'pm schema add-type Spike --description "Time-boxed investigation" --default-status open',"pm schema remove-type Spike","pm schema add-status review --role active --alias in_review","pm schema remove-status review","pm schema add-field severity_level --type string --commands create,update","pm schema list-fields","pm schema apply-preset agile","pm schema add-type --infer --min-count 10","pm schema rename-type Spike --to Experiment --migration-id spike-v2 --dry-run","pm schema rename-field severity --to impact --migration-id severity-v2","pm schema remap-status review --to verifying --migration-id review-v2"]})}async function Po(t,e,o){let i=m(o),n=Date.now(),r=await Z(t,{title:s(e,"title"),author:s(e,"author"),message:s(e,"message"),allowDuplicate:e.allowDuplicate===!0},i);await v(i,r),p(r,i),i.profile&&h(`profile:command=copy took_ms=${Date.now()-n}`)}async function No(t,e,o){let i=m(o),n=Date.now(),r=await ee(t,{clear:e.clear===!0},i);p(r,i),i.profile&&h(`profile:command=focus took_ms=${Date.now()-n}`)}async function $o(t,e,o){let i=m(o),n=Date.now();if(e.stdinJson===!0){nt(e);let a=await D().resolveValue("-","--stdin-json");e=ce(a??"","update",e)}await pe(e),typeof e.bodyFile=="string"&&(e.body=await U(e.bodyFile,e.body!==void 0?String(e.body):void 0),delete e.bodyFile);let r=await Be(t,K(e),i);await v(i,r),p(await F("update",[t],e,i,r),i),i.profile&&h(`profile:command=update took_ms=${Date.now()-n}`)}async function Ho(t,e,o){let i=m(o),n=Date.now(),r=await Q(t,{author:s(e,"author"),message:s(e,"message"),force:!!e.force,dryRun:e.dryRun===!0},i);r.dry_run!==!0&&await v(i,r),p(r,i),i.profile&&h(`profile:command=delete took_ms=${Date.now()-n}`)}function Lo(t,e){let o=s(e,"body"),i=s(e,"text"),n=typeof t=="string"?t:void 0;if([o,i,n].filter(l=>l!==void 0).length>1)throw new f("Specify append text with exactly one source: positional [text], --body, or --text",c.USAGE);let a=o??i??n;if(a===void 0)throw new f("Missing append text. Provide it as positional [text], --body <value>, or --text <value> (use - for stdin).",c.USAGE);return a}async function Bo(t,e,o,i){let n=m(i),r=Date.now(),a=await Fe(t,{body:Lo(e,o),author:s(o,"author"),message:s(o,"message"),force:!!o.force},n);await v(n,a),p(a,n),n.profile&&h(`profile:command=append took_ms=${Date.now()-r}`)}async function Uo(t,e,o,i){let n=m(i),r=Date.now(),a=await Y(t,e,{author:s(o,"author"),message:s(o,"message"),force:!!o.force},n);await v(n,a),p(a,n),n.profile&&h(`profile:command=restore took_ms=${Date.now()-r}`)}async function Go(t,e,o,i){let n=m(i),r=Date.now(),{PROFILE_SUBCOMMANDS:a}=P,l=(t??"").trim().toLowerCase();if(!l)throw new f(`pm profile requires a subcommand. Allowed: ${a.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:["pm profile list","pm profile show agile","pm profile apply agile --dry-run","pm profile lint agile"]});if(!a.includes(l))throw E({command_path:"profile",token:l,allowed:a});let u=await po(P,l,e,o,n);n.json===!0||n.defaultOutputFormat==="json"?p(u,n):n.quiet||fo(P,u),u.action==="lint"&&!u.ok&&(process.exitCode=c.GENERIC_FAILURE),n.profile&&h(`profile:command=profile took_ms=${Date.now()-r}`)}function C(t,e){return ve(t[e])??[]}async function qo(t,e,o){let i=m(o),n=Date.now(),r=C(e,"add"),a=C(e,"addGlob"),l=C(e,"remove"),u=C(e,"migrate"),y=await Te(t,{add:r,addGlob:a,remove:l,migrate:u,note:s(e,"note"),list:!!e.list,appendStable:!!e.appendStable,validatePaths:!!e.validatePaths,author:s(e,"author"),message:s(e,"message"),force:!!e.force},i);(r.length>0||a.length>0||l.length>0||u.length>0)&&await v(i,y),p(await F("files",[t],e,i,y),i),i.profile&&h(`profile:command=files took_ms=${Date.now()-n}`)}async function jo(t,e,o){let i=m(o),n=Date.now(),r={...o.optsWithGlobals(),...e},a=await Oe(t,{apply:!!r.apply,note:s(r,"note"),appendStable:!!r.appendStable,author:s(r,"author"),message:s(r,"message"),force:!!r.force},i);a.changed&&await v(i,a),p(a,i),i.profile&&h(`profile:command=files.discover took_ms=${Date.now()-n}`)}async function Vo(t,e,o){let i=m(o),n=Date.now(),r=C(e,"add"),a=C(e,"addGlob"),l=C(e,"remove"),u=C(e,"migrate"),y=await Re(t,{add:r,addGlob:a,remove:l,migrate:u,note:s(e,"note"),list:!!e.list,validatePaths:!!e.validatePaths,author:s(e,"author"),message:s(e,"message"),force:!!e.force},i);(r.length>0||a.length>0||l.length>0||u.length>0)&&await v(i,y),p(await F("docs",[t],e,i,y),i),i.profile&&h(`profile:command=docs took_ms=${Date.now()-n}`)}async function zo(t,e,o){let i=m(o),n=Date.now(),r=await xe(t,{format:e.format,maxDepth:s(e,"maxDepth"),collapse:e.collapse,summary:e.summary===!0,full:e.full===!0,nodeLimit:s(e,"nodeLimit"),edgeLimit:s(e,"edgeLimit"),tokenBudget:s(e,"tokenBudget"),cursor:s(e,"cursor"),direction:s(e,"direction"),...Array.isArray(e.kind)?{kind:e.kind}:{}},i);p(r,i),i.profile&&h(`profile:command=deps took_ms=${Date.now()-n}`)}function Gn(t,e={}){let o=t.command("create").argument("[type-or-title]",'Item title, or item type when a title follows (e.g. `pm create task "Fix bug"`)').argument("[title]","Item title when the first argument is an item type").description("Create a new project management item.");if(he(o,j),o.option("--stdin-json","Read a full item JSON document from stdin; explicit flags override document values").option("--body-file <path>","Load the item markdown body from a file (mutually exclusive with --body)").option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--allow-duplicate","Explicitly create even when strict similarity governance finds likely duplicates").action(wo),e.targetCommandName==="create")return;t.command("copy").argument("<id>","Source item id").option("--title <value>","Optional title override for the copied item").option("--author <value>","Mutation author").option("--message <value>","History message").option("--allow-duplicate","Explicitly copy even when strict similarity governance finds likely duplicates").description("Copy an item into a new item id while resetting lifecycle fields.").action(Po),t.command("focus").argument("[id]","Item id to focus (omit to show current focus)").option("--clear","Clear the focused item").description("Set/clear/show the session focused item that new items default --parent to.").action(No);let i=t.command("update").argument("<id>","Item id").description("Update item fields and metadata.");he(i,Se),i.option("--stdin-json","Read a full item JSON document from stdin; explicit flags override document values").option("--body-file <path>","Load the item markdown body from a file (mutually exclusive with --body)").option("--replace-deps","Atomically replace dependency entries with the provided --dep values").option("--replace-tests","Atomically replace linked test entries with the provided --test values").option("--replace-files","Atomically replace linked file entries with the provided --file values").option("--replace-docs","Atomically replace linked doc entries with the provided --doc values").option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--force","Force ownership override"),i.action($o),We(t);let n=t.command("update-many").description("Bulk-update matched items with dry-run plans and rollback checkpoints.").option("--filter-status <value>","Filter by status before applying updates").option("--filter-type <value>","Filter by item type before applying updates").option("--filter-tag <value>","Filter by tag before applying updates").option("--filter-priority <value>","Filter by priority before applying updates").option("--filter-deadline-before <value>","Filter by deadline upper bound before applying updates").option("--filter-deadline-after <value>","Filter by deadline lower bound before applying updates").option("--filter-updated-after <value>","Filter by updated_at lower bound before applying updates (ISO/relative)").option("--filter-updated-before <value>","Filter by updated_at upper bound before applying updates (ISO/relative)").option("--filter-created-after <value>","Filter by created_at lower bound before applying updates (ISO/relative)").option("--filter-created-before <value>","Filter by created_at upper bound before applying updates (ISO/relative)").option("--filter-assignee <value>","Filter by assignee before applying updates").option("--filter-assignee-filter <value>","Filter assignee presence: assigned|unassigned before applying updates").option("--filter-parent <value>","Filter by parent item ID before applying updates").option("--filter-sprint <value>","Filter by sprint before applying updates").option("--filter-release <value>","Filter by release before applying updates").option("--filter-ac-missing","Select only items missing acceptance_criteria (bulk backfill)").option("--filter-estimates-missing","Select only items missing estimated_minutes (bulk backfill)").option("--filter-resolution-missing","Select only terminal items missing resolution (bulk backfill)").option("--filter-metadata-missing","Select only items missing any tracked metadata (AC, estimate, or resolution)");et(n,"applying updates"),n.option("--ids <value>","Restrict to an explicit comma-separated ID allowlist (intersected with other filters)").option("--limit <n>","Limit matched item count before apply/preview").option("--offset <n>","Skip first n matched rows before apply/preview").option("--dry-run","Preview per-item diffs and checkpoint intent without mutating").option("--rollback <value>","Rollback a prior update-many checkpoint ID").option("--no-checkpoint","Disable checkpoint creation during apply mode").option("--title, -t <value>","Set title").option("--description, -d <value>","Set description").option("--body, -b <value>","Set body (allow empty string)").option("--status, -s <value>","Set status (use close command for closed)").option("--priority, -p <value>","Set priority").option("--type <value>","Set type").option("--tags <value>","Set comma-separated tags (replaces existing). Use --add-tags / --remove-tags to mutate additively.").option("--add-tags <value>","Add tags additively without replacing existing (repeatable; CSV accepted)",d).option("--remove-tags <value>","Remove tags from the existing list (repeatable; CSV accepted)",d).option("--deadline <value>","Set deadline (ISO/date string or relative)").option("--estimate, --estimated-minutes <value>","Set estimated minutes").option("--acceptance-criteria <value>","Set acceptance criteria").option("--ac <value>","Alias for --acceptance-criteria").option("--add-ac <value>","Add one semicolon-free acceptance criterion without replacing the existing list (repeatable)",d).option("--remove-ac <value>","Remove one semicolon-free acceptance criterion by exact text match (repeatable)",d).option("--definition-of-ready <value>","Set definition of ready").option("--order <value>","Set planning order/rank integer").option("--rank <value>","Alias for --order").option("--goal <value>","Set goal identifier").option("--objective <value>","Set objective identifier").option("--value <value>","Set business value summary").option("--impact <value>","Set business impact summary").option("--outcome <value>","Set expected outcome summary").option("--why-now <value>","Set why-now rationale").option("--assignee <value>","Set assignee").option("--parent <value>","Set parent item ID").option("--reviewer <value>","Set reviewer").option("--risk <value>","Set risk level").option("--confidence <value>","Set confidence level").option("--sprint <value>","Set sprint identifier").option("--release <value>","Set release identifier").option("--blocked-by <value>","Set blocked-by item ID or reason").option("--blocked-reason <value>","Set blocked reason").option("--unblock-note <value>","Set unblock rationale note").option("--reporter <value>","Set issue reporter").option("--severity <value>","Set issue severity").option("--environment <value>","Set issue environment context").option("--repro-steps <value>","Set issue reproduction steps").option("--resolution <value>","Set issue resolution summary").option("--expected-result <value>","Set issue expected behavior").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Set issue observed behavior").option("--actual <value>","Short alias for --actual-result").option("--affected-version <value>","Set affected version identifier").option("--fixed-version <value>","Set fixed version identifier").option("--component <value>","Set issue component ownership").option("--regression [value]","Set regression marker; bare flag means true, or pass true|false|1|0").option("--customer-impact <value>","Set customer impact summary").option("--dep <value>","Add dependency entry id=<id>,kind=<kind>,author=<author>,created_at=<timestamp>",d).option("--dep-remove <value>","Remove dependency entries by id/kind/author/timestamp signature",d).option("--replace-deps","Atomically replace dependency entries with provided --dep values").option("--replace-tests","Atomically replace linked tests with provided --test values").option("--replace-files","Atomically replace linked files with provided --file values").option("--replace-docs","Atomically replace linked docs with provided --doc values").option("--comment <value>","Add comment seed author=<value>,created_at=<iso|now>,text=<value>",d).option("--note <value>","Add note seed author=<value>,created_at=<iso|now>,text=<value>",d).option("--learning <value>","Add learning seed author=<value>,created_at=<iso|now>,text=<value>",d).option("--file <value>","Add linked file path=<value>,scope=<project|global>,note=<text>",d).option("--test <value>","Add linked test command=<value>,path=<value>,scope=<project|global>",d).option("--doc <value>","Add linked doc path=<value>,scope=<project|global>,note=<text>",d).option("--reminder <value>","Add reminder entry at=<iso|relative>|date=<iso|relative>,text=<text>|title=<text>",d).option("--event <value>","Add event entry start=<iso|relative>,end=<iso|relative>,recur_*",d).option("--type-option <value>","Set type options key=value (repeatable)",d).option("--unset <field>","Clear scalar metadata field by name (repeatable)",d).option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override"),M(n,[["--filter-assignee_filter <value>","Alias for --filter-assignee-filter"],["--estimated_minutes <value>","Alias for --estimated-minutes"],["--acceptance_criteria <value>","Alias for --acceptance-criteria"],["--definition_of_ready <value>","Alias for --definition-of-ready"],["--why_now <value>","Alias for --why-now"],["--blocked_by <value>","Alias for --blocked-by"],["--blocked_reason <value>","Alias for --blocked-reason"],["--unblock_note <value>","Alias for --unblock-note"],["--repro_steps <value>","Alias for --repro-steps"],["--expected_result <value>","Alias for --expected-result"],["--actual_result <value>","Alias for --actual-result"],["--affected_version <value>","Alias for --affected-version"],["--fixed_version <value>","Alias for --fixed-version"],["--customer_impact <value>","Alias for --customer-impact"],["--filter-estimate-missing","Alias for --filter-estimates-missing"]],!1),M(n,[["--dep_remove <value>","Alias for --dep-remove"],["--type_option <value>","Alias for --type-option"],["--add_tags <value>","Alias for --add-tags"],["--remove_tags <value>","Alias for --remove-tags"],["--add_ac <value>","Alias for --add-ac"],["--remove_ac <value>","Alias for --remove-ac"]],!0),n.action(So);let r=t.command("close").argument("<id>","Item id").argument("[text]","Close reason text (alias: --reason)").option("-r, --reason <value>","Close reason text (alias for positional <text>)").option("--close-reason <value>","Close reason text (alias for positional <text>)").option("--completed-at <value>","Actual completion timestamp (ISO or relative), distinct from tracker close time").option("-d, --duplicate-of <id>","Close as a duplicate of the canonical item id and auto-fill duplicate closure metadata").option("--author <value>","Mutation author").option("-m, --message <value>","History message").option("--validate-close [mode]",'Validate closure metadata before close: "off", "warn", or "strict" (default: settings governance preset)').option("--resolution <value>","Set the closure resolution summary inline (same field --validate-close strict checks; previously required a prior pm update)").option("--expected-result <value>","Set the expected-result note inline (closure validation field)").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Set the actual-result note inline (closure validation field)").option("--actual <value>","Short alias for --actual-result").option("--force","Force ownership override").description("Close an item. Close reason requirement follows governance.require_close_reason.");_(r,"--expected_result <value>","Alias for --expected-result",!1),_(r,"--actual_result <value>","Alias for --actual-result",!1),r.action(_o);let a=t.command("close-many").description("Bulk-close matched items with a shared reason and full runClose semantics (dry-run + rollback checkpoint).").option("--filter-status <value>","Filter by status before closing").option("--filter-type <value>","Filter by item type before closing").option("--filter-tag <value>","Filter by tag before closing").option("--filter-priority <value>","Filter by priority before closing").option("--filter-deadline-before <value>","Filter by deadline upper bound before closing").option("--filter-deadline-after <value>","Filter by deadline lower bound before closing").option("--filter-updated-after <value>","Filter by updated_at lower bound before closing (ISO/relative)").option("--filter-updated-before <value>","Filter by updated_at upper bound before closing (ISO/relative)").option("--filter-created-after <value>","Filter by created_at lower bound before closing (ISO/relative)").option("--filter-created-before <value>","Filter by created_at upper bound before closing (ISO/relative)").option("--filter-assignee <value>","Filter by assignee before closing").option("--filter-assignee-filter <value>","Filter assignee presence: assigned|unassigned before closing").option("--filter-parent <value>","Filter by parent item ID before closing").option("--filter-sprint <value>","Filter by sprint before closing").option("--filter-release <value>","Filter by release before closing");et(a,"closing"),a.option("--ids <value>","Restrict to an explicit comma-separated ID allowlist (intersected with other filters)").option("--limit <n>","Limit matched item count before apply/preview").option("--offset <n>","Skip first n matched rows before apply/preview").option("--reason <value>","Shared close reason applied to matched items (required when governance.require_close_reason is enabled)").option("--completed-at <value>","Actual completion timestamp (ISO or relative) applied to every matched item").option("--resolution <value>","Shared closure resolution applied to every matched item (closure-validation field)").option("--expected-result <value>","Shared expected-result note (closure-validation field)").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Shared actual-result note (closure-validation field)").option("--actual <value>","Short alias for --actual-result").option("--validate-close [mode]",'Validate closure metadata per item: "off", "warn", or "strict" (default: settings governance preset)').option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Re-close already-terminal matches and override ownership").option("--dry-run","Preview matched items + per-item skip/active-child plan without mutating").option("--rollback <value>","Rollback a prior close-many checkpoint ID").option("--no-checkpoint","Disable checkpoint creation during apply mode"),_(a,"--filter-assignee_filter <value>","Alias for --filter-assignee-filter",!1),_(a,"--expected_result <value>","Alias for --expected-result",!1),_(a,"--actual_result <value>","Alias for --actual-result",!1),a.action(Ao),t.command("delete").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").option("--dry-run","Preview the item file that would be deleted without mutating").description("Delete an item and record the change in history.").action(Ho),t.command("append").argument("<id>","Item id").argument("[text]","Body text; same as --body (- reads stdin)").option("--body <value>","Text to append to body (or - for stdin)").option("--text <value>","Alias for --body").option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override").description("Append text to an item's body. For concurrent writes, use pm notes.").action(Bo),t.command("restore").argument("<id>","Item id").argument("<target>","Restore target timestamp or version number").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership/lock override").description("Restore an item to an earlier timestamp or version.").action(Uo);let l=t.command("plan").description("Agent-optimized Plan item workflow: create, manage steps, link dependencies, approve, and materialize.").argument("[subcommand]","Required; Plan subcommand: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize").argument("[id]","Plan id (required for non-create subcommands); for create this may be the positional title").argument("[step]","Step reference: stable id (plan-step-001) or order integer").argument("[new-order]","New order integer for reorder-step").option("--title <value>","Plan title").option("--description <value>","Plan description").option("--scope <value>","Short scope statement of the target change or investigation").option("--parent <value>","Parent pm item id").option("--related <value>","Related pm item ids (repeatable, csv-friendly)",d).option("--blocks <value>","Pm item ids this plan blocks (repeatable, csv-friendly)",d).option("--blocked-by <value>","Pm item ids that block this plan (repeatable, csv-friendly)",d).option("--harness <value>","Plan harness provenance: codex|claude-code|cursor|generic").option("--mode <value>","Plan mode: draft|research|review|approved|executing|paused|completed|superseded").option("--resume-context <value>","Compact context summary for a future stateless agent").option("--tags <value>","Comma-separated tags").option("--priority <value>","Priority 0-4").option("--body <value>","Plan item body").option("--claim","Claim the plan on create for the author").option("--from-search <value>","Record the search query that led to plan creation").option("--template <value>","Seed plan steps from a built-in template: bug-investigation|feature-implementation|refactoring-sprint").option("--step-title <value>","Step title for add-step / update-step").option("--step <value>","Step title (repeatable on create: each --step appends an ordered step; elsewhere a single value aliases --step-title)",d).option("--step-body <value>","Step body text").option("--step-owner <value>","Step owner").option("--step-status <value>","Step status: pending|in_progress|completed|blocked|skipped|superseded").option("--step-evidence <value>","Step evidence text (used by update-step/complete-step)").option("--step-blocked-reason <value>","Step blocked reason (required when blocking)").option("--step-replacement <value>","Replacement reference for a superseded step").option("--depends-on <value>","Pm item ids the step depends on (repeatable, csv-friendly)",d).option("--link <value>","Pm item id to link (repeatable, csv-friendly)",d).option("--link-kind <value>",`Link kind: ${ke.join("|")}`).option("--link-note <value>","Optional note for the link").option("--promote-to-item-dep","Also add the linked id as a top-level item dependency when linking").option("--allow-multiple-active","Allow multiple steps to be in_progress at once").option("--file <value>","Step linked file path=<value>[,scope=project|global,note=<text>] (repeatable)",d).option("--test <value>","Step linked test command=<value>[,path=<value>,note=<text>] (repeatable)",d).option("--doc <value>","Step linked doc path=<value>[,scope=project|global,note=<text>] (repeatable)",d).option("--decision-text <value>","Decision log entry text").option("--decision <value>","Alias for --decision-text").option("--decision-rationale <value>","Decision log entry rationale").option("--decision-evidence <value>","Decision log entry evidence").option("--discovery-text <value>","Discovery log entry text").option("--discovery <value>","Alias for --discovery-text").option("--validation-text <value>","Validation log entry text").option("--validation <value>","Alias for --validation-text").option("--validation-command <value>","Validation log entry command").option("--validation-expected <value>","Validation log entry expected outcome").option("--depth <value>","Show depth: brief|standard|deep (default: brief)").option("--fields <value>","Comma-separated field projection for show output").option("--steps <value>","Comma-separated step ids/orders for materialize").option("--materialize-type <value>","Item type for materialized steps (default: Task)").option("--materialize-parent <value>","Parent item id for materialized children (default: the plan)").option("--materialize-tags <value>","Comma-separated tags for materialized children").option("--field <name=value>","Custom field value forwarded to every materialized child (repeatable)",d).option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override");he(l,j.filter(k=>ro.has(k.target))),M(l,[["--resume_context <value>","Alias for --resume-context"],["--from_search <value>","Alias for --from-search"],["--step_title <value>","Alias for --step-title"],["--step_body <value>","Alias for --step-body"],["--step_owner <value>","Alias for --step-owner"],["--step_status <value>","Alias for --step-status"],["--step_evidence <value>","Alias for --step-evidence"],["--step_blocked_reason <value>","Alias for --step-blocked-reason"],["--step_replacement <value>","Alias for --step-replacement"],["--link_kind <value>","Alias for --link-kind"],["--link_note <value>","Alias for --link-note"],["--promote_to_item_dep","Alias for --promote-to-item-dep"],["--allow_multiple_active","Alias for --allow-multiple-active"],["--decision_text <value>","Alias for --decision-text"],["--decision_rationale <value>","Alias for --decision-rationale"],["--decision_evidence <value>","Alias for --decision-evidence"],["--discovery_text <value>","Alias for --discovery-text"],["--validation_text <value>","Alias for --validation-text"],["--validation_command <value>","Alias for --validation-command"],["--validation_expected <value>","Alias for --validation-expected"],["--materialize_type <value>","Alias for --materialize-type"],["--materialize_parent <value>","Alias for --materialize-parent"],["--materialize_tags <value>","Alias for --materialize-tags"]],!1),M(l,[["--blocked_by <value>","Alias for --blocked-by"],["--depends_on <value>","Alias for --depends-on"]],!0),l.action(Ro),t.command("history-redact").argument("<id>","Item id").option("--literal <value>","Literal string to redact (repeatable)",d).option("--regex <value>","Regex pattern to redact (repeatable; accepts /pattern/flags or raw pattern)",d).option("--replacement <value>",'Replacement string (default: "[redacted]")').option("--dry-run","Preview redaction impact without writing item/history files").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the redaction marker entry").option("--force","Force ownership/lock override").description("Redact sensitive literals/patterns from an item history stream and recompute hashes.").action(async(k,g,R)=>{let A=m(R),I=Date.now(),S=Array.isArray(g.literal)?g.literal:void 0,$=Array.isArray(g.regex)?g.regex:void 0,x=await V(k,{literal:S,regex:$,replacement:typeof g.replacement=="string"?g.replacement:void 0,dryRun:g.dryRun===!0,author:typeof g.author=="string"?g.author:void 0,message:typeof g.message=="string"?g.message:void 0,force:!!g.force},A);x.changed&&!x.dry_run&&await v(A,x),p(x,A),A.profile&&h(`profile:command=history-redact took_ms=${Date.now()-I}`)}),t.command("history-repair").argument("[id]","Item id (omit with --all)").option("--all","Scan every stream for drift and repair each drifted stream in one audited pass").option("--dry-run","Preview the re-anchor impact without writing the history file").option("--normalize-provenance","Remove invalid provenance; return aggregate-only evidence").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the repair marker entry").option("--force","Force ownership/lock override").description("Re-anchor a drifted item history chain (recompute hashes, reconcile with the on-disk item) and record an audit marker. Use --all to repair every drifted stream.").action(async(k,g,R)=>{let A=m(R),I=Date.now(),S=g.all===!0;ne(k,S);let $={dryRun:g.dryRun===!0,author:typeof g.author=="string"?g.author:void 0,message:typeof g.message=="string"?g.message:void 0,force:!!g.force,normalizeProvenance:g.normalizeProvenance===!0};if(S){let x=await ae($,A);p(x,A),x.totals.failed>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let x=await ie(k,$,A);p(x,A)}A.profile&&h(`profile:command=history-repair took_ms=${Date.now()-I}`)}),Xe(t),t.command("history-compact").argument("[id]","Item id (omit when using a bulk selector)").option("--before <value>","Compact entries strictly before this version number or ISO timestamp (single-id mode only)").option("--ids <value>","Bulk: compact an explicit comma-separated list of item ids").option("--all-over <n>","Bulk: compact every stream with more than N entries").option("--closed","Bulk: compact only closed (terminal) items' streams").option("--all-streams","Bulk: compact every history stream regardless of lifecycle state").option("--min-entries <n>","Bulk: skip streams with at most N entries (already compact; default 3)").option("--dry-run","Preview compaction impact without writing the history file").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the compaction marker entry").option("--force","Force ownership/lock override").description("Compact item history streams into a synthetic baseline plus retained tail entries. Pass an item id for one stream, or a bulk selector (--ids/--all-over/--closed/--all-streams) to compact many.").action(Oo),t.command("merge").argument("<subcommand>","Merge subcommand: install, reconcile, report, driver").argument("[artifact]",`driver only: artifact class to merge (${te.join(", ")})`).argument("[base]","driver only: common-ancestor file path (git %O)").argument("[ours]","driver only: current-branch file path (git %A)").argument("[theirs]","driver only: other-branch file path (git %B)").option("--dry-run","install/reconcile: preview changes without writing").option("--message <text>","reconcile only: audit message recorded on repaired history streams").option("--force","reconcile only: permit the underlying audited history ownership override").option("--include-reconciled","report only: include clone-local receipts already recorded in history").option("--output <path>","driver only: write the merged content to this path instead of the ours path").option("--item-path <path>","driver only: original repository-relative path supplied by git as %P").option("--prefer <side>","driver only: side that wins unresolvable conflicts (ours|theirs; default ours)").description("Install merge drivers, reconcile or report post-merge history, or run a field-aware driver.").action(Eo);let u=t.command("schema").argument("[subcommand]","Required; Schema subcommand: list, show, show-status, add/remove type/status/field, rename-type, rename-field, remap-status, or a custom item type name shorthand").argument("[name]","Definition name, or source name for rename/remap migrations").option("--description <text>","Human description for the custom item type, status, or field").option("--default-status <status>","Default status hint recorded for the custom item type").option("--folder <dir>","Storage folder for items of this custom type").option("--alias <name>","Alias for the custom type, status, or field flag (repeatable, csv-friendly)",d).option("--role <value>","Lifecycle role for a custom status (repeatable): draft, active, blocked, terminal, terminal_done, terminal_canceled, default_open, default_close, default_cancel",d).option("--order <n>","Display/sort order for a custom status").option("--type <type>","Value type for a custom field (add-field): string, number, boolean, string_array, array, object").option("--commands <list>","Commands a custom field is wired onto (add-field; repeatable, comma-friendly): create, update, update_many, list, search, calendar, context",d).option("--cli-flag <flag>","Override the auto-derived CLI flag for a custom field (add-field)").option("--required","Mark a custom field as always required (add-field)").option("--required-on-create","Mark a custom field as required at create time (add-field)").option("--no-allow-unset","Disallow clearing a custom field via --unset (add-field)").option("--required-types <list>","Restrict a custom field's requirement to specific item types (add-field; repeatable, comma-friendly)",d).option("--infer","Infer custom item types from title-prefix conventions (add-type; preview unless --apply)").option("--min-count <n>","Minimum items sharing a prefix for add-type --infer (default 10)").option("--apply","Register inferred types (add-type --infer); without it the command previews only").option("--to <name>","Target definition name for rename/remap migrations").option("--migration-id <id>","Stable idempotency key for a resumable schema migration").option("--dry-run","Plan a schema migration without writing schema, items, or history").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("Inspect and manage config-driven runtime schema (types, statuses, fields, presets).");_(u,"--default_status <status>","Alias for --default-status",!1),_(u,"--migration_id <id>","Alias for --migration-id",!1),u.action(Fo),t.command("profile").argument("[subcommand]","Required; Profile subcommand: list, show, apply, or lint").argument("[name]","Profile name for show/apply/lint: agile, ops, or research").option("--dry-run","Preview the apply diff without writing any files (apply)").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("List, show, apply, and lint project profiles \u2014 archetype bundles of item types, statuses, fields, workflows, config, templates, and recommended packages.").action(Go),Ze(t,mo);let b=t.command("files").description("Manage files linked to an item.");b.argument("<id>","Item id").option("--add <value>","Add linked file entry (CSV/markdown pairs or - for stdin)",d).option("--add-glob <value>","Add linked file entries from a glob (plain glob or pattern=<glob>,scope=<scope>,note=<text>; repeatable)",d).option("--remove <value>","Remove linked file by path only (path=<value>, path:<value>, plain path, or - for stdin); does not accept note=/scope= \u2014 record removal context with --message",d).option("--migrate <value>","Migrate linked file paths in-place (from=<prefix>,to=<prefix>; repeatable)",d).option("--note <value>","Note attached to every link added by --add/--add-glob in this invocation (embedded note= wins)").option("--list","List linked files without mutating").option("--append-stable","Preserve existing linked-file order and append new links without full-array resorting").option("--validate-paths","Validate linked file paths for existence and file shape").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").action(qo),b.command("discover").argument("<id>","Item id").option("--apply","Add discovered missing files to the item").option("--note <value>","Note to attach to discovered file links").option("--append-stable","Preserve existing linked-file order and append discovered links without full-array resorting").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Discover existing file paths referenced in item text and optionally link missing files.").action(jo),Qe(b),t.command("docs").argument("<id>","Item id").option("--add <value>","Add linked doc entry (CSV/markdown pairs or - for stdin)",d).option("--add-glob <value>","Add linked doc entries from a glob (plain glob or pattern=<glob>,scope=<scope>,note=<text>; repeatable)",d).option("--remove <value>","Remove linked doc by path only (path=<value>, path:<value>, plain path, or - for stdin); does not accept note=/scope= \u2014 record removal context with --message",d).option("--migrate <value>","Migrate linked doc paths in-place (from=<prefix>,to=<prefix>; repeatable)",d).option("--note <value>","Note attached to every link added by --add/--add-glob in this invocation (embedded note= wins)").option("--list","List linked docs without mutating").option("--validate-paths","Validate linked doc paths for existence and file shape").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage docs linked to an item.").action(Vo),t.command("deps").argument("<id>","Item id").option("--format <value>","Output format (tree, graph, or context)","tree").option("--max-depth <value>","Maximum dependency traversal depth (0 keeps only the root)").option("--collapse <value>","Collapse mode (none or repeated)","none").option("--summary","Return counts only without full tree/graph payload").option("--full","Return the complete dependency row projection").option("--node-limit <value>","Maximum nodes in context output").option("--edge-limit <value>","Maximum edges and missing-reference rows in context output").option("--token-budget <value>","Maximum estimated tokens in context output").option("--cursor <value>","Continue an equivalent context query").option("--direction <value>","Context traversal direction (outgoing, incoming, or both)").option("--kind <value>","Restrict context traversal to registered relationship kinds (repeatable or comma-separated)",d).description("Show dependency relationships for an item.").action(zo)}export{ge as looksLikeSchemaSubcommandTypo,mo as parsePositiveIntOption,H as parseSchemaOrderOption,he as registerCommanderOptionContracts,Gn as registerMutationCommands};
20
+ //# sourceMappingURL=register-mutation-XJPAW63D.js.map