werkmeister 0.26.0 → 0.26.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/README.md CHANGED
@@ -7,8 +7,8 @@ ingress hostnames.
7
7
  ## Quick start
8
8
 
9
9
  ```sh
10
- npm install
11
- npm run build
10
+ pnpm install
11
+ pnpm run build
12
12
  ./sandbox --help
13
13
  ```
14
14
 
File without changes
@@ -134,26 +134,6 @@ OTHER DEALINGS IN THE SOFTWARE.
134
134
 
135
135
  ------------------------------------------------------------------------
136
136
 
137
- mute-stream@3.0.0 (ISC)
138
-
139
- The ISC License
140
-
141
- Copyright (c) Isaac Z. Schlueter and Contributors
142
-
143
- Permission to use, copy, modify, and/or distribute this software for any
144
- purpose with or without fee is hereby granted, provided that the above
145
- copyright notice and this permission notice appear in all copies.
146
-
147
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
148
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
149
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
150
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
151
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
152
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
153
- IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
154
-
155
- ------------------------------------------------------------------------
156
-
157
137
  @inquirer/editor@5.2.2 (MIT)
158
138
 
159
139
  Copyright (c) 2025 Simon Boudrias
@@ -644,11 +624,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
644
624
 
645
625
  ------------------------------------------------------------------------
646
626
 
647
- ajv@8.20.0 (MIT)
627
+ ajv-formats@3.0.1 (MIT)
648
628
 
649
- The MIT License (MIT)
629
+ MIT License
650
630
 
651
- Copyright (c) 2015-2021 Evgeny Poberezkin
631
+ Copyright (c) 2020 Evgeny Poberezkin
652
632
 
653
633
  Permission is hereby granted, free of charge, to any person obtaining a copy
654
634
  of this software and associated documentation files (the "Software"), to deal
@@ -670,11 +650,11 @@ SOFTWARE.
670
650
 
671
651
  ------------------------------------------------------------------------
672
652
 
673
- ajv-formats@3.0.1 (MIT)
653
+ ajv@8.20.0 (MIT)
674
654
 
675
- MIT License
655
+ The MIT License (MIT)
676
656
 
677
- Copyright (c) 2020 Evgeny Poberezkin
657
+ Copyright (c) 2015-2021 Evgeny Poberezkin
678
658
 
679
659
  Permission is hereby granted, free of charge, to any person obtaining a copy
680
660
  of this software and associated documentation files (the "Software"), to deal
@@ -766,33 +746,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
766
746
 
767
747
  ------------------------------------------------------------------------
768
748
 
769
- content-type@2.0.0 (MIT)
770
-
771
- (The MIT License)
772
-
773
- Copyright (c) 2015 Douglas Christopher Wilson
774
-
775
- Permission is hereby granted, free of charge, to any person obtaining
776
- a copy of this software and associated documentation files (the
777
- 'Software'), to deal in the Software without restriction, including
778
- without limitation the rights to use, copy, modify, merge, publish,
779
- distribute, sublicense, and/or sell copies of the Software, and to
780
- permit persons to whom the Software is furnished to do so, subject to
781
- the following conditions:
782
-
783
- The above copyright notice and this permission notice shall be
784
- included in all copies or substantial portions of the Software.
785
-
786
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
787
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
788
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
789
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
790
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
791
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
792
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
793
-
794
- ------------------------------------------------------------------------
795
-
796
749
  bytes@3.1.2 (MIT)
797
750
 
798
751
  (The MIT License)
@@ -1016,12 +969,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1016
969
 
1017
970
  ------------------------------------------------------------------------
1018
971
 
1019
- cookie@0.7.2 (MIT)
972
+ content-type@2.0.0 (MIT)
1020
973
 
1021
974
  (The MIT License)
1022
975
 
1023
- Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
1024
- Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
976
+ Copyright (c) 2015 Douglas Christopher Wilson
1025
977
 
1026
978
  Permission is hereby granted, free of charge, to any person obtaining
