werkmeister 0.94.3 → 0.95.0

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 (162) hide show
  1. package/dist/{budget-ZRAQK3PZ.js → budget-EMDQ2DZS.js} +2 -2
  2. package/dist/{cache-E4DLJUAP.js → cache-LEPLXGHR.js} +2 -2
  3. package/dist/{chunk-23GM2V7B.js → chunk-2IP5M2UW.js} +2 -2
  4. package/dist/{chunk-7KGYE5LJ.js → chunk-2YJDBWJO.js} +2 -2
  5. package/dist/{chunk-736XQT7E.js → chunk-3FX7DATM.js} +2 -2
  6. package/dist/{chunk-OXUT73ZK.js → chunk-4BR65TK6.js} +2 -2
  7. package/dist/{chunk-BTZGFSAD.js → chunk-4E4P27OE.js} +2 -2
  8. package/dist/{chunk-MA4ZNBJQ.js → chunk-546SJZOD.js} +2 -2
  9. package/dist/{chunk-LEIPUXIV.js → chunk-5QG3DOZZ.js} +2 -2
  10. package/dist/{chunk-QUKZMMNJ.js → chunk-5XSAAMDP.js} +2 -2
  11. package/dist/{chunk-36Y5TWCS.js → chunk-64WYOHLN.js} +2 -2
  12. package/dist/{chunk-VZ3CPOPB.js → chunk-6B25DSWW.js} +2 -2
  13. package/dist/{chunk-BVNQPKFK.js → chunk-6MHH3PKI.js} +2 -2
  14. package/dist/{chunk-DJGLCWSW.js → chunk-6VEY2JX7.js} +2 -2
  15. package/dist/chunk-7ATNOKW5.js +4 -0
  16. package/dist/{chunk-LIS7CNJ2.js → chunk-7B7Q6EAN.js} +2 -2
  17. package/dist/{chunk-3MYYJ2O6.js → chunk-AL3AC4P2.js} +2 -2
  18. package/dist/{chunk-VK7IBUGG.js → chunk-BJ4KKBL3.js} +2 -2
  19. package/dist/{chunk-VW2X6CB5.js → chunk-BNRNITRE.js} +2 -2
  20. package/dist/{chunk-V4WXF46Y.js → chunk-E6W3GWK6.js} +2 -2
  21. package/dist/{chunk-4EQH55B3.js → chunk-EBITRY7L.js} +3 -3
  22. package/dist/{chunk-34IKHARR.js → chunk-ETO72ULV.js} +2 -2
  23. package/dist/chunk-EZ75MGB4.js +13 -0
  24. package/dist/{chunk-6JVXGXN2.js → chunk-F27J4GUK.js} +2 -2
  25. package/dist/{chunk-MMXALKQ4.js → chunk-FJTOJUQE.js} +2 -2
  26. package/dist/{chunk-2IODMVLJ.js → chunk-FKCFF6PN.js} +2 -2
  27. package/dist/{chunk-EVHOXBDD.js → chunk-FNKN5FRN.js} +2 -2
  28. package/dist/chunk-FQCJ5O46.js +137 -0
  29. package/dist/{chunk-STMEAZFZ.js → chunk-GG7PJ5JF.js} +2 -2
  30. package/dist/{chunk-DEWNXQDG.js → chunk-I3BJZRIH.js} +3 -3
  31. package/dist/{chunk-7E35KHQU.js → chunk-IRIGNO72.js} +2 -2
  32. package/dist/chunk-IWBX6EKV.js +4 -0
  33. package/dist/{chunk-AEM77RAL.js → chunk-J4TDJJPQ.js} +2 -2
  34. package/dist/{chunk-APZJEON2.js → chunk-JPKZKLGV.js} +2 -2
  35. package/dist/{chunk-G55F62O5.js → chunk-KVPJ6B5B.js} +2 -2
  36. package/dist/{chunk-TQXT66GY.js → chunk-L2KXSSY3.js} +2 -2
  37. package/dist/{chunk-IZTW5UT4.js → chunk-LIBL5Q3L.js} +2 -2
  38. package/dist/{chunk-642DWZGI.js → chunk-LRMNDYRD.js} +2 -2
  39. package/dist/{chunk-F7TUYDEI.js → chunk-N75G263E.js} +2 -2
  40. package/dist/{chunk-R4WVSQHH.js → chunk-NHI74BTV.js} +2 -2
  41. package/dist/{chunk-IJUWNQO2.js → chunk-NO2H5YS4.js} +2 -2
  42. package/dist/chunk-NZQZX5GZ.js +117 -0
  43. package/dist/{chunk-VI7O564A.js → chunk-OIJIOW2Q.js} +2 -2
  44. package/dist/{chunk-3PZ6HQYD.js → chunk-OWYP2BRC.js} +24 -22
  45. package/dist/{chunk-P2KMXUCB.js → chunk-P3MGNF3T.js} +3 -3
  46. package/dist/{chunk-ERS24IKS.js → chunk-PESILXNN.js} +2 -2
  47. package/dist/{chunk-ZLNXIRGJ.js → chunk-QF7UYRPA.js} +16 -16
  48. package/dist/{chunk-6HU4LHQY.js → chunk-QIY6CJYG.js} +2 -2
  49. package/dist/{chunk-NONNQTC3.js → chunk-R65G2QPR.js} +2 -2
  50. package/dist/{chunk-TAHLKIRL.js → chunk-RAQKNHCM.js} +2 -2
  51. package/dist/{chunk-3JJ2DVAG.js → chunk-SGMHMD4R.js} +2 -2
  52. package/dist/{chunk-Y7MUE52D.js → chunk-SM64LULD.js} +2 -2
  53. package/dist/{chunk-ZREP3Q6O.js → chunk-SRC7TVUN.js} +2 -2
  54. package/dist/{chunk-KRXEK5IM.js → chunk-SZ5KZYVN.js} +16 -7
  55. package/dist/chunk-T7LKHOC6.js +84 -0
  56. package/dist/{chunk-ZDRNJGSF.js → chunk-TCNJFGTZ.js} +42 -41
  57. package/dist/{chunk-T3LXZQBK.js → chunk-TQC7XRVN.js} +2 -2
  58. package/dist/{chunk-PW2EKDJ4.js → chunk-UA6TRGH3.js} +21 -21
  59. package/dist/chunk-UW2UETCC.js +4 -0
  60. package/dist/{chunk-TKXEX3J7.js → chunk-UWS4FD46.js} +2 -2
  61. package/dist/{chunk-2WQY5YYA.js → chunk-VFK6V2ML.js} +2 -2
  62. package/dist/{chunk-COOC6H6Z.js → chunk-VG3BA2XL.js} +2 -2
  63. package/dist/{chunk-A3VNC7IG.js → chunk-VGQ47TCA.js} +2 -2
  64. package/dist/{chunk-A2JDE4VC.js → chunk-VLWEJKGW.js} +2 -2
  65. package/dist/{chunk-4UASFLJQ.js → chunk-WAPRU7VW.js} +2 -2
  66. package/dist/{chunk-GHLXJUIB.js → chunk-X5QBCKVG.js} +2 -2
  67. package/dist/{chunk-RP7X3XDD.js → chunk-XGEFFTJK.js} +2 -2
  68. package/dist/{chunk-ZB5MYPP3.js → chunk-ZLO4QG42.js} +2 -2
  69. package/dist/clean-T3IA75PZ.js +8 -0
  70. package/dist/close_out-LEVYUVT4.js +8 -0
  71. package/dist/code-X6EQKAAW.js +4 -0
  72. package/dist/{config-L3TANQJ3.js → config-IO2QME7N.js} +2 -2
  73. package/dist/{connect-RQD45V4L.js → connect-HRMMVCRQ.js} +2 -2
  74. package/dist/{daemon-O6QSXDGP.js → daemon-7E4EX2EC.js} +2 -2
  75. package/dist/dashboard.js +8 -8
  76. package/dist/{detect-JPV4YC6P.js → detect-7245MOM4.js} +2 -2
  77. package/dist/{down-XKZIIZKL.js → down-YZTYR6G5.js} +3 -3
  78. package/dist/fixture-RFVSYLGG.js +15 -0
  79. package/dist/form-cli.js +1 -1
  80. package/dist/hooks-XASL6OLS.js +4 -0
  81. package/dist/{hooks_gen-ULTNL4SI.js → hooks_gen-ACUKRNEB.js} +2 -2
  82. package/dist/infra-GZ647GVN.js +4 -0
  83. package/dist/init_workspace-YJ5FSUGV.js +4 -0
  84. package/dist/{intercept-E2UXVZO2.js → intercept-ASJLKDF7.js} +2 -2
  85. package/dist/{issue-JGG36D3F.js → issue-CZQNDC74.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-O53MPV6A.js +7 -0
  90. package/dist/logs-6JIZ62QJ.js +6 -0
  91. package/dist/main.js +17 -17
  92. package/dist/mcp-proxy.js +1 -1
  93. package/dist/mcp.js +8 -8
  94. package/dist/migrate-OHFAVO2X.js +8 -0
  95. package/dist/notes-UPSQ6JZI.js +4 -0
  96. package/dist/{open-6IM3BRTK.js → open-WTCEN4HQ.js} +2 -2
  97. package/dist/{optimize-QUVTAHU7.js → optimize-B4OXOEUW.js} +2 -2
  98. package/dist/pause-NAX5KD7M.js +4 -0
  99. package/dist/pr-XSDZDLIV.js +5 -0
  100. package/dist/proxy_reload-O5N5WS23.js +6 -0
  101. package/dist/{registry-FWV3GMBC.js → registry-JU64HNHD.js} +2 -2
  102. package/dist/remove-X5YOOXET.js +7 -0
  103. package/dist/remove_workspace-GM6Z4UQA.js +8 -0
  104. package/dist/restart-QTRIYF4X.js +8 -0
  105. package/dist/resume-WZEESNLQ.js +8 -0
  106. package/dist/{safari-O36TVN7H.js → safari-JR7NQ5JR.js} +2 -2
  107. package/dist/sandbox-H733FVSZ.js +4 -0
  108. package/dist/{services-KS7ZX5HD.js → services-L2MO6JDQ.js} +2 -2
  109. package/dist/{setup-PBJHUVDP.js → setup-6DYQFZGO.js} +2 -2
  110. package/dist/skills-7B75IKRP.js +4 -0
  111. package/dist/{slots-2TNE7QVT.js → slots-SR2W64NL.js} +2 -2
  112. package/dist/{standards-33HP5ISI.js → standards-Y4SCDB3A.js} +2 -2
  113. package/dist/start_args-LKHDBJ4P.js +4 -0
  114. package/dist/starting_prompt-XBI4KAYD.js +4 -0
  115. package/dist/stats-OKRT3CQK.js +4 -0
  116. package/dist/{status-HOGTW5NK.js → status-UX7MHORC.js} +2 -2
  117. package/dist/{stop-K63QPP2T.js → stop-O7IQG56L.js} +2 -2
  118. package/dist/{telepresence-RNQJ6STO.js → telepresence-X6ZPPX4L.js} +2 -2
  119. package/dist/{test-5OKDB5W6.js → test-6BXTJLPH.js} +2 -2
  120. package/dist/{tokens-2E2YOUGM.js → tokens-JBIS5UYD.js} +2 -2
  121. package/dist/{up-5RWHIAIE.js → up-4WAE7SM7.js} +3 -3
  122. package/dist/{v4-K4ELABVT.js → v4-XZKJWLZ4.js} +2 -2
  123. package/dist/wait_load-7XIKWRSE.js +4 -0
  124. package/dist/werkmeister-workspaces.vsix +0 -0
  125. package/dist/workspace-LPULQPEB.js +4 -0
  126. package/man/werkmeister-pr-push.1 +12 -0
  127. package/man/werkmeister-pr.1 +2 -0
  128. package/man/werkmeister-workspace-abandon.1 +6 -2
  129. package/man/werkmeister.1 +5 -1
  130. package/package.json +6 -5
  131. package/dist/chunk-AAUSOM4O.js +0 -115
  132. package/dist/chunk-CP5QRUYE.js +0 -13
  133. package/dist/chunk-TOVULDID.js +0 -84
  134. package/dist/chunk-U54E44M2.js +0 -4
  135. package/dist/chunk-WH66XR3Z.js +0 -137
  136. package/dist/chunk-YBDM4MR6.js +0 -4
  137. package/dist/chunk-ZOPN2T2K.js +0 -4
  138. package/dist/clean-NSMHWY5Q.js +0 -8
  139. package/dist/close_out-DAKMIDZN.js +0 -8
  140. package/dist/code-GK23DHSQ.js +0 -4
  141. package/dist/fixture-6MKI6ZI2.js +0 -15
  142. package/dist/hooks-3EOBCPEK.js +0 -4
  143. package/dist/infra-JX3AOCSP.js +0 -4
  144. package/dist/init_workspace-DG7JYR2X.js +0 -4
  145. package/dist/list_workspaces-ZNHKGLB3.js +0 -7
  146. package/dist/logs-EYJ4FLFO.js +0 -6
  147. package/dist/migrate-RTGGW7NR.js +0 -8
  148. package/dist/notes-QRKTX7I2.js +0 -4
  149. package/dist/pause-7QRTNAWG.js +0 -4
  150. package/dist/pr-NPWK4XZX.js +0 -5
  151. package/dist/proxy_reload-CKIEXATI.js +0 -6
  152. package/dist/remove-72IG4RPR.js +0 -7
  153. package/dist/remove_workspace-4ATUGFDT.js +0 -8
  154. package/dist/restart-ZL642OLA.js +0 -8
  155. package/dist/resume-EBFIT7LE.js +0 -8
  156. package/dist/sandbox-GYKSQM6Y.js +0 -4
  157. package/dist/skills-KTHUF3OQ.js +0 -4
  158. package/dist/start_args-WWUIVZP7.js +0 -4
  159. package/dist/starting_prompt-HIWHUCHA.js +0 -4
  160. package/dist/stats-FYPAWFPK.js +0 -4
  161. package/dist/wait_load-WC4EQSID.js +0 -4
  162. package/dist/workspace-TZ4LCYK7.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{d as v,m as L}from"./chunk-P2KMXUCB.js";import"./chunk-LIS7CNJ2.js";import"./chunk-T3LXZQBK.js";import"./chunk-V4WXF46Y.js";import"./chunk-36Y5TWCS.js";import"./chunk-642DWZGI.js";import"./chunk-ZDRNJGSF.js";import"./chunk-ZLNXIRGJ.js";import"./chunk-OXUT73ZK.js";import"./chunk-PW2EKDJ4.js";import"./chunk-34IKHARR.js";import"./chunk-KRXEK5IM.js";import"./chunk-MA4ZNBJQ.js";import"./chunk-DJGLCWSW.js";import"./chunk-ZOPN2T2K.js";import"./chunk-3PZ6HQYD.js";import"./chunk-TOVULDID.js";import"./chunk-G55F62O5.js";import"./chunk-TAHLKIRL.js";import{B as h,C as w,I as b,L as y,Q as k,v as f,w as $}from"./chunk-CP5QRUYE.js";import"./chunk-Y7MUE52D.js";import"./chunk-7KGYE5LJ.js";import"./chunk-2WQY5YYA.js";import"./chunk-3MYYJ2O6.js";import{p as d}from"./chunk-TQXT66GY.js";import"./chunk-TKXEX3J7.js";import"./chunk-7E35KHQU.js";import"./chunk-736XQT7E.js";import"./chunk-COOC6H6Z.js";import"./chunk-NONNQTC3.js";import"./chunk-6HU4LHQY.js";import"./chunk-3JJ2DVAG.js";import{a as c,f as g}from"./chunk-ZB5MYPP3.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-ZRAQK3PZ.js.map
3
+ import{d as v,m as L}from"./chunk-P3MGNF3T.js";import"./chunk-7B7Q6EAN.js";import"./chunk-TQC7XRVN.js";import"./chunk-E6W3GWK6.js";import"./chunk-64WYOHLN.js";import"./chunk-LRMNDYRD.js";import"./chunk-TCNJFGTZ.js";import"./chunk-QF7UYRPA.js";import"./chunk-4BR65TK6.js";import"./chunk-UA6TRGH3.js";import"./chunk-ETO72ULV.js";import"./chunk-SZ5KZYVN.js";import"./chunk-546SJZOD.js";import"./chunk-6VEY2JX7.js";import"./chunk-7ATNOKW5.js";import"./chunk-OWYP2BRC.js";import"./chunk-T7LKHOC6.js";import"./chunk-KVPJ6B5B.js";import"./chunk-RAQKNHCM.js";import{B as h,C as w,I as b,L as y,Q as k,v as f,w as $}from"./chunk-EZ75MGB4.js";import"./chunk-SM64LULD.js";import"./chunk-2YJDBWJO.js";import"./chunk-VFK6V2ML.js";import"./chunk-AL3AC4P2.js";import{p as d}from"./chunk-L2KXSSY3.js";import"./chunk-UWS4FD46.js";import"./chunk-IRIGNO72.js";import"./chunk-3FX7DATM.js";import"./chunk-VG3BA2XL.js";import"./chunk-R65G2QPR.js";import"./chunk-QIY6CJYG.js";import"./chunk-SGMHMD4R.js";import{a as c,f as g}from"./chunk-ZLO4QG42.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-EMDQ2DZS.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-U54E44M2.js";import{d as s}from"./chunk-34IKHARR.js";import"./chunk-ZOPN2T2K.js";import"./chunk-Y7MUE52D.js";import"./chunk-2WQY5YYA.js";import"./chunk-NONNQTC3.js";import{h as e,l as c}from"./chunk-6HU4LHQY.js";import"./chunk-3JJ2DVAG.js";import{a as r,f as i}from"./chunk-ZB5MYPP3.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-E4DLJUAP.js.map
3
+ import"./chunk-IWBX6EKV.js";import{d as s}from"./chunk-ETO72ULV.js";import"./chunk-7ATNOKW5.js";import"./chunk-SM64LULD.js";import"./chunk-VFK6V2ML.js";import"./chunk-R65G2QPR.js";import{h as e,l as c}from"./chunk-QIY6CJYG.js";import"./chunk-SGMHMD4R.js";import{a as r,f as i}from"./chunk-ZLO4QG42.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-LEPLXGHR.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{k as _,l as j}from"./chunk-ZOPN2T2K.js";import{a as R}from"./chunk-TAHLKIRL.js";import{aa as O}from"./chunk-CP5QRUYE.js";import{l as y,m as I,n as N}from"./chunk-2WQY5YYA.js";import{b as h}from"./chunk-NONNQTC3.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-6HU4LHQY.js";import{b as S}from"./chunk-3JJ2DVAG.js";import{a,f as $}from"./chunk-ZB5MYPP3.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{k as _,l as j}from"./chunk-7ATNOKW5.js";import{a as R}from"./chunk-RAQKNHCM.js";import{aa as O}from"./chunk-EZ75MGB4.js";import{l as y,m as I,n as N}from"./chunk-VFK6V2ML.js";import{b as h}from"./chunk-R65G2QPR.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-QIY6CJYG.js";import{b as S}from"./chunk-SGMHMD4R.js";import{a,f as $}from"./chunk-ZLO4QG42.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-23GM2V7B.js.map
57
+ //# sourceMappingURL=chunk-2IP5M2UW.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-ZB5MYPP3.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-7KGYE5LJ.js.map
3
+ import{a as r,f as c}from"./chunk-ZLO4QG42.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-2YJDBWJO.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{w as p}from"./chunk-6HU4LHQY.js";import{b as m}from"./chunk-3JJ2DVAG.js";import{a as n,f as a}from"./chunk-ZB5MYPP3.js";a();import{randomBytes as u}from"node:crypto";import*as r from"node:fs";import*as o from"node:path";var h="token";function f(){return o.join(p(),"tokens")}n(f,"tokensDir");function l(e){return o.join(m(e),h)}n(l,"workspaceTokenFile");function F(e,s){let i=o.join(f(),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{w as p}from"./chunk-QIY6CJYG.js";import{b as m}from"./chunk-SGMHMD4R.js";import{a as n,f as a}from"./chunk-ZLO4QG42.js";a();import{randomBytes as u}from"node:crypto";import*as r from"node:fs";import*as o from"node:path";var h="token";function f(){return o.join(p(),"tokens")}n(f,"tokensDir");function l(e){return o.join(m(e),h)}n(l,"workspaceTokenFile");function F(e,s){let i=o.join(f(),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(F,"mintWorkspaceToken");function T(e){r.rmSync(o.join(f(),e),{force:!0})}n(T,"revokeWorkspaceToken");function j(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(f())}catch{}if(i.length&&!s.size)throw new Error(`no workspace folders found under ${e}`);return i.filter(t=>!s.has(t)).sort()}n(j,"staleTokens");function y(e){try{return r.statSync(e).isDirectory()}catch{return!1}}n(y,"isDir");export{f as a,l as b,F as c,T as d,j as e};
5
- //# sourceMappingURL=chunk-736XQT7E.js.map
5
+ //# sourceMappingURL=chunk-3FX7DATM.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-2WQY5YYA.js";import{a as w}from"./chunk-6HU4LHQY.js";import{a as s,e as h,f as i}from"./chunk-ZB5MYPP3.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-VFK6V2ML.js";import{a as w}from"./chunk-QIY6CJYG.js";import{a as s,e as h,f as i}from"./chunk-ZLO4QG42.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-OXUT73ZK.js.map
5
+ //# sourceMappingURL=chunk-4BR65TK6.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{N as c}from"./chunk-3PZ6HQYD.js";import{a as l,f}from"./chunk-ZB5MYPP3.js";f();import*as s from"node:fs";import*as e from"node:path";function p(o){let n=e.resolve(o);for(;;){let r=e.join(n,".env"),t=!1;try{t=s.statSync(r).isFile()}catch{t=!1}if(t)return r;let i=e.dirname(n);if(i===n)return null;n=i}}l(p,"findDotenv");function v(o){let n=p(o);if(!n)return{};let r={};for(let t of s.readFileSync(n,"utf8").split(/\r?\n/)){if(t=t.trim(),!t||t.startsWith("#")||!t.includes("="))continue;let i=t.indexOf("="),a=t.slice(0,i),u=t.slice(i+1);r[a.trim()]=c(u.trim())}return r}l(v,"loadDotenv");export{p as a,v as b};
4
- //# sourceMappingURL=chunk-BTZGFSAD.js.map
3
+ import{N as c}from"./chunk-OWYP2BRC.js";import{a as l,f}from"./chunk-ZLO4QG42.js";f();import*as s from"node:fs";import*as e from"node:path";function p(o){let n=e.resolve(o);for(;;){let r=e.join(n,".env"),t=!1;try{t=s.statSync(r).isFile()}catch{t=!1}if(t)return r;let i=e.dirname(n);if(i===n)return null;n=i}}l(p,"findDotenv");function v(o){let n=p(o);if(!n)return{};let r={};for(let t of s.readFileSync(n,"utf8").split(/\r?\n/)){if(t=t.trim(),!t||t.startsWith("#")||!t.includes("="))continue;let i=t.indexOf("="),a=t.slice(0,i),u=t.slice(i+1);r[a.trim()]=c(u.trim())}return r}l(v,"loadDotenv");export{p as a,v as b};
4
+ //# sourceMappingURL=chunk-4E4P27OE.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{h as H}from"./chunk-DJGLCWSW.js";import{r as B}from"./chunk-COOC6H6Z.js";import{C as G,G as A,a as ne,l as K,w as U,y as W,z as D}from"./chunk-6HU4LHQY.js";import{a as Y}from"./chunk-3JJ2DVAG.js";import{a as c,e as se,f as R}from"./chunk-ZB5MYPP3.js";R();var v=se(ne(),1);import*as p from"node:fs";import*as V from"node:os";import*as k from"node:path";R();import*as _ from"node:fs";import*as X from"node:path";var ue=`# Port Allocation Scheme
3
+ import{h as H}from"./chunk-6VEY2JX7.js";import{r as B}from"./chunk-VG3BA2XL.js";import{C as G,G as A,a as ne,l as K,w as U,y as W,z as D}from"./chunk-QIY6CJYG.js";import{a as Y}from"./chunk-SGMHMD4R.js";import{a as c,e as se,f as R}from"./chunk-ZLO4QG42.js";R();var v=se(ne(),1);import*as p from"node:fs";import*as V from"node:os";import*as k from"node:path";R();import*as _ from"node:fs";import*as X from"node:path";var ue=`# Port Allocation Scheme
4
4
  # Each feature slot (1-12) gets a dedicated port range.
5
5
  #
6
6
  # k8s port-forward listen-ports (the 9000-range) are NOT defined here \u2014 they
@@ -68,4 +68,4 @@ to its path in \`~/.werkmeister/config.yaml\`. \`machine setup\` writes this
68
68
  file only when it is missing and never overwrites it.
69
69
  `,L={archetypes:{"node-web":{standards:["ui","config","testing"],mcp_servers:["context7"],test:"npm test"},"node-service":{standards:["service","testing"],test:"npm test"},"node-tool":{standards:["engineering","testing"],validate:"Library: run the unit/smoke tests. No URL, cookie, or Caddy step applies."},"mcp-client":{standards:["engineering","testing"],validate:"Build, then npm run test:integration (Extension Development Host via @vscode/test-cli). Walk the open items in MANUAL-CHECKLIST.md for anything visual."}},caches:{"pnpm-store":{path:"/pnpm-store",env:{npm_config_store_dir:"/pnpm-store"},detect:["pnpm-lock.yaml"]},turbo:{path:"/turbo-cache",env:{TURBO_CACHE_DIR:"/turbo-cache",TURBO_CACHE_MAX_AGE:"14d"},detect:["turbo.json"],max_age:"14d"}},mcp_servers:{context7:{type:"stdio",command:"npx",args:["-y","@upstash/context7-mcp"],env:{CONTEXT7_API_KEY:"${CONTEXT7_API_KEY:-}"}},werkmeister:{type:"http",url:"http://host.docker.internal:${WERKMEISTER_MCP_PORT:-3002}/mcp",headers:{Authorization:"Bearer ${WERKMEISTER_MCP_TOKEN}"}}}};var j=k.join(Y,"services.yaml");function I(e){let n=k.join(e,j);return p.existsSync(n)?n:null}c(I,"fragmentPath");var ie="# GENERATED by `werkmeister registry sync` \u2014 do not edit.",M=c(e=>e.startsWith("# GENERATED by "),"isGenerated"),x=["services","setup_services","infrastructure","caches"],ae=["archetypes","caches","mcp_servers","k8s_context","services","infrastructure","setup_services","repos"],y=class extends Error{static{c(this,"RegistryError")}};function m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}c(m,"isDict");function q(e){if(!p.existsSync(e))return[];let n=[];for(let r of p.readdirSync(e).sort()){let s=I(k.join(e,r));s&&(p.statSync(k.join(e,r,".git"),{throwIfNoEntry:!1})?.isFile()||n.push(N(r,s)))}return n}c(q,"discoverFragments");function N(e,n){let r;try{r=(0,v.parse)(p.readFileSync(n,"utf8"))}catch(s){throw new y(`${n}: ${s instanceof Error?s.message:String(s)}`)}return{repo:e,path:n,doc:m(r)?r:{}}}c(N,"readFragment");var ce=/\{\{\s*(home|repos_root|workspaces_root|werkmeister_home|local_domain)\s*\}\}/g;function F(e,n){if(typeof e=="string")return e.replace(ce,(r,s)=>n[s]);if(Array.isArray(e))return e.map(r=>F(r,n));if(m(e)){let r={};for(let[s,o]of Object.entries(e))r[s]=F(o,n);return r}return e}c(F,"expandPlaceholders");function Q(e,n){let r={...e};for(let[s,o]of Object.entries(n))r[s]=m(o)&&m(r[s])?Q(r[s],o):o;return r}c(Q,"deepMerge");function C(e,n,r,s){let o=e.get(n);if(o!==void 0&&o!==r)throw new y(`${s} is defined by both ${o} and ${r}`);e.set(n,r)}c(C,"claim");function Z(e,n){let r={archetypes:structuredClone(n.defaults.archetypes??{}),caches:structuredClone(n.defaults.caches??{}),mcp_servers:structuredClone(n.defaults.mcp_servers??{}),services:{},infrastructure:{},setup_services:{},repos:{}},s=new Map;for(let o of Object.keys(r.caches))s.set(`caches/${o}`,"werkmeister");for(let o of e){let i=F(o.doc,n.paths);for(let t of Object.keys(i))if(!(t.startsWith("x-")||t==="repo"||x.includes(t)))throw new y(`${o.path}: unexpected top-level key \`${t}\` \u2014 a fragment may only contain ${x.join(", ")}, repo (and x-* anchor blocks)`);if(i.repo!==void 0){if(!m(i.repo))throw new y(`${o.path}: \`repo:\` must be a map`);Object.assign(r.repos[o.repo]??={services:[],path_mappings:{}},i.repo)}for(let t of x){let l=i[t]??{};if(!m(l))throw new y(`${o.path}: \`${t}:\` must be a map`);for(let[f,a]of Object.entries(l)){if(!m(a))throw new y(`${o.path}: \`${t}.${f}\` must be a map`);C(s,`${t}/${f}`,o.repo,`${t}.${f}`);let d=a;if(t==="services"||t==="setup_services"){if(a.repo!==void 0&&a.repo!==o.repo)throw new y(`${o.path}: ${t}.${f} says repo: ${a.repo} but lives in ${o.repo}`);d={repo:o.repo,...a}}if(t==="services"){d.port_offset!==void 0&&C(s,`port_offset/${d.port_offset}`,`${o.repo}:${f}`,`port_offset ${d.port_offset}`);let w=r.repos[o.repo]??={services:[],path_mappings:{}};w.services.push(f);let g=String(d.path??".").replace(/^\/+|\/+$/g,"");g!==""&&g!=="."&&(w.path_mappings[g]=f)}(t==="services"||t==="infrastructure")&&d.k8s_forward_port!==void 0&&C(s,`k8s_forward_port/${d.k8s_forward_port}`,`${o.repo}:${f}`,`k8s_forward_port ${d.k8s_forward_port}`),r[t][f]=d}}}return Q(r,n.local)}c(Z,"mergeRegistry");var $="disabled_fragments";function ee(e,n,r){let{[$]:s,...o}=n,i=s??[];if(!Array.isArray(i)||!i.every(a=>typeof a=="string"))throw new y(`${r}: ${$} must be a list of repo names`);let t=new Set(i),l=e.filter(a=>t.has(a.repo)),f=structuredClone(o);for(let a of["services","setup_services","infrastructure"]){let d=f[a];if(m(d))for(let[w,g]of Object.entries(d))(l.some(E=>m(E.doc[a])&&w in E.doc[a])||m(g)&&t.has(g.repo))&&delete d[w]}if(m(f.repos))for(let a of t)delete f.repos[a];return{fragments:e.filter(a=>!t.has(a.repo)),skipped:l,unknown:i.filter(a=>!e.some(d=>d.repo===a)),local:f}}c(ee,"applyDisabled");function fe(e,n,r,s=[]){let o={};for(let t of ae)t in e&&(o[t]=e[t]);for(let t of Object.keys(e))t in o||(o[t]=e[t]);return[ie,"# Edit a repo's .werkmeister/services.yaml fragment, or the machine overrides file, then","# run `werkmeister registry sync` (or `werkmeister machine setup`). Regenerated from:",...n.map(t=>`# Source: ${t}`),...s.map(t=>`# Disabled: ${t}`),`# Machine overrides: ${r}`,""].join(`
70
70
  `)+(0,v.stringify)(o,{lineWidth:0})}c(fe,"renderRegistry");function de(e){if(!p.existsSync(e))return null;let n=p.readFileSync(e,"utf8");if(M(n))return null;try{let r=(0,v.parse)(n),s=m(r)?r.k8s_context:void 0;return typeof s=="string"&&s.trim()?s.trim():null}catch{return null}}c(de,"inheritedK8sContext");function pe(e,n){let r;try{r=(0,v.parse)(e)}catch{return[]}if(!m(r))return[];let s=[];for(let o of x){let i=r[o];if(m(i))for(let t of Object.keys(i))t in(n[o]??{})||s.push(`${o}.${t}`)}return s}c(pe,"orphanedEntries");function Se(e,n){let r=c(t=>{try{let l=t===null?null:(0,v.parse)(t);return m(l)?l:{}}catch{return{}}},"sections"),s=r(e),o=r(n),i={added:[],removed:[],changed:[]};for(let t of x){let l=m(s[t])?s[t]:{},f=m(o[t])?o[t]:{};for(let a of new Set([...Object.keys(l),...Object.keys(f)])){let d=`${t}.${a}`;a in l?a in f?JSON.stringify(l[a])!==JSON.stringify(f[a])&&i.changed.push(d):i.removed.push(d):i.added.push(d)}}for(let t of Object.values(i))t.sort();return i}c(Se,"registryChanges");function te(){return{home:V.homedir(),repos_root:A(),workspaces_root:G(),werkmeister_home:U(),local_domain:B().local_domain}}c(te,"placeholderPaths");function re(e){if(!p.existsSync(e))return{};let n;try{n=(0,v.parse)(p.readFileSync(e,"utf8"))}catch(r){throw new y(`${e}: ${r instanceof Error?r.message:String(r)}`)}if(n==null)return{};if(!m(n))throw new y(`${e}: must be a map of registry keys`);return n}c(re,"readLocalOverlay");function le(e,n,r=A()){let s=I(n);if(!s)return null;let o=q(r).filter(a=>a.repo!==e);o.push(N(e,s));let i=D(),t=re(i),l=t[$];Array.isArray(l)&&(t[$]=l.filter(a=>a!==e));let f=ee(o,t,i);return Z(f.fragments,{defaults:L,local:f.local,paths:te()})}c(le,"branchRegistry");function xe(e,n){let r={...e};for(let s of H(n)){let o=k.basename(s),i;try{i=le(o,s)}catch(t){K(`${o}: branch fragment ignored: ${t instanceof Error?t.message:String(t)}`);continue}for(let[t,l]of Object.entries(i?.services??{}))l.repo===o&&(r[t]=l)}return r}c(xe,"workspaceServices");function Re(e={}){let n="config services.yaml",r=e.reposRoot??A(),s=e.target??W(),o=D();if(e.generatedOnly&&p.existsSync(s)&&!M(p.readFileSync(s,"utf8")))return[{label:n,ok:!1,detail:`${s} is hand-written \u2014 left as is; \`werkmeister registry sync\` converts it (with a backup)`}];let i,t,l,f="";try{if(!e.checkOnly&&!e.target&&!p.existsSync(o)){let h=de(s)??"orbstack";z(o,J(h)),f=`; seeded ${o} (k8s_context: ${h} \u2014 edit there)`}let u=q(r);if(u.length===0)return[{label:n,ok:!1,detail:`no ${j} found under ${r} \u2014 clone your team's repos there and re-run \`werkmeister machine setup\` (or answer yes to the demo apps)`}];let S=re(o);if(e.from){let h=I(e.from);if(!h)return[{label:n,ok:!1,detail:`no ${j} in ${e.from}`}];let O=k.basename(e.from);u=[...u.filter(T=>T.repo!==O),N(O,h)];let P=S[$];Array.isArray(P)&&(S[$]=P.filter(T=>T!==O))}i=ee(u,S,o),t=Z(i.fragments,{defaults:L,local:i.local,paths:te()}),l=fe(t,i.fragments.map(h=>h.path),o,i.skipped.map(h=>h.path))}catch(u){return[{label:n,ok:!1,detail:u instanceof Error?u.message:String(u)}]}let a=[...i.skipped.map(u=>({label:`fragment ${u.repo}`,ok:!0,detail:`disabled in ${o} \u2014 skipped`})),...i.unknown.map(u=>({label:`fragment ${u}`,ok:!0,detail:`listed in ${$} in ${o}, but no fragment under ${r}`}))],d=c(u=>[u,...a],"report"),w=i.fragments.length,g=`${w} fragment${w===1?"":"s"}`,b=p.existsSync(s)?p.readFileSync(s,"utf8"):null;if(b===l)return d({label:n,ok:!0,detail:`up to date (${g}) at ${s}${f}`});if(e.checkOnly)return d({label:n,ok:!1,detail:b===null?`missing \u2014 would generate ${s} from ${g}`:`drift \u2014 would regenerate ${s} from ${g}`});let E="";if(b!==null&&!M(b)){let u=Math.floor((e.now??Date.now)()/1e3),S=`${s}.bak-${u}`;p.copyFileSync(s,S),E=`; hand-written registry backed up to ${S}`;let h=pe(b,t);h.length&&(E+=`; not in any fragment: ${h.join(", ")}`)}try{p.mkdirSync(k.dirname(s),{recursive:!0}),p.writeFileSync(s,l)}catch(u){return d({label:n,ok:!1,detail:`could not write ${s}: ${u}`})}return d({label:n,ok:!0,detail:`generated ${s} from ${g}${E}${f}`})}c(Re,"syncRegistry");export{ue as a,me as b,he as c,J as d,z as e,ye as f,j as g,y as h,q as i,Z as j,de as k,Se as l,le as m,xe as n,Re as o};
