@unbrained/pm-cli 2026.10.26 → 2026.10.28

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 (159) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +39 -1
  3. package/dist/cli/commander-usage.js +2 -2
  4. package/dist/cli/error-guidance.js +2 -2
  5. package/dist/cli/register-list-query.js +5 -5
  6. package/dist/cli-bundle/bundle-manifest.json +1 -1
  7. package/dist/cli-bundle/chunks/chunk-2J7I54MQ.js +2 -0
  8. package/dist/cli-bundle/chunks/{chunk-25MTQAHX.js → chunk-3KMYHYJV.js} +2 -2
  9. package/dist/cli-bundle/chunks/chunk-7V37RC2L.js +114 -0
  10. package/dist/cli-bundle/chunks/chunk-AHVN4GHF.js +31 -0
  11. package/dist/cli-bundle/chunks/{chunk-VS2IIV3F.js → chunk-CS7QDSUX.js} +28 -28
  12. package/dist/cli-bundle/chunks/{chunk-T7T4WLUY.js → chunk-CXUQEZDX.js} +3 -3
  13. package/dist/cli-bundle/chunks/{chunk-ZT64RDMF.js → chunk-D3AIQZXF.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-7UDQAINZ.js → chunk-D6P6IBPN.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-TGOG5BFM.js → chunk-DKLEDWVW.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-MWCG25PO.js → chunk-DM3PICGU.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-Y42DYMZX.js → chunk-E5QBZ4HI.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-XAIR53QZ.js → chunk-JESLOJD7.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-57YPOOED.js → chunk-LWW4F4G2.js} +2 -2
  20. package/dist/cli-bundle/chunks/chunk-PQLRKFPZ.js +20 -0
  21. package/dist/cli-bundle/chunks/{chunk-ONC4BBQP.js → chunk-RZQNFHXO.js} +2 -2
  22. package/dist/cli-bundle/chunks/chunk-SPPHDVZE.js +2 -0
  23. package/dist/cli-bundle/chunks/{chunk-ER7RLJW5.js → chunk-TH5KPAN4.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-OCDRHIVQ.js → chunk-XHONSCLJ.js} +6 -6
  25. package/dist/cli-bundle/chunks/{chunk-NGKTROAO.js → chunk-YUBUNECD.js} +42 -42
  26. package/dist/cli-bundle/chunks/{chunk-Z35XAHUN.js → chunk-YYD5MNAV.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-UF6EXZSP.js → chunk-ZX3XMTZG.js} +2 -2
  28. package/dist/cli-bundle/chunks/indexed-receipt-blobs-LHLE7PSG.js +4 -0
  29. package/dist/cli-bundle/chunks/{mutation-admission-VTNV6JV2.js → mutation-admission-GKDKHRTZ.js} +2 -2
  30. package/dist/cli-bundle/chunks/{register-list-query-LZDWUZS4.js → register-list-query-MHJJUM6M.js} +9 -9
  31. package/dist/cli-bundle/chunks/{register-mutation-M2A7PH42.js → register-mutation-SN425O3R.js} +2 -2
  32. package/dist/cli-bundle/chunks/{register-operations-E7P2JTXM.js → register-operations-EYUIUGPW.js} +2 -2
  33. package/dist/cli-bundle/chunks/{register-setup-DOV7KGSH.js → register-setup-WUZ2ZSMY.js} +2 -2
  34. package/dist/cli-bundle/chunks/{settlement-hook-SVD6CO7U.js → settlement-hook-MN3Y7LVX.js} +2 -2
  35. package/dist/cli-bundle/chunks/{stage-LYLEOAQB.js → stage-2FYJGGG3.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-3EHVI673.js +2 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-46WLWK73.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-E5C24MCV.js → chunk-4GN2ZPT5.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-NLZUI234.js → chunk-6L4KKRK7.js} +18 -18
  40. package/dist/cli-bundle/focused-chunks/{chunk-D5YQ4KAE.js → chunk-6VDRAJYX.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-KTXU5WU6.js → chunk-7SZPZOIC.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-YQKLKRMW.js → chunk-B4ZQJEMT.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/{chunk-NE27VCU7.js → chunk-BZSACRVX.js} +3 -3
  44. package/dist/cli-bundle/focused-chunks/{chunk-ADSBGYLW.js → chunk-C2GLO7HU.js} +55 -55
  45. package/dist/cli-bundle/focused-chunks/{chunk-UP765R2V.js → chunk-DRN4W3YJ.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-EGN2HFRU.js +2 -0
  47. package/dist/cli-bundle/focused-chunks/{chunk-CSCZYSNZ.js → chunk-F6UQJJYB.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/{chunk-I7H3XF25.js → chunk-I4X6AKOO.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-IQKLJFJE.js +79 -0
  50. package/dist/cli-bundle/focused-chunks/{chunk-KERJNFXY.js → chunk-JTCGDODH.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-IF6C43IP.js → chunk-L5GX2FGZ.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{chunk-PK5FJIVA.js → chunk-LPWZERVD.js} +11 -11
  53. package/dist/cli-bundle/focused-chunks/{chunk-YW5GHQN2.js → chunk-ML5JIUM6.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-BL77VCRB.js → chunk-OASYSUOH.js} +16 -16
  55. package/dist/cli-bundle/focused-chunks/{chunk-BH7RE2ZY.js → chunk-ON5WFDCG.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-WDWHUJQW.js → chunk-QUPGBO2L.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-226XKW3W.js → chunk-R3EA3SDW.js} +3 -3
  58. package/dist/cli-bundle/focused-chunks/{chunk-B266DDBJ.js → chunk-TUN4M757.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{chunk-YTEC2EPM.js → chunk-Z26ZPQH6.js} +3 -3
  60. package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-5H6RMRTK.js +4 -0
  61. package/dist/cli-bundle/focused-chunks/{mutation-admission-L42E3U5U.js → mutation-admission-TM3SVU2O.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{settlement-hook-3CADO4XZ.js → settlement-hook-LBVWWSCF.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{stage-TUQHWU7N.js → stage-7ZBRX2Q2.js} +2 -2
  64. package/dist/cli-bundle/main.js +21 -21
  65. package/dist/cli-bundle/sdk-authoring.js +1 -1
  66. package/dist/cli-bundle/sdk-contracts.js +2 -2
  67. package/dist/cli-bundle/sdk-core.js +34 -33
  68. package/dist/cli-bundle/sdk-governance.js +1 -1
  69. package/dist/cli-bundle/sdk-graph.js +1 -1
  70. package/dist/cli-bundle/sdk-merge.js +57 -57
  71. package/dist/cli-bundle/sdk-query.js +1 -1
  72. package/dist/cli-bundle/sdk-runtime.js +1 -1
  73. package/dist/cli-bundle/sdk-testing.js +1 -1
  74. package/dist/cli-bundle/sdk.js +11 -11
  75. package/dist/core/history/event-index.d.ts +6 -0
  76. package/dist/core/history/event-index.js +7 -6
  77. package/dist/core/history/read.d.ts +3 -1
  78. package/dist/core/history/read.js +1 -1
  79. package/dist/core/item/priority.js +1 -1
  80. package/dist/core/shared/errors.d.ts +2 -0
  81. package/dist/core/shared/errors.js +1 -1
  82. package/dist/core/store/item-store.js +1 -1
  83. package/dist/mcp/tool-definitions.js +1 -1
  84. package/dist/sdk/agent/command-recovery.d.ts +5 -0
  85. package/dist/sdk/agent/command-recovery.js +1 -1
  86. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  87. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  88. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
  89. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  90. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  91. package/dist/sdk/command-line.d.ts +6 -0
  92. package/dist/sdk/command-line.js +1 -1
  93. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  94. package/dist/sdk/index.d.ts +1 -1
  95. package/dist/sdk/index.js +1 -1
  96. package/dist/sdk/lifecycle/close.js +1 -1
  97. package/dist/sdk/lifecycle/create.js +1 -1
  98. package/dist/sdk/lifecycle/update-many.js +1 -1
  99. package/dist/sdk/lifecycle/update.js +1 -1
  100. package/dist/sdk/merge/indexed-receipt-blobs.d.ts +3 -1
  101. package/dist/sdk/merge/indexed-receipt-blobs.js +2 -2
  102. package/dist/sdk/merge/receipt-file-boundary.d.ts +2 -0
  103. package/dist/sdk/merge/receipt-file-boundary.js +1 -1
  104. package/dist/sdk/merge/receipts.js +2 -2
  105. package/dist/sdk/mutation-events.d.ts +6 -0
  106. package/dist/sdk/mutation-events.js +1 -1
  107. package/dist/sdk/public-surface.json +1 -1
  108. package/dist/sdk/query/history.d.ts +4 -0
  109. package/dist/sdk/query/history.js +1 -1
  110. package/dist/sdk/runtime/actions.js +1 -1
  111. package/dist/sdk/runtime-extended-actions.js +1 -1
  112. package/dist/sdk/runtime.js +1 -1
  113. package/dist/sdk/test/command-resolution.d.ts +5 -0
  114. package/dist/sdk/test/command-resolution.js +3 -0
  115. package/dist/sdk/test/execution.js +3 -3
  116. package/dist/sdk/test/receipt-index-snapshot.d.ts +2 -0
  117. package/dist/sdk/test/receipt-index-snapshot.js +2 -0
  118. package/dist/sdk/test/workspace-snapshot.d.ts +1 -1
  119. package/dist/sdk/test/workspace-snapshot.js +1 -1
  120. package/docs/COMMANDS.md +28 -1
  121. package/docs/PERFORMANCE.md +21 -6
  122. package/docs/RELEASING.md +11 -0
  123. package/docs/SDK.md +40 -0
  124. package/docs/SDK_CONTEXT_COORDINATION.md +35 -4
  125. package/docs/TESTING.md +42 -3
  126. package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
  127. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
  128. package/marketplace.json +1 -1
  129. package/package.json +1 -1
  130. package/packages/pm-beads/package.json +1 -1
  131. package/packages/pm-calendar/package.json +1 -1
  132. package/packages/pm-command-kit/package.json +1 -1
  133. package/packages/pm-digital-twin/package.json +1 -1
  134. package/packages/pm-governance-audit/package.json +1 -1
  135. package/packages/pm-guide-shell/package.json +1 -1
  136. package/packages/pm-kanban/package.json +1 -1
  137. package/packages/pm-lifecycle-hooks/package.json +1 -1
  138. package/packages/pm-linked-test-adapters/package.json +1 -1
  139. package/packages/pm-search-advanced/package.json +1 -1
  140. package/packages/pm-templates/package.json +1 -1
  141. package/packages/pm-todos/package.json +1 -1
  142. package/packages/pm-vcs/package.json +1 -1
  143. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  144. package/plugins/pm-claude/package.json +1 -1
  145. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  146. package/plugins/pm-codex/package.json +1 -1
  147. package/plugins/pm-codex/plugin.json +1 -1
  148. package/runtime-dependencies.json +1 -1
  149. package/dist/cli-bundle/chunks/chunk-N6FTEILW.js +0 -20
  150. package/dist/cli-bundle/chunks/chunk-OUDR2HWR.js +0 -113
  151. package/dist/cli-bundle/chunks/chunk-RUKSEZE7.js +0 -2
  152. package/dist/cli-bundle/chunks/chunk-YJBIPNDL.js +0 -2
  153. package/dist/cli-bundle/chunks/chunk-ZLVFUZI4.js +0 -30
  154. package/dist/cli-bundle/chunks/indexed-receipt-blobs-NWQIDTH7.js +0 -4
  155. package/dist/cli-bundle/focused-chunks/chunk-ABMNYWV6.js +0 -2
  156. package/dist/cli-bundle/focused-chunks/chunk-NFN2P4TW.js +0 -2
  157. package/dist/cli-bundle/focused-chunks/chunk-UHWTPOM4.js +0 -78
  158. package/dist/cli-bundle/focused-chunks/chunk-VVRXF4JO.js +0 -2
  159. package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-YFDNGHCM.js +0 -4
@@ -1,4 +1,4 @@
1
- import{D as p,y as h,z as u}from"./chunk-KTXU5WU6.js";import{readFile as b,realpath as y,stat as _,writeFile as $}from"node:fs/promises";import l from"node:path";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="38df9536-d87a-52ac-958d-091a17c9da9c")}catch{}})();var d="# pm-cli:runtime-cache:start",f="# pm-cli:runtime-cache:end",E=".agents/pm";async function m(n){let e=l.resolve(n),t=[];for(;;)try{let i=await y(e);if(!(await _(i)).isDirectory())throw Object.assign(new Error("Initialization path ancestry must be a directory."),{code:"ENOTDIR"});return l.join(i,...t)}catch(i){if(!p(i)||l.dirname(e)===e)throw i;t.unshift(l.basename(e)),e=l.dirname(e)}}var R=["runtime/","search/","locks/","transactions/","checkpoints/"],T=["search/eval-queries.json"];async function w(n){try{return await n()}catch(e){throw e instanceof Error&&"code"in e&&typeof e.code=="string"&&["EACCES","EPERM","EROFS"].includes(e.code)?new u("The workspace .gitignore is not writable.",h.GENERIC_FAILURE,{code:"init_gitignore_unwritable",reason:e.code.toLowerCase(),required:"Grant the current user read and write access to the workspace .gitignore before initialization.",why:"pm init must publish its managed runtime-cache ignore fence without replacing unrelated entries.",nextSteps:["Grant read and write access to the workspace .gitignore and rerun pm init.","If the workspace is intentionally read-only, initialize pm in a writable workspace or clone."]}):e}}function I(n){let e=n.split(l.sep).join("/").replace(/^\.\/+/,""),t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}function k(n){let e=n.replaceAll("\\","/");return l.isAbsolute(n)||e===".."||e.startsWith("../")}function G(n=E){let e=I(n);if(/[\r\n]/u.test(e))throw new u("A tracker path containing a line break cannot be represented safely in .gitignore.",h.USAGE,{code:"invalid_argument_value",required:"a tracker path without line breaks",nextSteps:["Choose a tracker path without carriage returns or newlines and rerun pm init."]});let t=e.replace(/[\\*?[\]#! \t]/gu,"\\$&");return[d,...R.map(i=>i==="search/"?`${t}/${i}*`:`${t}/${i}`),...T.map(i=>`!${t}/${i}`),f].join(`
1
+ import{D as p,y as h,z as u}from"./chunk-7SZPZOIC.js";import{readFile as b,realpath as y,stat as _,writeFile as $}from"node:fs/promises";import l from"node:path";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="38df9536-d87a-52ac-958d-091a17c9da9c")}catch{}})();var d="# pm-cli:runtime-cache:start",f="# pm-cli:runtime-cache:end",E=".agents/pm";async function m(n){let e=l.resolve(n),t=[];for(;;)try{let i=await y(e);if(!(await _(i)).isDirectory())throw Object.assign(new Error("Initialization path ancestry must be a directory."),{code:"ENOTDIR"});return l.join(i,...t)}catch(i){if(!p(i)||l.dirname(e)===e)throw i;t.unshift(l.basename(e)),e=l.dirname(e)}}var R=["runtime/","search/","locks/","transactions/","checkpoints/"],T=["search/eval-queries.json"];async function w(n){try{return await n()}catch(e){throw e instanceof Error&&"code"in e&&typeof e.code=="string"&&["EACCES","EPERM","EROFS"].includes(e.code)?new u("The workspace .gitignore is not writable.",h.GENERIC_FAILURE,{code:"init_gitignore_unwritable",reason:e.code.toLowerCase(),required:"Grant the current user read and write access to the workspace .gitignore before initialization.",why:"pm init must publish its managed runtime-cache ignore fence without replacing unrelated entries.",nextSteps:["Grant read and write access to the workspace .gitignore and rerun pm init.","If the workspace is intentionally read-only, initialize pm in a writable workspace or clone."]}):e}}function I(n){let e=n.split(l.sep).join("/").replace(/^\.\/+/,""),t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}function k(n){let e=n.replaceAll("\\","/");return l.isAbsolute(n)||e===".."||e.startsWith("../")}function G(n=E){let e=I(n);if(/[\r\n]/u.test(e))throw new u("A tracker path containing a line break cannot be represented safely in .gitignore.",h.USAGE,{code:"invalid_argument_value",required:"a tracker path without line breaks",nextSteps:["Choose a tracker path without carriage returns or newlines and rerun pm init."]});let t=e.replace(/[\\*?[\]#! \t]/gu,"\\$&");return[d,...R.map(i=>i==="search/"?`${t}/${i}*`:`${t}/${i}`),...T.map(i=>`!${t}/${i}`),f].join(`
2
2
  `)}function O(n,e,t){let i=e.replace(/[\\*?[\]#! \t]/gu,"\\$&"),o=[...new Set([e,i])].flatMap(s=>R.flatMap(c=>[`${s}/${c}`,`!${s}/${c}`])),a=[],r=!1;for(let s of n)o.some(c=>s.startsWith(c))?(r||a.push(...t),r=!0):a.push(s);return r||a.push(...t),a}function P(n){let e=[],t=-1,i=0,o=0;for(let a of n.split(`
3
3
  `)){let r=a.endsWith("\r")?a.slice(0,-1):a;r===d?(t=o,i=o+a.length+1):r===f&&t>=0&&(e.push({index:t,end:o+r.length,lines:n.slice(i,o).split(/\r?\n/u).filter(s=>s.length>0)}),t=-1),o+=a.length+1}return e}function v(n,e){let t=n.includes(`\r
4
4
  `)?`\r
@@ -6,4 +6,4 @@ import{D as p,y as h,z as u}from"./chunk-KTXU5WU6.js";import{readFile as b,realp
6
6
  `,i=G(e).split(`
7
7
  `).slice(1,-1),o=P(n),a=o.flatMap(c=>c.lines),r=[d,...O(a,e,i),f].join(t);if(o.length===0){let c=n.length===0?"":n.endsWith(`
8
8
  `)?t:`${t}${t}`;return`${n}${c}${r}${t}`}let s=n;for(let[c,g]of[...o.entries()].reverse())s=`${s.slice(0,g.index)}${c===0?r:""}${s.slice(g.end)}`;return s}async function S(n,e={}){let t=l.join(n,".gitignore"),i=E;if(e.pmRoot!==void 0){let r=I(l.relative(await m(n),await m(e.pmRoot)));if(k(r))return{path:t,changed:!1};i=r}let o="";try{o=await w(()=>b(t,"utf8"))}catch(r){if(!(r instanceof Error&&"code"in r&&p(r)))throw r}let a=v(o,i);return a===o?{path:t,changed:!1}:(await w(()=>$(t,a,"utf8")),{path:t,changed:!0})}export{R as a,k as b,S as c};
9
- //# sourceMappingURL=chunk-BH7RE2ZY.js.map
9
+ //# sourceMappingURL=chunk-ON5WFDCG.js.map
@@ -1,4 +1,4 @@
1
- import{f as w,i as y,j,k as B,l as U,o as f,p as X,q as W,r as Y}from"./chunk-YQKLKRMW.js";import{U as H,a as $,b as D}from"./chunk-YTEC2EPM.js";import{c as u,f as M,g as z,i as q}from"./chunk-E5C24MCV.js";import{Va as F,q as L,t as R}from"./chunk-ABMNYWV6.js";import{a as g,d as K}from"./chunk-B266DDBJ.js";import{da as k,g as P}from"./chunk-NLZUI234.js";import{a as N,e as O,f as A,g as x,i as C}from"./chunk-KTXU5WU6.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]="3ec1f825-59d1-5ce2-ac76-c628264bd8be")}catch{}})();var Ce=N,Pe=O,$e=C,De=A,Le=x;function G(e,t,n,r){let s=e.flag.slice(2).replace(/[-_]([a-z])/gu,(a,i)=>i.toUpperCase()),o=n.has(s);return{long:t,...r?{short:r}:{},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(s=>s.keys)),r=[];for(let s of L(e.map(o=>({...o})))){r.push(G(s,s.flag,n,s.short));for(let o of s.aliases??[])r.push(G(s,o,n))}return r}var Re=Q(R,$),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]="59d16a38-d6df-5695-96e3-28b6e384f76b")}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 y,j,k as B,l as U,o as f,p as X,q as W,r as Y}from"./chunk-B4ZQJEMT.js";import{U as H,a as $,b as D}from"./chunk-Z26ZPQH6.js";import{c as u,f as M,g as z,i as q}from"./chunk-4GN2ZPT5.js";import{Va as F,q as L,t as R}from"./chunk-46WLWK73.js";import{a as g,d as K}from"./chunk-TUN4M757.js";import{da as k,g as P}from"./chunk-6L4KKRK7.js";import{a as N,e as O,f as A,g as x,i as C}from"./chunk-7SZPZOIC.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]="3ec1f825-59d1-5ce2-ac76-c628264bd8be")}catch{}})();var Ce=N,Pe=O,$e=C,De=A,Le=x;function G(e,t,n,r){let s=e.flag.slice(2).replace(/[-_]([a-z])/gu,(a,i)=>i.toUpperCase()),o=n.has(s);return{long:t,...r?{short:r}:{},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(s=>s.keys)),r=[];for(let s of L(e.map(o=>({...o})))){r.push(G(s,s.flag,n,s.short));for(let o of s.aliases??[])r.push(G(s,o,n))}return r}var Re=Q(R,$),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]="59d16a38-d6df-5695-96e3-28b6e384f76b")}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 y,j,k as B,l as U,o as f,p as X,q as W,r as Y}from"./chunk-YQ
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 je(){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 re(e=[]){let t=_.map(o=>({definition:I[o],source:"builtin"})),n=new Set(_.map(o=>p(o))),r=new Set(n),s=[];for(let o of e){let a=p(o.profile.name);if(n.has(a)){s.push(`Extension "${o.name}" profile "${o.profile.name}" uses a name reserved by a built-in archetype and was ignored.`);continue}if(r.has(a)){s.push(`Profile "${o.profile.name}" from extension "${o.name}" duplicates an already-registered profile and was ignored.`);continue}r.add(a),t.push({definition:o.profile,source:"extension",package:o.name})}return{profiles:t,warnings:s}}function Be(e,t=[]){let{profiles:n,warnings:r}=re(t);if(typeof e!="string"||e.trim().length===0)throw new Error(`Profile name is required. Allowed: ${J(n)}.`);let s=p(e),o=n.find(a=>p(a.definition.name)===s);if(o===void 0)throw new Error(`Invalid profile "${e}". Allowed: ${J(n)}.`);return{resolved:o,warnings:r}}(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]="ab26bcb3-fb2a-5f2f-96e7-7965787b924e")}catch{}})();function se(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:se(e),types:e.types.map(t=>S(()=>u(t).name,()=>String(t.name??""))),statuses:e.statuses.map(t=>S(()=>f(t).id,()=>String(t.id??""))),fields:e.fields.map(t=>S(()=>y(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]="d681ddfe-ad15-527b-90de-bfbe341c6a86")}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_default_mode",path:"search.default_mode",kind:"string",choices:["auto","keyword","semantic","hybrid"],summary:"Mode a bare pm search runs in: auto (hybrid when semantic search is explicitly configured and runnable, else keyword), or a pinned keyword, semantic, or hybrid."},{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:"agent_identity_probes_enabled",path:"agent_identity.probes_enabled",kind:"boolean",summary:"Allow privacy-bounded local harness provenance probes; no network or subprocess access is permitted."},{key:"mutation_guard_require_attributed_author",path:"mutation_guard.require_attributed_author",kind:"boolean",summary:"Reject mutations whose effective author resolves to unknown."},{key:"mutation_guard_secret_guard",path:"mutation_guard.secret_guard",kind:"string",choices:["off","advise","block"],summary:"Detect credential-shaped mutation content: off, advise, or block."},{key:"mutation_guard_stale_in_progress_hours",path:"mutation_guard.stale_in_progress_hours",kind:"integer",min:1,summary:"Age threshold for unclaimed in-progress work surfaced by health."},{key:"governance_duplicate_detection_mode",path:"governance.duplicate_detection_mode",kind:"string",choices:["off","advisory","strict"],summary:"Create/copy duplicate governance: off, advisory, or strict explicit-bypass enforcement."},{key:"governance_duplicate_detection_threshold",path:"governance.duplicate_detection_threshold",kind:"ratio",summary:"Minimum shared similarity score in [0, 1] for create/copy duplicate governance."},{key:"governance_duplicate_detection_limit",path:"governance.duplicate_detection_limit",kind:"integer",min:0,max:20,summary:"Maximum likely duplicates returned by create/copy governance (0-20)."},{key:"output_default_format",path:"output.default_format",kind:"string",choices:["toon","json"],summary:"Default output format for commands that support it: toon or json."},{key:"ux_deprecation_hints",path:"ux.deprecation_hints",kind:"boolean",summary:"Emit one stderr migration hint for deprecated command aliases."},{key:"locks_ttl_seconds",path:"locks.ttl_seconds",kind:"integer",min:1,summary:"Claim/lock time-to-live in seconds before a stale lock can be reclaimed."},{key:"locks_wait_ms",path:"locks.wait_ms",kind:"integer",min:0,summary:"Wait budget in milliseconds before a contended lock fails with lock_conflict; item-store mutations, restore and the hierarchy lock treat it as a no-progress window that each observed owner handoff restarts (120 s total cap), other locks as a fixed total; 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)."}],ae=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 ae.get(t)}function ie(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 r=Number(n);return Number.isFinite(r)?{ok:!0,value:r}:{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 ie(e,t);if(e.kind==="string")return le(e,t,n);let r=de(e,t,n);return r.ok?e.kind==="integer"?ce(e,t,r.value):e.kind==="ratio"?me(e,t,r.value):pe(e,t,r.value):{ok:!1,error:r.error}}function V(e,t){let n=t.path.split("."),r=e;for(let s of n){if(typeof r!="object"||r===null)return null;let o=Object.getOwnPropertyDescriptor(r,s);if(!o||!Object.hasOwn(o,"value"))return null;r=o.value}return typeof r=="string"||typeof r=="number"||typeof r=="boolean"?r:null}function Ge(e,t,n){let r=t.path.split(".");if(r.some(a=>a.length===0||["__proto__","constructor","prototype"].includes(a)))throw new Error("Unsafe settings path");let s=e;for(let a=0;a<r.length-1;a+=1){let i=r[a],d=Object.getOwnPropertyDescriptor(s,i)?.value;if(typeof d!="object"||d===null||Array.isArray(d)){let c={};Object.defineProperty(s,i,{value:c,writable:!0,enumerable:!0,configurable:!0}),s=c}else s=d}let o=r[r.length-1];return Object.getOwnPropertyDescriptor(s,o)?.value===n?!1:(Object.defineProperty(s,o,{value:n,writable:!0,enumerable:!0,configurable:!0}),!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]="0b04624c-2096-55dc-9dde-b8c76ead72d6")}catch{}})();var it=["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(P.map(e=>e.toLowerCase()));function ye(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 fe(e,t){let n=new Set,r=new Set;for(let[s,o]of e.types.entries()){let a;try{a=u(o).name}catch(d){t.push({severity:"error",code:"type_invalid",dimension:"types",target:typeof o.name=="string"?o.name:`#${s}`,message:k(d)});continue}let i=a.toLowerCase();if(r.has(i)){t.push({severity:"error",code:"type_duplicate",dimension:"types",target:a,message:`Item type "${a}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}r.add(i),n.add(i)}return n}function he(e,t){let n=new Set,r=new Set;for(let[s,o]of e.statuses.entries()){let a;try{a=f(o)}catch(i){t.push({severity:"error",code:"status_invalid",dimension:"statuses",target:typeof o.id=="string"?o.id:`#${s}`,message:k(i)});continue}if(r.has(a.id)){t.push({severity:"error",code:"status_duplicate",dimension:"statuses",target:a.id,message:`Status "${a.id}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}r.add(a.id),n.add(a.id);for(let i of a.aliases??[])n.add(g(i))}return n}function ge(e,t){let n=new Set;for(let[r,s]of e.fields.entries()){let o;try{o=y(s).key}catch(i){t.push({severity:"error",code:"field_invalid",dimension:"fields",target:typeof s.key=="string"?s.key:`#${r}`,message:k(i)});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 a=H(o);a&&t.push({severity:"warning",code:"field_mcp_input_collision",dimension:"fields",target:o,message:`Field "${o}" collides with canonical MCP property "${a.property}" owned by ${a.owner}; callers must pass the custom value through ${a.nested_path}.`})}}function _e(e,t,n,r){let s=new Set;for(let[o,a]of e.workflows.entries()){let i=a.type.trim().toLowerCase();if(i.length===0){r.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 d=s.has(i);s.add(i),d?r.push({severity:"warning",code:"workflow_duplicate_type",dimension:"workflows",target:a.type,message:`Workflow type "${a.type}" is declared more than once; the later transition set wins.`}):!Z.has(i)&&!t.has(i)&&r.push({severity:"warning",code:"workflow_type_unknown",dimension:"workflows",target:a.type,message:`Workflow governs type "${a.type}" which is neither a built-in type nor declared by this profile; it has no effect unless that type already exists.`});let c=new Set;for(let l of a.allowed_transitions){let m=g(l[0]),T=g(l[1]);if(m.length===0||T.length===0){r.push({severity:"error",code:"workflow_transition_malformed",dimension:"workflows",target:a.type,message:`Workflow "${a.type}" has a transition with an empty status; the workflow resolver silently drops it.`});continue}for(let h of[m,T])ue.has(h)||n.has(h)||c.has(h)||(c.add(h),r.push({severity:"warning",code:"workflow_status_unknown",dimension:"workflows",target:h,message:`Workflow "${a.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 r of e.config){let s=b(r.key);if(s===void 0){t.push({severity:"error",code:"config_key_unknown",dimension:"config",target:r.key,message:`Config knob "${r.key}" is not a recognized setting; apply rejects it with a usage error.`});continue}n.has(s.key)?t.push({severity:"error",code:"config_duplicate",dimension:"config",target:s.key,message:`Config knob "${s.key}" is set more than once; the later value silently overwrites the earlier one.`}):n.add(s.key);let o=v(s,r.value);o.ok||t.push({severity:"error",code:"config_value_invalid",dimension:"config",target:r.key,message:o.error.message})}}function we(e,t,n){for(let r of e.templates){let s=r.options.type;if(typeof s!="string"||s.trim().length===0)continue;let o=s.trim().toLowerCase();!Z.has(o)&&!t.has(o)&&n.push({severity:"warning",code:"template_type_unknown",dimension:"templates",target:r.name,message:`Template "${r.name}" creates type "${s}" which is neither a built-in type nor declared by this profile.`})}}function be(e,t){for(let[n,r]of e.packages.entries())r.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=[];ye(e,t);let n=fe(e,t),r=he(e,t);ge(e,t),_e(e,n,r,t),ke(e,t),we(e,n,t),be(e,t);let s=t.filter(a=>a.severity==="error").length,o=t.length-s;return{profile:e.name,ok:s===0,findings:t,errorCount:s,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]="be2b507d-2797-570c-b211-46d950edcbde")}catch{}})();function E(e,t,n,r,s){let o=e,a=[];for(let i of t){let d=r(o),c=s(o,i),l=r(c.file);o=c.file;let m=d===l?"unchanged":c.replaced?"update":"add";a.push({key:n(i),status:m})}return{file:o,changes:a,changed:a.some(i=>i.status!=="unchanged")}}function ee(e){return JSON.stringify(e.map(t=>t.join("\0")).sort())}function ve(e,t){let n=e.map(s=>({...s})),r=[];for(let s of t){let o=n.findIndex(i=>i.type===s.type),a={type:s.type,allowed_transitions:s.allowed_transitions};o<0?(n.push(a),r.push({type:s.type,status:"add"})):ee(n[o].allowed_transitions)===ee(s.allowed_transitions)?r.push({type:s.type,status:"unchanged"}):(n[o]=a,r.push({type:s.type,status:"update"}))}return{changes:r,result:n,changed:r.some(s=>s.status!=="unchanged")}}function Ie(e,t){let n=[];for(let r of e.config){let s=b(r.key);if(s===void 0)throw new Error(`Profile "${e.name}" references unknown config key "${r.key}".`);let o=v(s,r.value);if(!o.ok)throw new Error(`Profile "${e.name}" config ${r.key}: ${o.error.message}`);let a=V(t,s),i=a===null?"add":a===o.parsed.value?"unchanged":"update";n.push({key:s.key,path:s.path,value:o.parsed.value,status:i})}return{changes:n,changed:n.some(r=>r.status!=="unchanged")}}function te(e){let t=Object.entries(e).sort(([n],[r])=>n.localeCompare(r));return JSON.stringify(t)}function Se(e,t){let n=[];for(let r of e.templates){let s=t.get(r.name),o;s===void 0?o="add":te(s)===te(r.options)?o="unchanged":o="update",n.push({name:r.name,options:r.options,status:o})}return{changes:n,changed:n.some(r=>r.status!=="unchanged")}}function ft(e,t){let n=E(M(t.typesRaw),e.types,l=>u(l).name,q,(l,m)=>z(l,u(m))),r=E(X(t.statusesRaw),e.statuses,l=>f(l).id,W,(l,m)=>Y(l,f(m))),s=E(j(t.fieldsRaw),e.fields,l=>y(l).key,B,(l,m)=>U(l,y(m))),o=ve(t.workflows,e.workflows),a=Ie(e,t.settings),i=Se(e,t.templates),d=e.packages.map(l=>({spec:l.spec,reason:l.reason,status:t.installedPackages.has(l.spec)?"installed":"recommended"})),c=n.changed||r.changed||s.changed||o.changed||a.changed||i.changed;return{profile:{name:e.name,title:e.title,summary:e.summary},types:n,statuses:r,fields:s,workflows:o,config:a,templates:i,packages:d,changed:c}}export{Ce as a,Pe as b,$e 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,je as m,re as n,Be as o,se as p,Ye as q,oe as r,b as s,v as t,V as u,Ge as v,it as w,lt as x,dt as y,ft as z};
26
- //# sourceMappingURL=chunk-WDWHUJQW.js.map
26
+ //# sourceMappingURL=chunk-QUPGBO2L.js.map
@@ -1,8 +1,8 @@
1
- import{b as K}from"./chunk-BH7RE2ZY.js";import{Wa as H,_a as P,aa as U,ab as L,db as V}from"./chunk-UHWTPOM4.js";import{Kd as $,Z as G,qa as B,wa as E,wd as W}from"./chunk-NLZUI234.js";import{a as X,b as y,c as q}from"./chunk-FOA7XKWP.js";import{B as S,D as j,E as F,H as N,y as w,z as v}from"./chunk-KTXU5WU6.js";import{access as le,readFile as A,realpath as _}from"node:fs/promises";import{constants as ue}from"node:fs";import{execFile as me}from"node:child_process";import c from"node:path";import{promisify as de}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="6d1f8e03-97b4-5d83-b85c-e47f39c07d48")}catch{}})();var se="PM_SOURCE_CONTEXT_ACCESS",ce="PM_ALLOW_SOURCE_CONTEXT_WRITES";function z(e){let r=e[se],i=r===void 0||r.trim().toLowerCase()==="write"?"write":"read_only",t=i==="read_only"&&e[ce]?.trim()==="1";return{access:i,write_override_applied:t,source_writes_allowed:i==="write"||t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="b1828465-0619-514c-8956-2a81dea9efbc")}catch{}})();var k=de(me),T="# pm-cli:merge-drivers:start",pe="# pm-cli:merge-drivers:end",x="# pm-cli:merge-drivers:v2:start",Q="# pm-cli:merge-drivers:v2:end",fe="merge-fence",ge="merge-attributes";function R(e){return`'${e.replaceAll("'",`'"'"'`)}'`}async function he(e,r){let i=await _(e);if(/(?:^|[\\/])bun-node-[^\\/]+[\\/]bun(?:\.exe)?$/iu.test(i))return;let{stdout:t}=await k(e,["--version"],{encoding:"utf8",windowsHide:!0,timeout:1e4});return t.trim()===r?i:void 0}async function ye(){let e=G(import.meta.url,["../../.."]),r=process.execPath,i=!1,t=await _(process.execPath),o=process.versions.bun,n=(process.env.PATH??"").split(c.delimiter).filter(a=>c.isAbsolute(a)).map(a=>c.join(a,o===void 0?c.basename(process.execPath):process.platform==="win32"?"bun.exe":"bun")),s=o===void 0?n:[process.env.npm_execpath??"",...n,t].filter(a=>c.isAbsolute(a)&&/^(?:bun|bun\.exe)$/iu.test(c.basename(a)));for(let a of s)try{if(await le(a,ue.X_OK),o!==void 0){let d=await he(a,o);if(d!==void 0){r=d,i=!0;break}continue}if(a!==t&&await _(a)===t){r=a;break}}catch{}if(o!==void 0&&!i)throw new v("Cannot install Bun merge drivers without a durable executable matching the current Bun version.",w.DEPENDENCY_FAILED,{code:"merge_bun_launcher_unavailable",why:"The current Bun process may be a temporary bunx launcher that Git cannot reuse after this command exits.",nextSteps:["Run with a durable version-matched Bun executable, expose one on an absolute PATH entry, or invoke pm through a Bun runner that publishes an absolute npm_execpath.","Retry pm merge install, then check pm health --strict-exit before merging branches."]});return`${R(r)} ${R(c.join(e,"dist","cli.js"))}`}var Z=[{key:"pm-item-toon",name:"pm field-aware TOON item document merge",artifact:"item",itemPath:"%P"},{key:"pm-item-markdown",name:"pm field-aware JSON-markdown item document merge",artifact:"item",itemPath:"%P"},{key:"pm-history",name:"pm append-only history stream merge",artifact:"history",itemPath:void 0},{key:"pm-relationship",name:"pm append-only relationship event store merge",artifact:"relationship",itemPath:void 0},{key:"pm-json",name:"pm key-level JSON config merge",artifact:"json",itemPath:void 0}];function we(e){let r=e.explicitPath?.trim(),i=e.environment.PM_SOURCE_WORKSPACE_ROOT?.trim(),t=e.environment.PM_SOURCE_PM_PATH?.trim(),o=z(e.environment),n=!!(i&&t),s=r===void 0&&n&&(e.dryRun||o.source_writes_allowed);if(r!==void 0){let a=E(e.cwd,r);return{pm_root:a,workspace_start:a,source_coordinates_available:n,source_context_selected:!1,source_policy:o}}return s?{pm_root:c.resolve(t),workspace_start:c.resolve(i),source_coordinates_available:!0,source_context_selected:!0,source_policy:o}:{pm_root:n?E(e.cwd,".agents/pm"):E(e.cwd),workspace_start:e.cwd,source_coordinates_available:n,source_context_selected:!1,source_policy:o}}async function ee(e){try{let{stdout:r}=await k("git",["rev-parse","--show-toplevel"],{cwd:e,env:y(),encoding:"utf8",windowsHide:!0,timeout:1e4});return await _(r.trim())}catch{return null}}async function te(e){let r=await ee(e);if(r===null)throw new v("pm merge install requires a git repository (merge drivers are git configuration).",w.USAGE);return r}function I(e,r){return c.relative(e,r).split(c.sep).join("/")}function J(e){return e.replace(/[\\*?[\]!]/gu,"\\$&")}function h(e){return`"${e.replaceAll("\\","\\\\").replaceAll('"','\\"')}"`}function Y(e,r){if(e[r]!=="'")return null;let i="";for(let t=r+1;t<e.length;t+=1){if(e.startsWith(`'"'"'`,t)){i+="'",t+=4;continue}if(e[t]==="'")return{value:i,nextOffset:t+1};i+=e[t]}return null}async function ve(e,r,i){if(L(r).filter(o=>o.constraint==="exact").some(o=>o.version!==i))return!1;let t=await ee(e);if(t!==null&&t!==await _(r)){let o=await Promise.all([t,r].map(async n=>{let s=await k("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:n,env:y(),timeout:1e4});return _(s.stdout.trim())}));if(o[0]===o[1])return!1}return!0}async function _e(e,r,i){let t=Y(e,0);if(t===null||e[t.nextOffset]!==" ")return!1;let o=Y(e,t.nextOffset+1);if(o===null||e.slice(o.nextOffset)!==r||!/^(?:node|bun)(?:\.exe)?$/iu.test(c.basename(t.value))||c.basename(o.value)!=="cli.js"||c.basename(c.dirname(o.value))!=="dist"||!await S(t.value)||!await S(o.value))return!1;try{let n=c.dirname(c.dirname(o.value)),s=JSON.parse(await A(c.join(n,"package.json"),"utf8")),a=typeof s.bin=="string"?s.bin:s.bin?.pm;return await ve(n,i,s.version)?s.name==="@unbrained/pm-cli"&&a==="dist/cli.js":!1}catch{return!1}}function O(e,r){let i=e.length>0?`${J(e)}/`:"",t=[`${h(`${i}**/*.toon`)} merge=pm-item-toon`,`${h(`${i}**/*.md`)} merge=pm-item-markdown`];for(let o of r){let n=J(o);t.push(`${h(`${i}${n}/*.toon`)} merge=pm-item-toon`),t.push(`${h(`${i}${n}/*.md`)} merge=pm-item-markdown`)}return t.push(`${h(`${i}**/*.jsonl`)} merge=pm-relationship`),t.push(`${h(`${i}history/*.jsonl`)} merge=pm-history`),t.push(`${h(`${i}settings.json`)} merge=pm-json`),t.push(`${h(`${i}**/*.json`)} merge=pm-json`),t.push(`${h(`${i}extensions/**`)} merge=text`),t.push(`${h(`${i}extensions/.managed-extensions.json`)} merge=pm-json`),t}function re(e){let r=[],i=0;for(;i<e.length;){let t=e.indexOf(T,i),o=e.indexOf(x,i),n=t===-1?o:o===-1?t:Math.min(t,o);if(n===-1)break;let s=n===o,a=s?x:T,d=s?Q:pe,u=e.indexOf(d,n+a.length),m=u===-1?e.length:u+d.length;r.push({start:n,end:m,closed:u!==-1,lines:e.slice(n+a.length,u===-1?m:u).split(`
1
+ import{b as K}from"./chunk-ON5WFDCG.js";import{Wa as H,_a as P,aa as U,ab as L,db as V}from"./chunk-IQKLJFJE.js";import{Md as $,Z as G,qa as B,wa as E,yd as W}from"./chunk-6L4KKRK7.js";import{a as X,b as y,c as q}from"./chunk-FOA7XKWP.js";import{B as S,D as j,E as F,H as N,y as w,z as v}from"./chunk-7SZPZOIC.js";import{access as le,readFile as A,realpath as _}from"node:fs/promises";import{constants as ue}from"node:fs";import{execFile as me}from"node:child_process";import c from"node:path";import{promisify as de}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="6d1f8e03-97b4-5d83-b85c-e47f39c07d48")}catch{}})();var se="PM_SOURCE_CONTEXT_ACCESS",ce="PM_ALLOW_SOURCE_CONTEXT_WRITES";function z(e){let r=e[se],i=r===void 0||r.trim().toLowerCase()==="write"?"write":"read_only",t=i==="read_only"&&e[ce]?.trim()==="1";return{access:i,write_override_applied:t,source_writes_allowed:i==="write"||t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="b1828465-0619-514c-8956-2a81dea9efbc")}catch{}})();var k=de(me),T="# pm-cli:merge-drivers:start",pe="# pm-cli:merge-drivers:end",x="# pm-cli:merge-drivers:v2:start",Q="# pm-cli:merge-drivers:v2:end",fe="merge-fence",ge="merge-attributes";function R(e){return`'${e.replaceAll("'",`'"'"'`)}'`}async function he(e,r){let i=await _(e);if(/(?:^|[\\/])bun-node-[^\\/]+[\\/]bun(?:\.exe)?$/iu.test(i))return;let{stdout:t}=await k(e,["--version"],{encoding:"utf8",windowsHide:!0,timeout:1e4});return t.trim()===r?i:void 0}async function ye(){let e=G(import.meta.url,["../../.."]),r=process.execPath,i=!1,t=await _(process.execPath),o=process.versions.bun,n=(process.env.PATH??"").split(c.delimiter).filter(a=>c.isAbsolute(a)).map(a=>c.join(a,o===void 0?c.basename(process.execPath):process.platform==="win32"?"bun.exe":"bun")),s=o===void 0?n:[process.env.npm_execpath??"",...n,t].filter(a=>c.isAbsolute(a)&&/^(?:bun|bun\.exe)$/iu.test(c.basename(a)));for(let a of s)try{if(await le(a,ue.X_OK),o!==void 0){let d=await he(a,o);if(d!==void 0){r=d,i=!0;break}continue}if(a!==t&&await _(a)===t){r=a;break}}catch{}if(o!==void 0&&!i)throw new v("Cannot install Bun merge drivers without a durable executable matching the current Bun version.",w.DEPENDENCY_FAILED,{code:"merge_bun_launcher_unavailable",why:"The current Bun process may be a temporary bunx launcher that Git cannot reuse after this command exits.",nextSteps:["Run with a durable version-matched Bun executable, expose one on an absolute PATH entry, or invoke pm through a Bun runner that publishes an absolute npm_execpath.","Retry pm merge install, then check pm health --strict-exit before merging branches."]});return`${R(r)} ${R(c.join(e,"dist","cli.js"))}`}var Z=[{key:"pm-item-toon",name:"pm field-aware TOON item document merge",artifact:"item",itemPath:"%P"},{key:"pm-item-markdown",name:"pm field-aware JSON-markdown item document merge",artifact:"item",itemPath:"%P"},{key:"pm-history",name:"pm append-only history stream merge",artifact:"history",itemPath:void 0},{key:"pm-relationship",name:"pm append-only relationship event store merge",artifact:"relationship",itemPath:void 0},{key:"pm-json",name:"pm key-level JSON config merge",artifact:"json",itemPath:void 0}];function we(e){let r=e.explicitPath?.trim(),i=e.environment.PM_SOURCE_WORKSPACE_ROOT?.trim(),t=e.environment.PM_SOURCE_PM_PATH?.trim(),o=z(e.environment),n=!!(i&&t),s=r===void 0&&n&&(e.dryRun||o.source_writes_allowed);if(r!==void 0){let a=E(e.cwd,r);return{pm_root:a,workspace_start:a,source_coordinates_available:n,source_context_selected:!1,source_policy:o}}return s?{pm_root:c.resolve(t),workspace_start:c.resolve(i),source_coordinates_available:!0,source_context_selected:!0,source_policy:o}:{pm_root:n?E(e.cwd,".agents/pm"):E(e.cwd),workspace_start:e.cwd,source_coordinates_available:n,source_context_selected:!1,source_policy:o}}async function ee(e){try{let{stdout:r}=await k("git",["rev-parse","--show-toplevel"],{cwd:e,env:y(),encoding:"utf8",windowsHide:!0,timeout:1e4});return await _(r.trim())}catch{return null}}async function te(e){let r=await ee(e);if(r===null)throw new v("pm merge install requires a git repository (merge drivers are git configuration).",w.USAGE);return r}function I(e,r){return c.relative(e,r).split(c.sep).join("/")}function J(e){return e.replace(/[\\*?[\]!]/gu,"\\$&")}function h(e){return`"${e.replaceAll("\\","\\\\").replaceAll('"','\\"')}"`}function Y(e,r){if(e[r]!=="'")return null;let i="";for(let t=r+1;t<e.length;t+=1){if(e.startsWith(`'"'"'`,t)){i+="'",t+=4;continue}if(e[t]==="'")return{value:i,nextOffset:t+1};i+=e[t]}return null}async function ve(e,r,i){if(L(r).filter(o=>o.constraint==="exact").some(o=>o.version!==i))return!1;let t=await ee(e);if(t!==null&&t!==await _(r)){let o=await Promise.all([t,r].map(async n=>{let s=await k("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:n,env:y(),timeout:1e4});return _(s.stdout.trim())}));if(o[0]===o[1])return!1}return!0}async function _e(e,r,i){let t=Y(e,0);if(t===null||e[t.nextOffset]!==" ")return!1;let o=Y(e,t.nextOffset+1);if(o===null||e.slice(o.nextOffset)!==r||!/^(?:node|bun)(?:\.exe)?$/iu.test(c.basename(t.value))||c.basename(o.value)!=="cli.js"||c.basename(c.dirname(o.value))!=="dist"||!await S(t.value)||!await S(o.value))return!1;try{let n=c.dirname(c.dirname(o.value)),s=JSON.parse(await A(c.join(n,"package.json"),"utf8")),a=typeof s.bin=="string"?s.bin:s.bin?.pm;return await ve(n,i,s.version)?s.name==="@unbrained/pm-cli"&&a==="dist/cli.js":!1}catch{return!1}}function O(e,r){let i=e.length>0?`${J(e)}/`:"",t=[`${h(`${i}**/*.toon`)} merge=pm-item-toon`,`${h(`${i}**/*.md`)} merge=pm-item-markdown`];for(let o of r){let n=J(o);t.push(`${h(`${i}${n}/*.toon`)} merge=pm-item-toon`),t.push(`${h(`${i}${n}/*.md`)} merge=pm-item-markdown`)}return t.push(`${h(`${i}**/*.jsonl`)} merge=pm-relationship`),t.push(`${h(`${i}history/*.jsonl`)} merge=pm-history`),t.push(`${h(`${i}settings.json`)} merge=pm-json`),t.push(`${h(`${i}**/*.json`)} merge=pm-json`),t.push(`${h(`${i}extensions/**`)} merge=text`),t.push(`${h(`${i}extensions/.managed-extensions.json`)} merge=pm-json`),t}function re(e){let r=[],i=0;for(;i<e.length;){let t=e.indexOf(T,i),o=e.indexOf(x,i),n=t===-1?o:o===-1?t:Math.min(t,o);if(n===-1)break;let s=n===o,a=s?x:T,d=s?Q:pe,u=e.indexOf(d,n+a.length),m=u===-1?e.length:u+d.length;r.push({start:n,end:m,closed:u!==-1,lines:e.slice(n+a.length,u===-1?m:u).split(`
2
2
  `).map(l=>l.trim()).filter(Boolean)}),i=m}return r}function ie(e,r,i){let t=new Set(r),o=h(i.length>0?`${i}/`:"").slice(0,-1);return e.some(n=>t.has(n)||n.startsWith(o)&&/^[^/]+\/\*\.(?:toon|md)" merge=pm-item-(?:toon|markdown)$/u.test(n.slice(o.length)))}async function ne(e,r,i,t){let o=c.join(e,".gitattributes"),n=t?null:(await k("git",["rev-parse","--absolute-git-dir"],{cwd:e,env:y(),encoding:"utf8",windowsHide:!0,timeout:1e4})).stdout.trim(),s=n===null?null:await $(n,ge,120,"merge-fence",!1,!0,5e3);try{let a=await F(o)??"",d=[x,...i,Q].join(`
3
3
  `),u=re(a),m=u.filter(p=>ie(p.lines,i,r));m.length===0&&r===".agents/pm"&&u.length===1&&u[0].lines.every(p=>!p.includes("/"))&&m.push(u[0]);let l;if(m.length>0){let p=m[0];l=a;for(let b of m.slice(1).reverse())l=`${l.slice(0,b.start)}${l.slice(b.end)}`;l=`${l.slice(0,p.start)}${d}${l.slice(p.end)}`}else{let p=a.trimEnd();l=`${p.length>0?`${p}
4
4
 
5
5
  `:""}${d}
6
6
  `}return l===a?{path:o,changed:!1}:(t||await N(o,l),{path:o,changed:!0})}finally{await s?.()}}function oe(e){let r=B(e,null);return[...new Set(Object.values(r.type_to_folder))].sort((i,t)=>i.localeCompare(t))}async function qe(e,r){let i=c.resolve(e),t=null,o="",n=i;for(let g=0;g<8;g+=1){let ae=c.join(n,".gitattributes");try{let C=await A(ae,"utf8");if(C.includes(x)||C.includes(T)){t=n,o=C;break}}catch{}let D=c.dirname(n);if(D===n)break;n=D}if(t===null)return{status:"not_installed",missing_patterns:[],stale_patterns:[],schema_scope:"project"};let s=c.join(t,".gitattributes"),a=I(t,i),d=re(o),u=O(a,r),m=d.filter(g=>ie(g.lines,u,a)),l=m.flatMap(g=>g.closed?g.lines:[]),p=new Set(l),b=new Set(u),f=u.filter(g=>!p.has(g)),M=l.filter(g=>!b.has(g));return{status:m.length!==1||!m[0].closed||f.length>0||M.length>0?"drift":"ok",path:s,missing_patterns:f,stale_patterns:M,schema_scope:"project"}}async function ze(e){let r=[],i=[];for(let t of Z){let o=`merge.${t.key}.driver`,n=` merge driver ${t.artifact} "%O" "%A" "%B"${t.itemPath===void 0?"":` --item-path ${t.itemPath}`}`;try{let{stdout:s}=await k("git",["config","--get",o],{cwd:e,env:y(),encoding:"utf8",windowsHide:!0,timeout:1e4}),a=s.trim();await _e(a,n,e)||i.push(o)}catch{r.push(o)}}return{status:r.length>0?"missing":i.length>0?"drift":"ok",missing_keys:r,drifted_keys:i}}async function Je(e){let r;try{r=await te(c.resolve(e))}catch{return{status:"no_git"}}let i=I(r,c.resolve(e)),t=await P(e),o=U(void 0,t.author_default),n=await $(e,fe,t.locks.ttl_seconds,o,!1,H(t).force_required_for_stale_lock,t.locks.wait_ms);try{let s=c.join(r,".gitattributes"),a;try{a=await A(s,"utf8")}catch(l){if(l instanceof Error&&"code"in l&&j(l))return{status:"not_installed",path:s};throw l}if(!a.includes(x)&&!a.includes(T))return{status:"not_installed",path:s};let d=await P(e),u=oe(d),m=await ne(r,i,O(i,u),!1);return{status:m.changed?"refreshed":"unchanged",path:m.path}}finally{await n()}}async function Ye(e,r){let i=we({cwd:process.cwd(),explicitPath:r.path,dryRun:e.dryRun===!0,environment:process.env}),t=i.pm_root;await V(t);let o=await te(i.workspace_start);return ke({pmRoot:t,workspaceRoot:o,dryRun:e.dryRun===!0,preCommitHook:e.preCommitHook===!0})}async function be(e,r){let i=(await k("git",["rev-parse","--path-format=absolute","--git-common-dir"],{cwd:e,env:y(),timeout:1e4})).stdout.trim(),t=await $(i,"merge-driver-config",120,"merge-install",!1,!0,5e3);try{let o=await q(e),n;try{n=(await k("git",["config",o,"--null","--get-regexp","."],{cwd:e,env:y(),timeout:1e4})).stdout}catch(a){if(typeof a!="object"||a===null||!("code"in a)||a.code!==1)throw a;n=""}let s=new Map(n.split("\0").filter(Boolean).map(a=>{let d=a.indexOf(`
7
- `);return[a.slice(0,d),a.slice(d+1)]}));for(let a of r)s.get(a.key)!==a.value&&await X(e,[o,a.key,a.value])}finally{await t()}}async function ke(e){let r=c.resolve(e.pmRoot),i=c.resolve(e.workspaceRoot),t=e.dryRun===!0,o,n;try{[o,n]=await Promise.all([_(r),_(i)])}catch(f){throw new v(`Cannot resolve tracker root ${r} or workspace root ${i}: ${String(f)}`,w.NOT_FOUND,{code:"merge_root_not_found",nextSteps:["Initialize the tracker and ensure both paths are accessible.",'Retry "pm merge install" from the repository workspace.']})}let s=I(n,o);if(K(s))throw new v(`Tracker root ${r} is outside the git repository ${i}; there is nothing to configure for this repository.`,w.USAGE);let a=await P(o),d=oe(a),u=O(s,d),m=[],l=await ye(),p=e.preCommitHook===!0?await import("./settlement-hook-3CADO4XZ.js").then(async f=>({plan:await f.prepareMergeSettlementHook(n,`${l} --pm-path ${R(s||".")}`),write:f.writeMergeSettlementHook})):void 0;for(let f of Z)m.push({key:`merge.${f.key}.name`,value:f.name}),m.push({key:`merge.${f.key}.driver`,value:`${l} merge driver ${f.artifact} "%O" "%A" "%B"${f.itemPath===void 0?"":` --item-path ${f.itemPath}`}`});if(!t)try{await be(n,m)}catch{throw new v(`Cannot install repository-local merge drivers in ${n}. Ensure the repository Git config is writable and no other Git process holds its lock, then retry.`,w.DEPENDENCY_FAILED,{code:"merge_git_config_unwritable",why:"pm merge install must persist clone-local driver commands before publishing their shared .gitattributes mappings.",nextSteps:["Make the repository Git config writable or wait for the process holding its lock to finish.",'Retry "pm merge install"; the operation is idempotent.','Use "pm merge install --dry-run --json" when the workspace is intentionally read-only.']})}let b=await ne(n,s,u,t);return p!==void 0&&!t&&await p.write(p.plan),{ok:!0,dry_run:t,workspace_root:n,pm_root:o,gitattributes:{path:b.path,changed:b.changed,patterns:u,schema_scope:"project"},git_config:m,...p===void 0?{}:{settlement_hook:{path:p.plan.path,changed:p.plan.changed}},guidance:["Commit .gitattributes so every branch and collaborator shares the merge mapping.",'git config is per-clone: each collaborator (and each fresh worktree/clone) runs "pm merge install" once.','After merging branches, run "pm merge reconcile --dry-run" to inspect the complete receipt and history repair, then apply "pm merge reconcile"; use --force only after explicitly accepting any discarded values.',"Custom item types registered later refresh this fence automatically (pm schema add-type/remove-type); rerun pm merge install only after out-of-band type-folder edits."],generated_at:W()}}import{execFile as xe}from"node:child_process";import{promisify as Ee}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="e57ef62f-fd40-5a33-9816-e24d8dba4d1d")}catch{}})();var $e=Ee(xe);async function nt(e,r){if(r.length===0)return[];let i;try{let n=$e("git",["check-ignore","--verbose","-z","--stdin"],{cwd:e,env:y(),timeout:1e4}),s=n.child.stdin;s!==null&&(s.on("error",()=>{n.child.kill()}),s.end(`${r.join("\0")}\0`)),{stdout:i}=await n}catch(n){if(typeof n=="object"&&n!==null&&"code"in n&&n.code===1)return[];throw new v("Git could not verify ignore rules for merge artifacts; no automatic settlement is safe until that check succeeds.",w.CONFLICT,{code:"merge_settlement_review_required",reason:"ignore_check_unavailable",nextSteps:["Check Git configuration and ignore-file readability, then retry pm merge reconcile --stage --dry-run."]})}let t=i.split("\0"),o=[];for(let n=0;n+3<t.length;n+=4){let[s,a,d,u]=t.slice(n,n+4);d.startsWith("!")||o.push({path:u,source:s,line:Number(a),pattern:d})}return o}export{se as a,ce as b,ee as c,oe as d,qe as e,ze as f,Je as g,Ye as h,ke as i,nt as j};
8
- //# sourceMappingURL=chunk-226XKW3W.js.map
7
+ `);return[a.slice(0,d),a.slice(d+1)]}));for(let a of r)s.get(a.key)!==a.value&&await X(e,[o,a.key,a.value])}finally{await t()}}async function ke(e){let r=c.resolve(e.pmRoot),i=c.resolve(e.workspaceRoot),t=e.dryRun===!0,o,n;try{[o,n]=await Promise.all([_(r),_(i)])}catch(f){throw new v(`Cannot resolve tracker root ${r} or workspace root ${i}: ${String(f)}`,w.NOT_FOUND,{code:"merge_root_not_found",nextSteps:["Initialize the tracker and ensure both paths are accessible.",'Retry "pm merge install" from the repository workspace.']})}let s=I(n,o);if(K(s))throw new v(`Tracker root ${r} is outside the git repository ${i}; there is nothing to configure for this repository.`,w.USAGE);let a=await P(o),d=oe(a),u=O(s,d),m=[],l=await ye(),p=e.preCommitHook===!0?await import("./settlement-hook-LBVWWSCF.js").then(async f=>({plan:await f.prepareMergeSettlementHook(n,`${l} --pm-path ${R(s||".")}`),write:f.writeMergeSettlementHook})):void 0;for(let f of Z)m.push({key:`merge.${f.key}.name`,value:f.name}),m.push({key:`merge.${f.key}.driver`,value:`${l} merge driver ${f.artifact} "%O" "%A" "%B"${f.itemPath===void 0?"":` --item-path ${f.itemPath}`}`});if(!t)try{await be(n,m)}catch{throw new v(`Cannot install repository-local merge drivers in ${n}. Ensure the repository Git config is writable and no other Git process holds its lock, then retry.`,w.DEPENDENCY_FAILED,{code:"merge_git_config_unwritable",why:"pm merge install must persist clone-local driver commands before publishing their shared .gitattributes mappings.",nextSteps:["Make the repository Git config writable or wait for the process holding its lock to finish.",'Retry "pm merge install"; the operation is idempotent.','Use "pm merge install --dry-run --json" when the workspace is intentionally read-only.']})}let b=await ne(n,s,u,t);return p!==void 0&&!t&&await p.write(p.plan),{ok:!0,dry_run:t,workspace_root:n,pm_root:o,gitattributes:{path:b.path,changed:b.changed,patterns:u,schema_scope:"project"},git_config:m,...p===void 0?{}:{settlement_hook:{path:p.plan.path,changed:p.plan.changed}},guidance:["Commit .gitattributes so every branch and collaborator shares the merge mapping.",'git config is per-clone: each collaborator (and each fresh worktree/clone) runs "pm merge install" once.','After merging branches, run "pm merge reconcile --dry-run" to inspect the complete receipt and history repair, then apply "pm merge reconcile"; use --force only after explicitly accepting any discarded values.',"Custom item types registered later refresh this fence automatically (pm schema add-type/remove-type); rerun pm merge install only after out-of-band type-folder edits."],generated_at:W()}}import{execFile as xe}from"node:child_process";import{promisify as Ee}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="e57ef62f-fd40-5a33-9816-e24d8dba4d1d")}catch{}})();var $e=Ee(xe);async function nt(e,r){if(r.length===0)return[];let i;try{let n=$e("git",["check-ignore","--verbose","-z","--stdin"],{cwd:e,env:y(),timeout:1e4}),s=n.child.stdin;s!==null&&(s.on("error",()=>{n.child.kill()}),s.end(`${r.join("\0")}\0`)),{stdout:i}=await n}catch(n){if(typeof n=="object"&&n!==null&&"code"in n&&n.code===1)return[];throw new v("Git could not verify ignore rules for merge artifacts; no automatic settlement is safe until that check succeeds.",w.CONFLICT,{code:"merge_settlement_review_required",reason:"ignore_check_unavailable",nextSteps:["Check Git configuration and ignore-file readability, then retry pm merge reconcile --stage --dry-run."]})}let t=i.split("\0"),o=[];for(let n=0;n+3<t.length;n+=4){let[s,a,d,u]=t.slice(n,n+4);d.startsWith("!")||o.push({path:u,source:s,line:Number(a),pattern:d})}return o}export{se as a,ce as b,ee as c,oe as d,qe as e,ze as f,Je as g,Ye as h,ke as i,nt as j};
8
+ //# sourceMappingURL=chunk-R3EA3SDW.js.map
@@ -1,3 +1,3 @@
1
- import{Ub as K,i as O,j as N,k as U,l as R,m as j}from"./chunk-NLZUI234.js";import{B as q,E as W,m as C,n as P}from"./chunk-KTXU5WU6.js";import x from"node:path";import{link as Q,mkdir as ee,mkdtemp as te,rm as re,writeFile as se}from"node:fs/promises";import D 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]="71c2fed9-81e1-5723-8e34-e6327c07a130")}catch{}})();async function V(e,t){let r=D.dirname(e);await ee(r,{recursive:!0});let s=await te(D.join(r,".pm-seed-")),o=D.join(s,"value");try{await se(o,t,"utf8");try{return await Q(o,e),!0}catch(i){if(i.code==="EEXIST")return!1;throw i}}finally{await re(s,{recursive:!0,force:!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]="2075887b-6d4b-582f-9da2-bab13198f9a5")}catch{}})();var oe=2e3,v=new Map;function S(e){if(typeof e!="string")return"";let t=v.get(e);if(t!==void 0)return t;let r=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return v.size>=oe&&K(v),v.set(e,r),r}(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]="6e07b1b6-1757-54dd-8833-9d3f984ccf79")}catch{}})();var m=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),$=P,M=C,ne=["create","update"],ie=new Set(N),ae=new Set(U),le=new Set(R),de=new Set(j),ue=new Set(["string","number","boolean","array","object"]),ce=16;function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var fe=[e=>e.type===void 0||typeof e.type=="string"&&ue.has(e.type),e=>!Object.hasOwn(e,"const")||I(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>I(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||J(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function I(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(s=>I(s,t)):Object.values(e).every(s=>I(s,t));return t.delete(e),r}function F(e,t=0,r=new Set){if(!J(e)||t>ce||r.has(e))return;r.add(e);let s=e,o=s.type,i=s.enum,a=s.one_of,l=s.properties,n=s.items,u=s.required,f=s.min_length,d=s.min_items,p=s.format,w=s.additional_properties;if(!fe.every(c=>c(s))){r.delete(e);return}let g=l===void 0?void 0:Object.fromEntries(Object.entries(l).map(([c,b])=>[c,F(b,t+1,r)])),h=n===void 0?void 0:F(n,t+1,r),A=a===void 0?void 0:a.map(c=>F(c,t+1,r));if([...Object.values(g??{}),...n===void 0?[]:[h],...A??[]].some(c=>c===void 0)){r.delete(e);return}return r.delete(e),Object.fromEntries(Object.entries({type:o,const:Object.hasOwn(s,"const")?s.const:void 0,enum:i,min_length:f,min_items:d,format:p,properties:g,required:u===void 0?void 0:[...new Set(u)],additional_properties:w,items:h,one_of:A}).filter(([,c])=>c!==void 0))}function T(e){let t=Array.isArray(e)?e:[];return[...new Set(t.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0))].sort((r,s)=>r.localeCompare(s))}function _(e){if(typeof e!="string"||e.length===0)return;let t=S(e);return t.length>0?t:void 0}function _e(e){return e.startsWith("--")?e.slice(2):e}function H(e){return typeof e=="string"?_e(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function B(e){return e.replaceAll("_","-")}function me(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(o=>o.length>0).map(o=>o.toLowerCase());if(t.length===0)return e;let[r,...s]=t;return`${r}${s.map(o=>`${o.slice(0,1).toUpperCase()}${o.slice(1)}`).join("")}`}function z(e,t){let r=_(e.id);if(!r)return null;let s=[...new Set(T(e.aliases).map(S).filter(l=>l.length>0))].sort((l,n)=>l.localeCompare(n)),o=T(e.roles).filter(l=>ie.has(l)),i=e.description?.trim(),a=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:r,aliases:s,roles:o,description:i&&i.length>0?i:void 0,order:a}}function pe(e){return{draft_status:_(e?.draft_status),open_status:_(e?.open_status),in_progress_status:_(e?.in_progress_status),blocked_status:_(e?.blocked_status),close_status:_(e?.close_status),canceled_status:_(e?.canceled_status)}}function X(e,t){if(!Array.isArray(t)||t.length!==2)return;let r=S(t[0]),s=S(t[1]);r.length===0||s.length===0||e.pairs.some(o=>o[0]===r&&o[1]===s)||e.pairs.push([r,s])}function ye(e){let t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;let r={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(let s of e.allowed_transitions)X(r,s);return{typeKey:t.toLowerCase(),record:r}}function we(e){if(!Array.isArray(e)||e.length===0)return;let t=new Map;for(let s of e){let o=ye(s);if(o===null)continue;let i=t.get(o.typeKey)??o.record;i.denyAll||=o.record.denyAll;for(let a of o.record.pairs)X(i,a);t.set(o.typeKey,i)}let r=[];for(let s of t.values())(s.pairs.length>0||s.denyAll)&&r.push({type:s.type,allowed_transitions:s.pairs});return r.sort((s,o)=>s.type.localeCompare(o.type)),r.length>0?r:void 0}function Z(e){let t=S(e.key??"");if(!t)return null;let r=S(e.metadata_key??e.front_matter_key??t),s=H(e.cli_flag??B(t));if(!s)return null;let o=T(e.cli_aliases).map(d=>H(d)).filter(d=>d.length>0&&d!==s),i=typeof e.type=="string"?e.type.trim().toLowerCase():"string",a=ae.has(i)?i:"string",l=(()=>{let d=T(e.commands).filter(p=>le.has(p));return d.length>0?d:[...ne]})(),n=e.description?.trim(),u=T(e.required_types),f=e.value_schema===void 0?void 0:F(e.value_schema);return e.value_schema!==void 0&&f===void 0?null:{key:t,metadata_key:r,cli_flag:s,cli_aliases:o,description:n&&n.length>0?n:void 0,type:a,commands:l,repeatable:[e.repeatable===!0,a==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:u,allow_unset:e.allow_unset!==!1,value_schema:f}}function Se(e){let t=new Map;for(let[s,o]of e.entries()){let i=z(o,s);i&&t.set(i.id,i)}let r=Y([...t.values()]);return r.length>0?r:Y(M.map((s,o)=>z(s,o)).filter(s=>s!==null))}function Y(e){return e.sort((t,r)=>t.order===r.order?t.id.localeCompare(r.id):t.order-r.order)}function ge(e){let t=new Map;for(let r of e??[]){let s=Z(r);s&&t.set(s.key,s)}return[...t.values()].sort((r,s)=>r.key.localeCompare(s.key))}function he(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function Ae(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==B(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function be(e){let t=typeof e=="string"?e.trim().toLowerCase():"allow";return de.has(t)?t:"allow"}function E(e){let t={...m,...e?.files},r=e?.statuses&&e.statuses.length>0?e.statuses:M,s=Se(r),o=ge(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:s.map(he),fields:o.map(Ae),workflow:{...$,...pe(e?.workflow)},type_workflows:we(e?.type_workflows),unknown_field_policy:be(e?.unknown_field_policy)}}function ke(e,t,r){try{return JSON.parse(e)}catch{r.push(t);return}}function Te(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function Ee(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function ve(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function Fe(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function Ie(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function y(e,t,r){let s=t?.trim()||r;return x.isAbsolute(s)?s:x.join(e,s)}function Ve(e,t){return y(e,t.files.types,m.types)}async function xe(e,t){let r=E(t),s=[{path:y(e,r.files.types,m.types),seed:{definitions:[]}},{path:y(e,r.files.statuses,m.statuses),seed:{statuses:M}},{path:y(e,r.files.fields,m.fields),seed:{fields:[]}},{path:y(e,r.files.workflows,m.workflows),seed:{workflow:$}}],o=[];for(let i of s)await q(i.path)||await V(i.path,`${JSON.stringify(i.seed,null,2)}
1
+ import{Ub as K,i as O,j as N,k as U,l as R,m as j}from"./chunk-6L4KKRK7.js";import{B as q,E as W,m as C,n as P}from"./chunk-7SZPZOIC.js";import x from"node:path";import{link as Q,mkdir as ee,mkdtemp as te,rm as re,writeFile as se}from"node:fs/promises";import D 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]="71c2fed9-81e1-5723-8e34-e6327c07a130")}catch{}})();async function V(e,t){let r=D.dirname(e);await ee(r,{recursive:!0});let s=await te(D.join(r,".pm-seed-")),o=D.join(s,"value");try{await se(o,t,"utf8");try{return await Q(o,e),!0}catch(i){if(i.code==="EEXIST")return!1;throw i}}finally{await re(s,{recursive:!0,force:!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]="2075887b-6d4b-582f-9da2-bab13198f9a5")}catch{}})();var oe=2e3,v=new Map;function S(e){if(typeof e!="string")return"";let t=v.get(e);if(t!==void 0)return t;let r=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return v.size>=oe&&K(v),v.set(e,r),r}(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]="6e07b1b6-1757-54dd-8833-9d3f984ccf79")}catch{}})();var m=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),$=P,M=C,ne=["create","update"],ie=new Set(N),ae=new Set(U),le=new Set(R),de=new Set(j),ue=new Set(["string","number","boolean","array","object"]),ce=16;function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var fe=[e=>e.type===void 0||typeof e.type=="string"&&ue.has(e.type),e=>!Object.hasOwn(e,"const")||I(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>I(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||J(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function I(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(s=>I(s,t)):Object.values(e).every(s=>I(s,t));return t.delete(e),r}function F(e,t=0,r=new Set){if(!J(e)||t>ce||r.has(e))return;r.add(e);let s=e,o=s.type,i=s.enum,a=s.one_of,l=s.properties,n=s.items,u=s.required,f=s.min_length,d=s.min_items,p=s.format,w=s.additional_properties;if(!fe.every(c=>c(s))){r.delete(e);return}let g=l===void 0?void 0:Object.fromEntries(Object.entries(l).map(([c,b])=>[c,F(b,t+1,r)])),h=n===void 0?void 0:F(n,t+1,r),A=a===void 0?void 0:a.map(c=>F(c,t+1,r));if([...Object.values(g??{}),...n===void 0?[]:[h],...A??[]].some(c=>c===void 0)){r.delete(e);return}return r.delete(e),Object.fromEntries(Object.entries({type:o,const:Object.hasOwn(s,"const")?s.const:void 0,enum:i,min_length:f,min_items:d,format:p,properties:g,required:u===void 0?void 0:[...new Set(u)],additional_properties:w,items:h,one_of:A}).filter(([,c])=>c!==void 0))}function T(e){let t=Array.isArray(e)?e:[];return[...new Set(t.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0))].sort((r,s)=>r.localeCompare(s))}function _(e){if(typeof e!="string"||e.length===0)return;let t=S(e);return t.length>0?t:void 0}function _e(e){return e.startsWith("--")?e.slice(2):e}function H(e){return typeof e=="string"?_e(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function B(e){return e.replaceAll("_","-")}function me(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(o=>o.length>0).map(o=>o.toLowerCase());if(t.length===0)return e;let[r,...s]=t;return`${r}${s.map(o=>`${o.slice(0,1).toUpperCase()}${o.slice(1)}`).join("")}`}function z(e,t){let r=_(e.id);if(!r)return null;let s=[...new Set(T(e.aliases).map(S).filter(l=>l.length>0))].sort((l,n)=>l.localeCompare(n)),o=T(e.roles).filter(l=>ie.has(l)),i=e.description?.trim(),a=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:r,aliases:s,roles:o,description:i&&i.length>0?i:void 0,order:a}}function pe(e){return{draft_status:_(e?.draft_status),open_status:_(e?.open_status),in_progress_status:_(e?.in_progress_status),blocked_status:_(e?.blocked_status),close_status:_(e?.close_status),canceled_status:_(e?.canceled_status)}}function X(e,t){if(!Array.isArray(t)||t.length!==2)return;let r=S(t[0]),s=S(t[1]);r.length===0||s.length===0||e.pairs.some(o=>o[0]===r&&o[1]===s)||e.pairs.push([r,s])}function ye(e){let t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;let r={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(let s of e.allowed_transitions)X(r,s);return{typeKey:t.toLowerCase(),record:r}}function we(e){if(!Array.isArray(e)||e.length===0)return;let t=new Map;for(let s of e){let o=ye(s);if(o===null)continue;let i=t.get(o.typeKey)??o.record;i.denyAll||=o.record.denyAll;for(let a of o.record.pairs)X(i,a);t.set(o.typeKey,i)}let r=[];for(let s of t.values())(s.pairs.length>0||s.denyAll)&&r.push({type:s.type,allowed_transitions:s.pairs});return r.sort((s,o)=>s.type.localeCompare(o.type)),r.length>0?r:void 0}function Z(e){let t=S(e.key??"");if(!t)return null;let r=S(e.metadata_key??e.front_matter_key??t),s=H(e.cli_flag??B(t));if(!s)return null;let o=T(e.cli_aliases).map(d=>H(d)).filter(d=>d.length>0&&d!==s),i=typeof e.type=="string"?e.type.trim().toLowerCase():"string",a=ae.has(i)?i:"string",l=(()=>{let d=T(e.commands).filter(p=>le.has(p));return d.length>0?d:[...ne]})(),n=e.description?.trim(),u=T(e.required_types),f=e.value_schema===void 0?void 0:F(e.value_schema);return e.value_schema!==void 0&&f===void 0?null:{key:t,metadata_key:r,cli_flag:s,cli_aliases:o,description:n&&n.length>0?n:void 0,type:a,commands:l,repeatable:[e.repeatable===!0,a==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:u,allow_unset:e.allow_unset!==!1,value_schema:f}}function Se(e){let t=new Map;for(let[s,o]of e.entries()){let i=z(o,s);i&&t.set(i.id,i)}let r=Y([...t.values()]);return r.length>0?r:Y(M.map((s,o)=>z(s,o)).filter(s=>s!==null))}function Y(e){return e.sort((t,r)=>t.order===r.order?t.id.localeCompare(r.id):t.order-r.order)}function ge(e){let t=new Map;for(let r of e??[]){let s=Z(r);s&&t.set(s.key,s)}return[...t.values()].sort((r,s)=>r.key.localeCompare(s.key))}function he(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function Ae(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==B(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function be(e){let t=typeof e=="string"?e.trim().toLowerCase():"allow";return de.has(t)?t:"allow"}function E(e){let t={...m,...e?.files},r=e?.statuses&&e.statuses.length>0?e.statuses:M,s=Se(r),o=ge(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:s.map(he),fields:o.map(Ae),workflow:{...$,...pe(e?.workflow)},type_workflows:we(e?.type_workflows),unknown_field_policy:be(e?.unknown_field_policy)}}function ke(e,t,r){try{return JSON.parse(e)}catch{r.push(t);return}}function Te(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function Ee(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function ve(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function Fe(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function Ie(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function y(e,t,r){let s=t?.trim()||r;return x.isAbsolute(s)?s:x.join(e,s)}function Ve(e,t){return y(e,t.files.types,m.types)}async function xe(e,t){let r=E(t),s=[{path:y(e,r.files.types,m.types),seed:{definitions:[]}},{path:y(e,r.files.statuses,m.statuses),seed:{statuses:M}},{path:y(e,r.files.fields,m.fields),seed:{fields:[]}},{path:y(e,r.files.workflows,m.workflows),seed:{workflow:$}}],o=[];for(let i of s)await q(i.path)||await V(i.path,`${JSON.stringify(i.seed,null,2)}
2
2
  `)&&o.push(i.path);return{created_paths:o}}async function He(e,t){let r=E(t),s=[],o=y(e,r.files.types,m.types),i=y(e,r.files.statuses,m.statuses),a=y(e,r.files.fields,m.fields),l=y(e,r.files.workflows,m.workflows),n,u,f,d,p,w=async(b,G)=>{let L=await W(b);if(L!==null)return ke(L,G,s)},g=await w(o,"runtime_schema_types_invalid_json");g!==void 0&&(n=Te(g),n===void 0&&s.push("runtime_schema_types_invalid_shape"));let h=await w(i,"runtime_schema_statuses_invalid_json");h!==void 0&&(u=Ee(h),u===void 0&&s.push("runtime_schema_statuses_invalid_shape"));let A=await w(a,"runtime_schema_fields_invalid_json");A!==void 0&&(f=ve(A),f===void 0&&s.push("runtime_schema_fields_invalid_shape"));let c=await w(l,"runtime_schema_workflows_invalid_json");return c!==void 0&&(d=Fe(c),d===void 0&&s.push("runtime_schema_workflows_invalid_shape"),p=Ie(c)),{schema:E({...r,statuses:[...r.statuses,...u??[]],fields:[...r.fields,...f??[]],workflow:{...r.workflow,...d},type_workflows:[...r.type_workflows??[],...p??[]]}),type_definitions_from_file:n,warnings:s,created_paths:[]}}function k(e,t,r,s=!1){let o=r.map(a=>_(a)).filter(a=>typeof a=="string").find(a=>e.some(l=>l.id===a));if(s&&o!==void 0)return o;let i=e.find(a=>a.roles.includes(t));return i!==void 0?i.id:o??e[0]?.id}function De(e){let t=new Map,r=new Map;for(let s of e){r.set(s.id,s),t.set(s.id,s.id),t.set(s.id.replaceAll("_","-"),s.id),t.set(s.id.replaceAll("_"," "),s.id);for(let o of s.aliases)t.set(o,s.id),t.set(o.replaceAll("_","-"),s.id),t.set(o.replaceAll("_"," "),s.id)}return{aliasToId:t,byId:r}}function ze(e){let t={activeStatuses:new Set,blockedStatuses:new Set,draftStatuses:new Set,terminalCanceledStatuses:new Set,terminalDoneStatuses:new Set,terminalStatuses:new Set};for(let r of e){let s=new Set(r.roles);(s.has("terminal")||s.has("terminal_done")||s.has("terminal_canceled"))&&t.terminalStatuses.add(r.id),s.has("terminal_done")&&t.terminalDoneStatuses.add(r.id),s.has("terminal_canceled")&&t.terminalCanceledStatuses.add(r.id),s.has("active")&&t.activeStatuses.add(r.id),s.has("blocked")&&t.blockedStatuses.add(r.id),s.has("draft")&&t.draftStatuses.add(r.id)}return t}function Ye(e){let t=E(e),r=t.statuses.map((c,b)=>z(c,b)).filter(c=>c!==null),{aliasToId:s,byId:o}=De(r),{activeStatuses:i,blockedStatuses:a,draftStatuses:l,terminalCanceledStatuses:n,terminalDoneStatuses:u,terminalStatuses:f}=ze(r),d=t.workflow,p=_(d.open_status)??k(r,"default_open",["open","in_progress",O[0]]),w=_(d.in_progress_status)??k(r,"active",["in_progress","in-progress",p],!0),g=_(d.blocked_status)??k(r,"blocked",["blocked"]),h=_(d.close_status)??k(r,"default_close",["closed","done","complete"]),A=_(d.canceled_status)??k(r,"default_cancel",["canceled","cancelled"]);return{definitions:r,by_id:o,alias_to_id:s,terminal_statuses:f,terminal_done_statuses:u,terminal_canceled_statuses:n,active_statuses:i,blocked_statuses:a,draft_statuses:l,open_status:p,in_progress_status:w,blocked_status:g,close_status:h,canceled_status:A}}function Me(e,t){let r=S(e);if(r)return t.alias_to_id.get(r)}function $e(e){let t=E(e),r=new Map,s=t.fields.map(n=>Z(n)).filter(n=>n!==null);for(let n of s)r.set(n.key,n);let o=[...r.values()].sort((n,u)=>n.key.localeCompare(u.key)),i=new Map,a=new Map,l=new Map;for(let n of o){i.set(n.key,n),a.set(n.cli_flag,n);for(let u of n.cli_aliases)a.set(u,n);for(let u of n.commands){let f=l.get(u)??[];f.push(n),l.set(u,f)}}for(let[n,u]of l.entries())u.sort((f,d)=>f.key.localeCompare(d.key)),l.set(n,u);return{definitions:o,by_key:i,by_cli_token:a,command_to_fields:l}}function Je(e){return me(e.key)}function Be(e,t){let r=Me(e,t);return r?t.terminal_statuses.has(r):!1}export{S as a,V as b,m as c,M as d,E as e,y as f,Ve as g,xe as h,He as i,Ye as j,Me as k,$e as l,Je as m,Be as n};
3
- //# sourceMappingURL=chunk-B266DDBJ.js.map
3
+ //# sourceMappingURL=chunk-TUN4M757.js.map