1027
979
  a copy of this software and associated documentation files (the
@@ -1071,6 +1023,34 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1071
1023
 
1072
1024
  ------------------------------------------------------------------------
1073
1025
 
1026
+ cookie@0.7.2 (MIT)
1027
+
1028
+ (The MIT License)
1029
+
1030
+ Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
1031
+ Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
1032
+
1033
+ Permission is hereby granted, free of charge, to any person obtaining
1034
+ a copy of this software and associated documentation files (the
1035
+ 'Software'), to deal in the Software without restriction, including
1036
+ without limitation the rights to use, copy, modify, merge, publish,
1037
+ distribute, sublicense, and/or sell copies of the Software, and to
1038
+ permit persons to whom the Software is furnished to do so, subject to
1039
+ the following conditions:
1040
+
1041
+ The above copyright notice and this permission notice shall be
1042
+ included in all copies or substantial portions of the Software.
1043
+
1044
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
1045
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1046
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1047
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
1048
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
1049
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
1050
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1051
+
1052
+ ------------------------------------------------------------------------
1053
+
1074
1054
  debug@4.4.3 (MIT)
1075
1055
 
1076
1056
  (The MIT License)
@@ -2182,6 +2162,26 @@ SOFTWARE.
2182
2162
 
2183
2163
  ------------------------------------------------------------------------
2184
2164
 
2165
+ mute-stream@3.0.0 (ISC)
2166
+
2167
+ The ISC License
2168
+
2169
+ Copyright (c) Isaac Z. Schlueter and Contributors
2170
+
2171
+ Permission to use, copy, modify, and/or distribute this software for any
2172
+ purpose with or without fee is hereby granted, provided that the above
2173
+ copyright notice and this permission notice appear in all copies.
2174
+
2175
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
2176
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
2177
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
2178
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
2179
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
2180
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
2181
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2182
+
2183
+ ------------------------------------------------------------------------
2184
+
2185
2185
  negotiator@1.0.0 (MIT)
2186
2186
 
2187
2187
  (The MIT License)
@@ -2720,11 +2720,11 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2720
2720
 
2721
2721
  ------------------------------------------------------------------------
2722
2722
 
2723
- side-channel@1.1.1 (MIT)
2723
+ side-channel-list@1.0.1 (MIT)
2724
2724
 
2725
2725
  MIT License
2726
2726
 
2727
- Copyright (c) 2019 Jordan Harband
2727
+ Copyright (c) 2024 Jordan Harband
2728
2728
 
2729
2729
  Permission is hereby granted, free of charge, to any person obtaining a copy
2730
2730
  of this software and associated documentation files (the "Software"), to deal
@@ -2746,7 +2746,7 @@ SOFTWARE.
2746
2746
 
2747
2747
  ------------------------------------------------------------------------
2748
2748
 
2749
- side-channel-list@1.0.1 (MIT)
2749
+ side-channel-map@1.0.1 (MIT)
2750
2750
 
2751
2751
  MIT License
2752
2752
 
@@ -2772,11 +2772,11 @@ SOFTWARE.
2772
2772
 
2773
2773
  ------------------------------------------------------------------------
2774
2774
 
2775
- side-channel-map@1.0.1 (MIT)
2775
+ side-channel-weakmap@1.0.2 (MIT)
2776
2776
 
2777
2777
  MIT License
2778
2778
 
2779
- Copyright (c) 2024 Jordan Harband
2779
+ Copyright (c) 2019 Jordan Harband
2780
2780
 
2781
2781
  Permission is hereby granted, free of charge, to any person obtaining a copy
2782
2782
  of this software and associated documentation files (the "Software"), to deal
@@ -2798,7 +2798,7 @@ SOFTWARE.
2798
2798
 
2799
2799
  ------------------------------------------------------------------------
2800
2800
 
2801
- side-channel-weakmap@1.0.2 (MIT)
2801
+ side-channel@1.1.1 (MIT)
2802
2802
 
2803
2803
  MIT License
2804
2804
 
@@ -3165,6 +3165,26 @@ THIS SOFTWARE.
3165
3165
 
3166
3166
  ------------------------------------------------------------------------
3167
3167
 
3168
+ zod-to-json-schema@3.25.2 (ISC)
3169
+
3170
+ ISC License
3171
+
3172
+ Copyright (c) 2020, Stefan Terdell
3173
+
3174
+ Permission to use, copy, modify, and/or distribute this software for any
3175
+ purpose with or without fee is hereby granted, provided that the above
3176
+ copyright notice and this permission notice appear in all copies.
3177
+
3178
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3179
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3180
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3181
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3182
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3183
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3184
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3185
+
3186
+ ------------------------------------------------------------------------
3187
+
3168
3188
  zod@4.4.3 (MIT)
3169
3189
 
3170
3190
  MIT License
@@ -3188,23 +3208,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3188
3208
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3189
3209
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3190
3210
  SOFTWARE.
3191
-
3192
- ------------------------------------------------------------------------
3193
-
3194
- zod-to-json-schema@3.25.2 (ISC)
3195
-
3196
- ISC License
3197
-
3198
- Copyright (c) 2020, Stefan Terdell
3199
-
3200
- Permission to use, copy, modify, and/or distribute this software for any
3201
- purpose with or without fee is hereby granted, provided that the above
3202
- copyright notice and this permission notice appear in all copies.
3203
-
3204
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3205
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3206
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3207
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3208
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3209
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3210
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
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 pU=Object.create;var mp=Object.defineProperty;var hU=Object.getOwnPropertyDescriptor;var mU=Object.getOwnPropertyNames;var gU=Object.getPrototypeOf,xU=Object.prototype.hasOwnProperty;var i=(e,t)=>mp(e,"name",{value:t,configurable:!0}),z=(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 C=(e,t)=>()=>(e&&(t=e(e=0)),t);var $=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),be=(e,t)=>{for(var r in t)mp(e,r,{get:t[r],enumerable:!0})},yU=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of mU(t))!xU.call(e,s)&&s!==r&&mp(e,s,{get:()=>t[s],enumerable:!(n=hU(t,s))||n.enumerable});return e};var Pe=(e,t,r)=>(r=e!=null?pU(gU(e)):{},yU(t||!e||!e.__esModule?mp(r,"default",{value:e,enumerable:!0}):r,e));var _,p=C(()=>{_={sha:"208de23e5c2bafd406b713b8929ef285fa4e2637",dirty:!1}});var Gl=$(ny=>{p();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}},ry=class extends gp{static{i(this,"InvalidArgumentError")}constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};ny.CommanderError=gp;ny.InvalidArgumentError=ry});var xp=$(oy=>{p();var{InvalidArgumentError:wU}=Gl(),sy=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 wU(`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 vU(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}i(vU,"humanReadableArgName");oy.Argument=sy;oy.humanReadableArgName=vU});var cy=$(ay=>{p();var{humanReadableArgName:_U}=xp(),iy=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=>_U(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,h){return r.formatItem(d,n,h,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(h=>o(r.styleOptionTerm(r.optionTerm(h)),r.styleOptionDescription(r.optionDescription(h))));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 pU=Object.create;var mp=Object.defineProperty;var hU=Object.getOwnPropertyDescriptor;var mU=Object.getOwnPropertyNames;var gU=Object.getPrototypeOf,xU=Object.prototype.hasOwnProperty;var i=(e,t)=>mp(e,"name",{value:t,configurable:!0}),z=(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 C=(e,t)=>()=>(e&&(t=e(e=0)),t);var $=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),be=(e,t)=>{for(var r in t)mp(e,r,{get:t[r],enumerable:!0})},yU=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of mU(t))!xU.call(e,s)&&s!==r&&mp(e,s,{get:()=>t[s],enumerable:!(n=hU(t,s))||n.enumerable});return e};var Pe=(e,t,r)=>(r=e!=null?pU(gU(e)):{},yU(t||!e||!e.__esModule?mp(r,"default",{value:e,enumerable:!0}):r,e));var _,p=C(()=>{_={sha:"b5688a469cf8fcb5d97ed273967e670f0882157e",dirty:!1}});var Gl=$(ny=>{p();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}},ry=class extends gp{static{i(this,"InvalidArgumentError")}constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};ny.CommanderError=gp;ny.InvalidArgumentError=ry});var xp=$(oy=>{p();var{InvalidArgumentError:wU}=Gl(),sy=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 wU(`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 vU(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}i(vU,"humanReadableArgName");oy.Argument=sy;oy.humanReadableArgName=vU});var cy=$(ay=>{p();var{humanReadableArgName:_U}=xp(),iy=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=>_U(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,h){return r.formatItem(d,n,h,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(h=>o(r.styleOptionTerm(r.optionTerm(h)),r.styleOptionDescription(r.optionDescription(h))));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 L6(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 h=f.trimStart();l=[h],u=this.displayWidth(h)}),o.push(l.join(""))}),o.join(`
@@ -204,7 +204,7 @@ Then output ONLY <result>{"ok":true}</result>, or <result>{"ok":false,"error":"<
204
204
  `)){if(s=s.trim(),!s||s.startsWith("#")||!s.includes("="))continue;let o=s.indexOf("="),a=s.slice(0,o).trim(),c=s.slice(o+1);a in r&&(n[r[a]]=c.trim())}return n}function Li(e,t){let r=At(t,e.config_file??null),n=qG(t),s={};for(let[o,a,c]of kc){let l=e[o]??null,u=a?Ye(a)??null:null,f=c==="issue_id"?sn(r)||null:c in r?r[c]:null,d=c in n?n[c]:null;for(let h of[l,u,f,d]){if(h==null)continue;let m;if(Array.isArray(h)?m=h.map(y=>String(y).trim()).filter(y=>y).join(","):m=String(h).trim(),m){s[c]=m;break}}}return s.issue_id&&(s.issue_id=Oe().parseRef(s.issue_id)??s.issue_id),s.autonomous&&(s.autonomous=String(ts(s.autonomous))),s.auto_stop&&(s.auto_stop=String(ts(s.auto_stop))),s}function UG(e){let t=e.split("-");return t.length&&t[0].length===4&&[...t[0].toLowerCase()].every(r=>"0123456789abcdef".includes(r))&&(t=t.slice(1)),t.length?t.join("-"):e}function WG(e){for(let t of an.readdirSync(e).sort()){let r=on.join(e,t);if(!MG(r)||t.startsWith("."))continue;let n;try{n=W(["git","-C",r,"branch","--show-current"],{capture:!0,timeout:5})}catch(o){if(o instanceof Y&&(o.code==="ENOENT"||o.code==="ETIMEDOUT"))continue;throw o}if(n.status!==0)continue;let s=Oe().parseRef(n.stdout.trim());if(s)return s}return""}function Di(e){let t=e.trim().toLowerCase();return Object.hasOwn(Bh,t)?Bh[t]:$w}function Wh(e,t,r,n={}){let s={key:e.key,label:e.label,help:e.help,accept_empty:e.acceptEmpty??!0,multi:e.multi??!1,recommended:e.recommended??!1,default:e.defaultFn&&n.defaults!==!1?e.defaultFn(t):e.default??"",resolved:e.key in r,resolved_value:e.key in r?r[e.key]:null};if(e.multiline&&(s.multiline=!0),e.boolean&&(s.boolean=!0),e.refinable&&(s.refinable=!0,e.refineInstruction&&(s.refine_instruction=e.refineInstruction)),e.pattern&&(s.pattern=e.pattern),e.placeholder&&(s.placeholder=e.placeholder),e.choicesFn&&(s.choices=e.choicesFn()),e.choiceGroupsFn){let o={},a=e.choiceGroupsFn();for(let c of s.choices??Object.keys(a))(o[a[c]??"other"]??=[]).push(c);s.choice_groups=Object.fromEntries(Object.entries(o).sort(([c],[l])=>c.localeCompare(l)))}return s}function HG(){let e=Oe();return KG.map(t=>t.key==="issue_id"?{...t,placeholder:e.refExample,...e.refPattern?{pattern:e.refPattern}:{}}:t)}function GG(e,t,r={}){return{workspace_root:e,workspace_name:on.basename(e),prompts:HG().map(n=>Wh(n,e,t,r))}}function Ow(e){let t=e.split("-");return t.length&&t[0].length===4&&[...t[0].toLowerCase()].every(r=>"0123456789abcdef".includes(r))&&(t=t.slice(1)),t.length?t.map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" "):e}function jr(){try{return[pe(),rn()]}catch{return[{},{}]}}function TR(e,t,r={}){return Tw(t,Li(e,t),r)}function Tw(e,t,r={}){let n=GG(e,t,r),s=Wh(YG,"",t);if(s.choices.length){let o=n.prompts??[],a=o.findIndex(c=>c.key==="services");a===-1&&(a=o.length-1),o.splice(a+1,0,s),n.prompts=o}return n}var $R,kc,Ro,Bh,$w,VG,KG,YG,ur=C(()=>{"use strict";p();$R=Pe(it(),1);Gn();J();lr();at();We();Mh();i(MG,"isDir");i(BG,"stripJsoncComments");i(Sc,"loadWorkspaceConfig");kc=[["feature",null,"feature"],["work_type","WORK_TYPE","work_type"],["context_strategy","CONTEXT_STRATEGY","context_strategy"],["repos","REPOS","repos"],["services","SERVICES","services"],["issue_id","ISSUE_ID","issue_id"],["test_path","TEST_PATH","test_path"],["description","DESCRIPTION","description"],["task","TASK","task"],["starting_prompt","STARTING_PROMPT","starting_prompt"],["labels","LABELS","labels"],["autonomous","AUTONOMOUS","autonomous"],["model","MODEL","model"],["auto_stop","AUTO_STOP","auto_stop"]];i(ts,"isTrue");i(qh,"readAutonomous");i(Uh,"readAutoStop");i(OR,"readModel");i(Ew,"readWorkspaceField");Ro=["workspace.yml","workspace.yaml","workspace.jsonc","workspace.json"];i(At,"loadConfigFile");i(Bs,"expandUserPath");i(qG,"loadExistingEnvMetadata");i(Li,"resolveInputs");i(UG,"defaultFeatureFromDir");i(WG,"scrapeIssueId");Bh={feature:{path:"architectural",phases:["research","implement","test","review","pr"],gate:{note:"decision",status:"decided"},hint:"invoke `sb-research` first \u2014 it ends in a `decision` note the user approves before any code"},bugfix:{path:"bounded",phases:["research","implement","test","pr"],gate:{note:"finding"},hint:"invoke `sb-research` first to reproduce and write the root cause to a `finding` note before changing code"},incident:{path:"bounded",phases:["research","implement","test","pr"],gate:{note:"finding"},hint:"invoke `sb-research` first to diagnose; the `finding` note is the incident record"},refactor:{path:"bounded",phases:["implement","test","review","pr"],gate:null,hint:"invoke `sb-implement` first \u2014 the scope is known and standards matter most"},spike:{path:"spike",phases:["research"],gate:null,hint:"invoke `sb-research` first to frame the questions; anything built is throwaway and there is no PR"}},$w={path:"architectural",phases:["research","implement","test","review","pr"],gate:null,hint:"invoke `sb-research` first"};i(Di,"planFor");VG=Object.keys(Bh),KG=[{key:"issue_id",label:"Issue",help:"Issue ID in this machine's issue tracker. The issue is fetched and stored in the workspace; empty fields are filled from it.",defaultFn:i(e=>WG(e),"defaultFn")},{key:"feature",label:"Feature name",help:`Lowercase, hyphen-separated. Drives sandbox slot routing via the X-Feature cookie. No feature = no ${Ve} / sandbox-context.md.`,acceptEmpty:!1,recommended:!0,pattern:"^[a-z0-9]+(-[a-z0-9]+)*$",placeholder:"mdx-blog",defaultFn:i(e=>UG(on.basename(e)),"defaultFn")},{key:"work_type",label:"Work type",help:"What kind of work this is; selects the phase sequence and the pre-implementation gate in CLAUDE.md.",acceptEmpty:!1,pattern:"^("+Object.keys(Bh).join("|")+")$",default:"feature",choicesFn:i(()=>[...VG],"choicesFn")},{key:"context_strategy",label:"Workflow",help:"Which context layer init-workspace generates: jit (sb-* skills, hooks, notes) or icm (staged folders the agent walks by itself).",pattern:"^("+Er.join("|")+")$",default:Er[0],choicesFn:i(()=>[...Er],"choicesFn")},{key:"autonomous",label:"Autonomous run",help:"Off by default. On: an icm run goes from stage 01 to `sandbox pr open` with no human check (each stage self-checks and the agent approves its own PR file), and .claude/settings.json allows the git, sandbox, docker, gh, node and python3 calls a headless session needs. The person reviews the PR; `sandbox pr gate` still applies.",boolean:!0},{key:"model",label:"Model",help:"Claude model for this workspace's sessions: an alias (opus, sonnet, haiku) or a full claude-\u2026 id; empty = Claude Code's default. Written to .claude/settings.json and passed as --model to claude-send and claude-resume. A cheaper model suits mechanical jobs (lint passes, renames).",pattern:"^[A-Za-z0-9][A-Za-z0-9._\\[\\]-]*$",placeholder:"sonnet"},{key:"auto_stop",label:"Auto-stop on session end",help:"On by default for autonomous workspaces, off otherwise. On: when a Claude session in the workspace ends and no other one is open there, a SessionEnd hook runs `sandbox stop --if-idle`, which stops this feature's containers (slot and volumes kept; `sandbox up` resumes). Shared infra is never stopped.",boolean:!0},{key:"services",label:"Services to run locally",help:"Services to run locally with hot-reload; the rest fall through to k8s port-forwards.",multi:!0,choicesFn:i(()=>Object.keys(jr()[0]).sort(),"choicesFn"),choiceGroupsFn:i(()=>Object.fromEntries(Object.entries(jr()[0]).map(([e,t])=>[e,String(t?.repo??"other")])),"choiceGroupsFn")},{key:"labels",label:"Labels",help:"Comma-separated free-form tags for filtering workspaces in the dashboard search.",multi:!0},{key:"test_path",label:"Feature test path",help:"URL path for the feature entry point, appended to the routed host.",pattern:"^/\\S*$",placeholder:"/products/foo"},{key:"task",label:"Task title",help:"Short title for the Current Task section. Defaults to the feature name in words.",defaultFn:i(e=>Ow(on.basename(e)),"defaultFn")},{key:"description",label:"Description",help:"1-2 sentences on what the feature does and the user-visible outcome; rendered under Current Task in CLAUDE.md.",placeholder:"Adds an MDX-powered blog index under /blog."},{key:"starting_prompt",label:"Starting prompt",help:"The first instruction to hand the agent in this workspace; persisted to .sandbox/workspace.yml.",multiline:!0,refinable:!0,refineInstruction:"Rewrite the user's text as a clear, specific, actionable starting instruction for a coding agent beginning a development task, preserving the user's intent. The rewritten instruction must state the goal \u2014 the desired end state and why it matters \u2014 and must include explicit acceptance criteria: a checklist of concrete, verifiable conditions that define when the task is done. Derive the goal and acceptance criteria from the user's text wherever possible; for any that cannot be confidently derived, the rewritten instruction must direct the agent to ask the user to supply them before proceeding, rather than guessing."}];i(Wh,"promptEntry");i(HG,"wizardPrompts");i(GG,"buildPromptSpec");i(Ow,"slugToTask");i(jr,"loadSandboxServiceConfigs");YG={key:"repos",label:"Extra repos",help:"Extra repos to create worktrees for. The final set is the union of these and the repos owning the services selected above.",multi:!0,choicesFn:i(()=>Object.keys(rn()).sort(),"choicesFn")};i(TR,"computePromptSpec");i(Tw,"workspacePromptSpec")});function ji(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Aw(e,t){if(!ji(e))return null;let r=e.archetype;if(r!=null){t==null&&(t=Et());let s=t[r];return ji(s)?s:null}let n=e.standards;return n?.length?{standards:Array.from(n)}:null}function AR(e,t){let r=Aw(e,t);return Array.from(r?.standards??[])}function rs(e,t,r){if(!ji(t))return null;let n=t.test;if(n)return String(n);let o=Aw(t,r)?.test;return o?String(o).split("{service}").join(e):null}function Vh(e,t,r){return`docker exec ${e}-${t} sh -c '${r}'`}function Rw(e,t){if(!ji(e))return null;let r=e.validate;if(r)return String(r);let n=Aw(e,t)?.validate;return n?String(n):null}function Bu(e,t,r){return r?.length?[...r]:e.flatMap(n=>t[n]?.services??[])}function Kh(e,t,r,n=new Set){r==null&&(r=Et());let s=[];for(let o of[...new Set(e)].sort()){let a=t[o];if(!ji(a))continue;let c=Rw(a,r);s.push({service:o,repo:String(a.repo??""),path:String(a.path??"."),test:rs(o,a,r),validate:c??(n.has(o)?"URL health check (see Quick Health Checks)":"No validation guidance registered in services.yaml; say so instead of inventing one")})}return s}function zG(e,t,r,n,s){s==null&&(s=Et());let o=Bu(e,r,n),a={};for(let l of o){let u=t[l];if(!ji(u))continue;let f=u.archetype;f&&f in s&&(a[f]??=[]).push(l)}let c={};for(let l of Object.keys(a).sort())c[l]=[...new Set(a[l])].sort();return c}function Hh(e,t,r,n,s){let o=(t.SERVICES??"").split(",").map(a=>a.trim()).filter(a=>a);return zG(e.map(([a])=>a),r,n,o,s)}function RR(e,t){let r=[];for(let[n,s]of Object.entries(e)){if(!ji(s))continue;let o=s.archetype;o!=null&&(o in t||r.push(`services.yaml: service '${n}' references unknown archetype '${o}' \u2014 no \`archetypes.${o}\` entry`),s.standards?.length&&r.push(`services.yaml: service '${n}' declares both \`archetype:\` and legacy \`standards:\` \u2014 drop \`standards:\` (the archetype wins)`))}return r}var ns=C(()=>{"use strict";p();J();i(ji,"isDict");i(Aw,"resolveServiceArchetype");i(AR,"serviceStandards");i(rs,"serviceTestCommand");i(Vh,"containerTestCommand");i(Rw,"serviceValidation");i(Bu,"candidateServiceNames");i(Kh,"validationRows");i(zG,"resolvePresentArchetypes");i(Hh,"presentArchetypes");i(RR,"validateServiceArchetypes")});import*as Dt from"node:fs";import*as Co from"node:path";function sY(){return{hooks:[{type:"command",command:XG}]}}function oY(){return{matcher:"Edit|Write",hooks:[{type:"command",command:QG}]}}function IR(){return{matcher:"Bash|mcp__.*create_pull_request",hooks:[{type:"command",command:ZG}]}}function iY(){return{hooks:[{type:"command",command:eY,timeout:nY}]}}function aY(){return{hooks:[{type:"command",command:tY}]}}function LR(e,t=Gh){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let r=e.hooks;return Array.isArray(r)?r.some(n=>typeof n=="object"&&n!==null&&!Array.isArray(n)&&String(n.command??"").includes(t)):!1}function cY(e,t,r,n){let s=t in e?e[t]:[];if(!Array.isArray(s))return!1;let o=s.filter(a=>!LR(a,n));return o.push(r),e[t]=o,!0}function Lw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qu(e){return Co.join(e,".claude","settings.json")}function Dw(e){if(!Dt.existsSync(e))return{};try{let t=JSON.parse(Dt.readFileSync(e,"utf8"));return Lw(t)?t:null}catch{return null}}function Yh(e,t){if(Object.keys(t).length){Dt.mkdirSync(Co.dirname(e),{recursive:!0}),Dt.writeFileSync(e,JSON.stringify(t,null,2)+`
205
205
  `);return}Dt.rmSync(e,{force:!0});try{Dt.rmdirSync(Co.dirname(e))}catch{}}function zh(e,t){let r=qu(e),n=Dw(r);if(n===null)return r;"hooks"in n||(n.hooks={});let s=n.hooks;if(typeof s!="object"||s===null||Array.isArray(s))return r;for(let[o,a,c]of t)if(!cY(s,o,a,c))return r;return Yh(r,n),r}function jw(e){return zh(e,[["SessionStart",sY(),Gh],["PreToolUse",oY(),Pw],["PreToolUse",IR(),Iw]])}function lY(e){return zh(e,rY.map(t=>[t,aY(),PR]))}function DR(e){return zh(e,[["PreToolUse",IR(),Iw]])}function jR(e){return FR(e,[["SessionStart",Gh],["PreToolUse",Pw]])}function uY(e,t){return t?zh(e,[["SessionEnd",iY(),Cw]]):(FR(e,[["SessionEnd",Cw]]),qu(e))}function FR(e,t){let r=qu(e),n;try{n=JSON.parse(Dt.readFileSync(r,"utf8"))}catch{return[]}let s=n?.hooks;if(typeof s!="object"||s===null||Array.isArray(s))return[];let o=[];for(let[a,c]of t){let l=s[a];if(!Array.isArray(l))continue;let u=l.filter(f=>!LR(f,c));for(let f of l)u.includes(f)||o.push(...f.hooks.map(d=>String(d.command)));u.length?s[a]=u:delete s[a]}return o.length?(Object.keys(s).length||delete n.hooks,Yh(r,n),o):[]}function dY(e,t){return e?[...CR,`Bash(sandbox up ${e})`,`Bash(sandbox restart ${e})`,...["logs","test","services"].map(r=>`Bash(sandbox ${r} ${e}:*)`),...t.flatMap(r=>[`Bash(docker exec ${e}-${r}:*)`,`Bash(docker logs ${e}-${r}:*)`,`Bash(docker restart ${e}-${r})`])]:CR}function hY(e,t,r,n){let s=[];for(let o of t){let a=rs(o,r[o],n);a&&s.push(`Bash(${Vh(e,o,a)})`,`Bash(${a}:*)`)}return[...new Set([...s,...MR])]}function mY(e){let t;try{t=Dt.readFileSync(Co.join(e,".env"),"utf8")}catch{return{}}let r={};for(let n of t.split(`
206
206
  `)){let s=n.indexOf("=");s>0&&(r[n.slice(0,s).trim()]=n.slice(s+1).trim())}return r}function gY(e){let t=mY(e),r=t.FEATURE??"",n=(t.SERVICES??"").split(",").map(o=>o.trim()).filter(Boolean),s=r&&n.length?hY(r,n,pe(),Et()):[...MR];return qh(e)?[...new Set([...s,...dY(r,n)])]:s}function xY(e){return qh(e)?pY:[]}function Fw(e){try{let t=JSON.parse(Dt.readFileSync(e,"utf8"));return Lw(t)?{allow:NR(t.allow),deny:NR(t.deny),model:typeof t.model=="string"?t.model:null}:{allow:[],deny:[],model:null}}catch{return{allow:[],deny:[],model:null}}}function Nw(e,t){let r={...t.allow.length?{allow:t.allow}:{},...t.deny.length?{deny:t.deny}:{},...t.model?{model:t.model}:{}},n=Fw(e);JSON.stringify(t)!==JSON.stringify(n)&&(Object.keys(r).length?(Dt.mkdirSync(Co.dirname(e),{recursive:!0}),Dt.writeFileSync(e,`${JSON.stringify(r,null,2)}
207
- `)):Dt.rmSync(e,{force:!0}))}function yY(e,t,r=[]){let n=qu(e),s=Dw(n);if(s===null)return n;let o=s.permissions??{};if(!Lw(o))return n;let a={allow:t,deny:r},c=["allow","deny"];if(c.some(h=>!Array.isArray(o[h]??[])))return n;let l=qR(e),u=Fw(l),f={...u},d=!1;for(let h of c){let m=o[h]??[],y=new Set(u[h]),g=[...new Set(a[h])],x=m.filter(w=>!(typeof w=="string"&&y.has(w)&&!g.includes(w))),v=g.filter(w=>!x.includes(w));if(f[h]=g.filter(w=>y.has(w)||v.includes(w)),x.length===m.length&&!v.length)continue;d=!0;let S=[...x,...v];S.length?o[h]=S:delete o[h]}return d&&(Object.keys(o).length?s.permissions=o:delete s.permissions,Yh(n,s)),Nw(l,f),n}function bY(e,t){let r=qu(e),n=Dw(r);if(n===null)return r;let s=qR(e),o=Fw(s),a=n.model;return a!==void 0&&a!==o.model?(Nw(s,{...o,model:null}),r):(a!==(t??void 0)&&(t?n.model=t:delete n.model,Yh(r,n)),Nw(s,{...o,model:t}),r)}function Uu(e){yY(e,gY(e),xY(e)),bY(e,OR(e)),uY(e,Uh(e)),lY(e)}var Gh,Pw,Iw,Cw,PR,JG,XG,QG,ZG,eY,tY,rY,nY,MR,fY,BR,CR,pY,qR,NR,Mw=C(()=>{"use strict";p();ns();J();ur();Gh="sandbox notes context",Pw="sandbox hooks gate",Iw="sandbox hooks pr-guard",Cw="sandbox stop --if-idle",PR="sandbox hooks agent-state",JG="sandbox skills check >/dev/null 2>&1 || sandbox skills sync >/dev/null 2>&1",XG=`command -v sandbox >/dev/null 2>&1 && { ${JG}; ${Gh}; } || true`,QG=`command -v sandbox >/dev/null 2>&1 && ${Pw} || true`,ZG=`command -v sandbox >/dev/null 2>&1 && ${Iw} || true`,eY=`command -v sandbox >/dev/null 2>&1 && ${Cw} >/dev/null 2>&1 || true`,tY=`command -v sandbox >/dev/null 2>&1 && ${PR} || true`,rY=["UserPromptSubmit","PreToolUse","PostToolUse","Notification","Stop","SessionEnd"],nY=10;i(sY,"buildSessionStartEntry");i(oY,"buildPreToolUseGateEntry");i(IR,"buildPrGuardEntry");i(iY,"buildSessionEndEntry");i(aY,"buildAgentStateEntry");i(LR,"_isManaged");i(cY,"_mergeEvent");i(Lw,"_isDict");i(qu,"_settingsPath");i(Dw,"_readSettings");i(Yh,"_saveSettings");i(zh,"_writeManaged");i(jw,"writeWorkspaceHooks");i(lY,"writeAgentStateHooks");i(DR,"writePrGuardHook");i(jR,"removeWorkspaceHooks");i(uY,"writeAutoStopHook");i(FR,"_removeManaged");MR=["Bash(git diff:*)","Bash(git status:*)","Bash(git ls-files:*)"],fY=["mcp__plugin_werkmeister_werkmeister__","mcp__plugin_sandbox-tools_sandbox-workspace__"],BR=i(e=>fY.map(t=>`${t}${e}`),"pluginTool"),CR=["Bash(git:*)",...["pr view","pr checks","pr diff","pr list","issue view","run view","run list"].map(e=>`Bash(gh ${e}:*)`),"Bash(sandbox up)","Bash(sandbox restart)",...["status","pr","issue view","issue start","init-workspace","skills","standards","notes context"].map(e=>`Bash(sandbox ${e}:*)`),"Bash(docker ps:*)",...["npm ci","npm run","npm test","npx","node","python3"].map(e=>`Bash(${e}:*)`),...["ls","cat","grep","find","head","tail","sed","diff","wc","test","mkdir"].map(e=>`Bash(${e}:*)`),"Bash(claude plugin validate:*)","Bash(claude plugin test:*)",...["issue","issue-statuses","status","workspace-prs","kube-context","k8s-forwards-status"].flatMap(BR)];i(dY,"autonomousRules");pY=[...["proxy-reload","down","remove","remove-workspace","clean","setup","registry","connect","intercept","workspace","notes graduate","up infra","restart infra","stop infra"].map(e=>`Bash(sandbox ${e}:*)`),...["stop","kill","rm","rmi","compose down","system prune","volume rm","network rm"].map(e=>`Bash(docker ${e}:*)`),...["publish","link","unlink","install -g","install --global","i -g","i --global","uninstall -g","uninstall --global"].map(e=>`Bash(npm ${e}:*)`),"Bash(gh pr merge:*)",...["remove-workspace","kube-switch","up","stop","restart","down","create-workspace","create-workspace-form","pr-approve","ask-pr-review","claude-send","claude-resume","connect","proxy-reload","remove-service","intercept"].flatMap(BR)],qR=i(e=>Co.join(K(e),"claude-permissions.json"),"permissionsRecord");i(hY,"buildAllowRules");i(mY,"_readEnv");i(gY,"workspaceAllowRules");i(xY,"workspaceDenyRules");NR=i(e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[],"_strings");i(Fw,"_readRecord");i(Nw,"_writeRecord");i(yY,"writeWorkspacePermissions");i(bY,"writeWorkspaceModel");i(Uu,"writeWorkspaceSettings")});function Jh(e,t="",r=Oe()){let{row:n,search:s,sandbox:o}=r.filingGuide(t.trim()),a=o??{where:`https://github.com/${UR}/issues`,command:`\`gh issue create -R ${UR} --label <label>\``},c=!o,l=r.issueTypes,u=i(d=>l?` ${l[d]} |`:"","col"),f=i(d=>c?` ${d} |`:"","label");return`# Filing an issue
207
+ `)):Dt.rmSync(e,{force:!0}))}function yY(e,t,r=[]){let n=qu(e),s=Dw(n);if(s===null)return n;let o=s.permissions??{};if(!Lw(o))return n;let a={allow:t,deny:r},c=["allow","deny"];if(c.some(h=>!Array.isArray(o[h]??[])))return n;let l=qR(e),u=Fw(l),f={...u},d=!1;for(let h of c){let m=o[h]??[],y=new Set(u[h]),g=[...new Set(a[h])],x=m.filter(w=>!(typeof w=="string"&&y.has(w)&&!g.includes(w))),v=g.filter(w=>!x.includes(w));if(f[h]=g.filter(w=>y.has(w)||v.includes(w)),x.length===m.length&&!v.length)continue;d=!0;let S=[...x,...v];S.length?o[h]=S:delete o[h]}return d&&(Object.keys(o).length?s.permissions=o:delete s.permissions,Yh(n,s)),Nw(l,f),n}function bY(e,t){let r=qu(e),n=Dw(r);if(n===null)return r;let s=qR(e),o=Fw(s),a=n.model;return a!==void 0&&a!==o.model?(Nw(s,{...o,model:null}),r):(a!==(t??void 0)&&(t?n.model=t:delete n.model,Yh(r,n)),Nw(s,{...o,model:t}),r)}function Uu(e){yY(e,gY(e),xY(e)),bY(e,OR(e)),uY(e,Uh(e)),lY(e)}var Gh,Pw,Iw,Cw,PR,JG,XG,QG,ZG,eY,tY,rY,nY,MR,fY,BR,CR,pY,qR,NR,Mw=C(()=>{"use strict";p();ns();J();ur();Gh="sandbox notes context",Pw="sandbox hooks gate",Iw="sandbox hooks pr-guard",Cw="sandbox stop --if-idle",PR="sandbox hooks agent-state",JG="sandbox skills check >/dev/null 2>&1 || sandbox skills sync >/dev/null 2>&1",XG=`command -v sandbox >/dev/null 2>&1 && { ${JG}; ${Gh}; } || true`,QG=`command -v sandbox >/dev/null 2>&1 && ${Pw} || true`,ZG=`command -v sandbox >/dev/null 2>&1 && ${Iw} || true`,eY=`command -v sandbox >/dev/null 2>&1 && ${Cw} >/dev/null 2>&1 || true`,tY=`command -v sandbox >/dev/null 2>&1 && ${PR} || true`,rY=["UserPromptSubmit","PreToolUse","PostToolUse","Notification","Stop","SessionEnd"],nY=10;i(sY,"buildSessionStartEntry");i(oY,"buildPreToolUseGateEntry");i(IR,"buildPrGuardEntry");i(iY,"buildSessionEndEntry");i(aY,"buildAgentStateEntry");i(LR,"_isManaged");i(cY,"_mergeEvent");i(Lw,"_isDict");i(qu,"_settingsPath");i(Dw,"_readSettings");i(Yh,"_saveSettings");i(zh,"_writeManaged");i(jw,"writeWorkspaceHooks");i(lY,"writeAgentStateHooks");i(DR,"writePrGuardHook");i(jR,"removeWorkspaceHooks");i(uY,"writeAutoStopHook");i(FR,"_removeManaged");MR=["Bash(git diff:*)","Bash(git status:*)","Bash(git ls-files:*)"],fY=["mcp__plugin_werkmeister_werkmeister__","mcp__plugin_sandbox-tools_sandbox-workspace__"],BR=i(e=>fY.map(t=>`${t}${e}`),"pluginTool"),CR=["Bash(git:*)",...["pr view","pr checks","pr diff","pr list","issue view","run view","run list"].map(e=>`Bash(gh ${e}:*)`),"Bash(sandbox up)","Bash(sandbox restart)",...["status","pr","issue view","issue start","init-workspace","skills","standards","notes context"].map(e=>`Bash(sandbox ${e}:*)`),"Bash(docker ps:*)",...["npm ci","npm run","npm test","npx","node","python3"].map(e=>`Bash(${e}:*)`),...["install --frozen-lockfile","run","test","exec","turbo"].map(e=>`Bash(pnpm ${e}:*)`),...["ls","cat","grep","find","head","tail","sed","diff","wc","test","mkdir"].map(e=>`Bash(${e}:*)`),"Bash(claude plugin validate:*)","Bash(claude plugin test:*)",...["issue","issue-statuses","status","workspace-prs","kube-context","k8s-forwards-status"].flatMap(BR)];i(dY,"autonomousRules");pY=[...["proxy-reload","down","remove","remove-workspace","clean","setup","registry","connect","intercept","workspace","notes graduate","up infra","restart infra","stop infra"].map(e=>`Bash(sandbox ${e}:*)`),...["stop","kill","rm","rmi","compose down","system prune","volume rm","network rm"].map(e=>`Bash(docker ${e}:*)`),...["npm","pnpm"].flatMap(e=>["publish","link","unlink","install -g","install --global","i -g","i --global","uninstall -g","uninstall --global"].map(t=>`Bash(${e} ${t}:*)`)),...["add -g","add --global","remove -g","remove --global"].map(e=>`Bash(pnpm ${e}:*)`),"Bash(gh pr merge:*)",...["remove-workspace","kube-switch","up","stop","restart","down","create-workspace","create-workspace-form","pr-approve","ask-pr-review","claude-send","claude-resume","connect","proxy-reload","remove-service","intercept"].flatMap(BR)],qR=i(e=>Co.join(K(e),"claude-permissions.json"),"permissionsRecord");i(hY,"buildAllowRules");i(mY,"_readEnv");i(gY,"workspaceAllowRules");i(xY,"workspaceDenyRules");NR=i(e=>Array.isArray(e)?e.filter(t=>typeof t=="string"):[],"_strings");i(Fw,"_readRecord");i(Nw,"_writeRecord");i(yY,"writeWorkspacePermissions");i(bY,"writeWorkspaceModel");i(Uu,"writeWorkspaceSettings")});function Jh(e,t="",r=Oe()){let{row:n,search:s,sandbox:o}=r.filingGuide(t.trim()),a=o??{where:`https://github.com/${UR}/issues`,command:`\`gh issue create -R ${UR} --label <label>\``},c=!o,l=r.issueTypes,u=i(d=>l?` ${l[d]} |`:"","col"),f=i(d=>c?` ${d} |`:"","label");return`# Filing an issue
208
208
 
209
209
  Log an issue when you find it, even if the notes are rough. Each issue must stand alone: a later agent should be able to act on it without re-running this workspace or asking follow-up questions.
210
210
 
@@ -885,7 +885,7 @@ else {`),this._emit("cb()")),this._emitLine("}")},"compileIf"),r.compileIfAsync=
885
885
  ${b.YELLOW}Stale slot entries (no running containers or compose file):${b.RESET}
