werkmeister 0.88.0 → 0.88.2
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.
- package/dist/{budget-2OG7ENGB.js → budget-KOVWWQJO.js} +2 -2
- package/dist/{cache-J37L6OZW.js → cache-LKH3U6DI.js} +2 -2
- package/dist/{chunk-AJ3LRI2P.js → chunk-2DWHFL34.js} +2 -2
- package/dist/{chunk-HOYEZ7GK.js → chunk-2FWHOC7N.js} +3 -3
- package/dist/{chunk-SH27Q7SE.js → chunk-2IC2QHZI.js} +2 -2
- package/dist/{chunk-T6BCSX42.js → chunk-2JHN4WUH.js} +2 -2
- package/dist/{chunk-KY2DPEJH.js → chunk-3VMN24FJ.js} +2 -2
- package/dist/{chunk-MHACNCTY.js → chunk-42KX6W6Q.js} +2 -2
- package/dist/{chunk-PYTNJGX7.js → chunk-4JTHKDHS.js} +2 -2
- package/dist/{chunk-673BG2U3.js → chunk-4QHEHBQ5.js} +2 -2
- package/dist/{chunk-MWCHEYYU.js → chunk-5GDEICWC.js} +49 -49
- package/dist/{chunk-32SZ3AWE.js → chunk-5QBQORVS.js} +2 -2
- package/dist/chunk-64WCT53L.js +12 -0
- package/dist/{chunk-CAFKEJLD.js → chunk-6HPU6O2L.js} +2 -2
- package/dist/{chunk-U7W6SCTX.js → chunk-7X2SLBGC.js} +2 -2
- package/dist/{chunk-5ZOYSH3U.js → chunk-AAFA4D2M.js} +2 -2
- package/dist/{chunk-IXIHUUVA.js → chunk-AFNK4WFP.js} +2 -2
- package/dist/{chunk-NLH4XNA7.js → chunk-BEOJHKCU.js} +3 -3
- package/dist/{chunk-MQ5CADR6.js → chunk-C44F4RQR.js} +2 -2
- package/dist/{chunk-OUGTY3YG.js → chunk-CGV2SCM4.js} +2 -2
- package/dist/{chunk-KMG45NE5.js → chunk-CHUFTL5K.js} +2 -2
- package/dist/{chunk-LVL3YEQU.js → chunk-CNDIPYF3.js} +2 -2
- package/dist/{chunk-3G4APYPN.js → chunk-E4H3LEKL.js} +3 -3
- package/dist/{chunk-WZYA5A7X.js → chunk-ESMH7NWU.js} +2 -2
- package/dist/{chunk-RMRELEIM.js → chunk-EZHYTISC.js} +2 -2
- package/dist/{chunk-PP2D2VQW.js → chunk-F7ZAVUUV.js} +2 -2
- package/dist/{chunk-P4BXZ2AH.js → chunk-FTHTTPGB.js} +2 -2
- package/dist/{chunk-WKJEHNIZ.js → chunk-G6WJIKZW.js} +2 -2
- package/dist/{chunk-D33ZKM4G.js → chunk-GKTFYMRL.js} +2 -2
- package/dist/chunk-GSJXYFRI.js +4 -0
- package/dist/{chunk-QXLVORTD.js → chunk-GWCNJONG.js} +2 -2
- package/dist/{chunk-C5NFD52M.js → chunk-HKL7IMPI.js} +2 -2
- package/dist/{chunk-H73LMEML.js → chunk-HOJPAUIW.js} +2 -2
- package/dist/{chunk-GAGXNKME.js → chunk-IGVR2Y66.js} +2 -2
- package/dist/{chunk-3SHZI4VC.js → chunk-IVIUIAEJ.js} +2 -2
- package/dist/{chunk-7CNFVADA.js → chunk-JLNLJTKG.js} +2 -2
- package/dist/{chunk-3VRQJQMN.js → chunk-KDFIGAZ7.js} +2 -2
- package/dist/{chunk-NQTEEYOO.js → chunk-KL6NK2GS.js} +2 -2
- package/dist/{chunk-EYTGAD5L.js → chunk-LQ3U7X62.js} +2 -2
- package/dist/{chunk-4NMNYWHU.js → chunk-MK6HHG6I.js} +2 -2
- package/dist/{chunk-PE7ZBBK3.js → chunk-NF4PB3YV.js} +2 -2
- package/dist/{chunk-2EH475Z2.js → chunk-NH3D357S.js} +2 -2
- package/dist/{chunk-TEU5X2MN.js → chunk-NTQD4ICQ.js} +2 -2
- package/dist/{chunk-F73C5JKF.js → chunk-O7MYU574.js} +2 -2
- package/dist/{chunk-IVE67NYE.js → chunk-OAXM4TY7.js} +2 -2
- package/dist/{chunk-ID5ZNKEA.js → chunk-OHR6GYJC.js} +2 -2
- package/dist/{chunk-IQXPVVVC.js → chunk-ON6ZGUU4.js} +2 -2
- package/dist/{chunk-PAJVVDZD.js → chunk-P23WL5LM.js} +2 -2
- package/dist/{chunk-DOKZSEOR.js → chunk-P2WA4B57.js} +2 -2
- package/dist/{chunk-CXHO37RU.js → chunk-PAWUXZLZ.js} +3 -3
- package/dist/{chunk-LSJQM4KT.js → chunk-PLESUD3T.js} +2 -2
- package/dist/{chunk-ZMDWF6GQ.js → chunk-PRSXSSBS.js} +2 -2
- package/dist/{chunk-RPGH5GOR.js → chunk-Q6VHNHYO.js} +2 -2
- package/dist/{chunk-IACOBMZQ.js → chunk-QLNCSPY2.js} +2 -2
- package/dist/{chunk-CNMFCMMJ.js → chunk-S6R5XRVK.js} +2 -2
- package/dist/{chunk-37R4GY5G.js → chunk-SPPXOJH4.js} +2 -2
- package/dist/{chunk-G2MKQICO.js → chunk-SX7GFT3T.js} +2 -2
- package/dist/{chunk-EIUNNV7M.js → chunk-TATT2QRD.js} +2 -2
- package/dist/{chunk-H7RPKE6G.js → chunk-TDV4CAHE.js} +2 -2
- package/dist/{chunk-GNOBZIY2.js → chunk-UM5N4G3H.js} +2 -2
- package/dist/{chunk-NWLGUZTZ.js → chunk-UZIMIFLK.js} +2 -2
- package/dist/{chunk-MFQ7W74R.js → chunk-VJQH542B.js} +2 -2
- package/dist/{chunk-LGSREWUN.js → chunk-VXGJSGLM.js} +2 -2
- package/dist/{chunk-44UFJ3CG.js → chunk-W5OHBU6Z.js} +2 -2
- package/dist/{chunk-4SPFHN5J.js → chunk-X2GC6UTF.js} +2 -2
- package/dist/{chunk-OTLQ3VIP.js → chunk-X37MBNGK.js} +2 -2
- package/dist/{chunk-BLSLM4DT.js → chunk-XG4T67HO.js} +2 -2
- package/dist/{chunk-BU3YWYKL.js → chunk-YDK6KDE7.js} +2 -2
- package/dist/clean-ITHB2SQ2.js +8 -0
- package/dist/close_out-E743TQ5G.js +8 -0
- package/dist/code-UBG2NWU4.js +4 -0
- package/dist/{config-A5NXL2I3.js → config-ZYFYKNHA.js} +2 -2
- package/dist/{connect-WLPK5AGP.js → connect-GQ2D2FID.js} +2 -2
- package/dist/{daemon-GIK4HZBE.js → daemon-A3EL24OP.js} +2 -2
- package/dist/dashboard.js +15 -15
- package/dist/{detect-SLTCSTK2.js → detect-JD7ZMAIW.js} +2 -2
- package/dist/{down-HZ2OFPQP.js → down-MHLBUS5U.js} +3 -3
- package/dist/{fixture-EJMCK4HP.js → fixture-ZB3KIUVO.js} +2 -2
- package/dist/form-cli.js +1 -1
- package/dist/hooks-IE23XSGG.js +4 -0
- package/dist/{hooks_gen-BVNHWHXG.js → hooks_gen-FEWQ7G27.js} +2 -2
- package/dist/infra-NT6GC7CG.js +4 -0
- package/dist/init_workspace-DOBU4M3O.js +4 -0
- package/dist/{intercept-H2W56PJJ.js → intercept-GA6BQRQR.js} +2 -2
- package/dist/{issue-RM22PX26.js → issue-TR37YT4M.js} +2 -2
- package/dist/lib/agent_state.js +1 -1
- package/dist/lib/gate.js +1 -1
- package/dist/lib/pr_guard.js +1 -1
- package/dist/list_workspaces-5LXJTT4D.js +7 -0
- package/dist/logs-3WWEDQHR.js +6 -0
- package/dist/main.js +3 -3
- package/dist/mcp-proxy.js +1 -1
- package/dist/mcp.js +8 -8
- package/dist/{migrate-BYHY2XN7.js → migrate-5UWXDPF6.js} +2 -2
- package/dist/notes-7X2Y3MU6.js +4 -0
- package/dist/{open-DBUWUVQJ.js → open-NNG4ZB55.js} +2 -2
- package/dist/{optimize-BKORF6W2.js → optimize-CHX6S7WB.js} +2 -2
- package/dist/pause-3R5TD4CO.js +4 -0
- package/dist/pr-45G2DDUV.js +5 -0
- package/dist/proxy_reload-6SOBSU7S.js +6 -0
- package/dist/{registry-Q3SZBPN5.js → registry-WI7Q4OU4.js} +2 -2
- package/dist/remove-MG6LFAI3.js +7 -0
- package/dist/remove_workspace-OHQ6JNZL.js +8 -0
- package/dist/restart-GUBZZRFV.js +8 -0
- package/dist/resume-LXZ33P2U.js +8 -0
- package/dist/{safari-CFFZTF2X.js → safari-ZCKD7RSZ.js} +2 -2
- package/dist/{sandbox-MNBUKASF.js → sandbox-PY4VAKAH.js} +2 -2
- package/dist/{services-3UPDIEVI.js → services-COFITZAZ.js} +2 -2
- package/dist/{setup-ME7GIK2B.js → setup-55TNNI67.js} +2 -2
- package/dist/skills-WFBYQH6Y.js +4 -0
- package/dist/{slots-B2Z54A2L.js → slots-WNL5FYUI.js} +2 -2
- package/dist/{standards-VOU4FQUM.js → standards-2QEGX42A.js} +2 -2
- package/dist/start_args-X6424OHN.js +4 -0
- package/dist/starting_prompt-2RVQIXG4.js +4 -0
- package/dist/stats-QYVOJ3LR.js +4 -0
- package/dist/{status-54FHL27E.js → status-3XMXMYEQ.js} +2 -2
- package/dist/{stop-HRFWT4UN.js → stop-AVGPXLQ3.js} +2 -2
- package/dist/{telepresence-LPY7XCG4.js → telepresence-4NL7WSJB.js} +2 -2
- package/dist/{test-4RBNY6AD.js → test-PDITTZUT.js} +2 -2
- package/dist/{tokens-5JCYNUG2.js → tokens-5KBF4E5U.js} +2 -2
- package/dist/{up-O54MEAOT.js → up-7TXXR676.js} +3 -3
- package/dist/{v4-7WDN7T2U.js → v4-IACPJRHL.js} +2 -2
- package/dist/wait_load-U2YARAJO.js +4 -0
- package/dist/werkmeister-workspaces.vsix +0 -0
- package/dist/{workspace-ZK2QZBBN.js → workspace-YSVJ5N2A.js} +2 -2
- package/package.json +4 -4
- package/dist/chunk-3ILPXLNL.js +0 -4
- package/dist/chunk-YUDCD5RO.js +0 -11
- package/dist/clean-PAQYOETC.js +0 -8
- package/dist/close_out-254HQZXP.js +0 -8
- package/dist/code-EFOWK72L.js +0 -4
- package/dist/hooks-ZYLU23FI.js +0 -4
- package/dist/infra-JJEG5FES.js +0 -4
- package/dist/init_workspace-MKT2EWUW.js +0 -4
- package/dist/list_workspaces-MUT43YZZ.js +0 -7
- package/dist/logs-U5Y3ZA3U.js +0 -6
- package/dist/notes-QXWGVPC4.js +0 -4
- package/dist/pause-WURPTXIK.js +0 -4
- package/dist/pr-2CWDUZ4T.js +0 -5
- package/dist/proxy_reload-NO2SDYIV.js +0 -6
- package/dist/remove-64HRZ2VC.js +0 -7
- package/dist/remove_workspace-I5GOJA2I.js +0 -8
- package/dist/restart-BMZFCUOJ.js +0 -8
- package/dist/resume-S3RN5FMJ.js +0 -8
- package/dist/skills-CQVWQKQW.js +0 -4
- package/dist/start_args-OS6J24LG.js +0 -4
- package/dist/starting_prompt-C3SSSCUA.js +0 -4
- package/dist/stats-CMGNHGCK.js +0 -4
- package/dist/wait_load-2ZI6P6JS.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{c as v,k as L}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=budget-
|
|
3
|
+
import{c as v,k as L}from"./chunk-2FWHOC7N.js";import"./chunk-6HPU6O2L.js";import"./chunk-CNDIPYF3.js";import"./chunk-SX7GFT3T.js";import"./chunk-IGVR2Y66.js";import"./chunk-2IC2QHZI.js";import"./chunk-VXGJSGLM.js";import"./chunk-GWCNJONG.js";import"./chunk-HKL7IMPI.js";import"./chunk-ESMH7NWU.js";import"./chunk-LQ3U7X62.js";import"./chunk-PRSXSSBS.js";import"./chunk-X37MBNGK.js";import"./chunk-UM5N4G3H.js";import"./chunk-NH3D357S.js";import"./chunk-E4H3LEKL.js";import"./chunk-EZHYTISC.js";import"./chunk-YDK6KDE7.js";import{A as h,B as w,F as b,I as y,N as k,v as f,w as $}from"./chunk-VJQH542B.js";import"./chunk-GKTFYMRL.js";import"./chunk-P2WA4B57.js";import"./chunk-O7MYU574.js";import"./chunk-JLNLJTKG.js";import{o as d}from"./chunk-64WCT53L.js";import"./chunk-CHUFTL5K.js";import"./chunk-NF4PB3YV.js";import"./chunk-Q6VHNHYO.js";import"./chunk-PLESUD3T.js";import"./chunk-3VMN24FJ.js";import"./chunk-UZIMIFLK.js";import"./chunk-TDV4CAHE.js";import"./chunk-HOJPAUIW.js";import{a as c,f as g}from"./chunk-P23WL5LM.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-KOVWWQJO.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-
|
|
4
|
-
//# sourceMappingURL=cache-
|
|
3
|
+
import"./chunk-GSJXYFRI.js";import{c as s}from"./chunk-2IC2QHZI.js";import"./chunk-NH3D357S.js";import"./chunk-GKTFYMRL.js";import"./chunk-O7MYU574.js";import"./chunk-UZIMIFLK.js";import{h as e,l as c}from"./chunk-TDV4CAHE.js";import"./chunk-HOJPAUIW.js";import{a as r,f as i}from"./chunk-P23WL5LM.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-LKH3U6DI.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-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as s,f as c}from"./chunk-P23WL5LM.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-2DWHFL34.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 ie}from"./chunk-
|
|
3
|
+
import{a as ie}from"./chunk-6HPU6O2L.js";import{a as yt,b as $t,c as St,e as Ct,f as kt,g as se,h as vt,k as _e,l as Oe,m as Ae,n as M}from"./chunk-CNDIPYF3.js";import{j as Et}from"./chunk-SX7GFT3T.js";import{d as re,h as wt,l as xt,m as Rt}from"./chunk-IGVR2Y66.js";import{m as Re}from"./chunk-VXGJSGLM.js";import{i as Ke,p as Qe,t as xe}from"./chunk-GWCNJONG.js";import{g as Ge,v as Ye}from"./chunk-ESMH7NWU.js";import{C as J}from"./chunk-E4H3LEKL.js";import{a as He,b as me,d as ge}from"./chunk-YDK6KDE7.js";import{$ as ve,A as ut,E as $e,F as lt,G as Se,H as dt,I as ft,J as pt,M as ne,N as mt,P as Ee,R as Ce,W as gt,Y as oe,Z as ke,_ as j,a as b,aa as ht,d as Ze,h as et,i as we,j as tt,k as nt,l as ot,m as rt,n as ye,o as st,p as it,s as Z,v as at,w as ee,x as L,y as te,z as ct}from"./chunk-VJQH542B.js";import{c as z,d as X,j as Je,k as he,l as ze,o as Xe}from"./chunk-GKTFYMRL.js";import{a as O,d as de}from"./chunk-P2WA4B57.js";import{l as Q,m as A}from"./chunk-O7MYU574.js";import{b as Ue,c as Y,e as fe,i as Ve,l as P,m as qe,n as pe,o as H,r as K,s as Be}from"./chunk-64WCT53L.js";import{n as We}from"./chunk-3VMN24FJ.js";import{b as $}from"./chunk-UZIMIFLK.js";import{J as Le,M as B,Q as G,W as je,Z as Me,h as m,j as u,k as R,l as E,m as x,n as y,u as D}from"./chunk-TDV4CAHE.js";import{b as Pe}from"./chunk-HOJPAUIW.js";import{a as c,f as q}from"./chunk-P23WL5LM.js";q();import*as k from"node:fs";import*as _ from"node:path";import{setTimeout as un}from"node:timers/promises";q();import*as _t from"node:fs";var ae="w9r-caddy",ce="/tmp/Caddyfile",Xt=/\breverse_proxy\b/g,Zt=/^\s*(handle(?:_path)?)\b\s*([^{]*)\{\s*$/,en=/^\s*(handle(?:_path)?)\b\s*([^{]*)\{.*\}\s*$/;function Ot(e){let t=e.indexOf("#");return t===-1?e:e.slice(0,t)}c(Ot,"_stripComment");function tn(e){return e.replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/\{[^{}\s]*\}/g,"")}c(tn,"_stripBraceNoise");function nn(e){function t(r){let i=0;for(let s of r)if(!(typeof s!="object"||s===null||Array.isArray(s)))for(let a of s.handle??[]){if(typeof a!="object"||a===null||Array.isArray(a))continue;let l=a.handler;l==="subroute"?i+=t(a.routes??[]):l==="reverse_proxy"&&(i+=1)}return i}c(t,"walkRouteBlocks");let n=e?.apps?.http?.servers;if(typeof n!="object"||n===null||Array.isArray(n))return 0;let o=0;for(let r of Object.values(n))typeof r=="object"&&r!==null&&!Array.isArray(r)&&(o+=t(r.routes??[]));return o}c(nn,"countCompiledRoutes");function on(e){let t=0;for(let n of e.split(/\r?\n/)){if(n.trim().startsWith("#"))continue;let o=Ot(n);t+=(o.match(Xt)??[]).length}return t}c(on,"computeExpectedRouteCount");function rn(e){let t=[],n=e.split(/\r?\n/),o=0,r="(global)",i=[],s=new Map,a=new Set;function l(d){let f=s.get(d)??[];if(s.delete(d),f.length<2||a.has(d))return;let S=f.filter(w=>w[2]===""),p=f.filter(w=>w[2]!=="");if(S.length&&p.length)for(let[w,v]of S)t.push(`${r}: line ${w}: bare unscoped '${v} {' coexists with path-scoped sibling handle blocks (route-drop risk)`);let g=new Map;for(let[w,v,h]of p)g.has(h)?t.push(`${r}: line ${w}: duplicate '${v} ${h}' matcher also used at line ${g.get(h)} (route-drop risk)`):g.set(h,w)}c(l,"flushGroup");for(let d=0;d<n.length;d++){let f=d+1,S=n[d],p=Ot(S),g=p.trim();if(o===0&&g.endsWith("{")&&!g.startsWith("#")){let h=g.slice(0,-1).trim();i.push(h||"(global)"),r=i[i.length-1]}else i.length&&g.endsWith("{");g.startsWith("route")&&/^route\b.*\{\s*$/.test(g)&&a.add(o+1);let w=Zt.exec(p);if(w){let h=w[1],T=w[2].trim(),I=s.get(o)??[];s.set(o,I),I.push([f,h,T,a.has(o)])}else{let h=en.exec(p);if(h){let T=h[1],I=h[2].trim(),V=s.get(o)??[];s.set(o,V),V.push([f,T,I,a.has(o)]);continue}}let v=tn(g);for(let h=0;h<(v.match(/\{/g)??[]).length;h++)o+=1;for(let h=0;h<(v.match(/\}/g)??[]).length;h++)s.has(o)&&l(o),a.delete(o),o=Math.max(o-1,0),o===0&&i.length&&(i.pop(),r=i.length?i[i.length-1]:"(global)")}for(let d of[...s.keys()])l(d);return t}c(rn,"lintCaddyfileStructure");async function sn(e,t=ae,n=ce){u(`Copying Caddyfile into container: ${e} -> ${t}:${n}`);try{return await Je(t,e,n),!0}catch(o){return x(`Copying the Caddyfile failed: ${o.message}`),!1}}c(sn,"cpCaddyfileToContainer");async function an(e=ae,t=ce){let n;try{n=await he(e,["caddy","adapt","--config",t])}catch(r){return[!1,0,r.message]}if(n.exitCode!==0)return[!1,0,n.stderr.trim()];let o;try{o=JSON.parse(n.stdout)}catch(r){return[!1,0,`failed to parse caddy adapt output as JSON: ${r}`]}return[!0,nn(o),""]}c(an,"adaptAndCountRoutes");function cn(e,{capture:t=!1}={}){let{argv:n,env:o,cwd:r}=wt(),i=[...n,...e];u(`Running: ${i.join(" ")}`);let s;try{s=A(i,{capture:t,timeout:60,env:o,cwd:r})}catch(a){if(a instanceof Q&&a.code==="ENOENT")return x("docker compose not found. Ensure Docker Desktop is installed."),!1;if(a instanceof Q&&a.code==="ETIMEDOUT")return x("Proxy command timed out after 60 seconds"),!1;throw a}if(s.status!==0){let a=t?s.stderr:"";return x(`Proxy command failed (exit ${s.status})`),a&&y(`${m.DIM}${a.trim()}${m.RESET}
|
|
4
4
|
`),!1}return!0}c(cn,"_runCaddyCompose");async function W(){let e=D();if(e)return u(`Caddy reload skipped (${e})`),!0;let t=`${Me()}/proxy/Caddyfile`;if(u("Copying Caddyfile into Caddy container..."),!await sn(t))return x(`Failed to copy ${t} into ${ae}:${ce}`),!1;let n=_t.readFileSync(t,"utf8"),o=rn(n);for(let d of o)E(`Structural lint: ${d}`);u("Validating config and counting compiled routes...");let[r,i,s]=await an();if(!r)return x(`caddy adapt failed -- not reloading: ${s}`),!1;let a=on(n);if(i<a)return x(`Route-count guard tripped: compiled ${i} routes, expected ${a} (from ${t}) -- not reloading. This usually means the Caddyfile uses overlapping/unscoped \`handle\` blocks instead of a \`route\` block.`),!1;u(`Route count OK: ${i} compiled routes (expected >= ${a})`),u("Reloading Caddy configuration...");let l;try{l=await he(ae,["caddy","reload","--config",ce])}catch(d){return x(`Caddy reload failed: ${d.message}`),!1}if(l.exitCode!==0){E(`Caddy reload failed: ${l.stderr.trim()}`),E("Falling back to restarting the Caddy container; it reads the bind-mounted /etc/caddy/Caddyfile which may lag behind the latest copy."),u("Attempting to restart Caddy container instead...");let d=await st("restart",re,"caddy");return d&&x(d),d===null}return R("Caddy configuration reloaded"),!0}c(W,"reloadCaddy");function be(){let e=D();if(e)return u(`Caddy start skipped (${e})`),!0;u("Starting Caddy reverse proxy...");let t=cn(["up","-d","caddy"],{capture:!0});return t&&R("Caddy reverse proxy started"),t}c(be,"startCaddy");var F="werkmeister-shared";function At(){try{if(A(["docker","network","inspect",F],{capture:!0,timeout:30}).status===0)return!0;let e=A(["docker","network","create","--label",`com.docker.compose.project=${re}`,"--label",`com.docker.compose.network=${F}`,F],{capture:!0,timeout:30});if(e.status!==0)return x(`Could not create the ${F} network: ${e.stderr.trim()}`),!1}catch(e){if(e instanceof Q)return x(`Could not create the ${F} network: ${e.message}`),!1;throw e}return u(`Created the ${F} network`),!0}c(At,"ensureSharedNetwork");async function U(){return(await X(re,"caddy")??[]).some(t=>t.state==="running")}c(U,"isCaddyRunning");function ln(e){xe(e).refresh(e),Et(e,"chore: refresh Claude settings",[".claude/settings.json",".werkmeister/claude-permissions.json"])&&u("Committed the refreshed .claude/settings.json on the record branch")}c(ln,"refreshWorkspaceSettings");async function dn(e,t,{signal:n,byPerson:o}={}){if(N(e,"up"),Yt(e,t),de(t),!k.existsSync(_.join(t,O)))throw new $(`No ${O} found in workspace: ${t}
|
|
5
5
|
Run 'werkmeister workspace init' first to generate it.`,"NO_COMPOSE");u("Loading configuration...");let r=Re(B(),t),i={services:r,ports:G()},s=Mt(t);Wt(r,s,t),Oe(t,s,r),ln(t);let{slot:a,regenerated:l,staleCompose:d}=await Ft(e,t,i,s),[f,S]=ve(a);if(s.length){await $e(t,void 0);let C=await Ne(e,t,o??!J(t));if(C!==null)return E(`Waiting for capacity, position ${C} \u2014 it starts when another feature stops`),{waitingNote:Lt(e,C,!0),feature:e,slot:a,portRange:[f,S],localServices:s,urls:[],servicePorts:[],regenerated:l,staleCompose:d,containersStarted:!1,caddy:"skipped",waiting:C}}else await te(e),K(t);Ae(e,a,s,i,t),y(`
|
|
6
6
|
${m.CYAN}Local services: ${m.BOLD}${s.length?s.join(", "):"(none -- all via k8s)"}${m.RESET}
|
|
@@ -14,7 +14,7 @@ ${Lt(e,w,!1)}`,"NO_CAPACITY");g||E(`Waiting for capacity to start ${l.join(", ")
|
|
|
14
14
|
Run \`werkmeister machine setup\` to write a template to ${o}, then fill in the missing values (or pin them under \`env_vars:\` in .werkmeister/workspace.yml).`,"MISSING_SECRETS")}c(Wt,"requireSecrets");function Ut(e,t=process.env,n="/.dockerenv"){return(t.WERKMEISTER_FEATURE??t.SANDBOX_FEATURE)===e&&k.existsSync(n)}c(Ut,"insideOwnContainer");function N(e,t){if(Ut(e))throw new $(`'werkmeister ${t}' is running inside ${e}'s own container, which it would recreate or stop and so kill itself.
|
|
15
15
|
Run it from the host: cd to the workspace and run 'werkmeister ${t}'.`,"INSIDE_OWN_CONTAINER")}c(N,"refuseInsideOwnContainer");var wn=new Set(["clear","resume"]);function Te(e,t=Date.now()){return Object.entries(Y(e,t)).map(([n,o])=>({sessionId:n,status:o.status,statusUpdatedAt:Date.parse(o.last??o.at),asking:o.ask!==void 0})).filter(n=>t-n.statusUpdatedAt<Ue)}c(Te,"liveSessions");function yn(e,t){return Te(e).map(n=>n.sessionId).filter(n=>n!==t)}c(yn,"otherLiveSessions");function $n(e,t,n){let o=c(i=>(i.statusUpdatedAt??1/0)>n,"recent");return t.sessions(e.workspace).some(i=>i.asking&&t.queued?o(i):i.status!=="idle"||o(i))?"session active":e.startedAt.some(i=>i>n)?`started < ${t.minutes} min ago`:(t.lastExec(e.workspace)??0)>n?`gate ran < ${t.minutes} min ago`:null}c($n,"busyReason");function Sn(){let e=We().overrides?.idle_stop_minutes;return Number.isInteger(e)&&e>=0?e:30}c(Sn,"idleStopMinutes");function Vt(e){return _.join(Pe(e),"last-exec")}c(Vt,"lastExecMarker");function qt(e){try{return k.statSync(e).mtimeMs}catch{return null}}c(qt,"mtimeMs");var En="com.docker.compose.project.working_dir";function Bt(e=t=>A(t,{capture:!0,timeout:20})){try{let t=new Set;for(let s of[Ee,Ce]){let a=e(["docker","ps","-q","--filter",`label=${s}`]);if(a.status!==0)return null;for(let l of a.stdout.split(`
|
|
16
16
|
`).filter(Boolean))t.add(l)}if(!t.size)return[];let o=`{{${`or (index .Config.Labels "${Ee}") (index .Config.Labels "${Ce}")`}}} {{index .Config.Labels "${En}"}} {{.State.StartedAt}} {{.HostConfig.MemoryReservation}} {{.HostConfig.NanoCpus}}`,r=e(["docker","inspect","--format",o,...t]);if(r.status!==0)return null;let i=new Map;for(let s of r.stdout.split(`
|
|
17
|
-
`).filter(Boolean)){let[a,l,d,f,S]=s.split(" ");if(!a||!l)continue;let p=i.get(a)??{feature:a,workspace:l,startedAt:[],memory:0,cpus:0};p.startedAt.push(Date.parse(d)),p.memory+=Number(f)||0,p.cpus+=(Number(S)||0)/1e9,i.set(a,p)}return[...i.values()]}catch{return null}}c(Bt,"runningFeatures");async function yo(e,t={}){let n=t.run??(f=>A(f,{capture:!0,timeout:20})),o=Bt(n);if(!o)return{ok:!0,lines:["docker unavailable \u2014 nothing reaped"]};let r=o.filter(f=>!t.only||f.feature===t.only);if(!r.length)return{ok:!0,lines:["no running feature containers"]};let i=t.now??Date.now(),s={minutes:e,now:i,running:r,sessions:c(f=>Te(f,i),"sessions"),lastExec:c(f=>qt(Vt(f)),"lastExec"),queued:t.queued??L().length>0},a=s.now-e*6e4,l=[],d=!0;for(let f of r){let S=f.feature==="infra"?"shared infra":Ut(f.feature)?"running inside its own container":$n(f,s,a);if(S){l.push(`${f.feature}: kept (${S})`);continue}let p=s.sessions(f.workspace).some(g=>g.asking);try{await(t.stop??De)(f.feature),l.push(p?`${f.feature}: stopped (waiting on a person \u2265 ${e} min, others queued)`:`${f.feature}: stopped (idle \u2265 ${e} min)`)}catch(g){d=!1,l.push(`${f.feature}: stop failed \u2014 ${g.message}`)}}return{ok:d,lines:l}}c(yo,"stopIdle");function $o(e){let{feature:t,workspaceRoot:n,sessionId:o,reason:r,entrypoint:i}=e;return!t||t==="infra"||r&&wn.has(r)||i?.startsWith("sdk")||yn(n,o).length?null:t}c($o,"idleStopFeature");var Cn="Capacity freed: this workspace's containers are up. Continue where you left off.";function Gt(e){let t=Bt(e);if(!t)return null;let n=Date.now()-Sn()*6e4;return t.map(o=>{let r=fe(Y(o.workspace)),i=o.feature==="infra"?"person":r?.agent==="needs-you"?"human-check":J(o.workspace)?r?.agent==="working"?"working":"idle":"person",s=P(o.workspace)!==null||(qt(Vt(o.workspace))??0)>n;return{lease:{feature:o.feature,cost:{memory:o.memory,cpus:o.cpus},rank:i,busy:s},at:r?Date.parse(r.at):0}}).sort((o,r)=>o.at-r.at).map(o=>o.lease)}c(Gt,"runningLeases");function Ne(e,t,n,o){return ne("admit",{feature:e,workspace:t,byPerson:n,starting:o},()=>kn(e,t,n,o),15*6e4)}c(Ne,"admitOrQueue");async function kn(e,t,n,o){let r=Gt();if(r===null)return null;let i=await ut(),s=await pt(e,t,n,r,i,o);if(s.kind==="never-fits"){let{cost:a}=s,l=c(f=>`${(f/2**30).toFixed(1)} GiB`,"gib"),d=a.cpus>i.cpus?`cost ${a.cpus.toFixed(1)} CPUs > budget ${i.cpus}; raise the engine's CPUs or budget.cpus`:`cost ${l(a.memory)} memory > budget ${l(i.memory)}; raise the engine's memory or budget.memory`;throw new $(`'${e}' can never fit the budget${o?` to start ${o.services.join(", ")}`:""}: ${d} in ~/.werkmeister/config.yaml, or start fewer services.`,"NEVER_FITS")}if(s.kind==="wait")return s.position;if(s.kind==="preempt")for(let a of s.victims){await De(a,{grant:!1});let l=ee()[a]?.workspace||b(a);l&&await ct(a,l);let d=r.find(f=>f.feature===a)?.rank;u(`Stopped '${a}' to make room: its session is ${d==="human-check"?"waiting on a person":d==="working"?"working":"idle"} (preemption; budget.preempt: false turns it off)`)}return null}c(kn,"admitOrQueueHere");function So(){return ne("grant",{},Ie,15*6e4)}c(So,"grantWaiters");var Tt=Promise.resolve();function Ie(){let e=Tt.then(It,It);return Tt=e.catch(()=>{}),e}c(Ie,"grantHere");function Eo(){let e=L().length;return e&&Ie().catch(t=>E(`Waiting queue: ${t.message}`)),e}c(Eo,"grantInBackground");async function It(){let e=[];for(let t of L()){let n=ee()[t]?.workspace;if(!n){await te(t);continue}H(n)?.services||(await dn(t,n,{byPerson:!1})).waiting!==void 0||(e.push(t),Te(n).length&&Be(n,Cn))}return e}c(It,"grantWaitersNow");async function Fe(){try{let e=await ne("grant-later",{},async()=>null);if(e!==null){e&&u(`The daemon will start the next waiting feature (${e} waiting)`);return}for(let t of await Ie())R(`Started '${t}' from the waiting queue`)}catch(e){E(`Could not start the next waiting feature: ${e instanceof Error?e.message:String(e)}`)}}c(Fe,"grantWaitersQuietly");async function De(e,{grant:t=!0}={}){N(e,"stop");let n=await ue(e);if(u(`Stopping containers for '${e}' (slot ${n})...`),!await rt(e))throw new $(`Failed to stop containers for '${e}'`,"COMPOSE_STOP_FAILED");return t&&await Fe(),{feature:e,slot:n}}c(De,"stop");async function Co(e){N(e,"restart");let t=await ue(e),n=b(e);if(Yt(e,n),u(`Restarting containers for '${e}' (slot ${t})...`),!(n?await ie(n,"restart",()=>ye(e)):await ye(e)))throw new $(`Failed to restart containers for '${e}'`,"COMPOSE_RESTART_FAILED");return{feature:e,slot:t}}c(Co,"restart");function Yt(e,t){if(t&&P(t))throw new $(`'${e}' is paused; Resume it first`,"PAUSED")}c(Yt,"refusePaused");function Ht(e){let t=b(e);if(!t)throw new $(`No workspace folder for '${e}'`,"NO_WORKSPACE");return t}c(Ht,"workspaceOrThrow");var Kt=c(e=>e.statusCode,"statusOf"),Qt=c(e=>e.json?.message??e.message,"daemonMessage");async function ko(e){N(e,"pause");let t=await ue(e),n=Ht(e);if(P(n))throw new $(`'${e}' is already paused`,"ALREADY_PAUSED");let o=await X(await Ze(e),void 0,{all:!1});if(o===null)throw new $("docker not found / not running","COMPOSE_PAUSE_FAILED");let r=it(o.filter(s=>s.state==="running")).map(s=>s.name);Ge(n)&&Ye(n),qe(n,{at:new Date().toISOString(),containers:r,was_working:fe(Y(n))?.agent==="working"}),u(`Pausing ${r.length} container(s) for '${e}' (slot ${t})...`);let i=[];for(let s of[...r].reverse())try{await z().getContainer(s).pause()}catch(a){Kt(a)!==409&&i.push(`${s}: ${Qt(a)}`)}if(i.length)throw new $(`docker pause failed: ${i.join("; ")}`,"COMPOSE_PAUSE_FAILED");return R(`Paused '${e}': its Claude session is held until Resume`),{feature:e,slot:t,containers:r}}c(ko,"pause");async function vo(e){N(e,"resume");let t=Ht(e),n=P(t);if(!n)throw new $(`'${e}' is not paused`,"NOT_PAUSED");u(`Resuming ${n.containers.length} container(s) for '${e}'...`);let o=[];for(let r of n.containers){let i=z().getContainer(r);try{let{State:s}=await i.inspect();s.Paused?(await i.unpause(),o.push({name:r,did:"unpaused"})):s.Running||(await i.start(),o.push({name:r,did:"started"}))}catch(s){if(Kt(s)!==404)throw new $(`docker resume ${r} failed: ${Qt(s)}`,"COMPOSE_RESUME_FAILED");E(`${r} is gone; nothing to resume`),o.push({name:r,did:"missing"})}}return pe(t),R(`Resumed '${e}'`),{feature:e,workspace:t,containers:o,wasWorking:n.was_working}}c(vo,"resume");async function xo(e,{removeVolumes:t=!1,signal:n}={}){N(e,"down");try{let{leaveFeatureIntercepts:i,releaseIdleTelepresence:s}=await import("./telepresence-
|
|
17
|
+
`).filter(Boolean)){let[a,l,d,f,S]=s.split(" ");if(!a||!l)continue;let p=i.get(a)??{feature:a,workspace:l,startedAt:[],memory:0,cpus:0};p.startedAt.push(Date.parse(d)),p.memory+=Number(f)||0,p.cpus+=(Number(S)||0)/1e9,i.set(a,p)}return[...i.values()]}catch{return null}}c(Bt,"runningFeatures");async function yo(e,t={}){let n=t.run??(f=>A(f,{capture:!0,timeout:20})),o=Bt(n);if(!o)return{ok:!0,lines:["docker unavailable \u2014 nothing reaped"]};let r=o.filter(f=>!t.only||f.feature===t.only);if(!r.length)return{ok:!0,lines:["no running feature containers"]};let i=t.now??Date.now(),s={minutes:e,now:i,running:r,sessions:c(f=>Te(f,i),"sessions"),lastExec:c(f=>qt(Vt(f)),"lastExec"),queued:t.queued??L().length>0},a=s.now-e*6e4,l=[],d=!0;for(let f of r){let S=f.feature==="infra"?"shared infra":Ut(f.feature)?"running inside its own container":$n(f,s,a);if(S){l.push(`${f.feature}: kept (${S})`);continue}let p=s.sessions(f.workspace).some(g=>g.asking);try{await(t.stop??De)(f.feature),l.push(p?`${f.feature}: stopped (waiting on a person \u2265 ${e} min, others queued)`:`${f.feature}: stopped (idle \u2265 ${e} min)`)}catch(g){d=!1,l.push(`${f.feature}: stop failed \u2014 ${g.message}`)}}return{ok:d,lines:l}}c(yo,"stopIdle");function $o(e){let{feature:t,workspaceRoot:n,sessionId:o,reason:r,entrypoint:i}=e;return!t||t==="infra"||r&&wn.has(r)||i?.startsWith("sdk")||yn(n,o).length?null:t}c($o,"idleStopFeature");var Cn="Capacity freed: this workspace's containers are up. Continue where you left off.";function Gt(e){let t=Bt(e);if(!t)return null;let n=Date.now()-Sn()*6e4;return t.map(o=>{let r=fe(Y(o.workspace)),i=o.feature==="infra"?"person":r?.agent==="needs-you"?"human-check":J(o.workspace)?r?.agent==="working"?"working":"idle":"person",s=P(o.workspace)!==null||(qt(Vt(o.workspace))??0)>n;return{lease:{feature:o.feature,cost:{memory:o.memory,cpus:o.cpus},rank:i,busy:s},at:r?Date.parse(r.at):0}}).sort((o,r)=>o.at-r.at).map(o=>o.lease)}c(Gt,"runningLeases");function Ne(e,t,n,o){return ne("admit",{feature:e,workspace:t,byPerson:n,starting:o},()=>kn(e,t,n,o),15*6e4)}c(Ne,"admitOrQueue");async function kn(e,t,n,o){let r=Gt();if(r===null)return null;let i=await ut(),s=await pt(e,t,n,r,i,o);if(s.kind==="never-fits"){let{cost:a}=s,l=c(f=>`${(f/2**30).toFixed(1)} GiB`,"gib"),d=a.cpus>i.cpus?`cost ${a.cpus.toFixed(1)} CPUs > budget ${i.cpus}; raise the engine's CPUs or budget.cpus`:`cost ${l(a.memory)} memory > budget ${l(i.memory)}; raise the engine's memory or budget.memory`;throw new $(`'${e}' can never fit the budget${o?` to start ${o.services.join(", ")}`:""}: ${d} in ~/.werkmeister/config.yaml, or start fewer services.`,"NEVER_FITS")}if(s.kind==="wait")return s.position;if(s.kind==="preempt")for(let a of s.victims){await De(a,{grant:!1});let l=ee()[a]?.workspace||b(a);l&&await ct(a,l);let d=r.find(f=>f.feature===a)?.rank;u(`Stopped '${a}' to make room: its session is ${d==="human-check"?"waiting on a person":d==="working"?"working":"idle"} (preemption; budget.preempt: false turns it off)`)}return null}c(kn,"admitOrQueueHere");function So(){return ne("grant",{},Ie,15*6e4)}c(So,"grantWaiters");var Tt=Promise.resolve();function Ie(){let e=Tt.then(It,It);return Tt=e.catch(()=>{}),e}c(Ie,"grantHere");function Eo(){let e=L().length;return e&&Ie().catch(t=>E(`Waiting queue: ${t.message}`)),e}c(Eo,"grantInBackground");async function It(){let e=[];for(let t of L()){let n=ee()[t]?.workspace;if(!n){await te(t);continue}H(n)?.services||(await dn(t,n,{byPerson:!1})).waiting!==void 0||(e.push(t),Te(n).length&&Be(n,Cn))}return e}c(It,"grantWaitersNow");async function Fe(){try{let e=await ne("grant-later",{},async()=>null);if(e!==null){e&&u(`The daemon will start the next waiting feature (${e} waiting)`);return}for(let t of await Ie())R(`Started '${t}' from the waiting queue`)}catch(e){E(`Could not start the next waiting feature: ${e instanceof Error?e.message:String(e)}`)}}c(Fe,"grantWaitersQuietly");async function De(e,{grant:t=!0}={}){N(e,"stop");let n=await ue(e);if(u(`Stopping containers for '${e}' (slot ${n})...`),!await rt(e))throw new $(`Failed to stop containers for '${e}'`,"COMPOSE_STOP_FAILED");return t&&await Fe(),{feature:e,slot:n}}c(De,"stop");async function Co(e){N(e,"restart");let t=await ue(e),n=b(e);if(Yt(e,n),u(`Restarting containers for '${e}' (slot ${t})...`),!(n?await ie(n,"restart",()=>ye(e)):await ye(e)))throw new $(`Failed to restart containers for '${e}'`,"COMPOSE_RESTART_FAILED");return{feature:e,slot:t}}c(Co,"restart");function Yt(e,t){if(t&&P(t))throw new $(`'${e}' is paused; Resume it first`,"PAUSED")}c(Yt,"refusePaused");function Ht(e){let t=b(e);if(!t)throw new $(`No workspace folder for '${e}'`,"NO_WORKSPACE");return t}c(Ht,"workspaceOrThrow");var Kt=c(e=>e.statusCode,"statusOf"),Qt=c(e=>e.json?.message??e.message,"daemonMessage");async function ko(e){N(e,"pause");let t=await ue(e),n=Ht(e);if(P(n))throw new $(`'${e}' is already paused`,"ALREADY_PAUSED");let o=await X(await Ze(e),void 0,{all:!1});if(o===null)throw new $("docker not found / not running","COMPOSE_PAUSE_FAILED");let r=it(o.filter(s=>s.state==="running")).map(s=>s.name);Ge(n)&&Ye(n),qe(n,{at:new Date().toISOString(),containers:r,was_working:fe(Y(n))?.agent==="working"}),u(`Pausing ${r.length} container(s) for '${e}' (slot ${t})...`);let i=[];for(let s of[...r].reverse())try{await z().getContainer(s).pause()}catch(a){Kt(a)!==409&&i.push(`${s}: ${Qt(a)}`)}if(i.length)throw new $(`docker pause failed: ${i.join("; ")}`,"COMPOSE_PAUSE_FAILED");return R(`Paused '${e}': its Claude session is held until Resume`),{feature:e,slot:t,containers:r}}c(ko,"pause");async function vo(e){N(e,"resume");let t=Ht(e),n=P(t);if(!n)throw new $(`'${e}' is not paused`,"NOT_PAUSED");u(`Resuming ${n.containers.length} container(s) for '${e}'...`);let o=[];for(let r of n.containers){let i=z().getContainer(r);try{let{State:s}=await i.inspect();s.Paused?(await i.unpause(),o.push({name:r,did:"unpaused"})):s.Running||(await i.start(),o.push({name:r,did:"started"}))}catch(s){if(Kt(s)!==404)throw new $(`docker resume ${r} failed: ${Qt(s)}`,"COMPOSE_RESUME_FAILED");E(`${r} is gone; nothing to resume`),o.push({name:r,did:"missing"})}}return pe(t),R(`Resumed '${e}'`),{feature:e,workspace:t,containers:o,wasWorking:n.was_working}}c(vo,"resume");async function xo(e,{removeVolumes:t=!1,signal:n}={}){N(e,"down");try{let{leaveFeatureIntercepts:i,releaseIdleTelepresence:s}=await import("./telepresence-4NL7WSJB.js"),a=i(e);a.length&&u(`Left k8s intercept(s): ${a.join(", ")}`),await s(a)}catch(i){E(`Could not clean up k8s intercepts: ${i instanceof Error?i.message:String(i)}`)}let o=b(e),r=await ke(e);return r===null&&(E(`Feature '${e}' does not have an allocated slot`),E("It may already be stopped. Cleaning up anyway...")),u("Stopping containers..."),t&&u("Per-feature Docker volumes will be removed"),await ot(e,{removeVolumes:t,signal:n})||E(`Containers for '${e}' may still exist -- see the docker compose output above`),u("Releasing feature slot..."),await oe(e),o&&(pe(o),K(o),k.rmSync(Ve(o),{force:!0})),await Fe(),{feature:e,slot:r}}c(xo,"down");async function Ro(e,t){let n={services:B(),ports:G()},o=await ue(e),r=[...(await j())[e]?.services??[]];if(!r.includes(t))throw new $(`Service '${t}' is not running locally for '${e}'`,"NOT_LOCAL");r.splice(r.indexOf(t),1),u(`Removed '${t}' from local services -- will fall back to k8s`),u("Regenerating configuration files..."),se(e,o,r,n),_e(e,o,r,n),Ae(e,o,r,n);let i=!1;r.length?(u("Restarting containers..."),et(e)):(u("No local services remaining -- containers will be stopped"),i=!0,we(e)||E(`Containers for '${e}' may still exist -- see the docker compose output above`)),u("Updating reverse proxy..."),await M(null,n);let s=!1;return await U()&&(await W(),s=!0),{feature:e,removed:t,remaining:[...r].sort(),containersStopped:i,proxyReloaded:s}}c(Ro,"removeService");var vn={generate:c(()=>M(),"generate"),slots:c(()=>j(),"slots"),running:c(()=>U(),"running"),reload:c(()=>W(),"reload"),start:c(()=>be(),"start"),hosts:c(()=>me(),"hosts")};async function _o({start:e=!1}={},t=vn){u(e?"Regenerating Caddyfile...":"Updating reverse proxy configuration..."),await t.generate(),await ge(t.hosts(),t.lookup);let n=await t.slots(),o=Object.keys(n).sort().map(s=>({feature:s,slot:n[s].slot,services:n[s].services}));if(e)if(!o.length)u("No active features in Caddyfile");else{y(`
|
|
18
18
|
${m.CYAN}Features in Caddyfile:${m.RESET}
|
|
19
19
|
`);for(let{feature:s,slot:a,services:l}of o){let d=l.length?l.join(", "):"(no local services)";y(` ${m.GREEN}*${m.RESET} ${s} (slot ${a}): ${d}
|
|
20
20
|
`)}y(`
|
|
@@ -40,4 +40,4 @@ ${Lt(e,w,!1)}`,"NO_CAPACITY");g||E(`Waiting for capacity to start ${l.join(", ")
|
|
|
40
40
|
`);for(let p of f)t?y(` ${m.DIM}[dry-run] Would release slot: ${p}${m.RESET}
|
|
41
41
|
`):(await oe(p),S.push(p),y(` ${m.GREEN}Released:${m.RESET} ${p}
|
|
42
42
|
`))}}return{activeFeatures:n,activeVolumes:a,orphanedVolumes:l,staleSlots:f,removedVolumes:s,releasedSlots:S}}c(An,"runClean");async function ue(e){let t=await ke(e);if(t===null)throw new $(`Feature '${e}' is not running (no slot allocated)`,"NOT_RUNNING");return t}c(ue,"requireSlot");async function Ao(e){let t=b(e);if(t===null)return{workspace:null,handoff:null,decisions:[],graduated:[]};let{decisions:n}=xe(t),o=Qe(t,null,n);return{workspace:t,handoff:Ke(t),decisions:n.open(t),graduated:o}}c(Ao,"teardownNotes");export{dn as a,wo as b,gn as c,Mt as d,Te as e,Sn as f,Vt as g,Bt as h,yo as i,$o as j,Gt as k,Ne as l,So as m,Eo as n,De as o,Co as p,ko as q,vo as r,xo as s,Ro as t,_o as u,Oo as v,An as w,Ao as x};
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-2FWHOC7N.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}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as S}from"./chunk-NH3D357S.js";import{m as z,n as O}from"./chunk-GKTFYMRL.js";import{m as j}from"./chunk-O7MYU574.js";import{U as w}from"./chunk-TDV4CAHE.js";import{a as l,f as _}from"./chunk-P23WL5LM.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{W as a,E as b,q as c};
|
|
4
|
+
//# sourceMappingURL=chunk-2IC2QHZI.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-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as R}from"./chunk-ON6ZGUU4.js";import{o as x,s as j}from"./chunk-5GDEICWC.js";import{c as y}from"./chunk-UZIMIFLK.js";import{a as i,e as F,f as b}from"./chunk-P23WL5LM.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-2JHN4WUH.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 M}from"./chunk-
|
|
3
|
+
import{b as M}from"./chunk-UZIMIFLK.js";import{X as C,a as ee,l as E,r as S,s as g,v as l,w as b,x as I}from"./chunk-TDV4CAHE.js";import{b as j}from"./chunk-HOJPAUIW.js";import{a as o,e as q,f as y}from"./chunk-P23WL5LM.js";y();var x=["jira","github"];y();y();var P=q(ee(),1);import*as a from"node:fs";import*as m from"node:os";import*as p from"node:path";var O="^/\\S*$";function L(){return p.join(b(),"env.sh")}o(L,"envShPath");function te(){let e=u().overrides?.standards_dir;return e?p.resolve(S(String(e))):p.join(C(),"docs","standards")}o(te,"standardsDirPath");function re(){let e=te();return a.existsSync(e)&&a.statSync(e).isDirectory()?"":u().overrides?.standards_dir?`standards tree not found: ${e} (overrides.standards_dir in ${l()})`:`no standards tree: overrides.standards_dir is unset in ${l()} and the default ${e} does not exist`}o(re,"standardsDirProblem");function je(){return p.join(b(),"secrets.env")}o(je,"secretsPath");function F(){return p.join(m.homedir(),".zshenv")}o(F,"zshenvPath");function oe(){return p.join(m.homedir(),".zshrc")}o(oe,"zshrcPath");function G(){return p.join(m.homedir(),"Library","Application Support","Claude","claude_desktop_config.json")}o(G,"desktopConfigPath");var ne=[["paths","werkmeister_root","WERKMEISTER_ROOT"],["paths","repos_root","WERKMEISTER_REPOS_ROOT"],["paths","workspaces_root","WERKMEISTER_WORKSPACES_ROOT"],["overrides","mcp_port","WERKMEISTER_MCP_PORT"],["overrides","node","WERKMEISTER_NODE"],["overrides","services_yaml","WERKMEISTER_SERVICES_YAML"],["overrides","ports_yaml","WERKMEISTER_PORTS_YAML"],["overrides","model_pricing_yaml","WERKMEISTER_MODEL_PRICING_YAML"],["overrides","cache_file","WERKMEISTER_CACHE_FILE"],["ingress","certs_dir","WERKMEISTER_CERTS_DIR"]],$="# >>> werkmeister config >>>",B="# <<< werkmeister config <<<",W="# >>> werkmeister completion >>>",N="# <<< werkmeister completion <<<",se=["SANDBOX_ROOT","SANDBOX_REPOS_ROOT","SANDBOX_WORKSPACES_ROOT"],Ie=[{key:"repos_root",label:"Repos root (absolute path)",help:"Directory holding the canonical source-repo clones (exported as WERKMEISTER_REPOS_ROOT).",acceptEmpty:!1,pattern:O,placeholder:"/Users/you/workspace"},{key:"workspaces_root",label:"Workspaces root (absolute path)",help:"Directory holding per-feature worktree workspaces (exported as WERKMEISTER_WORKSPACES_ROOT).",acceptEmpty:!1,pattern:O,placeholder:"/Users/you/workspace/features"}],z={repos_root:"REPOS_ROOT",workspaces_root:"WORKSPACES_ROOT"};function ie(e,t=""){let r=t||p.join(m.homedir(),"workspace");return e==="workspaces_root"?p.join(r,"features"):r}o(ie,"builtinPathDefault");function Ce(e,t,r={}){let n=(t??u()).paths??{},i=n[e]||g(z[e]);if(i)return String(i);let s=r.repos_root||String(n.repos_root||g(z.repos_root)||"");return ie(e,s)}o(Ce,"pathDefault");function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(_,"isDict");var ae=/token|secret|pass(word|wd)|credential|api_?key|private_?key|access_?key|auth/i,ce=o(e=>e===""||e==null||typeof e=="object"&&Object.keys(e).length===0,"isEmpty");function A(e){return Array.isArray(e)?e.map(A):_(e)?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,ae.test(t)&&!ce(r)?"<redacted>":A(r)])):e}o(A,"redact");function Me(e){return P.stringify(A(e))}o(Me,"redactedYaml");function u(){try{return I()}catch(e){return E(`Could not parse ${l()}: ${e}`),{}}}o(u,"load");function pe(){let e=u().paths;return _(e)?e:{}}o(pe,"loadPaths");function De(){let e=pe().workspaces_root,t=e?[p.resolve(S(e))]:[];return[...new Set([...t,p.join(m.homedir(),"workspace")])]}o(De,"candidateWorkspaceRoots");function We(){let e=u().jira;return _(e)?e:{}}o(We,"loadJira");var R={local_domain:"local.werkmeister.io",remote_domain:"remote.werkmeister.io",certs_dir:p.join(m.homedir(),".docker","certs")};function Ne(e){let t=(e??u()).ingress,r=_(t)?t:{},n=o(i=>{let s=r[i];return typeof s=="string"&&s.trim()?s.trim():R[i]},"pick");return{local_domain:n("local_domain"),remote_domain:n("remote_domain"),certs_dir:S(n("certs_dir"))}}o(Ne,"loadIngress");function ue(e){let t=(e??u()).overrides?.workspace_repo;return typeof t=="string"?t.trim():""}o(ue,"loadWorkspaceRepo");var de="[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?/[A-Za-z0-9._-]+$",ze={key:"workspace_repo",label:"Workspace config repo (owner/repo)",help:"GitHub repo cloned under the repos root and worktree'd as the root of every feature workspace, so .werkmeister/ configs and notes get history. Defaults to your own; point it at a shared <org>/sandbox-workspace to share workspace configs with your team.",acceptEmpty:!1,pattern:de,placeholder:"your-org/sandbox-workspace"};function Ke(e){let t=e??u(),r=t.overrides?.github_org;return typeof r=="string"&&r.trim()?r.trim():ue(t).split("/")[0]??""}o(Ke,"loadGithubOrg");function Ze(e){let t=(e??u()).overrides?.werkmeister_issues_project,r=typeof t=="string"?t.trim().toUpperCase():"";return/^[A-Z][A-Z0-9]+$/.test(r)?r:""}o(Ze,"loadSandboxIssuesProject");var Le={key:"github_org",label:"GitHub org for service repos",help:"Owner of the repos in your services registry. Used to link the canonical examples that standards docs cite (github.com/<org>/<repo>).",acceptEmpty:!1,pattern:"[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$",placeholder:"your-org"},K="[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?(\\.[A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?)+$",Fe=[{key:"local_domain",label:"Local ingress domain",help:"Base domain for docker features \u2014 each routed service is served at <service>.<domain> and Caddy terminates TLS for it.",acceptEmpty:!1,pattern:K,placeholder:R.local_domain},{key:"remote_domain",label:"Remote (K8s) ingress domain",help:"Base domain for services routed to the dev cluster instead of a local container \u2014 served at <service>.<domain>.",acceptEmpty:!1,pattern:K,placeholder:R.remote_domain},{key:"certs_dir",label:"Certificate directory (absolute path)",help:"Where bin/generate-certs.sh writes localhost.crt/.key; bind-mounted into the Caddy container (exported as WERKMEISTER_CERTS_DIR).",acceptEmpty:!1,pattern:O,placeholder:R.certs_dir}],fe="# Global werkmeister configuration \u2014 single source of truth.\n# Managed by `werkmeister machine config`; safe to hand-edit, then run `werkmeister machine config --check`.\n";function le(e=process.env,t="/.dockerenv"){return!!(e.WERKMEISTER_FEATURE??e.SANDBOX_FEATURE)&&a.existsSync(t)}o(le,"insideContainer");function H(e){if(le()&&!g("CONFIG_FILE"))throw new M(`Refusing to write ${e} from inside a workspace container: it is the host's machine config, bind-mounted here, and the running checkout is the container's /app.
|
|
4
4
|
Run it from the host, or set WERKMEISTER_CONFIG_FILE to a scratch file.`,"INSIDE_CONTAINER")}o(H,"refuseInsideContainer");function me(){for(let e of(process.env.PATH??"").split(p.delimiter))if(e)try{return p.dirname(a.realpathSync(p.join(e,"werkmeister")))}catch{}return null}o(me,"installedRoot");function Y(e){let t=e.paths?.werkmeister_root,r=u().paths?.werkmeister_root;if(!e.paths||!t||!r||t===r)return;let n=o(i=>{try{return a.realpathSync(i)}catch{return i}},"real");n(t)===n(r)||n(t)===me()||(E(`Keeping werkmeister_root ${r}: the running checkout ${t} is not the installed werkmeister. Edit ${l()} to move it.`),e.paths.werkmeister_root=r)}o(Y,"keepStoredRoot");function Ge(e){let t=l();return H(t),Y(e),a.mkdirSync(p.dirname(t),{recursive:!0}),a.writeFileSync(t,fe+P.stringify(e)),a.chmodSync(t,384),t}o(Ge,"save");function he(e){return e===""?"''":/^[A-Za-z0-9_@%+=:,./-]+$/.test(e)?e:"'"+e.replace(/'/g,`'"'"'`)+"'"}o(he,"shQuote");function U(e){let t=[`# Generated by \`werkmeister machine config\` from ${l()} \u2014 DO NOT EDIT.`,"# Sourced by ~/.zshenv and the `werkmeister` wrapper for backward compatibility."];for(let[r,n,i]of ne){let s=e[r]?.[n];if(s==null||s==="")continue;let c=String(s);t.push(`export ${i}=${he(c.startsWith("~")?S(c):c)}`)}return t.join(`
|
|
5
5
|
`)+`
|
|
6
6
|
`}o(U,"renderEnvSh");function Be(e){let t=L();return H(t),Y(e),a.mkdirSync(p.dirname(t),{recursive:!0}),a.writeFileSync(t,U(e)),t}o(Be,"writeEnvSh");function _e(){let e=p.basename(j(m.homedir()));return`${$}
|
|
@@ -23,4 +23,4 @@ fi
|
|
|
23
23
|
${N}
|
|
24
24
|
`;return V(t,n,i,r)}o(Ye,"ensureZshrcCompletion");function v(e){let t=String(e.command??"");return p.basename(t)==="werkmeister"&&w(e).length>0}o(v,"isSandboxServer");function w(e){let t=e.args??[];return t[0]==="mcp"||t[0]==="internal"&&t[1]==="mcp"?t:[]}o(w,"serverArgs");function Ue(e,t=!1){let r=e??G();if(!a.existsSync(r))return!1;let n;try{n=JSON.parse(a.readFileSync(r,"utf8"))}catch(s){return E(`Could not parse ${r}: ${s}`),!1}let i=!1;for(let s of Object.values(n.mcpServers??{}))!_(s)||!v(s)||("env"in s&&(delete s.env,i=!0),w(s)[0]==="mcp"&&(s.args=["internal",...w(s)],i=!0));return i&&!t&&a.writeFileSync(r,JSON.stringify(n,null,2)+`
|
|
25
25
|
`),i}o(Ue,"patchDesktopConfig");function Je(e){let t=[];if(!a.existsSync(l()))return t.push(`config file missing: ${l()} \u2014 run \`werkmeister machine config --write\``),t;let r=e.paths??{};for(let f of["repos_root","workspaces_root"]){let d=r[f];if(!d)t.push(`paths.${f} is not set`);else{let T=S(String(d));a.existsSync(T)&&a.statSync(T).isDirectory()||t.push(`paths.${f} does not exist: ${d} \u2014 create it, or set another with \`werkmeister machine config --${f.replace("_","-")} <path>\``)}}let n=re();n&&t.push(n),t.push(...Z(e));let i=L();a.existsSync(i)?a.readFileSync(i,"utf8")!==U(e)&&t.push(`${i} is stale \u2014 run \`werkmeister machine config --write\` to regenerate`):t.push(`${i} missing \u2014 run \`werkmeister machine config --write\``);let s=F();(!a.existsSync(s)||!a.readFileSync(s,"utf8").includes($))&&t.push(`${s} does not source env.sh \u2014 run \`werkmeister machine config --write\``);let c=G();if(a.existsSync(c))try{let f=JSON.parse(a.readFileSync(c,"utf8"));for(let d of Object.values(f.mcpServers??{}))_(d)&&v(d)&&"env"in d&&t.push(`${c}: werkmeister server still has a stale \`env\` block \u2014 run \`werkmeister machine config --write\``),_(d)&&v(d)&&w(d)[0]==="mcp"&&t.push(`${c}: werkmeister server still launches \`mcp\`, not \`internal mcp\` \u2014 run \`werkmeister machine config --write\``)}catch{}return t}o(Je,"check");var Ee=/^[a-z0-9]+(-[a-z0-9]+)*$/,Se=/^[A-Z][A-Z0-9]+$/,ke=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,k=o(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isDict"),h=o(e=>typeof e=="string"||typeof e=="number"?String(e).trim():"","str");function ge(e,t){if(!Ee.test(e))return"name must be lowercase letters, digits and single hyphens";if(!k(t))return"must be a map";let r=k(t.tracker)?t.tracker:{},n=h(r.id);if(!x.includes(n))return`tracker.id must be one of ${x.join(", ")}`;let i={};if(n==="jira"){let c=h(r.project).toUpperCase();if(!Se.test(c))return"tracker.project must be a Jira project key (e.g. SW)";i.project=c}else{let c=h(r.org);if(!c)return"tracker.org must name the GitHub owner";if(i.org=c,r.repos!==void 0){let f=Array.isArray(r.repos)?r.repos.map(h):[];if(!f.length||!f.every(d=>ke.test(d)))return"tracker.repos must be a list of owner/repo";i.repos=f}}let s;if(t.board!==void 0){let c=k(t.board)?t.board:{};if(!h(c.id)||!h(c.ready))return"board needs both id and ready";s={id:h(c.id),ready:h(c.ready)}}return t.issue_statuses!==void 0&&!k(t.issue_statuses)?"issue_statuses must be a map":{name:e,tracker:n,scope:i,...s?{board:s}:{},issueStatuses:k(t.issue_statuses)?t.issue_statuses:{},default:t.default===!0}}o(ge,"parse");function Q(e){let t=e.projects,r=[],n=[];if(t==null)return{projects:r,problems:n};if(!k(t))return{projects:r,problems:["projects: must be a map of name \u2192 project"]};for(let s of Object.keys(t).sort()){let c=ge(s,t[s]);typeof c=="string"?n.push(`projects.${s}: ${c}`):r.push(c)}let i=r.filter(s=>s.default).map(s=>s.name);return i.length>1&&n.push(`projects: only one project may set default: true (${i.join(", ")})`),{projects:r,problems:n}}o(Q,"parseAll");function Z(e){return Q(e??u()).problems}o(Z,"projectProblems");var X=new Set;function rt(e){let{projects:t,problems:r}=Q(e??u());for(let n of r)X.has(n)||(X.add(n),E(`${n} \u2014 skipped (werkmeister machine config --check)`));return t}o(rt,"loadProjects");export{x as a,rt as b,L as c,te as d,re as e,je as f,F as g,oe as h,G as i,Ie as j,ie as k,Ce as l,Me as m,u as n,pe as o,De as p,We as q,Ne as r,ue as s,ze as t,Ke as u,Ze as v,Le as w,Fe as x,Ge as y,U as z,Be as A,J as B,He as C,Ye as D,Ue as E,Je as F};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-3VMN24FJ.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{I as y,k as g,m as w,o as _,q as h,s as $}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{I as y,k as g,m as w,o as _,q as h,s as $}from"./chunk-E4H3LEKL.js";import{n as p}from"./chunk-3VMN24FJ.js";import{a,f}from"./chunk-P23WL5LM.js";f();import*as d from"node:fs";import*as c from"node:path";var b=["in_progress","in_review","merged","done","abandoned"],C={jira:{in_progress:"In Progress",in_review:"In Review",merged:null,done:"Done",abandoned:null},github:{in_progress:"status: in progress",in_review:"status: in review",merged:null,done:"closed",abandoned:"not planned"}},x={in_progress:"issue_progress_status",in_review:"issue_review_status",done:"issue_done_status"},O={in_progress:1,in_review:2,merged:3,done:4,abandoned:4},S=a(e=>e==null||String(e).trim()===""?null:String(e).trim(),"blankToNull");function I(e,t){let o=e.issue_statuses??{},n={...C[t]};for(let s of b){let r=x[s];Object.hasOwn(o,s)?n[s]=S(o[s]):r&&e[r]!==void 0&&(n[s]=S(e[r]))}return n}a(I,"resolveIssueStatuses");function L(e){let t=e?w(e):null;return t?I({issue_statuses:t.issueStatuses},t.tracker):I(p().overrides??{},g())}a(L,"issueStatuses");function N(e,t){let o=new Set([e.status,...e.labels??[]].flatMap(s=>s?[s.trim().toLowerCase()]:[])),n=a(s=>{let r=t[s];return r!==null&&o.has(r.toLowerCase())},"is");return e.statusCategory==="done"||n("done")?4:n("merged")?3:n("in_review")?2:n("in_progress")||e.statusCategory==="indeterminate"?1:0}a(N,"issuePosition");async function T(e,t,o,n,s){let r=n[o];try{if(r===null)return s.alwaysComment?(await e.updateIssue(t,{comment:s.comment}),`${t} commented (no ${o} status configured)`):"";let i=[],u=await e.fetchIssue(t,i)??await e.fetchIssue(t,i);if(!u)return`${t} not moved to "${r}": could not read its current status (${[...new Set(i)].join("; ")||"no reason given"}); move it by hand: werkmeister issue update ${t} --status ${JSON.stringify(r)} --comment ${JSON.stringify(s.comment)}`;let m=N(u,n);if(!(O[o]>m||s.back&&m>=2&&m<4)){s.alwaysComment&&await e.updateIssue(t,{comment:s.comment});let l=u.labels?.find(v=>b.some(j=>n[j]?.toLowerCase()===v.toLowerCase()));return`${t} already ${u.status??"past that"}${l?` (${l})`:""}`}return await e.updateIssue(t,{status:r,comment:s.comment}),`${t} \u2192 ${r}`}catch(i){return`${t} not moved to "${r??o}": ${i.message}`}}a(T,"moveIssue");function k(e){let t;try{t=d.readdirSync(c.join(e,"stages")).filter(n=>/^\d+_/.test(n)).sort()}catch{return"research phase"}return`stage ${t.find(n=>{try{return!d.readdirSync(c.join(e,"stages",n,"output")).some(s=>!s.startsWith("."))}catch{return!0}})??t[0]??"01"}`}a(k,"currentStage");async function D(e,t,o){let n=y(e,null),s=$(n);if(!s.length)return"no issue";let r=`Work started: ${k(e)} in workspace ${c.basename(e)}.`;return A(s,i=>{let u={project:h(n),text:i};return T(t??_(u),i,"in_progress",o??L(u),{comment:r})})}a(D,"startIssue");async function A(e,t){let o=[];for(let n of e)o.push(await t(n));return o.filter(Boolean).join("; ")}a(A,"eachIssue");export{L as a,T as b,D as c,A as d};
|
|
4
|
+
//# sourceMappingURL=chunk-42KX6W6Q.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-
|
|
3
|
+
import{f as C}from"./chunk-GKTFYMRL.js";import{K as S,L as _,M,O as y,X as w,j as g,l as x}from"./chunk-TDV4CAHE.js";import{a,f as b}from"./chunk-P23WL5LM.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-
|
|
18
|
+
//# sourceMappingURL=chunk-4JTHKDHS.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}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as s}from"./chunk-AFNK4WFP.js";import{a as e,e as o,f as i}from"./chunk-P23WL5LM.js";i();var r=o(s(),1);function p(n){if(n)try{return r.default.parse(n).type}catch{let t=(n.split(";",1)[0]??"").trim().toLowerCase();return t===""||n.slice(t.length).includes(",")?void 0:t}}e(p,"mediaTypeEssence");function u(n){return n==="application/json"?!0:p(n)==="application/json"}e(u,"isJsonContentType");export{p as a,u as b};
|
|
4
|
+
//# sourceMappingURL=chunk-4QHEHBQ5.js.map
|