71
- //# sourceMappingURL=chunk-MA4ZNBJQ.js.map
71
+ //# sourceMappingURL=chunk-546SJZOD.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{f as C}from"./chunk-Y7MUE52D.js";import{K as S,L as _,M,O as y,X as w,j as g,l as x}from"./chunk-6HU4LHQY.js";import{a,f as b}from"./chunk-ZB5MYPP3.js";b();import*as d from"node:fs";import*as h from"node:path";function L(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=a(()=>{clearTimeout(o),t?.removeEventListener("abort",r),n()},"done"),o=setTimeout(r,e*1e3);t?.addEventListener("abort",r,{once:!0})})}a(L,"sleep");var v=class{static{a(this,"ContainerStats")}name;samples=0;cpuSamples=[];memSamples=[];constructor(t){this.name=t}get avgCpu(){return this.cpuSamples.length?this.cpuSamples.reduce((t,n)=>t+n,0)/this.cpuSamples.length:0}get maxCpu(){return this.cpuSamples.length?Math.max(...this.cpuSamples):0}get avgMem(){return this.memSamples.length?this.memSamples.reduce((t,n)=>t+n,0)/this.memSamples.length:0}get maxMem(){return this.memSamples.length?Math.max(...this.memSamples):0}};async function $(e=60,t=10,n="",r){let o={},m=Math.max(1,Math.floor(e/t));for(let s=0;s<m&&!r?.aborted;s++){let p=await C(r);if(r?.aborted)break;for(let c of p){let i=c.name;if(n&&!i.startsWith(n))continue;i in o||(o[i]=new v(i));let u=o[i];u.samples+=1,u.cpuSamples.push(c.cpuPercent),u.memSamples.push(c.memMib)}s<m-1&&await L(t,r)}return o}a($,"collectStats");function j(e){return e>=1024?`${(e/1024).toFixed(1)}G`:e>=1?`${e.toFixed(0)}M`:`${(e*1024).toFixed(0)}K`}a(j,"formatMem");function k(e){let t=[];for(let n of Object.keys(e).sort()){let r=e[n];if(r.samples===0)continue;let o=r.maxCpu/100*1.5,m=O(o),s=r.maxMem*1.5,p=F(s),c=F(s/3);t.push({name:n,max_cpu_pct:r.maxCpu,max_mem_mib:r.maxMem,recommended_cpus:m,recommended_memory:p,recommended_reservation:c})}return t}a(k,"recommendLimits");function O(e){return e<=.1?"0.1":e<=.25?"0.25":e<=.5?"0.5":e<=1?"1.0":e<=1.5?"1.5":e<=2?"2.0":(Math.ceil(e*2)/2).toFixed(1)}a(O,"roundCpu");function F(e){let t=[64,128,256,512,1024,1536,2048,2560,3072,4096,6144,8192];for(let n of t)if(e<=n)return n<1024?`${n}M`:`${Math.floor(n/1024)}G`;return`${Math.ceil(e/1024)}G`}a(F,"roundMemory");function H(e){return O(Number(e)/2)}a(H,"halveCpu");function l(e){return String(e).padStart(2,"0")}a(l,"pad2");function P(e,t){let n=h.join(w(),"stats");d.existsSync(n)||d.mkdirSync(n);let r=new Date,o=`${r.getFullYear()}${l(r.getMonth()+1)}${l(r.getDate())}-${l(r.getHours())}${l(r.getMinutes())}${l(r.getSeconds())}`,m=h.join(n,`docker-stats-${o}.csv`),s=[["container","avg_cpu_pct","max_cpu_pct","avg_mem_mib","max_mem_mib","samples"].join(",")];for(let u of Object.keys(e).sort()){let f=e[u];s.push([u,f.avgCpu.toFixed(1),f.maxCpu.toFixed(1),f.avgMem.toFixed(1),f.maxMem.toFixed(1),String(f.samples)].join(","))}d.writeFileSync(m,s.join(`\r
3
+ import{f as C}from"./chunk-SM64LULD.js";import{K as S,L as _,M,O as y,X as w,j as g,l as x}from"./chunk-QIY6CJYG.js";import{a,f as b}from"./chunk-ZLO4QG42.js";b();import*as d from"node:fs";import*as h from"node:path";function L(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=a(()=>{clearTimeout(o),t?.removeEventListener("abort",r),n()},"done"),o=setTimeout(r,e*1e3);t?.addEventListener("abort",r,{once:!0})})}a(L,"sleep");var v=class{static{a(this,"ContainerStats")}name;samples=0;cpuSamples=[];memSamples=[];constructor(t){this.name=t}get avgCpu(){return this.cpuSamples.length?this.cpuSamples.reduce((t,n)=>t+n,0)/this.cpuSamples.length:0}get maxCpu(){return this.cpuSamples.length?Math.max(...this.cpuSamples):0}get avgMem(){return this.memSamples.length?this.memSamples.reduce((t,n)=>t+n,0)/this.memSamples.length:0}get maxMem(){return this.memSamples.length?Math.max(...this.memSamples):0}};async function $(e=60,t=10,n="",r){let o={},m=Math.max(1,Math.floor(e/t));for(let s=0;s<m&&!r?.aborted;s++){let p=await C(r);if(r?.aborted)break;for(let c of p){let i=c.name;if(n&&!i.startsWith(n))continue;i in o||(o[i]=new v(i));let u=o[i];u.samples+=1,u.cpuSamples.push(c.cpuPercent),u.memSamples.push(c.memMib)}s<m-1&&await L(t,r)}return o}a($,"collectStats");function j(e){return e>=1024?`${(e/1024).toFixed(1)}G`:e>=1?`${e.toFixed(0)}M`:`${(e*1024).toFixed(0)}K`}a(j,"formatMem");function k(e){let t=[];for(let n of Object.keys(e).sort()){let r=e[n];if(r.samples===0)continue;let o=r.maxCpu/100*1.5,m=O(o),s=r.maxMem*1.5,p=F(s),c=F(s/3);t.push({name:n,max_cpu_pct:r.maxCpu,max_mem_mib:r.maxMem,recommended_cpus:m,recommended_memory:p,recommended_reservation:c})}return t}a(k,"recommendLimits");function O(e){return e<=.1?"0.1":e<=.25?"0.25":e<=.5?"0.5":e<=1?"1.0":e<=1.5?"1.5":e<=2?"2.0":(Math.ceil(e*2)/2).toFixed(1)}a(O,"roundCpu");function F(e){let t=[64,128,256,512,1024,1536,2048,2560,3072,4096,6144,8192];for(let n of t)if(e<=n)return n<1024?`${n}M`:`${Math.floor(n/1024)}G`;return`${Math.ceil(e/1024)}G`}a(F,"roundMemory");function H(e){return O(Number(e)/2)}a(H,"halveCpu");function l(e){return String(e).padStart(2,"0")}a(l,"pad2");function P(e,t){let n=h.join(w(),"stats");d.existsSync(n)||d.mkdirSync(n);let r=new Date,o=`${r.getFullYear()}${l(r.getMonth()+1)}${l(r.getDate())}-${l(r.getHours())}${l(r.getMinutes())}${l(r.getSeconds())}`,m=h.join(n,`docker-stats-${o}.csv`),s=[["container","avg_cpu_pct","max_cpu_pct","avg_mem_mib","max_mem_mib","samples"].join(",")];for(let u of Object.keys(e).sort()){let f=e[u];s.push([u,f.avgCpu.toFixed(1),f.maxCpu.toFixed(1),f.avgMem.toFixed(1),f.maxMem.toFixed(1),String(f.samples)].join(","))}d.writeFileSync(m,s.join(`\r
4
4
  `)+`\r
5
5
  `);let p=h.join(n,`resource-summary-${o}.txt`),c=`${r.getFullYear()}-${l(r.getMonth()+1)}-${l(r.getDate())} ${l(r.getHours())}:${l(r.getMinutes())}:${l(r.getSeconds())}`,i="";i+=`Docker Resource Usage Summary
6
6
  `,i+=`Generated: ${c}
@@ -15,4 +15,4 @@ Recommended Resource Limits:
15
15
 
16
16
  `;for(let u of t)i+=` ${u.name.padEnd(35)} cpus: ${u.recommended_cpus.padStart(5)} memory: ${u.recommended_memory.padStart(5)}
17
17
  `;return d.writeFileSync(p,i),p}a(P,"saveReport");async function K(e,t,n,r){let o=Date.now(),m=await $(e*60,t,"",r),s=(Date.now()-o)/6e4;if(!Object.keys(m).length)return x("No container data collected."),{stats:m,recommendations:[],samples:0,durationMinutes:s,saved:!1,reportPath:null};let p=k(m),c=n?P(m,p):null;return{stats:m,recommendations:p,samples:Math.max(0,...Object.values(m).map(i=>i.samples)),durationMinutes:s,saved:c!==null,reportPath:c}}a(K,"runCollection");function R(e){if(!e)return 0;e=e.trim();let t;return e.endsWith("G")?t=Number(e.slice(0,-1))*1024:e.endsWith("M")?t=Number(e.slice(0,-1)):e.endsWith("K")?t=Number(e.slice(0,-1))/1024:t=Number(e),Number.isFinite(t)?t:0}a(R,"parseConfigMem");function D(e,t){if(e in t)return e;let n=e,r=["w9r-","sandbox-","feat-"];for(let s of r)n.startsWith(s)&&(n=n.slice(s.length));let o=n.lastIndexOf("-"),m=o===-1?[n]:[n.slice(0,o),n.slice(o+1)];if(/^\d+$/.test(m[m.length-1])&&(n=m[0]),n in t)return n;for(let s of Object.keys(t))if(n.endsWith(s)||e.endsWith(s))return s;return null}a(D,"matchService");function E(){let e={};for(let[t,n]of Object.entries(y()))e[t]=String(n?.cpus??_);for(let[t,n]of Object.entries(M()))e[t]=String(n?.cpus??S);return e}a(E,"configuredCpus");function N(e,t){let n=D(e,t);return n?t[n]:null}a(N,"cpuLimitOf");function U(e,t){return e<=0?"no_limit":t>85?"risk":t>60?"moderate":t<20&&e>256?"over_provisioned":"ok"}a(U,"classifyUsage");async function Y(e=0,t=10){let n=E(),r={};for(let[s,p]of Object.entries(M())){let c=p?.memory_limit;c&&(r[s]={limit:c,limitMib:R(c)})}let o;return e>0?(g(`Collecting stats for ${e} minute(s)...`),o=await $(e*60,t)):(g("Taking a snapshot of current resource usage..."),o=await $(15,5)),Object.keys(o).length?{usage:Object.keys(o).sort().map(s=>{let p=D(s,r),c=p?r[p]:void 0,i=c?.limitMib??0,u=o[s].maxMem,f=i>0?u/i*100:0;return{container:s,service:p,maxMemMib:u,limit:c?.limit??null,limitMib:i,cpuLimit:N(s,n),usagePct:f,status:U(i,f)}}),recommendations:k(o)}:(x("No running containers found. Start your workspace first."),{usage:[],recommendations:[]})}a(Y,"optimizeReport");export{j as a,H as b,K as c,E as d,N as e,Y as f};
