werkmeister 0.89.0 → 0.89.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{budget-IY73KSQA.js → budget-P5JBRTPG.js} +2 -2
- package/dist/{cache-ZGCLJBWU.js → cache-DUYHRESP.js} +2 -2
- package/dist/{chunk-4BZ2BPE5.js → chunk-2DWIVGDO.js} +3 -3
- package/dist/{chunk-EINEOPJC.js → chunk-2M2FM27H.js} +2 -2
- package/dist/{chunk-YMVRZDEM.js → chunk-2VPTBX43.js} +2 -2
- package/dist/{chunk-GULWMRWO.js → chunk-3QSQOSVX.js} +2 -2
- package/dist/{chunk-FIM7WRYA.js → chunk-4D72V6SW.js} +2 -2
- package/dist/{chunk-X4W6DOOU.js → chunk-4HOBUMZ4.js} +2 -2
- package/dist/chunk-4O5AVQ7C.js +13 -0
- package/dist/{chunk-EQ3G6TPU.js → chunk-4TT37SCP.js} +2 -2
- package/dist/{chunk-KBMW2YBZ.js → chunk-4YFK45ID.js} +2 -2
- package/dist/{chunk-52MMBRA6.js → chunk-5H6K4MI5.js} +2 -2
- package/dist/{chunk-UBDD7ZXR.js → chunk-5LQO3VEP.js} +2 -2
- package/dist/{chunk-FN2TO7UC.js → chunk-5VBOWGVH.js} +2 -2
- package/dist/{chunk-OHRZTQY6.js → chunk-65WN7UFH.js} +2 -2
- package/dist/{chunk-UMBJJOZS.js → chunk-6JER3JWG.js} +2 -2
- package/dist/{chunk-FHUDFZMW.js → chunk-6RPHJEST.js} +2 -2
- package/dist/{chunk-E33KKJCO.js → chunk-7D73HLJW.js} +2 -2
- package/dist/{chunk-BYUCSAYQ.js → chunk-ASWXLDJM.js} +2 -2
- package/dist/{chunk-4ZHFNNBO.js → chunk-C25JQ6TF.js} +2 -2
- package/dist/{chunk-SQB7QG5D.js → chunk-CONW5UWC.js} +2 -2
- package/dist/{chunk-F4JCQM3P.js → chunk-CQED4F7H.js} +49 -49
- package/dist/{chunk-JQQWJSER.js → chunk-CQY3GTFJ.js} +2 -2
- package/dist/chunk-CTJWIG5A.js +4 -0
- package/dist/{chunk-FJMTCCOU.js → chunk-DRI4OHNA.js} +3 -3
- package/dist/{chunk-6E4ULVOX.js → chunk-E5EYLHWE.js} +2 -2
- package/dist/{chunk-LZCTXBKR.js → chunk-ELLCJ25G.js} +2 -2
- package/dist/{chunk-LPWJDNF6.js → chunk-F37P66U5.js} +2 -2
- package/dist/chunk-F5YT2U6R.js +180 -0
- package/dist/{chunk-KQDID2KL.js → chunk-FG2XLGNM.js} +2 -2
- package/dist/{chunk-PWOG5P7M.js → chunk-FN2A7LG6.js} +2 -2
- package/dist/{chunk-HYNRKMEH.js → chunk-FS6YA3CG.js} +2 -2
- package/dist/{chunk-Q4KPD5RN.js → chunk-G3QEUH6Q.js} +2 -2
- package/dist/{chunk-T2MJE2A6.js → chunk-HEW6VJOC.js} +2 -2
- package/dist/chunk-HF34U4ZF.js +4 -0
- package/dist/{chunk-WFCJF6QX.js → chunk-I3NEQJZQ.js} +3 -3
- package/dist/{chunk-6JSMIMO4.js → chunk-I6XF24V6.js} +2 -2
- package/dist/chunk-IGZMYHXD.js +4 -0
- package/dist/{chunk-SJKII7IT.js → chunk-IHSZHN6O.js} +2 -2
- package/dist/{chunk-NS7AWBNX.js → chunk-J7B5NNPO.js} +2 -2
- package/dist/{chunk-AJZCKY52.js → chunk-KAV6YZGV.js} +2 -2
- package/dist/{chunk-3PKGBGJH.js → chunk-L766XAX3.js} +2 -2
- package/dist/{chunk-YDGOCYSZ.js → chunk-LBOP4JKF.js} +2 -2
- package/dist/{chunk-NJNB2YHZ.js → chunk-LBSVNANO.js} +2 -2
- package/dist/{chunk-T7NP3EST.js → chunk-LFNRVTYS.js} +2 -2
- package/dist/{chunk-J4NDYMKS.js → chunk-MMI6XRQX.js} +2 -2
- package/dist/{chunk-JUJ472CI.js → chunk-MNANLNCS.js} +2 -2
- package/dist/{chunk-QQ2CXAZU.js → chunk-N66DB4DW.js} +2 -2
- package/dist/{chunk-IL5VATCE.js → chunk-NO4HS4QL.js} +2 -2
- package/dist/{chunk-44LANG25.js → chunk-OFNMJWQV.js} +2 -2
- package/dist/{chunk-2JJO7CT2.js → chunk-OGQ4U6IV.js} +2 -2
- package/dist/{chunk-W6SPKDWO.js → chunk-OJKXMZOD.js} +2 -2
- package/dist/{chunk-RVEC5B3R.js → chunk-PCV6NAAK.js} +2 -2
- package/dist/{chunk-AP6QNZED.js → chunk-PK7M5KJY.js} +2 -2
- package/dist/{chunk-M3SYADIB.js → chunk-PM5GFZ7K.js} +2 -2
- package/dist/{chunk-AWMQ7T6S.js → chunk-PWCZJOYO.js} +2 -2
- package/dist/{chunk-7GUCQZFS.js → chunk-S36EPVSQ.js} +3 -3
- package/dist/{chunk-3RQGCEYT.js → chunk-S6CT7QYD.js} +2 -2
- package/dist/{chunk-LNLQCIVY.js → chunk-SA7ZCS57.js} +2 -2
- package/dist/{chunk-3NUKWDG4.js → chunk-SWZ47KNM.js} +2 -2
- package/dist/{chunk-YZHHINMS.js → chunk-TOO3IRV2.js} +2 -2
- package/dist/{chunk-RSSTB34P.js → chunk-VCXHU46R.js} +2 -2
- package/dist/{chunk-OWALS3U3.js → chunk-WH2N7OIO.js} +2 -2
- package/dist/chunk-WSTEEZR2.js +82 -0
- package/dist/{chunk-3DIPD6U3.js → chunk-XV4L6ZZW.js} +2 -2
- package/dist/{chunk-ADOZU7DR.js → chunk-YKXP53WF.js} +2 -2
- package/dist/{chunk-4KDXCXCU.js → chunk-YQWPQIAT.js} +2 -2
- package/dist/{chunk-3P7MAFTZ.js → chunk-ZH2U6Z6K.js} +2 -2
- package/dist/clean-Q3TZOFUJ.js +8 -0
- package/dist/close_out-PTIPM3PK.js +8 -0
- package/dist/code-BUNUJ2W3.js +4 -0
- package/dist/{config-4DS47FY2.js → config-6MNBCGS3.js} +2 -2
- package/dist/{connect-3W3D7G2U.js → connect-LQKEWBWV.js} +2 -2
- package/dist/{daemon-XLUSBTXO.js → daemon-BZU6CK7N.js} +2 -2
- package/dist/dashboard.js +1 -1
- package/dist/{detect-DCA5WCHB.js → detect-LSPWGEOM.js} +2 -2
- package/dist/{down-FSRQVDQK.js → down-LEOIK4OY.js} +3 -3
- package/dist/{fixture-UFXMN67J.js → fixture-O4H4JIDN.js} +2 -2
- package/dist/form-cli.js +1 -1
- package/dist/hooks-CHQKWPBJ.js +4 -0
- package/dist/{hooks_gen-ZIACQ2MX.js → hooks_gen-OVQAIWEX.js} +2 -2
- package/dist/infra-WSY5I6LI.js +4 -0
- package/dist/init_workspace-XSBDBCPS.js +4 -0
- package/dist/{intercept-3JRFBOQ6.js → intercept-MNBDHQJ7.js} +2 -2
- package/dist/{issue-Q2G7C76R.js → issue-GZXM2RR5.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-UEFLKGMV.js +7 -0
- package/dist/logs-F4HLXLKU.js +6 -0
- package/dist/main.js +5 -5
- package/dist/mcp-proxy.js +1 -1
- package/dist/mcp.js +19 -19
- package/dist/{migrate-KXDBT2XQ.js → migrate-PQR3O2FX.js} +2 -2
- package/dist/notes-JSKGX7FI.js +4 -0
- package/dist/{open-L3LSRBFA.js → open-MCQTSCWF.js} +2 -2
- package/dist/{optimize-HYSAIE3Z.js → optimize-BIQFV4YN.js} +2 -2
- package/dist/pause-AGHXL5N4.js +4 -0
- package/dist/pr-D4WAT3SU.js +5 -0
- package/dist/proxy_reload-EVVA6LYX.js +6 -0
- package/dist/{registry-JQPISUNZ.js → registry-UZ6VLJZP.js} +2 -2
- package/dist/remove-4GVSAUYM.js +7 -0
- package/dist/remove_workspace-3QKG4ABK.js +8 -0
- package/dist/restart-WIFG35JS.js +8 -0
- package/dist/resume-I5RZUXQH.js +8 -0
- package/dist/{safari-5CGSW5PU.js → safari-YX2O7P2R.js} +2 -2
- package/dist/{sandbox-3AZEXNCU.js → sandbox-Z7EKZKRV.js} +2 -2
- package/dist/{services-3R3PB4ZW.js → services-XBD543ZZ.js} +2 -2
- package/dist/{setup-A4HOTKL3.js → setup-HRAOD75R.js} +2 -2
- package/dist/skills-XGBM3JUR.js +4 -0
- package/dist/slots-WDBO6I6S.js +4 -0
- package/dist/{standards-KIZW4OV6.js → standards-2FFBOKMD.js} +2 -2
- package/dist/start_args-2YSDLIRJ.js +4 -0
- package/dist/starting_prompt-XMTWFIBE.js +4 -0
- package/dist/stats-EGB4LTTY.js +4 -0
- package/dist/status-MUZPU2VT.js +13 -0
- package/dist/{stop-OJDG5NAZ.js → stop-QYB6W4GK.js} +2 -2
- package/dist/{telepresence-RFXBG3V3.js → telepresence-HDNCXLWZ.js} +2 -2
- package/dist/{test-SQ6RNRRJ.js → test-S2VBYZLP.js} +2 -2
- package/dist/{tokens-4XLTSUIZ.js → tokens-KJ5AERQN.js} +2 -2
- package/dist/{up-XN7JE5OZ.js → up-DRYRRB7Q.js} +3 -3
- package/dist/{v4-RJV2SL56.js → v4-423YAJGU.js} +2 -2
- package/dist/wait_load-4PH7CAO4.js +4 -0
- package/dist/werkmeister-workspaces.vsix +0 -0
- package/dist/{workspace-KW2AIGUP.js → workspace-VASWJFFX.js} +2 -2
- package/man/werkmeister-pr.1 +3 -1
- package/package.json +4 -4
- package/dist/chunk-63CZKUBE.js +0 -13
- package/dist/chunk-C7IY6HKO.js +0 -180
- package/dist/chunk-EPUMCDXY.js +0 -4
- package/dist/chunk-FIL4QXN5.js +0 -4
- package/dist/chunk-GTBLZ6I2.js +0 -82
- package/dist/chunk-JJOAW3AU.js +0 -4
- package/dist/clean-DRPHOK4W.js +0 -8
- package/dist/close_out-UGEG2RDS.js +0 -8
- package/dist/code-D4XSRJ5U.js +0 -4
- package/dist/hooks-PFXKWUXM.js +0 -4
- package/dist/infra-7OHFMJ75.js +0 -4
- package/dist/init_workspace-J3I2ROUP.js +0 -4
- package/dist/list_workspaces-4LH2IYT6.js +0 -7
- package/dist/logs-NOAJDXIR.js +0 -6
- package/dist/notes-B35RVVAX.js +0 -4
- package/dist/pause-46LSFRUL.js +0 -4
- package/dist/pr-FVYS4G27.js +0 -5
- package/dist/proxy_reload-NB7P377R.js +0 -6
- package/dist/remove-Q6QS7HXM.js +0 -7
- package/dist/remove_workspace-3PH73FOP.js +0 -8
- package/dist/restart-QSMBTGZ5.js +0 -8
- package/dist/resume-INAE3KIT.js +0 -8
- package/dist/skills-V3ICMSN3.js +0 -4
- package/dist/slots-JVAQYINI.js +0 -4
- package/dist/start_args-SMH43KYT.js +0 -4
- package/dist/starting_prompt-AQVJJST3.js +0 -4
- package/dist/stats-L3I7B6GF.js +0 -4
- package/dist/status-MBV2OWEL.js +0 -13
- package/dist/wait_load-6ZZKAGFC.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{c as v,k as L}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=budget-
|
|
3
|
+
import{c as v,k as L}from"./chunk-S36EPVSQ.js";import"./chunk-WH2N7OIO.js";import"./chunk-ZH2U6Z6K.js";import"./chunk-MNANLNCS.js";import"./chunk-ELLCJ25G.js";import"./chunk-S6CT7QYD.js";import"./chunk-5VBOWGVH.js";import"./chunk-3QSQOSVX.js";import"./chunk-WSTEEZR2.js";import"./chunk-C25JQ6TF.js";import"./chunk-YQWPQIAT.js";import"./chunk-F5YT2U6R.js";import"./chunk-FN2A7LG6.js";import"./chunk-PWCZJOYO.js";import"./chunk-4YFK45ID.js";import"./chunk-2DWIVGDO.js";import"./chunk-PK7M5KJY.js";import"./chunk-SWZ47KNM.js";import{A as h,B as w,H as b,K as y,P as k,v as f,w as $}from"./chunk-4O5AVQ7C.js";import"./chunk-L766XAX3.js";import"./chunk-FS6YA3CG.js";import"./chunk-5LQO3VEP.js";import"./chunk-PM5GFZ7K.js";import{o as d}from"./chunk-LBOP4JKF.js";import"./chunk-4TT37SCP.js";import"./chunk-OFNMJWQV.js";import"./chunk-HF34U4ZF.js";import"./chunk-N66DB4DW.js";import"./chunk-6RPHJEST.js";import"./chunk-4HOBUMZ4.js";import"./chunk-J7B5NNPO.js";import"./chunk-6JER3JWG.js";import{a as c,f as g}from"./chunk-MMI6XRQX.js";g();import N from"node:os";var M=2**30,x=c((r,t)=>Number.isFinite(r)?`${Number(r.toFixed(1))}${t}`:"no limit","limit");async function P(r){let t=await h(),m=w(N.cpus().length),u=$(),l=await k(),n=L(),a=f(y(l,n??[])).map((o,e)=>{let s=u[o.feature]?.workspace,i=s&&d(s)?.services||null,B=s?b(s,i??void 0):null;return{...o,position:e+1,services:i,cost:B}});if(r.json){let o=c(e=>Number.isFinite(e)?e:null,"n");console.log(JSON.stringify({budget:{memory:o(t.memory),cpus:o(t.cpus),preempt:t.preempt},host_load:m,leases:u,waiting:l,running:n?.map(e=>({feature:e.feature,cpus:e.cost.cpus,memory:e.cost.memory,rank:e.rank,busy:e.busy}))??null,waiters:a.map(e=>({feature:e.feature,position:e.position,services:e.services,cpus:e.cost?.cpus??null,memory:e.cost?.memory??null,waited_ms:e.waitedMs,gate:e.gate}))}));return}console.log(`Budget: ${x(t.memory/M," GiB")} memory, ${x(t.cpus," CPUs")}, host load ${m||"unchecked"}, preemption ${t.preempt?"on":"off"}`);let p=Object.entries(u).sort(([,o],[,e])=>o.slot-e.slot);console.log(p.length?"Slots:":"Slots: none held");for(let[o,e]of p)console.log(` ${e.slot} ${o}${e.workspace?` ${e.workspace}`:""}`);console.log(n?n.length?"Running:":"Running: none":"Running: docker unavailable");for(let o of[...n??[]].sort((e,s)=>s.cost.cpus-e.cost.cpus))console.log(` ${v(o)}`);console.log(a.length?"Waiting:":"Waiting: none");for(let o of a){let e=o.services?`${o.services.join(", ")}${o.gate?" for a running feature":""}`:"whole feature",s=o.cost?` (${Number(o.cost.cpus.toFixed(1))} CPUs, ${(o.cost.memory/M).toFixed(1)} GiB)`:"",i=o.waitedMs?` waited ${Math.round(o.waitedMs/6e4)} min${o.position===1&&o.waitedMs>=3e5?", gets the next free room":""}`:"";console.log(` ${o.position}. ${o.feature} ${e}${s}${i}`)}}c(P,"run");export{P as run};
|
|
4
|
+
//# sourceMappingURL=budget-P5JBRTPG.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-CTJWIG5A.js";import{c as s}from"./chunk-S6CT7QYD.js";import"./chunk-4YFK45ID.js";import"./chunk-L766XAX3.js";import"./chunk-5LQO3VEP.js";import"./chunk-4HOBUMZ4.js";import{h as e,l as c}from"./chunk-J7B5NNPO.js";import"./chunk-6JER3JWG.js";import{a as r,f as i}from"./chunk-MMI6XRQX.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-DUYHRESP.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{b as D,c as Ge,d as ze,e as Ye,f as He,g as qe,h as Ze,i as Ke,j as Ve}from"./chunk-
|
|
3
|
+
import{b as D,c as Ge,d as ze,e as Ye,f as He,g as qe,h as Ze,i as Ke,j as Ve}from"./chunk-PK7M5KJY.js";import{a as Ce}from"./chunk-FS6YA3CG.js";import{a as De,b as Me,c as B,e as C,f as G,g as Le,j as ie,k as T,l as We,m as Be,n as ae}from"./chunk-5LQO3VEP.js";import{c as Fe,e as Ne,f as Ue,g as Je}from"./chunk-LBOP4JKF.js";import{a as oe,b as E,n as Pe,q as P,u as v,v as ve}from"./chunk-6RPHJEST.js";import{c as d}from"./chunk-4HOBUMZ4.js";import{B as Re,M as Oe,R as O,a as Te,j as Ae,l as R,s as W,t as Ie,x as se}from"./chunk-J7B5NNPO.js";import{b as ne}from"./chunk-6JER3JWG.js";import{a,e as Ee,f as p}from"./chunk-MMI6XRQX.js";p();import{spawn as sr}from"node:child_process";import{EventEmitter as or}from"node:events";import ir from"node:path";var Xe=new Map,z=new or;z.setMaxListeners(0);function Y(e){let t=Xe.get(e);return t?{state:t.state,startedAt:t.startedAt,exitCode:t.exitCode,error:t.error}:{state:"idle",startedAt:null,exitCode:null,error:null}}a(Y,"turnStatus");async function Qe(e,t,r,n,s){let o=sr(t,r,{cwd:n,env:C(),detached:!0,stdio:["ignore",s?"pipe":"ignore","pipe"]}),i="";o.stdout?.on("data",f=>{i+=f.toString()});let u=new Promise(f=>{o.on("exit",()=>f()),o.on("error",()=>f())}),c={pid:o.pid??null,startedAt:new Date().toISOString(),state:"running",exitCode:null,error:null};Xe.set(e,c),z.emit(e,{state:"running",error:null});let l="";if(o.stderr?.on("data",f=>{l.length<8192&&(l+=f.toString())}),o.on("error",f=>{c.state="failed",c.error=f.message,z.emit(e,{state:"failed",error:c.error})}),o.on("exit",f=>{if(c.exitCode=f,f===0)c.state="done";else{c.state="failed";let m=De(l).trim().split(`
|
|
4
4
|
`).slice(-2).join(" ");c.error=`${ir.basename(t)} exited with code ${f}${m?`: ${m}`:""}`}z.emit(e,{state:c.state,error:c.error})}),await new Promise(f=>{let m=setTimeout(f,2500),j=a(()=>{clearTimeout(m),f()},"settle");o.on("error",j),o.on("exit",j)}),c.state==="failed")throw new d(`Could not start the turn \u2014 ${c.error}`);if(!s)return o.unref(),null;if(await u,c.error)throw new d(`The turn failed \u2014 ${c.error}`);return i}a(Qe,"runTurn");p();import ce from"node:os";import et from"node:path";async function ue(){if(Ie())return Le();let e=[process.env.CLAUDE_BIN,et.join(ce.homedir(),".local","bin","claude"),et.join(ce.homedir(),".claude","local","claude"),"/opt/homebrew/bin/claude","/usr/local/bin/claude"].filter(t=>!!t);for(let t of e)if(await Me(t))return t;return"claude"}a(ue,"resolveClaudeBin");function ar(e){let t=e.match(/<result>\s*([\s\S]*?)\s*<\/result>/i);return(t?t[1]:e).trim()}a(ar,"extractResult");function wn(e){let t=a(s=>{let o=s.indexOf("{"),i=s.lastIndexOf("}");return o!==-1&&i>o?s.slice(o,i+1):null},"slice"),r=t(e);if(r)try{return JSON.parse(r),r}catch{}let n=/```(?:json)?\s*([\s\S]*?)```/i.exec(e);return n?t(n[1]):r}a(wn,"extractJson");var cr={type:"object",properties:{result:{type:"string"}},required:["result"]};async function tt(e,t,r){let{query:n}=await import("@anthropic-ai/claude-agent-sdk"),s=new AbortController,o=setTimeout(()=>s.abort(),12e4);try{for await(let i of n({prompt:e,options:{cwd:ce.homedir(),pathToClaudeCodeExecutable:await ue(),env:C(),abortController:s,outputFormat:{type:"json_schema",schema:t},...r.tools?{permissionMode:"bypassPermissions",allowDangerouslySkipPermissions:!0}:{tools:[]}}}))if(i.type==="result")return i;throw new d("the Claude session ended without a result")}catch(i){throw s.signal.aborted?new d("The `claude` CLI timed out after 120s."):i}finally{clearTimeout(o)}}a(tt,"runQuery");function rt(e){if(e.subtype!=="success")throw new d(`claude ended with ${e.subtype}:
|
|
5
5
|
${e.errors.join(`
|
|
6
6
|
`)}`);if(e.is_error)throw new d(`claude ended with an error:
|
|
@@ -10,7 +10,7 @@ ${e.result}`);if(!e.structured_output||typeof e.structured_output!="object")thro
|
|
|
10
10
|
`)}a(mt,"extractMessageText");function pr(e){if(!e||typeof e!="object")return"";let t=e,r=["command","file_path","path","pattern","query","url","prompt","description","name","message"];for(let s of r){let o=t[s];if(typeof o=="string"&&o.trim())return o.trim().replace(/\s+/g," ").slice(0,100)}let n=Object.values(t).find(s=>typeof s=="string"&&s.trim());return typeof n=="string"?n.trim().replace(/\s+/g," ").slice(0,100):""}a(pr,"summarizeToolInput");function H(e){let t=e.replace(/<([a-z][a-z0-9_-]*)>[\s\S]*?<\/\1>/gi,"").replace(/\n{3,}/g,`
|
|
11
11
|
|
|
12
12
|
`).trim();return!t||t.startsWith("[Request interrupted")?"":t}a(H,"cleanMessageText");function N(e){let t=[];for(let r of e.split(`
|
|
13
|
-
`)){if(!r.trim())continue;let n;try{n=JSON.parse(r)}catch{continue}if(n.isMeta&&n.origin?.kind!=="peer"||n.type!=="user"&&n.type!=="assistant")continue;let s=n.message?.role,o=n.timestamp??null,i=n.message?.content;if(s==="user"){let u=H(mt(i));u&&t.push({role:"user",text:u,timestamp:o});continue}if(s==="assistant"){if(typeof i=="string"){let u=H(i);u&&t.push({role:"assistant",text:u,timestamp:o});continue}if(Array.isArray(i))for(let u of i){if(!u||typeof u!="object")continue;let c=u;if(c.type==="text"&&typeof c.text=="string"){let l=H(c.text);l&&t.push({role:"assistant",text:l,timestamp:o})}else if(c.type==="tool_use"&&typeof c.name=="string"){let l=pr(c.input);t.push({role:"tool",text:l?`${c.name}: ${l}`:c.name,timestamp:o})}}}}return t}a(N,"parseSessionLines");async function ht(e,t,r){let n=await L(r??e),s={workspacePath:e,projectDir:n,sessionFile:null,sessionId:null,sessionCount:0,updatedAt:null};if(!n)return{...s,projectDir:null};let o=await F(n),i=pt(o,t);return i?{workspacePath:e,projectDir:n,sessionFile:i.file,sessionId:b.basename(i.file,".jsonl"),sessionCount:o.length,updatedAt:i.mtime.toISOString()}:s}a(ht,"sessionSourceIn");async function wt(e){if(!/^[\w-]+$/.test(e))return null;let t=b.join(lt.homedir(),".claude","projects"),r;try{r=await M.readdir(t)}catch{return null}for(let n of r){let s=b.join(t,n,`${e}.jsonl`);if(!await B(s))continue;let o=ft.createInterface({input:ut(s,"utf-8"),crlfDelay:1/0}),i=0;try{for await(let u of o){if(++i>50)break;try{let c=JSON.parse(u)?.cwd;if(typeof c=="string"&&c)return c}catch{}}}finally{o.close()}}return null}a(wt,"sessionStartDir");async function gt(e,t=20,r){let n={sessionId:null,workspacePath:e,messages:[],sessionCount:0,updatedAt:null},s=await L(e);if(!s)return n;let o=await F(s),i=pt(o,r);if(!i)return n;let u=b.basename(i.file,".jsonl"),c;try{c=await M.readFile(i.file,"utf-8")}catch(f){throw new d(`Could not read session file: ${f.message}`)}let l=N(c);return{sessionId:u,workspacePath:e,messages:it(l,t),sessionCount:o.length,updatedAt:i.mtime.toISOString()}}a(gt,"transcriptIn");p();var I=["claude","mcp","codex","opencode"];p();var kt="^([A-Za-z0-9_.-]+/)?[A-Za-z0-9_.-]+#[0-9]+$",q=/^([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)#(\d+)$/,dr=new Set(["closed","close","done","completed"]),mr=new Set(["not planned","abandoned"]),yt="status:",hr=new Set(["open","reopen","reopened"]),wr="1D76DB";function xt(e,t=v()){let r=e.trim(),n=/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/.exec(r);return n?`${n[1]}#${n[2]}`:/^[^/#]+#\d+$/.test(r)&&t?`${t}/${r}`:r}a(xt,"normalizeGithubIssue");function Z(e={}){if(e.repos?.length)return[...e.repos].sort();let t=e.org||v();if(!t)return[];let r;try{r=Object.keys(O())}catch{r=[]}return r.sort().map(n=>`${t}/${n}`)}a(Z,"githubIssueRepos");function bt(e){let t=q.exec(e);if(!t)throw new Error(`"${e}" is not a GitHub issue (owner/repo#n)`);return[t[1],t[2]]}a(bt,"split");async function S(e){let t=await ae([G(),...e],{capture:!0,env:C(),timeout:30});if(t.status!==0)throw new Error(t.stderr.trim()||`gh ${e[0]} ${e[1]} exited ${t.status}`);return t.stdout}a(S,"gh");var gr=a(e=>e?e[0]+e.slice(1).toLowerCase():void 0,"titleCase");function St(e,t){return{ref:e,title:t.title?.trim()||void 0,status:gr(t.state),...t.state?.toUpperCase()==="CLOSED"?{statusCategory:"done"}:{},labels:t.labels?.map(r=>r.name),type:t.labels?.map(r=>r.name).join(", ")||void 0,assignee:t.assignees?.map(r=>r.login).join(", ")||void 0,description:t.body?.trim()||void 0,url:t.url,comments:(t.comments??[]).flatMap(r=>{let n=r.body?.trim();return n?[{author:r.author?.login??"unknown",created:r.createdAt,body:n}]:[]})}}a(St,"fromGh");async function pe(e,t,r){try{let[n,s]=bt(e);return St(e,JSON.parse(await S(["issue","view",s,"-R",n,"--json",t])))}catch(n){return r?.push(n.message),null}}a(pe,"view");function de(e={}){let t=e.org||void 0,r=e.repos?.map(n=>n.toLowerCase());return{id:"github",label:"GitHub",refExample:"owner/repo#12",refPattern:kt,parseRef(n){let s=xt(n??"",t??v());if(q.test(s))return s;let o=/github\.com\/([^/\s]+\/[^/\s]+)\/issues\/(\d+)/.exec(s);return o?`${o[1]}#${o[2]}`:/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+#\d+/.exec(s)?.[0]??null},slug:a(n=>(n.split("/").pop()??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),"slug"),holds(n){let s=q.exec(n)?.[1].toLowerCase();return s?r?.length?r.includes(s):!t||s.startsWith(`${t.toLowerCase()}/`):!1},url(n){let s=q.exec(n);return s?`https://github.com/${s[1]}/issues/${s[2]}`:null},fetchIssue:a((n,s)=>pe(n,"title,state,body,url,labels,assignees,comments",s),"fetchIssue"),async fetchIssues(n){let s=await Promise.all(n.map(o=>pe(o,"title,state,url")));return Object.fromEntries(s.filter(o=>o!==null).map(o=>[o.ref,o]))},filingGuide(n,s="<workspace>"){let o=Z(e);return{row:`| app code in a worktree | ${o.length?`the GitHub issues of the repo it belongs to \u2014 one of ${o.map(u=>`\`${u}\``).join(", ")}`:"that repo's GitHub issues \u2014 find it with `git -C <worktree> remote get-url origin`"} | \`gh issue create -R <owner>/<repo> --label <label>\` |`,search:`Search first: \`gh issue list -R <owner>/<repo> --search "<keywords>" --state all\`, then the same with \`--search "${s}"\`: other sessions file from the same review and exercise files, and an issue filed from this workspace names it. If it exists, comment on it instead.`}},async listReady(n){if(n){let i=t||v(),u;try{u=await S(["project","item-list",n.id,"--owner",i,"--format","json","--limit","200","--query",`status:"${n.ready}"`])}catch(l){throw new Error(`${l.message} (boards need the read:project scope: gh auth refresh -s read:project)`)}let{items:c=[]}=JSON.parse(u);return c.flatMap(({status:l,content:f})=>f?.type==="Issue"&&l?.toLowerCase()===n.ready.toLowerCase()?[{ref:`${f.repository}#${f.number}`,title:f.title,status:l,url:f.url}]:[])}let s=Z(e);if(!s.length)throw new Error("no repos in scope");return(await Promise.all(s.map(async i=>JSON.parse(await S(["issue","list","-R",i,"--state","open","--limit","100","--json","number,title,url,labels","--search","sort:created-asc"])).map(c=>St(`${i}#${c.number}`,{...c,state:"OPEN"}))))).flat()},async updateIssue(n,s){let[o,i]=bt(n),u=s.status?.trim();if(u){let c=u.toLowerCase();if(dr.has(c))await S(["issue","close",i,"-R",o,"--reason","completed"]);else if(mr.has(c))await S(["issue","close",i,"-R",o,"--reason","not planned"]);else if(hr.has(c))await S(["issue","reopen",i,"-R",o]);else{let l=c.startsWith(yt)?((await pe(n,"labels"))?.labels??[]).filter(f=>f.toLowerCase().startsWith(yt)&&f.toLowerCase()!==c):[];await S(["label","create",u,"-R",o,"--color",wr,"--force"]),await S(["issue","edit",i,"-R",o,"--add-label",u,...l.length?["--remove-label",l.join(",")]:[]])}}s.comment&&await S(["issue","comment",i,"-R",o,"--body",s.comment])},async checkAuth(){let n=a(i=>ae([G(),...i],{capture:!0,env:C(),timeout:15}).catch(()=>null),"run"),s=await n(["auth","status","--hostname","github.com"]);if(s?.status!==0)return{ok:!1,reason:"not signed in",fix:"gh auth login"};let o=/account (\S+)/.exec(`${s.stdout}${s.stderr}`)?.[1];for(let i of Z(e))if((await n(["repo","view",i,"--json","name"]))?.status!==0)return{ok:!1,...o?{who:o}:{},reason:`can't read ${i}`,fix:"gh auth refresh -s repo"};return{ok:!0,...o?{who:o}:{},fix:""}}}}a(de,"githubTracker");var jt=de();p();p();p();p();p();import yr from"node:fs/promises";import kr from"node:path";function _t(e,t,r){return at(e,t,r,N)}a(_t,"sessionSignal");function xr(e,t,r,n={}){return["-p",...n.allow?.length?["--allowedTools",n.allow.join(",")]:[],...n.deny?.length?["--disallowedTools",n.deny.join(",")]:[],"--permission-mode","acceptEdits",...n.json?["--output-format","json"]:[],...r?["--model",r]:[],...t?["--resume",t]:[],e]}a(xr,"claudeSendArgs");async function $t(e,t,r,n,s,o={}){let i=await ue(),u=o.unattended,c=u&&await import("./hooks_gen-
|
|
13
|
+
`)){if(!r.trim())continue;let n;try{n=JSON.parse(r)}catch{continue}if(n.isMeta&&n.origin?.kind!=="peer"||n.type!=="user"&&n.type!=="assistant")continue;let s=n.message?.role,o=n.timestamp??null,i=n.message?.content;if(s==="user"){let u=H(mt(i));u&&t.push({role:"user",text:u,timestamp:o});continue}if(s==="assistant"){if(typeof i=="string"){let u=H(i);u&&t.push({role:"assistant",text:u,timestamp:o});continue}if(Array.isArray(i))for(let u of i){if(!u||typeof u!="object")continue;let c=u;if(c.type==="text"&&typeof c.text=="string"){let l=H(c.text);l&&t.push({role:"assistant",text:l,timestamp:o})}else if(c.type==="tool_use"&&typeof c.name=="string"){let l=pr(c.input);t.push({role:"tool",text:l?`${c.name}: ${l}`:c.name,timestamp:o})}}}}return t}a(N,"parseSessionLines");async function ht(e,t,r){let n=await L(r??e),s={workspacePath:e,projectDir:n,sessionFile:null,sessionId:null,sessionCount:0,updatedAt:null};if(!n)return{...s,projectDir:null};let o=await F(n),i=pt(o,t);return i?{workspacePath:e,projectDir:n,sessionFile:i.file,sessionId:b.basename(i.file,".jsonl"),sessionCount:o.length,updatedAt:i.mtime.toISOString()}:s}a(ht,"sessionSourceIn");async function wt(e){if(!/^[\w-]+$/.test(e))return null;let t=b.join(lt.homedir(),".claude","projects"),r;try{r=await M.readdir(t)}catch{return null}for(let n of r){let s=b.join(t,n,`${e}.jsonl`);if(!await B(s))continue;let o=ft.createInterface({input:ut(s,"utf-8"),crlfDelay:1/0}),i=0;try{for await(let u of o){if(++i>50)break;try{let c=JSON.parse(u)?.cwd;if(typeof c=="string"&&c)return c}catch{}}}finally{o.close()}}return null}a(wt,"sessionStartDir");async function gt(e,t=20,r){let n={sessionId:null,workspacePath:e,messages:[],sessionCount:0,updatedAt:null},s=await L(e);if(!s)return n;let o=await F(s),i=pt(o,r);if(!i)return n;let u=b.basename(i.file,".jsonl"),c;try{c=await M.readFile(i.file,"utf-8")}catch(f){throw new d(`Could not read session file: ${f.message}`)}let l=N(c);return{sessionId:u,workspacePath:e,messages:it(l,t),sessionCount:o.length,updatedAt:i.mtime.toISOString()}}a(gt,"transcriptIn");p();var I=["claude","mcp","codex","opencode"];p();var kt="^([A-Za-z0-9_.-]+/)?[A-Za-z0-9_.-]+#[0-9]+$",q=/^([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)#(\d+)$/,dr=new Set(["closed","close","done","completed"]),mr=new Set(["not planned","abandoned"]),yt="status:",hr=new Set(["open","reopen","reopened"]),wr="1D76DB";function xt(e,t=v()){let r=e.trim(),n=/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/.exec(r);return n?`${n[1]}#${n[2]}`:/^[^/#]+#\d+$/.test(r)&&t?`${t}/${r}`:r}a(xt,"normalizeGithubIssue");function Z(e={}){if(e.repos?.length)return[...e.repos].sort();let t=e.org||v();if(!t)return[];let r;try{r=Object.keys(O())}catch{r=[]}return r.sort().map(n=>`${t}/${n}`)}a(Z,"githubIssueRepos");function bt(e){let t=q.exec(e);if(!t)throw new Error(`"${e}" is not a GitHub issue (owner/repo#n)`);return[t[1],t[2]]}a(bt,"split");async function S(e){let t=await ae([G(),...e],{capture:!0,env:C(),timeout:30});if(t.status!==0)throw new Error(t.stderr.trim()||`gh ${e[0]} ${e[1]} exited ${t.status}`);return t.stdout}a(S,"gh");var gr=a(e=>e?e[0]+e.slice(1).toLowerCase():void 0,"titleCase");function St(e,t){return{ref:e,title:t.title?.trim()||void 0,status:gr(t.state),...t.state?.toUpperCase()==="CLOSED"?{statusCategory:"done"}:{},labels:t.labels?.map(r=>r.name),type:t.labels?.map(r=>r.name).join(", ")||void 0,assignee:t.assignees?.map(r=>r.login).join(", ")||void 0,description:t.body?.trim()||void 0,url:t.url,comments:(t.comments??[]).flatMap(r=>{let n=r.body?.trim();return n?[{author:r.author?.login??"unknown",created:r.createdAt,body:n}]:[]})}}a(St,"fromGh");async function pe(e,t,r){try{let[n,s]=bt(e);return St(e,JSON.parse(await S(["issue","view",s,"-R",n,"--json",t])))}catch(n){return r?.push(n.message),null}}a(pe,"view");function de(e={}){let t=e.org||void 0,r=e.repos?.map(n=>n.toLowerCase());return{id:"github",label:"GitHub",refExample:"owner/repo#12",refPattern:kt,parseRef(n){let s=xt(n??"",t??v());if(q.test(s))return s;let o=/github\.com\/([^/\s]+\/[^/\s]+)\/issues\/(\d+)/.exec(s);return o?`${o[1]}#${o[2]}`:/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+#\d+/.exec(s)?.[0]??null},slug:a(n=>(n.split("/").pop()??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),"slug"),holds(n){let s=q.exec(n)?.[1].toLowerCase();return s?r?.length?r.includes(s):!t||s.startsWith(`${t.toLowerCase()}/`):!1},url(n){let s=q.exec(n);return s?`https://github.com/${s[1]}/issues/${s[2]}`:null},fetchIssue:a((n,s)=>pe(n,"title,state,body,url,labels,assignees,comments",s),"fetchIssue"),async fetchIssues(n){let s=await Promise.all(n.map(o=>pe(o,"title,state,url")));return Object.fromEntries(s.filter(o=>o!==null).map(o=>[o.ref,o]))},filingGuide(n,s="<workspace>"){let o=Z(e);return{row:`| app code in a worktree | ${o.length?`the GitHub issues of the repo it belongs to \u2014 one of ${o.map(u=>`\`${u}\``).join(", ")}`:"that repo's GitHub issues \u2014 find it with `git -C <worktree> remote get-url origin`"} | \`gh issue create -R <owner>/<repo> --label <label>\` |`,search:`Search first: \`gh issue list -R <owner>/<repo> --search "<keywords>" --state all\`, then the same with \`--search "${s}"\`: other sessions file from the same review and exercise files, and an issue filed from this workspace names it. If it exists, comment on it instead.`}},async listReady(n){if(n){let i=t||v(),u;try{u=await S(["project","item-list",n.id,"--owner",i,"--format","json","--limit","200","--query",`status:"${n.ready}"`])}catch(l){throw new Error(`${l.message} (boards need the read:project scope: gh auth refresh -s read:project)`)}let{items:c=[]}=JSON.parse(u);return c.flatMap(({status:l,content:f})=>f?.type==="Issue"&&l?.toLowerCase()===n.ready.toLowerCase()?[{ref:`${f.repository}#${f.number}`,title:f.title,status:l,url:f.url}]:[])}let s=Z(e);if(!s.length)throw new Error("no repos in scope");return(await Promise.all(s.map(async i=>JSON.parse(await S(["issue","list","-R",i,"--state","open","--limit","100","--json","number,title,url,labels","--search","sort:created-asc"])).map(c=>St(`${i}#${c.number}`,{...c,state:"OPEN"}))))).flat()},async updateIssue(n,s){let[o,i]=bt(n),u=s.status?.trim();if(u){let c=u.toLowerCase();if(dr.has(c))await S(["issue","close",i,"-R",o,"--reason","completed"]);else if(mr.has(c))await S(["issue","close",i,"-R",o,"--reason","not planned"]);else if(hr.has(c))await S(["issue","reopen",i,"-R",o]);else{let l=c.startsWith(yt)?((await pe(n,"labels"))?.labels??[]).filter(f=>f.toLowerCase().startsWith(yt)&&f.toLowerCase()!==c):[];await S(["label","create",u,"-R",o,"--color",wr,"--force"]),await S(["issue","edit",i,"-R",o,"--add-label",u,...l.length?["--remove-label",l.join(",")]:[]])}}s.comment&&await S(["issue","comment",i,"-R",o,"--body",s.comment])},async checkAuth(){let n=a(i=>ae([G(),...i],{capture:!0,env:C(),timeout:15}).catch(()=>null),"run"),s=await n(["auth","status","--hostname","github.com"]);if(s?.status!==0)return{ok:!1,reason:"not signed in",fix:"gh auth login"};let o=/account (\S+)/.exec(`${s.stdout}${s.stderr}`)?.[1];for(let i of Z(e))if((await n(["repo","view",i,"--json","name"]))?.status!==0)return{ok:!1,...o?{who:o}:{},reason:`can't read ${i}`,fix:"gh auth refresh -s repo"};return{ok:!0,...o?{who:o}:{},fix:""}}}}a(de,"githubTracker");var jt=de();p();p();p();p();p();import yr from"node:fs/promises";import kr from"node:path";function _t(e,t,r){return at(e,t,r,N)}a(_t,"sessionSignal");function xr(e,t,r,n={}){return["-p",...n.allow?.length?["--allowedTools",n.allow.join(",")]:[],...n.deny?.length?["--disallowedTools",n.deny.join(",")]:[],"--permission-mode","acceptEdits",...n.json?["--output-format","json"]:[],...r?["--model",r]:[],...t?["--resume",t]:[],e]}a(xr,"claudeSendArgs");async function $t(e,t,r,n,s,o={}){let i=await ue(),u=o.unattended,c=u&&await import("./hooks_gen-OVQAIWEX.js"),l=xr(r,n,s,{...u&&c&&{allow:c.workspaceAllowRules(u,!0),deny:c.workspaceDenyRules(u,!0)},json:o.wait}),f=await Qe(e,i,l,t,!!o.wait);return f===null?null:{denied:br(f)}}a($t,"startTurn");function br(e){let t;try{t=JSON.parse(e)}catch{return[]}let r=(t.permission_denials??[]).map(n=>{let s=String(n.tool_input?.command??"").split(`
|
|
14
14
|
`)[0].slice(0,120);return s?`${n.tool_name}: ${s}`:String(n.tool_name)});return[...new Set(r)]}a(br,"deniedIn");function Qn(e,t){let r=Date.parse(t.sentAt);return e.some(n=>n.role==="user"&&n.timestamp!==null&&Date.parse(n.timestamp)>r&&n.text.includes(t.text))}a(Qn,"relayPickedUp");async function es(e,t){let r=t==="codex"?"codex":"claude",n=t==="codex"?/^ (exec|e)( |$)/:/(^| )(-p|--print)( |$)/,o=((await ie("ps",["-axo","pid=,args="]).catch(()=>null))?.stdout??"").split(`
|
|
15
15
|
`).map(c=>c.trim().match(/^(\d+) (\S+)(.*)$/)).filter(c=>c&&kr.basename(c[2])===r&&!n.test(c[3])).map(c=>c?.[1]);if(!o.length)return!1;let i=await yr.realpath(e).catch(()=>e);return((await ie("lsof",["-a","-d","cwd","-Fn","-p",o.join(",")]).catch(()=>null))?.stdout??"").split(`
|
|
16
16
|
`).some(c=>c.startsWith("n")&&(c.slice(1)===i||c.slice(1).startsWith(`${i}/`)))}a(es,"claudeOpenIn");function Et(e,t,r){return["claude",...t?["--model",T(t)]:[],...e?["--resume",e]:[],...r?[T(r)]:[]].join(" ")}a(Et,"claudeResumeCommand");p();var It=Ee(Te(),1);import At from"node:fs/promises";import Sr from"node:path";var K=a(()=>({input:0,output:0,cacheCreation:0,cacheRead:0}),"zeroTotals");function me(e,t){e.input+=t.input,e.output+=t.output,e.cacheCreation+=t.cacheCreation,e.cacheRead+=t.cacheRead}a(me,"addTotals");function Rt(e){let t=new Map,r=null,n=null,s=0;for(let o of e.split(`
|
|
@@ -30,4 +30,4 @@ Then output ONLY <result>{"ok":true}</result>, or <result>{"ok":false,"error":"<
|
|
|
30
30
|
`)}a(Ws,"issueBriefing");p();var be=["small","mid","frontier","advanced_frontier"],qt={claude:{small:"haiku",mid:"sonnet",frontier:"opus",advanced_frontier:"claude-fable-5-1"},opencode:{small:"anthropic/claude-haiku-5-5",mid:"anthropic/claude-sonnet-5-5",frontier:"anthropic/claude-opus-5-5",advanced_frontier:"anthropic/claude-fable-5-1"},codex:{}},Fr=new Set(["mcp"]),Zt=a(e=>be.includes(e),"isTier"),xe=a(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isDict");function Nr(e=se()){let t=xe(e.models)?e.models:{},r=t.default_tier;if(r!==void 0&&!(typeof r=="string"&&Zt(r)))throw new d(`models.default_tier must be one of ${be.join(", ")} (got ${String(r)})`);let n=new Set([...Object.keys(qt),...Object.keys(t).filter(o=>o!=="default_tier"&&xe(t[o]))]),s={};for(let o of n){let i=xe(t[o])?t[o]:{};s[o]=Object.fromEntries(be.map(u=>{let c=i[u];if(typeof c=="string"&&c.trim())return[u,{model:c.trim(),origin:"YAML"}];let l=qt[o]?.[u];return[u,l?{model:l,origin:"default"}:void 0]}))}return{defaultTier:r??"frontier",defaultOrigin:r===void 0?"default":"YAML",byHarness:s}}a(Nr,"modelTiers");function Kt(e,t,r){let n=(e??"").trim();if(Fr.has(t))return{model:n||null,tier:null};if(n&&!Zt(n))return{model:n,tier:null};let s=Nr(r??se()),o=n||s.defaultTier,i=s.byHarness[t]?.[o]?.model;if(!i)throw new d(`No model for tier ${o} on harness ${t}: set models.${t}.${o} in ~/.werkmeister/config.yaml`);return{model:i,tier:o}}a(Kt,"resolveModel");p();var ee=["icm","jit"];p();var Qt=Ee(Te(),1);import*as k from"node:fs";import*as Se from"node:os";import*as y from"node:path";function Ur(e){try{return k.statSync(e).isDirectory()}catch{return!1}}a(Ur,"isDir");function Jr(e){let t=[],r=0,n=e.length,s=!1;for(;r<n;){let o=e[r];if(s){if(t.push(o),o==="\\"&&r+1<n){t.push(e[r+1]),r+=2;continue}o==='"'&&(s=!1),r+=1;continue}if(o==='"'){s=!0,t.push(o),r+=1;continue}if(o==="/"&&r+1<n){let i=e[r+1];if(i==="/"){for(r+=2;r<n&&e[r]!==`
|
|
31
31
|
`;)r+=1;continue}if(i==="*"){for(r+=2;r+1<n&&!(e[r]==="*"&&e[r+1]==="/");)r+=1;r+=2;continue}}t.push(o),r+=1}return t.join("")}a(Jr,"stripJsoncComments");function er(e){let t=k.readFileSync(e,"utf8"),r=y.extname(e);return r===".yaml"||r===".yml"?Qt.parse(t):JSON.parse(Jr(t))}a(er,"loadWorkspaceConfig");var tr=[["feature",null,"feature"],["work_type","WORK_TYPE","work_type"],["context_strategy","CONTEXT_STRATEGY","context_strategy"],["harness","HARNESS","harness"],["repos","REPOS","repos"],["services","SERVICES","services"],["issue_id","ISSUE_ID","issue_id"],["project","PROJECT","project"],["test_path","TEST_PATH","test_path"],["description","DESCRIPTION","description"],["task","TASK","task"],["starting_prompt","STARTING_PROMPT","starting_prompt"],["labels","LABELS","labels"],["group","GROUP","group"],["autonomous","AUTONOMOUS","autonomous"],["model","MODEL","model"],["auto_stop","AUTO_STOP","auto_stop"]];function te(e){return/^(true|1|yes|on)$/i.test(String(e??"").trim())}a(te,"isTrue");function Wr(e){return te(_e(e,"autonomous"))}a(Wr,"readAutonomous");function fo(e){let t=_e(e,"auto_stop");return t==null||t===""?Wr(e):te(t)}a(fo,"readAutoStop");function po(e){let{model:t}=Kt(e.model,e.harness||I[0]);t?e.model=t:delete e.model}a(po,"resolveModelInput");function mo(e){let t=_e(e,"model");return typeof t=="string"&&t.trim()?t.trim():null}a(mo,"readModel");function _e(e,t){let r=W("WORKSPACE_CONFIG"),n=[...r?[je(r)]:[],...rr.map(s=>y.join(ne(e),s))];for(let s of n)if(k.existsSync(s))try{return er(s)?.[t]}catch{return}}a(_e,"readWorkspaceField");var rr=["workspace.yml","workspace.yaml","workspace.jsonc","workspace.json"];function Br(e,t){let r=[];t&&r.push(je(t));let n=W("WORKSPACE_CONFIG");n&&r.push(je(n));let s=ne(e);for(let o of rr)r.push(y.join(s,o));for(let o of r){if(!k.existsSync(o))continue;let i;try{i=er(o)}catch(u){return R(`Config file ${o} unreadable: ${u.message} \u2014 skipping.`),{}}return typeof i!="object"||i===null||Array.isArray(i)?(R(`Config file ${o} must be a mapping \u2014 skipping.`),{}):(Ae(`Loaded workspace config from ${o}`),i)}return{}}a(Br,"loadConfigFile");function je(e){return e==="~"?Se.homedir():e.startsWith("~/")?y.join(Se.homedir(),e.slice(2)):e}a(je,"expandUserPath");function ho(e){return/['"$#\\]/.test(e)?`"${e.replace(/[\\"$]/g,"\\$&")}"`:e}a(ho,"quoteEnvValue");function Gr(e){return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1).replace(/\\([\\"$])/g,"$1"):e}a(Gr,"unquoteEnvValue");function zr(e){let t=y.join(e,".env");if(!(k.existsSync(t)&&k.statSync(t).isFile()))return{};let r={};for(let[,,s]of tr)r[s.toUpperCase()]=s;r.JIRA_ID=r.GITHUB_ISSUE="issue_id";let n={};for(let s of k.readFileSync(t,"utf8").split(`
|
|
32
32
|
`)){if(s=s.trim(),!s||s.startsWith("#")||!s.includes("="))continue;let o=s.indexOf("="),i=s.slice(0,o).trim(),u=s.slice(o+1);i in r&&(n[r[i]]=Gr(u.trim()))}return n}a(zr,"loadExistingEnvMetadata");function Yr(e,t){let r=Br(t,e.config_file??null),n=zr(t),s={};for(let[u,c,l]of tr){let f=e[u]??null,m=c?W(c)??null:null,j=l==="issue_id"?ke(r)||null:l in r?r[l]:null,w=l in n?n[l]:null;for(let x of[f,m,j,w]){if(x==null)continue;let _;if(Array.isArray(x)?_=x.map($=>String($).trim()).filter($=>$).join(","):_=String(x).trim(),_){s[l]=_;break}}}let o=e.services;!s.services&&o!==null&&o!==void 0&&!String(o).trim()&&(s.services="");let i=a(()=>U({project:s.project,text:s.issue_id??""}),"tracker");if(s.issue_id&&(s.issue_id=i().parseRef(s.issue_id)??s.issue_id),s.group){let u=i(),c=[...new Set(s.group.split(",").map(l=>u.parseRef(l)??l))].filter(l=>l!==s.issue_id);s.group=c.join(",")}return s.autonomous&&(s.autonomous=String(te(s.autonomous))),s.auto_stop&&(s.auto_stop=String(te(s.auto_stop))),s}a(Yr,"resolveInputs");function Hr(e){let t=e.split("-");return t.length&&t[0].length===4&&[...t[0].toLowerCase()].every(r=>"0123456789abcdef".includes(r))&&(t=t.slice(1)),t.length?t.join("-"):e}a(Hr,"defaultFeatureFromDir");function qr(e){for(let t of k.readdirSync(e).sort()){let r=y.join(e,t);if(!Ur(r)||t.startsWith("."))continue;let n;try{n=Be(["git","-C",r,"branch","--show-current"],{capture:!0,timeout:5})}catch(i){if(i instanceof We&&(i.code==="ENOENT"||i.code==="ETIMEDOUT"))continue;throw i}if(n.status!==0)continue;let s=n.stdout.trim(),o=U({text:s}).parseRef(s);if(o)return o}return""}a(qr,"scrapeIssueId");var re={feature:{path:"architectural",phases:["research","implement","test","review","pr"],gate:{note:"decision",status:"decided"},hint:"invoke `w9r-research` first \u2014 it ends in a `decision` note the user approves before any code"},bugfix:{path:"bounded",phases:["research","implement","test","pr"],gate:{note:"finding"},hint:"invoke `w9r-research` first to reproduce and write the root cause to a `finding` note before changing code"},incident:{path:"bounded",phases:["research","implement","test","pr"],gate:{note:"finding"},hint:"invoke `w9r-research` first to diagnose; the `finding` note is the incident record"},refactor:{path:"bounded",phases:["implement","test","review","pr"],gate:null,hint:"invoke `w9r-implement` first \u2014 the scope is known and standards matter most"},spike:{path:"spike",phases:["research"],gate:null,hint:"invoke `w9r-research` first to frame the questions; anything built is throwaway and there is no PR"}},Zr={path:"architectural",phases:["research","implement","test","review","pr"],gate:null,hint:"invoke `w9r-research` first"};function wo(e){let t=e.trim().toLowerCase();return Object.hasOwn(re,t)?re[t]:Zr}a(wo,"planFor");var Kr=Object.keys(re),Vt=[{key:"issue_id",label:"Issue",help:"Issue ID in this machine's issue tracker. The issue is fetched and stored in the workspace; empty fields are filled from it.",defaultFn:a(e=>qr(e),"defaultFn")},{key:"project",label:"Project",help:"The project whose tracker holds the issue (projects: in ~/.werkmeister/config.yaml). Blank picks the one whose scope holds the issue, else the default project.",choicesFn:a(()=>E().map(e=>e.name),"choicesFn"),defaultFn:a(()=>ye()?.name??"","defaultFn")},{key:"feature",label:"Feature name",help:`Lowercase, hyphen-separated. Drives workspace slot routing via the X-Feature cookie. No feature = no ${Ce} / werkmeister-context.md.`,acceptEmpty:!1,recommended:!0,pattern:"^[a-z0-9]+(-[a-z0-9]+)*$",placeholder:"mdx-blog",defaultFn:a(e=>Hr(y.basename(e)),"defaultFn")},{key:"work_type",label:"Work type",help:"What kind of work this is; selects the phase sequence and the pre-implementation gate in CLAUDE.md.",acceptEmpty:!1,pattern:"^("+Object.keys(re).join("|")+")$",default:"feature",choicesFn:a(()=>[...Kr],"choicesFn")},{key:"context_strategy",label:"Workflow",help:"Which context layer init-workspace generates: jit (w9r-* skills, hooks, notes) or icm (staged folders the agent walks by itself).",pattern:"^("+ee.join("|")+")$",default:ee[0],choicesFn:a(()=>[...ee],"choicesFn")},{key:"harness",label:"Harness",help:"Which agent harness reads this workspace: claude (Claude Code: CLAUDE.md, .claude/, hooks), mcp (any harness with MCP and skills: AGENTS.md, .agents/skills, no hooks) or codex (Codex CLI: AGENTS.md, .agents/skills, .codex/hooks.json, .codex/config.toml).",pattern:"^("+I.join("|")+")$",default:I[0],choicesFn:a(()=>[...I],"choicesFn")},{key:"autonomous",label:"Autonomous run",help:"Off by default. On: an icm run goes from stage 01 to `werkmeister pr open` with no human check (each stage self-checks and the agent approves its own PR file), and .claude/settings.json allows the git, werkmeister, docker, gh, node and python3 calls a headless session needs. The person reviews the PR; `werkmeister pr gate` still applies.",boolean:!0},{key:"model",label:"Model",help:"Model tier (small, mid, frontier, advanced_frontier) or an explicit model (alias or full id); empty = the default tier from `models.default_tier` in ~/.werkmeister/config.yaml (frontier). The resolved model is written to workspace.yml and .claude/settings.json and passed to every session start. mid suits mechanical jobs (lint passes, renames).",pattern:"^[A-Za-z0-9][A-Za-z0-9._/\\[\\]-]*$",placeholder:"frontier"},{key:"auto_stop",label:"Auto-stop on session end",help:"On by default for autonomous workspaces, off otherwise. On: when a Claude session in the workspace ends and no other one is open there, a SessionEnd hook runs `werkmeister internal session-end`, which stops this feature's containers (slot and volumes kept; `werkmeister feature up` resumes). Shared infra is never stopped.",boolean:!0},{key:"services",label:"Services to run locally",help:"Services to run locally with hot-reload; the rest fall through to k8s port-forwards.",multi:!0,choicesFn:a(()=>Object.keys(Xt()[0]).sort(),"choicesFn"),choiceGroupsFn:a(()=>Object.fromEntries(Object.entries(Xt()[0]).map(([e,t])=>[e,String(t?.repo??"other")])),"choiceGroupsFn")},{key:"labels",label:"Labels",help:"Comma-separated free-form tags for filtering workspaces in the dashboard search.",multi:!0},{key:"group",label:"Grouped PR members",help:"Comma-separated issue keys this workspace's PR also covers, led by its issue: one PR, one commit per ticket. Blank for a one-ticket PR.",multi:!0},{key:"test_path",label:"Feature test path",help:"URL path for the feature entry point, appended to the routed host.",pattern:"^/\\S*$",placeholder:"/products/foo"},{key:"task",label:"Task title",help:"Short title for the Current Task section. Defaults to the feature name in words.",defaultFn:a(e=>Qr(y.basename(e)),"defaultFn")},{key:"description",label:"Description",help:"1-2 sentences on what the feature does and the user-visible outcome; rendered under Current Task in CLAUDE.md.",placeholder:"Adds an MDX-powered blog index under /blog."},{key:"starting_prompt",label:"Starting prompt",help:"The first instruction to hand the agent in this workspace; persisted to .werkmeister/workspace.yml.",multiline:!0,refinable:!0,refineInstruction:"Rewrite the user's text as a clear, specific, actionable starting instruction for a coding agent beginning a development task, preserving the user's intent. The rewritten instruction must state the goal \u2014 the desired end state and why it matters \u2014 and must include explicit acceptance criteria: a checklist of concrete, verifiable conditions that define when the task is done. Derive the goal and acceptance criteria from the user's text wherever possible; for any that cannot be confidently derived, the rewritten instruction must direct the agent to ask the user to supply them before proceeding, rather than guessing."}];function nr(e,t,r,n={}){let s={key:e.key,label:e.label,help:e.help,accept_empty:e.acceptEmpty??!0,multi:e.multi??!1,recommended:e.recommended??!1,default:e.defaultFn&&n.defaults!==!1?e.defaultFn(t):e.default??"",resolved:e.key in r,resolved_value:e.key in r?r[e.key]:null};if(e.multiline&&(s.multiline=!0),e.boolean&&(s.boolean=!0),e.refinable&&(s.refinable=!0,e.refineInstruction&&(s.refine_instruction=e.refineInstruction)),e.pattern&&(s.pattern=e.pattern),e.placeholder&&(s.placeholder=e.placeholder),e.choicesFn&&(s.choices=e.choicesFn()),e.choiceGroupsFn){let o={},i=e.choiceGroupsFn();for(let u of s.choices??Object.keys(i))(o[i[u]??"other"]??=[]).push(u);s.choice_groups=Object.fromEntries(Object.entries(o).sort(([u],[c])=>u.localeCompare(c)))}return s}a(nr,"promptEntry");function Vr(){let e=E();if(e.length){let r=[...new Set(e.map(n=>Yt(n.tracker).refExample))];return Vt.map(n=>n.key==="issue_id"?{...n,placeholder:r.join(" or ")}:n)}let t=U();return Vt.flatMap(r=>r.key==="project"?[]:r.key==="issue_id"?[{...r,placeholder:t.refExample,...t.refPattern?{pattern:t.refPattern}:{}}]:[r])}a(Vr,"wizardPrompts");function Xr(e,t,r={}){return{workspace_root:e,workspace_name:y.basename(e),prompts:Vr().map(n=>nr(n,e,t,r))}}a(Xr,"buildPromptSpec");function Qr(e){let t=e.split("-");return t.length&&t[0].length===4&&[...t[0].toLowerCase()].every(r=>"0123456789abcdef".includes(r))&&(t=t.slice(1)),t.length?t.map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" "):e}a(Qr,"slugToTask");function Xt(){try{return[Oe(),O()]}catch{return[{},{}]}}a(Xt,"loadSandboxServiceConfigs");var en={key:"repos",label:"Extra repos",help:"Extra repos to create worktrees for. The final set is the union of these and the repos owning the services selected above.",multi:!0,choicesFn:a(()=>Object.keys(O()).sort(),"choicesFn")};function go(e,t,r={}){return tn(t,Yr(e,t),r)}a(go,"computePromptSpec");function tn(e,t,r={}){let n=Xr(e,t,r),s=nr(en,"",t);if(s.choices.length){let o=n.prompts??[],i=o.findIndex(u=>u.key==="services");i===-1&&(i=o.length-1),o.splice(i+1,0,s),n.prompts=o}return n}a(tn,"workspacePromptSpec");export{z as a,Y as b,Qe as c,ar as d,wn as e,it as f,at as g,N as h,I as i,Yt as j,vr as k,ge as l,Ht as m,ye as n,U as o,Fs as p,Ns as q,ke as r,Us as s,Mr as t,Js as u,Ws as v,Nr as w,Kt as x,ee as y,er as z,tr as A,te as B,Wr as C,fo as D,po as E,mo as F,_e as G,rr as H,Br as I,je as J,ho as K,Gr as L,Yr as M,Zr as N,wo as O,nr as P,Qr as Q,Xt as R,go as S,tn as T,Rt as U,us as V,Ct as W,Tt as X,Ot as Y,Er as Z,xr as _,Qn as $,es as aa,Et as ba,Pt as ca,V as da};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-2DWIVGDO.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{i as _,j}from"./chunk-
|
|
3
|
+
import{i as _,j}from"./chunk-4YFK45ID.js";import{a as R}from"./chunk-SWZ47KNM.js";import{$ as O}from"./chunk-4O5AVQ7C.js";import{l as y,m as I,n as N}from"./chunk-5LQO3VEP.js";import{b as h}from"./chunk-4HOBUMZ4.js";import{M as x,R as A,S as F,j as g,k as v,l as d,n as p,o as T}from"./chunk-J7B5NNPO.js";import{b as S}from"./chunk-6JER3JWG.js";import{a,f as $}from"./chunk-MMI6XRQX.js";$();import*as n from"node:fs";import{createRequire as C}from"node:module";import*as c from"node:path";var m="1.63.0",P=600,D=["playwright.config.ts","playwright.config.js","playwright.config.mjs"];function U(t){let e=[t];try{for(let s of n.readdirSync(t,{withFileTypes:!0}))s.isDirectory()&&n.existsSync(c.join(t,s.name,".git"))&&e.push(c.join(t,s.name))}catch{}return e}a(U,"playwrightSearchDirs");function k(t){for(let e of t)if(n.existsSync(e)&&n.statSync(e).isDirectory()&&D.some(s=>n.existsSync(c.join(e,s))))return e;return null}a(k,"playwrightCwd");function M(t){let e=U(t).slice(1).map(f=>c.basename(f)),s="";try{s=/^SERVICES=(.*)$/m.exec(n.readFileSync(c.join(t,".env"),"utf8"))?.[1]??""}catch{}let l=s.split(",").map(f=>f.trim()).filter(Boolean),r=x(),i=R(r),u=j(_(e,A(),l),r,F(),new Set(Object.keys(i))).map(f=>` - ${f.service} \u2014 test: ${f.test??"\u2014"} \u2014 validate: ${f.validate}`);return"No Playwright suite found for this workspace (no playwright.config.{ts,js,mjs} in the workspace root or a repo worktree), so nothing was run."+(u.length?`
|
|
4
4
|
Validate each service as follows:
|
|
5
5
|
${u.join(`
|
|
6
6
|
`)}`:"")}a(M,"noSuiteMessage");function b(t){try{let e=C(c.join(t,"package.json")).resolve("@playwright/test/package.json");return JSON.parse(n.readFileSync(e,"utf8")).version??null}catch{return null}}a(b,"installedPlaywrightVersion");async function Q({feature:t,workspace:e,extraArgs:s=[],signal:l}){let r=await O(t),i=k(U(e));if(i===null)return{status:1,cwd:i,slot:r,message:M(e)};r===null&&(d(`Feature '${t}' does not have an allocated slot`),d("Start it first with: werkmeister feature up "+t),d("Running tests anyway with feature header routing..."));let w={...process.env,WERKMEISTER_FEATURE:t,SANDBOX_FEATURE:t};r&&(w.WERKMEISTER_SLOT=String(r)),g(`Working directory: ${i}`);let u=b(i);u!==m&&d(`@playwright/test is ${u??"not installed"} here, but \`werkmeister machine setup\` installs Chromium for ${m} -- the browser may be missing. Fix with: npm install -D @playwright/test@${m}`),g(`WERKMEISTER_FEATURE=${t}`);let f=["npx","playwright","test",...s];g(`Running: ${f.join(" ")}`),p(`
|
|
@@ -54,4 +54,4 @@ test('feature: ${t}', async ({ page, context }) => {
|
|
|
54
54
|
await page.pause();
|
|
55
55
|
});
|
|
56
56
|
`,"featureSpec");function tt(t,e,s){if(c.basename(t)!==t)throw new h(`Invalid feature name: ${t}`,"BAD_FEATURE_NAME");let l=[["playwright.config.ts",L(s.baseUrl)],[`${t}.spec.ts`,W(t,s)]],r=[];for(let[i,w]of l){let u=c.join(e,i);n.existsSync(u)||(n.writeFileSync(u,w),r.push(u))}return r}a(tt,"scaffoldFeatureTests");function et(t){let e=b(t);if(e===m){g(`@playwright/test ${e} present`);return}if(e){d(`workspace pins @playwright/test ${e}, but \`werkmeister machine setup\` installs Chromium for ${m} -- if launch fails, run: npx playwright@${e} install chromium`);return}let s=["npm","install","--save-dev",`@playwright/test@${m}`];if(!n.existsSync(S(t)))throw new h(`${t} is not a workspace (no ${c.basename(S(t))}/) -- pass --workspace, or install manually there: ${s.join(" ")}`,"NOT_A_WORKSPACE");let l=T(),r;try{r=I(s,{cwd:t,...l?{}:{capture:!0}})}catch(i){r={status:127,stderr:i instanceof Error?i.message:String(i)}}if(r.status!==0)throw!l&&r.stderr&&p(r.stderr,"stderr"),new h(`\`${s.join(" ")}\` failed in ${t}`,"PLAYWRIGHT_INSTALL");v(`installed @playwright/test ${m}`)}a(et,"ensurePlaywright");export{m as a,Q as b,Z as c,tt as d,et as e};
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-2M2FM27H.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 o,c as w,f as u}from"./chunk-
|
|
3
|
+
import{a as o,c as w,f as u}from"./chunk-MMI6XRQX.js";var $=w(s=>{"use strict";u();var y=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,c=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,E=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,v=/\\([\u000b\u0020-\u00ff])/g,h=/([\\"])/g,d=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;s.format=g;s.parse=T;function g(r){if(!r||typeof r!="object")throw new TypeError("argument obj is required");var e=r.parameters,t=r.type;if(!t||!d.test(t))throw new TypeError("invalid type");var f=t;if(e&&typeof e=="object")for(var a,p=Object.keys(e).sort(),n=0;n<p.length;n++){if(a=p[n],!E.test(a))throw new TypeError("invalid parameter name");f+="; "+a+"="+m(e[a])}return f}o(g,"format");function T(r){if(!r)throw new TypeError("argument string is required");var e=typeof r=="object"?l(r):r;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var t=e.indexOf(";"),f=t!==-1?e.slice(0,t).trim():e.trim();if(!d.test(f))throw new TypeError("invalid media type");var a=new _(f.toLowerCase());if(t!==-1){var p,n,i;for(y.lastIndex=t;n=y.exec(e);){if(n.index!==t)throw new TypeError("invalid parameter format");t+=n[0].length,p=n[1].toLowerCase(),i=n[2],i.charCodeAt(0)===34&&(i=i.slice(1,-1),i.indexOf("\\")!==-1&&(i=i.replace(v,"$1"))),a.parameters[p]=i}if(t!==e.length)throw new TypeError("invalid parameter format")}return a}o(T,"parse");function l(r){var e;if(typeof r.getHeader=="function"?e=r.getHeader("content-type"):typeof r.headers=="object"&&(e=r.headers&&r.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}o(l,"getcontenttype");function m(r){var e=String(r);if(E.test(e))return e;if(e.length>0&&!c.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(h,"\\$1")+'"'}o(m,"qstring");function _(r){this.parameters=Object.create(null),this.type=r}o(_,"ContentType")});export{$ as a};
|
|
4
4
|
/*! Bundled license information:
|
|
5
5
|
|
|
6
6
|
content-type/index.js:
|
|
@@ -10,4 +10,4 @@ content-type/index.js:
|
|
|
10
10
|
* MIT Licensed
|
|
11
11
|
*)
|
|
12
12
|
*/
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-2VPTBX43.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 it,b as ke,c as at,d as ct,e as Se,f as q,g as dt,h as lt}from"./chunk-
|
|
3
|
+
import{a as it,b as ke,c as at,d as ct,e as Se,f as q,g as dt,h as lt}from"./chunk-WSTEEZR2.js";import{J as re,d as Y,g as se,u as je,w as rt,x as ot}from"./chunk-C25JQ6TF.js";import{a as oe,b as ht,c as mt}from"./chunk-F5YT2U6R.js";import{c as he,d as Je,e as Qe,g as Ze,h as j,i as et,j as I,k as tt,m as V,n as me,o as ge}from"./chunk-PWCZJOYO.js";import{c as Ke,h as Ve,k as ze}from"./chunk-4YFK45ID.js";import{A as nt,B as we,G as st,I as B,O as ne,R as G,o as z,t as U,y as ye}from"./chunk-2DWIVGDO.js";import{a as ut}from"./chunk-SWZ47KNM.js";import{a as ue}from"./chunk-FS6YA3CG.js";import{m as te}from"./chunk-5LQO3VEP.js";import{c as Ie,d as ft,e as pt}from"./chunk-PM5GFZ7K.js";import{d as W,e as pe}from"./chunk-6RPHJEST.js";import{b as fe}from"./chunk-4HOBUMZ4.js";import{I as Ye,S as qe,Y as Xe,a as Ae,j as C,k as b,l as A}from"./chunk-J7B5NNPO.js";import{a as K,b as v}from"./chunk-6JER3JWG.js";import{a,e as Re,f as m}from"./chunk-MMI6XRQX.js";m();var zt="This is an interactive run: check with me at each stage's human check.",gt="Run `werkmeister feature up` only when the gate needs it, and `werkmeister feature stop` this workspace's containers right after `werkmeister pr open` succeeds.",Ne=["Tests never call the real Jira or GitHub APIs; the tracker is mocked. The only real issue updates are the status moves `werkmeister issue start` and `werkmeister pr open` make for this ticket and its `group:` members; run both.","Never read or write the real `~/.werkmeister`; tests use a temporary HOME. To see the machine config's shape run `werkmeister machine config`: it masks secrets such as `jira.api_token`.","No `npm link`, `npm`/`pnpm install -g`, `npm publish`, `werkmeister infra proxy-reload`, and no other workspaces.",'Where the ticket says "to confirm", use it as written unless the code shows a reason to change it, and record each choice in the stage output for PR review.',gt].map(e=>`- ${e}`).join(`
|
|
4
4
|
`),yt=[[/werkmeister registry sync/,"- Registry sync: the next `werkmeister registry sync` after merge picks up the change; the gate reads the branch's own `.werkmeister/services.yaml` fragment."],[/werkmeister infra proxy-reload/,"- Proxy reload: the next `werkmeister infra proxy-reload` after merge applies the change."],[/(?:npm|pnpm|yarn) link\b/,"- Linking the CLI: after merge, if at all; the run runs the built binary with `node`."],[/(?:(?:npm|pnpm|yarn) (?:install|i|add)\b[^`\n]*?(?: -g\b| --global\b)|yarn global add\b)/,"- Global installs: after merge, if at all; the run uses the workspace's own install."]],Jt=a(e=>new RegExp(`(?:^|(?<!["\u201C'])\\brun )\`?${e.source}`,"i"),"stepRe"),Qt=yt.map(([e])=>Jt(e)),Zt=/^(\s*(?:[-*]|\d+\.) +(?:\[[ x]\] +)?)?(.*)$/;function wt(e){let t=new Set,n=e.split(`
|
|
5
5
|
`).flatMap(s=>{let[,r="",o=""]=Zt.exec(s)??[],i=o.split(/(?<=[.!?]) +/).filter(c=>{let d=Qt.flatMap((l,u)=>l.test(c)?[u]:[]);for(let l of d)t.add(l);return!d.length});return i.join(" ")===o?[s]:i.length?[r+i.join(" ")]:[]});return t.size?[n.join(`
|
|
6
6
|
`).trimEnd(),"","## After merge","","Not steps for this run: the run limits forbid writing machine state under `~/.werkmeister` and global installs. These happen after the PR merges:",...yt.filter((s,r)=>t.has(r)).map(([,s])=>s)].join(`
|
|
@@ -291,4 +291,4 @@ ${r}
|
|
|
291
291
|
`),b(`Salvaged legacy Handoff Notes \u2192 ${x.relative(e,x.join(o,i))}`)}catch(n){A(`Could not salvage legacy Handoff Notes: ${n.message}`)}}a(Qn,"salvageLegacyHandoffNotes");function Zn(e){return e.type==="handoff"&&e.frontmatter.author==="workspace-creation"&&!e.body.includes("Seeded from `starting_prompt`")}a(Zn,"isPlaceholderHandoff");function es(e){let t=S.readFileSync(e.path,"utf8");S.writeFileSync(e.path,t.replace(/^status:.*$/m,"status: superseded"))}a(es,"supersedeNote");function ts(e,t,n,s=null){let r=t.trim();if(!r&&!s)return;let o=n.trim().toLowerCase(),i=ne(o);try{let c=ie(e),d=ve(e,!0).filter(f=>f.type==="handoff");if(d.some(f=>!Zn(f)))return;for(let f of d)es(f);S.mkdirSync(c,{recursive:!0});let l=Pe(Fe(c),"handoff","starting-prompt"),u=["---","type: handoff",`phase: ${i.phases[0]}`,"author: workspace-creation","refs: []","status: open","---","","# Handoff: workspace creation",""];s&&u.push(oe(s)),o&&u.push(`This workspace is a ${o} \u2014 ${i.hint}.`,""),r&&u.push("Seeded from `starting_prompt` in .werkmeister/workspace.yml when the","workspace was created. The task below has not begun \u2014 confirm","direction with the user before executing it.","",r),S.writeFileSync(x.join(c,l),u.join(`
|
|
292
292
|
`)+`
|
|
293
293
|
`),b(`Seeded starting handoff \u2192 ${x.relative(e,x.join(c,l))}`)}catch(c){A(`Could not seed starting handoff: ${c.message}`)}}a(ts,"seedStartingHandoff");function ns(e){let{workspaceRoot:t,workspaceName:n,repos:s,task:r,meta:o,inputs:i,configOverride:c}=e,d=Y(t),l=x.join(t,d.instructionsFile),u=null,f=null,w=I(null,j(t));if(Object.keys(w).length){let[R,ee]=G();for(let H of tt(R,w))A(H);let _e=B(t,c),de=s.map(([H])=>H),Vt=(o.SERVICES??"").split(",").map(H=>H.trim()).filter(H=>H),[le]=V(de,R,ee,_e,w,Vt);f=le,u=ht(le,w,de,i.work_type??""),C(`Standards routing: active = ${le.join(", ")}`),ge(t,me(le,w,ne(i.work_type??"").gate))}else A(pe()||`no standard modules found in ${W()} \u2014 this workspace gets no standards routing, skills, or edit-time gate`);S.mkdirSync(ie(t),{recursive:!0}),Qn(t,l);let $=i.starting_prompt??"";ts(t,$,i.work_type??"",e.isCreate||$.trim()?e.issue??null:null);let _=mt(n,t,s,r,o,u,e.issue??null);S.writeFileSync(l,_+d.notice()),b(`Wrote ${l}`);let X=x.join(v(t),"issues-report.md");S.mkdirSync(x.dirname(X),{recursive:!0}),S.writeFileSync(X,Ee(n,U(o),z({project:i.project,text:U(o)}))),b(`Wrote ${X}`);let Z=x.join(v(t),"pr-rules.md");S.writeFileSync(Z,ke(".werkmeister/notes/")),b(`Wrote ${Z}`);for(let R of Be(t,null,null,f))b(`Wrote ${R}`);if(d.agents&&ss(e),se(t)){let R=je(t);re(t),b(`Wrote ${R}`)}}a(ns,"init");function ss({workspaceRoot:e,repos:t,meta:n}){let[s,r]=G(),o=qe(),i=ze(t,n,s,r,o),c={};try{c=ut(s)}catch{c={}}let d=Pt(i,s,o,(n.FEATURE??"").trim(),c,(n.TEST_PATH??"").trim());for(let l of Lt(e,d))b(`Wrote ${l}`)}a(ss,"writeAgents");var qt={id:"jit",init:ns,refresh(e){se(e)&&(je(e),re(e))},check(e){let t=ce(e),{authoring:n,drift:s}=Ut(e,t?.active??null),r=Bt(e,t);return[...n,...s,...r===null?[]:[r]]},sync(e){let{written:t,manifestPath:n}=Yt(e);return{wrote:n===null?t:[...t,n]}},sessionContext(e,t){let n=String(t.source||"");return(n==="compact"||n==="clear")&&ft(e,String(t.session_id||"")),Tt(e,n)||null},gate:pt,ownedPaths:a(()=>["CLAUDE.md","AGENTS.md",".claude/settings.json",".claude/skills/w9r-*",".agents/skills/w9r-*",".claude/agents/w9r-*",".claude/skills/sb-*",".claude/agents/sb-*",`${K}/notes`,`${K}/standards.json`,`${K}/issues-report.md`,`${K}/pr-rules.md`,`${K}/.gate`],"ownedPaths"),decisions:$e};var Kt={jit:qt,icm:We};function qr(e){return Kt[e]}a(qr,"strategyById");function rs(e){let t=e==null?"":String(e).trim();if(!t)return"jit";if(ye.includes(t))return t;throw new fe(`Unknown context_strategy '${t}' in workspace.yml \u2014 expected one of: ${ye.join(", ")}`,"UNKNOWN_CONTEXT_STRATEGY")}a(rs,"parseStrategyId");function os(e){return rs(st(e,"context_strategy"))}a(os,"readContextStrategy");function Xr(e){return Kt[os(e)]}a(Xr,"strategyFor");function Xt(e,t){let n=[];for(let s of t){if(!s.endsWith("*")){Q.existsSync(M.join(e,s))&&n.push(s);continue}let r=M.dirname(s),o=M.basename(s).slice(0,-1),i;try{i=Q.readdirSync(M.join(e,r)).sort()}catch{continue}for(let c of i)c.startsWith(o)&&n.push(M.join(r,c))}return n}a(Xt,"expandOwned");function is(e,t,n){let s=new Set(Xt(e,n.ownedPaths()));return Xt(e,t.ownedPaths()).filter(r=>!s.has(r))}a(is,"leftoverPaths");function as(e,t){if(te(["git","-C",e,"ls-files","--error-unmatch","--",t],{capture:!0}).status!==0)return!1;let s=te(["git","-C",e,"status","--porcelain","--ignored","--untracked-files=all","--",t],{capture:!0});return s.status===0&&!s.stdout.trim()}a(as,"restorable");function Kr(e,t,n,s){let r=is(e,t,n);if(r.length){if(!s){A(`${t.id} layer still present: ${r.join(", ")}; remove by hand or run \`werkmeister workspace init --prune-context\``);return}for(let o of r)as(e,o)?(Q.rmSync(M.join(e,o),{recursive:!0,force:!0}),b(`Pruned ${o}`)):A(`Kept ${o}: untracked, ignored or modified \u2014 git could not restore it`)}}a(Kr,"reportLeftovers");export{zt as a,gt as b,Ne as c,wt as d,en as e,cs as f,cn as g,ve as h,dn as i,Ce as j,nn as k,N as l,rn as m,ws as n,on as o,St as p,ks as q,qr as r,rs as s,Xr as t,Kr as u};
|
|
294
|
-
//# sourceMappingURL=chunk-
|
|
294
|
+
//# sourceMappingURL=chunk-3QSQOSVX.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 n,f as o}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as n,f as o}from"./chunk-MMI6XRQX.js";o();function u(t){return t.listenerCount("SIGINT")>1}n(u,"claimed");var r=new AbortController;function s(){return r.signal}n(s,"interruptSignal");function d(t=process,i=()=>{},l=e=>process.exit(e)){let e=!1;r=new AbortController,t.on("SIGINT",()=>{if(r.abort(),u(t)&&!e){e=!0;return}i(),l(130)})}n(d,"installDefaultInterrupt");export{s as a,d as b};
|
|
4
|
+
//# sourceMappingURL=chunk-4D72V6SW.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-MMI6XRQX.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-4HOBUMZ4.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
|
+
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
+
import{c as k,d as X,i as at}from"./chunk-L766XAX3.js";import{a as j,c as J}from"./chunk-FS6YA3CG.js";import{l as T,m as _,n as Rt}from"./chunk-5LQO3VEP.js";import{j as Ft,k as Mt,o as z,q as st,r as it}from"./chunk-LBOP4JKF.js";import{d as jt,e as Ct,m as Tt}from"./chunk-HF34U4ZF.js";import{n as V}from"./chunk-6RPHJEST.js";import{b as C}from"./chunk-4HOBUMZ4.js";import{D as Lt,F as At,H as Nt,M as rt,Q as nt,a as vt,h as U,j as y,k as h,l as f,m as b,n as x,o as Et,s as Ot,w as _t}from"./chunk-J7B5NNPO.js";import{b as Q}from"./chunk-6JER3JWG.js";import{a as i,e as kt,f as w}from"./chunk-MMI6XRQX.js";w();import*as A from"node:fs";import*as de from"node:os";import*as we from"node:path";w();var Z=kt(vt(),1);import*as L from"node:fs";import*as It from"node:os";import*as Pt from"node:path";function ct(t){let e=q(t);return e===null?null:J(e)}i(ct,"composeFile");function q(t){let e=$e(t);if(e!==null&&J(e)!==null)return e;let o;try{o=Nt(t)}catch{return e}return J(o)!==null&&ge(o,t)?o:e}i(q,"workspaceForFeature");function ge(t,e){let o;try{o=L.readFileSync(Pt.join(t,".env"),"utf8")}catch{return!1}return o.split(`
|
|
4
|
+
`).some(r=>{let n=/^\s*(?:WERKMEISTER_)?FEATURE=(.*)$/.exec(r);return n!==null&&n[1].trim()===e})}i(ge,"envNamesFeature");function ut(t){try{return L.statSync(t).isFile()}catch{return!1}}i(ut,"isFile");function $e(t){for(let e of[ft,mt]){let o;try{o=_(["docker","ps","-a","--filter",`label=${e}=${t}`,"--format",'{{.Label "com.docker.compose.project.working_dir"}}'],{capture:!0,timeout:F})}catch(n){if(n instanceof T)return null;throw n}if(o.status!==0)return null;let r=o.stdout.split(`
|
|
5
|
+
`).map(n=>n.trim()).find(Boolean);if(r)return r}return null}i($e,"workspaceFromContainerLabel");function xe(t,e,o){return["docker","compose",...o?["-f",o]:[],"-p",Wt(t,o),...e]}i(xe,"workspaceComposeArgv");function Dt(t){return`werkmeister-${t}`}i(Dt,"projectName");function Ut(t){return`sandbox-${t}`}i(Ut,"legacyProjectName");async function B(t){let e=Ut(t);return(await X(e))?.length?e:Dt(t)}i(B,"liveProject");function Wt(t,e){try{let o=e&&(0,Z.parse)(L.readFileSync(e,"utf8"));if(o&&typeof o.name=="string")return o.name}catch{}return Dt(t)}i(Wt,"fileProject");function ke(t,e,{removeVolumes:o=!1}={}){let r=Ut(t);Wt(t,e)!==r&&ve(r,`'${t}''s pre-rename project`,{removeVolumes:o})}i(ke,"retireLegacyProject");function ve(t,e,{removeVolumes:o=!1}={}){let r=`label=com.docker.compose.project=${t}`;try{let n=[["docker","ps","-aq","--filter",r]];if(o&&n.push(["docker","volume","ls","-q","--filter",r]),!n.some(c=>_(c,{capture:!0,timeout:F}).stdout.trim()))return;y(`Taking down ${e} ${t}`);let s=["down","--remove-orphans",...o?["--volumes"]:[]],a=_(["docker","compose","-p",t,...s],{capture:!0,cwd:It.tmpdir(),timeout:F});a.status!==0&&f(`Could not take down ${t}: ${a.stderr.trim()}`)}catch(n){f(`Could not take down ${t}: ${n instanceof Error?n.message:String(n)}`)}}i(ve,"takeDownProject");var F=300,Bt=20*60;function Ht(t,e,{capture:o=!1,stream:r=!1,composePath:n=null}={}){let s=Yt(t,e,n);if(s===null)return null;try{return r?(_(s,{stdio:"inherit"}),null):Gt(_(s,{capture:o,timeout:F}),o)}catch(a){return Kt(a,F)}}i(Ht,"runCompose");async function lt(t,e,{capture:o=!1,composePath:r=null,signal:n,timeout:s=F}={}){let a=Yt(t,e,r);if(a===null)return null;try{return Gt(await Rt(a,{capture:o,timeout:s,signal:n}),o)}catch(c){return Kt(c,s)}}i(lt,"runComposeAsync");function Yt(t,e,o){if(o??=ct(t),o===null||!ut(o))return b(`No ${j} found for feature '${t}'.
|
|
6
|
+
Run 'werkmeister workspace init' (and 'werkmeister feature up') from the feature's workspace first.`),null;e.includes("up")&&Ee(o),(e.includes("up")||e.includes("down"))&&ke(t,o,{removeVolumes:e.includes("--volumes")});let r=xe(t,e,o);return y(`Running: ${r.join(" ")}`),r}i(Yt,"composeCommand");function Ee(t){try{let e=(0,Z.parse)(L.readFileSync(t,"utf8")),o=Object.entries(e?.volumes??{}).filter(([,r])=>r?.external===!0).map(([r,n])=>n?.name??r);for(let r of o){let n=_(["docker","volume","create",r],{capture:!0});n.status!==0&&f(`Could not create shared volume '${r}': ${n.stderr.trim()}`)}}catch(e){f(`Could not create shared volumes: ${e instanceof Error?e.message:String(e)}`)}}i(Ee,"ensureSharedVolumes");function Gt(t,e){if(t.status!==0){let o=e?t.stderr:"";b(`docker compose failed (exit ${t.status})`),o&&x(`${U.DIM}${o.trim()}${U.RESET}
|
|
7
|
+
`)}else{if(e)return t;h("docker compose completed successfully")}return e?t:null}i(Gt,"reportComposeOutcome");function Kt(t,e){if(t instanceof T&&(t.stdout&&x(t.stdout),t.stderr&&x(t.stderr,"stderr")),t instanceof T&&t.code==="ABORT_ERR")return f("docker compose was cancelled"),null;if(t instanceof T&&t.code==="ENOENT")return b("docker compose not found. Ensure Docker Desktop is installed and running."),null;if(t instanceof T&&t.code==="ETIMEDOUT")return b(`docker compose timed out after ${e/60} minutes`),null;throw t}i(Kt,"reportComposeFailure");var Jt=["--profile","*"];function yo(t){let e=Ht(t,["up","-d","--build","--remove-orphans"],{capture:!0});return e&&e.status===0?(h(`Containers for '${t}' are up`),!0):!1}i(yo,"composeUp");function ho(t,{removeVolumes:e=!1}={}){let o=ct(t);if(o===null||!ut(o))return y(`No ${j} for '${t}' -- nothing to tear down`),!0;let r=[...Jt,"down","--remove-orphans"];e&&r.push("--volumes");let n=Ht(t,r,{capture:!0,composePath:o});if(n===null||n.status!==0)return!1;let s=`Containers for '${t}' are down`;return e&&(s+=" (volumes removed)"),h(s),!0}i(ho,"composeDown");async function So(t,e){let o=await lt(t,["up","-d","--build","--remove-orphans"],{capture:!0,signal:e,timeout:Bt});return o&&o.status===0?(h(`Containers for '${t}' are up`),!0):!1}i(So,"composeUpAsync");async function bo(t,e,o,r=!1){let n=["up","-d","--wait",...r?["--no-deps"]:[],e],s=await lt(t,n,{capture:!0,composePath:o,timeout:Bt});return s!==null&&s.status===0}i(bo,"composeUpServiceAsync");async function go(t,{removeVolumes:e=!1,signal:o}={}){let r=ct(t);if(r===null||!ut(r))return y(`No ${j} for '${t}' -- nothing to tear down`),!0;let n=[...Jt,"down","--remove-orphans"];e&&n.push("--volumes");let s=await lt(t,n,{capture:!0,composePath:r,signal:o});if(s===null||s.status!==0)return!1;let a=`Containers for '${t}' are down`;return e&&(a+=" (volumes removed)"),h(a),!0}i(go,"composeDownAsync");async function $o(t){let e=await Qt("stop",await B(t));return e?(b(e),!1):(h(`Containers for '${t}' stopped (not removed)`),!0)}i($o,"composeStop");async function xo(t){let e=await Qt("restart",await B(t));return e?(b(e),!1):(h(`Containers for '${t}' restarted`),!0)}i(xo,"composeRestart");async function Qt(t,e,o){let r=await X(e,o,{all:t==="restart"});if(r===null)return"docker not found / not running";let n=_e(r);t==="stop"&&n.reverse();let s=t==="restart"?Oe(r):new Set;for(let a of n){let c=a.state==="exited"&&Le(a.service,M(a.labels,"role")),u=a.state!=="running"&&s.has(a.service);if(!(c||u))try{await k().getContainer(a.name)[t]()}catch(l){if(l.statusCode===304)continue;let d=l.json?.message;return`docker ${t} ${a.name} failed: ${d??l.message}`}}return null}i(Qt,"stopOrRestart");function Oe(t){let e=t[0]?.labels["com.docker.compose.project.config_files"]?.split(",")??[],o=new Set;for(let r of e)try{let n=(0,Z.parse)(L.readFileSync(r,"utf8"))?.services??{};for(let[s,a]of Object.entries(n))a?.profiles?.length&&o.add(s)}catch{}return o}i(Oe,"profiledServices");function _e(t){let e=new Map;for(let s of t)e.set(s.service,[...e.get(s.service)??[],s]);let o=[],r=new Set,n=i(s=>{let a=e.get(s);if(!(!a||r.has(s))){r.add(s);for(let c of(a[0].labels["com.docker.compose.depends_on"]??"").split(","))n(c.split(":")[0]);o.push(...a)}},"visit");for(let s of e.keys())n(s);return o}i(_e,"dependencyOrder");async function ko(t,e,{follow:o=!0,tail:r=100,signal:n}={}){if(await pt(t)===null){f(`Feature '${t}' is not running (no slot allocated)`),f(`Start it with: werkmeister feature up ${t}`);return}y(`Tailing logs for '${t}'`+(e?` (${e})`:"")),o&&x(`${U.DIM}Press Ctrl+C to stop${U.RESET}
|
|
8
|
+
`);let s=Et()&&process.stdout.isTTY===!0;await at(await B(t),e??null,{follow:o,tail:r,signal:n,color:s},(a,c)=>x(`${a}
|
|
9
|
+
`,c))}i(ko,"composeLogs");function vo(t,e,o){let r=new AbortController,n=B(t).then(s=>at(s,e,{follow:!0,tail:100,signal:r.signal,color:!0},a=>o(`${a}
|
|
10
|
+
`)));return{stop:i(()=>r.abort(),"stop"),done:n}}i(vo,"composeLogsStream");async function Eo(t){return(await X(await B(t))??[]).map(o=>({name:o.name,status:o.state,health:o.health,ports:o.ports,service:o.service,role:M(o.labels,"role"),exitCode:o.exitCode}))}i(Eo,"getContainerStatus");function Le(t,e){return e==="setup"||t.endsWith("-setup")}i(Le,"isOneShotService");w();import*as p from"node:fs";import*as Vt from"node:os";import*as dt from"node:path";import{setTimeout as Ae}from"node:timers/promises";var Ne=i(()=>dt.join(Q(Vt.homedir()),"locks"),"lockDir"),je=.1;function Ce(t){let e;try{e=Number.parseInt(p.readFileSync(t,"utf8").trim(),10)}catch{return!1}if(!Number.isInteger(e)||e<=0)return!0;try{return process.kill(e,0),!1}catch(o){return o.code==="ESRCH"}}i(Ce,"holderIsDead");function Te(t){try{let e=p.openSync(t,"wx");return p.writeSync(e,String(process.pid)),p.closeSync(e),!0}catch(e){if(e.code==="EEXIST"){if(Ce(t))try{p.unlinkSync(t)}catch{}return!1}throw e}}i(Te,"tryAcquire");async function v(t,e,{timeout:o}={}){let r=Ne();p.mkdirSync(r,{recursive:!0});let n=dt.join(r,`${t}.lock`),s=o!==void 0?performance.now()+o*1e3:null;for(;!Te(n);){if(s!==null&&performance.now()>=s)throw new Error(`Timed out after ${o}s waiting for lock '${t}' (${n}). The previous holder may have crashed without releasing it; if no werkmeister process is running, it is safe to delete this file and retry.`);await Ae(je*1e3)}try{return await e()}finally{try{p.unlinkSync(n)}catch{}}}i(v,"sandboxLock");w();var Fe={"":1,b:1,k:1024,m:1048576,g:1073741824,t:1099511627776};function wt(t){if(typeof t=="number")return t;let e=/^\s*(\d+(?:\.\d+)?)\s*([bkmgt]?)b?\s*$/i.exec(t);if(!e)throw new Error(`Not a size: '${t}'`);return Math.round(Number(e[1])*(Fe[e[2].toLowerCase()]??1))}i(wt,"parseSize");var zt=["idle","human-check","working"];function Me(t){return[...t.filter(e=>e.gate),...t.filter(e=>!e.gate)]}i(Me,"queueOrder");function Xt(t,e,o,r){if(!r.services&&e.some(m=>m.feature===r.feature))return{kind:"admit"};if(r.cost.memory>t.memory||r.cost.cpus>t.cpus)return{kind:"never-fits",cost:r.cost};let n=e.reduce((m,K)=>({memory:m.memory+K.cost.memory,cpus:m.cpus+K.cost.cpus}),{memory:0,cpus:0}),s=i(m=>n.memory-m.memory+r.cost.memory<=t.memory&&n.cpus-m.cpus+r.cost.cpus<=t.cpus,"fits"),a=!!r.gate||!!r.services&&e.some(m=>m.feature===r.feature),c=o.find(m=>m.feature===r.feature),u={feature:r.feature,waitedMs:c?.waitedMs??0,gate:a},l=Me(c?o.map(m=>m===c?u:m):[...o,u]),d=l.indexOf(u)+1,N=d===1,O=!N&&(l[0].gate||l[0].waitedMs>=3e5);if(s({memory:0,cpus:0})&&(r.byPerson||!O))return{kind:"admit"};let et=N&&(!!r.services||u.waitedMs>=3e5);if(t.preempt&&(r.byPerson||et)){let K=(r.byPerson?zt:zt.slice(0,2)).flatMap(P=>e.filter(D=>D.rank===P&&!D.busy&&D.feature!==r.feature&&(D.cost.memory||D.cost.cpus))),xt=[],ot={memory:0,cpus:0};for(let P of K)if(xt.push(P.feature),ot.memory+=P.cost.memory,ot.cpus+=P.cost.cpus,s(ot))return{kind:"preempt",victims:xt}}return{kind:"wait",position:d}}i(Xt,"admit");function Zt(t,e,o,r){for(let[n,s]of e)if(s===t)return n;if(r!==null&&r>=1&&r<=o&&!e.has(r))return r;for(let n=1;n<=o;n++)if(!e.has(n))return n;return null}i(Zt,"pickSlot");w();w();var te=kt(vt(),1);import{execFileSync as Re}from"node:child_process";import{createHash as Ie}from"node:crypto";import*as g from"node:fs";import*as qt from"node:net";import*as E from"node:os";import*as S from"node:path";import{setTimeout as Pe}from"node:timers/promises";var ht=30,ee=i(()=>S.join(_t(),"scheduler"),"stateDir"),oe=i(()=>S.join(ee(),"leases.json"),"leasesPath"),re=i(()=>S.join(ee(),"queue.json"),"queuePath");function ne(t,e,o){try{let r=JSON.parse(g.readFileSync(t,"utf8"));return e(r)?r:o}catch{return o}}i(ne,"readJson");function se(t,e){g.mkdirSync(S.dirname(t),{recursive:!0}),Mt(t,e)}i(se,"writeJson");var $=i(t=>typeof t=="object"&&t!==null&&!Array.isArray(t),"isDict");function I(){let t=ne(oe(),$,{}),e={};for(let[o,r]of Object.entries(t))$(r)&&Number.isInteger(r.slot)&&(e[o]={slot:r.slot,workspace:String(r.workspace??"")});return e}i(I,"readLeases");function St(t){se(oe(),t)}i(St,"writeLeases");function H(){return ne(re(),t=>Array.isArray(t),[]).map(String)}i(H,"readQueue");function bt(t){se(re(),t)}i(bt,"writeQueue");function ie(t){return v("scheduler",async()=>bt(H().filter(e=>e!==t)),{timeout:ht})}i(ie,"dequeue");function Vo(t,e){return v("scheduler",async()=>{let o=H().filter(r=>r!==t);st(e,{position:o.length+1,reason:"preempted",since:new Date().toISOString()}),bt([...o,t])},{timeout:ht})}i(Vo,"enqueue");async function zo(t=()=>k().info()){let e=V().budget,o=$(e)?e:{},r={};if(o.memory===void 0||o.cpus===void 0)try{r=await t()}catch{}let n=o.memory!==void 0?wt(o.memory):r.MemTotal?r.MemTotal-2**30:1/0,s=o.cpus!==void 0?Number(o.cpus):r.NCPU??1/0;return{memory:n,cpus:s,preempt:o.preempt!==!1}}i(zo,"loadBudget");function ae(t){let e=V().budget,o=$(e)?Number(e.host_load??Number.NaN):Number.NaN;return Number.isFinite(o)&&o>=0?o:2*t}i(ae,"hostLoadLimit");function De(){let t=V().budget,e=$(t)?Number(t.free_memory??Number.NaN):Number.NaN;return Number.isFinite(e)&&e>=0?e:15}i(De,"freeMemoryLimit");function ce(t=process.platform){let e=E.totalmem();if(t!=="darwin")return{free:E.freemem(),total:e};let o=Number(Re("sysctl",["-n","kern.memorystatus_level"],{encoding:"utf8"}));return{free:e*o/100,total:e}}i(ce,"readHostMemory");function ue(t=ce){let e=De();if(e===0)return"";let o;try{let{free:r,total:n}=t();o=100*r/n}catch{return""}return Number.isFinite(o)&&o<e?`${o.toFixed(0)}% free, under budget.free_memory ${e}%`:""}i(ue,"lowMemory");var yt=15e3,R=9e4,Ue=6e4,We=i(()=>({load:E.loadavg(),cores:E.availableParallelism()}),"readHostLoad"),le={hostLoad:We,hostMemory:ce,sleep:i(t=>Pe(t),"sleep")},tt=i(t=>Number((t/6e4).toFixed(1)),"minutes");async function Be(t=le,e=process.platform,o="with-temp-home; --no-wait skips"){if(Ot("NO_WAIT"))return"";let r=i(()=>{let{load:c,cores:u}=t.hostLoad(),l=e==="darwin"?0:ae(u);return{load:c[0],limit:l,loadOver:l!==0&&c[0]>l,memory:ue(t.hostMemory)}},"read"),n=r();if(!n.loadOver&&!n.memory)return"";let s=[n.loadOver&&"host load",n.memory&&"free memory"].filter(Boolean).join(" and ");y(`waiting up to ${tt(R)} min for ${[n.loadOver&&`host load ${n.load.toFixed(1)} to fall to ${n.limit} (budget.host_load)`,n.memory&&`free memory to rise (${n.memory})`].filter(Boolean).join(" and ")} before ${o}`);let a=i(()=>[n.loadOver&&`host load ${n.load.toFixed(1)} over ${n.limit}`,n.memory&&`low memory (${n.memory})`].filter(Boolean).join(", "),"state");for(let c=yt;c<=R;c+=yt){if(await t.sleep(yt),n=r(),!n.loadOver&&!n.memory)return`waited ${c/1e3} s for ${s}`;c%Ue===0&&c<R&&y(`still waiting: ${a()}, ${c/1e3} s so far, up to ${tt(R-c)} min left`)}return`ran with ${a()}; the ${tt(R)} min host-load wait is spent`}i(Be,"waitForHostLoadNow");async function Xo(t,e,o=le,r=process.platform){let n=Object.entries(Y(t)).filter(([O,et])=>e?e.includes(O):!et?.profiles).filter(([,O])=>O?.labels?.["com.werkmeister.role"]==="setup").map(([O])=>O);if(!n.length)return;let s=n.join(", "),a=await Be(o,r,`starting ${s}; WERKMEISTER_NO_WAIT=1 skips`);if(!a.startsWith("ran with"))return;let{load:c,cores:u}=o.hostLoad(),l=ae(u),d=ue(o.hostMemory),N=[r!=="darwin"&&l!==0&&c[0]>l&&`host load ${c[0].toFixed(1)} is over ${l} (budget.host_load)`,d&&`memory is low (${d})`].filter(Boolean).join(" and ");throw new C(`${N||a} after the ${tt(R)} min wait; ${s} not started. Retry when load falls or memory frees, or set WERKMEISTER_NO_WAIT=1 to start anyway.`,"HOST_LOAD")}i(Xo,"waitForSetupLoad");function Y(t,e=S.join(t,j)){try{let o=te.parse(g.readFileSync(e,"utf8"));return $(o?.services)?o.services:{}}catch{return{}}}i(Y,"composeServices");function He(t,e){let o={memory:0,cpus:0};for(let[r,n]of Object.entries(Y(t))){if(!$(n)||(e?!e.includes(r):n.profiles))continue;let s=n.deploy?.resources,a=s?.reservations?.memory;a!==void 0&&(o.memory+=wt(a)),o.cpus+=Number(s?.limits?.cpus??0)||0}return o}i(He,"featureCost");var fe=i(t=>{let e=t?.depends_on;return Array.isArray(e)?e.map(String):$(e)?Object.keys(e):[]},"dependsOn");function Zo(t,e){return[e,...fe(Y(t)[e])]}i(Zo,"serviceStarts");async function qo(t,e){let o=Y(S.dirname(t),t),r=fe(o[e]);if(!r.length||!r.every(n=>Ye(o[n])))return!1;for(let n of r){let s=o[n]?.container_name,a=s?await k().getContainer(String(s)).inspect().then(c=>c.State,()=>null):null;if(a?.Status!=="exited"||a.ExitCode!==0)return!1}return!0}i(qo,"setupsCurrent");function Ye(t){if(t?.labels?.["com.werkmeister.role"]!=="setup")return!1;let e=/^node:(\d+)/.exec(String(t.image??""))?.[1],o=(t.volumes??[]).map(String).find(a=>a.endsWith(":/app"));if(!e||!o)return!1;let r=o.slice(0,-5),n=Buffer.concat(["package-lock.json","pnpm-lock.yaml"].flatMap(a=>{try{return[g.readFileSync(S.join(r,a))]}catch{return[]}})),s=`${Ie("sha256").update(n).digest("hex")} v${e}`;try{return g.readFileSync(S.join(r,".turbo/.werkmeister-install-hash"),"utf8").trim()===s}catch{return!1}}i(Ye,"installStamped");var Ge=6e4;function Ke(t){let e=I();return t.filter(o=>{let r=e[o]?.workspace;if(!r||!z(r)?.services)return!0;let n=g.statSync(Ft(r),{throwIfNoEntry:!1})?.mtimeMs??0;return Date.now()-n<Ge?!0:(it(r),!1)})}i(Ke,"withoutDeadWaiters");function Je(t,e,o=Date.now()){let r=I();return t.map(n=>{let s=r[n]?.workspace,a=s?z(s):null,c=a?.since?Date.parse(a.since):Number.NaN;return{feature:n,waitedMs:Number.isFinite(c)?Math.max(0,o-c):0,gate:!!a?.gate||!!a?.services&&e.some(u=>u.feature===n)}})}i(Je,"waiters");function tr(t,e,o,r,n,s){let a=He(e,s?.services);return!a.memory&&!a.cpus?Promise.resolve({kind:"admit"}):v("scheduler",async()=>{let c=H(),u=Ke(c),l=Xt(n,r,Je(u,r),{feature:t,cost:a,byPerson:o,services:s?.services,...s?.gate&&{gate:!0}}),d=u;return l.kind==="wait"?(st(e,{position:l.position,reason:"waiting for capacity",...s,since:z(e)?.since??new Date().toISOString()}),u.includes(t)||(d=[...u,t])):(d=u.filter(N=>N!==t),it(e)),d.join(`
|
|
11
|
+
`)!==c.join(`
|
|
12
|
+
`)&&bt(d),l},{timeout:ht})}i(tr,"requestAdmission");function Qe(t,e){let o=[];for(let[r,n]of Object.entries(Y(t)))if(!(!$(n)||(e?!e.includes(r):n.profiles)))for(let s of n.ports??[]){let a=Number.parseInt(String(s).split(":").slice(-2)[0]??"",10);Number.isInteger(a)&&o.push(a)}return o}i(Qe,"publishedPorts");function Ve(t){return new Promise(e=>{let o=qt.createServer();o.once("error",r=>e(r.code==="EADDRINUSE")),o.listen(t,"0.0.0.0",()=>o.close(()=>e(!1)))})}i(Ve,"bound");async function er(t,e,o){let r=new Map;try{for(let s of await k().listContainers()){let a=(s.Names[0]??"").replace(/^\//,""),c=s.Labels?.["com.werkmeister.feature"]??"";for(let u of s.Ports??[])u.PublicPort&&r.set(u.PublicPort,{name:a,feature:c})}}catch{}let n=[];for(let s of Qe(e,o)){let a=r.get(s);a?.feature!==t&&(a||await Ve(s))&&n.push({port:s,holder:a?.name??"a host process"})}return n}i(er,"portHolders");var pe=!1,me=!1;function cr(){pe=!0}i(cr,"ownScheduler");async function G(t,e,o,r){if(pe||!jt())return o();try{let{data:n,text:s}=await Tt("scheduler",{op:t,...e},{timeoutMs:r});return s&&x(s),n.value}catch(n){if(!(n instanceof Ct))throw n;return me||f(`${n.message} Scheduling in this process instead.`),me=!0,o()}}i(G,"schedulerOp");function ur(){return G("queue",{},async()=>H())}i(ur,"waitingQueue");var ye="com.werkmeister",ft=`${ye}.feature`,he="com.sandbox.local",mt=`${he}.feature`;function M(t,e){return t?.[`${ye}.${e}`]??t?.[`${he}.${e}`]??""}i(M,"labelOf");var gt=30,ze=1e4;async function Xe(){let t;try{let e=await Promise.all([ft,mt].map(r=>k().listContainers({all:!0,filters:{label:[r]},abortSignal:AbortSignal.timeout(ze)}))),o=new Set;t=e.flat().filter(r=>!o.has(r.Names[0])&&o.add(r.Names[0]))}catch{return null}return t.map(e=>({name:(e.Names[0]??"").replace(/^\//,""),feature:M(e.Labels,"feature"),slot:M(e.Labels,"slot"),service:M(e.Labels,"service")}))}i(Xe,"queryLabeledContainers");function Ze(){let t=nt().feature_slots;return(typeof t=="object"&&t!==null&&!Array.isArray(t)?t.count:void 0)??12}i(Ze,"slotCount");function qe(){let t=rt();if(typeof t!="object"||t===null)return new Set;let e=new Set;for(let[o,r]of Object.entries(t))typeof r=="object"&&r!==null&&!Array.isArray(r)&&r.port_offset!==null&&r.port_offset!==void 0&&e.add(o);return e}i(qe,"routableServiceNames");async function $t(){let t=await Xe();if(t===null)return null;let e=qe(),o={};for(let r of t){let n=r.feature,s=Number.parseInt(r.slot,10);if(Number.isNaN(s)){f(`Container '${r.name}' has unparseable slot label: '${r.slot}'`);continue}let a=r.service,c=o[n];c||(c={slot:s,services:[]},o[n]=c),c.slot!==s&&(f(`Feature '${n}' has inconsistent slot labels across containers (saw ${c.slot} and ${s}) -- using ${s}`),c.slot=s),a&&e.has(a)&&!c.services.includes(a)&&c.services.push(a)}return o}i($t,"getAllSlotsFromDocker");var Se={labels:$t};function to(t){let e=I();for(let[r,n]of Object.entries(e))n.workspace&&!A.existsSync(n.workspace)&&delete e[r];for(let[r,n]of Object.entries(t??{}))e[r]??={slot:n.slot,workspace:q(r)??""};let o=new Map;for(let[r,n]of Object.entries(e))o.set(n.slot,r);for(let[r,n]of Object.entries(t??{})){let s=o.get(n.slot);s&&s!==r&&f(`Slot ${n.slot} is leased to '${s}' but '${r}' has containers on it`),o.set(n.slot,r)}return{leases:e,held:o}}i(to,"heldSlots");function eo(t,e,o,r=Se){return G("allocate",{feature:t,preferredSlot:e??null,workspace:o??null},()=>oo(t,e,o,r))}i(eo,"allocateSlot");function oo(t,e,o,r){let n=Ze();return v("allocate",async()=>{let{leases:s,held:a}=to(await r.labels()),c=Zt(t,a,n,e??null);if(c===null)throw b(`All ${n} feature slots are occupied!`),new Error("No available slots. Stop an existing feature with 'werkmeister feature down <feature>' first.");return s[t]?.slot!==c&&h(`Allocated slot ${c} for '${t}'`),s[t]={slot:c,workspace:o??s[t]?.workspace??q(t)??""},St(s),c},{timeout:gt})}i(oo,"allocateSlotHere");async function xr(t,e,o,r=Se){let n=await r.labels(),s=await ro(t);if(!s)try{return await eo(t,o,e,r)}catch(c){throw new C(c instanceof Error?c.message:String(c),"SLOT_ALLOC")}let a=Object.entries(n??{}).find(([c,u])=>c!==t&&u.slot===s.slot);if(a){let[c]=a;throw new C(`Slot ${s.slot} is leased to '${t}' but '${c}' has containers on it \u2014 stop it or run 'werkmeister feature down ${c}'`,"SLOT_ALLOC")}return s.slot}i(xr,"requireLeasedSlot");function ro(t){return G("lease",{feature:t},()=>v("allocate",()=>I()[t]??null,{timeout:gt}))}i(ro,"slotLease");function kr(t){return G("release",{feature:t},()=>no(t))}i(kr,"releaseSlot");async function no(t){await v("allocate",()=>{let e=I();t in e&&(delete e[t],St(e))},{timeout:gt}),await ie(t)}i(no,"releaseSlotHere");async function pt(t){let e=(await be())[t];return e?e.slot:null}i(pt,"getSlot");async function be(){let t=await $t();return t===null?{}:t}i(be,"getAllSlots");function so(t){return At(t,nt())}i(so,"getPortRange");function io(t,e){let[o]=so(t);return o+e}i(io,"getServicePort");function ao(t,e,o,r){let n=e.type??"unknown";if(o.includes(t)){let c=e.port_offset??0;return{service:t,source:"local",endpoint:`localhost:${io(r,c)}`,type:n}}let s=Lt(t,e);if(s)return{service:t,source:"baseline",endpoint:`${s.host}:${s.port}`,type:n};let a=e.k8s_forward_port;return a?{service:t,source:"k8s",endpoint:`localhost:${a}`,type:n}:{service:t,source:"none",endpoint:null,type:n}}i(ao,"classifyEndpoint");async function vr(t){let e=await pt(t);if(e===null)throw new C(`Feature '${t}' is not running (no slot allocated)`,"NOT_RUNNING");let o=(await be())[t]?.services??[],r=rt(),n=[];for(let s of Object.keys(r).sort()){let a=r[s]??{};typeof a!="object"||a===null||Array.isArray(a)||n.push(ao(s,a,o,e))}return{feature:t,slot:e,endpoints:n}}i(vr,"featureServices");async function Er(){let t=we.join(Q(de.homedir()),"slots.json");if(!A.existsSync(t))return;let e;try{let n=JSON.parse(A.readFileSync(t,"utf8"));e=typeof n=="object"&&n!==null?n:{}}catch{e={}}let o=await $t()??{},r=Object.keys(e).filter(n=>typeof e[n]=="object"&&e[n]!==null&&!Array.isArray(e[n])&&!(n in o));r.length>0&&(f(`~/.werkmeister/slots.json had features with no labeled containers: ${r.join(", ")}`),f("These are now forgotten \u2014 restart them with 'werkmeister feature up' to re-register.")),y("Migrating: removing legacy ~/.werkmeister/slots.json (labels are now authoritative)");try{A.unlinkSync(t)}catch(n){f(`Could not remove ${t}: ${n}`)}}i(Er,"migrateSlotsJson");export{q as a,xe as b,Dt as c,B as d,ke as e,ve as f,Ee as g,yo as h,ho as i,So as j,bo as k,go as l,$o as m,xo as n,Qt as o,_e as p,ko as q,vo as r,Eo as s,Le as t,v as u,Me as v,I as w,H as x,ie as y,Vo as z,zo as A,ae as B,ce as C,ue as D,We as E,Be as F,Xo as G,He as H,Zo as I,qo as J,Je as K,tr as L,er as M,cr as N,G as O,ur as P,ye as Q,ft as R,he as S,mt as T,M as U,Ze as V,$t as W,eo as X,xr as Y,ro as Z,kr as _,pt as $,be as aa,so as ba,io as ca,ao as da,vr as ea,Er as fa};
|
|
13
|
+
//# sourceMappingURL=chunk-4O5AVQ7C.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{f as t}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{f as t}from"./chunk-MMI6XRQX.js";t();var p="mcp__ccd_turn__wrap_up",o="Don't turn on Auto-fix in the Claude desktop app (`ccd_pr`).";export{p as a,o as b};
|
|
4
|
+
//# sourceMappingURL=chunk-4TT37SCP.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{S as f}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{S as f}from"./chunk-J7B5NNPO.js";import{a as c,f as m}from"./chunk-MMI6XRQX.js";m();function u(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}c(u,"isDict");function p(n,t){if(!u(n))return null;let e=n.archetype;if(e!=null){t==null&&(t=f());let i=t[e];return u(i)?i:null}let r=n.standards;return r?.length?{standards:Array.from(r)}:null}c(p,"resolveServiceArchetype");function j(n,t){let e=p(n,t);return Array.from(e?.standards??[])}c(j,"serviceStandards");function v(n,t,e){if(!u(t)||S(t)!==null)return null;let r=t.test;if(r)return String(r);let o=p(t,e)?.test;return o?String(o).split("{service}").join(n):null}c(v,"serviceTestCommand");function S(n){let t=u(n)?/^none(?::\s*(.*))?$/i.exec(String(n.test??"").trim()):null;return t?t[1]?.trim()||"test: none":null}c(S,"serviceNoTests");function k(n,t,e){return`docker exec ${n}-${t} sh -c '${e}'`}c(k,"containerTestCommand");function x(n){return!/[|;&{}()`\n]|\$\(/.test(n.split("&&").join(""))}c(x,"isPlainChain");function C(n,t,e){let r=e?`${t} && ${e}`:t;return n?x(r)&&!r.includes("&&")?`${n} ${r}`:`${n} sh -c '${r.split("'").join("'\\''")}'`:r}c(C,"wrappedTestCommand");function g(n,t){if(!u(n))return null;let e=n.validate;if(e)return String(e);let r=p(n,t)?.validate;return r?String(r):null}c(g,"serviceValidation");function y(n,t,e){return e?.length?[...e]:n.flatMap(r=>t[r]?.services??[])}c(y,"candidateServiceNames");function b(n,t,e,r=new Set){e==null&&(e=f());let i=[];for(let o of[...new Set(n)].sort()){let s=t[o];if(!u(s))continue;let l=g(s,e);i.push({service:o,repo:String(s.repo??""),path:String(s.path??"."),test:v(o,s,e),validate:l??(r.has(o)?"URL health check (see Quick Health Checks)":"No validation guidance registered in services.yaml; say so instead of inventing one")})}return i}c(b,"validationRows");function $(n,t,e,r,i){i==null&&(i=f());let o=y(n,e,r),s={};for(let a of o){let h=t[a];if(!u(h))continue;let d=h.archetype;d&&d in i&&(s[d]??=[]).push(a)}let l={};for(let a of Object.keys(s).sort())l[a]=[...new Set(s[a])].sort();return l}c($,"resolvePresentArchetypes");function T(n,t,e,r,i){let o=(t.SERVICES??"").split(",").map(s=>s.trim()).filter(s=>s);return $(n.map(([s])=>s),e,r,o,i)}c(T,"presentArchetypes");function N(n,t){let e=[];for(let[r,i]of Object.entries(n)){if(!u(i))continue;let o=i.archetype;o!=null&&(o in t||e.push(`services.yaml: service '${r}' references unknown archetype '${o}' \u2014 no \`archetypes.${o}\` entry`),i.standards?.length&&e.push(`services.yaml: service '${r}' declares both \`archetype:\` and legacy \`standards:\` \u2014 drop \`standards:\` (the archetype wins)`))}return e}c(N,"validateServiceArchetypes");export{p as a,j as b,v as c,S as d,k as e,x as f,C as g,g as h,y as i,b as j,T as k,N as l};
|
|
4
|
+
//# sourceMappingURL=chunk-4YFK45ID.js.map
|