werkmeister 0.36.0 → 0.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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 QW=Object.create;var Hp=Object.defineProperty;var ZW=Object.getOwnPropertyDescriptor;var eV=Object.getOwnPropertyNames;var tV=Object.getPrototypeOf,rV=Object.prototype.hasOwnProperty;var i=(e,t)=>Hp(e,"name",{value:t,configurable:!0}),ee=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var R=(e,t)=>()=>(e&&(t=e(e=0)),t);var $=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ce=(e,t)=>{for(var r in t)Hp(e,r,{get:t[r],enumerable:!0})},nV=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of eV(t))!rV.call(e,s)&&s!==r&&Hp(e,s,{get:()=>t[s],enumerable:!(n=ZW(t,s))||n.enumerable});return e};var Ie=(e,t,r)=>(r=e!=null?QW(tV(e)):{},nV(t||!e||!e.__esModule?Hp(r,"default",{value:e,enumerable:!0}):r,e));var S,h=R(()=>{S={sha:"71d7313bd4d59f0b29919fc8c8976bf9050bbca9",dirty:!1}});var wu=$(Zy=>{h();var Gp=class extends Error{static{i(this,"CommanderError")}constructor(t,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},Qy=class extends Gp{static{i(this,"InvalidArgumentError")}constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Zy.CommanderError=Gp;Zy.InvalidArgumentError=Qy});var Yp=$(tw=>{h();var{InvalidArgumentError:oV}=wu(),ew=class{static{i(this,"Argument")}constructor(t,r){switch(this.description=r||"",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,r){return r===this.defaultValue||!Array.isArray(r)?[t]:r.concat(t)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new oV(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function iV(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}i(iV,"humanReadableArgName");tw.Argument=ew;tw.humanReadableArgName=iV});var sw=$(nw=>{h();var{humanReadableArgName:aV}=Yp(),rw=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 r=t.commands.filter(s=>!s._hidden),n=t._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((s,o)=>s.name().localeCompare(o.name())),r}compareOptions(t,r){let n=i(s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,""),"getSortKey");return n(t).localeCompare(n(r))}visibleOptions(t){let r=t.options.filter(s=>!s.hidden),n=t._getHelpOption();if(n&&!n.hidden){let s=n.short&&t._findOption(n.short),o=n.long&&t._findOption(n.long);!s&&!o?r.push(n):n.long&&!o?r.push(t.createOption(n.long,n.description)):n.short&&!s&&r.push(t.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let n=t.parent;n;n=n.parent){let s=n.options.filter(o=>!o.hidden);r.push(...s)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(n=>aV(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(s)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(s)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(s)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(s)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let n="";for(let s=t.parent;s;s=s.parent)n=s.name()+" "+n;return n+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];return t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0?`${t.description} (${r.join(", ")})`:t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatHelp(t,r){let n=r.padWidth(t,r),s=r.helpWidth??80;function o(d,p){return r.formatItem(d,n,p,r)}i(o,"callFormatItem");let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],c=r.commandDescription(t);c.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(c),s),""]));let l=r.visibleArguments(t).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));l.length>0&&(a=a.concat([r.styleTitle("Arguments:"),...l,""]));let u=r.visibleOptions(t).map(d=>o(r.styleOptionTerm(r.optionTerm(d)),r.styleOptionDescription(r.optionDescription(d))));if(u.length>0&&(a=a.concat([r.styleTitle("Options:"),...u,""])),r.showGlobalOptions){let d=r.visibleGlobalOptions(t).map(p=>o(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));d.length>0&&(a=a.concat([r.styleTitle("Global Options:"),...d,""]))}let f=r.visibleCommands(t).map(d=>o(r.styleSubcommandTerm(r.subcommandTerm(d)),r.styleSubcommandDescription(r.subcommandDescription(d))));return f.length>0&&(a=a.concat([r.styleTitle("Commands:"),...f,""])),a.join(`
4
+ var QW=Object.create;var Hp=Object.defineProperty;var ZW=Object.getOwnPropertyDescriptor;var eV=Object.getOwnPropertyNames;var tV=Object.getPrototypeOf,rV=Object.prototype.hasOwnProperty;var i=(e,t)=>Hp(e,"name",{value:t,configurable:!0}),ee=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var R=(e,t)=>()=>(e&&(t=e(e=0)),t);var $=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ce=(e,t)=>{for(var r in t)Hp(e,r,{get:t[r],enumerable:!0})},nV=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of eV(t))!rV.call(e,s)&&s!==r&&Hp(e,s,{get:()=>t[s],enumerable:!(n=ZW(t,s))||n.enumerable});return e};var Ie=(e,t,r)=>(r=e!=null?QW(tV(e)):{},nV(t||!e||!e.__esModule?Hp(r,"default",{value:e,enumerable:!0}):r,e));var S,h=R(()=>{S={sha:"776242659263ed8abe3ba38b3615680396f6a5b2",dirty:!1}});var wu=$(Zy=>{h();var Gp=class extends Error{static{i(this,"CommanderError")}constructor(t,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},Qy=class extends Gp{static{i(this,"InvalidArgumentError")}constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Zy.CommanderError=Gp;Zy.InvalidArgumentError=Qy});var Yp=$(tw=>{h();var{InvalidArgumentError:oV}=wu(),ew=class{static{i(this,"Argument")}constructor(t,r){switch(this.description=r||"",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,r){return r===this.defaultValue||!Array.isArray(r)?[t]:r.concat(t)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new oV(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function iV(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}i(iV,"humanReadableArgName");tw.Argument=ew;tw.humanReadableArgName=iV});var sw=$(nw=>{h();var{humanReadableArgName:aV}=Yp(),rw=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 r=t.commands.filter(s=>!s._hidden),n=t._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((s,o)=>s.name().localeCompare(o.name())),r}compareOptions(t,r){let n=i(s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,""),"getSortKey");return n(t).localeCompare(n(r))}visibleOptions(t){let r=t.options.filter(s=>!s.hidden),n=t._getHelpOption();if(n&&!n.hidden){let s=n.short&&t._findOption(n.short),o=n.long&&t._findOption(n.long);!s&&!o?r.push(n):n.long&&!o?r.push(t.createOption(n.long,n.description)):n.short&&!s&&r.push(t.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let n=t.parent;n;n=n.parent){let s=n.options.filter(o=>!o.hidden);r.push(...s)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(n=>aV(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(s)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(s)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(s)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((n,s)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(s)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let n="";for(let s=t.parent;s;s=s.parent)n=s.name()+" "+n;return n+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];return t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0?`${t.description} (${r.join(", ")})`:t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatHelp(t,r){let n=r.padWidth(t,r),s=r.helpWidth??80;function o(d,p){return r.formatItem(d,n,p,r)}i(o,"callFormatItem");let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],c=r.commandDescription(t);c.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(c),s),""]));let l=r.visibleArguments(t).map(d=>o(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));l.length>0&&(a=a.concat([r.styleTitle("Arguments:"),...l,""]));let u=r.visibleOptions(t).map(d=>o(r.styleOptionTerm(r.optionTerm(d)),r.styleOptionDescription(r.optionDescription(d))));if(u.length>0&&(a=a.concat([r.styleTitle("Options:"),...u,""])),r.showGlobalOptions){let d=r.visibleGlobalOptions(t).map(p=>o(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));d.length>0&&(a=a.concat([r.styleTitle("Global Options:"),...d,""]))}let f=r.visibleCommands(t).map(d=>o(r.styleSubcommandTerm(r.subcommandTerm(d)),r.styleSubcommandDescription(r.subcommandDescription(d))));return f.length>0&&(a=a.concat([r.styleTitle("Commands:"),...f,""])),a.join(`
5
5
  `)}displayWidth(t){return jO(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).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(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).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,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,r,n,s){let a=" ".repeat(2);if(!n)return a+t;let c=t.padEnd(r+t.length-s.displayWidth(t)),l=2,f=(this.helpWidth??80)-r-l-2,d;return f<this.minWidthToWrap||s.preformatted(n)?d=n:d=s.boxWrap(n,f).replace(/\n/g,`
6
6
  `+" ".repeat(r+l)),a+c+" ".repeat(l)+d.replace(/\n/g,`
7
7
  ${a}`)}boxWrap(t,r){if(r<this.minWidthToWrap)return t;let n=t.split(/\r\n|\n/),s=/[\s]*[^\s]+/g,o=[];return n.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<=r){l.push(f),u+=d;return}o.push(l.join(""));let p=f.trimStart();l=[p],u=this.displayWidth(p)}),o.push(l.join(""))}),o.join(`
@@ -1370,7 +1370,7 @@ ${w.BOLD}=== sandbox close-out: ${r} ===${w.RESET}
1370
1370
  `),!e.yes&&(console.log(` ${w.DIM}${n===null?"Closes the issue, writes closeout.md, removes the workspace, and deletes merged code branches.":"Records the reason in closeout.md, pushes and keeps every branch with commits of its own, then removes the workspace."}${w.RESET}`),!await Yt(n===null?`Close out and remove '${r}'?`:`Abandon and remove '${r}'?`,!1))){O("Aborted -- nothing changed.");return}let s=n===null?await Ed(r):await Ed(r,{abandon:n});console.log(s.output),console.log(`
1371
1371
  ${w.GREEN}${w.BOLD}Workspace '${r}' closed out${w.RESET}`),console.log(` ${w.DIM}Archive this workspace's desktop sessions from the Claude sidebar.${w.RESET}
1372
1372
  `)}var OW=R(()=>{"use strict";h();Xn();ll();_e();dc();i(owe,"run")});var TW={};ce(TW,{run:()=>iwe});async function iwe(e){let t=e.feature||Gt(process.cwd()).FEATURE;t||(D("Feature name required: pass it as an argument or set FEATURE in a .env file."),process.exit(1));let{path:r}=await p1(t);console.log(`${w.GREEN}Opened '${t}' in VS Code${w.RESET} ${w.DIM}${r}${w.RESET}`)}var AW=R(()=>{"use strict";h();Xn();_e();fo();i(iwe,"run")});var NW={};ce(NW,{run:()=>cwe});import*as NO from"node:fs";import*as PW from"node:path";function Cn(e){console.log(`
1373
- ${w.BOLD}${e}${w.RESET}`)}async function awe(e){let t=He(),r=Ut(t);Cn("1. Paths & the workspace repo");let n={},s=i(J=>im(J.key,t,n),"pathDefault");if(e)await Pi(Ic,n,s,{intro:"Where your repos and per-feature workspaces live. Defaults in [brackets]."});else for(let J of Ic)n[J.key]=s(J),O(` ${J.key}: ${n[J.key]}`);let o=nj();o.length||P(" `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((J,pc)=>pc.length?{...J,choicesFn:i(()=>pc,"choicesFn")}:J,"withChoices"),c={},l=[a(QR,o.map(J=>`${J}/${Zn}`)),a(e8,o)],u=i(J=>J.key==="workspace_repo"?af(t)||(o[0]?`${o[0]}/${Zn}`:""):t.overrides?.github_org||(c.workspace_repo??"").split("/")[0]||"","ghDefault");if(e)await Pi(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 J of l)c[J.key]=u(J),O(` ${J.key}: ${c[J.key]||"(unset \u2014 `gh` named no user)"}`);Cn("2. Browser");let f={},d=i(()=>t.overrides?.browser||vd,"browserDefault");e?await Pi([i5],f,d,{intro:"Which browser `sandbox open` launches."}):(f.browser=d(),O(` browser: ${f.browser}`)),mo[f.browser]?.engine!=="chromium"&&f.browser!=="safari"&&P(` ${mo[f.browser].label} isn't wired up yet -- \`sandbox open\` will error until it's picked to chrome/chromium/brave/edge/safari.`),Cn("3. Ingress");let p={},m=i(J=>String(r[J.key]??""),"ingressDefault");if(e)await Pi(cv,p,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 J of cv)p[J.key]=m(J),O(` ${J.key}: ${p[J.key]}`);Cn("4. Service registry");let y=Js(),g=bt(n.repos_root),x=!1,v=_2(y)??"orbstack",_=[];try{_=mi(g).map(J=>J.repo)}catch{}_.length?O(`${y} will be generated from ${_.length} repo fragment(s): ${_.join(", ")}.`):(O(`No <repo>/${kd} found under ${g}.`),O("Clone your team's repos there and re-run `sandbox setup`, or try the demo apps.")),_.includes("demo-services")||(x=await Yt(" Clone the demo apps (backend, frontend) so there is something to run?",!1,e)),!NO.existsSync(ms())&&e&&(v=await gu("Kube context for `sandbox intercept` (services.local.yaml k8s_context)",v)),Cn("5. Issue tracker");let b={},E=i(()=>Ji(t),"trackerDefault");e?await Pi([{key:"issue_tracker",label:"Issue tracker",help:"Where workspace issues come from and where agents file existing bugs. "+zi.map(J=>`${J}: ${wv(J).label} (e.g. ${wv(J).refExample})`).join("; ")+".",acceptEmpty:!1,pattern:`(${zi.join("|")})`,choicesFn:i(()=>[...zi],"choicesFn")}],b,E):(b.issue_tracker=E(),O(` issue_tracker: ${b.issue_tracker}`));let k={...Qs()},T=!!(k.base_url&&k.email&&k.api_token);if(b.issue_tracker==="github"){let J=c.github_org;J?_.length?O(`Tracking GitHub issues in: ${_.map(pc=>`${J}/${pc}`).join(", ")}.`):O(`Tracking GitHub issues in every registry repo under ${J} (none registered yet).`):P(" No GitHub org set (section 1) \u2014 workspaces can only take owner/repo#n issue refs.")}else b.issue_tracker==="jira"&&T?O(`Already configured for ${k.email}.`):b.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 Yt(" Configure Jira credentials now?",!1,e)&&(k.base_url=await gu("Jira base URL",k.base_url??"https://your-org.atlassian.net"),k.email=await gu("Atlassian login email",k.email??""),O(" Create a token at https://id.atlassian.com/manage-profile/security/api-tokens"),k.api_token=await gu("API token",k.api_token??"",{secret:!0})));Cn("6. Telepresence (optional)"),O("Only `sandbox intercept` needs it \u2014 reroutes cluster traffic to a local container.");let A=await Yt(" Install/upgrade the OSS client via Homebrew if it's missing or stale?",!1,e);Cn("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 I=await Yt(" Install the superpowers plugin?",!1,e);Cn("8. VS Code (optional)");let N=K2(),j=!1;N.present?N.error?P(`${Nd()} does not parse (${N.error}) \u2014 skipping.`):!Object.keys(N.set).length&&!N.drop.length?O("Already mapped."):(O(`Validates <repo>/.werkmeister/services.yaml and .sandbox/workspace.yml against the sandbox's JSON Schemas (needs the redhat.vscode-yaml extension). Adds \`yaml.schemas\` entries to ${Nd()}; comments and other settings are kept.`),j=await Yt(" Add the schema mappings to your VS Code user settings?",!1,e)):O("VS Code not found \u2014 skipping.");let M=lx(),C=!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}).`),C=await Yt(" 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).`),Cn("9. Claude Code standards access (optional)");let L=H2(),B=!1;L.present?L.dirMissing?O(`Standards dir ${pt()} not found \u2014 skipping.`):L.error?P(`${Id()}: ${L.error} \u2014 skipping.`):L.granted?O("Already granted."):(O(`Lets every Claude Code session read the coding standards in ${pt()} without a prompt. Adds it to \`permissions.additionalDirectories\` in ${Id()}; other settings are kept.`),B=e&&await Yt(" Grant Claude Code read access to the standards dir?",!0,e)):O("Claude Code settings dir not found \u2014 skipping."),Cn("10. PR watch schedule (optional)");let q=Ld(),Ne;q.installed?(O(`Installed (${q.where}); logs \u2192 ${q.logFile}. Remove with \`werkmeister pr watch --uninstall\`.`),Ne=!0):(O("Resumes terminal Claude sessions when their PR merges, ships or closes (desktop sessions don't need it)."),Ne=await Yt(` Install a ${q.kind==="launchd"?"launchd agent":"crontab line"} that runs \`werkmeister pr watch\` every 10 minutes?`,!1,e));let U={version:1,paths:{sandbox_root:String(hd()),repos_root:n.repos_root,workspaces_root:n.workspaces_root},ingress:{local_domain:p.local_domain,remote_domain:p.remote_domain,certs_dir:p.certs_dir},overrides:{...t.overrides??{},browser:f.browser,issue_tracker:b.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}:{}},Xe=am(U),dt=Dc(U),me=jc(),Tt=n8(),Wr=lm();return Cn("Writing config"),F(`Wrote ${Xe}`),O(`Regenerated ${dt}`),O(`${Nc()}: ${me?"updated":"already sources env.sh"}`),O(`${ov()}: ${Tt?"installed tab completion":"tab completion already installed"}`),NO.existsSync(Hi())&&O(`${PW.basename(Hi())}: ${Wr?"dropped stale env block":"no env block to remove"}`),{workspaceRepo:c.workspace_repo,demo:x,k8sContext:v,installTelepresence:A,installOptionalPlugins:I,mapEditorSchemas:j,installVscodeExtension:C,grantStandardsDir:B,installPrWatch:Ne,skipSudo:!e}}function RW(){try{return _f()}catch{return[]}}function CW(e){Cn("Prerequisites");for(let t of e)t.ok?console.log(`${w.GREEN}\u2713${w.RESET} ${t.label}: ${t.detail}`):t.optional?console.log(`${w.YELLOW}\u26A0 ${t.label}: ${t.detail}${w.RESET}`):console.log(`${w.RED}\u2717 ${t.label}: ${t.detail}${w.RESET}`);return e.filter(t=>!t.ok&&!t.optional).length}async function cwe(e){let t=!!e.check,r=!!e.yes;if(t){let l=await J2({checkOnly:!0,hostnames:RW()}),u=um(He()).filter(f=>!/^paths\.\w+ does not exist/.test(f));for(let f of u)l.unshift({label:"global config",ok:!1,detail:f});CW(l)&&(P("Prerequisites out of date \u2014 run `sandbox setup` to converge."),process.exit(1)),F("All required sandbox prerequisites are in order.");return}let n=!!process.stdin.isTTY&&!r;n?O("Sandbox setup \u2014 press Ctrl-C at any prompt to abort without writing."):!process.stdin.isTTY&&!r&&P("Not a TTY \u2014 running non-interactively with defaults (same as --yes).");let s=await awe(n),o=await J2({checkOnly:!1,demo:s.demo,registry:{k8sContext:s.k8sContext},workspaceRepo:s.workspaceRepo,hostnames:RW,skipSudo:s.skipSudo,installTelepresence:s.installTelepresence,installOptionalPlugins:s.installOptionalPlugins,mapEditorSchemas:s.mapEditorSchemas,installVscodeExtension:s.installVscodeExtension,grantStandardsDir:s.grantStandardsDir,installPrWatch:s.installPrWatch}),a=CW(o),c=o.filter(l=>!l.ok&&l.optional).length;a&&(P(`${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 IW=R(()=>{"use strict";h();Il();Q();bs();ot();xr();jd();Ls();_e();dc();i(Cn,"heading");i(awe,"configureMachine");i(RW,"resolveHostnames");i(CW,"report");i(cwe,"run")});var jW={};ce(jW,{run:()=>uwe});import*as LW from"node:fs";import*as DW from"node:path";function lwe(e){let t=e.paths||{};console.log(`${w.BOLD}config file:${w.RESET} ${ar()}`),console.log(`${w.BOLD}env.sh:${w.RESET} ${Pc()}`),console.log(`${w.BOLD}sandbox_root:${w.RESET} ${hd()} ${w.DIM}(self-derived)${w.RESET}`);for(let s of["repos_root","workspaces_root"]){let o=t[s],a=o?"YAML":"default";console.log(`${w.BOLD}${s}:${w.RESET} ${o||av(s)} ${w.DIM}(${a})${w.RESET}`)}let r=Ut(e);console.log(`${w.BOLD}ingress:${w.RESET}`);for(let[s,o]of Object.entries(r)){let a=e.ingress?.[s]?"YAML":"default";console.log(` ${s}: ${o} ${w.DIM}(${a})${w.RESET}`)}let n=Object.fromEntries(Object.entries(e.overrides||{}).filter(([,s])=>s));if(Object.keys(n).length){console.log(`${w.BOLD}overrides:${w.RESET}`);for(let[s,o]of Object.entries(n))console.log(` ${s}: ${o}`)}}async function uwe(e){let t=He();if(e.check){let d=um(t);if(d.length){for(let p of d)console.log(`${w.RED}\u2717 ${p}${w.RESET}`);P("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){lwe(t);return}let r={};e.repos_root&&(r.repos_root=e.repos_root),e.workspaces_root&&(r.workspaces_root=e.workspaces_root);let n=i(d=>im(d.key,t,r),"defaultFor"),s=Ic.filter(d=>!(d.key in r));if(s.length)if(process.stdin.isTTY)await Pi(Ic,r,n,{intro:"Global sandbox config \u2014 press Ctrl-C to abort. Defaults in [brackets]."});else for(let d of s)d.key in r||(r[d.key]=n(d));let o={version:1,paths:{sandbox_root:String(hd()),repos_root:r.repos_root,workspaces_root:r.workspaces_root},overrides:t.overrides||{},...t.ingress?{ingress:t.ingress}:{},...t.jira?{jira:t.jira}:{}},a=am(o),c=Dc(o),l=jc(),u=lm();F(`Wrote ${a}`),O(`Regenerated ${c}`),O(`${Nc()}: ${l?"updated":"already sources env.sh"}`);let f=Hi();LW.existsSync(f)&&O(`${DW.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 FW=R(()=>{"use strict";h();ot();_e();dc();i(lwe,"show");i(uwe,"run")});var MW={};ce(MW,{run:()=>fwe});async function fwe(e){e.action!=="prune"&&(P(`Unknown action \`${String(e.action)}\` \u2014 the only action is \`prune\`.`),process.exit(2));let t=await uD({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 r of t){let n=r.ok?`${w.GREEN}\u2713${w.RESET}`:`${w.RED}\u2717${w.RESET}`;console.log(`${n} ${r.name} (${r.action}): ${r.detail}`)}t.some(r=>!r.ok)&&process.exit(1)}var BW=R(()=>{"use strict";h();nd();_e();i(fwe,"run")});var qW={};ce(qW,{run:()=>dwe});async function dwe(e){let t=String(e.action??"sync");t!=="sync"&&(P(`Unknown action \`${t}\` \u2014 the only action is \`sync\` (the default).`),process.exit(2));let r=!!e.check,n=Fl({checkOnly:r});for(let s of n){let o=s.ok?`${w.GREEN}\u2713${w.RESET}`:`${w.RED}\u2717${w.RESET}`;console.log(`${o} ${s.label}: ${s.detail}`)}n.some(s=>!s.ok)&&(P(r?"Registry is stale \u2014 run `sandbox registry sync`.":"Registry was not generated."),process.exit(1)),F(r?"Registry is up to date.":"Registry generated.")}var UW=R(()=>{"use strict";h();Ls();_e();i(dwe,"run")});import*as nt from"node:fs";import*as HW from"node:os";import*as ir from"node:path";async function pwe(){try{return(await it().listContainers({filters:{status:["running"]}})).map(t=>({name:(t.Names[0]??t.Id).replace(/^\//,""),mounts:(t.Mounts??[]).map(r=>r.Source),workingDir:t.Labels?.["com.docker.compose.project.working_dir"]}))}catch{return null}}function IO(e,t,r){return e.replace(new RegExp(`${hwe(t)}(?![\\w.-])`,"g"),r)}function VW(e,t,r){return nt.readFileSync(e,"utf8")===t?!1:(r||nt.writeFileSync(e,t),!0)}function KW(e){return nt.existsSync(e)?nt.readdirSync(e).sort().map(t=>ir.join(e,t)).filter(t=>[Kp,Vp].some(r=>nt.existsSync(ir.join(t,r,"workspace.yml")))):[]}async function GW(e={}){let t=!!e.checkOnly,r=HW.homedir(),n=ir.join(r,Vp),s=ir.join(r,Kp),o=i((x,v)=>t?v:x,"would");if(Ke("CONFIG_FILE"))return[{label:"tool home",ok:!1,detail:`*_CONFIG_FILE is set (${ar()}), so the home is not ${n}: nothing to move \u2014 unset it to migrate`}];if(nt.existsSync(n)&&nt.existsSync(s))return[{label:"tool home",ok:!1,detail:`both ${n} and ${s} exist \u2014 merge them by hand, then re-run`}];let a=Ln(),c=e.workspaces?KW(a).filter(x=>nt.existsSync(ir.join(x,Vp))&&!nt.existsSync(ir.join(x,Kp))):[];if(nt.existsSync(n)||c.length){let v=(await(e.running??pwe)()??[]).filter(_=>_.mounts.some(b=>WW(b,n))||WW(_.workingDir,a));if(v.length)return[{label:"containers",ok:!1,detail:`still running: ${v.map(_=>_.name).join(", ")} \u2014 stop them (\`werkmeister stop <feature>\`, \`werkmeister infra down\`) and re-run; nothing was changed`}]}let l=[],u=nt.existsSync(n);u?(t||nt.renameSync(n,s),l.push({label:"tool home",ok:!0,detail:o(`moved ${n} \u2192 ${s}`,`would move ${n} \u2192 ${s}`)})):l.push({label:"tool home",ok:!0,detail:nt.existsSync(s)?`already at ${s}`:"no tool home yet \u2014 nothing to move"});let d=ir.join(t&&u?n:s,"config.yaml"),p=!1;if(nt.existsSync(d)){let x=nt.readFileSync(d,"utf8"),v=IO(IO(x,n,s),`~/${Vp}`,`~/${Kp}`);p=VW(d,v,t)}if(l.push({label:"config.yaml",ok:!0,detail:p?o("repointed paths at the new home","would repoint paths at the new home"):"no paths under the old home"}),t)l.push({label:"env.sh, ~/.zshenv, services.yaml",ok:!0,detail:"would regenerate"});else if(nt.existsSync(s)){let x=Pc(),v=!nt.existsSync(x)||nt.readFileSync(x,"utf8")!==cm(He());v&&Dc(He()),l.push({label:"env.sh",ok:!0,detail:v?`regenerated ${x}`:"up to date"}),l.push({label:"~/.zshenv",ok:!0,detail:jc()?`source block now reads ${s}/env.sh`:"up to date"}),l.push(...Fl())}let m=Ld(e.prWatch),y="pr-watch schedule";if(!m.installed)l.push({label:y,ok:!0,detail:"not installed"});else if(m.current&&!(t&&u))l.push({label:y,ok:!0,detail:"up to date"});else if(t)l.push({label:y,ok:!0,detail:`would reinstall ${m.where}`});else{let x=Dd(e.prWatch);l.push({label:y,ok:x.ok,detail:x.lines[0]??""})}let g=[];for(let x of KW(a))for(let v of[De,Xp]){let _=ir.join(x,v);if(!nt.existsSync(_))continue;let b=nt.readFileSync(_,"utf8");VW(_,IO(b,n,s),t)&&g.push(_)}if(l.push({label:"workspace compose files",ok:!0,detail:g.length?`${o("repointed","would repoint")} ${g.length}: ${g.map(x=>ir.relative(a,x)).join(", ")}`:"none mount the old home"}),e.workspaces){if(!t)for(let x of c)nt.renameSync(ir.join(x,Vp),ir.join(x,Kp));l.push({label:"workspace dot-dirs",ok:!0,detail:c.length?`${o("renamed","would rename")} .sandbox/ \u2192 .werkmeister/ in ${c.map(x=>ir.basename(x)).join(", ")}; their CLAUDE.md and contexts say .sandbox/ until each one's next \`werkmeister init-workspace\``:"none left on .sandbox/"})}return u&&!t&&l.push({label:"shared infra",ok:!0,detail:"its files moved as they are (no host paths in them); the next `werkmeister infra up` mounts them from the new home"}),l}var Vp,Kp,WW,hwe,YW=R(()=>{"use strict";h();Pn();Q();Ir();ot();jd();Ls();Vp=".sandbox",Kp=".werkmeister";i(pwe,"dockerRunning");WW=i((e,t)=>e!==void 0&&(e===t||e.startsWith(t+ir.sep)),"within"),hwe=i(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRe");i(IO,"repointed");i(VW,"writeIfChanged");i(KW,"workspaceDirs");i(GW,"migrate")});var zW={};ce(zW,{run:()=>mwe});async function mwe(e){let t=!!e.check,r=await GW({checkOnly:t,workspaces:!!e.workspaces});for(let n of r){let s=n.ok?`${w.GREEN}\u2713${w.RESET}`:`${w.RED}\u2717${w.RESET}`;console.log(`${s} ${n.label}: ${n.detail}`)}r.some(n=>!n.ok)&&(P(t?"Migration would not complete.":"Migration did not complete."),process.exit(1)),F(t?"Nothing written (--check).":"Migrated to ~/.werkmeister.")}var JW=R(()=>{"use strict";h();YW();_e();i(mwe,"run")});h();import LO from"node:path";import{fileURLToPath as gwe}from"node:url";h();var zO=Ie(YO(),1),{program:Kwe,createCommand:Hwe,createArgument:Gwe,createOption:Ywe,CommanderError:zwe,InvalidArgumentError:Jwe,InvalidOptionArgumentError:Xwe,Command:JO,Argument:Ii,Option:hc,Help:Qwe}=zO.default;Pn();Q();Jt();Ve();ga();h();import{execFileSync as ste}from"node:child_process";import*as wI from"node:fs";import*as bI from"node:path";var vI=typeof S>"u"?void 0:S,ote="pnpm turbo run build --filter=werkmeister";function _I(e,t){if(!e?.sha||!wI.existsSync(bI.join(t,".git")))return null;let r;try{r=ste("git",["-C",t,"rev-parse","HEAD"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return null}return r===e.sha?null:`warning: this sandbox CLI was built from ${e.sha.slice(0,7)+(e.dirty?" (+uncommitted changes)":"")}, but ${t} is at ${r.slice(0,7)}.
1373
+ ${w.BOLD}${e}${w.RESET}`)}async function awe(e){let t=He(),r=Ut(t);Cn("1. Paths & the workspace repo");let n={},s=i(J=>im(J.key,t,n),"pathDefault");if(e)await Pi(Ic,n,s,{intro:"Where your repos and per-feature workspaces live. Defaults in [brackets]."});else for(let J of Ic)n[J.key]=s(J),O(` ${J.key}: ${n[J.key]}`);let o=nj();o.length||P(" `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((J,pc)=>pc.length?{...J,choicesFn:i(()=>pc,"choicesFn")}:J,"withChoices"),c={},l=[a(QR,o.map(J=>`${J}/${Zn}`)),a(e8,o)],u=i(J=>J.key==="workspace_repo"?af(t)||(o[0]?`${o[0]}/${Zn}`:""):t.overrides?.github_org||(c.workspace_repo??"").split("/")[0]||"","ghDefault");if(e)await Pi(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 J of l)c[J.key]=u(J),O(` ${J.key}: ${c[J.key]||"(unset \u2014 `gh` named no user)"}`);Cn("2. Browser");let f={},d=i(()=>t.overrides?.browser||vd,"browserDefault");e?await Pi([i5],f,d,{intro:"Which browser `sandbox open` launches."}):(f.browser=d(),O(` browser: ${f.browser}`)),mo[f.browser]?.engine!=="chromium"&&f.browser!=="safari"&&P(` ${mo[f.browser].label} isn't wired up yet -- \`sandbox open\` will error until it's picked to chrome/chromium/brave/edge/safari.`),Cn("3. Ingress");let p={},m=i(J=>String(r[J.key]??""),"ingressDefault");if(e)await Pi(cv,p,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 J of cv)p[J.key]=m(J),O(` ${J.key}: ${p[J.key]}`);Cn("4. Service registry");let y=Js(),g=bt(n.repos_root),x=!1,v=_2(y)??"orbstack",_=[];try{_=mi(g).map(J=>J.repo)}catch{}_.length?O(`${y} will be generated from ${_.length} repo fragment(s): ${_.join(", ")}.`):(O(`No <repo>/${kd} found under ${g}.`),O("Clone your team's repos there and re-run `sandbox setup`, or try the demo apps.")),_.includes("demo-services")||(x=await Yt(" Clone the demo apps (backend, frontend) so there is something to run?",!1,e)),!NO.existsSync(ms())&&e&&(v=await gu("Kube context for `sandbox intercept` (services.local.yaml k8s_context)",v)),Cn("5. Issue tracker");let b={},E=i(()=>Ji(t),"trackerDefault");e?await Pi([{key:"issue_tracker",label:"Issue tracker",help:"Where workspace issues come from and where agents file existing bugs. "+zi.map(J=>`${J}: ${wv(J).label} (e.g. ${wv(J).refExample})`).join("; ")+".",acceptEmpty:!1,pattern:`(${zi.join("|")})`,choicesFn:i(()=>[...zi],"choicesFn")}],b,E):(b.issue_tracker=E(),O(` issue_tracker: ${b.issue_tracker}`));let k={...Qs()},T=!!(k.base_url&&k.email&&k.api_token);if(b.issue_tracker==="github"){let J=c.github_org;J?_.length?O(`Tracking GitHub issues in: ${_.map(pc=>`${J}/${pc}`).join(", ")}.`):O(`Tracking GitHub issues in every registry repo under ${J} (none registered yet).`):P(" No GitHub org set (section 1) \u2014 workspaces can only take owner/repo#n issue refs.")}else b.issue_tracker==="jira"&&T?O(`Already configured for ${k.email}.`):b.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 Yt(" Configure Jira credentials now?",!1,e)&&(k.base_url=await gu("Jira base URL",k.base_url??"https://your-org.atlassian.net"),k.email=await gu("Atlassian login email",k.email??""),O(" Create a token at https://id.atlassian.com/manage-profile/security/api-tokens"),k.api_token=await gu("API token",k.api_token??"",{secret:!0})));Cn("6. Telepresence (optional)"),O("Only `sandbox intercept` needs it \u2014 reroutes cluster traffic to a local container.");let A=await Yt(" Install/upgrade the OSS client via Homebrew if it's missing or stale?",!1,e);Cn("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 I=await Yt(" Install the superpowers plugin?",!1,e);Cn("8. VS Code (optional)");let N=K2(),j=!1;N.present?N.error?P(`${Nd()} does not parse (${N.error}) \u2014 skipping.`):!Object.keys(N.set).length&&!N.drop.length?O("Already mapped."):(O(`Validates <repo>/.werkmeister/services.yaml and .sandbox/workspace.yml against the sandbox's JSON Schemas (needs the redhat.vscode-yaml extension). Adds \`yaml.schemas\` entries to ${Nd()}; comments and other settings are kept.`),j=await Yt(" Add the schema mappings to your VS Code user settings?",!1,e)):O("VS Code not found \u2014 skipping.");let M=lx(),C=!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}).`),C=await Yt(" 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).`),Cn("9. Claude Code standards access (optional)");let L=H2(),B=!1;L.present?L.dirMissing?O(`Standards dir ${pt()} not found \u2014 skipping.`):L.error?P(`${Id()}: ${L.error} \u2014 skipping.`):L.granted?O("Already granted."):(O(`Lets every Claude Code session read the coding standards in ${pt()} without a prompt. Adds it to \`permissions.additionalDirectories\` in ${Id()}; other settings are kept.`),B=e&&await Yt(" Grant Claude Code read access to the standards dir?",!0,e)):O("Claude Code settings dir not found \u2014 skipping."),Cn("10. PR watch schedule (optional)");let q=Ld(),Ne;q.installed?(O(`Installed (${q.where}); logs \u2192 ${q.logFile}. Remove with \`werkmeister pr watch --uninstall\`.`),Ne=!0):(O("Resumes terminal Claude sessions when their PR merges, ships or closes (desktop sessions don't need it)."),Ne=await Yt(` Install a ${q.kind==="launchd"?"launchd agent":"crontab line"} that runs \`werkmeister pr watch\` every 10 minutes?`,!1,e));let U={version:1,paths:{sandbox_root:String(hd()),repos_root:n.repos_root,workspaces_root:n.workspaces_root},ingress:{local_domain:p.local_domain,remote_domain:p.remote_domain,certs_dir:p.certs_dir},overrides:{...t.overrides??{},browser:f.browser,issue_tracker:b.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}:{}},Xe=am(U),dt=Dc(U),me=jc(),Tt=n8(),Wr=lm();return Cn("Writing config"),F(`Wrote ${Xe}`),O(`Regenerated ${dt}`),O(`${Nc()}: ${me?"updated":"already sources env.sh"}`),O(`${ov()}: ${Tt?"installed tab completion":"tab completion already installed"}`),NO.existsSync(Hi())&&O(`${PW.basename(Hi())}: ${Wr?"dropped stale env block":"no env block to remove"}`),{workspaceRepo:c.workspace_repo,demo:x,k8sContext:v,installTelepresence:A,installOptionalPlugins:I,mapEditorSchemas:j,installVscodeExtension:C,grantStandardsDir:B,installPrWatch:Ne,skipSudo:!e}}function RW(){try{return _f()}catch{return[]}}function CW(e){Cn("Prerequisites");for(let t of e)t.ok?console.log(`${w.GREEN}\u2713${w.RESET} ${t.label}: ${t.detail}`):t.optional?console.log(`${w.YELLOW}\u26A0 ${t.label}: ${t.detail}${w.RESET}`):console.log(`${w.RED}\u2717 ${t.label}: ${t.detail}${w.RESET}`);return e.filter(t=>!t.ok&&!t.optional).length}async function cwe(e){let t=!!e.check,r=!!e.yes;if(t){let l=await J2({checkOnly:!0,hostnames:RW()}),u=um(He()).filter(f=>!/^paths\.\w+ does not exist/.test(f));for(let f of u)l.unshift({label:"global config",ok:!1,detail:f});CW(l)&&(P("Prerequisites out of date \u2014 run `sandbox setup` to converge."),process.exit(1)),F("All required sandbox prerequisites are in order.");return}let n=!!process.stdin.isTTY&&!r;n?O("Sandbox setup \u2014 press Ctrl-C at any prompt to abort without writing."):!process.stdin.isTTY&&!r&&P("Not a TTY \u2014 running non-interactively with defaults (same as --yes).");let s=await awe(n),o=await J2({checkOnly:!1,demo:s.demo,registry:{k8sContext:s.k8sContext},workspaceRepo:s.workspaceRepo,hostnames:RW,skipSudo:s.skipSudo,installTelepresence:s.installTelepresence,installOptionalPlugins:s.installOptionalPlugins,mapEditorSchemas:s.mapEditorSchemas,installVscodeExtension:s.installVscodeExtension,grantStandardsDir:s.grantStandardsDir,installPrWatch:s.installPrWatch}),a=CW(o),c=o.filter(l=>!l.ok&&l.optional).length;a&&(P(`${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 IW=R(()=>{"use strict";h();Il();Q();bs();ot();xr();jd();Ls();_e();dc();i(Cn,"heading");i(awe,"configureMachine");i(RW,"resolveHostnames");i(CW,"report");i(cwe,"run")});var jW={};ce(jW,{run:()=>uwe});import*as LW from"node:fs";import*as DW from"node:path";function lwe(e){let t=e.paths||{};console.log(`${w.BOLD}config file:${w.RESET} ${ar()}`),console.log(`${w.BOLD}env.sh:${w.RESET} ${Pc()}`),console.log(`${w.BOLD}sandbox_root:${w.RESET} ${hd()} ${w.DIM}(self-derived)${w.RESET}`);for(let s of["repos_root","workspaces_root"]){let o=t[s],a=o?"YAML":"default";console.log(`${w.BOLD}${s}:${w.RESET} ${o||av(s)} ${w.DIM}(${a})${w.RESET}`)}let r=Ut(e);console.log(`${w.BOLD}ingress:${w.RESET}`);for(let[s,o]of Object.entries(r)){let a=e.ingress?.[s]?"YAML":"default";console.log(` ${s}: ${o} ${w.DIM}(${a})${w.RESET}`)}let n=Object.fromEntries(Object.entries(e.overrides||{}).filter(([,s])=>s));if(Object.keys(n).length){console.log(`${w.BOLD}overrides:${w.RESET}`);for(let[s,o]of Object.entries(n))console.log(` ${s}: ${o}`)}}async function uwe(e){let t=He();if(e.check){let d=um(t);if(d.length){for(let p of d)console.log(`${w.RED}\u2717 ${p}${w.RESET}`);P("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){lwe(t);return}let r={};e.repos_root&&(r.repos_root=e.repos_root),e.workspaces_root&&(r.workspaces_root=e.workspaces_root);let n=i(d=>im(d.key,t,r),"defaultFor"),s=Ic.filter(d=>!(d.key in r));if(s.length)if(process.stdin.isTTY)await Pi(Ic,r,n,{intro:"Global sandbox config \u2014 press Ctrl-C to abort. Defaults in [brackets]."});else for(let d of s)d.key in r||(r[d.key]=n(d));let o={version:1,paths:{sandbox_root:String(hd()),repos_root:r.repos_root,workspaces_root:r.workspaces_root},overrides:t.overrides||{},...t.ingress?{ingress:t.ingress}:{},...t.jira?{jira:t.jira}:{}},a=am(o),c=Dc(o),l=jc(),u=lm();F(`Wrote ${a}`),O(`Regenerated ${c}`),O(`${Nc()}: ${l?"updated":"already sources env.sh"}`);let f=Hi();LW.existsSync(f)&&O(`${DW.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 FW=R(()=>{"use strict";h();ot();_e();dc();i(lwe,"show");i(uwe,"run")});var MW={};ce(MW,{run:()=>fwe});async function fwe(e){e.action!=="prune"&&(P(`Unknown action \`${String(e.action)}\` \u2014 the only action is \`prune\`.`),process.exit(2));let t=await uD({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 r of t){let n=r.ok?`${w.GREEN}\u2713${w.RESET}`:`${w.RED}\u2717${w.RESET}`;console.log(`${n} ${r.name} (${r.action}): ${r.detail}`)}t.some(r=>!r.ok)&&process.exit(1)}var BW=R(()=>{"use strict";h();nd();_e();i(fwe,"run")});var qW={};ce(qW,{run:()=>dwe});async function dwe(e){let t=String(e.action??"sync");t!=="sync"&&(P(`Unknown action \`${t}\` \u2014 the only action is \`sync\` (the default).`),process.exit(2));let r=!!e.check,n=Fl({checkOnly:r});for(let s of n){let o=s.ok?`${w.GREEN}\u2713${w.RESET}`:`${w.RED}\u2717${w.RESET}`;console.log(`${o} ${s.label}: ${s.detail}`)}n.some(s=>!s.ok)&&(P(r?"Registry is stale \u2014 run `sandbox registry sync`.":"Registry was not generated."),process.exit(1)),F(r?"Registry is up to date.":"Registry generated.")}var UW=R(()=>{"use strict";h();Ls();_e();i(dwe,"run")});import*as nt from"node:fs";import*as HW from"node:os";import*as ir from"node:path";async function pwe(){try{return(await it().listContainers({filters:{status:["running"]}})).map(t=>({name:(t.Names[0]??t.Id).replace(/^\//,""),mounts:(t.Mounts??[]).map(r=>r.Source),workingDir:t.Labels?.["com.docker.compose.project.working_dir"]}))}catch{return null}}function IO(e,t,r){return e.replace(new RegExp(`${hwe(t)}(?![\\w.-])`,"g"),r)}function VW(e,t,r){return nt.readFileSync(e,"utf8")===t?!1:(r||nt.writeFileSync(e,t),!0)}function KW(e){return nt.existsSync(e)?nt.readdirSync(e).sort().map(t=>ir.join(e,t)).filter(t=>[Kp,Vp].some(r=>nt.existsSync(ir.join(t,r,"workspace.yml")))):[]}async function GW(e={}){let t=!!e.checkOnly,r=HW.homedir(),n=ir.join(r,Vp),s=ir.join(r,Kp),o=i((x,v)=>t?v:x,"would");if(Ke("CONFIG_FILE"))return[{label:"tool home",ok:!1,detail:`*_CONFIG_FILE is set (${ar()}), so the home is not ${n}: nothing to move \u2014 unset it to migrate`}];if(nt.existsSync(n)&&nt.existsSync(s))return[{label:"tool home",ok:!1,detail:`both ${n} and ${s} exist \u2014 merge them by hand, then re-run`}];let a=Ln(),c=e.workspaces?KW(a).filter(x=>nt.existsSync(ir.join(x,Vp))&&!nt.existsSync(ir.join(x,Kp))):[];if(nt.existsSync(n)||c.length){let v=(await(e.running??pwe)()??[]).filter(_=>_.mounts.some(b=>WW(b,n))||WW(_.workingDir,a));if(v.length)return[{label:"containers",ok:!1,detail:`still running: ${v.map(_=>_.name).join(", ")} \u2014 stop them (\`werkmeister stop <feature>\`, \`werkmeister down infra\`) and re-run; nothing was changed`}]}let l=[],u=nt.existsSync(n);u?(t||nt.renameSync(n,s),l.push({label:"tool home",ok:!0,detail:o(`moved ${n} \u2192 ${s}`,`would move ${n} \u2192 ${s}`)})):l.push({label:"tool home",ok:!0,detail:nt.existsSync(s)?`already at ${s}`:"no tool home yet \u2014 nothing to move"});let d=ir.join(t&&u?n:s,"config.yaml"),p=!1;if(nt.existsSync(d)){let x=nt.readFileSync(d,"utf8"),v=IO(IO(x,n,s),`~/${Vp}`,`~/${Kp}`);p=VW(d,v,t)}if(l.push({label:"config.yaml",ok:!0,detail:p?o("repointed paths at the new home","would repoint paths at the new home"):"no paths under the old home"}),t)l.push({label:"env.sh, ~/.zshenv, services.yaml",ok:!0,detail:"would regenerate"});else if(nt.existsSync(s)){let x=Pc(),v=!nt.existsSync(x)||nt.readFileSync(x,"utf8")!==cm(He());v&&Dc(He()),l.push({label:"env.sh",ok:!0,detail:v?`regenerated ${x}`:"up to date"}),l.push({label:"~/.zshenv",ok:!0,detail:jc()?`source block now reads ${s}/env.sh`:"up to date"}),l.push(...Fl())}let m=Ld(e.prWatch),y="pr-watch schedule";if(!m.installed)l.push({label:y,ok:!0,detail:"not installed"});else if(m.current&&!(t&&u))l.push({label:y,ok:!0,detail:"up to date"});else if(t)l.push({label:y,ok:!0,detail:`would reinstall ${m.where}`});else{let x=Dd(e.prWatch);l.push({label:y,ok:x.ok,detail:x.lines[0]??""})}let g=[];for(let x of KW(a))for(let v of[De,Xp]){let _=ir.join(x,v);if(!nt.existsSync(_))continue;let b=nt.readFileSync(_,"utf8");VW(_,IO(b,n,s),t)&&g.push(_)}if(l.push({label:"workspace compose files",ok:!0,detail:g.length?`${o("repointed","would repoint")} ${g.length}: ${g.map(x=>ir.relative(a,x)).join(", ")}`:"none mount the old home"}),e.workspaces){if(!t)for(let x of c)nt.renameSync(ir.join(x,Vp),ir.join(x,Kp));l.push({label:"workspace dot-dirs",ok:!0,detail:c.length?`${o("renamed","would rename")} .sandbox/ \u2192 .werkmeister/ in ${c.map(x=>ir.basename(x)).join(", ")}; their CLAUDE.md and contexts say .sandbox/ until each one's next \`werkmeister init-workspace\``:"none left on .sandbox/"})}return u&&!t&&l.push({label:"shared infra",ok:!0,detail:"its files moved as they are (no host paths in them); the next `werkmeister connect` mounts them from the new home"}),l}var Vp,Kp,WW,hwe,YW=R(()=>{"use strict";h();Pn();Q();Ir();ot();jd();Ls();Vp=".sandbox",Kp=".werkmeister";i(pwe,"dockerRunning");WW=i((e,t)=>e!==void 0&&(e===t||e.startsWith(t+ir.sep)),"within"),hwe=i(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRe");i(IO,"repointed");i(VW,"writeIfChanged");i(KW,"workspaceDirs");i(GW,"migrate")});var zW={};ce(zW,{run:()=>mwe});async function mwe(e){let t=!!e.check,r=await GW({checkOnly:t,workspaces:!!e.workspaces});for(let n of r){let s=n.ok?`${w.GREEN}\u2713${w.RESET}`:`${w.RED}\u2717${w.RESET}`;console.log(`${s} ${n.label}: ${n.detail}`)}r.some(n=>!n.ok)&&(P(t?"Migration would not complete.":"Migration did not complete."),process.exit(1)),F(t?"Nothing written (--check).":"Migrated to ~/.werkmeister.")}var JW=R(()=>{"use strict";h();YW();_e();i(mwe,"run")});h();import LO from"node:path";import{fileURLToPath as gwe}from"node:url";h();var zO=Ie(YO(),1),{program:Kwe,createCommand:Hwe,createArgument:Gwe,createOption:Ywe,CommanderError:zwe,InvalidArgumentError:Jwe,InvalidOptionArgumentError:Xwe,Command:JO,Argument:Ii,Option:hc,Help:Qwe}=zO.default;Pn();Q();Jt();Ve();ga();h();import{execFileSync as ste}from"node:child_process";import*as wI from"node:fs";import*as bI from"node:path";var vI=typeof S>"u"?void 0:S,ote="pnpm turbo run build --filter=werkmeister";function _I(e,t){if(!e?.sha||!wI.existsSync(bI.join(t,".git")))return null;let r;try{r=ste("git",["-C",t,"rev-parse","HEAD"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return null}return r===e.sha?null:`warning: this sandbox CLI was built from ${e.sha.slice(0,7)+(e.dirty?" (+uncommitted changes)":"")}, but ${t} is at ${r.slice(0,7)}.
1374
1374
  Rebuild it from ${t}: ${ote}`}i(_I,"staleBuildWarning");io();var XW=LO.resolve(LO.dirname(gwe(import.meta.url)),"..");Ke("ROOT")||(process.env.SANDBOX_ROOT=XW);var DO="\x1B[31m",xwe="\x1B[1m",Xy="\x1B[0m",ywe=`${xwe}Developer Sandbox CLI${Xy}
1375
1375
  Multi-feature concurrent development orchestrator
1376
1376
  `,wwe=[{name:"up",load:i(()=>Promise.resolve().then(()=>(A7(),T7)),"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(()=>(j7(),D7)),"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(()=>(B7(),M7)),"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(()=>(U7(),q7)),"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(()=>(Gk(),W7)),"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(()=>(fF(),uF)),"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(()=>(mF(),hF)),"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(()=>(CF(),RF)),"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(()=>(IU(),NU)),"load"),configure:i(e=>{e.description("Generate <repo>/.werkmeister/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(()=>(DU(),LU)),"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(()=>(FU(),jU)),"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(()=>(BU(),MU)),"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(()=>(WU(),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],r)=>({feature:e,extra:t??[],scaffold:r.scaffold??!1,workspace:r.workspace??null,base_url:r.baseUrl??null}),"namespace")},{name:"starting-prompt",load:i(()=>Promise.resolve().then(()=>(HU(),KU)),"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(()=>(YU(),GU)),"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(()=>(Vk(),Wk)),"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(()=>(JU(),zU)),"load"),configure:i(e=>{e.description("Regenerate Caddyfile and reload Caddy")},"configure"),namespace:i(()=>({}),"namespace")},{name:"clean",load:i(()=>Promise.resolve().then(()=>(QU(),XU)),"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(()=>(_1(),SF)),"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(()=>(eW(),ZU)),"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(()=>(rW(),tW)),"load"),configure:i(e=>{e.description("Workspace sb-* skill projection: verify freshness against the sandbox repo (check) or rewrite it (sync)").addArgument(new Ii("<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(()=>(sW(),nW)),"load"),configure:i(e=>{e.description("Validate the configured standards tree (structural regression gate)").addArgument(new Ii("<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(()=>(iW(),oW)),"load"),configure:i(e=>{e.description("Claude Code hook entrypoints: the standards gate, the PR guard and the agent state").addArgument(new Ii("<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(()=>(Kk(),I7)),"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 Ii("<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 hc("--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],r)=>({action:e,note_num:t==null?null:Number.parseInt(t,10),domain:r.domain??null,kind:r.kind??null,slug:r.slug??null}),"namespace")},{name:"workspace",load:i(()=>Promise.resolve().then(()=>(pW(),dW)),"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 hc("--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 hc("--context-strategy <id>","Context layer to generate: jit (skills, hooks, notes) or icm (staged folders). (env: SANDBOX_CONTEXT_STRATEGY; config: context_strategy).").choices([...Nr])).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(()=>(mW(),hW)),"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(()=>(vW(),bW)),"load"),configure:i(e=>{e.description("Read, update or file an issue in this machine's issue tracker (see `sandbox setup`)").addArgument(new Ii("<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],r)=>({action:e,ref:t??null,json:!!r.json,status:r.status??null,comment:r.comment??null,project:r.project??null,type:r.type??null,title:r.title??null,bodyFile:r.bodyFile??null}),"namespace")},{name:"remove-workspace",load:i(()=>Promise.resolve().then(()=>(SW(),_W)),"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(()=>(EW(),kW)),"load"),configure:i(e=>{e.description("Open and track this workspace's PRs from its PR files (docs/workspace-lifecycle.md)").addArgument(new Ii("<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],r)=>{let n=t,s=typeof r.pr=="string"?r.pr:null,o=e==="adopt"&&s===null?n[0]??null:null;return{action:e,pr:o,noPr:s,repo:n[o?1:0]??null,json:!!r.json,install:!!r.install,uninstall:!!r.uninstall}},"namespace")},{name:"close-out",load:i(()=>Promise.resolve().then(()=>(OW(),$W)),"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(()=>(AW(),TW)),"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(()=>(IW(),NW)),"load"),configure:i(e=>{e.description("Guided machine setup: walks through paths, ingress domains and the ~/.werkmeister 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(()=>(FW(),jW)),"load"),configure:i(e=>{e.description("Set up and maintain the machine-global sandbox config (~/.werkmeister/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(()=>(BW(),MW)),"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],r)=>({action:e,name:t??null,reset:!!r.reset,force:!!r.force,dry_run:!!r.dryRun}),"namespace")},{name:"registry",load:i(()=>Promise.resolve().then(()=>(UW(),qW)),"load"),configure:i(e=>{e.description("Regenerate ~/.werkmeister/services.yaml from every <repo>/.werkmeister/services.yaml (or legacy .sandbox/services.yaml) under paths.repos_root (merged under ~/.werkmeister/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:"migrate",load:i(()=>Promise.resolve().then(()=>(JW(),zW)),"load"),configure:i(e=>{e.description("Move ~/.sandbox to ~/.werkmeister and repoint everything that names it: config.yaml, env.sh, the ~/.zshenv block, services.yaml, the pr-watch schedule and workspace compose files. Safe to re-run; refuses while affected containers are running.").option("--workspaces","Also rename each workspace's .sandbox/ to .werkmeister/.").option("--check","Report what would change without writing.")},"configure"),namespace:i((e,t)=>({check:!!t.check,workspaces:!!t.workspaces}),"namespace")},{name:"init-workspace",load:i(()=>Promise.resolve().then(()=>(CO(),cW)),"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 / ${De}. 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 hc("--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 hc("--context-strategy <id>","Context layer to generate: jit (skills, hooks, notes) or icm (staged folders). (env: SANDBOX_CONTEXT_STRATEGY; config: context_strategy).").choices([...Nr])).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 bwe(e,t){try{let{migrateSlotsJson:n}=await Promise.resolve().then(()=>(Rt(),UN));await n()}catch{}let r;try{r=await e.load()}catch(n){throw n.code==="ERR_MODULE_NOT_FOUND"&&(console.log(`${DO}Failed to load command '${e.name}': ${n.message}${Xy}`),process.exit(1)),n}try{await r.run(t)}catch(n){if(n instanceof Y&&n.code!==Cc?D(n.message):console.log(`${DO}Error: ${n.message}${Xy}`),Ke("DEBUG"))throw n;process.exit(1)}}i(bwe,"dispatch");async function vwe(e){let t=(process.env.COMP_LINE??"").slice(0,Number(process.env.COMP_POINT??0)),r=t.split(/\s+/),n=t.endsWith(" ")?"":r.pop()??"",s=e.commands.find(a=>a.name()===r[1]),o=[];if(!s)o=e.commands.map(a=>a.name());else if(n.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(()=>(Xn(),y1)),{workspaces:c}=await a();o.push(...c.map(l=>l.name))}catch{}}console.log(o.filter(a=>a.startsWith(n)).join(`
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "werkmeister",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Multi-feature concurrent development orchestrator CLI tool",
6
6
  "type": "module",
@@ -55,7 +55,7 @@
55
55
  "typescript": "^5.7.0",
56
56
  "vitest": "^3.0.0",
57
57
  "yaml": "^2.7.0",
58
- "werkmeister-core": "0.36.0"
58
+ "werkmeister-core": "0.36.1"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "node esbuild.mjs",