18
- //# sourceMappingURL=chunk-LEIPUXIV.js.map
18
+ //# sourceMappingURL=chunk-5QG3DOZZ.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 s,f as c}from"./chunk-ZB5MYPP3.js";c();function t(e=process.env){let r=e.WERKMEISTER_LAUNCHER;return r==="vscode"||r==="terminal"?r:e.CLAUDE_CODE_ENTRYPOINT==="claude-vscode"||e.TERM_PROGRAM==="vscode"?"vscode":"terminal"}s(t,"claudeLauncher");var n="vscode://jbbz.werkmeister-vscode";function i(e){let r=new URLSearchParams({workspace:e.workspace,mode:e.sessionId?"resume":"new"});return e.sessionId&&r.set("session",e.sessionId),e.prompt&&r.set("prompt",e.prompt),`${n}/claude?${r}`}s(i,"claudeLaunchUri");function a(e){return`${n}/reconcile?${new URLSearchParams({slug:e})}`}s(a,"reconcileLaunchUri");export{t as a,i as b,a as c};
4
- //# sourceMappingURL=chunk-QUKZMMNJ.js.map
3
+ import{a as s,f as c}from"./chunk-ZLO4QG42.js";c();function t(e=process.env){let r=e.WERKMEISTER_LAUNCHER;return r==="vscode"||r==="terminal"?r:e.CLAUDE_CODE_ENTRYPOINT==="claude-vscode"||e.TERM_PROGRAM==="vscode"?"vscode":"terminal"}s(t,"claudeLauncher");var n="vscode://jbbz.werkmeister-vscode";function i(e){let r=new URLSearchParams({workspace:e.workspace,mode:e.sessionId?"resume":"new"});return e.sessionId&&r.set("session",e.sessionId),e.prompt&&r.set("prompt",e.prompt),`${n}/claude?${r}`}s(i,"claudeLaunchUri");function a(e){return`${n}/reconcile?${new URLSearchParams({slug:e})}`}s(a,"reconcileLaunchUri");export{t as a,i as b,a as c};
4
+ //# sourceMappingURL=chunk-5XSAAMDP.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{m as c}from"./chunk-2WQY5YYA.js";import{j as h,l as k}from"./chunk-6HU4LHQY.js";import{a,f as w}from"./chunk-ZB5MYPP3.js";w();import*as m from"node:fs";import*as d from"node:path";var $="# --- sandbox workspace (managed section)",E=`${$} -----------------------------------
3
+ import{m as c}from"./chunk-VFK6V2ML.js";import{j as h,l as k}from"./chunk-QIY6CJYG.js";import{a,f as w}from"./chunk-ZLO4QG42.js";w();import*as m from"node:fs";import*as d from"node:path";var $="# --- sandbox workspace (managed section)",E=`${$} -----------------------------------
4
4
  # Repo worktrees nested in this workspace, ignored by name. Rewritten by
5
5
  # \`werkmeister workspace init\` on each run; rules above come from the repo's main.
6
6
  `,x=["compose.yml","compose.gate.yml",".werkmeister/agent-state.json",".werkmeister/sessions/",".werkmeister/notices.json",".werkmeister/last-exec",".werkmeister/starts.json",".werkmeister/token",".werkmeister/wake-nudge*"],C=["/.env","/.env.*",...x.map(t=>`/${t}`)];function v(t){let i=["rm","--cached","--quiet","--ignore-unmatch","--",...x];c(["git","-C",t,...i],{capture:!0})}a(v,"untrackRuntimeFiles");function A(t){let i=d.join(t,".gitignore"),e="";try{e=m.readFileSync(i,"utf8")}catch{}let n=new Set(e.split(`
@@ -20,4 +20,4 @@ import{m as c}from"./chunk-2WQY5YYA.js";import{j as h,l as k}from"./chunk-6HU4LH
20
20
  then rerun; the worktree lands on that branch.
21
21
  Start over (deletes the remote branch): rerun with --force
22
22
  Keep both: pick a different feature name.`)}h(` ${r}: worktree \u2192 ${e} (from ${l})`),f=["git","-C",t,"worktree","add","--no-track","-b",e,i,l]}let o=c(f,{capture:!0});if(o.status!==0)throw new Error(o.stderr.trim()||`git worktree add failed for ${r}`);if(s.status!==0)for(let[l,u]of[["remote","origin"],["merge",`refs/heads/${e}`]])c(["git","-C",t,"config",`branch.${e}.${l}`,u],{capture:!0})}a(D,"createWorktree");function S(t){return!!c(["git","-C",t,"status","--porcelain"],{capture:!0}).stdout.trim()}a(S,"worktreeIsDirty");function N(t,i,e){let n=c(["git","-C",t,"worktree","remove","--force",i],{capture:!0});if(n.status!==0)return[!1,n.stderr.trim()||`could not remove worktree ${i}`];let r=c(["git","-C",t,"branch","-D",e],{capture:!0});return r.status!==0?[!0,`worktree removed but branch ${e} lingered: ${r.stderr.trim()}`]:[!0,""]}a(N,"removeWorktree");function H(t,i,e=[]){if(!m.existsSync(d.join(t,".git")))return!1;let n=e.length?["--",...e]:[];try{return c(["git","-C",t,"add","-A",...n],{capture:!0,check:!0}),c(["git","-C",t,"diff","--cached","--quiet",...n],{capture:!0}).status===0?!1:(c(["git","-C",t,"commit","-q","-m",i,...n],{capture:!0,check:!0}),!0)}catch(r){return k(`Could not commit ${i}: ${r.message}`),!1}}a(H,"commitRecord");export{A as a,F as b,W as c,j as d,_ as e,T as f,D as g,S as h,N as i,H as j};
