werkmeister 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONVENTIONS.md +3 -3
- package/README.md +2 -2
- package/dist/main.js +9 -9
- package/dist/mcp.js +7 -7
- package/dist/sandbox-workspaces.vsix +0 -0
- package/infra/schemas/services-fragment.schema.json +1 -1
- package/package.json +2 -2
- package/werkmeister +2 -2
package/CONVENTIONS.md
CHANGED
|
@@ -16,7 +16,7 @@ by other tooling, so they are not free to drift.
|
|
|
16
16
|
Runtime data dirs live alongside the source: `infra/`, `bin/`.
|
|
17
17
|
Path resolution: package root = `WERKMEISTER_ROOT` / `SANDBOX_ROOT` env, else the first
|
|
18
18
|
ancestor holding `apps/cli` (`sandboxRoot()` / `infraRoot()` in
|
|
19
|
-
`packages/
|
|
19
|
+
`packages/werkmeister-core/src/config.ts`, re-exported by `src/lib/config.ts` as
|
|
20
20
|
`getSandboxRoot()` / `getInfraRoot()`).
|
|
21
21
|
|
|
22
22
|
## Language
|
|
@@ -34,13 +34,13 @@ ancestor holding `apps/cli` (`sandboxRoot()` / `infraRoot()` in
|
|
|
34
34
|
verbatim with other consumers, so the environment options in `generate.ts`
|
|
35
35
|
(autoescape, trim/lstrip) are load-bearing — see the notes there before
|
|
36
36
|
touching them.
|
|
37
|
-
- Subprocesses go through `packages/
|
|
37
|
+
- Subprocesses go through `packages/werkmeister-core/src/proc.ts` (spawnSync-based, synchronous):
|
|
38
38
|
- `run(cmd: string[], opts)` → `{ status, stdout, stderr }`; `check: true` throws `ProcError`.
|
|
39
39
|
- `capture(cmd)` → trimmed stdout, throws on failure.
|
|
40
40
|
- Streaming/inherit-stdio cases: pass `stdio: "inherit"`.
|
|
41
41
|
- `timeout` is in **seconds**, not milliseconds.
|
|
42
42
|
- Filesystem work uses the sync `node:fs` API (`readFileSync` etc.) plus `node:path`.
|
|
43
|
-
- ANSI colors come from `packages/
|
|
43
|
+
- ANSI colors come from `packages/werkmeister-core/src/colors.ts` — the single definition site.
|
|
44
44
|
- `console.error` for stderr, `console.log` for stdout.
|
|
45
45
|
- `process.exit(n)` for exit codes. Thrown errors reach `main`, which prints
|
|
46
46
|
`Error: <msg>` in red and exits 1; `SANDBOX_DEBUG` re-raises with a stack.
|
package/README.md
CHANGED
|
@@ -51,8 +51,8 @@ feature name (`infra` plus the workspaces under the workspaces root).
|
|
|
51
51
|
nunjucks with a small compat layer (`{% do %}`, dict truthiness,
|
|
52
52
|
`map(attribute=…)`) so they stay shared verbatim with other consumers
|
|
53
53
|
- `sandbox mcp` runs the one MCP server over stdio. Its source is
|
|
54
|
-
`apps/mcp`, bundled into `dist/mcp.js` by `esbuild.mjs` so it ships in the npm
|
|
54
|
+
`apps/werkmeister-mcp`, bundled into `dist/mcp.js` by `esbuild.mjs` so it ships in the npm
|
|
55
55
|
package. `sandbox dashboard` runs the localhost workspaces dashboard from
|
|
56
|
-
`apps/
|
|
56
|
+
`apps/werkmeister-dashboard`, which is checkout-only
|
|
57
57
|
- interactive prompts and process-spawn edges are async (`run()` is
|
|
58
58
|
`async` throughout); core logic stays synchronous
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
3
3
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
4
|
-
var dW=Object.create;var Op=Object.defineProperty;var pW=Object.getOwnPropertyDescriptor;var hW=Object.getOwnPropertyNames;var mW=Object.getPrototypeOf,gW=Object.prototype.hasOwnProperty;var i=(e,t)=>Op(e,"name",{value:t,configurable:!0}),Z=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var C=(e,t)=>()=>(e&&(t=e(e=0)),t);var $=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ce=(e,t)=>{for(var n in t)Op(e,n,{get:t[n],enumerable:!0})},xW=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of hW(t))!gW.call(e,s)&&s!==n&&Op(e,s,{get:()=>t[s],enumerable:!(r=pW(t,s))||r.enumerable});return e};var Ne=(e,t,n)=>(n=e!=null?dW(mW(e)):{},xW(t||!e||!e.__esModule?Op(n,"default",{value:e,enumerable:!0}):n,e));var _,p=C(()=>{_={sha:"
|
|
4
|
+
var dW=Object.create;var Op=Object.defineProperty;var pW=Object.getOwnPropertyDescriptor;var hW=Object.getOwnPropertyNames;var mW=Object.getPrototypeOf,gW=Object.prototype.hasOwnProperty;var i=(e,t)=>Op(e,"name",{value:t,configurable:!0}),Z=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var C=(e,t)=>()=>(e&&(t=e(e=0)),t);var $=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ce=(e,t)=>{for(var n in t)Op(e,n,{get:t[n],enumerable:!0})},xW=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of hW(t))!gW.call(e,s)&&s!==n&&Op(e,s,{get:()=>t[s],enumerable:!(r=pW(t,s))||r.enumerable});return e};var Ne=(e,t,n)=>(n=e!=null?dW(mW(e)):{},xW(t||!e||!e.__esModule?Op(n,"default",{value:e,enumerable:!0}):n,e));var _,p=C(()=>{_={sha:"f43df27040ec99765940a617d7a73836c5bb9657",dirty:!1}});var ou=$(Ty=>{p();var Tp=class extends Error{static{i(this,"CommanderError")}constructor(t,n,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=t,this.nestedError=void 0}},Oy=class extends Tp{static{i(this,"InvalidArgumentError")}constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ty.CommanderError=Tp;Ty.InvalidArgumentError=Oy});var Ap=$(Ry=>{p();var{InvalidArgumentError:bW}=ou(),Ay=class{static{i(this,"Argument")}constructor(t,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,n){return n===this.defaultValue||!Array.isArray(n)?[t]:n.concat(t)}default(t,n){return this.defaultValue=t,this.defaultValueDescription=n,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(n,r)=>{if(!this.argChoices.includes(n))throw new bW(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(n,r):n},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function wW(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}i(wW,"humanReadableArgName");Ry.Argument=Ay;Ry.humanReadableArgName=wW});var Py=$(Ny=>{p();var{humanReadableArgName:vW}=Ap(),Cy=class{static{i(this,"Help")}constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let n=t.commands.filter(s=>!s._hidden),r=t._getHelpCommand();return r&&!r._hidden&&n.push(r),this.sortSubcommands&&n.sort((s,o)=>s.name().localeCompare(o.name())),n}compareOptions(t,n){let r=i(s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,""),"getSortKey");return r(t).localeCompare(r(n))}visibleOptions(t){let n=t.options.filter(s=>!s.hidden),r=t._getHelpOption();if(r&&!r.hidden){let s=r.short&&t._findOption(r.short),o=r.long&&t._findOption(r.long);!s&&!o?n.push(r):r.long&&!o?n.push(t.createOption(r.long,r.description)):r.short&&!s&&n.push(t.createOption(r.short,r.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let n=[];for(let r=t.parent;r;r=r.parent){let s=r.options.filter(o=>!o.hidden);n.push(...s)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(n=>{n.description=n.description||t._argsDescription[n.name()]||""}),t.registeredArguments.find(n=>n.description)?t.registeredArguments:[]}subcommandTerm(t){let n=t.registeredArguments.map(r=>vW(r)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,n){return n.visibleCommands(t).reduce((r,s)=>Math.max(r,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(s)))),0)}longestOptionTermLength(t,n){return n.visibleOptions(t).reduce((r,s)=>Math.max(r,this.displayWidth(n.styleOptionTerm(n.optionTerm(s)))),0)}longestGlobalOptionTermLength(t,n){return n.visibleGlobalOptions(t).reduce((r,s)=>Math.max(r,this.displayWidth(n.styleOptionTerm(n.optionTerm(s)))),0)}longestArgumentTermLength(t,n){return n.visibleArguments(t).reduce((r,s)=>Math.max(r,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(s)))),0)}commandUsage(t){let n=t._name;t._aliases[0]&&(n=n+"|"+t._aliases[0]);let r="";for(let s=t.parent;s;s=s.parent)r=s.name()+" "+r;return r+n+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let n=[];return t.argChoices&&n.push(`choices: ${t.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&n.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&n.push(`env: ${t.envVar}`),n.length>0?`${t.description} (${n.join(", ")})`:t.description}argumentDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),t.defaultValue!==void 0&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),n.length>0){let r=`(${n.join(", ")})`;return t.description?`${t.description} ${r}`:r}return t.description}formatHelp(t,n){let r=n.padWidth(t,n),s=n.helpWidth??80;function o(d,h){return n.formatItem(d,r,h,n)}i(o,"callFormatItem");let a=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(t))}`,""],c=n.commandDescription(t);c.length>0&&(a=a.concat([n.boxWrap(n.styleCommandDescription(c),s),""]));let l=n.visibleArguments(t).map(d=>o(n.styleArgumentTerm(n.argumentTerm(d)),n.styleArgumentDescription(n.argumentDescription(d))));l.length>0&&(a=a.concat([n.styleTitle("Arguments:"),...l,""]));let u=n.visibleOptions(t).map(d=>o(n.styleOptionTerm(n.optionTerm(d)),n.styleOptionDescription(n.optionDescription(d))));if(u.length>0&&(a=a.concat([n.styleTitle("Options:"),...u,""])),n.showGlobalOptions){let d=n.visibleGlobalOptions(t).map(h=>o(n.styleOptionTerm(n.optionTerm(h)),n.styleOptionDescription(n.optionDescription(h))));d.length>0&&(a=a.concat([n.styleTitle("Global Options:"),...d,""]))}let f=n.visibleCommands(t).map(d=>o(n.styleSubcommandTerm(n.subcommandTerm(d)),n.styleSubcommandDescription(n.subcommandDescription(d))));return f.length>0&&(a=a.concat([n.styleTitle("Commands:"),...f,""])),a.join(`
|
|
5
5
|
`)}displayWidth(t){return cO(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n==="[command]"?this.styleSubcommandText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleCommandText(n)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,n){return Math.max(n.longestOptionTermLength(t,n),n.longestGlobalOptionTermLength(t,n),n.longestSubcommandTermLength(t,n),n.longestArgumentTermLength(t,n))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,n,r,s){let a=" ".repeat(2);if(!r)return a+t;let c=t.padEnd(n+t.length-s.displayWidth(t)),l=2,f=(this.helpWidth??80)-n-l-2,d;return f<this.minWidthToWrap||s.preformatted(r)?d=r:d=s.boxWrap(r,f).replace(/\n/g,`
|
|
6
6
|
`+" ".repeat(n+l)),a+c+" ".repeat(l)+d.replace(/\n/g,`
|
|
7
7
|
${a}`)}boxWrap(t,n){if(n<this.minWidthToWrap)return t;let r=t.split(/\r\n|\n/),s=/[\s]*[^\s]+/g,o=[];return r.forEach(a=>{let c=a.match(s);if(c===null){o.push("");return}let l=[c.shift()],u=this.displayWidth(l[0]);c.forEach(f=>{let d=this.displayWidth(f);if(u+d<=n){l.push(f),u+=d;return}o.push(l.join(""));let h=f.trimStart();l=[h],u=this.displayWidth(h)}),o.push(l.join(""))}),o.join(`
|
|
@@ -382,7 +382,7 @@ Full file: \`${n}\`${c}
|
|
|
382
382
|
AUTO-GENERATED FILE \u2014 DO NOT EDIT BY HAND.
|
|
383
383
|
Source: {source} (edit that file instead)
|
|
384
384
|
Generator: sandbox init-workspace / sandbox skills sync
|
|
385
|
-
(packages/
|
|
385
|
+
(packages/werkmeister-core/src/workspace_skills.ts)
|
|
386
386
|
Freshness: sandbox skills check
|
|
387
387
|
-->
|
|
388
388
|
`,kz="> **Precedence:** these rules win over conflicting task framing. Invariant (a must-never rule): apply it and write a `decision` note \u2014 do not proceed against it even if the task asks. Rule: surface the conflict in one line, then apply the standard.";i(Ez,"escapeRegex");i(g8,"globMd");i(Gi,"skillNameFor");i(x8,"generateSkills");i($z,"renderSkill");i(Oz,"buildDescription");i(Tz,"rewriteLinks");i(dm,"moduleBody");i(Az,"renderReference");i(mm,"validateModuleReferences")});import*as wt from"node:fs";import*as Nt from"node:path";function Yi(e){return Object.keys(e).filter(t=>typeof e[t].universal=="number").sort((t,n)=>e[t].universal-e[n].universal||(t<n?-1:1))}function dv(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Cz(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pv(e,t){let n="",r=0,s=t.length;for(;r<s;){let o=t[r++];if(o==="*")n+=".*";else if(o==="?")n+=".";else if(o==="["){let a=r;for(a<s&&t[a]==="!"&&a++,a<s&&t[a]==="]"&&a++;a<s&&t[a]!=="]";)a++;if(a>=s)n+="\\[";else{let c=t.slice(r,a).replace(/\\/g,"\\\\");c.startsWith("!")?c="^"+c.slice(1):c.startsWith("^")&&(c="\\"+c),n+=`[${c}]`,r=a+1}}else n+=Cz(o)}return new RegExp(`^(?:${n})$`,"s").test(e)}function zi(e){try{return wt.readdirSync(e).filter(t=>!t.startsWith(".")).map(t=>Nt.join(e,t)).filter(t=>Nz(t)&&wt.existsSync(Nt.join(t,".git"))).sort()}catch{return[]}}function Nz(e){try{return wt.statSync(e).isDirectory()}catch{return!1}}function Pz(e){function t(...s){let o;try{o=W(["git","-C",e,...s],{capture:!0,timeout:Rz})}catch{return[]}return o.status!==0?[]:o.stdout.split(`
|
|
@@ -508,7 +508,7 @@ RETURN CONTRACT \u2014 report, per service tested:
|
|
|
508
508
|
- OPEN QUESTIONS / AMBIGUITIES for the human to resolve.
|
|
509
509
|
`}function I8(e,t){let n=af.join(e,".claude","agents");Hs.mkdirSync(n,{recursive:!0});let r=[af.join(n,`${Sv}.md`)];Hs.writeFileSync(r[0],jt(sJ(),e));for(let o of t??[]){let a=af.join(n,`${kv}${o.archetype}.md`);Hs.writeFileSync(a,jt(oJ(o),e)),r.push(a)}let s=new Set(r);for(let o of Hs.readdirSync(n))if(o.startsWith(kv)&&o.endsWith(".md")){let a=af.join(n,o);s.has(a)||Hs.unlinkSync(a)}return r}var N8,Sv,kv,L8=C(()=>{"use strict";p();Rr();Q();N8=`<!--
|
|
510
510
|
AUTO-GENERATED FILE \u2014 DO NOT EDIT BY HAND.
|
|
511
|
-
Generator: sandbox init-workspace (packages/
|
|
511
|
+
Generator: sandbox init-workspace (packages/werkmeister-core/src/agent_gen.ts)
|
|
512
512
|
Regenerated on every init-workspace run; edits will be clobbered.
|
|
513
513
|
-->
|
|
514
514
|
`,Sv="sb-researcher";i(sJ,"buildResearcherAgent");kv="sb-tester-";i(P8,"buildTesterSpecs");i(oJ,"buildTesterAgent");i(I8,"writeWorkspaceAgents")});function D8(e,t){return`${e}.${t.replace(/^\.+/,"")}`}function mn(e,t){let n=e??he(),r=t??as(),s={};for(let[o,a]of Object.entries(n)){let c=a&&typeof a=="object"?a.feature_router:null;if(!c)continue;let l=c.remote_upstream??void 0;s[o]={hostname:c.hostname??D8(o,r.local_domain),k8s:c.k8s??void 0,remoteHostname:c.remote_hostname??(l?D8(o,r.remote_domain):void 0),remoteUpstream:l}}return s}function cf(e,t){let n=new Set;for(let r of Object.values(mn(e,t)))r.hostname&&n.add(r.hostname),r.remoteHostname&&n.add(r.remoteHostname);return[...n].sort()}function wm(e){let t;try{t=cf()}catch{return null}return t.length?`https://${t[0]}${e.startsWith("/")?e:`/${e}`}`:null}var fs=C(()=>{"use strict";p();Q();bt();i(D8,"hostFor");i(mn,"loadFeatureRouters");i(cf,"ingressHostnames");i(wm,"featureUrl")});var W8=$((O2e,U8)=>{"use strict";p();var fr=Z("fs"),Qi=Z("path"),iJ=fr.lchown?"lchown":"chown",aJ=fr.lchownSync?"lchownSync":"chownSync",F8=fr.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),j8=i((e,t,n)=>{try{return fr[aJ](e,t,n)}catch(r){if(r.code!=="ENOENT")throw r}},"lchownSync"),cJ=i((e,t,n)=>{try{return fr.chownSync(e,t,n)}catch(r){if(r.code!=="ENOENT")throw r}},"chownSync"),lJ=F8?(e,t,n,r)=>s=>{!s||s.code!=="EISDIR"?r(s):fr.chown(e,t,n,r)}:(e,t,n,r)=>r,Ev=F8?(e,t,n)=>{try{return j8(e,t,n)}catch(r){if(r.code!=="EISDIR")throw r;cJ(e,t,n)}}:(e,t,n)=>j8(e,t,n),uJ=process.version,M8=i((e,t,n)=>fr.readdir(e,t,n),"readdir"),fJ=i((e,t)=>fr.readdirSync(e,t),"readdirSync");/^v4\./.test(uJ)&&(M8=i((e,t,n)=>fr.readdir(e,n),"readdir"));var vm=i((e,t,n,r)=>{fr[iJ](e,t,n,lJ(e,t,n,s=>{r(s&&s.code!=="ENOENT"?s:null)}))},"chown"),B8=i((e,t,n,r,s)=>{if(typeof t=="string")return fr.lstat(Qi.resolve(e,t),(o,a)=>{if(o)return s(o.code!=="ENOENT"?o:null);a.name=t,B8(e,a,n,r,s)});if(t.isDirectory())$v(Qi.resolve(e,t.name),n,r,o=>{if(o)return s(o);let a=Qi.resolve(e,t.name);vm(a,n,r,s)});else{let o=Qi.resolve(e,t.name);vm(o,n,r,s)}},"chownrKid"),$v=i((e,t,n,r)=>{M8(e,{withFileTypes:!0},(s,o)=>{if(s){if(s.code==="ENOENT")return r();if(s.code!=="ENOTDIR"&&s.code!=="ENOTSUP")return r(s)}if(s||!o.length)return vm(e,t,n,r);let a=o.length,c=null,l=i(u=>{if(!c){if(u)return r(c=u);if(--a===0)return vm(e,t,n,r)}},"then");o.forEach(u=>B8(e,u,t,n,l))})},"chownr"),dJ=i((e,t,n,r)=>{if(typeof t=="string")try{let s=fr.lstatSync(Qi.resolve(e,t));s.name=t,t=s}catch(s){if(s.code==="ENOENT")return;throw s}t.isDirectory()&&q8(Qi.resolve(e,t.name),n,r),Ev(Qi.resolve(e,t.name),n,r)},"chownrKidSync"),q8=i((e,t,n)=>{let r;try{r=fJ(e,{withFileTypes:!0})}catch(s){if(s.code==="ENOENT")return;if(s.code==="ENOTDIR"||s.code==="ENOTSUP")return Ev(e,t,n);throw s}return r&&r.length&&r.forEach(s=>dJ(e,s,t,n)),Ev(e,t,n)},"chownrSync");U8.exports=$v;$v.sync=q8});var Ov=$((R2e,V8)=>{p();V8.exports=Z("stream")});var J8=$((N2e,z8)=>{"use strict";p();function K8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}i(K8,"ownKeys");function H8(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?K8(Object(n),!0).forEach(function(r){pJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K8(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}i(H8,"_objectSpread");function pJ(e,t,n){return t=Y8(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}i(pJ,"_defineProperty");function hJ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}i(hJ,"_classCallCheck");function G8(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Y8(r.key),r)}}i(G8,"_defineProperties");function mJ(e,t,n){return t&&G8(e.prototype,t),n&&G8(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}i(mJ,"_createClass");function Y8(e){var t=gJ(e,"string");return typeof t=="symbol"?t:String(t)}i(Y8,"_toPropertyKey");function gJ(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}i(gJ,"_toPrimitive");var xJ=Z("buffer"),_m=xJ.Buffer,yJ=Z("util"),Tv=yJ.inspect,bJ=Tv&&Tv.custom||"inspect";function wJ(e,t,n){_m.prototype.copy.call(e,t,n)}i(wJ,"copyBuffer");z8.exports=function(){function e(){hJ(this,e),this.head=null,this.tail=null,this.length=0}return i(e,"BufferList"),mJ(e,[{key:"push",value:i(function(n){var r={data:n,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length},"push")},{key:"unshift",value:i(function(n){var r={data:n,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length},"unshift")},{key:"shift",value:i(function(){if(this.length!==0){var n=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,n}},"shift")},{key:"clear",value:i(function(){this.head=this.tail=null,this.length=0},"clear")},{key:"join",value:i(function(n){if(this.length===0)return"";for(var r=this.head,s=""+r.data;r=r.next;)s+=n+r.data;return s},"join")},{key:"concat",value:i(function(n){if(this.length===0)return _m.alloc(0);for(var r=_m.allocUnsafe(n>>>0),s=this.head,o=0;s;)wJ(s.data,r,o),o+=s.data.length,s=s.next;return r},"concat")},{key:"consume",value:i(function(n,r){var s;return n<this.head.data.length?(s=this.head.data.slice(0,n),this.head.data=this.head.data.slice(n)):n===this.head.data.length?s=this.shift():s=r?this._getString(n):this._getBuffer(n),s},"consume")},{key:"first",value:i(function(){return this.head.data},"first")},{key:"_getString",value:i(function(n){var r=this.head,s=1,o=r.data;for(n-=o.length;r=r.next;){var a=r.data,c=n>a.length?a.length:n;if(c===a.length?o+=a:o+=a.slice(0,n),n-=c,n===0){c===a.length?(++s,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=a.slice(c));break}++s}return this.length-=s,o},"_getString")},{key:"_getBuffer",value:i(function(n){var r=_m.allocUnsafe(n),s=this.head,o=1;for(s.data.copy(r),n-=s.data.length;s=s.next;){var a=s.data,c=n>a.length?a.length:n;if(a.copy(r,r.length-n,0,c),n-=c,n===0){c===a.length?(++o,s.next?this.head=s.next:this.head=this.tail=null):(this.head=s,s.data=a.slice(c));break}++o}return this.length-=o,r},"_getBuffer")},{key:bJ,value:i(function(n,r){return Tv(this,H8(H8({},r),{},{depth:0,customInspect:!1}))},"value")}]),e}()});var Rv=$((L2e,Q8)=>{"use strict";p();function vJ(e,t){var n=this,r=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return r||s?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(Av,this,e)):process.nextTick(Av,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(o){!t&&o?n._writableState?n._writableState.errorEmitted?process.nextTick(Sm,n):(n._writableState.errorEmitted=!0,process.nextTick(X8,n,o)):process.nextTick(X8,n,o):t?(process.nextTick(Sm,n),t(o)):process.nextTick(Sm,n)}),this)}i(vJ,"destroy");function X8(e,t){Av(e,t),Sm(e)}i(X8,"emitErrorAndCloseNT");function Sm(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}i(Sm,"emitCloseNT");function _J(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}i(_J,"undestroy");function Av(e,t){e.emit("error",t)}i(Av,"emitErrorNT");function SJ(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}i(SJ,"errorOrDestroy");Q8.exports={destroy:vJ,undestroy:_J,errorOrDestroy:SJ}});var Bo=$((F2e,tC)=>{"use strict";p();var eC={};function dr(e,t,n){n||(n=Error);function r(o,a,c){return typeof t=="string"?t:t(o,a,c)}i(r,"getMessage");class s extends n{static{i(this,"NodeError")}constructor(a,c,l){super(r(a,c,l))}}s.prototype.name=n.name,s.prototype.code=e,eC[e]=s}i(dr,"createErrorType");function Z8(e,t){if(Array.isArray(e)){let n=e.length;return e=e.map(r=>String(r)),n>2?`one of ${t} ${e.slice(0,n-1).join(", ")}, or `+e[n-1]:n===2?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}i(Z8,"oneOf");function kJ(e,t,n){return e.substr(!n||n<0?0:+n,t.length)===t}i(kJ,"startsWith");function EJ(e,t,n){return(n===void 0||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}i(EJ,"endsWith");function $J(e,t,n){return typeof n!="number"&&(n=0),n+t.length>e.length?!1:e.indexOf(t,n)!==-1}i($J,"includes");dr("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);dr("ERR_INVALID_ARG_TYPE",function(e,t,n){let r;typeof t=="string"&&kJ(t,"not ")?(r="must not be",t=t.replace(/^not /,"")):r="must be";let s;if(EJ(e," argument"))s=`The ${e} ${r} ${Z8(t,"type")}`;else{let o=$J(e,".")?"property":"argument";s=`The "${e}" ${o} ${r} ${Z8(t,"type")}`}return s+=`. Received type ${typeof n}`,s},TypeError);dr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");dr("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});dr("ERR_STREAM_PREMATURE_CLOSE","Premature close");dr("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});dr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");dr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");dr("ERR_STREAM_WRITE_AFTER_END","write after end");dr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);dr("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);dr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");tC.exports.codes=eC});var Cv=$((q2e,nC)=>{"use strict";p();var OJ=Bo().codes.ERR_INVALID_OPT_VALUE;function TJ(e,t,n){return e.highWaterMark!=null?e.highWaterMark:t?e[n]:null}i(TJ,"highWaterMarkFrom");function AJ(e,t,n,r){var s=TJ(t,r,n);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var o=r?n:"highWaterMark";throw new OJ(o,s)}return Math.floor(s)}return e.objectMode?16:16*1024}i(AJ,"getHighWaterMark");nC.exports={getHighWaterMark:AJ}});var rC=$((V2e,Nv)=>{p();typeof Object.create=="function"?Nv.exports=i(function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):Nv.exports=i(function(t,n){if(n){t.super_=n;var r=i(function(){},"TempCtor");r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},"inherits")});var qo=$((G2e,Iv)=>{p();try{if(Pv=Z("util"),typeof Pv.inherits!="function")throw"";Iv.exports=Pv.inherits}catch{Iv.exports=rC()}var Pv});var oC=$((z2e,sC)=>{p();sC.exports=Z("util").deprecate});var jv=$((X2e,fC)=>{"use strict";p();fC.exports=mt;function aC(e){var t=this;this.next=null,this.entry=null,this.finish=function(){nX(t,e)}}i(aC,"CorkedRequest");var Ic;mt.WritableState=uf;var RJ={deprecate:oC()},cC=Ov(),Em=Z("buffer").Buffer,CJ=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function NJ(e){return Em.from(e)}i(NJ,"_uint8ArrayToBuffer");function PJ(e){return Em.isBuffer(e)||e instanceof CJ}i(PJ,"_isUint8Array");var Dv=Rv(),IJ=Cv(),LJ=IJ.getHighWaterMark,Uo=Bo().codes,DJ=Uo.ERR_INVALID_ARG_TYPE,jJ=Uo.ERR_METHOD_NOT_IMPLEMENTED,FJ=Uo.ERR_MULTIPLE_CALLBACK,MJ=Uo.ERR_STREAM_CANNOT_PIPE,BJ=Uo.ERR_STREAM_DESTROYED,qJ=Uo.ERR_STREAM_NULL_VALUES,UJ=Uo.ERR_STREAM_WRITE_AFTER_END,WJ=Uo.ERR_UNKNOWN_ENCODING,Lc=Dv.errorOrDestroy;qo()(mt,cC);function VJ(){}i(VJ,"nop");function uf(e,t,n){Ic=Ic||Zi(),e=e||{},typeof n!="boolean"&&(n=t instanceof Ic),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=LJ(this,e,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var r=e.decodeStrings===!1;this.decodeStrings=!r,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(s){XJ(t,s)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new aC(this)}i(uf,"WritableState");uf.prototype.getBuffer=i(function(){for(var t=this.bufferedRequest,n=[];t;)n.push(t),t=t.next;return n},"getBuffer");(function(){try{Object.defineProperty(uf.prototype,"buffer",{get:RJ.deprecate(i(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var km;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(km=Function.prototype[Symbol.hasInstance],Object.defineProperty(mt,Symbol.hasInstance,{value:i(function(t){return km.call(this,t)?!0:this!==mt?!1:t&&t._writableState instanceof uf},"value")})):km=i(function(t){return t instanceof this},"realHasInstance");function mt(e){Ic=Ic||Zi();var t=this instanceof Ic;if(!t&&!km.call(mt,this))return new mt(e);this._writableState=new uf(e,this,t),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),cC.call(this)}i(mt,"Writable");mt.prototype.pipe=function(){Lc(this,new MJ)};function KJ(e,t){var n=new UJ;Lc(e,n),process.nextTick(t,n)}i(KJ,"writeAfterEnd");function HJ(e,t,n,r){var s;return n===null?s=new qJ:typeof n!="string"&&!t.objectMode&&(s=new DJ("chunk",["string","Buffer"],n)),s?(Lc(e,s),process.nextTick(r,s),!1):!0}i(HJ,"validChunk");mt.prototype.write=function(e,t,n){var r=this._writableState,s=!1,o=!r.objectMode&&PJ(e);return o&&!Em.isBuffer(e)&&(e=NJ(e)),typeof t=="function"&&(n=t,t=null),o?t="buffer":t||(t=r.defaultEncoding),typeof n!="function"&&(n=VJ),r.ending?KJ(this,n):(o||HJ(this,r,e,n))&&(r.pendingcb++,s=YJ(this,r,o,e,t,n)),s};mt.prototype.cork=function(){this._writableState.corked++};mt.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&lC(this,e))};mt.prototype.setDefaultEncoding=i(function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new WJ(t);return this._writableState.defaultEncoding=t,this},"setDefaultEncoding");Object.defineProperty(mt.prototype,"writableBuffer",{enumerable:!1,get:i(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function GJ(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Em.from(t,n)),t}i(GJ,"decodeChunk");Object.defineProperty(mt.prototype,"writableHighWaterMark",{enumerable:!1,get:i(function(){return this._writableState.highWaterMark},"get")});function YJ(e,t,n,r,s,o){if(!n){var a=GJ(t,r,s);r!==a&&(n=!0,s="buffer",r=a)}var c=t.objectMode?1:r.length;t.length+=c;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:s,isBuf:n,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Lv(e,t,!1,c,r,s,o);return l}i(YJ,"writeOrBuffer");function Lv(e,t,n,r,s,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new BJ("write")):n?e._writev(s,t.onwrite):e._write(s,o,t.onwrite),t.sync=!1}i(Lv,"doWrite");function zJ(e,t,n,r,s){--t.pendingcb,n?(process.nextTick(s,r),process.nextTick(lf,e,t),e._writableState.errorEmitted=!0,Lc(e,r)):(s(r),e._writableState.errorEmitted=!0,Lc(e,r),lf(e,t))}i(zJ,"onwriteError");function JJ(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}i(JJ,"onwriteStateUpdate");function XJ(e,t){var n=e._writableState,r=n.sync,s=n.writecb;if(typeof s!="function")throw new FJ;if(JJ(n),t)zJ(e,n,r,t,s);else{var o=uC(n)||e.destroyed;!o&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest&&lC(e,n),r?process.nextTick(iC,e,n,o,s):iC(e,n,o,s)}}i(XJ,"onwrite");function iC(e,t,n,r){n||QJ(e,t),t.pendingcb--,r(),lf(e,t)}i(iC,"afterWrite");function QJ(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}i(QJ,"onwriteDrain");function lC(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,s=new Array(r),o=t.corkedRequestsFree;o.entry=n;for(var a=0,c=!0;n;)s[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;s.allBuffers=c,Lv(e,t,!0,t.length,s,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new aC(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,u=n.encoding,f=n.callback,d=t.objectMode?1:l.length;if(Lv(e,t,!1,d,l,u,f),n=n.next,t.bufferedRequestCount--,t.writing)break}n===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}i(lC,"clearBuffer");mt.prototype._write=function(e,t,n){n(new jJ("_write()"))};mt.prototype._writev=null;mt.prototype.end=function(e,t,n){var r=this._writableState;return typeof e=="function"?(n=e,e=null,t=null):typeof t=="function"&&(n=t,t=null),e!=null&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||tX(this,r,n),this};Object.defineProperty(mt.prototype,"writableLength",{enumerable:!1,get:i(function(){return this._writableState.length},"get")});function uC(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}i(uC,"needFinish");function ZJ(e,t){e._final(function(n){t.pendingcb--,n&&Lc(e,n),t.prefinished=!0,e.emit("prefinish"),lf(e,t)})}i(ZJ,"callFinal");function eX(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,process.nextTick(ZJ,e,t)):(t.prefinished=!0,e.emit("prefinish")))}i(eX,"prefinish");function lf(e,t){var n=uC(t);if(n&&(eX(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}i(lf,"finishMaybe");function tX(e,t,n){t.ending=!0,lf(e,t),n&&(t.finished?process.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}i(tX,"endWritable");function nX(e,t,n){var r=e.entry;for(e.entry=null;r;){var s=r.callback;t.pendingcb--,s(n),r=r.next}t.corkedRequestsFree.next=e}i(nX,"onCorkedFinish");Object.defineProperty(mt.prototype,"destroyed",{enumerable:!1,get:i(function(){return this._writableState===void 0?!1:this._writableState.destroyed},"get"),set:i(function(t){this._writableState&&(this._writableState.destroyed=t)},"set")});mt.prototype.destroy=Dv.destroy;mt.prototype._undestroy=Dv.undestroy;mt.prototype._destroy=function(e,t){t(e)}});var Zi=$((e1e,pC)=>{"use strict";p();var rX=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};pC.exports=ds;var dC=Bv(),Mv=jv();qo()(ds,dC);for(Fv=rX(Mv.prototype),$m=0;$m<Fv.length;$m++)Om=Fv[$m],ds.prototype[Om]||(ds.prototype[Om]=Mv.prototype[Om]);var Fv,Om,$m;function ds(e){if(!(this instanceof ds))return new ds(e);dC.call(this,e),Mv.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",sX)))}i(ds,"Duplex");Object.defineProperty(ds.prototype,"writableHighWaterMark",{enumerable:!1,get:i(function(){return this._writableState.highWaterMark},"get")});Object.defineProperty(ds.prototype,"writableBuffer",{enumerable:!1,get:i(function(){return this._writableState&&this._writableState.getBuffer()},"get")});Object.defineProperty(ds.prototype,"writableLength",{enumerable:!1,get:i(function(){return this._writableState.length},"get")});function sX(){this._writableState.ended||process.nextTick(oX,this)}i(sX,"onend");function oX(e){e.end()}i(oX,"onEndNT");Object.defineProperty(ds.prototype,"destroyed",{enumerable:!1,get:i(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:i(function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)},"set")})});var gC=$((qv,mC)=>{p();var Tm=Z("buffer"),ps=Tm.Buffer;function hC(e,t){for(var n in e)t[n]=e[n]}i(hC,"copyProps");ps.from&&ps.alloc&&ps.allocUnsafe&&ps.allocUnsafeSlow?mC.exports=Tm:(hC(Tm,qv),qv.Buffer=ea);function ea(e,t,n){return ps(e,t,n)}i(ea,"SafeBuffer");ea.prototype=Object.create(ps.prototype);hC(ps,ea);ea.from=function(e,t,n){if(typeof e=="number")throw new TypeError("Argument must not be a number");return ps(e,t,n)};ea.alloc=function(e,t,n){if(typeof e!="number")throw new TypeError("Argument must be a number");var r=ps(e);return t!==void 0?typeof n=="string"?r.fill(t,n):r.fill(t):r.fill(0),r};ea.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return ps(e)};ea.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Tm.SlowBuffer(e)}});var Vv=$(yC=>{"use strict";p();var Wv=gC().Buffer,xC=Wv.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function iX(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}i(iX,"_normalizeEncoding");function aX(e){var t=iX(e);if(typeof t!="string"&&(Wv.isEncoding===xC||!xC(e)))throw new Error("Unknown encoding: "+e);return t||e}i(aX,"normalizeEncoding");yC.StringDecoder=ff;function ff(e){this.encoding=aX(e);var t;switch(this.encoding){case"utf16le":this.text=pX,this.end=hX,t=4;break;case"utf8":this.fillLast=uX,t=4;break;case"base64":this.text=mX,this.end=gX,t=3;break;default:this.write=xX,this.end=yX;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Wv.allocUnsafe(t)}i(ff,"StringDecoder");ff.prototype.write=function(e){if(e.length===0)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""};ff.prototype.end=dX;ff.prototype.text=fX;ff.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function Uv(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}i(Uv,"utf8CheckByte");function cX(e,t,n){var r=t.length-1;if(r<n)return 0;var s=Uv(t[r]);return s>=0?(s>0&&(e.lastNeed=s-1),s):--r<n||s===-2?0:(s=Uv(t[r]),s>=0?(s>0&&(e.lastNeed=s-2),s):--r<n||s===-2?0:(s=Uv(t[r]),s>=0?(s>0&&(s===2?s=0:e.lastNeed=s-3),s):0))}i(cX,"utf8CheckIncomplete");function lX(e,t,n){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}i(lX,"utf8CheckExtraBytes");function uX(e){var t=this.lastTotal-this.lastNeed,n=lX(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}i(uX,"utf8FillLast");function fX(e,t){var n=cX(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}i(fX,"utf8Text");function dX(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}i(dX,"utf8End");function pX(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}i(pX,"utf16Text");function hX(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}i(hX,"utf16End");function mX(e,t){var n=(e.length-t)%3;return n===0?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}i(mX,"base64Text");function gX(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}i(gX,"base64End");function xX(e){return e.toString(this.encoding)}i(xX,"simpleWrite");function yX(e){return e&&e.length?this.write(e):""}i(yX,"simpleEnd")});var Am=$((c1e,vC)=>{"use strict";p();var bC=Bo().codes.ERR_STREAM_PREMATURE_CLOSE;function bX(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];e.apply(this,r)}}}i(bX,"once");function wX(){}i(wX,"noop");function vX(e){return e.setHeader&&typeof e.abort=="function"}i(vX,"isRequest");function wC(e,t,n){if(typeof t=="function")return wC(e,null,t);t||(t={}),n=bX(n||wX);var r=t.readable||t.readable!==!1&&e.readable,s=t.writable||t.writable!==!1&&e.writable,o=i(function(){e.writable||c()},"onlegacyfinish"),a=e._writableState&&e._writableState.finished,c=i(function(){s=!1,a=!0,r||n.call(e)},"onfinish"),l=e._readableState&&e._readableState.endEmitted,u=i(function(){r=!1,l=!0,s||n.call(e)},"onend"),f=i(function(y){n.call(e,y)},"onerror"),d=i(function(){var y;if(r&&!l)return(!e._readableState||!e._readableState.ended)&&(y=new bC),n.call(e,y);if(s&&!a)return(!e._writableState||!e._writableState.ended)&&(y=new bC),n.call(e,y)},"onclose"),h=i(function(){e.req.on("finish",c)},"onrequest");return vX(e)?(e.on("complete",c),e.on("abort",d),e.req?h():e.on("request",h)):s&&!e._writableState&&(e.on("end",o),e.on("close",o)),e.on("end",u),e.on("finish",c),t.error!==!1&&e.on("error",f),e.on("close",d),function(){e.removeListener("complete",c),e.removeListener("abort",d),e.removeListener("request",h),e.req&&e.req.removeListener("finish",c),e.removeListener("end",o),e.removeListener("close",o),e.removeListener("finish",c),e.removeListener("end",u),e.removeListener("error",f),e.removeListener("close",d)}}i(wC,"eos");vC.exports=wC});var SC=$((f1e,_C)=>{"use strict";p();var Rm;function Wo(e,t,n){return t=_X(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}i(Wo,"_defineProperty");function _X(e){var t=SX(e,"string");return typeof t=="symbol"?t:String(t)}i(_X,"_toPropertyKey");function SX(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}i(SX,"_toPrimitive");var kX=Am(),Vo=Symbol("lastResolve"),ta=Symbol("lastReject"),df=Symbol("error"),Cm=Symbol("ended"),na=Symbol("lastPromise"),Kv=Symbol("handlePromise"),ra=Symbol("stream");function Ko(e,t){return{value:e,done:t}}i(Ko,"createIterResult");function EX(e){var t=e[Vo];if(t!==null){var n=e[ra].read();n!==null&&(e[na]=null,e[Vo]=null,e[ta]=null,t(Ko(n,!1)))}}i(EX,"readAndResolve");function $X(e){process.nextTick(EX,e)}i($X,"onReadable");function OX(e,t){return function(n,r){e.then(function(){if(t[Cm]){n(Ko(void 0,!0));return}t[Kv](n,r)},r)}}i(OX,"wrapForNext");var TX=Object.getPrototypeOf(function(){}),AX=Object.setPrototypeOf((Rm={get stream(){return this[ra]},next:i(function(){var t=this,n=this[df];if(n!==null)return Promise.reject(n);if(this[Cm])return Promise.resolve(Ko(void 0,!0));if(this[ra].destroyed)return new Promise(function(a,c){process.nextTick(function(){t[df]?c(t[df]):a(Ko(void 0,!0))})});var r=this[na],s;if(r)s=new Promise(OX(r,this));else{var o=this[ra].read();if(o!==null)return Promise.resolve(Ko(o,!1));s=new Promise(this[Kv])}return this[na]=s,s},"next")},Wo(Rm,Symbol.asyncIterator,function(){return this}),Wo(Rm,"return",i(function(){var t=this;return new Promise(function(n,r){t[ra].destroy(null,function(s){if(s){r(s);return}n(Ko(void 0,!0))})})},"_return")),Rm),TX),RX=i(function(t){var n,r=Object.create(AX,(n={},Wo(n,ra,{value:t,writable:!0}),Wo(n,Vo,{value:null,writable:!0}),Wo(n,ta,{value:null,writable:!0}),Wo(n,df,{value:null,writable:!0}),Wo(n,Cm,{value:t._readableState.endEmitted,writable:!0}),Wo(n,Kv,{value:i(function(o,a){var c=r[ra].read();c?(r[na]=null,r[Vo]=null,r[ta]=null,o(Ko(c,!1))):(r[Vo]=o,r[ta]=a)},"value"),writable:!0}),n));return r[na]=null,kX(t,function(s){if(s&&s.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=r[ta];o!==null&&(r[na]=null,r[Vo]=null,r[ta]=null,o(s)),r[df]=s;return}var a=r[Vo];a!==null&&(r[na]=null,r[Vo]=null,r[ta]=null,a(Ko(void 0,!0))),r[Cm]=!0}),t.on("readable",$X.bind(null,r)),r},"createReadableStreamAsyncIterator");_C.exports=RX});var OC=$((h1e,$C)=>{"use strict";p();function kC(e,t,n,r,s,o,a){try{var c=e[o](a),l=c.value}catch(u){n(u);return}c.done?t(l):Promise.resolve(l).then(r,s)}i(kC,"asyncGeneratorStep");function CX(e){return function(){var t=this,n=arguments;return new Promise(function(r,s){var o=e.apply(t,n);function a(l){kC(o,r,s,a,c,"next",l)}i(a,"_next");function c(l){kC(o,r,s,a,c,"throw",l)}i(c,"_throw"),a(void 0)})}}i(CX,"_asyncToGenerator");function EC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}i(EC,"ownKeys");function NX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?EC(Object(n),!0).forEach(function(r){PX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}i(NX,"_objectSpread");function PX(e,t,n){return t=IX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}i(PX,"_defineProperty");function IX(e){var t=LX(e,"string");return typeof t=="symbol"?t:String(t)}i(IX,"_toPropertyKey");function LX(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}i(LX,"_toPrimitive");var DX=Bo().codes.ERR_INVALID_ARG_TYPE;function jX(e,t,n){var r;if(t&&typeof t.next=="function")r=t;else if(t&&t[Symbol.asyncIterator])r=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])r=t[Symbol.iterator]();else throw new DX("iterable",["Iterable"],t);var s=new e(NX({objectMode:!0},n)),o=!1;s._read=function(){o||(o=!0,a())};function a(){return c.apply(this,arguments)}i(a,"next");function c(){return c=CX(function*(){try{var l=yield r.next(),u=l.value,f=l.done;f?s.push(null):s.push(yield u)?a():o=!1}catch(d){s.destroy(d)}}),c.apply(this,arguments)}return i(c,"_next2"),s}i(jX,"from");$C.exports=jX});var Bv=$((y1e,jC)=>{"use strict";p();jC.exports=Ae;var Dc;Ae.ReadableState=CC;var x1e=Z("events").EventEmitter,RC=i(function(t,n){return t.listeners(n).length},"EElistenerCount"),hf=Ov(),Nm=Z("buffer").Buffer,FX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function MX(e){return Nm.from(e)}i(MX,"_uint8ArrayToBuffer");function BX(e){return Nm.isBuffer(e)||e instanceof FX}i(BX,"_isUint8Array");var Hv=Z("util"),ye;Hv&&Hv.debuglog?ye=Hv.debuglog("stream"):ye=i(function(){},"debug");var qX=J8(),Zv=Rv(),UX=Cv(),WX=UX.getHighWaterMark,Pm=Bo().codes,VX=Pm.ERR_INVALID_ARG_TYPE,KX=Pm.ERR_STREAM_PUSH_AFTER_EOF,HX=Pm.ERR_METHOD_NOT_IMPLEMENTED,GX=Pm.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,jc,Gv,Yv;qo()(Ae,hf);var pf=Zv.errorOrDestroy,zv=["error","close","destroy","pause","resume"];function YX(e,t,n){if(typeof e.prependListener=="function")return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}i(YX,"prependListener");function CC(e,t,n){Dc=Dc||Zi(),e=e||{},typeof n!="boolean"&&(n=t instanceof Dc),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=WX(this,e,"readableHighWaterMark",n),this.buffer=new qX,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(jc||(jc=Vv().StringDecoder),this.decoder=new jc(e.encoding),this.encoding=e.encoding)}i(CC,"ReadableState");function Ae(e){if(Dc=Dc||Zi(),!(this instanceof Ae))return new Ae(e);var t=this instanceof Dc;this._readableState=new CC(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),hf.call(this)}i(Ae,"Readable");Object.defineProperty(Ae.prototype,"destroyed",{enumerable:!1,get:i(function(){return this._readableState===void 0?!1:this._readableState.destroyed},"get"),set:i(function(t){this._readableState&&(this._readableState.destroyed=t)},"set")});Ae.prototype.destroy=Zv.destroy;Ae.prototype._undestroy=Zv.undestroy;Ae.prototype._destroy=function(e,t){t(e)};Ae.prototype.push=function(e,t){var n=this._readableState,r;return n.objectMode?r=!0:typeof e=="string"&&(t=t||n.defaultEncoding,t!==n.encoding&&(e=Nm.from(e,t),t=""),r=!0),NC(this,e,t,!1,r)};Ae.prototype.unshift=function(e){return NC(this,e,null,!0,!1)};function NC(e,t,n,r,s){ye("readableAddChunk",t);var o=e._readableState;if(t===null)o.reading=!1,XX(e,o);else{var a;if(s||(a=zX(o,t)),a)pf(e,a);else if(o.objectMode||t&&t.length>0)if(typeof t!="string"&&!o.objectMode&&Object.getPrototypeOf(t)!==Nm.prototype&&(t=MX(t)),r)o.endEmitted?pf(e,new GX):Jv(e,o,t,!0);else if(o.ended)pf(e,new KX);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||t.length!==0?Jv(e,o,t,!1):Qv(e,o)):Jv(e,o,t,!1)}else r||(o.reading=!1,Qv(e,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}i(NC,"readableAddChunk");function Jv(e,t,n,r){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&Im(e)),Qv(e,t)}i(Jv,"addChunk");function zX(e,t){var n;return!BX(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(n=new VX("chunk",["string","Buffer","Uint8Array"],t)),n}i(zX,"chunkInvalid");Ae.prototype.isPaused=function(){return this._readableState.flowing===!1};Ae.prototype.setEncoding=function(e){jc||(jc=Vv().StringDecoder);var t=new jc(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";n!==null;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),r!==""&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var TC=1073741824;function JX(e){return e>=TC?e=TC:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}i(JX,"computeNewHighWaterMark");function AC(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=JX(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}i(AC,"howMuchToRead");Ae.prototype.read=function(e){ye("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return ye("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?Xv(this):Im(this),null;if(e=AC(e,t),e===0&&t.ended)return t.length===0&&Xv(this),null;var r=t.needReadable;ye("need readable",r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,ye("length less than watermark",r)),t.ended||t.reading?(r=!1,ye("reading or ended",r)):r&&(ye("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=AC(n,t)));var s;return e>0?s=LC(e,t):s=null,s===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&Xv(this)),s!==null&&this.emit("data",s),s};function XX(e,t){if(ye("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?Im(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,PC(e)))}}i(XX,"onEofChunk");function Im(e){var t=e._readableState;ye("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(ye("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(PC,e))}i(Im,"emitReadable");function PC(e){var t=e._readableState;ye("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,e_(e)}i(PC,"emitReadable_");function Qv(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(QX,e,t))}i(Qv,"maybeReadMore");function QX(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var n=t.length;if(ye("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}i(QX,"maybeReadMore_");Ae.prototype._read=function(e){pf(this,new HX("_read()"))};Ae.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e);break}r.pipesCount+=1,ye("pipe count=%d opts=%j",r.pipesCount,t);var s=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,o=s?c:g;r.endEmitted?process.nextTick(o):n.once("end",o),e.on("unpipe",a);function a(x,w){ye("onunpipe"),x===n&&w&&w.hasUnpiped===!1&&(w.hasUnpiped=!0,f())}i(a,"onunpipe");function c(){ye("onend"),e.end()}i(c,"onend");var l=ZX(n);e.on("drain",l);var u=!1;function f(){ye("cleanup"),e.removeListener("close",m),e.removeListener("finish",y),e.removeListener("drain",l),e.removeListener("error",h),e.removeListener("unpipe",a),n.removeListener("end",c),n.removeListener("end",g),n.removeListener("data",d),u=!0,r.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&l()}i(f,"cleanup"),n.on("data",d);function d(x){ye("ondata");var w=e.write(x);ye("dest.write",w),w===!1&&((r.pipesCount===1&&r.pipes===e||r.pipesCount>1&&DC(r.pipes,e)!==-1)&&!u&&(ye("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}i(d,"ondata");function h(x){ye("onerror",x),g(),e.removeListener("error",h),RC(e,"error")===0&&pf(e,x)}i(h,"onerror"),YX(e,"error",h);function m(){e.removeListener("finish",y),g()}i(m,"onclose"),e.once("close",m);function y(){ye("onfinish"),e.removeListener("close",m),g()}i(y,"onfinish"),e.once("finish",y);function g(){ye("unpipe"),n.unpipe(e)}return i(g,"unpipe"),e.emit("pipe",n),r.flowing||(ye("pipe resume"),n.resume()),e};function ZX(e){return i(function(){var n=e._readableState;ye("pipeOnDrain",n.awaitDrain),n.awaitDrain&&n.awaitDrain--,n.awaitDrain===0&&RC(e,"data")&&(n.flowing=!0,e_(e))},"pipeOnDrainFunctionResult")}i(ZX,"pipeOnDrain");Ae.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,s=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<s;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=DC(t.pipes,e);return a===-1?this:(t.pipes.splice(a,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)};Ae.prototype.on=function(e,t){var n=hf.prototype.on.call(this,e,t),r=this._readableState;return e==="data"?(r.readableListening=this.listenerCount("readable")>0,r.flowing!==!1&&this.resume()):e==="readable"&&!r.endEmitted&&!r.readableListening&&(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,ye("on readable",r.length,r.reading),r.length?Im(this):r.reading||process.nextTick(eQ,this)),n};Ae.prototype.addListener=Ae.prototype.on;Ae.prototype.removeListener=function(e,t){var n=hf.prototype.removeListener.call(this,e,t);return e==="readable"&&process.nextTick(IC,this),n};Ae.prototype.removeAllListeners=function(e){var t=hf.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&process.nextTick(IC,this),t};function IC(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}i(IC,"updateReadableListening");function eQ(e){ye("readable nexttick read 0"),e.read(0)}i(eQ,"nReadingNextTick");Ae.prototype.resume=function(){var e=this._readableState;return e.flowing||(ye("resume"),e.flowing=!e.readableListening,tQ(this,e)),e.paused=!1,this};function tQ(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(nQ,e,t))}i(tQ,"resume");function nQ(e,t){ye("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),e_(e),t.flowing&&!t.reading&&e.read(0)}i(nQ,"resume_");Ae.prototype.pause=function(){return ye("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ye("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function e_(e){var t=e._readableState;for(ye("flow",t.flowing);t.flowing&&e.read()!==null;);}i(e_,"flow");Ae.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;e.on("end",function(){if(ye("wrapped end"),n.decoder&&!n.ended){var a=n.decoder.end();a&&a.length&&t.push(a)}t.push(null)}),e.on("data",function(a){if(ye("wrapped data"),n.decoder&&(a=n.decoder.write(a)),!(n.objectMode&&a==null)&&!(!n.objectMode&&(!a||!a.length))){var c=t.push(a);c||(r=!0,e.pause())}});for(var s in e)this[s]===void 0&&typeof e[s]=="function"&&(this[s]=i(function(c){return i(function(){return e[c].apply(e,arguments)},"methodWrapReturnFunction")},"methodWrap")(s));for(var o=0;o<zv.length;o++)e.on(zv[o],this.emit.bind(this,zv[o]));return this._read=function(a){ye("wrapped _read",a),r&&(r=!1,e.resume())},this};typeof Symbol=="function"&&(Ae.prototype[Symbol.asyncIterator]=function(){return Gv===void 0&&(Gv=SC()),Gv(this)});Object.defineProperty(Ae.prototype,"readableHighWaterMark",{enumerable:!1,get:i(function(){return this._readableState.highWaterMark},"get")});Object.defineProperty(Ae.prototype,"readableBuffer",{enumerable:!1,get:i(function(){return this._readableState&&this._readableState.buffer},"get")});Object.defineProperty(Ae.prototype,"readableFlowing",{enumerable:!1,get:i(function(){return this._readableState.flowing},"get"),set:i(function(t){this._readableState&&(this._readableState.flowing=t)},"set")});Ae._fromList=LC;Object.defineProperty(Ae.prototype,"readableLength",{enumerable:!1,get:i(function(){return this._readableState.length},"get")});function LC(e,t){if(t.length===0)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(t.decoder?n=t.buffer.join(""):t.buffer.length===1?n=t.buffer.first():n=t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}i(LC,"fromList");function Xv(e){var t=e._readableState;ye("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(rQ,t,e))}i(Xv,"endReadable");function rQ(e,t){if(ye("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}i(rQ,"endReadableNT");typeof Symbol=="function"&&(Ae.from=function(e,t){return Yv===void 0&&(Yv=OC()),Yv(Ae,e,t)});function DC(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}i(DC,"indexOf")});var t_=$((v1e,MC)=>{"use strict";p();MC.exports=Gs;var Lm=Bo().codes,sQ=Lm.ERR_METHOD_NOT_IMPLEMENTED,oQ=Lm.ERR_MULTIPLE_CALLBACK,iQ=Lm.ERR_TRANSFORM_ALREADY_TRANSFORMING,aQ=Lm.ERR_TRANSFORM_WITH_LENGTH_0,Dm=Zi();qo()(Gs,Dm);function cQ(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit("error",new oQ);n.writechunk=null,n.writecb=null,t!=null&&this.push(t),r(e);var s=this._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}i(cQ,"afterTransform");function Gs(e){if(!(this instanceof Gs))return new Gs(e);Dm.call(this,e),this._transformState={afterTransform:cQ.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",lQ)}i(Gs,"Transform");function lQ(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,n){FC(e,t,n)}):FC(this,null,null)}i(lQ,"prefinish");Gs.prototype.push=function(e,t){return this._transformState.needTransform=!1,Dm.prototype.push.call(this,e,t)};Gs.prototype._transform=function(e,t,n){n(new sQ("_transform()"))};Gs.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var s=this._readableState;(r.needTransform||s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}};Gs.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Gs.prototype._destroy=function(e,t){Dm.prototype._destroy.call(this,e,function(n){t(n)})};function FC(e,t,n){if(t)return e.emit("error",t);if(n!=null&&e.push(n),e._writableState.length)throw new aQ;if(e._transformState.transforming)throw new iQ;return e.push(null)}i(FC,"done")});var UC=$((k1e,qC)=>{"use strict";p();qC.exports=mf;var BC=t_();qo()(mf,BC);function mf(e){if(!(this instanceof mf))return new mf(e);BC.call(this,e)}i(mf,"PassThrough");mf.prototype._transform=function(e,t,n){n(null,e)}});var GC=$((O1e,HC)=>{"use strict";p();var n_;function uQ(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}i(uQ,"once");var KC=Bo().codes,fQ=KC.ERR_MISSING_ARGS,dQ=KC.ERR_STREAM_DESTROYED;function WC(e){if(e)throw e}i(WC,"noop");function pQ(e){return e.setHeader&&typeof e.abort=="function"}i(pQ,"isRequest");function hQ(e,t,n,r){r=uQ(r);var s=!1;e.on("close",function(){s=!0}),n_===void 0&&(n_=Am()),n_(e,{readable:t,writable:n},function(a){if(a)return r(a);s=!0,r()});var o=!1;return function(a){if(!s&&!o){if(o=!0,pQ(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();r(a||new dQ("pipe"))}}}i(hQ,"destroyer");function VC(e){e()}i(VC,"call");function mQ(e,t){return e.pipe(t)}i(mQ,"pipe");function gQ(e){return!e.length||typeof e[e.length-1]!="function"?WC:e.pop()}i(gQ,"popCallback");function xQ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=gQ(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new fQ("streams");var s,o=t.map(function(a,c){var l=c<t.length-1,u=c>0;return hQ(a,l,u,function(f){s||(s=f),f&&o.forEach(VC),!l&&(o.forEach(VC),r(s))})});return t.reduce(mQ)}i(xQ,"pipeline");HC.exports=xQ});var Fc=$((pr,xf)=>{p();var gf=Z("stream");process.env.READABLE_STREAM==="disable"&&gf?(xf.exports=gf.Readable,Object.assign(xf.exports,gf),xf.exports.Stream=gf):(pr=xf.exports=Bv(),pr.Stream=gf||pr,pr.Readable=pr,pr.Writable=jv(),pr.Duplex=Zi(),pr.Transform=t_(),pr.PassThrough=UC(),pr.finished=Am(),pr.pipeline=GC())});var JC=$((C1e,zC)=>{"use strict";p();var{Buffer:Nr}=Z("buffer"),YC=Symbol.for("BufferList");function Xe(e){if(!(this instanceof Xe))return new Xe(e);Xe._init.call(this,e)}i(Xe,"BufferList");Xe._init=i(function(t){Object.defineProperty(this,YC,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)},"_init");Xe.prototype._new=i(function(t){return new Xe(t)},"_new");Xe.prototype._offset=i(function(t){if(t===0)return[0,0];let n=0;for(let r=0;r<this._bufs.length;r++){let s=n+this._bufs[r].length;if(t<s||r===this._bufs.length-1)return[r,t-n];n=s}},"_offset");Xe.prototype._reverseOffset=function(e){let t=e[0],n=e[1];for(let r=0;r<t;r++)n+=this._bufs[r].length;return n};Xe.prototype.get=i(function(t){if(t>this.length||t<0)return;let n=this._offset(t);return this._bufs[n[0]][n[1]]},"get");Xe.prototype.slice=i(function(t,n){return typeof t=="number"&&t<0&&(t+=this.length),typeof n=="number"&&n<0&&(n+=this.length),this.copy(null,0,t,n)},"slice");Xe.prototype.copy=i(function(t,n,r,s){if((typeof r!="number"||r<0)&&(r=0),(typeof s!="number"||s>this.length)&&(s=this.length),r>=this.length||s<=0)return t||Nr.alloc(0);let o=!!t,a=this._offset(r),c=s-r,l=c,u=o&&n||0,f=a[1];if(r===0&&s===this.length){if(!o)return this._bufs.length===1?this._bufs[0]:Nr.concat(this._bufs,this.length);for(let d=0;d<this._bufs.length;d++)this._bufs[d].copy(t,u),u+=this._bufs[d].length;return t}if(l<=this._bufs[a[0]].length-f)return o?this._bufs[a[0]].copy(t,n,f,f+l):this._bufs[a[0]].slice(f,f+l);o||(t=Nr.allocUnsafe(c));for(let d=a[0];d<this._bufs.length;d++){let h=this._bufs[d].length-f;if(l>h)this._bufs[d].copy(t,u,f),u+=h;else{this._bufs[d].copy(t,u,f,f+l),u+=h;break}l-=h,f&&(f=0)}return t.length>u?t.slice(0,u):t},"copy");Xe.prototype.shallowSlice=i(function(t,n){if(t=t||0,n=typeof n!="number"?this.length:n,t<0&&(t+=this.length),n<0&&(n+=this.length),t===n)return this._new();let r=this._offset(t),s=this._offset(n),o=this._bufs.slice(r[0],s[0]+1);return s[1]===0?o.pop():o[o.length-1]=o[o.length-1].slice(0,s[1]),r[1]!==0&&(o[0]=o[0].slice(r[1])),this._new(o)},"shallowSlice");Xe.prototype.toString=i(function(t,n,r){return this.slice(n,r).toString(t)},"toString");Xe.prototype.consume=i(function(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;for(;this._bufs.length;)if(t>=this._bufs[0].length)t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}return this},"consume");Xe.prototype.duplicate=i(function(){let t=this._new();for(let n=0;n<this._bufs.length;n++)t.append(this._bufs[n]);return t},"duplicate");Xe.prototype.append=i(function(t){if(t==null)return this;if(t.buffer)this._appendBuffer(Nr.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let n=0;n<t.length;n++)this.append(t[n]);else if(this._isBufferList(t))for(let n=0;n<t._bufs.length;n++)this.append(t._bufs[n]);else typeof t=="number"&&(t=t.toString()),this._appendBuffer(Nr.from(t));return this},"append");Xe.prototype._appendBuffer=i(function(t){this._bufs.push(t),this.length+=t.length},"appendBuffer");Xe.prototype.indexOf=function(e,t,n){if(n===void 0&&typeof t=="string"&&(n=t,t=void 0),typeof e=="function"||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof e=="number"?e=Nr.from([e]):typeof e=="string"?e=Nr.from(e,n):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=Nr.from(e.buffer,e.byteOffset,e.byteLength):Nr.isBuffer(e)||(e=Nr.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let r=this._offset(t),s=r[0],o=r[1];for(;s<this._bufs.length;s++){let a=this._bufs[s];for(;o<a.length;)if(a.length-o>=e.length){let l=a.indexOf(e,o);if(l!==-1)return this._reverseOffset([s,l]);o=a.length-e.length+1}else{let l=this._reverseOffset([s,o]);if(this._match(l,e))return l;o++}o=0}return-1};Xe.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let n=0;n<t.length;n++)if(this.get(e+n)!==t[n])return!1;return!0};(function(){let e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let t in e)(function(n){e[n]===null?Xe.prototype[n]=function(r,s){return this.slice(r,r+s)[n](0,s)}:Xe.prototype[n]=function(r=0){return this.slice(r,r+e[n])[n](0)}})(t)})();Xe.prototype._isBufferList=i(function(t){return t instanceof Xe||Xe.isBufferList(t)},"_isBufferList");Xe.isBufferList=i(function(t){return t!=null&&t[YC]},"isBufferList");zC.exports=Xe});var XC=$((I1e,jm)=>{"use strict";p();var r_=Fc().Duplex,yQ=qo(),yf=JC();function sn(e){if(!(this instanceof sn))return new sn(e);if(typeof e=="function"){this._callback=e;let t=i(function(r){this._callback&&(this._callback(r),this._callback=null)},"piper").bind(this);this.on("pipe",i(function(r){r.on("error",t)},"onPipe")),this.on("unpipe",i(function(r){r.removeListener("error",t)},"onUnpipe")),e=null}yf._init.call(this,e),r_.call(this)}i(sn,"BufferListStream");yQ(sn,r_);Object.assign(sn.prototype,yf.prototype);sn.prototype._new=i(function(t){return new sn(t)},"_new");sn.prototype._write=i(function(t,n,r){this._appendBuffer(t),typeof r=="function"&&r()},"_write");sn.prototype._read=i(function(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)},"_read");sn.prototype.end=i(function(t){r_.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},"end");sn.prototype._destroy=i(function(t,n){this._bufs.length=0,this.length=0,n(t)},"_destroy");sn.prototype._isBufferList=i(function(t){return t instanceof sn||t instanceof yf||sn.isBufferList(t)},"_isBufferList");sn.isBufferList=yf.isBufferList;jm.exports=sn;jm.exports.BufferListStream=sn;jm.exports.BufferList=yf});var i_=$(Bc=>{p();var bQ=Buffer.alloc,wQ="0000000000000000000",vQ="7777777777777777777",QC=48,ZC=Buffer.from("ustar\0","binary"),_Q=Buffer.from("00","binary"),SQ=Buffer.from("ustar ","binary"),kQ=Buffer.from(" \0","binary"),EQ=parseInt("7777",8),bf=257,o_=263,$Q=i(function(e,t,n){return typeof e!="number"?n:(e=~~e,e>=t?t:e>=0||(e+=t,e>=0)?e:0)},"clamp"),OQ=i(function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null},"toType"),TQ=i(function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0},"toTypeflag"),eN=i(function(e,t,n,r){for(;n<r;n++)if(e[n]===t)return n;return r},"indexOf"),tN=i(function(e){for(var t=256,n=0;n<148;n++)t+=e[n];for(var r=156;r<512;r++)t+=e[r];return t},"cksum"),Ho=i(function(e,t){return e=e.toString(8),e.length>t?vQ.slice(0,t)+" ":wQ.slice(0,t-e.length)+e+" "},"encodeOct");function AQ(e){var t;if(e[0]===128)t=!0;else if(e[0]===255)t=!1;else return null;for(var n=[],r=e.length-1;r>0;r--){var s=e[r];t?n.push(s):n.push(255-s)}var o=0,a=n.length;for(r=0;r<a;r++)o+=n[r]*Math.pow(256,r);return t?o:-1*o}i(AQ,"parse256");var Go=i(function(e,t,n){if(e=e.slice(t,t+n),t=0,e[t]&128)return AQ(e);for(;t<e.length&&e[t]===32;)t++;for(var r=$Q(eN(e,32,t,e.length),e.length,e.length);t<r&&e[t]===0;)t++;return r===t?0:parseInt(e.slice(t,r).toString(),8)},"decodeOct"),Mc=i(function(e,t,n,r){return e.slice(t,eN(e,0,t,t+n)).toString(r)},"decodeStr"),s_=i(function(e){var t=Buffer.byteLength(e),n=Math.floor(Math.log(t)/Math.log(10))+1;return t+n>=Math.pow(10,n)&&n++,t+n+e},"addLength");Bc.decodeLongPath=function(e,t){return Mc(e,0,e.length,t)};Bc.encodePax=function(e){var t="";e.name&&(t+=s_(" path="+e.name+`
|
|
@@ -676,7 +676,7 @@ ${N}
|
|
|
676
676
|
AUTO-GENERATED FILE \u2014 DO NOT EDIT BY HAND.
|
|
677
677
|
Source: ~/.sandbox/services.yaml + ports.yaml
|
|
678
678
|
+ .sandbox/workspace.yml (feature, services, slot)
|
|
679
|
-
Generator: packages/
|
|
679
|
+
Generator: packages/werkmeister-core/src/claude_md.ts :: buildSandboxContextMd
|
|
680
680
|
Regen: sandbox init-workspace (or \`sandbox up\` after slot changes)
|
|
681
681
|
To change ports/health endpoints/services, edit services.yaml / ports.yaml.
|
|
682
682
|
To change which services run locally, edit .sandbox/workspace.yml and rerun.
|
|
@@ -837,7 +837,7 @@ else {`),this._emit("cb()")),this._emitLine("}")},"compileIf"),n.compileIfAsync=
|
|
|
837
837
|
# Source: sandbox/config/services.yaml (type: graphql-subgraph,
|
|
838
838
|
# k8s_forward_port)
|
|
839
839
|
# + .sandbox/workspace.yml (feature local_services)
|
|
840
|
-
# Generator: packages/
|
|
840
|
+
# Generator: packages/werkmeister-core/src/generate.ts :: generateSupergraphConfig
|
|
841
841
|
# Regen: sandbox up (or \`sandbox init-workspace\`)
|
|
842
842
|
# To add a subgraph: set its \`type: graphql-subgraph\` in services.yaml and rerun.
|
|
843
843
|
# To change endpoint path, set \`graphql_path: /<path>\` on the service (default /graphql).
|
|
@@ -889,7 +889,7 @@ else {`),this._emit("cb()")),this._emitLine("}")},"compileIf"),n.compileIfAsync=
|
|
|
889
889
|
`);for(let h of f)t?ee(` ${b.DIM}[dry-run] Would release slot: ${h}${b.RESET}
|
|
890
890
|
`):(d.push(h),ee(` ${b.GREEN}Released:${b.RESET} ${h}
|
|
891
891
|
`))}}return{activeFeatures:n,activeVolumes:c,orphanedVolumes:l,staleSlots:f,removedVolumes:a,releasedSlots:d}}async function Z0(e){let t=await zt(e);if(t===null)throw new G(`Feature '${e}' is not running (no slot allocated)`,"NOT_RUNNING");return t}async function O7(e){let t=Lr(e);if(t===null)return{workspace:null,handoff:null,decisions:[],graduated:[]};let n=Zm(t);return{workspace:t,handoff:C_(t),decisions:ia(t),graduated:n}}var Poe,u7,joe,_7,S7,Moe,Mr=C(()=>{"use strict";p();s0();vI();ss();Dr();ts();Q();qn();Ms();Kt();fs();P0();bt();Yc();lm();al();oa();it();We();Jf();NS();Jt();ca();i(Y0,"up");i(d7,"prepareSlot");i(p7,"startService");i(h7,"requireSharedNetwork");i(Noe,"readSlotFromWorkspace");i(m7,"readServicesFromWorkspace");i(g7,"requireSecrets");i(x7,"insideOwnContainer");i(ga,"refuseInsideOwnContainer");Poe=new Set(["clear","resume"]);i(z0,"liveSessions");i(Ioe,"otherLiveSessions");i(Loe,"busyReason");i(y7,"idleStopMinutes");i(tk,"lastExecMarker");i(Doe,"mtimeMs");u7="com.sandbox.local.feature",joe="com.docker.compose.project.working_dir";i(Foe,"runningFeatures");i(J0,"stopIdle");i(b7,"idleStopFeature");i(xa,"stop");i(X0,"restart");i(w7,"refusePaused");i(v7,"workspaceOrThrow");_7=i(e=>e.statusCode,"statusOf"),S7=i(e=>e.json?.message??e.message,"daemonMessage");i(Q0,"pause");i(k7,"resume");i(ed,"down");i(E7,"removeService");Moe={generate:i(()=>ha(),"generate"),slots:i(()=>Pt(),"slots"),running:i(()=>Lf(),"running"),reload:i(()=>If(),"reload"),start:i(()=>X_(),"start")};i(si,"reloadProxy");i(Boe,"volumeBaseNames");i(qoe,"listSandboxVolumes");i(Uoe,"featureFromVolume");i(Woe,"classifyVolumes");i($7,"planClean");i(nk,"runClean");i(Z0,"requireSlot");i(O7,"teardownNotes")});var td,T7,ve=C(()=>{"use strict";p();ss();Q();We();Q();td=Be,T7=Dh});import*as eg from"node:fs";import*as pl from"node:path";function rk(e){let t=pl.resolve(e);for(;;){let n=pl.join(t,".env"),r=!1;try{r=eg.statSync(n).isFile()}catch{r=!1}if(r)return n;let s=pl.dirname(t);if(s===t)return null;t=s}}function Ut(e){let t=rk(e);if(!t)return{};let n={};for(let r of eg.readFileSync(t,"utf8").split(/\r?\n/)){if(r=r.trim(),!r||r.startsWith("#")||!r.includes("="))continue;let s=r.indexOf("="),o=r.slice(0,s),a=r.slice(s+1);n[o.trim()]=a.trim()}return n}var to=C(()=>{"use strict";p();i(rk,"findDotenv");i(Ut,"loadDotenv")});import*as A7 from"node:fs";import*as R7 from"node:path";function C7(e){let t=e??Be();if(!A7.existsSync(R7.join(t,".git")))return!1;let n;try{n=W(["git","-C",t,"config","--get","core.hooksPath"],{capture:!0})}catch(s){if(s instanceof X&&s.code==="ENOENT")return I(`git was not found on PATH \u2014 could not check or configure core.hooksPath. The sandbox secret-commit guard (${no}/pre-commit) was NOT installed.`),!1;throw s}let r=n.status===0?n.stdout.trim():"";if(r===no)return!0;if(r)return I(`core.hooksPath is already set to '${r}' \u2014 leaving it unchanged. The sandbox secret-commit guard (${no}/pre-commit) was NOT installed. Run 'git config core.hooksPath ${no}' manually if you want to activate it.`),!1;try{W(["git","-C",t,"config","core.hooksPath",no],{capture:!0,check:!0})}catch(s){let o=s instanceof X&&s.code===void 0&&s.stderr?s.stderr.trim():String(s instanceof Error?s.message:s);return I(`Could not set core.hooksPath to ${no} (${o}). The sandbox secret-commit guard (${no}/pre-commit) was NOT installed.`),!1}return O(`Configuring core.hooksPath -> ${no} (first-time setup)...`),F(`core.hooksPath set to ${no} (secret-commit guard active)`),!0}var no,N7=C(()=>{"use strict";p();Q();it();We();no=".githooks";i(C7,"configureGitHooksPath")});import{spawn as Voe}from"node:child_process";import*as tt from"node:fs";import*as P7 from"node:net";import*as I7 from"node:os";import*as _s from"node:path";function ik(e){return new Promise(t=>setTimeout(t,e*1e3))}async function L7(e){let t;try{t=W(["lsof","-ti",`tcp:${e}`,"-sTCP:LISTEN"],{capture:!0,timeout:5}).stdout}catch(r){if(r instanceof X&&(r.code==="ENOENT"||r.code==="ETIMEDOUT"))return;throw r}let n=t.split(/\s+/).map(r=>r.trim()).filter(r=>/^\d+$/.test(r)).map(r=>Number.parseInt(r,10));for(let r of n)try{process.kill(r,"SIGTERM")}catch{continue}if(n.length!==0){for(let r=0;r<20;r++){if(!await ak(e))return;await ik(.25)}for(let r of n)try{process.kill(r,"SIGKILL")}catch{continue}}}function D7(){let e=U(I7.homedir());return tt.mkdirSync(e,{recursive:!0}),e}function ya(e){return _s.join(D7(),`${e.stem}.pid`)}function Koe(e){return _s.join(D7(),`${e.stem}.log`)}function j7(e){return _s.join(Dh(),"apps",e.dir)}function Hoe(e,t){let n=t.lastIndexOf("/"),r=n>=0?_s.join(e,t.slice(0,n)):e,s=n>=0?t.slice(n+1):t,o=new RegExp("^"+s.split("*").map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$"),a;try{a=tt.readdirSync(r,{withFileTypes:!0})}catch{return[]}return a.filter(c=>o.test(c.name)).map(c=>_s.join(r,c.name))}function Goe(e){let t=j7(e),n=_s.join(t,e.buildRef),r;try{let o=tt.statSync(n);if(!o.isFile())return!0;r=o.mtimeMs}catch{return!0}let s=["*.ts","*.html","package.json","tsconfig*.json","src/*.ts","src/*.css","src/lib/*.ts"];for(let o of s)for(let a of Hoe(t,o))try{if(tt.statSync(a).mtimeMs>r)return!0}catch{continue}return!1}function Yoe(e,t){try{return tt.statSync(t).mtimeMs>tt.statSync(ya(e)).mtimeMs}catch{return!1}}function zoe(e){let t;try{t=tt.readFileSync(ya(e),"utf8")}catch{return null}let n=t.trim();return/^[+-]?\d+$/.test(n)?Number.parseInt(n,10):null}function F7(e){try{process.kill(e,0)}catch(t){let n=t.code;if(n==="ESRCH")return!1;if(n==="EPERM")return!0;throw t}return!0}function ak(e){return new Promise(t=>{let n=P7.connect({host:"127.0.0.1",port:e}),r=i(s=>{n.destroy(),t(s)},"done");n.setTimeout(1e3,()=>r(!1)),n.once("connect",()=>r(!0)),n.once("error",()=>r(!1))})}function ck(e=Ss){let t=zoe(e);return t&&F7(t)?[!0,t]:[!1,null]}async function ro(e=Ss){let[t,n]=ck(e);return{running:t,pid:n,port:e.port,url:`http://localhost:${e.port}/`,healthy:t&&await ak(e.port)}}async function M7(e=Ss,t=!0,n=!1){let[r,s]=ck(e);if(r&&s===process.pid)return F(`${e.label} is this process (pid ${s}); leaving it running`),!0;let o=j7(e),a=e.entry,c=_s.join(o,e.buildRef);if(!tt.existsSync(_s.join(o,"package.json"))){let g=e.bundled?_s.join(Be(),e.bundled):null;if(!g||!tt.existsSync(g))return I(`${e.label} not found at ${o}; skipping`),!1;o=Be(),a=g,c=g,t=!1}let l=!1;if(t&&Goe(e)){O(`Building ${e.label} (sources changed)...`);let g;try{g=W(["pnpm","run","build"],{cwd:o,capture:!0,timeout:300})}catch(x){if(x instanceof X&&x.code==="ENOENT")return I(`pnpm not found; skipping ${e.label}`),!1;if(x instanceof X&&x.code==="ETIMEDOUT")return L(`${e.label} build timed out; skipping`),!1;throw x}if(g.status!==0){let x=(g.stderr.trim()||g.stdout.trim()).slice(-800);return L(`${e.label} build failed; skipping start:
|
|
892
|
-
${x}`),!1}l=!0}else t&&O(`${e.label} build up to date; skipping build`);if(r&&!l&&Yoe(e,c)&&(O(`Running ${e.label} predates the current build; bouncing to reload it.`),n=!0),r&&!l&&!n)return F(`${e.label} already running (pid ${s}, http://localhost:${e.port}/)`),!0;r&&await B7(e),await L7(e.port);let u=Koe(e),f={...process.env,PORT:String(e.port),...e.env??{}};O(`Starting ${e.label} on http://localhost:${e.port}/ ...`);let d=tt.openSync(u,"w"),h=Voe("node",[a],{cwd:o,detached:!0,stdio:["ignore",d,d],env:f}),m=await new Promise(g=>{h.once("spawn",()=>g("spawned")),h.once("error",x=>g(x))});if(tt.closeSync(d),m!=="spawned"){if(m.code==="ENOENT")return I(`node not found; skipping ${e.label}`),!1;throw m}h.unref(),tt.writeFileSync(ya(e),String(h.pid));let y=!1;h.once("exit",()=>{y=!0});for(let g=0;g<20;g++){if(y)return L(`${e.label} exited immediately (see ${u})`),tt.rmSync(ya(e),{force:!0}),!1;if(await ak(e.port))return F(`${e.label} started (pid ${h.pid}, http://localhost:${e.port}/)`),!0;await ik(.25)}return I(`${e.label} started (pid ${h.pid}) but port ${e.port} not up yet; check ${u}`),!0}async function B7(e=Ss){let[t,n]=ck(e);if(!t||n===null)return tt.rmSync(ya(e),{force:!0}),!1;O(`Stopping ${e.label} (pid ${n})...`);try{process.kill(n,"SIGTERM")}catch(s){let o=s.code;if(o==="ESRCH")return tt.rmSync(ya(e),{force:!0}),!1;if(o==="EPERM")return L(`Cannot signal pid ${n} (owned by another user)`),!1;throw s}let r=!1;for(let s=0;s<20;s++){if(!F7(n)){r=!0;break}await ik(.25)}if(!r)try{process.kill(n,"SIGKILL")}catch{}return tt.rmSync(ya(e),{force:!0}),await L7(e.port),F(`${e.label} stopped`),!0}async function Joe(e=Ss,t=!1){await M7(e,t,!0)}async function q7(e=!0){for(let t of ok)await M7(t,e)}async function lk(){for(let e of ok)await B7(e)}async function U7(e=!1){for(let t of ok)await Joe(t,e)}var Ss,sk,ok,hl=C(()=>{"use strict";p();Q();it();We();Ss={label:"Workspaces dashboard",dir:"
|
|
892
|
+
${x}`),!1}l=!0}else t&&O(`${e.label} build up to date; skipping build`);if(r&&!l&&Yoe(e,c)&&(O(`Running ${e.label} predates the current build; bouncing to reload it.`),n=!0),r&&!l&&!n)return F(`${e.label} already running (pid ${s}, http://localhost:${e.port}/)`),!0;r&&await B7(e),await L7(e.port);let u=Koe(e),f={...process.env,PORT:String(e.port),...e.env??{}};O(`Starting ${e.label} on http://localhost:${e.port}/ ...`);let d=tt.openSync(u,"w"),h=Voe("node",[a],{cwd:o,detached:!0,stdio:["ignore",d,d],env:f}),m=await new Promise(g=>{h.once("spawn",()=>g("spawned")),h.once("error",x=>g(x))});if(tt.closeSync(d),m!=="spawned"){if(m.code==="ENOENT")return I(`node not found; skipping ${e.label}`),!1;throw m}h.unref(),tt.writeFileSync(ya(e),String(h.pid));let y=!1;h.once("exit",()=>{y=!0});for(let g=0;g<20;g++){if(y)return L(`${e.label} exited immediately (see ${u})`),tt.rmSync(ya(e),{force:!0}),!1;if(await ak(e.port))return F(`${e.label} started (pid ${h.pid}, http://localhost:${e.port}/)`),!0;await ik(.25)}return I(`${e.label} started (pid ${h.pid}) but port ${e.port} not up yet; check ${u}`),!0}async function B7(e=Ss){let[t,n]=ck(e);if(!t||n===null)return tt.rmSync(ya(e),{force:!0}),!1;O(`Stopping ${e.label} (pid ${n})...`);try{process.kill(n,"SIGTERM")}catch(s){let o=s.code;if(o==="ESRCH")return tt.rmSync(ya(e),{force:!0}),!1;if(o==="EPERM")return L(`Cannot signal pid ${n} (owned by another user)`),!1;throw s}let r=!1;for(let s=0;s<20;s++){if(!F7(n)){r=!0;break}await ik(.25)}if(!r)try{process.kill(n,"SIGKILL")}catch{}return tt.rmSync(ya(e),{force:!0}),await L7(e.port),F(`${e.label} stopped`),!0}async function Joe(e=Ss,t=!1){await M7(e,t,!0)}async function q7(e=!0){for(let t of ok)await M7(t,e)}async function lk(){for(let e of ok)await B7(e)}async function U7(e=!1){for(let t of ok)await Joe(t,e)}var Ss,sk,ok,hl=C(()=>{"use strict";p();Q();it();We();Ss={label:"Workspaces dashboard",dir:"werkmeister-dashboard",port:3001,stem:"mcp-server",entry:"dist/main.js",buildRef:"dist/main.js"},sk={label:"Sandbox MCP server",dir:"werkmeister-mcp",port:3002,stem:"sandbox-mcp",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/mcp.js",env:{HOST:"0.0.0.0"}},ok=[Ss,sk];i(ik,"sleep");i(L7,"freePort");i(D7,"stateDir");i(ya,"pidFile");i(Koe,"logFile");i(j7,"appDir");i(Hoe,"globMatch");i(Goe,"distStale");i(Yoe,"buildNewerThanRunning");i(zoe,"readPid");i(F7,"alive");i(ak,"portOpen");i(ck,"isRunning");i(ro,"status");i(M7,"start");i(B7,"stop");i(Joe,"restart");i(q7,"startAll");i(lk,"stopAll");i(U7,"restartAll")});var H7={};ce(H7,{connectK8s:()=>uk,down:()=>nie,infraHealth:()=>rd,restart:()=>dk,stop:()=>fk,up:()=>nd});import*as ks from"node:fs";import*as V7 from"node:net";import*as K7 from"node:os";import*as tg from"node:path";function Xoe(e){let{argv:t,env:n,cwd:r}=da(),s=[...t,...e];O(`Running: ${s.join(" ")}`);try{let o=W(s,{capture:!0,timeout:120,env:n,cwd:r});return o.status!==0?(L(`docker compose failed:
|
|
893
893
|
${o.stderr.trim()}`),!1):!0}catch(o){if(o instanceof X&&o.code==="ENOENT")return L("docker not found"),!1;if(o instanceof X&&o.code==="ETIMEDOUT")return L("docker compose timed out"),!1;throw o}}function Qoe(){let e=tg.join(Mn(),"corp-ca.crt");if(ks.mkdirSync(tg.dirname(e),{recursive:!0}),(ks.existsSync(e)?ks.readFileSync(e,"utf8"):"").includes("BEGIN CERTIFICATE"))return;if(K7.platform()!=="darwin"){ks.writeFileSync(e,"");return}let n=["goskope","certadmin","Zscaler","Palo Alto"],r=[];for(let o of n){let a=W(["security","find-certificate","-a","-p","-c",o,"/Library/Keychains/System.keychain"],{capture:!0,timeout:5});a.status===0&&a.stdout.includes("BEGIN CERTIFICATE")&&r.push(a.stdout)}let s=r.join("");ks.writeFileSync(e,s),s.includes("BEGIN CERTIFICATE")&&O(`Corporate CA extracted to ${e} (image builds will trust it)`)}async function Zoe(){O("Generating proxy/Caddyfile..."),await ha(),o0(),HS()}async function eie(e){let{argv:t,env:n,cwd:r}=da(),s=t[3];if(!ks.existsSync(s))return I(`Missing ${s}`),!1;O("Starting shared infrastructure (k8s-forwards, caddy, jaeger, redisinsight)...");try{let o=await Ar([...t,"up","-d","--build"],{capture:!0,signal:e,env:n,cwd:r});return o.status!==0?(L(`docker compose failed:
|
|
894
894
|
${o.stderr.trim()}`),!1):(F("Shared infrastructure started"),!0)}catch(o){if(o instanceof X&&o.code==="ABORT_ERR")return I("Shared infrastructure start was cancelled"),!1;if(o instanceof X&&o.code==="ENOENT")return L("docker not found"),!1;throw o}}function tie(e,t,n){return new Promise(r=>{let s=V7.createConnection({host:e,port:t}),o=!1,a=i(c=>{o||(o=!0,s.destroy(),r(c))},"finish");s.setTimeout(n*1e3),s.on("connect",()=>a(!0)),s.on("timeout",()=>a(!1)),s.on("error",()=>a(!1))})}async function W7(){let e={};for(let t of await Yt(gn,void 0,{all:!1})??[])e[t.service||t.name]=t.health==="healthy"||t.state==="running"&&!t.health;if(!Object.keys(e).length){let t=[["redis",9050],["postgres",9051],["caddy",443]];for(let[n,r]of t)e[n]=await tie("127.0.0.1",r,2)}return e}async function nd({signal:e}={}){if(e?.aborted)return I("Infrastructure start was cancelled before it began"),!1;C7(),await Zoe(),Qoe();let t=await eie(e);return await q7(!0),t}async function rd(e){O("Waiting for services to become healthy...");let t=Date.now()+e*1e3,n=await W7();for(;Object.keys(n).length>0&&Object.values(n).some(r=>!r)&&Date.now()<t;)await new Promise(r=>setTimeout(r,3e3)),n=await W7();return n}async function uk(){if((await KS())["k8s-forwards"]??!1)return F("k8s port-forwards container is already healthy"),!0;O("Attempting to start/restart k8s-forwards container...");let e=await L0()!=="failed";return e&&F("k8s port-forwards started"),e}async function nie(e=!1){await lk();let t=["down"];if(e&&t.push("--volumes"),Xoe(t)){let n="Shared infrastructure stopped";e&&(n+=" (volumes removed)"),F(n)}}async function fk(){await lk();let e=await ua("stop",gn);if(e){L(e);return}F("Shared infrastructure stopped (containers preserved, resumable with 'sandbox up infra')")}async function dk(){let e=await ua("restart",gn);e?L(e):F("Shared infrastructure restarted"),await U7()}var ml=C(()=>{"use strict";p();Dr();el();Q();qn();P0();N7();al();i0();it();We();hl();i(Xoe,"composeCmd");i(Qoe,"ensureCorpCa");i(Zoe,"ensureProxyFiles");i(eie,"startSharedInfra");i(tie,"checkPort");i(W7,"checkInfraHealth");i(nd,"up");i(rd,"infraHealth");i(uk,"connectK8s");i(nie,"down");i(fk,"stop");i(dk,"restart")});var pk={};ce(pk,{checkTracker:()=>z7,run:()=>sie,trackerLine:()=>Y7});import*as G7 from"node:readline/promises";function Y7(e,t){return t.ok?` ${b.GREEN}issue tracker \xB7 ${e} \xB7 ok${t.who?` (${t.who})`:""}${b.RESET}`:` ${b.YELLOW}issue tracker \xB7 ${e} \xB7 ${t.reason} \u2014 run: ${t.fix}${b.RESET}`}async function z7(){let e="";try{let t=Te();e=t.label;let n=await t.checkAuth();if(!n.ok&&t.id==="github"&&process.stdin.isTTY){let r=G7.createInterface({input:process.stdin,output:process.stdout}),s=/^y/i.test(await r.question(` GitHub: ${n.reason}. Sign in now? (${n.fix}) [y/N] `));r.close(),s&&(W([Ju(),...n.fix.split(" ").slice(1)],{stdio:"inherit"}),n=await t.checkAuth())}console.log(Y7(t.label,n))}catch(t){console.log(` ${b.YELLOW}issue tracker \xB7 ${e?`${e} \xB7 `:""}check failed: ${t.message}${b.RESET}`)}}async function rie(){console.log(`
|
|
895
895
|
${b.BOLD}=== k8s Connect ===${b.RESET}
|
|
@@ -1141,7 +1141,7 @@ ${Uae}`}]}if(t)return[{label:r,ok:!0,detail:`configured for ${e.email} (run \`sa
|
|
|
1141
1141
|
`):[]}}function ND(e,t){let n=se.mkdtempSync(_e.join(ci.tmpdir(),"werkmeister-crontab-")),r=_e.join(n,"crontab");try{se.writeFileSync(r,t.length?`${t.join(`
|
|
1142
1142
|
`)}
|
|
1143
1143
|
`:"");let[s,o]=e(["crontab",r]);return s===0?null:`crontab write failed: ${Ta(o)}`}finally{se.rmSync(n,{recursive:!0,force:!0})}}function v2(e={}){let t=b2(e);if(t.kind==="launchd"){let s=se.existsSync(t.plist)?se.readFileSync(t.plist,"utf8"):null;return{kind:t.kind,installed:s!==null,current:s===RD(t),where:t.plist,logFile:t.logFile}}let n=w2(t.runner),r="rows"in n?n.rows.filter(bd):[];return{kind:t.kind,installed:r.length>0,current:r.length===1&&r[0]===CD(t),where:"crontab",logFile:t.logFile}}function _2(e={}){let t=b2(e),n=i((c,l)=>({ok:!0,lines:[l?`Installed ${c}.`:`Already installed: ${c}.`,`It runs \`werkmeister pr watch\` every ${y2/60} minutes.`,`Logs: ${t.logFile}`,Yae]}),"done");if(se.mkdirSync(_e.dirname(t.logFile),{recursive:!0}),t.kind==="launchd"){let c=`launchd agent ${t.plist}`,l=RD(t);if(se.existsSync(t.plist)&&se.readFileSync(t.plist,"utf8")===l)return n(c,!1);se.mkdirSync(_e.dirname(t.plist),{recursive:!0}),se.writeFileSync(t.plist,l),t.runner(["launchctl","bootout",`gui/${t.uid}/${jg}`]);let[u,f]=t.runner(["launchctl","bootstrap",`gui/${t.uid}`,t.plist]);return u!==0?{ok:!1,lines:[`launchctl bootstrap failed: ${Ta(f)}`,`${t.plist} is written; re-run to retry.`]}:n(c,!0)}let r=w2(t.runner);if("error"in r)return{ok:!1,lines:[r.error]};let s=CD(t),o=r.rows.filter(bd);if(o.length===1&&o[0]===s)return n("crontab line",!1);let a=ND(t.runner,[...r.rows.filter(c=>!bd(c)),s]);return a?{ok:!1,lines:[a]}:n("crontab line",!0)}function PD(e={}){let t=b2(e),n={ok:!0,lines:["No PR watch schedule installed."]};if(t.kind==="launchd")return se.existsSync(t.plist)?(t.runner(["launchctl","bootout",`gui/${t.uid}/${jg}`]),se.rmSync(t.plist,{force:!0}),{ok:!0,lines:[`Removed launchd agent ${t.plist}.`]}):n;let r=w2(t.runner);if("error"in r)return{ok:!1,lines:[r.error]};if(!r.rows.some(bd))return n;let s=ND(t.runner,r.rows.filter(o=>!bd(o)));return s?{ok:!1,lines:[s]}:{ok:!0,lines:["Removed the crontab line."]}}function zae(e,t,n={}){let r="PR watch schedule (optional)";if(t&&!e){let a=_2(n);if(!a.ok)return[{label:r,ok:!1,optional:!0,detail:a.lines.join(" ")}]}let s=v2(n);if(!s.installed)return[{label:r,ok:!0,detail:"not installed (opt in via `werkmeister setup` or `werkmeister pr watch --install`)"}];let o=s.current?"":"; stale \u2014 re-run `werkmeister setup`";return[{label:r,ok:!0,detail:`installed (${s.where}), logs \u2192 ${s.logFile}${o}`}]}function Fg(e=li,t=Be()){let[n,r]=e(["code","--list-extensions","--show-versions"]),s=`${p2}@`,o=n===0?r.split(`
|
|
1144
|
-
`).find(c=>c.trim().toLowerCase().startsWith(s)):void 0,a=_e.join(t,Jae);return{cli:n===0,installed:o?o.trim().slice(s.length):null,bundled:se.existsSync(a)?{path:a,version:h2(_e.join(t,"package.json"))?.version}:null}}function Xae(e,t,n=Fg(),r=li){let s="VS Code extension (optional)";if(!n.cli)return[{label:s,ok:!0,detail:"`code` not on PATH \u2014 skipped (in VS Code: \"Shell Command: Install 'code' command in PATH\")"}];if(!n.bundled)return[{label:s,ok:!0,detail:`${n.installed??"not installed"}; running from a checkout, which bundles no .vsix \u2014 build it from packages/vscode
|
|
1144
|
+
`).find(c=>c.trim().toLowerCase().startsWith(s)):void 0,a=_e.join(t,Jae);return{cli:n===0,installed:o?o.trim().slice(s.length):null,bundled:se.existsSync(a)?{path:a,version:h2(_e.join(t,"package.json"))?.version}:null}}function Xae(e,t,n=Fg(),r=li){let s="VS Code extension (optional)";if(!n.cli)return[{label:s,ok:!0,detail:"`code` not on PATH \u2014 skipped (in VS Code: \"Shell Command: Install 'code' command in PATH\")"}];if(!n.bundled)return[{label:s,ok:!0,detail:`${n.installed??"not installed"}; running from a checkout, which bundles no .vsix \u2014 build it from packages/werkmeister-vscode`}];let o=n.bundled.version;if(n.installed===o)return[{label:s,ok:!0,detail:`${p2} ${o}`}];if(e||!t)return n.installed?[{label:s,ok:!1,optional:!0,detail:`${n.installed} < bundled ${o} \u2014 re-run \`sandbox setup\``}]:[{label:s,ok:!0,detail:"not installed (opt in via `sandbox setup`)"}];let[a,c]=r(["code","--install-extension",n.bundled.path,"--force"]);return a!==0?[{label:s,ok:!1,optional:!0,detail:`code --install-extension failed: ${Ta(c)}`}]:[{label:s,ok:!0,detail:`installed ${p2} ${o} \u2014 reload VS Code windows to pick it up`}]}function Qae(e,t,n={}){let r="telepresence (optional)",s=ni.join("."),o=i(()=>{let[w,S]=e(["telepresence","version"]);if(w!==0)return[null,null];let v=K0(S);return v===null?[{label:r,ok:!1,optional:!0,detail:`version unparseable: ${S.slice(0,80)}`},null]:[null,v]},"probe"),[a,c]=o();if(a)return[a];if(c&&!Zf(c,ni))return[{label:r,ok:!0,detail:`OSS client ${c.join(".")}`}];let l=c!==null,u=l?`${c.join(".")} < required ${s}`:"not installed";if(t||!n.install)return l?[{label:r,ok:!1,optional:!0,detail:`${u} \u2014 ${ma}`}]:[{label:r,ok:!0,detail:`not installed (needed only for \`sandbox intercept\`; ${ma})`}];let[f]=e(["brew","--version"]);if(f!==0)return[{label:r,ok:!l,optional:!0,detail:`${u}; Homebrew not found \u2014 ${ll}`}];let d=l?"upgrade":"install",[h,m]=e(["brew",d,Qf]);if(h!==0)return[{label:r,ok:!1,optional:!0,detail:`brew ${d} ${Qf} failed: ${Ta(m)}
|
|
1145
1145
|
Telepresence stays optional \u2014 this does not block anything except \`sandbox intercept\`. Install manually with: ${ll}`}];let[y,g]=o();if(y)return[y];if(g===null)return[{label:r,ok:!1,optional:!0,detail:`brew ${d} reported success but telepresence is not on PATH`}];let x=g.join(".");return Zf(g,ni)?[{label:r,ok:!1,optional:!0,detail:`brew installed ${x}, still < required ${s} \u2014 ${ll}`}]:[{label:r,ok:!0,detail:`installed OSS client ${x} via brew`}]}function Zae(e,t,n){let r="playwright chromium (optional)",s=`playwright@${uo}`,o="",a=i(()=>{let[f,d]=e(["npx","-y",s,"install","--dry-run","chromium"]);o=d;let h=[...d.matchAll(/Install location:\s*(\S.*)$/gm)].map(m=>m[1].trim());return f!==0||h.length===0?null:h.filter(m=>!se.existsSync(_e.join(m,"INSTALLATION_COMPLETE")))},"missingDirs"),c=a();if(c===null)return[{label:r,ok:!1,optional:!0,detail:`\`npx ${s} install --dry-run chromium\` failed: ${Ta(o)}`}];if(c.length===0)return[{label:r,ok:!0,detail:`chromium for ${s} present`}];if(t)return[{label:r,ok:!1,optional:!0,detail:`chromium for ${s} missing \u2014 re-run \`sandbox setup\``}];let l=(n??$D)(["npx","-y",s,"install","chromium"]),u=a();if(l!==0||u===null||u.length>0){let f=l!==0?`exited ${l}`:"finished, but the browser is still not reported installed";return[{label:r,ok:!1,optional:!0,detail:`\`npx ${s} install chromium\` ${f} \u2014 run it manually to see why`}]}return[{label:r,ok:!0,detail:`installed chromium for ${s}`}]}async function S2(e={}){let t=e.checkOnly??!1,n=e.reposRoot??or(),r=e.claudePluginsDir??_e.join(ci.homedir(),".claude","plugins"),s=e.repoPluginDir??_e.join(Be(),"plugins",Dt),o=e.runner??li,a=e.jira??Ws(),c=[],l=e.pathDirs??{repos_root:Ec().repos_root,workspaces_root:Ec().workspaces_root};c.push(...Dae(t,l)),c.push(...Fae(t,e.registry??{}));let[u]=o(["claude","--version"]);if(u===127)c.push({label:"claude CLI",ok:!1,detail:`not found on PATH \u2014 the ${Dt} and ponytail plugins cannot be installed without it. Install Claude Code from https://claude.com/claude-code (the VS Code extension alone does not put \`claude\` on PATH), then re-run \`sandbox setup\`.`});else{for(let h of Oae){let m=null;h.name===Dt&&(m=i(()=>Lg(s,r),"driftProbe"));let y=TD(h,r,o,t,m);c.push(...y),h.name===Dt&&(t||y.every(g=>g.ok))&&c.push(...Tae(r,o,t))}for(let h of Aae)c.push(...Lae(h,r,o,t,e.installOptionalPlugins??!1))}let f=e.workspaceRepo??(Hu()||Cae(o));f?c.push(...wD(n,Pae(f),o,t)):c.push({label:`repo ${Kr}`,ok:!1,optional:!0,detail:"no workspace repo configured and `gh` could not name one \u2014 set overrides.workspace_repo (or run `gh auth login`, then `sandbox setup`). Workspaces will fall back to plain directories."}),(e.demo||se.existsSync(_e.join(n,ED)))&&c.push(...wD(n,Iae,o,t)),c.push(...yg({reposRoot:n,checkOnly:t}));let d=typeof e.hostnames=="function"?e.hostnames():e.hostnames??[];return c.push(...Bae(t,{hostnames:d,ingress:e.ingress??void 0,skipSudo:e.skipSudo},e.interactiveRunner)),c.push(...await Vae(a,t,e.jiraVerifier)),c.push(...Qae(o,t,{install:e.installTelepresence})),c.push(...Zae(o,t,e.interactiveRunner)),c.push(...Hae(t,e.mapEditorSchemas??!1)),c.push(...Gae(t,e.grantStandardsDir??!1)),c.push(...Xae(t,e.installVscodeExtension??!1,Fg(o),o)),c.push(...zae(t,e.installPrWatch??!1,{runner:o})),c}var Oae,Oa,Aae,Kr,_D,ED,Nae,Pae,Iae,jae,vD,qae,Uae,Kae,jg,AD,y2,Yae,Dg,d2,bd,p2,Jae,Mg=C(()=>{"use strict";p();lD();Q();bt();Kw();u2();it();ai();Uk();dl();f2();i(Ta,"briefOutput");Oae=[{name:"werkmeister",marketplace:"werkmeister",source:"jbbz-sandbox/werkmeister@main"},{name:"ponytail",marketplace:"ponytail",source:"DietrichGebert/ponytail"}],Oa={name:Ig,marketplace:"sandbox",source:"jbbz-sandbox/werkmeister@main"};i(Tae,"retireLegacyPlugin");Aae=[{name:"superpowers",marketplace:"claude-plugins-official",source:"anthropics/claude-plugins-official",note:"brainstorming/planning skills; writes plans under docs/superpowers/"}],Kr="sandbox-workspace";i(Rae,"workspaceRepoUrl");_D=i(e=>/^[A-Za-z0-9-]+$/.test(e),"isLogin");i(SD,"githubUser");i(kD,"githubOwners");i(Cae,"defaultWorkspaceRepo");ED="demo-services",Nae="git@github.com:jbbz-sandbox/demo-services.git",Pae=i(e=>({name:Kr,url:Rae(e),missingConsequence:"Workspaces will fall back to plain directories."}),"workspaceRootSpec"),Iae={name:ED,url:Nae,missingConsequence:"The demo backend/frontend services will not start until it is cloned there."};i(li,"defaultRunner");i($D,"defaultInteractiveRunner");i(h2,"readJson");i(OD,"knownMarketplaces");i(m2,"installedVersion");i(TD,"syncPlugin");i(Lae,"syncOptionalPlugin");i(wD,"syncRepo");i(Dae,"syncPathDirs");jae=_e.join("infra","config");i(Fae,"syncRegistryConfigs");i(Mae,"resolveCertScript");i(Bae,"syncIngressCerts");vD="https://id.atlassian.com/manage-profile/security/api-tokens",qae=["base_url","email","api_token"],Uae=`jira:
|
|
1146
1146
|
base_url: https://your-org.atlassian.net
|
|
1147
1147
|
email: <your-atlassian-login-email>
|
|
@@ -1348,7 +1348,7 @@ ${b.BOLD}--- Usage vs Configured Limits ---${b.RESET}
|
|
|
1348
1348
|
`);let s=` ${b.BOLD}${"Service".padEnd(30)} ${"Max Mem".padStart(8)} ${"Limit".padStart(8)} ${"CPU Lim".padStart(7)} ${"Usage".padStart(7)} ${"Status".padEnd(20)}${b.RESET}`;console.log(s),console.log(` ${"\u2500".repeat(91)}`);for(let a of r.usage)console.log(` ${a.container.padEnd(30)} ${fi(a.maxMemMib).padStart(8)} ${(a.limit??"n/a").padStart(8)} ${(a.cpuLimit??"n/a").padStart(7)} ${a.usagePct.toFixed(0).padStart(6)}% ${Mxe[a.status]}`);console.log();let o=r.usage.filter(a=>a.status==="risk"||a.status==="over_provisioned");if(o.length){console.log(`${b.BOLD}--- Recommendations ---${b.RESET}
|
|
1349
1349
|
`);for(let a of o)a.status==="risk"?console.log(` ${b.RED}! ${a.container}${b.RESET}: Using ${a.usagePct.toFixed(0)}% of memory limit. Consider increasing to avoid OOM kills.`):console.log(` ${b.CYAN}~ ${a.container}${b.RESET}: Only using ${a.usagePct.toFixed(0)}% of memory limit. Could reduce limit to free resources.`);console.log()}if(r.recommendations.length){console.log(`${b.BOLD}--- Data-Driven Limit Recommendations ---${b.RESET}
|
|
1350
1350
|
`),console.log(` ${b.DIM}Based on observed max usage + 50% headroom:${b.RESET}
|
|
1351
|
-
`);for(let a of r.recommendations)console.log(` ${a.name.padEnd(30)} cpus: ${a.recommended_cpus.padStart(5)} memory: ${a.recommended_memory.padStart(5)}`);console.log(),console.log(` ${b.DIM}To update: edit config/services.yaml (memory_limit, memory_reservation, cpus)${b.RESET}`),console.log(` ${b.DIM}For shared infra: edit compose/shared-infra.yml (deploy.resources)${b.RESET}`)}console.log()}var Mxe,_U=C(()=>{"use strict";p();Y2();ve();Mxe={risk:`${b.RED}RISK - near limit${b.RESET}`,moderate:`${b.YELLOW}OK - moderate${b.RESET}`,over_provisioned:`${b.CYAN}OVER-PROVISIONED${b.RESET}`,ok:`${b.GREEN}OK${b.RESET}`,no_limit:`${b.DIM}no limit set${b.RESET}`};i(Bxe,"run")});var SU={};ce(SU,{run:()=>Uxe});function qxe(e){console.log(`${b.RED}\u2717 ${e}${b.RESET}`)}async function Uxe(e){let t=Pr(process.cwd());t===null&&(L("Not inside a sandbox workspace (no .sandbox/ directory found above CWD)."),process.exit(1));let n=Jo(t);if(e.action==="sync"){n.sync(t);return}let r=n.check(t);for(let s of r)qxe(s);r.length&&(console.log(`${b.YELLOW}Context layer lags the sandbox repo \u2014 run \`sandbox skills sync\` (or \`sandbox init-workspace\`) to refresh.${b.RESET}`),process.exit(1)),F(`Context layer fresh (${n.id}).`)}var kU=C(()=>{"use strict";p();sa();ca();ve();i(qxe,"printDrift");i(Uxe,"run")});var EU={};ce(EU,{run:()=>Wxe});async function Wxe(e){let{dir:t,moduleCount:n,errors:r}=v8();if(r.length){if(!n)L(r[0]);else{L(`${t} has ${r.length} problem(s):`);for(let s of r)O(` - ${s}`)}process.exit(1)}F(`${t} is well-formed (${n} standard module(s) checked).`)}var $U=C(()=>{"use strict";p();Cr();ve();i(Wxe,"run")});var OU={};ce(OU,{run:()=>Vxe});async function Vxe(e){if(e.action==="pr-guard"){zP();return}if(e.action==="agent-state"){nI();return}if(e.action!=="gate")return;let t;try{t=Jo(Pr(process.cwd())??process.cwd())}catch{return}t.gate()}var TU=C(()=>{"use strict";p();s0();sa();Af();ca();i(Vxe,"run")});var RU={};ce(RU,{readStdinTask:()=>Ey,run:()=>Kxe});import*as AU from"node:fs";function Ey(){if(process.stdin.isTTY)return"";try{return AU.readFileSync(0,"utf8")}catch{return""}}async function Kxe(e){try{await E2(e,void 0,{readStdinTask:Ey})}catch(t){throw t instanceof _d&&(console.log(t.message),process.exit(1)),t instanceof wn&&process.exit(1),t}}var rO=C(()=>{"use strict";p();Bg();i(Ey,"readStdinTask");i(Kxe,"run")});var IU={};ce(IU,{browserFormCommand:()=>PU,resolveWorkspaceInputs:()=>NU,run:()=>Xxe});import*as Ei from"node:fs";import*as es from"node:path";function Hxe(e){let t=es.relative(qs(),es.resolve(e));return t!==""&&!t.startsWith("..")&&!es.isAbsolute(t)}function CU(e){let t=i(n=>(n??"").split(",").filter(r=>r.trim()),"list");return sd({services:t(e.services),repos:t(e.repos)})}async function NU(e){let t=process.cwd(),n=Wi(e,t),r,s=new Set(Object.keys(n));if(process.stdin.isTTY){let o=yl(Zw(t,n,{defaults:Hxe(t)}));n=await Xq(o,n,{intro:"Interactive wizard \u2014 press Ctrl-C to abort. Defaults shown in [brackets]; leave a field blank to skip it.",afterField:i(async(c,l)=>{if(c!=="issue_id"||!l.issue_id||s.has("issue_id"))return{};let u=Te(),f=u.parseRef(l.issue_id);if(!f)throw new K(`${l.issue_id} isn't a ${u.label} issue ref (e.g. ${u.refExample})`);l.issue_id=f;try{r=await _l(f)}catch{throw new K(`couldn't read ${f} from ${u.label}; run \`sandbox connect\` to check the issue tracker.`)}if(e.no_distill)return{task:r.title};let{fields:d,warning:h}=await Vg(r);return h&&O(`Issue read; fields not pre-filled: ${h}`),{task:r.title,...d}},"afterField")});let a=_y(o).filter(c=>c.key==="services"||c.key==="repos");for(let c=CU(n);c;c=CU(n)){if(!a.length)throw new K(c);I(c);for(let l of a)await Sy(l,n)}}return{resolved:n,issue:r}}function Gxe(e){let t=(process.env.PATH||"").split(es.delimiter);for(let n of t){if(!n)continue;let r=es.join(n,e);try{return Ei.accessSync(r,Ei.constants.X_OK),r}catch{}}return null}function PU(e,t,n){let r=Object.fromEntries(Yxe.filter(o=>n[o]!=null&&n[o]!=="").map(o=>[o,zxe.has(o)?String(n[o]).split(",").map(a=>a.trim()).filter(Boolean):n[o]])),s=[e,t];return Object.keys(r).length&&s.push("--prefill",JSON.stringify(r)),n.issue_id&&s.push("--issue",String(n.issue_id)),n.open_vscode&&s.push("--open"),s}function Jxe(e){let t=es.join(T7(),"apps","
|
|
1351
|
+
`);for(let a of r.recommendations)console.log(` ${a.name.padEnd(30)} cpus: ${a.recommended_cpus.padStart(5)} memory: ${a.recommended_memory.padStart(5)}`);console.log(),console.log(` ${b.DIM}To update: edit config/services.yaml (memory_limit, memory_reservation, cpus)${b.RESET}`),console.log(` ${b.DIM}For shared infra: edit compose/shared-infra.yml (deploy.resources)${b.RESET}`)}console.log()}var Mxe,_U=C(()=>{"use strict";p();Y2();ve();Mxe={risk:`${b.RED}RISK - near limit${b.RESET}`,moderate:`${b.YELLOW}OK - moderate${b.RESET}`,over_provisioned:`${b.CYAN}OVER-PROVISIONED${b.RESET}`,ok:`${b.GREEN}OK${b.RESET}`,no_limit:`${b.DIM}no limit set${b.RESET}`};i(Bxe,"run")});var SU={};ce(SU,{run:()=>Uxe});function qxe(e){console.log(`${b.RED}\u2717 ${e}${b.RESET}`)}async function Uxe(e){let t=Pr(process.cwd());t===null&&(L("Not inside a sandbox workspace (no .sandbox/ directory found above CWD)."),process.exit(1));let n=Jo(t);if(e.action==="sync"){n.sync(t);return}let r=n.check(t);for(let s of r)qxe(s);r.length&&(console.log(`${b.YELLOW}Context layer lags the sandbox repo \u2014 run \`sandbox skills sync\` (or \`sandbox init-workspace\`) to refresh.${b.RESET}`),process.exit(1)),F(`Context layer fresh (${n.id}).`)}var kU=C(()=>{"use strict";p();sa();ca();ve();i(qxe,"printDrift");i(Uxe,"run")});var EU={};ce(EU,{run:()=>Wxe});async function Wxe(e){let{dir:t,moduleCount:n,errors:r}=v8();if(r.length){if(!n)L(r[0]);else{L(`${t} has ${r.length} problem(s):`);for(let s of r)O(` - ${s}`)}process.exit(1)}F(`${t} is well-formed (${n} standard module(s) checked).`)}var $U=C(()=>{"use strict";p();Cr();ve();i(Wxe,"run")});var OU={};ce(OU,{run:()=>Vxe});async function Vxe(e){if(e.action==="pr-guard"){zP();return}if(e.action==="agent-state"){nI();return}if(e.action!=="gate")return;let t;try{t=Jo(Pr(process.cwd())??process.cwd())}catch{return}t.gate()}var TU=C(()=>{"use strict";p();s0();sa();Af();ca();i(Vxe,"run")});var RU={};ce(RU,{readStdinTask:()=>Ey,run:()=>Kxe});import*as AU from"node:fs";function Ey(){if(process.stdin.isTTY)return"";try{return AU.readFileSync(0,"utf8")}catch{return""}}async function Kxe(e){try{await E2(e,void 0,{readStdinTask:Ey})}catch(t){throw t instanceof _d&&(console.log(t.message),process.exit(1)),t instanceof wn&&process.exit(1),t}}var rO=C(()=>{"use strict";p();Bg();i(Ey,"readStdinTask");i(Kxe,"run")});var IU={};ce(IU,{browserFormCommand:()=>PU,resolveWorkspaceInputs:()=>NU,run:()=>Xxe});import*as Ei from"node:fs";import*as es from"node:path";function Hxe(e){let t=es.relative(qs(),es.resolve(e));return t!==""&&!t.startsWith("..")&&!es.isAbsolute(t)}function CU(e){let t=i(n=>(n??"").split(",").filter(r=>r.trim()),"list");return sd({services:t(e.services),repos:t(e.repos)})}async function NU(e){let t=process.cwd(),n=Wi(e,t),r,s=new Set(Object.keys(n));if(process.stdin.isTTY){let o=yl(Zw(t,n,{defaults:Hxe(t)}));n=await Xq(o,n,{intro:"Interactive wizard \u2014 press Ctrl-C to abort. Defaults shown in [brackets]; leave a field blank to skip it.",afterField:i(async(c,l)=>{if(c!=="issue_id"||!l.issue_id||s.has("issue_id"))return{};let u=Te(),f=u.parseRef(l.issue_id);if(!f)throw new K(`${l.issue_id} isn't a ${u.label} issue ref (e.g. ${u.refExample})`);l.issue_id=f;try{r=await _l(f)}catch{throw new K(`couldn't read ${f} from ${u.label}; run \`sandbox connect\` to check the issue tracker.`)}if(e.no_distill)return{task:r.title};let{fields:d,warning:h}=await Vg(r);return h&&O(`Issue read; fields not pre-filled: ${h}`),{task:r.title,...d}},"afterField")});let a=_y(o).filter(c=>c.key==="services"||c.key==="repos");for(let c=CU(n);c;c=CU(n)){if(!a.length)throw new K(c);I(c);for(let l of a)await Sy(l,n)}}return{resolved:n,issue:r}}function Gxe(e){let t=(process.env.PATH||"").split(es.delimiter);for(let n of t){if(!n)continue;let r=es.join(n,e);try{return Ei.accessSync(r,Ei.constants.X_OK),r}catch{}}return null}function PU(e,t,n){let r=Object.fromEntries(Yxe.filter(o=>n[o]!=null&&n[o]!=="").map(o=>[o,zxe.has(o)?String(n[o]).split(",").map(a=>a.trim()).filter(Boolean):n[o]])),s=[e,t];return Object.keys(r).length&&s.push("--prefill",JSON.stringify(r)),n.issue_id&&s.push("--issue",String(n.issue_id)),n.open_vscode&&s.push("--open"),s}function Jxe(e){let t=es.join(T7(),"apps","werkmeister-dashboard","dist","form-cli.js");Ei.existsSync(t)&&Ei.statSync(t).isFile()||(L(`Browser form not built: ${t} is missing. Run \`npm --prefix apps/werkmeister-dashboard run build\` (or \`sandbox dashboard\` once) first.`),process.exit(1));let n=Gxe("node");n||(L("`node` not found on PATH \u2014 the browser form requires Node.js."),process.exit(1));let r=PU(n,t,e),s=W(r,{stdio:"inherit"});process.exit(s.status)}async function Xxe(e){if(e.browser_form){Jxe(e);return}try{let{resolved:t,issue:n}=await NU(e);await F2(t,{live:!0,open:!!e.open_vscode,cwd:process.cwd(),issue:n,distill:e.no_distill||n?!1:void 0,readStdinTask:Ey,force:!!e.force})}catch(t){throw t instanceof wn&&process.exit(1),t instanceof K&&(L(t.message),process.exit(1)),t}}var Yxe,zxe,LU=C(()=>{"use strict";p();Wr();Q();od();hg();pn();it();Bg();hn();ve();rc();rO();i(Hxe,"insideWorkspacesRoot");i(CU,"wizardRepoError");i(NU,"resolveWorkspaceInputs");i(Gxe,"which");Yxe=["feature","issue_id","services","repos","labels","task","test_path","description","starting_prompt","work_type","context_strategy","autonomous","model","auto_stop"],zxe=new Set(["services","repos"]);i(PU,"browserFormCommand");i(Jxe,"runBrowserForm");i(Xxe,"run")});var DU={};ce(DU,{run:()=>Qxe});async function Qxe(e){let{root:t,workspaces:n}=await kl();if(console.log(`
|
|
1352
1352
|
${b.BOLD}=== Workspaces in ${t} ===${b.RESET}
|
|
1353
1353
|
`),!n.length){console.log(` ${b.DIM}No workspaces. Create one with: sandbox workspace <feature>${b.RESET}
|
|
1354
1354
|
`);return}console.log(` ${b.BOLD}${"Workspace".padEnd(32)} ${"Issue".padEnd(12)} Labels${b.RESET}`),console.log(` ${"\u2500".repeat(70)}`);for(let{name:r,issueId:s,labels:o}of n){let a=s?s.padEnd(12):`${b.DIM}--${b.RESET}${" ".repeat(10)}`;console.log(` ${r.padEnd(32)} ${a} ${b.DIM}${o.join(", ")}${b.RESET}`)}console.log(),console.log(` ${b.DIM}End one with: sandbox close-out <name>${b.RESET}`),console.log()}var jU=C(()=>{"use strict";p();Wr();ve();i(Qxe,"run")});var UU={};ce(UU,{newIssueFromArgs:()=>qU,run:()=>Zxe,updateFromArgs:()=>BU});import*as MU from"node:fs";function BU(e){let t=e.status||void 0,n=e.comment||void 0;return!t&&!n?"Nothing to update: pass --status <name> and/or --comment <text>.":{status:t,comment:n}}function qU(e,t=n=>MU.readFileSync(n,"utf8")){let n=(e.project??"").trim().toUpperCase(),r=e.type??"",s=(e.title??"").trim(),o=e.bodyFile??"";if(!n)return"Pass --project <key> (the Jira project to file in).";if(!FU.includes(r))return`Pass --type ${FU.join("|")} (got '${r}').`;if(!s)return"Pass --title <text>.";if(!o)return"Pass --body-file <path> (or - for stdin).";let a;try{a=t(o==="-"?0:o)}catch(c){return`Could not read --body-file ${o}: ${c.message}`}return{project:n,type:r,title:s,body:a}}function Is(e){L(e),process.exit(1)}async function Zxe(e){let t=Te();if(e.action==="create"){t.createIssue||Is(`${t.label} issues are filed with its own CLI: gh issue create -R <owner>/<repo>.`);let a=qU(e);typeof a=="string"&&Is(a);try{let c=await t.createIssue(a);F(`Created ${c.ref} (${c.type}).`),console.log(c.url??c.ref)}catch(c){Is(`Could not create the issue in ${a.project}: ${c.message}`)}return}if(e.action==="start"){let a=Pr(process.cwd());a===null&&Is("Not inside a sandbox workspace (no .sandbox/ directory found above CWD).");let c=await I5(a)||"left as is (no in_progress status configured)";(c.includes("not moved")?I:F)(`Issue: ${c}`);return}let n=e.action==="update"?BU(e):null;typeof n=="string"&&Is(n);let r=e.ref??"";if(!r){let a=Pr(process.cwd());a===null&&Is("No issue given and not inside a sandbox workspace (no .sandbox/ directory found above CWD)."),r=cr(Ct(a,null)),r||Is("No issue given and this workspace has no issue (issue_id in .sandbox/workspace.yml).")}let s=t.parseRef(r);if(s||Is(`'${r}' is not a ${t.label} issue ID (e.g. ${t.refExample}).`),n){try{await t.updateIssue(s,n)}catch(c){Is(`Could not update ${s}: ${c.message}`)}let a=[n.status&&`status \u2192 ${n.status}`,n.comment&&"comment added"].filter(Boolean);F(`Updated ${s}: ${a.join(", ")}.`);return}let o=await t.fetchIssue(s);o||Is(`Could not read ${s} from ${t.label}.`),console.log(e.json?JSON.stringify(o,null,2):Rc(o))}var FU,WU=C(()=>{"use strict";p();sa();Bk();pn();hn();ve();i(BU,"updateFromArgs");FU=["bug","feature","task"];i(qU,"newIssueFromArgs");i(Is,"fail");i(Zxe,"run")});var VU={};ce(VU,{run:()=>eye});async function eye(e){let t=e.name;if(I('sandbox remove-workspace is deprecated \u2014 use `sandbox close-out --abandon "<reason>"`'),console.log(`
|
|
@@ -1361,7 +1361,7 @@ ${b.BOLD}=== sandbox close-out: ${n} ===${b.RESET}
|
|
|
1361
1361
|
`),!e.yes&&(console.log(` ${b.DIM}${r===null?"Closes the issue, writes closeout.md, removes the workspace, and deletes merged code branches.":"Records the reason in closeout.md, pushes every branch and keeps them, then removes the workspace."}${b.RESET}`),!await Wt(r===null?`Close out and remove '${n}'?`:`Abandon and remove '${n}'?`,!1))){O("Aborted -- nothing changed.");return}let s=r===null?await dd(n):await dd(n,{abandon:r});console.log(s.output),console.log(`
|
|
1362
1362
|
${b.GREEN}${b.BOLD}Workspace '${n}' closed out${b.RESET}`),console.log(` ${b.DIM}Archive this workspace's desktop sessions from the Claude sidebar.${b.RESET}
|
|
1363
1363
|
`)}var zU=C(()=>{"use strict";p();Wr();Af();ve();rc();i(rye,"run")});var JU={};ce(JU,{run:()=>sye});async function sye(e){let t=e.feature||Ut(process.cwd()).FEATURE;t||(L("Feature name required: pass it as an argument or set FEATURE in a .env file."),process.exit(1));let{path:n}=await B2(t);console.log(`${b.GREEN}Opened '${t}' in VS Code${b.RESET} ${b.DIM}${n}${b.RESET}`)}var XU=C(()=>{"use strict";p();Wr();ve();to();i(sye,"run")});var tW={};ce(tW,{run:()=>iye});import*as oO from"node:fs";import*as eW from"node:path";function Er(e){console.log(`
|
|
1364
|
-
${b.BOLD}${e}${b.RESET}`)}async function oye(e){let t=Ze(),n=as(t);Er("1. Paths & the workspace repo");let r={},s=i(z=>Bh(z.key,t,r),"pathDefault");if(e)await ki(kc,r,s,{intro:"Where your repos and per-feature workspaces live. Defaults in [brackets]."});else for(let z of kc)r[z.key]=s(z),O(` ${z.key}: ${r[z.key]}`);let o=kD();o.length||I(" `gh` could not name your GitHub account, so these are not prefilled \u2014 run `gh auth login` and re-run to pick from your orgs, or type them by hand.");let a=i((z,sc)=>sc.length?{...z,choicesFn:i(()=>sc,"choicesFn")}:z,"withChoices"),c={},l=[a(ER,o.map(z=>`${z}/${Kr}`)),a(OR,o)],u=i(z=>z.key==="workspace_repo"?Hu(t)||(o[0]?`${o[0]}/${Kr}`:""):t.overrides?.github_org||(c.workspace_repo??"").split("/")[0]||"","ghDefault");if(e)await ki(l,c,u,{intro:"GitHub locations. The workspace repo hosts the per-workspace configs at the root of every feature workspace \u2014 enter a shared <org>/sandbox-workspace to share them with your team, or keep your own."});else for(let z of l)c[z.key]=u(z),O(` ${z.key}: ${c[z.key]||"(unset \u2014 `gh` named no user)"}`);Er("2. Browser");let f={},d=i(()=>t.overrides?.browser||cd,"browserDefault");e?await ki([T5],f,d,{intro:"Which browser `sandbox open` launches."}):(f.browser=d(),O(` browser: ${f.browser}`)),so[f.browser]?.engine!=="chromium"&&f.browser!=="safari"&&I(` ${so[f.browser].label} isn't wired up yet -- \`sandbox open\` will error until it's picked to chrome/chromium/brave/edge/safari.`),Er("3. Ingress");let h={},m=i(z=>String(n[z.key]??""),"ingressDefault");if(e)await ki(jw,h,m,{intro:"Public hostnames Caddy terminates. Each routed service is served at <service>.<domain>; these domains also drive the TLS certificate and your /etc/hosts entries."});else for(let z of jw)h[z.key]=m(z),O(` ${z.key}: ${h[z.key]}`);Er("4. Service registry");let y=Bs(),g=yt(r.repos_root),x=!1,w=Hk(y)??"orbstack",S=[];try{S=ii(g).map(z=>z.repo)}catch{}S.length?O(`${y} will be generated from ${S.length} repo fragment(s): ${S.join(", ")}.`):(O(`No <repo>/${fd} found under ${g}.`),O("Clone your team's repos there and re-run `sandbox setup`, or try the demo apps.")),S.includes("demo-services")||(x=await Wt(" Clone the demo apps (backend, frontend) so there is something to run?",!1,e)),!oO.existsSync(is())&&e&&(w=await nu("Kube context for `sandbox intercept` (services.local.yaml k8s_context)",w)),Er("5. Issue tracker");let v={},E=i(()=>Ui(t),"trackerDefault");e?await ki([{key:"issue_tracker",label:"Issue tracker",help:"Where workspace issues come from and where agents file existing bugs. "+qi.map(z=>`${z}: ${Yw(z).label} (e.g. ${Yw(z).refExample})`).join("; ")+".",acceptEmpty:!1,pattern:`(${qi.join("|")})`,choicesFn:i(()=>[...qi],"choicesFn")}],v,E):(v.issue_tracker=E(),O(` issue_tracker: ${v.issue_tracker}`));let k={...Ws()},A=!!(k.base_url&&k.email&&k.api_token);if(v.issue_tracker==="github"){let z=c.github_org;z?S.length?O(`Tracking GitHub issues in: ${S.map(sc=>`${z}/${sc}`).join(", ")}.`):O(`Tracking GitHub issues in every registry repo under ${z} (none registered yet).`):I(" No GitHub org set (section 1) \u2014 workspaces can only take owner/repo#n issue refs.")}else v.issue_tracker==="jira"&&A?O(`Already configured for ${k.email}.`):v.issue_tracker==="jira"&&(O("A Jira API token lets the dashboard read tickets directly instead of shelling out to the claude CLI. Entirely optional \u2014 skip to leave it out."),await Wt(" Configure Jira credentials now?",!1,e)&&(k.base_url=await nu("Jira base URL",k.base_url??"https://your-org.atlassian.net"),k.email=await nu("Atlassian login email",k.email??""),O(" Create a token at https://id.atlassian.com/manage-profile/security/api-tokens"),k.api_token=await nu("API token",k.api_token??"",{secret:!0})));Er("6. Telepresence (optional)"),O("Only `sandbox intercept` needs it \u2014 reroutes cluster traffic to a local container.");let R=await Wt(" Install/upgrade the OSS client via Homebrew if it's missing or stale?",!1,e);Er("7. Superpowers plugin (optional)"),O("Brainstorming/planning skills, installed alongside ponytail. Writes its plans and specs under docs/superpowers/. Nothing in the sandbox depends on it, so declining is a first-class answer and `--check` stays green.");let P=await Wt(" Install the superpowers plugin?",!1,e);Er("8. VS Code (optional)");let N=g2(),D=!1;N.present?N.error?I(`${wd()} does not parse (${N.error}) \u2014 skipping.`):!Object.keys(N.set).length&&!N.drop.length?O("Already mapped."):(O(`Validates <repo>/.sandbox/services.yaml and .sandbox/workspace.yml against the sandbox's JSON Schemas (needs the redhat.vscode-yaml extension). Adds \`yaml.schemas\` entries to ${wd()}; comments and other settings are kept.`),D=await Wt(" Add the schema mappings to your VS Code user settings?",!1,e)):O("VS Code not found \u2014 skipping.");let M=Fg(),T=!1;M.cli&&M.bundled&&M.installed!==M.bundled.version?(O(`The Sandbox Workspaces extension shows your feature workspaces, containers and intercepts in a VS Code side bar (${M.installed??"not installed"} \u2192 ${M.bundled.version}).`),T=await Wt(" Install the Sandbox Workspaces extension?",!1,e)):M.cli&&!M.bundled&&O(`Sandbox Workspaces extension: ${M.installed??"not installed"}. A checkout bundles no .vsix, so setup can't install it \u2014 build it from packages/vscode-plugin (see the README).`),Er("9. Claude Code standards access (optional)");let j=x2(),B=!1;j.present?j.dirMissing?O(`Standards dir ${at()} not found \u2014 skipping.`):j.error?I(`${vd()}: ${j.error} \u2014 skipping.`):j.granted?O("Already granted."):(O(`Lets every Claude Code session read the coding standards in ${at()} without a prompt. Adds it to \`permissions.additionalDirectories\` in ${vd()}; other settings are kept.`),B=e&&await Wt(" Grant Claude Code read access to the standards dir?",!0,e)):O("Claude Code settings dir not found \u2014 skipping."),Er("10. PR watch schedule (optional)");let V=v2(),gt;V.installed?(O(`Installed (${V.where}); logs \u2192 ${V.logFile}. Remove with \`werkmeister pr watch --uninstall\`.`),gt=!0):(O("Resumes terminal Claude sessions when their PR merges, ships or closes (desktop sessions don't need it)."),gt=await Wt(` Install a ${V.kind==="launchd"?"launchd agent":"crontab line"} that runs \`werkmeister pr watch\` every 10 minutes?`,!1,e));let J={version:1,paths:{sandbox_root:String(td()),repos_root:r.repos_root,workspaces_root:r.workspaces_root},ingress:{local_domain:h.local_domain,remote_domain:h.remote_domain,certs_dir:h.certs_dir},overrides:{...t.overrides??{},browser:f.browser,issue_tracker:v.issue_tracker,...c.workspace_repo?{workspace_repo:c.workspace_repo}:{},...c.github_org?{github_org:c.github_org}:{}},...k.base_url||k.email||k.api_token?{jira:k}:{}},st=qh(J),xt=Uh(J),me=Wh(),$t=CR(),jn=Vh();return Er("Writing config"),F(`Wrote ${st}`),O(`Regenerated ${xt}`),O(`${Sc()}: ${me?"updated":"already sources env.sh"}`),O(`${Iw()}: ${$t?"installed tab completion":"tab completion already installed"}`),oO.existsSync(Fi())&&O(`${eW.basename(Fi())}: ${jn?"dropped stale env block":"no env block to remove"}`),{workspaceRepo:c.workspace_repo,demo:x,k8sContext:w,installTelepresence:R,installOptionalPlugins:P,mapEditorSchemas:D,installVscodeExtension:T,grantStandardsDir:B,installPrWatch:gt,skipSudo:!e}}function QU(){try{return cf()}catch{return[]}}function ZU(e){Er("Prerequisites");for(let t of e)t.ok?console.log(`${b.GREEN}\u2713${b.RESET} ${t.label}: ${t.detail}`):t.optional?console.log(`${b.YELLOW}\u26A0 ${t.label}: ${t.detail}${b.RESET}`):console.log(`${b.RED}\u2717 ${t.label}: ${t.detail}${b.RESET}`);return e.filter(t=>!t.ok&&!t.optional).length}async function iye(e){let t=!!e.check,n=!!e.yes;if(t){let l=await S2({checkOnly:!0,hostnames:QU()}),u=Kh(Ze()).filter(f=>!/^paths\.\w+ does not exist/.test(f));for(let f of u)l.unshift({label:"global config",ok:!1,detail:f});ZU(l)&&(I("Prerequisites out of date \u2014 run `sandbox setup` to converge."),process.exit(1)),F("All required sandbox prerequisites are in order.");return}let r=!!process.stdin.isTTY&&!n;r?O("Sandbox setup \u2014 press Ctrl-C at any prompt to abort without writing."):!process.stdin.isTTY&&!n&&I("Not a TTY \u2014 running non-interactively with defaults (same as --yes).");let s=await oye(r),o=await S2({checkOnly:!1,demo:s.demo,registry:{k8sContext:s.k8sContext},workspaceRepo:s.workspaceRepo,hostnames:QU,skipSudo:s.skipSudo,installTelepresence:s.installTelepresence,installOptionalPlugins:s.installOptionalPlugins,mapEditorSchemas:s.mapEditorSchemas,installVscodeExtension:s.installVscodeExtension,grantStandardsDir:s.grantStandardsDir,installPrWatch:s.installPrWatch}),a=ZU(o),c=o.filter(l=>!l.ok&&l.optional).length;a&&(I(`${a} required prerequisite(s) could not be converged (\u2717 above).`),process.exit(1)),c?F(`Machine is set up. ${c} optional prerequisite(s) are unconfigured (\u26A0 above) \u2014 everything works without them.`):F("Machine is set up."),O("Plugin updates apply to new Claude Code sessions only; open a new shell (or `source ~/.zshenv`) for the exports to take effect.")}var nW=C(()=>{"use strict";p();wl();Q();fs();bt();pn();Mg();ai();ve();rc();i(Er,"heading");i(oye,"configureMachine");i(QU,"resolveHostnames");i(ZU,"report");i(iye,"run")});var oW={};ce(oW,{run:()=>cye});import*as rW from"node:fs";import*as sW from"node:path";function aye(e){let t=e.paths||{};console.log(`${b.BOLD}config file:${b.RESET} ${Fn()}`),console.log(`${b.BOLD}env.sh:${b.RESET} ${Fh()}`),console.log(`${b.BOLD}sandbox_root:${b.RESET} ${td()} ${b.DIM}(self-derived)${b.RESET}`);for(let s of["repos_root","workspaces_root"]){let o=t[s],a=o?"YAML":"default";console.log(`${b.BOLD}${s}:${b.RESET} ${o||Dw(s)} ${b.DIM}(${a})${b.RESET}`)}let n=as(e);console.log(`${b.BOLD}ingress:${b.RESET}`);for(let[s,o]of Object.entries(n)){let a=e.ingress?.[s]?"YAML":"default";console.log(` ${s}: ${o} ${b.DIM}(${a})${b.RESET}`)}let r=Object.fromEntries(Object.entries(e.overrides||{}).filter(([,s])=>s));if(Object.keys(r).length){console.log(`${b.BOLD}overrides:${b.RESET}`);for(let[s,o]of Object.entries(r))console.log(` ${s}: ${o}`)}}async function cye(e){let t=Ze();if(e.check){let d=Kh(t);if(d.length){for(let h of d)console.log(`${b.RED}\u2717 ${h}${b.RESET}`);I("Global config out of date \u2014 run `sandbox config` to converge."),process.exit(1)}F("Global sandbox config is in order.");return}if(e.show){aye(t);return}let n={};e.repos_root&&(n.repos_root=e.repos_root),e.workspaces_root&&(n.workspaces_root=e.workspaces_root);let r=i(d=>Bh(d.key,t,n),"defaultFor"),s=kc.filter(d=>!(d.key in n));if(s.length)if(process.stdin.isTTY)await ki(kc,n,r,{intro:"Global sandbox config \u2014 press Ctrl-C to abort. Defaults in [brackets]."});else for(let d of s)d.key in n||(n[d.key]=r(d));let o={version:1,paths:{sandbox_root:String(td()),repos_root:n.repos_root,workspaces_root:n.workspaces_root},overrides:t.overrides||{},...t.ingress?{ingress:t.ingress}:{},...t.jira?{jira:t.jira}:{}},a=qh(o),c=Uh(o),l=Wh(),u=Vh();F(`Wrote ${a}`),O(`Regenerated ${c}`),O(`${Sc()}: ${l?"updated":"already sources env.sh"}`);let f=Fi();rW.existsSync(f)&&O(`${sW.basename(f)}: ${u?"dropped stale env block":"no env block to remove"}`),O("Open a new shell (or `source ~/.zshenv`) for the exports to take effect.")}var iW=C(()=>{"use strict";p();bt();ve();rc();i(aye,"show");i(cye,"run")});var aW={};ce(aW,{run:()=>lye});async function lye(e){e.action!=="prune"&&(I(`Unknown action \`${String(e.action)}\` \u2014 the only action is \`prune\`.`),process.exit(2));let t=await CL({name:typeof e.name=="string"?e.name:void 0,reset:!!e.reset,force:!!e.force,dryRun:!!e.dry_run});t.length||console.log("No caches in the registry.");for(let n of t){let r=n.ok?`${b.GREEN}\u2713${b.RESET}`:`${b.RED}\u2717${b.RESET}`;console.log(`${r} ${n.name} (${n.action}): ${n.detail}`)}t.some(n=>!n.ok)&&process.exit(1)}var cW=C(()=>{"use strict";p();Vf();ve();i(lye,"run")});var lW={};ce(lW,{run:()=>uye});async function uye(e){let t=String(e.action??"sync");t!=="sync"&&(I(`Unknown action \`${t}\` \u2014 the only action is \`sync\` (the default).`),process.exit(2));let n=!!e.check,r=yg({checkOnly:n});for(let s of r){let o=s.ok?`${b.GREEN}\u2713${b.RESET}`:`${b.RED}\u2717${b.RESET}`;console.log(`${o} ${s.label}: ${s.detail}`)}r.some(s=>!s.ok)&&(I(n?"Registry is stale \u2014 run `sandbox registry sync`.":"Registry was not generated."),process.exit(1)),F(n?"Registry is up to date.":"Registry generated.")}var uW=C(()=>{"use strict";p();ai();ve();i(uye,"run")});p();import iO from"node:path";import{fileURLToPath as fye}from"node:url";p();var wO=Ne(bO(),1),{program:Bye,createCommand:qye,createArgument:Uye,createOption:Wye,CommanderError:Vye,InvalidArgumentError:Kye,InvalidOptionArgumentError:Hye,Command:vO,Argument:$i,Option:oc,Help:Gye}=wO.default;ts();Q();Kt();We();ca();p();import{execFileSync as uee}from"node:child_process";import*as VP from"node:fs";import*as KP from"node:path";var HP=typeof _>"u"?void 0:_,fee="pnpm turbo run build --filter=werkmeister";function GP(e,t){if(!e?.sha||!VP.existsSync(KP.join(t,".git")))return null;let n;try{n=uee("git",["-C",t,"rev-parse","HEAD"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return null}return n===e.sha?null:`warning: this sandbox CLI was built from ${e.sha.slice(0,7)+(e.dirty?" (+uncommitted changes)":"")}, but ${t} is at ${n.slice(0,7)}.
|
|
1364
|
+
${b.BOLD}${e}${b.RESET}`)}async function oye(e){let t=Ze(),n=as(t);Er("1. Paths & the workspace repo");let r={},s=i(z=>Bh(z.key,t,r),"pathDefault");if(e)await ki(kc,r,s,{intro:"Where your repos and per-feature workspaces live. Defaults in [brackets]."});else for(let z of kc)r[z.key]=s(z),O(` ${z.key}: ${r[z.key]}`);let o=kD();o.length||I(" `gh` could not name your GitHub account, so these are not prefilled \u2014 run `gh auth login` and re-run to pick from your orgs, or type them by hand.");let a=i((z,sc)=>sc.length?{...z,choicesFn:i(()=>sc,"choicesFn")}:z,"withChoices"),c={},l=[a(ER,o.map(z=>`${z}/${Kr}`)),a(OR,o)],u=i(z=>z.key==="workspace_repo"?Hu(t)||(o[0]?`${o[0]}/${Kr}`:""):t.overrides?.github_org||(c.workspace_repo??"").split("/")[0]||"","ghDefault");if(e)await ki(l,c,u,{intro:"GitHub locations. The workspace repo hosts the per-workspace configs at the root of every feature workspace \u2014 enter a shared <org>/sandbox-workspace to share them with your team, or keep your own."});else for(let z of l)c[z.key]=u(z),O(` ${z.key}: ${c[z.key]||"(unset \u2014 `gh` named no user)"}`);Er("2. Browser");let f={},d=i(()=>t.overrides?.browser||cd,"browserDefault");e?await ki([T5],f,d,{intro:"Which browser `sandbox open` launches."}):(f.browser=d(),O(` browser: ${f.browser}`)),so[f.browser]?.engine!=="chromium"&&f.browser!=="safari"&&I(` ${so[f.browser].label} isn't wired up yet -- \`sandbox open\` will error until it's picked to chrome/chromium/brave/edge/safari.`),Er("3. Ingress");let h={},m=i(z=>String(n[z.key]??""),"ingressDefault");if(e)await ki(jw,h,m,{intro:"Public hostnames Caddy terminates. Each routed service is served at <service>.<domain>; these domains also drive the TLS certificate and your /etc/hosts entries."});else for(let z of jw)h[z.key]=m(z),O(` ${z.key}: ${h[z.key]}`);Er("4. Service registry");let y=Bs(),g=yt(r.repos_root),x=!1,w=Hk(y)??"orbstack",S=[];try{S=ii(g).map(z=>z.repo)}catch{}S.length?O(`${y} will be generated from ${S.length} repo fragment(s): ${S.join(", ")}.`):(O(`No <repo>/${fd} found under ${g}.`),O("Clone your team's repos there and re-run `sandbox setup`, or try the demo apps.")),S.includes("demo-services")||(x=await Wt(" Clone the demo apps (backend, frontend) so there is something to run?",!1,e)),!oO.existsSync(is())&&e&&(w=await nu("Kube context for `sandbox intercept` (services.local.yaml k8s_context)",w)),Er("5. Issue tracker");let v={},E=i(()=>Ui(t),"trackerDefault");e?await ki([{key:"issue_tracker",label:"Issue tracker",help:"Where workspace issues come from and where agents file existing bugs. "+qi.map(z=>`${z}: ${Yw(z).label} (e.g. ${Yw(z).refExample})`).join("; ")+".",acceptEmpty:!1,pattern:`(${qi.join("|")})`,choicesFn:i(()=>[...qi],"choicesFn")}],v,E):(v.issue_tracker=E(),O(` issue_tracker: ${v.issue_tracker}`));let k={...Ws()},A=!!(k.base_url&&k.email&&k.api_token);if(v.issue_tracker==="github"){let z=c.github_org;z?S.length?O(`Tracking GitHub issues in: ${S.map(sc=>`${z}/${sc}`).join(", ")}.`):O(`Tracking GitHub issues in every registry repo under ${z} (none registered yet).`):I(" No GitHub org set (section 1) \u2014 workspaces can only take owner/repo#n issue refs.")}else v.issue_tracker==="jira"&&A?O(`Already configured for ${k.email}.`):v.issue_tracker==="jira"&&(O("A Jira API token lets the dashboard read tickets directly instead of shelling out to the claude CLI. Entirely optional \u2014 skip to leave it out."),await Wt(" Configure Jira credentials now?",!1,e)&&(k.base_url=await nu("Jira base URL",k.base_url??"https://your-org.atlassian.net"),k.email=await nu("Atlassian login email",k.email??""),O(" Create a token at https://id.atlassian.com/manage-profile/security/api-tokens"),k.api_token=await nu("API token",k.api_token??"",{secret:!0})));Er("6. Telepresence (optional)"),O("Only `sandbox intercept` needs it \u2014 reroutes cluster traffic to a local container.");let R=await Wt(" Install/upgrade the OSS client via Homebrew if it's missing or stale?",!1,e);Er("7. Superpowers plugin (optional)"),O("Brainstorming/planning skills, installed alongside ponytail. Writes its plans and specs under docs/superpowers/. Nothing in the sandbox depends on it, so declining is a first-class answer and `--check` stays green.");let P=await Wt(" Install the superpowers plugin?",!1,e);Er("8. VS Code (optional)");let N=g2(),D=!1;N.present?N.error?I(`${wd()} does not parse (${N.error}) \u2014 skipping.`):!Object.keys(N.set).length&&!N.drop.length?O("Already mapped."):(O(`Validates <repo>/.sandbox/services.yaml and .sandbox/workspace.yml against the sandbox's JSON Schemas (needs the redhat.vscode-yaml extension). Adds \`yaml.schemas\` entries to ${wd()}; comments and other settings are kept.`),D=await Wt(" Add the schema mappings to your VS Code user settings?",!1,e)):O("VS Code not found \u2014 skipping.");let M=Fg(),T=!1;M.cli&&M.bundled&&M.installed!==M.bundled.version?(O(`The Sandbox Workspaces extension shows your feature workspaces, containers and intercepts in a VS Code side bar (${M.installed??"not installed"} \u2192 ${M.bundled.version}).`),T=await Wt(" Install the Sandbox Workspaces extension?",!1,e)):M.cli&&!M.bundled&&O(`Sandbox Workspaces extension: ${M.installed??"not installed"}. A checkout bundles no .vsix, so setup can't install it \u2014 build it from packages/werkmeister-vscode (see the README).`),Er("9. Claude Code standards access (optional)");let j=x2(),B=!1;j.present?j.dirMissing?O(`Standards dir ${at()} not found \u2014 skipping.`):j.error?I(`${vd()}: ${j.error} \u2014 skipping.`):j.granted?O("Already granted."):(O(`Lets every Claude Code session read the coding standards in ${at()} without a prompt. Adds it to \`permissions.additionalDirectories\` in ${vd()}; other settings are kept.`),B=e&&await Wt(" Grant Claude Code read access to the standards dir?",!0,e)):O("Claude Code settings dir not found \u2014 skipping."),Er("10. PR watch schedule (optional)");let V=v2(),gt;V.installed?(O(`Installed (${V.where}); logs \u2192 ${V.logFile}. Remove with \`werkmeister pr watch --uninstall\`.`),gt=!0):(O("Resumes terminal Claude sessions when their PR merges, ships or closes (desktop sessions don't need it)."),gt=await Wt(` Install a ${V.kind==="launchd"?"launchd agent":"crontab line"} that runs \`werkmeister pr watch\` every 10 minutes?`,!1,e));let J={version:1,paths:{sandbox_root:String(td()),repos_root:r.repos_root,workspaces_root:r.workspaces_root},ingress:{local_domain:h.local_domain,remote_domain:h.remote_domain,certs_dir:h.certs_dir},overrides:{...t.overrides??{},browser:f.browser,issue_tracker:v.issue_tracker,...c.workspace_repo?{workspace_repo:c.workspace_repo}:{},...c.github_org?{github_org:c.github_org}:{}},...k.base_url||k.email||k.api_token?{jira:k}:{}},st=qh(J),xt=Uh(J),me=Wh(),$t=CR(),jn=Vh();return Er("Writing config"),F(`Wrote ${st}`),O(`Regenerated ${xt}`),O(`${Sc()}: ${me?"updated":"already sources env.sh"}`),O(`${Iw()}: ${$t?"installed tab completion":"tab completion already installed"}`),oO.existsSync(Fi())&&O(`${eW.basename(Fi())}: ${jn?"dropped stale env block":"no env block to remove"}`),{workspaceRepo:c.workspace_repo,demo:x,k8sContext:w,installTelepresence:R,installOptionalPlugins:P,mapEditorSchemas:D,installVscodeExtension:T,grantStandardsDir:B,installPrWatch:gt,skipSudo:!e}}function QU(){try{return cf()}catch{return[]}}function ZU(e){Er("Prerequisites");for(let t of e)t.ok?console.log(`${b.GREEN}\u2713${b.RESET} ${t.label}: ${t.detail}`):t.optional?console.log(`${b.YELLOW}\u26A0 ${t.label}: ${t.detail}${b.RESET}`):console.log(`${b.RED}\u2717 ${t.label}: ${t.detail}${b.RESET}`);return e.filter(t=>!t.ok&&!t.optional).length}async function iye(e){let t=!!e.check,n=!!e.yes;if(t){let l=await S2({checkOnly:!0,hostnames:QU()}),u=Kh(Ze()).filter(f=>!/^paths\.\w+ does not exist/.test(f));for(let f of u)l.unshift({label:"global config",ok:!1,detail:f});ZU(l)&&(I("Prerequisites out of date \u2014 run `sandbox setup` to converge."),process.exit(1)),F("All required sandbox prerequisites are in order.");return}let r=!!process.stdin.isTTY&&!n;r?O("Sandbox setup \u2014 press Ctrl-C at any prompt to abort without writing."):!process.stdin.isTTY&&!n&&I("Not a TTY \u2014 running non-interactively with defaults (same as --yes).");let s=await oye(r),o=await S2({checkOnly:!1,demo:s.demo,registry:{k8sContext:s.k8sContext},workspaceRepo:s.workspaceRepo,hostnames:QU,skipSudo:s.skipSudo,installTelepresence:s.installTelepresence,installOptionalPlugins:s.installOptionalPlugins,mapEditorSchemas:s.mapEditorSchemas,installVscodeExtension:s.installVscodeExtension,grantStandardsDir:s.grantStandardsDir,installPrWatch:s.installPrWatch}),a=ZU(o),c=o.filter(l=>!l.ok&&l.optional).length;a&&(I(`${a} required prerequisite(s) could not be converged (\u2717 above).`),process.exit(1)),c?F(`Machine is set up. ${c} optional prerequisite(s) are unconfigured (\u26A0 above) \u2014 everything works without them.`):F("Machine is set up."),O("Plugin updates apply to new Claude Code sessions only; open a new shell (or `source ~/.zshenv`) for the exports to take effect.")}var nW=C(()=>{"use strict";p();wl();Q();fs();bt();pn();Mg();ai();ve();rc();i(Er,"heading");i(oye,"configureMachine");i(QU,"resolveHostnames");i(ZU,"report");i(iye,"run")});var oW={};ce(oW,{run:()=>cye});import*as rW from"node:fs";import*as sW from"node:path";function aye(e){let t=e.paths||{};console.log(`${b.BOLD}config file:${b.RESET} ${Fn()}`),console.log(`${b.BOLD}env.sh:${b.RESET} ${Fh()}`),console.log(`${b.BOLD}sandbox_root:${b.RESET} ${td()} ${b.DIM}(self-derived)${b.RESET}`);for(let s of["repos_root","workspaces_root"]){let o=t[s],a=o?"YAML":"default";console.log(`${b.BOLD}${s}:${b.RESET} ${o||Dw(s)} ${b.DIM}(${a})${b.RESET}`)}let n=as(e);console.log(`${b.BOLD}ingress:${b.RESET}`);for(let[s,o]of Object.entries(n)){let a=e.ingress?.[s]?"YAML":"default";console.log(` ${s}: ${o} ${b.DIM}(${a})${b.RESET}`)}let r=Object.fromEntries(Object.entries(e.overrides||{}).filter(([,s])=>s));if(Object.keys(r).length){console.log(`${b.BOLD}overrides:${b.RESET}`);for(let[s,o]of Object.entries(r))console.log(` ${s}: ${o}`)}}async function cye(e){let t=Ze();if(e.check){let d=Kh(t);if(d.length){for(let h of d)console.log(`${b.RED}\u2717 ${h}${b.RESET}`);I("Global config out of date \u2014 run `sandbox config` to converge."),process.exit(1)}F("Global sandbox config is in order.");return}if(e.show){aye(t);return}let n={};e.repos_root&&(n.repos_root=e.repos_root),e.workspaces_root&&(n.workspaces_root=e.workspaces_root);let r=i(d=>Bh(d.key,t,n),"defaultFor"),s=kc.filter(d=>!(d.key in n));if(s.length)if(process.stdin.isTTY)await ki(kc,n,r,{intro:"Global sandbox config \u2014 press Ctrl-C to abort. Defaults in [brackets]."});else for(let d of s)d.key in n||(n[d.key]=r(d));let o={version:1,paths:{sandbox_root:String(td()),repos_root:n.repos_root,workspaces_root:n.workspaces_root},overrides:t.overrides||{},...t.ingress?{ingress:t.ingress}:{},...t.jira?{jira:t.jira}:{}},a=qh(o),c=Uh(o),l=Wh(),u=Vh();F(`Wrote ${a}`),O(`Regenerated ${c}`),O(`${Sc()}: ${l?"updated":"already sources env.sh"}`);let f=Fi();rW.existsSync(f)&&O(`${sW.basename(f)}: ${u?"dropped stale env block":"no env block to remove"}`),O("Open a new shell (or `source ~/.zshenv`) for the exports to take effect.")}var iW=C(()=>{"use strict";p();bt();ve();rc();i(aye,"show");i(cye,"run")});var aW={};ce(aW,{run:()=>lye});async function lye(e){e.action!=="prune"&&(I(`Unknown action \`${String(e.action)}\` \u2014 the only action is \`prune\`.`),process.exit(2));let t=await CL({name:typeof e.name=="string"?e.name:void 0,reset:!!e.reset,force:!!e.force,dryRun:!!e.dry_run});t.length||console.log("No caches in the registry.");for(let n of t){let r=n.ok?`${b.GREEN}\u2713${b.RESET}`:`${b.RED}\u2717${b.RESET}`;console.log(`${r} ${n.name} (${n.action}): ${n.detail}`)}t.some(n=>!n.ok)&&process.exit(1)}var cW=C(()=>{"use strict";p();Vf();ve();i(lye,"run")});var lW={};ce(lW,{run:()=>uye});async function uye(e){let t=String(e.action??"sync");t!=="sync"&&(I(`Unknown action \`${t}\` \u2014 the only action is \`sync\` (the default).`),process.exit(2));let n=!!e.check,r=yg({checkOnly:n});for(let s of r){let o=s.ok?`${b.GREEN}\u2713${b.RESET}`:`${b.RED}\u2717${b.RESET}`;console.log(`${o} ${s.label}: ${s.detail}`)}r.some(s=>!s.ok)&&(I(n?"Registry is stale \u2014 run `sandbox registry sync`.":"Registry was not generated."),process.exit(1)),F(n?"Registry is up to date.":"Registry generated.")}var uW=C(()=>{"use strict";p();ai();ve();i(uye,"run")});p();import iO from"node:path";import{fileURLToPath as fye}from"node:url";p();var wO=Ne(bO(),1),{program:Bye,createCommand:qye,createArgument:Uye,createOption:Wye,CommanderError:Vye,InvalidArgumentError:Kye,InvalidOptionArgumentError:Hye,Command:vO,Argument:$i,Option:oc,Help:Gye}=wO.default;ts();Q();Kt();We();ca();p();import{execFileSync as uee}from"node:child_process";import*as VP from"node:fs";import*as KP from"node:path";var HP=typeof _>"u"?void 0:_,fee="pnpm turbo run build --filter=werkmeister";function GP(e,t){if(!e?.sha||!VP.existsSync(KP.join(t,".git")))return null;let n;try{n=uee("git",["-C",t,"rev-parse","HEAD"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return null}return n===e.sha?null:`warning: this sandbox CLI was built from ${e.sha.slice(0,7)+(e.dirty?" (+uncommitted changes)":"")}, but ${t} is at ${n.slice(0,7)}.
|
|
1365
1365
|
Rebuild it from ${t}: ${fee}`}i(GP,"staleBuildWarning");Js();var fW=iO.resolve(iO.dirname(fye(import.meta.url)),"..");Ge("ROOT")||(process.env.SANDBOX_ROOT=fW);var aO="\x1B[31m",dye="\x1B[1m",$y="\x1B[0m",pye=`${dye}Developer Sandbox CLI${$y}
|
|
1366
1366
|
Multi-feature concurrent development orchestrator
|
|
1367
1367
|
`,hye=[{name:"up",load:i(()=>Promise.resolve().then(()=>(X7(),J7)),"load"),configure:i(e=>{e.description("Detect services, allocate slot, generate config, start containers").argument("[feature]","Feature name (arbitrary label for slot/proxy routing). If omitted, read from FEATURE in a .env file in the current directory tree.").option("-w, --workspace <path>","Path to directory containing repo checkouts. Default: ~/workspace (override with WORKSPACE env var).").option("--dev","Run the file watchers in cli/library/extension containers, which otherwise idle.")},"configure"),namespace:i(([e],t)=>({feature:e??null,workspace:t.workspace??null,dev:t.dev??!1}),"namespace")},{name:"down",load:i(()=>Promise.resolve().then(()=>(o5(),s5)),"load"),configure:i(e=>{e.description("Stop containers, release slot, update proxy (use 'infra' for shared infra)").argument("[feature]","Feature name or 'infra'. If omitted, read from FEATURE in a .env file.").option("-v, --volumes","Also remove Docker volumes (node_modules, caches)").option("--all-features","Stop and clean up all active features (ignores <feature> argument)")},"configure"),namespace:i(([e],t)=>({feature:e??null,volumes:!!t.volumes,all_features:!!t.allFeatures}),"namespace")},{name:"intercept",load:i(()=>Promise.resolve().then(()=>(c5(),a5)),"load"),configure:i(e=>{e.description("Route header-scoped k8s dev traffic to a local service (Telepresence OSS).").argument("[feature]","Feature name (defaults to FEATURE from a .env file in CWD).").option("-s, --service <name>","Local service to intercept (must be in the workspace's SERVICES and running via `sandbox up`).").option("--leave","End the intercept for -s (or all of this feature's intercepts without -s).").option("--status","Show telepresence connection and intercept status.").option("--docker-daemon","Run the telepresence daemon in a container (connect --docker) \u2014 avoids the host TUN device, its sudo prompt, and VPN routing conflicts. In exchange the host loses cluster DNS: nothing on your laptop resolves <svc>.<ns> while connected this way.").option("--workspace <path>","Explicit workspace path (default: resolve from the feature name).")},"configure"),namespace:i(([e],t)=>({feature:e??null,service:t.service??null,leave:!!t.leave,status:!!t.status,docker_daemon:!!t.dockerDaemon,workspace:t.workspace??null}),"namespace")},{name:"restart",load:i(()=>Promise.resolve().then(()=>(u5(),l5)),"load"),configure:i(e=>{e.description("Restart containers (use 'infra' for shared infra)").argument("[feature]","Feature name or 'infra'. If omitted, read from FEATURE in a .env file.")},"configure"),namespace:i(([e])=>({feature:e??null}),"namespace")},{name:"pause",load:i(()=>Promise.resolve().then(()=>(xk(),f5)),"load"),configure:i(e=>{e.description("Freeze a workspace's running containers and hold its Claude session until resume").argument("[feature]","Feature name. If omitted, read from FEATURE in a .env file.")},"configure"),namespace:i(([e])=>({feature:e??null}),"namespace")},{name:"resume",load:i(()=>Promise.resolve().then(()=>(Pj(),Nj)),"load"),configure:i(e=>{e.description("Thaw exactly the containers pause froze, release the session, and tell it to continue").argument("[feature]","Feature name. If omitted, read from FEATURE in a .env file.")},"configure"),namespace:i(([e])=>({feature:e??null}),"namespace")},{name:"stop",load:i(()=>Promise.resolve().then(()=>(jj(),Dj)),"load"),configure:i(e=>{e.description("Stop containers without removing them or releasing the slot (use 'infra' for shared infra)").argument("[feature]","Feature name or 'infra'. If omitted, read from FEATURE in a .env file.").option("--if-idle","SessionEnd hook mode: stop the workspace's own feature unless another Claude session is open there; silent, always exits 0, never stops infra").option("--idle <minutes>","Stop every workspace's feature containers nothing has used for <minutes> (a busy or recently active session, a gate exec or a fresh start all count as use); with [feature], only that one")},"configure"),namespace:i(([e],t)=>({feature:e??null,if_idle:!!t.ifIdle,idle:t.idle??null}),"namespace")},{name:"status",load:i(()=>Promise.resolve().then(()=>(Zj(),Qj)),"load"),configure:i(e=>{e.description("Show all features, services, resource usage").option("-v, --verbose","Show individual container details").option("--k8s","Show k8s port-forward health only (replaces standalone k8s-status command)").option("--intercepts","Show Telepresence intercept state only (per feature service; cheap \u2014 skips docker and k8s probes).").option("--json","Output structured JSON (useful for agent-driven diagnosis)")},"configure"),namespace:i((e,t)=>({verbose:!!t.verbose,k8s:!!t.k8s,intercepts:!!t.intercepts,json:!!t.json}),"namespace")},{name:"detect",load:i(()=>Promise.resolve().then(()=>(nU(),tU)),"load"),configure:i(e=>{e.description("Generate <repo>/.sandbox/services.yaml from the repo's package manifests, Dockerfiles, compose, Helm and k8s files (re-runs only add what is missing)").argument("[repo]","Repo directory (default: the git repo containing the current directory)").option("--dry-run","Show the report and the proposed YAML; write nothing").option("-y, --yes","Write without asking").option("--assist","Ask Claude to resolve the fields the scan had to guess").option("--no-assist","Never ask Claude")},"configure"),namespace:i(([e],t)=>({repo:e??null,dryRun:!!t.dryRun,yes:!!t.yes,assist:t.assist}),"namespace")},{name:"services",load:i(()=>Promise.resolve().then(()=>(sU(),rU)),"load"),configure:i(e=>{e.description("List services and their endpoints for a feature").argument("<feature>","Feature name")},"configure"),namespace:i(([e])=>({feature:e}),"namespace")},{name:"logs",load:i(()=>Promise.resolve().then(()=>(iU(),oU)),"load"),configure:i(e=>{e.description("Tail a feature's container logs").argument("<feature>","Feature name").argument("[service]","Specific service to tail (optional)")},"configure"),namespace:i(([e,t])=>({feature:e,service:t??null}),"namespace")},{name:"remove",load:i(()=>Promise.resolve().then(()=>(cU(),aU)),"load"),configure:i(e=>{e.description("Stop a local service, fall back to k8s").argument("<feature>","Feature name").argument("<service>","Service name to remove")},"configure"),namespace:i(([e,t])=>({feature:e,service:t}),"namespace")},{name:"test",load:i(()=>Promise.resolve().then(()=>(fU(),uU)),"load"),configure:i(e=>{e.description("Run Playwright tests against a feature's stack").argument("<feature>","Feature name").argument("[extra...]","Additional arguments to pass to Playwright").option("--scaffold","Don't run: write playwright.config.ts + <feature>.spec.ts into the workspace (if missing) and install the pinned @playwright/test").option("-w, --workspace <path>","--scaffold: workspace directory (default: from cwd)").option("--base-url <url>","--scaffold: ingress URL to target (default: the first feature_router service)")},"configure"),namespace:i(([e,t],n)=>({feature:e,extra:t??[],scaffold:n.scaffold??!1,workspace:n.workspace??null,base_url:n.baseUrl??null}),"namespace")},{name:"starting-prompt",load:i(()=>Promise.resolve().then(()=>(hU(),pU)),"load"),configure:i(e=>{e.description("Print the enclosing workspace's starting_prompt from workspace.yml").option("--start <dir>","Directory to search up from (default: cwd)")},"configure"),namespace:i((e,t)=>({start:t.start??null}),"namespace")},{name:"open",load:i(()=>Promise.resolve().then(()=>(gU(),mU)),"load"),configure:i(e=>{e.description("Open a feature-tagged Chrome window with the X-Feature cookie set (no Playwright)").argument("[feature]","Feature name -> sets X-Feature=<feature>. If omitted, read from FEATURE in a .env file.").option("--url <url>","Full start URL (overrides --path). Default: the first routed host's homepage.").option("--path <path>","Path appended to the first routed host (default: test_path from .sandbox/workspace.yml, else TEST_PATH from .env, else '/').").option("--size <W,H>","Window size WIDTH,HEIGHT (default: 1440,900).","1440,900").option("--position <X,Y>","Window position X,Y (default: staggered by feature name).")},"configure"),namespace:i(([e],t)=>({feature:e??null,url:t.url??null,path:t.path??null,size:t.size,position:t.position??null}),"namespace")},{name:"connect",load:i(()=>Promise.resolve().then(()=>(hk(),pk)),"load"),configure:i(e=>{e.description("Start all shared infrastructure (local + k8s port-forwards)").option("--k8s","Start/restart k8s port-forwards container only (replaces standalone k8s-connect command)")},"configure"),namespace:i((e,t)=>({k8s:!!t.k8s}),"namespace")},{name:"proxy-reload",load:i(()=>Promise.resolve().then(()=>(yU(),xU)),"load"),configure:i(e=>{e.description("Regenerate Caddyfile and reload Caddy")},"configure"),namespace:i(()=>({}),"namespace")},{name:"clean",load:i(()=>Promise.resolve().then(()=>(wU(),bU)),"load"),configure:i(e=>{e.description("Remove orphaned volumes and generated files from stopped features").option("--all","Also clean volumes for currently active features (implies sandbox down for each)").option("--dry-run","Show what would be cleaned without actually removing anything")},"configure"),namespace:i((e,t)=>({all:!!t.all,dry_run:!!t.dryRun}),"namespace")},{name:"stats",load:i(()=>Promise.resolve().then(()=>(z2(),Kj)),"load"),configure:i(e=>{e.description("Show Docker container resource usage (CPU, memory)").option("--collect <MINUTES>","Collect stats over N minutes (default: snapshot only)",t=>Number.parseInt(t,10),0).option("-i, --interval <SECS>","Sampling interval in seconds (default: 10)",t=>Number.parseInt(t,10),10).option("--save","Save results to stats/ directory")},"configure"),namespace:i((e,t)=>({collect:t.collect,interval:t.interval,save:!!t.save}),"namespace")},{name:"optimize",load:i(()=>Promise.resolve().then(()=>(_U(),vU)),"load"),configure:i(e=>{e.description("Analyze resource usage vs configured limits, recommend changes").option("--collect <MINUTES>","Collect stats over N minutes before analyzing (default: quick snapshot)",t=>Number.parseInt(t,10),0).option("-i, --interval <SECS>","Sampling interval in seconds (default: 10)",t=>Number.parseInt(t,10),10)},"configure"),namespace:i((e,t)=>({collect:t.collect,interval:t.interval}),"namespace")},{name:"skills",load:i(()=>Promise.resolve().then(()=>(kU(),SU)),"load"),configure:i(e=>{e.description("Workspace sb-* skill projection: verify freshness against the sandbox repo (check) or rewrite it (sync)").addArgument(new $i("<action>","check: exit 1 if the workspace's .claude/skills/sb-* lag the repo; sync: refresh them").choices(["check","sync"]))},"configure"),namespace:i(([e])=>({action:e}),"namespace")},{name:"standards",load:i(()=>Promise.resolve().then(()=>($U(),EU)),"load"),configure:i(e=>{e.description("Validate the configured standards tree (structural regression gate)").addArgument(new $i("<action>","check: exit 1 if any standard module is structurally malformed").choices(["check"]))},"configure"),namespace:i(([e])=>({action:e}),"namespace")},{name:"hooks",load:i(()=>Promise.resolve().then(()=>(TU(),OU)),"load"),configure:i(e=>{e.description("Claude Code hook entrypoints: the standards gate, the PR guard and the agent state").addArgument(new $i("<action>","gate: deny or allow an Edit/Write per the standards gate; pr-guard: deny opening a PR except via `sandbox pr open`; agent-state: record working / needs-you / done for the workspace pane and dashboard").choices(["gate","pr-guard","agent-state"]))},"configure"),namespace:i(([e])=>({action:e}),"namespace")},{name:"notes",load:i(()=>Promise.resolve().then(()=>(mk(),n5)),"load"),configure:i(e=>{e.description("Workspace notes (.sandbox/notes/). `context` prints the latest handoff + open decisions for session-start injection (hook target); `graduate` scaffolds an open decision note into the standards tree.").addArgument(new $i("<action>","context: print notes context for the enclosing workspace (silent if none); graduate: scaffold an open decision note into the standards tree").choices(["context","graduate"])).argument("[note_num]","graduate: note number to graduate (omit to pick interactively)").option("--domain <domain>","graduate: target <domain> in the standards tree (omit to infer from refs, or prompt)").addOption(new oc("--kind <kind>","graduate: content kind to scaffold (omit to prompt)").choices(["rule","example","anti-pattern"])).option("--slug <slug>","graduate: override the derived reference-file slug")},"configure"),namespace:i(([e,t],n)=>({action:e,note_num:t==null?null:Number.parseInt(t,10),domain:n.domain??null,kind:n.kind??null,slug:n.slug??null}),"namespace")},{name:"workspace",load:i(()=>Promise.resolve().then(()=>(LU(),IU)),"load"),configure:i(e=>{e.description("Create a new workspace under $SANDBOX_WORKSPACES_ROOT (git worktrees on a <user>/<workspace> branch) and run init-workspace inside it.").argument("[feature]","Feature name (lower-cased). Combined with --issue-id to form the workspace dir name, e.g. an issue + feature -> <issue-slug>-feature. If omitted, resolved from ./.sandbox/workspace.yml, then interactively (TTY).").option("--issue-id <ref>","Issue ID in this machine's issue tracker (see `sandbox setup`). Its slug is prefixed to the workspace dir name; passed through to init-workspace.").option("-s, --services <list>","Comma-separated services to run locally. Their owning repos are added as worktrees, and the list is passed through to init-workspace.").option("-r, --repos <list>","Comma-separated repos to create worktrees for (union with the repos derived from --services). Interactive multi-select if neither --repos nor --services is given.").option("--labels <list>","Comma-separated free-form tags for filtering workspaces in the dashboard search; passed through to init-workspace.").option("-t, --task <title>","Task title for the workspace CLAUDE.md; passed through to init-workspace.").option("--test-path <path>","URL path for feature testing; passed through to init-workspace.").option("--description <text>","Free-form description for the CLAUDE.md header; passed through to init-workspace.").option("--starting-prompt <text>","First instruction for the agent; passed through to init-workspace.").addOption(new oc("--work-type <type>","Kind of work; seeds the first-phase handoff note. Passed through to init-workspace.").choices(["feature","bugfix","refactor","spike","incident"])).addOption(new oc("--context-strategy <id>","Context layer to generate: jit (skills, hooks, notes) or icm (staged folders). (env: SANDBOX_CONTEXT_STRATEGY; config: context_strategy).").choices([...An])).option("--autonomous","Run an icm workspace stage-to-PR with no human checks, and allow the Bash calls a headless session needs (env: SANDBOX_AUTONOMOUS; config: autonomous).").option("--model <id>","Claude model for this workspace's sessions: an alias (opus, sonnet, haiku) or a claude-\u2026 id; blank keeps Claude Code's default (env: SANDBOX_MODEL; config: model).").option("--auto-stop","Stop this workspace's feature containers when a Claude session in it ends and no other is open (a SessionEnd hook; env: SANDBOX_AUTO_STOP; config: auto_stop).").option("--browser-form","Collect inputs through the Sandbox-branded browser form (the same form the Desktop MCP App renders), pre-filled from every flag given, then create the workspace. Opens a localhost page in the default browser and blocks until submit/cancel.").option("--no-distill","Store the issue but don't have a model rewrite it into description/starting_prompt.").option("--open","With --browser-form: launch VS Code on the new workspace after creating.").option("--force","Delete a <user>/<workspace> branch an earlier workspace of the same name left on origin, instead of aborting (that branch's work is gone; see the abort message for how to continue it instead).")},"configure"),namespace:i(([e],t)=>({feature:e??null,issue_id:t.issueId??null,services:t.services??null,repos:t.repos??null,labels:t.labels??null,task:t.task??null,test_path:t.testPath??null,description:t.description??null,starting_prompt:t.startingPrompt??null,work_type:t.workType??null,context_strategy:t.contextStrategy??null,autonomous:t.autonomous??null,model:t.model??null,auto_stop:t.autoStop??null,browser_form:!!t.browserForm,open_vscode:!!t.open,no_distill:t.distill===!1,force:!!t.force}),"namespace")},{name:"list-workspaces",load:i(()=>Promise.resolve().then(()=>(jU(),DU)),"load"),configure:i(e=>{e.description("List the workspaces under the workspaces root with their issue and labels")},"configure"),namespace:i(()=>({}),"namespace")},{name:"issue",load:i(()=>Promise.resolve().then(()=>(WU(),UU)),"load"),configure:i(e=>{e.description("Read, update or file an issue in this machine's issue tracker (see `sandbox setup`)").addArgument(new $i("<action>","view: print the issue; update: change its status and/or add a comment; create: file a new issue and print its URL (Jira); start: move the workspace's issue to in progress (forward only)").choices(["view","update","create","start"])).argument("[ref]","Issue ID; omit inside a workspace to use its .sandbox/workspace.yml issue").option("--json","view: print the issue as JSON").option("--status <name>","update: move the issue to this status").option("--comment <text>","update: add this comment").option("--project <key>","create: the Jira project to file in").option("--type <type>","create: bug, feature or task (mapped to the tracker's issue type)").option("--title <text>","create: the issue's summary").option("--body-file <path>","create: the issue's description, from a file (- for stdin)")},"configure"),namespace:i(([e,t],n)=>({action:e,ref:t??null,json:!!n.json,status:n.status??null,comment:n.comment??null,project:n.project??null,type:n.type??null,title:n.title??null,bodyFile:n.bodyFile??null}),"namespace")},{name:"remove-workspace",load:i(()=>Promise.resolve().then(()=>(KU(),VU)),"load"),configure:i(e=>{e.description("Deprecated: use `sandbox close-out --abandon <reason>`. Hand off (commit + push) and delete a workspace").argument("<name>","Workspace directory name, as `sandbox list-workspaces` reports it").option("-y, --yes","Skip the confirmation prompt").option("--abandon <reason>","Remove despite unshipped work; records the reason in closeout.md and the PR files")},"configure"),namespace:i(([e],t)=>({name:e,yes:!!t.yes,abandon:t.abandon??null}),"namespace")},{name:"pr",load:i(()=>Promise.resolve().then(()=>(GU(),HU)),"load"),configure:i(e=>{e.description("Open and track this workspace's PRs from its PR files (docs/workspace-lifecycle.md)").addArgument(new $i("<action>","gate: run the pre-PR gate; open: gate, push and open each approved PR file; status: record merged/shipped/closed; adopt: record a PR opened outside the workspace; watch: resume each opening session once its PR merges, ships or closes (any workspace; `--install` schedules it)").choices(["gate","open","status","adopt","watch"])).argument("[args...]","[repo] \u2014 only this code worktree's PR file; adopt: <pr-number|url> [repo]").option("--no-pr <reason>","adopt: no PR \u2014 the fix is already on base").option("--install","watch: install a schedule (launchd on macOS, else crontab) that runs `pr watch` every 10 minutes").option("--uninstall","watch: remove that schedule").option("--json","Print the result as JSON")},"configure"),namespace:i(([e,t],n)=>{let r=t,s=typeof n.pr=="string"?n.pr:null,o=e==="adopt"&&s===null?r[0]??null:null;return{action:e,pr:o,noPr:s,repo:r[o?1:0]??null,json:!!n.json,install:!!n.install,uninstall:!!n.uninstall}},"namespace")},{name:"close-out",load:i(()=>Promise.resolve().then(()=>(zU(),YU)),"load"),configure:i(e=>{e.description("End a workspace. After every PR shipped: close the issue, write closeout.md, remove the workspace, delete merged branches. With --abandon: record the reason, push every branch and keep them, remove the workspace").argument("[name]","Workspace directory name; defaults to the workspace you are in").option("-y, --yes","Skip the confirmation prompt").option("--abandon <reason>","Close out without shipping; the reason goes in closeout.md and the PR files")},"configure"),namespace:i(([e],t)=>({name:e??null,yes:!!t.yes,abandon:t.abandon??null}),"namespace")},{name:"code",load:i(()=>Promise.resolve().then(()=>(XU(),JU)),"load"),configure:i(e=>{e.description("Open a workspace in VS Code").argument("[feature]","Workspace name, as `sandbox list-workspaces` reports it. If omitted, read from FEATURE in a .env file.")},"configure"),namespace:i(([e])=>({feature:e??null}),"namespace")},{name:"setup",load:i(()=>Promise.resolve().then(()=>(nW(),tW)),"load"),configure:i(e=>{e.description("Guided machine setup: walks through paths, ingress domains and the ~/.sandbox service registry, then converges the plugins, the sandbox-workspace checkout, the TLS certificate and the optional issue tracker, Telepresence and VS Code YAML-schema prerequisites").option("--check","Report prerequisite state without prompting or running any install/update commands").option("--yes","Non-interactive: accept every default and skip optional installs")},"configure"),namespace:i((e,t)=>({check:!!t.check,yes:!!t.yes}),"namespace")},{name:"config",load:i(()=>Promise.resolve().then(()=>(iW(),oW)),"load"),configure:i(e=>{e.description("Set up and maintain the machine-global sandbox config (~/.sandbox/config.yaml \u2014 the single source of truth); regenerates env.sh and wires up ~/.zshenv and the Desktop MCP config").option("--repos-root <path>","Absolute path to the canonical source-repo clones (non-interactive set).").option("--workspaces-root <path>","Absolute path to the per-feature worktree workspaces (non-interactive set).").option("--show","Print the resolved config and each value's origin, without writing.").option("--check","Validate config + derived files; nonzero exit on drift.")},"configure"),namespace:i((e,t)=>({repos_root:t.reposRoot??null,workspaces_root:t.workspacesRoot??null,show:!!t.show,check:!!t.check}),"namespace")},{name:"cache",load:i(()=>Promise.resolve().then(()=>(cW(),aW)),"load"),configure:i(e=>{e.description("Prune the shared build and package caches (`caches:` in the registry) by each one's age or prune rule").argument("<action>","prune \u2014 the only action").argument("[name]","One cache; every cache when omitted").option("--reset","Empty the cache(s) instead of applying the rule.").option("--force","Prune a cache even while a running container mounts it.").option("--dry-run","Report what would be deleted; change nothing.")},"configure"),namespace:i(([e,t],n)=>({action:e,name:t??null,reset:!!n.reset,force:!!n.force,dry_run:!!n.dryRun}),"namespace")},{name:"registry",load:i(()=>Promise.resolve().then(()=>(uW(),lW)),"load"),configure:i(e=>{e.description("Regenerate ~/.sandbox/services.yaml from every <repo>/.sandbox/services.yaml under paths.repos_root (merged under ~/.sandbox/services.local.yaml)").argument("[action]","sync \u2014 the default and only action").option("--check","Report drift without writing; nonzero exit when stale.")},"configure"),namespace:i(([e],t)=>({action:e??"sync",check:!!t.check}),"namespace")},{name:"init-workspace",load:i(()=>Promise.resolve().then(()=>(rO(),RU)),"load"),configure:i(e=>{e.description(`Reconcile a sandbox workspace from .sandbox/workspace.yml: create/remove repo worktrees to match the \`repos\`/\`services\` fields, then (re)generate CLAUDE.md / .env / ${Ue}. Idempotent \u2014 edit workspace.yml and rerun. Inputs resolve as CLI flag > env (SANDBOX_*) > workspace.yml.`).option("-t, --task <title>","Task description / title (env: SANDBOX_TASK; config: task).").option("--feature <name>","Feature name for sandbox slot routing (config: feature).").option("--services <list>","Comma-separated list of local services (env: SANDBOX_SERVICES; config: services). Their owning repos are added to the reconciled worktree set.").option("-r, --repos <list>","Comma-separated repos to keep as git worktrees (union with the repos owning --services). Persisted to workspace.yml; the worktree set is reconciled to match on every run (env: SANDBOX_REPOS; config: repos).").option("--force","When reconciling, delete repo worktrees dropped from workspace.yml even if they have uncommitted changes, and delete a <user>/<workspace> branch an earlier workspace left on origin instead of aborting (default: abort without changes).").option("--issue-id <ref>","Issue ID in this machine's issue tracker (see `sandbox setup`) (env: SANDBOX_ISSUE_ID; config: issue_id).").option("--labels <list>","Comma-separated free-form tags for filtering workspaces in the dashboard search (env: SANDBOX_LABELS; config: labels).").option("--test-path <path>","URL path for feature testing (env: SANDBOX_TEST_PATH; config: test_path).").option("--description <text>","Free-form description for the CLAUDE.md header (env: SANDBOX_DESCRIPTION; config: description).").option("--starting-prompt <text>","First instruction for the agent; persisted to .sandbox/workspace.yml (env: SANDBOX_STARTING_PROMPT; config: starting_prompt).").addOption(new oc("--work-type <type>","Kind of work; seeds the first-phase handoff note (env: SANDBOX_WORK_TYPE; config: work_type).").choices(["feature","bugfix","refactor","spike","incident"])).addOption(new oc("--context-strategy <id>","Context layer to generate: jit (skills, hooks, notes) or icm (staged folders). (env: SANDBOX_CONTEXT_STRATEGY; config: context_strategy).").choices([...An])).option("--autonomous","Run an icm workspace stage-to-PR with no human checks, and allow the Bash calls a headless session needs (env: SANDBOX_AUTONOMOUS; config: autonomous).").option("--model <id>","Claude model for this workspace's sessions: an alias (opus, sonnet, haiku) or a claude-\u2026 id; blank keeps Claude Code's default (env: SANDBOX_MODEL; config: model).").option("--auto-stop","Stop this workspace's feature containers when a Claude session in it ends and no other is open (a SessionEnd hook; env: SANDBOX_AUTO_STOP; config: auto_stop).").option("--config <path>","Path to a YAML config file (JSONC/JSON also accepted). Defaults to <workspace>/.sandbox/workspace.yml; legacy workspace.yaml / workspace.jsonc / workspace.json are migrated on next write (env: SANDBOX_WORKSPACE_CONFIG).").option("--prune-context","After a context_strategy change, delete the previous strategy's files that git tracks unmodified (anything else is kept and reported).").option("--refresh-issue","Re-fetch the workspace's issue into .sandbox/issue.md (BRIEF.md is not rewritten, except an untouched placeholder brief).")},"configure"),namespace:i((e,t)=>({task:t.task??null,feature:t.feature??null,services:t.services??null,repos:t.repos??null,force:!!t.force,issue_id:t.issueId??null,labels:t.labels??null,test_path:t.testPath??null,description:t.description??null,starting_prompt:t.startingPrompt??null,work_type:t.workType??null,context_strategy:t.contextStrategy??null,autonomous:t.autonomous??null,model:t.model??null,auto_stop:t.autoStop??null,config_file:t.config??null,prune_context:!!t.pruneContext,refresh_issue:!!t.refreshIssue}),"namespace")}];async function mye(e,t){try{let{migrateSlotsJson:r}=await Promise.resolve().then(()=>(Jt(),pP));await r()}catch{}let n;try{n=await e.load()}catch(r){throw r.code==="ERR_MODULE_NOT_FOUND"&&(console.log(`${aO}Failed to load command '${e.name}': ${r.message}${$y}`),process.exit(1)),r}try{await n.run(t)}catch(r){if(r instanceof G&&r.code!==_c?L(r.message):console.log(`${aO}Error: ${r.message}${$y}`),Ge("DEBUG"))throw r;process.exit(1)}}i(mye,"dispatch");async function gye(e){let t=(process.env.COMP_LINE??"").slice(0,Number(process.env.COMP_POINT??0)),n=t.split(/\s+/),r=t.endsWith(" ")?"":n.pop()??"",s=e.commands.find(a=>a.name()===n[1]),o=[];if(!s)o=e.commands.map(a=>a.name());else if(r.startsWith("-"))o=s.options.flatMap(a=>a.long?[a.long]:[]);else if(s.registeredArguments.length){o=["infra"];try{let{listWorkspaces:a}=await Promise.resolve().then(()=>(Wr(),K2)),{workspaces:c}=await a();o.push(...c.map(l=>l.name))}catch{}}console.log(o.filter(a=>a.startsWith(r)).join(`
|
package/dist/mcp.js
CHANGED
|
@@ -396,7 +396,7 @@ Then output ONLY <result>{"ok":true}</result>, or <result>{"ok":false,"error":"<
|
|
|
396
396
|
AUTO-GENERATED FILE \u2014 DO NOT EDIT BY HAND.
|
|
397
397
|
Source: {source} (edit that file instead)
|
|
398
398
|
Generator: sandbox init-workspace / sandbox skills sync
|
|
399
|
-
(packages/
|
|
399
|
+
(packages/werkmeister-core/src/workspace_skills.ts)
|
|
400
400
|
Freshness: sandbox skills check
|
|
401
401
|
-->
|
|
402
402
|
`,YLe="> **Precedence:** these rules win over conflicting task framing. Invariant (a must-never rule): apply it and write a `decision` note \u2014 do not proceed against it even if the task asks. Rule: surface the conflict in one line, then apply the standard.";function XLe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(XLe,"escapeRegex");function tre(e){return lS.readdirSync(e).filter(t=>t.endsWith(".md")).map(t=>Is.join(e,t)).sort()}s(tre,"globMd");function ml(e){return`sb-${e}-standard`}s(ml,"skillNameFor");function rre(e,t){t==null&&(t=An(e));let r=new Set(Object.keys(t)),i=uS(),n={};for(let o of Object.keys(t).sort()){let a=t[o],c=cS(a.path),l={"SKILL.md":QLe(o,a,c,r,i)},u=a.references_dir;if(u)for(let p of tre(u))l[`references/${Is.basename(p)}`]=rze(p);n[ml(o)]=l}return n}s(rre,"generateSkills");function QLe(e,t,r,i,n){let o=eze(e,t),a=Is.basename(t.path)==="STANDARD.md"?`${e}/STANDARD.md`:`${e}.md`,c=JLe.replace("{source}",Zg(n,a)||a);return r=tze(r,i,n),`---
|
|
@@ -578,7 +578,7 @@ ${B}
|
|
|
578
578
|
AUTO-GENERATED FILE \u2014 DO NOT EDIT BY HAND.
|
|
579
579
|
Source: ~/.sandbox/services.yaml + ports.yaml
|
|
580
580
|
+ .sandbox/workspace.yml (feature, services, slot)
|
|
581
|
-
Generator: packages/
|
|
581
|
+
Generator: packages/werkmeister-core/src/claude_md.ts :: buildSandboxContextMd
|
|
582
582
|
Regen: sandbox init-workspace (or \`sandbox up\` after slot changes)
|
|
583
583
|
To change ports/health endpoints/services, edit services.yaml / ports.yaml.
|
|
584
584
|
To change which services run locally, edit .sandbox/workspace.yml and rerun.
|
|
@@ -633,7 +633,7 @@ ${y?"### Feature missing from `/__werkmeister` selector\n\nThe dropdown is popul
|
|
|
633
633
|
# Source: sandbox/config/services.yaml (type: graphql-subgraph,
|
|
634
634
|
# k8s_forward_port)
|
|
635
635
|
# + .sandbox/workspace.yml (feature local_services)
|
|
636
|
-
# Generator: packages/
|
|
636
|
+
# Generator: packages/werkmeister-core/src/generate.ts :: generateSupergraphConfig
|
|
637
637
|
# Regen: sandbox up (or \`sandbox init-workspace\`)
|
|
638
638
|
# To add a subgraph: set its \`type: graphql-subgraph\` in services.yaml and rerun.
|
|
639
639
|
# To change endpoint path, set \`graphql_path: /<path>\` on the service (default /graphql).
|
|
@@ -645,7 +645,7 @@ ${y?"### Feature missing from `/__werkmeister` selector\n\nThe dropdown is popul
|
|
|
645
645
|
`),Cze(e,r,i,qt(),o)})}s(_d,"generateCaddyfile");function Rze(e){return`(?:^|;\\s*)X-Feature=${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:\\s*;|\\s*$)`}s(Rze,"featureCookieRegexp");function Pze(e,t){let r=[];for(let[i,n]of Object.entries(In(t))){if(n.remoteHostname&&n.remoteUpstream&&r.push({hostname:n.remoteHostname,service:i,upstream:n.remoteUpstream}),!n.hostname)continue;let o=t[i]??{},a=er(o)?o.port_offset??0:0,c=Object.entries(e).filter(([,u])=>er(u)&&u.slot!==null&&u.slot!==void 0&&(u.services??[]).includes(i)).sort(([u],[p])=>u<p?-1:u>p?1:0).map(([u,p],d)=>({name:u,upstream:`host.docker.internal:${hi(p.slot)[0]+a}`,matcher:`feat${d}_${u.replace(/[^A-Za-z0-9_]/g,"_")}`,cookie_regexp:Rze(u)})),l=n.remoteUpstream??c[0]?.upstream;l&&r.push({hostname:n.hostname,service:i,upstream:l,...c.length?{features:c}:{}})}return r}s(Pze,"buildHostRouters");function jze(e){let t=[];for(let r of e){t.push(`# ${r.service} \u2014 Caddy terminates ${r.hostname} directly`),t.push(`${r.hostname} {`),t.push(" tls internal"),t.push(""),t.push(" # Sandbox feature selector UI (sets/clears the X-Feature cookie)."),t.push(" # /__sandbox is a deprecated alias (SW-8; SW-11 removes it)."),t.push(" @selector_features path /__werkmeister/features.json /__sandbox/features.json"),t.push(" handle @selector_features {"),t.push(" root * /sandbox/proxy/ui"),t.push(" rewrite * /features.json"),t.push(" file_server"),t.push(" }"),t.push(" @selector path /__werkmeister* /__sandbox*"),t.push(" handle @selector {"),t.push(" root * /sandbox/proxy/ui"),t.push(" rewrite * /index.html"),t.push(" file_server"),t.push(" }"),t.push("");let i=r.features??[];if(i.length){for(let n of i)t.push(` # X-Feature=${n.name} -> that workspace's containers.`),t.push(` @${n.matcher} header_regexp Cookie ${n.cookie_regexp}`),t.push(` handle @${n.matcher} {`),t.push(` reverse_proxy ${n.upstream} {`),t.push(` header_up X-Feature ${n.name}`),t.push(" }"),t.push(" }");t.push(" # No cookie, or one naming a feature not serving this service.")}else t.push(" # X-Feature cookie -> X-Feature header (when present), then proxy."),t.push(" @xf header_regexp xf Cookie X-Feature=([^;]+)"),t.push(" handle @xf {"),t.push(` reverse_proxy ${r.upstream} {`),t.push(" header_up X-Feature {re.xf.1}"),t.push(" }"),t.push(" }");t.push(" handle /* {"),t.push(` reverse_proxy ${r.upstream}`),t.push(" }"),t.push("}"),t.push("")}return t}s(jze,"hostRouterLines");function Cze(e,t,r,i,n){let o=Pze(e,t),a=bS(),c=xS(a,"Caddyfile.njk");if(c){let u=c.render(wd({host_routers:o}));return Le.writeFileSync(n,u),X(`Generated Caddyfile (template): ${n}`),n}Z("Template 'Caddyfile.njk' not found -- falling back to built-in Caddyfile generation");let l=["# Auto-generated Caddyfile -- do not edit manually","# Regenerate with: sandbox proxy-reload","","{"," admin localhost:2019","}","",...jze(o)];return Le.writeFileSync(n,l.join(`
|
|
646
646
|
`)),X(`Generated Caddyfile (built-in): ${n}`),n}s(Cze,"generateCaddyfileLocked");async function kre(e,t,r,i="",n=[]){lg(r),j(`Generating ${rt}...`);let o=Qe(),a=bo(),c={services:o,ports:a},l={};for(let[_,$]of Object.entries(o)){if(!er($))continue;let E=($.path??"").replace(/\/+$/,""),I=E.includes("/")?E.slice(E.lastIndexOf("/")+1):E;I!==_&&(l[I]=_)}let u=s(_=>{if(_ in o)return _;let $=l[_];return $?(j(` Resolved service alias: ${_} \u2192 ${$}`),$):$??null},"resolve"),p=t.split(",").map(_=>_.trim()).filter(_=>_),d=new Map;for(let _ of p)d.set(_,u(_));let m=[...d.values()].filter(_=>_!==null),h=[...d.entries()].filter(([,_])=>_===null).map(([_])=>_);h.length>0&&Z(`Unknown services (skipped): ${h.join(", ")}`);let v;try{v=await Ck(e,m)}catch(_){let $=_ instanceof Error?_.message:String(_);return Z(`Could not allocate slot: ${$}`),$.startsWith("Timed out")?Z("Retry, or remove the stale lock file if no sandbox process is running."):Z("Run 'sandbox down <feature>' to free a slot, then re-run init-workspace."),null}Kg(e,v,m,c,r,"sandbox init-workspace"),_S(e,v,m,c,r),SS(e,v,m,c,r);let[g,y]=hi(v);X(`Compose ready (slot ${v}, ports ${g}-${y})`);let w=pre(e,v,g,y,m,o,i,null,zg(n,Fi(),m),fS(r)),k=Q(r);return Le.mkdirSync(k,{recursive:!0}),Le.writeFileSync(gt.join(k,"sandbox-context.md"),vr(w,r)),X(`Wrote ${gt.basename(k)}/sandbox-context.md`),v}s(kre,"generateWorkspaceCompose");f();ge();Bt();wt();import*as Sre from"node:fs";import*as $re from"node:path";var Rs=".githooks";function Ere(e){let t=e??qt();if(!Sre.existsSync($re.join(t,".git")))return!1;let r;try{r=ee(["git","-C",t,"config","--get","core.hooksPath"],{capture:!0})}catch(n){if(n instanceof ve&&n.code==="ENOENT")return Z(`git was not found on PATH \u2014 could not check or configure core.hooksPath. The sandbox secret-commit guard (${Rs}/pre-commit) was NOT installed.`),!1;throw n}let i=r.status===0?r.stdout.trim():"";if(i===Rs)return!0;if(i)return Z(`core.hooksPath is already set to '${i}' \u2014 leaving it unchanged. The sandbox secret-commit guard (${Rs}/pre-commit) was NOT installed. Run 'git config core.hooksPath ${Rs}' manually if you want to activate it.`),!1;try{ee(["git","-C",t,"config","core.hooksPath",Rs],{capture:!0,check:!0})}catch(n){let o=n instanceof ve&&n.code===void 0&&n.stderr?n.stderr.trim():String(n instanceof Error?n.message:n);return Z(`Could not set core.hooksPath to ${Rs} (${o}). The sandbox secret-commit guard (${Rs}/pre-commit) was NOT installed.`),!1}return j(`Configuring core.hooksPath -> ${Rs} (first-time setup)...`),X(`core.hooksPath set to ${Rs} (secret-commit guard active)`),!0}s(Ere,"configureGitHooksPath");f();ms();import*as wi from"node:fs";import*as Tre from"node:http";import*as b2 from"node:net";import*as $S from"node:path";import{setTimeout as Nze}from"node:timers/promises";ge();Zi();On();Bt();wt();async function x2(){return{"k8s-forwards":(await Yr(vi,"k8s-forwards",{all:!1})??[]).some(t=>t.health==="healthy"||t.state==="running"&&!t.health)}}s(x2,"checkPortForwardHealth");function Dze(e){return wi.existsSync(e)&&wi.statSync(e).isDirectory()}s(Dze,"isDir");function Lze(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}s(Lze,"shimLocalApiServer");function w2(){let e=$S.join(pi(),"k8s-port-forward","kubeconfig");Dze(e)&&wi.rmSync(e,{recursive:!0,force:!0}),wi.mkdirSync($S.dirname(e),{recursive:!0}),j("Refreshing k8s-port-forward/kubeconfig from current context...");try{let t=ee(["kubectl","config","view","--raw","--minify","--flatten"],{capture:!0,timeout:10});if(t.status===0){wi.writeFileSync(e,Lze(t.stdout));let r=ee(["kubectl","--kubeconfig",e,"config","current-context"],{capture:!0,timeout:5}),i=r.status===0?r.stdout.trim():"?";X(`Kubeconfig pinned to context: ${i}`)}else de(`kubectl config view failed: ${t.stderr.trim()}`)}catch(t){if(t instanceof ve&&(t.code==="ENOENT"||t.code==="ETIMEDOUT"))de(`Could not generate kubeconfig: ${t.message}`);else throw t}return wi.existsSync(e)&&wi.statSync(e).isFile()}s(w2,"refreshKubeconfig");function zze(){try{return ee(["kubectl","--request-timeout=3s","get","--raw","/readyz"],{capture:!0,timeout:20}).status===0}catch(e){if(e instanceof ve)return!1;throw e}}s(zze,"clusterReachable");async function ES(){if((await x2())["k8s-forwards"]??!1)return X("k8s port-forwards container is healthy"),"healthy";if(Z("k8s port-forwards container is unhealthy \u2014 restarting..."),!w2())return de("Not restarting k8s-forwards without a kubeconfig file to mount"),"failed";if(!zze())return Z("No reachable k8s cluster \u2014 skipping port-forwards; services not run locally are unavailable"),"failed";let{argv:t,env:r,cwd:i}=cd();try{let n=ee([...t,"up","-d","--force-recreate","k8s-forwards"],{capture:!0,timeout:60,env:r,cwd:i});return n.status!==0?(de(`Failed to restart k8s-forwards: ${n.stderr.trim()}`),"failed"):(X("k8s port-forwards container restarted"),"restarted")}catch(n){if(n instanceof ve)return de(`Failed to restart k8s-forwards: ${n.message}`),"failed";throw n}}s(ES,"ensurePortForwardsHealthy");async function Ore(e=3e4,t=500){let r=Ig();if(!r.length)return;j("Waiting for port-forwards to reconnect...");let i=Date.now()+e;for(;;){if(r=(await Promise.all(r.map(async o=>({spec:o,ok:(await TS(o.listen,o.health)).ok})))).filter(o=>!o.ok).map(o=>o.spec),!r.length){X("k8s port-forwards are carrying traffic");return}if(Date.now()>=i)throw new se(`k8s port-forwards did not come back within ${Math.round(e/1e3)}s: ${r.map(o=>`${o.name}:${o.listen}`).join(", ")}
|
|
647
647
|
Check \`docker logs sandbox-k8s-forwards\` and your kubeconfig.`,"FORWARDS_NEVER_READY");await Nze(t)}}s(Ore,"waitForForwards");function Mze(e,t,r=3500){return new Promise(i=>{let n=Tre.get({host:"127.0.0.1",port:e,path:t,timeout:r},o=>{o.resume();let a=o.statusCode??0;i({ok:a<500,detail:`HTTP ${a}`})});n.on("timeout",()=>{n.destroy(),i({ok:!1,detail:"timeout"})}),n.on("error",o=>i({ok:!1,detail:o.code??o.message}))})}s(Mze,"checkHttpHealth");var Ire={redis:{send:Buffer.from(`PING\r
|
|
648
|
-
`),ok:s(e=>e.toString("latin1").startsWith("+PONG"),"ok")},postgres:{send:Buffer.from([0,0,0,8,4,210,22,47]),ok:s(e=>e[0]===83||e[0]===78,"ok")}};function Fze(e,t,r=3500){return new Promise(i=>{let n=Ire[t],o=b2.connect({host:"127.0.0.1",port:e,timeout:r});o.on("connect",()=>o.write(n.send)),o.once("data",a=>{o.destroy();let c=n.ok(a);i({ok:c,detail:c?`${t} ok`:`${t} bad reply`})}),o.on("timeout",()=>{o.destroy(),i({ok:!1,detail:"timeout (connected, no reply)"})}),o.on("error",a=>i({ok:!1,detail:a.code??a.message})),o.on("close",()=>i({ok:!1,detail:"closed without reply"}))})}s(Fze,"checkWireHealth");function qze(e,t=2500){return new Promise(r=>{let i=b2.connect({host:"127.0.0.1",port:e,timeout:t});i.on("connect",()=>{i.destroy(),r({ok:!0,detail:"tcp open"})}),i.on("timeout",()=>{i.destroy(),r({ok:!1,detail:"timeout"})}),i.on("error",n=>r({ok:!1,detail:n.code??n.message}))})}s(qze,"checkTcpHealth");function TS(e,t){return t.startsWith("/")?Mze(e,t):Ire[t]?Fze(e,t):t?Promise.resolve({ok:!1,detail:`unknown probe "${t}"`}):qze(e)}s(TS,"checkForwardHealth");async function Uze(e,t){return(await TS(e,t)).ok?"alive":"dead"}s(Uze,"classifyForward");async function Are(){let e=await zX("sandbox-k8s-forwards"),t;try{t=Ig()}catch{return[]}let r=[];for(let i of t)r.push({name:i.name,listen_port:i.listen,remote_port:i.remote,health_path:i.health,status:e?await Uze(i.listen,i.health):"container_down"});return r}s(Are,"getPerServiceStatus");Bt();wt();f();ge();Bt();wt();import{spawn as Bze}from"node:child_process";import*as Pt from"node:fs";import*as Rre from"node:net";import*as Pre from"node:os";import*as Co from"node:path";var Ps={label:"Workspaces dashboard",dir:"
|
|
648
|
+
`),ok:s(e=>e.toString("latin1").startsWith("+PONG"),"ok")},postgres:{send:Buffer.from([0,0,0,8,4,210,22,47]),ok:s(e=>e[0]===83||e[0]===78,"ok")}};function Fze(e,t,r=3500){return new Promise(i=>{let n=Ire[t],o=b2.connect({host:"127.0.0.1",port:e,timeout:r});o.on("connect",()=>o.write(n.send)),o.once("data",a=>{o.destroy();let c=n.ok(a);i({ok:c,detail:c?`${t} ok`:`${t} bad reply`})}),o.on("timeout",()=>{o.destroy(),i({ok:!1,detail:"timeout (connected, no reply)"})}),o.on("error",a=>i({ok:!1,detail:a.code??a.message})),o.on("close",()=>i({ok:!1,detail:"closed without reply"}))})}s(Fze,"checkWireHealth");function qze(e,t=2500){return new Promise(r=>{let i=b2.connect({host:"127.0.0.1",port:e,timeout:t});i.on("connect",()=>{i.destroy(),r({ok:!0,detail:"tcp open"})}),i.on("timeout",()=>{i.destroy(),r({ok:!1,detail:"timeout"})}),i.on("error",n=>r({ok:!1,detail:n.code??n.message}))})}s(qze,"checkTcpHealth");function TS(e,t){return t.startsWith("/")?Mze(e,t):Ire[t]?Fze(e,t):t?Promise.resolve({ok:!1,detail:`unknown probe "${t}"`}):qze(e)}s(TS,"checkForwardHealth");async function Uze(e,t){return(await TS(e,t)).ok?"alive":"dead"}s(Uze,"classifyForward");async function Are(){let e=await zX("sandbox-k8s-forwards"),t;try{t=Ig()}catch{return[]}let r=[];for(let i of t)r.push({name:i.name,listen_port:i.listen,remote_port:i.remote,health_path:i.health,status:e?await Uze(i.listen,i.health):"container_down"});return r}s(Are,"getPerServiceStatus");Bt();wt();f();ge();Bt();wt();import{spawn as Bze}from"node:child_process";import*as Pt from"node:fs";import*as Rre from"node:net";import*as Pre from"node:os";import*as Co from"node:path";var Ps={label:"Workspaces dashboard",dir:"werkmeister-dashboard",port:3001,stem:"mcp-server",entry:"dist/main.js",buildRef:"dist/main.js"},Zze={label:"Sandbox MCP server",dir:"werkmeister-mcp",port:3002,stem:"sandbox-mcp",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/mcp.js",env:{HOST:"0.0.0.0"}},Hze=[Ps,Zze];function _2(e){return new Promise(t=>setTimeout(t,e*1e3))}s(_2,"sleep");async function jre(e){let t;try{t=ee(["lsof","-ti",`tcp:${e}`,"-sTCP:LISTEN"],{capture:!0,timeout:5}).stdout}catch(i){if(i instanceof ve&&(i.code==="ENOENT"||i.code==="ETIMEDOUT"))return;throw i}let r=t.split(/\s+/).map(i=>i.trim()).filter(i=>/^\d+$/.test(i)).map(i=>Number.parseInt(i,10));for(let i of r)try{process.kill(i,"SIGTERM")}catch{continue}if(r.length!==0){for(let i=0;i<20;i++){if(!await k2(e))return;await _2(.25)}for(let i of r)try{process.kill(i,"SIGKILL")}catch{continue}}}s(jre,"freePort");function Cre(){let e=Q(Pre.homedir());return Pt.mkdirSync(e,{recursive:!0}),e}s(Cre,"stateDir");function yl(e){return Co.join(Cre(),`${e.stem}.pid`)}s(yl,"pidFile");function Wze(e){return Co.join(Cre(),`${e.stem}.log`)}s(Wze,"logFile");function Nre(e){return Co.join(gJ(),"apps",e.dir)}s(Nre,"appDir");function Vze(e,t){let r=t.lastIndexOf("/"),i=r>=0?Co.join(e,t.slice(0,r)):e,n=r>=0?t.slice(r+1):t,o=new RegExp("^"+n.split("*").map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$"),a;try{a=Pt.readdirSync(i,{withFileTypes:!0})}catch{return[]}return a.filter(c=>o.test(c.name)).map(c=>Co.join(i,c.name))}s(Vze,"globMatch");function Kze(e){let t=Nre(e),r=Co.join(t,e.buildRef),i;try{let o=Pt.statSync(r);if(!o.isFile())return!0;i=o.mtimeMs}catch{return!0}let n=["*.ts","*.html","package.json","tsconfig*.json","src/*.ts","src/*.css","src/lib/*.ts"];for(let o of n)for(let a of Vze(t,o))try{if(Pt.statSync(a).mtimeMs>i)return!0}catch{continue}return!1}s(Kze,"distStale");function Gze(e,t){try{return Pt.statSync(t).mtimeMs>Pt.statSync(yl(e)).mtimeMs}catch{return!1}}s(Gze,"buildNewerThanRunning");function Jze(e){let t;try{t=Pt.readFileSync(yl(e),"utf8")}catch{return null}let r=t.trim();return/^[+-]?\d+$/.test(r)?Number.parseInt(r,10):null}s(Jze,"readPid");function Dre(e){try{process.kill(e,0)}catch(t){let r=t.code;if(r==="ESRCH")return!1;if(r==="EPERM")return!0;throw t}return!0}s(Dre,"alive");function k2(e){return new Promise(t=>{let r=Rre.connect({host:"127.0.0.1",port:e}),i=s(n=>{r.destroy(),t(n)},"done");r.setTimeout(1e3,()=>i(!1)),r.once("connect",()=>i(!0)),r.once("error",()=>i(!1))})}s(k2,"portOpen");function S2(e=Ps){let t=Jze(e);return t&&Dre(t)?[!0,t]:[!1,null]}s(S2,"isRunning");async function $2(e=Ps){let[t,r]=S2(e);return{running:t,pid:r,port:e.port,url:`http://localhost:${e.port}/`,healthy:t&&await k2(e.port)}}s($2,"status");async function E2(e=Ps,t=!0,r=!1){let[i,n]=S2(e);if(i&&n===process.pid)return X(`${e.label} is this process (pid ${n}); leaving it running`),!0;let o=Nre(e),a=e.entry,c=Co.join(o,e.buildRef);if(!Pt.existsSync(Co.join(o,"package.json"))){let g=e.bundled?Co.join(qt(),e.bundled):null;if(!g||!Pt.existsSync(g))return Z(`${e.label} not found at ${o}; skipping`),!1;o=qt(),a=g,c=g,t=!1}let l=!1;if(t&&Kze(e)){j(`Building ${e.label} (sources changed)...`);let g;try{g=ee(["pnpm","run","build"],{cwd:o,capture:!0,timeout:300})}catch(y){if(y instanceof ve&&y.code==="ENOENT")return Z(`pnpm not found; skipping ${e.label}`),!1;if(y instanceof ve&&y.code==="ETIMEDOUT")return de(`${e.label} build timed out; skipping`),!1;throw y}if(g.status!==0){let y=(g.stderr.trim()||g.stdout.trim()).slice(-800);return de(`${e.label} build failed; skipping start:
|
|
649
649
|
${y}`),!1}l=!0}else t&&j(`${e.label} build up to date; skipping build`);if(i&&!l&&Gze(e,c)&&(j(`Running ${e.label} predates the current build; bouncing to reload it.`),r=!0),i&&!l&&!r)return X(`${e.label} already running (pid ${n}, http://localhost:${e.port}/)`),!0;i&&await Yze(e),await jre(e.port);let u=Wze(e),p={...process.env,PORT:String(e.port),...e.env??{}};j(`Starting ${e.label} on http://localhost:${e.port}/ ...`);let d=Pt.openSync(u,"w"),m=Bze("node",[a],{cwd:o,detached:!0,stdio:["ignore",d,d],env:p}),h=await new Promise(g=>{m.once("spawn",()=>g("spawned")),m.once("error",y=>g(y))});if(Pt.closeSync(d),h!=="spawned"){if(h.code==="ENOENT")return Z(`node not found; skipping ${e.label}`),!1;throw h}m.unref(),Pt.writeFileSync(yl(e),String(m.pid));let v=!1;m.once("exit",()=>{v=!0});for(let g=0;g<20;g++){if(v)return de(`${e.label} exited immediately (see ${u})`),Pt.rmSync(yl(e),{force:!0}),!1;if(await k2(e.port))return X(`${e.label} started (pid ${m.pid}, http://localhost:${e.port}/)`),!0;await _2(.25)}return Z(`${e.label} started (pid ${m.pid}) but port ${e.port} not up yet; check ${u}`),!0}s(E2,"start");async function Yze(e=Ps){let[t,r]=S2(e);if(!t||r===null)return Pt.rmSync(yl(e),{force:!0}),!1;j(`Stopping ${e.label} (pid ${r})...`);try{process.kill(r,"SIGTERM")}catch(n){let o=n.code;if(o==="ESRCH")return Pt.rmSync(yl(e),{force:!0}),!1;if(o==="EPERM")return de(`Cannot signal pid ${r} (owned by another user)`),!1;throw n}let i=!1;for(let n=0;n<20;n++){if(!Dre(r)){i=!0;break}await _2(.25)}if(!i)try{process.kill(r,"SIGKILL")}catch{}return Pt.rmSync(yl(e),{force:!0}),await jre(e.port),X(`${e.label} stopped`),!0}s(Yze,"stop");async function Lre(e=!0){for(let t of Hze)await E2(t,e)}s(Lre,"startAll");function Xze(){let e=OS.join(gs(),"corp-ca.crt");if(No.mkdirSync(OS.dirname(e),{recursive:!0}),(No.existsSync(e)?No.readFileSync(e,"utf8"):"").includes("BEGIN CERTIFICATE"))return;if(zre.platform()!=="darwin"){No.writeFileSync(e,"");return}let r=["goskope","certadmin","Zscaler","Palo Alto"],i=[];for(let o of r){let a=ee(["security","find-certificate","-a","-p","-c",o,"/Library/Keychains/System.keychain"],{capture:!0,timeout:5});a.status===0&&a.stdout.includes("BEGIN CERTIFICATE")&&i.push(a.stdout)}let n=i.join("");No.writeFileSync(e,n),n.includes("BEGIN CERTIFICATE")&&j(`Corporate CA extracted to ${e} (image builds will trust it)`)}s(Xze,"ensureCorpCa");async function Qze(){j("Generating proxy/Caddyfile..."),await _d(),Nk(),w2()}s(Qze,"ensureProxyFiles");async function e6e(e){let{argv:t,env:r,cwd:i}=cd(),n=t[3];if(!No.existsSync(n))return Z(`Missing ${n}`),!1;j("Starting shared infrastructure (k8s-forwards, caddy, jaeger, redisinsight)...");try{let o=await Bi([...t,"up","-d","--build"],{capture:!0,signal:e,env:r,cwd:i});return o.status!==0?(de(`docker compose failed:
|
|
650
650
|
${o.stderr.trim()}`),!1):(X("Shared infrastructure started"),!0)}catch(o){if(o instanceof ve&&o.code==="ABORT_ERR")return Z("Shared infrastructure start was cancelled"),!1;if(o instanceof ve&&o.code==="ENOENT")return de("docker not found"),!1;throw o}}s(e6e,"startSharedInfra");async function T2({signal:e}={}){if(e?.aborted)return Z("Infrastructure start was cancelled before it began"),!1;Ere(),await Qze(),Xze();let t=await e6e(e);return await Lre(!0),t}s(T2,"up");async function Mre(){if((await x2())["k8s-forwards"]??!1)return X("k8s port-forwards container is already healthy"),!0;j("Attempting to start/restart k8s-forwards container...");let e=await ES()!=="failed";return e&&X("k8s port-forwards started"),e}s(Mre,"connectK8s");f();Zi();Da();import*as kd from"node:fs";import*as IS from"node:os";import*as AS from"node:path";var t6e=10,Fre=2e3,r6e=5*6e4;function qre(e){return AS.join(Q(e),"starts.json")}s(qre,"startsFile");function Ure(e){try{let t=JSON.parse(kd.readFileSync(qre(e),"utf8"));return Array.isArray(t)?t:[]}catch{return[]}}s(Ure,"readStarts");function n6e(e,t,r,i=Date.now()){try{let n=qre(e),o=[...Ure(e),{by:t,from:new Date(r).toISOString(),to:new Date(i).toISOString()}].slice(-t6e);kd.mkdirSync(AS.dirname(n),{recursive:!0}),kd.writeFileSync(n,`${JSON.stringify(o,null,2)}
|
|
651
651
|
`)}catch{}}s(n6e,"recordStart");async function RS(e,t,r){let i=Date.now();try{return await r()}finally{n6e(e,t,i)}}s(RS,"withStartRecord");function i6e(e,t){for(let r=t.length-1;r>=0;r--){let i=t[r];if(e>=Date.parse(i.from)-Fre&&e<=Date.parse(i.to)+Fre)return i.by}return"person"}s(i6e,"startedBy");function Bre(e,t,r){return e.state==="restarting"?!0:!t||t.restartCount===0?!1:e.state!=="running"||r-t.startedAt<r6e}s(Bre,"isCrashLoop");function o6e(e){return e.state==="running"||e.state==="restarting"||e.state==="exited"&&e.exitCode!==0}s(o6e,"worthInspecting");function s6e(e,t,r,i){let n=new Map,o=new Map;for(let a of e){let c=a.labels["com.docker.compose.project"];if(!c)continue;let l=n.get(c)??{started:null,crashLoops:[]};n.set(c,l);let u=t.get(a.name);if(Bre(a,u,i)&&l.crashLoops.push({service:a.service,restarts:u?.restartCount??0,lastLog:null}),a.state!=="running"||!u||Number.isNaN(u.startedAt))continue;let p=o.get(c);(!p||u.startedAt<p.at)&&o.set(c,{at:u.startedAt,workingDir:a.labels["com.docker.compose.project.working_dir"]??""})}for(let[a,{at:c,workingDir:l}]of o){let u=n.get(a);u.started={at:new Date(c).toISOString(),by:l?i6e(c,r(l)):"person"}}for(let a of n.values())a.crashLoops.sort((c,l)=>c.service.localeCompare(l.service));return n}s(s6e,"healthOf");async function PS(e,t=Date.now()){let r=e.filter(o6e),i=await qX(r.map(o=>o.name)),n=s6e(r,i,Ure,t);return await Promise.all(r.filter(o=>Bre(o,i.get(o.name),t)).map(async o=>{let a=n.get(o.labels["com.docker.compose.project"])?.crashLoops.find(c=>c.service===o.service&&c.lastLog===null);a&&(a.lastLog=await UX(o.name,i.get(o.name)?.tty??!1))})),n}s(PS,"projectHealth");var Gg=s(e=>Math.round(e*10)/10,"round1");function a6e(e){let t={};for(let r of e){let i=r.labels["com.docker.compose.project"];if(!i)continue;let n=t[i]??={cpuPercent:0,memMib:0};n.cpuPercent+=r.cpuPercent,n.memMib+=r.memMib}for(let r of Object.values(t))r.cpuPercent=Gg(r.cpuPercent),r.memMib=Math.round(r.memMib);return t}s(a6e,"usageByProject");function c6e(e,t=IS.loadavg(),r=IS.availableParallelism()){let i=e.filter(n=>{let o=n.labels["com.sandbox.local.feature"];return o&&o!=="infra"});return{load:[Gg(t[0]),Gg(t[1]),Gg(t[2])],cores:r,featureCpuPercent:Gg(i.reduce((n,o)=>n+o.cpuPercent,0))}}s(c6e,"hostSummary");async function O2(e=2e4){let t=await FX(AbortSignal.timeout(e));return{projects:a6e(t),host:c6e(t)}}s(O2,"getWorkspaceResources");f();To();ge();Zi();Eo();Qg();async function h6e(){return(await Yr(vi,void 0,{all:!1})??[]).map(({service:t,state:r,health:i})=>{let n;return i==="healthy"?n="healthy":i==="starting"?n="starting":r==="running"?n="running":n=r||"down",{service:t||"unknown",display:n}})}s(h6e,"getInfraStatus");function g6e(e){if(typeof e=="number"){let[t,r]=hi(e);return`${t}-${r}`}return"?"}s(g6e,"featurePortRange");function v6e(e){return Og(e.service,e.role)&&e.status==="exited"&&e.exitCode===0}s(v6e,"finishedSetup");function y6e(e){return e.filter(t=>!v6e(t))}s(y6e,"tallied");function ine(e){return Object.entries(e).sort((t,r)=>{let i=typeof t[1].slot=="number"?t[1].slot:99,n=typeof r[1].slot=="number"?r[1].slot:99;return i-n})}s(ine,"sortedSlots");function one(e,t,r){let i=[];for(let[n,o]of ine(e))for(let a of o.services??[]){let c=t[a],l=LS(c),u=l===null?String(c.k8s_deployment):null,p=u!==null?r.intercepts.get(u):void 0;i.push({feature:n,service:a,deployment:u,interceptable:l===null,blocker:l,intercepted:p!==void 0,intercepted_by:p??null})}return i}s(one,"buildInterceptRows");var sne=s(e=>Sd(e,15),"STATUS_READ");async function F2(){let e=zS(sne),t=Qe(),r=e.installed?one(await $o(),t,e):[];return{available:e.available,installed:e.installed,connected_namespace:e.namespace,intercepts:r,remote_services:Object.keys(t).filter(i=>D2(t[i])).sort()}}s(F2,"interceptsSnapshot");async function b6e(){let[e,t]=await Promise.all([Yr().then(r=>PS(r??[])),O2().catch(()=>null)]);return{health:e,resources:t}}s(b6e,"featureVitals");async function ane(){let e=b6e(),t=$te().catch(()=>[]),r=await h6e(),i=await Are(),n=await $o(),o=await $2(),a=zS(sne),c=one(n,Qe(),a),{health:l,resources:u}=await e,p=[];for(let[d,m]of ine(n)){let h=y6e(await uD(d)),v=`sandbox-${d}`,g=u?.projects[v],y=l.get(v);p.push({name:d,slot:m.slot,services:m.services??[],port_range:g6e(m.slot),containers:h,containers_running:h.filter(w=>w.status==="running").length,containers_total:h.length,intercepts:c.filter(w=>w.feature===d),cpu_percent:g?.cpuPercent??null,mem_mib:g?.memMib??null,started_at:y?.started?.at??null,started_by:y?.started?.by??null,crash_loops:y?.crashLoops??[]})}return{host:u?.host??null,infrastructure:r,mcp_web_server:o,k8s_forwards:i,features:p,caches:await t,summary:{total_features:p.length,available_slots:tD()-p.length,infra_healthy:r.length>0&&r.every(d=>d.display==="healthy"||d.display==="running"),k8s_alive:i.filter(d=>d.status==="alive").length,k8s_total:i.length,telepresence_available:a.available,intercepts_active:c.filter(d=>d.intercepted).length}}}s(ane,"statusSnapshot");MS();Ts();f();ge();import*as Od from"node:fs";import*as qS from"node:path";var vne=s(e=>qS.join(Q(e),"issue.md"),"issueCopyPath"),bl=class extends Error{static{s(this,"IssueFetchError")}};async function US(e,t=()=>new Date){let r=Et(),i=await r.fetchIssue(e);if(!i)throw new bl(`couldn't read ${e} from ${r.label}`);return{ref:i.ref,url:i.url??r.url(i.ref),tracker:r.id,title:i.title??"",status:i.status??"",body:i.description??"",comments:i.comments??[],fetchedAt:t().toISOString()}}s(US,"fetchIssueSnapshot");var J2=`
|
|
@@ -873,7 +873,7 @@ Lifecycle: \`working \u2192 ready \u2192 pr-open \u2192 merged \u2192 shipped \u
|
|
|
873
873
|
`):["---",`source: .sandbox/workspace.yml (description, starting_prompt)${i?", .sandbox/issue.md":""}`,"---","",`# Brief: ${e.task}`,"",hl(e.issue),...r?[r,""]:[],...t?[t,""]:[],...i&&!r&&!t?[D8e,""]:[]].join(`
|
|
874
874
|
`)}s(z8e,"renderBrief");function Kne(e){let t=t$(e.inputs.work_type??""),r=wl(t),i=S8e(e),n=Vne(e,t),o={"_shared/standards.md":T8e(i),"_shared/issues-report.md":QS(e.workspaceName,gd(e.meta))},a=xL(t);return a&&(o["_shared/pr-rules.md"]=e$(`stages/${a}/output/`,n.autonomous)),t.forEach((c,l)=>{o[`stages/${r[l]}/CONTEXT.md`]=A8e(r[l],c,{...n,standards:O8e(c.standards,i)},l===0&&!!gd(e.meta))}),o}s(Kne,"render");function M8e(e){let t=dn(e,null),r={};for(let[,,i]of bd){let n=t[i];n!=null&&(r[i]=Array.isArray(n)?n.map(String).join(","):String(n))}return{workspaceRoot:e,workspaceName:_r.basename(e),repos:fl(e).map(i=>[_r.basename(i),""]),task:r.task??"",meta:{FEATURE:r.feature??"",SERVICES:r.services??""},inputs:r,configOverride:null}}s(M8e,"contextFromDisk");function Gne(e,t,r){let i=_r.join(e,t);zr.mkdirSync(_r.dirname(i),{recursive:!0}),zr.writeFileSync(i,vr(r,e))}s(Gne,"writeRel");function Zne(e){let t=M8e(e);return Wne(e,t$(t.inputs.work_type??"")).length?[]:Object.entries(Kne(t)).filter(([r,i])=>{try{return zr.readFileSync(_r.join(e,r),"utf8")!==vr(i,e)}catch{return!0}})}s(Zne,"drifted");function F8e(e){let t=e.workspaceRoot,r=t$(e.inputs.work_type??""),i=Wne(t,r);i.length&&Z(`stages/ holds ${i.join(", ")}, which the current ${e.inputs.work_type||"feature"} template does not render \u2014 left CLAUDE.md, CONTEXT.md, _shared/ and stages/ as they are so the run keeps its pipeline. To regenerate them from the current template, move stages/ aside and rerun.`);let n=i.length?{}:{"CLAUDE.md":R8e(e,r),"CONTEXT.md":C8e(e,r),...Kne(e)},o=_r.join(t,"BRIEF.md"),a=zr.existsSync(o)?zr.readFileSync(o,"utf8"):null;(a===null||e.issue?.fetchedAt&&L8e.test(a))&&(n["BRIEF.md"]=z8e(e));for(let[c,l]of Object.entries(n))Gne(t,c,l),X(`Wrote ${c}`);for(let c of i.length?[]:wl(r)){let l=_r.join(t,"stages",c,"output");zr.existsSync(l)||(zr.mkdirSync(l,{recursive:!0}),zr.writeFileSync(_r.join(l,".gitkeep"),""))}wL.refresh(t)}s(F8e,"init");var wL={id:"icm",init:F8e,refresh(e){for(let r of Dne(e))j(`Removed JIT hook from .claude/settings.json: ${r}`);let t=_r.join(Q(e),".gate");zr.existsSync(t)&&(zr.rmSync(t,{recursive:!0,force:!0}),j(`Removed ${_r.basename(Q(e))}/.gate/`)),Nne(e),ov(e)},check:s(e=>Zne(e).map(([t])=>t),"check"),sync(e){let t=[];for(let[r,i]of Zne(e))Gne(e,r,i),j(`wrote ${r}`),t.push(r);return{wrote:t}},sessionContext:s(()=>null,"sessionContext"),gate(){},ownedPaths:s(()=>["CLAUDE.md","CONTEXT.md","BRIEF.md","_shared","stages"],"ownedPaths")};f();import*as Fr from"node:fs";import*as Wn from"node:path";f();import*as Ns from"node:fs";import*as sv from"node:path";ge();var Jne=`<!--
|
|
875
875
|
AUTO-GENERATED FILE \u2014 DO NOT EDIT BY HAND.
|
|
876
|
-
Generator: sandbox init-workspace (packages/
|
|
876
|
+
Generator: sandbox init-workspace (packages/werkmeister-core/src/agent_gen.ts)
|
|
877
877
|
Regenerated on every init-workspace run; edits will be clobbered.
|
|
878
878
|
-->
|
|
879
879
|
`,_L="sb-researcher";function q8e(){return`---
|
|
@@ -1178,7 +1178,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
1178
1178
|
- omitted: host decides border`)}),BTt=x.object({method:x.literal("ui/request-display-mode"),params:x.object({mode:Ev.describe("The display mode being requested.")})}),ZTt=x.object({mode:Ev.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),TUe=x.union([x.literal("model"),x.literal("app")]).describe("Tool visibility scope - who can access the tool."),HTt=x.object({resourceUri:x.string().optional(),visibility:x.array(TUe).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
1179
1179
|
- "model": Tool visible to and callable by the agent
|
|
1180
1180
|
- "app": Tool callable by the app from this server only`),csp:x.never().optional(),permissions:x.never().optional()}),WTt=x.object({mimeTypes:x.array(x.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),VTt=x.object({method:x.literal("ui/download-file"),params:x.object({contents:x.array(x.union([UR,BR])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),KTt=x.object({method:x.literal("ui/message"),params:x.object({role:x.literal("user").describe('Message role, currently only "user" is supported.'),content:x.array(op).describe("Message content blocks (text, image, etc.).")})}),GTt=x.object({method:x.literal("ui/notifications/sandbox-resource-ready"),params:x.object({html:x.string().describe("HTML content to load into the inner iframe."),sandbox:x.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Ez.optional().describe("CSP configuration from resource metadata."),permissions:Tz.optional().describe("Sandbox permissions from resource metadata.")})}),JTt=x.object({method:x.literal("ui/notifications/tool-result"),params:Cc.describe("Standard MCP tool execution result.")}),lae=x.object({toolInfo:x.object({id:ep.optional().describe("JSON-RPC id of the tools/call request."),tool:Zw.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:xUe.optional().describe("Current color theme preference."),styles:SUe.optional().describe("Style configuration for theming the app."),displayMode:Ev.optional().describe("How the UI is currently displayed."),availableDisplayModes:x.array(Ev).optional().describe("Display modes the host supports."),containerDimensions:x.union([x.object({height:x.number().describe("Fixed container height in pixels.")}),x.object({maxHeight:x.union([x.number(),x.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(x.union([x.object({width:x.number().describe("Fixed container width in pixels.")}),x.object({maxWidth:x.union([x.number(),x.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
1181
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:x.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:x.string().optional().describe("User's timezone in IANA format."),userAgent:x.string().optional().describe("Host application identifier."),platform:x.union([x.literal("web"),x.literal("desktop"),x.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:x.object({touch:x.boolean().optional().describe("Whether the device supports touch input."),hover:x.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:x.object({top:x.number().describe("Top safe area inset in pixels."),right:x.number().describe("Right safe area inset in pixels."),bottom:x.number().describe("Bottom safe area inset in pixels."),left:x.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),YTt=x.object({method:x.literal("ui/notifications/host-context-changed"),params:lae.describe("Partial context update containing only changed fields.")}),XTt=x.object({method:x.literal("ui/update-model-context"),params:x.object({content:x.array(op).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:x.record(x.string(),x.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),QTt=x.object({method:x.literal("ui/initialize"),params:x.object({appInfo:Pm.describe("App identification (name and version)."),appCapabilities:EUe.describe("Features and capabilities this app provides."),protocolVersion:x.string().describe("Protocol version this app supports.")})}),eOt=x.object({protocolVersion:x.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Pm.describe("Host application identification and version."),hostCapabilities:$Ue.describe("Features and capabilities provided by the host."),hostContext:lae.describe("Rich context about the host environment.")}).passthrough();var cae="ui/resourceUri",Il="text/html;profile=mcp-app";function Oz(e,t,r,i){let n=r._meta,o=n.ui,a=n[cae],c=n;return o?.resourceUri&&!a?c={...n,[cae]:o.resourceUri}:a&&!o?.resourceUri&&(c={...n,ui:{...o,resourceUri:a}}),e.registerTool(t,{...r,_meta:c},i)}s(Oz,"K3");function Iz(e,t,r,i,n){return e.registerResource(t,r,{mimeType:Il,...i},n)}s(Iz,"N3");var OUe="io.modelcontextprotocol/ui";function uae(e){if(e)return e.extensions?.[OUe]}s(uae,"Y3");ge();On();wt();var T$="ui://workspace/mcp-app.html",O$="ui://workspace/mcp-list.html",Tv={ui:{visibility:["app"]}};function Az(e,t){try{let r=IUe.join(qt(),"..",e,"dist",t);return hae.existsSync(r)?r:null}catch{return null}}s(Az,"appFile");function pae(e,t){return!!uae(e.server.getClientCapabilities())?.mimeTypes?.includes(Il)&&Az("mcp",t)!==null}s(pae,"rendersUi");function dae(e){let t=Az("mcp",e);if(t===null)throw new Error(`${e} is not built here \u2014 run \`pnpm run build\` in apps/mcp.`);return hae.readFileSync(t,"utf-8")}s(dae,"readAppHtml");function kt(e){return{isError:!0,content:[{type:"text",text:e instanceof ye||e instanceof se?e.message:`Unexpected error: ${e.message}`}]}}s(kt,"fail");var I$={workspace:x.string().optional().describe("Workspace directory name or feature name, or a `reconcile:<repo>-<number>` key from pr-reconcile. Defaults to the X-Sandbox-Feature header on the connection.")};function A$(e,t){let r=$z(e,Zt(t));return r.startsWith("reconcile:")?r:Gi(r,void 0).name}s(A$,"sessionKey");function fae(e){let t;return e.opened?t="Launched VS Code on the workspace.":e.openNote?t=e.openNote:t=e.workspacePath?`Open with: code "${e.workspacePath}"`:"",`${e.workspacePath?`Created workspace at ${e.workspacePath}`:"Workspace command completed."}
|
|
1181
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:x.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:x.string().optional().describe("User's timezone in IANA format."),userAgent:x.string().optional().describe("Host application identifier."),platform:x.union([x.literal("web"),x.literal("desktop"),x.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:x.object({touch:x.boolean().optional().describe("Whether the device supports touch input."),hover:x.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:x.object({top:x.number().describe("Top safe area inset in pixels."),right:x.number().describe("Right safe area inset in pixels."),bottom:x.number().describe("Bottom safe area inset in pixels."),left:x.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),YTt=x.object({method:x.literal("ui/notifications/host-context-changed"),params:lae.describe("Partial context update containing only changed fields.")}),XTt=x.object({method:x.literal("ui/update-model-context"),params:x.object({content:x.array(op).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:x.record(x.string(),x.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),QTt=x.object({method:x.literal("ui/initialize"),params:x.object({appInfo:Pm.describe("App identification (name and version)."),appCapabilities:EUe.describe("Features and capabilities this app provides."),protocolVersion:x.string().describe("Protocol version this app supports.")})}),eOt=x.object({protocolVersion:x.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Pm.describe("Host application identification and version."),hostCapabilities:$Ue.describe("Features and capabilities provided by the host."),hostContext:lae.describe("Rich context about the host environment.")}).passthrough();var cae="ui/resourceUri",Il="text/html;profile=mcp-app";function Oz(e,t,r,i){let n=r._meta,o=n.ui,a=n[cae],c=n;return o?.resourceUri&&!a?c={...n,[cae]:o.resourceUri}:a&&!o?.resourceUri&&(c={...n,ui:{...o,resourceUri:a}}),e.registerTool(t,{...r,_meta:c},i)}s(Oz,"K3");function Iz(e,t,r,i,n){return e.registerResource(t,r,{mimeType:Il,...i},n)}s(Iz,"N3");var OUe="io.modelcontextprotocol/ui";function uae(e){if(e)return e.extensions?.[OUe]}s(uae,"Y3");ge();On();wt();var T$="ui://workspace/mcp-app.html",O$="ui://workspace/mcp-list.html",Tv={ui:{visibility:["app"]}};function Az(e,t){try{let r=IUe.join(qt(),"..",e,"dist",t);return hae.existsSync(r)?r:null}catch{return null}}s(Az,"appFile");function pae(e,t){return!!uae(e.server.getClientCapabilities())?.mimeTypes?.includes(Il)&&Az("werkmeister-mcp",t)!==null}s(pae,"rendersUi");function dae(e){let t=Az("werkmeister-mcp",e);if(t===null)throw new Error(`${e} is not built here \u2014 run \`pnpm run build\` in apps/werkmeister-mcp.`);return hae.readFileSync(t,"utf-8")}s(dae,"readAppHtml");function kt(e){return{isError:!0,content:[{type:"text",text:e instanceof ye||e instanceof se?e.message:`Unexpected error: ${e.message}`}]}}s(kt,"fail");var I$={workspace:x.string().optional().describe("Workspace directory name or feature name, or a `reconcile:<repo>-<number>` key from pr-reconcile. Defaults to the X-Sandbox-Feature header on the connection.")};function A$(e,t){let r=$z(e,Zt(t));return r.startsWith("reconcile:")?r:Gi(r,void 0).name}s(A$,"sessionKey");function fae(e){let t;return e.opened?t="Launched VS Code on the workspace.":e.openNote?t=e.openNote:t=e.workspacePath?`Open with: code "${e.workspacePath}"`:"",`${e.workspacePath?`Created workspace at ${e.workspacePath}`:"Workspace command completed."}
|
|
1182
1182
|
Ran: ${e.command}
|
|
1183
1183
|
|
|
1184
1184
|
${e.output}
|
|
@@ -1188,7 +1188,7 @@ ${t}`.trim()}s(fae,"formatCreateResult");function AUe(e){if(!e.workspaces.length
|
|
|
1188
1188
|
| --- | --- |
|
|
1189
1189
|
`+t.join(`
|
|
1190
1190
|
`)+"\n\nFor the interactive dashboard (status, PRs, actions, chat), call the `open-workspaces-ui` tool."}s(AUe,"renderWorkspaceTable");function RUe(e){let[t,r]=process.platform==="darwin"?["open",[e]]:process.platform==="win32"?["cmd",["/c","start","",e]]:["xdg-open",[e]];mae(t,r,{detached:!0,stdio:"ignore"}).on("error",()=>{}).unref()}s(RUe,"openBrowser");function PUe(e,t,r){let i=[e,...t?["--issue",t]:[],...r?["--open"]:[]];return new Promise(n=>{let o=mae(process.execPath,i,{stdio:["ignore","pipe","inherit"]}),a="";o.stdout.on("data",c=>a+=c),o.on("error",c=>n({status:"error",message:c.message})),o.on("close",()=>{try{n(JSON.parse(a.trim().split(`
|
|
1191
|
-
`).pop()??""))}catch{n({status:"error",message:`The form exited without an outcome: ${a.trim()}`})}})})}s(PUe,"runFormCli");function gae(e){Oz(e,"create-workspace-form",{title:"New Sandbox Workspace",description:"Open the New Sandbox Workspace form and create the workspace from it (git worktrees on a <user>/<workspace> branch under $SANDBOX_WORKSPACES_ROOT, then init-workspace). With an `issue_id` the issue is fetched and stored in `.sandbox/issue.md` (the create fails if it can't be read). The form renders inline where the client supports MCP App UI (Claude Desktop), otherwise in the user's browser. Fields come from the same prompt definitions as the terminal wizard. Pass an issue ID or URL as `issue` to pre-fill. To create without a form, call `create-workspace`.",inputSchema:{issue:x.string().optional().describe("Issue ID or URL in this machine's issue tracker (see `sandbox setup`). When set, the issue is fetched and used to pre-fill the form (feature, issue_id, task, description, starting_prompt)."),open:x.boolean().optional().describe("Launch VS Code on the new workspace (default true). Browser-form path only.")},_meta:{ui:{resourceUri:T$}}},async i=>{try{let n=typeof i?.issue=="string"?i.issue.trim():"";if(pae(e,"mcp-app.html")){let c=await cz(),l="";if(n){let u=await az(n);c.formData={...c.formData,...u};let p=typeof u.issue_id=="string"?u.issue_id:"";l=p?` Pre-filled from ${p}; review before creating.`:` Couldn't read an issue from \u201C${n}\u201D.`}return{content:[{type:"text",text:"Opening the workspace form. Fill it in to create a new sandbox workspace (worktrees + branch + init-workspace)."+l}],structuredContent:c}}let o=Az("
|
|
1191
|
+
`).pop()??""))}catch{n({status:"error",message:`The form exited without an outcome: ${a.trim()}`})}})})}s(PUe,"runFormCli");function gae(e){Oz(e,"create-workspace-form",{title:"New Sandbox Workspace",description:"Open the New Sandbox Workspace form and create the workspace from it (git worktrees on a <user>/<workspace> branch under $SANDBOX_WORKSPACES_ROOT, then init-workspace). With an `issue_id` the issue is fetched and stored in `.sandbox/issue.md` (the create fails if it can't be read). The form renders inline where the client supports MCP App UI (Claude Desktop), otherwise in the user's browser. Fields come from the same prompt definitions as the terminal wizard. Pass an issue ID or URL as `issue` to pre-fill. To create without a form, call `create-workspace`.",inputSchema:{issue:x.string().optional().describe("Issue ID or URL in this machine's issue tracker (see `sandbox setup`). When set, the issue is fetched and used to pre-fill the form (feature, issue_id, task, description, starting_prompt)."),open:x.boolean().optional().describe("Launch VS Code on the new workspace (default true). Browser-form path only.")},_meta:{ui:{resourceUri:T$}}},async i=>{try{let n=typeof i?.issue=="string"?i.issue.trim():"";if(pae(e,"mcp-app.html")){let c=await cz(),l="";if(n){let u=await az(n);c.formData={...c.formData,...u};let p=typeof u.issue_id=="string"?u.issue_id:"";l=p?` Pre-filled from ${p}; review before creating.`:` Couldn't read an issue from \u201C${n}\u201D.`}return{content:[{type:"text",text:"Opening the workspace form. Fill it in to create a new sandbox workspace (worktrees + branch + init-workspace)."+l}],structuredContent:c}}let o=Az("werkmeister-dashboard","form-cli.js");if(o===null)return{isError:!0,content:[{type:"text",text:"The browser form ships with a werkmeister checkout (apps/werkmeister-dashboard), not this install. Call `create-workspace` with the fields as `formData`."}]};let a=await PUe(o,n,i?.open??!0);switch(a.status){case"cancelled":return{content:[{type:"text",text:"Workspace creation cancelled \u2014 nothing was created."}]};case"timeout":return{content:[{type:"text",text:"The workspace form timed out \u2014 nothing was created. Re-run to try again."}]};case"error":return{isError:!0,content:[{type:"text",text:a.message}]}}return a.create.ok?{content:[{type:"text",text:fae(a.create.result)}],structuredContent:a.create.result}:{isError:!0,content:[{type:"text",text:a.create.error}]}}catch(n){return kt(n)}}),e.registerTool("create-workspace",{title:"Create Workspace",description:"Create the workspace through `createWorkspace` in this process (worktrees + branch + init-workspace); with an `issue_id` the issue is fetched and stored in `.sandbox/issue.md` (the create fails if it can't be read). Called by the New Sandbox Workspace form; can also be invoked directly.",inputSchema:{formData:x.record(x.string(),x.unknown()).describe("Submitted form fields (feature, services[], issue_id, test_path, task, \u2026). Holds the form's fields, same keys as the CLI flags; `feature` is required."),open:x.boolean().optional().describe("Launch VS Code on the new workspace (default false).")},outputSchema:x.object({command:x.string(),output:x.string(),workspacePath:x.string().nullable(),opened:x.boolean(),openNote:x.string().optional()})},async i=>{try{let n=await qoe(i.formData??{},{open:i.open??!1});return{content:[{type:"text",text:fae(n)}],structuredContent:n}}catch(n){return kt(n)}}),e.registerTool("workspace-form-schema",{title:"Workspace Form Schema",description:"Return the New Sandbox Workspace form definition (RJSF schema/uiSchema/formData/title), built from the terminal wizard's prompt definitions. Data-only; used by the browser dashboard's create-workspace tab.",inputSchema:{},outputSchema:x.object({schema:x.record(x.string(),x.unknown()),uiSchema:x.record(x.string(),x.unknown()),formData:x.record(x.string(),x.unknown()),title:x.string()}),_meta:Tv},async()=>{try{let i=await cz();return{content:[{type:"text",text:`Loaded the New Workspace form (${i.title}).`}],structuredContent:i}}catch(i){return kt(i)}}),e.registerTool("issue-form-data",{title:"Issue \u2192 Form Fields",description:"Distil an issue from this machine's issue tracker into New Sandbox Workspace form fields (issue_id, feature, task, description, starting_prompt, suggested services) from an issue ID or URL. Best-effort; returns just { issue_id } if the lookup fails. Called by the form's \u201CFetch from <tracker>\u201D button.",inputSchema:{ref:x.string().describe("An issue ID or URL, or any string containing one.")},outputSchema:x.object({formData:x.record(x.string(),x.unknown())}),_meta:Tv},async i=>{try{let n=await az(i.ref),o=typeof n.issue_id=="string"?n.issue_id:"";return{content:[{type:"text",text:o?`Loaded form fields from ${o}.`:`No issue found in \u201C${i.ref}\u201D.`}],structuredContent:{formData:n}}}catch(n){return kt(n)}}),e.registerTool("refine-prompt",{title:"Refine Prompt",description:"Rewrite a starting-prompt draft via the local `claude` CLI. Called by the New Sandbox Workspace form's \u201CRefine this prompt\u201D button; returns the rewrite.",inputSchema:{text:x.string().describe("The current prompt text to refine."),instruction:x.string().optional().describe("How to rewrite it \u2014 the field's ui:options.refineInstruction."),formData:x.record(x.string(),x.unknown()).optional().describe("Current state of the workspace form (all populated inputs) \u2014 embedded as background context, alongside the service registry, to ground the rewrite.")},outputSchema:x.object({refined:x.string()}),_meta:Tv},async i=>{try{let n=await Coe(i.text??"",i.instruction??"",i.formData);return{content:[{type:"text",text:n}],structuredContent:{refined:n}}}catch(n){return kt(n)}}),Oz(e,"list-workspaces",{title:"List Sandbox Workspaces",description:"List the workspaces under $SANDBOX_WORKSPACES_ROOT (workspace name + issue). Renders an interactive table inline where the client supports MCP App UI (Claude Desktop), otherwise a markdown table. To open one in VS Code, call `open-workspace` with the name.",inputSchema:{},outputSchema:x.object({root:x.string(),workspaces:x.array(x.object({name:x.string(),path:x.string(),vscodeUri:x.string(),issueId:x.string().nullable(),issueUrl:x.string().nullable(),labels:x.array(x.string()),task:x.string().nullable(),workType:x.string().nullable(),lifecycle:x.string()}))}),_meta:{ui:{resourceUri:O$}}},async()=>{try{let i=await u$();return{content:[{type:"text",text:pae(e,"mcp-list.html")?`${i.workspaces.length} workspace(s) in ${i.root}.`:AUe(i)}],structuredContent:i}}catch(i){return kt(i)}}),e.registerTool("open-workspaces-ui",{title:"Open Workspaces Dashboard in Browser",description:"Open the interactive Sandbox Workspaces dashboard in the user's default browser \u2014 the same UI Claude Desktop renders inline, as a fallback for hosts that don't render MCP App UI. Starts the localhost dashboard on port 3001 if it isn't running, and returns its URL.",inputSchema:{},outputSchema:x.object({url:x.string()})},async()=>{try{let i=za();if(!await La(i,()=>E2(Ps,!1)))throw new ye(`Could not start the workspaces dashboard:
|
|
1192
1192
|
${i.text()}`);let n=`http://127.0.0.1:${Ps.port}/`;return RUe(n),{content:[{type:"text",text:`Opened the workspaces dashboard at ${n}`}],structuredContent:{url:n}}}catch(i){return kt(i)}}),e.registerTool("open-workspace",{title:"Open Workspace in VS Code",description:"Launch VS Code on a workspace directory under $SANDBOX_WORKSPACES_ROOT. ",inputSchema:{...nr},outputSchema:x.object({path:x.string()})},async(i,n)=>{try{let{path:o}=await Boe(Gi(i.workspace,Zt(n)).name);return{content:[{type:"text",text:`Opened ${o} in VS Code.`}],structuredContent:{path:o}}}catch(o){return kt(o)}}),e.registerTool("workspace-prs",{title:"Workspace Pull Requests",description:"For every workspace, list its repo worktrees and the open/merged/closed PR for each one's branch (via the `gh` CLI). Best-effort \u2014 a repo with no PR (or when `gh` is unavailable) reports a null PR.",inputSchema:{},outputSchema:x.object({workspaces:x.array(x.object({name:x.string(),repos:x.array(x.object({repo:x.string(),branch:x.string().nullable(),url:x.string().nullable(),state:x.enum(["OPEN","MERGED","CLOSED"]).nullable(),title:x.string().nullable(),labels:x.array(x.string()),ci:x.enum(["pass","running","fail"]).nullable(),failingChecks:x.number(),draft:x.boolean().optional()}))}))})},async()=>{try{let i=await Voe();return{content:[{type:"text",text:i.map(o=>{let a=o.repos.map(c=>`${c.repo}${c.state?` [${c.state}]`:""}`).join(", ");return`${o.name}: ${a||"(no repos)"}`}).join(`
|
|
1193
1193
|
`)||"No workspaces."}],structuredContent:{workspaces:i}}}catch(i){return kt(i)}}),e.registerTool("issue-statuses",{title:"Issue Statuses",description:"Fetch the current status name for a batch of issue IDs in this machine's issue tracker in one lookup. Best-effort: issues that can't be fetched are omitted from the result.",inputSchema:{refs:x.array(x.string()).describe("Issue IDs in the configured tracker."),refresh:x.boolean().optional().describe("Bypass the cache and re-fetch every issue from the tracker.")},outputSchema:x.object({statuses:x.record(x.string(),x.string())}),_meta:Tv},async i=>{try{let n=await Moe(i.refs??[],{refresh:i.refresh});return{content:[{type:"text",text:Object.entries(n).map(([a,c])=>`${a}: ${c}`).join(`
|
|
1194
1194
|
`)||"No statuses found."}],structuredContent:{statuses:n}}}catch(n){return kt(n)}});let t=x.object({ref:x.string(),title:x.string().optional(),status:x.string().optional(),type:x.string().optional(),assignee:x.string().optional(),description:x.string().optional(),url:x.string().optional(),comments:x.array(x.object({author:x.string(),created:x.string().optional(),body:x.string()})).optional()}),r=x.object({url:x.string(),repo:x.string(),number:x.number(),title:x.string(),author:x.string(),body:x.string(),labels:x.array(x.string()),reviewStatus:x.enum(["APPROVED","CHANGES_REQUESTED","DISMISSED","PENDING"]),failingChecks:x.number(),outOfDate:x.boolean(),hasApprovalLabel:x.boolean(),issueId:x.string().nullable(),issueUrl:x.string().nullable(),isDraft:x.boolean()});e.registerTool("open-prs",{title:"Open Pull Requests",description:"List open PRs across the sandbox org (younger than 30 days): my own PRs and other members' ready-for-human-approval PRs, each with review/check/label state and its issue ID. Best-effort \u2014 a PR whose details can't be read degrades to a stub card.",inputSchema:{},outputSchema:x.object({me:x.string(),mine:x.array(r),others:x.array(r)})},async()=>{try{let i=await Xoe();return{content:[{type:"text",text:`Open PRs \u2014 mine: ${i.mine.length}, ready-for-approval: ${i.others.length}.`}],structuredContent:i}}catch(i){return kt(i)}}),e.registerTool("pr-approve",{title:"Approve Pull Request",description:"Approve a pull request via `gh pr review <url> --approve`. Does not change labels.",inputSchema:{url:x.string().describe("The pull request URL.")},outputSchema:x.object({ok:x.literal(!0)})},async i=>{try{let n=await Qoe(i.url);return{content:[{type:"text",text:`Approved ${i.url}.`}],structuredContent:n}}catch(n){return kt(n)}}),e.registerTool("ask-pr-review",{title:"Ask for PR Review",description:"Message the configured Slack channel to request a review of this pull request. The message includes the PR URL, title, and author.",inputSchema:{url:x.string().describe("The pull request URL."),title:x.string().optional().describe("The PR title, for a readable message."),author:x.string().optional().describe("The PR author's login.")},outputSchema:x.object({ok:x.literal(!0)})},async i=>{try{let o=`Review requested${i.author?` (by ${i.author})`:""}: ${i.title??""} ${i.url}`.trim();return{content:[{type:"text",text:`Review request sent to Slack (${await Goe(o)}) for ${i.url}.`}],structuredContent:{ok:!0}}}catch(n){return kt(n)}}),e.registerTool("issue",{title:"Issue Card",description:"Fetch a compact issue card (ref, title, status, type, assignee, description, url, comments) from this machine's issue tracker for an issue ID or any string containing one. Best-effort: returns `{ ref }` alone if the lookup fails.",inputSchema:{ref:x.string().describe("An issue ID or URL, or any string containing one.")},outputSchema:t},async i=>{try{let n=await pz(i.ref);return{content:[{type:"text",text:n.title?`${n.ref}: ${n.title}`:n.ref||"No issue."}],structuredContent:n}}catch(n){return kt(n)}}),e.registerTool("pr-reconcile",{title:"Reconcile PR with Issue",description:"Gather a PR's issue, description, and diff, then launch a headless, tool-restricted `claude -p` session (context handed off at spawn) in a background Terminal window to reconcile the two. Returns the `sessionKey` the dashboard chat panel streams from (a `reconcile:<repo>-<number>` key).",inputSchema:{url:x.string().describe("The pull request URL to reconcile."),issueRef:x.string().optional().describe("Issue ID hint; inferred from the PR when omitted.")},outputSchema:x.object({sessionKey:x.string(),slug:x.string(),issue:t})},async i=>{try{let n=await hse(i.url,i.issueRef);return{content:[{type:"text",text:`Launched reconcile session ${n.sessionKey} for ${i.url}.`}],structuredContent:n}}catch(n){return kt(n)}}),e.registerTool("workspace-pr",{title:"Workspace PR: gate, open, status",description:"The only way to open a PR from a sandbox workspace \u2014 use it instead of `gh pr create`, `/create-pr` or `finishing-a-development-branch`. `gate` runs the pre-PR gate; `open` gates each PR file at `status: approved`, pushes, opens the PR and records its URL; `status` records merged / shipped / closed from GitHub and release tags.",inputSchema:{...nr,action:x.enum(["gate","open","status"]),repo:x.string().optional().describe("Only this code worktree's PR file.")},outputSchema:x.object({ok:x.boolean(),lines:x.array(x.string())})},async(i,n)=>{try{let o=Gi(i.workspace,Zt(n)).dir,a=i.action==="gate"?await BL(o,i.repo):i.action==="open"?await ZL(o,i.repo):{ok:!0,lines:(await l$(o)).lines};return{isError:!a.ok,content:[{type:"text",text:a.lines.join(`
|
|
Binary file
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$id": "https://raw.githubusercontent.com/jbbz-sandbox/werkmeister/main/apps/cli/infra/schemas/services-fragment.schema.json",
|
|
4
4
|
"title": "Sandbox service-registry fragment (<repo>/.sandbox/services.yaml)",
|
|
5
|
-
"description": "A repo's slice of the service registry. `sandbox registry sync` (run by `sandbox setup`) merges every fragment under paths.repos_root into ~/.sandbox/services.yaml. `{{home}}`, `{{repos_root}}` and `{{workspaces_root}}` expand in any string at merge time. Mirrors the checks in packages/
|
|
5
|
+
"description": "A repo's slice of the service registry. `sandbox registry sync` (run by `sandbox setup`) merges every fragment under paths.repos_root into ~/.sandbox/services.yaml. `{{home}}`, `{{repos_root}}` and `{{workspaces_root}}` expand in any string at merge time. Mirrors the checks in packages/werkmeister-core/src/registry_sync.ts.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"services": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "werkmeister",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Multi-feature concurrent development orchestrator CLI tool",
|
|
6
6
|
"type": "module",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"typescript": "^5.7.0",
|
|
54
54
|
"vitest": "^3.0.0",
|
|
55
55
|
"yaml": "^2.7.0",
|
|
56
|
-
"werkmeister-core": "0.
|
|
56
|
+
"werkmeister-core": "0.31.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "node esbuild.mjs",
|
package/werkmeister
CHANGED
|
@@ -81,7 +81,7 @@ fi
|
|
|
81
81
|
# server `connect` starts on 3001).
|
|
82
82
|
#
|
|
83
83
|
# Only apps/cli is published to npm (see its package.json `files`), so on a
|
|
84
|
-
# global install these siblings are absent. apps/mcp is bundled into this
|
|
84
|
+
# global install these siblings are absent. apps/werkmeister-mcp is bundled into this
|
|
85
85
|
# package as dist/mcp.js (esbuild.mjs), so `mcp` always has a target. The
|
|
86
86
|
# dashboard is checkout-only.
|
|
87
87
|
case "${1:-}" in
|
|
@@ -96,7 +96,7 @@ case "${1:-}" in
|
|
|
96
96
|
exec "$node_bin" "$app_entry" --stdio "$@"
|
|
97
97
|
;;
|
|
98
98
|
dashboard)
|
|
99
|
-
app_entry="$(cd "$SANDBOX_ROOT/.." && pwd)/
|
|
99
|
+
app_entry="$(cd "$SANDBOX_ROOT/.." && pwd)/werkmeister-dashboard/dist/main.js"
|
|
100
100
|
if [ ! -f "$app_entry" ]; then
|
|
101
101
|
echo "Error: the workspaces dashboard ships with a werkmeister checkout only -- missing $app_entry." >&2
|
|
102
102
|
exit 1
|