werkmeister 0.92.0 → 0.92.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.
Files changed (149) hide show
  1. package/dist/{budget-TKBLI67Y.js → budget-TTYJ5KH5.js} +2 -2
  2. package/dist/{cache-BUL5R7Q2.js → cache-6H63KWFE.js} +2 -2
  3. package/dist/{chunk-EX2QMXTK.js → chunk-2AYQZZIC.js} +2 -2
  4. package/dist/{chunk-JBWHWESN.js → chunk-2HQRIQ4U.js} +2 -2
  5. package/dist/{chunk-M6S5WJFM.js → chunk-2OVQ4XCH.js} +3 -3
  6. package/dist/{chunk-BV4NA344.js → chunk-3CYN2F6X.js} +2 -2
  7. package/dist/{chunk-FPXY5JSG.js → chunk-3HON37L6.js} +2 -2
  8. package/dist/{chunk-T44QBJL7.js → chunk-3OIQ4WLP.js} +2 -2
  9. package/dist/{chunk-CI3EJJQC.js → chunk-3W4RYB7A.js} +2 -2
  10. package/dist/{chunk-XIVOJW3V.js → chunk-4JN2Z2L7.js} +2 -2
  11. package/dist/{chunk-HOK3ESYD.js → chunk-4QC3BQWC.js} +2 -2
  12. package/dist/{chunk-FNWXAU5D.js → chunk-56VNGSHC.js} +2 -2
  13. package/dist/{chunk-4367DZNU.js → chunk-5JPOPZ32.js} +2 -2
  14. package/dist/{chunk-4TQZZ5YN.js → chunk-6KRQ3H6N.js} +2 -2
  15. package/dist/{chunk-GNOGFS45.js → chunk-6VTA7NS7.js} +2 -2
  16. package/dist/{chunk-74M5N75B.js → chunk-7GY3YBLK.js} +2 -2
  17. package/dist/{chunk-5JJ2BK6S.js → chunk-7IZYEWMJ.js} +2 -2
  18. package/dist/{chunk-AAWZOPFV.js → chunk-AEJ67TDF.js} +2 -2
  19. package/dist/{chunk-6ZEKED6S.js → chunk-AJ4NDENF.js} +2 -2
  20. package/dist/{chunk-XRWTNGOI.js → chunk-AXHKR7QJ.js} +3 -3
  21. package/dist/{chunk-444N5SCC.js → chunk-BJUG37UY.js} +3 -3
  22. package/dist/{chunk-33N7SIVU.js → chunk-BY2ABT4X.js} +2 -2
  23. package/dist/{chunk-MPC5IJIZ.js → chunk-CM5S2JQM.js} +2 -2
  24. package/dist/{chunk-6YT3NGUB.js → chunk-CSA7FTSE.js} +3 -3
  25. package/dist/{chunk-2ACFWN2M.js → chunk-D6GYYNC6.js} +2 -2
  26. package/dist/{chunk-Q2RP2WSQ.js → chunk-D76SNXGW.js} +2 -2
  27. package/dist/{chunk-MX36SA6F.js → chunk-DKQXFDLB.js} +2 -2
  28. package/dist/{chunk-QGICDQ5A.js → chunk-DVA5RUUS.js} +2 -2
  29. package/dist/{chunk-NPSTOELH.js → chunk-E4LKXESH.js} +2 -2
  30. package/dist/{chunk-LE7QUGQB.js → chunk-FVSWVCJY.js} +2 -2
  31. package/dist/{chunk-BVZYLT4Y.js → chunk-GBEJYOHW.js} +2 -2
  32. package/dist/{chunk-OSLXQ55S.js → chunk-H5TX3NBY.js} +2 -2
  33. package/dist/{chunk-4H2WS76E.js → chunk-HM4VMEJE.js} +2 -2
  34. package/dist/{chunk-2RSRU6B7.js → chunk-IJ7KALKL.js} +2 -2
  35. package/dist/chunk-IMYXPBUZ.js +4 -0
  36. package/dist/{chunk-P7OT4Y7J.js → chunk-JEFMLFH2.js} +2 -2
  37. package/dist/{chunk-LAMNTGMN.js → chunk-JZBQMFSA.js} +2 -2
  38. package/dist/{chunk-F6ZUFLFY.js → chunk-KI2DOUUL.js} +2 -2
  39. package/dist/{chunk-IKOQ77ZZ.js → chunk-KIIMYDMA.js} +2 -2
  40. package/dist/{chunk-X6CVGO2K.js → chunk-KJ6E76L6.js} +2 -2
  41. package/dist/{chunk-F7OXH6PK.js → chunk-KKBNNZKD.js} +2 -2
  42. package/dist/{chunk-OJ3OZ57Z.js → chunk-KQ74ETV7.js} +2 -2
  43. package/dist/{chunk-VV3GE2PH.js → chunk-KW4XOYMP.js} +2 -2
  44. package/dist/{chunk-PZEQX2PI.js → chunk-L5QVUT7E.js} +2 -2
  45. package/dist/{chunk-YQS3XJF7.js → chunk-LBXKRJ2H.js} +2 -2
  46. package/dist/{chunk-EE6CVUJU.js → chunk-LKGOZP4T.js} +2 -2
  47. package/dist/{chunk-5NYE7QLH.js → chunk-LZ4O2X3P.js} +2 -2
  48. package/dist/{chunk-3PVHFXT4.js → chunk-LZUS5ISQ.js} +2 -2
  49. package/dist/{chunk-I63BTZ7Q.js → chunk-MULCDSTG.js} +2 -2
  50. package/dist/{chunk-D6D3PMMQ.js → chunk-NM5VSS3I.js} +2 -2
  51. package/dist/{chunk-VO5KA24O.js → chunk-NS6NJTDL.js} +2 -2
  52. package/dist/{chunk-QSD3XLGY.js → chunk-OSMT22M5.js} +2 -2
  53. package/dist/{chunk-XL3VZTXU.js → chunk-PYZLNWVW.js} +2 -2
  54. package/dist/{chunk-VUM6YZHQ.js → chunk-QFBPHEOJ.js} +2 -2
  55. package/dist/{chunk-DBDOKIDS.js → chunk-QRR2ZLUW.js} +2 -2
  56. package/dist/{chunk-AWO5OU62.js → chunk-QXMIEWVS.js} +19 -19
  57. package/dist/{chunk-SPQGOYKE.js → chunk-RNN5HGWQ.js} +2 -2
  58. package/dist/{chunk-ASBFFRUJ.js → chunk-UA62KMFB.js} +2 -2
  59. package/dist/{chunk-MFZFU6TC.js → chunk-UPV6CYKM.js} +2 -2
  60. package/dist/{chunk-CGUDKKJA.js → chunk-V6Q2JXTT.js} +2 -2
  61. package/dist/{chunk-4G42JK5O.js → chunk-W4KSSVNG.js} +2 -2
  62. package/dist/{chunk-P6QBXNZB.js → chunk-WPJBTZOM.js} +2 -2
  63. package/dist/{chunk-HZTJBCPZ.js → chunk-XGFUL5U4.js} +2 -2
  64. package/dist/{chunk-QE2XDGWU.js → chunk-Y45MA3HZ.js} +2 -2
  65. package/dist/{chunk-TJCNHCI4.js → chunk-YAUI6SGO.js} +2 -2
  66. package/dist/{chunk-6VAMG5IG.js → chunk-YBA7BD7G.js} +2 -2
  67. package/dist/{chunk-PBGA2MNO.js → chunk-Z6R3FO6F.js} +2 -2
  68. package/dist/{chunk-7XU4VES3.js → chunk-ZNIWZFIE.js} +2 -2
  69. package/dist/clean-X5WWNZIP.js +8 -0
  70. package/dist/close_out-7LO3KNTS.js +8 -0
  71. package/dist/code-EJ3QU7E6.js +4 -0
  72. package/dist/{config-3USW4MXN.js → config-KR3H4TDB.js} +2 -2
  73. package/dist/{connect-OEJ6BEW6.js → connect-IPQ5AOIS.js} +2 -2
  74. package/dist/{daemon-OUZ2J3OL.js → daemon-TUGMKFHW.js} +2 -2
  75. package/dist/dashboard.js +1 -1
  76. package/dist/{detect-II6CDXSW.js → detect-7MAHGVGY.js} +2 -2
  77. package/dist/{down-LXQJ5PKE.js → down-AOLCRBES.js} +3 -3
  78. package/dist/{fixture-Y2KJZ57V.js → fixture-F7DSIVT3.js} +2 -2
  79. package/dist/form-cli.js +1 -1
  80. package/dist/hooks-RMXPVVIC.js +4 -0
  81. package/dist/{hooks_gen-SAV2DIGW.js → hooks_gen-WGD5FFQ4.js} +2 -2
  82. package/dist/infra-NHNT4ONT.js +4 -0
  83. package/dist/init_workspace-T52YUOMZ.js +4 -0
  84. package/dist/{intercept-BYGTUJJX.js → intercept-HLTGV442.js} +2 -2
  85. package/dist/{issue-PYFVLYTJ.js → issue-DMYUWFA2.js} +2 -2
  86. package/dist/lib/agent_state.js +1 -1
  87. package/dist/lib/gate.js +1 -1
  88. package/dist/lib/pr_guard.js +1 -1
  89. package/dist/list_workspaces-DKCSLIP5.js +7 -0
  90. package/dist/logs-ZIUFCDA7.js +6 -0
  91. package/dist/main.js +3 -3
  92. package/dist/mcp-proxy.js +1 -1
  93. package/dist/mcp.js +1 -1
  94. package/dist/{migrate-N7THLGFS.js → migrate-KGSH4WGD.js} +2 -2
  95. package/dist/notes-AQVKVTI4.js +4 -0
  96. package/dist/{open-ETRC55LW.js → open-MCJDWVDH.js} +2 -2
  97. package/dist/{optimize-PDA7S3BT.js → optimize-XWEKUCIY.js} +2 -2
  98. package/dist/pause-RWX5RSDC.js +4 -0
  99. package/dist/pr-HGSOZI2U.js +5 -0
  100. package/dist/proxy_reload-LNWI6CPL.js +6 -0
  101. package/dist/{registry-QDPVM24C.js → registry-SSARK6C3.js} +2 -2
  102. package/dist/remove-7BB7THFA.js +7 -0
  103. package/dist/remove_workspace-KSQLFOAE.js +8 -0
  104. package/dist/restart-3FDY7PAN.js +8 -0
  105. package/dist/resume-UNJCKVHH.js +8 -0
  106. package/dist/{safari-H7QZRIVW.js → safari-G4IW7YKV.js} +2 -2
  107. package/dist/{sandbox-BYFPGJVF.js → sandbox-XN4U5CKW.js} +2 -2
  108. package/dist/{services-MSHQCMVN.js → services-2SQY6DTO.js} +2 -2
  109. package/dist/{setup-YKQ77D5H.js → setup-QXJNO4PR.js} +2 -2
  110. package/dist/skills-LDHX6ZJI.js +4 -0
  111. package/dist/{slots-73G2ZGJL.js → slots-S7AWNSVB.js} +2 -2
  112. package/dist/{standards-FDDNAEOV.js → standards-HRJAVEGH.js} +2 -2
  113. package/dist/start_args-VDKLTUAI.js +4 -0
  114. package/dist/starting_prompt-XF247YE4.js +4 -0
  115. package/dist/stats-DZLJMUPH.js +4 -0
  116. package/dist/{status-OQGX7QI7.js → status-FXPDU54K.js} +2 -2
  117. package/dist/{stop-HNXAPSHU.js → stop-P4GFPWNZ.js} +2 -2
  118. package/dist/{telepresence-GRHFVPH2.js → telepresence-DI5DO3XJ.js} +2 -2
  119. package/dist/{test-RB6AUWVY.js → test-TPU7MGCF.js} +2 -2
  120. package/dist/{tokens-RE4INZUK.js → tokens-E7AWV5BO.js} +2 -2
  121. package/dist/{up-A7P62LFK.js → up-OIRGZC2H.js} +3 -3
  122. package/dist/{v4-IYCRXX7U.js → v4-ASZ7X64N.js} +2 -2
  123. package/dist/wait_load-VMOJ42X5.js +4 -0
  124. package/dist/werkmeister-workspaces.vsix +0 -0
  125. package/dist/{workspace-VTMQVWHY.js → workspace-LOUYKMYT.js} +2 -2
  126. package/infra/schemas/services-fragment.schema.json +5 -0
  127. package/package.json +3 -3
  128. package/dist/chunk-E6AYGN43.js +0 -4
  129. package/dist/clean-VMGDHPTK.js +0 -8
  130. package/dist/close_out-YL7ZQNYX.js +0 -8
  131. package/dist/code-PEALTJS6.js +0 -4
  132. package/dist/hooks-UHOQBMP6.js +0 -4
  133. package/dist/infra-25WZFWM5.js +0 -4
  134. package/dist/init_workspace-63E5ESML.js +0 -4
  135. package/dist/list_workspaces-T7PPF6FG.js +0 -7
  136. package/dist/logs-UWHV5QW2.js +0 -6
  137. package/dist/notes-TGGQWDDQ.js +0 -4
  138. package/dist/pause-CTRSE2IT.js +0 -4
  139. package/dist/pr-CD4JTB6G.js +0 -5
  140. package/dist/proxy_reload-WMLGFYB4.js +0 -6
  141. package/dist/remove-ZZJZSRYI.js +0 -7
  142. package/dist/remove_workspace-7G2TWHNN.js +0 -8
  143. package/dist/restart-HLJKWBNY.js +0 -8
  144. package/dist/resume-FFORMDXI.js +0 -8
  145. package/dist/skills-3CA6KDTH.js +0 -4
  146. package/dist/start_args-GY2J76SB.js +0 -4
  147. package/dist/starting_prompt-7MKOGQRI.js +0 -4
  148. package/dist/stats-63H62WBA.js +0 -4
  149. package/dist/wait_load-ZN5FY4YA.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{a as s,f as c}from"./chunk-T44QBJL7.js";c();function t(e=process.env){let r=e.WERKMEISTER_LAUNCHER;return r==="vscode"||r==="terminal"?r:e.CLAUDE_CODE_ENTRYPOINT==="claude-vscode"||e.TERM_PROGRAM==="vscode"?"vscode":"terminal"}s(t,"claudeLauncher");var n="vscode://jbbz.werkmeister-vscode";function i(e){let r=new URLSearchParams({workspace:e.workspace,mode:e.sessionId?"resume":"new"});return e.sessionId&&r.set("session",e.sessionId),e.prompt&&r.set("prompt",e.prompt),`${n}/claude?${r}`}s(i,"claudeLaunchUri");function a(e){return`${n}/reconcile?${new URLSearchParams({slug:e})}`}s(a,"reconcileLaunchUri");export{t as a,i as b,a as c};