23
- //# sourceMappingURL=chunk-36Y5TWCS.js.map
23
+ //# sourceMappingURL=chunk-64WYOHLN.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{d as rt}from"./chunk-WH66XR3Z.js";import{a as Xe,c as M,d as Ze,f as et,h as tt}from"./chunk-ERS24IKS.js";import{d as qe,o as Qe}from"./chunk-V4WXF46Y.js";import{b as ze,c as ce,g as ae,h as Je,i as fe,j as Ye}from"./chunk-36Y5TWCS.js";import{r as se,s as ie,u as Ke}from"./chunk-ZDRNJGSF.js";import{c as ne,d as Pe}from"./chunk-ZLNXIRGJ.js";import{c as Te}from"./chunk-KRXEK5IM.js";import{o as Oe}from"./chunk-MA4ZNBJQ.js";import{h as je}from"./chunk-DJGLCWSW.js";import{m as Ae}from"./chunk-ZOPN2T2K.js";import{A as Ne,B as Fe,G as te,H as Me,J as z,L as re,O as Ue,S as Le,T as oe,i as We,o as j,p as Ie,x as De,z as ee}from"./chunk-3PZ6HQYD.js";import{b as He,e as Be,g as Ve}from"./chunk-CP5QRUYE.js";import{a as B}from"./chunk-7KGYE5LJ.js";import{m as K}from"./chunk-2WQY5YYA.js";import{a as Ge}from"./chunk-3MYYJ2O6.js";import{b as be}from"./chunk-7E35KHQU.js";import{b as Re,c as Ce}from"./chunk-736XQT7E.js";import{o as _e,p as Z,s as xe}from"./chunk-COOC6H6Z.js";import{c as ve}from"./chunk-NONNQTC3.js";import{G as X,M as Se,S as $e,T as Ee,a as Rt,h as A,j as k,k as y,l as g,m as V,n as F,o as ge,r as ye,s as Q}from"./chunk-6HU4LHQY.js";import{b as N}from"./chunk-3JJ2DVAG.js";import{a as i,e as xt,f as C}from"./chunk-ZB5MYPP3.js";C();import*as T from"node:fs";import*as J from"node:path";var ot=i(e=>J.join(N(e),"issue.md"),"issueCopyPath"),U=class extends Error{static{i(this,"IssueFetchError")}};async function nt(e,r=()=>new Date,o=j({text:e})){let t=await o.fetchIssue(e);if(!t)throw new U(`couldn't read ${e} from ${o.label}`);return{ref:t.ref,url:t.url??o.url(t.ref),tracker:o.id,title:t.title??"",status:t.status??"",body:t.description??"",comments:t.comments??[],fetchedAt:r().toISOString()}}i(nt,"fetchIssueSnapshot");var ue=`
3
+ import{d as rt}from"./chunk-FQCJ5O46.js";import{a as Xe,c as M,d as Ze,f as et,h as tt}from"./chunk-PESILXNN.js";import{d as qe,o as Qe}from"./chunk-E6W3GWK6.js";import{b as ze,c as ce,g as ae,h as Je,i as fe,j as Ye}from"./chunk-64WYOHLN.js";import{r as se,s as ie,u as Ke}from"./chunk-TCNJFGTZ.js";import{c as ne,d as Pe}from"./chunk-QF7UYRPA.js";import{c as Te}from"./chunk-SZ5KZYVN.js";import{o as Oe}from"./chunk-546SJZOD.js";import{h as je}from"./chunk-6VEY2JX7.js";import{m as Ae}from"./chunk-7ATNOKW5.js";import{A as Ne,B as Fe,G as te,H as Me,J as z,L as re,O as Ue,S as Le,T as oe,i as We,o as j,p as Ie,x as De,z as ee}from"./chunk-OWYP2BRC.js";import{b as He,e as Be,g as Ve}from"./chunk-EZ75MGB4.js";import{a as B}from"./chunk-2YJDBWJO.js";import{m as K}from"./chunk-VFK6V2ML.js";import{a as Ge}from"./chunk-AL3AC4P2.js";import{b as be}from"./chunk-IRIGNO72.js";import{b as Re,c as Ce}from"./chunk-3FX7DATM.js";import{o as _e,p as Z,s as xe}from"./chunk-VG3BA2XL.js";import{c as ve}from"./chunk-R65G2QPR.js";import{G as X,M as Se,S as $e,T as Ee,a as Rt,h as A,j as k,k as y,l as g,m as V,n as F,o as ge,r as ye,s as Q}from"./chunk-QIY6CJYG.js";import{b as N}from"./chunk-SGMHMD4R.js";import{a as i,e as xt,f as C}from"./chunk-ZLO4QG42.js";C();import*as T from"node:fs";import*as J from"node:path";var ot=i(e=>J.join(N(e),"issue.md"),"issueCopyPath"),U=class extends Error{static{i(this,"IssueFetchError")}};async function nt(e,r=()=>new Date,o=j({text:e})){let t=await o.fetchIssue(e);if(!t)throw new U(`couldn't read ${e} from ${o.label}`);return{ref:t.ref,url:t.url??o.url(t.ref),tracker:o.id,title:t.title??"",status:t.status??"",body:t.description??"",comments:t.comments??[],fetchedAt:r().toISOString()}}i(nt,"fetchIssueSnapshot");var ue=`
4
4
 
5
5
  ## Comments
6
6
  `;function Ct(e){let r=["---",`ref: ${e.ref}`,`url: ${e.url??""}`,`tracker: ${e.tracker}`,`status: ${e.status}`,`fetched: ${e.fetchedAt}`,"---","",`# ${e.title}`,"",e.body].join(`
@@ -33,4 +33,4 @@ ${A.BOLD}Workspace initialised.${A.RESET} Open a new Claude Code session from th
33
33
  ${A.BOLD}Workspace ready.${A.RESET} cd ${a} and open a Claude Code session from there.
34
34
 
35
35
  `),a):(g(`Workspace created at ${a}, but its containers are not set up: it has no slot (see the slot warning above). Free a slot with \`werkmeister feature down <feature>\`, then run \`werkmeister workspace init\` there.`),a)}i(Lr,"provisionWorkspace");export{U as a,nt as b,R as c,de as d,wt as e,Xt as f,Lr as g};
