@unbrained/pm-cli 2026.9.21 → 2026.9.22

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 (250) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +21 -1
  3. package/dist/cli/commander-usage.d.ts +5 -1
  4. package/dist/cli/commander-usage.js +2 -2
  5. package/dist/cli/commands/annotations/comments.d.ts +2 -0
  6. package/dist/cli/commands/{comments.js → annotations/comments.js} +1 -1
  7. package/dist/cli/commands/{docs.d.ts → annotations/docs.d.ts} +2 -2
  8. package/dist/cli/commands/{docs.js → annotations/docs.js} +1 -1
  9. package/dist/cli/commands/{files.d.ts → annotations/files.d.ts} +2 -2
  10. package/dist/cli/commands/{files.js → annotations/files.js} +1 -1
  11. package/dist/cli/commands/annotations/learnings.d.ts +2 -0
  12. package/dist/cli/commands/{learnings.js → annotations/learnings.js} +1 -1
  13. package/dist/cli/commands/annotations/notes.d.ts +2 -0
  14. package/dist/cli/commands/{notes.js → annotations/notes.js} +1 -1
  15. package/dist/cli/commands/extension/extension.d.ts +6 -0
  16. package/dist/cli/commands/{extension.js → extension/extension.js} +1 -1
  17. package/dist/cli/commands/{gc.d.ts → governance/gc.d.ts} +2 -2
  18. package/dist/cli/commands/{gc.js → governance/gc.js} +1 -1
  19. package/dist/cli/commands/governance/health.d.ts +6 -0
  20. package/dist/cli/commands/{deps.js → governance/health.js} +2 -2
  21. package/dist/cli/commands/governance/telemetry.d.ts +6 -0
  22. package/dist/cli/commands/{telemetry.js → governance/telemetry.js} +1 -1
  23. package/dist/cli/commands/governance/validate.d.ts +9 -0
  24. package/dist/cli/commands/governance/validate.js +2 -0
  25. package/dist/cli/commands/history/activity.d.ts +6 -0
  26. package/dist/cli/commands/{activity.js → history/activity.js} +1 -1
  27. package/dist/cli/commands/history/history-compact.d.ts +7 -0
  28. package/dist/cli/commands/{history-compact.js → history/history-compact.js} +1 -1
  29. package/dist/cli/commands/{history-redact.d.ts → history/history-redact.d.ts} +2 -2
  30. package/dist/cli/commands/history/history-redact.js +2 -0
  31. package/dist/cli/commands/{history-repair.d.ts → history/history-repair.d.ts} +2 -2
  32. package/dist/cli/commands/{history-repair.js → history/history-repair.js} +1 -1
  33. package/dist/cli/commands/history/history.d.ts +2 -0
  34. package/dist/cli/commands/{history.js → history/history.js} +1 -1
  35. package/dist/cli/commands/history/restore.d.ts +6 -0
  36. package/dist/cli/commands/history/restore.js +2 -0
  37. package/dist/cli/commands/lifecycle/append.d.ts +2 -0
  38. package/dist/cli/commands/{append.js → lifecycle/append.js} +1 -1
  39. package/dist/cli/commands/lifecycle/claim.d.ts +2 -0
  40. package/dist/cli/commands/{claim.js → lifecycle/claim.js} +1 -1
  41. package/dist/cli/commands/lifecycle/close-many.d.ts +2 -0
  42. package/dist/cli/commands/{close-many.js → lifecycle/close-many.js} +1 -1
  43. package/dist/cli/commands/lifecycle/close.d.ts +6 -0
  44. package/dist/cli/commands/lifecycle/close.js +2 -0
  45. package/dist/cli/commands/lifecycle/copy.d.ts +6 -0
  46. package/dist/cli/commands/lifecycle/copy.js +2 -0
  47. package/dist/cli/commands/lifecycle/create.d.ts +6 -0
  48. package/dist/cli/commands/{create.js → lifecycle/create.js} +1 -1
  49. package/dist/cli/commands/lifecycle/delete.d.ts +6 -0
  50. package/dist/cli/commands/{delete.js → lifecycle/delete.js} +1 -1
  51. package/dist/cli/commands/lifecycle/focus.d.ts +6 -0
  52. package/dist/cli/commands/lifecycle/focus.js +2 -0
  53. package/dist/cli/commands/lifecycle/plan.d.ts +6 -0
  54. package/dist/cli/commands/{plan.js → lifecycle/plan.js} +1 -1
  55. package/dist/cli/commands/lifecycle/update-many.d.ts +2 -0
  56. package/dist/cli/commands/lifecycle/update-many.js +2 -0
  57. package/dist/cli/commands/lifecycle/update.d.ts +6 -0
  58. package/dist/cli/commands/{copy.js → lifecycle/update.js} +2 -2
  59. package/dist/cli/commands/query/aggregate.d.ts +2 -0
  60. package/dist/cli/commands/{aggregate.js → query/aggregate.js} +1 -1
  61. package/dist/cli/commands/query/context.d.ts +6 -0
  62. package/dist/cli/commands/{focus.js → query/context.js} +2 -2
  63. package/dist/cli/commands/{deps.d.ts → query/deps.d.ts} +2 -2
  64. package/dist/cli/commands/query/deps.js +2 -0
  65. package/dist/cli/commands/query/duplicates.d.ts +6 -0
  66. package/dist/cli/commands/{duplicates.js → query/duplicates.js} +1 -1
  67. package/dist/cli/commands/{eval.d.ts → query/eval.d.ts} +2 -2
  68. package/dist/cli/commands/{eval.js → query/eval.js} +1 -1
  69. package/dist/cli/commands/query/get.d.ts +6 -0
  70. package/dist/cli/commands/{get.js → query/get.js} +1 -1
  71. package/dist/cli/commands/{graph.d.ts → query/graph.d.ts} +2 -2
  72. package/dist/cli/commands/{graph.js → query/graph.js} +1 -1
  73. package/dist/cli/commands/{list.d.ts → query/list.d.ts} +2 -2
  74. package/dist/cli/commands/{list.js → query/list.js} +1 -1
  75. package/dist/cli/commands/{next.d.ts → query/next.d.ts} +2 -2
  76. package/dist/cli/commands/{next.js → query/next.js} +1 -1
  77. package/dist/cli/commands/query/search.d.ts +6 -0
  78. package/dist/cli/commands/{search.js → query/search.js} +1 -1
  79. package/dist/cli/commands/query/stats.d.ts +6 -0
  80. package/dist/cli/commands/{stats.js → query/stats.js} +1 -1
  81. package/dist/cli/commands/{test-all.d.ts → test/test-all.d.ts} +2 -2
  82. package/dist/cli/commands/{test-all.js → test/test-all.js} +1 -1
  83. package/dist/cli/commands/{test-runs.d.ts → test/test-runs.d.ts} +2 -2
  84. package/dist/cli/commands/{test-runs.js → test/test-runs.js} +1 -1
  85. package/dist/cli/commands/{test.d.ts → test/test.d.ts} +2 -2
  86. package/dist/cli/commands/{test.js → test/test.js} +1 -1
  87. package/dist/cli/commands/{config.d.ts → workspace/config.d.ts} +2 -2
  88. package/dist/cli/commands/{config.js → workspace/config.js} +1 -1
  89. package/dist/cli/commands/workspace/contracts.d.ts +2 -0
  90. package/dist/cli/commands/{contracts.js → workspace/contracts.js} +1 -1
  91. package/dist/cli/commands/{init.d.ts → workspace/init.d.ts} +2 -2
  92. package/dist/cli/commands/{update.js → workspace/init.js} +2 -2
  93. package/dist/cli/commands/workspace/merge.d.ts +8 -0
  94. package/dist/cli/commands/workspace/merge.js +2 -0
  95. package/dist/cli/commands/{profile.d.ts → workspace/profile.d.ts} +2 -2
  96. package/dist/cli/commands/{profile.js → workspace/profile.js} +1 -1
  97. package/dist/cli/commands/workspace/schema.d.ts +7 -0
  98. package/dist/cli/commands/workspace/schema.js +2 -0
  99. package/dist/cli/commands/workspace/upgrade.d.ts +2 -0
  100. package/dist/cli/commands/{update-many.js → workspace/upgrade.js} +2 -2
  101. package/dist/cli/register-annotations.js +1 -1
  102. package/dist/cli/register-history-activity.js +1 -1
  103. package/dist/cli/register-history-maintenance.js +1 -1
  104. package/dist/cli/register-list-query.js +1 -1
  105. package/dist/cli/register-mutation.js +1 -1
  106. package/dist/cli/register-operations.js +1 -1
  107. package/dist/cli/register-setup.js +1 -1
  108. package/dist/cli/schema/registration.js +1 -1
  109. package/dist/cli/stats-analytics-json.d.ts +1 -1
  110. package/dist/cli/stats-analytics-json.js +1 -1
  111. package/dist/cli-bundle/bundle-manifest.json +154 -154
  112. package/dist/cli-bundle/chunks/{chunk-GRHSNUQO.js → chunk-3OFFMS2N.js} +2 -2
  113. package/dist/cli-bundle/chunks/{chunk-QZTS23BV.js → chunk-4XOV7Q5R.js} +2 -2
  114. package/dist/cli-bundle/chunks/{chunk-2QLXN6HZ.js → chunk-AVWHZUNC.js} +26 -26
  115. package/dist/cli-bundle/chunks/{chunk-2UNYUB4A.js → chunk-BJBBOUYQ.js} +2 -2
  116. package/dist/cli-bundle/chunks/{chunk-JBJUOOJI.js → chunk-CM57QHVK.js} +5 -5
  117. package/dist/cli-bundle/chunks/{chunk-NHRB3L5T.js → chunk-D2OV2UBV.js} +2 -2
  118. package/dist/cli-bundle/chunks/{chunk-4SI67A2F.js → chunk-GFTN5OS4.js} +2 -2
  119. package/dist/cli-bundle/chunks/{chunk-HAFSMFJK.js → chunk-JSW33Q6R.js} +3 -3
  120. package/dist/cli-bundle/chunks/{chunk-FBWAECBI.js → chunk-ML42DLI3.js} +3 -3
  121. package/dist/cli-bundle/chunks/{chunk-SDLBF4PY.js → chunk-SBTT42A4.js} +2 -2
  122. package/dist/cli-bundle/chunks/chunk-SGFQQXFD.js +2 -0
  123. package/dist/cli-bundle/chunks/{chunk-7YUYLYJQ.js → chunk-UDNYAMCM.js} +6 -6
  124. package/dist/cli-bundle/chunks/{chunk-K7RWRJLT.js → chunk-ZSPZJOMK.js} +2 -2
  125. package/dist/cli-bundle/chunks/{register-list-query-5V43MYPN.js → register-list-query-VOS5CBX4.js} +2 -2
  126. package/dist/cli-bundle/chunks/register-mutation-LWZH6UFJ.js +20 -0
  127. package/dist/cli-bundle/chunks/{register-operations-LJU5H2CU.js → register-operations-YJK4DNFZ.js} +2 -2
  128. package/dist/cli-bundle/chunks/{register-setup-HJUNGYBB.js → register-setup-Q3CYF67Q.js} +2 -2
  129. package/dist/cli-bundle/focused-chunks/{chunk-L6L4XCLY.js → chunk-AO5FR7PN.js} +2 -2
  130. package/dist/cli-bundle/focused-chunks/{chunk-K5ZCBC6Y.js → chunk-CASXNCNQ.js} +2 -2
  131. package/dist/cli-bundle/focused-chunks/{chunk-FXAZPSU6.js → chunk-FKYUTTFL.js} +2 -2
  132. package/dist/cli-bundle/focused-chunks/{chunk-DPBTIFW7.js → chunk-IOL25GKH.js} +2 -2
  133. package/dist/cli-bundle/focused-chunks/{chunk-N6KI3LWF.js → chunk-JCD5YESL.js} +2 -2
  134. package/dist/cli-bundle/focused-chunks/{chunk-6MNKQKT6.js → chunk-LH24XUPJ.js} +2 -2
  135. package/dist/cli-bundle/focused-chunks/{chunk-IA5CCSBB.js → chunk-MXESHALQ.js} +2 -2
  136. package/dist/cli-bundle/focused-chunks/{chunk-3XPBKIV6.js → chunk-PRMQTT7X.js} +12 -12
  137. package/dist/cli-bundle/focused-chunks/{chunk-ISEOBALS.js → chunk-QFEDRPPI.js} +2 -2
  138. package/dist/cli-bundle/focused-chunks/{chunk-UIS5FVHH.js → chunk-QYN77MQP.js} +49 -49
  139. package/dist/cli-bundle/focused-chunks/{chunk-5BLRMUMK.js → chunk-TSI73EEM.js} +3 -3
  140. package/dist/cli-bundle/focused-chunks/{chunk-PC6ZZVNP.js → chunk-UAU4DJSR.js} +3 -3
  141. package/dist/cli-bundle/focused-chunks/{chunk-RQL5WLNZ.js → chunk-URH727T5.js} +2 -2
  142. package/dist/cli-bundle/focused-chunks/{chunk-U2SB2BMM.js → chunk-UT7VS4X2.js} +2 -2
  143. package/dist/cli-bundle/focused-chunks/{chunk-HYPK5OPA.js → chunk-V2NARGRH.js} +2 -2
  144. package/dist/cli-bundle/focused-chunks/{chunk-DRNXMOSV.js → chunk-XR5EBU3B.js} +2 -2
  145. package/dist/cli-bundle/main.js +18 -18
  146. package/dist/cli-bundle/sdk-authoring.js +1 -1
  147. package/dist/cli-bundle/sdk-contracts.js +1 -1
  148. package/dist/cli-bundle/sdk-core.js +3 -3
  149. package/dist/cli-bundle/sdk-governance.js +1 -1
  150. package/dist/cli-bundle/sdk-graph.js +1 -1
  151. package/dist/cli-bundle/sdk-merge.js +38 -38
  152. package/dist/cli-bundle/sdk-query.js +1 -1
  153. package/dist/cli-bundle/sdk-runtime.js +1 -1
  154. package/dist/cli-bundle/sdk-testing.js +1 -1
  155. package/dist/cli-bundle/sdk.js +1 -1
  156. package/dist/core/config/positional-value.d.ts +0 -2
  157. package/dist/core/config/positional-value.js +1 -1
  158. package/dist/core/history/history-diff.js +1 -1
  159. package/dist/core/schema/type-workflows.d.ts +1 -1
  160. package/dist/core/schema/type-workflows.js +1 -1
  161. package/dist/core/search/eval.d.ts +1 -1
  162. package/dist/core/search/eval.js +1 -1
  163. package/dist/core/shared/item-metadata-contract.d.ts +0 -4
  164. package/dist/core/shared/item-metadata-contract.js +1 -1
  165. package/dist/sdk/extension/shared.d.ts +2 -2
  166. package/dist/sdk/extension/shared.js +1 -1
  167. package/dist/sdk/governance/upgrade.d.ts +2 -0
  168. package/dist/sdk/governance/upgrade.js +2 -2
  169. package/dist/sdk/public-surface.json +1 -1
  170. package/dist/sdk/query/search-contracts.d.ts +0 -1
  171. package/dist/sdk/query/search-contracts.js +1 -1
  172. package/dist/sdk/schema.d.ts +8 -4
  173. package/dist/sdk/schema.js +1 -1
  174. package/docs/ARCHITECTURE.md +31 -4
  175. package/docs/BUILD_AND_RELEASE_ACCEPTANCE.md +50 -1
  176. package/docs/COMMANDS.md +1 -1
  177. package/docs/EXTENSIONS.md +1 -1
  178. package/docs/READ_OUTPUT_CONTRACTS.md +1 -1
  179. package/docs/RELEASING.md +7 -1
  180. package/docs/SDK_CONTEXT_INTEGRITY_PRIMITIVES.md +1 -1
  181. package/marketplace.json +2 -2
  182. package/package.json +6 -4
  183. package/packages/pm-beads/package.json +1 -1
  184. package/packages/pm-calendar/package.json +1 -1
  185. package/packages/pm-command-kit/package.json +1 -1
  186. package/packages/pm-digital-twin/package.json +1 -1
  187. package/packages/pm-governance-audit/package.json +1 -1
  188. package/packages/pm-guide-shell/package.json +1 -1
  189. package/packages/pm-kanban/package.json +1 -1
  190. package/packages/pm-lifecycle-hooks/package.json +1 -1
  191. package/packages/pm-linked-test-adapters/package.json +1 -1
  192. package/packages/pm-search-advanced/package.json +1 -1
  193. package/packages/pm-templates/package.json +1 -1
  194. package/packages/pm-todos/package.json +1 -1
  195. package/packages/pm-vcs/package.json +1 -1
  196. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  197. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  198. package/scripts/build-lease.mjs +27 -0
  199. package/dist/cli/commands/activity.d.ts +0 -6
  200. package/dist/cli/commands/aggregate.d.ts +0 -2
  201. package/dist/cli/commands/append.d.ts +0 -2
  202. package/dist/cli/commands/claim.d.ts +0 -2
  203. package/dist/cli/commands/close-many.d.ts +0 -2
  204. package/dist/cli/commands/close.d.ts +0 -6
  205. package/dist/cli/commands/close.js +0 -2
  206. package/dist/cli/commands/comments.d.ts +0 -2
  207. package/dist/cli/commands/context.d.ts +0 -6
  208. package/dist/cli/commands/context.js +0 -2
  209. package/dist/cli/commands/contracts.d.ts +0 -2
  210. package/dist/cli/commands/copy.d.ts +0 -6
  211. package/dist/cli/commands/create.d.ts +0 -6
  212. package/dist/cli/commands/delete.d.ts +0 -6
  213. package/dist/cli/commands/duplicates.d.ts +0 -6
  214. package/dist/cli/commands/extension.d.ts +0 -6
  215. package/dist/cli/commands/focus.d.ts +0 -6
  216. package/dist/cli/commands/get.d.ts +0 -6
  217. package/dist/cli/commands/health.d.ts +0 -6
  218. package/dist/cli/commands/health.js +0 -2
  219. package/dist/cli/commands/history-compact.d.ts +0 -7
  220. package/dist/cli/commands/history-redact.js +0 -2
  221. package/dist/cli/commands/history.d.ts +0 -2
  222. package/dist/cli/commands/index.d.ts +0 -55
  223. package/dist/cli/commands/index.js +0 -2
  224. package/dist/cli/commands/init-agent-guidance.d.ts +0 -6
  225. package/dist/cli/commands/init-agent-guidance.js +0 -2
  226. package/dist/cli/commands/init.js +0 -2
  227. package/dist/cli/commands/learnings.d.ts +0 -2
  228. package/dist/cli/commands/lifecycle-transitions.d.ts +0 -2
  229. package/dist/cli/commands/lifecycle-transitions.js +0 -2
  230. package/dist/cli/commands/merge.d.ts +0 -8
  231. package/dist/cli/commands/merge.js +0 -2
  232. package/dist/cli/commands/notes.d.ts +0 -2
  233. package/dist/cli/commands/plan.d.ts +0 -6
  234. package/dist/cli/commands/restore.d.ts +0 -6
  235. package/dist/cli/commands/restore.js +0 -2
  236. package/dist/cli/commands/scheduling-shortcuts.d.ts +0 -6
  237. package/dist/cli/commands/scheduling-shortcuts.js +0 -2
  238. package/dist/cli/commands/schema.d.ts +0 -7
  239. package/dist/cli/commands/schema.js +0 -2
  240. package/dist/cli/commands/search.d.ts +0 -6
  241. package/dist/cli/commands/stats.d.ts +0 -6
  242. package/dist/cli/commands/telemetry.d.ts +0 -6
  243. package/dist/cli/commands/update-many.d.ts +0 -2
  244. package/dist/cli/commands/update.d.ts +0 -6
  245. package/dist/cli/commands/upgrade.d.ts +0 -2
  246. package/dist/cli/commands/upgrade.js +0 -2
  247. package/dist/cli/commands/validate.d.ts +0 -9
  248. package/dist/cli/commands/validate.js +0 -2
  249. package/dist/cli-bundle/chunks/chunk-T3AMFUCN.js +0 -2
  250. package/dist/cli-bundle/chunks/register-mutation-DXES37MA.js +0 -20
