werkmeister 0.96.6 → 0.97.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 (157) hide show
  1. package/dist/budget-SY4OYGIO.js +4 -0
  2. package/dist/{cache-5OJXOLPF.js → cache-5JAO6KMH.js} +2 -2
  3. package/dist/{chunk-ICBOFT25.js → chunk-2PRO5KKI.js} +2 -2
  4. package/dist/{chunk-7QYU5PXD.js → chunk-3GF2UKS3.js} +2 -2
  5. package/dist/{chunk-AJULLWA3.js → chunk-4G5AWUKD.js} +2 -2
  6. package/dist/{chunk-ESYNFLSX.js → chunk-4YXW6XQD.js} +2 -2
  7. package/dist/{chunk-IJXRJHSE.js → chunk-5C2WV6TH.js} +2 -2
  8. package/dist/{chunk-NZNWTE7L.js → chunk-5CPDXROI.js} +56 -56
  9. package/dist/{chunk-Q3X77IN7.js → chunk-5M7TYWNS.js} +2 -2
  10. package/dist/{chunk-6XH3UM4W.js → chunk-6Y6UDX65.js} +2 -2
  11. package/dist/{chunk-CRERPUL7.js → chunk-6YUF2P5N.js} +2 -2
  12. package/dist/{chunk-KSUN7ZZK.js → chunk-74SDUY6Y.js} +2 -2
  13. package/dist/{chunk-QM23FCOA.js → chunk-7IIPSLHH.js} +3 -3
  14. package/dist/{chunk-SUESH3BY.js → chunk-7MEF3UU5.js} +3 -3
  15. package/dist/{chunk-4HRKQKPW.js → chunk-AJS373KE.js} +2 -2
  16. package/dist/{chunk-YAELVAID.js → chunk-BMYBIF7M.js} +2 -2
  17. package/dist/{chunk-DOTKDY53.js → chunk-BNQGIASN.js} +2 -2
  18. package/dist/chunk-BUKCOFHZ.js +24 -0
  19. package/dist/{chunk-U7F7OEJD.js → chunk-CHVX47AH.js} +2 -2
  20. package/dist/{chunk-443FHHSF.js → chunk-DGLQUPK4.js} +2 -2
  21. package/dist/{chunk-XSPQUCPB.js → chunk-DOIXKR62.js} +2 -2
  22. package/dist/{chunk-LR4VZKK7.js → chunk-DXYVB7QC.js} +2 -2
  23. package/dist/{chunk-BA6RZ57Q.js → chunk-EOLDZ6FB.js} +2 -2
  24. package/dist/{chunk-C24472A2.js → chunk-EQUWXUB3.js} +2 -2
  25. package/dist/{chunk-CRB7AFYE.js → chunk-F7EEA6UM.js} +2 -2
  26. package/dist/{chunk-Z5T3QBI7.js → chunk-FU4UBCTI.js} +2 -2
  27. package/dist/{chunk-DA3UKURI.js → chunk-HGWLUH4O.js} +3 -3
  28. package/dist/{chunk-EJFZWVFV.js → chunk-HWQ7AIKM.js} +2 -2
  29. package/dist/{chunk-2DZPE4HK.js → chunk-HZ2S4IAD.js} +2 -2
  30. package/dist/{chunk-FLYJZMJ4.js → chunk-IVERMOXH.js} +2 -2
  31. package/dist/{chunk-KD5W3PUQ.js → chunk-IXDRNMZ3.js} +2 -2
  32. package/dist/{chunk-K7PSTFHC.js → chunk-J5VY6HDB.js} +2 -2
  33. package/dist/{chunk-7QEZMWPN.js → chunk-J6O2ERPY.js} +2 -2
  34. package/dist/{chunk-KLTQPIKL.js → chunk-JES5FFRB.js} +2 -2
  35. package/dist/{chunk-ABY7DNTE.js → chunk-K6BZPURG.js} +2 -2
  36. package/dist/{chunk-CBH6SVWW.js → chunk-KGY2FBPR.js} +2 -2
  37. package/dist/{chunk-GRAAEXFE.js → chunk-KX67WIPT.js} +2 -2
  38. package/dist/{chunk-NWVBEWIZ.js → chunk-M2K3NLEH.js} +2 -2
  39. package/dist/chunk-MHHKG6BE.js +14 -0
  40. package/dist/{chunk-J3243TDQ.js → chunk-MKREJILZ.js} +2 -2
  41. package/dist/{chunk-MHICRT4W.js → chunk-MZR7MKJB.js} +3 -3
  42. package/dist/{chunk-4Q5N4VVF.js → chunk-NX32RYF7.js} +2 -2
  43. package/dist/chunk-OGGXSHXX.js +8 -0
  44. package/dist/chunk-OTM535OZ.js +4 -0
  45. package/dist/{chunk-J2RRXPO6.js → chunk-PDAWXZWV.js} +2 -2
  46. package/dist/{chunk-OZ54CGVR.js → chunk-PESUUXNN.js} +2 -2
  47. package/dist/{chunk-7FLMMXQA.js → chunk-Q32XMOUD.js} +2 -2
  48. package/dist/{chunk-J3UHZQ2C.js → chunk-QFMT4MWW.js} +2 -2
  49. package/dist/{chunk-M7OLABFX.js → chunk-QNES4AIV.js} +2 -2
  50. package/dist/{chunk-WH3SI5C7.js → chunk-QORXDQWC.js} +2 -2
  51. package/dist/{chunk-HPC4HZHD.js → chunk-QZ2B7M47.js} +2 -2
  52. package/dist/{chunk-ZX55PJPG.js → chunk-R5NBEMAP.js} +2 -2
  53. package/dist/{chunk-CXEPCQWZ.js → chunk-RLDOEKWB.js} +2 -2
  54. package/dist/{chunk-3EZX2NCC.js → chunk-TWOQINCE.js} +2 -2
  55. package/dist/{chunk-ENQNDPDP.js → chunk-U7H636RX.js} +2 -2
  56. package/dist/{chunk-AAM2FUZU.js → chunk-UJMUYJUW.js} +2 -2
  57. package/dist/{chunk-DAXUO6CD.js → chunk-VOWTL6ET.js} +2 -2
  58. package/dist/{chunk-3P2IUJ55.js → chunk-VQ7XX3F7.js} +2 -2
  59. package/dist/chunk-WFRNDVDL.js +29 -0
  60. package/dist/{chunk-IKFNWBKS.js → chunk-XN7WXRNH.js} +2 -2
  61. package/dist/chunk-YGRV3ONS.js +86 -0
  62. package/dist/{chunk-2R3TTVDD.js → chunk-YU333Y7B.js} +2 -2
  63. package/dist/{chunk-4ZXCC7N3.js → chunk-Z5IYGXQ7.js} +2 -2
  64. package/dist/{chunk-PNWBVVCB.js → chunk-ZITZHENB.js} +3 -3
  65. package/dist/{chunk-GLJAGFNV.js → chunk-ZPHTEFGX.js} +2 -2
  66. package/dist/{chunk-ST6VN3TA.js → chunk-ZSKXAQ62.js} +2 -2
  67. package/dist/{chunk-YXE7P3P3.js → chunk-ZUFHRGGK.js} +2 -2
  68. package/dist/clean-M5TTYOGM.js +8 -0
  69. package/dist/{close_out-KSCU6ND2.js → close_out-CNZTQZD2.js} +2 -2
  70. package/dist/code-ZRE6YGWG.js +4 -0
  71. package/dist/config-ZOJVNZ2X.js +4 -0
  72. package/dist/{connect-3C63UXYD.js → connect-RNEYYOS7.js} +2 -2
  73. package/dist/{daemon-FDJYZS47.js → daemon-WESJR5L4.js} +2 -2
  74. package/dist/dashboard.js +1 -1
  75. package/dist/detect-W6BDFTFI.js +13 -0
  76. package/dist/{down-Z2YDS76D.js → down-V4NRGE4B.js} +3 -3
  77. package/dist/{fixture-EQ2DDG2K.js → fixture-GGZOW4U3.js} +2 -2
  78. package/dist/form-cli.js +1 -1
  79. package/dist/hooks-KVKVLIR6.js +4 -0
  80. package/dist/{hooks_gen-QBZ3WVYH.js → hooks_gen-VXOPBT7J.js} +2 -2
  81. package/dist/infra-D2RYP4XP.js +4 -0
  82. package/dist/init_workspace-PDQD4OEK.js +4 -0
  83. package/dist/{intercept-GKECH33N.js → intercept-EBNKV3RM.js} +2 -2
  84. package/dist/{issue-4UFEXM3O.js → issue-G36QUZE7.js} +2 -2
  85. package/dist/lib/agent_state.js +1 -1
  86. package/dist/lib/gate.js +1 -1
  87. package/dist/lib/pr_guard.js +1 -1
  88. package/dist/list_workspaces-LJDWTQEX.js +7 -0
  89. package/dist/logs-QRR55ESF.js +6 -0
  90. package/dist/main.js +4 -4
  91. package/dist/mcp-proxy.js +1 -1
  92. package/dist/mcp.js +15 -15
  93. package/dist/migrate-WRQOHOBZ.js +4 -0
  94. package/dist/notes-YSRATT6K.js +4 -0
  95. package/dist/{open-QKSCQPPA.js → open-MAWH4CLY.js} +2 -2
  96. package/dist/{optimize-ATIAANUW.js → optimize-PDXW5MRK.js} +2 -2
  97. package/dist/pause-MH2OQT2H.js +4 -0
  98. package/dist/pr-6OICHFQU.js +5 -0
  99. package/dist/proxy_reload-RHTB7KBT.js +6 -0
  100. package/dist/{registry-73YKPBWG.js → registry-JEXTHXF4.js} +2 -2
  101. package/dist/remove-YUHSB5XB.js +7 -0
  102. package/dist/remove_workspace-TZBDLRU5.js +8 -0
  103. package/dist/restart-4LDFSP3O.js +8 -0
  104. package/dist/resume-NY6VEPPH.js +8 -0
  105. package/dist/{safari-B4PPMH4P.js → safari-FT6TPFPK.js} +2 -2
  106. package/dist/{sandbox-SHAZUUYS.js → sandbox-SXJE5NAR.js} +2 -2
  107. package/dist/{services-MEO4UL7D.js → services-G63VZSXI.js} +2 -2
  108. package/dist/setup-ZXI6MOZW.js +5 -0
  109. package/dist/skills-7EGTN35T.js +4 -0
  110. package/dist/slots-6UPBA44G.js +4 -0
  111. package/dist/{standards-YNJDI2AZ.js → standards-H6TRHRTI.js} +2 -2
  112. package/dist/start_args-KQ7ZV57W.js +4 -0
  113. package/dist/starting_prompt-JYJEFSRP.js +4 -0
  114. package/dist/stats-7OIDJMFG.js +4 -0
  115. package/dist/{status-2PRB2FD7.js → status-RAOZQYBH.js} +2 -2
  116. package/dist/{stop-Z4DXCZLG.js → stop-VZMI46UY.js} +2 -2
  117. package/dist/{telepresence-4FJAS53H.js → telepresence-B2VFTCUX.js} +2 -2
  118. package/dist/{test-ULK423I4.js → test-O42W7EDO.js} +2 -2
  119. package/dist/{tokens-HNQZCIQO.js → tokens-LE4HGYQY.js} +2 -2
  120. package/dist/{up-VRPRF3NW.js → up-GTF5UDTU.js} +3 -3
  121. package/dist/{v4-ETOSO3EW.js → v4-E5ZAU6ZX.js} +2 -2
  122. package/dist/wait_load-6C5M6S7F.js +4 -0
  123. package/dist/werkmeister-workspaces.vsix +0 -0
  124. package/dist/{workspace-R5LWQC63.js → workspace-4TNV4SS7.js} +2 -2
  125. package/man/werkmeister-pr.1 +1 -1
  126. package/package.json +4 -4
  127. package/dist/budget-TUUI6WGZ.js +0 -4
  128. package/dist/chunk-2PAYCFDX.js +0 -24
  129. package/dist/chunk-43O2Z5F5.js +0 -86
  130. package/dist/chunk-IE4Y2XO4.js +0 -13
  131. package/dist/chunk-P4LYRKV2.js +0 -26
  132. package/dist/chunk-URWDJ4PG.js +0 -4
  133. package/dist/clean-QW3IDVG7.js +0 -8
  134. package/dist/code-WPYJXPAJ.js +0 -4
  135. package/dist/config-CCIEE7DF.js +0 -4
  136. package/dist/detect-SCJGDHTL.js +0 -13
  137. package/dist/hooks-ZNOJ56SY.js +0 -4
  138. package/dist/infra-O7LRZU2X.js +0 -4
  139. package/dist/init_workspace-TUV4RE42.js +0 -4
  140. package/dist/list_workspaces-ALPDEO4R.js +0 -7
  141. package/dist/logs-F6HUT2FZ.js +0 -6
  142. package/dist/migrate-2XENAGXU.js +0 -8
  143. package/dist/notes-6ICOGD4H.js +0 -4
  144. package/dist/pause-AARC2ZPR.js +0 -4
  145. package/dist/pr-JSLZ2CRF.js +0 -5
  146. package/dist/proxy_reload-UQSOX3W2.js +0 -6
  147. package/dist/remove-57FABBTN.js +0 -7
  148. package/dist/remove_workspace-JXC4S52U.js +0 -8
  149. package/dist/restart-T3JTLGV5.js +0 -8
  150. package/dist/resume-5VW6EDOX.js +0 -8
  151. package/dist/setup-3N7WOACF.js +0 -5
  152. package/dist/skills-YXDBPRMQ.js +0 -4
  153. package/dist/slots-M5CGDEDY.js +0 -4
  154. package/dist/start_args-ADKZTILR.js +0 -4
  155. package/dist/starting_prompt-SJBA5IQP.js +0 -4
  156. package/dist/stats-JNRK4PTB.js +0 -4
  157. package/dist/wait_load-RJF5DXEJ.js +0 -4
