@unbrained/pm-cli 2026.8.11 → 2026.8.13

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 +74 -21
  3. package/dist/cli/commander-usage.js +37 -11
  4. package/dist/cli/error-guidance.d.ts +2 -0
  5. package/dist/cli/error-guidance.js +82 -19
  6. package/dist/cli/main.js +35 -19
  7. package/dist/cli/register-annotations.js +56 -3
  8. package/dist/cli/register-assurance.js +28 -17
  9. package/dist/cli/register-list-query.js +10 -7
  10. package/dist/cli/register-operations.js +16 -6
  11. package/dist/cli-bundle/bundle-manifest.json +163 -163
  12. package/dist/cli-bundle/chunks/chunk-3ZMOWAFM.js +2 -0
  13. package/dist/cli-bundle/chunks/chunk-DEDU3DG7.js +196 -0
  14. package/dist/cli-bundle/chunks/chunk-DL5M5J3V.js +13 -0
  15. package/dist/cli-bundle/chunks/chunk-F7FJYGK3.js +8 -0
  16. package/dist/cli-bundle/chunks/chunk-HIUZVCMN.js +5 -0
  17. package/dist/cli-bundle/chunks/chunk-IMGIN7R6.js +2 -0
  18. package/dist/cli-bundle/chunks/{chunk-A2SJGHSI.js → chunk-Q47C67TQ.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-WMEZHCFI.js → chunk-QGTUPEU5.js} +62 -54
  20. package/dist/cli-bundle/chunks/chunk-TF3TPKPR.js +34 -0
  21. package/dist/cli-bundle/chunks/{chunk-ZU34C3LH.js → chunk-YLBAPY22.js} +50 -50
  22. package/dist/cli-bundle/chunks/register-list-query-4HIZ7EA3.js +10 -0
  23. package/dist/cli-bundle/chunks/register-mutation-W64FZ5HN.js +20 -0
  24. package/dist/cli-bundle/chunks/register-operations-C44ET7R5.js +2 -0
  25. package/dist/cli-bundle/chunks/{register-setup-NOCOOWQY.js → register-setup-634MFRXU.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-27N23W6M.js +31 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-4H5IA6AV.js → chunk-2JP7W7GO.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-2RI2FESN.js +4 -0
  29. package/dist/cli-bundle/focused-chunks/chunk-3BNVU6LC.js +8 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-2DL3MRTD.js → chunk-3DJSGWVB.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-6MLIRBLV.js +5 -0
  32. package/dist/cli-bundle/focused-chunks/chunk-6XYLENDV.js +155 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-CP4K4WFS.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-TL5M2PAY.js → chunk-E3AVJ655.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/chunk-EBTNSFYE.js +2 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-J5EKAIVD.js → chunk-HC2OL2H2.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-BKPIY34S.js → chunk-I75MANL7.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-IIS2FRKL.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-NFHFZH2Z.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-OGC4XSBC.js +17 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-UDAZWT25.js → chunk-OOYYKQWX.js} +4 -4
  42. package/dist/cli-bundle/focused-chunks/{chunk-23FTGO3W.js → chunk-PKPOZXLL.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-QDZUABWL.js +2 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-QQX5TDFT.js +16 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-55BIB6DV.js → chunk-TEZIXMTH.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-WEH6NSL6.js +18 -0
  47. package/dist/cli-bundle/main.js +13 -13
  48. package/dist/cli-bundle/sdk-authoring.js +1 -1
  49. package/dist/cli-bundle/sdk-contracts.js +1 -1
  50. package/dist/cli-bundle/sdk-core.js +42 -41
  51. package/dist/cli-bundle/sdk-governance.js +1 -1
  52. package/dist/cli-bundle/sdk-graph.js +1 -1
  53. package/dist/cli-bundle/sdk-merge.js +1 -1
  54. package/dist/cli-bundle/sdk-query.js +1 -1
  55. package/dist/cli-bundle/sdk-runtime.js +1 -1
  56. package/dist/cli-bundle/sdk-testing.js +1 -1
  57. package/dist/cli-bundle/sdk.js +2 -2
  58. package/dist/core/checkpoint/checkpoint-gc.js +7 -12
  59. package/dist/core/extensions/activation-summary-markdown.js +5 -4
  60. package/dist/core/extensions/activation-summary.d.ts +2 -0
  61. package/dist/core/extensions/activation-summary.js +6 -2
  62. package/dist/core/extensions/capability-usage.d.ts +1 -1
  63. package/dist/core/extensions/capability-usage.js +4 -3
  64. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  65. package/dist/core/extensions/contribution-inventory.js +6 -2
  66. package/dist/core/extensions/extension-registries.js +3 -2
  67. package/dist/core/extensions/extension-types.d.ts +83 -1
  68. package/dist/core/extensions/extension-types.js +3 -2
  69. package/dist/core/extensions/loader.d.ts +2 -8
  70. package/dist/core/extensions/loader.js +53 -144
  71. package/dist/core/extensions/registration-values.d.ts +43 -0
  72. package/dist/core/extensions/registration-values.js +210 -0
  73. package/dist/core/extensions/reserved-host-flags.js +3 -2
  74. package/dist/core/extensions/runtime-registrations.d.ts +3 -1
  75. package/dist/core/extensions/runtime-registrations.js +12 -2
  76. package/dist/core/fs/fs-utils.d.ts +2 -0
  77. package/dist/core/fs/fs-utils.js +7 -3
  78. package/dist/core/history/drift-cache.js +4 -3
  79. package/dist/core/history/drift-scan.js +16 -17
  80. package/dist/core/history/history.d.ts +8 -0
  81. package/dist/core/history/history.js +57 -7
  82. package/dist/core/history/replay.d.ts +9 -1
  83. package/dist/core/history/replay.js +48 -13
  84. package/dist/core/lock/lock-gc.js +8 -13
  85. package/dist/core/lock/lock.js +5 -4
  86. package/dist/core/output/output.d.ts +2 -0
  87. package/dist/core/output/output.js +46 -14
  88. package/dist/core/search/vector-stores.js +6 -11
  89. package/dist/core/shared/command-types.d.ts +2 -0
  90. package/dist/core/shared/command-types.js +2 -2
  91. package/dist/core/shared/errors.d.ts +5 -0
  92. package/dist/core/shared/errors.js +2 -2
  93. package/dist/core/store/item-metadata-cache.d.ts +1 -1
  94. package/dist/core/store/item-metadata-cache.js +16 -9
  95. package/dist/core/telemetry/runtime.d.ts +6 -0
  96. package/dist/core/telemetry/runtime.js +101 -30
  97. package/dist/sdk/agent/command-recovery.d.ts +2 -0
  98. package/dist/sdk/agent/command-recovery.js +10 -2
  99. package/dist/sdk/annotations.js +4 -4
  100. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  101. package/dist/sdk/cli-bootstrap.js +6 -2
  102. package/dist/sdk/cli-contracts/completeness.js +10 -3
  103. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  104. package/dist/sdk/cli-contracts/flag-contracts.js +9 -3
  105. package/dist/sdk/cli-contracts/registration-helpers.d.ts +20 -3
  106. package/dist/sdk/cli-contracts/registration-helpers.js +18 -12
  107. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +40 -6
  108. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +27 -3
  109. package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
  110. package/dist/sdk/cli-contracts/tool-parameter-tables.js +55 -5
  111. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  112. package/dist/sdk/cli-contracts/tool-schema.js +22 -4
  113. package/dist/sdk/cli-program.js +3 -2
  114. package/dist/sdk/comments.js +4 -3
  115. package/dist/sdk/compile-cache.js +4 -3
  116. package/dist/sdk/completion.js +16 -7
  117. package/dist/sdk/compose.d.ts +3 -1
  118. package/dist/sdk/compose.js +16 -2
  119. package/dist/sdk/context-intent-contracts.js +45 -4
  120. package/dist/sdk/context-signal-store.js +4 -3
  121. package/dist/sdk/core.d.ts +1 -0
  122. package/dist/sdk/core.js +3 -2
  123. package/dist/sdk/extension/install-runtime.js +4 -4
  124. package/dist/sdk/extension/managed-state.js +4 -3
  125. package/dist/sdk/extension-contracts.d.ts +1 -1
  126. package/dist/sdk/flag-invocation-contracts.js +5 -6
  127. package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +8 -0
  128. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1597 -0
  129. package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +8 -0
  130. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1608 -0
  131. package/dist/sdk/generated-error-code-catalog.js +6 -3140
  132. package/dist/sdk/governance/assurance-action.d.ts +27 -3
  133. package/dist/sdk/governance/assurance-action.js +117 -31
  134. package/dist/sdk/governance/assurance-mutation-error.d.ts +14 -0
  135. package/dist/sdk/governance/assurance-mutation-error.js +58 -0
  136. package/dist/sdk/governance/assurance-presets.d.ts +54 -0
  137. package/dist/sdk/governance/assurance-presets.js +136 -0
  138. package/dist/sdk/governance/assurance-runtime.d.ts +4 -0
  139. package/dist/sdk/governance/assurance-runtime.js +118 -14
  140. package/dist/sdk/governance/assurance.d.ts +51 -6
  141. package/dist/sdk/governance/assurance.js +321 -67
  142. package/dist/sdk/governance/gc.js +5 -11
  143. package/dist/sdk/governance/health.d.ts +3 -1
  144. package/dist/sdk/governance/health.js +24 -7
  145. package/dist/sdk/governance/validate-item-reader.js +3 -3
  146. package/dist/sdk/governance/validate.d.ts +2 -0
  147. package/dist/sdk/governance/validate.js +15 -5
  148. package/dist/sdk/graph/durable-cache.d.ts +1 -1
  149. package/dist/sdk/graph/durable-cache.js +156 -29
  150. package/dist/sdk/graph/governance-contracts.d.ts +12 -0
  151. package/dist/sdk/graph/governance-contracts.js +27 -0
  152. package/dist/sdk/graph/governance.d.ts +44 -2
  153. package/dist/sdk/graph/governance.js +156 -12
  154. package/dist/sdk/guide.js +4 -4
  155. package/dist/sdk/index.d.ts +3 -2
  156. package/dist/sdk/index.js +5 -4
  157. package/dist/sdk/lifecycle/claim.js +10 -3
  158. package/dist/sdk/linked-artifacts.d.ts +2 -0
  159. package/dist/sdk/linked-artifacts.js +29 -4
  160. package/dist/sdk/merge/driver.d.ts +2 -2
  161. package/dist/sdk/merge/driver.js +3 -3
  162. package/dist/sdk/merge/install.js +5 -4
  163. package/dist/sdk/merge/receipts.d.ts +6 -4
  164. package/dist/sdk/merge/receipts.js +7 -5
  165. package/dist/sdk/merge/three-way.d.ts +2 -2
  166. package/dist/sdk/merge/three-way.js +3 -3
  167. package/dist/sdk/output-projection.d.ts +9 -1
  168. package/dist/sdk/output-projection.js +45 -9
  169. package/dist/sdk/query/activity.d.ts +49 -2
  170. package/dist/sdk/query/activity.js +185 -38
  171. package/dist/sdk/query/get.js +19 -2
  172. package/dist/sdk/read-output-contracts.d.ts +5 -1
  173. package/dist/sdk/read-output-contracts.js +17 -2
  174. package/dist/sdk/read-output-session.d.ts +2 -0
  175. package/dist/sdk/read-output-session.js +12 -5
  176. package/dist/sdk/relationship-history.js +5 -5
  177. package/dist/sdk/runtime-primitives.d.ts +3 -3
  178. package/dist/sdk/runtime-primitives.js +5 -5
  179. package/dist/sdk/runtime-stats-options.js +3 -2
  180. package/dist/sdk/runtime.js +5 -9
  181. package/dist/sdk/schema-migration.js +4 -4
  182. package/dist/sdk/stats.d.ts +36 -3
  183. package/dist/sdk/stats.js +55 -15
  184. package/dist/sdk/test/execution.d.ts +4 -0
  185. package/dist/sdk/test/execution.js +88 -23
  186. package/dist/sdk/workspace-memory.js +4 -4
  187. package/dist/sdk/workspace-snapshot.js +8 -14
  188. package/dist/sdk/workspace-transaction-gc.js +4 -9
  189. package/dist/sdk/workspace-transaction.js +4 -4
  190. package/dist/sdk/workspace.js +4 -3
  191. package/dist/types.d.ts +2 -0
  192. package/dist/types.js +2 -2
  193. package/docs/ASSURANCE.md +170 -14
  194. package/docs/COMMANDS.md +29 -8
  195. package/docs/CONFIGURATION.md +9 -0
  196. package/docs/DEPENDENCY_KIND_CONTRACT.md +10 -8
  197. package/docs/EXTENSIONS.md +11 -12
  198. package/docs/MERGE_SAFETY.md +3 -1
  199. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +26 -13
  200. package/docs/README.md +2 -0
  201. package/docs/READ_OUTPUT_CONTRACTS.md +17 -2
  202. package/docs/RELATIONSHIP_GRAPH.md +15 -0
  203. package/docs/SDK.md +17 -3
  204. package/docs/SDK_AGENT_SESSION_CONTEXT.md +12 -1
  205. package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +53 -0
  206. package/docs/SDK_CONTEXT_INTEGRITY.md +28 -1
  207. package/docs/TESTING.md +24 -15
  208. package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +106 -0
  209. package/docs/performance/sdk-entrypoint-import-costs.md +6 -2
  210. package/marketplace.json +2 -2
  211. package/package.json +6 -6
  212. package/packages/pm-beads/package.json +1 -1
  213. package/packages/pm-calendar/package.json +1 -1
  214. package/packages/pm-command-kit/package.json +1 -1
  215. package/packages/pm-digital-twin/package.json +1 -1
  216. package/packages/pm-governance-audit/package.json +1 -1
  217. package/packages/pm-guide-shell/package.json +1 -1
  218. package/packages/pm-kanban/package.json +1 -1
  219. package/packages/pm-lifecycle-hooks/package.json +1 -1
  220. package/packages/pm-linked-test-adapters/package.json +1 -1
  221. package/packages/pm-search-advanced/package.json +1 -1
  222. package/packages/pm-templates/package.json +1 -1
  223. package/packages/pm-todos/package.json +1 -1
  224. package/packages/pm-vcs/package.json +1 -1
  225. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  226. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  227. package/sdk/public-surface.json +384 -83
  228. package/dist/cli-bundle/chunks/chunk-2OOU2AFH.js +0 -8
  229. package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +0 -33
  230. package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +0 -13
  231. package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +0 -194
  232. package/dist/cli-bundle/chunks/chunk-IUNRVDAI.js +0 -2
  233. package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +0 -2
  234. package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +0 -5
  235. package/dist/cli-bundle/chunks/register-list-query-HAUXVUPY.js +0 -10
  236. package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +0 -20
  237. package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +0 -2
  238. package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +0 -2
  239. package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +0 -2
  240. package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +0 -16
  241. package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +0 -8
  242. package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +0 -2
  243. package/dist/cli-bundle/focused-chunks/chunk-DPO7TEFX.js +0 -31
  244. package/dist/cli-bundle/focused-chunks/chunk-E3KCL7AY.js +0 -5
  245. package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +0 -153
  246. package/dist/cli-bundle/focused-chunks/chunk-F6E4JZKG.js +0 -2
  247. package/dist/cli-bundle/focused-chunks/chunk-FPSYO5ZG.js +0 -18
  248. package/dist/cli-bundle/focused-chunks/chunk-KDH5OX3D.js +0 -4
  249. package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +0 -2
  250. package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +0 -17
@@ -1,4 +1,4 @@
1
- import{f as w,i as f,j as B,k as j,l as U,o as y,p as X,q as W,r as Y}from"./chunk-UDAZWT25.js";import{B as H,a as P,b as D}from"./chunk-OJ3LVVIS.js";import{c as u,f as M,g as z,i as q}from"./chunk-TL5M2PAY.js";import{Fa as F,c as L,f as R}from"./chunk-4AHEC74N.js";import{Ia as g,Ka as K,X as k}from"./chunk-KDH5OX3D.js";import{a as N,e as x,f as O,g as A,i as C,l as $}from"./chunk-D4PIWE6D.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb16b445-3bd4-520d-becf-c55621bfa186")}catch{}})();var Ce=N,$e=x,Pe=C,De=O,Le=A;function G(e,t,n,s){let r=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),o=n.has(r);return{long:t,...s?{short:s}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:o?"string":"boolean",...o?{value_name:e.value_name??"value"}:{}}}function Q(e,t=[]){let n=new Set(t.flatMap(r=>r.keys)),s=[];for(let r of L(e.map(o=>({...o})))){s.push(G(r,r.flag,n,r.short));for(let o of r.aliases??[])s.push(G(r,o,n))}return s}var Re=Q(R,P),Fe=Q(F,D);(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]="bed1d1d4-0c1d-59e5-8267-fbe800dfd83b")}catch{}})();var _=["agile","ops","research"],I={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:w.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
1
+ import{f as w,i as f,j as B,k as j,l as U,o as y,p as X,q as W,r as Y}from"./chunk-OOYYKQWX.js";import{B as H,a as P,b as D}from"./chunk-NFHFZH2Z.js";import{c as u,f as M,g as z,i as q}from"./chunk-E3AVJ655.js";import{Fa as F,c as L,f as R}from"./chunk-QDZUABWL.js";import{Ja as g,La as K,Y as k}from"./chunk-2RI2FESN.js";import{a as N,e as x,f as O,g as A,i as C,l as $}from"./chunk-CP4K4WFS.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb16b445-3bd4-520d-becf-c55621bfa186")}catch{}})();var Ce=N,$e=x,Pe=C,De=O,Le=A;function G(e,t,n,s){let r=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),o=n.has(r);return{long:t,...s?{short:s}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:o?"string":"boolean",...o?{value_name:e.value_name??"value"}:{}}}function Q(e,t=[]){let n=new Set(t.flatMap(r=>r.keys)),s=[];for(let r of L(e.map(o=>({...o})))){s.push(G(r,r.flag,n,r.short));for(let o of r.aliases??[])s.push(G(r,o,n))}return s}var Re=Q(R,P),Fe=Q(F,D);(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]="bed1d1d4-0c1d-59e5-8267-fbe800dfd83b")}catch{}})();var _=["agile","ops","research"],I={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:w.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
2
2
 
3
3
  ## I want
4
4
 
@@ -23,4 +23,4 @@ import{f as w,i as f,j as B,k as j,l as U,o as y,p as X,q as W,r as Y}from"./chu
23
23
 
24
24
  ## Conclusion
25
25
  `}}],packages:[{spec:"search-advanced",reason:"Semantic retrieval over experiments and findings."},{spec:"templates",reason:"Consistent experiment and hypothesis scaffolds."},{spec:"beads",reason:"Import structured prior work into the tracker."}]}};function ne(e){if(e===void 0)return;let t=p(e);if(t.length===0)throw new Error("Profile name must not be empty.");if(_.includes(t))return t;throw new Error(`Invalid profile "${e}". Allowed: ${_.join(", ")}.`)}function qe(e){let t=ne(e);if(t===void 0)throw new Error(`Profile name is required. Allowed: ${_.join(", ")}.`);return I[t]}function Be(){return _.map(e=>I[e])}function p(e){return e.trim().toLowerCase().replaceAll("-","_")}function J(e){return e.map(t=>t.definition.name).join(", ")}function se(e=[]){let t=_.map(o=>({definition:I[o],source:"builtin"})),n=new Set(_.map(o=>p(o))),s=new Set(n),r=[];for(let o of e){let i=p(o.profile.name);if(n.has(i)){r.push(`Extension "${o.name}" profile "${o.profile.name}" uses a name reserved by a built-in archetype and was ignored.`);continue}if(s.has(i)){r.push(`Profile "${o.profile.name}" from extension "${o.name}" duplicates an already-registered profile and was ignored.`);continue}s.add(i),t.push({definition:o.profile,source:"extension",package:o.name})}return{profiles:t,warnings:r}}function je(e,t=[]){let{profiles:n,warnings:s}=se(t);if(typeof e!="string"||e.trim().length===0)throw new Error(`Profile name is required. Allowed: ${J(n)}.`);let r=p(e),o=n.find(i=>p(i.definition.name)===r);if(o===void 0)throw new Error(`Invalid profile "${e}". Allowed: ${J(n)}.`);return{resolved:o,warnings:s}}(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]="933d8f74-c4aa-58d0-bd3b-8932a35d3702")}catch{}})();function re(e){return{types:e.types.length,statuses:e.statuses.length,fields:e.fields.length,workflows:e.workflows.length,config:e.config.length,templates:e.templates.length,packages:e.packages.length}}function Ye(e){return{name:e.name,title:e.title,summary:e.summary,composition:re(e),types:e.types.map(t=>S(()=>u(t).name,()=>String(t.name??""))),statuses:e.statuses.map(t=>S(()=>y(t).id,()=>String(t.id??""))),fields:e.fields.map(t=>S(()=>f(t).key,()=>String(t.key??""))),workflows:e.workflows.map(t=>t.type),config:e.config.map(t=>`${t.key}=${t.value}`),templates:e.templates.map(t=>t.name),packages:e.packages.map(t=>({spec:t.spec,reason:t.reason}))}}function S(e,t){try{return e()}catch{return 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]="b4af534e-32f9-5271-b6f1-7d901c282de0")}catch{}})();var oe=[{key:"search_provider",path:"search.provider",kind:"string",summary:"Search embedding provider name (e.g. openai, ollama, or an extension provider)."},{key:"search_mutation_refresh_policy",path:"search.mutation_refresh_policy",kind:"string",choices:["cache_only","semantic_configured","semantic_auto"],summary:"Mutation-time search refresh policy: cache_only, semantic_configured, or semantic_auto."},{key:"search_query_expansion_enabled",path:"search.query_expansion.enabled",kind:"boolean",summary:"Enable or disable query expansion for semantic/hybrid search."},{key:"search_query_expansion_provider",path:"search.query_expansion.provider",kind:"string",summary:"Query expansion provider name (built-in openai/ollama or extension provider)."},{key:"search_rerank_enabled",path:"search.rerank.enabled",kind:"boolean",summary:"Enable or disable post-retrieval reranking for hybrid search."},{key:"search_rerank_model",path:"search.rerank.model",kind:"string",summary:"Rerank model name override used by built-in providers."},{key:"search_rerank_top_k",path:"search.rerank.top_k",kind:"integer",min:1,summary:"Number of top hybrid candidates to rerank when rerank is enabled."},{key:"search_embedding_model",path:"search.embedding_model",kind:"string",summary:"Default embedding model name (overrides provider-specific model when set)."},{key:"search_embedding_corpus_max_characters",path:"search.embedding_corpus_max_characters",kind:"integer",min:1,summary:"Maximum semantic corpus characters per item before truncation."},{key:"search_embedding_batch_size",path:"search.embedding_batch_size",kind:"integer",min:1,summary:"Number of items embedded per request batch."},{key:"search_embedding_timeout_ms",path:"search.embedding_timeout_ms",kind:"integer",min:1,summary:"Per-request embedding timeout in milliseconds."},{key:"search_score_threshold",path:"search.score_threshold",kind:"number",summary:"Minimum score for a hit to be returned (0 keeps all matches)."},{key:"search_hybrid_semantic_weight",path:"search.hybrid_semantic_weight",kind:"ratio",summary:"Hybrid mode semantic weight in [0, 1] (1-weight goes to keyword)."},{key:"search_max_results",path:"search.max_results",kind:"integer",min:1,summary:"Default upper bound on search hits when --limit is not supplied."},{key:"search_bm25_k1",path:"search.bm25.k1",kind:"number",min:0,summary:"Offline BM25 term-frequency saturation (k1); higher saturates repeated terms slower (default 1.2)."},{key:"search_bm25_b",path:"search.bm25.b",kind:"ratio",summary:"Offline BM25 document-length normalization (b) in [0, 1]; 0 disables, 1 fully normalizes (default 0.75)."},{key:"openai_base_url",path:"providers.openai.base_url",kind:"string",summary:"OpenAI-compatible API base URL (LM Studio/vLLM also use this)."},{key:"openai_api_key",path:"providers.openai.api_key",kind:"string",summary:"OpenAI-compatible API key."},{key:"openai_model",path:"providers.openai.model",kind:"string",summary:"OpenAI-compatible embedding model name."},{key:"ollama_base_url",path:"providers.ollama.base_url",kind:"string",summary:"Ollama API base URL (typically http://localhost:11434)."},{key:"ollama_model",path:"providers.ollama.model",kind:"string",summary:"Ollama embedding model name (e.g. nomic-embed-text)."},{key:"vector_store_adapter",path:"vector_store.adapter",kind:"string",summary:"Vector store adapter name (lancedb, qdrant, or an extension adapter)."},{key:"vector_store_collection_name",path:"vector_store.collection_name",kind:"string",non_empty:!0,summary:"Vector collection/table name shared by Qdrant and LanceDB adapters."},{key:"qdrant_url",path:"vector_store.qdrant.url",kind:"string",summary:"Qdrant HTTP API URL."},{key:"qdrant_api_key",path:"vector_store.qdrant.api_key",kind:"string",summary:"Qdrant API key (empty if running unauthenticated)."},{key:"lancedb_path",path:"vector_store.lancedb.path",kind:"string",summary:"LanceDB storage path (relative to pm root or absolute)."},{key:"id_prefix",path:"id_prefix",kind:"string",non_empty:!0,summary:'Prefix for generated item IDs (e.g. "pm" produces pm-xxxx).'},{key:"author_default",path:"author_default",kind:"string",non_empty:!0,summary:"Default author recorded on mutations when --author is not supplied."},{key:"mutation_guard_require_attributed_author",path:"mutation_guard.require_attributed_author",kind:"boolean",summary:"Reject mutations whose effective author resolves to unknown."},{key:"mutation_guard_secret_guard",path:"mutation_guard.secret_guard",kind:"string",choices:["off","advise","block"],summary:"Detect credential-shaped mutation content: off, advise, or block."},{key:"mutation_guard_stale_in_progress_hours",path:"mutation_guard.stale_in_progress_hours",kind:"integer",min:1,summary:"Age threshold for unclaimed in-progress work surfaced by health."},{key:"governance_duplicate_detection_mode",path:"governance.duplicate_detection_mode",kind:"string",choices:["off","advisory","strict"],summary:"Create/copy duplicate governance: off, advisory, or strict explicit-bypass enforcement."},{key:"governance_duplicate_detection_threshold",path:"governance.duplicate_detection_threshold",kind:"ratio",summary:"Minimum shared similarity score in [0, 1] for create/copy duplicate governance."},{key:"governance_duplicate_detection_limit",path:"governance.duplicate_detection_limit",kind:"integer",min:0,max:20,summary:"Maximum likely duplicates returned by create/copy governance (0-20)."},{key:"output_default_format",path:"output.default_format",kind:"string",choices:["toon","json"],summary:"Default output format for commands that support it: toon or json."},{key:"locks_ttl_seconds",path:"locks.ttl_seconds",kind:"integer",min:1,summary:"Claim/lock time-to-live in seconds before a stale lock can be reclaimed."},{key:"locks_wait_ms",path:"locks.wait_ms",kind:"integer",min:0,summary:"Bounded jittered wait in milliseconds before a contended item mutation fails with lock_conflict; 0 fails fast. PM_LOCK_WAIT_MS overrides per invocation."},{key:"ids_token_length",path:"ids.token_length",kind:"integer",min:4,max:12,summary:"Random base36 token length for newly minted item ids (4-12, default 4). Raise it to shrink cross-branch id collision odds in concurrent multi-agent workflows (pm-pibw)."},{key:"checkpoints_retention_days",path:"checkpoints.retention_days",kind:"integer",min:1,summary:"Age in days above which pm gc --scope checkpoints prunes bulk-mutation rollback checkpoints."},{key:"schema_unknown_field_policy",path:"schema.unknown_field_policy",kind:"string",choices:["allow","warn","reject"],summary:"How item I/O handles metadata keys not in the field registry: allow, warn, or reject."},{key:"history_compact_policy_enabled",path:"history.compact_policy.enabled",kind:"boolean",summary:"Enable the history-compaction advisory: pm health warns on over-threshold streams."},{key:"history_compact_policy_max_entries",path:"history.compact_policy.max_entries",kind:"integer",min:1,summary:"Entry count above which a history stream is flagged (and the default pm history-compact --all-over threshold)."},{key:"history_compact_policy_trigger",path:"history.compact_policy.trigger",kind:"string",choices:["health_warn","auto"],summary:"History-compaction policy intent: health_warn (advisory only) or auto (scheduled sweeps expected)."}],ie=new Map(oe.flatMap(e=>[[e.key,e],[e.path.toLowerCase().replaceAll("-","_"),e]]));function b(e){if(typeof e!="string")return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length!==0)return ie.get(t)}function ae(e,t){let n=t.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"||n==="on"?{ok:!0,parsed:{descriptor:e,value:!0}}:n==="false"||n==="0"||n==="no"||n==="off"?{ok:!0,parsed:{descriptor:e,value:!1}}:{ok:!1,error:{message:`Config set ${e.key} requires a boolean value (true|false), got "${t}"`}}}function le(e,t,n){return e.non_empty===!0&&n.length===0?{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}}:e.choices&&!e.choices.includes(n)?{ok:!1,error:{message:`Config set ${e.key} must be one of ${e.choices.join("|")}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function de(e,t,n){if(n.length===0)return{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}};let s=Number(n);return Number.isFinite(s)?{ok:!0,value:s}:{ok:!1,error:{message:`Config set ${e.key} requires a finite number, got "${t}"`}}}function ce(e,t,n){return!Number.isInteger(n)||n<0?{ok:!1,error:{message:`Config set ${e.key} requires a non-negative integer, got "${t}"`}}:e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires an integer >= ${e.min}, got "${t}" (the runtime silently ignores 0 here and falls back to the default)`}}:e.max!==void 0&&n>e.max?{ok:!1,error:{message:`Config set ${e.key} requires an integer <= ${e.max}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function me(e,t,n){return n<0||n>1?{ok:!1,error:{message:`Config set ${e.key} requires a number in [0, 1], got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function pe(e,t,n){return e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires a number >= ${e.min}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function v(e,t){if(typeof t!="string")return{ok:!1,error:{message:`Config set ${e.key} requires a string value`}};let n=t.trim();if(e.kind==="boolean")return ae(e,t);if(e.kind==="string")return le(e,t,n);let s=de(e,t,n);return s.ok?e.kind==="integer"?ce(e,t,s.value):e.kind==="ratio"?me(e,t,s.value):pe(e,t,s.value):{ok:!1,error:s.error}}function V(e,t){let n=t.path.split("."),s=e;for(let r of n){if(typeof s!="object"||s===null)return null;s=s[r]}return typeof s=="string"||typeof s=="number"||typeof s=="boolean"?s:null}function Ge(e,t,n){let s=t.path.split("."),r=e;for(let a=0;a<s.length-1;a+=1){let c=s[a],d=r[c];if(typeof d!="object"||d===null||Array.isArray(d)){let l={};r[c]=l,r=l}else r=d}let o=s[s.length-1];return r[o]===n?!1:(r[o]=n,!0)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f9b22df0-7ec2-5d72-bc88-3eb7201a6051")}catch{}})();var at=["profile","types","statuses","fields","workflows","config","templates","packages"],lt=["profile_name_empty","profile_name_not_normalized","profile_title_empty","profile_summary_empty","type_invalid","type_duplicate","status_invalid","status_duplicate","field_invalid","field_duplicate","field_mcp_input_collision","workflow_type_empty","workflow_type_unknown","workflow_duplicate_type","workflow_transition_malformed","workflow_status_unknown","config_key_unknown","config_value_invalid","config_duplicate","template_type_unknown","package_spec_empty"],ue=new Set(K.flatMap(e=>[g(e.id),...(e.aliases??[]).map(t=>g(t))]).filter(e=>e.length>0)),Z=new Set($.map(e=>e.toLowerCase()));function fe(e,t){e.name.trim().length===0?t.push({severity:"error",code:"profile_name_empty",dimension:"profile",message:"Profile name must not be empty; profile resolution requires a non-blank name."}):e.name!==p(e.name)&&t.push({severity:"warning",code:"profile_name_not_normalized",dimension:"profile",target:e.name,message:`Profile name "${e.name}" is not in canonical form; resolution folds it to "${p(e.name)}" (lowercase, hyphens as underscores).`}),e.title.trim().length===0&&t.push({severity:"warning",code:"profile_title_empty",dimension:"profile",message:"Profile title is empty; list and show surfaces will render a blank title."}),e.summary.trim().length===0&&t.push({severity:"warning",code:"profile_summary_empty",dimension:"profile",message:"Profile summary is empty; list and show surfaces will render a blank archetype description."})}function ye(e,t){let n=new Set,s=new Set;for(let[r,o]of e.types.entries()){let i;try{i=u(o).name}catch(c){t.push({severity:"error",code:"type_invalid",dimension:"types",target:typeof o.name=="string"?o.name:`#${r}`,message:k(c)});continue}let a=i.toLowerCase();if(s.has(a)){t.push({severity:"error",code:"type_duplicate",dimension:"types",target:i,message:`Item type "${i}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}s.add(a),n.add(a)}return n}function he(e,t){let n=new Set,s=new Set;for(let[r,o]of e.statuses.entries()){let i;try{i=y(o)}catch(a){t.push({severity:"error",code:"status_invalid",dimension:"statuses",target:typeof o.id=="string"?o.id:`#${r}`,message:k(a)});continue}if(s.has(i.id)){t.push({severity:"error",code:"status_duplicate",dimension:"statuses",target:i.id,message:`Status "${i.id}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}s.add(i.id),n.add(i.id);for(let a of i.aliases??[])n.add(g(a))}return n}function ge(e,t){let n=new Set;for(let[s,r]of e.fields.entries()){let o;try{o=f(r).key}catch(a){t.push({severity:"error",code:"field_invalid",dimension:"fields",target:typeof r.key=="string"?r.key:`#${s}`,message:k(a)});continue}if(n.has(o)){t.push({severity:"error",code:"field_duplicate",dimension:"fields",target:o,message:`Field "${o}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}n.add(o);let i=H(o);i&&t.push({severity:"warning",code:"field_mcp_input_collision",dimension:"fields",target:o,message:`Field "${o}" collides with canonical MCP property "${i.property}" owned by ${i.owner}; callers must pass the custom value through ${i.nested_path}.`})}}function _e(e,t,n,s){let r=new Set;for(let[o,i]of e.workflows.entries()){let a=i.type.trim().toLowerCase();if(a.length===0){s.push({severity:"error",code:"workflow_type_empty",dimension:"workflows",target:`#${o}`,message:"Workflow has an empty type; the workflow resolver drops entries without a type."});continue}let c=r.has(a);r.add(a),c?s.push({severity:"warning",code:"workflow_duplicate_type",dimension:"workflows",target:i.type,message:`Workflow type "${i.type}" is declared more than once; the later transition set wins.`}):!Z.has(a)&&!t.has(a)&&s.push({severity:"warning",code:"workflow_type_unknown",dimension:"workflows",target:i.type,message:`Workflow governs type "${i.type}" which is neither a built-in type nor declared by this profile; it has no effect unless that type already exists.`});let d=new Set;for(let l of i.allowed_transitions){let m=g(l[0]),E=g(l[1]);if(m.length===0||E.length===0){s.push({severity:"error",code:"workflow_transition_malformed",dimension:"workflows",target:i.type,message:`Workflow "${i.type}" has a transition with an empty status; the workflow resolver silently drops it.`});continue}for(let h of[m,E])ue.has(h)||n.has(h)||d.has(h)||(d.add(h),s.push({severity:"warning",code:"workflow_status_unknown",dimension:"workflows",target:h,message:`Workflow "${i.type}" references status "${h}" which is neither a built-in status nor declared by this profile; transitions to or from it are unreachable.`}))}}}function ke(e,t){let n=new Set;for(let s of e.config){let r=b(s.key);if(r===void 0){t.push({severity:"error",code:"config_key_unknown",dimension:"config",target:s.key,message:`Config knob "${s.key}" is not a recognized setting; apply rejects it with a usage error.`});continue}n.has(r.key)?t.push({severity:"error",code:"config_duplicate",dimension:"config",target:r.key,message:`Config knob "${r.key}" is set more than once; the later value silently overwrites the earlier one.`}):n.add(r.key);let o=v(r,s.value);o.ok||t.push({severity:"error",code:"config_value_invalid",dimension:"config",target:s.key,message:o.error.message})}}function we(e,t,n){for(let s of e.templates){let r=s.options.type;if(typeof r!="string"||r.trim().length===0)continue;let o=r.trim().toLowerCase();!Z.has(o)&&!t.has(o)&&n.push({severity:"warning",code:"template_type_unknown",dimension:"templates",target:s.name,message:`Template "${s.name}" creates type "${r}" which is neither a built-in type nor declared by this profile.`})}}function be(e,t){for(let[n,s]of e.packages.entries())s.spec.trim().length===0&&t.push({severity:"warning",code:"package_spec_empty",dimension:"packages",target:`#${n}`,message:"Package recommendation has an empty spec; it cannot be surfaced as an install hint."})}function dt(e){let t=[];fe(e,t);let n=ye(e,t),s=he(e,t);ge(e,t),_e(e,n,s,t),ke(e,t),we(e,n,t),be(e,t);let r=t.filter(i=>i.severity==="error").length,o=t.length-r;return{profile:e.name,ok:r===0,findings:t,errorCount:r,warningCount:o}}(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]="ead1caea-8e8b-5208-9fba-23fb114044b5")}catch{}})();function T(e,t,n,s,r){let o=e,i=[];for(let a of t){let c=s(o),d=r(o,a),l=s(d.file);o=d.file;let m=c===l?"unchanged":d.replaced?"update":"add";i.push({key:n(a),status:m})}return{file:o,changes:i,changed:i.some(a=>a.status!=="unchanged")}}function ee(e){return JSON.stringify(e.map(t=>t.join("\0")).sort())}function ve(e,t){let n=e.map(r=>({...r})),s=[];for(let r of t){let o=n.findIndex(a=>a.type===r.type),i={type:r.type,allowed_transitions:r.allowed_transitions};o<0?(n.push(i),s.push({type:r.type,status:"add"})):ee(n[o].allowed_transitions)===ee(r.allowed_transitions)?s.push({type:r.type,status:"unchanged"}):(n[o]=i,s.push({type:r.type,status:"update"}))}return{changes:s,result:n,changed:s.some(r=>r.status!=="unchanged")}}function Ie(e,t){let n=[];for(let s of e.config){let r=b(s.key);if(r===void 0)throw new Error(`Profile "${e.name}" references unknown config key "${s.key}".`);let o=v(r,s.value);if(!o.ok)throw new Error(`Profile "${e.name}" config ${s.key}: ${o.error.message}`);let i=V(t,r),a=i===null?"add":i===o.parsed.value?"unchanged":"update";n.push({key:r.key,path:r.path,value:o.parsed.value,status:a})}return{changes:n,changed:n.some(s=>s.status!=="unchanged")}}function te(e){let t=Object.entries(e).sort(([n],[s])=>n.localeCompare(s));return JSON.stringify(t)}function Se(e,t){let n=[];for(let s of e.templates){let r=t.get(s.name),o;r===void 0?o="add":te(r)===te(s.options)?o="unchanged":o="update",n.push({name:s.name,options:s.options,status:o})}return{changes:n,changed:n.some(s=>s.status!=="unchanged")}}function yt(e,t){let n=T(M(t.typesRaw),e.types,l=>u(l).name,q,(l,m)=>z(l,u(m))),s=T(X(t.statusesRaw),e.statuses,l=>y(l).id,W,(l,m)=>Y(l,y(m))),r=T(B(t.fieldsRaw),e.fields,l=>f(l).key,j,(l,m)=>U(l,f(m))),o=ve(t.workflows,e.workflows),i=Ie(e,t.settings),a=Se(e,t.templates),c=e.packages.map(l=>({spec:l.spec,reason:l.reason,status:t.installedPackages.has(l.spec)?"installed":"recommended"})),d=n.changed||s.changed||r.changed||o.changed||i.changed||a.changed;return{profile:{name:e.name,title:e.title,summary:e.summary},types:n,statuses:s,fields:r,workflows:o,config:i,templates:a,packages:c,changed:d}}export{Ce as a,$e as b,Pe as c,De as d,Le as e,Q as f,Re as g,Fe as h,_ as i,I as j,ne as k,qe as l,Be as m,se as n,je as o,re as p,Ye as q,oe as r,b as s,v as t,V as u,Ge as v,at as w,lt as x,dt as y,yt as z};
26
- //# sourceMappingURL=chunk-2DL3MRTD.js.map
26
+ //# sourceMappingURL=chunk-3DJSGWVB.js.map
@@ -0,0 +1,5 @@
1
+ import{Aa as we,V as $,W as pe,X as ye,Y as ge,Z as _e,b as he}from"./chunk-OGC4XSBC.js";import{e as ue,f as fe,g as me}from"./chunk-PKPOZXLL.js";import{h as L}from"./chunk-WEH6NSL6.js";import{Fa as A,Ia as ae,Ja as ce,Ma as U,Na as M,Oa as b,U as te,V as C,W as D,Ya as x,l as T,la as j,na as re,o as ee,oa as ne,ob as de,pa as ie,qa as oe,rb as le,va as se}from"./chunk-6XYLENDV.js";import{F as B,L as k,O as F,h as Y,p as O,s as Z}from"./chunk-2RI2FESN.js";import{Y as g,Z as _,aa as R}from"./chunk-CP4K4WFS.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3c9d6924-ae7c-57c3-a346-1e2189c532fa")}catch{}})();function J(e,t){let n=j(e);if(n)throw new _(`History merge input (${t}) contains unresolved conflict markers at line ${n.line}. Merge drivers must receive clean per-side versions.`,g.GENERIC_FAILURE);let r=[];for(let[o,s]of e.split(/\r?\n/).entries()){let i=s.trim();if(i)try{let c=JSON.parse(i);if(typeof c!="object"||c===null||Array.isArray(c))throw new TypeError("history entry must be an object");r.push(c)}catch{throw new _(`History merge input (${t}) contains invalid JSON at line ${o+1}.`,g.GENERIC_FAILURE)}}return r}function I(e){return R({ts:e.ts,author:e.author,op:e.op,patch:e.patch,message:e.message??null})}function Pe(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&I(e[r])===I(t[r]);)r+=1;return r}function Re(e,t,n){J(e,"base");let r=J(t,"ours"),o=J(n,"theirs"),s=Pe(r,o);if(s===r.length&&s===o.length)return{merged:b(r),strategy:"identical",common_entries:s,entries_from_ours:0,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(s===o.length)return{merged:b(r),strategy:"fast_forward_ours",common_entries:s,entries_from_ours:r.length-s,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(s===r.length)return{merged:b(o),strategy:"fast_forward_theirs",common_entries:s,entries_from_ours:0,entries_from_theirs:o.length-s,entries_total:o.length,reanchored:!1};let i=r.slice(s),c=new Set(i.map(I)),d=o.slice(s).filter(l=>!c.has(I(l))),u=[...i,...d].sort((l,m)=>{let f=D(l.ts,m.ts);if(f!==0)return f;let h=c.has(I(l)),y=c.has(I(m));return h!==y?Number(y)-Number(h):I(l).localeCompare(I(m))}),a=M([...r.slice(0,s),...u]);return{merged:b(a.entries),strategy:"union_reanchor",common_entries:s,entries_from_ours:i.length,entries_from_theirs:d.length,entries_total:a.entries.length,reanchored:!0}}function G(e,t){let n=j(e);if(n)throw new _(`Relationship merge input (${t}) contains unresolved conflict markers at line ${n.line}. Merge drivers must receive clean per-side versions.`,g.GENERIC_FAILURE);let r=[];for(let[o,s]of e.split(/\r?\n/).entries()){let i=s.trim();if(!i)continue;let c;try{c=JSON.parse(i)}catch{throw new _(`Relationship merge input (${t}) contains invalid JSON at line ${o+1}.`,g.GENERIC_FAILURE)}if(typeof c!="object"||c===null||Array.isArray(c)||typeof c.eventId!="string"||typeof c.sequence!="number")throw new _(`Relationship merge input (${t}) line ${o+1} is not a relationship event (eventId + sequence required).`,g.GENERIC_FAILURE);r.push(c)}return r}function H(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
2
+ `)}
3
+ `}function De(e){return e.map((t,n)=>({...t,sequence:n+1}))}function ve(e,t,n){G(e,"base");let r=G(t,"ours"),o=G(n,"theirs"),s=Math.min(r.length,o.length),i=0;for(;i<s&&r[i].eventId===o[i].eventId;)i+=1;if(i===r.length&&i===o.length)return{merged:H(r),strategy:"identical",common_entries:i,entries_from_ours:0,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(i===o.length)return{merged:H(r),strategy:"fast_forward_ours",common_entries:i,entries_from_ours:r.length-i,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(i===r.length)return{merged:H(o),strategy:"fast_forward_theirs",common_entries:i,entries_from_ours:0,entries_from_theirs:o.length-i,entries_total:o.length,reanchored:!1};let c=r.slice(i),d=new Set(c.map(m=>m.eventId)),u=o.slice(i).filter(m=>!d.has(m.eventId)),a=[...c,...u].sort((m,f)=>{if(m.timestamp!==void 0&&f.timestamp!==void 0){let p=D(m.timestamp,f.timestamp);if(p!==0)return p}else{if(m.timestamp===void 0&&f.timestamp!==void 0)return 1;if(m.timestamp!==void 0)return-1}let h=d.has(m.eventId),y=d.has(f.eventId);return h!==y?Number(y)-Number(h):0}),l=De([...r.slice(0,i),...a]);return{merged:H(l),strategy:"union_reanchor",common_entries:i,entries_from_ours:c.length,entries_from_theirs:u.length,entries_total:l.length,reanchored:!0}}var je=["tags","dependencies","comments","notes","learnings","files","tests","test_runs","docs","reminders","events"],Me=["updated_at"];function E(e,t){return R(e??null)===R(t??null)}function Le(e,t,n){let r=a=>Array.isArray(a)?a:[],o=new Set(r(e).map(a=>R(a))),s=r(t),i=new Set(s.map(a=>R(a))),c=r(n),d=new Set(c.map(a=>R(a))),u=s.filter(a=>{let l=R(a);return!o.has(l)||d.has(l)});for(let a of c){let l=R(a);!i.has(l)&&!o.has(l)&&u.push(a)}return u}function He(e,t){return D(String(e),String(t))>=0?e:t}function Ie(e,t,n,r){return E(t,n)?{value:t,from_theirs:!1,conflict:!1}:E(e,t)?{value:n,from_theirs:!0,conflict:!1}:E(e,n)?{value:t,from_theirs:!1,conflict:!1}:{value:r==="theirs"?n:t,from_theirs:r==="theirs",conflict:!0}}function be(e,t,n,r,o){let s=Ie(e,t,n,r);if(!s.conflict||o==="preferred_side")return s;let i=R(n).localeCompare(R(t))<0;return{value:i?n:t,from_theirs:i,conflict:!0}}function z(e){return{...e.metadata}}function V(e,t,n){try{return ie(re(e,n),n)}catch(r){throw new _(`Item merge input (${t}) is not a readable item document: ${String(r)}`,g.GENERIC_FAILURE)}}function Be(e,t,n,r,o){let s=new Set(je),i=new Set(Me),c=[...new Set([...Object.keys(t),...Object.keys(n)])].sort((u,a)=>u.localeCompare(a)),d={merged:{},conflictFields:[],fieldsFromTheirs:[],unionFields:[],conflictDecisions:[]};for(let u of c){let a=e[u],l=t[u],m=n[u];if(s.has(u)){let h=Le(a,l,m);d.merged[u]=h,E(h,l)||d.unionFields.push(u);continue}if(i.has(u)){d.merged[u]=He(l,m);continue}let f=be(a,l,m,r,o);f.value!==void 0&&(d.merged[u]=f.value),f.conflict?(d.conflictFields.push(u),d.conflictDecisions.push({field:u,base:a,ours:l,theirs:m,retained:f.value,discarded:f.from_theirs?l:m})):f.from_theirs&&d.fieldsFromTheirs.push(u)}return d}function Ee(e,t,n,r={}){let o=r.preferred??"ours",s=r.conflictResolution??"preferred_side",i=e.trim().length>0,c=V(t,"ours",r),d=V(n,"theirs",r),u=i?V(e,"base",r):c,a=i?z(u):{},l=z(c),m=z(d),{merged:f,conflictFields:h,fieldsFromTheirs:y,unionFields:p,conflictDecisions:w}=Be(a,l,m,o,s),v=be(i?u.body:"",c.body,d.body,o,s);return v.conflict?(h.push("body"),w.push({field:"body",base:i?u.body:"",ours:c.body,theirs:d.body,retained:v.value,discarded:v.from_theirs?c.body:d.body})):v.from_theirs&&y.push("body"),{merged:ne({metadata:f,body:v.value},r),conflict_fields:h,fields_from_theirs:y,union_fields:p,conflict_decisions:w,requested_preference:o,conflict_resolution:s}}function W(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function q(e,t){let n=j(e);if(n)throw new _(`JSON merge input (${t}) contains unresolved conflict markers at line ${n.line}.`,g.GENERIC_FAILURE);if(e.trim().length!==0)try{return JSON.parse(e)}catch{throw new _(`JSON merge input (${t}) is not valid JSON.`,g.GENERIC_FAILURE)}}function Ue(e,t,n){if(!Array.isArray(e)||!Array.isArray(t)||!Array.isArray(n))return null;let r=u=>{let a=new Map;for(let l of u){let m=R(l);a.set(m,(a.get(m)??0)+1)}return a},o=r(e),s=r(t),i=r(n);for(let[u,a]of o)if((s.get(u)??0)<a||(i.get(u)??0)<a)return null;let c=new Map(s),d=[];for(let u of n){let a=R(u),l=c.get(a)??0;l>0?c.set(a,l-1):d.push(u)}return{merged:[...t,...d],acceptedTheirs:d.length>0}}function Je(e,t,n,r,o,s,i){if(!W(t)||!W(n))return null;let c=W(e)?e:{},d={},u=[...new Set([...Object.keys(t),...Object.keys(n)])].sort((a,l)=>a.localeCompare(l));for(let a of u){let l=o.length>0?`${o}.${a}`:a,m=Ge(c,t,n,a,r,l,s,i);m!==void 0&&(d[a]=m)}return d}function Se(e,t,n,r,o,s,i){if(E(t,n))return t;let c=Ue(e,t,n);if(c!==null)return c.acceptedTheirs&&i.push(o),c.merged;let d=Je(e,t,n,r,o,s,i);if(d!==null)return d;let u=Ie(e,t,n,r);return u.conflict?s.push(o):u.from_theirs&&i.push(o),u.value}function Ge(e,t,n,r,o,s,i,c){let d=Object.prototype.hasOwnProperty.call(t,r),u=Object.prototype.hasOwnProperty.call(n,r),a=Object.prototype.hasOwnProperty.call(e,r);if(d&&u)return Se(e[r],t[r],n[r],o,s,i,c);if(d){if(a&&E(e[r],t[r])){c.push(s);return}return a?(i.push(s),o==="theirs"?void 0:t[r]):t[r]}if(!(a&&E(e[r],n[r])))return a?(i.push(s),o==="theirs"?n[r]:void 0):(c.push(s),n[r])}function Oe(e,t,n,r={}){let o=r.preferred??"ours",s=q(e,"base"),i=q(t,"ours"),c=q(n,"theirs"),d=[],u=[],a=Se(s,i,c,o,"",d,u);return{merged:`${JSON.stringify(a??null,null,2)}
4
+ `,conflict_paths:d,paths_from_theirs:u,preferred:o}}import{readFile as ze,writeFile as Ve}from"node:fs/promises";import We 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]="8d79e3a4-6104-5855-837f-69a041b87b27")}catch{}})();var Ce=["item","history","relationship","json"];function qe(e){let t=e.trim().toLowerCase();if(Ce.includes(t))return t;throw new _(`Unknown merge artifact "${e}". Supported values: ${Ce.join(", ")}.`,g.USAGE)}function Xe(e){if(e===void 0)return"ours";let t=e.trim().toLowerCase();if(t==="ours"||t==="theirs")return t;throw new _(`Unknown --prefer value "${e}". Supported values: ours, theirs.`,g.USAGE)}async function X(e,t){try{return await ze(e,"utf8")}catch{throw new _(`Cannot read merge ${t} file at ${e}.`,g.NOT_FOUND)}}async function Ke(e){let t=k(process.cwd(),e.path);return await O(F(t))?x(t):null}function Qe(e,t){return e.endsWith(".md")?"json_markdown":e.endsWith(".toon")?"toon":t?.item_format??"toon"}async function Et(e,t){let n=qe(e.artifact),r=Xe(e.prefer),o=We.resolve(e.outputPath??e.oursPath),[s,i,c]=await Promise.all([X(e.basePath,"base"),X(e.oursPath,"ours"),X(e.theirsPath,"theirs")]),d,u,a=[],l={};if(n==="history"){let f=Re(s,i,c);d=f.merged,l.history={strategy:f.strategy,common_entries:f.common_entries,entries_from_ours:f.entries_from_ours,entries_from_theirs:f.entries_from_theirs,entries_total:f.entries_total,reanchored:f.reanchored}}else if(n==="relationship"){let f=ve(s,i,c);d=f.merged,l.relationship={strategy:f.strategy,common_entries:f.common_entries,entries_from_ours:f.entries_from_ours,entries_from_theirs:f.entries_from_theirs,entries_total:f.entries_total,reanchored:f.reanchored}}else if(n==="item"){let f=await Ke(t),h=Ee(s,i,c,{format:Qe(e.itemPath??o,f),schema:f?.schema,extensionFieldNames:Y(T()),preferred:r,conflictResolution:"stable_value_order"});d=h.merged,a.push(...h.conflict_fields),l.item={fields_from_theirs:h.fields_from_theirs,union_fields:h.union_fields,conflict_resolution:"stable_value_order"},e.itemPath!==void 0&&(u={cwd:process.cwd(),itemPath:e.itemPath,preferred:r,conflictResolution:"stable_value_order",fieldsFromTheirs:h.fields_from_theirs,unionFields:h.union_fields,decisions:h.conflict_decisions})}else{let f=Oe(s,i,c,{preferred:r});d=f.merged,a.push(...f.conflict_paths),l.json={paths_from_theirs:f.paths_from_theirs}}if(await Ve(o,d,"utf8"),u!==void 0){let f=await pe(u);f!==null&&(l.receipt=$(f))}let m=[];if(a.length>0){let f=l.receipt===void 0?'Run "pm merge report" to inspect clone-local merge evidence.':`Run "pm merge report" and correlate receipt ${l.receipt.receipt_id} with item ${l.receipt.item_id}; clone-local discarded values are never copied into this result.`;m.push(`Both branches changed ${a.join(", ")}; the item driver kept the direction-independent stable value. ${f} Review the merged file, re-apply the discarded change if needed, then "git add" it.`)}return n==="history"&&l.history?.reanchored&&m.push('The merged history chain was re-anchored. Run "pm merge reconcile --dry-run" to inspect the complete post-merge repair, then "pm merge reconcile" to apply it; use --force only after explicitly accepting reported discards.'),{ok:a.length===0,artifact:n,output_path:o,requested_preference:r,conflicts:a,...l,guidance:m,generated_at:C()}}import Fe from"fast-json-patch";(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]="dd5ab9c3-bc6f-59f1-be89-ad0ab2abe7b5")}catch{}})();function Ae(e,t){return t==="body"?e.body:e.metadata[t]}function K(e,t){if(e===void 0||Object.is(e,t))return!0;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let r=new Set;return e.every(o=>{let s=t.findIndex((i,c)=>!r.has(c)&&K(o,i));return s<0?!1:(r.add(s),!0)})}if(e===null||t===null||typeof e!="object"||typeof t!="object"||Array.isArray(t))return!1;let n=t;return Object.entries(e).every(([r,o])=>Object.hasOwn(n,r)&&K(o,n[r]))}function ke(e,t){let n=new Set(t),r=[];for(let o=e.length-1;o>=0&&n.size>0;o-=1){let s=e[o],i=new Set;for(let d of ce(s.patch))i.add(L(d.path)),d.from&&i.add(L(d.from));let c=[...n].filter(d=>i.has(d));if(c.length!==0){for(let d of c)n.delete(d);r.push({index:o+1,ts:s.ts,author:s.author,op:s.op,fields:c.sort((d,u)=>d.localeCompare(u))})}}return r.reverse()}function Ye(e,t,n){let r=Fe.compare(t,n);if(r.length===0)return;let o=new Set;for(let h of r)o.add(L(h.path));let s=new Set([...o].filter(h=>K(Ae(t,h),Ae(n,h)))),i=new Set([...o].filter(h=>!s.has(h))),c=ke(e,i),d=ke(e,s),u=[...o].sort((h,y)=>h.localeCompare(y)),a=[...i].sort((h,y)=>h.localeCompare(y)),l=[...s].sort((h,y)=>h.localeCompare(y)),m=[...new Set(c.map(h=>h.author))].sort((h,y)=>h.localeCompare(y)),f=[...new Set(d.map(h=>h.author))].sort((h,y)=>h.localeCompare(y));return{reconciled_field_count:o.size,reconciled_fields:u,reverted_field_count:i.size,reverted_fields:a,discarded_events:c,discarded_authors:m,preserved_field_count:s.size,preserved_fields:l,preserved_events:d,preserved_authors:f,recovery_hint:c.length>0?"Reconciliation keeps the on-disk item and overwrites these replayed mutations. To recover one, inspect it with pm history <id> --diff --field <field>, then re-apply the lost value with pm update.":null}}async function Ze(e,t,n){let r=e.located?.itemPath??null,o=e.located?await de(e.located,{schema:t.schema}):null;if(!o)return{currentItemReplay:null,currentItemPath:r,matchedChainBefore:null,currentItemRawBeforeLock:null,loadedItem:null};let s=ae(o.document),i=n[n.length-1]?.after_hash;return{currentItemReplay:s,currentItemPath:r,matchedChainBefore:A(s)===i,currentItemRawBeforeLock:o.raw,loadedItem:o}}function et(e){return typeof e.message=="string"&&e.message.trim().length>0?e.message:`history-repair re-anchored ${e.entriesRehashed} entr${e.entriesRehashed===1?"y":"ies"}${e.entriesPatchRepaired>0?`, repaired ${e.entriesPatchRepaired} patch(es)`:""}${e.reconcileNeeded?", reconciled chain with on-disk item":""}.`}function tt(e){let t=[...e.reanchorEntries];if(!e.changed)return{rewrittenEntries:t,auditEntryAdded:!1};let n=e.reconcileNeeded&&e.currentItemReplay?e.currentItemReplay:e.finalReplay;return t.push({ts:C(),author:e.author,op:e.auditOperation,patch:e.reconcileNeeded&&e.currentItemReplay?Fe.compare(e.finalReplay,e.currentItemReplay):[],before_hash:A(e.finalReplay),after_hash:A(n),message:e.message,...e.auditContext===void 0?{}:{context:e.auditContext}}),{rewrittenEntries:t,auditEntryAdded:!0}}function rt(e,t){let n=[];return e||n.push("history_repair_no_changes"),t>0&&n.push(`history_repair_skipped_unresolvable_ops:${t}`),n}async function nt(e){return fe({pmRoot:e.pmRoot,subject:e.subject,settings:e.settings,typeRegistry:e.typeRegistry,historyRawBeforeLock:e.historyRawBeforeLock,currentItemRawBeforeLock:e.currentItemRawBeforeLock,operation:"history-repair",author:e.author,force:e.force,itemDocument:e.loadedItem?.document??null,applyRewrite:async({historyRawUnderLock:t})=>ue({historyPath:e.historyPath,nextHistoryRaw:b(e.rewrittenEntries),historyRawUnderLock:t}),applyPostRewrite:async()=>ee({path:e.historyPath,scope:"project",op:"history_repair:history"})})}async function Q(e,t,n){let r=k(process.cwd(),n.path);if(!await O(F(r)))throw new _(`Tracker is not initialized at ${r}. Run pm init first.`,g.NOT_FOUND);let o=await x(r),s=B(o,T()),i=await me(r,e,o,s.type_to_folder);if(!await O(i.historyPath))throw new _(`No history stream exists for ${i.id}.`,g.NOT_FOUND);let c=await Z(i.historyPath),d=await oe(i.historyPath,i.id);if(d.length===0)throw new _(`No history entries exist for ${i.id}; nothing to repair.`,g.USAGE);let u=U(d),a=M(d),l=await Ze(i,o,d),m=a.finalDocument,f=l.currentItemReplay!==null&&A(m)!==A(l.currentItemReplay),h=f&&l.currentItemReplay?Ye(a.entries,m,l.currentItemReplay):void 0,y=[a.entriesRehashed>0,a.entriesPatchRepaired>0,f,t.forceAuditEntry===!0].some(Boolean),p=te(t.author,o.author_default),w=!!t.dryRun,v=et({message:t.message,entriesRehashed:a.entriesRehashed,entriesPatchRepaired:a.entriesPatchRepaired,reconcileNeeded:f}),{rewrittenEntries:S,auditEntryAdded:xe}=tt({reanchorEntries:a.entries,changed:y,reconcileNeeded:f,currentItemReplay:l.currentItemReplay,finalReplay:m,author:p,message:v,auditOperation:t.auditOperation??"history_repair",auditContext:t.auditContext}),N=U(S);if(!N.ok)throw new _(`history-repair produced an invalid rewritten chain (${N.errors.join(", ")}).`,g.GENERIC_FAILURE);let P=rt(y,a.skippedOps);return h&&h.discarded_events.length>0&&(P.push(`history_repair_reconcile_discards_events:${h.discarded_events.length}`),P.push(`history_repair_discarded_authors:${h.discarded_authors.join(",")}`)),y&&!w&&P.push(...await nt({pmRoot:r,subject:i,settings:o,typeRegistry:s,historyRawBeforeLock:c,currentItemRawBeforeLock:l.currentItemRawBeforeLock,author:p,force:t.force,loadedItem:l.loadedItem,historyPath:i.historyPath,rewrittenEntries:S})),{id:i.id,dry_run:w,changed:y,history:{path:i.historyPath,entries_scanned:d.length,chain_drift_before:!u.ok,entries_rehashed:a.entriesRehashed,entries_patch_repaired:a.entriesPatchRepaired,converted_replace_to_add:a.convertedReplaceToAdd,skipped_ops:a.skippedOps,reconciled_with_item:f,audit_entry_added:xe,verify_ok:N.ok,verify_errors:N.errors},item:{exists:l.currentItemPath!==null,path:l.currentItemPath,matched_chain_before:l.matchedChainBefore},...h?{reconciliation:h}:{},warnings:[...new Set(P)].sort(($e,Ne)=>$e.localeCompare(Ne)),generated_at:C()}}function Gt(e,t){if(t&&e!==void 0)throw new _("history-repair: <id> and --all are mutually exclusive; pass an item id to repair one stream or --all to repair every drifted stream.",g.USAGE);if(!t&&e===void 0)throw new _("history-repair: provide an item <id> or pass --all to repair every drifted stream.",g.USAGE)}async function Te(e,t){let n=k(process.cwd(),t.path);if(!await O(F(n)))throw new _(`Tracker is not initialized at ${n}. Run pm init first.`,g.NOT_FOUND);let r=await x(n),o=B(r,T()),s=[],i=await le(n,r.item_format,o.type_to_folder,s,r.schema,{forceSourceScan:!0}),c=await he(n,i),d=[],u=[],a={repaired:0,skipped_clean:0,failed:0};for(let l of c.driftedItems)try{let m=await Q(l,{...e,auditContext:e.auditContextById?.[l],auditContextById:void 0},t),f=m.changed?"repaired":"skipped_clean";a[f]+=1,u.push(...m.warnings.map(h=>`${l}:${h}`)),d.push({id:l,outcome:f,entries_rehashed:m.history.entries_rehashed,entries_patch_repaired:m.history.entries_patch_repaired,reconciled_with_item:m.history.reconciled_with_item,...m.reconciliation?{reconciliation:m.reconciliation}:{},warnings:m.warnings})}catch(m){a.failed+=1,d.push({id:l,outcome:"failed",error:m instanceof Error?m.message:String(m)})}return e.dryRun||await se(n),{all:!0,dry_run:!!e.dryRun,scanned_streams:i.length,drifted_streams:c.driftedItems.length,streams:d,totals:a,warnings:[...new Set([...s,...u])].sort((l,m)=>l.localeCompare(m)),generated_at:C()}}(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]="c5620467-6c8c-5702-b742-57fba9e302c5")}catch{}})();async function Qt(e,t){let n=e.dryRun===!0,r=await ye(process.cwd(),{includeLossless:!0}),{pendingDecisions:o}=ge(r);if(!n&&e.force!==!0&&o.length>0)throw new _(`Merge reconciliation would accept ${o.length} receipt(s) containing discarded scalar values. Review pm merge report and rerun with --force only after deciding which values to retain or re-apply.`,g.CONFLICT,{code:"merge_reconcile_discards_require_acceptance",required:"Explicitly review every discarded field before accepting reconciliation.",nextSteps:o.map(p=>`Review receipt ${p.id} for ${p.item_id}: ${p.decisions.map(w=>w.field).join(", ")}.`),recovery:{suggested_retry:"pm merge reconcile --dry-run"}});let s=r.reduce((p,w)=>((p[w.item_id]??=[]).push(w),p),{}),i=Object.fromEntries(Object.entries(s).map(([p,w])=>[p,{merge:{receipts:w.map($)}}])),c=await Te({dryRun:n,author:e.author??t.author,message:e.message??"post-merge reconciliation of field-aware tracker history",force:e.force,auditOperation:"merge_reconcile",auditContextById:i},t),d=new Set(c.streams.map(p=>p.id)),u=Object.keys(s).filter(p=>!d.has(p));(await Promise.allSettled(u.map(p=>Q(p,{dryRun:n,author:e.author??t.author,message:e.message??"record field-aware branch merge provenance",force:e.force,auditOperation:"merge_reconcile",auditContext:i[p],forceAuditEntry:!0},t)))).forEach((p,w)=>{let v=u[w];if(p.status==="fulfilled"){let S=p.value.changed?"repaired":"skipped_clean";c.streams.push({id:v,outcome:S,entries_rehashed:p.value.history.entries_rehashed,entries_patch_repaired:p.value.history.entries_patch_repaired,reconciled_with_item:p.value.history.reconciled_with_item,warnings:p.value.warnings}),c.totals[S]+=1}else c.streams.push({id:v,outcome:"failed",error:p.reason instanceof Error?p.reason.message:String(p.reason)}),c.totals.failed+=1});let l=0;!n&&c.totals.failed===0&&(await Promise.all(r.map(p=>_e(process.cwd(),p))),l=r.length);let m=await we({checkHistoryDrift:!0,checkStorageIntegrity:!0},t),f=m.checks.every(p=>p.status==="ok"),h=c.totals.failed===0&&f,y=n?["Review repair.streams, then rerun pm merge reconcile without --dry-run to apply audited repairs.","No Git hook is installed automatically; invoke this command from an explicit post-merge hook only when your repository policy opts in."]:h?["Reconciliation is complete; commit changed history streams with the merge result.","Rerun pm merge reconcile --dry-run after future tracker-data merges as a non-mutating integrity check."]:["Reconciliation remains incomplete; inspect repair failures and non-green validation checks before retrying.","Do not commit repaired history streams as reconciled until pm merge reconcile returns ok=true."];return{ok:h,dry_run:n,repair:c,receipts:{pending_before:r.length,reconciled:l,summaries:r.map($)},validation:m,guidance:y,generated_at:m.generated_at}}export{Re as a,ve as b,je as c,Me as d,Ee as e,Oe as f,Ce as g,Et as h,Q as i,Gt as j,Te as k,Qt as l};
5
+ //# sourceMappingURL=chunk-6MLIRBLV.js.map