4
- //# sourceMappingURL=chunk-XIVOJW3V.js.map
3
+ import{a as s,f as c}from"./chunk-3OIQ4WLP.js";c();function t(e=process.env){let r=e.WERKMEISTER_LAUNCHER;return r==="vscode"||r==="terminal"?r:e.CLAUDE_CODE_ENTRYPOINT==="claude-vscode"||e.TERM_PROGRAM==="vscode"?"vscode":"terminal"}s(t,"claudeLauncher");var n="vscode://jbbz.werkmeister-vscode";function i(e){let r=new URLSearchParams({workspace:e.workspace,mode:e.sessionId?"resume":"new"});return e.sessionId&&r.set("session",e.sessionId),e.prompt&&r.set("prompt",e.prompt),`${n}/claude?${r}`}s(i,"claudeLaunchUri");function a(e){return`${n}/reconcile?${new URLSearchParams({slug:e})}`}s(a,"reconcileLaunchUri");export{t as a,i as b,a as c};
4
+ //# sourceMappingURL=chunk-4JN2Z2L7.js.map
@@ -1,10 +1,10 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{U as Y}from"./chunk-VV3GE2PH.js";import{d as N,e as L}from"./chunk-D6D3PMMQ.js";import{l as R,m as g}from"./chunk-CGUDKKJA.js";import{b as J}from"./chunk-74M5N75B.js";import{E as K,J as M,M as h,P as U,Z as B,_ as f,a as ne,j as l,k as y,l as A,m as p,t as W,x}from"./chunk-7XU4VES3.js";import{a as n,e as oe,f as u}from"./chunk-T44QBJL7.js";u();var q=oe(ne(),1);import*as $ from"node:fs";import*as S from"node:path";var se=/@sha256:[0-9a-f]{64}$/;function m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(m,"isDict");function ie(e,r){let t=(e??x()).infra,o=m(t)?t.baseline:void 0;if(!m(o))return[];let i=r??h();return Object.entries(o).map(([s,a])=>{let d=`config.yaml infra.baseline.${s}`,H=i[s];if(!m(H))throw new Error(`${d}: no such service in services.yaml`);let b=m(a)?a.image:void 0;if(typeof b!="string"||!se.test(b))throw new Error(`${d}.image must be pinned as <image>@sha256:<digest>, got ${JSON.stringify(b)}. Resolve one with: docker pull <image>:<tag> && docker inspect --format='{{index .RepoDigests 0}}' <image>:<tag>`);let _=m(a)?a.environment??{}:{};if(!m(_)||Object.values(_).some(v=>m(v)||Array.isArray(v)))throw new Error(`${d}.environment must be a map of plain values`);return{service:s,image:b,port:Number(H.internal_port??3e3),environment:Object.fromEntries(Object.entries(_).map(([v,te])=>[v,String(te)]))}})}n(ie,"baselineSpecs");function I(){return S.join(f(),"compose","baseline.override.yml")}n(I,"baselineOverridePath");var ae=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/config.yaml infra.baseline \u2014 do not edit.","# Merged over infra/compose/shared-infra.yml by every `docker compose` call the CLI makes."];function ce(e){let r=Object.fromEntries(e.map(t=>{let o=`baseline-${t.service}`;return[o,{image:t.image,container_name:`w9r-${o}`,restart:"unless-stopped",...Object.keys(t.environment).length>0?{environment:t.environment}:{},networks:{"werkmeister-shared":{aliases:[o]}}}]}));return[...ae,(0,q.stringify)({services:r},{aliasDuplicateObjects:!1})].join(`
3
+ import{U as Y}from"./chunk-KW4XOYMP.js";import{d as N,e as L}from"./chunk-NM5VSS3I.js";import{l as R,m as g}from"./chunk-V6Q2JXTT.js";import{b as J}from"./chunk-7GY3YBLK.js";import{E as K,J as M,M as h,P as U,Z as B,_ as f,a as ne,j as l,k as y,l as A,m as p,t as W,x}from"./chunk-ZNIWZFIE.js";import{a as n,e as oe,f as u}from"./chunk-3OIQ4WLP.js";u();var q=oe(ne(),1);import*as $ from"node:fs";import*as S from"node:path";var se=/@sha256:[0-9a-f]{64}$/;function m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(m,"isDict");function ie(e,r){let t=(e??x()).infra,o=m(t)?t.baseline:void 0;if(!m(o))return[];let i=r??h();return Object.entries(o).map(([s,a])=>{let d=`config.yaml infra.baseline.${s}`,H=i[s];if(!m(H))throw new Error(`${d}: no such service in services.yaml`);let b=m(a)?a.image:void 0;if(typeof b!="string"||!se.test(b))throw new Error(`${d}.image must be pinned as <image>@sha256:<digest>, got ${JSON.stringify(b)}. Resolve one with: docker pull <image>:<tag> && docker inspect --format='{{index .RepoDigests 0}}' <image>:<tag>`);let _=m(a)?a.environment??{}:{};if(!m(_)||Object.values(_).some(v=>m(v)||Array.isArray(v)))throw new Error(`${d}.environment must be a map of plain values`);return{service:s,image:b,port:Number(H.internal_port??3e3),environment:Object.fromEntries(Object.entries(_).map(([v,te])=>[v,String(te)]))}})}n(ie,"baselineSpecs");function I(){return S.join(f(),"compose","baseline.override.yml")}n(I,"baselineOverridePath");var ae=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/config.yaml infra.baseline \u2014 do not edit.","# Merged over infra/compose/shared-infra.yml by every `docker compose` call the CLI makes."];function ce(e){let r=Object.fromEntries(e.map(t=>{let o=`baseline-${t.service}`;return[o,{image:t.image,container_name:`w9r-${o}`,restart:"unless-stopped",...Object.keys(t.environment).length>0?{environment:t.environment}:{},networks:{"werkmeister-shared":{aliases:[o]}}}]}));return[...ae,(0,q.stringify)({services:r},{aliasDuplicateObjects:!1})].join(`
4
4
  `)}n(ce,"renderBaselineOverride");function Fe(e=!1){let r=ie(),t=I();$.mkdirSync(S.dirname(t),{recursive:!0}),$.writeFileSync(t,ce(r)),e||l(`Generated ${t}`)}n(Fe,"generateBaselineOverride");u();import*as w from"node:fs";import*as k from"node:path";function E(e,r){return K(e??h(),r??U())}n(E,"forwardSpecs");function fe(e,r){return E(e,r).map(t=>`${t.name}|${t.listen}|${t.remote}|${t.ns}|${t.prefix}|${t.health}`)}n(fe,"buildForwardRows");function z(){return k.join(f(),"k8s-port-forward","forwards")}n(z,"forwardsFilePath");function P(){return k.join(f(),"compose","k8s-forwards.override.yml")}n(P,"overrideFilePath");function ue(e){e=e??z(),w.mkdirSync(k.dirname(e),{recursive:!0});let r=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/services.yaml \u2014 do not edit.","# Format: name|listen_port|remote_port|namespace|pod_prefix|health_path",...fe(),""].join(`