36
- //# sourceMappingURL=chunk-VZ3CPOPB.js.map
36
+ //# sourceMappingURL=chunk-6B25DSWW.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 as B,u as F,w as _}from"./chunk-VW2X6CB5.js";import{b as D,d as N}from"./chunk-LIS7CNJ2.js";import{d as E,r as T}from"./chunk-642DWZGI.js";import{f as O}from"./chunk-EVHOXBDD.js";import{c as k}from"./chunk-34IKHARR.js";import{Q as A,W as C,ba as y,ca as I,d as R,s as j,t as P}from"./chunk-CP5QRUYE.js";import{d as v}from"./chunk-Y7MUE52D.js";import{M as w}from"./chunk-6HU4LHQY.js";import{a,f as x}from"./chunk-ZB5MYPP3.js";x();async function M(){return(await v(E,void 0,{all:!1})??[]).map(({service:e,state:n,health:r})=>{let s;return r==="healthy"?s="healthy":r==="starting"?s="starting":n==="running"?s="running":s=n||"down",{service:e||"unknown",display:s}})}a(M,"getInfraStatus");function Q(t){if(typeof t=="number"){let[e,n]=I(t);return`${e}-${n}`}return"?"}a(Q,"featurePortRange");function U(t){return P(t.service,t.role)&&t.status==="exited"&&t.exitCode===0}a(U,"finishedSetup");function V(t){return t.filter(e=>!U(e))}a(V,"tallied");function H(t){return Object.entries(t).sort((e,n)=>{let r=typeof e[1].slot=="number"?e[1].slot:99,s=typeof n[1].slot=="number"?n[1].slot:99;return r-s})}a(H,"sortedSlots");function J(t,e,n){let r=[];for(let[s,f]of H(t))for(let l of f.services??[]){let u=e[l],p=B(u),c=p===null?String(u.k8s_deployment):null,i=c!==null?n.intercepts.get(c):void 0;r.push({feature:s,service:l,deployment:c,interceptable:p===null,blocker:p,intercepted:i!==void 0,intercepted_by:i??null})}return r}a(J,"buildInterceptRows");var L=a(t=>$(t,void 0,15),"STATUS_READ");async function ot(){let t=await _(L),e=w(),n=t.installed?J(await y(),e,t):[];return{available:t.available,installed:t.installed,connected_namespace:t.namespace,intercepts:n,remote_services:Object.keys(e).filter(r=>F(e[r])).sort()}}a(ot,"interceptsSnapshot");async function W(){let[t,e]=await Promise.all([v().then(n=>D(n??[])),N().catch(()=>null)]);return{health:t,resources:e}}a(W,"featureVitals");async function at(){let t=W(),e=k().catch(()=>[]),n=await M(),r=await T(),s=await y(),f=await O(),l=await _(L),u=J(s,w(),l),{health:p,resources:c}=await t,i=[];for(let[o,m]of H(s)){let h=V(await j(o)),S=await R(o),b=c?.projects[S],d=p.get(S);i.push({name:o,slot:m.slot,services:m.services??[],port_range:Q(m.slot),containers:h,containers_running:h.filter(g=>g.status==="running").length,containers_total:h.length,intercepts:u.filter(g=>g.feature===o),cpu_percent:b?.cpuPercent??null,mem_mib:b?.memMib??null,started_at:d?.started?.at??null,started_by:d?.started?.by??null,crash_loops:d?.crashLoops??[]})}return{host:c?.host??null,infrastructure:n,mcp_web_server:f,k8s_forwards:r,features:i,waiting:await A(),caches:await e,summary:{total_features:i.length,available_slots:C()-i.length,infra_healthy:n.length>0&&n.every(o=>o.display==="healthy"||o.display==="running"),k8s_alive:r.filter(o=>o.status==="alive").length,k8s_total:r.length,telepresence_available:l.available,intercepts_active:u.filter(o=>o.intercepted).length}}}a(at,"statusSnapshot");export{M as a,Q as b,U as c,V as d,H as e,J as f,ot as g,W as h,at as i};
4
- //# sourceMappingURL=chunk-BVNQPKFK.js.map
3
+ import{f as $,t as B,u as F,w as _}from"./chunk-BNRNITRE.js";import{b as D,d as N}from"./chunk-7B7Q6EAN.js";import{d as E,r as T}from"./chunk-LRMNDYRD.js";import{f as O}from"./chunk-FNKN5FRN.js";import{c as k}from"./chunk-ETO72ULV.js";import{Q as A,W as C,ba as y,ca as I,d as R,s as j,t as P}from"./chunk-EZ75MGB4.js";import{d as v}from"./chunk-SM64LULD.js";import{M as w}from"./chunk-QIY6CJYG.js";import{a,f as x}from"./chunk-ZLO4QG42.js";x();async function M(){return(await v(E,void 0,{all:!1})??[]).map(({service:e,state:n,health:r})=>{let s;return r==="healthy"?s="healthy":r==="starting"?s="starting":n==="running"?s="running":s=n||"down",{service:e||"unknown",display:s}})}a(M,"getInfraStatus");function Q(t){if(typeof t=="number"){let[e,n]=I(t);return`${e}-${n}`}return"?"}a(Q,"featurePortRange");function U(t){return P(t.service,t.role)&&t.status==="exited"&&t.exitCode===0}a(U,"finishedSetup");function V(t){return t.filter(e=>!U(e))}a(V,"tallied");function H(t){return Object.entries(t).sort((e,n)=>{let r=typeof e[1].slot=="number"?e[1].slot:99,s=typeof n[1].slot=="number"?n[1].slot:99;return r-s})}a(H,"sortedSlots");function J(t,e,n){let r=[];for(let[s,f]of H(t))for(let l of f.services??[]){let u=e[l],p=B(u),c=p===null?String(u.k8s_deployment):null,i=c!==null?n.intercepts.get(c):void 0;r.push({feature:s,service:l,deployment:c,interceptable:p===null,blocker:p,intercepted:i!==void 0,intercepted_by:i??null})}return r}a(J,"buildInterceptRows");var L=a(t=>$(t,void 0,15),"STATUS_READ");async function ot(){let t=await _(L),e=w(),n=t.installed?J(await y(),e,t):[];return{available:t.available,installed:t.installed,connected_namespace:t.namespace,intercepts:n,remote_services:Object.keys(e).filter(r=>F(e[r])).sort()}}a(ot,"interceptsSnapshot");async function W(){let[t,e]=await Promise.all([v().then(n=>D(n??[])),N().catch(()=>null)]);return{health:t,resources:e}}a(W,"featureVitals");async function at(){let t=W(),e=k().catch(()=>[]),n=await M(),r=await T(),s=await y(),f=await O(),l=await _(L),u=J(s,w(),l),{health:p,resources:c}=await t,i=[];for(let[o,m]of H(s)){let h=V(await j(o)),S=await R(o),b=c?.projects[S],d=p.get(S);i.push({name:o,slot:m.slot,services:m.services??[],port_range:Q(m.slot),containers:h,containers_running:h.filter(g=>g.status==="running").length,containers_total:h.length,intercepts:u.filter(g=>g.feature===o),cpu_percent:b?.cpuPercent??null,mem_mib:b?.memMib??null,started_at:d?.started?.at??null,started_by:d?.started?.by??null,crash_loops:d?.crashLoops??[]})}return{host:c?.host??null,infrastructure:n,mcp_web_server:f,k8s_forwards:r,features:i,waiting:await A(),caches:await e,summary:{total_features:i.length,available_slots:C()-i.length,infra_healthy:n.length>0&&n.every(o=>o.display==="healthy"||o.display==="running"),k8s_alive:r.filter(o=>o.status==="alive").length,k8s_total:r.length,telepresence_available:l.available,intercepts_active:u.filter(o=>o.intercepted).length}}}a(at,"statusSnapshot");export{M as a,Q as b,U as c,V as d,H as e,J as f,ot as g,W as h,at as i};
4
+ //# sourceMappingURL=chunk-6MHH3PKI.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{d as C,n as G}from"./chunk-ZOPN2T2K.js";import{m as x}from"./chunk-2WQY5YYA.js";import{d as g,e as P,u as L}from"./chunk-COOC6H6Z.js";import{G as F,M as W,S as T,a as X}from"./chunk-6HU4LHQY.js";import{b as I}from"./chunk-3JJ2DVAG.js";import{a,e as Q,f as O}from"./chunk-ZB5MYPP3.js";O();var K=Q(X(),1);import*as d from"node:fs";import*as u from"node:path";O();import*as D from"node:fs";import*as y from"node:path";var ee=5;function te(t){let e=t.trim().replace(/\.git$/,""),n=/^(?:ssh:\/\/)?git@([^:/]+)[:/](.+)$/.exec(e);return n?`https://${n[1]}/${n[2]}`:/^https?:\/\//.test(e)?e:""}a(te,"httpsRemote");function ne(t=g()){let e=a((...i)=>{try{let r=x(["git","-C",t,...i],{capture:!0,timeout:ee});return r.status===0?r.stdout.trim():""}catch{return""}},"git"),n=te(e("remote","get-url","origin"));return n?{base:n,prefix:e("rev-parse","--show-prefix").replace(/\/+$/,"")}:null}a(ne,"standardsSource");function H(t,e,n="blob"){if(!t)return"";let i=y.posix.normalize(y.posix.join(t.prefix,e)).replace(/\/+$/,"");return i==="."?`${t.base}/${n}/HEAD`:`${t.base}/${n}/HEAD/${i}`}a(H,"standardsUrl");function re(){let t=L();return t?`https://github.com/${t}`:""}a(re,"serviceRepoBase");var se=`<!--
3
+ import{d as C,n as G}from"./chunk-7ATNOKW5.js";import{m as x}from"./chunk-VFK6V2ML.js";import{d as g,e as P,u as L}from"./chunk-VG3BA2XL.js";import{G as F,M as W,S as T,a as X}from"./chunk-QIY6CJYG.js";import{b as I}from"./chunk-SGMHMD4R.js";import{a,e as Q,f as O}from"./chunk-ZLO4QG42.js";O();var K=Q(X(),1);import*as d from"node:fs";import*as u from"node:path";O();import*as D from"node:fs";import*as y from"node:path";var ee=5;function te(t){let e=t.trim().replace(/\.git$/,""),n=/^(?:ssh:\/\/)?git@([^:/]+)[:/](.+)$/.exec(e);return n?`https://${n[1]}/${n[2]}`:/^https?:\/\//.test(e)?e:""}a(te,"httpsRemote");function ne(t=g()){let e=a((...i)=>{try{let r=x(["git","-C",t,...i],{capture:!0,timeout:ee});return r.status===0?r.stdout.trim():""}catch{return""}},"git"),n=te(e("remote","get-url","origin"));return n?{base:n,prefix:e("rev-parse","--show-prefix").replace(/\/+$/,"")}:null}a(ne,"standardsSource");function H(t,e,n="blob"){if(!t)return"";let i=y.posix.normalize(y.posix.join(t.prefix,e)).replace(/\/+$/,"");return i==="."?`${t.base}/${n}/HEAD`:`${t.base}/${n}/HEAD/${i}`}a(H,"standardsUrl");function re(){let t=L();return t?`https://github.com/${t}`:""}a(re,"serviceRepoBase");var se=`<!--
4
4
  AUTO-GENERATED FILE \u2014 DO NOT EDIT BY HAND.
5
5
  Source: {source} (edit that file instead)
6
6
  Generator: werkmeister workspace init / werkmeister skills sync
@@ -28,4 +28,4 @@ Full file: \`${n}\`${c}
28
28
  `))return{};let n=e.indexOf(`
29
29
  ---`,4);if(n===-1)return{};let i;try{i=K.parse(e.slice(4,n))}catch{return{}}return R(i)?i:{}}a(w,"parseFrontmatter");function ge(t,e,n){n==null&&(n=T());let i=G(t,n);for(let r of Object.keys(n).sort()){let s=n[r];if(R(s))for(let o of s.standards??[])o in e||i.push(`services.yaml: archetype '${r}' lists unknown standard '${o}' \u2014 no docs/standards/${o}.md with \`domain: ${o}\``)}for(let[r,s]of Object.entries(t))if(!(!R(s)||s.archetype))for(let o of s.standards??[])o in e||i.push(`services.yaml: service '${r}' lists unknown standard '${o}' \u2014 no docs/standards/${o}.md with \`domain: ${o}\``);return i}a(ge,"validateServiceStandards");function z(t){t==null&&(t=g());let e=[];if(!(d.existsSync(t)&&d.statSync(t).isDirectory()))return e;for(let n of J(t)){let i=u.relative(t,n),r=w(n),s=r.domain;if(!(typeof s=="string"&&s.trim())){e.push(`${i}: unparseable frontmatter or missing \`domain:\``);continue}let o=r.summary;typeof o=="string"&&o.trim()||e.push(`${i}: missing or empty \`summary:\``);let c=r.applies_to;Array.isArray(c)&&c.length&&c.every(h=>typeof h=="string"&&h.trim())||e.push(`${i}: \`applies_to:\` must be a non-empty list of non-empty globs (empty means the standard never loads and never re-injects)`);let f=r.phase;f!=null&&!(Array.isArray(f)&&f.length&&f.every(h=>typeof h=="string"&&h.trim()))&&e.push(`${i}: \`phase:\` if present must be a non-empty list of strings (a scalar string silently breaks skill_gen's substring gate)`);let m=r.universal;m!=null&&!Number.isInteger(m)&&e.push(`${i}: \`universal:\` if present must be an integer (its load order) \u2014 \`universal: true\` reads as universal but silently is not`);let p=u.basename(n)==="STANDARD.md"?u.basename(u.dirname(n)):u.basename(n,".md");s.trim()!==p&&e.push(`${i}: \`domain: ${s}\` does not match its location (expected \`${p}\` \u2014 w9r-<domain>-standard would diverge from where the standard lives)`)}return e}a(z,"validateStandardModules");function _e(){let t=g(),e=$e(),n=P();if(n)return{dir:t,repoTrees:e,moduleCount:0,errors:[n]};let i=k();if(!Object.keys(i).length)return{dir:t,repoTrees:e,moduleCount:0,errors:[`no standard modules found in ${t}`]};let r={...i},s=[];for(let o of e){let c=u.basename(u.resolve(o,"..","..")),f=N(o),m=a(p=>`${c}: ${p}`,"tag");s.push(...z(o).map(m)),s.push(...E(f).map(m));for(let p of Object.keys(f))p in i?s.push(m(`\`${p}\` is also a module in ${t}, which wins; rename this one`)):r[p]=f[p]}return{dir:t,repoTrees:e,moduleCount:Object.keys(r).length,errors:[...z(),...E(i),...s,...ge(W(),r)]}}a(_e,"checkStandards");function $e(t=F()){let e;try{e=d.readdirSync(t).sort()}catch{return[]}return e.map(n=>u.join(t,n)).filter(n=>d.statSync(u.join(n,".git"),{throwIfNoEntry:!1})?.isDirectory()).map(Y).filter(n=>d.statSync(n,{throwIfNoEntry:!1})?.isDirectory())}a($e,"repoStandardTrees");function be(t,e){if(!t)return new Set;let n=t.toLowerCase(),i=new Set;for(let[r,s]of Object.entries(e))(s.task_signatures??[]).some(c=>n.includes(String(c).toLowerCase()))&&i.add(r);return i}a(be,"domainsMatchingTaskText");function Me(t,e,n,i,r,s,o){r==null&&(r=k()),o==null&&(o=T());let c;s?.length?c=[...s]:c=t.flatMap(l=>n[l]?.services??[]);let f=new Set;for(let l of c)for(let v of C(e[l],o))f.add(v);let m=i??{},p=m.standards_override??{};for(let l of p.add??[])f.add(l);for(let[l,v]of Object.entries(r))v.repo&&f.add(l);let h=["starting_prompt","task","description"].map(l=>m[l]?String(m[l]):"").join(" ");for(let l of be(h,r))f.add(l);for(let l of p.remove??[])f.delete(l);let $=_(r);for(let l of $)f.add(l);for(let l of[...f])l in r||f.delete(l);let M=a(l=>$.includes(l)?[0,$.indexOf(l),""]:[1,0,l],"sortKey"),q=[...f].sort((l,v)=>{let b=M(l),S=M(v);return b[0]!==S[0]?b[0]-S[0]:b[1]!==S[1]?b[1]-S[1]:b[2]<S[2]?-1:b[2]>S[2]?1:0}),V=Object.keys(r).filter(l=>!f.has(l)).sort();return[q,V]}a(Me,"resolveActiveStandards");function Ie(t,e,n=null){let i=_(e),r={};for(let o of t)i.includes(o)||(r[o]={applies_to:Array.from(e[o]?.applies_to??[]),summary:String(e[o]?.summary??"").trim()});let s={generated_by:"werkmeister workspace init",universal:t.filter(o=>i.includes(o)),domains:r};return n&&(s.phase_gate={...n}),s}a(Ie,"buildStandardsManifest");function Fe(t,e){let n=u.join(I(t),"standards.json");return d.mkdirSync(u.dirname(n),{recursive:!0}),d.writeFileSync(n,JSON.stringify(e,null,2)+`
30
30
  `),n}a(Fe,"writeStandardsManifest");export{ne as a,H as b,j as c,we as d,E as e,_ as f,me as g,U as h,Ne as i,k as j,ge as k,_e as l,Me as m,Ie as n,Fe as o};
