werkmeister 0.93.0 → 0.93.1

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 (148) hide show
  1. package/dist/{budget-UD5LY74U.js → budget-BWZ2PMH2.js} +2 -2
  2. package/dist/{cache-R3DVOIMT.js → cache-G7SLV6F7.js} +2 -2
  3. package/dist/{chunk-VCE3C3SZ.js → chunk-3RUNYSC4.js} +2 -2
  4. package/dist/{chunk-FHYI2VBS.js → chunk-4EXMNBQR.js} +2 -2
  5. package/dist/{chunk-ATFVFJQO.js → chunk-5R7UQGGJ.js} +4 -2
  6. package/dist/{chunk-GUKFAVFB.js → chunk-5YFUXZBD.js} +2 -2
  7. package/dist/{chunk-W3VZMQZE.js → chunk-6EIQPRWO.js} +2 -2
  8. package/dist/{chunk-YG26JIHA.js → chunk-6PPFIYOJ.js} +2 -2
  9. package/dist/{chunk-24T42JYF.js → chunk-7E5V6XYL.js} +2 -2
  10. package/dist/{chunk-7N75HGKB.js → chunk-7SID5ZXC.js} +3 -3
  11. package/dist/{chunk-WSZSFGM7.js → chunk-AYZ6UTQP.js} +2 -2
  12. package/dist/{chunk-T4I26BBQ.js → chunk-B22ESQSU.js} +2 -2
  13. package/dist/{chunk-3UZRG3XH.js → chunk-B6RIK6M7.js} +2 -2
  14. package/dist/{chunk-LHAPOPKA.js → chunk-B75RKH5O.js} +2 -2
  15. package/dist/{chunk-WUHKR4Q5.js → chunk-BPVZBH4L.js} +2 -2
  16. package/dist/{chunk-I4HGRDJW.js → chunk-C3BKLNWL.js} +2 -2
  17. package/dist/{chunk-W6W2X3CN.js → chunk-CPWZ5ED7.js} +2 -2
  18. package/dist/{chunk-QL7XCD5C.js → chunk-DAUTEJPJ.js} +2 -2
  19. package/dist/{chunk-VSRGQN6B.js → chunk-DTR7WIYX.js} +2 -2
  20. package/dist/{chunk-IOFC5J44.js → chunk-EGTDIX5E.js} +2 -2
  21. package/dist/{chunk-SNIANMW7.js → chunk-FMKL7K6O.js} +2 -2
  22. package/dist/{chunk-FO3BRONW.js → chunk-FNZUAB3H.js} +2 -2
  23. package/dist/{chunk-MCAAZMSU.js → chunk-FTSANPK4.js} +2 -2
  24. package/dist/{chunk-RP4S7AXJ.js → chunk-GDB3ERFM.js} +2 -2
  25. package/dist/{chunk-L77WAEJR.js → chunk-GIXVRB5Z.js} +2 -2
  26. package/dist/{chunk-CMX5BNYH.js → chunk-GLRMTXB7.js} +2 -2
  27. package/dist/{chunk-V3KFBSHV.js → chunk-HDAU3HQS.js} +2 -2
  28. package/dist/{chunk-BOPPNMSR.js → chunk-HTDQNGKC.js} +2 -2
  29. package/dist/{chunk-7WILG7CG.js → chunk-HZWEJFWS.js} +2 -2
  30. package/dist/{chunk-EQ2P7X4F.js → chunk-J3XBC4PW.js} +2 -2
  31. package/dist/{chunk-L34KAVPK.js → chunk-J3ZO6S7L.js} +2 -2
  32. package/dist/{chunk-AEH4HEZS.js → chunk-K5WL5U6S.js} +2 -2
  33. package/dist/{chunk-PLECZXJS.js → chunk-KPTVXGQA.js} +2 -2
  34. package/dist/{chunk-4VIL3XNZ.js → chunk-LE4AT5SS.js} +2 -2
  35. package/dist/{chunk-D7BAFMUM.js → chunk-LNZMWP5H.js} +2 -2
  36. package/dist/{chunk-HSCOWKAY.js → chunk-LXS2C6FX.js} +3 -3
  37. package/dist/{chunk-DLLLWWPQ.js → chunk-M5KPI2SP.js} +2 -2
  38. package/dist/{chunk-7X5WLO7X.js → chunk-N3JIUR7I.js} +2 -2
  39. package/dist/{chunk-GTJ3GX42.js → chunk-N6I7BEQE.js} +2 -2
  40. package/dist/{chunk-R5PYBIIH.js → chunk-NT5XYODL.js} +2 -2
  41. package/dist/{chunk-MWQFHDHU.js → chunk-OXIKS62S.js} +2 -2
  42. package/dist/{chunk-Z3JDTSQT.js → chunk-OYCAU54K.js} +2 -2
  43. package/dist/{chunk-NSTFLAV6.js → chunk-P54FQEQS.js} +2 -2
  44. package/dist/{chunk-ZKQSZ4D6.js → chunk-QHAH55YV.js} +3 -3
  45. package/dist/{chunk-PFAJITCT.js → chunk-QKLKSTDV.js} +2 -2
  46. package/dist/{chunk-CRFORJIH.js → chunk-QWFF7K3T.js} +2 -2
  47. package/dist/{chunk-AUAACGPO.js → chunk-RE6NKADW.js} +2 -2
  48. package/dist/{chunk-EVFZZJV7.js → chunk-RSJQIFCK.js} +2 -2
  49. package/dist/{chunk-RZUCID4V.js → chunk-SCOBBPOH.js} +2 -2
  50. package/dist/{chunk-X4ROLZKQ.js → chunk-SKM4MDCE.js} +2 -2
  51. package/dist/{chunk-KZNB25WC.js → chunk-SQFXASQ4.js} +2 -2
  52. package/dist/{chunk-Z7F2DQS7.js → chunk-SR3BZNGU.js} +2 -2
  53. package/dist/{chunk-TK634FP2.js → chunk-SVKSNQJZ.js} +2 -2
  54. package/dist/{chunk-VCKXDZTU.js → chunk-TDL7IH4Y.js} +2 -2
  55. package/dist/{chunk-Z2DA2CBC.js → chunk-TF4DHDJ3.js} +2 -2
  56. package/dist/{chunk-ILAZVFQJ.js → chunk-TYASAQ7U.js} +2 -2
  57. package/dist/{chunk-AE6372IR.js → chunk-UGYPQKJS.js} +2 -2
  58. package/dist/{chunk-QTEJGJ7U.js → chunk-VFPQHVG7.js} +2 -2
  59. package/dist/{chunk-JSYQVWOO.js → chunk-VXVRQ7FB.js} +2 -2
  60. package/dist/{chunk-PCM7UWAC.js → chunk-W27QQWCC.js} +2 -2
  61. package/dist/{chunk-BDVUTE3T.js → chunk-XNDI75MH.js} +2 -2
  62. package/dist/{chunk-TOXYIYRJ.js → chunk-XOCUKTLA.js} +2 -2
  63. package/dist/chunk-YG5HEMR5.js +4 -0
  64. package/dist/{chunk-7TZ3WFDZ.js → chunk-YSGHHJN2.js} +3 -3
  65. package/dist/{chunk-YBITNIB7.js → chunk-Z6Y7KMRS.js} +2 -2
  66. package/dist/{chunk-6NHEJ7T7.js → chunk-ZELRS5EE.js} +2 -2
  67. package/dist/{chunk-M2SWNYW5.js → chunk-ZEYQCGVN.js} +2 -2
  68. package/dist/{chunk-ETTHEQ6J.js → chunk-ZLFV5EHR.js} +2 -2
  69. package/dist/clean-KBC3WGQ4.js +8 -0
  70. package/dist/close_out-IPET25GD.js +8 -0
  71. package/dist/code-YZXE3K3E.js +4 -0
  72. package/dist/{config-KB32KZ34.js → config-DGXT56OO.js} +2 -2
  73. package/dist/{connect-WQIFMG5N.js → connect-B5LXK5HO.js} +2 -2
  74. package/dist/{daemon-MYMZXYWQ.js → daemon-HAA44DIR.js} +2 -2
  75. package/dist/dashboard.js +1 -1
  76. package/dist/{detect-GTTYNZC3.js → detect-EQEU7SKX.js} +2 -2
  77. package/dist/{down-CKY25NLH.js → down-RAKEARFK.js} +3 -3
  78. package/dist/{fixture-3KPWV4F3.js → fixture-F2AOIDBK.js} +2 -2
  79. package/dist/form-cli.js +1 -1
  80. package/dist/hooks-UBBWURAB.js +4 -0
  81. package/dist/{hooks_gen-KE7BD4MI.js → hooks_gen-VUCEK2SQ.js} +2 -2
  82. package/dist/infra-M6VTY7JW.js +4 -0
  83. package/dist/init_workspace-2GTR7GYN.js +4 -0
  84. package/dist/{intercept-VIFU5OXT.js → intercept-CTR27TT6.js} +2 -2
  85. package/dist/{issue-QNJK656A.js → issue-CCBFQPAM.js} +2 -2
  86. package/dist/lib/agent_state.js +1 -1
  87. package/dist/lib/gate.js +1 -1
  88. package/dist/lib/pr_guard.js +1 -1
  89. package/dist/list_workspaces-LQP6RJBC.js +7 -0
  90. package/dist/logs-H7YBXV4N.js +6 -0
  91. package/dist/main.js +3 -3
  92. package/dist/mcp-proxy.js +1 -1
  93. package/dist/mcp.js +1 -1
  94. package/dist/{migrate-CMHQDLYQ.js → migrate-TB4MLRFY.js} +2 -2
  95. package/dist/notes-B6VY7RTI.js +4 -0
  96. package/dist/{open-VXM3WEW6.js → open-7EIUOIAD.js} +2 -2
  97. package/dist/{optimize-KOBZTWKQ.js → optimize-GD5TITPG.js} +2 -2
  98. package/dist/pause-4XKZX6FL.js +4 -0
  99. package/dist/pr-T3ZRX47T.js +5 -0
  100. package/dist/proxy_reload-PFY4XHM5.js +6 -0
  101. package/dist/{registry-2C466H3M.js → registry-JMNYNCBV.js} +2 -2
  102. package/dist/remove-7FBB535H.js +7 -0
  103. package/dist/remove_workspace-5AIQBHCU.js +8 -0
  104. package/dist/restart-AF4ZY4Y3.js +8 -0
  105. package/dist/resume-N742ZOVC.js +8 -0
  106. package/dist/{safari-GAIOLJGY.js → safari-2HR3LJQ2.js} +2 -2
  107. package/dist/{sandbox-PLFOIQS7.js → sandbox-L6E7MBDY.js} +2 -2
  108. package/dist/{services-EHNNEOB7.js → services-R3SNMIBX.js} +2 -2
  109. package/dist/{setup-MJNST253.js → setup-WYQIHFIQ.js} +2 -2
  110. package/dist/skills-UOZBWKT3.js +4 -0
  111. package/dist/{slots-HXPXKTWX.js → slots-UBGHQFOB.js} +2 -2
  112. package/dist/{standards-6FNBQ4RZ.js → standards-MEOYJUX6.js} +2 -2
  113. package/dist/start_args-STLXKKP6.js +4 -0
  114. package/dist/starting_prompt-TYH5HSKE.js +4 -0
  115. package/dist/stats-UNDIP3CA.js +4 -0
  116. package/dist/{status-WF6WK6IM.js → status-Q3M4SIAR.js} +2 -2
  117. package/dist/{stop-U4KMNGPR.js → stop-O5OOPTEI.js} +2 -2
  118. package/dist/{telepresence-AZTCVQUL.js → telepresence-TI2OEZ5L.js} +2 -2
  119. package/dist/{test-NMVST43P.js → test-KXAAKIYS.js} +2 -2
  120. package/dist/{tokens-GUSPYDPI.js → tokens-YOP7XET4.js} +2 -2
  121. package/dist/{up-OBVAAABF.js → up-FZW3LG3J.js} +3 -3
  122. package/dist/{v4-XKK6JUWD.js → v4-5UU2FMIC.js} +2 -2
  123. package/dist/wait_load-FKUE7YRE.js +4 -0
  124. package/dist/werkmeister-workspaces.vsix +0 -0
  125. package/dist/{workspace-DBL2JYUS.js → workspace-HYVTNW4M.js} +2 -2
  126. package/package.json +3 -3
  127. package/dist/chunk-NOXWHIIL.js +0 -4
  128. package/dist/clean-CWCLUWVB.js +0 -8
  129. package/dist/close_out-7BWSWTBQ.js +0 -8
  130. package/dist/code-4MXQCUI5.js +0 -4
  131. package/dist/hooks-PDJVGIOB.js +0 -4
  132. package/dist/infra-3J2ZYUIF.js +0 -4
  133. package/dist/init_workspace-VONRLFOE.js +0 -4
  134. package/dist/list_workspaces-BCZVX56P.js +0 -7
  135. package/dist/logs-WIRDHTXV.js +0 -6
  136. package/dist/notes-6URHDVIO.js +0 -4
  137. package/dist/pause-LGD7S36L.js +0 -4
  138. package/dist/pr-H5F3UUXI.js +0 -5
  139. package/dist/proxy_reload-AWPIVCOO.js +0 -6
  140. package/dist/remove-WHUWRIJQ.js +0 -7
  141. package/dist/remove_workspace-B2CGD3KX.js +0 -8
  142. package/dist/restart-S3I74P3O.js +0 -8
  143. package/dist/resume-4KKJQBJZ.js +0 -8
  144. package/dist/skills-2I67Q3KP.js +0 -4
  145. package/dist/start_args-5XIOAWRG.js +0 -4
  146. package/dist/starting_prompt-FV5A7RC3.js +0 -4
  147. package/dist/stats-MT66WXNO.js +0 -4
  148. package/dist/wait_load-K444LLQ3.js +0 -4
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{c as v,k as L}from"./chunk-7TZ3WFDZ.js";import"./chunk-QL7XCD5C.js";import"./chunk-4VIL3XNZ.js";import"./chunk-Z7F2DQS7.js";import"./chunk-W3VZMQZE.js";import"./chunk-EVFZZJV7.js";import"./chunk-GTJ3GX42.js";import"./chunk-R5PYBIIH.js";import"./chunk-Z3JDTSQT.js";import"./chunk-GUKFAVFB.js";import"./chunk-W6W2X3CN.js";import"./chunk-ATFVFJQO.js";import"./chunk-NSTFLAV6.js";import"./chunk-6NHEJ7T7.js";import"./chunk-HSCOWKAY.js";import"./chunk-M2SWNYW5.js";import"./chunk-IOFC5J44.js";import"./chunk-MCAAZMSU.js";import{A as h,B as w,H as b,K as y,P as k,v as f,w as $}from"./chunk-BDVUTE3T.js";import"./chunk-CMX5BNYH.js";import"./chunk-WSZSFGM7.js";import"./chunk-LHAPOPKA.js";import"./chunk-WUHKR4Q5.js";import{o as d}from"./chunk-L34KAVPK.js";import"./chunk-T4I26BBQ.js";import"./chunk-YBITNIB7.js";import"./chunk-V3KFBSHV.js";import"./chunk-3UZRG3XH.js";import"./chunk-PCM7UWAC.js";import"./chunk-YG26JIHA.js";import"./chunk-SNIANMW7.js";import"./chunk-PFAJITCT.js";import{a as c,f as g}from"./chunk-ETTHEQ6J.js";g();import N from"node:os";var M=2**30,x=c((r,t)=>Number.isFinite(r)?`${Number(r.toFixed(1))}${t}`:"no limit","limit");async function P(r){let t=await h(),m=w(N.cpus().length),u=$(),l=await k(),n=L(),a=f(y(l,n??[])).map((o,e)=>{let s=u[o.feature]?.workspace,i=s&&d(s)?.services||null,B=s?b(s,i??void 0):null;return{...o,position:e+1,services:i,cost:B}});if(r.json){let o=c(e=>Number.isFinite(e)?e:null,"n");console.log(JSON.stringify({budget:{memory:o(t.memory),cpus:o(t.cpus),preempt:t.preempt},host_load:m,leases:u,waiting:l,running:n?.map(e=>({feature:e.feature,cpus:e.cost.cpus,memory:e.cost.memory,rank:e.rank,busy:e.busy}))??null,waiters:a.map(e=>({feature:e.feature,position:e.position,services:e.services,cpus:e.cost?.cpus??null,memory:e.cost?.memory??null,waited_ms:e.waitedMs,gate:e.gate}))}));return}console.log(`Budget: ${x(t.memory/M," GiB")} memory, ${x(t.cpus," CPUs")}, host load ${m||"unchecked"}, preemption ${t.preempt?"on":"off"}`);let p=Object.entries(u).sort(([,o],[,e])=>o.slot-e.slot);console.log(p.length?"Slots:":"Slots: none held");for(let[o,e]of p)console.log(` ${e.slot} ${o}${e.workspace?` ${e.workspace}`:""}`);console.log(n?n.length?"Running:":"Running: none":"Running: docker unavailable");for(let o of[...n??[]].sort((e,s)=>s.cost.cpus-e.cost.cpus))console.log(` ${v(o)}`);console.log(a.length?"Waiting:":"Waiting: none");for(let o of a){let e=o.services?`${o.services.join(", ")}${o.gate?" for a running feature":""}`:"whole feature",s=o.cost?` (${Number(o.cost.cpus.toFixed(1))} CPUs, ${(o.cost.memory/M).toFixed(1)} GiB)`:"",i=o.waitedMs?` waited ${Math.round(o.waitedMs/6e4)} min${o.position===1&&o.waitedMs>=3e5?", gets the next free room":""}`:"";console.log(` ${o.position}. ${o.feature} ${e}${s}${i}`)}}c(P,"run");export{P as run};
4
- //# sourceMappingURL=budget-UD5LY74U.js.map
3
+ import{c as v,k as L}from"./chunk-YSGHHJN2.js";import"./chunk-DAUTEJPJ.js";import"./chunk-LE4AT5SS.js";import"./chunk-SR3BZNGU.js";import"./chunk-6EIQPRWO.js";import"./chunk-RSJQIFCK.js";import"./chunk-N6I7BEQE.js";import"./chunk-NT5XYODL.js";import"./chunk-OYCAU54K.js";import"./chunk-5YFUXZBD.js";import"./chunk-CPWZ5ED7.js";import"./chunk-5R7UQGGJ.js";import"./chunk-P54FQEQS.js";import"./chunk-ZELRS5EE.js";import"./chunk-LXS2C6FX.js";import"./chunk-ZEYQCGVN.js";import"./chunk-EGTDIX5E.js";import"./chunk-FTSANPK4.js";import{A as h,B as w,H as b,K as y,P as k,v as f,w as $}from"./chunk-XNDI75MH.js";import"./chunk-GLRMTXB7.js";import"./chunk-AYZ6UTQP.js";import"./chunk-B75RKH5O.js";import"./chunk-BPVZBH4L.js";import{o as d}from"./chunk-J3ZO6S7L.js";import"./chunk-B22ESQSU.js";import"./chunk-Z6Y7KMRS.js";import"./chunk-HDAU3HQS.js";import"./chunk-B6RIK6M7.js";import"./chunk-W27QQWCC.js";import"./chunk-6PPFIYOJ.js";import"./chunk-FMKL7K6O.js";import"./chunk-QKLKSTDV.js";import{a as c,f as g}from"./chunk-ZLFV5EHR.js";g();import N from"node:os";var M=2**30,x=c((r,t)=>Number.isFinite(r)?`${Number(r.toFixed(1))}${t}`:"no limit","limit");async function P(r){let t=await h(),m=w(N.cpus().length),u=$(),l=await k(),n=L(),a=f(y(l,n??[])).map((o,e)=>{let s=u[o.feature]?.workspace,i=s&&d(s)?.services||null,B=s?b(s,i??void 0):null;return{...o,position:e+1,services:i,cost:B}});if(r.json){let o=c(e=>Number.isFinite(e)?e:null,"n");console.log(JSON.stringify({budget:{memory:o(t.memory),cpus:o(t.cpus),preempt:t.preempt},host_load:m,leases:u,waiting:l,running:n?.map(e=>({feature:e.feature,cpus:e.cost.cpus,memory:e.cost.memory,rank:e.rank,busy:e.busy}))??null,waiters:a.map(e=>({feature:e.feature,position:e.position,services:e.services,cpus:e.cost?.cpus??null,memory:e.cost?.memory??null,waited_ms:e.waitedMs,gate:e.gate}))}));return}console.log(`Budget: ${x(t.memory/M," GiB")} memory, ${x(t.cpus," CPUs")}, host load ${m||"unchecked"}, preemption ${t.preempt?"on":"off"}`);let p=Object.entries(u).sort(([,o],[,e])=>o.slot-e.slot);console.log(p.length?"Slots:":"Slots: none held");for(let[o,e]of p)console.log(` ${e.slot} ${o}${e.workspace?` ${e.workspace}`:""}`);console.log(n?n.length?"Running:":"Running: none":"Running: docker unavailable");for(let o of[...n??[]].sort((e,s)=>s.cost.cpus-e.cost.cpus))console.log(` ${v(o)}`);console.log(a.length?"Waiting:":"Waiting: none");for(let o of a){let e=o.services?`${o.services.join(", ")}${o.gate?" for a running feature":""}`:"whole feature",s=o.cost?` (${Number(o.cost.cpus.toFixed(1))} CPUs, ${(o.cost.memory/M).toFixed(1)} GiB)`:"",i=o.waitedMs?` waited ${Math.round(o.waitedMs/6e4)} min${o.position===1&&o.waitedMs>=3e5?", gets the next free room":""}`:"";console.log(` ${o.position}. ${o.feature} ${e}${s}${i}`)}}c(P,"run");export{P as run};
4
+ //# sourceMappingURL=budget-BWZ2PMH2.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import"./chunk-NOXWHIIL.js";import{c as s}from"./chunk-EVFZZJV7.js";import"./chunk-6NHEJ7T7.js";import"./chunk-CMX5BNYH.js";import"./chunk-LHAPOPKA.js";import"./chunk-YG26JIHA.js";import{h as e,l as c}from"./chunk-SNIANMW7.js";import"./chunk-PFAJITCT.js";import{a as r,f as i}from"./chunk-ETTHEQ6J.js";i();async function u(o){o.action!=="prune"&&(c(`Unknown action \`${String(o.action)}\` \u2014 the only action is \`prune\`.`),process.exit(2));let t=await s({name:typeof o.name=="string"?o.name:void 0,reset:!!o.reset,force:!!o.force,dryRun:!!o.dry_run});t.length||console.log("No caches in the registry.");for(let n of t){let a=n.ok?`${e.GREEN}\u2713${e.RESET}`:`${e.RED}\u2717${e.RESET}`;console.log(`${a} ${n.name} (${n.action}): ${n.detail}`)}t.some(n=>!n.ok)&&process.exit(1)}r(u,"run");export{u as run};
4
- //# sourceMappingURL=cache-R3DVOIMT.js.map
3
+ import"./chunk-YG5HEMR5.js";import{c as s}from"./chunk-RSJQIFCK.js";import"./chunk-ZELRS5EE.js";import"./chunk-GLRMTXB7.js";import"./chunk-B75RKH5O.js";import"./chunk-6PPFIYOJ.js";import{h as e,l as c}from"./chunk-FMKL7K6O.js";import"./chunk-QKLKSTDV.js";import{a as r,f as i}from"./chunk-ZLFV5EHR.js";i();async function u(o){o.action!=="prune"&&(c(`Unknown action \`${String(o.action)}\` \u2014 the only action is \`prune\`.`),process.exit(2));let t=await s({name:typeof o.name=="string"?o.name:void 0,reset:!!o.reset,force:!!o.force,dryRun:!!o.dry_run});t.length||console.log("No caches in the registry.");for(let n of t){let a=n.ok?`${e.GREEN}\u2713${e.RESET}`:`${e.RED}\u2717${e.RESET}`;console.log(`${a} ${n.name} (${n.action}): ${n.detail}`)}t.some(n=>!n.ok)&&process.exit(1)}r(u,"run");export{u as run};
4
+ //# sourceMappingURL=cache-G7SLV6F7.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as st}from"./chunk-24T42JYF.js";import{a as se,b as $e,c as le,d as Ae,h as ot,i as Se}from"./chunk-ILAZVFQJ.js";import{a as et,b as tt,c as nt,d as rt,e as be,n as it}from"./chunk-GTJ3GX42.js";import{b as V,c as oe,d as Ze,g as Ke,j as Ce}from"./chunk-FHYI2VBS.js";import{a as Xe}from"./chunk-IOFC5J44.js";import{l as ie,m as we}from"./chunk-LHAPOPKA.js";import{c as Qe}from"./chunk-V3KFBSHV.js";import{d as ke,f as Je,o as ye,q as Ye,r as ze,s as qe}from"./chunk-PCM7UWAC.js";import{A as We,B as He,G as Ge,X as P,r as ge,t as Ve,v as Be,w as he,z as Me}from"./chunk-SNIANMW7.js";import{a,f as O}from"./chunk-ETTHEQ6J.js";O();import*as k from"node:fs";import*as I from"node:os";import*as b from"node:path";O();O();O();function X(e,r=!1){let n=e.length,t=0,o="",i=0,c=16,s=0,l=0,f=0,u=0,p=0;function m(g,v){let w=0,h=0;for(;w<g||!v;){let d=e.charCodeAt(t);if(d>=48&&d<=57)h=h*16+d-48;else if(d>=65&&d<=70)h=h*16+d-65+10;else if(d>=97&&d<=102)h=h*16+d-97+10;else break;t++,w++}return w<g&&(h=-1),h}a(m,"scanHexDigits");function y(g){t=g,o="",i=0,c=16,p=0}a(y,"setPosition");function A(){let g=t;if(e.charCodeAt(t)===48)t++;else for(t++;t<e.length&&H(e.charCodeAt(t));)t++;if(t<e.length&&e.charCodeAt(t)===46)if(t++,t<e.length&&H(e.charCodeAt(t)))for(t++;t<e.length&&H(e.charCodeAt(t));)t++;else return p=3,e.substring(g,t);let v=t;if(t<e.length&&(e.charCodeAt(t)===69||e.charCodeAt(t)===101))if(t++,(t<e.length&&e.charCodeAt(t)===43||e.charCodeAt(t)===45)&&t++,t<e.length&&H(e.charCodeAt(t))){for(t++;t<e.length&&H(e.charCodeAt(t));)t++;v=t}else p=3;return e.substring(g,v)}a(A,"scanNumber");function x(){let g="",v=t;for(;;){if(t>=n){g+=e.substring(v,t),p=2;break}let w=e.charCodeAt(t);if(w===34){g+=e.substring(v,t),t++;break}if(w===92){if(g+=e.substring(v,t),t++,t>=n){p=2;break}switch(e.charCodeAt(t++)){case 34:g+='"';break;case 92:g+="\\";break;case 47:g+="/";break;case 98:g+="\b";break;case 102:g+="\f";break;case 110:g+=`
3
+ import{a as st}from"./chunk-7E5V6XYL.js";import{a as se,b as $e,c as le,d as Ae,h as ot,i as Se}from"./chunk-TYASAQ7U.js";import{a as et,b as tt,c as nt,d as rt,e as be,n as it}from"./chunk-N6I7BEQE.js";import{b as V,c as oe,d as Ze,g as Ke,j as Ce}from"./chunk-4EXMNBQR.js";import{a as Xe}from"./chunk-EGTDIX5E.js";import{l as ie,m as we}from"./chunk-B75RKH5O.js";import{c as Qe}from"./chunk-HDAU3HQS.js";import{d as ke,f as Je,o as ye,q as Ye,r as ze,s as qe}from"./chunk-W27QQWCC.js";import{A as We,B as He,G as Ge,X as P,r as ge,t as Ve,v as Be,w as he,z as Me}from"./chunk-FMKL7K6O.js";import{a,f as O}from"./chunk-ZLFV5EHR.js";O();import*as k from"node:fs";import*as I from"node:os";import*as b from"node:path";O();O();O();function X(e,r=!1){let n=e.length,t=0,o="",i=0,c=16,s=0,l=0,f=0,u=0,p=0;function m(g,v){let w=0,h=0;for(;w<g||!v;){let d=e.charCodeAt(t);if(d>=48&&d<=57)h=h*16+d-48;else if(d>=65&&d<=70)h=h*16+d-65+10;else if(d>=97&&d<=102)h=h*16+d-97+10;else break;t++,w++}return w<g&&(h=-1),h}a(m,"scanHexDigits");function y(g){t=g,o="",i=0,c=16,p=0}a(y,"setPosition");function A(){let g=t;if(e.charCodeAt(t)===48)t++;else for(t++;t<e.length&&H(e.charCodeAt(t));)t++;if(t<e.length&&e.charCodeAt(t)===46)if(t++,t<e.length&&H(e.charCodeAt(t)))for(t++;t<e.length&&H(e.charCodeAt(t));)t++;else return p=3,e.substring(g,t);let v=t;if(t<e.length&&(e.charCodeAt(t)===69||e.charCodeAt(t)===101))if(t++,(t<e.length&&e.charCodeAt(t)===43||e.charCodeAt(t)===45)&&t++,t<e.length&&H(e.charCodeAt(t))){for(t++;t<e.length&&H(e.charCodeAt(t));)t++;v=t}else p=3;return e.substring(g,v)}a(A,"scanNumber");function x(){let g="",v=t;for(;;){if(t>=n){g+=e.substring(v,t),p=2;break}let w=e.charCodeAt(t);if(w===34){g+=e.substring(v,t),t++;break}if(w===92){if(g+=e.substring(v,t),t++,t>=n){p=2;break}switch(e.charCodeAt(t++)){case 34:g+='"';break;case 92:g+="\\";break;case 47:g+="/";break;case 98:g+="\b";break;case 102:g+="\f";break;case 110:g+=`
4
4
  `;break;case 114:g+="\r";break;case 116:g+=" ";break;case 117:let d=m(4,!0);d>=0?g+=String.fromCharCode(d):p=4;break;default:p=5}v=t;continue}if(w>=0&&w<=31)if(Q(w)){g+=e.substring(v,t),p=2;break}else p=6;t++}return g}a(x,"scanString");function $(){if(o="",p=0,i=t,l=s,u=f,t>=n)return i=n,c=17;let g=e.charCodeAt(t);if(ve(g)){do t++,o+=String.fromCharCode(g),g=e.charCodeAt(t);while(ve(g));return c=15}if(Q(g))return t++,o+=String.fromCharCode(g),g===13&&e.charCodeAt(t)===10&&(t++,o+=`
5
5
  `),s++,f=t,c=14;switch(g){case 123:return t++,c=1;case 125:return t++,c=2;case 91:return t++,c=3;case 93:return t++,c=4;case 58:return t++,c=6;case 44:return t++,c=5;case 34:return t++,o=x(),c=10;case 47:let v=t-1;if(e.charCodeAt(t+1)===47){for(t+=2;t<n&&!Q(e.charCodeAt(t));)t++;return o=e.substring(v,t),c=12}if(e.charCodeAt(t+1)===42){t+=2;let w=n-1,h=!1;for(;t<w;){let d=e.charCodeAt(t);if(d===42&&e.charCodeAt(t+1)===47){t+=2,h=!0;break}t++,Q(d)&&(d===13&&e.charCodeAt(t)===10&&t++,s++,f=t)}return h||(t++,p=1),o=e.substring(v,t),c=13}return o+=String.fromCharCode(g),t++,c=16;case 45:if(o+=String.fromCharCode(g),t++,t===n||!H(e.charCodeAt(t)))return c=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=A(),c=11;default:for(;t<n&&L(g);)t++,g=e.charCodeAt(t);if(i!==t){switch(o=e.substring(i,t),o){case"true":return c=8;case"false":return c=9;case"null":return c=7}return c=16}return o+=String.fromCharCode(g),t++,c=16}}a($,"scanNext");function L(g){if(ve(g)||Q(g))return!1;switch(g){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}a(L,"isUnknownContentCharacter");function j(){let g;do g=$();while(g>=12&&g<=15);return g}return a(j,"scanNextNonTrivia"),{setPosition:y,getPosition:a(()=>t,"getPosition"),scan:r?j:$,getToken:a(()=>c,"getToken"),getTokenValue:a(()=>o,"getTokenValue"),getTokenOffset:a(()=>i,"getTokenOffset"),getTokenLength:a(()=>t-i,"getTokenLength"),getTokenStartLine:a(()=>l,"getTokenStartLine"),getTokenStartCharacter:a(()=>i-u,"getTokenStartCharacter"),getTokenError:a(()=>p,"getTokenError")}}a(X,"createScanner");function ve(e){return e===32||e===9}a(ve,"isWhiteSpace");function Q(e){return e===10||e===13}a(Q,"isLineBreak");function H(e){return e>=48&&e<=57}a(H,"isDigit");var lt;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(lt||(lt={}));O();var _=new Array(20).fill(0).map((e,r)=>" ".repeat(r)),G=200,Te={" ":{"\n":new Array(G).fill(0).map((e,r)=>`
6
6
  `+" ".repeat(r)),"\r":new Array(G).fill(0).map((e,r)=>"\r"+" ".repeat(r)),"\r\n":new Array(G).fill(0).map((e,r)=>`\r
@@ -86,4 +86,4 @@ ${mn}`}]}if(r)return[{label:t,ok:!0,detail:`configured for ${e.email} (run \`wer
86
86
  `}a(Ln,"daemonPlist");async function On(e){try{return await fetch(e,{signal:AbortSignal.timeout(2e3)}),!0}catch{return!1}}a(On,"anythingAnswers");async function jn(e,r,n={}){let t="werkmeister daemon",o=Fe(n),i=n.port===void 0?Qe():`http://127.0.0.1:${n.port}`,c=a(()=>(n.serving??On)(i),"answers"),s=`nothing answers at ${i}: the daemon is not running`;if(!o.darwin)return e&&!await c()?[{label:t,ok:!1,optional:!0,detail:`not on macOS and ${s} \u2014 run \`werkmeister infra connect\``}]:[{label:t,ok:!0,detail:"not on macOS: `werkmeister infra connect` starts it"}];let l=Ln(n);if(l===null)return[{label:t,ok:!1,detail:`${V.label} not built or bundled; run the build first`}];if(e||!r){let u=k.existsSync(o.plist)?k.readFileSync(o.plist,"utf8"):null,p=u===null?"not installed":u===l?"installed":"stale",m=e&&u===l&&!await c()?`, but ${s} \u2014 see ${o.logFile}, or run \`werkmeister daemon restart\``:"";return[{label:t,ok:u===l&&!m,optional:!0,detail:`launchd agent ${o.plist}: ${p}${m}${u===l?"":" \u2014 run `werkmeister machine setup`"}`}]}k.existsSync(o.plist)||await(n.stopPidServer??(()=>Ce(V)))();let f=It(oe,o.plist,l,o.uid,o.runner);return"error"in f?[{label:t,ok:!1,detail:f.error.join(" ")}]:[{label:t,ok:!0,detail:`${f.changed?"installed":"up to date"}: launchd agent ${o.plist}, logs \u2192 ${o.logFile}`}]}a(jn,"syncDaemonAgent");function Ar(e={}){let r="werkmeister daemon",n=Fe(e);return k.existsSync(n.plist)?(n.runner(["launchctl","bootout",`gui/${n.uid}/${oe}`]),k.rmSync(n.plist,{force:!0}),{label:r,ok:!0,detail:`removed launchd agent ${n.plist}`}):{label:r,ok:!0,detail:"no launchd agent installed"}}a(Ar,"uninstallDaemonAgent");var je="jbbz.werkmeister-vscode",_n=b.join("dist","werkmeister-workspaces.vsix");function Pt(e=N,r=P()){let[n,t]=e(["code","--list-extensions","--show-versions"]),o=`${je}@`,i=n===0?t.split(`
87
87
  `).find(s=>s.trim().toLowerCase().startsWith(o)):void 0,c=b.join(r,_n);return{cli:n===0,installed:i?i.trim().slice(o.length):null,bundled:k.existsSync(c)?{path:c,version:q(b.join(r,"package.json"))?.version}:null,checkout:q(b.join(r,"..","..","packages","werkmeister-vscode","package.json"))?.version??null}}a(Pt,"vscodeExtensionState");function In(e,r,n=Pt(),t=N){let o="VS Code extension (optional)";if(!n.cli)return[{label:o,ok:!0,detail:"`code` not on PATH \u2014 skipped (in VS Code: \"Shell Command: Install 'code' command in PATH\")"}];if(!n.bundled)return n.installed&&n.checkout&&n.installed!==n.checkout?[{label:o,ok:!1,optional:!0,detail:`${n.installed}, checkout has ${n.checkout} \u2014 pnpm --filter werkmeister-vscode install:local`}]:[{label:o,ok:!0,detail:`${n.installed??"not installed"}; running from a checkout, which bundles no .vsix \u2014 build it from packages/werkmeister-vscode`}];let i=n.bundled.version;if(n.installed===i)return[{label:o,ok:!0,detail:`${je} ${i}`}];if(e||!r)return n.installed?[{label:o,ok:!1,optional:!0,detail:`${n.installed} < bundled ${i} \u2014 re-run \`werkmeister machine setup\``}]:[{label:o,ok:!0,detail:"not installed (opt in via `werkmeister machine setup`)"}];let[c,s]=t(["code","--install-extension",n.bundled.path,"--force"]);return c!==0?[{label:o,ok:!1,optional:!0,detail:`code --install-extension failed: ${U(s)}`}]:[{label:o,ok:!0,detail:`installed ${je} ${i} \u2014 reload VS Code windows to pick it up`}]}a(In,"syncVscodeExtension");function Nn(e,r,n={}){let t="telepresence (optional)",o=se.join("."),i=a(()=>{let[L,j]=e(["telepresence","version"]);if(L!==0)return[null,null];let g=ot(j);return g===null?[{label:t,ok:!1,optional:!0,detail:`version unparseable: ${j.slice(0,80)}`},null]:[null,g]},"probe"),[c,s]=i();if(c)return[c];if(s&&!Se(s,se))return[{label:t,ok:!0,detail:`OSS client ${s.join(".")}`}];let l=s!==null,f=l?`${s.join(".")} < required ${o}`:"not installed";if(r||!n.install)return l?[{label:t,ok:!1,optional:!0,detail:`${f} \u2014 ${Ae}`}]:[{label:t,ok:!0,detail:`not installed (needed only for \`werkmeister infra intercept\`; ${Ae})`}];let[u]=e(["brew","--version"]);if(u!==0)return[{label:t,ok:!l,optional:!0,detail:`${f}; Homebrew not found \u2014 ${le}`}];let p=l?"upgrade":"install",[m,y]=e(["brew",p,$e]);if(m!==0)return[{label:t,ok:!1,optional:!0,detail:`brew ${p} ${$e} failed: ${U(y)}
88
88
  Telepresence stays optional \u2014 this does not block anything except \`werkmeister infra intercept\`. Install manually with: ${le}`}];let[A,x]=i();if(A)return[A];if(x===null)return[{label:t,ok:!1,optional:!0,detail:`brew ${p} reported success but telepresence is not on PATH`}];let $=x.join(".");return Se(x,se)?[{label:t,ok:!1,optional:!0,detail:`brew installed ${$}, still < required ${o} \u2014 ${le}`}]:[{label:t,ok:!0,detail:`installed OSS client ${$} via brew`}]}a(Nn,"syncTelepresence");function Rn(e,r,n){let t="playwright chromium (optional)",o=`playwright@${st}`,i="",c=a(()=>{let[u,p]=e(["npx","-y",o,"install","--dry-run","chromium"]);i=p;let m=[...p.matchAll(/Install location:\s*(\S.*)$/gm)].map(y=>y[1].trim());return u!==0||m.length===0?null:m.filter(y=>!k.existsSync(b.join(y,"INSTALLATION_COMPLETE")))},"missingDirs"),s=c();if(s===null)return[{label:t,ok:!1,optional:!0,detail:`\`npx ${o} install --dry-run chromium\` failed: ${U(i)}`}];if(s.length===0)return[{label:t,ok:!0,detail:`chromium for ${o} present`}];if(r)return[{label:t,ok:!1,optional:!0,detail:`chromium for ${o} missing \u2014 re-run \`werkmeister machine setup\``}];let l=(n??Tt)(["npx","-y",o,"install","chromium"]),f=c();if(l!==0||f===null||f.length>0){let u=l!==0?`exited ${l}`:"finished, but the browser is still not reported installed";return[{label:t,ok:!1,optional:!0,detail:`\`npx ${o} install chromium\` ${u} \u2014 run it manually to see why`}]}return[{label:t,ok:!0,detail:`installed chromium for ${o}`}]}a(Rn,"syncPlaywright");async function Sr(e={}){let r=e.checkOnly??!1,n=e.reposRoot??Ge(),t=e.claudePluginsDir??b.join(I.homedir(),".claude","plugins"),o=e.repoPluginDir??b.join(P(),"plugins",E),i=e.runner??N,c=e.jira??Ye(),s=[],l=e.pathDirs??{repos_root:ye().repos_root,workspaces_root:ye().workspaces_root};s.push(...an(r,l)),s.push(...un(r,e.registry??{}));let[f]=i(["claude","--version"]);if(f===127)s.push({label:"claude CLI",ok:!1,detail:`not found on PATH \u2014 the ${E} and ponytail plugins cannot be installed without it. Install Claude Code from https://claude.com/claude-code (the VS Code extension alone does not put \`claude\` on PATH), then re-run \`werkmeister machine setup\`.`});else{for(let m of Xt){let y=null;m.name===E&&(y=a(()=>yt(o,t),"driftProbe"));let A=xt(m,t,i,r,y);s.push(...A),m.name===E&&(r||A.every(x=>x.ok))&&s.push(...Zt(t,i,r))}for(let m of Kt)s.push(...ln(m,t,i,r,e.installOptionalPlugins??!1))}let u=e.workspaceRepo??(qe()||tn(i));u?s.push(...wt(n,rn(u),i,r,e.repointWorkspaceOrigin)):s.push({label:`repo ${_e}`,ok:!1,optional:!0,detail:"no workspace repo configured and `gh` could not name one \u2014 set overrides.workspace_repo (or run `gh auth login`, then `werkmeister machine setup`). Workspaces will fall back to plain directories."}),(e.demo||k.existsSync(b.join(n,vt)))&&s.push(...wt(n,on,i,r)),s.push(...it({reposRoot:n,checkOnly:r}));let p=typeof e.hostnames=="function"?e.hostnames():e.hostnames??[];return s.push(...pn(r,{hostnames:p,ingress:e.ingress??void 0,skipSudo:e.skipSudo},e.interactiveRunner)),s.push(...await hn(c,r,e.jiraVerifier)),s.push(...Nn(i,r,{install:e.installTelepresence})),s.push(...Rn(i,r,e.interactiveRunner)),s.push(...wn(r,e.mapEditorSchemas??!1)),s.push(...$n(r,e.grantStandardsDir??!1)),s.push(...Sn(r)),s.push(...In(r,e.installVscodeExtension??!1,Pt(i),i)),s.push(...xn(r,e.installPrWatch??!1,{runner:i})),s.push(...await jn(r,e.installDaemon??!1,{runner:i})),s}a(Sr,"runSetup");export{yt as a,_e as b,Ct as c,$t as d,en as e,br as f,tn as g,Lt as h,yn as i,ne as j,bn as k,Tn as l,En as m,$r as n,jn as o,Ar as p,Pt as q,Sr as r};
89
- //# sourceMappingURL=chunk-VCE3C3SZ.js.map
89
+ //# sourceMappingURL=chunk-3RUNYSC4.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{l as w,m as S}from"./chunk-LHAPOPKA.js";import{b as F}from"./chunk-V3KFBSHV.js";import{X as T,aa as C,j as m,k as b,l as g,m as y}from"./chunk-SNIANMW7.js";import{b as D}from"./chunk-PFAJITCT.js";import{a as s,f as A}from"./chunk-ETTHEQ6J.js";A();import{spawn as X}from"node:child_process";import*as o from"node:fs";import*as G from"node:net";import*as M from"node:os";import*as u from"node:path";var $={label:"Workspaces dashboard",dir:"werkmeister-dashboard",port:3001,stem:"mcp-server",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/dashboard.js"},H={label:"Werkmeister MCP server",dir:"werkmeister-mcp",get port(){return F()},stem:"sandbox-mcp",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/mcp.js",env:{HOST:"0.0.0.0"}},k="com.werkmeister.daemon";function Y(t=M.homedir()){return u.join(t,"Library","LaunchAgents",`${k}.plist`)}s(Y,"daemonPlistPath");function B(t){return t===H&&process.platform==="darwin"&&o.existsSync(Y())}s(B,"launchdOwns");function Z(t,e){let r=`gui/${process.getuid?.()??0}/${k}`,n=S(["launchctl","kickstart",...e?["-k"]:[],r],{capture:!0,timeout:15});return n.status!==0?(y(`launchctl kickstart ${r} failed: ${(n.stderr||n.stdout).trim()}`),!1):(b(`${t.label} ${e?"restarted":"started"} by launchd (${k})`),!0)}s(Z,"kickstart");var O=[$,H];function v(t){return new Promise(e=>setTimeout(e,t*1e3))}s(v,"sleep");async function _(t){let e;try{e=S(["lsof","-ti",`tcp:${t}`,"-sTCP:LISTEN"],{capture:!0,timeout:5}).stdout}catch(n){if(n instanceof w&&(n.code==="ENOENT"||n.code==="ETIMEDOUT"))return;throw n}let r=e.split(/\s+/).map(n=>n.trim()).filter(n=>/^\d+$/.test(n)).map(n=>Number.parseInt(n,10));for(let n of r)try{process.kill(n,"SIGTERM")}catch{}if(r.length!==0){for(let n=0;n<20;n++){if(!await W(t))return;await v(.25)}for(let n of r)try{process.kill(n,"SIGKILL")}catch{}}}s(_,"freePort");function K(){let t=D(M.homedir());return o.mkdirSync(t,{recursive:!0}),t}s(K,"stateDir");function p(t){return u.join(K(),`${t.stem}.pid`)}s(p,"pidFile");function tt(t){return u.join(K(),`${t.stem}.log`)}s(tt,"logFile");function I(t){return u.join(C(),"apps",t.dir)}s(I,"appDir");function et(t,e){let r=e.lastIndexOf("/"),n=r>=0?u.join(t,e.slice(0,r)):t,i=r>=0?e.slice(r+1):e,c=new RegExp("^"+i.split("*").map(d=>d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$"),f;try{f=o.readdirSync(n,{withFileTypes:!0})}catch{return[]}return f.filter(d=>c.test(d.name)).map(d=>u.join(n,d.name))}s(et,"globMatch");function rt(t){let e=I(t),r=u.join(e,t.buildRef),n;try{let c=o.statSync(r);if(!c.isFile())return!0;n=c.mtimeMs}catch{return!0}let i=["*.ts","*.html","package.json","tsconfig*.json","src/*.ts","src/*.css","src/lib/*.ts"];for(let c of i)for(let f of et(e,c))try{if(o.statSync(f).mtimeMs>n)return!0}catch{}return!1}s(rt,"distStale");function nt(t,e){try{return o.statSync(e).mtimeMs>o.statSync(p(t)).mtimeMs}catch{return!1}}s(nt,"buildNewerThanRunning");function st(t){let e;try{e=o.readFileSync(p(t),"utf8")}catch{return null}let r=e.trim();return/^[+-]?\d+$/.test(r)?Number.parseInt(r,10):null}s(st,"readPid");function U(t){try{process.kill(t,0)}catch(e){let r=e.code;if(r==="ESRCH")return!1;if(r==="EPERM")return!0;throw e}return!0}s(U,"alive");function W(t){return new Promise(e=>{let r=G.connect({host:"127.0.0.1",port:t}),n=s(i=>{r.destroy(),e(i)},"done");r.setTimeout(1e3,()=>n(!1)),r.once("connect",()=>n(!0)),r.once("error",()=>n(!1))})}s(W,"portOpen");async function P(t){try{let e=await fetch(`http://127.0.0.1:${t}/__werkmeister-health`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}",signal:AbortSignal.timeout(2e3)});return e.status!==400&&e.status<500}catch{return!1}}s(P,"serves");function L(t=$){let e=st(t);return e&&U(e)?[!0,e]:[!1,null]}s(L,"isRunning");async function dt(t=$){let[e,r]=L(t);return{running:e,pid:r,port:t.port,url:`http://localhost:${t.port}/`,healthy:e&&await P(t.port)}}s(dt,"status");function q(t){let e=I(t);if(o.existsSync(u.join(e,"package.json")))return{dir:e,entry:t.entry,bundled:!1};let r=t.bundled?u.join(T(),t.bundled):null;return!r||!o.existsSync(r)?null:{dir:T(),entry:r,bundled:!0}}s(q,"appEntry");function mt(t){let e=q(t);return e?u.resolve(e.dir,e.entry):void 0}s(mt,"appEntryPath");async function z(t=$,e=!0,r=!1){let[n,i]=L(t);if(n&&i===process.pid)return b(`${t.label} is this process (pid ${i}); leaving it running`),!0;if(B(t))return!r&&await P(t.port)?(b(`${t.label} already running under launchd (http://localhost:${t.port}/)`),!0):Z(t,r);n&&!await P(t.port)&&(m(`${t.label} (pid ${i}) is not serving on port ${t.port}; restarting it.`),r=!0);let c=q(t);if(!c)return g(`${t.label} not found at ${I(t)}; skipping`),!1;let{dir:f,entry:d}=c,Q=c.bundled?d:u.join(f,t.buildRef);c.bundled&&(e=!1);let x=!1;if(e&&rt(t)){m(`Building ${t.label} (sources changed)...`);let l;try{l=S(["pnpm","run","build"],{cwd:f,capture:!0,timeout:300})}catch(a){if(a instanceof w&&a.code==="ENOENT")return g(`pnpm not found; skipping ${t.label}`),!1;if(a instanceof w&&a.code==="ETIMEDOUT")return y(`${t.label} build timed out; skipping`),!1;throw a}if(l.status!==0){let a=(l.stderr.trim()||l.stdout.trim()).slice(-800);return y(`${t.label} build failed; skipping start:
3
+ import{l as w,m as S}from"./chunk-B75RKH5O.js";import{b as F}from"./chunk-HDAU3HQS.js";import{X as T,aa as C,j as m,k as b,l as g,m as y}from"./chunk-FMKL7K6O.js";import{b as D}from"./chunk-QKLKSTDV.js";import{a as s,f as A}from"./chunk-ZLFV5EHR.js";A();import{spawn as X}from"node:child_process";import*as o from"node:fs";import*as G from"node:net";import*as M from"node:os";import*as u from"node:path";var $={label:"Workspaces dashboard",dir:"werkmeister-dashboard",port:3001,stem:"mcp-server",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/dashboard.js"},H={label:"Werkmeister MCP server",dir:"werkmeister-mcp",get port(){return F()},stem:"sandbox-mcp",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/mcp.js",env:{HOST:"0.0.0.0"}},k="com.werkmeister.daemon";function Y(t=M.homedir()){return u.join(t,"Library","LaunchAgents",`${k}.plist`)}s(Y,"daemonPlistPath");function B(t){return t===H&&process.platform==="darwin"&&o.existsSync(Y())}s(B,"launchdOwns");function Z(t,e){let r=`gui/${process.getuid?.()??0}/${k}`,n=S(["launchctl","kickstart",...e?["-k"]:[],r],{capture:!0,timeout:15});return n.status!==0?(y(`launchctl kickstart ${r} failed: ${(n.stderr||n.stdout).trim()}`),!1):(b(`${t.label} ${e?"restarted":"started"} by launchd (${k})`),!0)}s(Z,"kickstart");var O=[$,H];function v(t){return new Promise(e=>setTimeout(e,t*1e3))}s(v,"sleep");async function _(t){let e;try{e=S(["lsof","-ti",`tcp:${t}`,"-sTCP:LISTEN"],{capture:!0,timeout:5}).stdout}catch(n){if(n instanceof w&&(n.code==="ENOENT"||n.code==="ETIMEDOUT"))return;throw n}let r=e.split(/\s+/).map(n=>n.trim()).filter(n=>/^\d+$/.test(n)).map(n=>Number.parseInt(n,10));for(let n of r)try{process.kill(n,"SIGTERM")}catch{}if(r.length!==0){for(let n=0;n<20;n++){if(!await W(t))return;await v(.25)}for(let n of r)try{process.kill(n,"SIGKILL")}catch{}}}s(_,"freePort");function K(){let t=D(M.homedir());return o.mkdirSync(t,{recursive:!0}),t}s(K,"stateDir");function p(t){return u.join(K(),`${t.stem}.pid`)}s(p,"pidFile");function tt(t){return u.join(K(),`${t.stem}.log`)}s(tt,"logFile");function I(t){return u.join(C(),"apps",t.dir)}s(I,"appDir");function et(t,e){let r=e.lastIndexOf("/"),n=r>=0?u.join(t,e.slice(0,r)):t,i=r>=0?e.slice(r+1):e,c=new RegExp("^"+i.split("*").map(d=>d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$"),f;try{f=o.readdirSync(n,{withFileTypes:!0})}catch{return[]}return f.filter(d=>c.test(d.name)).map(d=>u.join(n,d.name))}s(et,"globMatch");function rt(t){let e=I(t),r=u.join(e,t.buildRef),n;try{let c=o.statSync(r);if(!c.isFile())return!0;n=c.mtimeMs}catch{return!0}let i=["*.ts","*.html","package.json","tsconfig*.json","src/*.ts","src/*.css","src/lib/*.ts"];for(let c of i)for(let f of et(e,c))try{if(o.statSync(f).mtimeMs>n)return!0}catch{}return!1}s(rt,"distStale");function nt(t,e){try{return o.statSync(e).mtimeMs>o.statSync(p(t)).mtimeMs}catch{return!1}}s(nt,"buildNewerThanRunning");function st(t){let e;try{e=o.readFileSync(p(t),"utf8")}catch{return null}let r=e.trim();return/^[+-]?\d+$/.test(r)?Number.parseInt(r,10):null}s(st,"readPid");function U(t){try{process.kill(t,0)}catch(e){let r=e.code;if(r==="ESRCH")return!1;if(r==="EPERM")return!0;throw e}return!0}s(U,"alive");function W(t){return new Promise(e=>{let r=G.connect({host:"127.0.0.1",port:t}),n=s(i=>{r.destroy(),e(i)},"done");r.setTimeout(1e3,()=>n(!1)),r.once("connect",()=>n(!0)),r.once("error",()=>n(!1))})}s(W,"portOpen");async function P(t){try{let e=await fetch(`http://127.0.0.1:${t}/__werkmeister-health`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}",signal:AbortSignal.timeout(2e3)});return e.status!==400&&e.status<500}catch{return!1}}s(P,"serves");function L(t=$){let e=st(t);return e&&U(e)?[!0,e]:[!1,null]}s(L,"isRunning");async function dt(t=$){let[e,r]=L(t);return{running:e,pid:r,port:t.port,url:`http://localhost:${t.port}/`,healthy:e&&await P(t.port)}}s(dt,"status");function q(t){let e=I(t);if(o.existsSync(u.join(e,"package.json")))return{dir:e,entry:t.entry,bundled:!1};let r=t.bundled?u.join(T(),t.bundled):null;return!r||!o.existsSync(r)?null:{dir:T(),entry:r,bundled:!0}}s(q,"appEntry");function mt(t){let e=q(t);return e?u.resolve(e.dir,e.entry):void 0}s(mt,"appEntryPath");async function z(t=$,e=!0,r=!1){let[n,i]=L(t);if(n&&i===process.pid)return b(`${t.label} is this process (pid ${i}); leaving it running`),!0;if(B(t))return!r&&await P(t.port)?(b(`${t.label} already running under launchd (http://localhost:${t.port}/)`),!0):Z(t,r);n&&!await P(t.port)&&(m(`${t.label} (pid ${i}) is not serving on port ${t.port}; restarting it.`),r=!0);let c=q(t);if(!c)return g(`${t.label} not found at ${I(t)}; skipping`),!1;let{dir:f,entry:d}=c,Q=c.bundled?d:u.join(f,t.buildRef);c.bundled&&(e=!1);let x=!1;if(e&&rt(t)){m(`Building ${t.label} (sources changed)...`);let l;try{l=S(["pnpm","run","build"],{cwd:f,capture:!0,timeout:300})}catch(a){if(a instanceof w&&a.code==="ENOENT")return g(`pnpm not found; skipping ${t.label}`),!1;if(a instanceof w&&a.code==="ETIMEDOUT")return y(`${t.label} build timed out; skipping`),!1;throw a}if(l.status!==0){let a=(l.stderr.trim()||l.stdout.trim()).slice(-800);return y(`${t.label} build failed; skipping start:
4
4
  ${a}`),!1}x=!0}else e&&m(`${t.label} build up to date; skipping build`);if(n&&!x&&nt(t,Q)&&(m(`Running ${t.label} predates the current build; bouncing to reload it.`),r=!0),n&&!x&&!r)return b(`${t.label} already running (pid ${i}, http://localhost:${t.port}/)`),!0;n&&await J(t),await _(t.port);let E=tt(t),V={...process.env,PORT:String(t.port),...t.env??{}};m(`Starting ${t.label} on http://localhost:${t.port}/ ...`);let j=o.openSync(E,"w"),h=X("node",[d],{cwd:f,detached:!0,stdio:["ignore",j,j],env:V}),R=await new Promise(l=>{h.once("spawn",()=>l("spawned")),h.once("error",a=>l(a))});if(o.closeSync(j),R!=="spawned"){if(R.code==="ENOENT")return g(`node not found; skipping ${t.label}`),!1;throw R}h.unref(),o.writeFileSync(p(t),String(h.pid));let N=!1;h.once("exit",()=>{N=!0});for(let l=0;l<20;l++){if(N)return y(`${t.label} exited immediately (see ${E})`),o.rmSync(p(t),{force:!0}),!1;if(await W(t.port))return b(`${t.label} started (pid ${h.pid}, http://localhost:${t.port}/)`),!0;await v(.25)}return g(`${t.label} started (pid ${h.pid}) but port ${t.port} not up yet; check ${E}`),!0}s(z,"start");async function J(t=$){if(B(t))return m(`${t.label} is kept up by launchd (${k}); leaving it running`),!1;let[e,r]=L(t);if(!e||r===null)return o.rmSync(p(t),{force:!0}),!1;m(`Stopping ${t.label} (pid ${r})...`);try{process.kill(r,"SIGTERM")}catch(i){let c=i.code;if(c==="ESRCH")return o.rmSync(p(t),{force:!0}),!1;if(c==="EPERM")return y(`Cannot signal pid ${r} (owned by another user)`),!1;throw i}let n=!1;for(let i=0;i<20;i++){if(!U(r)){n=!0;break}await v(.25)}if(!n)try{process.kill(r,"SIGKILL")}catch{}return o.rmSync(p(t),{force:!0}),await _(t.port),b(`${t.label} stopped`),!0}s(J,"stop");async function ot(t=$,e=!1){await z(t,e,!0)}s(ot,"restart");async function ht(t=!0){for(let e of O)await z(e,t)}s(ht,"startAll");async function bt(){for(let t of O)await J(t)}s(bt,"stopAll");async function pt(t=!1){for(let e of O)await ot(e,t)}s(pt,"restartAll");export{$ as a,H as b,k as c,Y as d,P as e,dt as f,q as g,mt as h,z as i,J as j,ot as k,ht as l,bt as m,pt as n};
5
- //# sourceMappingURL=chunk-FHYI2VBS.js.map
5
+ //# sourceMappingURL=chunk-4EXMNBQR.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{b as a}from"./chunk-PFAJITCT.js";import{a as s,f as i}from"./chunk-ETTHEQ6J.js";i();import*as e from"node:fs";import*as o from"node:path";var n=`#!/bin/sh
3
+ import{b as a}from"./chunk-QKLKSTDV.js";import{a as s,f as i}from"./chunk-ZLFV5EHR.js";i();import*as e from"node:fs";import*as o from"node:path";var n=`#!/bin/sh
4
4
  # Generated by \`werkmeister workspace init\` (SW-124); rerun it to regenerate.
5
5
  # Runs <cmd...> with HOME set to a fresh temporary directory, removed on exit,
6
6
  # so no test or CLI exercise reads or writes the real ~/.werkmeister.
@@ -20,6 +20,8 @@ no_wait=\${WERKMEISTER_NO_WAIT:-}
20
20
  # 75: the wait is spent and load is still over, so running would pile on (SW-540); any other failure runs.
21
21
  } || { s=$?; [ "$s" -ne 75 ] || exit 75; }
22
22
  tmp=$(mktemp -d) || exit 1
23
+ # os.tmpdir() scratch from the wrapped command goes with the temp HOME (SW-799).
24
+ export TMPDIR="$tmp"
23
25
  trap 'rm -rf "$tmp"' EXIT
24
26
  trap 'exit 130' HUP INT TERM
25
27
  # Corepack keeps pnpm under HOME; without this a fresh HOME re-downloads it every run.
@@ -37,4 +39,4 @@ status=$?
37
39
  [ "$status" -eq 0 ] || echo "with-temp-home: exit $status; host load $(uptime | sed 's/.*load averages*: //; s/,//g') on $(getconf _NPROCESSORS_ONLN) cores" >&2
38
40
  exit "$status"
39
41
  `;function p(r){return o.join(a(r),"bin","with-temp-home")}s(p,"tempHomeWrapper");function m(r){let t=p(r);return e.mkdirSync(o.dirname(t),{recursive:!0}),e.writeFileSync(t,n),e.chmodSync(t,493),t}s(m,"writeTempHomeWrapper");export{n as a,p as b,m as c};
40
- //# sourceMappingURL=chunk-ATFVFJQO.js.map
42
+ //# sourceMappingURL=chunk-5R7UQGGJ.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{l as k,m as x}from"./chunk-LHAPOPKA.js";import{a as w}from"./chunk-SNIANMW7.js";import{a as s,e as h,f as i}from"./chunk-ETTHEQ6J.js";i();var j=h(w(),1);import*as c from"node:fs";import*as f from"node:path";function D(e){let t=e.split("/");return t.some((r,o)=>r==="node_modules"||o<t.length-1&&r.startsWith("."))}s(D,"pruned");function A(e,t=""){let r=[];for(let o of c.readdirSync(f.join(e,t),{withFileTypes:!0})){let a=t?`${t}/${o.name}`:o.name;if(o.isDirectory()){if(o.name==="node_modules"||o.name.startsWith("."))continue;r.push(...A(e,a))}else o.isFile()&&r.push(a)}return r}s(A,"walk");function z(e,t){let[r,o]=t(["git","-C",e,"ls-files","--cached","--others","--exclude-standard"]);return(r===0?o.split(`
3
+ import{l as k,m as x}from"./chunk-B75RKH5O.js";import{a as w}from"./chunk-FMKL7K6O.js";import{a as s,e as h,f as i}from"./chunk-ZLFV5EHR.js";i();var j=h(w(),1);import*as c from"node:fs";import*as f from"node:path";function D(e){let t=e.split("/");return t.some((r,o)=>r==="node_modules"||o<t.length-1&&r.startsWith("."))}s(D,"pruned");function A(e,t=""){let r=[];for(let o of c.readdirSync(f.join(e,t),{withFileTypes:!0})){let a=t?`${t}/${o.name}`:o.name;if(o.isDirectory()){if(o.name==="node_modules"||o.name.startsWith("."))continue;r.push(...A(e,a))}else o.isFile()&&r.push(a)}return r}s(A,"walk");function z(e,t){let[r,o]=t(["git","-C",e,"ls-files","--cached","--others","--exclude-standard"]);return(r===0?o.split(`
4
4
  `).map(n=>n.trim()).filter(Boolean):A(e)).filter(n=>!D(n)&&c.existsSync(f.join(e,n))).sort()}s(z,"listRepoFiles");function y(e,t){return c.readFileSync(f.join(e.root,t),"utf8")}s(y,"readText");function S(e,t){if(!e.files.includes(t))return null;let r=JSON.parse(y(e,t));return r&&typeof r=="object"&&!Array.isArray(r)?r:null}s(S,"readJson");function J(e){return(0,j.parseAllDocuments)(e).map(t=>{if(t.errors.length)throw new Error(t.errors[0].message);return t.toJS()})}s(J,"yamlDocs");function O(e){try{let t=x(e,{capture:!0,timeout:120});return[t.status,t.status===0?t.stdout||"":(t.stderr||t.stdout||"").trim()]}catch(t){if(t instanceof k&&t.code==="ENOENT")return[127,`${e[0]}: command not found`];if(t instanceof k&&t.code==="ETIMEDOUT")return[124,`${e.join(" ")}: timed out`];throw t}}s(O,"stdoutRunner");i();var b=h(w(),1);import*as m from"node:path";i();function g(e,t){return{value:e,source:t,confidence:"stated"}}s(g,"stated");function I(e,t){return{value:e,source:t,confidence:"guessed"}}s(I,"guessed");var T={npm:"npm install",pnpm:"corepack enable && pnpm install",yarn:"corepack enable && yarn install"},W={npm:["package-lock.json","npm ci"],pnpm:["pnpm-lock.yaml","corepack enable && pnpm install --frozen-lockfile"]};function K(e){return[e("pnpm-lock.yaml")&&"pnpm install --frozen-lockfile",e("package-lock.json")&&"npm ci",e("yarn.lock")&&(e(".yarnrc.yml")?"yarn install --immutable":"yarn install --frozen-lockfile"),e("uv.lock")&&"uv sync --frozen"].filter(t=>!!t)}s(K,"frozenInstalls");function F(e,t){let r=s(n=>new RegExp("^"+n.replace(/^\.\//,"").replace(/\/+$/,"").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\0").replace(/\*/g,"[^/]+").replace(/\0/g,".+")+"$"),"toRe"),o=e.filter(n=>!n.startsWith("!")).map(r),a=e.filter(n=>n.startsWith("!")).map(n=>r(n.slice(1)));return t.filter(n=>n.endsWith("/package.json")).map(n=>m.posix.dirname(n)).filter(n=>o.some(l=>l.test(n))&&!a.some(l=>l.test(n))).sort()}s(F,"expandWorkspaceGlobs");function M(e,t=null,r=null){let o=s(p=>e.files.includes(p),"has"),a=o("pnpm-lock.yaml")||o("pnpm-workspace.yaml")?"pnpm":o("yarn.lock")?"yarn":"npm",n=S(e,"package.json");if(!n)return{pm:a,packageDirs:[],setupName:null,setupFields:{}};let l=[],u="package.json";if(o("pnpm-workspace.yaml")){let p=(0,b.parse)(y(e,"pnpm-workspace.yaml"))?.packages;l=Array.isArray(p)?p.map(String):[],u="pnpm-workspace.yaml"}else{let p=n.workspaces;l=Array.isArray(p)?p.map(String):Array.isArray(p?.packages)?p.packages.map(String):[],l.length&&(u="package.json \u2192 workspaces")}let d=W[a],E=d&&o(d[0])?d[1]:T[a];return{pm:a,packageDirs:F(l,e.files),setupName:t??`${m.basename(e.root)}-install`,setupFields:{command:g(E,`${u} (${a})`),node_modules_volume:g(r??`${m.basename(e.root)}-node-modules`,u)}}}s(M,"detectWorkspace");export{z as a,y as b,S as c,J as d,O as e,g as f,I as g,K as h,M as i};
5
- //# sourceMappingURL=chunk-GUKFAVFB.js.map
5
+ //# sourceMappingURL=chunk-5YFUXZBD.js.map
@@ -1,10 +1,10 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{U as Y}from"./chunk-BDVUTE3T.js";import{d as N,e as L}from"./chunk-CMX5BNYH.js";import{l as R,m as g}from"./chunk-LHAPOPKA.js";import{b as J}from"./chunk-YG26JIHA.js";import{E as K,J as M,M as h,P as U,Z as B,_ as f,a as ne,j as l,k as y,l as A,m as p,t as W,x}from"./chunk-SNIANMW7.js";import{a as n,e as oe,f as u}from"./chunk-ETTHEQ6J.js";u();var q=oe(ne(),1);import*as $ from"node:fs";import*as S from"node:path";var se=/@sha256:[0-9a-f]{64}$/;function m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(m,"isDict");function ie(e,r){let t=(e??x()).infra,o=m(t)?t.baseline:void 0;if(!m(o))return[];let i=r??h();return Object.entries(o).map(([s,a])=>{let d=`config.yaml infra.baseline.${s}`,H=i[s];if(!m(H))throw new Error(`${d}: no such service in services.yaml`);let b=m(a)?a.image:void 0;if(typeof b!="string"||!se.test(b))throw new Error(`${d}.image must be pinned as <image>@sha256:<digest>, got ${JSON.stringify(b)}. Resolve one with: docker pull <image>:<tag> && docker inspect --format='{{index .RepoDigests 0}}' <image>:<tag>`);let _=m(a)?a.environment??{}:{};if(!m(_)||Object.values(_).some(v=>m(v)||Array.isArray(v)))throw new Error(`${d}.environment must be a map of plain values`);return{service:s,image:b,port:Number(H.internal_port??3e3),environment:Object.fromEntries(Object.entries(_).map(([v,te])=>[v,String(te)]))}})}n(ie,"baselineSpecs");function I(){return S.join(f(),"compose","baseline.override.yml")}n(I,"baselineOverridePath");var ae=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/config.yaml infra.baseline \u2014 do not edit.","# Merged over infra/compose/shared-infra.yml by every `docker compose` call the CLI makes."];function ce(e){let r=Object.fromEntries(e.map(t=>{let o=`baseline-${t.service}`;return[o,{image:t.image,container_name:`w9r-${o}`,restart:"unless-stopped",...Object.keys(t.environment).length>0?{environment:t.environment}:{},networks:{"werkmeister-shared":{aliases:[o]}}}]}));return[...ae,(0,q.stringify)({services:r},{aliasDuplicateObjects:!1})].join(`
3
+ import{U as Y}from"./chunk-XNDI75MH.js";import{d as N,e as L}from"./chunk-GLRMTXB7.js";import{l as R,m as g}from"./chunk-B75RKH5O.js";import{b as J}from"./chunk-6PPFIYOJ.js";import{E as K,J as M,M as h,P as U,Z as B,_ as f,a as ne,j as l,k as y,l as A,m as p,t as W,x}from"./chunk-FMKL7K6O.js";import{a as n,e as oe,f as u}from"./chunk-ZLFV5EHR.js";u();var q=oe(ne(),1);import*as $ from"node:fs";import*as S from"node:path";var se=/@sha256:[0-9a-f]{64}$/;function m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(m,"isDict");function ie(e,r){let t=(e??x()).infra,o=m(t)?t.baseline:void 0;if(!m(o))return[];let i=r??h();return Object.entries(o).map(([s,a])=>{let d=`config.yaml infra.baseline.${s}`,H=i[s];if(!m(H))throw new Error(`${d}: no such service in services.yaml`);let b=m(a)?a.image:void 0;if(typeof b!="string"||!se.test(b))throw new Error(`${d}.image must be pinned as <image>@sha256:<digest>, got ${JSON.stringify(b)}. Resolve one with: docker pull <image>:<tag> && docker inspect --format='{{index .RepoDigests 0}}' <image>:<tag>`);let _=m(a)?a.environment??{}:{};if(!m(_)||Object.values(_).some(v=>m(v)||Array.isArray(v)))throw new Error(`${d}.environment must be a map of plain values`);return{service:s,image:b,port:Number(H.internal_port??3e3),environment:Object.fromEntries(Object.entries(_).map(([v,te])=>[v,String(te)]))}})}n(ie,"baselineSpecs");function I(){return S.join(f(),"compose","baseline.override.yml")}n(I,"baselineOverridePath");var ae=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/config.yaml infra.baseline \u2014 do not edit.","# Merged over infra/compose/shared-infra.yml by every `docker compose` call the CLI makes."];function ce(e){let r=Object.fromEntries(e.map(t=>{let o=`baseline-${t.service}`;return[o,{image:t.image,container_name:`w9r-${o}`,restart:"unless-stopped",...Object.keys(t.environment).length>0?{environment:t.environment}:{},networks:{"werkmeister-shared":{aliases:[o]}}}]}));return[...ae,(0,q.stringify)({services:r},{aliasDuplicateObjects:!1})].join(`
4
4
  `)}n(ce,"renderBaselineOverride");function Fe(e=!1){let r=ie(),t=I();$.mkdirSync(S.dirname(t),{recursive:!0}),$.writeFileSync(t,ce(r)),e||l(`Generated ${t}`)}n(Fe,"generateBaselineOverride");u();import*as w from"node:fs";import*as k from"node:path";function E(e,r){return K(e??h(),r??U())}n(E,"forwardSpecs");function fe(e,r){return E(e,r).map(t=>`${t.name}|${t.listen}|${t.remote}|${t.ns}|${t.prefix}|${t.health}`)}n(fe,"buildForwardRows");function z(){return k.join(f(),"k8s-port-forward","forwards")}n(z,"forwardsFilePath");function P(){return k.join(f(),"compose","k8s-forwards.override.yml")}n(P,"overrideFilePath");function ue(e){e=e??z(),w.mkdirSync(k.dirname(e),{recursive:!0});let r=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/services.yaml \u2014 do not edit.","# Format: name|listen_port|remote_port|namespace|pod_prefix|health_path",...fe(),""].join(`
5
5
  `);return w.writeFileSync(e,r),e}n(ue,"generateForwardsFile");var V=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/services.yaml \u2014 do not edit.","# Merged over infra/compose/shared-infra.yml by every `docker compose` call the CLI makes."];function le(e){return e.length===0?[...V,"services:"," k8s-forwards: {}",""].join(`
6
6
  `):[...V,"services:"," k8s-forwards:"," ports:",...e.map(r=>` - "${r.listen}:${r.listen}" # ${r.name}`)," networks:"," werkmeister-shared:"," aliases:",...e.map(r=>` - k8s-${r.name}`),""].join(`
7
7
  `)}n(le,"renderK8sForwardsOverride");function X(e=!1){ue();let r=P();w.mkdirSync(k.dirname(r),{recursive:!0}),w.writeFileSync(r,le(E())),e||l(`Generated ${z()} and ${r}`)}n(X,"generateK8sForwards");u();import*as D from"node:fs";import*as F from"node:path";var j="w9r-infra",He="sandbox-infra",C="w9r-k8s-forwards";function me(){let r=x().infra?.profiles;return Array.isArray(r)?r.filter(t=>typeof t=="string"&&t!==""):[]}n(me,"infraProfiles");function Q(){let e=P();D.existsSync(e)||X(!0);let r=I();return{argv:["docker","compose","-f",F.join(B(),"compose","shared-infra.yml"),"-f",e,...D.existsSync(r)?["-f",r]:[],"-p",j,...me().flatMap(t=>["--profile",t])],env:{...process.env,WERKMEISTER_STATE_DIR:f()},cwd:F.dirname(f())}}n(Q,"composeInvocation");u();import*as c from"node:fs";import*as Z from"node:http";import*as G from"node:net";import*as O from"node:path";import{setTimeout as de}from"node:timers/promises";async function pe(){return{"k8s-forwards":(await N(j,"k8s-forwards",{all:!1})??[]).some(r=>r.health==="healthy"||r.state==="running"&&!r.health)}}n(pe,"checkPortForwardHealth");function he(e,r){if(!e)return!0;let t=new Map;for(let o of e){let i=Y(o.labels,"feature");if(!i)continue;let s=t.get(i)??{local:[],running:!1};s.local.push(o.service),s.running||=o.state==="running",t.set(i,s)}return[...t.values()].some(o=>o.running&&M(o.local,r))}n(he,"clusterNeeded");async function we(e){let r;try{r=h()}catch{return!0}return he(e===void 0?await N():e,r)}n(we,"forwarderNeeded");function ke(e){return c.existsSync(e)&&c.statSync(e).isDirectory()}n(ke,"isDir");function ye(e){return/server:\s*https:\/\/(127\.0\.0\.1|localhost)\b/.test(e)?e.replace(/(server:\s*https:\/\/)(127\.0\.0\.1|localhost)\b/g,"$1host.docker.internal").replace(/^(\s*)certificate-authority-data:.*$/gm,"$1insecure-skip-tls-verify: true"):e}n(ye,"shimLocalApiServer");function ge(){let e=O.join(f(),"k8s-port-forward","kubeconfig");ke(e)&&c.rmSync(e,{recursive:!0,force:!0}),c.mkdirSync(O.dirname(e),{recursive:!0}),l("Refreshing k8s-port-forward/kubeconfig from current context...");try{let r=g(["kubectl","config","view","--raw","--minify","--flatten"],{capture:!0,timeout:30});if(r.status===0){c.writeFileSync(e,ye(r.stdout));let t=g(["kubectl","--kubeconfig",e,"config","current-context"],{capture:!0,timeout:15}),o=t.status===0?t.stdout.trim():"?";y(`Kubeconfig pinned to context: ${o}`)}else p(`kubectl config view failed: ${r.stderr.trim()}`)}catch(r){if(r instanceof R&&(r.code==="ENOENT"||r.code==="ETIMEDOUT"))p(`Could not generate kubeconfig: ${r.message}`);else throw r}return c.existsSync(e)&&c.statSync(e).isFile()}n(ge,"refreshKubeconfig");function Ee(){try{return g(["kubectl","--request-timeout=3s","get","--raw","/readyz"],{capture:!0,timeout:20}).status===0}catch(e){if(e instanceof R)return!1;throw e}}n(Ee,"clusterReachable");async function er(){if(W())return l("k8s port-forwards skipped (WERKMEISTER_FIXTURE)"),"healthy";if((await pe())["k8s-forwards"]??!1)return y("k8s port-forwards container is healthy"),"healthy";if(A("k8s port-forwards container is unhealthy \u2014 restarting..."),!ge())return p("Not restarting k8s-forwards without a kubeconfig file to mount"),"failed";if(!Ee())return A("No reachable k8s cluster \u2014 skipping port-forwards; services not run locally are unavailable"),"failed";let{argv:r,env:t,cwd:o}=Q();try{let i=g([...r,"up","-d","--force-recreate","k8s-forwards"],{capture:!0,timeout:60,env:t,cwd:o});return i.status!==0?(p(`Failed to restart k8s-forwards: ${i.stderr.trim()}`),"failed"):(y("k8s port-forwards container restarted"),"restarted")}catch(i){if(i instanceof R)return p(`Failed to restart k8s-forwards: ${i.message}`),"failed";throw i}}n(er,"ensurePortForwardsHealthy");async function rr(e=3e4,r=500){let t=E();if(!t.length)return;l("Waiting for port-forwards to reconnect...");let o=Date.now()+e;for(;;){if(t=(await Promise.all(t.map(async s=>({spec:s,ok:(await re(s.listen,s.health)).ok})))).filter(s=>!s.ok).map(s=>s.spec),!t.length){y("k8s port-forwards are carrying traffic");return}if(Date.now()>=o)throw new J(`k8s port-forwards did not come back within ${Math.round(e/1e3)}s: ${t.map(s=>`${s.name}:${s.listen}`).join(", ")}
8
8
  Check \`docker logs ${C}\` and your kubeconfig.`,"FORWARDS_NEVER_READY");await de(r)}}n(rr,"waitForForwards");function be(e,r,t=3500){return new Promise(o=>{let i=Z.get({host:"127.0.0.1",port:e,path:r,timeout:t},s=>{s.resume();let a=s.statusCode??0;o({ok:a<500,detail:`HTTP ${a}`})});i.on("timeout",()=>{i.destroy(),o({ok:!1,detail:"timeout"})}),i.on("error",s=>o({ok:!1,detail:s.code??s.message}))})}n(be,"checkHttpHealth");var ee={redis:{send:Buffer.from(`PING\r
9
9
  `),ok:n(e=>e.toString("latin1").startsWith("+PONG"),"ok")},postgres:{send:Buffer.from([0,0,0,8,4,210,22,47]),ok:n(e=>e[0]===83||e[0]===78,"ok")}};function ve(e,r,t=3500){return new Promise(o=>{let i=ee[r],s=G.connect({host:"127.0.0.1",port:e,timeout:t});s.on("connect",()=>s.write(i.send)),s.once("data",a=>{s.destroy();let d=i.ok(a);o({ok:d,detail:d?`${r} ok`:`${r} bad reply`})}),s.on("timeout",()=>{s.destroy(),o({ok:!1,detail:"timeout (connected, no reply)"})}),s.on("error",a=>o({ok:!1,detail:a.code??a.message})),s.on("close",()=>o({ok:!1,detail:"closed without reply"}))})}n(ve,"checkWireHealth");function xe(e,r=2500){return new Promise(t=>{let o=G.connect({host:"127.0.0.1",port:e,timeout:r});o.on("connect",()=>{o.destroy(),t({ok:!0,detail:"tcp open"})}),o.on("timeout",()=>{o.destroy(),t({ok:!1,detail:"timeout"})}),o.on("error",i=>t({ok:!1,detail:i.code??i.message}))})}n(xe,"checkTcpHealth");function re(e,r){return r.startsWith("/")?be(e,r):ee[r]?ve(e,r):r?Promise.resolve({ok:!1,detail:`unknown probe "${r}"`}):xe(e)}n(re,"checkForwardHealth");async function Re(e,r){return(await re(e,r)).ok?"alive":"dead"}n(Re,"classifyForward");async function tr(){let e=await L(C),r;try{r=E()}catch{return[]}let t=e?null:await we()?"container_down":"stopped",o=[];for(let i of r)o.push({name:i.name,listen_port:i.listen,remote_port:i.remote,health_path:i.health,status:t??await Re(i.listen,i.health)});return o}n(tr,"getPerServiceStatus");export{ie as a,Fe as b,X as c,j as d,He as e,C as f,me as g,Q as h,pe as i,we as j,ge as k,er as l,rr as m,re as n,tr as o};