5
5
  `);return w.writeFileSync(e,r),e}n(ue,"generateForwardsFile");var V=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/services.yaml \u2014 do not edit.","# Merged over infra/compose/shared-infra.yml by every `docker compose` call the CLI makes."];function le(e){return e.length===0?[...V,"services:"," k8s-forwards: {}",""].join(`
6
6
  `):[...V,"services:"," k8s-forwards:"," ports:",...e.map(r=>` - "${r.listen}:${r.listen}" # ${r.name}`)," networks:"," werkmeister-shared:"," aliases:",...e.map(r=>` - k8s-${r.name}`),""].join(`
7
7
  `)}n(le,"renderK8sForwardsOverride");function X(e=!1){ue();let r=P();w.mkdirSync(k.dirname(r),{recursive:!0}),w.writeFileSync(r,le(E())),e||l(`Generated ${z()} and ${r}`)}n(X,"generateK8sForwards");u();import*as D from"node:fs";import*as F from"node:path";var j="w9r-infra",He="sandbox-infra",C="w9r-k8s-forwards";function me(){let r=x().infra?.profiles;return Array.isArray(r)?r.filter(t=>typeof t=="string"&&t!==""):[]}n(me,"infraProfiles");function Q(){let e=P();D.existsSync(e)||X(!0);let r=I();return{argv:["docker","compose","-f",F.join(B(),"compose","shared-infra.yml"),"-f",e,...D.existsSync(r)?["-f",r]:[],"-p",j,...me().flatMap(t=>["--profile",t])],env:{...process.env,WERKMEISTER_STATE_DIR:f()},cwd:F.dirname(f())}}n(Q,"composeInvocation");u();import*as c from"node:fs";import*as Z from"node:http";import*as G from"node:net";import*as O from"node:path";import{setTimeout as de}from"node:timers/promises";async function pe(){return{"k8s-forwards":(await N(j,"k8s-forwards",{all:!1})??[]).some(r=>r.health==="healthy"||r.state==="running"&&!r.health)}}n(pe,"checkPortForwardHealth");function he(e,r){if(!e)return!0;let t=new Map;for(let o of e){let i=Y(o.labels,"feature");if(!i)continue;let s=t.get(i)??{local:[],running:!1};s.local.push(o.service),s.running||=o.state==="running",t.set(i,s)}return[...t.values()].some(o=>o.running&&M(o.local,r))}n(he,"clusterNeeded");async function we(e){let r;try{r=h()}catch{return!0}return he(e===void 0?await N():e,r)}n(we,"forwarderNeeded");function ke(e){return c.existsSync(e)&&c.statSync(e).isDirectory()}n(ke,"isDir");function ye(e){return/server:\s*https:\/\/(127\.0\.0\.1|localhost)\b/.test(e)?e.replace(/(server:\s*https:\/\/)(127\.0\.0\.1|localhost)\b/g,"$1host.docker.internal").replace(/^(\s*)certificate-authority-data:.*$/gm,"$1insecure-skip-tls-verify: true"):e}n(ye,"shimLocalApiServer");function ge(){let e=O.join(f(),"k8s-port-forward","kubeconfig");ke(e)&&c.rmSync(e,{recursive:!0,force:!0}),c.mkdirSync(O.dirname(e),{recursive:!0}),l("Refreshing k8s-port-forward/kubeconfig from current context...");try{let r=g(["kubectl","config","view","--raw","--minify","--flatten"],{capture:!0,timeout:30});if(r.status===0){c.writeFileSync(e,ye(r.stdout));let t=g(["kubectl","--kubeconfig",e,"config","current-context"],{capture:!0,timeout:15}),o=t.status===0?t.stdout.trim():"?";y(`Kubeconfig pinned to context: ${o}`)}else p(`kubectl config view failed: ${r.stderr.trim()}`)}catch(r){if(r instanceof R&&(r.code==="ENOENT"||r.code==="ETIMEDOUT"))p(`Could not generate kubeconfig: ${r.message}`);else throw r}return c.existsSync(e)&&c.statSync(e).isFile()}n(ge,"refreshKubeconfig");function Ee(){try{return g(["kubectl","--request-timeout=3s","get","--raw","/readyz"],{capture:!0,timeout:20}).status===0}catch(e){if(e instanceof R)return!1;throw e}}n(Ee,"clusterReachable");async function er(){if(W())return l("k8s port-forwards skipped (WERKMEISTER_FIXTURE)"),"healthy";if((await pe())["k8s-forwards"]??!1)return y("k8s port-forwards container is healthy"),"healthy";if(A("k8s port-forwards container is unhealthy \u2014 restarting..."),!ge())return p("Not restarting k8s-forwards without a kubeconfig file to mount"),"failed";if(!Ee())return A("No reachable k8s cluster \u2014 skipping port-forwards; services not run locally are unavailable"),"failed";let{argv:r,env:t,cwd:o}=Q();try{let i=g([...r,"up","-d","--force-recreate","k8s-forwards"],{capture:!0,timeout:60,env:t,cwd:o});return i.status!==0?(p(`Failed to restart k8s-forwards: ${i.stderr.trim()}`),"failed"):(y("k8s port-forwards container restarted"),"restarted")}catch(i){if(i instanceof R)return p(`Failed to restart k8s-forwards: ${i.message}`),"failed";throw i}}n(er,"ensurePortForwardsHealthy");async function rr(e=3e4,r=500){let t=E();if(!t.length)return;l("Waiting for port-forwards to reconnect...");let o=Date.now()+e;for(;;){if(t=(await Promise.all(t.map(async s=>({spec:s,ok:(await re(s.listen,s.health)).ok})))).filter(s=>!s.ok).map(s=>s.spec),!t.length){y("k8s port-forwards are carrying traffic");return}if(Date.now()>=o)throw new J(`k8s port-forwards did not come back within ${Math.round(e/1e3)}s: ${t.map(s=>`${s.name}:${s.listen}`).join(", ")}
