@unbrained/pm-cli 2026.11.23 → 2026.11.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/error-guidance.js +5 -5
  3. package/dist/cli/main.js +5 -5
  4. package/dist/cli/register-annotations.js +1 -1
  5. package/dist/cli/runtime/invocation-options.js +1 -1
  6. package/dist/cli-bundle/bundle-manifest.json +1 -1
  7. package/dist/cli-bundle/chunks/chunk-4FZH5BTV.js +2 -0
  8. package/dist/cli-bundle/chunks/{chunk-YYT3MIRF.js → chunk-6OIHST4I.js} +1 -1
  9. package/dist/cli-bundle/chunks/chunk-7EPYCU7U.js +9 -0
  10. package/dist/cli-bundle/chunks/{chunk-AEOHUSUI.js → chunk-BVJMVU4Z.js} +68 -68
  11. package/dist/cli-bundle/chunks/{chunk-2UQU7HRR.js → chunk-C4KIZQHW.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-CNUFU454.js +113 -0
  13. package/dist/cli-bundle/chunks/chunk-CONBVY2O.js +2 -0
  14. package/dist/cli-bundle/chunks/{chunk-BSRIVYTM.js → chunk-CZEMEPPQ.js} +3 -3
  15. package/dist/cli-bundle/chunks/chunk-DF6A7C32.js +2 -0
  16. package/dist/cli-bundle/chunks/chunk-FHLOGAGA.js +8 -0
  17. package/dist/cli-bundle/chunks/chunk-FVY7U3SU.js +125 -0
  18. package/dist/cli-bundle/chunks/{chunk-F2Z6XLZB.js → chunk-GBVF2ZB3.js} +2 -2
  19. package/dist/cli-bundle/chunks/chunk-GZI7ZAB7.js +2 -0
  20. package/dist/cli-bundle/chunks/chunk-HZZLSBIJ.js +2 -0
  21. package/dist/cli-bundle/chunks/chunk-K34FR5CO.js +3 -0
  22. package/dist/cli-bundle/chunks/{chunk-D6PDUKUG.js → chunk-KHFUHGL3.js} +2 -2
  23. package/dist/cli-bundle/chunks/chunk-L6VS7F3R.js +2 -0
  24. package/dist/cli-bundle/chunks/chunk-LOX3VY4T.js +2 -0
  25. package/dist/cli-bundle/chunks/{chunk-H7JEXRIN.js → chunk-LPW7S5KA.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-5DUP4AZA.js → chunk-MGJMQSN4.js} +2 -2
  27. package/dist/cli-bundle/chunks/chunk-OS5W4ZG2.js +31 -0
  28. package/dist/cli-bundle/chunks/{chunk-O7JHS64G.js → chunk-OWK2JL4I.js} +2 -2
  29. package/dist/cli-bundle/chunks/chunk-SCIPT7WF.js +2 -0
  30. package/dist/cli-bundle/chunks/chunk-SX76UGEY.js +3 -0
  31. package/dist/cli-bundle/chunks/{chunk-CFWLQFJM.js → chunk-VA4T37Q4.js} +50 -51
  32. package/dist/cli-bundle/chunks/chunk-WQOEVGLQ.js +2 -0
  33. package/dist/cli-bundle/chunks/chunk-XHCIOLJP.js +3 -0
  34. package/dist/cli-bundle/chunks/{chunk-J2PDAVBC.js → chunk-XKWJONAO.js} +2 -2
  35. package/dist/cli-bundle/chunks/chunk-YIGBEY7K.js +2 -0
  36. package/dist/cli-bundle/chunks/chunk-ZBOQEZ2H.js +33 -0
  37. package/dist/cli-bundle/chunks/chunk-ZLICQPRG.js +3 -0
  38. package/dist/cli-bundle/chunks/field-option-collisions-QE65APSD.js +2 -0
  39. package/dist/cli-bundle/chunks/{indexed-receipt-blobs-BPYKN5Q7.js → indexed-receipt-blobs-H3MMNXXG.js} +2 -2
  40. package/dist/cli-bundle/{focused-chunks/item-revision-YDACCDVY.js → chunks/item-revision-INDHJV6X.js} +2 -2
  41. package/dist/cli-bundle/chunks/item-transaction-LCKK4XXB.js +2 -0
  42. package/dist/cli-bundle/chunks/mutation-actor-KU7BMLUN.js +2 -0
  43. package/dist/cli-bundle/chunks/mutation-admission-3OMCTQD4.js +2 -0
  44. package/dist/cli-bundle/chunks/{register-list-query-L4IBU64P.js → register-list-query-3GV3LBOT.js} +2 -2
  45. package/dist/cli-bundle/chunks/register-mutation-GZLF47SX.js +21 -0
  46. package/dist/cli-bundle/chunks/register-operations-PBJZGCAL.js +2 -0
  47. package/dist/cli-bundle/chunks/register-setup-ZLJEF6NZ.js +2 -0
  48. package/dist/cli-bundle/chunks/runtime-schema-Y4SHTEXL.js +2 -0
  49. package/dist/cli-bundle/chunks/{settlement-hook-6MR32OOC.js → settlement-hook-ESAAEBRM.js} +2 -2
  50. package/dist/cli-bundle/chunks/stage-3WIZBD4N.js +2 -0
  51. package/dist/cli-bundle/focused-chunks/chunk-3Y5PTQ2F.js +27 -0
  52. package/dist/cli-bundle/focused-chunks/{chunk-Y2ESLKCF.js → chunk-4LQL4EO6.js} +3 -3
  53. package/dist/cli-bundle/focused-chunks/{chunk-RIE3SJSE.js → chunk-4SX2BN4V.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-ZHWPCVQL.js → chunk-5RBC4WSE.js} +39 -39
  55. package/dist/cli-bundle/focused-chunks/chunk-7SSGTGZO.js +91 -0
  56. package/dist/cli-bundle/focused-chunks/chunk-A4R57E4K.js +2 -0
  57. package/dist/cli-bundle/focused-chunks/chunk-BOIMP2AR.js +5 -0
  58. package/dist/cli-bundle/focused-chunks/chunk-BYQK5DGH.js +2 -0
  59. package/dist/cli-bundle/focused-chunks/chunk-C3FEDTSD.js +44 -0
  60. package/dist/cli-bundle/focused-chunks/chunk-IAOKVKWW.js +2 -0
  61. package/dist/cli-bundle/focused-chunks/chunk-JOKRDFMQ.js +2 -0
  62. package/dist/cli-bundle/focused-chunks/chunk-MB56Y4M6.js +8 -0
  63. package/dist/cli-bundle/focused-chunks/{chunk-A6VEMCRR.js → chunk-NGFDPEP7.js} +1 -1
  64. package/dist/cli-bundle/focused-chunks/chunk-OCKKIECS.js +3 -0
  65. package/dist/cli-bundle/focused-chunks/chunk-PKX2EHE3.js +26 -0
  66. package/dist/cli-bundle/focused-chunks/chunk-SXC2EO3E.js +3 -0
  67. package/dist/cli-bundle/focused-chunks/chunk-TQIKDFOD.js +2 -0
  68. package/dist/cli-bundle/focused-chunks/chunk-TRL4JDWX.js +8 -0
  69. package/dist/cli-bundle/focused-chunks/{chunk-IROZDIDX.js → chunk-UWWAVXG4.js} +2 -2
  70. package/dist/cli-bundle/focused-chunks/chunk-VMYVN36N.js +13 -0
  71. package/dist/cli-bundle/focused-chunks/chunk-VU2PH4PF.js +2 -0
  72. package/dist/cli-bundle/focused-chunks/chunk-WL2R7T5G.js +2 -0
  73. package/dist/cli-bundle/focused-chunks/chunk-WVA5KOXF.js +3 -0
  74. package/dist/cli-bundle/focused-chunks/{chunk-QQIIMMFU.js → chunk-X4EWD6TL.js} +2 -2
  75. package/dist/cli-bundle/focused-chunks/chunk-XKLBTDJ7.js +100 -0
  76. package/dist/cli-bundle/focused-chunks/chunk-YYEWIKNI.js +2 -0
  77. package/dist/cli-bundle/focused-chunks/chunk-ZLRRII55.js +2 -0
  78. package/dist/cli-bundle/focused-chunks/field-option-collisions-5ROXGUME.js +2 -0
  79. package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-EGEJMG3G.js → indexed-receipt-blobs-PG2VJ3MB.js} +2 -2
  80. package/dist/cli-bundle/focused-chunks/item-revision-KYMSQVZE.js +2 -0
  81. package/dist/cli-bundle/focused-chunks/item-transaction-I4HLVHEJ.js +2 -0
  82. package/dist/cli-bundle/focused-chunks/mutation-actor-GGOQKAE6.js +2 -0
  83. package/dist/cli-bundle/focused-chunks/mutation-admission-OS36ZCMH.js +2 -0
  84. package/dist/cli-bundle/focused-chunks/runtime-schema-YXPYDD2C.js +2 -0
  85. package/dist/cli-bundle/focused-chunks/{settlement-hook-FMLGKG7J.js → settlement-hook-4MGRERCT.js} +2 -2
  86. package/dist/cli-bundle/focused-chunks/stage-4ZFWJUKO.js +2 -0
  87. package/dist/cli-bundle/main.js +26 -26
  88. package/dist/cli-bundle/sdk-authoring.js +1 -1
  89. package/dist/cli-bundle/sdk-contracts.js +4 -4
  90. package/dist/cli-bundle/sdk-core.js +1 -1
  91. package/dist/cli-bundle/sdk-governance.js +1 -1
  92. package/dist/cli-bundle/sdk-graph.js +1 -1
  93. package/dist/cli-bundle/sdk-merge.js +63 -63
  94. package/dist/cli-bundle/sdk-query.js +1 -1
  95. package/dist/cli-bundle/sdk-runtime.js +1 -1
  96. package/dist/cli-bundle/sdk-testing.js +1 -1
  97. package/dist/cli-bundle/sdk.js +12 -12
  98. package/dist/core/profile/profile-lint.d.ts +1 -1
  99. package/dist/core/profile/profile-lint.js +1 -1
  100. package/dist/core/schema/fields-file.js +2 -2
  101. package/dist/core/schema/runtime-field-values.js +1 -1
  102. package/dist/core/schema/runtime-schema.d.ts +2 -0
  103. package/dist/core/schema/runtime-schema.js +1 -1
  104. package/dist/core/shared/command-line.d.ts +54 -4
  105. package/dist/core/shared/command-line.js +1 -1
  106. package/dist/core/shared/errors.d.ts +9 -0
  107. package/dist/core/shared/secret-rules.js +5 -5
  108. package/dist/core/shared/url-credentials.d.ts +16 -3
  109. package/dist/core/shared/url-credentials.js +1 -1
  110. package/dist/core/store/item-store.d.ts +26 -4
  111. package/dist/core/store/item-store.js +1 -1
  112. package/dist/sdk/command-line.d.ts +1 -1
  113. package/dist/sdk/command-line.js +1 -1
  114. package/dist/sdk/context-intent-contracts.js +1 -1
  115. package/dist/sdk/extension/command-options.d.ts +26 -1
  116. package/dist/sdk/extension/command-options.js +1 -1
  117. package/dist/sdk/extension-command-context.js +2 -2
  118. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  119. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  120. package/dist/sdk/governance/tracked-runtime-cache.js +1 -1
  121. package/dist/sdk/index.d.ts +1 -1
  122. package/dist/sdk/lifecycle/claim.d.ts +21 -1
  123. package/dist/sdk/lifecycle/claim.js +1 -1
  124. package/dist/sdk/lifecycle/task-composition.js +1 -1
  125. package/dist/sdk/ownership-source.d.ts +15 -1
  126. package/dist/sdk/ownership-source.js +1 -1
  127. package/dist/sdk/public-surface.json +1 -1
  128. package/dist/sdk/read-output-contracts.d.ts +11 -0
  129. package/dist/sdk/read-output-contracts.js +1 -1
  130. package/dist/sdk/runtime-primitives.d.ts +1 -1
  131. package/dist/sdk/schema/field-flag-spelling.d.ts +22 -0
  132. package/dist/sdk/schema/field-flag-spelling.js +2 -0
  133. package/dist/sdk/schema/field-option-collisions.js +1 -1
  134. package/docs/AGENT_GUIDE.md +2 -2
  135. package/docs/COMMANDS.md +1 -1
  136. package/docs/CONFIGURATION.md +1 -0
  137. package/docs/EXTENSIONS.md +1 -1
  138. package/docs/MUTATION_INTEGRITY.md +97 -8
  139. package/docs/READ_OUTPUT_CONTRACTS.md +2 -0
  140. package/docs/SDK.md +60 -4
  141. package/docs/SDK_AUDITED_MUTATIONS.md +11 -0
  142. package/docs/WORKSPACE_POSITION_AND_LIFECYCLE.md +17 -4
  143. package/marketplace.json +1 -1
  144. package/package.json +1 -1
  145. package/packages/pm-beads/package.json +1 -1
  146. package/packages/pm-calendar/package.json +1 -1
  147. package/packages/pm-command-kit/package.json +1 -1
  148. package/packages/pm-digital-twin/package.json +1 -1
  149. package/packages/pm-governance-audit/package.json +1 -1
  150. package/packages/pm-guide-shell/package.json +1 -1
  151. package/packages/pm-kanban/package.json +1 -1
  152. package/packages/pm-lifecycle-hooks/package.json +1 -1
  153. package/packages/pm-linked-test-adapters/package.json +1 -1
  154. package/packages/pm-search-advanced/package.json +1 -1
  155. package/packages/pm-templates/package.json +1 -1
  156. package/packages/pm-todos/package.json +1 -1
  157. package/packages/pm-vcs/package.json +1 -1
  158. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  159. package/plugins/pm-claude/package.json +1 -1
  160. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  161. package/plugins/pm-codex/package.json +1 -1
  162. package/plugins/pm-codex/plugin.json +1 -1
  163. package/runtime-dependencies.json +1 -1
  164. package/dist/cli-bundle/chunks/chunk-5WZZ5XEN.js +0 -3
  165. package/dist/cli-bundle/chunks/chunk-6MYJLOSG.js +0 -2
  166. package/dist/cli-bundle/chunks/chunk-ENKXRSFZ.js +0 -31
  167. package/dist/cli-bundle/chunks/chunk-FJOEL75F.js +0 -2
  168. package/dist/cli-bundle/chunks/chunk-GDXCAC52.js +0 -2
  169. package/dist/cli-bundle/chunks/chunk-KE7HMBEW.js +0 -2
  170. package/dist/cli-bundle/chunks/chunk-KZHIBEJL.js +0 -33
  171. package/dist/cli-bundle/chunks/chunk-NGJ5ERBF.js +0 -115
  172. package/dist/cli-bundle/chunks/chunk-NQ54T7T2.js +0 -2
  173. package/dist/cli-bundle/chunks/chunk-OKEZF7HU.js +0 -2
  174. package/dist/cli-bundle/chunks/chunk-OKIKF4FD.js +0 -2
  175. package/dist/cli-bundle/chunks/chunk-OPJF254V.js +0 -9
  176. package/dist/cli-bundle/chunks/chunk-RWA5YZ5X.js +0 -2
  177. package/dist/cli-bundle/chunks/chunk-S32NGRQM.js +0 -2
  178. package/dist/cli-bundle/chunks/chunk-TZY5MVJF.js +0 -125
  179. package/dist/cli-bundle/chunks/chunk-ZPS4B6SI.js +0 -8
  180. package/dist/cli-bundle/chunks/item-revision-FMD4KWBB.js +0 -2
  181. package/dist/cli-bundle/chunks/item-transaction-SEHTH7N2.js +0 -2
  182. package/dist/cli-bundle/chunks/mutation-actor-SFGYIRPW.js +0 -2
  183. package/dist/cli-bundle/chunks/mutation-admission-57LBSKQI.js +0 -2
  184. package/dist/cli-bundle/chunks/register-mutation-6NUOPHZ3.js +0 -21
  185. package/dist/cli-bundle/chunks/register-operations-JGYVORNN.js +0 -2
  186. package/dist/cli-bundle/chunks/register-setup-C44SIXEH.js +0 -2
  187. package/dist/cli-bundle/chunks/stage-PQ7AB63N.js +0 -2
  188. package/dist/cli-bundle/focused-chunks/chunk-6LKTEKHS.js +0 -6
  189. package/dist/cli-bundle/focused-chunks/chunk-6LPXMFLM.js +0 -2
  190. package/dist/cli-bundle/focused-chunks/chunk-HMDQDRV2.js +0 -8
  191. package/dist/cli-bundle/focused-chunks/chunk-I66IKYKP.js +0 -2
  192. package/dist/cli-bundle/focused-chunks/chunk-IR2J3NOT.js +0 -2
  193. package/dist/cli-bundle/focused-chunks/chunk-ITKDHSBR.js +0 -2
  194. package/dist/cli-bundle/focused-chunks/chunk-LQYYPXUK.js +0 -26
  195. package/dist/cli-bundle/focused-chunks/chunk-NQTEE66P.js +0 -13
  196. package/dist/cli-bundle/focused-chunks/chunk-O7Z73ALG.js +0 -2
  197. package/dist/cli-bundle/focused-chunks/chunk-OTMMOKPM.js +0 -91
  198. package/dist/cli-bundle/focused-chunks/chunk-OXOCZJC6.js +0 -2
  199. package/dist/cli-bundle/focused-chunks/chunk-QLAHEDT6.js +0 -2
  200. package/dist/cli-bundle/focused-chunks/chunk-TD544C74.js +0 -8
  201. package/dist/cli-bundle/focused-chunks/chunk-UFTUNBMY.js +0 -27
  202. package/dist/cli-bundle/focused-chunks/chunk-XRS3VNC6.js +0 -44
  203. package/dist/cli-bundle/focused-chunks/chunk-XYPEZGTR.js +0 -2
  204. package/dist/cli-bundle/focused-chunks/chunk-YSJKQLFR.js +0 -2
  205. package/dist/cli-bundle/focused-chunks/chunk-Z2X7HH3C.js +0 -102
  206. package/dist/cli-bundle/focused-chunks/item-transaction-UKEQCTKB.js +0 -2
  207. package/dist/cli-bundle/focused-chunks/mutation-actor-AS465LRX.js +0 -2
  208. package/dist/cli-bundle/focused-chunks/mutation-admission-E5UHJZFE.js +0 -2
  209. package/dist/cli-bundle/focused-chunks/stage-36J7YLGI.js +0 -2
