@unbrained/pm-cli 2026.11.24 → 2026.11.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/error-guidance.js +5 -5
  3. package/dist/cli-bundle/bundle-manifest.json +1 -1
  4. package/dist/cli-bundle/chunks/{chunk-I2OJ5B4A.js → chunk-4FZH5BTV.js} +2 -2
  5. package/dist/cli-bundle/chunks/{chunk-YYT3MIRF.js → chunk-6OIHST4I.js} +1 -1
  6. package/dist/cli-bundle/chunks/{chunk-ZYCOM4MS.js → chunk-7EPYCU7U.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-TVIJ2VCU.js → chunk-BVJMVU4Z.js} +5 -5
  8. package/dist/cli-bundle/chunks/{chunk-23K6DQQY.js → chunk-C4KIZQHW.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-FXJYZBWV.js → chunk-CNUFU454.js} +40 -40
  10. package/dist/cli-bundle/chunks/{chunk-PQUBVRV5.js → chunk-CONBVY2O.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-HNKK2UG6.js → chunk-CZEMEPPQ.js} +3 -3
  12. package/dist/cli-bundle/chunks/{chunk-Z7MFVRDV.js → chunk-DF6A7C32.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-ZOX4SWRL.js → chunk-FHLOGAGA.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-FVY7U3SU.js +125 -0
  15. package/dist/cli-bundle/chunks/{chunk-VJSGUXGU.js → chunk-GBVF2ZB3.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-TKRY22SO.js → chunk-GZI7ZAB7.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-PW7U7WCE.js → chunk-K34FR5CO.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-D6PDUKUG.js → chunk-KHFUHGL3.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-DQDRA3SW.js → chunk-L6VS7F3R.js} +2 -2
  20. package/dist/cli-bundle/chunks/chunk-LOX3VY4T.js +2 -0
  21. package/dist/cli-bundle/chunks/{chunk-WWTPNIC2.js → chunk-LPW7S5KA.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-5DUP4AZA.js → chunk-MGJMQSN4.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-MXUSC5RS.js → chunk-OS5W4ZG2.js} +31 -31
  24. package/dist/cli-bundle/chunks/{chunk-37UDIJ2K.js → chunk-OWK2JL4I.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-SSALO4DB.js → chunk-SCIPT7WF.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-7X253M6Z.js → chunk-SX76UGEY.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-YW2HBHRO.js → chunk-VA4T37Q4.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-STOOTHZZ.js → chunk-WQOEVGLQ.js} +2 -2
  29. package/dist/cli-bundle/chunks/chunk-XHCIOLJP.js +3 -0
  30. package/dist/cli-bundle/chunks/{chunk-XFADNMGD.js → chunk-XKWJONAO.js} +2 -2
  31. package/dist/cli-bundle/chunks/chunk-YIGBEY7K.js +2 -0
  32. package/dist/cli-bundle/chunks/{chunk-7VRFEURZ.js → chunk-ZBOQEZ2H.js} +25 -25
  33. package/dist/cli-bundle/chunks/{chunk-PLIUU37C.js → chunk-ZLICQPRG.js} +2 -2
  34. package/dist/cli-bundle/chunks/{field-option-collisions-W66HSWMK.js → field-option-collisions-QE65APSD.js} +2 -2
  35. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-BPYKN5Q7.js → indexed-receipt-blobs-H3MMNXXG.js} +2 -2
  36. package/dist/cli-bundle/chunks/{item-revision-D3LSBNIR.js → item-revision-INDHJV6X.js} +2 -2
  37. package/dist/cli-bundle/chunks/item-transaction-LCKK4XXB.js +2 -0
  38. package/dist/cli-bundle/chunks/{mutation-actor-OKL3CQVX.js → mutation-actor-KU7BMLUN.js} +2 -2
  39. package/dist/cli-bundle/chunks/mutation-admission-3OMCTQD4.js +2 -0
  40. package/dist/cli-bundle/chunks/{register-list-query-3LBV6CS2.js → register-list-query-3GV3LBOT.js} +2 -2
  41. package/dist/cli-bundle/chunks/{register-mutation-72AGTMNE.js → register-mutation-GZLF47SX.js} +2 -2
  42. package/dist/cli-bundle/chunks/{register-operations-XERFG2SH.js → register-operations-PBJZGCAL.js} +2 -2
  43. package/dist/cli-bundle/chunks/{register-setup-W22L34Z4.js → register-setup-ZLJEF6NZ.js} +2 -2
  44. package/dist/cli-bundle/chunks/{runtime-schema-JP2KBHBY.js → runtime-schema-Y4SHTEXL.js} +2 -2
  45. package/dist/cli-bundle/chunks/{settlement-hook-6MR32OOC.js → settlement-hook-ESAAEBRM.js} +2 -2
  46. package/dist/cli-bundle/chunks/{stage-T2LKWN7C.js → stage-3WIZBD4N.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/chunk-3Y5PTQ2F.js +27 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-XDBHD4CY.js → chunk-4LQL4EO6.js} +3 -3
  49. package/dist/cli-bundle/focused-chunks/{chunk-RIE3SJSE.js → chunk-4SX2BN4V.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-B6BNHKUW.js → chunk-5RBC4WSE.js} +39 -39
  51. package/dist/cli-bundle/focused-chunks/chunk-7SSGTGZO.js +91 -0
  52. package/dist/cli-bundle/focused-chunks/{chunk-LMFIAQ2V.js → chunk-A4R57E4K.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{chunk-46MP7IZN.js → chunk-BOIMP2AR.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-GXP7Q4XM.js → chunk-BYQK5DGH.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/chunk-C3FEDTSD.js +44 -0
  56. package/dist/cli-bundle/focused-chunks/{chunk-REFMQY47.js → chunk-IAOKVKWW.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-YD66IRSL.js → chunk-JOKRDFMQ.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/{chunk-HL47UQZJ.js → chunk-MB56Y4M6.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{chunk-A6VEMCRR.js → chunk-NGFDPEP7.js} +1 -1
  60. package/dist/cli-bundle/focused-chunks/{chunk-RIQUIHYU.js → chunk-OCKKIECS.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{chunk-24VRBNKE.js → chunk-PKX2EHE3.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{chunk-C7WHWI7K.js → chunk-SXC2EO3E.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{chunk-3ELVASVA.js → chunk-TQIKDFOD.js} +2 -2
  64. package/dist/cli-bundle/focused-chunks/{chunk-OZOCEB2Q.js → chunk-TRL4JDWX.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{chunk-3OCDKITJ.js → chunk-UWWAVXG4.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/chunk-VMYVN36N.js +13 -0
  67. package/dist/cli-bundle/focused-chunks/{chunk-LMU7DDOA.js → chunk-VU2PH4PF.js} +2 -2
  68. package/dist/cli-bundle/focused-chunks/{chunk-EUQGZPGO.js → chunk-WL2R7T5G.js} +2 -2
  69. package/dist/cli-bundle/focused-chunks/chunk-WVA5KOXF.js +3 -0
  70. package/dist/cli-bundle/focused-chunks/{chunk-RLO2HCZT.js → chunk-X4EWD6TL.js} +2 -2
  71. package/dist/cli-bundle/focused-chunks/{chunk-SMMOZ3H3.js → chunk-XKLBTDJ7.js} +37 -37
  72. package/dist/cli-bundle/focused-chunks/{chunk-UVTUX54T.js → chunk-YYEWIKNI.js} +2 -2
  73. package/dist/cli-bundle/focused-chunks/{chunk-Z7W2RQIB.js → chunk-ZLRRII55.js} +2 -2
  74. package/dist/cli-bundle/focused-chunks/{field-option-collisions-UODPSV6W.js → field-option-collisions-5ROXGUME.js} +2 -2
  75. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-EGEJMG3G.js → indexed-receipt-blobs-PG2VJ3MB.js} +2 -2
  76. package/dist/cli-bundle/focused-chunks/{item-revision-QH7RNBX4.js → item-revision-KYMSQVZE.js} +2 -2
  77. package/dist/cli-bundle/focused-chunks/{item-transaction-ZO72OINF.js → item-transaction-I4HLVHEJ.js} +2 -2
  78. package/dist/cli-bundle/focused-chunks/{mutation-actor-PHVLKG4I.js → mutation-actor-GGOQKAE6.js} +2 -2
  79. package/dist/cli-bundle/focused-chunks/{mutation-admission-ZSG5OECH.js → mutation-admission-OS36ZCMH.js} +2 -2
  80. package/dist/cli-bundle/focused-chunks/{runtime-schema-6RQMIDTN.js → runtime-schema-YXPYDD2C.js} +2 -2
  81. package/dist/cli-bundle/focused-chunks/{settlement-hook-FMLGKG7J.js → settlement-hook-4MGRERCT.js} +2 -2
  82. package/dist/cli-bundle/focused-chunks/{stage-AQMKRVX4.js → stage-4ZFWJUKO.js} +2 -2
  83. package/dist/cli-bundle/main.js +18 -18
  84. package/dist/cli-bundle/sdk-authoring.js +1 -1
  85. package/dist/cli-bundle/sdk-contracts.js +1 -1
  86. package/dist/cli-bundle/sdk-core.js +1 -1
  87. package/dist/cli-bundle/sdk-governance.js +1 -1
  88. package/dist/cli-bundle/sdk-graph.js +1 -1
  89. package/dist/cli-bundle/sdk-merge.js +61 -61
  90. package/dist/cli-bundle/sdk-query.js +1 -1
  91. package/dist/cli-bundle/sdk-runtime.js +1 -1
  92. package/dist/cli-bundle/sdk-testing.js +1 -1
  93. package/dist/cli-bundle/sdk.js +12 -12
  94. package/dist/core/shared/command-line.d.ts +54 -4
  95. package/dist/core/shared/command-line.js +1 -1
  96. package/dist/core/shared/errors.d.ts +9 -0
  97. package/dist/core/shared/secret-rules.js +5 -5
  98. package/dist/core/shared/url-credentials.d.ts +16 -3
  99. package/dist/core/shared/url-credentials.js +1 -1
  100. package/dist/core/store/item-store.d.ts +26 -4
  101. package/dist/core/store/item-store.js +1 -1
  102. package/dist/sdk/command-line.d.ts +1 -1
  103. package/dist/sdk/command-line.js +1 -1
  104. package/dist/sdk/context-intent-contracts.js +1 -1
  105. package/dist/sdk/governance/tracked-runtime-cache.js +1 -1
  106. package/dist/sdk/index.d.ts +1 -1
  107. package/dist/sdk/lifecycle/claim.d.ts +21 -1
  108. package/dist/sdk/lifecycle/claim.js +1 -1
  109. package/dist/sdk/lifecycle/task-composition.js +1 -1
  110. package/dist/sdk/ownership-source.d.ts +15 -1
  111. package/dist/sdk/ownership-source.js +1 -1
  112. package/dist/sdk/public-surface.json +1 -1
  113. package/dist/sdk/runtime-primitives.d.ts +1 -1
  114. package/docs/AGENT_GUIDE.md +2 -2
  115. package/docs/CONFIGURATION.md +1 -0
  116. package/docs/MUTATION_INTEGRITY.md +97 -8
  117. package/docs/SDK.md +40 -3
  118. package/docs/WORKSPACE_POSITION_AND_LIFECYCLE.md +17 -4
  119. package/marketplace.json +1 -1
  120. package/package.json +1 -1
  121. package/packages/pm-beads/package.json +1 -1
  122. package/packages/pm-calendar/package.json +1 -1
  123. package/packages/pm-command-kit/package.json +1 -1
  124. package/packages/pm-digital-twin/package.json +1 -1
  125. package/packages/pm-governance-audit/package.json +1 -1
  126. package/packages/pm-guide-shell/package.json +1 -1
  127. package/packages/pm-kanban/package.json +1 -1
  128. package/packages/pm-lifecycle-hooks/package.json +1 -1
  129. package/packages/pm-linked-test-adapters/package.json +1 -1
  130. package/packages/pm-search-advanced/package.json +1 -1
  131. package/packages/pm-templates/package.json +1 -1
  132. package/packages/pm-todos/package.json +1 -1
  133. package/packages/pm-vcs/package.json +1 -1
  134. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  135. package/plugins/pm-claude/package.json +1 -1
  136. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  137. package/plugins/pm-codex/package.json +1 -1
  138. package/plugins/pm-codex/plugin.json +1 -1
  139. package/runtime-dependencies.json +1 -1
  140. package/dist/cli-bundle/chunks/chunk-7IROAPWI.js +0 -3
  141. package/dist/cli-bundle/chunks/chunk-AWB5KBJS.js +0 -2
  142. package/dist/cli-bundle/chunks/chunk-I3BFCKZR.js +0 -2
  143. package/dist/cli-bundle/chunks/chunk-YOPTAIBD.js +0 -125
  144. package/dist/cli-bundle/chunks/item-transaction-M6NTBYH3.js +0 -2
  145. package/dist/cli-bundle/chunks/mutation-admission-EKPEOZMF.js +0 -2
  146. package/dist/cli-bundle/focused-chunks/chunk-3GT4A3ZN.js +0 -44
  147. package/dist/cli-bundle/focused-chunks/chunk-3Z7MCUJM.js +0 -3
  148. package/dist/cli-bundle/focused-chunks/chunk-5LDBS6MS.js +0 -91
  149. package/dist/cli-bundle/focused-chunks/chunk-FDZPRJXJ.js +0 -27
  150. package/dist/cli-bundle/focused-chunks/chunk-Q2HY44LV.js +0 -13
@@ -1,3 +1,3 @@
1
- import{a as A,c as b,d as C,e as E,k as S,m as x}from"./chunk-WWTPNIC2.js";import{lb as w,mb as R,nb as k}from"./chunk-7VRFEURZ.js";import{Ka as v,pa as p,sa as g,ta as a}from"./chunk-ZYCOM4MS.js";import{ca as O,od as B}from"./chunk-YOPTAIBD.js";import{Af as y,Ih as I,uf as H,zf as u}from"./chunk-FXJYZBWV.js";import{A as c,C as f}from"./chunk-YYT3MIRF.js";function _(r,e){if(typeof r!="string")return;let o=Number.parseInt(r,10);if(!/^\d+$/.test(r.trim())||!Number.isSafeInteger(o))throw new f(`history-compact ${e} must be a non-negative integer.`,c.USAGE);return o}async function D(r,e,o){let t=p(o),s=Date.now(),i=await O(a(e,"ids")),l=i===void 0?void 0:B(i),m=_(e.allOver,"--all-over"),d=_(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 n=e.closed===!0?"closed":e.allStreams===!0?"all-streams":void 0;if((l!==void 0||m!==void 0||n!==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(b(r,{ids:l,allOver:m,scope:n}),r!==void 0&&d!==void 0)throw new f("history-compact: --min-entries applies only in bulk mode (single-id mode compacts the named stream).",c.USAGE);if(r===void 0){let h=await C({ids:l,scope:n,allOver:m,minEntries:d,dryRun:e.dryRun===!0,author:a(e,"author"),message:a(e,"message"),force:!!e.force},t);u(h,t),h.totals.items_errored>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let h=await A(r,{before:a(e,"before"),dryRun:e.dryRun===!0,author:a(e,"author"),message:a(e,"message"),force:!!e.force},t);u(h,t)}t.profile&&y(`profile:command=history-compact took_ms=${Date.now()-s}`)}async function N(r,e,o,t){let s=p(t),i=Date.now(),l=await x(r,e,{author:a(o,"author"),message:a(o,"message"),force:!!o.force},s);await v(s,l),u(l,s),s.profile&&y(`profile:command=restore took_ms=${Date.now()-i}`)}async function F(r,e){let o=p(e),t=await S({verify:a(r,"verify"),output:a(r,"output"),hashAlgorithm:a(r,"hashAlgorithm")},o);"format"in t?(I(t),o.quiet||H(`${JSON.stringify(t,null,2)}
1
+ import{a as A,c as b,d as C,e as E,k as S,m as x}from"./chunk-LPW7S5KA.js";import{lb as w,mb as R,nb as k}from"./chunk-ZBOQEZ2H.js";import{Ka as v,pa as p,sa as g,ta as a}from"./chunk-7EPYCU7U.js";import{ca as O,od as B}from"./chunk-FVY7U3SU.js";import{Af as y,Ih as I,uf as H,zf as u}from"./chunk-CNUFU454.js";import{A as c,C as f}from"./chunk-6OIHST4I.js";function _(r,e){if(typeof r!="string")return;let o=Number.parseInt(r,10);if(!/^\d+$/.test(r.trim())||!Number.isSafeInteger(o))throw new f(`history-compact ${e} must be a non-negative integer.`,c.USAGE);return o}async function D(r,e,o){let t=p(o),s=Date.now(),i=await O(a(e,"ids")),l=i===void 0?void 0:B(i),m=_(e.allOver,"--all-over"),d=_(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 n=e.closed===!0?"closed":e.allStreams===!0?"all-streams":void 0;if((l!==void 0||m!==void 0||n!==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(b(r,{ids:l,allOver:m,scope:n}),r!==void 0&&d!==void 0)throw new f("history-compact: --min-entries applies only in bulk mode (single-id mode compacts the named stream).",c.USAGE);if(r===void 0){let h=await C({ids:l,scope:n,allOver:m,minEntries:d,dryRun:e.dryRun===!0,author:a(e,"author"),message:a(e,"message"),force:!!e.force},t);u(h,t),h.totals.items_errored>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let h=await A(r,{before:a(e,"before"),dryRun:e.dryRun===!0,author:a(e,"author"),message:a(e,"message"),force:!!e.force},t);u(h,t)}t.profile&&y(`profile:command=history-compact took_ms=${Date.now()-s}`)}async function N(r,e,o,t){let s=p(t),i=Date.now(),l=await x(r,e,{author:a(o,"author"),message:a(o,"message"),force:!!o.force},s);await v(s,l),u(l,s),s.profile&&y(`profile:command=restore took_ms=${Date.now()-i}`)}async function F(r,e){let o=p(e),t=await S({verify:a(r,"verify"),output:a(r,"output"),hashAlgorithm:a(r,"hashAlgorithm")},o);"format"in t?(I(t),o.quiet||H(`${JSON.stringify(t,null,2)}
2
2
  `)):u(t,o),"ok"in t&&!t.ok&&(process.exitCode=c.GENERIC_FAILURE)}function ee(r,e){r.command(e?"attest":"history-attest",{hidden:!e}).summary("Export or verify history proof.").option("--verify <file>","Compare retained streams with a detached JSON proof").option("--output <file>","Create a proof file and return a compact receipt").option("--hash-algorithm <name>","Bundle digest algorithm: sha256 (default) or sha512").description("Export exact-byte history commitments, or verify an independently retained proof without tracker writes.").action(F),r.command("restore",{hidden:!e}).summary("Restore a version.").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(N),r.command(e?"redact":"history-redact",{hidden:!e}).summary("Redact sensitive values.").argument("<id>","Item id").option("--literal <value>","Literal; repeatable",g).option("--regex <value>","Raw RegExp source (repeatable; e.g. /var/[a-z]+) or /pattern/flags. Leading-slash input is a literal only when the final unescaped slash is followed by supported JavaScript flag letters or nothing.",g).option("--replacement <value>",'Default: "[redacted]"').option("--dry-run","Preview; no item/history edits").option("--author <value>","Author").option("--message <value>","Audit marker message").option("--force","Override owner/lock").description("Redact and reseal item history.").action(async(o,t,s)=>{let i=p(s),l=Date.now(),m=Array.isArray(t.literal)?t.literal:void 0,d=Array.isArray(t.regex)?t.regex:void 0,n=await E(o,{literal:m,regex:d,replacement:a(t,"replacement"),dryRun:t.dryRun===!0,author:a(t,"author"),message:a(t,"message"),force:!!t.force},i);n.changed&&!n.dry_run&&await v(i,n),u(n,i),i.profile&&y(`profile:command=history-redact took_ms=${Date.now()-l}`)}),r.command(e?"repair":"history-repair",{hidden:!e}).summary("Repair drift.").argument("[id]","Item id (omit with --all)").option("--salvage-tail","Recover invalid tail; requires verified prefix").option("--append-only","Bridge breaks; never rewrite entries").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(o,t,s)=>{let i=p(s),l=Date.now(),m=t.all===!0;R(o,m);let d={dryRun:t.dryRun===!0,author:a(t,"author"),message:a(t,"message"),force:!!t.force,normalizeProvenance:t.normalizeProvenance===!0,salvageTail:t.salvageTail===!0,appendOnly:t.appendOnly===!0};if(m){let n=await k(d,i);u(n,i),n.totals.failed>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let n=await w(o,d,i);u(n,i)}i.profile&&y(`profile:command=history-repair took_ms=${Date.now()-l}`)}),r.command(e?"compact":"history-compact",{hidden:!e}).summary("Compact streams.").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 IDs: comma/newline text, - stdin, or @path file").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(D)}export{ee as a};
3
- //# sourceMappingURL=chunk-VJSGUXGU.js.map
3
+ //# sourceMappingURL=chunk-GBVF2ZB3.js.map
@@ -1,2 +1,2 @@
1
- import{I as C,J as I,K as v,L,M as g,N as y,Qa as S,fd as D,gc as z,gd as G,hc as w,td as P,ud as W,uf as U}from"./chunk-FXJYZBWV.js";import{mb as h}from"./chunk-I2OJ5B4A.js";import{G as $,H as V,M as B,j as F,k as p,m as E,n as M,o as k,s as R}from"./chunk-7IROAPWI.js";import{A as x,C as _}from"./chunk-YYT3MIRF.js";import{Command as ae}from"commander";function nt(e){return new ae().name("pm").description("Universal, flexible, extensible, agent-optimized project management CLI for any project or programming language.").version(e).showHelpAfterError(!1).allowExcessArguments(!1).allowUnknownOption(!1).configureOutput({writeOut:t=>{U(t)},writeErr:()=>{}}).option("--json","Output JSON instead of TOON; mutations emit a flat receipt with top-level id/status/changed_field_count while reads use documented entity or collection envelopes").option("--lean","Omit null and empty containers from JSON output").option("--token-accounting","Attach a bounded per-section token-cost receipt to command output").option("--output-include <fields>","Retain comma-separated fields or sections in read output").option("--output-limit <count>","Bound rows in read output").option("--output-budget <tokens|unbounded>","Bound estimated tokens in read output or explicitly disable the default ceiling").option("--output-format <toon|json>","Select the result encoding for reads and mutations").option("--output-session <state>","Carry a JSON session budget and served-item ledger across read calls").option("--output-cursor <cursor>","Resume continuation_kind=output_cursor").option("--output-row-contract","Include row selectors, encoding metadata, and read-output receipts").option("--quiet","Suppress stdout output").option("--no-changed-fields","Omit the changed_fields array from mutation output (keeps changed_field_count)").option("--full-changed-fields","Restore the legacy full mutation envelope and changed_fields array").option("--id-only","Print only id and status for single-item mutation output").option("--pm-path <dir>","Explicit tracker storage path for this command (preferred over --path)").option("--path <dir>","Backward-compatible alias for --pm-path; this is the tracker storage path, not a workspace cwd").option("--no-extensions","Disable extension loading").option("--no-pager","Disable pager integration for help and long output").option("--explain","Render extended rationale and examples in help output").option("--all","Reveal every public command and compatibility alias").option("--profile","Print deterministic timing diagnostics").option("--author <id>","Override mutation author for this invocation").option("--expect-hash <revision>","Refuse writes to the named item unless it is still at this item_hash from pm get (a bare hash names the command's <id>; guard each other item with <id>=<item_hash>, repeatable)",(t,n)=>[...n??[],t]).exitOverride()}var j=new Set(["append","claim","close","close-task","comments","copy","delete","deps","docs","files","focus","get","history","history-compact","history-redact","history-repair","learnings","notes","pause-task","release","restore","start-task","test","update"]),q=new Map([["files","discover"],["item","complete"]]),ce=new Map([["append",1],["close",1],["close-task",1],["comments",1],["item complete",1],["learnings",1],["notes",1],["restore",1]]);function K(e){let t=p(e?.trim().toLowerCase()??"");return j.has(t)||q.has(t)}function ue(e,t,n){let o=j.has(n)?t+1:void 0,s=g(e.slice(t+1));if(s===void 0)return o;let r=t+1+s,a=`${n} ${e[r]}`,i=p(a);return i===a?n==="item"&&e[r]==="complete"?r+1:o:K(i)?N(e,r,i):void 0}function N(e,t,n){if(["history","context","ctx","update","close","item"].includes(n))return ue(e,t,n);let o=q.get(n);if(o===void 0)return t+1;let s=e[t+1]?.toLowerCase()===o;return t+(s?2:1)}function le(e){let t=new Map;for(let n of h(e))for(let o of[n.flag,n.short,...n.aliases??[]])o&&t.set(o,n);return t}function de(e){let t=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="--")break;o==="--id"?(t.push({index:n,consumed:2,value:e[n+1]}),n+=1):o.startsWith("--id=")&&t.push({index:n,consumed:1,value:o.slice(5)})}return t}function fe(e,t,n){if(e.indexOf("=")>=0||t===void 0||t.startsWith("-"))return!1;let s=n.get(e);return s!==void 0&&s.value_type!=="boolean"}function pe(e,t,n,o,s){let r=0;for(let a=t;a<e.length;a+=1){let i=e[a];if(i==="--")break;if(i==="--id"){a+=1;continue}if(!i.startsWith("--id=")){if(!i.startsWith("-")){if(a<o)return!0;r+=1;continue}fe(i,e[a+1],s)&&(a+=1)}}return r>(ce.get(p(n))??0)}function Y(e){let t=g(e),n=t===void 0?void 0:e[t]?.toLowerCase();if(n!=="context"&&n!=="ctx"&&!K(n))return{argv:[...e],changed:!1,conflict:!1};let o=N(e,t,n);if(o===void 0)return{argv:[...e],changed:!1,conflict:!1};let s=o>t+1?`${p(e.slice(t,o-1).join(" "))} ${e[o-1]}`:n,r=le(s),a=de(e),i=a[0];if(!i||!i.value?.trim())return{argv:[...e],changed:!1,conflict:!1};if(a.length>1||pe(e,o,s,i.index,r))return{argv:[...e],changed:!1,conflict:!0,itemId:i.value};let c=[...e.slice(0,i.index),...e.slice(i.index+i.consumed)],u=g(c),l=N(c,u,n);return c.splice(l,0,i.value),{argv:c,changed:!0,conflict:!1,itemId:i.value}}var me=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),he=new Set(["toon","json"]);function ge(e,t,n){let o=e[t];if(I.has(o))return n.booleanFlags.add(o),1;let s=o.indexOf("="),r=s>0?o.slice(0,s):o;if(!C.has(r))return 1;let a=s>0?o.slice(s+1):void 0,i=a===void 0&&L(r,e[t+1]),c=a??(i?e[t+1]:void 0);return r==="--author"?n.author=c??"":typeof c=="string"&&c.length>0&&(me.has(r)?n.outputValues:n.pathValues).set(r,c),i?2:1}function be(e){return e.outputValues.get("--output-format")!=="toon"&&(e.booleanFlags.has("--json")||e.outputValues.get("--output-format")==="json"||e.pathValues.get("--format")?.trim().toLowerCase()==="json")}function xe(e){let t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map},n=0;for(;n<e.length&&e[n]!=="--";)n+=ge(e,n,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions")||["history attest","history-attest"].includes(ee(e)??""),noPager:t.booleanFlags.has("--no-pager"),json:be(t),quiet:t.booleanFlags.has("--quiet"),lean:t.booleanFlags.has("--lean"),tokenAccounting:t.booleanFlags.has("--token-accounting"),...t.booleanFlags.has("--output-row-contract")?{outputRowContract:!0}:{},...t.outputValues.get("--output-include")===void 0?{}:{outputInclude:t.outputValues.get("--output-include")},...t.outputValues.get("--output-limit")===void 0?{}:{outputLimit:t.outputValues.get("--output-limit")},...t.outputValues.get("--output-budget")===void 0?{}:{outputBudget:t.outputValues.get("--output-budget")},...he.has(t.outputValues.get("--output-format"))?{outputFormat:t.outputValues.get("--output-format")}:{},...t.outputValues.get("--output-session")===void 0?{}:{outputSession:t.outputValues.get("--output-session")},...t.outputValues.get("--output-cursor")===void 0?{}:{outputCursor:t.outputValues.get("--output-cursor")},...t.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function Z(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="--")break;if(I.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(C.has(o)){n+=L(o,e[n+1])?2:1;continue}if(v(o)){n+=1;continue}t.push(o),n+=1}return t}function _e(e){let t=Z(e);if(t[0]?.trim().toLowerCase()==="help"){let r=[];for(let a=1;a<t.length;a+=1){let i=t[a];if(i.startsWith("-"))break;r.push(i.trim().toLowerCase())}return{requested:!0,commandPathTokens:r}}if(t.findIndex(r=>r==="--help"||r==="-h")<0)return{requested:!1,commandPathTokens:[]};let s=[];for(let r of t){if(r.startsWith("-"))break;s.push(r.trim().toLowerCase())}return{requested:!0,commandPathTokens:s}}function O(e){return g(e)}function Ce(e){return y(e)}function ke(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:_e(e).requested}function bt(e){let t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(r=>process.env[r]),o=()=>{for(let[r,a]of t.entries()){let i=n[r];i===void 0?delete process.env[a]:process.env[a]=i}},s=xe(e);return ke(e,s)&&(process.env.PAGER="cat",process.env.MANPAGER="cat",process.env.GIT_PAGER="cat",(typeof process.env.LESS!="string"||process.env.LESS.trim().length===0)&&(process.env.LESS="FRX")),o}var Ie=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function ye(e){let t=O(e);if(t===void 0||e[t]!=="extension")return[...e];let n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!Ie.has(n))return[...e];if(e.includes("--help")||e.includes("-h"))return[...e];let o=`--${n}`;return e.includes(o)?[...e]:[...e.slice(0,t+1),o,...e.slice(t+2)]}var Se=new Set(["pm","pm-cli"]);function we(e,t){let n=O(e);if(n===void 0)return e;let o=e[n];return Se.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function Oe(e,t){let n=O(e);if(n!==void 0&&e[n]==="help"){let i=O(e.slice(n+1));n=i===void 0?void 0:n+1+i}if(n===void 0)return e;let o=e[n],s=M[o.trim().toLowerCase()];if(!s)return e;let r=s.split(" "),a=[...e.slice(0,n),...r,...e.slice(n+1)];return t.push({from:o,to:r,reason:"command_alias",confidence:"high"}),a}function T(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function X(e){return T(e).replace(/-/g,"")}function J(e,t,n){let o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function Te(e){let t=[],n=o=>{typeof o=="string"&&o.startsWith("--")&&t.push(o)};n(e.flag);for(let o of e.aliases??[])n(o);return t}function Ae(e,t){let n=t??h(e),o=new Map,s=new Map,r=new Map,a=new Set;for(let i of n){let c=Te(i);if(c.length===0)continue;let u=`--${T(c[0])}`;for(let d of c)J(o,T(d),u),J(s,X(d),u);let l=X(u);r.has(u)||r.set(u,l),i.list===!0&&a.add(u)}return{canonicalByNormalized:o,canonicalByCompact:s,canonicalComparables:[...r.entries()].map(([i,c])=>({canonicalFlag:i,comparable:c})),listCanonicalFlags:a}}function H(e,t){let n=T(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};let s=n.replace(/-/g,""),r=t.canonicalByCompact.get(s);if(typeof r=="string")return{flag:r,reason:"flag_alias",confidence:"high"};let a=s.length>=8?2:1,i=Number.POSITIVE_INFINITY,c,u=!1;for(let l of t.canonicalComparables){let d=S(s,l.comparable,a);if(d!==null){if(d<i){i=d,c=l.canonicalFlag,u=!1;continue}d===i&&c!==l.canonicalFlag&&(u=!0)}}return!c||u||!Number.isFinite(i)||i<=0?null:{flag:c,reason:"flag_typo",confidence:i>=2?"medium":"high"}}function xt(e){let t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function Ee(e,t=!1){if(t||e.includes("://"))return null;let n=e.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!n)return null;let o=n[1],s=n[3];return s.length===0||n[2]===":"&&/\s/u.test(e)?null:{key:o,value:s}}function Le(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};let o=e.indexOf("="),s=o>=0?e.slice(0,o):e,r=o>=0?e.slice(o+1):void 0,a=H(s,t);if(!a)return{tokens:[e]};let i=r===void 0?a.flag:`${a.flag}=${r}`;return i===e?{tokens:[e]}:{tokens:[i],event:{from:e,to:[i],reason:a.reason,confidence:a.confidence}}}function Pe(e){let t=new Set,n=!1;for(let o=0;o<e.length;o+=1){if(n){t.add(o),n=!1;continue}let s=e[o];n=s==="--path"||s==="--pm-path"}return t}function Ne(e){if(!e.startsWith("--"))return null;let t=e.indexOf("=");return t<0?{flag:e}:{flag:e.slice(0,t),inlineValue:e.slice(t+1)}}function Fe(e,t,n){n.push(e[t]);let o=e[t+1];return typeof o=="string"&&o!=="--"?(n.push(o),t+2):t+1}function Me(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};let s=[],r=t+1;for(;r<e.length&&e[r]!=="--"&&!e[r].startsWith("-")&&(s.length===0||o.has(n.flag));)s.push(e[r]),r+=1;let a=s.length===0?1:1+s.length;return{originalTokens:e.slice(t,t+a),value:s.length===0?void 0:s.join(","),consumed:a}}function ve(e,t,n,o){let s=e.get(n);if(s){s.values.push(o.value),s.occurrences+=1;return}e.set(n,{outputIndex:t.length,originalTokens:o.originalTokens,values:[o.value],occurrences:1}),t.push(null)}function Re(e,t){let n=[],o=[];for(let[s,r]of e){if(!(r.occurrences>=2||t.has(s)&&r.originalTokens.length>2)){o.push({outputIndex:r.outputIndex,tokens:r.originalTokens});continue}let i=`${s}=${r.values.join(",")}`;o.push({outputIndex:r.outputIndex,tokens:[i]}),n.push({from:`${s} (x${r.occurrences})`,to:[i],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function $e(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(let n of t)e.splice(n.outputIndex,1,...n.tokens)}function Ve(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};let s=[],r=new Map,a=0;for(;a<e.length;){let u=e[a];if(u==="--"){s.push(...e.slice(a));break}if(n.has(u)){a=Fe(e,a,s);continue}let l=Ne(u);if(!l||!t.has(l.flag)){s.push(u),a+=1;continue}let d=Me(e,a,l,o);if(d.value===void 0){s.push(u),a+=d.consumed;continue}ve(r,s,l.flag,{originalTokens:d.originalTokens,value:d.value}),a+=d.consumed}let{events:i,splices:c}=Re(r,o);return $e(s,c),{argv:s,events:i}}var Q=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function Be(e,t){if(e!=="test"||t.length<2)return!1;let n=t[t.length-1],o=t[t.length-2],s=Q.get(o);return s!==void 0&&s.has(n)}function ze(e,t,n){if(t!=="test")return e;let o=[],s=0;for(;s<e.length;){let r=e[s];if(r==="--")return o.push(...e.slice(s)),o;let a=Q.get(r),i=a?e[s+1]:void 0;if(!a||typeof i!="string"||!a.has(i)){o.push(r),s+=1;continue}let c=s+2;for(;c<e.length&&!e[c].startsWith("-");)c+=1;if(c-(s+2)!==1){o.push(r),s+=1;continue}let u=e[s+2],l=`${i}=${u}`;o.push(r,l),n.push({from:`${r} ${i} ${u}`,to:[r,l],reason:"bare_key_value",confidence:"high"}),s+=3}return o}function De(e,t,n,o){let s=[],r=Pe(e);for(let a=0;a<e.length;a+=1){let i=e[a];if(i==="--"){s.push(...e.slice(a));break}let c=r.has(a),u=s[s.length-1];if(i.startsWith("--")){let b=Le(i,t,c);s.push(...b.tokens),b.event&&o.push(b.event);continue}let l=Ee(i,c);if(!l||typeof u=="string"&&u.startsWith("-")&&!u.includes("=")||["search","comments","notes","learnings"].includes(n)||Be(n,s)){s.push(i);continue}let d=H(l.key,t);if(!d){s.push(i);continue}let m=l.value.startsWith("-")?[`${d.flag}=${l.value}`]:[d.flag,l.value];s.push(...m),o.push({from:i,to:m,reason:"bare_key_value",confidence:d.confidence})}return s}function Ge(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--verify"){let o=e[t+1];if(o===void 0||o==="--")throw new _("history attest --verify requires a bundle file.",x.USAGE);e.splice(t,2,`--verify=${o}`)}else(C.has(n)||n==="--output"||n==="--hash-algorithm")&&(t+=1)}}function We(e,t){if(!e.some(o=>o==="--help"||o==="-h"))return;let n=new Set(h(t).flatMap(o=>[o.flag,...o.aliases??[],...o.short===void 0?[]:[o.short]]));for(let o=0;o<e.length;o+=1){let s=e[o];if(s==="--")break;s!=="--help"&&s!=="-h"||n.has(e[o-1])&&!I.has(e[o-1])&&(e[o-1]=s)}}function _t(e){let t=[],n=we(e,t),o=ye(n);(o.length!==n.length||o.some((b,re)=>b!==n[re]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});let s=Oe(o,t),r=Y(s);if(r.conflict)throw new _("Provide the item id either positionally or with --id, not both.",x.USAGE);r.changed&&t.push({from:`--id ${r.itemId}`,to:[r.itemId],reason:"item_id_alias",confidence:"high"});let a=Ce(r.argv),i=ee(r.argv),c=p(i??a??""),u=Ae(i??a),l=De(r.argv,u,c,t),d=ze(l,c,t),m=Ve(d,u.listCanonicalFlags,C,a==="create"?new Set(["--tags"]):new Set);for(let b of m.events)t.push(b);return We(m.argv,i??a),i==="history attest"&&Ge(m.argv),{argv:m.argv,commandName:a,trace:t}}function ee(e){let t=Z(e),n=t[0]?.trim().toLowerCase(),o=t[1]?.trim().toLowerCase(),s=F(t);return s?s.canonical:(n==="extension"||n==="package"||n==="packages")&&typeof o=="string"&&o.length>0&&!o.startsWith("-")?`${n} ${o}`:n}function Ct(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--type"){let o=e[t+1];if(typeof o=="string"&&o.trim().length>0)return o.trim();continue}if(n.startsWith("--type=")){let o=n.slice(7).trim();if(o.length>0)return o}}}function wt(e){if(e===void 0)return()=>{};let t=e.trim();if(t.length===0)throw new _("--author requires a non-empty value.",x.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});let n=z();w(t);let o=!1;return()=>{o||(o=!0,n===void 0?w(void 0):w(n))}}var f=Object.freeze({clock:"PM_CLOCK",tickMs:"PM_CLOCK_TICK_MS",seed:"PM_SEED"});function A(e,t,n,o){return new _(e,x.USAGE,{code:"invalid_reproducible_process_environment",reason:t,field:n,required:`${f.clock} and ${f.seed}; ${f.tickMs} is optional`,nextSteps:[`Set ${f.clock} to an ISO-8601 instant with Z or a numeric UTC offset and ${f.seed} to a non-empty reproducibility seed.`,`Optionally set ${f.tickMs} to a non-negative integer; it defaults to 1.`,"Unset all three variables to retain normal wall-clock and cryptographic-random behavior."],recovery:{recovery_mode:"compact",provided_fields:o,missing_required_fields:t==="incomplete"?[f.clock,f.seed].filter(s=>!o.includes(s)):void 0}})}function Ue(e){let t=e[f.clock],n=e[f.tickMs],o=e[f.seed],s=[[f.clock,t],[f.tickMs,n],[f.seed,o]].filter(a=>a[1]!==void 0).map(([a])=>a);if(s.length===0)return;if(t===void 0||o===void 0)throw A("Reproducible process execution requires PM_CLOCK and PM_SEED together.","incomplete",t===void 0?f.clock:f.seed,s);if(o.trim().length===0)throw A(`${f.seed} must not be empty.`,"invalid_value",f.seed,s);if(!B(t))throw A(`${f.clock} must be a valid ISO-8601 instant with Z or a numeric UTC offset.`,"invalid_value",f.clock,s);let r=n===void 0?1:Number(n);if(n?.trim().length===0||!Number.isSafeInteger(r)||r<0)throw A(`${f.tickMs} must be a non-negative integer.`,"invalid_value",f.tickMs,s);return $({clock:t,seed:o,tickMs:r})}function je(e){let t=Ue(e);return t===void 0?n=>n():V(t)}async function Pt(e,t){return je(e)(t)}var te=new Set([...Object.values(D),...G,"--full","--brief","--compact","--summary","--fields","--section","--token-budget"]),ne=new Set(["--full-changed-fields","--no-changed-fields","--id-only"]);function zt(e,t){if(!["block","unblock"].includes(e)||t.includes(e)||!t.includes("update"))return;let n=new Set(h("update").map(s=>s.flag));if((e==="block"?["--blocked-by","--blocked-reason"]:["--unset","--unblock-note"]).every(s=>n.has(s)))return e==="block"?{examples:[["update","<item-id>","--blocked-by","<blocker-id>","--blocked-reason","<reason>"]],nextSteps:["Choose the actual item and blocker identifiers before running update. --blocked-by records the blocker field and its blocked_by relationship."]}:{examples:[["update","<item-id>","--unset","blocked-by","--unset","blocked-reason","--unblock-note","<note>"]],nextSteps:[`Inspect the item's blockers before running update. --unset blocked-by removes the blocker field and the blocked_by rows naming it; other blocked_by relationships stay, so remove one with --dep-remove "id=<id>,kind=blocked_by" or all with --dep-remove kind=blocked_by. --unset blocked-reason clears the stale reason. --unblock-note alone records a note and does not unblock the item.`,"If your project also uses a blocked lifecycle status, choose its appropriate next status separately with update --status."]}}function qe(e,t){let n=e.includes("="),o=n?e.slice(e.indexOf("=")+1):t;if(!(!o||o.startsWith("--")))return{consumed:n?1:2,replacement:["--from",o],conflicts:["--from"]}}var Ke=["--depth","--output-include","--fields","--section","--for"];function Ye(e){let t=P(p(e.trim().toLowerCase()));if(t===void 0)return;let n=h(t),o=n.flatMap(a=>[a.flag,...a.aliases??[]]),s=[...W(t).keys()].filter(a=>o.includes(`--${a}`)),r=[...n.find(a=>a.flag==="--depth")?.values??[]];if(!(s.length===0&&r.length===0))return{command:t,modes:s,depth_values:r,declared_flags:o}}function Dt(e){return[...e.depth_values.length>0?[`--depth ${e.depth_values.join("|")}`]:[],...e.modes.map(t=>`--${t}`)].join(", ")}function Xe(e,t,n,o){let s=Ye(e);if(s===void 0||s.declared_flags.includes(t))return;let r=[...Ke,...s.modes.map(i=>`--${i}`)].filter(i=>i!==t);if(t==="--depth"){let i=n.includes("="),c=(i?n.slice(n.indexOf("=")+1):o)?.trim().toLowerCase();if(!c)return;let u=i?1:2;return s.modes.includes(c)?{consumed:u,replacement:[`--${c}`],conflicts:r}:c==="standard"?{consumed:u,replacement:[],conflicts:r}:void 0}let a=t.slice(2);return n===t&&s.depth_values.includes(a)?{consumed:1,replacement:["--depth",a],conflicts:r}:void 0}function Je(e,t,n,o){return t==="--since"&&e==="activity"?qe(n,o):t==="--toon"&&n===t?{consumed:1,replacement:["--output-format","toon"],conflicts:["--json","--format","--output-format","--stream"]}:Xe(e,t,n,o)}function Ze(e){let t=g(e);if(t===void 0)return;let n=e[t].trim().toLowerCase(),o=`${n} ${e[t+1]?.trim().toLowerCase()??""}`,s=p(o);return s!==o.trim()?s:n==="ctx"?"context":p(n)}function Gt(e,t,n){let o=e==="ctx"?"context":p(e);if(P(o)===void 0||t.includes("--")||Ze(t)!==o)return;let s=n.split("=",1)[0],r=t.flatMap((d,m)=>d===s||d.startsWith(`${s}=`)?[m]:[]);if(r.length!==1)return;let a=r[0],i=Je(o,s,t[a],t[a+1]);if(!i)return;let{replacement:c,consumed:u,conflicts:l}=i;if(!t.some(d=>l.includes(d.split("=",1)[0])))return[...t.slice(0,a),...c,...t.slice(a+u)]}function oe(e){let t=e.split("=",1)[0].replaceAll("_","-");return te.has(t)||t.length>=5&&[...te].some(n=>n.startsWith(t))}function Wt(e,t){let n=e.split("=",1)[0].replaceAll("_","-");return oe(n)?!ne.has(t):ne.has(n)?!oe(t):!0}function se(e){return e.trim().match(/--[a-z0-9][a-z0-9_-]*/i)?.[0]?.replaceAll("_","-").toLowerCase()}function Ut(e){if(!(!Array.isArray(e)||e.length===0))return y(e)}function He(e,t){let n=se(t);if(!n)return;let o=h(e).find(s=>s.flag===n||s.aliases?.includes(n));return o?o.value_type==="boolean"?null:`<${o.value_name??"value"}>`:"<value>"}function jt(e,t,n){let o=[...e],s=o.indexOf("--"),r=s<0?o.length:s;for(let a of n){let i=se(a);if(!i||o.slice(0,r).some(l=>l===i||l.startsWith(`${i}=`)))continue;let c=He(t,i),u=c?[i,c]:[i];o.splice(r,0,...u),r+=u.length}return o.length===e.length?void 0:R(o)}function Qt(e,t){let n=e.trim().split(/\s+/u);if(!(n.length<2||t.includes(n.join(" "))))for(let o=1;o<n.length;o+=1){if(!t.includes(n.slice(0,o).join(" ")))return;let s=n.slice(o).join(" "),r=k(s),a=new Set(t.filter(i=>i===s||i.endsWith(` ${s}`)||i===r?.canonical).map(i=>k(i)?.canonical??i).filter(i=>t.includes(i)));if(a.size>0)return a.size===1?[...a][0]:void 0}}var Qe={add:["create","append"],fetch:["get"],inspect:["get","health"],log:["history","comments","notes"],ls:["list"],pause:["release"],read:["get"],remove:["delete"],rm:["delete"],show:["get"],start:["start-task"]};function ie(e,t){let n=e.trim().toLowerCase(),o=t.trim().toLowerCase();if(o.length===0)return Number.POSITIVE_INFINITY;let s=n.split(" "),r=Qe[o]?.indexOf(p(n));if(r!==void 0&&r>=0)return r;if(n===o)return 10;if(s.includes(o))return 11;if(s.some(c=>c.startsWith(o)))return 12;let a=o.length>=5?2:1,i=Number.POSITIVE_INFINITY;for(let c of s){let u=S(c,o,a);u!==null&&(i=Math.min(i,u))}return Number.isFinite(i)?20+i:n.includes(o)?30:Number.POSITIVE_INFINITY}function en(e,t){return e.map(n=>({path:n,score:ie(n,t)})).filter(n=>Number.isFinite(n.score)).sort((n,o)=>n.score!==o.score?n.score-o.score:n.path===o.path?0:n.path<o.path?-1:1).map(n=>n.path)}function tn(e,t,n){let o=new Set(t),s=E.filter(i=>i.lifecycle==="deprecated").slice().sort((i,c)=>c.alias.length-i.alias.length),r=[],a=e.flatMap(i=>{let c=s.find(l=>i===l.alias||i.startsWith(`${l.alias} `)),u=i;if(c){let l=i.slice(c.alias.length);if(!o.has(`${c.canonical}${l}`))return[];u=`${c.canonical_argv.join(" ")}${l}`}return n!==void 0&&ie(i,n)<10&&r.push(u),[u]});return[...new Set(r.length>0?r:a)]}export{nt as a,K as b,Y as c,xe as d,Z as e,_e as f,O as g,Ce as h,bt as i,ye as j,xt as k,Ve as l,ze as m,_t as n,Ct as o,wt as p,f as q,Ue as r,je as s,Pt as t,zt as u,Ye as v,Dt as w,Gt as x,oe as y,Wt as z,Ut as A,He as B,jt as C,Qt as D,ie as E,en as F,tn as G};
2
- //# sourceMappingURL=chunk-TKRY22SO.js.map
1
+ import{I as C,J as I,K as v,L,M as g,N as y,Qa as S,fd as D,gc as z,gd as G,hc as w,td as P,ud as W,uf as U}from"./chunk-CNUFU454.js";import{mb as h}from"./chunk-4FZH5BTV.js";import{L as $,M as V,R as B,j as F,k as p,m as E,n as M,o as k,x as R}from"./chunk-XHCIOLJP.js";import{A as x,C as _}from"./chunk-6OIHST4I.js";import{Command as ae}from"commander";function nt(e){return new ae().name("pm").description("Universal, flexible, extensible, agent-optimized project management CLI for any project or programming language.").version(e).showHelpAfterError(!1).allowExcessArguments(!1).allowUnknownOption(!1).configureOutput({writeOut:t=>{U(t)},writeErr:()=>{}}).option("--json","Output JSON instead of TOON; mutations emit a flat receipt with top-level id/status/changed_field_count while reads use documented entity or collection envelopes").option("--lean","Omit null and empty containers from JSON output").option("--token-accounting","Attach a bounded per-section token-cost receipt to command output").option("--output-include <fields>","Retain comma-separated fields or sections in read output").option("--output-limit <count>","Bound rows in read output").option("--output-budget <tokens|unbounded>","Bound estimated tokens in read output or explicitly disable the default ceiling").option("--output-format <toon|json>","Select the result encoding for reads and mutations").option("--output-session <state>","Carry a JSON session budget and served-item ledger across read calls").option("--output-cursor <cursor>","Resume continuation_kind=output_cursor").option("--output-row-contract","Include row selectors, encoding metadata, and read-output receipts").option("--quiet","Suppress stdout output").option("--no-changed-fields","Omit the changed_fields array from mutation output (keeps changed_field_count)").option("--full-changed-fields","Restore the legacy full mutation envelope and changed_fields array").option("--id-only","Print only id and status for single-item mutation output").option("--pm-path <dir>","Explicit tracker storage path for this command (preferred over --path)").option("--path <dir>","Backward-compatible alias for --pm-path; this is the tracker storage path, not a workspace cwd").option("--no-extensions","Disable extension loading").option("--no-pager","Disable pager integration for help and long output").option("--explain","Render extended rationale and examples in help output").option("--all","Reveal every public command and compatibility alias").option("--profile","Print deterministic timing diagnostics").option("--author <id>","Override mutation author for this invocation").option("--expect-hash <revision>","Refuse writes to the named item unless it is still at this item_hash from pm get (a bare hash names the command's <id>; guard each other item with <id>=<item_hash>, repeatable)",(t,n)=>[...n??[],t]).exitOverride()}var j=new Set(["append","claim","close","close-task","comments","copy","delete","deps","docs","files","focus","get","history","history-compact","history-redact","history-repair","learnings","notes","pause-task","release","restore","start-task","test","update"]),q=new Map([["files","discover"],["item","complete"]]),ce=new Map([["append",1],["close",1],["close-task",1],["comments",1],["item complete",1],["learnings",1],["notes",1],["restore",1]]);function K(e){let t=p(e?.trim().toLowerCase()??"");return j.has(t)||q.has(t)}function ue(e,t,n){let o=j.has(n)?t+1:void 0,s=g(e.slice(t+1));if(s===void 0)return o;let r=t+1+s,a=`${n} ${e[r]}`,i=p(a);return i===a?n==="item"&&e[r]==="complete"?r+1:o:K(i)?N(e,r,i):void 0}function N(e,t,n){if(["history","context","ctx","update","close","item"].includes(n))return ue(e,t,n);let o=q.get(n);if(o===void 0)return t+1;let s=e[t+1]?.toLowerCase()===o;return t+(s?2:1)}function le(e){let t=new Map;for(let n of h(e))for(let o of[n.flag,n.short,...n.aliases??[]])o&&t.set(o,n);return t}function de(e){let t=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="--")break;o==="--id"?(t.push({index:n,consumed:2,value:e[n+1]}),n+=1):o.startsWith("--id=")&&t.push({index:n,consumed:1,value:o.slice(5)})}return t}function fe(e,t,n){if(e.indexOf("=")>=0||t===void 0||t.startsWith("-"))return!1;let s=n.get(e);return s!==void 0&&s.value_type!=="boolean"}function pe(e,t,n,o,s){let r=0;for(let a=t;a<e.length;a+=1){let i=e[a];if(i==="--")break;if(i==="--id"){a+=1;continue}if(!i.startsWith("--id=")){if(!i.startsWith("-")){if(a<o)return!0;r+=1;continue}fe(i,e[a+1],s)&&(a+=1)}}return r>(ce.get(p(n))??0)}function Y(e){let t=g(e),n=t===void 0?void 0:e[t]?.toLowerCase();if(n!=="context"&&n!=="ctx"&&!K(n))return{argv:[...e],changed:!1,conflict:!1};let o=N(e,t,n);if(o===void 0)return{argv:[...e],changed:!1,conflict:!1};let s=o>t+1?`${p(e.slice(t,o-1).join(" "))} ${e[o-1]}`:n,r=le(s),a=de(e),i=a[0];if(!i||!i.value?.trim())return{argv:[...e],changed:!1,conflict:!1};if(a.length>1||pe(e,o,s,i.index,r))return{argv:[...e],changed:!1,conflict:!0,itemId:i.value};let c=[...e.slice(0,i.index),...e.slice(i.index+i.consumed)],u=g(c),l=N(c,u,n);return c.splice(l,0,i.value),{argv:c,changed:!0,conflict:!1,itemId:i.value}}var me=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),he=new Set(["toon","json"]);function ge(e,t,n){let o=e[t];if(I.has(o))return n.booleanFlags.add(o),1;let s=o.indexOf("="),r=s>0?o.slice(0,s):o;if(!C.has(r))return 1;let a=s>0?o.slice(s+1):void 0,i=a===void 0&&L(r,e[t+1]),c=a??(i?e[t+1]:void 0);return r==="--author"?n.author=c??"":typeof c=="string"&&c.length>0&&(me.has(r)?n.outputValues:n.pathValues).set(r,c),i?2:1}function be(e){return e.outputValues.get("--output-format")!=="toon"&&(e.booleanFlags.has("--json")||e.outputValues.get("--output-format")==="json"||e.pathValues.get("--format")?.trim().toLowerCase()==="json")}function xe(e){let t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map},n=0;for(;n<e.length&&e[n]!=="--";)n+=ge(e,n,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions")||["history attest","history-attest"].includes(ee(e)??""),noPager:t.booleanFlags.has("--no-pager"),json:be(t),quiet:t.booleanFlags.has("--quiet"),lean:t.booleanFlags.has("--lean"),tokenAccounting:t.booleanFlags.has("--token-accounting"),...t.booleanFlags.has("--output-row-contract")?{outputRowContract:!0}:{},...t.outputValues.get("--output-include")===void 0?{}:{outputInclude:t.outputValues.get("--output-include")},...t.outputValues.get("--output-limit")===void 0?{}:{outputLimit:t.outputValues.get("--output-limit")},...t.outputValues.get("--output-budget")===void 0?{}:{outputBudget:t.outputValues.get("--output-budget")},...he.has(t.outputValues.get("--output-format"))?{outputFormat:t.outputValues.get("--output-format")}:{},...t.outputValues.get("--output-session")===void 0?{}:{outputSession:t.outputValues.get("--output-session")},...t.outputValues.get("--output-cursor")===void 0?{}:{outputCursor:t.outputValues.get("--output-cursor")},...t.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function Z(e){let t=[],n=0;for(;n<e.length;){let o=e[n];if(o==="--")break;if(I.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(C.has(o)){n+=L(o,e[n+1])?2:1;continue}if(v(o)){n+=1;continue}t.push(o),n+=1}return t}function _e(e){let t=Z(e);if(t[0]?.trim().toLowerCase()==="help"){let r=[];for(let a=1;a<t.length;a+=1){let i=t[a];if(i.startsWith("-"))break;r.push(i.trim().toLowerCase())}return{requested:!0,commandPathTokens:r}}if(t.findIndex(r=>r==="--help"||r==="-h")<0)return{requested:!1,commandPathTokens:[]};let s=[];for(let r of t){if(r.startsWith("-"))break;s.push(r.trim().toLowerCase())}return{requested:!0,commandPathTokens:s}}function O(e){return g(e)}function Ce(e){return y(e)}function ke(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:_e(e).requested}function bt(e){let t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(r=>process.env[r]),o=()=>{for(let[r,a]of t.entries()){let i=n[r];i===void 0?delete process.env[a]:process.env[a]=i}},s=xe(e);return ke(e,s)&&(process.env.PAGER="cat",process.env.MANPAGER="cat",process.env.GIT_PAGER="cat",(typeof process.env.LESS!="string"||process.env.LESS.trim().length===0)&&(process.env.LESS="FRX")),o}var Ie=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function ye(e){let t=O(e);if(t===void 0||e[t]!=="extension")return[...e];let n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!Ie.has(n))return[...e];if(e.includes("--help")||e.includes("-h"))return[...e];let o=`--${n}`;return e.includes(o)?[...e]:[...e.slice(0,t+1),o,...e.slice(t+2)]}var Se=new Set(["pm","pm-cli"]);function we(e,t){let n=O(e);if(n===void 0)return e;let o=e[n];return Se.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function Oe(e,t){let n=O(e);if(n!==void 0&&e[n]==="help"){let i=O(e.slice(n+1));n=i===void 0?void 0:n+1+i}if(n===void 0)return e;let o=e[n],s=M[o.trim().toLowerCase()];if(!s)return e;let r=s.split(" "),a=[...e.slice(0,n),...r,...e.slice(n+1)];return t.push({from:o,to:r,reason:"command_alias",confidence:"high"}),a}function T(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function X(e){return T(e).replace(/-/g,"")}function J(e,t,n){let o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function Te(e){let t=[],n=o=>{typeof o=="string"&&o.startsWith("--")&&t.push(o)};n(e.flag);for(let o of e.aliases??[])n(o);return t}function Ae(e,t){let n=t??h(e),o=new Map,s=new Map,r=new Map,a=new Set;for(let i of n){let c=Te(i);if(c.length===0)continue;let u=`--${T(c[0])}`;for(let d of c)J(o,T(d),u),J(s,X(d),u);let l=X(u);r.has(u)||r.set(u,l),i.list===!0&&a.add(u)}return{canonicalByNormalized:o,canonicalByCompact:s,canonicalComparables:[...r.entries()].map(([i,c])=>({canonicalFlag:i,comparable:c})),listCanonicalFlags:a}}function H(e,t){let n=T(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};let s=n.replace(/-/g,""),r=t.canonicalByCompact.get(s);if(typeof r=="string")return{flag:r,reason:"flag_alias",confidence:"high"};let a=s.length>=8?2:1,i=Number.POSITIVE_INFINITY,c,u=!1;for(let l of t.canonicalComparables){let d=S(s,l.comparable,a);if(d!==null){if(d<i){i=d,c=l.canonicalFlag,u=!1;continue}d===i&&c!==l.canonicalFlag&&(u=!0)}}return!c||u||!Number.isFinite(i)||i<=0?null:{flag:c,reason:"flag_typo",confidence:i>=2?"medium":"high"}}function xt(e){let t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function Ee(e,t=!1){if(t||e.includes("://"))return null;let n=e.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!n)return null;let o=n[1],s=n[3];return s.length===0||n[2]===":"&&/\s/u.test(e)?null:{key:o,value:s}}function Le(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};let o=e.indexOf("="),s=o>=0?e.slice(0,o):e,r=o>=0?e.slice(o+1):void 0,a=H(s,t);if(!a)return{tokens:[e]};let i=r===void 0?a.flag:`${a.flag}=${r}`;return i===e?{tokens:[e]}:{tokens:[i],event:{from:e,to:[i],reason:a.reason,confidence:a.confidence}}}function Pe(e){let t=new Set,n=!1;for(let o=0;o<e.length;o+=1){if(n){t.add(o),n=!1;continue}let s=e[o];n=s==="--path"||s==="--pm-path"}return t}function Ne(e){if(!e.startsWith("--"))return null;let t=e.indexOf("=");return t<0?{flag:e}:{flag:e.slice(0,t),inlineValue:e.slice(t+1)}}function Fe(e,t,n){n.push(e[t]);let o=e[t+1];return typeof o=="string"&&o!=="--"?(n.push(o),t+2):t+1}function Me(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};let s=[],r=t+1;for(;r<e.length&&e[r]!=="--"&&!e[r].startsWith("-")&&(s.length===0||o.has(n.flag));)s.push(e[r]),r+=1;let a=s.length===0?1:1+s.length;return{originalTokens:e.slice(t,t+a),value:s.length===0?void 0:s.join(","),consumed:a}}function ve(e,t,n,o){let s=e.get(n);if(s){s.values.push(o.value),s.occurrences+=1;return}e.set(n,{outputIndex:t.length,originalTokens:o.originalTokens,values:[o.value],occurrences:1}),t.push(null)}function Re(e,t){let n=[],o=[];for(let[s,r]of e){if(!(r.occurrences>=2||t.has(s)&&r.originalTokens.length>2)){o.push({outputIndex:r.outputIndex,tokens:r.originalTokens});continue}let i=`${s}=${r.values.join(",")}`;o.push({outputIndex:r.outputIndex,tokens:[i]}),n.push({from:`${s} (x${r.occurrences})`,to:[i],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function $e(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(let n of t)e.splice(n.outputIndex,1,...n.tokens)}function Ve(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};let s=[],r=new Map,a=0;for(;a<e.length;){let u=e[a];if(u==="--"){s.push(...e.slice(a));break}if(n.has(u)){a=Fe(e,a,s);continue}let l=Ne(u);if(!l||!t.has(l.flag)){s.push(u),a+=1;continue}let d=Me(e,a,l,o);if(d.value===void 0){s.push(u),a+=d.consumed;continue}ve(r,s,l.flag,{originalTokens:d.originalTokens,value:d.value}),a+=d.consumed}let{events:i,splices:c}=Re(r,o);return $e(s,c),{argv:s,events:i}}var Q=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function Be(e,t){if(e!=="test"||t.length<2)return!1;let n=t[t.length-1],o=t[t.length-2],s=Q.get(o);return s!==void 0&&s.has(n)}function ze(e,t,n){if(t!=="test")return e;let o=[],s=0;for(;s<e.length;){let r=e[s];if(r==="--")return o.push(...e.slice(s)),o;let a=Q.get(r),i=a?e[s+1]:void 0;if(!a||typeof i!="string"||!a.has(i)){o.push(r),s+=1;continue}let c=s+2;for(;c<e.length&&!e[c].startsWith("-");)c+=1;if(c-(s+2)!==1){o.push(r),s+=1;continue}let u=e[s+2],l=`${i}=${u}`;o.push(r,l),n.push({from:`${r} ${i} ${u}`,to:[r,l],reason:"bare_key_value",confidence:"high"}),s+=3}return o}function De(e,t,n,o){let s=[],r=Pe(e);for(let a=0;a<e.length;a+=1){let i=e[a];if(i==="--"){s.push(...e.slice(a));break}let c=r.has(a),u=s[s.length-1];if(i.startsWith("--")){let b=Le(i,t,c);s.push(...b.tokens),b.event&&o.push(b.event);continue}let l=Ee(i,c);if(!l||typeof u=="string"&&u.startsWith("-")&&!u.includes("=")||["search","comments","notes","learnings"].includes(n)||Be(n,s)){s.push(i);continue}let d=H(l.key,t);if(!d){s.push(i);continue}let m=l.value.startsWith("-")?[`${d.flag}=${l.value}`]:[d.flag,l.value];s.push(...m),o.push({from:i,to:m,reason:"bare_key_value",confidence:d.confidence})}return s}function Ge(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--verify"){let o=e[t+1];if(o===void 0||o==="--")throw new _("history attest --verify requires a bundle file.",x.USAGE);e.splice(t,2,`--verify=${o}`)}else(C.has(n)||n==="--output"||n==="--hash-algorithm")&&(t+=1)}}function We(e,t){if(!e.some(o=>o==="--help"||o==="-h"))return;let n=new Set(h(t).flatMap(o=>[o.flag,...o.aliases??[],...o.short===void 0?[]:[o.short]]));for(let o=0;o<e.length;o+=1){let s=e[o];if(s==="--")break;s!=="--help"&&s!=="-h"||n.has(e[o-1])&&!I.has(e[o-1])&&(e[o-1]=s)}}function _t(e){let t=[],n=we(e,t),o=ye(n);(o.length!==n.length||o.some((b,re)=>b!==n[re]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});let s=Oe(o,t),r=Y(s);if(r.conflict)throw new _("Provide the item id either positionally or with --id, not both.",x.USAGE);r.changed&&t.push({from:`--id ${r.itemId}`,to:[r.itemId],reason:"item_id_alias",confidence:"high"});let a=Ce(r.argv),i=ee(r.argv),c=p(i??a??""),u=Ae(i??a),l=De(r.argv,u,c,t),d=ze(l,c,t),m=Ve(d,u.listCanonicalFlags,C,a==="create"?new Set(["--tags"]):new Set);for(let b of m.events)t.push(b);return We(m.argv,i??a),i==="history attest"&&Ge(m.argv),{argv:m.argv,commandName:a,trace:t}}function ee(e){let t=Z(e),n=t[0]?.trim().toLowerCase(),o=t[1]?.trim().toLowerCase(),s=F(t);return s?s.canonical:(n==="extension"||n==="package"||n==="packages")&&typeof o=="string"&&o.length>0&&!o.startsWith("-")?`${n} ${o}`:n}function Ct(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="--")break;if(n==="--type"){let o=e[t+1];if(typeof o=="string"&&o.trim().length>0)return o.trim();continue}if(n.startsWith("--type=")){let o=n.slice(7).trim();if(o.length>0)return o}}}function wt(e){if(e===void 0)return()=>{};let t=e.trim();if(t.length===0)throw new _("--author requires a non-empty value.",x.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});let n=z();w(t);let o=!1;return()=>{o||(o=!0,n===void 0?w(void 0):w(n))}}var f=Object.freeze({clock:"PM_CLOCK",tickMs:"PM_CLOCK_TICK_MS",seed:"PM_SEED"});function A(e,t,n,o){return new _(e,x.USAGE,{code:"invalid_reproducible_process_environment",reason:t,field:n,required:`${f.clock} and ${f.seed}; ${f.tickMs} is optional`,nextSteps:[`Set ${f.clock} to an ISO-8601 instant with Z or a numeric UTC offset and ${f.seed} to a non-empty reproducibility seed.`,`Optionally set ${f.tickMs} to a non-negative integer; it defaults to 1.`,"Unset all three variables to retain normal wall-clock and cryptographic-random behavior."],recovery:{recovery_mode:"compact",provided_fields:o,missing_required_fields:t==="incomplete"?[f.clock,f.seed].filter(s=>!o.includes(s)):void 0}})}function Ue(e){let t=e[f.clock],n=e[f.tickMs],o=e[f.seed],s=[[f.clock,t],[f.tickMs,n],[f.seed,o]].filter(a=>a[1]!==void 0).map(([a])=>a);if(s.length===0)return;if(t===void 0||o===void 0)throw A("Reproducible process execution requires PM_CLOCK and PM_SEED together.","incomplete",t===void 0?f.clock:f.seed,s);if(o.trim().length===0)throw A(`${f.seed} must not be empty.`,"invalid_value",f.seed,s);if(!B(t))throw A(`${f.clock} must be a valid ISO-8601 instant with Z or a numeric UTC offset.`,"invalid_value",f.clock,s);let r=n===void 0?1:Number(n);if(n?.trim().length===0||!Number.isSafeInteger(r)||r<0)throw A(`${f.tickMs} must be a non-negative integer.`,"invalid_value",f.tickMs,s);return $({clock:t,seed:o,tickMs:r})}function je(e){let t=Ue(e);return t===void 0?n=>n():V(t)}async function Pt(e,t){return je(e)(t)}var te=new Set([...Object.values(D),...G,"--full","--brief","--compact","--summary","--fields","--section","--token-budget"]),ne=new Set(["--full-changed-fields","--no-changed-fields","--id-only"]);function zt(e,t){if(!["block","unblock"].includes(e)||t.includes(e)||!t.includes("update"))return;let n=new Set(h("update").map(s=>s.flag));if((e==="block"?["--blocked-by","--blocked-reason"]:["--unset","--unblock-note"]).every(s=>n.has(s)))return e==="block"?{examples:[["update","<item-id>","--blocked-by","<blocker-id>","--blocked-reason","<reason>"]],nextSteps:["Choose the actual item and blocker identifiers before running update. --blocked-by records the blocker field and its blocked_by relationship."]}:{examples:[["update","<item-id>","--unset","blocked-by","--unset","blocked-reason","--unblock-note","<note>"]],nextSteps:[`Inspect the item's blockers before running update. --unset blocked-by removes the blocker field and the blocked_by rows naming it; other blocked_by relationships stay, so remove one with --dep-remove "id=<id>,kind=blocked_by" or all with --dep-remove kind=blocked_by. --unset blocked-reason clears the stale reason. --unblock-note alone records a note and does not unblock the item.`,"If your project also uses a blocked lifecycle status, choose its appropriate next status separately with update --status."]}}function qe(e,t){let n=e.includes("="),o=n?e.slice(e.indexOf("=")+1):t;if(!(!o||o.startsWith("--")))return{consumed:n?1:2,replacement:["--from",o],conflicts:["--from"]}}var Ke=["--depth","--output-include","--fields","--section","--for"];function Ye(e){let t=P(p(e.trim().toLowerCase()));if(t===void 0)return;let n=h(t),o=n.flatMap(a=>[a.flag,...a.aliases??[]]),s=[...W(t).keys()].filter(a=>o.includes(`--${a}`)),r=[...n.find(a=>a.flag==="--depth")?.values??[]];if(!(s.length===0&&r.length===0))return{command:t,modes:s,depth_values:r,declared_flags:o}}function Dt(e){return[...e.depth_values.length>0?[`--depth ${e.depth_values.join("|")}`]:[],...e.modes.map(t=>`--${t}`)].join(", ")}function Xe(e,t,n,o){let s=Ye(e);if(s===void 0||s.declared_flags.includes(t))return;let r=[...Ke,...s.modes.map(i=>`--${i}`)].filter(i=>i!==t);if(t==="--depth"){let i=n.includes("="),c=(i?n.slice(n.indexOf("=")+1):o)?.trim().toLowerCase();if(!c)return;let u=i?1:2;return s.modes.includes(c)?{consumed:u,replacement:[`--${c}`],conflicts:r}:c==="standard"?{consumed:u,replacement:[],conflicts:r}:void 0}let a=t.slice(2);return n===t&&s.depth_values.includes(a)?{consumed:1,replacement:["--depth",a],conflicts:r}:void 0}function Je(e,t,n,o){return t==="--since"&&e==="activity"?qe(n,o):t==="--toon"&&n===t?{consumed:1,replacement:["--output-format","toon"],conflicts:["--json","--format","--output-format","--stream"]}:Xe(e,t,n,o)}function Ze(e){let t=g(e);if(t===void 0)return;let n=e[t].trim().toLowerCase(),o=`${n} ${e[t+1]?.trim().toLowerCase()??""}`,s=p(o);return s!==o.trim()?s:n==="ctx"?"context":p(n)}function Gt(e,t,n){let o=e==="ctx"?"context":p(e);if(P(o)===void 0||t.includes("--")||Ze(t)!==o)return;let s=n.split("=",1)[0],r=t.flatMap((d,m)=>d===s||d.startsWith(`${s}=`)?[m]:[]);if(r.length!==1)return;let a=r[0],i=Je(o,s,t[a],t[a+1]);if(!i)return;let{replacement:c,consumed:u,conflicts:l}=i;if(!t.some(d=>l.includes(d.split("=",1)[0])))return[...t.slice(0,a),...c,...t.slice(a+u)]}function oe(e){let t=e.split("=",1)[0].replaceAll("_","-");return te.has(t)||t.length>=5&&[...te].some(n=>n.startsWith(t))}function Wt(e,t){let n=e.split("=",1)[0].replaceAll("_","-");return oe(n)?!ne.has(t):ne.has(n)?!oe(t):!0}function se(e){return e.trim().match(/--[a-z0-9][a-z0-9_-]*/i)?.[0]?.replaceAll("_","-").toLowerCase()}function Ut(e){if(!(!Array.isArray(e)||e.length===0))return y(e)}function He(e,t){let n=se(t);if(!n)return;let o=h(e).find(s=>s.flag===n||s.aliases?.includes(n));return o?o.value_type==="boolean"?null:`<${o.value_name??"value"}>`:"<value>"}function jt(e,t,n){let o=[...e],s=o.indexOf("--"),r=s<0?o.length:s;for(let a of n){let i=se(a);if(!i||o.slice(0,r).some(l=>l===i||l.startsWith(`${i}=`)))continue;let c=He(t,i),u=c?[i,c]:[i];o.splice(r,0,...u),r+=u.length}return o.length===e.length?void 0:R(o)}function Qt(e,t){let n=e.trim().split(/\s+/u);if(!(n.length<2||t.includes(n.join(" "))))for(let o=1;o<n.length;o+=1){if(!t.includes(n.slice(0,o).join(" ")))return;let s=n.slice(o).join(" "),r=k(s),a=new Set(t.filter(i=>i===s||i.endsWith(` ${s}`)||i===r?.canonical).map(i=>k(i)?.canonical??i).filter(i=>t.includes(i)));if(a.size>0)return a.size===1?[...a][0]:void 0}}var Qe={add:["create","append"],fetch:["get"],inspect:["get","health"],log:["history","comments","notes"],ls:["list"],pause:["release"],read:["get"],remove:["delete"],rm:["delete"],show:["get"],start:["start-task"]};function ie(e,t){let n=e.trim().toLowerCase(),o=t.trim().toLowerCase();if(o.length===0)return Number.POSITIVE_INFINITY;let s=n.split(" "),r=Qe[o]?.indexOf(p(n));if(r!==void 0&&r>=0)return r;if(n===o)return 10;if(s.includes(o))return 11;if(s.some(c=>c.startsWith(o)))return 12;let a=o.length>=5?2:1,i=Number.POSITIVE_INFINITY;for(let c of s){let u=S(c,o,a);u!==null&&(i=Math.min(i,u))}return Number.isFinite(i)?20+i:n.includes(o)?30:Number.POSITIVE_INFINITY}function en(e,t){return e.map(n=>({path:n,score:ie(n,t)})).filter(n=>Number.isFinite(n.score)).sort((n,o)=>n.score!==o.score?n.score-o.score:n.path===o.path?0:n.path<o.path?-1:1).map(n=>n.path)}function tn(e,t,n){let o=new Set(t),s=E.filter(i=>i.lifecycle==="deprecated").slice().sort((i,c)=>c.alias.length-i.alias.length),r=[],a=e.flatMap(i=>{let c=s.find(l=>i===l.alias||i.startsWith(`${l.alias} `)),u=i;if(c){let l=i.slice(c.alias.length);if(!o.has(`${c.canonical}${l}`))return[];u=`${c.canonical_argv.join(" ")}${l}`}return n!==void 0&&ie(i,n)<10&&r.push(u),[u]});return[...new Set(r.length>0?r:a)]}export{nt as a,K as b,Y as c,xe as d,Z as e,_e as f,O as g,Ce as h,bt as i,ye as j,xt as k,Ve as l,ze as m,_t as n,Ct as o,wt as p,f as q,Ue as r,je as s,Pt as t,zt as u,Ye as v,Dt as w,Gt as x,oe as y,Wt as z,Ut as A,He as B,jt as C,Qt as D,ie as E,en as F,tn as G};
2
+ //# sourceMappingURL=chunk-GZI7ZAB7.js.map
@@ -1,3 +1,3 @@
1
- import{F as S,mb as T}from"./chunk-I2OJ5B4A.js";import{R as c,S as E,X as w,Y as C}from"./chunk-7IROAPWI.js";import{E as r,I as k,Q as h,e as g,f as _}from"./chunk-7X253M6Z.js";import{A as p,C as u,m as a}from"./chunk-YYT3MIRF.js";var q=new Set(g),j=new Set(_),d=new Set([...a.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),U=["create","update"];function I(e){if(typeof e!="string")return"";let n=e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return n.startsWith("--")?n.slice(2):n}function v(e){return e.replaceAll("_","-")}function z(e,n){let i=new Set;for(let t of e){let o=I(t);o.length>0&&o!==n&&i.add(o)}return[...i].sort((t,o)=>t.localeCompare(o))}function P(e){let n=new Set;for(let i of e??[]){let t=i.trim();t.length>0&&n.add(t)}return[...n].sort((i,t)=>i.localeCompare(t))}function Y(e){let n=new Set,i=[];for(let t of e??[]){let o=t.trim().toLowerCase();if(o.length!==0){if(!j.has(o))throw new Error(`Invalid field command "${t}". Allowed: ${_.join(", ")}.`);n.has(o)||(n.add(o),i.push(o))}}return e===void 0||i.length===0?[...U]:i}function oe(e){let n=r(e.key);if(n.length===0)throw new Error("Field key must not be empty.");if(n.includes(","))throw new Error(`Field key "${n}" must not contain commas: commas separate field names in list flags such as --unset and --fields.`);if(d.has(n))throw new Error(`Cannot define custom field "${n}": custom schema field "${n}" collides with built-in item metadata "${n}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...d].sort((N,R)=>N.localeCompare(R)).join(", ")}.`);let i=typeof e.type=="string"&&e.type.trim().length>0?e.type.trim().toLowerCase():"string";if(!q.has(i))throw new Error(`Invalid field type "${e.type}". Allowed: ${g.join(", ")}.`);let t=i,o=Y(e.commands),l=I(e.cliFlag),s=l.length>0&&l!==v(n)?l:void 0,f=s??v(n),b=z(e.aliases??[],f),m=e.description?.trim();return{key:n,type:t,commands:o,description:m&&m.length>0?m:void 0,cliFlag:s,cliAliases:b,required:e.required===!0,requiredOnCreate:e.requiredOnCreate===!0,allowUnset:e.allowUnset!==!1,requiredTypes:P(e.requiredTypes)}}function B(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let n=e;if(Array.isArray(n.fields))return n.fields;if(Array.isArray(n.definitions))return n.definitions}function K(e){let n=B(e);if(!n)return[];let i=[];for(let t of n){if(typeof t!="object"||t===null||Array.isArray(t))continue;let o=t;typeof o.key!="string"||o.key.trim().length===0||i.push(o)}return i}function le(e){if(e==null||e.trim().length===0)return{fields:[]};let n;try{n=JSON.parse(e)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:K(n)}}function se(e){return`${JSON.stringify({fields:e.fields},null,2)}
1
+ import{F as S,mb as T}from"./chunk-4FZH5BTV.js";import{W as c,X as E,aa as w,ba as C}from"./chunk-XHCIOLJP.js";import{E as r,I as k,Q as h,e as g,f as _}from"./chunk-SX76UGEY.js";import{A as p,C as u,m as a}from"./chunk-6OIHST4I.js";var q=new Set(g),j=new Set(_),d=new Set([...a.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),U=["create","update"];function I(e){if(typeof e!="string")return"";let n=e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return n.startsWith("--")?n.slice(2):n}function v(e){return e.replaceAll("_","-")}function z(e,n){let i=new Set;for(let t of e){let o=I(t);o.length>0&&o!==n&&i.add(o)}return[...i].sort((t,o)=>t.localeCompare(o))}function P(e){let n=new Set;for(let i of e??[]){let t=i.trim();t.length>0&&n.add(t)}return[...n].sort((i,t)=>i.localeCompare(t))}function Y(e){let n=new Set,i=[];for(let t of e??[]){let o=t.trim().toLowerCase();if(o.length!==0){if(!j.has(o))throw new Error(`Invalid field command "${t}". Allowed: ${_.join(", ")}.`);n.has(o)||(n.add(o),i.push(o))}}return e===void 0||i.length===0?[...U]:i}function oe(e){let n=r(e.key);if(n.length===0)throw new Error("Field key must not be empty.");if(n.includes(","))throw new Error(`Field key "${n}" must not contain commas: commas separate field names in list flags such as --unset and --fields.`);if(d.has(n))throw new Error(`Cannot define custom field "${n}": custom schema field "${n}" collides with built-in item metadata "${n}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...d].sort((N,R)=>N.localeCompare(R)).join(", ")}.`);let i=typeof e.type=="string"&&e.type.trim().length>0?e.type.trim().toLowerCase():"string";if(!q.has(i))throw new Error(`Invalid field type "${e.type}". Allowed: ${g.join(", ")}.`);let t=i,o=Y(e.commands),l=I(e.cliFlag),s=l.length>0&&l!==v(n)?l:void 0,f=s??v(n),b=z(e.aliases??[],f),m=e.description?.trim();return{key:n,type:t,commands:o,description:m&&m.length>0?m:void 0,cliFlag:s,cliAliases:b,required:e.required===!0,requiredOnCreate:e.requiredOnCreate===!0,allowUnset:e.allowUnset!==!1,requiredTypes:P(e.requiredTypes)}}function B(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let n=e;if(Array.isArray(n.fields))return n.fields;if(Array.isArray(n.definitions))return n.definitions}function K(e){let n=B(e);if(!n)return[];let i=[];for(let t of n){if(typeof t!="object"||t===null||Array.isArray(t))continue;let o=t;typeof o.key!="string"||o.key.trim().length===0||i.push(o)}return i}function le(e){if(e==null||e.trim().length===0)return{fields:[]};let n;try{n=JSON.parse(e)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:K(n)}}function se(e){return`${JSON.stringify({fields:e.fields},null,2)}
2
2
  `}function re(e,n){let i=e.fields.find(s=>r(s.key)===n.key),t=i!==void 0,o=e.fields.filter(s=>r(s.key)!==n.key),l={...i,key:n.key,type:n.type,commands:[...n.commands]};return O(l,"description",n.description),O(l,"cli_flag",n.cliFlag),n.cliAliases.length>0?l.cli_aliases=[...n.cliAliases]:delete l.cli_aliases,x(l,"required",n.required),x(l,"required_on_create",n.requiredOnCreate),n.allowUnset===!1?l.allow_unset=!1:delete l.allow_unset,n.requiredTypes.length>0?l.required_types=[...n.requiredTypes]:delete l.required_types,o.push(l),o.sort((s,f)=>r(s.key).localeCompare(r(f.key))),{file:{fields:o},definition:l,replaced:t}}function ae(e,n){let i=r(n);if(i.length===0)throw new Error("Field key must not be empty.");let t=[],o=e.fields.filter(l=>r(l.key)===i?(t.push(l),!1):!0);return t.length===0?{file:{fields:o},removed:!1}:{file:{fields:o},removed:!0,definition:t[0]}}function O(e,n,i){let t=e;i!==void 0&&i.length>0?t[n]=i:delete t[n]}function x(e,n,i){let t=e;i?t[n]=!0:delete t[n]}function $(e){return e.trim().toLowerCase().replace(/^-+/u,"")}function L(e){let n=$(e),i=C({key:n,cli_flag:n,cli_aliases:[]});return[...new Set([...i,w(n)])]}var G=new Set(a.filter(e=>!d.has(e))),J={flag:"--help",short:"-h"},D=new Map;function V(e){let n=D.get(e);if(n===void 0){let i=new Map,t=new Map;for(let o of[...T(e),...S,J]){for(let l of[o.flag,...o.aliases??[]].flatMap(L))i.has(l)||i.set(l,o.flag);o.short!==void 0&&!t.has(o.short)&&t.set(o.short,o.flag)}n={long:i,short:t},D.set(e,n)}return n}function H(e,n){return c(e)?n.short.get(e.trim()):L(e).map(i=>n.long.get(i)).find(i=>i!==void 0)}function F(e){let n=[];for(let i of e){let t=[...new Set([i.cli_flag,...i.cli_aliases,i.key].map(o=>c(o)?o.trim():$(o)))];for(let o of i.commands)n.push(...W(i.key,t,o.replaceAll("_","-")))}return n.sort((i,t)=>i.field.localeCompare(t.field)||i.command.localeCompare(t.command)||i.option.localeCompare(t.option))}function W(e,n,i){let t=V(i),o=new Map;for(let l of n){if(G.has(e)&&l.replaceAll("-","_")===e)continue;let s=H(l,t);s===void 0||o.has(s)||o.set(s,{field:e,command:i,field_flag:c(l)?l:`--${l.replaceAll("_","-")}`,option:s})}return[...o.values()]}function X(e){return F([{key:e.key,cli_flag:e.cliFlag??e.key.replaceAll("_","-"),cli_aliases:e.cliAliases,commands:e.commands}])}function A(e){return e.flatMap(n=>[...new Set([n.cli_flag,...n.cli_aliases])].flatMap(i=>{let t=E(i);return t===void 0?[]:[{field:n.key,spelling:i,reason:t}]}))}function Q(e){return A([{key:e.key,cli_flag:e.cliFlag??e.key.replaceAll("_","-"),cli_aliases:e.cliAliases}])}function Z(e){return`${JSON.stringify(e.spelling)} ${e.reason}`}function ee(e){return`${e.field_flag} shadows built-in ${e.option} on pm ${e.command}`}function ye(e,n){let i=h(e).definitions,t=F(i),o=A(i),l=o.length===0?{details:{},warnings:[]}:{details:{schema_field_flag_invalid_count:o.length,schema_field_flag_invalid:o.slice(0,n),schema_field_flag_invalid_truncated:o.length>n,schema_field_flag_invalid_fix_hint:"Re-register the field with one flag and one spelling per alias: pm schema add-field <key> --cli-flag <flag> --alias <alias>. A short alias is one dash and one character. Edit a field defined inline in settings.json there."},warnings:[`validate_schema_field_flag_invalid:${o.length}`]};return t.length===0?l:{details:{...l.details,schema_field_option_collision_count:t.length,schema_field_option_collisions:t.slice(0,n),schema_field_option_collisions_truncated:t.length>n,schema_field_option_collision_fix_hint:"Rename a file-backed field without losing item values: pm schema rename-field <key> --to <new-key>. For a colliding flag, alias or command list, re-register the same key: pm schema add-field <key> --cli-flag <flag> --commands <commands>. Edit a field defined inline in settings.json there."},warnings:[...l.warnings,`validate_schema_field_option_collision:${t.length}`]}}function Fe(e){y(e.key,Q(e)),M(e.key,e.commands,X(e))}function Ae(e){let n=[e.cli_flag,...Array.isArray(e.cli_aliases)?e.cli_aliases:[]].filter(t=>typeof t=="string");y(e.key,n.filter(t=>k(t).length===0).map(t=>({field:e.key,spelling:t,reason:"is empty"})));let i=h({fields:[e]}).definitions;y(e.key,A(i)),M(e.key,i.flatMap(t=>t.commands),F(i))}function y(e,n){if(n.length!==0)throw new u(`Cannot define custom field "${e}": flag ${n.map(Z).join("; ")}. The command it is registered for could not register it as one option.`,p.USAGE,{code:"schema_field_flag_invalid",field:e,flag:n[0].spelling,required:"Each custom field flag and alias must be one option spelling: a long name without spaces, pipes, commas, '=' or brackets, or a short flag of one dash and one character.",nextSteps:[`Pass one spelling per --alias, for example pm schema add-field ${e} --alias <first> --alias <second>.`]})}function M(e,n,i){if(i.length===0)return;let t={key:e,commands:n},o=new Set(i.map(s=>s.command)),l=t.commands.filter(s=>!o.has(s.replaceAll("_","-")));throw new u(`Cannot define custom field "${t.key}": ${i.map(ee).join("; ")}. The built-in option would stop working for that command.`,p.USAGE,{code:"schema_field_option_collision",field:t.key,flag:i[0].option,required:"A custom field's key, flag and aliases must differ from every built-in option of each command it is registered for.",nextSteps:[`Rename the field with a project-specific prefix, for example pm schema add-field project_${t.key}.`,...l.length>0?[`Or register "${t.key}" only where its option is free: --commands ${l.join(",")}.`]:[]]})}export{oe as a,le as b,se as c,re as d,ae as e,F as f,X as g,A as h,Q as i,Z as j,ee as k,ye as l,Fe as m,Ae as n};
3
- //# sourceMappingURL=chunk-PW7U7WCE.js.map
3
+ //# sourceMappingURL=chunk-K34FR5CO.js.map
@@ -1,4 +1,4 @@
1
- import{A as p,C as h,G as u}from"./chunk-YYT3MIRF.js";import{readFile as $,realpath as _,stat as G,writeFile as k}from"node:fs/promises";import l from"node:path";var f="# pm-cli:runtime-cache:start",g="# pm-cli:runtime-cache:end",E=".agents/pm";async function d(n){let e=l.resolve(n),t=[];for(;;)try{let i=await _(e);if(!(await G(i)).isDirectory())throw Object.assign(new Error("Initialization path ancestry must be a directory."),{code:"ENOTDIR"});return l.join(i,...t)}catch(i){if(!u(i)||l.dirname(e)===e)throw i;t.unshift(l.basename(e)),e=l.dirname(e)}}var R=["runtime/","search/","locks/","transactions/","checkpoints/"],T=["search/eval-queries.json"];async function w(n){try{return await n()}catch(e){throw e instanceof Error&&"code"in e&&typeof e.code=="string"&&["EACCES","EPERM","EROFS"].includes(e.code)?new h("The workspace .gitignore is not writable.",p.GENERIC_FAILURE,{code:"init_gitignore_unwritable",reason:e.code.toLowerCase(),required:"Grant the current user read and write access to the workspace .gitignore before initialization.",why:"pm init must publish its managed runtime-cache ignore fence without replacing unrelated entries.",nextSteps:["Grant read and write access to the workspace .gitignore and rerun pm init.","If the workspace is intentionally read-only, initialize pm in a writable workspace or clone."]}):e}}function I(n){let e=n.split(l.sep).join("/").replace(/^\.\/+/,""),t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}function x(n){let e=n.replaceAll("\\","/");return l.isAbsolute(n)||e===".."||e.startsWith("../")}function b(n=E){let e=I(n);if(/[\r\n]/u.test(e))throw new h("A tracker path containing a line break cannot be represented safely in .gitignore.",p.USAGE,{code:"invalid_argument_value",required:"a tracker path without line breaks",nextSteps:["Choose a tracker path without carriage returns or newlines and rerun pm init."]});let t=e.replace(/[\\*?[\]#! \t]/gu,"\\$&");return[f,...R.map(i=>i==="search/"?`${t}/${i}*`:`${t}/${i}`),...T.map(i=>`!${t}/${i}`),g].join(`
1
+ import{A as p,C as h,G as u}from"./chunk-6OIHST4I.js";import{readFile as $,realpath as _,stat as G,writeFile as k}from"node:fs/promises";import l from"node:path";var f="# pm-cli:runtime-cache:start",g="# pm-cli:runtime-cache:end",E=".agents/pm";async function d(n){let e=l.resolve(n),t=[];for(;;)try{let i=await _(e);if(!(await G(i)).isDirectory())throw Object.assign(new Error("Initialization path ancestry must be a directory."),{code:"ENOTDIR"});return l.join(i,...t)}catch(i){if(!u(i)||l.dirname(e)===e)throw i;t.unshift(l.basename(e)),e=l.dirname(e)}}var R=["runtime/","search/","locks/","transactions/","checkpoints/"],T=["search/eval-queries.json"];async function w(n){try{return await n()}catch(e){throw e instanceof Error&&"code"in e&&typeof e.code=="string"&&["EACCES","EPERM","EROFS"].includes(e.code)?new h("The workspace .gitignore is not writable.",p.GENERIC_FAILURE,{code:"init_gitignore_unwritable",reason:e.code.toLowerCase(),required:"Grant the current user read and write access to the workspace .gitignore before initialization.",why:"pm init must publish its managed runtime-cache ignore fence without replacing unrelated entries.",nextSteps:["Grant read and write access to the workspace .gitignore and rerun pm init.","If the workspace is intentionally read-only, initialize pm in a writable workspace or clone."]}):e}}function I(n){let e=n.split(l.sep).join("/").replace(/^\.\/+/,""),t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}function x(n){let e=n.replaceAll("\\","/");return l.isAbsolute(n)||e===".."||e.startsWith("../")}function b(n=E){let e=I(n);if(/[\r\n]/u.test(e))throw new h("A tracker path containing a line break cannot be represented safely in .gitignore.",p.USAGE,{code:"invalid_argument_value",required:"a tracker path without line breaks",nextSteps:["Choose a tracker path without carriage returns or newlines and rerun pm init."]});let t=e.replace(/[\\*?[\]#! \t]/gu,"\\$&");return[f,...R.map(i=>i==="search/"?`${t}/${i}*`:`${t}/${i}`),...T.map(i=>`!${t}/${i}`),g].join(`
2
2
  `)}function y(n,e,t){let i=e.replace(/[\\*?[\]#! \t]/gu,"\\$&"),o=[...new Set([e,i])].flatMap(s=>R.flatMap(c=>[`${s}/${c}`,`!${s}/${c}`])),a=[],r=!1;for(let s of n)o.some(c=>s.startsWith(c))?(r||a.push(...t),r=!0):a.push(s);return r||a.push(...t),a}function O(n){let e=[],t=-1,i=0,o=0;for(let a of n.split(`
3
3
  `)){let r=a.endsWith("\r")?a.slice(0,-1):a;r===f?(t=o,i=o+a.length+1):r===g&&t>=0&&(e.push({index:t,end:o+r.length,lines:n.slice(i,o).split(/\r?\n/u).filter(s=>s.length>0)}),t=-1),o+=a.length+1}return e}function P(n,e){let t=n.includes(`\r
4
4
  `)?`\r
@@ -6,4 +6,4 @@ import{A as p,C as h,G as u}from"./chunk-YYT3MIRF.js";import{readFile as $,realp
6
6
  `,i=b(e).split(`
7
7
  `).slice(1,-1),o=O(n),a=o.flatMap(c=>c.lines),r=[f,...y(a,e,i),g].join(t);if(o.length===0){let c=n.length===0?"":n.endsWith(`
8
8
  `)?t:`${t}${t}`;return`${n}${c}${r}${t}`}let s=n;for(let[c,m]of[...o.entries()].reverse())s=`${s.slice(0,m.index)}${c===0?r:""}${s.slice(m.end)}`;return s}async function N(n,e={}){let t=l.join(n,".gitignore"),i=E;if(e.pmRoot!==void 0){let r=I(l.relative(await d(n),await d(e.pmRoot)));if(x(r))return{path:t,changed:!1};i=r}let o="";try{o=await w(()=>$(t,"utf8"))}catch(r){if(!(r instanceof Error&&"code"in r&&u(r)))throw r}let a=P(o,i);return a===o?{path:t,changed:!1}:(await w(()=>k(t,a,"utf8")),{path:t,changed:!0})}export{f as a,g as b,R as c,x as d,b as e,N as f};
9
- //# sourceMappingURL=chunk-D6PDUKUG.js.map
9
+ //# sourceMappingURL=chunk-KHFUHGL3.js.map
@@ -1,2 +1,2 @@
1
- import{Aa as re,Y as T,ba as R,j as x,k as J,l as Z,m as C,n as Q,o as ee,u as O,w as k,xa as te,y as v,ya as ne}from"./chunk-ZYCOM4MS.js";import{L as I,b as S,ba as D,c as L,s as H,t as q,ta as X,v as A,w as W}from"./chunk-YOPTAIBD.js";import{La as _}from"./chunk-FXJYZBWV.js";import{A as f,C as d}from"./chunk-YYT3MIRF.js";var he=new Set(["none","null"]);function pt(e={}){return[{optionKey:"dep",clearFlagKey:"clearDeps",valueFlag:"--dep",clearFlag:"--clear-deps",...e.depDisableFlagKey===void 0?{}:{disableFlagKey:e.depDisableFlagKey}},{optionKey:"comment",clearFlagKey:"clearComments",valueFlag:"--comment",clearFlag:"--clear-comments"},{optionKey:"note",clearFlagKey:"clearNotes",valueFlag:"--note",clearFlag:"--clear-notes"},{optionKey:"learning",clearFlagKey:"clearLearnings",valueFlag:"--learning",clearFlag:"--clear-learnings"},{optionKey:"file",clearFlagKey:"clearFiles",valueFlag:"--file",clearFlag:"--clear-files",...e.fileDisableFlagKey===void 0?{}:{disableFlagKey:e.fileDisableFlagKey}},{optionKey:"test",clearFlagKey:"clearTests",valueFlag:"--test",clearFlag:"--clear-tests",...e.testDisableFlagKey===void 0?{}:{disableFlagKey:e.testDisableFlagKey}},{optionKey:"doc",clearFlagKey:"clearDocs",valueFlag:"--doc",clearFlag:"--clear-docs",...e.docDisableFlagKey===void 0?{}:{disableFlagKey:e.docDisableFlagKey}},{optionKey:"reminder",clearFlagKey:"clearReminders",valueFlag:"--reminder",clearFlag:"--clear-reminders"},{optionKey:"event",clearFlagKey:"clearEvents",valueFlag:"--event",clearFlag:"--clear-events"},{optionKey:"typeOption",clearFlagKey:"clearTypeOptions",valueFlag:"--type-option",clearFlag:"--clear-type-options"}]}function g(e){return e===void 0?!1:he.has(e.trim().toLowerCase())}function mt(e,t,n){if(!g(e))return;let r=n?` ${n}`:"";throw new d(`${t} no longer accepts "none" or "null".${r}`.trim(),f.USAGE)}function yt(e,t,n){if(!e||e.length===0||L(e)||!e.some(o=>g(o)))return;let i=n?` ${n}`:"";throw new d(`${t} no longer accepts "none" or "null".${i}`.trim(),f.USAGE)}function _t(e,t){for(let n of t){let r=e[n.optionKey];if(!Array.isArray(r)||r.length===0)continue;if(!r.every(s=>typeof s=="string"))throw new d(`${n.valueFlag} entries must be strings.`,f.USAGE);if(L(r))continue;let i=r;if(!i.some(s=>g(s)))continue;if(i.filter(s=>!g(s)).length>0)throw new d(`Cannot mix legacy clear token "none"/"null" with concrete ${n.valueFlag} entries. Use ${n.clearFlag} to clear or provide explicit entries.`,f.USAGE);e[n.optionKey]=void 0,e[n.clearFlagKey]=!0,n.disableFlagKey&&(e[n.disableFlagKey]=!1)}return e}var Ee=["close_reason","close-reason"],ae=[{canonical:"tags",aliases:["tags"],optionKey:"tags",metadataKey:"tags"}],oe=[{canonical:"deadline",aliases:["deadline"],optionKey:"deadline",metadataKey:"deadline"},{canonical:"estimate",aliases:["estimate","estimated_minutes","estimated-minutes"],optionKey:"estimatedMinutes",metadataKey:"estimated_minutes"},{canonical:"acceptance-criteria",aliases:["acceptance_criteria","acceptance-criteria","ac"],optionKey:"acceptanceCriteria",metadataKey:"acceptance_criteria"},{canonical:"definition-of-ready",aliases:["definition_of_ready","definition-of-ready"],optionKey:"definitionOfReady",metadataKey:"definition_of_ready"},{canonical:"order",aliases:["order","rank"],optionKey:"order",metadataKey:"order"},{canonical:"goal",aliases:["goal"],optionKey:"goal",metadataKey:"goal"},{canonical:"objective",aliases:["objective"],optionKey:"objective",metadataKey:"objective"},{canonical:"value",aliases:["value"],optionKey:"value",metadataKey:"value"},{canonical:"impact",aliases:["impact"],optionKey:"impact",metadataKey:"impact"},{canonical:"outcome",aliases:["outcome"],optionKey:"outcome",metadataKey:"outcome"},{canonical:"why-now",aliases:["why_now","why-now"],optionKey:"whyNow",metadataKey:"why_now"}],Ne=[...ae,...oe],ie=[{canonical:"assignee",aliases:["assignee"],optionKey:"assignee",metadataKey:"assignee"},{canonical:"parent",aliases:["parent"],optionKey:"parent",metadataKey:"parent"},{canonical:"reviewer",aliases:["reviewer"],optionKey:"reviewer",metadataKey:"reviewer"},{canonical:"risk",aliases:["risk"],optionKey:"risk",metadataKey:"risk"},{canonical:"confidence",aliases:["confidence"],optionKey:"confidence",metadataKey:"confidence"},{canonical:"sprint",aliases:["sprint"],optionKey:"sprint",metadataKey:"sprint"},{canonical:"release",aliases:["release"],optionKey:"release",metadataKey:"release"},{canonical:"blocked-by",aliases:["blocked_by","blocked-by"],optionKey:"blockedBy",metadataKey:"blocked_by"},{canonical:"blocked-reason",aliases:["blocked_reason","blocked-reason"],optionKey:"blockedReason",metadataKey:"blocked_reason"},{canonical:"unblock-note",aliases:["unblock_note","unblock-note"],optionKey:"unblockNote",metadataKey:"unblock_note"},{canonical:"reporter",aliases:["reporter"],optionKey:"reporter",metadataKey:"reporter"},{canonical:"severity",aliases:["severity"],optionKey:"severity",metadataKey:"severity"},{canonical:"environment",aliases:["environment"],optionKey:"environment",metadataKey:"environment"},{canonical:"repro-steps",aliases:["repro_steps","repro-steps"],optionKey:"reproSteps",metadataKey:"repro_steps"},{canonical:"resolution",aliases:["resolution"],optionKey:"resolution",metadataKey:"resolution"},{canonical:"expected-result",aliases:["expected_result","expected-result"],optionKey:"expectedResult",metadataKey:"expected_result"},{canonical:"actual-result",aliases:["actual_result","actual-result"],optionKey:"actualResult",metadataKey:"actual_result"},{canonical:"affected-version",aliases:["affected_version","affected-version"],optionKey:"affectedVersion",metadataKey:"affected_version"},{canonical:"fixed-version",aliases:["fixed_version","fixed-version"],optionKey:"fixedVersion",metadataKey:"fixed_version"},{canonical:"component",aliases:["component"],optionKey:"component",metadataKey:"component"},{canonical:"regression",aliases:["regression"],optionKey:"regression",metadataKey:"regression"},{canonical:"customer-impact",aliases:["customer_impact","customer-impact"],optionKey:"customerImpact",metadataKey:"customer_impact"}],$=[...Ne,{canonical:"author",aliases:["author"],optionKey:"author",metadataKey:"author"},...ie],Se=[...ae,{canonical:"close-reason",aliases:Ee,optionKey:"closeReason",metadataKey:"close_reason"},...oe,...ie],Ce=new Set(["none","null","-"]);function se(e){return e==="create"?$:Se}function F(e,t){let n=t.unset;if(n!==void 0&&typeof n!="string"&&!Array.isArray(n))return;let r=[];for(let i of se(e))i.optionKey==="author"||!Object.hasOwn(t,i.optionKey)||t[i.optionKey]!==null||(Reflect.deleteProperty(t,i.optionKey),r.push(i.canonical));r.length!==0&&(t.unset=[...n===void 0?[]:typeof n=="string"?[n]:n,...r])}function U(e){return typeof e=="string"&&Ce.has(e.trim().toLowerCase())}function gt(e,t,n,r){return n?se(e).flatMap(i=>{let o=t[i.optionKey],a=r[i.metadataKey];return U(o)&&(U(a)||Array.isArray(a)&&a.some(U))?[`literal_sentinel_stored:${i.canonical}:${o.trim()}`]:[]}):[]}function Re(e,t){return e.flatMap(n=>n.includes(",")&&t(n)?[n]:n.split(","))}function Ke(e){let t=new Set,n=new Set;if(!e.raw||e.raw.length===0)return{metadataKeys:t,optionKeys:n};let r=Re(e.raw,i=>e.resolveDefinition(i.trim().toLowerCase())!==void 0);for(let i of r){let o=i.trim().toLowerCase();if(!o)throw new d("--unset values must not be empty; name each field once, for example --unset parent,release",f.USAGE);if(g(o))throw new d('--unset no longer accepts "none" or "null". Specify concrete field names such as --unset deadline',f.USAGE);let a=e.resolveDefinition(o);if(!a)throw new d(`Unsupported --unset field "${i}". Supported fields: ${e.supportedFields}`,f.USAGE);t.add(a.metadataKey),n.add(a.optionKey)}return{metadataKeys:t,optionKeys:n}}function be(e,t,n){let r=e.trim().toLowerCase();if(!n)return;let i=n.command_to_fields?.get(t)??[];for(let o of i){if(o.allow_unset===!1)continue;let a=new Set;if(typeof o.key=="string"&&o.key.length>0&&a.add(o.key.toLowerCase()),typeof o.metadata_key=="string"&&o.metadata_key.length>0&&a.add(o.metadata_key.toLowerCase()),typeof o.cli_flag=="string"&&o.cli_flag.length>0&&(a.add(o.cli_flag.replaceAll("-","_").toLowerCase()),a.add(o.cli_flag.toLowerCase())),Array.isArray(o.cli_aliases))for(let s of o.cli_aliases)typeof s!="string"||s.length===0||(a.add(s.replaceAll("-","_").toLowerCase()),a.add(s.toLowerCase()));if(a.has(r))return{optionKey:o.key,metadataKey:o.metadata_key}}}var Ie=(()=>{let e=new Map;for(let t of $)for(let n of t.aliases)e.set(n,{optionKey:t.optionKey,metadataKey:t.metadataKey});return e})(),xe=$.map(e=>e.canonical).sort((e,t)=>e.localeCompare(t)).join(", ");function ht(e,t){return Ke({raw:e,supportedFields:xe,resolveDefinition:n=>Ie.get(n)??be(n,"create",t)})}var ke={create:'client.create({ type: "Task", title: "Example", createMode: "progressive" })',update:'client.update(id, { estimatedMinutes: "45", force: false })',append:'client.append(id, "Body text")',reopen:'client.reopen(id, "The work recurred", { expectedResult: "Verified recovery" })'};function h(e,t,n){let r=`${e} ${t} must be ${n}.`;throw new d(r,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",field:t,changed:!1,required:r,examples:[ke[e]]})}function K(e,t,n){typeof e!="string"&&h(t,n,"a string")}function B(e,t){(e===null||typeof e!="object"||Array.isArray(e))&&h(t,"options","an object")}function le(e,t){(e==="append"||e==="update")&&t.id!==void 0&&K(t.id,e,"id"),e==="item-reopen"&&(t.id!==void 0&&K(t.id,"reopen","id"),t.reason!==void 0&&K(t.reason,"reopen","reason"),t.options!==void 0&&ve(t.options))}function Ft(e){B(e,"append");for(let t of["body","author","message"])e[t]!==void 0&&K(e[t],"append",t);e.force!==void 0&&typeof e.force!="boolean"&&h("append","force","a boolean")}function ve(e){B(e,"reopen");for(let t of R["item-reopen"].optional){let n=e[t];n!==void 0&&(_(Reflect.get(T,t)).type==="boolean"?typeof n!="boolean"&&h("reopen",t,"a boolean"):K(n,"reopen",t))}}function Fe(e,t){return e?t?"a string or string array":"a string array":"a string"}function Me(e,t,n,r,i,o){n===void 0||typeof n=="string"&&(!i||o)||r==="priority"&&typeof n=="number"&&Number.isFinite(n)||i&&Array.isArray(n)&&Array.from(n).every(a=>typeof a=="string")||h(e,t,Fe(i,o))}function we(e,t,n){let r=e==="create"?k:v;for(let{param:i}of[...r,...O,{param:"force"}]){if(_(Reflect.get(T,i)).type!=="boolean")continue;let o=n.find(a=>a.keys.includes(i))?.keys??[i];for(let a of o)t[a]!==void 0&&typeof t[a]!="boolean"&&h(e,a,"a boolean")}}function j(e,t,n=!0,r=!1){let i=e==="create"?x:C;for(let{target:o,keys:a,repeatable:s}of i)if(_(Reflect.get(T,o)).type!=="boolean")for(let c of a){let y=r&&c!==o,m=s===!0&&(o!=="acceptanceCriteria"||y);Me(e,c,t[c],o,m,n||y)}we(e,t,i)}function Mt(e,t){B(t,e);let n=H(t),r=S(n);return r||F(e,n),j(e,n,!1,r),n}var Pe=Symbol("pm.mcp-mutation-transport"),Le=new Set(["create","update","append"]),P={create:{parameters:k,aliases:x,strings:J,repeatables:Z},update:{parameters:v,aliases:C,strings:Q,repeatables:ee}},De=new Set(["activity","aggregate","context","contracts","deps","files-discover","files-lookup","get","graph","health","history","history-attest","list","next","search","stats","telemetry","validate"]);function b(e){return Pe in e}function w(e,t){return b(e)?q(t):A(e,t)}function Jt(e,t,n=[]){let r=A(e,{...e,...t});for(let i of n)Reflect.deleteProperty(r,i);return r}function l(e,t){let n=e[t];return typeof n=="string"&&n.trim().length>0?n:void 0}function u(e,t){let n=e[t];return typeof n=="string"?n.trim().length>0?n:void 0:typeof n=="number"&&Number.isFinite(n)?String(n):void 0}function Zt(e,t){let n=e[t];return typeof n=="string"?n:typeof n=="number"&&Number.isFinite(n)?String(n):void 0}function p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Qt(e,t){if(typeof e=="number"){if(!Number.isInteger(e))throw new d(`${t} must be a finite integer.`,f.USAGE);return e}if(typeof e=="string"&&e.trim().length>0){let n=Number(e);if(!Number.isInteger(n))throw new d(`${t} must be a finite integer.`,f.USAGE);return n}}function en(e,t){return typeof e.limit=="number"&&Number.isFinite(e.limit)?e.limit:typeof t.limit=="number"&&Number.isFinite(t.limit)?t.limit:l(e,"limit")??l(t,"limit")}function tn(e){let t=l(e,"outputFormat");return{json:!0,quiet:!0,author:l(e,"author"),path:l(e,"path"),noExtensions:e.noExtensions===!0||e.no_extensions===!0,noPager:!0,outputInclude:l(e,"outputInclude"),outputLimit:u(e,"outputLimit"),outputBudget:u(e,"outputBudget"),outputSession:l(e,"outputSession"),outputCursor:l(e,"outputCursor"),outputFormat:t==="json"||t==="toon"?t:void 0}}var pe=new Set(["tags","blockedBy","blocked_by","skills","fields"]),me=new Set(["comment","note","learning","reminder","event","dep","depRemove","dep_remove","file","doc","test","unset","addGlob","add_glob","migrate","envSet","env_set","envClear","env_clear"]),Ue=new Set([...me].filter(e=>e!=="file")),$e=new Set(["files","files-discover","docs","test","test-all"]),z=new Set(["comments","notes","learnings"]);function Be(e,t){if(!(!z.has(e)||!Object.prototype.hasOwnProperty.call(t,"file")))throw new d(`MCP ${e} does not accept options.file. Pass annotation text in options.add instead.`,f.USAGE,{code:"mcp_annotation_file_unavailable",required:"Pass annotation text as JSON data; MCP annotation actions cannot read server-local files."})}var je=new Set(["claim","release","start-task","pause-task","close-task"]),ye={history:["order"],"history-attest":["verify","output","hashAlgorithm"],list:["status","type","tag","priority","limit","offset"],search:["mode","status","type","tag","priority","limit"],create:["title","type","status","description","body","priority","tags","parent","createMode","create_mode","allowMissingParent","allowDuplicate","inheritFocus"],update:["parent","allowMissingParent","completedAt"],copy:["allowDuplicate"],close:["duplicateOf","completedAt","releaseAssignment"],claim:["start","next","ifAvailable","takeoverStale"],"start-task":["takeoverStale"],release:["pause","handoff"],comments:["ifAbsent"],notes:["ifAbsent"],learnings:["ifAbsent"],extension:["dryRun","offline"],package:["dryRun","offline"],install:["dryRun"],upgrade:["scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"],append:["body"]},Ge=new Set(["context","get","list","next","search","comments","notes","learnings","files","docs","test"]),Ve=new Set(["query","keywords","id","text"]);function ze(e){return Ge.has(e)?R[e].optional.filter(t=>!Ve.has(t)):[]}var Ye=new Set(["claim","start-task","comments","notes","learnings","files","docs","test"]);function He(e,t){if(!Ye.has(e??""))return t;let n={...t};for(let r of R[e].optional){let i=r.replace(/[A-Z]/gu,o=>`_${o.toLowerCase()}`);i===r||n[i]===void 0||(n[r]??=n[i],delete n[i])}return n}function qe(e,t,n){if(!z.has(e??""))return n;let r=n,i=r.text??t.text;if(i===void 0)return r;if(r.add!==void 0&&r.add!==i){let a=e.replace(/s$/u,"");throw new d(`Specify ${a} text either as text or with add, not both.`,f.USAGE,{code:"annotation_text_source_conflict",field:"text",required:`Pass the ${a} text once: text and add are the same source.`})}let o={...r,add:i};return delete o.text,o}function We(e,t){let n=t.replace(/[A-Z]/gu,r=>`_${r.toLowerCase()}`);return e[t]!==void 0||e[n]!==void 0}function Xe(e){return[...ye[e]??[],...ze(e),..._e]}var _e=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];function Ae(e,t=""){let n={},r=$e.has(t),i=t==="files"||t==="files-discover"||t==="docs",o=z.has(t)?Ue:me;for(let[a,s]of Object.entries(e)){if(Array.isArray(s)&&pe.has(a)){n[a]=s.join(",");continue}if(a==="note"&&i){n[a]=s;continue}if(typeof s=="string"&&o.has(a)){n[a]=[s];continue}if(typeof s=="string"&&r&&(a==="add"||a==="remove")){n[a]=[s];continue}n[a]=s}return Object.assign(n,Object.fromEntries(Object.getOwnPropertySymbols(e).map(a=>[a,Reflect.get(e,a)]))),n}function Je(e,t,n){let r=l(e,"author");return r!==void 0?r:n!==void 0&&je.has(n)?l(e,"assignee")??l(t,"assignee"):void 0}function Ze(e,t){return t!==void 0&&e.author===void 0?{...e,author:t}:e}function Qe(e,t,n){let r={},i=P[e],o=new Set([...i.parameters.map(({param:a})=>a),...O.map(({param:a})=>a),...ye[e],..._e,"force"]);for(let a of o){let s=i.aliases.find(c=>c.keys.includes(a))?.keys??[a];t[a]===void 0||s.some(c=>n[c]!==void 0)||(r[a]=t[a])}return r}function E(e,t){throw new d(`Invalid MCP ${e} value for "${t}". No changes were made.`,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:t,required:`Provide valid ${e} field values and an options object; inspect the pm_${e} input schema for supported types.`})}function et(e,t,n){let r=P[e],i=[...r.parameters,...O,{param:"force"}];for(let{param:o}of i){if(_(T[o]).type!=="boolean")continue;let s=(r.aliases.find(c=>c.keys.includes(o))?.keys??[o]).find(c=>n[c]!==void 0&&typeof n[c]!="boolean");s!==void 0&&E(e,s)}for(let o of["idOnly","fullChangedFields"])t[o]!==void 0&&typeof t[o]!="boolean"&&E(e,o)}function tt(e,t,n){t.options!==void 0&&!p(t.options)&&E(e,"options"),et(e,t,n);for(let a of pe){let s=n[a];Array.isArray(s)&&s.some(c=>typeof c!="string")&&E(e,a)}let r=ge(n,e),i=P[e];for(let{keys:a,target:s}of i.strings)a.some(c=>n[c]!==void 0)&&r[s]===void 0&&E(e,s);let o=i.repeatables.flatMap(({keys:a})=>a).find(a=>{let s=n[a];return s!==void 0&&typeof s!="string"&&(!Array.isArray(s)||s.some(c=>typeof c!="string"))});return o!==void 0&&E(e,o),r}function nt(e,t,n,r,i){let o=(t==="create"||t==="update")&&b(e),a={...o?Qe(t,e,r):n,...r};if((t==="create"||t==="update")&&!o){let s=p(e.options)&&S(e.options);s||F(t,a),j(t,a,!0,s)}return o?tt(t,e,a):i?Ae(a,t):a}function rt(e,t){return!Le.has(e??"")||S(t)?t:X(t)}function nn(e,t,{nativeAction:n=!0}={}){le(t,e);let r=p(e.options)?e.options:void 0,i=_(e.options),o={},a=m=>{We(i,m)||e[m]===void 0||(o[m]=e[m])};for(let m of Xe(t??""))a(m);t!==void 0&&b(e)&&Be(t,i);let s=qe(t,e,He(t,nt(e,t,o,i,n)));if(t==="history-attest"&&b(e)&&(s.output!==void 0||typeof s.verify=="string"))throw new d("MCP history attest does not accept server-local proof paths. Export the returned JSON bundle and pass that JSON object as verify.",f.USAGE);let c=b(e)?e:r??e,y=w(c,Ze(s,Je(e,s,t)));return rt(t,y)}function rn(e){if(e.addNote===void 0)return e;let t={...e};return t.note===void 0&&typeof t.addNote=="string"&&(t.note=t.addNote),delete t.addNote,t}function an(e){let t={...e};return t.discoveryNote!==void 0&&t.note===void 0&&typeof t.discoveryNote=="string"&&(t.note=t.discoveryNote),delete t.discover,delete t.discoveryNote,t}function at(e){let t=[],n=!0;for(let r of e.trim().toLowerCase()){if(r>="a"&&r<="z"||r>="0"&&r<="9"){t.push(r),n=!1;continue}n||(t.push("-"),n=!0)}return t.at(-1)==="-"&&t.pop(),t.join("")}function on(e){return!De.has(at(e))}function sn(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean).join(" ")}function ot(e){return Array.isArray(e)?e.map(t=>String(t)).filter(t=>t.length>0):[]}function ln(e,t){let n=new Set(["action","args","author","cwd","fullChangedFields","id","options","path","query","reason","target"]),r={};for(let[o,a]of Object.entries(e))n.has(o)||(r[o]=a);let i={...r,...t};return delete i.args,delete i.author,i}function cn(e,t){let n=w(t??{},{...t});return{changedFields:e.fullChangedFields===!0?"full":"compact",idOnly:e.idOnly===!0,runnerOptions:n}}function V(e){return{type:u(e,"filterType"),tag:u(e,"filterTag"),priority:u(e,"filterPriority"),deadlineBefore:u(e,"filterDeadlineBefore"),deadlineAfter:u(e,"filterDeadlineAfter"),updatedAfter:u(e,"filterUpdatedAfter"),updatedBefore:u(e,"filterUpdatedBefore"),createdAfter:u(e,"filterCreatedAfter"),createdBefore:u(e,"filterCreatedBefore"),ids:D(e.ids),assignee:u(e,"filterAssignee"),assigneeFilter:u(e,"filterAssigneeFilter")??u(e,"filterAssignee_filter"),parent:u(e,"filterParent"),sprint:u(e,"filterSprint"),release:u(e,"filterRelease"),limit:u(e,"limit"),offset:u(e,"offset")}}function G(e){if(typeof e=="string"&&e.trim().length>0)return e;if(Array.isArray(e))return ot(e)}function M(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&e.trim().length>0)return e}function un(e){let t=G(e.kind),n=G(e.exemptIsolate),r=G(e.exemptIsolateType);return{...t===void 0?{}:{kind:t},maxDepth:M(e.maxDepth),limit:M(e.limit),after:l(e,"after"),direction:l(e,"direction"),maxPaths:M(e.maxPaths),sample:M(e.sample),...n===void 0?{}:{exemptIsolate:n},...r===void 0?{}:{exemptIsolateType:r},saveBaseline:e.saveBaseline===!0,rebuild:e.rebuild===!0,clear:e.clear===!0,summary:e.summary===!0,...e.full===!0?{full:!0}:{}}}function Oe(e){let t=re(e);return e.ids!==void 0&&(t.ids=D(e.ids)),t}function fn(e){return{status:l(e,"filterStatus"),list:p(e.list)?Oe(e.list):V(e),reason:l(e,"reason"),completedAt:l(e,"completedAt")??l(e,"completed_at"),resolution:l(e,"resolution"),expectedResult:l(e,"expectedResult")??l(e,"expected_result")??l(e,"expected"),actualResult:l(e,"actualResult")??l(e,"actual_result")??l(e,"actual"),validateClose:l(e,"validateClose")??l(e,"validate_close"),author:l(e,"author"),message:l(e,"message"),force:e.force===!0?!0:void 0,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:I(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}var Y=new Set(["filterStatus","filterType","filterTag","filterPriority","filterDeadlineBefore","filterDeadlineAfter","filterUpdatedAfter","filterUpdatedBefore","filterCreatedAfter","filterCreatedBefore","filterAssignee","filterAssigneeFilter","filterAssignee_filter","filterParent","filterSprint","filterRelease","ids","list","update","limit","offset","dryRun","dry_run","rollback","checkpoint","noCheckpoint","no_checkpoint"]);function ce(e){let t={};for(let[n,r]of Object.entries(e))Y.has(n)||(t[n]=r);return Te(t)}function Te(e){return ge(e,"update")}function ge(e,t){let n=Ae(e,t),r=P[t],i=new Set([...r.parameters,...O].filter(({booleanish:o})=>o===!0).map(({param:o})=>o));for(let{keys:o}of r.repeatables)for(let a of o)typeof n[a]=="string"&&(n[a]=[n[a]]);for(let o of r.strings)for(let a of o.keys){let s=n[a];(typeof s=="number"&&Number.isFinite(s)||s===!1&&i.has(a))&&(n[a]=String(s))}return t==="create"?{...te(n,{requireType:!1})}:ne(n)}var it=new Map(C.flatMap(({target:e,keys:t})=>t.map(n=>[n,e])));function st(e){return e.startsWith("filter")||e==="ids"||e==="limit"||e==="offset"}function ue(e,t){throw new d(`update-many "${e}" cannot be null. No changes were made.`,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:e,required:t})}function lt(e){return Object.fromEntries(Object.entries(e).filter(([t])=>!Y.has(t)))}function fe(e,t,n){if(!e)return;let r=p(t.list)?t.list:{},i=p(t.update)?t.update:void 0,o=Object.keys(t).find(s=>t[s]===null&&(i!==void 0||Y.has(s)||st(s)))??Object.keys(r).filter(s=>r[s]===null).map(s=>`list.${s}`)[0];o!==void 0&&ue(o,`"${o}" selects rows or controls the run: omit it or pass a value. To clear an item field, pass null on the field itself${i===void 0?"":" inside update"}.`);let a=i??lt(t);for(let[s,c]of Object.entries(a)){if(c!==null)continue;let y=it.get(s);y===void 0&&ue(s,`Pass unset: ["${s}"] to clear a field, or omit "${s}".`),n[y]=null}}var ct=["author","message"];function ut(e,t){let n=Object.fromEntries(ct.filter(r=>typeof e[r]=="string"&&t[r]===void 0).map(r=>[r,e[r]]));return e.force===!0&&t.force===void 0&&(n.force=!0),Object.keys(n).length===0?t:A(t,{...t,...n})}function dn(e,t=!1){if(p(e.list)||p(e.update)){let r=p(e.update)?ut(e,e.update):ce(e),i=w(e,Te(r));return fe(t,e,i),{status:u(e,"filterStatus"),list:p(e.list)?Oe(e.list):V(e),update:W(r,i),dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:I(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}let n=w(e,ce(e));return fe(t,e,n),{status:u(e,"filterStatus"),list:V(e),update:n,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:I(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}function de(e){return"expectHash"in e||"expect_hash"in e}function pn(e){if(!de(e)&&!(p(e.options)&&de(e.options)))return{expectHash:void 0,dispatchArgs:e};let{expectHash:t,expect_hash:n,...r}=e,i=p(r.options)?r.options:{},{expectHash:o,expect_hash:a,...s}=i,c=[t,n,o,a].filter(N=>N!==void 0),y=c.length>1?c.flatMap(N=>Array.isArray(N)?N:[N]):c[0],m=A(e,"options"in r?{...r,options:p(r.options)?A(r.options,s):r.options}:r);return{expectHash:y,dispatchArgs:m}}export{pt as a,g as b,mt as c,yt as d,_t as e,Ee as f,$ as g,Se as h,gt as i,Re as j,Ke as k,be as l,ht as m,K as n,B as o,Ft as p,ve as q,Mt as r,b as s,Jt as t,l as u,u as v,Zt as w,p as x,Qt as y,en as z,tn as A,ye as B,Ae as C,nn as D,rn as E,an as F,at as G,on as H,sn as I,ot as J,ln as K,cn as L,V as M,un as N,fn as O,Y as P,Te as Q,dn as R,pn as S};
2
- //# sourceMappingURL=chunk-DQDRA3SW.js.map
1
+ import{Aa as re,Y as T,ba as R,j as x,k as J,l as Z,m as C,n as Q,o as ee,u as O,w as k,xa as te,y as v,ya as ne}from"./chunk-7EPYCU7U.js";import{L as I,b as S,ba as D,c as L,s as H,t as q,ta as X,v as A,w as W}from"./chunk-FVY7U3SU.js";import{La as _}from"./chunk-CNUFU454.js";import{A as f,C as d}from"./chunk-6OIHST4I.js";var he=new Set(["none","null"]);function pt(e={}){return[{optionKey:"dep",clearFlagKey:"clearDeps",valueFlag:"--dep",clearFlag:"--clear-deps",...e.depDisableFlagKey===void 0?{}:{disableFlagKey:e.depDisableFlagKey}},{optionKey:"comment",clearFlagKey:"clearComments",valueFlag:"--comment",clearFlag:"--clear-comments"},{optionKey:"note",clearFlagKey:"clearNotes",valueFlag:"--note",clearFlag:"--clear-notes"},{optionKey:"learning",clearFlagKey:"clearLearnings",valueFlag:"--learning",clearFlag:"--clear-learnings"},{optionKey:"file",clearFlagKey:"clearFiles",valueFlag:"--file",clearFlag:"--clear-files",...e.fileDisableFlagKey===void 0?{}:{disableFlagKey:e.fileDisableFlagKey}},{optionKey:"test",clearFlagKey:"clearTests",valueFlag:"--test",clearFlag:"--clear-tests",...e.testDisableFlagKey===void 0?{}:{disableFlagKey:e.testDisableFlagKey}},{optionKey:"doc",clearFlagKey:"clearDocs",valueFlag:"--doc",clearFlag:"--clear-docs",...e.docDisableFlagKey===void 0?{}:{disableFlagKey:e.docDisableFlagKey}},{optionKey:"reminder",clearFlagKey:"clearReminders",valueFlag:"--reminder",clearFlag:"--clear-reminders"},{optionKey:"event",clearFlagKey:"clearEvents",valueFlag:"--event",clearFlag:"--clear-events"},{optionKey:"typeOption",clearFlagKey:"clearTypeOptions",valueFlag:"--type-option",clearFlag:"--clear-type-options"}]}function g(e){return e===void 0?!1:he.has(e.trim().toLowerCase())}function mt(e,t,n){if(!g(e))return;let r=n?` ${n}`:"";throw new d(`${t} no longer accepts "none" or "null".${r}`.trim(),f.USAGE)}function yt(e,t,n){if(!e||e.length===0||L(e)||!e.some(o=>g(o)))return;let i=n?` ${n}`:"";throw new d(`${t} no longer accepts "none" or "null".${i}`.trim(),f.USAGE)}function _t(e,t){for(let n of t){let r=e[n.optionKey];if(!Array.isArray(r)||r.length===0)continue;if(!r.every(s=>typeof s=="string"))throw new d(`${n.valueFlag} entries must be strings.`,f.USAGE);if(L(r))continue;let i=r;if(!i.some(s=>g(s)))continue;if(i.filter(s=>!g(s)).length>0)throw new d(`Cannot mix legacy clear token "none"/"null" with concrete ${n.valueFlag} entries. Use ${n.clearFlag} to clear or provide explicit entries.`,f.USAGE);e[n.optionKey]=void 0,e[n.clearFlagKey]=!0,n.disableFlagKey&&(e[n.disableFlagKey]=!1)}return e}var Ee=["close_reason","close-reason"],ae=[{canonical:"tags",aliases:["tags"],optionKey:"tags",metadataKey:"tags"}],oe=[{canonical:"deadline",aliases:["deadline"],optionKey:"deadline",metadataKey:"deadline"},{canonical:"estimate",aliases:["estimate","estimated_minutes","estimated-minutes"],optionKey:"estimatedMinutes",metadataKey:"estimated_minutes"},{canonical:"acceptance-criteria",aliases:["acceptance_criteria","acceptance-criteria","ac"],optionKey:"acceptanceCriteria",metadataKey:"acceptance_criteria"},{canonical:"definition-of-ready",aliases:["definition_of_ready","definition-of-ready"],optionKey:"definitionOfReady",metadataKey:"definition_of_ready"},{canonical:"order",aliases:["order","rank"],optionKey:"order",metadataKey:"order"},{canonical:"goal",aliases:["goal"],optionKey:"goal",metadataKey:"goal"},{canonical:"objective",aliases:["objective"],optionKey:"objective",metadataKey:"objective"},{canonical:"value",aliases:["value"],optionKey:"value",metadataKey:"value"},{canonical:"impact",aliases:["impact"],optionKey:"impact",metadataKey:"impact"},{canonical:"outcome",aliases:["outcome"],optionKey:"outcome",metadataKey:"outcome"},{canonical:"why-now",aliases:["why_now","why-now"],optionKey:"whyNow",metadataKey:"why_now"}],Ne=[...ae,...oe],ie=[{canonical:"assignee",aliases:["assignee"],optionKey:"assignee",metadataKey:"assignee"},{canonical:"parent",aliases:["parent"],optionKey:"parent",metadataKey:"parent"},{canonical:"reviewer",aliases:["reviewer"],optionKey:"reviewer",metadataKey:"reviewer"},{canonical:"risk",aliases:["risk"],optionKey:"risk",metadataKey:"risk"},{canonical:"confidence",aliases:["confidence"],optionKey:"confidence",metadataKey:"confidence"},{canonical:"sprint",aliases:["sprint"],optionKey:"sprint",metadataKey:"sprint"},{canonical:"release",aliases:["release"],optionKey:"release",metadataKey:"release"},{canonical:"blocked-by",aliases:["blocked_by","blocked-by"],optionKey:"blockedBy",metadataKey:"blocked_by"},{canonical:"blocked-reason",aliases:["blocked_reason","blocked-reason"],optionKey:"blockedReason",metadataKey:"blocked_reason"},{canonical:"unblock-note",aliases:["unblock_note","unblock-note"],optionKey:"unblockNote",metadataKey:"unblock_note"},{canonical:"reporter",aliases:["reporter"],optionKey:"reporter",metadataKey:"reporter"},{canonical:"severity",aliases:["severity"],optionKey:"severity",metadataKey:"severity"},{canonical:"environment",aliases:["environment"],optionKey:"environment",metadataKey:"environment"},{canonical:"repro-steps",aliases:["repro_steps","repro-steps"],optionKey:"reproSteps",metadataKey:"repro_steps"},{canonical:"resolution",aliases:["resolution"],optionKey:"resolution",metadataKey:"resolution"},{canonical:"expected-result",aliases:["expected_result","expected-result"],optionKey:"expectedResult",metadataKey:"expected_result"},{canonical:"actual-result",aliases:["actual_result","actual-result"],optionKey:"actualResult",metadataKey:"actual_result"},{canonical:"affected-version",aliases:["affected_version","affected-version"],optionKey:"affectedVersion",metadataKey:"affected_version"},{canonical:"fixed-version",aliases:["fixed_version","fixed-version"],optionKey:"fixedVersion",metadataKey:"fixed_version"},{canonical:"component",aliases:["component"],optionKey:"component",metadataKey:"component"},{canonical:"regression",aliases:["regression"],optionKey:"regression",metadataKey:"regression"},{canonical:"customer-impact",aliases:["customer_impact","customer-impact"],optionKey:"customerImpact",metadataKey:"customer_impact"}],$=[...Ne,{canonical:"author",aliases:["author"],optionKey:"author",metadataKey:"author"},...ie],Se=[...ae,{canonical:"close-reason",aliases:Ee,optionKey:"closeReason",metadataKey:"close_reason"},...oe,...ie],Ce=new Set(["none","null","-"]);function se(e){return e==="create"?$:Se}function F(e,t){let n=t.unset;if(n!==void 0&&typeof n!="string"&&!Array.isArray(n))return;let r=[];for(let i of se(e))i.optionKey==="author"||!Object.hasOwn(t,i.optionKey)||t[i.optionKey]!==null||(Reflect.deleteProperty(t,i.optionKey),r.push(i.canonical));r.length!==0&&(t.unset=[...n===void 0?[]:typeof n=="string"?[n]:n,...r])}function U(e){return typeof e=="string"&&Ce.has(e.trim().toLowerCase())}function gt(e,t,n,r){return n?se(e).flatMap(i=>{let o=t[i.optionKey],a=r[i.metadataKey];return U(o)&&(U(a)||Array.isArray(a)&&a.some(U))?[`literal_sentinel_stored:${i.canonical}:${o.trim()}`]:[]}):[]}function Re(e,t){return e.flatMap(n=>n.includes(",")&&t(n)?[n]:n.split(","))}function Ke(e){let t=new Set,n=new Set;if(!e.raw||e.raw.length===0)return{metadataKeys:t,optionKeys:n};let r=Re(e.raw,i=>e.resolveDefinition(i.trim().toLowerCase())!==void 0);for(let i of r){let o=i.trim().toLowerCase();if(!o)throw new d("--unset values must not be empty; name each field once, for example --unset parent,release",f.USAGE);if(g(o))throw new d('--unset no longer accepts "none" or "null". Specify concrete field names such as --unset deadline',f.USAGE);let a=e.resolveDefinition(o);if(!a)throw new d(`Unsupported --unset field "${i}". Supported fields: ${e.supportedFields}`,f.USAGE);t.add(a.metadataKey),n.add(a.optionKey)}return{metadataKeys:t,optionKeys:n}}function be(e,t,n){let r=e.trim().toLowerCase();if(!n)return;let i=n.command_to_fields?.get(t)??[];for(let o of i){if(o.allow_unset===!1)continue;let a=new Set;if(typeof o.key=="string"&&o.key.length>0&&a.add(o.key.toLowerCase()),typeof o.metadata_key=="string"&&o.metadata_key.length>0&&a.add(o.metadata_key.toLowerCase()),typeof o.cli_flag=="string"&&o.cli_flag.length>0&&(a.add(o.cli_flag.replaceAll("-","_").toLowerCase()),a.add(o.cli_flag.toLowerCase())),Array.isArray(o.cli_aliases))for(let s of o.cli_aliases)typeof s!="string"||s.length===0||(a.add(s.replaceAll("-","_").toLowerCase()),a.add(s.toLowerCase()));if(a.has(r))return{optionKey:o.key,metadataKey:o.metadata_key}}}var Ie=(()=>{let e=new Map;for(let t of $)for(let n of t.aliases)e.set(n,{optionKey:t.optionKey,metadataKey:t.metadataKey});return e})(),xe=$.map(e=>e.canonical).sort((e,t)=>e.localeCompare(t)).join(", ");function ht(e,t){return Ke({raw:e,supportedFields:xe,resolveDefinition:n=>Ie.get(n)??be(n,"create",t)})}var ke={create:'client.create({ type: "Task", title: "Example", createMode: "progressive" })',update:'client.update(id, { estimatedMinutes: "45", force: false })',append:'client.append(id, "Body text")',reopen:'client.reopen(id, "The work recurred", { expectedResult: "Verified recovery" })'};function h(e,t,n){let r=`${e} ${t} must be ${n}.`;throw new d(r,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",field:t,changed:!1,required:r,examples:[ke[e]]})}function K(e,t,n){typeof e!="string"&&h(t,n,"a string")}function B(e,t){(e===null||typeof e!="object"||Array.isArray(e))&&h(t,"options","an object")}function le(e,t){(e==="append"||e==="update")&&t.id!==void 0&&K(t.id,e,"id"),e==="item-reopen"&&(t.id!==void 0&&K(t.id,"reopen","id"),t.reason!==void 0&&K(t.reason,"reopen","reason"),t.options!==void 0&&ve(t.options))}function Ft(e){B(e,"append");for(let t of["body","author","message"])e[t]!==void 0&&K(e[t],"append",t);e.force!==void 0&&typeof e.force!="boolean"&&h("append","force","a boolean")}function ve(e){B(e,"reopen");for(let t of R["item-reopen"].optional){let n=e[t];n!==void 0&&(_(Reflect.get(T,t)).type==="boolean"?typeof n!="boolean"&&h("reopen",t,"a boolean"):K(n,"reopen",t))}}function Fe(e,t){return e?t?"a string or string array":"a string array":"a string"}function Me(e,t,n,r,i,o){n===void 0||typeof n=="string"&&(!i||o)||r==="priority"&&typeof n=="number"&&Number.isFinite(n)||i&&Array.isArray(n)&&Array.from(n).every(a=>typeof a=="string")||h(e,t,Fe(i,o))}function we(e,t,n){let r=e==="create"?k:v;for(let{param:i}of[...r,...O,{param:"force"}]){if(_(Reflect.get(T,i)).type!=="boolean")continue;let o=n.find(a=>a.keys.includes(i))?.keys??[i];for(let a of o)t[a]!==void 0&&typeof t[a]!="boolean"&&h(e,a,"a boolean")}}function j(e,t,n=!0,r=!1){let i=e==="create"?x:C;for(let{target:o,keys:a,repeatable:s}of i)if(_(Reflect.get(T,o)).type!=="boolean")for(let c of a){let y=r&&c!==o,m=s===!0&&(o!=="acceptanceCriteria"||y);Me(e,c,t[c],o,m,n||y)}we(e,t,i)}function Mt(e,t){B(t,e);let n=H(t),r=S(n);return r||F(e,n),j(e,n,!1,r),n}var Pe=Symbol("pm.mcp-mutation-transport"),Le=new Set(["create","update","append"]),P={create:{parameters:k,aliases:x,strings:J,repeatables:Z},update:{parameters:v,aliases:C,strings:Q,repeatables:ee}},De=new Set(["activity","aggregate","context","contracts","deps","files-discover","files-lookup","get","graph","health","history","history-attest","list","next","search","stats","telemetry","validate"]);function b(e){return Pe in e}function w(e,t){return b(e)?q(t):A(e,t)}function Jt(e,t,n=[]){let r=A(e,{...e,...t});for(let i of n)Reflect.deleteProperty(r,i);return r}function l(e,t){let n=e[t];return typeof n=="string"&&n.trim().length>0?n:void 0}function u(e,t){let n=e[t];return typeof n=="string"?n.trim().length>0?n:void 0:typeof n=="number"&&Number.isFinite(n)?String(n):void 0}function Zt(e,t){let n=e[t];return typeof n=="string"?n:typeof n=="number"&&Number.isFinite(n)?String(n):void 0}function p(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Qt(e,t){if(typeof e=="number"){if(!Number.isInteger(e))throw new d(`${t} must be a finite integer.`,f.USAGE);return e}if(typeof e=="string"&&e.trim().length>0){let n=Number(e);if(!Number.isInteger(n))throw new d(`${t} must be a finite integer.`,f.USAGE);return n}}function en(e,t){return typeof e.limit=="number"&&Number.isFinite(e.limit)?e.limit:typeof t.limit=="number"&&Number.isFinite(t.limit)?t.limit:l(e,"limit")??l(t,"limit")}function tn(e){let t=l(e,"outputFormat");return{json:!0,quiet:!0,author:l(e,"author"),path:l(e,"path"),noExtensions:e.noExtensions===!0||e.no_extensions===!0,noPager:!0,outputInclude:l(e,"outputInclude"),outputLimit:u(e,"outputLimit"),outputBudget:u(e,"outputBudget"),outputSession:l(e,"outputSession"),outputCursor:l(e,"outputCursor"),outputFormat:t==="json"||t==="toon"?t:void 0}}var pe=new Set(["tags","blockedBy","blocked_by","skills","fields"]),me=new Set(["comment","note","learning","reminder","event","dep","depRemove","dep_remove","file","doc","test","unset","addGlob","add_glob","migrate","envSet","env_set","envClear","env_clear"]),Ue=new Set([...me].filter(e=>e!=="file")),$e=new Set(["files","files-discover","docs","test","test-all"]),z=new Set(["comments","notes","learnings"]);function Be(e,t){if(!(!z.has(e)||!Object.prototype.hasOwnProperty.call(t,"file")))throw new d(`MCP ${e} does not accept options.file. Pass annotation text in options.add instead.`,f.USAGE,{code:"mcp_annotation_file_unavailable",required:"Pass annotation text as JSON data; MCP annotation actions cannot read server-local files."})}var je=new Set(["claim","release","start-task","pause-task","close-task"]),ye={history:["order"],"history-attest":["verify","output","hashAlgorithm"],list:["status","type","tag","priority","limit","offset"],search:["mode","status","type","tag","priority","limit"],create:["title","type","status","description","body","priority","tags","parent","createMode","create_mode","allowMissingParent","allowDuplicate","inheritFocus"],update:["parent","allowMissingParent","completedAt"],copy:["allowDuplicate"],close:["duplicateOf","completedAt","releaseAssignment"],claim:["start","next","ifAvailable","takeoverStale"],"start-task":["takeoverStale"],release:["pause","handoff"],comments:["ifAbsent"],notes:["ifAbsent"],learnings:["ifAbsent"],extension:["dryRun","offline"],package:["dryRun","offline"],install:["dryRun"],upgrade:["scope","dryRun","cliOnly","packagesOnly","repair","tag","packageName"],append:["body"]},Ge=new Set(["context","get","list","next","search","comments","notes","learnings","files","docs","test"]),Ve=new Set(["query","keywords","id","text"]);function ze(e){return Ge.has(e)?R[e].optional.filter(t=>!Ve.has(t)):[]}var Ye=new Set(["claim","start-task","comments","notes","learnings","files","docs","test"]);function He(e,t){if(!Ye.has(e??""))return t;let n={...t};for(let r of R[e].optional){let i=r.replace(/[A-Z]/gu,o=>`_${o.toLowerCase()}`);i===r||n[i]===void 0||(n[r]??=n[i],delete n[i])}return n}function qe(e,t,n){if(!z.has(e??""))return n;let r=n,i=r.text??t.text;if(i===void 0)return r;if(r.add!==void 0&&r.add!==i){let a=e.replace(/s$/u,"");throw new d(`Specify ${a} text either as text or with add, not both.`,f.USAGE,{code:"annotation_text_source_conflict",field:"text",required:`Pass the ${a} text once: text and add are the same source.`})}let o={...r,add:i};return delete o.text,o}function We(e,t){let n=t.replace(/[A-Z]/gu,r=>`_${r.toLowerCase()}`);return e[t]!==void 0||e[n]!==void 0}function Xe(e){return[...ye[e]??[],...ze(e),..._e]}var _e=["outputInclude","outputLimit","outputBudget","outputFormat","outputSession","outputCursor"];function Ae(e,t=""){let n={},r=$e.has(t),i=t==="files"||t==="files-discover"||t==="docs",o=z.has(t)?Ue:me;for(let[a,s]of Object.entries(e)){if(Array.isArray(s)&&pe.has(a)){n[a]=s.join(",");continue}if(a==="note"&&i){n[a]=s;continue}if(typeof s=="string"&&o.has(a)){n[a]=[s];continue}if(typeof s=="string"&&r&&(a==="add"||a==="remove")){n[a]=[s];continue}n[a]=s}return Object.assign(n,Object.fromEntries(Object.getOwnPropertySymbols(e).map(a=>[a,Reflect.get(e,a)]))),n}function Je(e,t,n){let r=l(e,"author");return r!==void 0?r:n!==void 0&&je.has(n)?l(e,"assignee")??l(t,"assignee"):void 0}function Ze(e,t){return t!==void 0&&e.author===void 0?{...e,author:t}:e}function Qe(e,t,n){let r={},i=P[e],o=new Set([...i.parameters.map(({param:a})=>a),...O.map(({param:a})=>a),...ye[e],..._e,"force"]);for(let a of o){let s=i.aliases.find(c=>c.keys.includes(a))?.keys??[a];t[a]===void 0||s.some(c=>n[c]!==void 0)||(r[a]=t[a])}return r}function E(e,t){throw new d(`Invalid MCP ${e} value for "${t}". No changes were made.`,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:t,required:`Provide valid ${e} field values and an options object; inspect the pm_${e} input schema for supported types.`})}function et(e,t,n){let r=P[e],i=[...r.parameters,...O,{param:"force"}];for(let{param:o}of i){if(_(T[o]).type!=="boolean")continue;let s=(r.aliases.find(c=>c.keys.includes(o))?.keys??[o]).find(c=>n[c]!==void 0&&typeof n[c]!="boolean");s!==void 0&&E(e,s)}for(let o of["idOnly","fullChangedFields"])t[o]!==void 0&&typeof t[o]!="boolean"&&E(e,o)}function tt(e,t,n){t.options!==void 0&&!p(t.options)&&E(e,"options"),et(e,t,n);for(let a of pe){let s=n[a];Array.isArray(s)&&s.some(c=>typeof c!="string")&&E(e,a)}let r=ge(n,e),i=P[e];for(let{keys:a,target:s}of i.strings)a.some(c=>n[c]!==void 0)&&r[s]===void 0&&E(e,s);let o=i.repeatables.flatMap(({keys:a})=>a).find(a=>{let s=n[a];return s!==void 0&&typeof s!="string"&&(!Array.isArray(s)||s.some(c=>typeof c!="string"))});return o!==void 0&&E(e,o),r}function nt(e,t,n,r,i){let o=(t==="create"||t==="update")&&b(e),a={...o?Qe(t,e,r):n,...r};if((t==="create"||t==="update")&&!o){let s=p(e.options)&&S(e.options);s||F(t,a),j(t,a,!0,s)}return o?tt(t,e,a):i?Ae(a,t):a}function rt(e,t){return!Le.has(e??"")||S(t)?t:X(t)}function nn(e,t,{nativeAction:n=!0}={}){le(t,e);let r=p(e.options)?e.options:void 0,i=_(e.options),o={},a=m=>{We(i,m)||e[m]===void 0||(o[m]=e[m])};for(let m of Xe(t??""))a(m);t!==void 0&&b(e)&&Be(t,i);let s=qe(t,e,He(t,nt(e,t,o,i,n)));if(t==="history-attest"&&b(e)&&(s.output!==void 0||typeof s.verify=="string"))throw new d("MCP history attest does not accept server-local proof paths. Export the returned JSON bundle and pass that JSON object as verify.",f.USAGE);let c=b(e)?e:r??e,y=w(c,Ze(s,Je(e,s,t)));return rt(t,y)}function rn(e){if(e.addNote===void 0)return e;let t={...e};return t.note===void 0&&typeof t.addNote=="string"&&(t.note=t.addNote),delete t.addNote,t}function an(e){let t={...e};return t.discoveryNote!==void 0&&t.note===void 0&&typeof t.discoveryNote=="string"&&(t.note=t.discoveryNote),delete t.discover,delete t.discoveryNote,t}function at(e){let t=[],n=!0;for(let r of e.trim().toLowerCase()){if(r>="a"&&r<="z"||r>="0"&&r<="9"){t.push(r),n=!1;continue}n||(t.push("-"),n=!0)}return t.at(-1)==="-"&&t.pop(),t.join("")}function on(e){return!De.has(at(e))}function sn(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean).join(" ")}function ot(e){return Array.isArray(e)?e.map(t=>String(t)).filter(t=>t.length>0):[]}function ln(e,t){let n=new Set(["action","args","author","cwd","fullChangedFields","id","options","path","query","reason","target"]),r={};for(let[o,a]of Object.entries(e))n.has(o)||(r[o]=a);let i={...r,...t};return delete i.args,delete i.author,i}function cn(e,t){let n=w(t??{},{...t});return{changedFields:e.fullChangedFields===!0?"full":"compact",idOnly:e.idOnly===!0,runnerOptions:n}}function V(e){return{type:u(e,"filterType"),tag:u(e,"filterTag"),priority:u(e,"filterPriority"),deadlineBefore:u(e,"filterDeadlineBefore"),deadlineAfter:u(e,"filterDeadlineAfter"),updatedAfter:u(e,"filterUpdatedAfter"),updatedBefore:u(e,"filterUpdatedBefore"),createdAfter:u(e,"filterCreatedAfter"),createdBefore:u(e,"filterCreatedBefore"),ids:D(e.ids),assignee:u(e,"filterAssignee"),assigneeFilter:u(e,"filterAssigneeFilter")??u(e,"filterAssignee_filter"),parent:u(e,"filterParent"),sprint:u(e,"filterSprint"),release:u(e,"filterRelease"),limit:u(e,"limit"),offset:u(e,"offset")}}function G(e){if(typeof e=="string"&&e.trim().length>0)return e;if(Array.isArray(e))return ot(e)}function M(e){if(typeof e=="number"&&Number.isFinite(e)||typeof e=="string"&&e.trim().length>0)return e}function un(e){let t=G(e.kind),n=G(e.exemptIsolate),r=G(e.exemptIsolateType);return{...t===void 0?{}:{kind:t},maxDepth:M(e.maxDepth),limit:M(e.limit),after:l(e,"after"),direction:l(e,"direction"),maxPaths:M(e.maxPaths),sample:M(e.sample),...n===void 0?{}:{exemptIsolate:n},...r===void 0?{}:{exemptIsolateType:r},saveBaseline:e.saveBaseline===!0,rebuild:e.rebuild===!0,clear:e.clear===!0,summary:e.summary===!0,...e.full===!0?{full:!0}:{}}}function Oe(e){let t=re(e);return e.ids!==void 0&&(t.ids=D(e.ids)),t}function fn(e){return{status:l(e,"filterStatus"),list:p(e.list)?Oe(e.list):V(e),reason:l(e,"reason"),completedAt:l(e,"completedAt")??l(e,"completed_at"),resolution:l(e,"resolution"),expectedResult:l(e,"expectedResult")??l(e,"expected_result")??l(e,"expected"),actualResult:l(e,"actualResult")??l(e,"actual_result")??l(e,"actual"),validateClose:l(e,"validateClose")??l(e,"validate_close"),author:l(e,"author"),message:l(e,"message"),force:e.force===!0?!0:void 0,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:I(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}var Y=new Set(["filterStatus","filterType","filterTag","filterPriority","filterDeadlineBefore","filterDeadlineAfter","filterUpdatedAfter","filterUpdatedBefore","filterCreatedAfter","filterCreatedBefore","filterAssignee","filterAssigneeFilter","filterAssignee_filter","filterParent","filterSprint","filterRelease","ids","list","update","limit","offset","dryRun","dry_run","rollback","checkpoint","noCheckpoint","no_checkpoint"]);function ce(e){let t={};for(let[n,r]of Object.entries(e))Y.has(n)||(t[n]=r);return Te(t)}function Te(e){return ge(e,"update")}function ge(e,t){let n=Ae(e,t),r=P[t],i=new Set([...r.parameters,...O].filter(({booleanish:o})=>o===!0).map(({param:o})=>o));for(let{keys:o}of r.repeatables)for(let a of o)typeof n[a]=="string"&&(n[a]=[n[a]]);for(let o of r.strings)for(let a of o.keys){let s=n[a];(typeof s=="number"&&Number.isFinite(s)||s===!1&&i.has(a))&&(n[a]=String(s))}return t==="create"?{...te(n,{requireType:!1})}:ne(n)}var it=new Map(C.flatMap(({target:e,keys:t})=>t.map(n=>[n,e])));function st(e){return e.startsWith("filter")||e==="ids"||e==="limit"||e==="offset"}function ue(e,t){throw new d(`update-many "${e}" cannot be null. No changes were made.`,f.USAGE,{code:"invalid_argument_value",reason:"invalid_mutation_option_value",changed:!1,field:e,required:t})}function lt(e){return Object.fromEntries(Object.entries(e).filter(([t])=>!Y.has(t)))}function fe(e,t,n){if(!e)return;let r=p(t.list)?t.list:{},i=p(t.update)?t.update:void 0,o=Object.keys(t).find(s=>t[s]===null&&(i!==void 0||Y.has(s)||st(s)))??Object.keys(r).filter(s=>r[s]===null).map(s=>`list.${s}`)[0];o!==void 0&&ue(o,`"${o}" selects rows or controls the run: omit it or pass a value. To clear an item field, pass null on the field itself${i===void 0?"":" inside update"}.`);let a=i??lt(t);for(let[s,c]of Object.entries(a)){if(c!==null)continue;let y=it.get(s);y===void 0&&ue(s,`Pass unset: ["${s}"] to clear a field, or omit "${s}".`),n[y]=null}}var ct=["author","message"];function ut(e,t){let n=Object.fromEntries(ct.filter(r=>typeof e[r]=="string"&&t[r]===void 0).map(r=>[r,e[r]]));return e.force===!0&&t.force===void 0&&(n.force=!0),Object.keys(n).length===0?t:A(t,{...t,...n})}function dn(e,t=!1){if(p(e.list)||p(e.update)){let r=p(e.update)?ut(e,e.update):ce(e),i=w(e,Te(r));return fe(t,e,i),{status:u(e,"filterStatus"),list:p(e.list)?Oe(e.list):V(e),update:W(r,i),dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:I(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}let n=w(e,ce(e));return fe(t,e,n),{status:u(e,"filterStatus"),list:V(e),update:n,dryRun:e.dryRun===!0||e.dry_run===!0?!0:void 0,rollback:I(e.rollback),checkpoint:e.checkpoint===!1||e.noCheckpoint===!0||e.no_checkpoint===!0?!1:void 0}}function de(e){return"expectHash"in e||"expect_hash"in e}function pn(e){if(!de(e)&&!(p(e.options)&&de(e.options)))return{expectHash:void 0,dispatchArgs:e};let{expectHash:t,expect_hash:n,...r}=e,i=p(r.options)?r.options:{},{expectHash:o,expect_hash:a,...s}=i,c=[t,n,o,a].filter(N=>N!==void 0),y=c.length>1?c.flatMap(N=>Array.isArray(N)?N:[N]):c[0],m=A(e,"options"in r?{...r,options:p(r.options)?A(r.options,s):r.options}:r);return{expectHash:y,dispatchArgs:m}}export{pt as a,g as b,mt as c,yt as d,_t as e,Ee as f,$ as g,Se as h,gt as i,Re as j,Ke as k,be as l,ht as m,K as n,B as o,Ft as p,ve as q,Mt as r,b as s,Jt as t,l as u,u as v,Zt as w,p as x,Qt as y,en as z,tn as A,ye as B,Ae as C,nn as D,rn as E,an as F,at as G,on as H,sn as I,ot as J,ln as K,cn as L,V as M,un as N,fn as O,Y as P,Te as Q,dn as R,pn as S};
2
+ //# sourceMappingURL=chunk-L6VS7F3R.js.map
@@ -0,0 +1,2 @@
1
+ import{ad as r}from"./chunk-OS5W4ZG2.js";import{sa as t}from"./chunk-FVY7U3SU.js";function i(o,n,p){return r(o,t(n),p)}export{i as a};
2
+ //# sourceMappingURL=chunk-LOX3VY4T.js.map