8
8
  Check \`docker logs ${C}\` and your kubeconfig.`,"FORWARDS_NEVER_READY");await de(r)}}n(rr,"waitForForwards");function be(e,r,t=3500){return new Promise(o=>{let i=Z.get({host:"127.0.0.1",port:e,path:r,timeout:t},s=>{s.resume();let a=s.statusCode??0;o({ok:a<500,detail:`HTTP ${a}`})});i.on("timeout",()=>{i.destroy(),o({ok:!1,detail:"timeout"})}),i.on("error",s=>o({ok:!1,detail:s.code??s.message}))})}n(be,"checkHttpHealth");var ee={redis:{send:Buffer.from(`PING\r
9
9
  `),ok:n(e=>e.toString("latin1").startsWith("+PONG"),"ok")},postgres:{send:Buffer.from([0,0,0,8,4,210,22,47]),ok:n(e=>e[0]===83||e[0]===78,"ok")}};function ve(e,r,t=3500){return new Promise(o=>{let i=ee[r],s=G.connect({host:"127.0.0.1",port:e,timeout:t});s.on("connect",()=>s.write(i.send)),s.once("data",a=>{s.destroy();let d=i.ok(a);o({ok:d,detail:d?`${r} ok`:`${r} bad reply`})}),s.on("timeout",()=>{s.destroy(),o({ok:!1,detail:"timeout (connected, no reply)"})}),s.on("error",a=>o({ok:!1,detail:a.code??a.message})),s.on("close",()=>o({ok:!1,detail:"closed without reply"}))})}n(ve,"checkWireHealth");function xe(e,r=2500){return new Promise(t=>{let o=G.connect({host:"127.0.0.1",port:e,timeout:r});o.on("connect",()=>{o.destroy(),t({ok:!0,detail:"tcp open"})}),o.on("timeout",()=>{o.destroy(),t({ok:!1,detail:"timeout"})}),o.on("error",i=>t({ok:!1,detail:i.code??i.message}))})}n(xe,"checkTcpHealth");function re(e,r){return r.startsWith("/")?be(e,r):ee[r]?ve(e,r):r?Promise.resolve({ok:!1,detail:`unknown probe "${r}"`}):xe(e)}n(re,"checkForwardHealth");async function Re(e,r){return(await re(e,r)).ok?"alive":"dead"}n(Re,"classifyForward");async function tr(){let e=await L(C),r;try{r=E()}catch{return[]}let t=e?null:await we()?"container_down":"stopped",o=[];for(let i of r)o.push({name:i.name,listen_port:i.listen,remote_port:i.remote,health_path:i.health,status:t??await Re(i.listen,i.health)});return o}n(tr,"getPerServiceStatus");export{ie as a,Fe as b,X as c,j as d,He as e,C as f,me as g,Q as h,pe as i,we as j,ge as k,er as l,rr as m,re as n,tr as o};