@@ -0,0 +1,4 @@
1
+ import { createRequire as __sandboxCreateRequire } from "node:module";
2
+ const require = __sandboxCreateRequire(import.meta.url);
3
+ import{e as x,n as S}from"./chunk-MZR7MKJB.js";import"./chunk-5M7TYWNS.js";import"./chunk-6YUF2P5N.js";import"./chunk-HWQ7AIKM.js";import"./chunk-Z5IYGXQ7.js";import"./chunk-XN7WXRNH.js";import"./chunk-74SDUY6Y.js";import"./chunk-PDAWXZWV.js";import"./chunk-UJMUYJUW.js";import"./chunk-BMYBIF7M.js";import"./chunk-2PRO5KKI.js";import"./chunk-KX67WIPT.js";import"./chunk-4G5AWUKD.js";import"./chunk-VQ7XX3F7.js";import"./chunk-7IIPSLHH.js";import"./chunk-YGRV3ONS.js";import"./chunk-J6O2ERPY.js";import"./chunk-RLDOEKWB.js";import{D as b,E as y,I as v,L as k,O as L,T as M,v as $,w as h,x as w}from"./chunk-MHHKG6BE.js";import"./chunk-ZPHTEFGX.js";import"./chunk-DOIXKR62.js";import"./chunk-7MEF3UU5.js";import"./chunk-F7EEA6UM.js";import{p as g}from"./chunk-DXYVB7QC.js";import"./chunk-IVERMOXH.js";import"./chunk-DGLQUPK4.js";import"./chunk-YU333Y7B.js";import"./chunk-WFRNDVDL.js";import"./chunk-J5VY6HDB.js";import"./chunk-HZ2S4IAD.js";import"./chunk-ZSKXAQ62.js";import{a as i,f}from"./chunk-EOLDZ6FB.js";f();import R from"node:os";var N=2**30,B=i((n,t)=>Number.isFinite(n)?`${Number(n.toFixed(1))}${t}`:"no limit","limit");function W(n,t=process.platform){return n?`host load limit ${n}${{darwin:" (Docker VM load on macOS)",win32:" (Docker VM load on Windows)"}[t]??""}`:"host load limit off"}i(W,"hostLoadText");async function T(n){let t=await b(),m=process.platform==="darwin"||process.platform==="win32",u=y(m&&(await v())?.cores||R.availableParallelism()),c=w(),d=await M(),r=S(),l=$(L(d,r??[])).map((e,o)=>{let s=c[e.feature]?.workspace,a=s&&g(s)?.services||null,F=s?k(s,a??void 0):null,O=o===0&&e.waitedMs>=3e5&&!e.parked&&h(t,r??[],e);return{...e,position:o+1,services:a,cost:F,holds:O}});if(n.json){let e=i(o=>Number.isFinite(o)?o:null,"n");console.log(JSON.stringify({budget:{memory:e(t.memory),cpus:e(t.cpus),preempt:t.preempt},host_load:u,leases:c,waiting:d,running:r?.map(o=>({feature:o.feature,cpus:o.cost.cpus,memory:o.cost.memory,rank:o.rank,busy:o.busy}))??null,waiters:l.map(o=>({feature:o.feature,position:o.position,services:o.services,cpus:o.cost?.cpus??null,memory:o.cost?.memory??null,waited_ms:o.waitedMs,gate:o.gate}))}));return}console.log(`Budget: ${B(t.memory/N," GiB")} memory, ${B(t.cpus," CPUs")}, ${W(u)}, preemption ${t.preempt?"on":"off"}`);let p=Object.entries(c).sort(([,e],[,o])=>e.slot-o.slot);console.log(p.length?"Slots:":"Slots: none held");for(let[e,o]of p)console.log(` ${o.slot} ${e}${o.workspace?` ${o.workspace}`:""}`);console.log(r?r.length?"Running:":"Running: none":"Running: docker unavailable");for(let e of[...r??[]].sort((o,s)=>s.cost.cpus-o.cost.cpus))console.log(` ${x(e)}`);console.log(l.length?"Waiting:":"Waiting: none");for(let e of l){let o=e.services?`${e.services.join(", ")}${e.gate?" for a running feature":""}`:"whole feature",s=e.cost?` (${Number(e.cost.cpus.toFixed(1))} CPUs, ${(e.cost.memory/N).toFixed(1)} GiB)`:"",a=e.waitedMs?` waited ${Math.round(e.waitedMs/6e4)} min${e.holds?", gets the next free room":""}`:"";console.log(` ${e.position}. ${e.feature} ${o}${s}${a}`)}}i(T,"run");export{W as hostLoadText,T as run};
4
+ //# sourceMappingURL=budget-SY4OYGIO.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-URWDJ4PG.js";import{d as s}from"./chunk-YAELVAID.js";import"./chunk-3P2IUJ55.js";import"./chunk-GLJAGFNV.js";import"./chunk-SUESH3BY.js";import"./chunk-K7PSTFHC.js";import{h as e,l as c}from"./chunk-2DZPE4HK.js";import"./chunk-ST6VN3TA.js";import{a as r,f as i}from"./chunk-BA6RZ57Q.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-5OJXOLPF.js.map
3
+ import"./chunk-OTM535OZ.js";import{d as s}from"./chunk-BMYBIF7M.js";import"./chunk-VQ7XX3F7.js";import"./chunk-ZPHTEFGX.js";import"./chunk-7MEF3UU5.js";import"./chunk-J5VY6HDB.js";import{h as e,l as c}from"./chunk-HZ2S4IAD.js";import"./chunk-ZSKXAQ62.js";import{a as r,f as i}from"./chunk-EOLDZ6FB.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-5JAO6KMH.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{b as n}from"./chunk-ST6VN3TA.js";import{a as o,f as s}from"./chunk-BA6RZ57Q.js";s();import*as t from"node:fs";import*as i from"node:path";var a=`#!/bin/sh
3
+ import{b as n}from"./chunk-ZSKXAQ62.js";import{a as o,f as s}from"./chunk-EOLDZ6FB.js";s();import*as t from"node:fs";import*as i from"node:path";var a=`#!/bin/sh
4
4
  # Generated by \`werkmeister workspace init\` (SW-124); rerun it to regenerate.
5
5
  # Runs <cmd...> with HOME set to a fresh temporary directory, removed on exit,
6
6
  # so no test or CLI exercise reads or writes the real ~/.werkmeister.
@@ -72,4 +72,4 @@ nw=
72
72
  [ "\${1:-}" != --no-wait ] || { nw=--no-wait; shift; }
73
73
  exec "$(dirname "$0")/with-temp-home" $nw node "$main" internal fixture "$@"
74
74
  `;function h(r){return i.join(n(r),"bin","with-fixture-workspace")}o(h,"fixtureWrapper");function w(r){let e=h(r);return t.mkdirSync(i.dirname(e),{recursive:!0}),t.writeFileSync(e,d),t.chmodSync(e,493),e}o(w,"writeFixtureWrapper");export{a,p as b,m as c,w as d};