@@ -1,3 +1,3 @@
1
- import{a as k,c as I,d as A,e as _,k as T,m as C}from"./chunk-7YUYLYJQ.js";import{Db as v,Eb as b,Fb as R}from"./chunk-GRHSNUQO.js";import{Cj as H,Ec as E,Ef as D,Fo as f,Hf as m,If as y,Io as g,Jo as a,ap as w,la as d,ll as x,na as p}from"./chunk-JBJUOOJI.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="42878185-8f30-5d0e-bddc-de26b64e3615")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="c713a4ec-b6a5-5a77-8c53-610dde8a386d")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="72fad412-7931-5198-a862-d7df2c431945")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="c44b53b6-4c4d-5830-a4b5-347f509e427f")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="1eaec30c-3460-57c1-ae4c-475a44278426")}catch{}})();function B(t,e){if(typeof t!="string")return;let o=Number.parseInt(t,10);if(!/^\d+$/.test(t.trim())||!Number.isSafeInteger(o))throw new p(`history-compact ${e} must be a non-negative integer.`,d.USAGE);return o}async function O(t,e,o){let r=f(o),n=Date.now(),i=await H(a(e,"ids")),l=i===void 0?void 0:x(i),c=B(e.allOver,"--all-over"),u=B(e.minEntries,"--min-entries");if(e.closed===!0&&e.allStreams===!0)throw new p("history-compact: --closed and --all-streams are mutually exclusive; pick one lifecycle scope.",d.USAGE);let s=e.closed===!0?"closed":e.allStreams===!0?"all-streams":void 0;if((l!==void 0||c!==void 0||s!==void 0)&&typeof e.before=="string")throw new p("history-compact: --before applies only in single-id mode (bulk mode always compacts full streams).",d.USAGE);if(I(t,{ids:l,allOver:c,scope:s}),t!==void 0&&u!==void 0)throw new p("history-compact: --min-entries applies only in bulk mode (single-id mode compacts the named stream).",d.USAGE);if(t===void 0){let h=await A({ids:l,scope:s,allOver:c,minEntries:u,dryRun:e.dryRun===!0,author:a(e,"author"),message:a(e,"message"),force:!!e.force},r);m(h,r),h.totals.items_errored>0&&(process.exitCode=d.GENERIC_FAILURE)}else{let h=await k(t,{before:a(e,"before"),dryRun:e.dryRun===!0,author:a(e,"author"),message:a(e,"message"),force:!!e.force},r);m(h,r)}r.profile&&y(`profile:command=history-compact took_ms=${Date.now()-n}`)}async function S(t,e,o,r){let n=f(r),i=Date.now(),l=await C(t,e,{author:a(o,"author"),message:a(o,"message"),force:!!o.force},n);await w(n,l),m(l,n),n.profile&&y(`profile:command=restore took_ms=${Date.now()-i}`)}async function N(t,e){let o=f(e),r=await T({verify:a(t,"verify"),output:a(t,"output"),hashAlgorithm:a(t,"hashAlgorithm")},o);"format"in r?(E(r),o.quiet||D(`${JSON.stringify(r,null,2)}
2
- `)):m(r,o),"ok"in r&&!r.ok&&(process.exitCode=d.GENERIC_FAILURE)}function te(t,e){t.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(N),t.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(S),t.command(e?"redact":"history-redact",{hidden:!e}).summary("Redact sensitive values.").argument("<id>","Item id").option("--literal <value>","Literal string to redact (repeatable)",g).option("--regex <value>","Regex pattern to redact (repeatable; accepts /pattern/flags or raw pattern)",g).option("--replacement <value>",'Replacement string (default: "[redacted]")').option("--dry-run","Preview redaction impact without writing item/history files").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the redaction marker entry").option("--force","Force ownership/lock override").description("Redact sensitive literals/patterns from an item history stream and recompute hashes.").action(async(o,r,n)=>{let i=f(n),l=Date.now(),c=Array.isArray(r.literal)?r.literal:void 0,u=Array.isArray(r.regex)?r.regex:void 0,s=await _(o,{literal:c,regex:u,replacement:a(r,"replacement"),dryRun:r.dryRun===!0,author:a(r,"author"),message:a(r,"message"),force:!!r.force},i);s.changed&&!s.dry_run&&await w(i,s),m(s,i),i.profile&&y(`profile:command=history-redact took_ms=${Date.now()-l}`)}),t.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("--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,r,n)=>{let i=f(n),l=Date.now(),c=r.all===!0;b(o,c);let u={dryRun:r.dryRun===!0,author:a(r,"author"),message:a(r,"message"),force:!!r.force,normalizeProvenance:r.normalizeProvenance===!0,salvageTail:r.salvageTail===!0};if(c){let s=await R(u,i);m(s,i),s.totals.failed>0&&(process.exitCode=d.GENERIC_FAILURE)}else{let s=await v(o,u,i);m(s,i)}i.profile&&y(`profile:command=history-repair took_ms=${Date.now()-l}`)}),t.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(O)}export{te as a};
3
- //# sourceMappingURL=chunk-FBWAECBI.js.map
1
+ import{a as k,c as I,d as A,e as _,k as T,m as C}from"./chunk-UDNYAMCM.js";import{Db as b,Eb as v,Fb as R}from"./chunk-3OFFMS2N.js";import{$o as w,Cj as x,Ec as E,Ef as D,Eo as f,Hf as m,Ho as g,If as y,Io as a,kl as H,la as c,na as p}from"./chunk-CM57QHVK.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="631e56aa-4d7e-58b6-bbea-a0d320716b82")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="0bcdd63c-5fd3-585d-a6c5-9393029ef864")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="4dce4f19-071c-54a8-be0d-5975d9e3b34b")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f330a0c5-a967-5383-9c27-efa4a39e0f0d")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="420952ed-9a04-55dd-bcb8-804d81582002")}catch{}})();function B(t,e){if(typeof t!="string")return;let o=Number.parseInt(t,10);if(!/^\d+$/.test(t.trim())||!Number.isSafeInteger(o))throw new p(`history-compact ${e} must be a non-negative integer.`,c.USAGE);return o}async function O(t,e,o){let r=f(o),n=Date.now(),i=await x(a(e,"ids")),l=i===void 0?void 0:H(i),d=B(e.allOver,"--all-over"),u=B(e.minEntries,"--min-entries");if(e.closed===!0&&e.allStreams===!0)throw new p("history-compact: --closed and --all-streams are mutually exclusive; pick one lifecycle scope.",c.USAGE);let s=e.closed===!0?"closed":e.allStreams===!0?"all-streams":void 0;if((l!==void 0||d!==void 0||s!==void 0)&&typeof e.before=="string")throw new p("history-compact: --before applies only in single-id mode (bulk mode always compacts full streams).",c.USAGE);if(I(t,{ids:l,allOver:d,scope:s}),t!==void 0&&u!==void 0)throw new p("history-compact: --min-entries applies only in bulk mode (single-id mode compacts the named stream).",c.USAGE);if(t===void 0){let h=await A({ids:l,scope:s,allOver:d,minEntries:u,dryRun:e.dryRun===!0,author:a(e,"author"),message:a(e,"message"),force:!!e.force},r);m(h,r),h.totals.items_errored>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let h=await k(t,{before:a(e,"before"),dryRun:e.dryRun===!0,author:a(e,"author"),message:a(e,"message"),force:!!e.force},r);m(h,r)}r.profile&&y(`profile:command=history-compact took_ms=${Date.now()-n}`)}async function S(t,e,o,r){let n=f(r),i=Date.now(),l=await C(t,e,{author:a(o,"author"),message:a(o,"message"),force:!!o.force},n);await w(n,l),m(l,n),n.profile&&y(`profile:command=restore took_ms=${Date.now()-i}`)}async function N(t,e){let o=f(e),r=await T({verify:a(t,"verify"),output:a(t,"output"),hashAlgorithm:a(t,"hashAlgorithm")},o);"format"in r?(E(r),o.quiet||D(`${JSON.stringify(r,null,2)}
2
+ `)):m(r,o),"ok"in r&&!r.ok&&(process.exitCode=c.GENERIC_FAILURE)}function ee(t,e){t.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(N),t.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(S),t.command(e?"redact":"history-redact",{hidden:!e}).summary("Redact sensitive values.").argument("<id>","Item id").option("--literal <value>","Literal string to redact (repeatable)",g).option("--regex <value>","Regex pattern to redact (repeatable; accepts /pattern/flags or raw pattern)",g).option("--replacement <value>",'Replacement string (default: "[redacted]")').option("--dry-run","Preview redaction impact without writing item/history files").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the redaction marker entry").option("--force","Force ownership/lock override").description("Redact sensitive literals/patterns from an item history stream and recompute hashes.").action(async(o,r,n)=>{let i=f(n),l=Date.now(),d=Array.isArray(r.literal)?r.literal:void 0,u=Array.isArray(r.regex)?r.regex:void 0,s=await _(o,{literal:d,regex:u,replacement:a(r,"replacement"),dryRun:r.dryRun===!0,author:a(r,"author"),message:a(r,"message"),force:!!r.force},i);s.changed&&!s.dry_run&&await w(i,s),m(s,i),i.profile&&y(`profile:command=history-redact took_ms=${Date.now()-l}`)}),t.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("--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,r,n)=>{let i=f(n),l=Date.now(),d=r.all===!0;v(o,d);let u={dryRun:r.dryRun===!0,author:a(r,"author"),message:a(r,"message"),force:!!r.force,normalizeProvenance:r.normalizeProvenance===!0,salvageTail:r.salvageTail===!0};if(d){let s=await R(u,i);m(s,i),s.totals.failed>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let s=await b(o,u,i);m(s,i)}i.profile&&y(`profile:command=history-repair took_ms=${Date.now()-l}`)}),t.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(O)}export{ee as a};
3
+ //# sourceMappingURL=chunk-ML42DLI3.js.map
@@ -1,4 +1,4 @@
1
- import{a as tt,b as In,c as oc,d as rc,g as ic,i as Cc}from"./chunk-HAFSMFJK.js";import{L as Ho,R as Hc,a as Rc,c as xc,d as Oc,e as $c,k as Fc,l as Dt,m as je,n as qo,u as zo,w as zc}from"./chunk-7YUYLYJQ.js";import{$c as Go,Aa as Za,Ba as wn,Ca as Qa,Da as vn,Ea as kn,Fa as ec,Fb as kc,Fd as Bo,Ha as Qe,Hd as Qc,Ia as tc,Ib as Sc,J as Pe,Ja as Ro,Jb as Ic,Ka as Sn,Lc as Po,Ma as et,Ob as Lt,Oc as Se,Od as el,Pc,Pd as tl,Qc as No,Rc as Lc,Sc as Nc,Tc as nt,Uc as Dc,Va as nc,Xc as Gc,Yc as Uc,Zc as qc,_c as jo,ad as Uo,b as Ao,dd as Vc,ec as Tn,ed as Wc,fd as Kc,ga as un,gd as Yc,ha as Ft,hd as Jc,i as ga,ia as _,j as ya,ja as Va,jd as Xc,ka as Wa,kd as Zc,l as ba,lb as ac,lc as Ec,ma as J,mb as cc,na as Ka,nc as Tc,oa as yn,pa as Ya,qa as Eo,ra as Pt,rb as xo,sa as bn,sb as Oo,ta as De,tb as $o,ua as Ja,uc as Nt,va as To,vb as lc,wa as j,wb as dc,xa as Co,xb as Fo,ya as G,za as Xa}from"./chunk-K7RWRJLT.js";import{$ as Fa,C as va,E as Le,Ea as Ze,F as ka,G as _n,H as Sa,I as Ne,J as Ia,K as hn,L as Aa,La as za,Qa as gn,R as Ea,U as Ta,Ua as Ha,W as Ca,X as Ra,Xa as Ba,Y as xa,Z as Oa,_ as $a,aa as Pa,b as ns,ba as La,ca as Na,da as Da,ea as Ma,fa as ja,ga as Ga,h as fn,ha as Ua,ia as qa,w as wa}from"./chunk-2QLXN6HZ.js";import{$a as mc,Db as ke,Eb as Ac,Fb as En,Jb as Lo,Uc as Do,Xb as Mc,Yb as jc,Zc as Mo,ad as Bc,d as es,f as ts,ib as pc,jb as uc,kb as fc,na as de,nb as _c,ob as hc,pb as gc,qb as yc,sb as Me,tb as bc,ua as sc,ub as wc,xb as An,zb as vc}from"./chunk-GRHSNUQO.js";import{$d as Ci,$i as an,$n as E,A as ae,Ab as ui,Ac as uo,Aj as us,Ak as Rs,B as oe,Bb as fi,Bc as $,Bj as fs,Bk as xs,Bn as Zs,C as vt,Cb as _i,Cf as Di,Ck as $t,Db as hi,Dk as Os,Dm as js,Eb as gi,Ek as dn,Fh as Tt,Fk as $s,Fn as Qs,Ga as to,Gc as vi,Gh as Ct,Gk as vo,Gn as ea,Ha as no,Hc as ki,Hd as en,Hk as ko,Hn as ta,Ia as oo,Ii as Ji,Ik as Fs,Im as Gs,In as na,J as oi,Ja as ro,Jm as Us,Jn as oa,Kc as H,Kf as Mi,Ki as Xi,L as ri,Lf as F,Li as Zi,Lj as _s,Lm as qs,Ln as ra,M as be,Mg as Hi,Mi as ce,Mn as ia,Ng as Bi,Ni as we,Nn as sa,Oc as Si,Og as Vi,Om as zs,On as aa,Pc as Ii,Pj as hs,Pn as ca,Qe as Oi,Qi as Rt,Qn as la,Rb as It,S as Qn,Sa as P,Sb as yi,T as ii,Ta as Yt,Tc as B,Te as $i,Tf as Ke,Ti as nn,Tj as gs,Tn as da,Uc as Qt,Uf as xe,Un as pn,Vf as ji,Vn as ma,Wf as Gi,Wi as xt,Wj as le,Wn as pa,X as si,Xf as Oe,Xi as Qi,Y as ai,Yf as Ui,Yi as on,Z as ci,Zi as rn,Zj as ys,_ as li,_a as A,_f as V,_i as sn,_j as bs,_n as ve,ae as Ri,af as S,ag as At,ak as ln,ba as di,bb as St,bg as qi,bj as re,bo as ua,cb as io,ch as _o,ck as ws,cn as Hs,de as xi,dh as R,di as Je,dj as os,eb as Re,ef as Fi,eg as zi,ej as rs,f as Y,fn as Bs,gf as Pi,gm as Ps,gn as Vs,h as Xn,hf as te,hi as Wi,hj as Ot,ic as Jt,ij as is,ik as vs,j as ni,jc as Xt,jj as ss,jk as ks,kc as Zt,ki as C,kj as as,la as p,lg as $e,li as Ki,lj as cs,ll as So,lo as fa,mc as bi,mo as _a,na as m,nf as Li,ng as Ye,nk as bo,nl as Io,oa as kt,od as Ai,oi as ho,on as Ws,p as Kt,pi as go,pk as wo,pm as Ls,qa as eo,qj as yo,qn as Ks,rd as Ei,rg as tn,rj as ls,rm as Ns,sc as wi,sg as Et,sj as Fe,sm as mn,tg as fo,tk as Ss,tm as Ds,u as Be,uc as so,ud as Ti,uj as ds,uk as Is,vc as ao,vf as Ni,vi as Yi,vj as ms,vk as As,wc as co,wk as Es,wn as Ys,wo as ha,x as ye,xc as lo,xj as cn,xk as Ts,xn as Js,y as Ve,yb as mi,yc as mo,yf as We,yi as Xe,yn as Xs,z as Zn,zb as pi,zc as po,zj as ps,zk as Cs,zm as Ms}from"./chunk-JBJUOOJI.js";import{AsyncLocalStorage as Eg}from"node:async_hooks";import{readFile as np}from"node:fs/promises";import op from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c64f304d-9081-5bad-8187-7bf6b65e4a07")}catch{}})();var Vo="context-intents.json";function Cn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rp(e,t,n){if(!Cn(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let o=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(o)||!o.every(r=>typeof r=="string")||typeof e.token_budget!="number")throw new TypeError(`${t} context intent at index ${String(n)} has an invalid contract shape`);return{command:e.command,intent:e.intent,description:e.description,included_field_groups:o,token_budget:e.token_budget}}function nl(e,t){let n=Array.isArray(e)?e:Cn(e)&&Array.isArray(e.intents)?e.intents:void 0;if(!n)throw new TypeError(`${t} context intents must be an array or an object with an intents array`);return n.map((o,r)=>rp(o,t,r))}async function ip(e){let t=op.join(e,Vo),n;try{n=await np(t,"utf8")}catch(r){if(Ve(r))return[];throw await Mi(e),r}let o;try{o=JSON.parse(n)}catch(r){let i=r instanceof Error?r.message:String(r);throw new TypeError(`Invalid ${Vo}: ${i}`,{cause:r})}return nl(o,Vo)}function sp(e){if(!Cn(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return Cn(n)?n.contextIntents??n.context_intents:void 0}function ap(e){return e.flatMap(t=>{let n=sp(t.module);return n===void 0?[]:nl(n,`package ${t.name}`)})}async function cp(e){let t=await ip(e.pmRoot),n=ap(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function Wo(e,t){let n=await cp(e);return await Ni(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c2766f4e-6354-55bb-9e40-676273ee901f")}catch{}})();async function ol(e,t,n=Li){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let o=t,r=Array.isArray(o.warnings)?o.warnings.filter(i=>typeof i=="string"):[];o.warnings=[...new Set([...r,"context_usage_feedback_write_failed"])].sort()}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var rl="PmCliError";function lp(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=p.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function dp(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new m(e,lp(t.exitCode??p.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function Ko(e){if(!(e instanceof Error)||e.name!==rl)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}import{constants as Mt}from"node:fs";import{lstat as il,mkdir as Jo,open as sl}from"node:fs/promises";import me from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e57a9bca-1190-5ffd-bb7d-d76a22fc9e57")}catch{}})();function Yo(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Xo(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function mp(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function pp(e,t,n,o){let r=n.require(e.kind),i=o.outgoingOne.get(`${r.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let s=o.incomingOne.get(`${r.kind}\0${e.target}`);if(s!==void 0&&s!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let a=Xo(e,n),c=o.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function up(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function fp(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=Yo(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:Yo(e.relationshipId,"relationshipId"),author:Yo(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function _p(e,t,n,o,r,i){let s=n.has(t);if(e.action==="add"&&s)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(a)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let l=new Be([a,c],[e.edge],r).edges()[0];return pp(l,t,r,i),mp(l)}var jt=class{#t;#n;#o=[];#i=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??Kt()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,r=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=n-1;i<o;i+=r)yield Object.freeze(this.#o.slice(i,Math.min(i+r,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let r=t,i=0,s;for(let a of this.stream({...o,batchSize:256}))for(let c of a)r=n(r,c),i+=1,s=c;return Object.freeze({state:r,version:s?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:i,...s===void 0?{}:{asOf:s.timestamp}})}#s(t,n){let o=this.#n.require(n.kind);this.#r.identities.set(Xo(n,this.#n),t),o.outgoing==="one"&&this.#r.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#r.incomingOne.set(`${o.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#r.identities.delete(Xo(t,this.#n)),n.outgoing==="one"&&this.#r.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#r.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=fp(t,this.version,this.#i),o=this.#e.get(n.relationshipId),r=_p(t,n.relationshipId,this.#e,this.#t,this.#n,this.#r),i=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...r===void 0?{}:{edge:r},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(i),this.#i.add(n.eventId),o&&this.#a(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,r),this.#s(n.relationshipId,r)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(s=>Date.parse(s.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);n=this.#o.slice(0,i)}let o=up(n),r=new Be(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Ai("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(Ei(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=Ti(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:i=>i.eventId,snapshot:String(o)});return{version:o,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},hp="relationship-event-store",al=Mt.O_NOFOLLOW;function Rn(e){return te(e,hp,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function Ge(e,t="relationships/events.jsonl"){let n=me.resolve(e),o=me.resolve(n,t),r=me.relative(n,o);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${me.sep}`)||me.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await Jo(n,{recursive:!0}),(await il(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let s=n;for(let a of r.split(me.sep)){s=me.join(s,a);try{if((await il(s)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(Zn(c))break;throw c}}return o}async function xn(e,t,n){let o=new jt(t,{registry:n}),r,i;try{i=await sl(e,Mt.O_RDONLY|al),r=await i.readFile("utf8")}catch(a){if(Zn(a))return{log:o,raw:""};throw a}finally{await i?.close()}let s=r.split(`
1
+ import{a as tt,b as In,c as oc,d as rc,g as ic,i as Cc}from"./chunk-JSW33Q6R.js";import{L as Ho,R as Hc,a as Rc,c as xc,d as Oc,e as $c,k as Fc,l as Dt,m as je,n as qo,u as zo,w as zc}from"./chunk-UDNYAMCM.js";import{$c as Go,Aa as Za,Ba as wn,Ca as Qa,Da as vn,Ea as kn,Fa as ec,Fb as kc,Fd as Bo,Ha as Qe,Hd as Qc,Ia as tc,Ib as Sc,J as Pe,Ja as Ro,Jb as Ic,Ka as Sn,Lc as Po,Ma as et,Ob as Lt,Oc as Se,Od as el,Pc,Pd as tl,Qc as No,Rc as Lc,Sc as Nc,Tc as nt,Uc as Dc,Va as nc,Xc as Gc,Yc as Uc,Zc as qc,_c as jo,ad as Uo,b as Ao,dd as Vc,ec as Tn,ed as Wc,fd as Kc,ga as un,gd as Yc,ha as Ft,hd as Jc,i as ga,ia as _,j as ya,ja as Va,jd as Xc,ka as Wa,kd as Zc,l as ba,lb as ac,lc as Ec,ma as J,mb as cc,na as Ka,nc as Tc,oa as yn,pa as Ya,qa as Eo,ra as Pt,rb as xo,sa as bn,sb as Oo,ta as De,tb as $o,ua as Ja,uc as Nt,va as To,vb as lc,wa as j,wb as dc,xa as Co,xb as Fo,ya as G,za as Xa}from"./chunk-ZSPZJOMK.js";import{$ as Fa,C as va,E as Le,Ea as Ze,F as ka,G as _n,H as Sa,I as Ne,J as Ia,K as hn,L as Aa,La as za,Qa as gn,R as Ea,U as Ta,Ua as Ha,W as Ca,X as Ra,Xa as Ba,Y as xa,Z as Oa,_ as $a,aa as Pa,b as ns,ba as La,ca as Na,da as Da,ea as Ma,fa as ja,ga as Ga,h as fn,ha as Ua,ia as qa,w as wa}from"./chunk-AVWHZUNC.js";import{$a as mc,Db as ke,Eb as Ac,Fb as En,Jb as Lo,Uc as Do,Xb as Mc,Yb as jc,Zc as Mo,ad as Bc,d as es,f as ts,ib as pc,jb as uc,kb as fc,na as de,nb as _c,ob as hc,pb as gc,qb as yc,sb as Me,tb as bc,ua as sc,ub as wc,xb as An,zb as vc}from"./chunk-3OFFMS2N.js";import{$d as Ci,$i as an,A as ae,Ab as ui,Ac as uo,Aj as us,Ak as xs,An as Zs,B as oe,Bb as fi,Bc as $,Bj as fs,Bk as $t,C as vt,Cb as _i,Cf as Di,Ck as Os,Cm as js,Db as hi,Dk as dn,Eb as gi,Ek as $s,En as Qs,Fh as Tt,Fk as vo,Fn as ea,Ga as to,Gc as vi,Gh as Ct,Gk as ko,Gn as ta,Ha as no,Hc as ki,Hd as en,Hk as Fs,Hm as Gs,Hn as na,Ia as oo,Ii as Ji,Im as Us,In as oa,J as oi,Ja as ro,Kc as H,Kf as Mi,Ki as Xi,Km as qs,Kn as ra,L as ri,Lf as F,Li as Zi,Lj as _s,Ln as ia,M as be,Mg as Hi,Mi as ce,Mn as sa,Ng as Bi,Ni as we,Nm as zs,Nn as aa,Oc as Si,Og as Vi,On as ca,Pc as Ii,Pj as hs,Pn as la,Qe as Oi,Qi as Rt,Rb as It,S as Qn,Sa as P,Sb as yi,Sn as da,T as ii,Ta as Yt,Tc as B,Te as $i,Tf as Ke,Ti as nn,Tj as gs,Tn as pn,Uc as Qt,Uf as xe,Un as ma,Vf as ji,Vn as pa,Wf as Gi,Wi as xt,Wj as le,X as si,Xf as Oe,Xi as Qi,Y as ai,Yf as Ui,Yi as on,Z as ci,Zi as rn,Zj as ys,Zn as ve,_ as li,_a as A,_f as V,_i as sn,_j as bs,_n as E,ae as Ri,af as S,ag as At,ak as ln,ao as ua,ba as di,bb as St,bg as qi,bj as re,bk as ws,bn as Hs,cb as io,ch as _o,de as xi,dh as R,di as Je,dj as os,eb as Re,ef as Fi,eg as zi,ej as rs,en as Bs,f as Y,fm as Ps,fn as Vs,gf as Pi,h as Xn,hf as te,hi as Wi,hj as Ot,hk as vs,ic as Jt,ij as is,ik as ks,j as ni,jc as Xt,jj as ss,kc as Zt,ki as C,kj as as,kl as So,ko as fa,la as p,lg as $e,li as Ki,lj as cs,lo as _a,mc as bi,mk as bo,ml as Io,na as m,nf as Li,ng as Ye,nn as Ws,oa as kt,od as Ai,oi as ho,ok as wo,om as Ls,p as Kt,pi as go,pn as Ks,qa as eo,qj as yo,qm as Ns,rd as Ei,rg as tn,rj as ls,rm as mn,sc as wi,sg as Et,sj as Fe,sk as Ss,sm as Ds,tg as fo,tk as Is,u as Be,uc as so,ud as Ti,uj as ds,uk as As,vc as ao,vf as Ni,vi as Yi,vj as ms,vk as Es,vn as Ys,vo as ha,wc as co,wk as Ts,wn as Js,x as ye,xc as lo,xj as cn,xn as Xs,y as Ve,yb as mi,yc as mo,yf as We,yi as Xe,yk as Cs,ym as Ms,z as Zn,zb as pi,zc as po,zj as ps,zk as Rs}from"./chunk-CM57QHVK.js";import{AsyncLocalStorage as Eg}from"node:async_hooks";import{readFile as np}from"node:fs/promises";import op from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c64f304d-9081-5bad-8187-7bf6b65e4a07")}catch{}})();var Vo="context-intents.json";function Cn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rp(e,t,n){if(!Cn(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let o=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(o)||!o.every(r=>typeof r=="string")||typeof e.token_budget!="number")throw new TypeError(`${t} context intent at index ${String(n)} has an invalid contract shape`);return{command:e.command,intent:e.intent,description:e.description,included_field_groups:o,token_budget:e.token_budget}}function nl(e,t){let n=Array.isArray(e)?e:Cn(e)&&Array.isArray(e.intents)?e.intents:void 0;if(!n)throw new TypeError(`${t} context intents must be an array or an object with an intents array`);return n.map((o,r)=>rp(o,t,r))}async function ip(e){let t=op.join(e,Vo),n;try{n=await np(t,"utf8")}catch(r){if(Ve(r))return[];throw await Mi(e),r}let o;try{o=JSON.parse(n)}catch(r){let i=r instanceof Error?r.message:String(r);throw new TypeError(`Invalid ${Vo}: ${i}`,{cause:r})}return nl(o,Vo)}function sp(e){if(!Cn(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return Cn(n)?n.contextIntents??n.context_intents:void 0}function ap(e){return e.flatMap(t=>{let n=sp(t.module);return n===void 0?[]:nl(n,`package ${t.name}`)})}async function cp(e){let t=await ip(e.pmRoot),n=ap(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function Wo(e,t){let n=await cp(e);return await Ni(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c2766f4e-6354-55bb-9e40-676273ee901f")}catch{}})();async function ol(e,t,n=Li){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let o=t,r=Array.isArray(o.warnings)?o.warnings.filter(i=>typeof i=="string"):[];o.warnings=[...new Set([...r,"context_usage_feedback_write_failed"])].sort()}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var rl="PmCliError";function lp(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=p.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function dp(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new m(e,lp(t.exitCode??p.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function Ko(e){if(!(e instanceof Error)||e.name!==rl)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}import{constants as Mt}from"node:fs";import{lstat as il,mkdir as Jo,open as sl}from"node:fs/promises";import me from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e57a9bca-1190-5ffd-bb7d-d76a22fc9e57")}catch{}})();function Yo(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Xo(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function mp(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function pp(e,t,n,o){let r=n.require(e.kind),i=o.outgoingOne.get(`${r.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let s=o.incomingOne.get(`${r.kind}\0${e.target}`);if(s!==void 0&&s!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let a=Xo(e,n),c=o.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function up(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function fp(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=Yo(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:Yo(e.relationshipId,"relationshipId"),author:Yo(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function _p(e,t,n,o,r,i){let s=n.has(t);if(e.action==="add"&&s)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(a)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let l=new Be([a,c],[e.edge],r).edges()[0];return pp(l,t,r,i),mp(l)}var jt=class{#t;#n;#o=[];#i=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??Kt()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,r=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=n-1;i<o;i+=r)yield Object.freeze(this.#o.slice(i,Math.min(i+r,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let r=t,i=0,s;for(let a of this.stream({...o,batchSize:256}))for(let c of a)r=n(r,c),i+=1,s=c;return Object.freeze({state:r,version:s?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:i,...s===void 0?{}:{asOf:s.timestamp}})}#s(t,n){let o=this.#n.require(n.kind);this.#r.identities.set(Xo(n,this.#n),t),o.outgoing==="one"&&this.#r.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#r.incomingOne.set(`${o.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#r.identities.delete(Xo(t,this.#n)),n.outgoing==="one"&&this.#r.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#r.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=fp(t,this.version,this.#i),o=this.#e.get(n.relationshipId),r=_p(t,n.relationshipId,this.#e,this.#t,this.#n,this.#r),i=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...r===void 0?{}:{edge:r},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(i),this.#i.add(n.eventId),o&&this.#a(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,r),this.#s(n.relationshipId,r)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(s=>Date.parse(s.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);n=this.#o.slice(0,i)}let o=up(n),r=new Be(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Ai("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(Ei(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=Ti(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:i=>i.eventId,snapshot:String(o)});return{version:o,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},hp="relationship-event-store",al=Mt.O_NOFOLLOW;function Rn(e){return te(e,hp,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function Ge(e,t="relationships/events.jsonl"){let n=me.resolve(e),o=me.resolve(n,t),r=me.relative(n,o);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${me.sep}`)||me.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await Jo(n,{recursive:!0}),(await il(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let s=n;for(let a of r.split(me.sep)){s=me.join(s,a);try{if((await il(s)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(Zn(c))break;throw c}}return o}async function xn(e,t,n){let o=new jt(t,{registry:n}),r,i;try{i=await sl(e,Mt.O_RDONLY|al),r=await i.readFile("utf8")}catch(a){if(Zn(a))return{log:o,raw:""};throw a}finally{await i?.close()}let s=r.split(`
2
2
  `);for(let a=0;a<s.length;a+=1){let c=s[a].trim();if(!c)continue;let l;try{l=JSON.parse(c)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${a+1}`)}if(l.sequence!==o.version+1)throw new TypeError(`Invalid relationship event sequence at line ${a+1}`);o.append({eventId:l.eventId,relationshipId:l.relationshipId,action:l.action,...l.edge===void 0?{}:{edge:l.edge},author:l.author,timestamp:l.timestamp,...l.reason===void 0?{}:{reason:l.reason},expectedVersion:o.version})}return{log:o,raw:r}}function gp(e,t,n,o){let r=Date.parse(t.timestamp),i;return t.action!=="remove"&&t.edge!==void 0&&(i=new Be(n,[t.edge],o).edges()[0]),e.eventId===t.eventId.trim()&&e.relationshipId===t.relationshipId.trim()&&e.action===t.action&&e.author===t.author.trim()&&Number.isFinite(r)&&e.timestamp===new Date(r).toISOString()&&e.reason===(t.reason?.trim()||void 0)&&It(e.edge)===It(i)}var On=class e{#t;#n;#o;#i;#e;constructor(t,n,o,r){this.#t=t.pmRoot,this.#n=n,this.#o=t.registry,this.#i=o,this.#e=r}static async open(t){let n=Object.freeze([...t.nodes]),o=await Ge(t.pmRoot,t.relativePath),r=await Rn(t.pmRoot);try{await Ge(t.pmRoot,o);let{log:i}=await xn(o,n,t.registry);return new e(t,n,o,i)}finally{await r()}}get path(){return this.#i}async currentVersion(){return this.#e=await this.#r(),this.#e.version}async append(t){let n=await Rn(this.#t);try{let o=await Ge(this.#t,this.#i),{log:r}=await xn(o,this.#n,this.#o),i=r.append(t);await Jo(me.dirname(o),{recursive:!0}),await Ge(this.#t,o);let s=await sl(o,Mt.O_APPEND|Mt.O_CREAT|Mt.O_WRONLY|al);try{await s.appendFile(`${JSON.stringify(i)}
3
3
  `,"utf8")}finally{await s.close()}return this.#e=r,i}finally{await n()}}async appendBatch(t,n={}){let o=await Rn(this.#t);try{let r=await Ge(this.#t,this.#i),{log:i,raw:s}=await xn(r,this.#n,this.#o),a=i.version,c=new Map(i.events().map(d=>[d.eventId,d])),l=[],u=[];for(let d of t){let f=d.eventId.trim(),g=c.get(f);if(g!==void 0){if(n.existingEventPolicy==="skip_identical"&&gp(g,d,this.#n,this.#o)){u.push(g.eventId);continue}if(n.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${f}`)}let w=i.append(d);c.set(w.eventId,w),l.push(w)}if(l.length>0){let d=s.length===0||s.endsWith(`
4
4
  `)?s:`${s}
@@ -2244,4 +2244,4 @@ compdef _pm pm`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"
2244
2244
  `);M(e.progressEnabled,"writing keyword artifacts"),await oe(t,`${JSON.stringify(e.manifest,null,2)}
2245
2245
  `),await oe(n,`${r}
2246
2246
  `);let i=[];if(e.mode!=="keyword")try{M(e.progressEnabled,"writing vectorization status ledger"),await Fs(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(s){i.push(`search_vectorization_status_ledger_write_failed:${s instanceof Error?s.message:String(s)}`)}return i}async function Ag(e,t){let n=rg(e.mode),o=og(e),r=e.full===!0;M(o,`start mode=${n}`);let i=A(process.cwd(),t.path);await F(i);let s=vs(await C(i)).settings,a=null;try{a=await te(i,ks,s.locks.ttl_seconds,R(void 0,"pm-reindex"),!1,s.governance.force_required_for_stale_lock,s.locks.wait_ms)}catch(c){throw c instanceof m&&c.exitCode===p.CONFLICT?new m("Another pm reindex run is already active for this project. Wait for it to finish before starting a new keyword, semantic, or hybrid reindex.",p.CONFLICT,{code:"reindex_already_running",type:"urn:pm-cli:error:reindex_already_running",why:"Semantic reindex can be expensive and duplicate runs compete for the same local embedding model and vector store.",nextSteps:["Check active pm reindex processes before starting another reindex.","Rerun with --progress when you need non-interactive visibility."]}):c}try{let c=ag(s),l=cg(s),u=fg({requestedMode:n,pmRoot:i,settings:s,extensionEmbedding:c,extensionVectorAdapter:l}),d=n;M(o,"loading item corpus");let f=await _g({pmRoot:i,settings:s}),g=f.warnings,{documentCandidates:w,metadataDocuments:k}=f;M(o,`loaded_items=${k.length}`);let y=S(),v=ug(d,y,k),h=Wt.join(i,Jr),I=Wt.join(i,Xr),x=d==="keyword"?await Qr(i,w,s.schema,g):k,N=[],z={},O=null,T=pg(d);if(d==="keyword"&&await hg({pmRoot:i,settings:s,forceFullSemantic:r,extensionEmbedding:c,reindexWarnings:g}),d!=="keyword"){let ne=await Sg({pmRoot:i,settings:s,requestedMode:n,activeEmbeddingProvider:u.activeEmbeddingProvider,activeVectorStore:u.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:l,documentCandidates:w,metadataDocuments:k,documentsForKeywordArtifacts:x,forceFullSemantic:r,reindexWarnings:g,semanticWarnings:N,semanticSummary:T,progressEnabled:o});x=ne.documentsForKeywordArtifacts,z=ne.vectorizationLedgerEntries,O=ne.vectorizationEmbeddingMetadata}let se=await Ig({pmRoot:i,mode:d,manifest:v,documentsForKeywordArtifacts:x,settings:s,vectorizationLedgerEntries:z,vectorizationEmbeddingMetadata:O,progressEnabled:o}),Ce=[...await H({path:h,scope:"project",op:"reindex:manifest"}),...await H({path:I,scope:"project",op:"reindex:embeddings"}),...await Si({mode:d,total_items:k.length})];return M(o,"done"),{ok:!0,mode:d,total_items:k.length,semantic:T,artifacts:{manifest:Jr,embeddings:Xr},warnings:[...g,...N,...se,...Ce],generated_at:y}}finally{await a?.()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="856f6aeb-4343-5cda-8b04-66d786e351d9")}catch{}})();var Zm=Symbol("pm.active-extension-host-context");function Q(e){return{fullChangedFields:!0,options:e}}var b=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[Zm]=!0,n}run(t,n={}){return xg({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return dl(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return Fn(await this.list(Qo(t)))}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},o={}){return this.runTyped("graph",{subcommand:t,...n,options:o})}append(t,n,o={}){return this.runTyped("append",{id:t,...Q(Ft(o,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,o,r,i={}){return this.runTyped("config",{scope:t,configAction:n,...o===void 0?{}:{key:o},...r===void 0?{}:{value:r},options:i})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}workflowPolicy(t,n,o={}){return this.runTyped("schema",{name:n,options:{...o,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,o,r){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-field",to:n,...r?{fieldTypeScope:r}:{}}})}schemaRemapStatus(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyAttest(t={}){return this.runTyped("history-attest",{options:t})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,o={},r,i){return this.runTyped("plan",{...n===void 0?{}:{id:n},...r===void 0?{}:{stepRef:r},...i===void 0?{}:{reorderTo:i},options:Ft(o,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,o){return this.plan("update-step",t,o,n)}planCompleteStep(t,n,o={}){return this.plan("complete-step",t,o,n)}planBlockStep(t,n,o){return this.plan("block-step",t,o,n)}planReorderStep(t,n,o,r={}){return this.plan("reorder-step",t,r,n,o)}planRemoveStep(t,n,o={}){return this.plan("remove-step",t,o,n)}planLink(t,n,o){return this.plan("link",t,o,n)}planUnlink(t,n,o){return this.plan("unlink",t,o,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",Q(t))}update(t,n={}){return this.runTyped("update",{id:t,...Q(n)})}reopen(t,n,o={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:o})}close(t,n,o={}){return this.runTyped("close",{id:t,reason:n,...Q(o)})}claim(t,n={}){return this.runTyped("claim",{id:t,...Q(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...Q(t)})}release(t,n={}){return this.runTyped("release",{id:t,...Q(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...Q(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...Q(n)})}restore(t,n,o={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...o,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...Q(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...Q(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...Q(n)})}closeTask(t,n,o={}){return this.runTyped("close-task",{id:t,reason:n,...Q(o)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function ZE(e={},t={}){return new b(t).context(e)}function QE(e={},t={}){return new b(t).list(e)}function eT(e={},t={}){return new b(t).listAllComplete(e)}function tT(e,t={},n={}){return new b(n).search(e,t)}function nT(e,t={},n={}){return new b(n).get(e,t)}function oT(e={},t={}){return new b(t).next(e)}function rT(e={},t={}){return new b(t).aggregate(e)}function iT(e={},t={}){return new b(t).stats(e)}function sT(e={},t={}){return new b(t).duplicates(e)}function aT(e,t={},n={}){return new b(n).comments(e,t)}function cT(e,t={},n={}){return new b(n).notes(e,t)}function lT(e,t={},n={}){return new b(n).learnings(e,t)}function dT(e,t={},n={}){return new b(n).files(e,t)}function mT(e,t={},n={}){return new b(n).filesDiscover(e,t)}function pT(e,t={}){return new b(t).filesLookup(e)}function uT(e,t={},n={}){return new b(n).docs(e,t)}function fT(e,t={},n={}){return new b(n).deps(e,t)}function _T(e,t={},n={},o={}){return new b(o).graph(e,t,n)}function hT(e,t,n={},o={}){return new b(o).append(e,t,n)}function gT(e,t={},n={}){return new b(n).init(e,t)}function yT(e,t,n,o,r={},i={}){return new b(i).config(e,t,n,o,r)}function bT(e,t={},n={}){return new b(n).schema(e,t)}function wT(e={}){return new b(e).schemaList()}function vT(e,t={}){return new b(t).schemaShow(e)}function kT(e,t={},n={}){return new b(n).schemaAddType(e,t)}function ST(e,t={},n={}){return new b(n).schemaRemoveType(e,t)}function IT(e,t={},n={}){return new b(n).schemaAddStatus(e,t)}function AT(e,t={},n={}){return new b(n).schemaRemoveStatus(e,t)}function ET(e,t={},n={}){return new b(n).schemaAddField(e,t)}function TT(e,t={},n={}){return new b(n).schemaRemoveField(e,t)}function CT(e={}){return new b(e).schemaListFields()}function RT(e,t={}){return new b(t).schemaShowField(e)}function xT(e,t={},n={}){return new b(n).schemaApplyPreset(e,t)}function OT(e={},t={}){return new b(t).schemaInferTypes(e)}function $T(e,t,n,o={}){return new b(o).schemaRenameType(e,t,n)}function FT(e,t,n,o,r={}){return new b(r).schemaRenameField(e,t,n,o)}function PT(e,t,n,o={}){return new b(o).schemaRemapStatus(e,t,n)}function LT(e,t={}){return new b(t).schemaShowStatus(e)}function NT(e,t={},n={}){return new b(n).profile(e,t)}function DT(e={}){return new b(e).profileList()}function MT(e,t={}){return new b(t).profileShow(e)}function jT(e,t={},n={}){return new b(n).profileApply(e,t)}function GT(e,t={}){return new b(t).profileLint(e)}function UT(e={},t={}){return new b(t).validate(e)}function qT(e={},t={}){return new b(t).health(e)}function zT(e={},t={}){return new b(t).gc(e)}function HT(e,t,n={}){return new b(n).historyRedact(e,t)}function BT(e,t={},n={}){return new b(n).historyRepair(e,t)}function VT(e={},t={}){return new b(t).historyRepairAll(e)}function WT(e,t={},n={}){return new b(n).historyCompact(e,t)}function KT(e,t={}){return new b(t).historyCompactBulk(e)}function YT(e={},t={}){return new b(t).create(e)}function JT(e,t={},n={}){return new b(n).update(e,t)}function XT(e,t,n={},o={}){return new b(o).reopen(e,t,n)}function ZT(e,t,n={},o={}){return new b(o).close(e,t,n)}function QT(e,t={},n={}){return new b(n).claim(e,t)}function eC(e={},t={}){return new b(t).claimNext(e)}function tC(e,t={},n={}){return new b(n).release(e,t)}function nC(e,t={},n={}){return new b(n).copy(e,t)}function oC(e,t={},n={}){return new b(n).delete(e,t)}function rC(e,t,n={},o={}){return new b(o).restore(e,t,n)}function iC(e,t={},n={}){return new b(n).focus(e,t)}function sC(e,t={},n={}){return new b(n).startTask(e,t)}function aC(e,t={},n={}){return new b(n).pauseTask(e,t)}function cC(e,t,n={},o={}){return new b(o).closeTask(e,t,n)}function lC(e,t={},n={}){return new b(n).extension(e,t)}function dC(e={},t={}){return new b(t).extensionList(e)}function mC(e,t={},n={}){return new b(n).extensionActivate(e,t)}function pC(e,t={},n={}){return new b(n).extensionDeactivate(e,t)}function uC(e,t={},n={}){return new b(n).package(e,t)}function fC(e={},t={}){return new b(t).packageList(e)}function _C(e,t={},n={}){return new b(n).packageInstall(e,t)}function hC(e,t={},n={}){return new b(n).packageUninstall(e,t)}function gC(e={},t={}){return new b(t).packageDoctor(e)}function yC(e,t={},n={}){return new b(n).packageManage(e,t)}function bC(e,t={},n={}){return new b(n).packageDescribe(e,t)}function wC(e={},t={}){return new b(t).packageReload(e)}function vC(e={},t={}){return new b(t).packageCatalog(e)}function kC(e,t={},n={}){return new b(n).packageActivate(e,t)}function SC(e,t={},n={}){return new b(n).packageDeactivate(e,t)}function IC(e,t={},n={}){return new b(n).upgrade(e,t)}async function AC(e,t={}){let n=typeof e=="string"?{...t,pmRoot:e}:e??t,o={json:!0,quiet:n.quiet??!0,noExtensions:n.noExtensions??!1,noPager:!0,profile:n.profile??!1,path:n.pmRoot};return un(n,o)}var Jm=bi(),Qm=new Eg;function Jn(){so(mi()),ao(pi()),co(ui()),lo(fi()),mo(_i()),po(hi()),uo(gi())}async function ep(e,t,n,o){return wi(()=>t===void 0?Jm.read(()=>Xm(e,n,o)):Jm.write(()=>Cg(t,()=>Xm(e,n,o))))}async function EC(e,t){let n=e.cwd,o=n??process.cwd();return ep(yn({path:e.path,noExtensions:e.noExtensions}),n,o,()=>Qm.run(!0,t))}async function Xm(e,t,n){let o=A(t,e.path);if(e.noExtensions)return Jn(),Wo({pmRoot:o},()=>n(null));if(!await ye(St(o)))return Jn(),n(null);let r=null,i;try{let s=await C(o),a=await Jt({pmRoot:o,settings:s,cwd:t,noExtensions:!1}),c=await Zt({...a,loaded:a.loaded});i={loadResult:a,activationResult:c},so(c.hooks),ao(c.commands),co(c.parsers),lo(c.preflight),mo(c.services),po(c.renderers),uo(c.registrations),r={registrations:c.registrations,commands:c.commands,pmRoot:o,packages:a.loaded}}catch(s){Jn(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",s)}try{return await Wo({pmRoot:o,packages:r?.packages},()=>n(r))}finally{Jn(),i&&await Xt(i.loadResult,i.activationResult).catch(()=>{})}}async function Tg(e,t,n,o,r){if(!r)throw new m(`Unsupported native pm action: ${e}`,p.USAGE);let i=De(e),a=r.registrations.commands.find(l=>De(l.action)===i)?.command??r.commands.handlers.find(l=>De(l.command)===i)?.command;if(!a)throw new m(`Unsupported native pm action: ${e}`,p.USAGE);let c=await Ii({command:To(a),args:j(n.args??t.args),options:Co(t,n),global:o,pm_root:r.pmRoot,sdk:cl(r.pmRoot,b.forActiveExtensionHost({pmRoot:r.pmRoot,author:typeof o.author=="string"&&o.author.trim()?o.author.trim():"pm-extension"}))});if(!c.handled){let l=c.warnings.length>0?` (${c.warnings.join(", ")})`:"";throw new m(`Unsupported native pm action: ${e}${l}`,p.USAGE)}return c.result}async function Cg(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}function Rg(e){let t=K(e,"action"),n=De(t),o=_e(er,n),r=o?.action??n,i={...e,action:r};return o?.options!==void 0&&(i.options={...o.options,...Qn(e.options)}),r==="package"&&(i.options={...Qn(i.options),vocabulary:"package"}),{action:r,args:i}}async function xg(e){let t=Rg(e),n=yn(t.args),o=Ja(t.action),r=_(t.args,"cwd"),i=r??process.cwd();t.action==="init"&&(n[Ha]=i),(t.action!=="init"||n.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(n.path=A(i,n.path));try{return t.action==="history-attest"?await ei(t.action,t.args,n,null):e[Zm]===!0||Qm.getStore()===!0?await ei(t.action,t.args,n,null):await ep(n,r,i,s=>ei(t.action,t.args,n,s))}finally{o&&Dr()}}function TC(e=xi){return e.map(t=>{let n=De(t),o=_e(er,n),r=o?.action??n,i=_e(Nr,r)!==void 0;return{action:t,resolved_action:r,covered:i,route:i?o?"alias":"native":"missing"}})}async function ei(e,t,n,o){let r=Eo(t,e);Oi(e,r),$i(e,r);let i={action:e,args:t,options:r,id:_(t,"id"),force:t.force===!0||r.force===!0,global:n,activeExtensions:o},s=_e(Nr,e),a=s?await s(i):await Tg(e,t,r,n,o);if(e==="history-attest")return a;{r.resolvedOutputFormat="json";let c=Di(e,r,a);return await ol(A(process.cwd(),n.path),c),c}}var Og={closeManyOptionsFromFlat:wn,extensionOptionsFromArgs:Co,globalOptions:yn,mutationListOptions:Xa,normalizeActionName:De,normalizeCommandPath:To,normalizeMcpUpdateOptions:Qa,normalizeMcpOptionsArrays:Ya,optionsWithAuthor:Eo,readRequiredString:K,readScalarString:Va,readScalarStringAllowBlank:Wa,readStringArray:j,updateManyOptionsFromFlat:vn,withAddNoteOption:Pt,withFilesDiscoveryOptions:bn,withMutationCompaction:G};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=Og);export{Vo as a,nl as b,ip as c,ap as d,cp as e,Wo as f,rl as g,dp as h,Ko as i,jt as j,On as k,cl as l,yp as m,$n as n,Qo as o,ll as p,Fn as q,Ap as r,ul as s,hl as t,yl as u,kl as v,rr as w,ir as x,sr as y,ar as z,Qp as A,Cl as B,ur as C,Gl as D,Bl as E,Vl as F,it as G,Ir as H,Of as I,Nb as J,Db as K,Tr as L,Kl as M,Qb as N,ew as O,Jl as P,Ql as Q,bw as R,Kf as S,Pr as T,Jf as U,Xf as V,pd as W,ud as X,fd as Y,_d as Z,hd as _,Hw as $,Bw as aa,Vw as ba,Ww as ca,gd as da,yd as ea,vd as fa,Id as ga,Ad as ha,Ed as ia,K as ja,Dr as ka,bS as la,wS as ma,vS as na,kS as oa,SS as pa,Dd as qa,IS as ra,Q_ as sa,nh as ta,sh as ua,ah as va,ch as wa,q as xa,lh as ya,dh as za,mh as Aa,ph as Ba,jr as Ca,Ud as Da,ct as Ea,Mr as Fa,qd as Ga,uh as Ha,zd as Ia,fh as Ja,_h as Ka,hh as La,gh as Ma,yh as Na,Ah as Oa,Wd as Pa,Eh as Qa,Fh as Ra,Gh as Sa,qh as Ta,eg as Ua,Ag as Va,b as Wa,ZE as Xa,QE as Ya,eT as Za,tT as _a,nT as $a,oT as ab,rT as bb,iT as cb,sT as db,aT as eb,cT as fb,lT as gb,dT as hb,mT as ib,pT as jb,uT as kb,fT as lb,_T as mb,hT as nb,gT as ob,yT as pb,bT as qb,wT as rb,vT as sb,kT as tb,ST as ub,IT as vb,AT as wb,ET as xb,TT as yb,CT as zb,RT as Ab,xT as Bb,OT as Cb,$T as Db,FT as Eb,PT as Fb,LT as Gb,NT as Hb,DT as Ib,MT as Jb,jT as Kb,GT as Lb,UT as Mb,qT as Nb,zT as Ob,HT as Pb,BT as Qb,VT as Rb,WT as Sb,KT as Tb,YT as Ub,JT as Vb,XT as Wb,ZT as Xb,QT as Yb,eC as Zb,tC as _b,nC as $b,oC as ac,rC as bc,iC as cc,sC as dc,aC as ec,cC as fc,lC as gc,dC as hc,mC as ic,pC as jc,uC as kc,fC as lc,_C as mc,hC as nc,gC as oc,yC as pc,bC as qc,wC as rc,vC as sc,kC as tc,SC as uc,IC as vc,AC as wc,EC as xc,xg as yc,TC as zc};
2247
- //# sourceMappingURL=chunk-SDLBF4PY.js.map
2247
+ //# sourceMappingURL=chunk-SBTT42A4.js.map
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},f=new e.Error().stack;f&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[f]="841f6791-c2b4-51ea-8047-d27f51ffafb5")}catch{}})();
2
+ //# sourceMappingURL=chunk-SGFQQXFD.js.map