@@ -1,2 +0,0 @@
1
- import{lb as h}from"./chunk-OPJF254V.js";import{$ as L,Ub as $,Vb as V,Ve as D,Wd as z,We as G,Xd as w,Y as C,Z as I,_ as v,_b as B,aa as g,ba as y,gh as U,hc as S,hf as P,if as W,lb as R,u as F,v as p,x as E,y as M,z as k}from"./chunk-NGJ5ERBF.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-RWA5YZ5X.js.map
@@ -1,2 +0,0 @@
1
- import{b as C}from"./chunk-NQ54T7T2.js";import{Va as M,Xa as T,Za as D,_a as w}from"./chunk-TZY5MVJF.js";import{I as R,v as H}from"./chunk-2UQU7HRR.js";import{Bh as g,Dh as x,Eh as v,Ka as l,Sa as p,ge as _,pj as E,re as y,tc as u,ve as I}from"./chunk-NGJ5ERBF.js";import{A as f,C as h}from"./chunk-YYT3MIRF.js";function J(e,o){let a=I(e),n=e.length>0?e[e.length-1].after_hash:v(),i=o===void 0||a.item_hash_version===void 0?void 0:x(o,a.item_hash_version,u(e.at(-1)?.hash_algorithm)),s=o===void 0?void 0:i===void 0?g(o):i[Math.max(0,i.indexOf(n))],r=s===void 0?void 0:s===n,t=[...a.errors];return r===!1&&t.push("verify_failed:current_item_hash_mismatch"),{ok:t.length===0,entries:e.length,errors:t,latest_after_hash:e.length>0?e[e.length-1].after_hash:void 0,current_item_hash:s,current_matches_latest:r}}async function K(e,o,a={}){let n=p(a.cwd??process.cwd(),a.pmRoot);await R(n);let i=await H(n),s=l(i,E()),r=await C(n,e,i,s.type_to_folder),t=await _(r.historyPath,r.id);if(t.length===0)throw new h(`No history exists for ${r.id}; point-in-time reads are unavailable.`,f.NOT_FOUND);let d=T(o,t),A=w(D(t,d.historyIndex),d),m=y(A,{schema:i.schema});if(m.metadata.id!==r.id)throw new h(`History target resolved to item ${m.metadata.id}, expected ${r.id}.`,f.GENERIC_FAILURE);let N=t[d.historyIndex],c=M(t,!0);return{document:m,reconstructed:!0,as_of_version:c===null?null:c+d.historyIndex+1,as_of_timestamp:N.ts,target:d,history_length:t.length}}export{J as a,K as b};
2
- //# sourceMappingURL=chunk-S32NGRQM.js.map