10
- //# sourceMappingURL=chunk-HOK3ESYD.js.map
10
+ //# sourceMappingURL=chunk-4QC3BQWC.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{r as l}from"./chunk-BV4NA344.js";import{M as f,l as i}from"./chunk-7XU4VES3.js";import{a as n,f as u}from"./chunk-T44QBJL7.js";u();import{promises as p}from"node:dns";function h(e,o){return`${e}.${o.replace(/^\.+/,"")}`}n(h,"hostFor");function v(e,o){let a=e??f(),s=o??l(),m={};for(let[t,r]of Object.entries(a)){let c=r&&typeof r=="object"?r.feature_router:null;if(!c)continue;let d=c.remote_upstream??void 0;m[t]={hostname:c.hostname??h(t,s.local_domain),k8s:c.k8s??void 0,remoteHostname:c.remote_hostname??(d?h(t,s.remote_domain):void 0),remoteUpstream:d}}return m}n(v,"loadFeatureRouters");function $(e,o){let a=new Set;for(let s of Object.values(v(e,o)))s.hostname&&a.add(s.hostname),s.remoteHostname&&a.add(s.remoteHostname);return[...a].sort()}n($,"ingressHostnames");function _(e){let o;try{o=$()}catch{return null}return o.length?`https://${o[0]}${e.startsWith("/")?e:`/${e}`}`:null}n(_,"featureUrl");var g=n(e=>p.lookup(e,{all:!0}),"platformLookup");async function b(e,o=g){let s=(await Promise.all(e.map(async t=>{try{return{host:t,addresses:(await o(t)).map(r=>r.address)}}catch{return{host:t,addresses:[]}}}))).filter(({addresses:t})=>!t.includes("127.0.0.1"));if(!s.length)return[];let m=s.map(({host:t})=>t);i(`${m.length} routed hostname(s) do not resolve to 127.0.0.1 on this machine:`);for(let{host:t,addresses:r}of s)i(` ${t}: ${r.length?`resolves to ${r.join(", ")}`:"no address"}`);return i(`Add them: echo "127.0.0.1 ${m.join(" ")}" | sudo tee -a /etc/hosts`),i('or run `werkmeister machine setup` (docs/configuration.md: "New hostnames need /etc/hosts entries")'),m}n(b,"warnUnresolvedHosts");export{v as a,$ as b,_ as c,b as d};
4
- //# sourceMappingURL=chunk-FNWXAU5D.js.map
3
+ import{r as l}from"./chunk-3CYN2F6X.js";import{M as f,l as i}from"./chunk-ZNIWZFIE.js";import{a as n,f as u}from"./chunk-3OIQ4WLP.js";u();import{promises as p}from"node:dns";function h(e,o){return`${e}.${o.replace(/^\.+/,"")}`}n(h,"hostFor");function v(e,o){let a=e??f(),s=o??l(),m={};for(let[t,r]of Object.entries(a)){let c=r&&typeof r=="object"?r.feature_router:null;if(!c)continue;let d=c.remote_upstream??void 0;m[t]={hostname:c.hostname??h(t,s.local_domain),k8s:c.k8s??void 0,remoteHostname:c.remote_hostname??(d?h(t,s.remote_domain):void 0),remoteUpstream:d}}return m}n(v,"loadFeatureRouters");function $(e,o){let a=new Set;for(let s of Object.values(v(e,o)))s.hostname&&a.add(s.hostname),s.remoteHostname&&a.add(s.remoteHostname);return[...a].sort()}n($,"ingressHostnames");function _(e){let o;try{o=$()}catch{return null}return o.length?`https://${o[0]}${e.startsWith("/")?e:`/${e}`}`:null}n(_,"featureUrl");var g=n(e=>p.lookup(e,{all:!0}),"platformLookup");async function b(e,o=g){let s=(await Promise.all(e.map(async t=>{try{return{host:t,addresses:(await o(t)).map(r=>r.address)}}catch{return{host:t,addresses:[]}}}))).filter(({addresses:t})=>!t.includes("127.0.0.1"));if(!s.length)return[];let m=s.map(({host:t})=>t);i(`${m.length} routed hostname(s) do not resolve to 127.0.0.1 on this machine:`);for(let{host:t,addresses:r}of s)i(` ${t}: ${r.length?`resolves to ${r.join(", ")}`:"no address"}`);return i(`Add them: echo "127.0.0.1 ${m.join(" ")}" | sudo tee -a /etc/hosts`),i('or run `werkmeister machine setup` (docs/configuration.md: "New hostnames need /etc/hosts entries")'),m}n(b,"warnUnresolvedHosts");export{v as a,$ as b,_ as c,b as d};
4
+ //# sourceMappingURL=chunk-56VNGSHC.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as r,f as c}from"./chunk-T44QBJL7.js";c();import*as t from"node:fs";import*as s from"node:path";var i="compose.yml",p="docker-compose.yml";function f(o){try{return t.statSync(o).isFile()}catch{return!1}}r(f,"isFile");function m(o){for(let e of[i,p]){let n=s.join(o,e);if(f(n))return n}return null}r(m,"findWorkspaceCompose");function u(o){let e=s.join(o,p),n=s.join(o,i);f(e)&&!t.existsSync(n)&&t.renameSync(e,n)}r(u,"migrateWorkspaceCompose");export{i as a,p as b,m as c,u as d};
4
- //# sourceMappingURL=chunk-4367DZNU.js.map
3
+ import{a as r,f as c}from"./chunk-3OIQ4WLP.js";c();import*as t from"node:fs";import*as s from"node:path";var i="compose.yml",p="docker-compose.yml";function f(o){try{return t.statSync(o).isFile()}catch{return!1}}r(f,"isFile");function m(o){for(let e of[i,p]){let n=s.join(o,e);if(f(n))return n}return null}r(m,"findWorkspaceCompose");function u(o){let e=s.join(o,p),n=s.join(o,i);f(e)&&!t.existsSync(n)&&t.renameSync(e,n)}r(u,"migrateWorkspaceCompose");export{i as a,p as b,m as c,u as d};
4
+ //# sourceMappingURL=chunk-5JPOPZ32.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 F,b as H,f as Z}from"./chunk-XL3VZTXU.js";import{c as X,d as Y,e as K,g as Q,j as J}from"./chunk-5NYE7QLH.js";import{N as te,O as re,u as ee}from"./chunk-444N5SCC.js";import{a as O,b as se}from"./chunk-FNWXAU5D.js";import{ca as oe}from"./chunk-VV3GE2PH.js";import{r as V}from"./chunk-BV4NA344.js";import{D as G,S as q}from"./chunk-7XU4VES3.js";import{a as l,f as A}from"./chunk-T44QBJL7.js";A();import*as ae from"node:fs";import*as ie from"node:path";A();function ne(t){let n=t.url?`[${t.ref}](${t.url})`:t.ref,i=t.title?`: ${t.title}`:"",a=t.fetchedAt?`Copy taken ${t.fetchedAt.slice(0,10)}: \`.werkmeister/issue.md\`.`:"No stored copy; run `werkmeister workspace init --refresh-issue`.";return["## Issue","",`${n}${i}. ${a}`,"Before each stage, re-read the live issue for newer direction: `werkmeister issue view`","Its status moves by itself (In Progress \u2192 In Review \u2192 Done): `docs/workspace-lifecycle.md` \xA7 Issue status in the werkmeister repo.",""].join(`
3
+ import{a as F,b as H,f as Z}from"./chunk-PYZLNWVW.js";import{c as X,d as Y,e as K,g as Q,j as J}from"./chunk-LZ4O2X3P.js";import{N as te,O as re,u as ee}from"./chunk-BJUG37UY.js";import{a as O,b as se}from"./chunk-56VNGSHC.js";import{ca as oe}from"./chunk-KW4XOYMP.js";import{r as V}from"./chunk-3CYN2F6X.js";import{D as G,S as q}from"./chunk-ZNIWZFIE.js";import{a as l,f as A}from"./chunk-3OIQ4WLP.js";A();import*as ae from"node:fs";import*as ie from"node:path";A();function ne(t){let n=t.url?`[${t.ref}](${t.url})`:t.ref,i=t.title?`: ${t.title}`:"",a=t.fetchedAt?`Copy taken ${t.fetchedAt.slice(0,10)}: \`.werkmeister/issue.md\`.`:"No stored copy; run `werkmeister workspace init --refresh-issue`.";return["## Issue","",`${n}${i}. ${a}`,"Before each stage, re-read the live issue for newer direction: `werkmeister issue view`","Its status moves by itself (In Progress \u2192 In Review \u2192 Done): `docs/workspace-lifecycle.md` \xA7 Issue status in the werkmeister repo.",""].join(`
4
4
  `)}l(ne,"renderIssueRef");function Te(t){try{let n=V(),i=O(void 0,n),a=t.find(r=>i[r]?.hostname),s=a?i[a].hostname:Object.values(i).map(r=>r.hostname).filter(Boolean).sort()[0];return s?{host:s,domain:n.local_domain.replace(/^\.+/,"")}:null}catch{return null}}l(Te,"resolveProxyHost");function B(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}l(B,"isDict");function xe(t,n,i){let a=[];for(let[s]of t){let r=!1;try{r=ae.statSync(ie.join(n,s,"CLAUDE.md")).isFile()}catch{}r&&a.push(`| Working in ${s} | ${s}/CLAUDE.md |`)}return i&&a.push("| Running or validating the change \u2014 test commands, how to validate, ports, lifecycle | .werkmeister/werkmeister-context.md |"),t.length>1&&a.push("| Cross-repo contract change | .werkmeister/notes/ (`contract` notes) |"),a.push("| Open or create a PR (including `/create-pr`), merge, close out | .werkmeister/pr-rules.md |"),a.length===0?"":`| Task | Read |
5
5
  |------|------|
6
6
  `+a.join(`
@@ -177,4 +177,4 @@ ${fe}
177
177
  ${we}${ke}${$e}${ge}${U}${ve}${be}${y||k?`## Troubleshooting
178
178
 
179
179
  ${y?"### Feature missing from `/__werkmeister` selector\n\nThe dropdown is populated from `~/.werkmeister/infra/proxy/features.json` (a static file served by Caddy), which is regenerated alongside the Caddyfile. It can drift from the live container labels (`com.werkmeister.feature` \u2014 the source of truth) if a slot is allocated without a proxy regen.\n\nDiagnose \u2014 compare what's labeled vs. what the UI shows:\n```bash\ndocker ps -a --filter label=com.werkmeister.feature --format '{{ .Label \"com.werkmeister.feature\" }}' | sort -u\njq '[.[].name]' \"$HOME/.werkmeister/infra/proxy/features.json\"\n```\n\nResync:\n```bash\nwerkmeister infra proxy-reload # regenerates Caddyfile + features.json, reloads Caddy\n```\n\n### Caddy returns `content-length: 0` but direct service hit works\n\nCaddy routing issue, not an app issue. Try `werkmeister infra proxy-reload` first; if Caddy is still misrouting, check `docker logs w9r-caddy --tail 50`.\n\n":""}${k?"### Containers expected per the table above are missing from `docker ps`\n\n`werkmeister feature up` may have partially failed. Re-run from the workspace root:\n```bash\nwerkmeister feature up # idempotent \u2014 starts missing containers\ndocker compose logs -f # watch startup if something crashes\n```\n":""}`:""}`}l(Ge,"buildSandboxContextMd");export{ne as a,We as b,ze as c,Ge as d};
180
- //# sourceMappingURL=chunk-4TQZZ5YN.js.map
180
+ //# sourceMappingURL=chunk-6KRQ3H6N.js.map
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{b as f}from"./chunk-ASBFFRUJ.js";import{q as c}from"./chunk-M6S5WJFM.js";import{b as u}from"./chunk-74M5N75B.js";import{h as o,j as a,m as n}from"./chunk-7XU4VES3.js";import{a as s,f as i}from"./chunk-T44QBJL7.js";i();function m(r,e){let t=r.feature||f(process.cwd()).FEATURE;return t||(n("Feature name required: pass it as an argument or set FEATURE in a .env file."),process.exit(1)),t==="infra"&&(n(`${e} the infra stack is not supported: every workspace shares it.`),process.exit(1)),t}s(m,"featureArg");function p(r,e){throw r instanceof u&&e[r.code]&&(n(r.message),a(e[r.code]),process.exit(1)),r}s(p,"reportHint");async function l(r){let e=m(r,"Pausing");console.log(`
3
+ import{b as f}from"./chunk-UA62KMFB.js";import{q as c}from"./chunk-2OVQ4XCH.js";import{b as u}from"./chunk-7GY3YBLK.js";import{h as o,j as a,m as n}from"./chunk-ZNIWZFIE.js";import{a as s,f as i}from"./chunk-3OIQ4WLP.js";i();function m(r,e){let t=r.feature||f(process.cwd()).FEATURE;return t||(n("Feature name required: pass it as an argument or set FEATURE in a .env file."),process.exit(1)),t==="infra"&&(n(`${e} the infra stack is not supported: every workspace shares it.`),process.exit(1)),t}s(m,"featureArg");function p(r,e){throw r instanceof u&&e[r.code]&&(n(r.message),a(e[r.code]),process.exit(1)),r}s(p,"reportHint");async function l(r){let e=m(r,"Pausing");console.log(`
4
4
  ${o.BOLD}=== werkmeister pause: ${e} ===${o.RESET}
5
5
  `);try{let{containers:t}=await c(e);console.log(`
6
6
  ${o.GREEN}${o.BOLD}Paused '${e}': ${t.length} container(s) frozen, its Claude session is held.${o.RESET} Resume with: werkmeister feature resume ${e}
7
7
  `)}catch(t){p(t,{NOT_RUNNING:`Nothing to pause. Start it with: werkmeister feature up ${e}`,ALREADY_PAUSED:`Resume it with: werkmeister feature resume ${e}`,NO_WORKSPACE:"Run it from the workspace folder, or check: werkmeister workspace list",COMPOSE_PAUSE_FAILED:`Undo what did freeze with: werkmeister feature resume ${e}`})}}s(l,"run");export{m as a,p as b,l as c};
8
- //# sourceMappingURL=chunk-GNOGFS45.js.map
8
+ //# sourceMappingURL=chunk-6VTA7NS7.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-T44QBJL7.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-74M5N75B.js.map
3
+ import{a as e,f as r}from"./chunk-3OIQ4WLP.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-7GY3YBLK.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as $,b as g}from"./chunk-QSD3XLGY.js";import{a,f as v}from"./chunk-T44QBJL7.js";v();import*as l from"node:fs";import*as i from"node:path";var A="Precedence: these standards' rules win over conflicting task framing \u2014 if a rule and the task clash, follow the rule and say so (invariant: apply it and write a `decision` note; rule: surface the conflict in one line, then apply). This gate fires once; your retry will proceed.",j="Standards gate: invoke `w9r-implement` before coding \u2014 it loads the universal base (ponytail + comments + engineering) and the workspace notes. Then retry this edit.";function D(t){let e="",n=0,r=t.length;for(;n<r;){let o=t[n];if(n+=1,o==="*")e+=".*";else if(o==="?")e+=".";else if(o==="["){let s=n;for(s<r&&t[s]==="!"&&(s+=1),s<r&&t[s]==="]"&&(s+=1);s<r&&t[s]!=="]";)s+=1;if(s>=r)e+="\\[";else{let c=t.slice(n,s).replace(/\\/g,"\\\\");n=s+1,c.startsWith("!")?c="^"+c.slice(1):c.startsWith("^")&&(c="\\"+c),e+=`[${c}]`}}else e+=o.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return`^(?:${e})$`}a(D,"_translate");function F(t,e){return new RegExp(D(e),"s").test(t)}a(F,"fnmatch");function O(t,e){let n=T(t);for(let r of e){let o=T(r),s=i.relative(o,n);if(!(s===""||s===".."||s.startsWith(".."+i.sep)||i.isAbsolute(s)))return i.join(o,s.split(i.sep)[0])}return null}a(O,"workspaceUnder");function T(t){try{return l.realpathSync(t)}catch{return i.resolve(t)}}a(T,"_realpath");function R(t,e){if(e){let r=O(t,e);return r!==null&&E(g(r))?r:null}let n=i.resolve(t);for(;;){if(E(g(n)))return n;let r=i.dirname(n);if(r===n)return null;n=r}}a(R,"findWorkspaceRoot");function E(t){try{return l.statSync(t).isDirectory()}catch{return!1}}a(E,"_isDir");function P(t){try{return l.statSync(t).isFile()}catch{return!1}}a(P,"_isFile");function p(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}a(p,"_isDict");function W(t){let e=i.join(g(t),"standards.json");if(!P(e))return null;let n;try{n=JSON.parse(l.readFileSync(e,"utf8"))}catch{return null}return p(n)?n:null}a(W,"loadManifest");function k(t,e){return i.join(g(t),".gate",`${e}.json`)}a(k,"_statePath");function C(t,e){let n=k(t,e);if(!P(n))return{};let r;try{r=JSON.parse(l.readFileSync(n,"utf8"))}catch{return null}return p(r)?r:null}a(C,"_loadState");function J(t,e,n){try{let r=k(t,e);return l.mkdirSync(i.dirname(r),{recursive:!0}),l.writeFileSync(r,JSON.stringify(n)),!0}catch{return!1}}a(J,"_saveState");function q(t,e){if(!(!e||e.includes("/")||e.includes("..")))try{l.unlinkSync(k(t,e))}catch{}}a(q,"resetSessionState");function N(t){return[...t].sort()}a(N,"_sorted");function G(t){let e=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t);if(!e)return;let n=/^status:\s*["']?([^\s"'#]+)/m.exec(e[1]);return n?n[1].toLowerCase():null}a(G,"_noteStatus");function H(t,e){let n=String(e.note??"");if(!/^[a-z]+$/.test(n))return!0;let r=e.status?String(e.status).toLowerCase():null,o=i.join(g(t),"notes"),s;try{s=l.readdirSync(o)}catch(u){return u.code!=="ENOENT"}let c=new RegExp(`^\\d{3}-${n}-.+\\.md$`);for(let u of s){if(!c.test(u))continue;let f;try{f=l.readFileSync(i.join(o,u),"utf8")}catch{return!0}let d=G(f);if(d===void 0)return!0;if(!(d==="superseded"||d==="graduated")&&(r===null||d===r))return!0}return!1}a(H,"_phaseGateSatisfied");function U(t){let e=String(t.note);if(t.status){let n=String(t.status);return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` has \`status: ${n}\`, so source edits wait for an approved design. Invoke \`w9r-research\`, present the design to the user, and when they approve write \`NNN-${e}-<slug>.md\` with \`status: ${n}\` recording what was approved. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` names the root cause yet. Invoke \`w9r-research\`, reproduce the problem, and write \`NNN-${e}-<slug>.md\` stating the root cause. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}a(U,"_phaseGateText");function L(t,e,n){if(!e||e.includes("/")||e.includes(".."))return null;let r=R(t);if(r===null)return null;let o=W(r);if(o===null)return null;let s=C(r,e);if(s===null)return null;let c=n?i.relative(r,n):"",u=o.phase_gate;if(p(u)&&c&&c!==".."&&!c.startsWith(".."+i.sep)&&!i.isAbsolute(c)&&!c.startsWith($+i.sep)&&!H(r,u))return U(u);let f=new Set(Array.isArray(s.delivered)?s.delivered:[]),d=!s.phase_entry_delivered,h=null,S=p(o.domains)?o.domains:{};for(let m of N(Object.keys(S))){let y=S[m];if(f.has(m)||!p(y))continue;if((Array.isArray(y.applies_to)?y.applies_to:[]).some(b=>F(c,String(b)))){h=m;break}}if(!d&&h===null)return null;let w=[];if(d&&w.push(j),h!==null){let m=S[h],y=String(p(m)&&m.summary||"").trim(),_=`Standards gate: you are editing a path governed by the \`${h}\` standard, which has not been loaded this session. Invoke the \`w9r-${h}-standard\` skill, then retry this edit.`;y&&(_+=` Summary: ${y}.`),w.push(_)}w.push(A);let x={phase_entry_delivered:!0,delivered:N(h?new Set([...f,h]):f)};return J(r,e,x)?w.join(`
3
+ import{a as $,b as g}from"./chunk-OSMT22M5.js";import{a,f as v}from"./chunk-3OIQ4WLP.js";v();import*as l from"node:fs";import*as i from"node:path";var A="Precedence: these standards' rules win over conflicting task framing \u2014 if a rule and the task clash, follow the rule and say so (invariant: apply it and write a `decision` note; rule: surface the conflict in one line, then apply). This gate fires once; your retry will proceed.",j="Standards gate: invoke `w9r-implement` before coding \u2014 it loads the universal base (ponytail + comments + engineering) and the workspace notes. Then retry this edit.";function D(t){let e="",n=0,r=t.length;for(;n<r;){let o=t[n];if(n+=1,o==="*")e+=".*";else if(o==="?")e+=".";else if(o==="["){let s=n;for(s<r&&t[s]==="!"&&(s+=1),s<r&&t[s]==="]"&&(s+=1);s<r&&t[s]!=="]";)s+=1;if(s>=r)e+="\\[";else{let c=t.slice(n,s).replace(/\\/g,"\\\\");n=s+1,c.startsWith("!")?c="^"+c.slice(1):c.startsWith("^")&&(c="\\"+c),e+=`[${c}]`}}else e+=o.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return`^(?:${e})$`}a(D,"_translate");function F(t,e){return new RegExp(D(e),"s").test(t)}a(F,"fnmatch");function O(t,e){let n=T(t);for(let r of e){let o=T(r),s=i.relative(o,n);if(!(s===""||s===".."||s.startsWith(".."+i.sep)||i.isAbsolute(s)))return i.join(o,s.split(i.sep)[0])}return null}a(O,"workspaceUnder");function T(t){try{return l.realpathSync(t)}catch{return i.resolve(t)}}a(T,"_realpath");function R(t,e){if(e){let r=O(t,e);return r!==null&&E(g(r))?r:null}let n=i.resolve(t);for(;;){if(E(g(n)))return n;let r=i.dirname(n);if(r===n)return null;n=r}}a(R,"findWorkspaceRoot");function E(t){try{return l.statSync(t).isDirectory()}catch{return!1}}a(E,"_isDir");function P(t){try{return l.statSync(t).isFile()}catch{return!1}}a(P,"_isFile");function p(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}a(p,"_isDict");function W(t){let e=i.join(g(t),"standards.json");if(!P(e))return null;let n;try{n=JSON.parse(l.readFileSync(e,"utf8"))}catch{return null}return p(n)?n:null}a(W,"loadManifest");function k(t,e){return i.join(g(t),".gate",`${e}.json`)}a(k,"_statePath");function C(t,e){let n=k(t,e);if(!P(n))return{};let r;try{r=JSON.parse(l.readFileSync(n,"utf8"))}catch{return null}return p(r)?r:null}a(C,"_loadState");function J(t,e,n){try{let r=k(t,e);return l.mkdirSync(i.dirname(r),{recursive:!0}),l.writeFileSync(r,JSON.stringify(n)),!0}catch{return!1}}a(J,"_saveState");function q(t,e){if(!(!e||e.includes("/")||e.includes("..")))try{l.unlinkSync(k(t,e))}catch{}}a(q,"resetSessionState");function N(t){return[...t].sort()}a(N,"_sorted");function G(t){let e=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t);if(!e)return;let n=/^status:\s*["']?([^\s"'#]+)/m.exec(e[1]);return n?n[1].toLowerCase():null}a(G,"_noteStatus");function H(t,e){let n=String(e.note??"");if(!/^[a-z]+$/.test(n))return!0;let r=e.status?String(e.status).toLowerCase():null,o=i.join(g(t),"notes"),s;try{s=l.readdirSync(o)}catch(u){return u.code!=="ENOENT"}let c=new RegExp(`^\\d{3}-${n}-.+\\.md$`);for(let u of s){if(!c.test(u))continue;let f;try{f=l.readFileSync(i.join(o,u),"utf8")}catch{return!0}let d=G(f);if(d===void 0)return!0;if(!(d==="superseded"||d==="graduated")&&(r===null||d===r))return!0}return!1}a(H,"_phaseGateSatisfied");function U(t){let e=String(t.note);if(t.status){let n=String(t.status);return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` has \`status: ${n}\`, so source edits wait for an approved design. Invoke \`w9r-research\`, present the design to the user, and when they approve write \`NNN-${e}-<slug>.md\` with \`status: ${n}\` recording what was approved. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` names the root cause yet. Invoke \`w9r-research\`, reproduce the problem, and write \`NNN-${e}-<slug>.md\` stating the root cause. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}a(U,"_phaseGateText");function L(t,e,n){if(!e||e.includes("/")||e.includes(".."))return null;let r=R(t);if(r===null)return null;let o=W(r);if(o===null)return null;let s=C(r,e);if(s===null)return null;let c=n?i.relative(r,n):"",u=o.phase_gate;if(p(u)&&c&&c!==".."&&!c.startsWith(".."+i.sep)&&!i.isAbsolute(c)&&!c.startsWith($+i.sep)&&!H(r,u))return U(u);let f=new Set(Array.isArray(s.delivered)?s.delivered:[]),d=!s.phase_entry_delivered,h=null,S=p(o.domains)?o.domains:{};for(let m of N(Object.keys(S))){let y=S[m];if(f.has(m)||!p(y))continue;if((Array.isArray(y.applies_to)?y.applies_to:[]).some(b=>F(c,String(b)))){h=m;break}}if(!d&&h===null)return null;let w=[];if(d&&w.push(j),h!==null){let m=S[h],y=String(p(m)&&m.summary||"").trim(),_=`Standards gate: you are editing a path governed by the \`${h}\` standard, which has not been loaded this session. Invoke the \`w9r-${h}-standard\` skill, then retry this edit.`;y&&(_+=` Summary: ${y}.`),w.push(_)}w.push(A);let x={phase_entry_delivered:!0,delivered:N(h?new Set([...f,h]):f)};return J(r,e,x)?w.join(`
4
4
  `):null}a(L,"decide");var M=/^\*\*\* (?:Add File|Update File|Delete File|Move to): (.+)$/gm;function X(t){return[...new Set([...t.matchAll(M)].map(e=>e[1].trim()))]}a(X,"patchPaths");function B(){let t;try{let f=process.stdin.isTTY?"":l.readFileSync(0,"utf8"),d=f.trim()?JSON.parse(f):{};t=p(d)?d:{}}catch{t={}}let e=String(t.session_id||""),n=t.tool_input,r=p(n)?n:{},o=String(t.cwd||process.cwd()),s=t.tool_name==="apply_patch"?r.command:void 0,c=typeof s=="string"?X(s).map(f=>i.resolve(o,f)):[String(r.file_path||"")],u=null;try{for(let f of c)if(u=L(o,e,f),u)break}catch{u=null}u&&console.log(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:u}}))}a(B,"main");export{O as a,R as b,W as c,q as d,B as e};