886
886
  `);for(let h of f)t?Q(` ${b.DIM}[dry-run] Would release slot: ${h}${b.RESET}
887
887
  `):(d.push(h),Q(` ${b.GREEN}Released:${b.RESET} ${h}
888
- `))}}return{activeFeatures:r,activeVolumes:c,orphanedVolumes:l,staleSlots:f,removedVolumes:a,releasedSlots:d}}async function ES(e){let t=await dr(e);if(t===null)throw new Z(`Feature '${e}' is not running (no slot allocated)`,"NOT_RUNNING");return t}async function jL(e){let t=ea(e);if(t===null)return{workspace:null,handoff:null,decisions:[],graduated:[]};let r=Mm(t);return{workspace:t,handoff:a_(t),decisions:Xi(t),graduated:r}}var yse,kL,_se,kse,gs=C(()=>{"use strict";p();MP();Jn();us();Gn();J();fn();ki();Jt();ss();g0();gt();Bc();Xc();Ji();at();We();Pf();eS();Zt();Zi();i(C0,"up");i($L,"prepareSlot");i(OL,"startService");i(TL,"requireSharedNetwork");i(xse,"readSlotFromWorkspace");i(AL,"readServicesFromWorkspace");i(RL,"requireSecrets");i(CL,"insideOwnContainer");i(jf,"refuseInsideOwnContainer");yse=new Set(["clear","resume"]);i(NL,"liveSessions");i(bse,"otherLiveSessions");i(wse,"busyReason");i(PL,"idleStopMinutes");i(SS,"lastExecMarker");i(vse,"mtimeMs");kL="com.sandbox.local.feature",_se="com.docker.compose.project.working_dir";i(Sse,"runningFeatures");i(N0,"stopIdle");i(IL,"idleStopFeature");i(aa,"stop");i(P0,"restart");i(Ff,"down");i(LL,"removeService");kse={generate:i(()=>oa(),"generate"),slots:i(()=>Ct(),"slots"),running:i(()=>wf(),"running"),reload:i(()=>bf(),"reload"),start:i(()=>b_(),"start")};i(Go,"reloadProxy");i(Ese,"volumeBaseNames");i($se,"listSandboxVolumes");i(Ose,"featureFromVolume");i(Tse,"classifyVolumes");i(DL,"planClean");i(kS,"runClean");i(ES,"requireSlot");i(jL,"teardownNotes")});var Mf,FL,Re=C(()=>{"use strict";p();Jn();J();We();J();Mf=qe,FL=Sh});import*as I0 from"node:fs";import*as nl from"node:path";function $S(e){let t=nl.resolve(e);for(;;){let r=nl.join(t,".env"),n=!1;try{n=I0.statSync(r).isFile()}catch{n=!1}if(n)return r;let s=nl.dirname(t);if(s===t)return null;t=s}}function rr(e){let t=$S(e);if(!t)return{};let r={};for(let n of I0.readFileSync(t,"utf8").split(/\r?\n/)){if(n=n.trim(),!n||n.startsWith("#")||!n.includes("="))continue;let s=n.indexOf("="),o=n.slice(0,s),a=n.slice(s+1);r[o.trim()]=a.trim()}return r}var Yo=C(()=>{"use strict";p();i($S,"findDotenv");i(rr,"loadDotenv")});import*as ML from"node:fs";import*as BL from"node:path";function qL(e){let t=e??qe();if(!ML.existsSync(BL.join(t,".git")))return!1;let r;try{r=W(["git","-C",t,"config","--get","core.hooksPath"],{capture:!0})}catch(s){if(s instanceof Y&&s.code==="ENOENT")return I(`git was not found on PATH \u2014 could not check or configure core.hooksPath. The sandbox secret-commit guard (${Js}/pre-commit) was NOT installed.`),!1;throw s}let n=r.status===0?r.stdout.trim():"";if(n===Js)return!0;if(n)return I(`core.hooksPath is already set to '${n}' \u2014 leaving it unchanged. The sandbox secret-commit guard (${Js}/pre-commit) was NOT installed. Run 'git config core.hooksPath ${Js}' manually if you want to activate it.`),!1;try{W(["git","-C",t,"config","core.hooksPath",Js],{capture:!0,check:!0})}catch(s){let o=s instanceof Y&&s.code===void 0&&s.stderr?s.stderr.trim():String(s instanceof Error?s.message:s);return I(`Could not set core.hooksPath to ${Js} (${o}). The sandbox secret-commit guard (${Js}/pre-commit) was NOT installed.`),!1}return O(`Configuring core.hooksPath -> ${Js} (first-time setup)...`),F(`core.hooksPath set to ${Js} (secret-commit guard active)`),!0}var Js,UL=C(()=>{"use strict";p();J();at();We();Js=".githooks";i(qL,"configureGitHooksPath")});import{spawn as Ase}from"node:child_process";import*as rt from"node:fs";import*as WL from"node:net";import*as VL from"node:os";import*as xs from"node:path";function AS(e){return new Promise(t=>setTimeout(t,e*1e3))}async function KL(e){let t;try{t=W(["lsof","-ti",`tcp:${e}`,"-sTCP:LISTEN"],{capture:!0,timeout:5}).stdout}catch(n){if(n instanceof Y&&(n.code==="ENOENT"||n.code==="ETIMEDOUT"))return;throw n}let r=t.split(/\s+/).map(n=>n.trim()).filter(n=>/^\d+$/.test(n)).map(n=>Number.parseInt(n,10));for(let n of r)try{process.kill(n,"SIGTERM")}catch{continue}if(r.length!==0){for(let n=0;n<20;n++){if(!await RS(e))return;await AS(.25)}for(let n of r)try{process.kill(n,"SIGKILL")}catch{continue}}}function HL(){let e=K(VL.homedir());return rt.mkdirSync(e,{recursive:!0}),e}function ca(e){return xs.join(HL(),`${e.stem}.pid`)}function Rse(e){return xs.join(HL(),`${e.stem}.log`)}function GL(e){return xs.join(Sh(),"apps",e.dir)}function Cse(e,t){let r=t.lastIndexOf("/"),n=r>=0?xs.join(e,t.slice(0,r)):e,s=r>=0?t.slice(r+1):t,o=new RegExp("^"+s.split("*").map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$"),a;try{a=rt.readdirSync(n,{withFileTypes:!0})}catch{return[]}return a.filter(c=>o.test(c.name)).map(c=>xs.join(n,c.name))}function Nse(e){let t=GL(e),r=xs.join(t,e.buildRef),n;try{let o=rt.statSync(r);if(!o.isFile())return!0;n=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 Cse(t,o))try{if(rt.statSync(a).mtimeMs>n)return!0}catch{continue}return!1}function Pse(e,t){try{return rt.statSync(t).mtimeMs>rt.statSync(ca(e)).mtimeMs}catch{return!1}}function Ise(e){let t;try{t=rt.readFileSync(ca(e),"utf8")}catch{return null}let r=t.trim();return/^[+-]?\d+$/.test(r)?Number.parseInt(r,10):null}function YL(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}function RS(e){return new Promise(t=>{let r=WL.connect({host:"127.0.0.1",port:e}),n=i(s=>{r.destroy(),t(s)},"done");r.setTimeout(1e3,()=>n(!1)),r.once("connect",()=>n(!0)),r.once("error",()=>n(!1))})}function CS(e=ys){let t=Ise(e);return t&&YL(t)?[!0,t]:[!1,null]}async function Xs(e=ys){let[t,r]=CS(e);return{running:t,pid:r,port:e.port,url:`http://localhost:${e.port}/`,healthy:t&&await RS(e.port)}}async function zL(e=ys,t=!0,r=!1){let[n,s]=CS(e);if(n&&s===process.pid)return F(`${e.label} is this process (pid ${s}); leaving it running`),!0;let o=GL(e),a=e.entry,c=xs.join(o,e.buildRef);if(!rt.existsSync(xs.join(o,"package.json"))){let g=e.bundled?xs.join(qe(),e.bundled):null;if(!g||!rt.existsSync(g))return I(`${e.label} not found at ${o}; skipping`),!1;o=qe(),a=g,c=g,t=!1}let l=!1;if(t&&Nse(e)){O(`Building ${e.label} (sources changed)...`);let g;try{g=W(["npm","run","build"],{cwd:o,capture:!0,timeout:300})}catch(x){if(x instanceof Y&&x.code==="ENOENT")return I(`npm not found; skipping ${e.label}`),!1;if(x instanceof Y&&x.code==="ETIMEDOUT")return j(`${e.label} build timed out; skipping`),!1;throw x}if(g.status!==0){let x=(g.stderr.trim()||g.stdout.trim()).slice(-800);return j(`${e.label} build failed; skipping start:
888
+ `))}}return{activeFeatures:r,activeVolumes:c,orphanedVolumes:l,staleSlots:f,removedVolumes:a,releasedSlots:d}}async function ES(e){let t=await dr(e);if(t===null)throw new Z(`Feature '${e}' is not running (no slot allocated)`,"NOT_RUNNING");return t}async function jL(e){let t=ea(e);if(t===null)return{workspace:null,handoff:null,decisions:[],graduated:[]};let r=Mm(t);return{workspace:t,handoff:a_(t),decisions:Xi(t),graduated:r}}var yse,kL,_se,kse,gs=C(()=>{"use strict";p();MP();Jn();us();Gn();J();fn();ki();Jt();ss();g0();gt();Bc();Xc();Ji();at();We();Pf();eS();Zt();Zi();i(C0,"up");i($L,"prepareSlot");i(OL,"startService");i(TL,"requireSharedNetwork");i(xse,"readSlotFromWorkspace");i(AL,"readServicesFromWorkspace");i(RL,"requireSecrets");i(CL,"insideOwnContainer");i(jf,"refuseInsideOwnContainer");yse=new Set(["clear","resume"]);i(NL,"liveSessions");i(bse,"otherLiveSessions");i(wse,"busyReason");i(PL,"idleStopMinutes");i(SS,"lastExecMarker");i(vse,"mtimeMs");kL="com.sandbox.local.feature",_se="com.docker.compose.project.working_dir";i(Sse,"runningFeatures");i(N0,"stopIdle");i(IL,"idleStopFeature");i(aa,"stop");i(P0,"restart");i(Ff,"down");i(LL,"removeService");kse={generate:i(()=>oa(),"generate"),slots:i(()=>Ct(),"slots"),running:i(()=>wf(),"running"),reload:i(()=>bf(),"reload"),start:i(()=>b_(),"start")};i(Go,"reloadProxy");i(Ese,"volumeBaseNames");i($se,"listSandboxVolumes");i(Ose,"featureFromVolume");i(Tse,"classifyVolumes");i(DL,"planClean");i(kS,"runClean");i(ES,"requireSlot");i(jL,"teardownNotes")});var Mf,FL,Re=C(()=>{"use strict";p();Jn();J();We();J();Mf=qe,FL=Sh});import*as I0 from"node:fs";import*as nl from"node:path";function $S(e){let t=nl.resolve(e);for(;;){let r=nl.join(t,".env"),n=!1;try{n=I0.statSync(r).isFile()}catch{n=!1}if(n)return r;let s=nl.dirname(t);if(s===t)return null;t=s}}function rr(e){let t=$S(e);if(!t)return{};let r={};for(let n of I0.readFileSync(t,"utf8").split(/\r?\n/)){if(n=n.trim(),!n||n.startsWith("#")||!n.includes("="))continue;let s=n.indexOf("="),o=n.slice(0,s),a=n.slice(s+1);r[o.trim()]=a.trim()}return r}var Yo=C(()=>{"use strict";p();i($S,"findDotenv");i(rr,"loadDotenv")});import*as ML from"node:fs";import*as BL from"node:path";function qL(e){let t=e??qe();if(!ML.existsSync(BL.join(t,".git")))return!1;let r;try{r=W(["git","-C",t,"config","--get","core.hooksPath"],{capture:!0})}catch(s){if(s instanceof Y&&s.code==="ENOENT")return I(`git was not found on PATH \u2014 could not check or configure core.hooksPath. The sandbox secret-commit guard (${Js}/pre-commit) was NOT installed.`),!1;throw s}let n=r.status===0?r.stdout.trim():"";if(n===Js)return!0;if(n)return I(`core.hooksPath is already set to '${n}' \u2014 leaving it unchanged. The sandbox secret-commit guard (${Js}/pre-commit) was NOT installed. Run 'git config core.hooksPath ${Js}' manually if you want to activate it.`),!1;try{W(["git","-C",t,"config","core.hooksPath",Js],{capture:!0,check:!0})}catch(s){let o=s instanceof Y&&s.code===void 0&&s.stderr?s.stderr.trim():String(s instanceof Error?s.message:s);return I(`Could not set core.hooksPath to ${Js} (${o}). The sandbox secret-commit guard (${Js}/pre-commit) was NOT installed.`),!1}return O(`Configuring core.hooksPath -> ${Js} (first-time setup)...`),F(`core.hooksPath set to ${Js} (secret-commit guard active)`),!0}var Js,UL=C(()=>{"use strict";p();J();at();We();Js=".githooks";i(qL,"configureGitHooksPath")});import{spawn as Ase}from"node:child_process";import*as rt from"node:fs";import*as WL from"node:net";import*as VL from"node:os";import*as xs from"node:path";function AS(e){return new Promise(t=>setTimeout(t,e*1e3))}async function KL(e){let t;try{t=W(["lsof","-ti",`tcp:${e}`,"-sTCP:LISTEN"],{capture:!0,timeout:5}).stdout}catch(n){if(n instanceof Y&&(n.code==="ENOENT"||n.code==="ETIMEDOUT"))return;throw n}let r=t.split(/\s+/).map(n=>n.trim()).filter(n=>/^\d+$/.test(n)).map(n=>Number.parseInt(n,10));for(let n of r)try{process.kill(n,"SIGTERM")}catch{continue}if(r.length!==0){for(let n=0;n<20;n++){if(!await RS(e))return;await AS(.25)}for(let n of r)try{process.kill(n,"SIGKILL")}catch{continue}}}function HL(){let e=K(VL.homedir());return rt.mkdirSync(e,{recursive:!0}),e}function ca(e){return xs.join(HL(),`${e.stem}.pid`)}function Rse(e){return xs.join(HL(),`${e.stem}.log`)}function GL(e){return xs.join(Sh(),"apps",e.dir)}function Cse(e,t){let r=t.lastIndexOf("/"),n=r>=0?xs.join(e,t.slice(0,r)):e,s=r>=0?t.slice(r+1):t,o=new RegExp("^"+s.split("*").map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$"),a;try{a=rt.readdirSync(n,{withFileTypes:!0})}catch{return[]}return a.filter(c=>o.test(c.name)).map(c=>xs.join(n,c.name))}function Nse(e){let t=GL(e),r=xs.join(t,e.buildRef),n;try{let o=rt.statSync(r);if(!o.isFile())return!0;n=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 Cse(t,o))try{if(rt.statSync(a).mtimeMs>n)return!0}catch{continue}return!1}function Pse(e,t){try{return rt.statSync(t).mtimeMs>rt.statSync(ca(e)).mtimeMs}catch{return!1}}function Ise(e){let t;try{t=rt.readFileSync(ca(e),"utf8")}catch{return null}let r=t.trim();return/^[+-]?\d+$/.test(r)?Number.parseInt(r,10):null}function YL(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}function RS(e){return new Promise(t=>{let r=WL.connect({host:"127.0.0.1",port:e}),n=i(s=>{r.destroy(),t(s)},"done");r.setTimeout(1e3,()=>n(!1)),r.once("connect",()=>n(!0)),r.once("error",()=>n(!1))})}function CS(e=ys){let t=Ise(e);return t&&YL(t)?[!0,t]:[!1,null]}async function Xs(e=ys){let[t,r]=CS(e);return{running:t,pid:r,port:e.port,url:`http://localhost:${e.port}/`,healthy:t&&await RS(e.port)}}async function zL(e=ys,t=!0,r=!1){let[n,s]=CS(e);if(n&&s===process.pid)return F(`${e.label} is this process (pid ${s}); leaving it running`),!0;let o=GL(e),a=e.entry,c=xs.join(o,e.buildRef);if(!rt.existsSync(xs.join(o,"package.json"))){let g=e.bundled?xs.join(qe(),e.bundled):null;if(!g||!rt.existsSync(g))return I(`${e.label} not found at ${o}; skipping`),!1;o=qe(),a=g,c=g,t=!1}let l=!1;if(t&&Nse(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 Y&&x.code==="ENOENT")return I(`pnpm not found; skipping ${e.label}`),!1;if(x instanceof Y&&x.code==="ETIMEDOUT")return j(`${e.label} build timed out; skipping`),!1;throw x}if(g.status!==0){let x=(g.stderr.trim()||g.stdout.trim()).slice(-800);return j(`${e.label} build failed; skipping start:
889
889
  ${x}`),!1}l=!0}else t&&O(`${e.label} build up to date; skipping build`);if(n&&!l&&Pse(e,c)&&(O(`Running ${e.label} predates the current build; bouncing to reload it.`),r=!0),n&&!l&&!r)return F(`${e.label} already running (pid ${s}, http://localhost:${e.port}/)`),!0;n&&await JL(e),await KL(e.port);let u=Rse(e),f={...process.env,PORT:String(e.port),...e.env??{}};O(`Starting ${e.label} on http://localhost:${e.port}/ ...`);let d=rt.openSync(u,"w"),h=Ase("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(rt.closeSync(d),m!=="spawned"){if(m.code==="ENOENT")return I(`node not found; skipping ${e.label}`),!1;throw m}h.unref(),rt.writeFileSync(ca(e),String(h.pid));let y=!1;h.once("exit",()=>{y=!0});for(let g=0;g<20;g++){if(y)return j(`${e.label} exited immediately (see ${u})`),rt.rmSync(ca(e),{force:!0}),!1;if(await RS(e.port))return F(`${e.label} started (pid ${h.pid}, http://localhost:${e.port}/)`),!0;await AS(.25)}return I(`${e.label} started (pid ${h.pid}) but port ${e.port} not up yet; check ${u}`),!0}async function JL(e=ys){let[t,r]=CS(e);if(!t||r===null)return rt.rmSync(ca(e),{force:!0}),!1;O(`Stopping ${e.label} (pid ${r})...`);try{process.kill(r,"SIGTERM")}catch(s){let o=s.code;if(o==="ESRCH")return rt.rmSync(ca(e),{force:!0}),!1;if(o==="EPERM")return j(`Cannot signal pid ${r} (owned by another user)`),!1;throw s}let n=!1;for(let s=0;s<20;s++){if(!YL(r)){n=!0;break}await AS(.25)}if(!n)try{process.kill(r,"SIGKILL")}catch{}return rt.rmSync(ca(e),{force:!0}),await KL(e.port),F(`${e.label} stopped`),!0}async function Lse(e=ys,t=!1){await zL(e,t,!0)}async function XL(e=!0){for(let t of TS)await zL(t,e)}async function NS(){for(let e of TS)await JL(e)}async function QL(e=!1){for(let t of TS)await Lse(t,e)}var ys,OS,TS,sl=C(()=>{"use strict";p();J();at();We();ys={label:"Workspaces dashboard",dir:"sandbox-dashboard",port:3001,stem:"mcp-server",entry:"dist/main.js",buildRef:"dist/main.js"},OS={label:"Sandbox MCP server",dir:"mcp",port:3002,stem:"sandbox-mcp",entry:"dist/main.js",buildRef:"dist/main.js",bundled:"dist/mcp.js",env:{HOST:"0.0.0.0"}},TS=[ys,OS];i(AS,"sleep");i(KL,"freePort");i(HL,"stateDir");i(ca,"pidFile");i(Rse,"logFile");i(GL,"appDir");i(Cse,"globMatch");i(Nse,"distStale");i(Pse,"buildNewerThanRunning");i(Ise,"readPid");i(YL,"alive");i(RS,"portOpen");i(CS,"isRunning");i(Xs,"status");i(zL,"start");i(JL,"stop");i(Lse,"restart");i(XL,"startAll");i(NS,"stopAll");i(QL,"restartAll")});var r7={};be(r7,{connectK8s:()=>PS,down:()=>qse,infraHealth:()=>qf,restart:()=>LS,stop:()=>IS,up:()=>Bf});import*as bs from"node:fs";import*as e7 from"node:net";import*as t7 from"node:os";import*as L0 from"node:path";function Dse(e){let{argv:t,env:r,cwd:n}=na(),s=[...t,...e];O(`Running: ${s.join(" ")}`);try{let o=W(s,{capture:!0,timeout:120,env:r,cwd:n});return o.status!==0?(j(`docker compose failed:
890
890
  ${o.stderr.trim()}`),!1):!0}catch(o){if(o instanceof Y&&o.code==="ENOENT")return j("docker not found"),!1;if(o instanceof Y&&o.code==="ETIMEDOUT")return j("docker compose timed out"),!1;throw o}}function jse(){let e=L0.join(Lr(),"corp-ca.crt");if(bs.mkdirSync(L0.dirname(e),{recursive:!0}),(bs.existsSync(e)?bs.readFileSync(e,"utf8"):"").includes("BEGIN CERTIFICATE"))return;if(t7.platform()!=="darwin"){bs.writeFileSync(e,"");return}let r=["goskope","certadmin","Zscaler","Palo Alto"],n=[];for(let o of r){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")&&n.push(a.stdout)}let s=n.join("");bs.writeFileSync(e,s),s.includes("BEGIN CERTIFICATE")&&O(`Corporate CA extracted to ${e} (image builds will trust it)`)}async function Fse(){O("Generating proxy/Caddyfile..."),await oa(),Um(),hS()}async function Mse(e){let{argv:t,env:r,cwd:n}=na(),s=t[3];if(!bs.existsSync(s))return I(`Missing ${s}`),!1;O("Starting shared infrastructure (k8s-forwards, caddy, jaeger, redisinsight)...");try{let o=await On([...t,"up","-d","--build"],{capture:!0,signal:e,env:r,cwd:n});return o.status!==0?(j(`docker compose failed:
891
891
  ${o.stderr.trim()}`),!1):(F("Shared infrastructure started"),!0)}catch(o){if(o instanceof Y&&o.code==="ABORT_ERR")return I("Shared infrastructure start was cancelled"),!1;if(o instanceof Y&&o.code==="ENOENT")return j("docker not found"),!1;throw o}}function Bse(e,t,r){return new Promise(n=>{let s=e7.createConnection({host:e,port:t}),o=!1,a=i(c=>{o||(o=!0,s.destroy(),n(c))},"finish");s.setTimeout(r*1e3),s.on("connect",()=>a(!0)),s.on("timeout",()=>a(!1)),s.on("error",()=>a(!1))})}async function ZL(){let e={};for(let t of await fr(pr,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[r,n]of t)e[r]=await Bse("127.0.0.1",n,2)}return e}async function Bf({signal:e}={}){if(e?.aborted)return I("Infrastructure start was cancelled before it began"),!1;qL(),await Fse(),jse();let t=await Mse(e);return await XL(!0),t}async function qf(e){O("Waiting for services to become healthy...");let t=Date.now()+e*1e3,r=await ZL();for(;Object.keys(r).length>0&&Object.values(r).some(n=>!n)&&Date.now()<t;)await new Promise(n=>setTimeout(n,3e3)),r=await ZL();return r}async function PS(){if((await pS())["k8s-forwards"]??!1)return F("k8s port-forwards container is already healthy"),!0;O("Attempting to start/restart k8s-forwards container...");let e=await y0()!=="failed";return e&&F("k8s port-forwards started"),e}async function qse(e=!1){await NS();let t=["down"];if(e&&t.push("--volumes"),Dse(t)){let r="Shared infrastructure stopped";e&&(r+=" (volumes removed)"),F(r)}}async function IS(){await NS();let e=await ta("stop",pr);if(e){j(e);return}F("Shared infrastructure stopped (containers preserved, resumable with 'sandbox up infra')")}async function LS(){let e=await ta("restart",pr);e?j(e):F("Shared infrastructure restarted"),await QL()}var ol=C(()=>{"use strict";p();us();Vc();J();fn();g0();UL();Xc();Wm();at();We();sl();i(Dse,"composeCmd");i(jse,"ensureCorpCa");i(Fse,"ensureProxyFiles");i(Mse,"startSharedInfra");i(Bse,"checkPort");i(ZL,"checkInfraHealth");i(Bf,"up");i(qf,"infraHealth");i(PS,"connectK8s");i(qse,"down");i(IS,"stop");i(LS,"restart")});var DS={};be(DS,{checkTracker:()=>o7,run:()=>Wse,trackerLine:()=>s7});import*as n7 from"node:readline/promises";function s7(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 o7(){let e="";try{let t=Oe();e=t.label;let r=await t.checkAuth();if(!r.ok&&t.id==="github"&&process.stdin.isTTY){let n=n7.createInterface({input:process.stdin,output:process.stdout}),s=/^y/i.test(await n.question(` GitHub: ${r.reason}. Sign in now? (${r.fix}) [y/N] `));n.close(),s&&(W([ju(),...r.fix.split(" ").slice(1)],{stdio:"inherit"}),r=await t.checkAuth())}console.log(s7(t.label,r))}catch(t){console.log(` ${b.YELLOW}issue tracker \xB7 ${e?`${e} \xB7 `:""}check failed: ${t.message}${b.RESET}`)}}async function Use(){console.log(`
@@ -1305,7 +1305,7 @@ ${b.BOLD}=== sandbox close-out: ${r} ===${b.RESET}
1305
1305
  `),!e.yes&&(console.log(` ${b.DIM}${n===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 Bt(n===null?`Close out and remove '${r}'?`:`Abandon and remove '${r}'?`,!1))){O("Aborted -- nothing changed.");return}let s=n===null?await Jd(r):await Jd(r,{abandon:n});console.log(s.output),console.log(`
1306
1306
  ${b.GREEN}${b.BOLD}Workspace '${r}' closed out${b.RESET}`),console.log(` ${b.DIM}Archive this workspace's desktop sessions from the Claude sidebar.${b.RESET}
1307
1307
  `)}var Qq=C(()=>{"use strict";p();Ts();Vd();Re();Ya();i(Hge,"run")});var Zq={};be(Zq,{run:()=>Gge});async function Gge(e){let t=e.feature||rr(process.cwd()).FEATURE;t||(j("Feature name required: pass it as an argument or set FEATURE in a .env file."),process.exit(1));let{path:r}=await y6(t);console.log(`${b.GREEN}Opened '${t}' in VS Code${b.RESET} ${b.DIM}${r}${b.RESET}`)}var eU=C(()=>{"use strict";p();Ts();Re();Yo();i(Gge,"run")});var sU={};be(sU,{run:()=>zge});import*as N6 from"node:fs";import*as nU from"node:path";function Sn(e){console.log(`
1308
- ${b.BOLD}${e}${b.RESET}`)}async function Yge(e){let t=et(),r=Zn(t);Sn("1. Paths & the workspace repo");let n={},s=i(ve=>Oh(ve.key,t,n),"pathDefault");if(e)await hi(gc,n,s,{intro:"Where your repos and per-feature workspaces live. Defaults in [brackets]."});else for(let ve of gc)n[ve.key]=s(ve),O(` ${ve.key}: ${n[ve.key]}`);let o=M3();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((ve,hp)=>hp.length?{...ve,choicesFn:i(()=>hp,"choicesFn")}:ve,"withChoices"),c={},l=[a(QA,o.map(ve=>`${ve}/${Kn}`)),a(eR,o)],u=i(ve=>ve.key==="workspace_repo"?Pu(t)||(o[0]?`${o[0]}/${Kn}`:""):t.overrides?.github_org||(c.workspace_repo??"").split("/")[0]||"","ghDefault");if(e)await hi(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 ve of l)c[ve.key]=u(ve),O(` ${ve.key}: ${c[ve.key]||"(unset \u2014 `gh` named no user)"}`);Sn("2. Browser");let f={},d=i(()=>t.overrides?.browser||Yd,"browserDefault");e?await hi([n3],f,d,{intro:"Which browser `sandbox open` launches."}):(f.browser=d(),O(` browser: ${f.browser}`)),lo[f.browser]?.engine!=="chromium"&&f.browser!=="safari"&&I(` ${lo[f.browser].label} isn't wired up yet -- \`sandbox open\` will error until it's picked to chrome/chromium/brave/edge/safari.`),Sn("3. Ingress");let h={},m=i(ve=>String(r[ve.key]??""),"ingressDefault");if(e)await hi(dw,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 ve of dw)h[ve.key]=m(ve),O(` ${ve.key}: ${h[ve.key]}`);Sn("4. Service registry");let y=Ds(),g=mt(n.repos_root),x=!1,v=XS(y)??"orbstack",S=[];try{S=Jo(g).map(ve=>ve.repo)}catch{}S.length?O(`${y} will be generated from ${S.length} repo fragment(s): ${S.join(", ")}.`):(O(`No <repo>/${Wf} 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 Bt(" Clone the demo apps (backend, frontend) so there is something to run?",!1,e)),!N6.existsSync(Qn())&&e&&(v=await Vl("Kube context for `sandbox intercept` (services.local.yaml k8s_context)",v)),Sn("5. Issue tracker");let w={},E=i(()=>Ii(t),"trackerDefault");e?await hi([{key:"issue_tracker",label:"Issue tracker",help:"Where workspace issues come from and where agents file existing bugs. "+Pi.map(ve=>`${ve}: ${Sw(ve).label} (e.g. ${Sw(ve).refExample})`).join("; ")+".",acceptEmpty:!1,pattern:`(${Pi.join("|")})`,choicesFn:i(()=>[...Pi],"choicesFn")}],w,E):(w.issue_tracker=E(),O(` issue_tracker: ${w.issue_tracker}`));let k={...Ms()},T=!!(k.base_url&&k.email&&k.api_token);if(w.issue_tracker==="github"){let ve=c.github_org;ve?S.length?O(`Tracking GitHub issues in: ${S.map(hp=>`${ve}/${hp}`).join(", ")}.`):O(`Tracking GitHub issues in every registry repo under ${ve} (none registered yet).`):I(" No GitHub org set (section 1) \u2014 workspaces can only take owner/repo#n issue refs.")}else w.issue_tracker==="jira"&&T?O(`Already configured for ${k.email}.`):w.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 Bt(" Configure Jira credentials now?",!1,e)&&(k.base_url=await Vl("Jira base URL",k.base_url??"https://your-org.atlassian.net"),k.email=await Vl("Atlassian login email",k.email??""),O(" Create a token at https://id.atlassian.com/manage-profile/security/api-tokens"),k.api_token=await Vl("API token",k.api_token??"",{secret:!0})));Sn("6. Telepresence (optional)"),O("Only `sandbox intercept` needs it \u2014 reroutes cluster traffic to a local container.");let R=await Bt(" Install/upgrade the OSS client via Homebrew if it's missing or stale?",!1,e);Sn("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 N=await Bt(" Install the superpowers plugin?",!1,e);Sn("8. VS Code (optional)");let P=Y$(),L=!1;P.present?P.error?I(`${op()} does not parse (${P.error}) \u2014 skipping.`):!Object.keys(P.set).length&&!P.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 ${op()}; comments and other settings are kept.`),L=await Bt(" Add the schema mappings to your VS Code user settings?",!1,e)):O("VS Code not found \u2014 skipping.");let M=Mx(),A=!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}).`),A=await Bt(" 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).`),Sn("9. Claude Code standards access (optional)");let D=z$(),B=!1;D.present?D.dirMissing?O(`Standards dir ${ct()} not found \u2014 skipping.`):D.error?I(`${ip()}: ${D.error} \u2014 skipping.`):D.granted?O("Already granted."):(O(`Lets every Claude Code session read the coding standards in ${ct()} without a prompt. Adds it to \`permissions.additionalDirectories\` in ${ip()}; other settings are kept.`),B=e&&await Bt(" Grant Claude Code read access to the standards dir?",!0,e)):O("Claude Code settings dir not found \u2014 skipping."),Sn("10. PR watch schedule (optional)");let U=Z$(),St;U.installed?(O(`Installed (${U.where}); logs \u2192 ${U.logFile}. Remove with \`werkmeister pr watch --uninstall\`.`),St=!0):(O("Resumes terminal Claude sessions when their PR merges, ships or closes (desktop sessions don't need it)."),St=await Bt(` Install a ${U.kind==="launchd"?"launchd agent":"crontab line"} that runs \`werkmeister pr watch\` every 10 minutes?`,!1,e));let ee={version:1,paths:{sandbox_root:String(Mf()),repos_root:n.repos_root,workspaces_root:n.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:w.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}:{}},oe=Th(ee),Ne=Ah(ee),ot=Rh(),ht=sR(),Hl=Ch();return Sn("Writing config"),F(`Wrote ${oe}`),O(`Regenerated ${Ne}`),O(`${mc()}: ${ot?"updated":"already sources env.sh"}`),O(`${lw()}: ${ht?"installed tab completion":"tab completion already installed"}`),N6.existsSync(Ri())&&O(`${nU.basename(Ri())}: ${Hl?"dropped stale env block":"no env block to remove"}`),{workspaceRepo:c.workspace_repo,demo:x,k8sContext:v,installTelepresence:R,installOptionalPlugins:N,mapEditorSchemas:L,installVscodeExtension:A,grantStandardsDir:B,installPrWatch:St,skipSudo:!e}}function tU(){try{return Gu()}catch{return[]}}function rU(e){Sn("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 zge(e){let t=!!e.check,r=!!e.yes;if(t){let l=await t6({checkOnly:!0,hostnames:tU()}),u=Nh(et()).filter(f=>!/^paths\.\w+ does not exist/.test(f));for(let f of u)l.unshift({label:"global config",ok:!1,detail:f});rU(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 n=!!process.stdin.isTTY&&!r;n?O("Sandbox setup \u2014 press Ctrl-C at any prompt to abort without writing."):!process.stdin.isTTY&&!r&&I("Not a TTY \u2014 running non-interactively with defaults (same as --yes).");let s=await Yge(n),o=await t6({checkOnly:!1,demo:s.demo,registry:{k8sContext:s.k8sContext},workspaceRepo:s.workspaceRepo,hostnames:tU,skipSudo:s.skipSudo,installTelepresence:s.installTelepresence,installOptionalPlugins:s.installOptionalPlugins,mapEditorSchemas:s.mapEditorSchemas,installVscodeExtension:s.installVscodeExtension,grantStandardsDir:s.grantStandardsDir,installPrWatch:s.installPrWatch}),a=rU(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 oU=C(()=>{"use strict";p();Hd();J();ss();gt();lr();Bx();Xo();Re();Ya();i(Sn,"heading");i(Yge,"configureMachine");i(tU,"resolveHostnames");i(rU,"report");i(zge,"run")});var cU={};be(cU,{run:()=>Xge});import*as iU from"node:fs";import*as aU from"node:path";function Jge(e){let t=e.paths||{};console.log(`${b.BOLD}config file:${b.RESET} ${Ir()}`),console.log(`${b.BOLD}env.sh:${b.RESET} ${Eh()}`),console.log(`${b.BOLD}sandbox_root:${b.RESET} ${Mf()} ${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||fw(s)} ${b.DIM}(${a})${b.RESET}`)}let r=Zn(e);console.log(`${b.BOLD}ingress:${b.RESET}`);for(let[s,o]of Object.entries(r)){let a=e.ingress?.[s]?"YAML":"default";console.log(` ${s}: ${o} ${b.DIM}(${a})${b.RESET}`)}let n=Object.fromEntries(Object.entries(e.overrides||{}).filter(([,s])=>s));if(Object.keys(n).length){console.log(`${b.BOLD}overrides:${b.RESET}`);for(let[s,o]of Object.entries(n))console.log(` ${s}: ${o}`)}}async function Xge(e){let t=et();if(e.check){let d=Nh(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){Jge(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=>Oh(d.key,t,r),"defaultFor"),s=gc.filter(d=>!(d.key in r));if(s.length)if(process.stdin.isTTY)await hi(gc,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(Mf()),repos_root:r.repos_root,workspaces_root:r.workspaces_root},overrides:t.overrides||{},...t.ingress?{ingress:t.ingress}:{},...t.jira?{jira:t.jira}:{}},a=Th(o),c=Ah(o),l=Rh(),u=Ch();F(`Wrote ${a}`),O(`Regenerated ${c}`),O(`${mc()}: ${l?"updated":"already sources env.sh"}`);let f=Ri();iU.existsSync(f)&&O(`${aU.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 lU=C(()=>{"use strict";p();gt();Re();Ya();i(Jge,"show");i(Xge,"run")});var uU={};be(uU,{run:()=>Qge});async function Qge(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 r=!!e.check,n=V0({checkOnly:r});for(let s of n){let o=s.ok?`${b.GREEN}\u2713${b.RESET}`:`${b.RED}\u2717${b.RESET}`;console.log(`${o} ${s.label}: ${s.detail}`)}n.some(s=>!s.ok)&&(I(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 fU=C(()=>{"use strict";p();Xo();Re();i(Qge,"run")});p();import P6 from"node:path";import{fileURLToPath as Zge}from"node:url";p();var G6=Pe(H6(),1),{program:Txe,createCommand:Axe,createArgument:Rxe,createOption:Cxe,CommanderError:Nxe,InvalidArgumentError:Pxe,InvalidOptionArgumentError:Ixe,Command:Y6,Argument:xi,Option:Ja,Help:Lxe}=G6.default;Gn();J();Jt();We();Zi();p();import{execFileSync as uZ}from"node:child_process";import*as mP from"node:fs";import*as gP from"node:path";var xP=typeof _>"u"?void 0:_,fZ="npm run build --workspace werkmeister-core && npm run build --workspace apps/cli";function yP(e,t){if(!e?.sha||!mP.existsSync(gP.join(t,".git")))return null;let r;try{r=uZ("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)}.
1308
+ ${b.BOLD}${e}${b.RESET}`)}async function Yge(e){let t=et(),r=Zn(t);Sn("1. Paths & the workspace repo");let n={},s=i(ve=>Oh(ve.key,t,n),"pathDefault");if(e)await hi(gc,n,s,{intro:"Where your repos and per-feature workspaces live. Defaults in [brackets]."});else for(let ve of gc)n[ve.key]=s(ve),O(` ${ve.key}: ${n[ve.key]}`);let o=M3();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((ve,hp)=>hp.length?{...ve,choicesFn:i(()=>hp,"choicesFn")}:ve,"withChoices"),c={},l=[a(QA,o.map(ve=>`${ve}/${Kn}`)),a(eR,o)],u=i(ve=>ve.key==="workspace_repo"?Pu(t)||(o[0]?`${o[0]}/${Kn}`:""):t.overrides?.github_org||(c.workspace_repo??"").split("/")[0]||"","ghDefault");if(e)await hi(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 ve of l)c[ve.key]=u(ve),O(` ${ve.key}: ${c[ve.key]||"(unset \u2014 `gh` named no user)"}`);Sn("2. Browser");let f={},d=i(()=>t.overrides?.browser||Yd,"browserDefault");e?await hi([n3],f,d,{intro:"Which browser `sandbox open` launches."}):(f.browser=d(),O(` browser: ${f.browser}`)),lo[f.browser]?.engine!=="chromium"&&f.browser!=="safari"&&I(` ${lo[f.browser].label} isn't wired up yet -- \`sandbox open\` will error until it's picked to chrome/chromium/brave/edge/safari.`),Sn("3. Ingress");let h={},m=i(ve=>String(r[ve.key]??""),"ingressDefault");if(e)await hi(dw,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 ve of dw)h[ve.key]=m(ve),O(` ${ve.key}: ${h[ve.key]}`);Sn("4. Service registry");let y=Ds(),g=mt(n.repos_root),x=!1,v=XS(y)??"orbstack",S=[];try{S=Jo(g).map(ve=>ve.repo)}catch{}S.length?O(`${y} will be generated from ${S.length} repo fragment(s): ${S.join(", ")}.`):(O(`No <repo>/${Wf} 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 Bt(" Clone the demo apps (backend, frontend) so there is something to run?",!1,e)),!N6.existsSync(Qn())&&e&&(v=await Vl("Kube context for `sandbox intercept` (services.local.yaml k8s_context)",v)),Sn("5. Issue tracker");let w={},E=i(()=>Ii(t),"trackerDefault");e?await hi([{key:"issue_tracker",label:"Issue tracker",help:"Where workspace issues come from and where agents file existing bugs. "+Pi.map(ve=>`${ve}: ${Sw(ve).label} (e.g. ${Sw(ve).refExample})`).join("; ")+".",acceptEmpty:!1,pattern:`(${Pi.join("|")})`,choicesFn:i(()=>[...Pi],"choicesFn")}],w,E):(w.issue_tracker=E(),O(` issue_tracker: ${w.issue_tracker}`));let k={...Ms()},T=!!(k.base_url&&k.email&&k.api_token);if(w.issue_tracker==="github"){let ve=c.github_org;ve?S.length?O(`Tracking GitHub issues in: ${S.map(hp=>`${ve}/${hp}`).join(", ")}.`):O(`Tracking GitHub issues in every registry repo under ${ve} (none registered yet).`):I(" No GitHub org set (section 1) \u2014 workspaces can only take owner/repo#n issue refs.")}else w.issue_tracker==="jira"&&T?O(`Already configured for ${k.email}.`):w.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 Bt(" Configure Jira credentials now?",!1,e)&&(k.base_url=await Vl("Jira base URL",k.base_url??"https://your-org.atlassian.net"),k.email=await Vl("Atlassian login email",k.email??""),O(" Create a token at https://id.atlassian.com/manage-profile/security/api-tokens"),k.api_token=await Vl("API token",k.api_token??"",{secret:!0})));Sn("6. Telepresence (optional)"),O("Only `sandbox intercept` needs it \u2014 reroutes cluster traffic to a local container.");let R=await Bt(" Install/upgrade the OSS client via Homebrew if it's missing or stale?",!1,e);Sn("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 N=await Bt(" Install the superpowers plugin?",!1,e);Sn("8. VS Code (optional)");let P=Y$(),L=!1;P.present?P.error?I(`${op()} does not parse (${P.error}) \u2014 skipping.`):!Object.keys(P.set).length&&!P.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 ${op()}; comments and other settings are kept.`),L=await Bt(" Add the schema mappings to your VS Code user settings?",!1,e)):O("VS Code not found \u2014 skipping.");let M=Mx(),A=!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}).`),A=await Bt(" 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).`),Sn("9. Claude Code standards access (optional)");let D=z$(),B=!1;D.present?D.dirMissing?O(`Standards dir ${ct()} not found \u2014 skipping.`):D.error?I(`${ip()}: ${D.error} \u2014 skipping.`):D.granted?O("Already granted."):(O(`Lets every Claude Code session read the coding standards in ${ct()} without a prompt. Adds it to \`permissions.additionalDirectories\` in ${ip()}; other settings are kept.`),B=e&&await Bt(" Grant Claude Code read access to the standards dir?",!0,e)):O("Claude Code settings dir not found \u2014 skipping."),Sn("10. PR watch schedule (optional)");let U=Z$(),St;U.installed?(O(`Installed (${U.where}); logs \u2192 ${U.logFile}. Remove with \`werkmeister pr watch --uninstall\`.`),St=!0):(O("Resumes terminal Claude sessions when their PR merges, ships or closes (desktop sessions don't need it)."),St=await Bt(` Install a ${U.kind==="launchd"?"launchd agent":"crontab line"} that runs \`werkmeister pr watch\` every 10 minutes?`,!1,e));let ee={version:1,paths:{sandbox_root:String(Mf()),repos_root:n.repos_root,workspaces_root:n.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:w.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}:{}},oe=Th(ee),Ne=Ah(ee),ot=Rh(),ht=sR(),Hl=Ch();return Sn("Writing config"),F(`Wrote ${oe}`),O(`Regenerated ${Ne}`),O(`${mc()}: ${ot?"updated":"already sources env.sh"}`),O(`${lw()}: ${ht?"installed tab completion":"tab completion already installed"}`),N6.existsSync(Ri())&&O(`${nU.basename(Ri())}: ${Hl?"dropped stale env block":"no env block to remove"}`),{workspaceRepo:c.workspace_repo,demo:x,k8sContext:v,installTelepresence:R,installOptionalPlugins:N,mapEditorSchemas:L,installVscodeExtension:A,grantStandardsDir:B,installPrWatch:St,skipSudo:!e}}function tU(){try{return Gu()}catch{return[]}}function rU(e){Sn("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 zge(e){let t=!!e.check,r=!!e.yes;if(t){let l=await t6({checkOnly:!0,hostnames:tU()}),u=Nh(et()).filter(f=>!/^paths\.\w+ does not exist/.test(f));for(let f of u)l.unshift({label:"global config",ok:!1,detail:f});rU(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 n=!!process.stdin.isTTY&&!r;n?O("Sandbox setup \u2014 press Ctrl-C at any prompt to abort without writing."):!process.stdin.isTTY&&!r&&I("Not a TTY \u2014 running non-interactively with defaults (same as --yes).");let s=await Yge(n),o=await t6({checkOnly:!1,demo:s.demo,registry:{k8sContext:s.k8sContext},workspaceRepo:s.workspaceRepo,hostnames:tU,skipSudo:s.skipSudo,installTelepresence:s.installTelepresence,installOptionalPlugins:s.installOptionalPlugins,mapEditorSchemas:s.mapEditorSchemas,installVscodeExtension:s.installVscodeExtension,grantStandardsDir:s.grantStandardsDir,installPrWatch:s.installPrWatch}),a=rU(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 oU=C(()=>{"use strict";p();Hd();J();ss();gt();lr();Bx();Xo();Re();Ya();i(Sn,"heading");i(Yge,"configureMachine");i(tU,"resolveHostnames");i(rU,"report");i(zge,"run")});var cU={};be(cU,{run:()=>Xge});import*as iU from"node:fs";import*as aU from"node:path";function Jge(e){let t=e.paths||{};console.log(`${b.BOLD}config file:${b.RESET} ${Ir()}`),console.log(`${b.BOLD}env.sh:${b.RESET} ${Eh()}`),console.log(`${b.BOLD}sandbox_root:${b.RESET} ${Mf()} ${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||fw(s)} ${b.DIM}(${a})${b.RESET}`)}let r=Zn(e);console.log(`${b.BOLD}ingress:${b.RESET}`);for(let[s,o]of Object.entries(r)){let a=e.ingress?.[s]?"YAML":"default";console.log(` ${s}: ${o} ${b.DIM}(${a})${b.RESET}`)}let n=Object.fromEntries(Object.entries(e.overrides||{}).filter(([,s])=>s));if(Object.keys(n).length){console.log(`${b.BOLD}overrides:${b.RESET}`);for(let[s,o]of Object.entries(n))console.log(` ${s}: ${o}`)}}async function Xge(e){let t=et();if(e.check){let d=Nh(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){Jge(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=>Oh(d.key,t,r),"defaultFor"),s=gc.filter(d=>!(d.key in r));if(s.length)if(process.stdin.isTTY)await hi(gc,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(Mf()),repos_root:r.repos_root,workspaces_root:r.workspaces_root},overrides:t.overrides||{},...t.ingress?{ingress:t.ingress}:{},...t.jira?{jira:t.jira}:{}},a=Th(o),c=Ah(o),l=Rh(),u=Ch();F(`Wrote ${a}`),O(`Regenerated ${c}`),O(`${mc()}: ${l?"updated":"already sources env.sh"}`);let f=Ri();iU.existsSync(f)&&O(`${aU.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 lU=C(()=>{"use strict";p();gt();Re();Ya();i(Jge,"show");i(Xge,"run")});var uU={};be(uU,{run:()=>Qge});async function Qge(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 r=!!e.check,n=V0({checkOnly:r});for(let s of n){let o=s.ok?`${b.GREEN}\u2713${b.RESET}`:`${b.RED}\u2717${b.RESET}`;console.log(`${o} ${s.label}: ${s.detail}`)}n.some(s=>!s.ok)&&(I(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 fU=C(()=>{"use strict";p();Xo();Re();i(Qge,"run")});p();import P6 from"node:path";import{fileURLToPath as Zge}from"node:url";p();var G6=Pe(H6(),1),{program:Txe,createCommand:Axe,createArgument:Rxe,createOption:Cxe,CommanderError:Nxe,InvalidArgumentError:Pxe,InvalidOptionArgumentError:Ixe,Command:Y6,Argument:xi,Option:Ja,Help:Lxe}=G6.default;Gn();J();Jt();We();Zi();p();import{execFileSync as uZ}from"node:child_process";import*as mP from"node:fs";import*as gP from"node:path";var xP=typeof _>"u"?void 0:_,fZ="pnpm turbo run build --filter=werkmeister";function yP(e,t){if(!e?.sha||!mP.existsSync(gP.join(t,".git")))return null;let r;try{r=uZ("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)}.
1309
1309
  Rebuild it from ${t}: ${fZ}`}i(yP,"staleBuildWarning");Hs();var dU=P6.resolve(P6.dirname(Zge(import.meta.url)),"..");Ye("ROOT")||(process.env.SANDBOX_ROOT=dU);var I6="\x1B[31m",exe="\x1B[1m",ty="\x1B[0m",txe=`${exe}Developer Sandbox CLI${ty}