75
- //# sourceMappingURL=chunk-ICBOFT25.js.map
75
+ //# sourceMappingURL=chunk-2PRO5KKI.js.map
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as D,s as B}from"./chunk-CRERPUL7.js";import{a as F,b as j,c as H,d as y,e as v,g as G,h as I,i as _,k as K,l as M,n as J,o as L}from"./chunk-4ZXCC7N3.js";import{l as b,m as x,n as N}from"./chunk-IJXRJHSE.js";import{f as P,o as T}from"./chunk-IE4Y2XO4.js";import{d as A,l as O}from"./chunk-GLJAGFNV.js";import{m as p,n as w,o as C}from"./chunk-SUESH3BY.js";import{X as S,j as c,k as u,l as d,m,t as $,w as R}from"./chunk-2DZPE4HK.js";import{a as i,f as g}from"./chunk-BA6RZ57Q.js";g();import*as f from"node:fs";import*as X from"node:net";import*as Z from"node:os";import*as E from"node:path";g();import*as U from"node:fs";import*as W from"node:path";var l=".githooks";function Y(e){let t=e??S();if(!U.existsSync(W.join(t,".git")))return!1;let o;try{o=w(["git","-C",t,"config","--get","core.hooksPath"],{capture:!0})}catch(r){if(r instanceof p&&r.code==="ENOENT")return d(`git was not found on PATH \u2014 could not check or configure core.hooksPath. The werkmeister secret-commit guard (${l}/pre-commit) was NOT installed.`),!1;throw r}let s=o.status===0?o.stdout.trim():"";if(s===l)return!0;if(s)return d(`core.hooksPath is already set to '${s}' \u2014 leaving it unchanged. The werkmeister secret-commit guard (${l}/pre-commit) was NOT installed. Run 'git config core.hooksPath ${l}' manually if you want to activate it.`),!1;try{w(["git","-C",t,"config","core.hooksPath",l],{capture:!0,check:!0})}catch(r){let a=r instanceof p&&r.code===void 0&&r.stderr?r.stderr.trim():String(r instanceof Error?r.message:r);return d(`Could not set core.hooksPath to ${l} (${a}). The werkmeister secret-commit guard (${l}/pre-commit) was NOT installed.`),!1}return c(`Configuring core.hooksPath -> ${l} (first-time setup)...`),u(`core.hooksPath set to ${l} (secret-commit guard active)`),!0}i(Y,"configureGitHooksPath");function Q(e){let{argv:t,env:o,cwd:s}=I(),r=[...t,...e];c(`Running: ${r.join(" ")}`);try{let a=w(r,{capture:!0,timeout:120,env:o,cwd:s});return a.status!==0?(m(`docker compose failed:
3
+ import{a as D,s as B}from"./chunk-6YUF2P5N.js";import{a as F,b as j,c as H,d as y,e as v,g as G,h as I,i as _,k as K,l as M,n as J,o as L}from"./chunk-Z5IYGXQ7.js";import{l as b,m as x,n as N}from"./chunk-5C2WV6TH.js";import{f as P,o as T}from"./chunk-MHHKG6BE.js";import{d as A,l as O}from"./chunk-ZPHTEFGX.js";import{n as p,o as w,p as C}from"./chunk-7MEF3UU5.js";import{X as S,j as c,k as u,l as d,m,t as $,w as R}from"./chunk-HZ2S4IAD.js";import{a as i,f as g}from"./chunk-EOLDZ6FB.js";g();import*as f from"node:fs";import*as X from"node:net";import*as Z from"node:os";import*as E from"node:path";g();import*as U from"node:fs";import*as W from"node:path";var l=".githooks";function Y(e){let t=e??S();if(!U.existsSync(W.join(t,".git")))return!1;let o;try{o=w(["git","-C",t,"config","--get","core.hooksPath"],{capture:!0})}catch(r){if(r instanceof p&&r.code==="ENOENT")return d(`git was not found on PATH \u2014 could not check or configure core.hooksPath. The werkmeister secret-commit guard (${l}/pre-commit) was NOT installed.`),!1;throw r}let s=o.status===0?o.stdout.trim():"";if(s===l)return!0;if(s)return d(`core.hooksPath is already set to '${s}' \u2014 leaving it unchanged. The werkmeister secret-commit guard (${l}/pre-commit) was NOT installed. Run 'git config core.hooksPath ${l}' manually if you want to activate it.`),!1;try{w(["git","-C",t,"config","core.hooksPath",l],{capture:!0,check:!0})}catch(r){let a=r instanceof p&&r.code===void 0&&r.stderr?r.stderr.trim():String(r instanceof Error?r.message:r);return d(`Could not set core.hooksPath to ${l} (${a}). The werkmeister secret-commit guard (${l}/pre-commit) was NOT installed.`),!1}return c(`Configuring core.hooksPath -> ${l} (first-time setup)...`),u(`core.hooksPath set to ${l} (secret-commit guard active)`),!0}i(Y,"configureGitHooksPath");function Q(e){let{argv:t,env:o,cwd:s}=I(),r=[...t,...e];c(`Running: ${r.join(" ")}`);try{let a=w(r,{capture:!0,timeout:120,env:o,cwd:s});return a.status!==0?(m(`docker compose failed:
4
4
  ${a.stderr.trim()}`),!1):!0}catch(a){if(a instanceof p&&a.code==="ENOENT")return m("docker not found"),!1;if(a instanceof p&&a.code==="ETIMEDOUT")return m("docker compose timed out"),!1;throw a}}i(Q,"composeCmd");function ee(){let e=E.join(R(),"corp-ca.crt");if(f.mkdirSync(E.dirname(e),{recursive:!0}),(f.existsSync(e)?f.readFileSync(e,"utf8"):"").includes("BEGIN CERTIFICATE"))return;if(Z.platform()!=="darwin"){f.writeFileSync(e,"");return}let o=["goskope","certadmin","Zscaler","Palo Alto"],s=[];for(let a of o){let n=w(["security","find-certificate","-a","-p","-c",a,"/Library/Keychains/System.keychain"],{capture:!0,timeout:5});n.status===0&&n.stdout.includes("BEGIN CERTIFICATE")&&s.push(n.stdout)}let r=s.join("");f.writeFileSync(e,r),r.includes("BEGIN CERTIFICATE")&&c(`Corporate CA extracted to ${e} (image builds will trust it)`)}i(ee,"ensureCorpCa");async function te(){c("Generating proxy/Caddyfile..."),await B(),H(),j(),J()}i(te,"ensureProxyFiles");async function re(e){if($())return c("Shared infra (Caddy, k8s forwards) skipped (WERKMEISTER_FIXTURE)"),!0;let{argv:t,env:o,cwd:s}=I(),r=t[3];if(!f.existsSync(r))return d(`Missing ${r}`),!1;P(v,"the pre-rename shared infra");let a=["k8s-forwards","caddy",...G(),...F().map(n=>`baseline-${n.service}`)];c(`Starting shared infrastructure (${a.join(", ")})...`);try{let n=await C([...t,"up","-d","--build"],{capture:!0,signal:e,env:o,cwd:s});if(n.status!==0)return m(`docker compose failed:
5
5
  ${n.stderr.trim()}`),!1;let{recreate:k,leftover:q}=K(await _(),a);for(let h of q)d(`${h.name} was ${h.reason}, and this checkout has no such service: remove it with \`docker rm -f ${h.name}\``);if(k.length){c(`Recreating ${k.join(", ")} from this checkout...`);let h=await C([...t,"up","-d","--no-deps","--force-recreate",...k],{capture:!0,signal:e,env:o,cwd:s});if(h.status!==0)return m(`docker compose failed:
6
6
  ${h.stderr.trim()}`),!1}return u("Shared infrastructure started"),!0}catch(n){if(n instanceof p&&n.code==="ABORT_ERR")return d("Shared infrastructure start was cancelled"),!1;if(n instanceof p&&n.code==="ENOENT")return m("docker not found"),!1;throw n}}i(re,"startSharedInfra");var oe="/werkmeister/proxy/ui/index.html";function se(e,t,o){return new Promise(s=>{let r=X.createConnection({host:e,port:t}),a=!1,n=i(k=>{a||(a=!0,r.destroy(),s(k))},"finish");r.setTimeout(o*1e3),r.on("connect",()=>n(!0)),r.on("timeout",()=>n(!1)),r.on("error",()=>n(!1))})}i(se,"checkPort");async function V(){let e={};for(let t of await A(y,void 0,{all:!1})??[])e[t.service||t.name]=t.health==="healthy"||t.state==="running"&&!t.health;if(e.caddy){let t=await O(D,["test","-s",oe]).catch(()=>null);e.caddy=t?.exitCode===0}if(!Object.keys(e).length){let t=[["redis",9050],["postgres",9051],["caddy",443]];for(let[o,s]of t)e[o]=await se("127.0.0.1",s,2)}return e}i(V,"checkInfraHealth");async function xe({signal:e}={}){if(e?.aborted)return d("Infrastructure start was cancelled before it began"),!1;Y(),await te(),ee();let t=await re(e);return await b(!0),t}i(xe,"up");async function ve(e){c("Waiting for services to become healthy...");let t=Date.now()+e*1e3,o=await V();for(;Object.keys(o).length>0&&Object.values(o).some(s=>!s)&&Date.now()<t;)await new Promise(s=>setTimeout(s,3e3)),o=await V();return o}i(ve,"infraHealth");async function Ie(){if((await M())["k8s-forwards"]??!1)return u("k8s port-forwards container is already healthy"),!0;c("Attempting to start/restart k8s-forwards container...");let e=await L()!=="failed";return e&&u("k8s port-forwards started"),e}i(Ie,"connectK8s");async function $e(e=!1){await x(),P(v,"the pre-rename shared infra",{removeVolumes:e});let t=["--profile","*","down"];e&&t.push("--volumes");let o=Q(t);if(o){let s="Shared infrastructure stopped";e&&(s+=" (volumes removed)"),u(s)}return o}i($e,"down");async function Re(){await x();let e=await T("stop",y);return e?(m(e),!1):(u("Shared infrastructure stopped (containers preserved, resumable with 'werkmeister infra up')"),!0)}i(Re,"stop");async function Se(){let e=await T("restart",y);return e?m(e):u("Shared infrastructure restarted"),await N(),!e}i(Se,"restart");export{re as a,xe as b,ve as c,Ie as d,$e as e,Re as f,Se as g};
7
- //# sourceMappingURL=chunk-7QYU5PXD.js.map
7
+ //# sourceMappingURL=chunk-3GF2UKS3.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{e as C,o as G}from"./chunk-3P2IUJ55.js";import{n as x}from"./chunk-SUESH3BY.js";import{d as g,e as P,u as L}from"./chunk-P4LYRKV2.js";import{G as F,M as W,S as T,a as X}from"./chunk-2DZPE4HK.js";import{b as I}from"./chunk-ST6VN3TA.js";import{a,e as Q,f as O}from"./chunk-BA6RZ57Q.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{e as C,o as G}from"./chunk-VQ7XX3F7.js";import{o as x}from"./chunk-7MEF3UU5.js";import{d as g,e as P,u as L}from"./chunk-WFRNDVDL.js";import{G as F,M as W,S as T,a as X}from"./chunk-HZ2S4IAD.js";import{b as I}from"./chunk-ZSKXAQ62.js";import{a,e as Q,f as O}from"./chunk-EOLDZ6FB.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-AJULLWA3.js.map
31
+ //# sourceMappingURL=chunk-4G5AWUKD.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 M}from"./chunk-4Q5N4VVF.js";import{a as $,b as v,c as y,d as u,e as S}from"./chunk-KLTQPIKL.js";import{f as x}from"./chunk-GLJAGFNV.js";import{h as e,j as E,k as R,l as C}from"./chunk-2DZPE4HK.js";import{a as p,f as h}from"./chunk-BA6RZ57Q.js";h();function T(n,t){if(Object.keys(n).length===0)return" No container data collected.";let a=[],o=` ${e.BOLD}${"Container".padEnd(35)} ${"Avg CPU".padStart(8)} ${"Max CPU".padStart(8)} ${"Avg Mem".padStart(8)} ${"Max Mem".padStart(8)} ${"Samples".padStart(7)} ${"CPU Lim".padStart(7)}${e.RESET}`;a.push(o),a.push(` ${"\u2500".repeat(94)}`);for(let r of Object.keys(n).sort()){let s=n[r];a.push(` ${r.padEnd(35)} ${s.avgCpu.toFixed(1).padStart(7)}% ${s.maxCpu.toFixed(1).padStart(7)}% ${$(s.avgMem).padStart(8)} ${$(s.maxMem).padStart(8)} ${String(s.samples).padStart(7)} ${(S(r,t)??"n/a").padStart(7)}`)}return a.join(`
3
+ import{a as M}from"./chunk-NX32RYF7.js";import{a as $,b as v,c as y,d as u,e as S}from"./chunk-JES5FFRB.js";import{f as x}from"./chunk-ZPHTEFGX.js";import{h as e,j as E,k as R,l as C}from"./chunk-HZ2S4IAD.js";import{a as p,f as h}from"./chunk-EOLDZ6FB.js";h();function T(n,t){if(Object.keys(n).length===0)return" No container data collected.";let a=[],o=` ${e.BOLD}${"Container".padEnd(35)} ${"Avg CPU".padStart(8)} ${"Max CPU".padStart(8)} ${"Avg Mem".padStart(8)} ${"Max Mem".padStart(8)} ${"Samples".padStart(7)} ${"CPU Lim".padStart(7)}${e.RESET}`;a.push(o),a.push(` ${"\u2500".repeat(94)}`);for(let r of Object.keys(n).sort()){let s=n[r];a.push(` ${r.padEnd(35)} ${s.avgCpu.toFixed(1).padStart(7)}% ${s.maxCpu.toFixed(1).padStart(7)}% ${$(s.avgMem).padStart(8)} ${$(s.maxMem).padStart(8)} ${String(s.samples).padStart(7)} ${(S(r,t)??"n/a").padStart(7)}`)}return a.join(`
4
4
  `)}p(T,"formatStatsTable");function O(n){if(n.length===0)return" No recommendations available (no data collected).";let t=[],a=` ${e.BOLD}${"Container".padEnd(35)} ${"Max CPU".padStart(8)} ${"Max Mem".padStart(8)} ${"Rec. CPU".padStart(9)} ${"Rec. Mem".padStart(9)} ${"Rec. Rsrv".padStart(9)}${e.RESET}`;t.push(a),t.push(` ${"\u2500".repeat(90)}`);for(let o of n)t.push(` ${o.name.padEnd(35)} ${o.max_cpu_pct.toFixed(1).padStart(7)}% ${$(o.max_mem_mib).padStart(8)} ${o.recommended_cpus.padStart(9)} ${o.recommended_memory.padStart(9)} ${o.recommended_reservation.padStart(9)}`);t.push(""),t.push(` ${e.BOLD}YAML Snippets:${e.RESET}`),t.push("");for(let o of n)t.push(` # ${o.name}`),t.push(" deploy:"),t.push(" resources:"),t.push(" limits:"),t.push(` cpus: "${o.recommended_cpus}"`),t.push(` memory: ${o.recommended_memory}`),t.push(" reservations:"),t.push(` cpus: "${v(o.recommended_cpus)}"`),t.push(` memory: ${o.recommended_reservation}`),t.push("");return t.join(`
5
5
  `)}p(O,"formatRecommendations");async function k(n){let t=n.collect??0,a=n.interval??10,o=!!n.save;console.log(`
6
6
  ${e.BOLD}=== Docker Resource Usage ===${e.RESET}
@@ -10,4 +10,4 @@ ${e.BOLD}--- Collected Statistics ---${e.RESET}
10
10
  `),console.log(T(r.stats,u())),console.log(`
11
11
  ${e.BOLD}--- Recommended Resource Limits ---${e.RESET}
12
12
  `),console.log(O(r.recommendations)),r.reportPath?R(`Report saved to: ${r.reportPath}`):a||console.log(` ${e.DIM}Tip: Use --save to write results to stats/ directory${e.RESET}`),console.log())}p(D,"renderCollection");function f(n){return n>=1024?`${(n/1024).toFixed(1)} GiB`:n>=1?`${n.toFixed(0)} MiB`:`${(n*1024).toFixed(0)} KiB`}p(f,"fmtMem");export{k as a,f as b};