5
- //# sourceMappingURL=chunk-5JJ2BK6S.js.map
5
+ //# sourceMappingURL=chunk-7IZYEWMJ.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{f as C}from"./chunk-D6D3PMMQ.js";import{K as S,L as _,M,O as y,X as w,j as g,l as x}from"./chunk-7XU4VES3.js";import{a,f as b}from"./chunk-T44QBJL7.js";b();import*as d from"node:fs";import*as h from"node:path";function L(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=a(()=>{clearTimeout(o),t?.removeEventListener("abort",r),n()},"done"),o=setTimeout(r,e*1e3);t?.addEventListener("abort",r,{once:!0})})}a(L,"sleep");var v=class{static{a(this,"ContainerStats")}name;samples=0;cpuSamples=[];memSamples=[];constructor(t){this.name=t}get avgCpu(){return this.cpuSamples.length?this.cpuSamples.reduce((t,n)=>t+n,0)/this.cpuSamples.length:0}get maxCpu(){return this.cpuSamples.length?Math.max(...this.cpuSamples):0}get avgMem(){return this.memSamples.length?this.memSamples.reduce((t,n)=>t+n,0)/this.memSamples.length:0}get maxMem(){return this.memSamples.length?Math.max(...this.memSamples):0}};async function $(e=60,t=10,n="",r){let o={},m=Math.max(1,Math.floor(e/t));for(let s=0;s<m&&!r?.aborted;s++){let p=await C(r);if(r?.aborted)break;for(let c of p){let i=c.name;if(n&&!i.startsWith(n))continue;i in o||(o[i]=new v(i));let u=o[i];u.samples+=1,u.cpuSamples.push(c.cpuPercent),u.memSamples.push(c.memMib)}s<m-1&&await L(t,r)}return o}a($,"collectStats");function j(e){return e>=1024?`${(e/1024).toFixed(1)}G`:e>=1?`${e.toFixed(0)}M`:`${(e*1024).toFixed(0)}K`}a(j,"formatMem");function k(e){let t=[];for(let n of Object.keys(e).sort()){let r=e[n];if(r.samples===0)continue;let o=r.maxCpu/100*1.5,m=O(o),s=r.maxMem*1.5,p=F(s),c=F(s/3);t.push({name:n,max_cpu_pct:r.maxCpu,max_mem_mib:r.maxMem,recommended_cpus:m,recommended_memory:p,recommended_reservation:c})}return t}a(k,"recommendLimits");function O(e){return e<=.1?"0.1":e<=.25?"0.25":e<=.5?"0.5":e<=1?"1.0":e<=1.5?"1.5":e<=2?"2.0":(Math.ceil(e*2)/2).toFixed(1)}a(O,"roundCpu");function F(e){let t=[64,128,256,512,1024,1536,2048,2560,3072,4096,6144,8192];for(let n of t)if(e<=n)return n<1024?`${n}M`:`${Math.floor(n/1024)}G`;return`${Math.ceil(e/1024)}G`}a(F,"roundMemory");function H(e){return O(Number(e)/2)}a(H,"halveCpu");function l(e){return String(e).padStart(2,"0")}a(l,"pad2");function P(e,t){let n=h.join(w(),"stats");d.existsSync(n)||d.mkdirSync(n);let r=new Date,o=`${r.getFullYear()}${l(r.getMonth()+1)}${l(r.getDate())}-${l(r.getHours())}${l(r.getMinutes())}${l(r.getSeconds())}`,m=h.join(n,`docker-stats-${o}.csv`),s=[["container","avg_cpu_pct","max_cpu_pct","avg_mem_mib","max_mem_mib","samples"].join(",")];for(let u of Object.keys(e).sort()){let f=e[u];s.push([u,f.avgCpu.toFixed(1),f.maxCpu.toFixed(1),f.avgMem.toFixed(1),f.maxMem.toFixed(1),String(f.samples)].join(","))}d.writeFileSync(m,s.join(`\r
3
+ import{f as C}from"./chunk-NM5VSS3I.js";import{K as S,L as _,M,O as y,X as w,j as g,l as x}from"./chunk-ZNIWZFIE.js";import{a,f as b}from"./chunk-3OIQ4WLP.js";b();import*as d from"node:fs";import*as h from"node:path";function L(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=a(()=>{clearTimeout(o),t?.removeEventListener("abort",r),n()},"done"),o=setTimeout(r,e*1e3);t?.addEventListener("abort",r,{once:!0})})}a(L,"sleep");var v=class{static{a(this,"ContainerStats")}name;samples=0;cpuSamples=[];memSamples=[];constructor(t){this.name=t}get avgCpu(){return this.cpuSamples.length?this.cpuSamples.reduce((t,n)=>t+n,0)/this.cpuSamples.length:0}get maxCpu(){return this.cpuSamples.length?Math.max(...this.cpuSamples):0}get avgMem(){return this.memSamples.length?this.memSamples.reduce((t,n)=>t+n,0)/this.memSamples.length:0}get maxMem(){return this.memSamples.length?Math.max(...this.memSamples):0}};async function $(e=60,t=10,n="",r){let o={},m=Math.max(1,Math.floor(e/t));for(let s=0;s<m&&!r?.aborted;s++){let p=await C(r);if(r?.aborted)break;for(let c of p){let i=c.name;if(n&&!i.startsWith(n))continue;i in o||(o[i]=new v(i));let u=o[i];u.samples+=1,u.cpuSamples.push(c.cpuPercent),u.memSamples.push(c.memMib)}s<m-1&&await L(t,r)}return o}a($,"collectStats");function j(e){return e>=1024?`${(e/1024).toFixed(1)}G`:e>=1?`${e.toFixed(0)}M`:`${(e*1024).toFixed(0)}K`}a(j,"formatMem");function k(e){let t=[];for(let n of Object.keys(e).sort()){let r=e[n];if(r.samples===0)continue;let o=r.maxCpu/100*1.5,m=O(o),s=r.maxMem*1.5,p=F(s),c=F(s/3);t.push({name:n,max_cpu_pct:r.maxCpu,max_mem_mib:r.maxMem,recommended_cpus:m,recommended_memory:p,recommended_reservation:c})}return t}a(k,"recommendLimits");function O(e){return e<=.1?"0.1":e<=.25?"0.25":e<=.5?"0.5":e<=1?"1.0":e<=1.5?"1.5":e<=2?"2.0":(Math.ceil(e*2)/2).toFixed(1)}a(O,"roundCpu");function F(e){let t=[64,128,256,512,1024,1536,2048,2560,3072,4096,6144,8192];for(let n of t)if(e<=n)return n<1024?`${n}M`:`${Math.floor(n/1024)}G`;return`${Math.ceil(e/1024)}G`}a(F,"roundMemory");function H(e){return O(Number(e)/2)}a(H,"halveCpu");function l(e){return String(e).padStart(2,"0")}a(l,"pad2");function P(e,t){let n=h.join(w(),"stats");d.existsSync(n)||d.mkdirSync(n);let r=new Date,o=`${r.getFullYear()}${l(r.getMonth()+1)}${l(r.getDate())}-${l(r.getHours())}${l(r.getMinutes())}${l(r.getSeconds())}`,m=h.join(n,`docker-stats-${o}.csv`),s=[["container","avg_cpu_pct","max_cpu_pct","avg_mem_mib","max_mem_mib","samples"].join(",")];for(let u of Object.keys(e).sort()){let f=e[u];s.push([u,f.avgCpu.toFixed(1),f.maxCpu.toFixed(1),f.avgMem.toFixed(1),f.maxMem.toFixed(1),String(f.samples)].join(","))}d.writeFileSync(m,s.join(`\r
4
4
  `)+`\r
5
5
  `);let p=h.join(n,`resource-summary-${o}.txt`),c=`${r.getFullYear()}-${l(r.getMonth()+1)}-${l(r.getDate())} ${l(r.getHours())}:${l(r.getMinutes())}:${l(r.getSeconds())}`,i="";i+=`Docker Resource Usage Summary
6
6
  `,i+=`Generated: ${c}
@@ -15,4 +15,4 @@ Recommended Resource Limits:
15
15
 
16
16
  `;for(let u of t)i+=` ${u.name.padEnd(35)} cpus: ${u.recommended_cpus.padStart(5)} memory: ${u.recommended_memory.padStart(5)}
17
17
  `;return d.writeFileSync(p,i),p}a(P,"saveReport");async function K(e,t,n,r){let o=Date.now(),m=await $(e*60,t,"",r),s=(Date.now()-o)/6e4;if(!Object.keys(m).length)return x("No container data collected."),{stats:m,recommendations:[],samples:0,durationMinutes:s,saved:!1,reportPath:null};let p=k(m),c=n?P(m,p):null;return{stats:m,recommendations:p,samples:Math.max(0,...Object.values(m).map(i=>i.samples)),durationMinutes:s,saved:c!==null,reportPath:c}}a(K,"runCollection");function R(e){if(!e)return 0;e=e.trim();let t;return e.endsWith("G")?t=Number(e.slice(0,-1))*1024:e.endsWith("M")?t=Number(e.slice(0,-1)):e.endsWith("K")?t=Number(e.slice(0,-1))/1024:t=Number(e),Number.isFinite(t)?t:0}a(R,"parseConfigMem");function D(e,t){if(e in t)return e;let n=e,r=["w9r-","sandbox-","feat-"];for(let s of r)n.startsWith(s)&&(n=n.slice(s.length));let o=n.lastIndexOf("-"),m=o===-1?[n]:[n.slice(0,o),n.slice(o+1)];if(/^\d+$/.test(m[m.length-1])&&(n=m[0]),n in t)return n;for(let s of Object.keys(t))if(n.endsWith(s)||e.endsWith(s))return s;return null}a(D,"matchService");function E(){let e={};for(let[t,n]of Object.entries(y()))e[t]=String(n?.cpus??_);for(let[t,n]of Object.entries(M()))e[t]=String(n?.cpus??S);return e}a(E,"configuredCpus");function N(e,t){let n=D(e,t);return n?t[n]:null}a(N,"cpuLimitOf");function U(e,t){return e<=0?"no_limit":t>85?"risk":t>60?"moderate":t<20&&e>256?"over_provisioned":"ok"}a(U,"classifyUsage");async function Y(e=0,t=10){let n=E(),r={};for(let[s,p]of Object.entries(M())){let c=p?.memory_limit;c&&(r[s]={limit:c,limitMib:R(c)})}let o;return e>0?(g(`Collecting stats for ${e} minute(s)...`),o=await $(e*60,t)):(g("Taking a snapshot of current resource usage..."),o=await $(15,5)),Object.keys(o).length?{usage:Object.keys(o).sort().map(s=>{let p=D(s,r),c=p?r[p]:void 0,i=c?.limitMib??0,u=o[s].maxMem,f=i>0?u/i*100:0;return{container:s,service:p,maxMemMib:u,limit:c?.limit??null,limitMib:i,cpuLimit:N(s,n),usagePct:f,status:U(i,f)}}),recommendations:k(o)}:(x("No running containers found. Start your workspace first."),{usage:[],recommendations:[]})}a(Y,"optimizeReport");export{j as a,H as b,K as c,E as d,N as e,Y as f};
18
- //# sourceMappingURL=chunk-AAWZOPFV.js.map
18
+ //# sourceMappingURL=chunk-AEJ67TDF.js.map