10
- //# sourceMappingURL=chunk-W3VZMQZE.js.map
10
+ //# sourceMappingURL=chunk-6EIQPRWO.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as e,f as r}from"./chunk-ETTHEQ6J.js";r();var p="WORKSPACE",t=class extends Error{static{e(this,"SandboxError")}code;constructor(s,n){super(s),this.code=n,this.name="SandboxError"}},o=class extends t{static{e(this,"WorkspaceError")}constructor(s){super(s,p),this.name="WorkspaceError"}};export{p as a,t as b,o as c};
4
- //# sourceMappingURL=chunk-YG26JIHA.js.map
3
+ import{a as e,f as r}from"./chunk-ZLFV5EHR.js";r();var p="WORKSPACE",t=class extends Error{static{e(this,"SandboxError")}code;constructor(s,n){super(s),this.code=n,this.name="SandboxError"}},o=class extends t{static{e(this,"WorkspaceError")}constructor(s){super(s,p),this.name="WorkspaceError"}};export{p as a,t as b,o as c};
4
+ //# sourceMappingURL=chunk-6PPFIYOJ.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{i as _,j}from"./chunk-6NHEJ7T7.js";import{a as R}from"./chunk-MCAAZMSU.js";import{$ as O}from"./chunk-BDVUTE3T.js";import{l as y,m as I,n as N}from"./chunk-LHAPOPKA.js";import{b as h}from"./chunk-YG26JIHA.js";import{M as x,R as A,S as F,j as g,k as v,l as d,n as p,o as T}from"./chunk-SNIANMW7.js";import{b as S}from"./chunk-PFAJITCT.js";import{a,f as $}from"./chunk-ETTHEQ6J.js";$();import*as n from"node:fs";import{createRequire as C}from"node:module";import*as c from"node:path";var m="1.63.0",P=600,D=["playwright.config.ts","playwright.config.js","playwright.config.mjs"];function U(t){let e=[t];try{for(let s of n.readdirSync(t,{withFileTypes:!0}))s.isDirectory()&&n.existsSync(c.join(t,s.name,".git"))&&e.push(c.join(t,s.name))}catch{}return e}a(U,"playwrightSearchDirs");function k(t){for(let e of t)if(n.existsSync(e)&&n.statSync(e).isDirectory()&&D.some(s=>n.existsSync(c.join(e,s))))return e;return null}a(k,"playwrightCwd");function M(t){let e=U(t).slice(1).map(f=>c.basename(f)),s="";try{s=/^SERVICES=(.*)$/m.exec(n.readFileSync(c.join(t,".env"),"utf8"))?.[1]??""}catch{}let l=s.split(",").map(f=>f.trim()).filter(Boolean),r=x(),i=R(r),u=j(_(e,A(),l),r,F(),new Set(Object.keys(i))).map(f=>` - ${f.service} \u2014 test: ${f.test??"\u2014"} \u2014 validate: ${f.validate}`);return"No Playwright suite found for this workspace (no playwright.config.{ts,js,mjs} in the workspace root or a repo worktree), so nothing was run."+(u.length?`
3
+ import{i as _,j}from"./chunk-ZELRS5EE.js";import{a as R}from"./chunk-FTSANPK4.js";import{$ as O}from"./chunk-XNDI75MH.js";import{l as y,m as I,n as N}from"./chunk-B75RKH5O.js";import{b as h}from"./chunk-6PPFIYOJ.js";import{M as x,R as A,S as F,j as g,k as v,l as d,n as p,o as T}from"./chunk-FMKL7K6O.js";import{b as S}from"./chunk-QKLKSTDV.js";import{a,f as $}from"./chunk-ZLFV5EHR.js";$();import*as n from"node:fs";import{createRequire as C}from"node:module";import*as c from"node:path";var m="1.63.0",P=600,D=["playwright.config.ts","playwright.config.js","playwright.config.mjs"];function U(t){let e=[t];try{for(let s of n.readdirSync(t,{withFileTypes:!0}))s.isDirectory()&&n.existsSync(c.join(t,s.name,".git"))&&e.push(c.join(t,s.name))}catch{}return e}a(U,"playwrightSearchDirs");function k(t){for(let e of t)if(n.existsSync(e)&&n.statSync(e).isDirectory()&&D.some(s=>n.existsSync(c.join(e,s))))return e;return null}a(k,"playwrightCwd");function M(t){let e=U(t).slice(1).map(f=>c.basename(f)),s="";try{s=/^SERVICES=(.*)$/m.exec(n.readFileSync(c.join(t,".env"),"utf8"))?.[1]??""}catch{}let l=s.split(",").map(f=>f.trim()).filter(Boolean),r=x(),i=R(r),u=j(_(e,A(),l),r,F(),new Set(Object.keys(i))).map(f=>` - ${f.service} \u2014 test: ${f.test??"\u2014"} \u2014 validate: ${f.validate}`);return"No Playwright suite found for this workspace (no playwright.config.{ts,js,mjs} in the workspace root or a repo worktree), so nothing was run."+(u.length?`
4
4
  Validate each service as follows:
5
5
  ${u.join(`
6
6
  `)}`:"")}a(M,"noSuiteMessage");function b(t){try{let e=C(c.join(t,"package.json")).resolve("@playwright/test/package.json");return JSON.parse(n.readFileSync(e,"utf8")).version??null}catch{return null}}a(b,"installedPlaywrightVersion");async function Q({feature:t,workspace:e,extraArgs:s=[],signal:l}){let r=await O(t),i=k(U(e));if(i===null)return{status:1,cwd:i,slot:r,message:M(e)};r===null&&(d(`Feature '${t}' does not have an allocated slot`),d("Start it first with: werkmeister feature up "+t),d("Running tests anyway with feature header routing..."));let w={...process.env,WERKMEISTER_FEATURE:t,SANDBOX_FEATURE:t};r&&(w.WERKMEISTER_SLOT=String(r)),g(`Working directory: ${i}`);let u=b(i);u!==m&&d(`@playwright/test is ${u??"not installed"} here, but \`werkmeister machine setup\` installs Chromium for ${m} -- the browser may be missing. Fix with: npm install -D @playwright/test@${m}`),g(`WERKMEISTER_FEATURE=${t}`);let f=["npx","playwright","test",...s];g(`Running: ${f.join(" ")}`),p(`
@@ -54,4 +54,4 @@ test('feature: ${t}', async ({ page, context }) => {
54
54
  await page.pause();
55
55
  });
56
56
  `,"featureSpec");function tt(t,e,s){if(c.basename(t)!==t)throw new h(`Invalid feature name: ${t}`,"BAD_FEATURE_NAME");let l=[["playwright.config.ts",L(s.baseUrl)],[`${t}.spec.ts`,W(t,s)]],r=[];for(let[i,w]of l){let u=c.join(e,i);n.existsSync(u)||(n.writeFileSync(u,w),r.push(u))}return r}a(tt,"scaffoldFeatureTests");function et(t){let e=b(t);if(e===m){g(`@playwright/test ${e} present`);return}if(e){d(`workspace pins @playwright/test ${e}, but \`werkmeister machine setup\` installs Chromium for ${m} -- if launch fails, run: npx playwright@${e} install chromium`);return}let s=["npm","install","--save-dev",`@playwright/test@${m}`];if(!n.existsSync(S(t)))throw new h(`${t} is not a workspace (no ${c.basename(S(t))}/) -- pass --workspace, or install manually there: ${s.join(" ")}`,"NOT_A_WORKSPACE");let l=T(),r;try{r=I(s,{cwd:t,...l?{}:{capture:!0}})}catch(i){r={status:127,stderr:i instanceof Error?i.message:String(i)}}if(r.status!==0)throw!l&&r.stderr&&p(r.stderr,"stderr"),new h(`\`${s.join(" ")}\` failed in ${t}`,"PLAYWRIGHT_INSTALL");v(`installed @playwright/test ${m}`)}a(et,"ensurePlaywright");export{m as a,Q as b,Z as c,tt as d,et as e};
57
- //# sourceMappingURL=chunk-24T42JYF.js.map
57
+ //# sourceMappingURL=chunk-7E5V6XYL.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{n as C,r as M}from"./chunk-PCM7UWAC.js";import{a as j,h as B,j as b,m as x,n as S}from"./chunk-SNIANMW7.js";import{b as I}from"./chunk-PFAJITCT.js";import{a as i,e as L,f as F}from"./chunk-ETTHEQ6J.js";F();var _=L(j(),1);import{spawn as W}from"node:child_process";import*as k from"node:crypto";import*as p from"node:fs";import*as v from"node:net";import*as R from"node:os";import*as P from"node:path";function N(){return`.${M().local_domain.replace(/^\.+/,"")}`}i(N,"cookieDomain");var y={chrome:{label:"Google Chrome",engine:"chromium",macPath:"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"},chromium:{label:"Chromium",engine:"chromium",macPath:"/Applications/Chromium.app/Contents/MacOS/Chromium"},brave:{label:"Brave Browser",engine:"chromium",macPath:"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"},edge:{label:"Microsoft Edge",engine:"chromium",macPath:"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"},firefox:{label:"Firefox",engine:"gecko",macPath:"/Applications/Firefox.app/Contents/MacOS/firefox"},safari:{label:"Safari",engine:"webkit",macPath:"/Applications/Safari.app/Contents/MacOS/Safari"},duckduckgo:{label:"DuckDuckGo",engine:"webkit",macPath:"/Applications/DuckDuckGo.app/Contents/MacOS/DuckDuckGo"}},A="chrome",oe={key:"browser",label:"Browser for `werkmeister feature open`",help:"Chromium browsers (chrome, chromium, brave, edge) work via CDP; safari works via Apple's bundled safaridriver. Firefox/DuckDuckGo are listed for visibility but aren't wired up yet.",acceptEmpty:!1,pattern:`(${Object.keys(y).join("|")})`,placeholder:A,choicesFn:i(()=>Object.keys(y),"choicesFn")};function H(){if(process.env.CHROME_BIN)return process.env.CHROME_BIN;let s=C().overrides??{};if(s.browser_path)return s.browser_path;let t=s.browser||A,e=y[t];if(!e)return x(`Unknown overrides.browser '${t}' -- choices: ${Object.keys(y).join(", ")}`),null;if(e.engine!=="chromium"){let o=e.engine==="webkit"?"WebKit":"Gecko",r=Object.keys(y).filter(n=>y[n].engine==="chromium");return x(`${e.label} uses ${o}, not Chromium -- \`werkmeister feature open\` only speaks the Chrome DevTools Protocol, which just Chromium-based browsers support. Run \`werkmeister machine setup\` and pick one of: ${r.join(", ")}.`),null}return e.macPath}i(H,"resolveBrowserBinary");function $(s){return new Promise(t=>setTimeout(t,s))}i($,"sleep");var O=class s{static{i(this,"WS")}host;port;sock;fatalError=null;rxbuf=Buffer.alloc(0);nextId=0;pending=[];handler=null;set onMessage(t){if(this.handler=t,t)for(;this.pending.length;)t(this.pending.shift())}constructor(t,e,o){this.sock=t,this.host=e,this.port=o}static connect(t){let e=new URL(t),o=e.hostname,r=e.port?parseInt(e.port,10):80,n=e.pathname||"/";return e.search&&(n+=e.search),new Promise((a,l)=>{let c=v.createConnection({host:o,port:r}),u=new s(c,o,r),d=!1,f=Buffer.alloc(0);c.setTimeout(1e4,()=>c.destroy(new Error("websocket handshake timed out"))),c.on("error",h=>{d?u.fatalError||(u.fatalError=h):l(h)}),c.on("close",()=>{d?u.fatalError||(u.fatalError=new Error("websocket closed by peer")):l(new Error("websocket handshake failed (closed)"))});let m=i(h=>{f=Buffer.concat([f,h]);let w=f.indexOf(`\r
3
+ import{n as C,r as M}from"./chunk-W27QQWCC.js";import{a as j,h as B,j as b,m as x,n as S}from"./chunk-FMKL7K6O.js";import{b as I}from"./chunk-QKLKSTDV.js";import{a as i,e as L,f as F}from"./chunk-ZLFV5EHR.js";F();var _=L(j(),1);import{spawn as W}from"node:child_process";import*as k from"node:crypto";import*as p from"node:fs";import*as v from"node:net";import*as R from"node:os";import*as P from"node:path";function N(){return`.${M().local_domain.replace(/^\.+/,"")}`}i(N,"cookieDomain");var y={chrome:{label:"Google Chrome",engine:"chromium",macPath:"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"},chromium:{label:"Chromium",engine:"chromium",macPath:"/Applications/Chromium.app/Contents/MacOS/Chromium"},brave:{label:"Brave Browser",engine:"chromium",macPath:"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"},edge:{label:"Microsoft Edge",engine:"chromium",macPath:"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"},firefox:{label:"Firefox",engine:"gecko",macPath:"/Applications/Firefox.app/Contents/MacOS/firefox"},safari:{label:"Safari",engine:"webkit",macPath:"/Applications/Safari.app/Contents/MacOS/Safari"},duckduckgo:{label:"DuckDuckGo",engine:"webkit",macPath:"/Applications/DuckDuckGo.app/Contents/MacOS/DuckDuckGo"}},A="chrome",oe={key:"browser",label:"Browser for `werkmeister feature open`",help:"Chromium browsers (chrome, chromium, brave, edge) work via CDP; safari works via Apple's bundled safaridriver. Firefox/DuckDuckGo are listed for visibility but aren't wired up yet.",acceptEmpty:!1,pattern:`(${Object.keys(y).join("|")})`,placeholder:A,choicesFn:i(()=>Object.keys(y),"choicesFn")};function H(){if(process.env.CHROME_BIN)return process.env.CHROME_BIN;let s=C().overrides??{};if(s.browser_path)return s.browser_path;let t=s.browser||A,e=y[t];if(!e)return x(`Unknown overrides.browser '${t}' -- choices: ${Object.keys(y).join(", ")}`),null;if(e.engine!=="chromium"){let o=e.engine==="webkit"?"WebKit":"Gecko",r=Object.keys(y).filter(n=>y[n].engine==="chromium");return x(`${e.label} uses ${o}, not Chromium -- \`werkmeister feature open\` only speaks the Chrome DevTools Protocol, which just Chromium-based browsers support. Run \`werkmeister machine setup\` and pick one of: ${r.join(", ")}.`),null}return e.macPath}i(H,"resolveBrowserBinary");function $(s){return new Promise(t=>setTimeout(t,s))}i($,"sleep");var O=class s{static{i(this,"WS")}host;port;sock;fatalError=null;rxbuf=Buffer.alloc(0);nextId=0;pending=[];handler=null;set onMessage(t){if(this.handler=t,t)for(;this.pending.length;)t(this.pending.shift())}constructor(t,e,o){this.sock=t,this.host=e,this.port=o}static connect(t){let e=new URL(t),o=e.hostname,r=e.port?parseInt(e.port,10):80,n=e.pathname||"/";return e.search&&(n+=e.search),new Promise((a,l)=>{let c=v.createConnection({host:o,port:r}),u=new s(c,o,r),d=!1,f=Buffer.alloc(0);c.setTimeout(1e4,()=>c.destroy(new Error("websocket handshake timed out"))),c.on("error",h=>{d?u.fatalError||(u.fatalError=h):l(h)}),c.on("close",()=>{d?u.fatalError||(u.fatalError=new Error("websocket closed by peer")):l(new Error("websocket handshake failed (closed)"))});let m=i(h=>{f=Buffer.concat([f,h]);let w=f.indexOf(`\r
4
4
  \r
5
5
  `);if(w===-1)return;if(!f.subarray(0,f.indexOf(`\r
6
6
  `)).toString("latin1").includes(" 101 ")){c.destroy(),l(new Error(`websocket handshake failed: ${f.subarray(0,80).toString("latin1")}`));return}u.rxbuf=f.subarray(w+4),c.setTimeout(0),c.off("data",m),c.on("data",g=>{u.rxbuf=Buffer.concat([u.rxbuf,g]),u.pump()}),d=!0,a(u),u.pump()},"onHandshakeData");c.on("data",m),c.on("connect",()=>{let h=k.randomBytes(16).toString("base64"),w=`GET ${n} HTTP/1.1\r
@@ -37,9 +37,9 @@ Sec-WebSocket-Version: 13\r
37
37
  tick();
38
38
  setInterval(tick,1000); // self-heal across SPA route changes
39
39
  })();
40
- `}i(J,"badgeScript");function K(){return new Promise((s,t)=>{let e=v.createServer();e.once("error",t),e.listen(0,"127.0.0.1",()=>{let o=e.address().port;e.close(()=>s(o))})})}i(K,"findFreePort");async function q(s,t=15){let e=Date.now()+t*1e3,o=null;for(;Date.now()<e;)try{return(await(await fetch(`http://127.0.0.1:${s}/json/version`,{signal:AbortSignal.timeout(2e3)})).json()).webSocketDebuggerUrl}catch(r){o=r,await $(250)}throw new Error(`Chrome debug endpoint never came up on :${s} (${o})`)}i(q,"waitForBrowserWs");var T=class{static{i(this,"FeatureSession")}ws;feature;url;script;procExited;shouldStop;configured=new Set;cookieSet=!1;navigated=!1;constructor(t,e,o,r,n,a){this.ws=t,this.feature=e,this.url=r,this.script=J(e,o),this.procExited=n,this.shouldStop=a}configureTarget(t){this.cookieSet||(this.ws.send("Network.enable",null,t),this.ws.send("Network.setCookie",{name:"X-Feature",value:this.feature,domain:N(),path:"/",secure:!0,sameSite:"Lax"},t),this.cookieSet=!0),this.ws.send("Page.enable",null,t),this.ws.send("Page.addScriptToEvaluateOnNewDocument",{source:this.script},t),this.ws.send("Runtime.evaluate",{expression:this.script},t),this.navigated||(this.ws.send("Page.navigate",{url:this.url},t),this.navigated=!0)}onEvent(t){if(t?.method!=="Target.attachedToTarget")return;let e=t.params,o=e.sessionId;if(e.targetInfo?.type==="page"&&!this.configured.has(o)){this.configured.add(o);try{this.configureTarget(o)}catch(r){x(`could not configure tab: ${r instanceof Error?r.message:r}`)}}}async start(t=15e3){this.ws.send("Target.setAutoAttach",{autoAttach:!0,waitForDebuggerOnStart:!1,flatten:!0}),this.ws.onMessage=o=>this.onEvent(o);let e=Date.now()+t;for(;!this.navigated;){if(this.ws.fatalError)throw this.ws.fatalError;if(this.procExited()||Date.now()>e)return!1;await $(50)}return!0}async poll(){for(;!this.procExited()&&!this.shouldStop();){if(this.ws.fatalError)throw this.ws.fatalError;await $(1e3)}}};function X(){if(process.env.CHROME_BIN)return!1;let s=C().overrides??{};return s.browser_path?!1:(s.browser||A)==="safari"}i(X,"wantsSafari");async function ne(s,t,e={}){if(X()){let{launchSafariWindow:o}=await import("./safari-GAIOLJGY.js");return o(s,t,e)}return V(s,t,e)}i(ne,"launchFeatureWindow");async function V(s,t,e={}){let o=e.size??"1440,900",r=e.position??null,n=H();if(!n)return null;if(!p.existsSync(n))return x(`Browser not found at ${n} (set CHROME_BIN, or overrides.browser_path in config.yaml, to override -- or run \`werkmeister machine setup\` to pick an installed browser)`),null;let a=z(s),l=await K(),c=p.mkdtempSync(P.join(R.tmpdir(),`chrome-${s}-`));if(!r){let g=Number(G(s)%8n)*40;r=`${60+g},${60+g}`}let u=[`--user-data-dir=${c}`,`--remote-debugging-port=${l}`,"--no-first-run","--no-default-browser-check","--new-window",`--window-size=${o}`,`--window-position=${r}`,"about:blank"],d=W(n,u,{stdio:"ignore",detached:!0});d.unref();let f=!1;d.on("exit",()=>{f=!0});let m=null;async function h(){m?.close();try{d.kill()}catch{}if(!f&&!await new Promise(D=>{let U=setTimeout(()=>D(!1),5e3);d.once("exit",()=>{clearTimeout(U),D(!0)})}))try{d.kill("SIGKILL")}catch{}p.rmSync(c,{recursive:!0,force:!0})}i(h,"cleanup");let w,E=!1;try{if(m=await O.connect(await q(l)),w=new T(m,s,a,t,()=>f,()=>E),!await w.start())return x("The browser window never came up \u2014 nothing was tagged."),await h(),null}catch(g){throw await h(),g}return S(`
40
+ `}i(J,"badgeScript");function K(){return new Promise((s,t)=>{let e=v.createServer();e.once("error",t),e.listen(0,"127.0.0.1",()=>{let o=e.address().port;e.close(()=>s(o))})})}i(K,"findFreePort");async function q(s,t=15){let e=Date.now()+t*1e3,o=null;for(;Date.now()<e;)try{return(await(await fetch(`http://127.0.0.1:${s}/json/version`,{signal:AbortSignal.timeout(2e3)})).json()).webSocketDebuggerUrl}catch(r){o=r,await $(250)}throw new Error(`Chrome debug endpoint never came up on :${s} (${o})`)}i(q,"waitForBrowserWs");var T=class{static{i(this,"FeatureSession")}ws;feature;url;script;procExited;shouldStop;configured=new Set;cookieSet=!1;navigated=!1;constructor(t,e,o,r,n,a){this.ws=t,this.feature=e,this.url=r,this.script=J(e,o),this.procExited=n,this.shouldStop=a}configureTarget(t){this.cookieSet||(this.ws.send("Network.enable",null,t),this.ws.send("Network.setCookie",{name:"X-Feature",value:this.feature,domain:N(),path:"/",secure:!0,sameSite:"Lax"},t),this.cookieSet=!0),this.ws.send("Page.enable",null,t),this.ws.send("Page.addScriptToEvaluateOnNewDocument",{source:this.script},t),this.ws.send("Runtime.evaluate",{expression:this.script},t),this.navigated||(this.ws.send("Page.navigate",{url:this.url},t),this.navigated=!0)}onEvent(t){if(t?.method!=="Target.attachedToTarget")return;let e=t.params,o=e.sessionId;if(e.targetInfo?.type==="page"&&!this.configured.has(o)){this.configured.add(o);try{this.configureTarget(o)}catch(r){x(`could not configure tab: ${r instanceof Error?r.message:r}`)}}}async start(t=15e3){this.ws.send("Target.setAutoAttach",{autoAttach:!0,waitForDebuggerOnStart:!1,flatten:!0}),this.ws.onMessage=o=>this.onEvent(o);let e=Date.now()+t;for(;!this.navigated;){if(this.ws.fatalError)throw this.ws.fatalError;if(this.procExited()||Date.now()>e)return!1;await $(50)}return!0}async poll(){for(;!this.procExited()&&!this.shouldStop();){if(this.ws.fatalError)throw this.ws.fatalError;await $(1e3)}}};function X(){if(process.env.CHROME_BIN)return!1;let s=C().overrides??{};return s.browser_path?!1:(s.browser||A)==="safari"}i(X,"wantsSafari");async function ne(s,t,e={}){if(X()){let{launchSafariWindow:o}=await import("./safari-2HR3LJQ2.js");return o(s,t,e)}return V(s,t,e)}i(ne,"launchFeatureWindow");async function V(s,t,e={}){let o=e.size??"1440,900",r=e.position??null,n=H();if(!n)return null;if(!p.existsSync(n))return x(`Browser not found at ${n} (set CHROME_BIN, or overrides.browser_path in config.yaml, to override -- or run \`werkmeister machine setup\` to pick an installed browser)`),null;let a=z(s),l=await K(),c=p.mkdtempSync(P.join(R.tmpdir(),`chrome-${s}-`));if(!r){let g=Number(G(s)%8n)*40;r=`${60+g},${60+g}`}let u=[`--user-data-dir=${c}`,`--remote-debugging-port=${l}`,"--no-first-run","--no-default-browser-check","--new-window",`--window-size=${o}`,`--window-position=${r}`,"about:blank"],d=W(n,u,{stdio:"ignore",detached:!0});d.unref();let f=!1;d.on("exit",()=>{f=!0});let m=null;async function h(){m?.close();try{d.kill()}catch{}if(!f&&!await new Promise(D=>{let U=setTimeout(()=>D(!1),5e3);d.once("exit",()=>{clearTimeout(U),D(!0)})}))try{d.kill("SIGKILL")}catch{}p.rmSync(c,{recursive:!0,force:!0})}i(h,"cleanup");let w,E=!1;try{if(m=await O.connect(await q(l)),w=new T(m,s,a,t,()=>f,()=>E),!await w.start())return x("The browser window never came up \u2014 nothing was tagged."),await h(),null}catch(g){throw await h(),g}return S(`
41
41
  `),b(`Feature : ${s}`),b(`Cookie : X-Feature=${s} (domain ${N()})`),b(`Badge : ${a}`),b(`URL : ${t}`),b(`Profile : ${c} (throwaway)`),S(`
42
42
  Window is tagged ${B.BOLD}[${s}]${B.RESET} in the title bar + corner badge.
43
43
  `),{stop:i(()=>{E=!0},"stop"),async supervise(){try{return await w.poll(),E?(S(`
44
44
  `),b("Closing feature window\u2026"),130):0}finally{await h()}}}}i(V,"launchChromiumWindow");function se(s){for(let t of["workspace.yml","workspace.yaml"]){let e=P.join(I(s),t);if(!(p.existsSync(e)&&p.statSync(e).isFile()))continue;let o;try{o=(0,_.parse)(p.readFileSync(e,"utf8"))}catch{return{}}return o&&typeof o=="object"&&!Array.isArray(o)?o:{}}return{}}i(se,"readWorkspaceYaml");export{N as a,y as b,A as c,oe as d,$ as e,z as f,J as g,K as h,ne as i,se as j};
45
- //# sourceMappingURL=chunk-7N75HGKB.js.map
45
+ //# sourceMappingURL=chunk-7SID5ZXC.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as r,f as c}from"./chunk-ETTHEQ6J.js";c();import*as t from"node:fs";import*as s from"node:path";var i="compose.yml",p="docker-compose.yml";function f(o){try{return t.statSync(o).isFile()}catch{return!1}}r(f,"isFile");function m(o){for(let e of[i,p]){let n=s.join(o,e);if(f(n))return n}return null}r(m,"findWorkspaceCompose");function u(o){let e=s.join(o,p),n=s.join(o,i);f(e)&&!t.existsSync(n)&&t.renameSync(e,n)}r(u,"migrateWorkspaceCompose");export{i as a,p as b,m as c,u as d};
4
- //# sourceMappingURL=chunk-WSZSFGM7.js.map
3
+ import{a as r,f as c}from"./chunk-ZLFV5EHR.js";c();import*as t from"node:fs";import*as s from"node:path";var i="compose.yml",p="docker-compose.yml";function f(o){try{return t.statSync(o).isFile()}catch{return!1}}r(f,"isFile");function m(o){for(let e of[i,p]){let n=s.join(o,e);if(f(n))return n}return null}r(m,"findWorkspaceCompose");function u(o){let e=s.join(o,p),n=s.join(o,i);f(e)&&!t.existsSync(n)&&t.renameSync(e,n)}r(u,"migrateWorkspaceCompose");export{i as a,p as b,m as c,u as d};
4
+ //# sourceMappingURL=chunk-AYZ6UTQP.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{f as t}from"./chunk-ETTHEQ6J.js";t();var p="mcp__ccd_turn__wrap_up",o="Don't turn on Auto-fix in the Claude desktop app (`ccd_pr`).";export{p as a,o as b};
4
- //# sourceMappingURL=chunk-T4I26BBQ.js.map
3
+ import{f as t}from"./chunk-ZLFV5EHR.js";t();var p="mcp__ccd_turn__wrap_up",o="Don't turn on Auto-fix in the Claude desktop app (`ccd_pr`).";export{p as a,o as b};
4
+ //# sourceMappingURL=chunk-B22ESQSU.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{b as f}from"./chunk-PFAJITCT.js";import{a as n,f as m}from"./chunk-ETTHEQ6J.js";m();import{randomBytes as u}from"node:crypto";import*as r from"node:fs";import*as p from"node:os";import*as o from"node:path";var h="token";function a(){return o.join(f(p.homedir()),"tokens")}n(a,"tokensDir");function l(e){return o.join(f(e),h)}n(l,"workspaceTokenFile");function x(e,s){let i=o.join(a(),e),t="";try{t=r.readFileSync(i,"utf8").trim()}catch{}t||=u(32).toString("hex");for(let c of[i,l(s)])r.mkdirSync(o.dirname(c),{recursive:!0}),r.writeFileSync(c,`${t}
3
+ import{b as f}from"./chunk-QKLKSTDV.js";import{a as n,f as m}from"./chunk-ZLFV5EHR.js";m();import{randomBytes as u}from"node:crypto";import*as r from"node:fs";import*as p from"node:os";import*as o from"node:path";var h="token";function a(){return o.join(f(p.homedir()),"tokens")}n(a,"tokensDir");function l(e){return o.join(f(e),h)}n(l,"workspaceTokenFile");function x(e,s){let i=o.join(a(),e),t="";try{t=r.readFileSync(i,"utf8").trim()}catch{}t||=u(32).toString("hex");for(let c of[i,l(s)])r.mkdirSync(o.dirname(c),{recursive:!0}),r.writeFileSync(c,`${t}
4
4
  `,{mode:384}),r.chmodSync(c,384);return t}n(x,"mintWorkspaceToken");function F(e){r.rmSync(o.join(a(),e),{force:!0})}n(F,"revokeWorkspaceToken");function T(e){let s=new Set(r.readdirSync(e,{withFileTypes:!0}).filter(t=>t.isDirectory()||t.isSymbolicLink()&&y(o.join(e,t.name))).map(t=>t.name)),i=[];try{i=r.readdirSync(a())}catch{}if(i.length&&!s.size)throw new Error(`no workspace folders found under ${e}`);return i.filter(t=>!s.has(t)).sort()}n(T,"staleTokens");function y(e){try{return r.statSync(e).isDirectory()}catch{return!1}}n(y,"isDir");export{a,l as b,x as c,F as d,T as e};
5
- //# sourceMappingURL=chunk-3UZRG3XH.js.map
5
+ //# sourceMappingURL=chunk-B6RIK6M7.js.map
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as I,b as _}from"./chunk-YG26JIHA.js";import{s as C,t as g}from"./chunk-SNIANMW7.js";import{a as r,f as h}from"./chunk-ETTHEQ6J.js";h();import{spawn as B}from"node:child_process";import{writeFileSync as A}from"node:fs";import O from"node:fs/promises";import T from"node:os";import E from"node:path";import{stripVTControlCharacters as M}from"node:util";function J(t){return M(t)}r(J,"stripAnsi");async function Y(t){try{return await O.access(t,O.constants.X_OK),!0}catch{return!1}}r(Y,"isExecutable");async function Z(t){try{return(await O.stat(t)).isFile()}catch{return!1}}r(Z,"isFile");var D=["GIT_DIR","GIT_WORK_TREE","GIT_COMMON_DIR"];function R(t=process.env){return Object.fromEntries(Object.entries(t).filter(([e])=>!D.includes(e)))}r(R,"gitEnv");function y(){let t=[E.join(T.homedir(),".local","bin"),E.join(T.homedir(),".cargo","bin"),"/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin"],e=process.env.PATH?process.env.PATH.split(E.delimiter):[],o=[...new Set([...t,...e])].join(E.delimiter);return R({...process.env,PATH:o})}r(y,"childEnv");var K=r(()=>C("GH_BIN")||(g()?w("gh"):"gh"),"ghBin"),P=r(()=>process.env.CLAUDE_BIN||w("claude"),"fixtureClaudeBin"),tt=r(()=>process.env.CODEX_BIN||w("codex"),"fixtureCodexBin"),G=r(()=>C("DOCKER_BIN")||"docker","dockerBin");function x(t){return t==="gh"?K():t==="docker"?G():g()?t==="claude"?P():t==="kubectl"?w("kubectl"):t:t}r(x,"toolBin");var v=new Map;function w(t){let e=v.get(t);if(e)return e;let o=E.join(T.tmpdir(),`werkmeister-fixture-${t}-${process.pid}`);return A(o,`#!/bin/sh
3
+ import{a as I,b as _}from"./chunk-6PPFIYOJ.js";import{s as C,t as g}from"./chunk-FMKL7K6O.js";import{a as r,f as h}from"./chunk-ZLFV5EHR.js";h();import{spawn as B}from"node:child_process";import{writeFileSync as A}from"node:fs";import O from"node:fs/promises";import T from"node:os";import E from"node:path";import{stripVTControlCharacters as M}from"node:util";function J(t){return M(t)}r(J,"stripAnsi");async function Y(t){try{return await O.access(t,O.constants.X_OK),!0}catch{return!1}}r(Y,"isExecutable");async function Z(t){try{return(await O.stat(t)).isFile()}catch{return!1}}r(Z,"isFile");var D=["GIT_DIR","GIT_WORK_TREE","GIT_COMMON_DIR"];function R(t=process.env){return Object.fromEntries(Object.entries(t).filter(([e])=>!D.includes(e)))}r(R,"gitEnv");function y(){let t=[E.join(T.homedir(),".local","bin"),E.join(T.homedir(),".cargo","bin"),"/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin"],e=process.env.PATH?process.env.PATH.split(E.delimiter):[],o=[...new Set([...t,...e])].join(E.delimiter);return R({...process.env,PATH:o})}r(y,"childEnv");var K=r(()=>C("GH_BIN")||(g()?w("gh"):"gh"),"ghBin"),P=r(()=>process.env.CLAUDE_BIN||w("claude"),"fixtureClaudeBin"),tt=r(()=>process.env.CODEX_BIN||w("codex"),"fixtureCodexBin"),G=r(()=>C("DOCKER_BIN")||"docker","dockerBin");function x(t){return t==="gh"?K():t==="docker"?G():g()?t==="claude"?P():t==="kubectl"?w("kubectl"):t:t}r(x,"toolBin");var v=new Map;function w(t){let e=v.get(t);if(e)return e;let o=E.join(T.tmpdir(),`werkmeister-fixture-${t}-${process.pid}`);return A(o,`#!/bin/sh
4
4
  echo "${t} called under WERKMEISTER_FIXTURE: $*" >&2
5
5
  exit 1
6
6
  `,{mode:493}),v.set(t,o),o}r(w,"fixtureStub");function et(t,e,o=T.homedir()){return new Promise((i,s)=>{let n=B(x(t),e,{cwd:o,env:y(),stdio:["ignore","pipe","pipe"]}),u="",a="",m=setTimeout(()=>{n.kill("SIGKILL"),s(new _("The `claude` CLI timed out after 120s.",I))},12e4);n.stdout.on("data",c=>u+=c.toString()),n.stderr.on("data",c=>a+=c.toString()),n.on("error",c=>{clearTimeout(m),s(c)}),n.on("close",c=>{clearTimeout(m),i({stdout:u,stderr:a,code:c})})})}r(et,"runCapture");function rt(t){return`'${t.replace(/'/g,"'\\''")}'`}r(rt,"shellQuote");h();import{spawn as U,spawnSync as F}from"node:child_process";var S=r((t,e)=>t[0]==="git"?R(e):e,"spawnEnv"),N=r(t=>t*Number(process.env.WERKMEISTER_TIMEOUT_SCALE||1)*1e3,"timeoutMs"),l=class extends Error{static{r(this,"ProcError")}status;stdout;stderr;cmd;code;constructor(e,o,i,s="",n="",u){super(e),this.name="ProcError",this.cmd=o,this.status=i,this.stdout=s,this.stderr=n,this.code=u}};function ct(t,e={}){let o=e.capture?["pipe","pipe","pipe"]:["inherit","inherit","inherit"];e.input!==void 0&&(o[0]="pipe");let i=F(x(t[0]),t.slice(1),{cwd:e.cwd,env:S(t,e.env),input:e.input,timeout:e.timeout!==void 0?N(e.timeout):void 0,encoding:"utf8",stdio:o}),s=i.stdout??"",n=i.stderr??"";if(i.error){let a=i.error.code;throw a==="ETIMEDOUT"?new l(`Command timed out after ${e.timeout}s: ${t.join(" ")}`,t,i.status??-1,s,n,"ETIMEDOUT"):a==="ENOENT"?new l(`Command not found: ${t[0]}`,t,-1,s,n,"ENOENT"):new l(`Command failed to start: ${t.join(" ")} (${i.error.message})`,t,i.status??-1,s,n,a)}let u=i.status??-1;if(e.check&&u!==0)throw new l(`Command failed with exit code ${u}: ${t.join(" ")}`,t,u,s,n);return{status:u,stdout:s,stderr:n}}r(ct,"run");function dt(t,e={}){return new Promise((o,i)=>{let s=e.capture?["pipe","pipe","pipe"]:["inherit","inherit","inherit"];e.input!==void 0&&(s[0]="pipe");let n=U(x(t[0]),t.slice(1),{cwd:e.cwd,env:S(t,e.env),stdio:s,signal:e.signal}),u=e.timeout!==void 0?setTimeout(()=>n.kill(),N(e.timeout)):void 0,a="",m="";n.stdout?.on("data",d=>a+=d.toString()),n.stderr?.on("data",d=>m+=d.toString()),e.input!==void 0&&n.stdin?.end(e.input);let c=!1,p=r((d,f,j)=>{c||(c=!0,i(new l(d,t,f,a,m,j)))},"fail"),b=r(d=>{c||(c=!0,o({status:d,stdout:a,stderr:m}))},"done"),$=r(()=>e.signal?.aborted===!0,"aborted");n.on("error",d=>{clearTimeout(u);let f=d.code;if($()){p(`Command aborted: ${t.join(" ")}`,-1,"ABORT_ERR");return}if(f==="ENOENT"){p(`Command not found: ${t[0]}`,-1,"ENOENT");return}p(`Command failed to start: ${t.join(" ")} (${d.message})`,-1,f)}),n.on("close",d=>{if(clearTimeout(u),$()){p(`Command aborted: ${t.join(" ")}`,-1,"ABORT_ERR");return}if(n.killed&&e.timeout!==void 0){p(`Command timed out after ${e.timeout}s: ${t.join(" ")}`,-1,"ETIMEDOUT");return}let f=d??-1;if(e.check&&f!==0){p(`Command failed with exit code ${f}: ${t.join(" ")}`,f);return}b(f)})})}r(dt,"runAsync");export{J as a,Y as b,Z as c,R as d,y as e,K as f,P as g,tt as h,x as i,et as j,rt as k,l,ct as m,dt as n};
7
- //# sourceMappingURL=chunk-LHAPOPKA.js.map
7
+ //# sourceMappingURL=chunk-B75RKH5O.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as $,b as g}from"./chunk-PFAJITCT.js";import{a,f as v}from"./chunk-ETTHEQ6J.js";v();import*as l from"node:fs";import*as i from"node:path";var A="Precedence: these standards' rules win over conflicting task framing \u2014 if a rule and the task clash, follow the rule and say so (invariant: apply it and write a `decision` note; rule: surface the conflict in one line, then apply). This gate fires once; your retry will proceed.",j="Standards gate: invoke `w9r-implement` before coding \u2014 it loads the universal base (ponytail + comments + engineering) and the workspace notes. Then retry this edit.";function D(t){let e="",n=0,r=t.length;for(;n<r;){let o=t[n];if(n+=1,o==="*")e+=".*";else if(o==="?")e+=".";else if(o==="["){let s=n;for(s<r&&t[s]==="!"&&(s+=1),s<r&&t[s]==="]"&&(s+=1);s<r&&t[s]!=="]";)s+=1;if(s>=r)e+="\\[";else{let c=t.slice(n,s).replace(/\\/g,"\\\\");n=s+1,c.startsWith("!")?c="^"+c.slice(1):c.startsWith("^")&&(c="\\"+c),e+=`[${c}]`}}else e+=o.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return`^(?:${e})$`}a(D,"_translate");function F(t,e){return new RegExp(D(e),"s").test(t)}a(F,"fnmatch");function O(t,e){let n=T(t);for(let r of e){let o=T(r),s=i.relative(o,n);if(!(s===""||s===".."||s.startsWith(".."+i.sep)||i.isAbsolute(s)))return i.join(o,s.split(i.sep)[0])}return null}a(O,"workspaceUnder");function T(t){try{return l.realpathSync(t)}catch{return i.resolve(t)}}a(T,"_realpath");function R(t,e){if(e){let r=O(t,e);return r!==null&&E(g(r))?r:null}let n=i.resolve(t);for(;;){if(E(g(n)))return n;let r=i.dirname(n);if(r===n)return null;n=r}}a(R,"findWorkspaceRoot");function E(t){try{return l.statSync(t).isDirectory()}catch{return!1}}a(E,"_isDir");function P(t){try{return l.statSync(t).isFile()}catch{return!1}}a(P,"_isFile");function p(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}a(p,"_isDict");function W(t){let e=i.join(g(t),"standards.json");if(!P(e))return null;let n;try{n=JSON.parse(l.readFileSync(e,"utf8"))}catch{return null}return p(n)?n:null}a(W,"loadManifest");function k(t,e){return i.join(g(t),".gate",`${e}.json`)}a(k,"_statePath");function C(t,e){let n=k(t,e);if(!P(n))return{};let r;try{r=JSON.parse(l.readFileSync(n,"utf8"))}catch{return null}return p(r)?r:null}a(C,"_loadState");function J(t,e,n){try{let r=k(t,e);return l.mkdirSync(i.dirname(r),{recursive:!0}),l.writeFileSync(r,JSON.stringify(n)),!0}catch{return!1}}a(J,"_saveState");function q(t,e){if(!(!e||e.includes("/")||e.includes("..")))try{l.unlinkSync(k(t,e))}catch{}}a(q,"resetSessionState");function N(t){return[...t].sort()}a(N,"_sorted");function G(t){let e=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t);if(!e)return;let n=/^status:\s*["']?([^\s"'#]+)/m.exec(e[1]);return n?n[1].toLowerCase():null}a(G,"_noteStatus");function H(t,e){let n=String(e.note??"");if(!/^[a-z]+$/.test(n))return!0;let r=e.status?String(e.status).toLowerCase():null,o=i.join(g(t),"notes"),s;try{s=l.readdirSync(o)}catch(u){return u.code!=="ENOENT"}let c=new RegExp(`^\\d{3}-${n}-.+\\.md$`);for(let u of s){if(!c.test(u))continue;let f;try{f=l.readFileSync(i.join(o,u),"utf8")}catch{return!0}let d=G(f);if(d===void 0)return!0;if(!(d==="superseded"||d==="graduated")&&(r===null||d===r))return!0}return!1}a(H,"_phaseGateSatisfied");function U(t){let e=String(t.note);if(t.status){let n=String(t.status);return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` has \`status: ${n}\`, so source edits wait for an approved design. Invoke \`w9r-research\`, present the design to the user, and when they approve write \`NNN-${e}-<slug>.md\` with \`status: ${n}\` recording what was approved. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` names the root cause yet. Invoke \`w9r-research\`, reproduce the problem, and write \`NNN-${e}-<slug>.md\` stating the root cause. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}a(U,"_phaseGateText");function L(t,e,n){if(!e||e.includes("/")||e.includes(".."))return null;let r=R(t);if(r===null)return null;let o=W(r);if(o===null)return null;let s=C(r,e);if(s===null)return null;let c=n?i.relative(r,n):"",u=o.phase_gate;if(p(u)&&c&&c!==".."&&!c.startsWith(".."+i.sep)&&!i.isAbsolute(c)&&!c.startsWith($+i.sep)&&!H(r,u))return U(u);let f=new Set(Array.isArray(s.delivered)?s.delivered:[]),d=!s.phase_entry_delivered,h=null,S=p(o.domains)?o.domains:{};for(let m of N(Object.keys(S))){let y=S[m];if(f.has(m)||!p(y))continue;if((Array.isArray(y.applies_to)?y.applies_to:[]).some(b=>F(c,String(b)))){h=m;break}}if(!d&&h===null)return null;let w=[];if(d&&w.push(j),h!==null){let m=S[h],y=String(p(m)&&m.summary||"").trim(),_=`Standards gate: you are editing a path governed by the \`${h}\` standard, which has not been loaded this session. Invoke the \`w9r-${h}-standard\` skill, then retry this edit.`;y&&(_+=` Summary: ${y}.`),w.push(_)}w.push(A);let x={phase_entry_delivered:!0,delivered:N(h?new Set([...f,h]):f)};return J(r,e,x)?w.join(`
3
+ import{a as $,b as g}from"./chunk-QKLKSTDV.js";import{a,f as v}from"./chunk-ZLFV5EHR.js";v();import*as l from"node:fs";import*as i from"node:path";var A="Precedence: these standards' rules win over conflicting task framing \u2014 if a rule and the task clash, follow the rule and say so (invariant: apply it and write a `decision` note; rule: surface the conflict in one line, then apply). This gate fires once; your retry will proceed.",j="Standards gate: invoke `w9r-implement` before coding \u2014 it loads the universal base (ponytail + comments + engineering) and the workspace notes. Then retry this edit.";function D(t){let e="",n=0,r=t.length;for(;n<r;){let o=t[n];if(n+=1,o==="*")e+=".*";else if(o==="?")e+=".";else if(o==="["){let s=n;for(s<r&&t[s]==="!"&&(s+=1),s<r&&t[s]==="]"&&(s+=1);s<r&&t[s]!=="]";)s+=1;if(s>=r)e+="\\[";else{let c=t.slice(n,s).replace(/\\/g,"\\\\");n=s+1,c.startsWith("!")?c="^"+c.slice(1):c.startsWith("^")&&(c="\\"+c),e+=`[${c}]`}}else e+=o.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return`^(?:${e})$`}a(D,"_translate");function F(t,e){return new RegExp(D(e),"s").test(t)}a(F,"fnmatch");function O(t,e){let n=T(t);for(let r of e){let o=T(r),s=i.relative(o,n);if(!(s===""||s===".."||s.startsWith(".."+i.sep)||i.isAbsolute(s)))return i.join(o,s.split(i.sep)[0])}return null}a(O,"workspaceUnder");function T(t){try{return l.realpathSync(t)}catch{return i.resolve(t)}}a(T,"_realpath");function R(t,e){if(e){let r=O(t,e);return r!==null&&E(g(r))?r:null}let n=i.resolve(t);for(;;){if(E(g(n)))return n;let r=i.dirname(n);if(r===n)return null;n=r}}a(R,"findWorkspaceRoot");function E(t){try{return l.statSync(t).isDirectory()}catch{return!1}}a(E,"_isDir");function P(t){try{return l.statSync(t).isFile()}catch{return!1}}a(P,"_isFile");function p(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}a(p,"_isDict");function W(t){let e=i.join(g(t),"standards.json");if(!P(e))return null;let n;try{n=JSON.parse(l.readFileSync(e,"utf8"))}catch{return null}return p(n)?n:null}a(W,"loadManifest");function k(t,e){return i.join(g(t),".gate",`${e}.json`)}a(k,"_statePath");function C(t,e){let n=k(t,e);if(!P(n))return{};let r;try{r=JSON.parse(l.readFileSync(n,"utf8"))}catch{return null}return p(r)?r:null}a(C,"_loadState");function J(t,e,n){try{let r=k(t,e);return l.mkdirSync(i.dirname(r),{recursive:!0}),l.writeFileSync(r,JSON.stringify(n)),!0}catch{return!1}}a(J,"_saveState");function q(t,e){if(!(!e||e.includes("/")||e.includes("..")))try{l.unlinkSync(k(t,e))}catch{}}a(q,"resetSessionState");function N(t){return[...t].sort()}a(N,"_sorted");function G(t){let e=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t);if(!e)return;let n=/^status:\s*["']?([^\s"'#]+)/m.exec(e[1]);return n?n[1].toLowerCase():null}a(G,"_noteStatus");function H(t,e){let n=String(e.note??"");if(!/^[a-z]+$/.test(n))return!0;let r=e.status?String(e.status).toLowerCase():null,o=i.join(g(t),"notes"),s;try{s=l.readdirSync(o)}catch(u){return u.code!=="ENOENT"}let c=new RegExp(`^\\d{3}-${n}-.+\\.md$`);for(let u of s){if(!c.test(u))continue;let f;try{f=l.readFileSync(i.join(o,u),"utf8")}catch{return!0}let d=G(f);if(d===void 0)return!0;if(!(d==="superseded"||d==="graduated")&&(r===null||d===r))return!0}return!1}a(H,"_phaseGateSatisfied");function U(t){let e=String(t.note);if(t.status){let n=String(t.status);return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` has \`status: ${n}\`, so source edits wait for an approved design. Invoke \`w9r-research\`, present the design to the user, and when they approve write \`NNN-${e}-<slug>.md\` with \`status: ${n}\` recording what was approved. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` names the root cause yet. Invoke \`w9r-research\`, reproduce the problem, and write \`NNN-${e}-<slug>.md\` stating the root cause. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}a(U,"_phaseGateText");function L(t,e,n){if(!e||e.includes("/")||e.includes(".."))return null;let r=R(t);if(r===null)return null;let o=W(r);if(o===null)return null;let s=C(r,e);if(s===null)return null;let c=n?i.relative(r,n):"",u=o.phase_gate;if(p(u)&&c&&c!==".."&&!c.startsWith(".."+i.sep)&&!i.isAbsolute(c)&&!c.startsWith($+i.sep)&&!H(r,u))return U(u);let f=new Set(Array.isArray(s.delivered)?s.delivered:[]),d=!s.phase_entry_delivered,h=null,S=p(o.domains)?o.domains:{};for(let m of N(Object.keys(S))){let y=S[m];if(f.has(m)||!p(y))continue;if((Array.isArray(y.applies_to)?y.applies_to:[]).some(b=>F(c,String(b)))){h=m;break}}if(!d&&h===null)return null;let w=[];if(d&&w.push(j),h!==null){let m=S[h],y=String(p(m)&&m.summary||"").trim(),_=`Standards gate: you are editing a path governed by the \`${h}\` standard, which has not been loaded this session. Invoke the \`w9r-${h}-standard\` skill, then retry this edit.`;y&&(_+=` Summary: ${y}.`),w.push(_)}w.push(A);let x={phase_entry_delivered:!0,delivered:N(h?new Set([...f,h]):f)};return J(r,e,x)?w.join(`
4
4
  `):null}a(L,"decide");var M=/^\*\*\* (?:Add File|Update File|Delete File|Move to): (.+)$/gm;function X(t){return[...new Set([...t.matchAll(M)].map(e=>e[1].trim()))]}a(X,"patchPaths");function B(){let t;try{let f=process.stdin.isTTY?"":l.readFileSync(0,"utf8"),d=f.trim()?JSON.parse(f):{};t=p(d)?d:{}}catch{t={}}let e=String(t.session_id||""),n=t.tool_input,r=p(n)?n:{},o=String(t.cwd||process.cwd()),s=t.tool_name==="apply_patch"?r.command:void 0,c=typeof s=="string"?X(s).map(f=>i.resolve(o,f)):[String(r.file_path||"")],u=null;try{for(let f of c)if(u=L(o,e,f),u)break}catch{u=null}u&&console.log(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:u}}))}a(B,"main");export{O as a,R as b,W as c,q as d,B as e};
5
- //# sourceMappingURL=chunk-WUHKR4Q5.js.map
5
+ //# sourceMappingURL=chunk-BPVZBH4L.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{k as d,l as c,m as N,n as R,q as S,t as m}from"./chunk-R5PYBIIH.js";import{j as x}from"./chunk-NSTFLAV6.js";import{b as h}from"./chunk-WUHKR4Q5.js";import{d as b,p as g}from"./chunk-PCM7UWAC.js";import{j as u,k,m as l}from"./chunk-SNIANMW7.js";import{a as i,f as $}from"./chunk-ETTHEQ6J.js";$();import*as v from"node:fs";import*as j from"node:path";import*as D from"node:readline/promises";async function w(t){let n=D.createInterface({input:process.stdin,output:process.stdout});try{return await n.question(t)}finally{n.close()}}i(w,"input");function p(){return!!process.stdin.isTTY}i(p,"stdinIsatty");async function I(t,n,o){let e=N(n);if(o){if(!e.includes(o))throw new c(`'${o}' is not an eligible domain (eligible: ${e.join(", ")})`);return o}let a=t.frontmatter.refs??[],s=R(a,n,e);if(s.length===1)return s[0];if(!p())throw new c(`ambiguous or unmatched domain for note refs ${G(a)} \u2014 pass --domain (eligible: ${e.join(", ")})`);console.log(`Which domain? [${e.join(", ")}]`);let r=(await w("> ")).trim();if(!e.includes(r))throw new c(`'${r}' is not an eligible domain`);return r}i(I,"resolveDomain");async function K(t){if(t)return t;if(!p())throw new c(`--kind required (expected one of ${P(d)})`);let n=(await w(`Kind? [${d.join("/")}] > `)).trim();if(!d.includes(n))throw new c(`'${n}' is not a valid kind (expected one of ${P(d)})`);return n}i(K,"resolveKind");async function T(t,n,{domain:o,kind:e,slug:a}){let s=x(),r=await I(n,s,o),f=await K(e);return S(t,n,{domain:r,kind:f,slug:a,decisions:m(t).decisions})}i(T,"graduateOne");async function A(t){let n=h(process.cwd(),g());n===null&&(l("Not inside a workspace \u2014 run this from a workspace folder or below."),process.exit(1));let o=m(n).decisions.open(n);if(!o.length){u("No open decisions to graduate.");return}let e=t.note_num;if(e==null){p()||(l("Pass a note number as an argument (non-interactive mode)."),process.exit(1)),console.log("Open decision notes:");for(let y of o)console.log(` [${String(y.number).padStart(3,"0")}] ${j.basename(y.path)}`);let r=(await w("Graduate which note number? > ")).trim(),f=F(r);f===null&&(l(`'${r}' is not a note number.`),process.exit(1)),e=f}let a=o.find(r=>r.number===e)??null;a===null&&(l(`No open decision note numbered ${String(e).padStart(3,"0")}.`),process.exit(1));let s;try{s=await T(n,a,{domain:t.domain??null,kind:t.kind??null,slug:t.slug??null})}catch(r){throw r instanceof c&&(l(r.message),process.exit(1)),r}k(`Scaffolded ${s.scaffold_path}`),u(`Note marked graduating \u2192 ${s.graduated_to}`),u("Ask Claude to run the w9r-author skill to fill in the placeholder, then `werkmeister skills check`."),u(`Commit it in ${b()} \u2014 a separate repo from this workspace. The note stays an open decision until that file is tracked.`)}i(A,"runGraduate");function C(){try{if(p())return{};let t=v.readFileSync(0,"utf8"),n=t.trim()?JSON.parse(t):null;return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:{}}catch{return{}}}i(C,"hookPayload");async function L(t){if(t.action==="graduate"){await A(t);return}try{let n=h(process.cwd(),g());if(n===null)return;let o=m(n).sessionContext(n,C());o&&process.stdout.write(o)}catch{return}}i(L,"run");function F(t){let n=t.trim();return/^[+-]?\d+$/.test(n)?Number.parseInt(n,10):null}i(F,"parseIntStrict");function G(t){return`[${t.map(n=>`'${n}'`).join(", ")}]`}i(G,"reprList");function P(t){return t.length===1?`('${t[0]}',)`:`(${t.map(n=>`'${n}'`).join(", ")})`}i(P,"reprTuple");export{w as a,T as b,L as c};
4
- //# sourceMappingURL=chunk-I4HGRDJW.js.map
3
+ import{k as d,l as c,m as N,n as R,q as S,t as m}from"./chunk-NT5XYODL.js";import{j as x}from"./chunk-P54FQEQS.js";import{b as h}from"./chunk-BPVZBH4L.js";import{d as b,p as g}from"./chunk-W27QQWCC.js";import{j as u,k,m as l}from"./chunk-FMKL7K6O.js";import{a as i,f as $}from"./chunk-ZLFV5EHR.js";$();import*as v from"node:fs";import*as j from"node:path";import*as D from"node:readline/promises";async function w(t){let n=D.createInterface({input:process.stdin,output:process.stdout});try{return await n.question(t)}finally{n.close()}}i(w,"input");function p(){return!!process.stdin.isTTY}i(p,"stdinIsatty");async function I(t,n,o){let e=N(n);if(o){if(!e.includes(o))throw new c(`'${o}' is not an eligible domain (eligible: ${e.join(", ")})`);return o}let a=t.frontmatter.refs??[],s=R(a,n,e);if(s.length===1)return s[0];if(!p())throw new c(`ambiguous or unmatched domain for note refs ${G(a)} \u2014 pass --domain (eligible: ${e.join(", ")})`);console.log(`Which domain? [${e.join(", ")}]`);let r=(await w("> ")).trim();if(!e.includes(r))throw new c(`'${r}' is not an eligible domain`);return r}i(I,"resolveDomain");async function K(t){if(t)return t;if(!p())throw new c(`--kind required (expected one of ${P(d)})`);let n=(await w(`Kind? [${d.join("/")}] > `)).trim();if(!d.includes(n))throw new c(`'${n}' is not a valid kind (expected one of ${P(d)})`);return n}i(K,"resolveKind");async function T(t,n,{domain:o,kind:e,slug:a}){let s=x(),r=await I(n,s,o),f=await K(e);return S(t,n,{domain:r,kind:f,slug:a,decisions:m(t).decisions})}i(T,"graduateOne");async function A(t){let n=h(process.cwd(),g());n===null&&(l("Not inside a workspace \u2014 run this from a workspace folder or below."),process.exit(1));let o=m(n).decisions.open(n);if(!o.length){u("No open decisions to graduate.");return}let e=t.note_num;if(e==null){p()||(l("Pass a note number as an argument (non-interactive mode)."),process.exit(1)),console.log("Open decision notes:");for(let y of o)console.log(` [${String(y.number).padStart(3,"0")}] ${j.basename(y.path)}`);let r=(await w("Graduate which note number? > ")).trim(),f=F(r);f===null&&(l(`'${r}' is not a note number.`),process.exit(1)),e=f}let a=o.find(r=>r.number===e)??null;a===null&&(l(`No open decision note numbered ${String(e).padStart(3,"0")}.`),process.exit(1));let s;try{s=await T(n,a,{domain:t.domain??null,kind:t.kind??null,slug:t.slug??null})}catch(r){throw r instanceof c&&(l(r.message),process.exit(1)),r}k(`Scaffolded ${s.scaffold_path}`),u(`Note marked graduating \u2192 ${s.graduated_to}`),u("Ask Claude to run the w9r-author skill to fill in the placeholder, then `werkmeister skills check`."),u(`Commit it in ${b()} \u2014 a separate repo from this workspace. The note stays an open decision until that file is tracked.`)}i(A,"runGraduate");function C(){try{if(p())return{};let t=v.readFileSync(0,"utf8"),n=t.trim()?JSON.parse(t):null;return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:{}}catch{return{}}}i(C,"hookPayload");async function L(t){if(t.action==="graduate"){await A(t);return}try{let n=h(process.cwd(),g());if(n===null)return;let o=m(n).sessionContext(n,C());o&&process.stdout.write(o)}catch{return}}i(L,"run");function F(t){let n=t.trim();return/^[+-]?\d+$/.test(n)?Number.parseInt(n,10):null}i(F,"parseIntStrict");function G(t){return`[${t.map(n=>`'${n}'`).join(", ")}]`}i(G,"reprList");function P(t){return t.length===1?`('${t[0]}',)`:`(${t.map(n=>`'${n}'`).join(", ")})`}i(P,"reprTuple");export{w as a,T as b,L as c};
4
+ //# sourceMappingURL=chunk-C3BKLNWL.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as F,b as H,f as Z}from"./chunk-NSTFLAV6.js";import{c as X,d as Y,e as K,g as Q,j as J}from"./chunk-6NHEJ7T7.js";import{O as te,P as re,u as ee}from"./chunk-HSCOWKAY.js";import{a as O,b as se}from"./chunk-MCAAZMSU.js";import{ca as oe}from"./chunk-BDVUTE3T.js";import{r as V}from"./chunk-PCM7UWAC.js";import{D as G,S as q}from"./chunk-SNIANMW7.js";import{a as l,f as A}from"./chunk-ETTHEQ6J.js";A();import*as ae from"node:fs";import*as ie from"node:path";A();function ne(t){let n=t.url?`[${t.ref}](${t.url})`:t.ref,i=t.title?`: ${t.title}`:"",a=t.fetchedAt?`Copy taken ${t.fetchedAt.slice(0,10)}: \`.werkmeister/issue.md\`.`:"No stored copy; run `werkmeister workspace init --refresh-issue`.";return["## Issue","",`${n}${i}. ${a}`,"Before each stage, re-read the live issue for newer direction: `werkmeister issue view`","Its status moves by itself (In Progress \u2192 In Review \u2192 Done): `docs/workspace-lifecycle.md` \xA7 Issue status in the werkmeister repo.",""].join(`
3
+ import{a as F,b as H,f as Z}from"./chunk-P54FQEQS.js";import{c as X,d as Y,e as K,g as Q,j as J}from"./chunk-ZELRS5EE.js";import{O as te,P as re,u as ee}from"./chunk-LXS2C6FX.js";import{a as O,b as se}from"./chunk-FTSANPK4.js";import{ca as oe}from"./chunk-XNDI75MH.js";import{r as V}from"./chunk-W27QQWCC.js";import{D as G,S as q}from"./chunk-FMKL7K6O.js";import{a as l,f as A}from"./chunk-ZLFV5EHR.js";A();import*as ae from"node:fs";import*as ie from"node:path";A();function ne(t){let n=t.url?`[${t.ref}](${t.url})`:t.ref,i=t.title?`: ${t.title}`:"",a=t.fetchedAt?`Copy taken ${t.fetchedAt.slice(0,10)}: \`.werkmeister/issue.md\`.`:"No stored copy; run `werkmeister workspace init --refresh-issue`.";return["## Issue","",`${n}${i}. ${a}`,"Before each stage, re-read the live issue for newer direction: `werkmeister issue view`","Its status moves by itself (In Progress \u2192 In Review \u2192 Done): `docs/workspace-lifecycle.md` \xA7 Issue status in the werkmeister repo.",""].join(`
4
4
  `)}l(ne,"renderIssueRef");function Te(t){try{let n=V(),i=O(void 0,n),a=t.find(r=>i[r]?.hostname),s=a?i[a].hostname:Object.values(i).map(r=>r.hostname).filter(Boolean).sort()[0];return s?{host:s,domain:n.local_domain.replace(/^\.+/,"")}:null}catch{return null}}l(Te,"resolveProxyHost");function B(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}l(B,"isDict");function xe(t,n,i){let a=[];for(let[s]of t){let r=!1;try{r=ae.statSync(ie.join(n,s,"CLAUDE.md")).isFile()}catch{}r&&a.push(`| Working in ${s} | ${s}/CLAUDE.md |`)}return i&&a.push("| Running or validating the change \u2014 test commands, how to validate, ports, lifecycle | .werkmeister/werkmeister-context.md |"),t.length>1&&a.push("| Cross-repo contract change | .werkmeister/notes/ (`contract` notes) |"),a.push("| Open or create a PR (including `/create-pr`), merge, close out | .werkmeister/pr-rules.md |"),a.length===0?"":`| Task | Read |
5
5
  |------|------|
6
6
  `+a.join(`
@@ -177,4 +177,4 @@ ${fe}
177
177
  ${we}${ke}${$e}${ge}${U}${ve}${be}${y||k?`## Troubleshooting
178
178
 
179
179
  ${y?"### Feature missing from `/__werkmeister` selector\n\nThe dropdown is populated from `~/.werkmeister/infra/proxy/features.json` (a static file served by Caddy), which is regenerated alongside the Caddyfile. It can drift from the live container labels (`com.werkmeister.feature` \u2014 the source of truth) if a slot is allocated without a proxy regen.\n\nDiagnose \u2014 compare what's labeled vs. what the UI shows:\n```bash\ndocker ps -a --filter label=com.werkmeister.feature --format '{{ .Label \"com.werkmeister.feature\" }}' | sort -u\njq '[.[].name]' \"$HOME/.werkmeister/infra/proxy/features.json\"\n```\n\nResync:\n```bash\nwerkmeister infra proxy-reload # regenerates Caddyfile + features.json, reloads Caddy\n```\n\n### Caddy returns `content-length: 0` but direct service hit works\n\nCaddy routing issue, not an app issue. Try `werkmeister infra proxy-reload` first; if Caddy is still misrouting, check `docker logs w9r-caddy --tail 50`.\n\n":""}${k?"### Containers expected per the table above are missing from `docker ps`\n\n`werkmeister feature up` may have partially failed. Re-run from the workspace root:\n```bash\nwerkmeister feature up # idempotent \u2014 starts missing containers\ndocker compose logs -f # watch startup if something crashes\n```\n":""}`:""}`}l(Ge,"buildSandboxContextMd");export{ne as a,We as b,ze as c,Ge as d};
180
- //# sourceMappingURL=chunk-W6W2X3CN.js.map
180
+ //# sourceMappingURL=chunk-CPWZ5ED7.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{U as x}from"./chunk-BDVUTE3T.js";import{f as y,g as b,h as w}from"./chunk-CMX5BNYH.js";import{b as S}from"./chunk-PFAJITCT.js";import{a,f as h}from"./chunk-ETTHEQ6J.js";h();import*as l from"node:fs";import*as m from"node:os";import*as d from"node:path";var M=10,j=2e3,A=5*6e4;function v(t){return d.join(S(t),"starts.json")}a(v,"startsFile");function D(t){try{let e=JSON.parse(l.readFileSync(v(t),"utf8"));return Array.isArray(e)?e:[]}catch{return[]}}a(D,"readStarts");function C(t,e,r,n=Date.now()){try{let s=v(t),o=[...D(t),{by:e,from:new Date(r).toISOString(),to:new Date(n).toISOString()}].slice(-M);l.mkdirSync(d.dirname(s),{recursive:!0}),l.writeFileSync(s,`${JSON.stringify(o,null,2)}
3
+ import{U as x}from"./chunk-XNDI75MH.js";import{f as y,g as b,h as w}from"./chunk-GLRMTXB7.js";import{b as S}from"./chunk-QKLKSTDV.js";import{a,f as h}from"./chunk-ZLFV5EHR.js";h();import*as l from"node:fs";import*as m from"node:os";import*as d from"node:path";var M=10,j=2e3,A=5*6e4;function v(t){return d.join(S(t),"starts.json")}a(v,"startsFile");function D(t){try{let e=JSON.parse(l.readFileSync(v(t),"utf8"));return Array.isArray(e)?e:[]}catch{return[]}}a(D,"readStarts");function C(t,e,r,n=Date.now()){try{let s=v(t),o=[...D(t),{by:e,from:new Date(r).toISOString(),to:new Date(n).toISOString()}].slice(-M);l.mkdirSync(d.dirname(s),{recursive:!0}),l.writeFileSync(s,`${JSON.stringify(o,null,2)}
4
4
  `)}catch{}}a(C,"recordStart");async function W(t,e,r){let n=Date.now();try{return await r()}finally{C(t,e,n)}}a(W,"withStartRecord");function O(t,e){for(let r=e.length-1;r>=0;r--){let n=e[r];if(t>=Date.parse(n.from)-j&&t<=Date.parse(n.to)+j)return n.by}return"person"}a(O,"startedBy");function L(t,e,r){return t.state==="restarting"?!0:!e||e.restartCount===0?!1:t.state!=="running"||r-e.startedAt<A}a(L,"isCrashLoop");function P(t){return t.state==="running"||t.state==="restarting"||t.state==="exited"&&t.exitCode!==0}a(P,"worthInspecting");function k(t,e,r,n){let s=new Map,o=new Map;for(let c of t){let i=c.labels["com.docker.compose.project"];if(!i)continue;let f=s.get(i)??{started:null,crashLoops:[]};s.set(i,f);let u=e.get(c.name);if(L(c,u,n)&&f.crashLoops.push({service:c.service,restarts:u?.restartCount??0,lastLog:null}),c.state!=="running"||!u||Number.isNaN(u.startedAt))continue;let g=o.get(i);(!g||u.startedAt<g.at)&&o.set(i,{at:u.startedAt,workingDir:c.labels["com.docker.compose.project.working_dir"]??""})}for(let[c,{at:i,workingDir:f}]of o){let u=s.get(c);u.started={at:new Date(i).toISOString(),by:f?O(i,r(f)):"person"}}for(let c of s.values())c.crashLoops.sort((i,f)=>i.service.localeCompare(f.service));return s}a(k,"healthOf");async function B(t,e=Date.now()){let r=t.filter(P),n=await b(r.map(o=>o.name)),s=k(r,n,D,e);return await Promise.all(r.filter(o=>L(o,n.get(o.name),e)).map(async o=>{let c=s.get(o.labels["com.docker.compose.project"])?.crashLoops.find(i=>i.service===o.service&&i.lastLog===null);c&&(c.lastLog=await w(o.name,n.get(o.name)?.tty??!1))})),s}a(B,"projectHealth");var p=a(t=>Math.round(t*10)/10,"round1");function _(t){let e={};for(let r of t){let n=r.labels["com.docker.compose.project"];if(!n)continue;let s=e[n]??={cpuPercent:0,memMib:0};s.cpuPercent+=r.cpuPercent,s.memMib+=r.memMib}for(let r of Object.values(e))r.cpuPercent=p(r.cpuPercent),r.memMib=Math.round(r.memMib);return e}a(_,"usageByProject");function N(t,e=m.loadavg(),r=m.availableParallelism()){let n=t.filter(s=>{let o=x(s.labels,"feature");return o&&o!=="infra"});return{load:[p(e[0]),p(e[1]),p(e[2])],cores:r,featureCpuPercent:p(n.reduce((s,o)=>s+o.cpuPercent,0))}}a(N,"hostSummary");function H(t,e){let[r,n,s]=t.map(o=>p(o).toFixed(1));return`host load ${r} / ${n} / ${s} (1, 5, 15 min) on ${e} cores`}a(H,"loadNote");async function J(t=2e4){let e=await y(AbortSignal.timeout(t));return{projects:_(e),host:N(e)}}a(J,"getWorkspaceResources");export{W as a,B as b,H as c,J as d};
5
- //# sourceMappingURL=chunk-QL7XCD5C.js.map
5
+ //# sourceMappingURL=chunk-DAUTEJPJ.js.map