13
- //# sourceMappingURL=chunk-ESYNFLSX.js.map
13
+ //# sourceMappingURL=chunk-4YXW6XQD.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{m as w,n as k}from"./chunk-SUESH3BY.js";import{b as H}from"./chunk-443FHHSF.js";import{X as v,ba as F,j as f,k as b,l as g,m as $,u as T,w as D}from"./chunk-2DZPE4HK.js";import{a as s,f as C}from"./chunk-BA6RZ57Q.js";C();import{spawn as Z}from"node:child_process";import*as o from"node:fs";import*as G from"node:net";import*as B from"node:os";import*as l from"node:path";var p={label:"Workspaces dashboard",dir:"werkmeister-dashboard",port:3001,stem:"mcp-server",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/dashboard.js"},_={label:"Werkmeister MCP server",dir:"werkmeister-mcp",get port(){return H()},stem:"sandbox-mcp",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/mcp.js",env:{HOST:"0.0.0.0"}},x="com.werkmeister.daemon";function tt(t=B.homedir()){return l.join(t,"Library","LaunchAgents",`${x}.plist`)}s(tt,"daemonPlistPath");function K(t){return t===_&&process.platform==="darwin"&&o.existsSync(tt())}s(K,"launchdOwns");function et(t,e){let n=`gui/${process.getuid?.()??0}/${x}`,r=k(["launchctl","kickstart",...e?["-k"]:[],n],{capture:!0,timeout:15});return r.status!==0?($(`launchctl kickstart ${n} failed: ${(r.stderr||r.stdout).trim()}`),!1):(b(`${t.label} ${e?"restarted":"started"} by launchd (${x})`),!0)}s(et,"kickstart");var M=[p,_];function O(t){return new Promise(e=>setTimeout(e,t*1e3))}s(O,"sleep");async function U(t){let e;try{e=k(["lsof","-ti",`tcp:${t}`,"-sTCP:LISTEN"],{capture:!0,timeout:5}).stdout}catch(r){if(r instanceof w&&(r.code==="ENOENT"||r.code==="ETIMEDOUT"))return;throw r}let n=e.split(/\s+/).map(r=>r.trim()).filter(r=>/^\d+$/.test(r)).map(r=>Number.parseInt(r,10));for(let r of n)try{process.kill(r,"SIGTERM")}catch{}if(n.length!==0){for(let r=0;r<20;r++){if(!await z(t))return;await O(.25)}for(let r of n)try{process.kill(r,"SIGKILL")}catch{}}}s(U,"freePort");function W(){let t=D();return o.mkdirSync(t,{recursive:!0}),t}s(W,"stateDir");function y(t){return l.join(W(),`${t.stem}.pid`)}s(y,"pidFile");function rt(t){return l.join(W(),`${t.stem}.log`)}s(rt,"logFile");function I(t){return l.join(F(),"apps",t.dir)}s(I,"appDir");function nt(t,e){let n=e.lastIndexOf("/"),r=n>=0?l.join(t,e.slice(0,n)):t,c=n>=0?e.slice(n+1):e,i=new RegExp("^"+c.split("*").map(d=>d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$"),u;try{u=o.readdirSync(r,{withFileTypes:!0})}catch{return[]}return u.filter(d=>i.test(d.name)).map(d=>l.join(r,d.name))}s(nt,"globMatch");function st(t){let e=I(t),n=l.join(e,t.buildRef),r;try{let i=o.statSync(n);if(!i.isFile())return!0;r=i.mtimeMs}catch{return!0}let c=["*.ts","*.html","package.json","tsconfig*.json","src/*.ts","src/*.css","src/lib/*.ts"];for(let i of c)for(let u of nt(e,i))try{if(o.statSync(u).mtimeMs>r)return!0}catch{}return!1}s(st,"distStale");function ot(t,e){try{return o.statSync(e).mtimeMs>o.statSync(y(t)).mtimeMs}catch{return!1}}s(ot,"buildNewerThanRunning");function it(t){let e;try{e=o.readFileSync(y(t),"utf8")}catch{return null}let n=e.trim();return/^[+-]?\d+$/.test(n)?Number.parseInt(n,10):null}s(it,"readPid");function q(t){try{process.kill(t,0)}catch(e){let n=e.code;if(n==="ESRCH")return!1;if(n==="EPERM")return!0;throw e}return!0}s(q,"alive");function z(t){return new Promise(e=>{let n=G.connect({host:"127.0.0.1",port:t}),r=s(c=>{n.destroy(),e(c)},"done");n.setTimeout(1e3,()=>r(!1)),n.once("connect",()=>r(!0)),n.once("error",()=>r(!1))})}s(z,"portOpen");async function S(t){try{let e=await fetch(`http://127.0.0.1:${t}/__werkmeister-health`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}",signal:AbortSignal.timeout(2e3)});return e.status!==400&&e.status<500}catch{return!1}}s(S,"serves");function L(t=p){let e=it(t);return e&&q(e)?[!0,e]:[!1,null]}s(L,"isRunning");async function ht(t=p){let[e,n]=L(t);return{running:e,pid:n,port:t.port,url:`http://localhost:${t.port}/`,healthy:e&&await S(t.port)}}s(ht,"status");function J(t){let e=I(t);if(o.existsSync(l.join(e,"package.json")))return{dir:e,entry:t.entry,bundled:!1};let n=t.bundled?l.join(v(),t.bundled):null;return!n||!o.existsSync(n)?null:{dir:v(),entry:n,bundled:!0}}s(J,"appEntry");function bt(t){let e=J(t);return e?l.resolve(e.dir,e.entry):void 0}s(bt,"appEntryPath");async function Q(t=p,e=!0,n=!1){let r=T();if(r)return f(`${t.label}: ${r}; leaving the machine's server on port ${t.port} alone`),S(t.port);let[c,i]=L(t);if(c&&i===process.pid)return b(`${t.label} is this process (pid ${i}); leaving it running`),!0;if(K(t))return!n&&await S(t.port)?(b(`${t.label} already running under launchd (http://localhost:${t.port}/)`),!0):et(t,n);c&&!await S(t.port)&&(f(`${t.label} (pid ${i}) is not serving on port ${t.port}; restarting it.`),n=!0);let u=J(t);if(!u)return g(`${t.label} not found at ${I(t)}; skipping`),!1;let{dir:d,entry:N}=u,X=u.bundled?N:l.join(d,t.buildRef);u.bundled&&(e=!1);let E=!1;if(e&&st(t)){f(`Building ${t.label} (sources changed)...`);let a;try{a=k(["pnpm","run","build"],{cwd:d,capture:!0,timeout:300})}catch(m){if(m instanceof w&&m.code==="ENOENT")return g(`pnpm not found; skipping ${t.label}`),!1;if(m instanceof w&&m.code==="ETIMEDOUT")return $(`${t.label} build timed out; skipping`),!1;throw m}if(a.status!==0){let m=(a.stderr.trim()||a.stdout.trim()).slice(-800);return $(`${t.label} build failed; skipping start:
3
+ import{n as w,o as k}from"./chunk-7MEF3UU5.js";import{b as H}from"./chunk-DGLQUPK4.js";import{X as v,ba as F,j as f,k as b,l as g,m as $,u as T,w as D}from"./chunk-HZ2S4IAD.js";import{a as s,f as C}from"./chunk-EOLDZ6FB.js";C();import{spawn as Z}from"node:child_process";import*as o from"node:fs";import*as G from"node:net";import*as B from"node:os";import*as l from"node:path";var p={label:"Workspaces dashboard",dir:"werkmeister-dashboard",port:3001,stem:"mcp-server",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/dashboard.js"},_={label:"Werkmeister MCP server",dir:"werkmeister-mcp",get port(){return H()},stem:"sandbox-mcp",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/mcp.js",env:{HOST:"0.0.0.0"}},x="com.werkmeister.daemon";function tt(t=B.homedir()){return l.join(t,"Library","LaunchAgents",`${x}.plist`)}s(tt,"daemonPlistPath");function K(t){return t===_&&process.platform==="darwin"&&o.existsSync(tt())}s(K,"launchdOwns");function et(t,e){let n=`gui/${process.getuid?.()??0}/${x}`,r=k(["launchctl","kickstart",...e?["-k"]:[],n],{capture:!0,timeout:15});return r.status!==0?($(`launchctl kickstart ${n} failed: ${(r.stderr||r.stdout).trim()}`),!1):(b(`${t.label} ${e?"restarted":"started"} by launchd (${x})`),!0)}s(et,"kickstart");var M=[p,_];function O(t){return new Promise(e=>setTimeout(e,t*1e3))}s(O,"sleep");async function U(t){let e;try{e=k(["lsof","-ti",`tcp:${t}`,"-sTCP:LISTEN"],{capture:!0,timeout:5}).stdout}catch(r){if(r instanceof w&&(r.code==="ENOENT"||r.code==="ETIMEDOUT"))return;throw r}let n=e.split(/\s+/).map(r=>r.trim()).filter(r=>/^\d+$/.test(r)).map(r=>Number.parseInt(r,10));for(let r of n)try{process.kill(r,"SIGTERM")}catch{}if(n.length!==0){for(let r=0;r<20;r++){if(!await z(t))return;await O(.25)}for(let r of n)try{process.kill(r,"SIGKILL")}catch{}}}s(U,"freePort");function W(){let t=D();return o.mkdirSync(t,{recursive:!0}),t}s(W,"stateDir");function y(t){return l.join(W(),`${t.stem}.pid`)}s(y,"pidFile");function rt(t){return l.join(W(),`${t.stem}.log`)}s(rt,"logFile");function I(t){return l.join(F(),"apps",t.dir)}s(I,"appDir");function nt(t,e){let n=e.lastIndexOf("/"),r=n>=0?l.join(t,e.slice(0,n)):t,c=n>=0?e.slice(n+1):e,i=new RegExp("^"+c.split("*").map(d=>d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$"),u;try{u=o.readdirSync(r,{withFileTypes:!0})}catch{return[]}return u.filter(d=>i.test(d.name)).map(d=>l.join(r,d.name))}s(nt,"globMatch");function st(t){let e=I(t),n=l.join(e,t.buildRef),r;try{let i=o.statSync(n);if(!i.isFile())return!0;r=i.mtimeMs}catch{return!0}let c=["*.ts","*.html","package.json","tsconfig*.json","src/*.ts","src/*.css","src/lib/*.ts"];for(let i of c)for(let u of nt(e,i))try{if(o.statSync(u).mtimeMs>r)return!0}catch{}return!1}s(st,"distStale");function ot(t,e){try{return o.statSync(e).mtimeMs>o.statSync(y(t)).mtimeMs}catch{return!1}}s(ot,"buildNewerThanRunning");function it(t){let e;try{e=o.readFileSync(y(t),"utf8")}catch{return null}let n=e.trim();return/^[+-]?\d+$/.test(n)?Number.parseInt(n,10):null}s(it,"readPid");function q(t){try{process.kill(t,0)}catch(e){let n=e.code;if(n==="ESRCH")return!1;if(n==="EPERM")return!0;throw e}return!0}s(q,"alive");function z(t){return new Promise(e=>{let n=G.connect({host:"127.0.0.1",port:t}),r=s(c=>{n.destroy(),e(c)},"done");n.setTimeout(1e3,()=>r(!1)),n.once("connect",()=>r(!0)),n.once("error",()=>r(!1))})}s(z,"portOpen");async function S(t){try{let e=await fetch(`http://127.0.0.1:${t}/__werkmeister-health`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}",signal:AbortSignal.timeout(2e3)});return e.status!==400&&e.status<500}catch{return!1}}s(S,"serves");function L(t=p){let e=it(t);return e&&q(e)?[!0,e]:[!1,null]}s(L,"isRunning");async function ht(t=p){let[e,n]=L(t);return{running:e,pid:n,port:t.port,url:`http://localhost:${t.port}/`,healthy:e&&await S(t.port)}}s(ht,"status");function J(t){let e=I(t);if(o.existsSync(l.join(e,"package.json")))return{dir:e,entry:t.entry,bundled:!1};let n=t.bundled?l.join(v(),t.bundled):null;return!n||!o.existsSync(n)?null:{dir:v(),entry:n,bundled:!0}}s(J,"appEntry");function bt(t){let e=J(t);return e?l.resolve(e.dir,e.entry):void 0}s(bt,"appEntryPath");async function Q(t=p,e=!0,n=!1){let r=T();if(r)return f(`${t.label}: ${r}; leaving the machine's server on port ${t.port} alone`),S(t.port);let[c,i]=L(t);if(c&&i===process.pid)return b(`${t.label} is this process (pid ${i}); leaving it running`),!0;if(K(t))return!n&&await S(t.port)?(b(`${t.label} already running under launchd (http://localhost:${t.port}/)`),!0):et(t,n);c&&!await S(t.port)&&(f(`${t.label} (pid ${i}) is not serving on port ${t.port}; restarting it.`),n=!0);let u=J(t);if(!u)return g(`${t.label} not found at ${I(t)}; skipping`),!1;let{dir:d,entry:N}=u,X=u.bundled?N:l.join(d,t.buildRef);u.bundled&&(e=!1);let E=!1;if(e&&st(t)){f(`Building ${t.label} (sources changed)...`);let a;try{a=k(["pnpm","run","build"],{cwd:d,capture:!0,timeout:300})}catch(m){if(m instanceof w&&m.code==="ENOENT")return g(`pnpm not found; skipping ${t.label}`),!1;if(m instanceof w&&m.code==="ETIMEDOUT")return $(`${t.label} build timed out; skipping`),!1;throw m}if(a.status!==0){let m=(a.stderr.trim()||a.stdout.trim()).slice(-800);return $(`${t.label} build failed; skipping start:
4
4
  ${m}`),!1}E=!0}else e&&f(`${t.label} build up to date; skipping build`);if(c&&!E&&ot(t,X)&&(f(`Running ${t.label} predates the current build; bouncing to reload it.`),n=!0),c&&!E&&!n)return b(`${t.label} already running (pid ${i}, http://localhost:${t.port}/)`),!0;c&&await V(t),await U(t.port);let j=rt(t),Y={...process.env,PORT:String(t.port),...t.env??{}};f(`Starting ${t.label} on http://localhost:${t.port}/ ...`);let R=o.openSync(j,"w"),h=Z("node",[N],{cwd:d,detached:!0,stdio:["ignore",R,R],env:Y}),P=await new Promise(a=>{h.once("spawn",()=>a("spawned")),h.once("error",m=>a(m))});if(o.closeSync(R),P!=="spawned"){if(P.code==="ENOENT")return g(`node not found; skipping ${t.label}`),!1;throw P}h.unref(),o.writeFileSync(y(t),String(h.pid));let A=!1;h.once("exit",()=>{A=!0});for(let a=0;a<20;a++){if(A)return $(`${t.label} exited immediately (see ${j})`),o.rmSync(y(t),{force:!0}),!1;if(await z(t.port))return b(`${t.label} started (pid ${h.pid}, http://localhost:${t.port}/)`),!0;await O(.25)}return g(`${t.label} started (pid ${h.pid}) but port ${t.port} not up yet; check ${j}`),!0}s(Q,"start");async function V(t=p){if(K(t))return f(`${t.label} is kept up by launchd (${x}); leaving it running`),!1;let e=T();if(e)return f(`${t.label}: ${e}; leaving the machine's server on port ${t.port} alone`),!1;let[n,r]=L(t);if(!n||r===null)return o.rmSync(y(t),{force:!0}),!1;f(`Stopping ${t.label} (pid ${r})...`);try{process.kill(r,"SIGTERM")}catch(i){let u=i.code;if(u==="ESRCH")return o.rmSync(y(t),{force:!0}),!1;if(u==="EPERM")return $(`Cannot signal pid ${r} (owned by another user)`),!1;throw i}let c=!1;for(let i=0;i<20;i++){if(!q(r)){c=!0;break}await O(.25)}if(!c)try{process.kill(r,"SIGKILL")}catch{}return o.rmSync(y(t),{force:!0}),await U(t.port),b(`${t.label} stopped`),!0}s(V,"stop");async function ct(t=p,e=!1){await Q(t,e,!0)}s(ct,"restart");async function yt(t=!0){for(let e of M)await Q(e,t)}s(yt,"startAll");async function $t(){for(let t of M)await V(t)}s($t,"stopAll");async function pt(t=!1){for(let e of M)await ct(e,t)}s(pt,"restartAll");export{p as a,_ as b,x as c,tt as d,S as e,ht as f,J as g,bt as h,Q as i,V as j,ct as k,yt as l,$t as m,pt as n};
5
- //# sourceMappingURL=chunk-IJXRJHSE.js.map
5
+ //# sourceMappingURL=chunk-5C2WV6TH.js.map