1310
1310
  Multi-feature concurrent development orchestrator
1311
1311
  `,rxe=[{name:"up",load:i(()=>Promise.resolve().then(()=>(a7(),i7)),"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(()=>(m7(),h7)),"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(()=>(y7(),x7)),"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(()=>(w7(),b7)),"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:"stop",load:i(()=>Promise.resolve().then(()=>(k7(),S7)),"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(()=>(N7(),C7)),"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(()=>(eq(),ZB)),"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(()=>(rq(),tq)),"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(()=>(sq(),nq)),"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(()=>(iq(),oq)),"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(()=>(cq(),aq)),"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")},"configure"),namespace:i(([e,t])=>({feature:e,extra:t??[]}),"namespace")},{name:"open",load:i(()=>Promise.resolve().then(()=>(uq(),lq)),"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(()=>(jS(),DS)),"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(()=>(dq(),fq)),"load"),configure:i(e=>{e.description("Regenerate Caddyfile and reload Caddy")},"configure"),namespace:i(()=>({}),"namespace")},{name:"clean",load:i(()=>Promise.resolve().then(()=>(hq(),pq)),"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(()=>(Sq(),_q)),"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(()=>(Eq(),kq)),"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(()=>(Oq(),$q)),"load"),configure:i(e=>{e.description("Workspace sb-* skill projection: verify freshness against the sandbox repo (check) or rewrite it (sync)").addArgument(new xi("<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(()=>(Aq(),Tq)),"load"),configure:i(e=>{e.description("Validate the configured standards tree (structural regression gate)").addArgument(new xi("<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(()=>(Cq(),Rq)),"load"),configure:i(e=>{e.description("Claude Code hook entrypoints: the standards gate, the PR guard and the agent state").addArgument(new xi("<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(()=>(FS(),d7)),"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 xi("<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 Ja("--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(()=>(Fq(),jq)),"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 Ja("--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 Ja("--context-strategy <id>","Context layer to generate: jit (skills, hooks, notes) or icm (staged folders). (env: SANDBOX_CONTEXT_STRATEGY; config: context_strategy).").choices([...Er])).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(()=>(Bq(),Mq)),"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(()=>(Hq(),Kq)),"load"),configure:i(e=>{e.description("Read, update or file an issue in this machine's issue tracker (see `sandbox setup`)").addArgument(new xi("<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(()=>(Yq(),Gq)),"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(()=>(Jq(),zq)),"load"),configure:i(e=>{e.description("Open and track this workspace's PRs from its PR files (docs/workspace-lifecycle.md)").addArgument(new xi("<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(()=>(Qq(),Xq)),"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(()=>(eU(),Zq)),"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(()=>(oU(),sU)),"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(()=>(lU(),cU)),"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:"registry",load:i(()=>Promise.resolve().then(()=>(fU(),uU)),"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(()=>(R6(),Pq)),"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 / ${Ve}. 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 Ja("--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 Ja("--context-strategy <id>","Context layer to generate: jit (skills, hooks, notes) or icm (staged folders). (env: SANDBOX_CONTEXT_STRATEGY; config: context_strategy).").choices([...Er])).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 nxe(e,t){try{let{migrateSlotsJson:n}=await Promise.resolve().then(()=>(Zt(),FN));await n()}catch{}let r;try{r=await e.load()}catch(n){throw n.code==="ERR_MODULE_NOT_FOUND"&&(console.log(`${I6}Failed to load command '${e.name}': ${n.message}${ty}`),process.exit(1)),n}try{await r.run(t)}catch(n){if(n instanceof Z&&n.code!==hc?j(n.message):console.log(`${I6}Error: ${n.message}${ty}`),Ye("DEBUG"))throw n;process.exit(1)}}i(nxe,"dispatch");async function sxe(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(()=>(Ts(),S6)),{workspaces:c}=await a();o.push(...c.map(l=>l.name))}catch{}}console.log(o.filter(a=>a.startsWith(n)).join(`