werkmeister 0.95.5 → 0.96.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.
- package/dist/{budget-7QMJAY27.js → budget-DW2Y7WYY.js} +2 -2
- package/dist/{cache-6FJH5GTO.js → cache-H5P25RQ7.js} +2 -2
- package/dist/{chunk-VF7TWW76.js → chunk-25MRYFFW.js} +2 -2
- package/dist/{chunk-MWMW72D4.js → chunk-2CIUCBFA.js} +2 -2
- package/dist/{chunk-TIKJDY23.js → chunk-2LHQYEXB.js} +2 -2
- package/dist/{chunk-Q7MGFSWB.js → chunk-2NTZWY2A.js} +2 -2
- package/dist/{chunk-MP2CZT6N.js → chunk-2SMQ3CDZ.js} +2 -2
- package/dist/{chunk-AJ6ECKRK.js → chunk-2TKJV5JW.js} +2 -2
- package/dist/{chunk-IY7NXCD3.js → chunk-35Y6EQE6.js} +2 -2
- package/dist/{chunk-CV3MBQYV.js → chunk-3MEUJG4H.js} +2 -2
- package/dist/{chunk-QMOXBUEH.js → chunk-55WCJC53.js} +2 -2
- package/dist/{chunk-52Y6C7EC.js → chunk-5BNRA2MK.js} +2 -2
- package/dist/{chunk-6LPDAIV7.js → chunk-5M4EAVKV.js} +2 -2
- package/dist/{chunk-Q2RHQZ2Z.js → chunk-5QLVIFRQ.js} +2 -2
- package/dist/{chunk-YGBFRPCB.js → chunk-62BDVGLP.js} +2 -2
- package/dist/{chunk-VJPJJVR6.js → chunk-6T2HOUPV.js} +3 -3
- package/dist/{chunk-ZGMZ47OW.js → chunk-6XL774M4.js} +2 -2
- package/dist/{chunk-G57NXNLB.js → chunk-7D2QNHBK.js} +2 -2
- package/dist/{chunk-6RKTIHJH.js → chunk-7HM7A2HL.js} +2 -2
- package/dist/{chunk-RENA5E4C.js → chunk-AAMYRAFF.js} +2 -2
- package/dist/{chunk-L2XZIPYC.js → chunk-B44FCMJX.js} +2 -2
- package/dist/{chunk-YJCNNW6X.js → chunk-CNP6VFLZ.js} +2 -2
- package/dist/{chunk-P6UYMTFV.js → chunk-D67RVE7Q.js} +2 -2
- package/dist/{chunk-JIHDEY4U.js → chunk-DTUKOQDL.js} +2 -2
- package/dist/{chunk-YTPRD2G3.js → chunk-DZO5ZKCO.js} +3 -3
- package/dist/{chunk-JSNFM5SA.js → chunk-EKEKMPTG.js} +2 -2
- package/dist/{chunk-FNJZGJOU.js → chunk-FQELUU4C.js} +15 -15
- package/dist/{chunk-G5WNKEKG.js → chunk-GSLIPL73.js} +2 -2
- package/dist/{chunk-CCSXOMF5.js → chunk-IJG3YOML.js} +2 -2
- package/dist/{chunk-DGG7JPGH.js → chunk-J5IWCUTH.js} +2 -2
- package/dist/{chunk-PSCJ3SWB.js → chunk-J5LK36ZJ.js} +2 -2
- package/dist/{chunk-PMEKXTPT.js → chunk-JSTU5ALW.js} +3 -3
- package/dist/chunk-JYAFAFPT.js +7 -0
- package/dist/{chunk-QRLKSWRJ.js → chunk-K6FGY23J.js} +2 -2
- package/dist/{chunk-UL3IU4YD.js → chunk-KO7ZCJA6.js} +18 -18
- package/dist/{chunk-VBBVS6Z5.js → chunk-KWVN6AXJ.js} +2 -2
- package/dist/{chunk-SO6GBFEQ.js → chunk-LUKDMMUT.js} +2 -2
- package/dist/{chunk-HIQNZTEC.js → chunk-MGO5ILWR.js} +2 -2
- package/dist/{chunk-NUBPMPJQ.js → chunk-ND5QNCDE.js} +2 -2
- package/dist/{chunk-UCR6E6PI.js → chunk-NPACNGMM.js} +2 -2
- package/dist/{chunk-YCABJ5LH.js → chunk-NTNAK4RW.js} +2 -2
- package/dist/{chunk-L5BOEZQG.js → chunk-OXL76PIX.js} +2 -2
- package/dist/{chunk-OPY2MU5Q.js → chunk-PQFK6ZTZ.js} +2 -2
- package/dist/{chunk-223CMO5U.js → chunk-Q2DILRP5.js} +2 -2
- package/dist/{chunk-QJFOYBSB.js → chunk-Q7OFZU5T.js} +2 -2
- package/dist/{chunk-3LUDGYTS.js → chunk-QRZKPUJI.js} +2 -2
- package/dist/chunk-QUQNQUL5.js +146 -0
- package/dist/{chunk-HXS63TFM.js → chunk-QVILP4AA.js} +2 -2
- package/dist/{chunk-Y4NGEJA2.js → chunk-QYF432KY.js} +2 -2
- package/dist/{chunk-CQPW6RED.js → chunk-QYIC3OW2.js} +2 -2
- package/dist/chunk-R5MLCHSR.js +4 -0
- package/dist/{chunk-PAA3VRIJ.js → chunk-RF7MR7AD.js} +2 -2
- package/dist/{chunk-SMICQ3K4.js → chunk-RK67KSPW.js} +2 -2
- package/dist/{chunk-XWAMXZRV.js → chunk-RWLYRSF4.js} +2 -2
- package/dist/{chunk-MZ6A6O26.js → chunk-SANH53TN.js} +2 -2
- package/dist/{chunk-HLOD3DMR.js → chunk-TAKWRVPR.js} +2 -2
- package/dist/{chunk-4W67Z5S7.js → chunk-UBYOA4M7.js} +3 -3
- package/dist/{chunk-VPAJKNSR.js → chunk-UNFLH5RR.js} +2 -2
- package/dist/{chunk-WPYBJWOM.js → chunk-URX2FTQA.js} +2 -2
- package/dist/{chunk-5MOLNCIE.js → chunk-UY3DQ5DD.js} +2 -2
- package/dist/{chunk-YDC6EP5F.js → chunk-VG2SME7A.js} +2 -2
- package/dist/{chunk-ZEK7CNH2.js → chunk-VISVCRGS.js} +2 -2
- package/dist/{chunk-ZYHBPDSY.js → chunk-WGN2FAV3.js} +2 -2
- package/dist/{chunk-WKJFWAES.js → chunk-X373B5J4.js} +2 -2
- package/dist/{chunk-3KZRHSUL.js → chunk-XL3D3JRM.js} +2 -2
- package/dist/{chunk-QLQFJNZY.js → chunk-ZNMAMF6W.js} +2 -2
- package/dist/{chunk-HRQCKPHM.js → chunk-ZZP6MSAL.js} +2 -2
- package/dist/clean-OMGZSJ34.js +8 -0
- package/dist/close_out-GXL52GO6.js +8 -0
- package/dist/code-FKDZNYDL.js +4 -0
- package/dist/{config-IDCZTEIJ.js → config-SNDBE45B.js} +2 -2
- package/dist/{connect-CKUIB3RO.js → connect-J3MEX2Y6.js} +2 -2
- package/dist/{daemon-LZ36WF6W.js → daemon-AVGXNM24.js} +2 -2
- package/dist/dashboard.js +1 -1
- package/dist/{detect-TCXAIFRE.js → detect-6M5KKNSX.js} +2 -2
- package/dist/{down-37JIXHAH.js → down-R75CKBOV.js} +3 -3
- package/dist/{fixture-JYGHKZ7I.js → fixture-RCLAGVKG.js} +2 -2
- package/dist/form-cli.js +1 -1
- package/dist/hooks-XHKBASTW.js +4 -0
- package/dist/{hooks_gen-FGJD435F.js → hooks_gen-A46U3E66.js} +2 -2
- package/dist/infra-4NWXBS6L.js +4 -0
- package/dist/init_workspace-HDVYV2YI.js +4 -0
- package/dist/{intercept-VKGXPKZA.js → intercept-4GDG6VBI.js} +2 -2
- package/dist/{issue-JDSDMIDT.js → issue-PFCVM353.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-N55ZI7BB.js +7 -0
- package/dist/logs-6XNP5LCC.js +6 -0
- package/dist/main.js +3 -3
- package/dist/mcp-proxy.js +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{migrate-OOZFLP7O.js → migrate-T5NXPXIK.js} +2 -2
- package/dist/notes-ICUJSIFX.js +4 -0
- package/dist/{open-TDDNA5LT.js → open-HFFDSWSS.js} +2 -2
- package/dist/{optimize-AVR6I4R2.js → optimize-U6DWQOZF.js} +2 -2
- package/dist/pause-KKOQ34ZK.js +4 -0
- package/dist/pr-VX76WASY.js +5 -0
- package/dist/proxy_reload-3Z5NLQNC.js +6 -0
- package/dist/{registry-INEN3LNE.js → registry-6RHTVCV5.js} +2 -2
- package/dist/remove-563HV4FS.js +7 -0
- package/dist/remove_workspace-5KT4KD2N.js +8 -0
- package/dist/restart-ZINXQ7M2.js +8 -0
- package/dist/resume-NRY4APBC.js +8 -0
- package/dist/{safari-ZSXY2CH4.js → safari-DGXGNNIU.js} +2 -2
- package/dist/{sandbox-IDX23YKB.js → sandbox-EDV5XJS4.js} +2 -2
- package/dist/{services-UUYWPVQ7.js → services-PK567T5X.js} +2 -2
- package/dist/{setup-XM77NBXR.js → setup-6M2MT3SM.js} +2 -2
- package/dist/skills-5SM3XYOB.js +4 -0
- package/dist/{slots-KUWYDTDQ.js → slots-762WJZOD.js} +2 -2
- package/dist/{standards-SYF4D42X.js → standards-L6ERAXVG.js} +2 -2
- package/dist/start_args-VQUXYY4Q.js +4 -0
- package/dist/starting_prompt-QTKPBJTW.js +4 -0
- package/dist/stats-QMRQKMRH.js +4 -0
- package/dist/{status-QFZKVFSZ.js → status-OCFQHLMX.js} +2 -2
- package/dist/{stop-7LEQTCYS.js → stop-K2VFRW42.js} +2 -2
- package/dist/{telepresence-YLBDTTFG.js → telepresence-SAISPRXG.js} +2 -2
- package/dist/{test-4CSCD3RJ.js → test-YGUXA4S5.js} +2 -2
- package/dist/{tokens-F5H26X2Q.js → tokens-6GOSW4KY.js} +2 -2
- package/dist/{up-KR7KAKDB.js → up-KTAQEFRR.js} +3 -3
- package/dist/{v4-ENQCN57P.js → v4-SILAYA2E.js} +2 -2
- package/dist/wait_load-HLLNRMH2.js +4 -0
- package/dist/werkmeister-workspaces.vsix +0 -0
- package/dist/{workspace-INIEF4AK.js → workspace-SPVY7DFX.js} +2 -2
- package/package.json +5 -5
- package/dist/chunk-GEUGFGJA.js +0 -146
- package/dist/chunk-JEHUZ4DV.js +0 -4
- package/dist/chunk-LLWWJL42.js +0 -7
- package/dist/clean-YBPUXQA4.js +0 -8
- package/dist/close_out-KAHC5NV6.js +0 -8
- package/dist/code-TC7BHEZL.js +0 -4
- package/dist/hooks-4IQGV4IT.js +0 -4
- package/dist/infra-D5LESD2I.js +0 -4
- package/dist/init_workspace-KZPADTJE.js +0 -4
- package/dist/list_workspaces-T7BIK7MW.js +0 -7
- package/dist/logs-NDGGTM3X.js +0 -6
- package/dist/notes-JP7GTQDA.js +0 -4
- package/dist/pause-ZKW3ZJZM.js +0 -4
- package/dist/pr-46E2WKHC.js +0 -5
- package/dist/proxy_reload-7UND7FKV.js +0 -6
- package/dist/remove-4LJFYLJS.js +0 -7
- package/dist/remove_workspace-IZ7Z33YC.js +0 -8
- package/dist/restart-CRVRU2ZB.js +0 -8
- package/dist/resume-6PFI6TWA.js +0 -8
- package/dist/skills-EBCEFYYB.js +0 -4
- package/dist/start_args-6X7FPR7L.js +0 -4
- package/dist/starting_prompt-6BFTAJIT.js +0 -4
- package/dist/stats-2OUOYH33.js +0 -4
- package/dist/wait_load-TMGIEADE.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{e as x,n as L}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=budget-
|
|
3
|
+
import{e as x,n as L}from"./chunk-6T2HOUPV.js";import"./chunk-3MEUJG4H.js";import"./chunk-RK67KSPW.js";import"./chunk-D67RVE7Q.js";import"./chunk-OXL76PIX.js";import"./chunk-DTUKOQDL.js";import"./chunk-QUQNQUL5.js";import"./chunk-QRZKPUJI.js";import"./chunk-KO7ZCJA6.js";import"./chunk-NPACNGMM.js";import"./chunk-MGO5ILWR.js";import"./chunk-2CIUCBFA.js";import"./chunk-ND5QNCDE.js";import"./chunk-5BNRA2MK.js";import"./chunk-DZO5ZKCO.js";import"./chunk-QVILP4AA.js";import"./chunk-7HM7A2HL.js";import"./chunk-VG2SME7A.js";import{C as b,D as y,J as w,M as k,R as v,v as g,w as $,x as h}from"./chunk-J5LK36ZJ.js";import"./chunk-RWLYRSF4.js";import"./chunk-J5IWCUTH.js";import"./chunk-JYAFAFPT.js";import"./chunk-7D2QNHBK.js";import{p as f}from"./chunk-UNFLH5RR.js";import"./chunk-ZZP6MSAL.js";import"./chunk-2LHQYEXB.js";import"./chunk-2NTZWY2A.js";import"./chunk-PQFK6ZTZ.js";import"./chunk-25MRYFFW.js";import"./chunk-RF7MR7AD.js";import"./chunk-5QLVIFRQ.js";import{a as i,f as p}from"./chunk-LUKDMMUT.js";p();import O from"node:os";var S=2**30,M=i((n,t)=>Number.isFinite(n)?`${Number(n.toFixed(1))}${t}`:"no limit","limit");function P(n,t=process.platform){return n?`host load limit ${n}${t==="darwin"?" (not enforced on macOS)":""}`:"host load limit off"}i(P,"hostLoadText");async function T(n){let t=await b(),l=y(O.availableParallelism()),c=h(),m=await v(),r=L(),u=g(k(m,r??[])).map((e,o)=>{let s=c[e.feature]?.workspace,a=s&&f(s)?.services||null,N=s?w(s,a??void 0):null,B=o===0&&e.waitedMs>=3e5&&!e.parked&&$(t,r??[],e);return{...e,position:o+1,services:a,cost:N,holds:B}});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:l,leases:c,waiting:m,running:r?.map(o=>({feature:o.feature,cpus:o.cost.cpus,memory:o.cost.memory,rank:o.rank,busy:o.busy}))??null,waiters:u.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: ${M(t.memory/S," GiB")} memory, ${M(t.cpus," CPUs")}, ${P(l)}, preemption ${t.preempt?"on":"off"}`);let d=Object.entries(c).sort(([,e],[,o])=>e.slot-o.slot);console.log(d.length?"Slots:":"Slots: none held");for(let[e,o]of d)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(u.length?"Waiting:":"Waiting: none");for(let e of u){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/S).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{P as hostLoadText,T as run};
|
|
4
|
+
//# sourceMappingURL=budget-DW2Y7WYY.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-R5MLCHSR.js";import{d as s}from"./chunk-NPACNGMM.js";import"./chunk-5BNRA2MK.js";import"./chunk-RWLYRSF4.js";import"./chunk-JYAFAFPT.js";import"./chunk-25MRYFFW.js";import{h as e,l as c}from"./chunk-RF7MR7AD.js";import"./chunk-5QLVIFRQ.js";import{a as r,f as i}from"./chunk-LUKDMMUT.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-H5P25RQ7.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{a as e,f as r}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as e,f as r}from"./chunk-LUKDMMUT.js";r();var p="WORKSPACE",t=class extends Error{static{e(this,"SandboxError")}code;constructor(s,n){super(s),this.code=n,this.name="SandboxError"}},o=class extends t{static{e(this,"WorkspaceError")}constructor(s){super(s,p),this.name="WorkspaceError"}};export{p as a,t as b,o as c};
|
|
4
|
+
//# sourceMappingURL=chunk-25MRYFFW.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{h as H}from"./chunk-
|
|
3
|
+
import{h as H}from"./chunk-ND5QNCDE.js";import{r as B}from"./chunk-PQFK6ZTZ.js";import{C as G,G as A,a as ne,l as K,w as U,y as W,z as D}from"./chunk-RF7MR7AD.js";import{a as Y}from"./chunk-5QLVIFRQ.js";import{a as c,e as se,f as R}from"./chunk-LUKDMMUT.js";R();var v=se(ne(),1);import*as p from"node:fs";import*as V from"node:os";import*as k from"node:path";R();import*as _ from"node:fs";import*as X from"node:path";var ue=`# Port Allocation Scheme
|
|
4
4
|
# Each feature slot (1-12) gets a dedicated port range.
|
|
5
5
|
#
|
|
6
6
|
# k8s port-forward listen-ports (the 9000-range) are NOT defined here \u2014 they
|
|
@@ -68,4 +68,4 @@ to its path in \`~/.werkmeister/config.yaml\`. \`machine setup\` writes this
|
|
|
68
68
|
file only when it is missing and never overwrites it.
|
|
69
69
|
`,L={archetypes:{"node-web":{standards:["ui","config","testing"],mcp_servers:["context7"],test:"npm test"},"node-service":{standards:["service","testing"],test:"npm test"},"node-tool":{standards:["engineering","testing"],validate:"Library: run the unit/smoke tests. No URL, cookie, or Caddy step applies."},"mcp-client":{standards:["engineering","testing"],validate:"Build, then npm run test:integration (Extension Development Host via @vscode/test-cli). Walk the open items in MANUAL-CHECKLIST.md for anything visual."}},caches:{"pnpm-store":{path:"/pnpm-store",env:{npm_config_store_dir:"/pnpm-store"},detect:["pnpm-lock.yaml"]},turbo:{path:"/turbo-cache",env:{TURBO_CACHE_DIR:"/turbo-cache",TURBO_CACHE_MAX_AGE:"14d"},detect:["turbo.json"],max_age:"14d"}},mcp_servers:{context7:{type:"stdio",command:"npx",args:["-y","@upstash/context7-mcp"],env:{CONTEXT7_API_KEY:"${CONTEXT7_API_KEY:-}"}},werkmeister:{type:"http",url:"http://host.docker.internal:${WERKMEISTER_MCP_PORT:-3002}/mcp",headers:{Authorization:"Bearer ${WERKMEISTER_MCP_TOKEN}"}}}};var j=k.join(Y,"services.yaml");function I(e){let n=k.join(e,j);return p.existsSync(n)?n:null}c(I,"fragmentPath");var ie="# GENERATED by `werkmeister registry sync` \u2014 do not edit.",M=c(e=>e.startsWith("# GENERATED by "),"isGenerated"),x=["services","setup_services","infrastructure","caches"],ae=["archetypes","caches","mcp_servers","k8s_context","services","infrastructure","setup_services","repos"],y=class extends Error{static{c(this,"RegistryError")}};function m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}c(m,"isDict");function q(e){if(!p.existsSync(e))return[];let n=[];for(let r of p.readdirSync(e).sort()){let s=I(k.join(e,r));s&&(p.statSync(k.join(e,r,".git"),{throwIfNoEntry:!1})?.isFile()||n.push(N(r,s)))}return n}c(q,"discoverFragments");function N(e,n){let r;try{r=(0,v.parse)(p.readFileSync(n,"utf8"))}catch(s){throw new y(`${n}: ${s instanceof Error?s.message:String(s)}`)}return{repo:e,path:n,doc:m(r)?r:{}}}c(N,"readFragment");var ce=/\{\{\s*(home|repos_root|workspaces_root|werkmeister_home|local_domain)\s*\}\}/g;function F(e,n){if(typeof e=="string")return e.replace(ce,(r,s)=>n[s]);if(Array.isArray(e))return e.map(r=>F(r,n));if(m(e)){let r={};for(let[s,o]of Object.entries(e))r[s]=F(o,n);return r}return e}c(F,"expandPlaceholders");function Q(e,n){let r={...e};for(let[s,o]of Object.entries(n))r[s]=m(o)&&m(r[s])?Q(r[s],o):o;return r}c(Q,"deepMerge");function C(e,n,r,s){let o=e.get(n);if(o!==void 0&&o!==r)throw new y(`${s} is defined by both ${o} and ${r}`);e.set(n,r)}c(C,"claim");function Z(e,n){let r={archetypes:structuredClone(n.defaults.archetypes??{}),caches:structuredClone(n.defaults.caches??{}),mcp_servers:structuredClone(n.defaults.mcp_servers??{}),services:{},infrastructure:{},setup_services:{},repos:{}},s=new Map;for(let o of Object.keys(r.caches))s.set(`caches/${o}`,"werkmeister");for(let o of e){let i=F(o.doc,n.paths);for(let t of Object.keys(i))if(!(t.startsWith("x-")||t==="repo"||x.includes(t)))throw new y(`${o.path}: unexpected top-level key \`${t}\` \u2014 a fragment may only contain ${x.join(", ")}, repo (and x-* anchor blocks)`);if(i.repo!==void 0){if(!m(i.repo))throw new y(`${o.path}: \`repo:\` must be a map`);Object.assign(r.repos[o.repo]??={services:[],path_mappings:{}},i.repo)}for(let t of x){let l=i[t]??{};if(!m(l))throw new y(`${o.path}: \`${t}:\` must be a map`);for(let[f,a]of Object.entries(l)){if(!m(a))throw new y(`${o.path}: \`${t}.${f}\` must be a map`);C(s,`${t}/${f}`,o.repo,`${t}.${f}`);let d=a;if(t==="services"||t==="setup_services"){if(a.repo!==void 0&&a.repo!==o.repo)throw new y(`${o.path}: ${t}.${f} says repo: ${a.repo} but lives in ${o.repo}`);d={repo:o.repo,...a}}if(t==="services"){d.port_offset!==void 0&&C(s,`port_offset/${d.port_offset}`,`${o.repo}:${f}`,`port_offset ${d.port_offset}`);let w=r.repos[o.repo]??={services:[],path_mappings:{}};w.services.push(f);let g=String(d.path??".").replace(/^\/+|\/+$/g,"");g!==""&&g!=="."&&(w.path_mappings[g]=f)}(t==="services"||t==="infrastructure")&&d.k8s_forward_port!==void 0&&C(s,`k8s_forward_port/${d.k8s_forward_port}`,`${o.repo}:${f}`,`k8s_forward_port ${d.k8s_forward_port}`),r[t][f]=d}}}return Q(r,n.local)}c(Z,"mergeRegistry");var $="disabled_fragments";function ee(e,n,r){let{[$]:s,...o}=n,i=s??[];if(!Array.isArray(i)||!i.every(a=>typeof a=="string"))throw new y(`${r}: ${$} must be a list of repo names`);let t=new Set(i),l=e.filter(a=>t.has(a.repo)),f=structuredClone(o);for(let a of["services","setup_services","infrastructure"]){let d=f[a];if(m(d))for(let[w,g]of Object.entries(d))(l.some(E=>m(E.doc[a])&&w in E.doc[a])||m(g)&&t.has(g.repo))&&delete d[w]}if(m(f.repos))for(let a of t)delete f.repos[a];return{fragments:e.filter(a=>!t.has(a.repo)),skipped:l,unknown:i.filter(a=>!e.some(d=>d.repo===a)),local:f}}c(ee,"applyDisabled");function fe(e,n,r,s=[]){let o={};for(let t of ae)t in e&&(o[t]=e[t]);for(let t of Object.keys(e))t in o||(o[t]=e[t]);return[ie,"# Edit a repo's .werkmeister/services.yaml fragment, or the machine overrides file, then","# run `werkmeister registry sync` (or `werkmeister machine setup`). Regenerated from:",...n.map(t=>`# Source: ${t}`),...s.map(t=>`# Disabled: ${t}`),`# Machine overrides: ${r}`,""].join(`
|
|
70
70
|
`)+(0,v.stringify)(o,{lineWidth:0})}c(fe,"renderRegistry");function de(e){if(!p.existsSync(e))return null;let n=p.readFileSync(e,"utf8");if(M(n))return null;try{let r=(0,v.parse)(n),s=m(r)?r.k8s_context:void 0;return typeof s=="string"&&s.trim()?s.trim():null}catch{return null}}c(de,"inheritedK8sContext");function pe(e,n){let r;try{r=(0,v.parse)(e)}catch{return[]}if(!m(r))return[];let s=[];for(let o of x){let i=r[o];if(m(i))for(let t of Object.keys(i))t in(n[o]??{})||s.push(`${o}.${t}`)}return s}c(pe,"orphanedEntries");function Se(e,n){let r=c(t=>{try{let l=t===null?null:(0,v.parse)(t);return m(l)?l:{}}catch{return{}}},"sections"),s=r(e),o=r(n),i={added:[],removed:[],changed:[]};for(let t of x){let l=m(s[t])?s[t]:{},f=m(o[t])?o[t]:{};for(let a of new Set([...Object.keys(l),...Object.keys(f)])){let d=`${t}.${a}`;a in l?a in f?JSON.stringify(l[a])!==JSON.stringify(f[a])&&i.changed.push(d):i.removed.push(d):i.added.push(d)}}for(let t of Object.values(i))t.sort();return i}c(Se,"registryChanges");function te(){return{home:V.homedir(),repos_root:A(),workspaces_root:G(),werkmeister_home:U(),local_domain:B().local_domain}}c(te,"placeholderPaths");function re(e){if(!p.existsSync(e))return{};let n;try{n=(0,v.parse)(p.readFileSync(e,"utf8"))}catch(r){throw new y(`${e}: ${r instanceof Error?r.message:String(r)}`)}if(n==null)return{};if(!m(n))throw new y(`${e}: must be a map of registry keys`);return n}c(re,"readLocalOverlay");function le(e,n,r=A()){let s=I(n);if(!s)return null;let o=q(r).filter(a=>a.repo!==e);o.push(N(e,s));let i=D(),t=re(i),l=t[$];Array.isArray(l)&&(t[$]=l.filter(a=>a!==e));let f=ee(o,t,i);return Z(f.fragments,{defaults:L,local:f.local,paths:te()})}c(le,"branchRegistry");function xe(e,n){let r={...e};for(let s of H(n)){let o=k.basename(s),i;try{i=le(o,s)}catch(t){K(`${o}: branch fragment ignored: ${t instanceof Error?t.message:String(t)}`);continue}for(let[t,l]of Object.entries(i?.services??{}))l.repo===o&&(r[t]=l)}return r}c(xe,"workspaceServices");function Re(e={}){let n="config services.yaml",r=e.reposRoot??A(),s=e.target??W(),o=D();if(e.generatedOnly&&p.existsSync(s)&&!M(p.readFileSync(s,"utf8")))return[{label:n,ok:!1,detail:`${s} is hand-written \u2014 left as is; \`werkmeister registry sync\` converts it (with a backup)`}];let i,t,l,f="";try{if(!e.checkOnly&&!e.target&&!p.existsSync(o)){let h=de(s)??"orbstack";z(o,J(h)),f=`; seeded ${o} (k8s_context: ${h} \u2014 edit there)`}let u=q(r);if(u.length===0)return[{label:n,ok:!1,detail:`no ${j} found under ${r} \u2014 clone your team's repos there and re-run \`werkmeister machine setup\` (or answer yes to the demo apps)`}];let S=re(o);if(e.from){let h=I(e.from);if(!h)return[{label:n,ok:!1,detail:`no ${j} in ${e.from}`}];let O=k.basename(e.from);u=[...u.filter(T=>T.repo!==O),N(O,h)];let P=S[$];Array.isArray(P)&&(S[$]=P.filter(T=>T!==O))}i=ee(u,S,o),t=Z(i.fragments,{defaults:L,local:i.local,paths:te()}),l=fe(t,i.fragments.map(h=>h.path),o,i.skipped.map(h=>h.path))}catch(u){return[{label:n,ok:!1,detail:u instanceof Error?u.message:String(u)}]}let a=[...i.skipped.map(u=>({label:`fragment ${u.repo}`,ok:!0,detail:`disabled in ${o} \u2014 skipped`})),...i.unknown.map(u=>({label:`fragment ${u}`,ok:!0,detail:`listed in ${$} in ${o}, but no fragment under ${r}`}))],d=c(u=>[u,...a],"report"),w=i.fragments.length,g=`${w} fragment${w===1?"":"s"}`,b=p.existsSync(s)?p.readFileSync(s,"utf8"):null;if(b===l)return d({label:n,ok:!0,detail:`up to date (${g}) at ${s}${f}`});if(e.checkOnly)return d({label:n,ok:!1,detail:b===null?`missing \u2014 would generate ${s} from ${g}`:`drift \u2014 would regenerate ${s} from ${g}`});let E="";if(b!==null&&!M(b)){let u=Math.floor((e.now??Date.now)()/1e3),S=`${s}.bak-${u}`;p.copyFileSync(s,S),E=`; hand-written registry backed up to ${S}`;let h=pe(b,t);h.length&&(E+=`; not in any fragment: ${h.join(", ")}`)}try{p.mkdirSync(k.dirname(s),{recursive:!0}),p.writeFileSync(s,l)}catch(u){return d({label:n,ok:!1,detail:`could not write ${s}: ${u}`})}return d({label:n,ok:!0,detail:`generated ${s} from ${g}${E}${f}`})}c(Re,"syncRegistry");export{ue as a,me as b,he as c,J as d,z as e,ye as f,j as g,y as h,q as i,Z as j,de as k,Se as l,le as m,xe as n,Re as o};
|
|
71
|
-
//# sourceMappingURL=chunk-
|
|
71
|
+
//# sourceMappingURL=chunk-2CIUCBFA.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{b as O}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{b as O}from"./chunk-2NTZWY2A.js";import{n as N}from"./chunk-PQFK6ZTZ.js";import{b as d}from"./chunk-25MRYFFW.js";import{l as x,s as l,w as g}from"./chunk-RF7MR7AD.js";import{a as n,f as T}from"./chunk-LUKDMMUT.js";T();import*as c from"node:fs";import*as i from"node:path";var M=3002;function P(){let t=l("MCP_PORT")||N().overrides?.mcp_port,e=Number(t);return Number.isInteger(e)&&e>0?e:M}n(P,"daemonPort");function w(){return(l("HOST")||`http://127.0.0.1:${P()}`).replace(/\/+$/,"")}n(w,"daemonUrl");function S(t){try{return c.readFileSync(t,"utf8").trim()||null}catch{return null}}n(S,"readToken");function H(t){return l("MCP_TOKEN")||(t?S(O(t)):null)||S(i.join(g(),"mcp-token"))}n(H,"daemonToken");var m=class extends d{static{n(this,"DaemonUnavailable")}constructor(e){super(`werkmeister daemon not reachable at ${w()} (${e}). Run \`werkmeister machine setup\` (macOS) or \`werkmeister infra connect\`.`,"DAEMON_DOWN")}};function $(t){let e=t===void 0?H():t;return e?{Authorization:`Bearer ${e}`}:{}}n($,"headers");var p=class extends d{static{n(this,"DaemonTimeout")}constructor(e){super(`werkmeister daemon at ${w()} took the call but did not answer in time (${e}); it may still be running it.`,"DAEMON_TIMEOUT")}},b={ECONNREFUSED:"ECONNREFUSED: nothing is listening, the daemon is not running",ECONNRESET:"ECONNRESET: the daemon reset the connection while exiting or restarting"},U=n(()=>Number(l("DAEMON_RETRY_MS"))||15e3,"restartGapMs"),E=!1,I=n(t=>t==="TimeoutError"||t.startsWith("UND_ERR_")&&t!=="UND_ERR_CONNECT_TIMEOUT","tookTheCall"),y=n(t=>{let e=t;return e.cause?.code??e.name},"codeOf");async function R(t,e,r=!0){let s=Date.now()+(E?0:U());for(;;)try{let a=await fetch(t,e);return r&&(E=!1),a}catch(a){let o=y(a);if(I(o))throw new p(o);if(!(o in b))throw new m(o);if(!r||Date.now()>=s)throw r&&(E=!0),new m(b[o]);await new Promise(f=>setTimeout(f,500))}}n(R,"send");var A="x-werkmeister-build",_="x-werkmeister-stream",Z="x-werkmeister-launcher",q="x-werkmeister-client-ui";function z(t){if(!t)return null;try{let e=c.statSync(t).mtime.toISOString().replace(/\.\d+Z$/,"Z");for(let r=i.dirname(t);;r=i.dirname(r)){let s=i.join(r,"package.json");if(c.existsSync(s))return`${JSON.parse(c.readFileSync(s,"utf8")).version} @ ${e}`;if(i.dirname(r)===r)return null}}catch{return null}}n(z,"buildOf");var C=null,k=!1;function K(t){C=t}n(K,"expectDaemonBuild");function L(){try{return C?.()??null}catch{return null}}n(L,"buildToSend");function j(t,e){let r=e.headers.get(A);k||!t||!r||r===t||(k=!0,x(`The werkmeister daemon runs an older build (loaded ${r}, on disk ${t}); it restarts by itself once idle, or run \`werkmeister daemon restart\`.`))}n(j,"checkBuild");async function V(){try{let t=await R(`${w()}/api/status`,{headers:$(void 0),signal:AbortSignal.timeout(5e3)},!1);return t.ok?await t.json():null}catch{return null}}n(V,"daemonStatus");async function Y(t,e={},r={}){let s=AbortSignal.timeout(r.timeoutMs??12e4),a=L(),o=await R(`${w()}/api/tool`,{method:"POST",headers:{"Content-Type":"application/json",...$(r.token),...a?{[A]:a}:{},[_]:"1"},body:JSON.stringify({name:t,arguments:e}),signal:r.signal?AbortSignal.any([r.signal,s]):s});if(j(a,o),!o.headers.get("content-type")?.includes("json")&&o.status!==401&&o.status!==403)throw new m(`HTTP ${o.status}: the port is held by something that is not the werkmeister daemon`);let f=o.headers.get(_)==="1",u=await o.json().catch(D=>{if(f)throw new p(y(D));return{}}),h=f?u.status??500:o.status;if(h<200||h>299)throw u.error?.replace(/^MCP error -?\d+: /,"")===`Tool ${t} not found`?new d(`The werkmeister daemon is older than this CLI: it has no \`${t}\` tool. Run \`werkmeister daemon restart\`.`,"DAEMON_STALE"):new d(u.error??`daemon answered HTTP ${h} to ${t}`,u.code??`HTTP_${h}`);return{data:u.structuredContent,text:u.text??""}}n(Y,"callTool");export{M as a,P as b,w as c,H as d,m as e,A as f,_ as g,Z as h,q as i,z as j,K as k,V as l,Y as m};
|
|
4
|
+
//# sourceMappingURL=chunk-2LHQYEXB.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{w as p}from"./chunk-
|
|
3
|
+
import{w as p}from"./chunk-RF7MR7AD.js";import{b as m}from"./chunk-5QLVIFRQ.js";import{a as n,f as a}from"./chunk-LUKDMMUT.js";a();import{randomBytes as u}from"node:crypto";import*as r from"node:fs";import*as o from"node:path";var h="token";function f(){return o.join(p(),"tokens")}n(f,"tokensDir");function l(e){return o.join(m(e),h)}n(l,"workspaceTokenFile");function F(e,s){let i=o.join(f(),e),t="";try{t=r.readFileSync(i,"utf8").trim()}catch{}t||=u(32).toString("hex");for(let c of[i,l(s)])r.mkdirSync(o.dirname(c),{recursive:!0}),r.writeFileSync(c,`${t}
|
|
4
4
|
`,{mode:384}),r.chmodSync(c,384);return t}n(F,"mintWorkspaceToken");function T(e){r.rmSync(o.join(f(),e),{force:!0})}n(T,"revokeWorkspaceToken");function j(e){let s=new Set(r.readdirSync(e,{withFileTypes:!0}).filter(t=>t.isDirectory()||t.isSymbolicLink()&&y(o.join(e,t.name))).map(t=>t.name)),i=[];try{i=r.readdirSync(f())}catch{}if(i.length&&!s.size)throw new Error(`no workspace folders found under ${e}`);return i.filter(t=>!s.has(t)).sort()}n(j,"staleTokens");function y(e){try{return r.statSync(e).isDirectory()}catch{return!1}}n(y,"isDir");export{f as a,l as b,F as c,T as d,j as e};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-2NTZWY2A.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{K as y,k as g,m as w,o as _,q as h,t as $}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{K as y,k as g,m as w,o as _,q as h,t as $}from"./chunk-DZO5ZKCO.js";import{n as p}from"./chunk-PQFK6ZTZ.js";import{a,f}from"./chunk-LUKDMMUT.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:"Done"},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 R(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(R,"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,R as c,A as d};
|
|
4
|
+
//# sourceMappingURL=chunk-2SMQ3CDZ.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-LUKDMMUT.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-2TKJV5JW.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{
|
|
3
|
+
import{m as w,n as k}from"./chunk-JYAFAFPT.js";import{b as H}from"./chunk-2LHQYEXB.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-RF7MR7AD.js";import{a as s,f as C}from"./chunk-LUKDMMUT.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-
|
|
5
|
+
//# sourceMappingURL=chunk-35Y6EQE6.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{W as x}from"./chunk-
|
|
3
|
+
import{W as x}from"./chunk-J5LK36ZJ.js";import{f as y,g as b,h as w}from"./chunk-RWLYRSF4.js";import{b as S}from"./chunk-5QLVIFRQ.js";import{a,f as h}from"./chunk-LUKDMMUT.js";h();import*as l from"node:fs";import*as m from"node:os";import*as d from"node:path";var M=10,j=2e3,A=5*6e4;function v(t){return d.join(S(t),"starts.json")}a(v,"startsFile");function D(t){try{let e=JSON.parse(l.readFileSync(v(t),"utf8"));return Array.isArray(e)?e:[]}catch{return[]}}a(D,"readStarts");function C(t,e,r,n=Date.now()){try{let s=v(t),o=[...D(t),{by:e,from:new Date(r).toISOString(),to:new Date(n).toISOString()}].slice(-M);l.mkdirSync(d.dirname(s),{recursive:!0}),l.writeFileSync(s,`${JSON.stringify(o,null,2)}
|
|
4
4
|
`)}catch{}}a(C,"recordStart");async function W(t,e,r){let n=Date.now();try{return await r()}finally{C(t,e,n)}}a(W,"withStartRecord");function O(t,e){for(let r=e.length-1;r>=0;r--){let n=e[r];if(t>=Date.parse(n.from)-j&&t<=Date.parse(n.to)+j)return n.by}return"person"}a(O,"startedBy");function L(t,e,r){return t.state==="restarting"?!0:!e||e.restartCount===0?!1:t.state!=="running"||r-e.startedAt<A}a(L,"isCrashLoop");function P(t){return t.state==="running"||t.state==="restarting"||t.state==="exited"&&t.exitCode!==0}a(P,"worthInspecting");function k(t,e,r,n){let s=new Map,o=new Map;for(let c of t){let i=c.labels["com.docker.compose.project"];if(!i)continue;let f=s.get(i)??{started:null,crashLoops:[]};s.set(i,f);let u=e.get(c.name);if(L(c,u,n)&&f.crashLoops.push({service:c.service,restarts:u?.restartCount??0,lastLog:null}),c.state!=="running"||!u||Number.isNaN(u.startedAt))continue;let g=o.get(i);(!g||u.startedAt<g.at)&&o.set(i,{at:u.startedAt,workingDir:c.labels["com.docker.compose.project.working_dir"]??""})}for(let[c,{at:i,workingDir:f}]of o){let u=s.get(c);u.started={at:new Date(i).toISOString(),by:f?O(i,r(f)):"person"}}for(let c of s.values())c.crashLoops.sort((i,f)=>i.service.localeCompare(f.service));return s}a(k,"healthOf");async function B(t,e=Date.now()){let r=t.filter(P),n=await b(r.map(o=>o.name)),s=k(r,n,D,e);return await Promise.all(r.filter(o=>L(o,n.get(o.name),e)).map(async o=>{let c=s.get(o.labels["com.docker.compose.project"])?.crashLoops.find(i=>i.service===o.service&&i.lastLog===null);c&&(c.lastLog=await w(o.name,n.get(o.name)?.tty??!1))})),s}a(B,"projectHealth");var p=a(t=>Math.round(t*10)/10,"round1");function _(t){let e={};for(let r of t){let n=r.labels["com.docker.compose.project"];if(!n)continue;let s=e[n]??={cpuPercent:0,memMib:0};s.cpuPercent+=r.cpuPercent,s.memMib+=r.memMib}for(let r of Object.values(e))r.cpuPercent=p(r.cpuPercent),r.memMib=Math.round(r.memMib);return e}a(_,"usageByProject");function N(t,e=m.loadavg(),r=m.availableParallelism()){let n=t.filter(s=>{let o=x(s.labels,"feature");return o&&o!=="infra"});return{load:[p(e[0]),p(e[1]),p(e[2])],cores:r,featureCpuPercent:p(n.reduce((s,o)=>s+o.cpuPercent,0))}}a(N,"hostSummary");function H(t,e){let[r,n,s]=t.map(o=>p(o).toFixed(1));return`host load ${r} / ${n} / ${s} (1, 5, 15 min) on ${e} cores`}a(H,"loadNote");async function J(t=2e4){let e=await y(AbortSignal.timeout(t));return{projects:_(e),host:N(e)}}a(J,"getWorkspaceResources");export{W as a,B as b,H as c,J as d};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-3MEUJG4H.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 c,f as p}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as c,f as p}from"./chunk-LUKDMMUT.js";p();function k(e){let t=e.resolved_value;return(t==null||t==="")&&(t=e.default),t||""}c(k,"_default");function q(e){return e.accept_empty===!1||!!e.recommended}c(q,"_required");function w(e,t,n,o){let i=e.choices,s=Array.isArray(i)&&i.length>0;if(e.boolean)return n.type="boolean",t===!0||t==="true";if(e.multi&&s)return Object.assign(n,{type:"array",uniqueItems:!0,items:{type:"string",enum:i}}),o["ui:widget"]="checkboxes",e.choice_groups&&(o["ui:options"]={groups:e.choice_groups}),t?String(t).split(",").map(r=>r.trim()).filter(r=>r):null;if(s)return Object.assign(n,{type:"string",enum:i}),t||null;if(n.type="string",e.multiline&&(o["ui:widget"]="textarea",e.refinable)){let r={refinable:!0};e.refine_instruction&&(r.refineInstruction=e.refine_instruction),o["ui:options"]=r}return t||null}c(w,"_shape");function m(e){let t={title:e.label||e.key};e.help&&(t.description=e.help);let n={},o=k(e),i=w(e,o,t,n),s=q(e),r=e.pattern;return r&&t.type==="string"&&!("enum"in t)&&(t.pattern=s?r:`^$|(?:${r})`),e.placeholder&&(n["ui:placeholder"]=e.placeholder),s&&t.type==="string"&&(t.minLength=1),[t,n,i,s]}c(m,"_field");function A(e,t){let n={},o=[],i=[],s={},r={};for(let f of e.prompts??[]){if(f.resolved)continue;let d=f.key;i.push(d);let[b,h,g,_]=m(f);n[d]=b,g!==null&&(r[d]=g),_&&o.push(d),i.length===1&&(h["ui:autofocus"]=!0),Object.keys(h).length&&(s[d]=h)}let u=e.workspace_name||"workspace",a=t||`Initialize ${u}`,l={type:"object",title:a,properties:n};return o.length&&(l.required=o),i.length&&(s["ui:order"]=i),{schema:l,uiSchema:s,formData:r,title:a}}c(A,"buildFormSchema");function v(e){let t=c(n=>Array.isArray(n)?n.filter(Boolean).length:0,"picked");return t(e.services)+t(e.repos)>0?null:"Select at least one service (or add a repo below) \u2014 a workspace needs at least one repo."}c(v,"repoSelectionError");var y=c(e=>e==null||e===""||Array.isArray(e)&&e.length===0,"blank");function j(e,t){let n={},o=new Set(e.schema.required??[]);for(let[s,r]of Object.entries(e.schema.properties??{})){let u=t[s];if(y(u)){o.has(s)&&(n[s]="required");continue}let a=r.type==="array"?r.items?.enum:r.enum,l=a?(Array.isArray(u)?u:[u]).filter(f=>!a.includes(f)):[];l.length?n[s]=`not offered: ${l.join(", ")}`:r.pattern&&typeof u=="string"&&!new RegExp(r.pattern).test(u)&&(n[s]=`"${u}" doesn't match the expected format`)}let i=v(t);return i&&!n.services&&(n.services=i),n}c(j,"validateFormData");function S(e,t){let n={...e};for(let[o,i]of Object.entries(t))!y(i)&&y(n[o])&&(n[o]=i);return typeof t.issue_id=="string"&&t.issue_id&&(n.issue_id=t.issue_id),n}c(S,"mergeFormData");export{A as a,v as b,j as c,S as d};
|
|
4
|
+
//# sourceMappingURL=chunk-55WCJC53.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{C as j,G as k,S as m,X as R,a as b,r as g,w}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{C as j,G as k,S as m,X as R,a as b,r as g,w}from"./chunk-RF7MR7AD.js";import{b as y}from"./chunk-5QLVIFRQ.js";import{a as c,e as O,f as S}from"./chunk-LUKDMMUT.js";S();var A=O(b(),1);import*as v from"node:fs";import*as a from"node:path";var d=c(t=>{try{return v.realpathSync(t)}catch{return a.resolve(t)}},"realPath"),E=c(t=>(t?.extra_volumes??[]).map(n=>n.split(":")[0]).filter(n=>n.includes("/")).map(n=>d(g(n))),"hostBinds"),h=c((t,n)=>t===n||t.startsWith(`${n}${a.sep}`)||n==="/","within");function N(t,n){let e=[j(),k()].map(d),o=["/var/run/docker.sock",w(),...e].map(d),r=n&&d(n);return E(t).some(s=>a.basename(s)==="docker.sock"||o.some(i=>h(i,s))||!!(r&&e.some(i=>h(s,i))&&!h(s,r)))}c(N,"hostAccess");function B(t,n){let e=d(n);return E(t).some(o=>h(e,o))}c(B,"seesHostPath");function u(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}c(u,"isDict");function x(t,n){if(!u(t))return null;let e=t.archetype;if(e!=null){n==null&&(n=m());let r=n[e];return u(r)?r:null}let o=t.standards;return o?.length?{standards:Array.from(o)}:null}c(x,"resolveServiceArchetype");function L(t,n){let e=x(t,n);return Array.from(e?.standards??[])}c(L,"serviceStandards");function C(t,n,e){if(!u(n)||T(n)!==null)return null;let o=n.test;if(o)return String(o);let s=x(n,e)?.test;return s?String(s).split("{service}").join(t):null}c(C,"serviceTestCommand");function T(t){let n=u(t)?/^none(?::\s*(.*))?$/i.exec(String(t.test??"").trim()):null;return n?n[1]?.trim()||"test: none":null}c(T,"serviceNoTests");function U(t,n,e,o){let r=`sh -c '${e.split("'").join("'\\''")}'`;return o?`docker exec -w /app ${t}-${n} ${o} --no-wait ${r}`:`docker exec ${t}-${n} ${r}`}c(U,"containerTestCommand");function _(t){return!/[|;&{}()`\n]|\$\(/.test(t.split("&&").join(""))}c(_,"isPlainChain");function V(t,n,e,o){let r=e?`${e} && ${n}`:n;if(!t)return r;let s=o?`${t} --cwd ${a.resolve(t,"../../..",o)}`:t;return _(r)&&!r.includes("&&")?`${s} ${r}`:`${s} sh -c '${r.split("'").join("'\\''")}'`}c(V,"wrappedTestCommand");function P(t,n){if(!u(t))return null;let e=t.validate;if(e)return String(e);let o=x(t,n)?.validate;return o?String(o):null}c(P,"serviceValidation");function M(t,n,e){return e?.length?[...e]:t.flatMap(o=>n[o]?.services??[])}c(M,"candidateServiceNames");function q(t,n,e,o=new Set){e==null&&(e=m());let r=[];for(let s of[...new Set(t)].sort()){let i=n[s];if(!u(i))continue;let p=P(i,e);r.push({service:s,repo:String(i.repo??""),path:String(i.path??"."),test:C(s,i,e),validate:p??(o.has(s)?"URL health check (see Quick Health Checks)":"No validation guidance registered in services.yaml; say so instead of inventing one")})}return r}c(q,"validationRows");function W(t,n,e,o,r){r==null&&(r=m());let s=M(t,e,o),i={};for(let l of s){let f=n[l];if(!u(f))continue;let $=f.archetype;$&&$ in r&&(i[$]??=[]).push(l)}let p={};for(let l of Object.keys(i).sort())p[l]=[...new Set(i[l])].sort();return p}c(W,"resolvePresentArchetypes");function F(t,n,e,o,r){let s=(n.SERVICES??"").split(",").map(i=>i.trim()).filter(i=>i);return W(t.map(([i])=>i),e,o,s,r)}c(F,"presentArchetypes");function Q(t,n){let e=[];for(let[o,r]of Object.entries(t)){if(!u(r))continue;let s=r.archetype;s!=null&&(s in n||e.push(`services.yaml: service '${o}' references unknown archetype '${s}' \u2014 no \`archetypes.${s}\` entry`),r.standards?.length&&e.push(`services.yaml: service '${o}' declares both \`archetype:\` and legacy \`standards:\` \u2014 drop \`standards:\` (the archetype wins)`))}return e}c(Q,"validateServiceArchetypes");function Y(t,n,e){let o={};try{o=(0,A.parse)(v.readFileSync(a.join(y(n),"workspace.yml"),"utf8"))?.dev_links??{}}catch{}return Object.fromEntries(Object.entries(t).map(([r,s])=>{let i=a.join(n,String(e[r]?.repo??s.repo??"")),p=[...s.extra_volumes??[],...e[r]?.extra_volumes??[],...o[r]??[]].map(l=>{let f=l.split("${WORKSPACE}").join(n).split("${REPO}").join(i);return f.includes("${WERKMEISTER_ROOT}")?f.split("${WERKMEISTER_ROOT}").join(R()):f});return[r,{...s,extra_volumes:p}]}))}c(Y,"withComposeMounts");export{N as a,B as b,x as c,L as d,C as e,T as f,U as g,_ as h,V as i,P as j,M as k,q as l,F as m,Q as n,Y as o};
|
|
4
|
+
//# sourceMappingURL=chunk-5BNRA2MK.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-UY3DQ5DD.js";import{a as e,e as o,f as i}from"./chunk-LUKDMMUT.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-5M4EAVKV.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 t,f as r}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as t,f as r}from"./chunk-LUKDMMUT.js";r();import*as o from"node:path";var i=".werkmeister";function p(e){return o.join(e,i)}t(p,"dotDir");export{i as a,p as b};
|
|
4
|
+
//# sourceMappingURL=chunk-5QLVIFRQ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{f as $,t as B,u as F,w as _}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{f as $,t as B,u as F,w as _}from"./chunk-GSLIPL73.js";import{b as D,d as N}from"./chunk-3MEUJG4H.js";import{d as E,r as T}from"./chunk-OXL76PIX.js";import{f as O}from"./chunk-35Y6EQE6.js";import{c as k}from"./chunk-NPACNGMM.js";import{R as A,X as C,ca as y,d as R,da as I,s as j,t as P}from"./chunk-J5LK36ZJ.js";import{d as v}from"./chunk-RWLYRSF4.js";import{M as w}from"./chunk-RF7MR7AD.js";import{a,f as x}from"./chunk-LUKDMMUT.js";x();async function M(){return(await v(E,void 0,{all:!1})??[]).map(({service:e,state:n,health:r})=>{let s;return r==="healthy"?s="healthy":r==="starting"?s="starting":n==="running"?s="running":s=n||"down",{service:e||"unknown",display:s}})}a(M,"getInfraStatus");function Q(t){if(typeof t=="number"){let[e,n]=I(t);return`${e}-${n}`}return"?"}a(Q,"featurePortRange");function U(t){return P(t.service,t.role)&&t.status==="exited"&&t.exitCode===0}a(U,"finishedSetup");function V(t){return t.filter(e=>!U(e))}a(V,"tallied");function H(t){return Object.entries(t).sort((e,n)=>{let r=typeof e[1].slot=="number"?e[1].slot:99,s=typeof n[1].slot=="number"?n[1].slot:99;return r-s})}a(H,"sortedSlots");function J(t,e,n){let r=[];for(let[s,f]of H(t))for(let l of f.services??[]){let u=e[l],p=B(u),c=p===null?String(u.k8s_deployment):null,i=c!==null?n.intercepts.get(c):void 0;r.push({feature:s,service:l,deployment:c,interceptable:p===null,blocker:p,intercepted:i!==void 0,intercepted_by:i??null})}return r}a(J,"buildInterceptRows");var L=a(t=>$(t,void 0,15),"STATUS_READ");async function ot(){let t=await _(L),e=w(),n=t.installed?J(await y(),e,t):[];return{available:t.available,installed:t.installed,connected_namespace:t.namespace,intercepts:n,remote_services:Object.keys(e).filter(r=>F(e[r])).sort()}}a(ot,"interceptsSnapshot");async function W(){let[t,e]=await Promise.all([v().then(n=>D(n??[])),N().catch(()=>null)]);return{health:t,resources:e}}a(W,"featureVitals");async function at(){let t=W(),e=k().catch(()=>[]),n=await M(),r=await T(),s=await y(),f=await O(),l=await _(L),u=J(s,w(),l),{health:p,resources:c}=await t,i=[];for(let[o,m]of H(s)){let h=V(await j(o)),S=await R(o),b=c?.projects[S],d=p.get(S);i.push({name:o,slot:m.slot,services:m.services??[],port_range:Q(m.slot),containers:h,containers_running:h.filter(g=>g.status==="running").length,containers_total:h.length,intercepts:u.filter(g=>g.feature===o),cpu_percent:b?.cpuPercent??null,mem_mib:b?.memMib??null,started_at:d?.started?.at??null,started_by:d?.started?.by??null,crash_loops:d?.crashLoops??[]})}return{host:c?.host??null,infrastructure:n,mcp_web_server:f,k8s_forwards:r,features:i,waiting:await A(),caches:await e,summary:{total_features:i.length,available_slots:C()-i.length,infra_healthy:n.length>0&&n.every(o=>o.display==="healthy"||o.display==="running"),k8s_alive:r.filter(o=>o.status==="alive").length,k8s_total:r.length,telepresence_available:l.available,intercepts_active:u.filter(o=>o.intercepted).length}}}a(at,"statusSnapshot");export{M as a,Q as b,U as c,V as d,H as e,J as f,ot as g,W as h,at as i};
|
|
4
|
+
//# sourceMappingURL=chunk-62BDVGLP.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 te}from"./chunk-
|
|
3
|
+
import{a as te}from"./chunk-3MEUJG4H.js";import{b as U,c as _e,d as ht,e as q,f as wt,g as $t,h as St,j as Et,k as kt,l as ee,m as vt,p as Oe,q as Ae,r as Ne,s as V}from"./chunk-RK67KSPW.js";import{j as yt}from"./chunk-D67RVE7Q.js";import{o as Ct,p as xt}from"./chunk-OXL76PIX.js";import{i as Ke,p as Qe,t as Re}from"./chunk-DTUKOQDL.js";import{g as Ge,v as Ye}from"./chunk-QUQNQUL5.js";import{n as fe}from"./chunk-2CIUCBFA.js";import{D as Q}from"./chunk-DZO5ZKCO.js";import{a as He,b as de,d as pe}from"./chunk-VG2SME7A.js";import{A as $e,B as ut,C as Se,I as ye,J as X,K as Ee,L as lt,M as ft,N as dt,Q as J,R as pt,T as ke,V as ve,_ as mt,a as x,aa as Z,ba as Ce,ca as W,d as et,da as xe,ea as gt,h as tt,i as ge,j as nt,k as he,l as ot,m as st,n as we,p as rt,s as A,t as it,v as at,w as ct,x as z,y as R,z as D}from"./chunk-J5LK36ZJ.js";import{c as me,d as ze,k as Xe,m as Je,p as Ze}from"./chunk-RWLYRSF4.js";import{a as C,d as re}from"./chunk-J5IWCUTH.js";import{n as le}from"./chunk-JYAFAFPT.js";import{c as Ue,d as K,f as ie,j as qe,m as M,n as Ve,o as ae,p as j,r as Be,s as P,t as ce,u as ue,v as T}from"./chunk-UNFLH5RR.js";import{n as We}from"./chunk-PQFK6ZTZ.js";import{b as g}from"./chunk-25MRYFFW.js";import{J as Me,M as Y,Q as H,W as je,h as m,j as d,k as L,l as w,n as S,u as Le}from"./chunk-RF7MR7AD.js";import{b as De}from"./chunk-5QLVIFRQ.js";import{a as c,f as Te}from"./chunk-LUKDMMUT.js";Te();import*as k from"node:fs";import*as _ from"node:path";import{setTimeout as Ht}from"node:timers/promises";function Kt(e){Re(e).refresh(e),yt(e,"chore: refresh Claude settings",[".claude/settings.json",".werkmeister/claude-permissions.json"])&&d("Committed the refreshed .claude/settings.json on the record branch")}c(Kt,"refreshWorkspaceSettings");async function Qt(e,t,{signal:n,byPerson:s}={}){if(b(e,"up"),Ut(e,t),re(t),!k.existsSync(_.join(t,C)))throw new g(`No ${C} found in workspace: ${t}
|
|
4
4
|
Run 'werkmeister workspace init' first to generate it.`,"NO_COMPOSE");d("Loading configuration...");let o=fe(Y(),t),r={services:o,ports:H()},i=bt(t);Tt(o,i,t),Ae(t,i,o),Kt(t);let{slot:a,regenerated:u,staleCompose:p}=await Nt(e,t,r,i),[l,$]=xe(a);if(i.length){await ye(t,void 0);let y=await Ie(e,t,s??un(t));if(y!==null)return w(`Waiting for capacity, position ${y} \u2014 it starts when another feature stops`),{waitingNote:await Ft(e,y,!0,X(t)),feature:e,slot:a,portRange:[l,$],localServices:i,urls:[],servicePorts:[],regenerated:u,staleCompose:p,containersStarted:!1,caddy:"skipped",waiting:y}}else await D(e),P(t);Ne(e,a,i,r,t),S(`
|
|
5
5
|
${m.CYAN}Local services: ${m.BOLD}${i.length?i.join(", "):"(none -- all via k8s)"}${m.RESET}
|
|
6
6
|
|
|
@@ -14,7 +14,7 @@ ${await Ft(e,v,I,X(t,f.services))}`,"NO_CAPACITY")}E||w(`Waiting for capacity to
|
|
|
14
14
|
Run it from the host: cd to the workspace and run 'werkmeister ${t}'.`,"INSIDE_OWN_CONTAINER")}c(b,"refuseInsideOwnContainer");var nn=new Set(["clear","resume"]);function ne(e,t=Date.now()){return Object.entries(K(e,t)).map(([n,s])=>({sessionId:n,status:s.status,statusUpdatedAt:Date.parse(s.last??s.at),asking:s.ask!==void 0})).filter(n=>t-n.statusUpdatedAt<Ue)}c(ne,"liveSessions");function on(e,t){return ne(e).map(n=>n.sessionId).filter(n=>n!==t)}c(on,"otherLiveSessions");function sn(e,t,n){if(e.execs)return"docker exec running";let s=c(r=>(r.statusUpdatedAt??1/0)>n,"recent");return t.sessions(e.workspace).some(r=>r.asking&&t.queued?s(r):r.status!=="idle"||s(r))?"session active":e.startedAt.some(r=>r>n)?`started < ${t.minutes} min ago`:(t.lastExec(e.workspace)??0)>n?`gate ran < ${t.minutes} min ago`:null}c(sn,"busyReason");function rn(){let e=We().overrides?.idle_stop_minutes;return Number.isInteger(e)&&e>=0?e:30}c(rn,"idleStopMinutes");function Lt(e){return _.join(De(e),"last-exec")}c(Lt,"lastExecMarker");function Mt(e){try{return k.statSync(e).mtimeMs}catch{return null}}c(Mt,"mtimeMs");var an="com.docker.compose.project.working_dir";function jt(e=t=>le(t,{capture:!0,timeout:20})){try{let t=new Set;for(let i of[ke,ve]){let a=e(["docker","ps","-q","--filter",`label=${i}`]);if(a.status!==0)return null;for(let u of a.stdout.split(`
|
|
15
15
|
`).filter(Boolean))t.add(u)}if(!t.size)return[];let s=`{{${`or (index .Config.Labels "${ke}") (index .Config.Labels "${ve}")`}}} {{index .Config.Labels "${an}"}} {{.State.StartedAt}} {{.HostConfig.MemoryReservation}} {{.HostConfig.NanoCpus}} {{len .ExecIDs}}`,o=e(["docker","inspect","--format",s,...t]);if(o.status!==0)return null;let r=new Map;for(let i of o.stdout.split(`
|
|
16
16
|
`).filter(Boolean)){let[a,u,p,l,$,f]=i.split(" ");if(!a||!u)continue;let h=r.get(a)??{feature:a,workspace:u,startedAt:[],memory:0,cpus:0,execs:0};h.startedAt.push(Date.parse(p)),h.memory+=Number(l)||0,h.cpus+=(Number($)||0)/1e9,h.execs+=Number(f)||0,r.set(a,h)}return[...r.values()]}catch{return null}}c(jt,"runningFeatures");async function Xn(e,t={}){let n=t.run??(l=>le(l,{capture:!0,timeout:20})),s=jt(n);if(!s)return{ok:!0,lines:["docker unavailable \u2014 nothing reaped"]};let o=s.filter(l=>!t.only||l.feature===t.only);if(!o.length)return{ok:!0,lines:["no running feature containers"]};let r=t.now??Date.now(),i={minutes:e,now:r,running:o,sessions:c(l=>ne(l,r),"sessions"),lastExec:c(l=>Mt(Lt(l)),"lastExec"),queued:t.queued??R().length>0},a=i.now-e*6e4,u=[],p=!0;for(let l of o){let $=l.feature==="infra"?"shared infra":Dt(l.feature)?"running inside its own container":sn(l,i,a);if($){u.push(`${l.feature}: kept (${$})`);continue}let f=i.sessions(l.workspace).some(h=>h.asking);try{await(t.stop??be)(l.feature,{why:`idle \u2265 ${e} min`}),u.push(f?`${l.feature}: stopped (waiting on a person \u2265 ${e} min, others queued)`:`${l.feature}: stopped (idle \u2265 ${e} min)`)}catch(h){p=!1,u.push(`${l.feature}: stop failed \u2014 ${h.message}`)}}return{ok:p,lines:u}}c(Xn,"stopIdle");function Jn(e){let{feature:t,workspaceRoot:n,sessionId:s,reason:o,entrypoint:r}=e;return!t||t==="infra"||o&&nn.has(o)||r?.startsWith("sdk")||on(n,s).length?null:t}c(Jn,"idleStopFeature");var cn="Capacity freed: this workspace's containers are up. Continue where you left off.";async function _t(e,t){let n=(await A(e)).filter(o=>o.status!=="running"&&!it(o.service,o.role)),s=t?`Werkmeister had stopped it (${t.why})`+(t.killed.length?`, killing ${t.killed.map(o=>`\`${o}\``).join(", ")}: rerun them`:"")+". ":"";return n.length?`${s}Capacity freed: this workspace started, but these containers are still stopped: ${n.map(o=>o.name).join(", ")}. Start them with ${n.map(o=>`\`werkmeister feature up --service ${o.service}\``).join(", ")}, then continue where you left off.`:s+cn}c(_t,"grantedNudge");function Wt(e){let t=jt(e);if(!t)return null;let n=Date.now()-Math.max(rn(),2)*6e4;return t.map(s=>{let o=ie(K(s.workspace)),r=s.feature==="infra"?"person":o?.agent==="needs-you"?"human-check":Q(s.workspace)?o?.agent==="working"?"working":"idle":"person",i=s.execs>0||M(s.workspace)!==null||(Mt(Lt(s.workspace))??0)>n;return{lease:{feature:s.feature,cost:{memory:s.memory,cpus:s.cpus},rank:r,busy:i},at:o?Date.parse(o.at):0}}).sort((s,o)=>s.at-o.at).map(s=>s.lease)}c(Wt,"runningLeases");function un(e,t=process.env){return!Q(e)&&!t.CLAUDECODE}c(un,"startsAsPerson");function Ie(e,t,n,s){return J("admit",{feature:e,workspace:t,byPerson:n,starting:s},()=>ln(e,t,n,s),15*6e4)}c(Ie,"admitOrQueue");async function ln(e,t,n,s){let o=Wt();if(o===null)return null;let r=await Se(),i=await dt(e,t,n,o,r,s);if(i.kind==="never-fits"){let{cost:a}=i,u=c(l=>`${(l/2**30).toFixed(1)} GiB`,"gib"),p=a.cpus>r.cpus?`cost ${a.cpus.toFixed(1)} CPUs > budget ${r.cpus}; raise the engine's CPUs or budget.cpus`:`cost ${u(a.memory)} memory > budget ${u(r.memory)}; raise the engine's memory or budget.memory`;throw new g(`'${e}' can never fit the budget${s?` to start ${s.services.join(", ")}`:""}: ${p} in ~/.werkmeister/config.yaml, or start fewer services.`,"NEVER_FITS")}if(i.kind==="wait")return i.position;if(i.kind==="preempt")for(let a of i.victims){let u=z()[a]?.workspace||x(a);try{await be(a,{grant:!1,why:`preempted to make room for '${e}'`})}catch(l){let $=(await A(a)).some(f=>f.status==="running");return u&&!$&&await $e(a,u),w(`Could not stop '${a}' to make room (${l.message}); waiting instead`+($?`, and '${a}' keeps running`:"")),ut(e,t,s)}u&&await $e(a,u);let p=o.find(l=>l.feature===a)?.rank;d(`Stopped '${a}' to make room: its session is ${p==="human-check"?"waiting on a person":p==="working"?"working":"idle"} (preemption; budget.preempt: false turns it off)`)}return null}c(ln,"admitOrQueueHere");function Zn(){return J("grant",{},Fe,15*6e4)}c(Zn,"grantWaiters");var Ot=Promise.resolve();function Fe(){let e=Ot.then(At,At);return Ot=e.catch(()=>{}),e}c(Fe,"grantHere");function eo(){let e=R().length;return e&&Fe().catch(t=>w(`Waiting queue: ${t.message}`)),e}c(eo,"grantInBackground");async function At(){let e=[];for(let t of R()){let n=z()[t]?.workspace||x(t);if(!n){w(`'${t}' left the waiting queue: its workspace can't be found`),await D(t);continue}let s=ue(n);try{let o=j(n);if(o?.parked){await fn(t,n,o.parked.service)&&(e.push(t),ne(n).length&&T(n,await _t(t,s)));continue}if(o?.services)continue;let r;try{r=await Qt(t,n,{byPerson:!1})}catch(i){let a=`Could not start '${t}' from the waiting queue: ${i.message}`;if(w(a),!R().includes(t)){P(n);let u=i instanceof g&&i.code==="NEVER_FITS";T(n,u?a:`${a}
|
|
17
|
-
It left the queue: run \`werkmeister feature up\` to queue it again.`)}continue}if(r.waiting!==void 0)continue;e.push(t),ne(n).length&&T(n,await _t(t,s))}finally{s&&!e.includes(t)&&R().includes(t)&&ce(n,s)}}return e}c(At,"grantWaitersNow");async function fn(e,t,n){try{await zt(e,t,n,C,{park:!0,waitMs:0,grant:!1})}catch(s){if(!(s instanceof g&&s.code==="NO_CAPACITY")||!R().includes(e)){let o=`Could not start '${e}' ${n} from the waiting queue: ${s.message}`;w(o),T(t,o)}return!1}return await mn().catch(s=>w(`Proxy not reloaded for '${e}': ${s.message}`)),!0}c(fn,"startParked");async function Pe(){try{let e=await J("grant-later",{},async()=>null);if(e!==null){e&&d(`The daemon will start the next waiting feature (${e} waiting)`);return}for(let t of await Fe())L(`Started '${t}' from the waiting queue`)}catch(e){w(`Could not start the next waiting feature: ${e instanceof Error?e.message:String(e)}`)}}c(Pe,"grantWaitersQuietly");function dn(e,t){return`Werkmeister stopped this workspace's containers (${e}) while these ran in them: ${t.map(n=>`\`${n}\``).join(", ")}. They were killed (exit 137), not failed: start the containers with \`werkmeister feature up\` (\`--service <name>\` for an on-demand one), then rerun them.`}c(dn,"killedNudge");async function be(e,{grant:t=!0,why:n}={}){b(e,"stop");let s=await oe(e),o=n?x(e):null;if(n&&o){let r=(await A(e)).filter(a=>a.status==="running").map(a=>a.name),i=await Xe(r);try{ce(o,{at:new Date().toISOString(),why:n,killed:i}),i.length&&T(o,dn(n,i))}catch(a){w(`Could not tell '${e}' why it stopped: ${a.message}`)}}if(d(`Stopping containers for '${e}' (slot ${s})...`),!await st(e))throw new g(`Failed to stop containers for '${e}'`,"COMPOSE_STOP_FAILED");return t&&await Pe(),{feature:e,slot:s}}c(be,"stop");async function to(e){b(e,"restart");let t=await oe(e),n=x(e);if(Ut(e,n),d(`Restarting containers for '${e}' (slot ${t})...`),!(n?await te(n,"restart",()=>we(e)):await we(e)))throw new g(`Failed to restart containers for '${e}'`,"COMPOSE_RESTART_FAILED");return await D(e),n&&P(n),{feature:e,slot:t}}c(to,"restart");function Ut(e,t){if(t&&M(t))throw new g(`'${e}' is paused; Resume it first`,"PAUSED")}c(Ut,"refusePaused");function qt(e){let t=x(e);if(!t)throw new g(`No workspace folder for '${e}'`,"NO_WORKSPACE");return t}c(qt,"workspaceOrThrow");var Vt=c(e=>e.statusCode,"statusOf"),Bt=c(e=>e.json?.message??e.message,"daemonMessage");async function no(e){b(e,"pause");let t=await oe(e),n=qt(e);if(M(n))throw new g(`'${e}' is already paused`,"ALREADY_PAUSED");let s=await ze(await et(e),void 0,{all:!1});if(s===null)throw new g("docker not found / not running","COMPOSE_PAUSE_FAILED");let o=rt(s.filter(i=>i.state==="running")).map(i=>i.name);Ge(n)&&Ye(n),Ve(n,{at:new Date().toISOString(),containers:o,was_working:ie(K(n))?.agent==="working"}),d(`Pausing ${o.length} container(s) for '${e}' (slot ${t})...`);let r=[];for(let i of[...o].reverse())try{await me().getContainer(i).pause()}catch(a){Vt(a)!==409&&r.push(`${i}: ${Bt(a)}`)}if(r.length)throw new g(`docker pause failed: ${r.join("; ")}`,"COMPOSE_PAUSE_FAILED");return L(`Paused '${e}': its Claude session is held until Resume`),{feature:e,slot:t,containers:o}}c(no,"pause");async function oo(e){b(e,"resume");let t=qt(e),n=M(t);if(!n)throw new g(`'${e}' is not paused`,"NOT_PAUSED");d(`Resuming ${n.containers.length} container(s) for '${e}'...`);let s=[];for(let o of n.containers){let r=me().getContainer(o);try{let{State:i}=await r.inspect();i.Paused?(await r.unpause(),s.push({name:o,did:"unpaused"})):i.Running||(await r.start(),s.push({name:o,did:"started"}))}catch(i){if(Vt(i)!==404)throw new g(`docker resume ${o} failed: ${Bt(i)}`,"COMPOSE_RESUME_FAILED");w(`${o} is gone; nothing to resume`),s.push({name:o,did:"missing"})}}return ae(t),L(`Resumed '${e}'`),{feature:e,workspace:t,containers:s,wasWorking:n.was_working}}c(oo,"resume");async function so(e,{removeVolumes:t=!1,signal:n}={}){b(e,"down");try{let{leaveFeatureIntercepts:r,releaseIdleTelepresence:i}=await import("./telepresence-
|
|
17
|
+
It left the queue: run \`werkmeister feature up\` to queue it again.`)}continue}if(r.waiting!==void 0)continue;e.push(t),ne(n).length&&T(n,await _t(t,s))}finally{s&&!e.includes(t)&&R().includes(t)&&ce(n,s)}}return e}c(At,"grantWaitersNow");async function fn(e,t,n){try{await zt(e,t,n,C,{park:!0,waitMs:0,grant:!1})}catch(s){if(!(s instanceof g&&s.code==="NO_CAPACITY")||!R().includes(e)){let o=`Could not start '${e}' ${n} from the waiting queue: ${s.message}`;w(o),T(t,o)}return!1}return await mn().catch(s=>w(`Proxy not reloaded for '${e}': ${s.message}`)),!0}c(fn,"startParked");async function Pe(){try{let e=await J("grant-later",{},async()=>null);if(e!==null){e&&d(`The daemon will start the next waiting feature (${e} waiting)`);return}for(let t of await Fe())L(`Started '${t}' from the waiting queue`)}catch(e){w(`Could not start the next waiting feature: ${e instanceof Error?e.message:String(e)}`)}}c(Pe,"grantWaitersQuietly");function dn(e,t){return`Werkmeister stopped this workspace's containers (${e}) while these ran in them: ${t.map(n=>`\`${n}\``).join(", ")}. They were killed (exit 137), not failed: start the containers with \`werkmeister feature up\` (\`--service <name>\` for an on-demand one), then rerun them.`}c(dn,"killedNudge");async function be(e,{grant:t=!0,why:n}={}){b(e,"stop");let s=await oe(e),o=n?x(e):null;if(n&&o){let r=(await A(e)).filter(a=>a.status==="running").map(a=>a.name),i=await Xe(r);try{ce(o,{at:new Date().toISOString(),why:n,killed:i}),i.length&&T(o,dn(n,i))}catch(a){w(`Could not tell '${e}' why it stopped: ${a.message}`)}}if(d(`Stopping containers for '${e}' (slot ${s})...`),!await st(e))throw new g(`Failed to stop containers for '${e}'`,"COMPOSE_STOP_FAILED");return t&&await Pe(),{feature:e,slot:s}}c(be,"stop");async function to(e){b(e,"restart");let t=await oe(e),n=x(e);if(Ut(e,n),d(`Restarting containers for '${e}' (slot ${t})...`),!(n?await te(n,"restart",()=>we(e)):await we(e)))throw new g(`Failed to restart containers for '${e}'`,"COMPOSE_RESTART_FAILED");return await D(e),n&&P(n),{feature:e,slot:t}}c(to,"restart");function Ut(e,t){if(t&&M(t))throw new g(`'${e}' is paused; Resume it first`,"PAUSED")}c(Ut,"refusePaused");function qt(e){let t=x(e);if(!t)throw new g(`No workspace folder for '${e}'`,"NO_WORKSPACE");return t}c(qt,"workspaceOrThrow");var Vt=c(e=>e.statusCode,"statusOf"),Bt=c(e=>e.json?.message??e.message,"daemonMessage");async function no(e){b(e,"pause");let t=await oe(e),n=qt(e);if(M(n))throw new g(`'${e}' is already paused`,"ALREADY_PAUSED");let s=await ze(await et(e),void 0,{all:!1});if(s===null)throw new g("docker not found / not running","COMPOSE_PAUSE_FAILED");let o=rt(s.filter(i=>i.state==="running")).map(i=>i.name);Ge(n)&&Ye(n),Ve(n,{at:new Date().toISOString(),containers:o,was_working:ie(K(n))?.agent==="working"}),d(`Pausing ${o.length} container(s) for '${e}' (slot ${t})...`);let r=[];for(let i of[...o].reverse())try{await me().getContainer(i).pause()}catch(a){Vt(a)!==409&&r.push(`${i}: ${Bt(a)}`)}if(r.length)throw new g(`docker pause failed: ${r.join("; ")}`,"COMPOSE_PAUSE_FAILED");return L(`Paused '${e}': its Claude session is held until Resume`),{feature:e,slot:t,containers:o}}c(no,"pause");async function oo(e){b(e,"resume");let t=qt(e),n=M(t);if(!n)throw new g(`'${e}' is not paused`,"NOT_PAUSED");d(`Resuming ${n.containers.length} container(s) for '${e}'...`);let s=[];for(let o of n.containers){let r=me().getContainer(o);try{let{State:i}=await r.inspect();i.Paused?(await r.unpause(),s.push({name:o,did:"unpaused"})):i.Running||(await r.start(),s.push({name:o,did:"started"}))}catch(i){if(Vt(i)!==404)throw new g(`docker resume ${o} failed: ${Bt(i)}`,"COMPOSE_RESUME_FAILED");w(`${o} is gone; nothing to resume`),s.push({name:o,did:"missing"})}}return ae(t),L(`Resumed '${e}'`),{feature:e,workspace:t,containers:s,wasWorking:n.was_working}}c(oo,"resume");async function so(e,{removeVolumes:t=!1,signal:n}={}){b(e,"down");try{let{leaveFeatureIntercepts:r,releaseIdleTelepresence:i}=await import("./telepresence-SAISPRXG.js"),a=r(e);a.length&&d(`Left k8s intercept(s): ${a.join(", ")}`),await i(a)}catch(r){w(`Could not clean up k8s intercepts: ${r instanceof Error?r.message:String(r)}`)}let s=x(e),o=await Ce(e);return o===null&&(w(`Feature '${e}' does not have an allocated slot`),w("It may already be stopped. Cleaning up anyway...")),d("Stopping containers..."),t&&d("Per-feature Docker volumes will be removed"),await ot(e,{removeVolumes:t,signal:n})||w(`Containers for '${e}' may still exist -- see the docker compose output above`),d("Releasing feature slot..."),await Z(e),s&&(ae(s),P(s),k.rmSync(qe(s),{force:!0})),await Pe(),{feature:e,slot:o}}c(so,"down");async function ro(e,t){let n={services:Y(),ports:H()},s=await oe(e),o=[...(await W())[e]?.services??[]];if(!o.includes(t))throw new g(`Service '${t}' is not running locally for '${e}'`,"NOT_LOCAL");o.splice(o.indexOf(t),1),d(`Removed '${t}' from local services -- will fall back to k8s`),d("Regenerating configuration files..."),ee(e,s,o,n),Oe(e,s,o,n),Ne(e,s,o,n);let r=!1;o.length?(d("Restarting containers..."),tt(e)):(d("No local services remaining -- containers will be stopped"),r=!0,ge(e)||w(`Containers for '${e}' may still exist -- see the docker compose output above`)),d("Updating reverse proxy..."),await V(null,n);let i=!1;return await q()&&(await U(),i=!0),{feature:e,removed:t,remaining:[...o].sort(),containersStopped:r,proxyReloaded:i}}c(ro,"removeService");var pn={generate:c(()=>V(),"generate"),slots:c(()=>W(),"slots"),running:c(()=>q(),"running"),reload:c(()=>U(),"reload"),start:c(()=>_e(),"start"),hosts:c(()=>de(),"hosts")};async function mn({start:e=!1}={},t=pn){d(e?"Regenerating Caddyfile...":"Updating reverse proxy configuration..."),await t.generate(),await pe(t.hosts(),t.lookup);let n=await t.slots(),s=Object.keys(n).sort().map(i=>({feature:i,slot:n[i].slot,services:n[i].services}));if(e)if(!s.length)d("No active features in Caddyfile");else{S(`
|
|
18
18
|
${m.CYAN}Features in Caddyfile:${m.RESET}
|
|
19
19
|
`);for(let{feature:i,slot:a,services:u}of s){let p=u.length?u.join(", "):"(no local services)";S(` ${m.GREEN}*${m.RESET} ${i} (slot ${a}): ${p}
|
|
20
20
|
`)}S(`
|
|
@@ -40,4 +40,4 @@ It left the queue: run \`werkmeister feature up\` to queue it again.`)}continue}
|
|
|
40
40
|
`);for(let f of l)t?S(` ${m.DIM}[dry-run] Would release slot: ${f}${m.RESET}
|
|
41
41
|
`):(await Z(f),$.push(f),S(` ${m.GREEN}Released:${m.RESET} ${f}
|
|
42
42
|
`))}}return{activeFeatures:n,activeVolumes:a,orphanedVolumes:u,staleSlots:l,removedVolumes:i,releasedSlots:$}}c($n,"runClean");async function oe(e){let t=await Ce(e);if(t===null)throw new g(`Feature '${e}' is not running (no slot allocated)`,"NOT_RUNNING");return t}c(oe,"requireSlot");async function ao(e){let t=x(e);if(t===null)return{workspace:null,handoff:null,decisions:[],graduated:[]};let{decisions:n}=Re(t),s=Qe(t,null,n);return{workspace:t,handoff:Ke(t),decisions:n.open(t),graduated:s}}c(ao,"teardownNotes");export{Kt as a,Qt as b,zt as c,zn as d,en as e,bt as f,Dt as g,ne as h,rn as i,Lt as j,jt as k,Xn as l,Jn as m,Wt as n,Ie as o,Zn as p,eo as q,be as r,to as s,no as t,oo as u,so as v,ro as w,mn as x,io as y,$n as z,ao as A};
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-6T2HOUPV.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-RWLYRSF4.js";import{K as S,L as _,M,O as y,X as w,j as g,l as x}from"./chunk-RF7MR7AD.js";import{a,f as b}from"./chunk-LUKDMMUT.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-6XL774M4.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{a as $,b as g}from"./chunk-
|
|
3
|
+
import{a as $,b as g}from"./chunk-5QLVIFRQ.js";import{a,f as v}from"./chunk-LUKDMMUT.js";v();import*as l from"node:fs";import*as i from"node:path";var A="Precedence: these standards' rules win over conflicting task framing \u2014 if a rule and the task clash, follow the rule and say so (invariant: apply it and write a `decision` note; rule: surface the conflict in one line, then apply). This gate fires once; your retry will proceed.",j="Standards gate: invoke `w9r-implement` before coding \u2014 it loads the universal base (ponytail + comments + engineering) and the workspace notes. Then retry this edit.";function D(t){let e="",n=0,r=t.length;for(;n<r;){let o=t[n];if(n+=1,o==="*")e+=".*";else if(o==="?")e+=".";else if(o==="["){let s=n;for(s<r&&t[s]==="!"&&(s+=1),s<r&&t[s]==="]"&&(s+=1);s<r&&t[s]!=="]";)s+=1;if(s>=r)e+="\\[";else{let c=t.slice(n,s).replace(/\\/g,"\\\\");n=s+1,c.startsWith("!")?c="^"+c.slice(1):c.startsWith("^")&&(c="\\"+c),e+=`[${c}]`}}else e+=o.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return`^(?:${e})$`}a(D,"_translate");function F(t,e){return new RegExp(D(e),"s").test(t)}a(F,"fnmatch");function O(t,e){let n=T(t);for(let r of e){let o=T(r),s=i.relative(o,n);if(!(s===""||s===".."||s.startsWith(".."+i.sep)||i.isAbsolute(s)))return i.join(o,s.split(i.sep)[0])}return null}a(O,"workspaceUnder");function T(t){try{return l.realpathSync(t)}catch{return i.resolve(t)}}a(T,"_realpath");function R(t,e){if(e){let r=O(t,e);return r!==null&&E(g(r))?r:null}let n=i.resolve(t);for(;;){if(E(g(n)))return n;let r=i.dirname(n);if(r===n)return null;n=r}}a(R,"findWorkspaceRoot");function E(t){try{return l.statSync(t).isDirectory()}catch{return!1}}a(E,"_isDir");function P(t){try{return l.statSync(t).isFile()}catch{return!1}}a(P,"_isFile");function p(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}a(p,"_isDict");function W(t){let e=i.join(g(t),"standards.json");if(!P(e))return null;let n;try{n=JSON.parse(l.readFileSync(e,"utf8"))}catch{return null}return p(n)?n:null}a(W,"loadManifest");function k(t,e){return i.join(g(t),".gate",`${e}.json`)}a(k,"_statePath");function C(t,e){let n=k(t,e);if(!P(n))return{};let r;try{r=JSON.parse(l.readFileSync(n,"utf8"))}catch{return null}return p(r)?r:null}a(C,"_loadState");function J(t,e,n){try{let r=k(t,e);return l.mkdirSync(i.dirname(r),{recursive:!0}),l.writeFileSync(r,JSON.stringify(n)),!0}catch{return!1}}a(J,"_saveState");function q(t,e){if(!(!e||e.includes("/")||e.includes("..")))try{l.unlinkSync(k(t,e))}catch{}}a(q,"resetSessionState");function N(t){return[...t].sort()}a(N,"_sorted");function G(t){let e=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t);if(!e)return;let n=/^status:\s*["']?([^\s"'#]+)/m.exec(e[1]);return n?n[1].toLowerCase():null}a(G,"_noteStatus");function H(t,e){let n=String(e.note??"");if(!/^[a-z]+$/.test(n))return!0;let r=e.status?String(e.status).toLowerCase():null,o=i.join(g(t),"notes"),s;try{s=l.readdirSync(o)}catch(u){return u.code!=="ENOENT"}let c=new RegExp(`^\\d{3}-${n}-.+\\.md$`);for(let u of s){if(!c.test(u))continue;let f;try{f=l.readFileSync(i.join(o,u),"utf8")}catch{return!0}let d=G(f);if(d===void 0)return!0;if(!(d==="superseded"||d==="graduated")&&(r===null||d===r))return!0}return!1}a(H,"_phaseGateSatisfied");function U(t){let e=String(t.note);if(t.status){let n=String(t.status);return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` has \`status: ${n}\`, so source edits wait for an approved design. Invoke \`w9r-research\`, present the design to the user, and when they approve write \`NNN-${e}-<slug>.md\` with \`status: ${n}\` recording what was approved. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` names the root cause yet. Invoke \`w9r-research\`, reproduce the problem, and write \`NNN-${e}-<slug>.md\` stating the root cause. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}a(U,"_phaseGateText");function L(t,e,n){if(!e||e.includes("/")||e.includes(".."))return null;let r=R(t);if(r===null)return null;let o=W(r);if(o===null)return null;let s=C(r,e);if(s===null)return null;let c=n?i.relative(r,n):"",u=o.phase_gate;if(p(u)&&c&&c!==".."&&!c.startsWith(".."+i.sep)&&!i.isAbsolute(c)&&!c.startsWith($+i.sep)&&!H(r,u))return U(u);let f=new Set(Array.isArray(s.delivered)?s.delivered:[]),d=!s.phase_entry_delivered,h=null,S=p(o.domains)?o.domains:{};for(let m of N(Object.keys(S))){let y=S[m];if(f.has(m)||!p(y))continue;if((Array.isArray(y.applies_to)?y.applies_to:[]).some(b=>F(c,String(b)))){h=m;break}}if(!d&&h===null)return null;let w=[];if(d&&w.push(j),h!==null){let m=S[h],y=String(p(m)&&m.summary||"").trim(),_=`Standards gate: you are editing a path governed by the \`${h}\` standard, which has not been loaded this session. Invoke the \`w9r-${h}-standard\` skill, then retry this edit.`;y&&(_+=` Summary: ${y}.`),w.push(_)}w.push(A);let x={phase_entry_delivered:!0,delivered:N(h?new Set([...f,h]):f)};return J(r,e,x)?w.join(`
|
|
4
4
|
`):null}a(L,"decide");var M=/^\*\*\* (?:Add File|Update File|Delete File|Move to): (.+)$/gm;function X(t){return[...new Set([...t.matchAll(M)].map(e=>e[1].trim()))]}a(X,"patchPaths");function B(){let t;try{let f=process.stdin.isTTY?"":l.readFileSync(0,"utf8"),d=f.trim()?JSON.parse(f):{};t=p(d)?d:{}}catch{t={}}let e=String(t.session_id||""),n=t.tool_input,r=p(n)?n:{},o=String(t.cwd||process.cwd()),s=t.tool_name==="apply_patch"?r.command:void 0,c=typeof s=="string"?X(s).map(f=>i.resolve(o,f)):[String(r.file_path||"")],u=null;try{for(let f of c)if(u=L(o,e,f),u)break}catch{u=null}u&&console.log(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:u}}))}a(B,"main");export{O as a,R as b,W as c,q as d,B as e};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-7D2QNHBK.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{x as $}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{x as $}from"./chunk-RF7MR7AD.js";import{a,f as y}from"./chunk-LUKDMMUT.js";y();var j=new Set(["PASTE_TOKEN_HERE","<your-atlassian-login-email>","https://your-org.atlassian.net"]),d=a(e=>j.has(e.trim().replace(/\/+$/,"")),"isJiraPlaceholder");function h(e,t,s){let n=e.trim();for(;n.endsWith("/");)n=n.slice(0,-1);return!n||!t||!s||d(n)||d(t)||d(s)?null:{baseUrl:n,email:t,token:s}}a(h,"normalizeCreds");async function u(){let e=h(process.env.JIRA_BASE_URL??"",process.env.JIRA_EMAIL??"",process.env.JIRA_API_TOKEN??"");if(e)return e;try{let t=$().jira??{};return h(String(t.base_url??""),String(t.email??""),String(t.api_token??""))}catch{return null}}a(u,"jiraCreds");async function f(e,t,s){let n=await fetch(`${e.baseUrl}${t}`,{method:s===void 0?"GET":"POST",headers:{Authorization:"Basic "+Buffer.from(`${e.email}:${e.token}`).toString("base64"),Accept:"application/json",...s===void 0?{}:{"Content-Type":"application/json"}},body:s===void 0?void 0:JSON.stringify(s),signal:AbortSignal.timeout(1e4)});if(!n.ok){let o=(await n.text().catch(()=>"")).trim().slice(0,500);throw new Error(`Jira REST ${t} \u2192 HTTP ${n.status}${o?`: ${o}`:""}`)}return n}a(f,"jiraFetch");async function S(){let e=await u();if(!e)return null;let s=await(await f(e,"/rest/api/3/myself")).json();return{who:s.emailAddress??s.displayName??e.email}}a(S,"jiraMyself");async function l(e,t){return await(await f(e,t)).json()}a(l,"jiraGet");var C="summary,description,status,issuetype,assignee,comment";async function T(e,t){let s=await u();if(!s)return t?.push("no Jira REST credentials"),null;try{return await l(s,`/rest/api/2/issue/${encodeURIComponent(e)}?fields=${C}`)}catch(n){return t?.push(E(n)),null}}a(T,"fetchIssueRest");function E(e){let t=e;if(t.message?.startsWith("Jira REST "))return t.message;let s=t.cause?.code??t.cause?.message;return`Jira REST: ${t.message}${s?` (${s})`:""}`}a(E,"restFailure");async function A(e){if(!e.length)return{};let t=await u();if(!t)return null;let s=encodeURIComponent(`key in (${e.join(",")})`);try{let n=await l(t,`/rest/api/2/search/jql?jql=${s}&fields=status&maxResults=100`),o={};for(let r of n.issues??[]){let c=r.fields?.status?.name;r.key&&c&&(o[r.key.toUpperCase()]=c)}return o}catch{return null}}a(A,"fetchStatusesRest");var R="fields=summary,status&maxResults=100";async function b(e){let t=await u();return t?(await l(t,`/rest/api/2/search/jql?jql=${encodeURIComponent(e)}&${R}`)).issues??[]:null}a(b,"searchIssuesRest");async function L(e,t){let s=await u();if(!s)return null;let n=encodeURIComponent(e),{columnConfig:o}=await l(s,`/rest/agile/1.0/board/${n}/configuration`),r=o?.columns??[],c=r.find(p=>p.name?.toLowerCase()===t.toLowerCase());if(!c)throw new Error(`board ${e} has no "${t}" column (it has: ${r.map(p=>p.name).join(", ")})`);let i=(c.statuses??[]).flatMap(p=>p.id?[p.id]:[]);if(!i.length)return[];let m=encodeURIComponent(`status in (${i.join(",")})`);return(await l(s,`/rest/agile/1.0/board/${n}/issue?jql=${m}&${R}`)).issues??[]}a(L,"boardColumnRest");async function x(e){let t=await u();if(!t)return null;let s=encodeURIComponent(e.project),{issueTypes:n=[]}=await l(t,`/rest/api/2/issue/createmeta/${s}/issuetypes`),o=a(m=>n.some(w=>w.name?.toLowerCase()===m.toLowerCase()),"has"),r=o(e.issueType)||!o("Task")?e.issueType:"Task",c=await f(t,"/rest/api/2/issue",{fields:{project:{key:e.project},issuetype:{name:r},summary:e.summary,description:e.description,...r===e.issueType?{}:{labels:[e.fallbackLabel]}}}),{key:i}=await c.json();return{key:i,url:`${t.baseUrl}/browse/${i}`,issueType:r}}a(x,"createIssueRest");async function U(e,t){let s=await u();return s?(await f(s,"/rest/api/2/issueLink",{type:{name:"Relates"},inwardIssue:{key:e},outwardIssue:{key:t}}),!0):null}a(U,"linkIssueRest");async function _(e,t){let s=await u();if(!s)return null;let n=`/rest/api/2/issue/${encodeURIComponent(e)}`;if(t.status){let o=t.status.trim().toLowerCase(),{transitions:r=[]}=await l(s,`${n}/transitions`),c=r.find(i=>i.to?.name?.toLowerCase()===o)??r.find(i=>i.name?.toLowerCase()===o);if(!c){let i=r.map(m=>m.to?.name??m.name).filter(Boolean).join(", ");throw new Error(`${e} has no transition to "${t.status}" (available: ${i||"none"})`)}await f(s,`${n}/transitions`,{transition:{id:c.id}})}return t.comment&&await f(s,`${n}/comment`,{body:t.comment}),!0}a(_,"updateIssueRest");export{j as a,d as b,S as c,T as d,A as e,b as f,L as g,x as h,U as i,_ as j};
|
|
4
|
+
//# sourceMappingURL=chunk-7HM7A2HL.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-CNP6VFLZ.js";import{p as x,t as j}from"./chunk-VISVCRGS.js";import{c as y}from"./chunk-25MRYFFW.js";import{a as i,e as F,f as b}from"./chunk-LUKDMMUT.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-AAMYRAFF.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{j as a}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{j as a}from"./chunk-JSTU5ALW.js";import{m as n}from"./chunk-RF7MR7AD.js";import{b as m}from"./chunk-5QLVIFRQ.js";import{a as s,f as p}from"./chunk-LUKDMMUT.js";p();import*as f from"node:fs";import*as o from"node:path";function c(i){let t=o.resolve(i??"."),r=t;for(;!f.existsSync(o.join(m(r),"workspace.yml"));){let e=o.dirname(r);e===r&&(n(`No .werkmeister/workspace.yml found from ${t}`),process.exit(1)),r=e}return r}s(c,"findWorkspaceDir");function h(i){let t=c(i.start),r=a(t).starting_prompt;(typeof r!="string"||!r.trim())&&(n(`${t} has no starting_prompt`),process.exit(2)),console.log(r.trim())}s(h,"run");export{c as a,h as b};
|
|
4
|
+
//# sourceMappingURL=chunk-B44FCMJX.js.map
|