31
- //# sourceMappingURL=chunk-DJGLCWSW.js.map
31
+ //# sourceMappingURL=chunk-6VEY2JX7.js.map
@@ -0,0 +1,4 @@
1
+ import { createRequire as __sandboxCreateRequire } from "node:module";
2
+ const require = __sandboxCreateRequire(import.meta.url);
3
+ import{S as d,r as x,w as S}from"./chunk-QIY6CJYG.js";import{a as i,f as $}from"./chunk-ZLO4QG42.js";$();import*as g from"node:fs";import*as u from"node:path";var h=i(n=>{try{return g.realpathSync(n)}catch{return u.resolve(n)}},"realPath"),y=i(n=>(n?.extra_volumes??[]).map(t=>t.split(":")[0]).filter(t=>t.includes("/")).map(t=>h(x(t))),"hostBinds"),w=i((n,t)=>n===t||n.startsWith(`${t}${u.sep}`)||t==="/","within");function R(n){let t=["/var/run/docker.sock",S()].map(h);return y(n).some(e=>u.basename(e)==="docker.sock"||t.some(r=>w(r,e)))}i(R,"hostAccess");function E(n,t){let e=h(t);return y(n).some(r=>w(e,r))}i(E,"seesHostPath");function a(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}i(a,"isDict");function m(n,t){if(!a(n))return null;let e=n.archetype;if(e!=null){t==null&&(t=d());let o=t[e];return a(o)?o:null}let r=n.standards;return r?.length?{standards:Array.from(r)}:null}i(m,"resolveServiceArchetype");function O(n,t){let e=m(n,t);return Array.from(e?.standards??[])}i(O,"serviceStandards");function k(n,t,e){if(!a(t)||A(t)!==null)return null;let r=t.test;if(r)return String(r);let s=m(t,e)?.test;return s?String(s).split("{service}").join(n):null}i(k,"serviceTestCommand");function A(n){let t=a(n)?/^none(?::\s*(.*))?$/i.exec(String(n.test??"").trim()):null;return t?t[1]?.trim()||"test: none":null}i(A,"serviceNoTests");function U(n,t,e,r){let o=`sh -c '${e.split("'").join("'\\''")}'`;return r?`docker exec -w /app ${n}-${t} ${r} --no-wait ${o}`:`docker exec ${n}-${t} ${o}`}i(U,"containerTestCommand");function j(n){return!/[|;&{}()`\n]|\$\(/.test(n.split("&&").join(""))}i(j,"isPlainChain");function V(n,t,e,r){let o=e?`${e} && ${t}`:t;if(!n)return o;let s=r?`${n} --cwd ${u.resolve(n,"../../..",r)}`:n;return j(o)&&!o.includes("&&")?`${s} ${o}`:`${s} sh -c '${o.split("'").join("'\\''")}'`}i(V,"wrappedTestCommand");function b(n,t){if(!a(n))return null;let e=n.validate;if(e)return String(e);let r=m(n,t)?.validate;return r?String(r):null}i(b,"serviceValidation");function C(n,t,e){return e?.length?[...e]:n.flatMap(r=>t[r]?.services??[])}i(C,"candidateServiceNames");function q(n,t,e,r=new Set){e==null&&(e=d());let o=[];for(let s of[...new Set(n)].sort()){let c=t[s];if(!a(c))continue;let f=b(c,e);o.push({service:s,repo:String(c.repo??""),path:String(c.path??"."),test:k(s,c,e),validate:f??(r.has(s)?"URL health check (see Quick Health Checks)":"No validation guidance registered in services.yaml; say so instead of inventing one")})}return o}i(q,"validationRows");function P(n,t,e,r,o){o==null&&(o=d());let s=C(n,e,r),c={};for(let l of s){let v=t[l];if(!a(v))continue;let p=v.archetype;p&&p in o&&(c[p]??=[]).push(l)}let f={};for(let l of Object.keys(c).sort())f[l]=[...new Set(c[l])].sort();return f}i(P,"resolvePresentArchetypes");function B(n,t,e,r,o){let s=(t.SERVICES??"").split(",").map(c=>c.trim()).filter(c=>c);return P(n.map(([c])=>c),e,r,s,o)}i(B,"presentArchetypes");function I(n,t){let e=[];for(let[r,o]of Object.entries(n)){if(!a(o))continue;let s=o.archetype;s!=null&&(s in t||e.push(`services.yaml: service '${r}' references unknown archetype '${s}' \u2014 no \`archetypes.${s}\` entry`),o.standards?.length&&e.push(`services.yaml: service '${r}' declares both \`archetype:\` and legacy \`standards:\` \u2014 drop \`standards:\` (the archetype wins)`))}return e}i(I,"validateServiceArchetypes");export{R as a,E as b,m as c,O as d,k as e,A as f,U as g,j as h,V as i,b as j,C as k,q as l,B as m,I as n};
4
+ //# sourceMappingURL=chunk-7ATNOKW5.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{V as x}from"./chunk-CP5QRUYE.js";import{f as y,g as b,h as w}from"./chunk-Y7MUE52D.js";import{b as S}from"./chunk-3JJ2DVAG.js";import{a,f as h}from"./chunk-ZB5MYPP3.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{V as x}from"./chunk-EZ75MGB4.js";import{f as y,g as b,h as w}from"./chunk-SM64LULD.js";import{b as S}from"./chunk-SGMHMD4R.js";import{a,f as h}from"./chunk-ZLO4QG42.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-LIS7CNJ2.js.map
5
+ //# sourceMappingURL=chunk-7B7Q6EAN.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-3JJ2DVAG.js";import{a,f as v}from"./chunk-ZB5MYPP3.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-SGMHMD4R.js";import{a,f as v}from"./chunk-ZLO4QG42.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-3MYYJ2O6.js.map
5
+ //# sourceMappingURL=chunk-AL3AC4P2.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}from"./chunk-A2JDE4VC.js";import{o as x,s as j}from"./chunk-AAUSOM4O.js";import{c as y}from"./chunk-NONNQTC3.js";import{a as i,e as F,f as b}from"./chunk-ZB5MYPP3.js";b();var g=F(R(),1);import{spawn as D}from"node:child_process";import L from"node:fs/promises";import l from"node:path";var S=import.meta.filename.endsWith(".ts")?l.join(import.meta.dirname,"..","..","dist"):l.basename(import.meta.dirname)==="lib"?l.join(import.meta.dirname,".."):import.meta.dirname;function C(o){let e=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open",c=process.platform==="win32"?["/c","start","",o]:[o];try{D(e,c,{detached:!0,stdio:"ignore"}).unref()}catch{}}i(C,"openBrowser");function k(o){if(!o)return!1;let e=o.replace(/:\d+$/,"").replace(/^\[|\]$/g,"");return e==="localhost"||e==="127.0.0.1"||e==="::1"}i(k,"isLocalHost");function I(o,e,c){let m=o.headers.origin;if(m){let s=null;try{s=new URL(m).hostname}catch{}if(!k(s??void 0)){e.status(403).json({error:"cross-origin request refused"});return}}if(!k(o.headers.host)){e.status(403).json({error:"non-local host refused"});return}c()}i(I,"localOnly");function P(o,e={}){let c=e.timeoutMs??6e5;return new Promise(m=>{let s=(0,g.default)();s.use(g.default.json({limit:"1mb"}));let w=!1,d,u=i(n=>{w||(w=!0,d&&clearTimeout(d),setTimeout(()=>f.close(()=>m(n)),50))},"settle");s.get("/",async(n,t)=>{try{let p=await L.readFile(l.join(S,"form.html"),"utf-8");t.type("html").send(p)}catch{t.status(500).type("text").send("Form UI bundle missing \u2014 run `pnpm run build` in apps/werkmeister-dashboard.")}}),s.post("/api/tool",I,async(n,t)=>{let{name:p,arguments:a}=n.body??{};try{switch(p){case"workspace-form-schema":t.json({structuredContent:o});return;case"refine-prompt":{let r=a??{},h=await x(r.text??"",r.instruction??"",r.formData);t.json({structuredContent:{refined:h}});return}case"issue-form-data":{let r=typeof a?.ref=="string"?a.ref:"";t.json({structuredContent:{formData:await j(r)}});return}case"create-workspace":t.json({structuredContent:{output:"Submitted \u2014 return to Claude; the workspace is being created there."}}),u({status:"submitted",formData:a?.formData??{},open:typeof a?.open=="boolean"?a.open:void 0});return;case"cancel-form":t.json({structuredContent:null}),u({status:"cancelled"});return;default:t.status(400).json({error:`unknown tool ${String(p)}`})}}catch(r){let h=(r instanceof y,r.message);t.status(500).json({error:h})}});let f=s.listen(0,"127.0.0.1",()=>{let{port:n}=f.address(),t=`http://127.0.0.1:${n}/`;console.error(`[workspaces] workspace form: ${t}`),e.open!==!1&&C(t)});f.on("error",()=>u({status:"cancelled"})),d=setTimeout(()=>u({status:"timeout"}),c)})}i(P,"promptViaLocalhostForm");export{I as a,P as b};
4
- //# sourceMappingURL=chunk-VK7IBUGG.js.map
3
+ import{a as R}from"./chunk-VLWEJKGW.js";import{p as x,t as j}from"./chunk-NZQZX5GZ.js";import{c as y}from"./chunk-R65G2QPR.js";import{a as i,e as F,f as b}from"./chunk-ZLO4QG42.js";b();var g=F(R(),1);import{spawn as D}from"node:child_process";import L from"node:fs/promises";import l from"node:path";var S=import.meta.filename.endsWith(".ts")?l.join(import.meta.dirname,"..","..","dist"):l.basename(import.meta.dirname)==="lib"?l.join(import.meta.dirname,".."):import.meta.dirname;function C(o){let e=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open",c=process.platform==="win32"?["/c","start","",o]:[o];try{D(e,c,{detached:!0,stdio:"ignore"}).unref()}catch{}}i(C,"openBrowser");function k(o){if(!o)return!1;let e=o.replace(/:\d+$/,"").replace(/^\[|\]$/g,"");return e==="localhost"||e==="127.0.0.1"||e==="::1"}i(k,"isLocalHost");function I(o,e,c){let m=o.headers.origin;if(m){let s=null;try{s=new URL(m).hostname}catch{}if(!k(s??void 0)){e.status(403).json({error:"cross-origin request refused"});return}}if(!k(o.headers.host)){e.status(403).json({error:"non-local host refused"});return}c()}i(I,"localOnly");function P(o,e={}){let c=e.timeoutMs??6e5;return new Promise(m=>{let s=(0,g.default)();s.use(g.default.json({limit:"1mb"}));let w=!1,d,u=i(n=>{w||(w=!0,d&&clearTimeout(d),setTimeout(()=>f.close(()=>m(n)),50))},"settle");s.get("/",async(n,t)=>{try{let p=await L.readFile(l.join(S,"form.html"),"utf-8");t.type("html").send(p)}catch{t.status(500).type("text").send("Form UI bundle missing \u2014 run `pnpm run build` in apps/werkmeister-dashboard.")}}),s.post("/api/tool",I,async(n,t)=>{let{name:p,arguments:a}=n.body??{};try{switch(p){case"workspace-form-schema":t.json({structuredContent:o});return;case"refine-prompt":{let r=a??{},h=await x(r.text??"",r.instruction??"",r.formData);t.json({structuredContent:{refined:h}});return}case"issue-form-data":{let r=typeof a?.ref=="string"?a.ref:"";t.json({structuredContent:{formData:await j(r)}});return}case"create-workspace":t.json({structuredContent:{output:"Submitted \u2014 return to Claude; the workspace is being created there."}}),u({status:"submitted",formData:a?.formData??{},open:typeof a?.open=="boolean"?a.open:void 0});return;case"cancel-form":t.json({structuredContent:null}),u({status:"cancelled"});return;default:t.status(400).json({error:`unknown tool ${String(p)}`})}}catch(r){let h=(r instanceof y,r.message);t.status(500).json({error:h})}});let f=s.listen(0,"127.0.0.1",()=>{let{port:n}=f.address(),t=`http://127.0.0.1:${n}/`;console.error(`[workspaces] workspace form: ${t}`),e.open!==!1&&C(t)});f.on("error",()=>u({status:"cancelled"})),d=setTimeout(()=>u({status:"timeout"}),c)})}i(P,"promptViaLocalhostForm");export{I as a,P as b};
4
+ //# sourceMappingURL=chunk-BJ4KKBL3.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 N}from"./chunk-TAHLKIRL.js";import{a as O,aa as R,da as C}from"./chunk-CP5QRUYE.js";import{l as h,m as b,n as T}from"./chunk-2WQY5YYA.js";import{b as u}from"./chunk-NONNQTC3.js";import{M as x,N as S,j as m,l as y,t as E}from"./chunk-6HU4LHQY.js";import{a as s,f as k}from"./chunk-ZB5MYPP3.js";k();import*as f from"node:fs";import*as L from"node:net";import*as w from"node:path";var A=[2,30,0],W="telepresenceio/telepresence/telepresence-oss",J="curl -fL https://github.com/telepresenceio/telepresence/releases/latest/download/telepresence-darwin-arm64 -o /opt/homebrew/bin/telepresence && chmod +x /opt/homebrew/bin/telepresence",g=`Install Telepresence OSS >= ${A.join(".")} with \`brew install ${W}\`, or by direct release download: ${J}`;function F(e){for(let t of(process.env.PATH??"").split(w.delimiter)){if(!t)continue;let n=w.join(t,e);try{if(f.accessSync(n,f.constants.X_OK),f.statSync(n).isFile())return n}catch{}}return null}s(F,"which");function D(e,t=120){let n;try{n=b(e,{capture:!0,timeout:t})}catch(r){if(r instanceof h&&r.code==="ENOENT")return[127,`${e[0]}: command not found`];if(r instanceof h&&r.code==="ETIMEDOUT")return[124,`${e.join(" ")}: timed out after ${t}s`];throw r}return[n.status,((n.stdout||"")+(n.stderr||"")).trim()]}s(D,"_run");async function d(e,t,n=120){let r;try{r=await T(e,{capture:!0,timeout:n,signal:t})}catch(o){if(o instanceof h&&o.code==="ENOENT")return[127,`${e[0]}: command not found`];if(o instanceof h&&o.code==="ETIMEDOUT")return[124,`${e.join(" ")}: timed out after ${n}s`];throw o}return[r.status,((r.stdout||"")+(r.stderr||"")).trim()]}s(d,"runAsyncRunner");function X(e,t=1e3){return new Promise(n=>{let r=new L.Socket,o=!1,i=s(c=>{o||(o=!0,r.destroy(),n(c))},"finish");r.setTimeout(t),r.once("connect",()=>i(!0)),r.once("timeout",()=>i(!1)),r.once("error",()=>i(!1)),r.connect(e,"localhost")})}s(X,"portOpen");function G(e){let t=/v(\d+)\.(\d+)\.(\d+)/.exec(e);return t?[Number.parseInt(t[1],10),Number.parseInt(t[2],10),Number.parseInt(t[3],10)]:null}s(G,"parseVersion");function z(e,t){for(let n=0;n<3;n++)if(e[n]!==t[n])return e[n]<t[n];return!1}s(z,"versionLt");async function Q(e=t=>d(t)){if(F("telepresence")===null)return`telepresence not found on PATH. ${g}`;let[t,n]=await e(["telepresence","version"]),r=G(n);if(t!==0||r===null)return`could not determine telepresence version (${n?n.split(`
3
+ import{a as N}from"./chunk-RAQKNHCM.js";import{a as O,aa as R,da as C}from"./chunk-EZ75MGB4.js";import{l as h,m as b,n as T}from"./chunk-VFK6V2ML.js";import{b as u}from"./chunk-R65G2QPR.js";import{M as x,N as S,j as m,l as y,t as E}from"./chunk-QIY6CJYG.js";import{a as s,f as k}from"./chunk-ZLO4QG42.js";k();import*as f from"node:fs";import*as L from"node:net";import*as w from"node:path";var A=[2,30,0],W="telepresenceio/telepresence/telepresence-oss",J="curl -fL https://github.com/telepresenceio/telepresence/releases/latest/download/telepresence-darwin-arm64 -o /opt/homebrew/bin/telepresence && chmod +x /opt/homebrew/bin/telepresence",g=`Install Telepresence OSS >= ${A.join(".")} with \`brew install ${W}\`, or by direct release download: ${J}`;function F(e){for(let t of(process.env.PATH??"").split(w.delimiter)){if(!t)continue;let n=w.join(t,e);try{if(f.accessSync(n,f.constants.X_OK),f.statSync(n).isFile())return n}catch{}}return null}s(F,"which");function D(e,t=120){let n;try{n=b(e,{capture:!0,timeout:t})}catch(r){if(r instanceof h&&r.code==="ENOENT")return[127,`${e[0]}: command not found`];if(r instanceof h&&r.code==="ETIMEDOUT")return[124,`${e.join(" ")}: timed out after ${t}s`];throw r}return[n.status,((n.stdout||"")+(n.stderr||"")).trim()]}s(D,"_run");async function d(e,t,n=120){let r;try{r=await T(e,{capture:!0,timeout:n,signal:t})}catch(o){if(o instanceof h&&o.code==="ENOENT")return[127,`${e[0]}: command not found`];if(o instanceof h&&o.code==="ETIMEDOUT")return[124,`${e.join(" ")}: timed out after ${n}s`];throw o}return[r.status,((r.stdout||"")+(r.stderr||"")).trim()]}s(d,"runAsyncRunner");function X(e,t=1e3){return new Promise(n=>{let r=new L.Socket,o=!1,i=s(c=>{o||(o=!0,r.destroy(),n(c))},"finish");r.setTimeout(t),r.once("connect",()=>i(!0)),r.once("timeout",()=>i(!1)),r.once("error",()=>i(!1)),r.connect(e,"localhost")})}s(X,"portOpen");function G(e){let t=/v(\d+)\.(\d+)\.(\d+)/.exec(e);return t?[Number.parseInt(t[1],10),Number.parseInt(t[2],10),Number.parseInt(t[3],10)]:null}s(G,"parseVersion");function z(e,t){for(let n=0;n<3;n++)if(e[n]!==t[n])return e[n]<t[n];return!1}s(z,"versionLt");async function Q(e=t=>d(t)){if(F("telepresence")===null)return`telepresence not found on PATH. ${g}`;let[t,n]=await e(["telepresence","version"]),r=G(n);if(t!==0||r===null)return`could not determine telepresence version (${n?n.split(`
4
4
  `)[0]:"no output"}). ${g}`;if(z(r,A)){let o=r.join("."),i=A.join(".");return`telepresence ${o} is too old (need >= ${i}). ${g}`}return null}s(Q,"versionError");function Y(e,t,n=!1){let r=["telepresence","connect"];return n&&r.push("--docker"),r.push("--context",e,"--namespace",t),r}s(Y,"buildConnectArgs");var Z="host.docker.internal";function I(e,t){return`${e}-${t}-cn`}s(I,"dockerDaemonName");function ee(e,t,n,r,o=!1){return["telepresence","intercept",e,"--port",`${t}:${n}`,"--http-header",`x-feature=${r}`,"--mount","false",...o?["--address",Z]:[]]}s(ee,"buildInterceptArgs");function _(e){return["telepresence","detach",e]}s(_,"buildLeaveArgs");function te(e){return["telepresence","uninstall",...e]}s(te,"buildUninstallArgs");function ne(){return["telepresence","quit","-s"]}s(ne,"buildQuitArgs");var P="x-feature";function U(){return["telepresence","list","-i","--format","json"]}s(U,"buildListInterceptsArgs");function re(e){if(typeof e!="object"||e===null||Array.isArray(e))return"is not defined in ~/.werkmeister/services.yaml.";let t=e,n=M(t);return n.length?`has no ${n.join("/")} in services.yaml \u2014 not interceptable.`:t.k8s_port_name?null:"has no k8s_port_name in services.yaml. Interception under Istio ambient requires a NAMED Service targetPort; add the port name there once the service's manifests are fixed."}s(re,"interceptBlocker");var oe=["k8s_deployment","k8s_namespace","k8s_port"];function M(e){return oe.filter(t=>!e[t])}s(M,"missingClusterKeys");function ye(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&M(e).length===0}s(ye,"isRemoteService");function H(e){let t=new Map,n=String(e||"").trim();if(!n)return t;let r;try{r=JSON.parse(n)}catch{return t}if(!Array.isArray(r))return t;for(let o of r){if(typeof o!="object"||o===null)continue;let i=o,c=i.name,a=i.intercept_info;typeof c!="string"||!c||!Array.isArray(a)||!a.length||t.set(c,se(a[0]))}return t}s(H,"parseInterceptList");function se(e){if(typeof e!="object"||e===null)return null;let t=e.spec?.header_filters;if(typeof t!="object"||t===null)return null;for(let[n,r]of Object.entries(t))if(n.toLowerCase()===P&&typeof r=="string")return r;return null}s(se,"featureOf");async function Ee(e=t=>d(t)){let t=new Map;if(E())return{installed:!1,available:!1,namespace:null,intercepts:t};let[n,r]=await e($);if(n===127)return{installed:!1,available:!1,namespace:null,intercepts:t};let o=v(n,r),i=[];for(let l of o===null?ie(r):[])if(o=v(...await e([...$,"--use",l])),o!==null){i=["--use",l];break}if(o===null)return{installed:!0,available:!1,namespace:o,intercepts:t};let[c,a]=await e([...U(),...i]);return c!==0?{installed:!0,available:!1,namespace:o,intercepts:t}:{installed:!0,available:!0,namespace:o,intercepts:H(a)}}s(Ee,"listIntercepts");function xe(e=D){return v(...e($))}s(xe,"connectedNamespace");var $=["telepresence","status","--format","json"];function ie(e){let t=/please select (.+?) using the --use/.exec(e);return t?t[1].split(/, | or /):[]}s(ie,"daemonChoices");function v(e,t){if(e!==0)return null;let n;try{n=JSON.parse(t)}catch{return null}let r=n.daemon||n.user_daemon||{};return(r.status==="Connected"||r.running)&&r.namespace||null}s(v,"parseConnectedNamespace");async function ce(e,t,n=!1,r=o=>d(o)){if(E())return;let o=n?["--use",I(e,t)]:[];if(v(...await r([...$,...o]))===t)return;await r(["telepresence","quit","-s"]);let[c,a]=await r(Y(e,t,n));if(c!==0)throw new Error(`telepresence connect failed: ${a||"no output"}`)}s(ce,"ensureConnected");function ae(e){let t;try{if(!f.statSync(e).isFile())return[];t=f.readFileSync(e,"utf8")}catch{return[]}for(let n of t.split(`
5
5
  `))if(n=n.trim(),n.startsWith("SERVICES="))return n.slice(n.indexOf("=")+1).split(",").map(o=>o.trim()).filter(Boolean);return[]}s(ae,"servicesFromEnv");function $e(e,t=D){if(F("telepresence")===null)return[];let n=O(e);if(n===null)return[];let r=ae(w.join(n,".env"));if(!r.length)return[];let o=x(),i=[];for(let c of r){let a=q(o[c]);if(!a)continue;let[l]=t(_(a));l===0&&i.push(a)}return i}s($e,"leaveFeatureIntercepts");async function j(e,t=n=>d(n)){let n={uninstalled:[],quit:!1};if(!e.length)return n;let[r,o]=await t(U()),i=[];try{i=o.trim()?JSON.parse(o):[]}catch{i=null}if(r!==0||!Array.isArray(i))return y("Could not read telepresence intercepts -- leaving traffic agents and daemons in place"),n;let c=H(o),a=e.filter(l=>!c.has(l));if(a.length){let[l,p]=await t(te(a));l===0?(n.uninstalled=a,m(`Uninstalled traffic agent(s): ${a.join(", ")}`)):y(`Could not uninstall traffic agent(s) ${a.join(", ")}: ${p||"no output"}`)}if(c.size===0){let[l,p]=await t(ne());l===0?(n.quit=!0,m("Stopped telepresence daemons")):y(`Could not stop telepresence daemons: ${p||"no output"}`)}return n}s(j,"releaseIdleTelepresence");function q(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e.k8s_deployment:void 0}s(q,"deploymentOf");function B(e,t){if(!t.includes(e))throw new u(`'${e}' is not a local service of this workspace (SERVICES=${t.join(",")||"(none)"}). Add it to workspace.yml services and rerun \`werkmeister workspace init\`.`,"NOT_LOCAL");let n=x()[e],r=re(n);if(r)throw new u(`'${e}' ${r}`,"NOT_INTERCEPTABLE");return n}s(B,"resolveServiceDef");async function ve(e){if(E())throw new u("Intercepts are off under WERKMEISTER_FIXTURE.","FIXTURE");let t=B(e.service,e.localServices),n=s(V=>d(V,e.signal),"runner"),r=await Q(n);if(r)throw new u(r,"TELEPRESENCE_VERSION");let o=await R(e.feature);if(o===null)throw new u(`Feature '${e.feature}' has no allocated slot \u2014 run \`werkmeister feature up ${e.feature}\` first.`,"NOT_RUNNING");let i=C(o,t.port_offset??0);if(!await X(i))throw new u(`${e.service} is not listening on localhost:${i} \u2014 run \`werkmeister feature up ${e.feature}\` first (the local container is the intercept target).`,"PORT_CLOSED");let c=S(),a=t.k8s_namespace,l=t.k8s_deployment;m(`Connecting to ${a} on ${c}...`),await ce(c,a,!!e.dockerDaemon,n),m(`Intercepting ${l} \u2192 localhost:${i} (x-feature=${e.feature})...`);let[p,K]=await n([...ee(l,i,t.k8s_port,e.feature,!!e.dockerDaemon),...e.dockerDaemon?["--use",I(c,a)]:[]]);if(p!==0)throw new u(`telepresence intercept failed: ${K||"no output"}`,"INTERCEPT_FAILED");return{service:e.service,context:c,namespace:a,deployment:l,localPort:i,header:P,remoteHost:N()[e.service]?.remoteHostname??null}}s(ve,"startIntercept");async function Se(e){let t=s(i=>c=>d(e.dockerDaemon?[...c,"--use",I(S(),i)]:c,e.signal),"runnerIn");if(e.service){let i=B(e.service,e.localServices),c=i.k8s_deployment,a=t(i.k8s_namespace),[l,p]=await a(_(c));if(l!==0)throw new u(`Could not leave intercept: ${p||"no output"}`,"INTERCEPT_FAILED");return await j([c],a),[c]}let n=x(),r=[],o=t("default");for(let i of e.localServices){let c=q(n[i]);if(!c)continue;o=t(n[i].k8s_namespace??"default");let[a]=await o(_(c));a===0&&r.push(c)}return await j(r,o),r}s(Se,"leaveIntercept");export{A as a,W as b,J as c,g as d,D as e,d as f,X as g,G as h,z as i,Q as j,Y as k,Z as l,I as m,ee as n,_ as o,te as p,ne as q,P as r,U as s,re as t,ye as u,H as v,Ee as w,xe as x,ce as y,$e as z,j as A,ve as B,Se as C};
6
- //# sourceMappingURL=chunk-VW2X6CB5.js.map
6
+ //# sourceMappingURL=chunk-BNRNITRE.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 kr}from"./chunk-36Y5TWCS.js";import{d as yr}from"./chunk-PW2EKDJ4.js";import{b as dr}from"./chunk-34IKHARR.js";import{b as fr}from"./chunk-KRXEK5IM.js";import{n as ur}from"./chunk-MA4ZNBJQ.js";import{k as cr}from"./chunk-ZOPN2T2K.js";import{F as pr,M as hr}from"./chunk-3PZ6HQYD.js";import{a as mr}from"./chunk-TAHLKIRL.js";import{Y as _r,ba as gr,c as $e,ca as ge,da as ut,u as vr}from"./chunk-CP5QRUYE.js";import{a as _e,d as Zt}from"./chunk-7KGYE5LJ.js";import{f as lr,z as ct}from"./chunk-COOC6H6Z.js";import{$ as ar,D as it,H as Ke,I as er,K as Me,L as tr,M as st,O as rr,Q as ot,R as nr,S as ir,U as sr,V as at,X as Ae,_ as or,a as Ki,aa as lt,j as je,k as te,l as fe}from"./chunk-6HU4LHQY.js";import{b as Te}from"./chunk-3JJ2DVAG.js";import{a,b as Q,c as M,e as Qt,f as b}from"./chunk-ZB5MYPP3.js";var ee=M((pc,Ar)=>{"use strict";b();var De=Array.prototype,Ne=Object.prototype,Mi={"&":"&amp;",'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","\\":"&#92;"},$i=/[&"'<>\\]/g,j=Ar.exports={};function ft(t,n){return Ne.hasOwnProperty.call(t,n)}a(ft,"hasOwnProp");j.hasOwnProp=ft;function Di(t){return Mi[t]}a(Di,"lookupEscape");function qi(t,n,s){if(s.Update||(s=new j.TemplateError(s)),s.Update(t),!n){var i=s;s=new Error(i.message),s.name=i.name}return s}a(qi,"_prettifyError");j._prettifyError=qi;function Le(t,n,s){var i,e;t instanceof Error&&(e=t,t=e.name+": "+e.message),Object.setPrototypeOf?(i=new Error(t),Object.setPrototypeOf(i,Le.prototype)):(i=this,Object.defineProperty(i,"message",{enumerable:!1,writable:!0,value:t})),Object.defineProperty(i,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(i,this.constructor);var r;if(e){var o=Object.getOwnPropertyDescriptor(e,"stack");r=o&&(o.get||function(){return o.value}),r||(r=a(function(){return e.stack},"getStack"))}else{var l=new Error(t).stack;r=a(function(){return l},"getStack")}return Object.defineProperty(i,"stack",{get:a(function(){return r.call(i)},"get")}),Object.defineProperty(i,"cause",{value:e}),i.lineno=n,i.colno=s,i.firstUpdate=!0,i.Update=a(function(u){var f="("+(u||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?f+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(f+=" [Line "+this.lineno+"]")),f+=`
3
+ import{a as kr}from"./chunk-64WYOHLN.js";import{d as yr}from"./chunk-UA6TRGH3.js";import{b as dr}from"./chunk-ETO72ULV.js";import{b as fr}from"./chunk-SZ5KZYVN.js";import{n as ur}from"./chunk-546SJZOD.js";import{k as cr}from"./chunk-7ATNOKW5.js";import{F as pr,M as hr}from"./chunk-OWYP2BRC.js";import{a as mr}from"./chunk-RAQKNHCM.js";import{Y as _r,ba as gr,c as $e,ca as ge,da as ut,u as vr}from"./chunk-EZ75MGB4.js";import{a as _e,d as Zt}from"./chunk-2YJDBWJO.js";import{f as lr,z as ct}from"./chunk-VG3BA2XL.js";import{$ as ar,D as it,H as Ke,I as er,K as Me,L as tr,M as st,O as rr,Q as ot,R as nr,S as ir,U as sr,V as at,X as Ae,_ as or,a as Ki,aa as lt,j as je,k as te,l as fe}from"./chunk-QIY6CJYG.js";import{b as Te}from"./chunk-SGMHMD4R.js";import{a,b as Q,c as M,e as Qt,f as b}from"./chunk-ZLO4QG42.js";var ee=M((pc,Ar)=>{"use strict";b();var De=Array.prototype,Ne=Object.prototype,Mi={"&":"&amp;",'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","\\":"&#92;"},$i=/[&"'<>\\]/g,j=Ar.exports={};function ft(t,n){return Ne.hasOwnProperty.call(t,n)}a(ft,"hasOwnProp");j.hasOwnProp=ft;function Di(t){return Mi[t]}a(Di,"lookupEscape");function qi(t,n,s){if(s.Update||(s=new j.TemplateError(s)),s.Update(t),!n){var i=s;s=new Error(i.message),s.name=i.name}return s}a(qi,"_prettifyError");j._prettifyError=qi;function Le(t,n,s){var i,e;t instanceof Error&&(e=t,t=e.name+": "+e.message),Object.setPrototypeOf?(i=new Error(t),Object.setPrototypeOf(i,Le.prototype)):(i=this,Object.defineProperty(i,"message",{enumerable:!1,writable:!0,value:t})),Object.defineProperty(i,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(i,this.constructor);var r;if(e){var o=Object.getOwnPropertyDescriptor(e,"stack");r=o&&(o.get||function(){return o.value}),r||(r=a(function(){return e.stack},"getStack"))}else{var l=new Error(t).stack;r=a(function(){return l},"getStack")}return Object.defineProperty(i,"stack",{get:a(function(){return r.call(i)},"get")}),Object.defineProperty(i,"cause",{value:e}),i.lineno=n,i.colno=s,i.firstUpdate=!0,i.Update=a(function(u){var f="("+(u||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?f+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(f+=" [Line "+this.lineno+"]")),f+=`
4
4
  `,this.firstUpdate&&(f+=" "),this.message=f+(this.message||""),this.firstUpdate=!1,this},"Update"),i}a(Le,"TemplateError");Object.setPrototypeOf?Object.setPrototypeOf(Le.prototype,Error.prototype):Le.prototype=Object.create(Error.prototype,{constructor:{value:Le}});j.TemplateError=Le;function Ui(t){return t.replace($i,Di)}a(Ui,"escape");j.escape=Ui;function Er(t){return Ne.toString.call(t)==="[object Function]"}a(Er,"isFunction");j.isFunction=Er;function wr(t){return Ne.toString.call(t)==="[object Array]"}a(wr,"isArray");j.isArray=wr;function br(t){return Ne.toString.call(t)==="[object String]"}a(br,"isString");j.isString=br;function Or(t){return Ne.toString.call(t)==="[object Object]"}a(Or,"isObject");j.isObject=Or;function Vi(t){return t?typeof t=="string"?t.split("."):[t]:[]}a(Vi,"_prepareAttributeParts");function xr(t){var n=Vi(t);return a(function(i){for(var e=i,r=0;r<n.length;r++){var o=n[r];if(ft(e,o))e=e[o];else return}return e},"attrGetter")}a(xr,"getAttrGetter");j.getAttrGetter=xr;function Wi(t,n,s){for(var i={},e=Er(n)?n:xr(n),r=0;r<t.length;r++){var o=t[r],l=e(o,r);if(l===void 0&&s===!0)throw new TypeError('groupby: attribute "'+n+'" resolved to undefined');(i[l]||(i[l]=[])).push(o)}return i}a(Wi,"groupBy");j.groupBy=Wi;function Sr(t){return Array.prototype.slice.call(t)}a(Sr,"toArray");j.toArray=Sr;function Gi(t){var n=[];if(!t)return n;for(var s=t.length,i=Sr(arguments).slice(1),e=-1;++e<s;)Tr(i,t[e])===-1&&n.push(t[e]);return n}a(Gi,"without");j.without=Gi;function Hi(t,n){for(var s="",i=0;i<n;i++)s+=t;return s}a(Hi,"repeat");j.repeat=Hi;function Yi(t,n,s){if(t!=null){if(De.forEach&&t.forEach===De.forEach)t.forEach(n,s);else if(t.length===+t.length)for(var i=0,e=t.length;i<e;i++)n.call(s,t[i],i,t)}}a(Yi,"each");j.each=Yi;function Xi(t,n){var s=[];if(t==null)return s;if(De.map&&t.map===De.map)return t.map(n);for(var i=0;i<t.length;i++)s[s.length]=n(t[i],i);return t.length===+t.length&&(s.length=t.length),s}a(Xi,"map");j.map=Xi;function zi(t,n,s){var i=-1;function e(){i++,i<t.length?n(t[i],i,e,s):s()}a(e,"next"),e()}a(zi,"asyncIter");j.asyncIter=zi;function Ji(t,n,s){var i=Ce(t||{}),e=i.length,r=-1;function o(){r++;var l=i[r];r<e?n(l,t[l],r,e,o):s()}a(o,"next"),o()}a(Ji,"asyncFor");j.asyncFor=Ji;function Tr(t,n,s){return Array.prototype.indexOf.call(t||[],n,s)}a(Tr,"indexOf");j.indexOf=Tr;function Ce(t){var n=[];for(var s in t)ft(t,s)&&n.push(s);return n}a(Ce,"keys_");j.keys=Ce;function Qi(t){return Ce(t).map(function(n){return[n,t[n]]})}a(Qi,"_entries");j._entries=Qi;function Zi(t){return Ce(t).map(function(n){return t[n]})}a(Zi,"_values");j._values=Zi;function es(t,n){return t=t||{},Ce(n).forEach(function(s){t[s]=n[s]}),t}a(es,"extend");j._assign=j.extend=es;function ts(t,n){if(wr(n)||br(n))return n.indexOf(t)!==-1;if(Or(n))return t in n;throw new Error('Cannot use "in" operator to search for "'+t+'" in unexpected types.')}a(ts,"inOperator");j.inOperator=ts});var Rr=M((dc,Fr)=>{"use strict";b();var qe,rs=typeof setImmediate=="function";Fr.exports=Nr;function Nr(t){ne.length||(Cr(),pt=!0),ne[ne.length]=t}a(Nr,"rawAsap");var ne=[],pt=!1,re=0,ns=1024;function Lr(){for(;re<ne.length;){var t=re;if(re=re+1,ne[t].call(),re>ns){for(var n=0,s=ne.length-re;n<s;n++)ne[n]=ne[n+re];ne.length-=re,re=0}}ne.length=0,re=0,pt=!1}a(Lr,"flush");Nr.requestFlush=Cr;function Cr(){var t=process.domain;t&&(qe||(qe=Q("domain")),qe.active=process.domain=null),pt&&rs?setImmediate(Lr):process.nextTick(Lr),t&&(qe.active=process.domain=t)}a(Cr,"requestFlush")});var jr=M((gc,Br)=>{"use strict";b();var Pr=Rr(),ht=[];Br.exports=is;function is(t){var n;ht.length?n=ht.pop():n=new Ir,n.task=t,n.domain=process.domain,Pr(n)}a(is,"asap");function Ir(){this.task=null,this.domain=null}a(Ir,"RawTask");Ir.prototype.call=function(){this.domain&&this.domain.enter();var t=!0;try{this.task.call(),t=!1,this.domain&&this.domain.exit()}finally{t&&Pr.requestFlush(),this.task=null,this.domain=null,ht.push(this)}}});var Mr=M((Kr,Ue)=>{b();(function(t){"use strict";var n=a(function(){var o=Array.prototype.slice.call(arguments);typeof o[0]=="function"&&o[0].apply(null,o.splice(1))},"executeSync"),s=a(function(o){typeof setImmediate=="function"?setImmediate(o):typeof process<"u"&&process.nextTick?process.nextTick(o):setTimeout(o,0)},"executeAsync"),i=a(function(o){var l=a(function(c){var u=a(function(){return o.length&&o[c].apply(null,arguments),u.next()},"fn");return u.next=function(){return c<o.length-1?l(c+1):null},u},"makeCallback");return l(0)},"makeIterator"),e=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},r=a(function(o,l,c){var u=c?s:n;if(l=l||function(){},!e(o)){var f=new Error("First argument to waterfall must be an array of functions");return l(f)}if(!o.length)return l();var p=a(function(m){return function(g){if(g)l.apply(null,arguments),l=a(function(){},"callback");else{var w=Array.prototype.slice.call(arguments,1),x=m.next();x?w.push(p(x)):w.push(l),u(function(){m.apply(null,w)})}}},"wrapIterator");p(i(o))()},"waterfall");typeof define<"u"&&define.amd?define([],function(){return r}):typeof Ue<"u"&&Ue.exports?Ue.exports=r:t.waterfall=r})(Kr)});var dt=M((bc,mn)=>{"use strict";b();var $r=ee(),Dr=`
5
5
  \r\xA0`,qr="()[]{}%*-+~/#,:|.<>=!",ss="0123456789",os="{%",as="%}",ls="{{",cs="}}",us="{#",fs="#}",Ur="string",Vr="whitespace",Wr="data",Gr="block-start",Hr="block-end",Yr="variable-start",Xr="variable-end",zr="comment",Jr="left-paren",Qr="right-paren",Zr="left-bracket",en="right-bracket",tn="left-curly",rn="right-curly",nn="operator",sn="comma",on="colon",an="tilde",ln="pipe",cn="int",un="float",fn="boolean",mt="none",pn="symbol",ps="special",hn="regex";function Y(t,n,s,i){return{type:t,value:n,lineno:s,colno:i}}a(Y,"token");var hs=function(){function t(s,i){this.str=s,this.index=0,this.len=s.length,this.lineno=0,this.colno=0,this.in_code=!1,i=i||{};var e=i.tags||{};this.tags={BLOCK_START:e.blockStart||os,BLOCK_END:e.blockEnd||as,VARIABLE_START:e.variableStart||ls,VARIABLE_END:e.variableEnd||cs,COMMENT_START:e.commentStart||us,COMMENT_END:e.commentEnd||fs},this.trimBlocks=!!i.trimBlocks,this.lstripBlocks=!!i.lstripBlocks}a(t,"Tokenizer");var n=t.prototype;return n.nextToken=a(function(){var i=this.lineno,e=this.colno,r;if(this.in_code){var o=this.current();if(this.isFinished())return null;if(o==='"'||o==="'")return Y(Ur,this._parseString(o),i,e);if(r=this._extract(Dr))return Y(Vr,r,i,e);if((r=this._extractString(this.tags.BLOCK_END))||(r=this._extractString("-"+this.tags.BLOCK_END)))return this.in_code=!1,this.trimBlocks&&(o=this.current(),o===`
6
6
  `?this.forward():o==="\r"&&(this.forward(),o=this.current(),o===`
@@ -78,4 +78,4 @@ Why: ${L}
78
78
 
79
79
  Next: ${O} That rewrites this file with the container recipe.
80
80
  `),null}ec(t,w,m,l,s,"werkmeister workspace init"),ic(t,w,m,l,s),oc(t,w,m,l,s);let[x,k]=ge(w);te(`Compose ready (slot ${w}, ports ${x}-${k})`);let _=nr(),h=yr(t,w,x,k,m,r,i,null,cr(e,_,m),pr(s),fr(s),_),d=Te(s);return T.mkdirSync(d,{recursive:!0}),T.writeFileSync(C.join(d,"werkmeister-context.md"),h),T.rmSync(C.join(d,"sandbox-context.md"),{force:!0}),te(`Wrote ${C.basename(d)}/werkmeister-context.md`),w}a(Zu,"generateWorkspaceCompose");export{Ai as a,Li as b,Ni as c,Xu as d,Bi as e,Ql as f,ec as g,zu as h,tc as i,Ju as j,ic as k,sc as l,oc as m,Qu as n,Zu as o};
81
- //# sourceMappingURL=chunk-V4WXF46Y.js.map
81
+ //# sourceMappingURL=chunk-E6W3GWK6.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-COOC6H6Z.js";import{a as j,h as B,j as b,m as x,n as S}from"./chunk-6HU4LHQY.js";import{b as I}from"./chunk-3JJ2DVAG.js";import{a as i,e as L,f as F}from"./chunk-ZB5MYPP3.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-VG3BA2XL.js";import{a as j,h as B,j as b,m as x,n as S}from"./chunk-QIY6CJYG.js";import{b as I}from"./chunk-SGMHMD4R.js";import{a as i,e as L,f as F}from"./chunk-ZLO4QG42.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-O36TVN7H.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-JR7NQ5JR.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-4EQH55B3.js.map
45
+ //# sourceMappingURL=chunk-EBITRY7L.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{c as S}from"./chunk-ZOPN2T2K.js";import{m as z,n as O}from"./chunk-Y7MUE52D.js";import{m as j}from"./chunk-2WQY5YYA.js";import{U as w}from"./chunk-6HU4LHQY.js";import{a as l,f as _}from"./chunk-ZB5MYPP3.js";_();import*as k from"node:fs";import*as d from"node:path";function g(n,e){return e.host?{kind:"host",name:e.host}:{kind:"volume",name:e.volume??`werkmeister-${n}`}}l(g,"cacheSource");function R(n,e){return e.host||e.volume?null:`sandbox-${n}`}l(R,"legacyCacheVolume");function I(n,e,i){for(let t=e;;t=d.dirname(t)){if(n.some(o=>k.existsSync(d.join(t,o))))return!0;if(t===i||!t.startsWith(i))return!1}}l(I,"detectedIn");function N(n,e,i,t,o){let s;if(Array.isArray(e.caches))s=[...e.caches];else{let r=S(e,i)?.caches??[],u=o&&k.existsSync(o)?Object.keys(t).filter(c=>{let a=t[c]?.detect??[];return a.length>0&&I(a,d.resolve(o,e.path??"."),d.resolve(o))}):[];s=[...new Set([...r,...u])]}for(let r of s)if(!(r in t))throw new Error(`services.yaml: service '${n}' names unknown cache '${r}' \u2014 no \`caches.${r}\` entry`);return s.sort()}l(N,"serviceCaches");function C(n,e,i){let t=[...n.extra_volumes??[]],o={};for(let s of e){let r=i[s],u=g(s,r),c=`${u.kind==="volume"?`^${u.name}`:u.name}:${r.path}`;t.includes(c)||t.push(c),o={...o,...r.env}}return{...n,extra_volumes:t,environment:{...o,...n.environment}}}l(C,"withCaches");function W(n,e,i,t,o){if(Object.keys(t).length===0)return[n,e];let s={},r=new Map;for(let[c,a]of Object.entries(n)){let h=a.repo?d.join(o,a.repo):null,m=N(c,a,i,t,h);if(s[c]=m.length?C(a,m,t):a,a.setup_service&&m.length){let p=r.get(a.setup_service)??new Set;for(let v of m)p.add(v);r.set(a.setup_service,p)}}let u={};for(let[c,a]of Object.entries(e)){let h=[...r.get(c)??[]].sort();u[c]=h.length?C(a,h,t):a}return[s,u]}l(W,"applyCaches");function B(n){let e=0;for(let i of k.readdirSync(n,{withFileTypes:!0,recursive:!0}))i.isFile()&&(e+=k.statSync(d.join(i.parentPath,i.name)).size);return e}l(B,"dirSize");async function E(n=w(),e=void 0){return e??=await z(),Object.keys(n).sort().flatMap(i=>{let t=n[i],o=R(i,t),s=o?e?.get(o):void 0,r=g(i,t),u=A(i,r,e);return s&&o?[u,A(i,{kind:"volume",name:o},e)]:[u]})}l(E,"cacheSnapshots");function A(n,e,i){if(e.kind==="host"){let o=k.statSync(e.name,{throwIfNoEntry:!1});return{name:n,kind:e.kind,source:e.name,exists:!!o,size_bytes:o?B(e.name):null,created_at:o?o.birthtime.toISOString():null}}let t=i?.get(e.name);return{name:n,kind:e.kind,source:e.name,exists:!!t,size_bytes:t&&t.size>=0?t.size:null,created_at:t?.createdAt??null}}l(A,"snapshotOf");var F=l(()=>({caches:w(),snapshots:l(n=>E(n),"snapshots"),busy:O,run:l(n=>j(n,{capture:!0}),"run")}),"defaultDeps");async function q(n={},e=F()){let{caches:i}=e;if(n.name!==void 0&&!(n.name in i)){let s=Object.keys(i).sort().join(", ")||"none";return[{name:n.name,action:"skipped",detail:`unknown cache (known: ${s})`,ok:!1}]}let t=(await e.snapshots(i)).filter(s=>n.name===void 0||s.name===n.name),o=[];for(let s of t){let r=i[s.name],u=s.source===g(s.name,r).name?s.name:`${s.name} (${s.source})`,c=l((f,y=!0)=>o.push({name:u,action:"skipped",detail:f,ok:y}),"skip");if(!s.exists){c("not created");continue}let a="";if(!n.force){let f=await e.busy(s.source);if(f===null){c("Docker is unreachable",!1);continue}if(f.length&&!n.dryRun){c(`in use by ${f.join(", ")} (--force to prune anyway)`);continue}f.length&&(a=` (in use by ${f.join(", ")})`)}let h=`'${r.path}'`,m,p,v=[];if(n.reset)m="reset",p=`find ${h} -mindepth 1 -delete`;else if(r.max_age){let f=/^([1-9][0-9]*)d$/.exec(r.max_age)?.[1];if(!f){c(`max_age '${r.max_age}' is not <N>d`,!1);continue}m="max_age";let y=`find ${h} -mindepth 1 -type f -mmin +${Number(f)*1440}`;p=n.dryRun?`${y} | wc -l`:`${y} -delete && find ${h} -mindepth 1 -type d -empty -delete`}else if(r.prune)m="prune",p=r.prune,v=Object.entries(r.env??{}).flatMap(([f,y])=>["-e",`${f}=${y}`]);else{c("no prune rule; use --reset");continue}if(n.dryRun&&m!=="max_age"){let f=s.size_bytes===null?"unknown size":`${s.size_bytes} bytes`,y=m==="reset"?`would empty ${f}`:`would run: ${p}`;o.push({name:u,action:m,detail:y+a,ok:!0});continue}let x=["docker","run","--rm","-v",`${s.source}:${r.path}`,...v];x.push(r.image??"node:22","sh","-c",p);let $=e.run(x),b=$.stdout.trim(),M=$.status!==0?$.stderr.trim()||`exit ${$.status}`:n.dryRun?`would delete ${b} file(s) older than ${r.max_age}${a}`:b||"done";o.push({name:u,action:m,detail:M,ok:$.status===0})}return o}l(q,"pruneCaches");export{g as a,W as b,E as c,q as d};
4
- //# sourceMappingURL=chunk-34IKHARR.js.map
3
+ import{c as S}from"./chunk-7ATNOKW5.js";import{m as z,n as O}from"./chunk-SM64LULD.js";import{m as j}from"./chunk-VFK6V2ML.js";import{U as w}from"./chunk-QIY6CJYG.js";import{a as l,f as _}from"./chunk-ZLO4QG42.js";_();import*as k from"node:fs";import*as d from"node:path";function g(n,e){return e.host?{kind:"host",name:e.host}:{kind:"volume",name:e.volume??`werkmeister-${n}`}}l(g,"cacheSource");function R(n,e){return e.host||e.volume?null:`sandbox-${n}`}l(R,"legacyCacheVolume");function I(n,e,i){for(let t=e;;t=d.dirname(t)){if(n.some(o=>k.existsSync(d.join(t,o))))return!0;if(t===i||!t.startsWith(i))return!1}}l(I,"detectedIn");function N(n,e,i,t,o){let s;if(Array.isArray(e.caches))s=[...e.caches];else{let r=S(e,i)?.caches??[],u=o&&k.existsSync(o)?Object.keys(t).filter(c=>{let a=t[c]?.detect??[];return a.length>0&&I(a,d.resolve(o,e.path??"."),d.resolve(o))}):[];s=[...new Set([...r,...u])]}for(let r of s)if(!(r in t))throw new Error(`services.yaml: service '${n}' names unknown cache '${r}' \u2014 no \`caches.${r}\` entry`);return s.sort()}l(N,"serviceCaches");function C(n,e,i){let t=[...n.extra_volumes??[]],o={};for(let s of e){let r=i[s],u=g(s,r),c=`${u.kind==="volume"?`^${u.name}`:u.name}:${r.path}`;t.includes(c)||t.push(c),o={...o,...r.env}}return{...n,extra_volumes:t,environment:{...o,...n.environment}}}l(C,"withCaches");function W(n,e,i,t,o){if(Object.keys(t).length===0)return[n,e];let s={},r=new Map;for(let[c,a]of Object.entries(n)){let h=a.repo?d.join(o,a.repo):null,m=N(c,a,i,t,h);if(s[c]=m.length?C(a,m,t):a,a.setup_service&&m.length){let p=r.get(a.setup_service)??new Set;for(let v of m)p.add(v);r.set(a.setup_service,p)}}let u={};for(let[c,a]of Object.entries(e)){let h=[...r.get(c)??[]].sort();u[c]=h.length?C(a,h,t):a}return[s,u]}l(W,"applyCaches");function B(n){let e=0;for(let i of k.readdirSync(n,{withFileTypes:!0,recursive:!0}))i.isFile()&&(e+=k.statSync(d.join(i.parentPath,i.name)).size);return e}l(B,"dirSize");async function E(n=w(),e=void 0){return e??=await z(),Object.keys(n).sort().flatMap(i=>{let t=n[i],o=R(i,t),s=o?e?.get(o):void 0,r=g(i,t),u=A(i,r,e);return s&&o?[u,A(i,{kind:"volume",name:o},e)]:[u]})}l(E,"cacheSnapshots");function A(n,e,i){if(e.kind==="host"){let o=k.statSync(e.name,{throwIfNoEntry:!1});return{name:n,kind:e.kind,source:e.name,exists:!!o,size_bytes:o?B(e.name):null,created_at:o?o.birthtime.toISOString():null}}let t=i?.get(e.name);return{name:n,kind:e.kind,source:e.name,exists:!!t,size_bytes:t&&t.size>=0?t.size:null,created_at:t?.createdAt??null}}l(A,"snapshotOf");var F=l(()=>({caches:w(),snapshots:l(n=>E(n),"snapshots"),busy:O,run:l(n=>j(n,{capture:!0}),"run")}),"defaultDeps");async function q(n={},e=F()){let{caches:i}=e;if(n.name!==void 0&&!(n.name in i)){let s=Object.keys(i).sort().join(", ")||"none";return[{name:n.name,action:"skipped",detail:`unknown cache (known: ${s})`,ok:!1}]}let t=(await e.snapshots(i)).filter(s=>n.name===void 0||s.name===n.name),o=[];for(let s of t){let r=i[s.name],u=s.source===g(s.name,r).name?s.name:`${s.name} (${s.source})`,c=l((f,y=!0)=>o.push({name:u,action:"skipped",detail:f,ok:y}),"skip");if(!s.exists){c("not created");continue}let a="";if(!n.force){let f=await e.busy(s.source);if(f===null){c("Docker is unreachable",!1);continue}if(f.length&&!n.dryRun){c(`in use by ${f.join(", ")} (--force to prune anyway)`);continue}f.length&&(a=` (in use by ${f.join(", ")})`)}let h=`'${r.path}'`,m,p,v=[];if(n.reset)m="reset",p=`find ${h} -mindepth 1 -delete`;else if(r.max_age){let f=/^([1-9][0-9]*)d$/.exec(r.max_age)?.[1];if(!f){c(`max_age '${r.max_age}' is not <N>d`,!1);continue}m="max_age";let y=`find ${h} -mindepth 1 -type f -mmin +${Number(f)*1440}`;p=n.dryRun?`${y} | wc -l`:`${y} -delete && find ${h} -mindepth 1 -type d -empty -delete`}else if(r.prune)m="prune",p=r.prune,v=Object.entries(r.env??{}).flatMap(([f,y])=>["-e",`${f}=${y}`]);else{c("no prune rule; use --reset");continue}if(n.dryRun&&m!=="max_age"){let f=s.size_bytes===null?"unknown size":`${s.size_bytes} bytes`,y=m==="reset"?`would empty ${f}`:`would run: ${p}`;o.push({name:u,action:m,detail:y+a,ok:!0});continue}let x=["docker","run","--rm","-v",`${s.source}:${r.path}`,...v];x.push(r.image??"node:22","sh","-c",p);let $=e.run(x),b=$.stdout.trim(),M=$.status!==0?$.stderr.trim()||`exit ${$.status}`:n.dryRun?`would delete ${b} file(s) older than ${r.max_age}${a}`:b||"done";o.push({name:u,action:m,detail:M,ok:$.status===0})}return o}l(q,"pruneCaches");export{g as a,W as b,E as c,q as d};
4
+ //# sourceMappingURL=chunk-ETO72ULV.js.map