@thegpvc/gp-foundry 0.2.0 → 0.2.3

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.
@@ -35,8 +35,8 @@ inputs:
35
35
  Token used ONLY to read the check-runs rollup for the head SHA. That read
36
36
  needs the Checks permission, which is a GitHub App permission — a
37
37
  fine-grained PAT cannot be granted it, so passing the harness PAT here 403s
38
- and the gate merges nothing. Pass ${{ github.token }} (an App installation
39
- token) and give the job `permissions: checks: read`. Defaults to `token`,
38
+ and the gate merges nothing. Pass the built-in GITHUB_TOKEN (an App
39
+ installation token) and give the job `permissions: checks: read`. Defaults to `token`,
40
40
  which is correct only when that token is a GitHub App installation token.
41
41
  required: false
42
42
  default: ""
@@ -78,8 +78,8 @@ inputs:
78
78
  Optional newline-separated NAME=VALUE pairs exported into the agent's
79
79
  environment before the CLI runs, so roles can reach extra secrets (e.g. a
80
80
  Sentry token). Values are passed in by the caller because composites have
81
- no secrets context; the compiler fills these from config.agent.secrets as
82
- NAME=${{ secrets.NAME }}. Values are never echoed.
81
+ no secrets context; the compiler fills these from config.agent.secrets, one
82
+ NAME=<value> pair per line. Values are never echoed.
83
83
  required: false
84
84
  default: ""
85
85
 
@@ -1,85 +1,86 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var cr=Object.create;var Rt=Object.defineProperty;var ur=Object.getOwnPropertyDescriptor;var dr=Object.getOwnPropertyNames;var fr=Object.getPrototypeOf,pr=Object.prototype.hasOwnProperty;var hr=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(i){throw t=[i],i}};var ke=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var mr=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of dr(e))!pr.call(r,o)&&o!==t&&Rt(r,o,{get:()=>e[o],enumerable:!(i=ur(e,o))||i.enumerable});return r};var wn=(r,e,t)=>(t=r!=null?cr(fr(r)):{},mr(e||!r||!r.__esModule?Rt(t,"default",{value:r,enumerable:!0}):t,r));var gr,V,R=hr(()=>{"use strict";gr=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,V=gr()});var Je=ke(Un=>{"use strict";R();var _n=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Bn=class extends _n{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Un.CommanderError=_n;Un.InvalidArgumentError=Bn});var An=ke(Wn=>{"use strict";R();var{InvalidArgumentError:br}=Je(),Vn=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new br(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function yr(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}Wn.Argument=Vn;Wn.humanReadableArgName=yr});var Yn=ke(Pt=>{"use strict";R();var{humanReadableArgName:wr}=An(),Gn=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(o=>!o._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((o,s)=>o.name().localeCompare(s.name())),t}compareOptions(e,t){let i=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(o=>!o.hidden),i=e._getHelpOption();if(i&&!i.hidden){let o=i.short&&e._findOption(i.short),s=i.long&&e._findOption(i.long);!o&&!s?t.push(i):i.long&&!s?t.push(e.createOption(i.long,i.description)):i.short&&!o&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let o=i.options.filter(s=>!s.hidden);t.push(...o)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>wr(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,o)=>Math.max(i,t.subcommandTerm(o).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,o)=>Math.max(i,t.optionTerm(o).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,o)=>Math.max(i,t.optionTerm(o).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,o)=>Math.max(i,t.argumentTerm(o).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let o=e.parent;o;o=o.parent)i=o.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),o=t.helpWidth||80,s=2,a=2;function d($,E){if(E){let v=`${$.padEnd(i+a)}${E}`;return t.wrap(v,o-s,i+a)}return $}function u($){return $.join(`
2
+ "use strict";var cr=Object.create;var It=Object.defineProperty;var ur=Object.getOwnPropertyDescriptor;var dr=Object.getOwnPropertyNames;var fr=Object.getPrototypeOf,pr=Object.prototype.hasOwnProperty;var hr=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(i){throw t=[i],i}};var Ce=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var mr=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of dr(e))!pr.call(r,o)&&o!==t&&It(r,o,{get:()=>e[o],enumerable:!(i=ur(e,o))||i.enumerable});return r};var wn=(r,e,t)=>(t=r!=null?cr(fr(r)):{},mr(e||!r||!r.__esModule?It(t,"default",{value:r,enumerable:!0}):t,r));var gr,V,I=hr(()=>{"use strict";gr=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,V=gr()});var Je=Ce(Un=>{"use strict";I();var _n=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Bn=class extends _n{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Un.CommanderError=_n;Un.InvalidArgumentError=Bn});var An=Ce(Gn=>{"use strict";I();var{InvalidArgumentError:br}=Je(),Vn=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new br(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function yr(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}Gn.Argument=Vn;Gn.humanReadableArgName=yr});var Yn=Ce(Pt=>{"use strict";I();var{humanReadableArgName:wr}=An(),Wn=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(o=>!o._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((o,s)=>o.name().localeCompare(s.name())),t}compareOptions(e,t){let i=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(o=>!o.hidden),i=e._getHelpOption();if(i&&!i.hidden){let o=i.short&&e._findOption(i.short),s=i.long&&e._findOption(i.long);!o&&!s?t.push(i):i.long&&!s?t.push(e.createOption(i.long,i.description)):i.short&&!o&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let o=i.options.filter(s=>!s.hidden);t.push(...o)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>wr(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,o)=>Math.max(i,t.subcommandTerm(o).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,o)=>Math.max(i,t.optionTerm(o).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,o)=>Math.max(i,t.optionTerm(o).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,o)=>Math.max(i,t.argumentTerm(o).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let o=e.parent;o;o=o.parent)i=o.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),o=t.helpWidth||80,s=2,a=2;function d($,E){if(E){let v=`${$.padEnd(i+a)}${E}`;return t.wrap(v,o-s,i+a)}return $}function u($){return $.join(`
3
3
  `).replace(/^/gm," ".repeat(s))}let c=[`Usage: ${t.commandUsage(e)}`,""],f=t.commandDescription(e);f.length>0&&(c=c.concat([t.wrap(f,o,0),""]));let h=t.visibleArguments(e).map($=>d(t.argumentTerm($),t.argumentDescription($)));h.length>0&&(c=c.concat(["Arguments:",u(h),""]));let g=t.visibleOptions(e).map($=>d(t.optionTerm($),t.optionDescription($)));if(g.length>0&&(c=c.concat(["Options:",u(g),""])),this.showGlobalOptions){let $=t.visibleGlobalOptions(e).map(E=>d(t.optionTerm(E),t.optionDescription(E)));$.length>0&&(c=c.concat(["Global Options:",u($),""]))}let x=t.visibleCommands(e).map($=>d(t.subcommandTerm($),t.subcommandDescription($)));return x.length>0&&(c=c.concat(["Commands:",u(x),""])),c.join(`
4
4
  `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,o=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",a=new RegExp(`[\\n][${s}]+`);if(e.match(a))return e;let d=t-i;if(d<o)return e;let u=e.slice(0,i),c=e.slice(i).replace(`\r
5
5
  `,`
6
6
  `),f=" ".repeat(i),g="\\s\u200B",x=new RegExp(`
7
7
  |.{1,${d-1}}([${g}]|$)|[^${g}]+?([${g}]|$)`,"g"),$=c.match(x)||[];return u+$.map((E,v)=>E===`
8
8
  `?"":(v>0?f:"")+E.trimEnd()).join(`
9
- `)}};Pt.Help=Gn});var Xn=ke(zn=>{"use strict";R();var{InvalidArgumentError:_r}=Je(),Kn=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=xr(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new _r(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Ar(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Jn=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let o=this.negativeOptions.get(i).presetArg,s=o!==void 0?o:!1;return t.negate===(s===e)}};function Ar(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function xr(r){let e,t,i=r.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}zn.Option=Kn;zn.DualOptions=Jn});var Mt=ke(Ft=>{"use strict";R();function kr(r,e){if(Math.abs(r.length-e.length)>3)return Math.max(r.length,e.length);let t=[];for(let i=0;i<=r.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let o=1;o<=r.length;o++){let s=1;r[o-1]===e[i-1]?s=0:s=1,t[o][i]=Math.min(t[o-1][i]+1,t[o][i-1]+1,t[o-1][i-1]+s),o>1&&i>1&&r[o-1]===e[i-2]&&r[o-2]===e[i-1]&&(t[o][i]=Math.min(t[o][i],t[o-2][i-2]+1))}return t[r.length][e.length]}function Cr(r,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=r.startsWith("--");t&&(r=r.slice(2),e=e.map(a=>a.slice(2)));let i=[],o=3,s=.4;return e.forEach(a=>{if(a.length<=1)return;let d=kr(r,a),u=Math.max(r.length,a.length);(u-d)/u>s&&(d<o?(o=d,i=[a]):d===o&&i.push(a))}),i.sort((a,d)=>a.localeCompare(d)),t&&(i=i.map(a=>`--${a}`)),i.length>1?`
9
+ `)}};Pt.Help=Wn});var Xn=Ce(zn=>{"use strict";I();var{InvalidArgumentError:_r}=Je(),Kn=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=xr(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new _r(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Ar(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Jn=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let o=this.negativeOptions.get(i).presetArg,s=o!==void 0?o:!1;return t.negate===(s===e)}};function Ar(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function xr(r){let e,t,i=r.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}zn.Option=Kn;zn.DualOptions=Jn});var Mt=Ce(Ft=>{"use strict";I();function kr(r,e){if(Math.abs(r.length-e.length)>3)return Math.max(r.length,e.length);let t=[];for(let i=0;i<=r.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let o=1;o<=r.length;o++){let s=1;r[o-1]===e[i-1]?s=0:s=1,t[o][i]=Math.min(t[o-1][i]+1,t[o][i-1]+1,t[o-1][i-1]+s),o>1&&i>1&&r[o-1]===e[i-2]&&r[o-2]===e[i-1]&&(t[o][i]=Math.min(t[o][i],t[o-2][i-2]+1))}return t[r.length][e.length]}function Cr(r,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=r.startsWith("--");t&&(r=r.slice(2),e=e.map(a=>a.slice(2)));let i=[],o=3,s=.4;return e.forEach(a=>{if(a.length<=1)return;let d=kr(r,a),u=Math.max(r.length,a.length);(u-d)/u>s&&(d<o?(o=d,i=[a]):d===o&&i.push(a))}),i.sort((a,d)=>a.localeCompare(d)),t&&(i=i.map(a=>`--${a}`)),i.length>1?`
10
10
  (Did you mean one of ${i.join(", ")}?)`:i.length===1?`
11
- (Did you mean ${i[0]}?)`:""}Ft.suggestSimilar=Cr});var Bt=ke(qt=>{"use strict";R();var Er=require("events").EventEmitter,Qn=require("child_process"),be=require("path"),Zn=require("fs"),X=require("process"),{Argument:Sr,humanReadableArgName:vr}=An(),{CommanderError:et}=Je(),{Help:Or}=Yn(),{Option:Lt,DualOptions:$r}=Xn(),{suggestSimilar:jt}=Mt(),nt=class r extends Er{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>X.stdout.write(t),writeErr:t=>X.stderr.write(t),getOutHelpWidth:()=>X.stdout.isTTY?X.stdout.columns:void 0,getErrHelpWidth:()=>X.stderr.isTTY?X.stderr.columns:void 0,outputError:(t,i)=>i(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let o=t,s=i;typeof o=="object"&&o!==null&&(s=o,o=null),s=s||{};let[,a,d]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(a);return o&&(u.description(o),u._executableHandler=!0),s.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(s.noHelp||s.hidden),u._executableFile=s.executableFile||null,d&&u.arguments(d),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),o?this:u}createCommand(e){return new r(e)}createHelp(){return Object.assign(new Or,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
11
+ (Did you mean ${i[0]}?)`:""}Ft.suggestSimilar=Cr});var Bt=Ce(qt=>{"use strict";I();var Er=require("events").EventEmitter,Qn=require("child_process"),be=require("path"),Zn=require("fs"),X=require("process"),{Argument:Sr,humanReadableArgName:vr}=An(),{CommanderError:et}=Je(),{Help:Or}=Yn(),{Option:jt,DualOptions:$r}=Xn(),{suggestSimilar:Lt}=Mt(),nt=class r extends Er{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>X.stdout.write(t),writeErr:t=>X.stderr.write(t),getOutHelpWidth:()=>X.stdout.isTTY?X.stdout.columns:void 0,getErrHelpWidth:()=>X.stderr.isTTY?X.stderr.columns:void 0,outputError:(t,i)=>i(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let o=t,s=i;typeof o=="object"&&o!==null&&(s=o,o=null),s=s||{};let[,a,d]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(a);return o&&(u.description(o),u._executableHandler=!0),s.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(s.noHelp||s.hidden),u._executableFile=s.executableFile||null,d&&u.arguments(d),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),o?this:u}createCommand(e){return new r(e)}createHelp(){return Object.assign(new Or,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
12
  - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Sr(e,t)}argument(e,t,i,o){let s=this.createArgument(e,t);return typeof i=="function"?s.default(o).argParser(i):s.default(i),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,i,o]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
- Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new et(e,t,i)),X.exit(e)}action(e){let t=i=>{let o=this.registeredArguments.length,s=i.slice(0,o);return this._storeOptionsAsProperties?s[o]=this:s[o]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new Lt(e,t)}_callParseArg(e,t,i,o){try{return e.parseArg(t,i)}catch(s){if(s.code==="commander.invalidArgument"){let a=`${o} ${s.message}`;this.error(a,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
14
- - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=o=>[o.name()].concat(o.aliases()),i=t(e).find(o=>this._findCommand(o));if(i){let o=t(this._findCommand(i)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${o}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let o=(s,a,d)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let u=this.getOptionValue(i);s!==null&&e.parseArg?s=this._callParseArg(e,s,u,a):s!==null&&e.variadic&&(s=e._concatValue(s,u)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,d)};return this.on("option:"+t,s=>{let a=`error: option '${e.flags}' argument '${s}' is invalid.`;o(s,a,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let a=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;o(s,a,"env")}),this}_optionEx(e,t,i,o,s){if(typeof t=="object"&&t instanceof Lt)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(t,i);if(a.makeOptionMandatory(!!e.mandatory),typeof o=="function")a.default(s).argParser(o);else if(o instanceof RegExp){let d=o;o=(u,c)=>{let f=d.exec(u);return f?f[0]:c},a.default(s).argParser(o)}else a.default(o);return this.addOption(a)}option(e,t,i,o){return this._optionEx({},e,t,i,o)}requiredOption(e,t,i,o){return this._optionEx({mandatory:!0},e,t,i,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){X.versions?.electron&&(t.from="electron");let o=X.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(t.from="eval")}e===void 0&&(e=X.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":X.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){t=t.slice();let i=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function s(f,h){let g=be.resolve(f,h);if(Zn.existsSync(g))return g;if(o.includes(be.extname(h)))return;let x=o.find($=>Zn.existsSync(`${g}${$}`));if(x)return`${g}${x}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||"";if(this._scriptPath){let f;try{f=Zn.realpathSync(this._scriptPath)}catch{f=this._scriptPath}d=be.resolve(be.dirname(f),d)}if(d){let f=s(d,a);if(!f&&!e._executableFile&&this._scriptPath){let h=be.basename(this._scriptPath,be.extname(this._scriptPath));h!==this._name&&(f=s(d,`${h}-${e._name}`))}a=f||a}i=o.includes(be.extname(a));let u;X.platform!=="win32"?i?(t.unshift(a),t=Dt(X.execArgv).concat(t),u=Qn.spawn(X.argv[0],t,{stdio:"inherit"})):u=Qn.spawn(a,t,{stdio:"inherit"}):(t.unshift(a),t=Dt(X.execArgv).concat(t),u=Qn.spawn(X.execPath,t,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(h=>{X.on(h,()=>{u.killed===!1&&u.exitCode===null&&u.kill(h)})});let c=this._exitCallback;u.on("close",f=>{f=f??1,c?c(new et(f,"commander.executeSubCommandAsync","(close)")):X.exit(f)}),u.on("error",f=>{if(f.code==="ENOENT"){let h=d?`searched for local subcommand relative to directory '${d}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",g=`'${a}' does not exist
13
+ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new et(e,t,i)),X.exit(e)}action(e){let t=i=>{let o=this.registeredArguments.length,s=i.slice(0,o);return this._storeOptionsAsProperties?s[o]=this:s[o]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new jt(e,t)}_callParseArg(e,t,i,o){try{return e.parseArg(t,i)}catch(s){if(s.code==="commander.invalidArgument"){let a=`${o} ${s.message}`;this.error(a,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
14
+ - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=o=>[o.name()].concat(o.aliases()),i=t(e).find(o=>this._findCommand(o));if(i){let o=t(this._findCommand(i)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${o}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let o=(s,a,d)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let u=this.getOptionValue(i);s!==null&&e.parseArg?s=this._callParseArg(e,s,u,a):s!==null&&e.variadic&&(s=e._concatValue(s,u)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,d)};return this.on("option:"+t,s=>{let a=`error: option '${e.flags}' argument '${s}' is invalid.`;o(s,a,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let a=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;o(s,a,"env")}),this}_optionEx(e,t,i,o,s){if(typeof t=="object"&&t instanceof jt)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(t,i);if(a.makeOptionMandatory(!!e.mandatory),typeof o=="function")a.default(s).argParser(o);else if(o instanceof RegExp){let d=o;o=(u,c)=>{let f=d.exec(u);return f?f[0]:c},a.default(s).argParser(o)}else a.default(o);return this.addOption(a)}option(e,t,i,o){return this._optionEx({},e,t,i,o)}requiredOption(e,t,i,o){return this._optionEx({mandatory:!0},e,t,i,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){X.versions?.electron&&(t.from="electron");let o=X.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(t.from="eval")}e===void 0&&(e=X.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":X.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){t=t.slice();let i=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function s(f,h){let g=be.resolve(f,h);if(Zn.existsSync(g))return g;if(o.includes(be.extname(h)))return;let x=o.find($=>Zn.existsSync(`${g}${$}`));if(x)return`${g}${x}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||"";if(this._scriptPath){let f;try{f=Zn.realpathSync(this._scriptPath)}catch{f=this._scriptPath}d=be.resolve(be.dirname(f),d)}if(d){let f=s(d,a);if(!f&&!e._executableFile&&this._scriptPath){let h=be.basename(this._scriptPath,be.extname(this._scriptPath));h!==this._name&&(f=s(d,`${h}-${e._name}`))}a=f||a}i=o.includes(be.extname(a));let u;X.platform!=="win32"?i?(t.unshift(a),t=Dt(X.execArgv).concat(t),u=Qn.spawn(X.argv[0],t,{stdio:"inherit"})):u=Qn.spawn(a,t,{stdio:"inherit"}):(t.unshift(a),t=Dt(X.execArgv).concat(t),u=Qn.spawn(X.execPath,t,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(h=>{X.on(h,()=>{u.killed===!1&&u.exitCode===null&&u.kill(h)})});let c=this._exitCallback;u.on("close",f=>{f=f??1,c?c(new et(f,"commander.executeSubCommandAsync","(close)")):X.exit(f)}),u.on("error",f=>{if(f.code==="ENOENT"){let h=d?`searched for local subcommand relative to directory '${d}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",g=`'${a}' does not exist
15
15
  - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
17
  - ${h}`;throw new Error(g)}else if(f.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)X.exit(1);else{let h=new et(1,"commander.executeSubCommandAsync","(error)");h.nestedError=f,c(h)}}),this.runningCommand=u}_dispatchSubcommand(e,t,i){let o=this._findCommand(e);o||this.help({error:!0});let s;return s=this._chainOrCallSubCommandHook(s,o,"preSubcommand"),s=this._chainOrCall(s,()=>{if(o._executableHandler)this._executeSubCommand(o,t.concat(i));else return o._parseCommand(t,i)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(i,o,s)=>{let a=o;if(o!==null&&i.parseArg){let d=`error: command-argument value '${o}' is invalid for argument '${i.name()}'.`;a=this._callParseArg(i,o,s,d)}return a};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,o)=>{let s=i.defaultValue;i.variadic?o<this.args.length?(s=this.args.slice(o),i.parseArg&&(s=s.reduce((a,d)=>e(i,d,a),i.defaultValue))):s===void 0&&(s=[]):o<this.args.length&&(s=this.args[o],i.parseArg&&(s=e(i,s,i.defaultValue))),t[o]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,o=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(a=>{o.push({hookedCommand:s,callback:a})})}),t==="postAction"&&o.reverse(),o.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let o=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{o=this._chainOrCall(o,()=>s(this,t))}),o}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(s,e,t)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent&&this.parent.listenerCount(s))o(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(i=>{let o=i.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let o=e.find(s=>i.conflictsWith.includes(s.attributeName()));o&&this._conflictingOption(i,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],o=t,s=e.slice();function a(u){return u.length>1&&u[0]==="-"}let d=null;for(;s.length;){let u=s.shift();if(u==="--"){o===i&&o.push(u),o.push(...s);break}if(d&&!a(u)){this.emit(`option:${d.name()}`,u);continue}if(d=null,a(u)){let c=this._findOption(u);if(c){if(c.required){let f=s.shift();f===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,f)}else if(c.optional){let f=null;s.length>0&&!a(s[0])&&(f=s.shift()),this.emit(`option:${c.name()}`,f)}else this.emit(`option:${c.name()}`);d=c.variadic?c:null;continue}}if(u.length>2&&u[0]==="-"&&u[1]!=="-"){let c=this._findOption(`-${u[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,u.slice(2)):(this.emit(`option:${c.name()}`),s.unshift(`-${u.slice(2)}`));continue}}if(/^--[^=]+=/.test(u)){let c=u.indexOf("="),f=this._findOption(u.slice(0,c));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,u.slice(c+1));continue}}if(a(u)&&(o=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(u)){t.push(u),s.length>0&&i.push(...s);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){t.push(u),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){i.push(u),s.length>0&&i.push(...s);break}}if(this._passThroughOptions){o.push(u),s.length>0&&o.push(...s);break}o.push(u)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let o=this.options[i].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
18
18
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
19
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
20
- `),this.outputHelp({error:!0}));let i=t||{},o=i.exitCode||1,s=i.code||"commander.error";this._exit(o,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in X.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,X.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new $r(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(o=>!t(o)).forEach(o=>{this.setOptionValueWithSource(o,i.implied[o],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=a=>{let d=a.attributeName(),u=this.getOptionValue(d),c=this.options.find(h=>h.negate&&d===h.attributeName()),f=this.options.find(h=>!h.negate&&d===h.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:f||a},o=a=>{let d=i(a),u=d.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${d.envVar}'`:`option '${d.flags}'`},s=`error: ${o(e)} cannot be used with ${o(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],s=this;do{let a=s.createHelp().visibleOptions(s).filter(d=>d.long).map(d=>d.long);o=o.concat(a),s=s.parent}while(s&&!s._enablePositionalOptions);t=jt(e,o)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(s=>{o.push(s.name()),s.alias()&&o.push(s.alias())}),t=jt(e,o)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let o=this.createOption(t,i);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
20
+ `),this.outputHelp({error:!0}));let i=t||{},o=i.exitCode||1,s=i.code||"commander.error";this._exit(o,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in X.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,X.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new $r(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(o=>!t(o)).forEach(o=>{this.setOptionValueWithSource(o,i.implied[o],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=a=>{let d=a.attributeName(),u=this.getOptionValue(d),c=this.options.find(h=>h.negate&&d===h.attributeName()),f=this.options.find(h=>!h.negate&&d===h.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:f||a},o=a=>{let d=i(a),u=d.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${d.envVar}'`:`option '${d.flags}'`},s=`error: ${o(e)} cannot be used with ${o(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],s=this;do{let a=s.createHelp().visibleOptions(s).filter(d=>d.long).map(d=>d.long);o=o.concat(a),s=s.parent}while(s&&!s._enablePositionalOptions);t=Lt(e,o)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(s=>{o.push(s.name()),s.alias()&&o.push(s.alias())}),t=Lt(e,o)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let o=this.createOption(t,i);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
21
  `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(e);if(i){let o=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${o}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>vr(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=be.basename(e,be.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},i;return t.error?i=o=>this._outputConfiguration.writeErr(o):i=o=>this._outputConfiguration.writeOut(o),t.write=e.write||i,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation(i);if(t&&(o=t(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=X.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
22
22
  Expecting one of '${i.join("', '")}'`);let o=`${e}Help`;return this.on(o,s=>{let a;typeof t=="function"?a=t({error:s.error,command:s.command}):a=t,a&&s.write(`${a}
23
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(o=>t.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Dt(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",o="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?o=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],o=s[4]),t&&o!=="0"?`${t}=${i}:${parseInt(o)+1}`:e})}qt.Command=nt});var Gt=ke(le=>{"use strict";R();var{Argument:Ut}=An(),{Command:tt}=Bt(),{CommanderError:Tr,InvalidArgumentError:Vt}=Je(),{Help:Nr}=Yn(),{Option:Wt}=Xn();le.program=new tt;le.createCommand=r=>new tt(r);le.createOption=(r,e)=>new Wt(r,e);le.createArgument=(r,e)=>new Ut(r,e);le.Command=tt;le.Option=Wt;le.Argument=Ut;le.Help=Nr;le.CommanderError=Tr;le.InvalidArgumentError=Vt;le.InvalidOptionArgumentError=Vt});var Cn=ke((es,it)=>{"use strict";R();var kn=process||{},Jt=kn.argv||[],xn=kn.env||{},Hr=!(xn.NO_COLOR||Jt.includes("--no-color"))&&(!!xn.FORCE_COLOR||Jt.includes("--color")||kn.platform==="win32"||(kn.stdout||{}).isTTY&&xn.TERM!=="dumb"||!!xn.CI),Ir=(r,e,t=r)=>i=>{let o=""+i,s=o.indexOf(e,r.length);return~s?r+Rr(o,e,t,s)+e:r+o+e},Rr=(r,e,t,i)=>{let o="",s=0;do o+=r.substring(s,i)+t,s=i+e.length,i=r.indexOf(e,s);while(~i);return o+r.substring(s)},zt=(r=Hr)=>{let e=r?Ir:()=>String;return{isColorSupported:r,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};it.exports=zt();it.exports.createColors=zt});R();R();var Yt=wn(Gt(),1),{program:Bo,createCommand:Uo,createArgument:Vo,createOption:Wo,CommanderError:Go,InvalidArgumentError:Yo,InvalidOptionArgumentError:Ko,Command:Kt,Argument:Jo,Option:zo,Help:Xo}=Yt.default;var Q=wn(Cn(),1),lr=require("child_process"),Y=require("fs"),ne=require("path");R();R();R();var En=["analyst","issue-agent","producer","pr-review","pr-fix","scheduled-agent"];function Xt(r){return r.uses!==void 0}R();function ze(r){let e=r.auth;return e?.mode?{mode:e.mode,appIdSecret:e.app_id_secret??r.identity.app_id_secret,appKeySecret:e.app_key_secret??r.identity.app_key_secret,tokenSecret:e.token_secret}:r.identity.app_id_secret&&r.identity.app_key_secret?{mode:"app",appIdSecret:r.identity.app_id_secret,appKeySecret:r.identity.app_key_secret}:{mode:"github-token"}}R();var Pr=new Set(En);function Le(r){let e=new Map(r.nodes.map(a=>[a.id,a])),t=new Map,i=new Map;for(let a of r.nodes)t.set(a.id,[]),i.set(a.id,[]);for(let a of r.edges)t.get(a.to)?.push(a),i.get(a.from)?.push(a);let o=new Map,s=new Set;for(let a of r.nodes){if(a.type!=="fan_in")continue;let d=t.get(a.id)??[];if(d.length<2)continue;let u=[],c,f=!0;for(let $ of d){let E=e.get($.from);if(!E||!Pr.has(E.type)){f=!1;break}let v=t.get(E.id)??[],P=i.get(E.id)??[];if(v.length!==1||P.length!==1||P[0].to!==a.id){f=!1;break}let M=e.get(v[0].from);if(!M||M.type!=="parallel"){f=!1;break}if(v[0].on||v[0].when){f=!1;break}if(c===void 0)c=M.id;else if(c!==M.id){f=!1;break}u.push(E.id)}if(!f||c===void 0)continue;let h=t.get(c)??[],g=i.get(c)??[];if(h.length!==1||!h[0].on)continue;let x=new Set(u);if(!(!g.every($=>x.has($.to))||g.length!==u.length)){o.set(a.id,{parallelId:c,entryEdge:h[0],legIds:u,faninId:a.id}),s.add(c);for(let $ of u)s.add($)}}return{byFanin:o,memberIds:s}}var rt=new Set(En);function Xe(r,e={}){let t=[],i=new Map(r.nodes.map(a=>[a.id,a]));for(let a of r.nodes)a.declared||t.push({level:"error",code:"node.undeclared",message:`node '${a.id}' is referenced in an edge but never declared`,where:{node:a.id,line:a.line},hint:`add a node statement, e.g. ${a.id} [type=...]`});for(let a of r.nodes)rt.has(a.type)&&!a.files.role&&t.push({level:"error",code:"node.missing-role",message:`agent node '${a.id}' (type ${a.type}) needs a role="..." job description`,where:{node:a.id,line:a.line}}),a.type==="human-gate"&&a.attrs.environment===void 0&&t.push({level:"error",code:"node.human-gate-no-environment",message:`human-gate '${a.id}' must set environment=<name> (maps to a protected GitHub Environment)`,where:{node:a.id,line:a.line}}),a.type==="merge-gate"&&!a.files.policy&&t.push({level:"warning",code:"node.merge-gate-no-policy",message:`merge-gate '${a.id}' has no policy="..."; default merge policy will be used`,where:{node:a.id,line:a.line}});if(e.fileExists)for(let a of r.nodes)for(let d of["role","policy","prompt","tools"]){let u=a.files[d];u&&!e.fileExists(u)&&t.push({level:"error",code:"file.missing",message:`node '${a.id}' references ${d}="${u}" which does not exist`,where:{node:a.id,line:a.line,file:u}})}if(e.roles){let a=new Map;for(let u of r.nodes)a.set(u.id,[]);for(let u of r.edges){let c=i.get(u.to);c&&a.get(u.from)?.push({node:c,edge:u})}let d=u=>(e.roles?.get(u.id)?.role??u.id).toLowerCase();for(let u of r.nodes){let c=e.roles.get(u.id);if(!c?.handoffs)continue;let f=a.get(u.id)??[],h=new Set(f.flatMap(x=>[x.node.id.toLowerCase(),d(x.node)])),g=new Set(c.handoffs.map(x=>String(x.to).toLowerCase()));for(let x of c.handoffs)h.has(String(x.to).toLowerCase())||t.push({level:"warning",code:"role.handoff-no-edge",message:`role '${c.role}' (node '${u.id}') declares a handoff to '${x.to}' but there is no matching out-edge`,where:{node:u.id},hint:"add the edge, or remove the handoff so the job description matches the graph"});for(let{node:x,edge:$}of f)x.type==="exit"&&!$.when||!g.has(x.id.toLowerCase())&&!g.has(d(x))&&t.push({level:"warning",code:"role.edge-no-handoff",message:`node '${u.id}' has an out-edge to '${x.id}' not declared as a handoff in role '${c.role}'`,where:{node:u.id,edge:[u.id,x.id]},hint:"document the handoff in the role, or remove the edge"})}}let o=(a,d)=>{if(typeof a=="string"){let u=a.match(/<[A-Za-z][^<>]{0,80}>/);u&&t.push({level:"error",code:"config.placeholder",message:`config value ${d} still contains the placeholder ${u[0]} \u2014 fill it in foundry.config.yaml`,hint:"generated workflows would be broken until every <placeholder> is replaced"})}else if(Array.isArray(a))a.forEach((u,c)=>o(u,`${d}[${c}]`));else if(a&&typeof a=="object")for(let[u,c]of Object.entries(a))o(c,d?`${d}.${u}`:u)};if(o(r.config,""),e.fileExists&&(r.config.runtime?.mode??"pinned")==="vendored"){let a=new Set,d=!1;for(let u of r.nodes)rt.has(u.type)&&(d=!0,a.add("run-agent")),rt.has(u.type)&&u.type!=="scheduled-agent"&&a.add("agent-context"),(u.type==="producer"||u.type==="scheduled-agent")&&a.add("agent-fallback"),u.type==="merge-gate"&&a.add("merge-gate"),u.type==="pr-review"&&u.attrs.gates!==void 0&&a.add("wait-for-checks");for(let u of a)e.fileExists(`actions/${u}/action.yml`)||t.push({level:"warning",code:"runtime.action-not-vendored",message:`runtime.mode is 'vendored' but .github/actions/${u}/ is missing`,hint:"run `gp-foundry vendor` to copy the runtime actions into the repo"});d&&!e.fileExists("agent-setup/action.yml")&&t.push({level:"warning",code:"runtime.agent-setup-missing",message:"generated agent jobs use ./.github/agent-setup, which does not exist",hint:"run `gp-foundry vendor` (or `gp-foundry init`) to scaffold the agent-setup shim"})}{let{byFanin:a,memberIds:d}=Le(r);for(let u of r.nodes)if(u.type==="parallel"&&!d.has(u.id)&&t.push({level:"error",code:"diamond.malformed",message:`parallel '${u.id}' is not part of a clean diamond (need: exactly one in-edge carrying on=, \u22652 bare out-edges to agent legs that each flow into one fan_in)`,where:{node:u.id,line:u.line},hint:"see reference/node-types.md \u2014 v1 supports clean parallel\u2192legs\u2192fan_in diamonds only"}),u.type==="fan_in"){let c=a.get(u.id);if(!c)t.push({level:"error",code:"diamond.malformed",message:`fan_in '${u.id}' is not the join of a clean diamond (need \u22652 legs, each with exactly one in-edge from a shared parallel and one out-edge into this fan_in)`,where:{node:u.id,line:u.line},hint:"see reference/node-types.md \u2014 v1 supports clean parallel\u2192legs\u2192fan_in diamonds only"});else{!u.files.role&&u.attrs.on_complete_label===void 0&&t.push({level:"error",code:"diamond.unobservable-join",message:`fan_in '${u.id}' has neither a role nor on_complete_label \u2014 its completion would be unobservable`,where:{node:u.id,line:u.line},hint:'give it a role="..." (synthesize the lanes) and/or on_complete_label=<label> to cascade the next stage'});let f=c.legIds.filter(h=>i.get(h)?.type==="pr-review");f.length&&t.push({level:"warning",code:"diamond.lane-verdict-risk",message:`fan_in '${u.id}' lanes [${f.join(", ")}] are pr-review typed \u2014 if a lane role posts a '**Verdict:**' review, the merge gate acts on ONE lane's opinion and the join is bypassed`,where:{node:u.id},hint:"lane roles must post ANALYSES (plain comments); only the fan_in role posts the verdict"})}}}if(ze(r.config).mode==="github-token"){let a=r.edges.filter(d=>/^(pull_request\.opened|pull_request\.synchronize|push)/.test(d.on??"")||/^(label=|verdict=)/.test(d.when??""));a.length&&t.push({level:r.config.auth?.mode==="github-token"?"error":"warning",code:"auth.github-token-no-cascade",message:`auth mode 'github-token': commits/PRs made with GITHUB_TOKEN do not trigger other workflows, so ${a.length} event-cascade edge(s) (pull_request.opened/synchronize/push) will not fire and the harness will stall`,hint:"use auth.mode 'app' or 'pat' (a fine-grained PAT secret), or drive those stages via explicit dispatch"})}return!r.config.identity?.bot_login&&r.edges.some(a=>/^verdict=/.test(a.when??""))&&t.push({level:"warning",code:"auth.no-bot-login",message:"identity.bot_login is unset, so verdict-triggered workflows (fixer, human-gate) guard only on the verdict marker \u2014 any user who can review the PR can fire them",hint:"set identity.bot_login in foundry.config.yaml to the login that posts the reviews"}),r.nodes.some(a=>a.type==="start"||a.attrs.schedule!==void 0||a.type==="merge-gate")||t.push({level:"warning",code:"graph.no-entry",message:"harness has no entry node (a start node or a scheduled node) \u2014 nothing will trigger it"}),t}R();var Fr=new Set(["exit","merge-gate","human-gate","scheduled-agent","fan_in"]),Qt=new Set(["start"]);function Qe(r){let e=[],t=new Set(r.nodes.map(c=>c.id)),i=new Map(r.nodes.map(c=>[c.id,c])),o=new Map;for(let c of t)o.set(c,[]);for(let c of r.edges)t.has(c.from)&&t.has(c.to)&&o.get(c.from).push(c.to);let s=r.nodes.filter(c=>Qt.has(c.type)||c.attrs.schedule!==void 0||c.type==="merge-gate"),a=new Set,d=s.map(c=>c.id);for(;d.length;){let c=d.pop();if(!a.has(c)){a.add(c);for(let f of o.get(c)??[])d.push(f)}}for(let c of r.nodes)!a.has(c.id)&&!Qt.has(c.type)&&e.push({level:"warning",code:"graph.unreachable",message:`node '${c.id}' is unreachable from any entry (start/scheduled) node`,where:{node:c.id,line:c.line},hint:"add an incoming edge, a schedule=, or a start node that leads here"});for(let c of r.nodes)(o.get(c.id)??[]).length===0&&!Fr.has(c.type)&&e.push({level:"warning",code:"graph.dead-end",message:`node '${c.id}' (type ${c.type}) has no outgoing edge and is not a sink (exit/merge-gate/human-gate)`,where:{node:c.id,line:c.line},hint:"route it to a next node, or make it an exit"});for(let c of jr(t,o)){if(!(c.length>1||(o.get(c[0])??[]).includes(c[0])))continue;let h=new Set(c),g=[];for(let x of c)for(let $ of o.get(x)??[])h.has($)||g.push({from:x,to:$});g.length===0?e.push({level:"error",code:"graph.unbounded-loop",message:`cycle {${c.join(" \u2192 ")}} has no escape edge \u2014 this is a livelock`,where:{node:c[0]},hint:'add a bounded escape edge (e.g. when="attempts>=N" \u2192 needs-human/exit)'}):g.some(x=>Lr(Mr(r,x.from,x.to)))||e.push({level:"warning",code:"graph.loop-escape-unbounded",message:`cycle {${c.join(" \u2192 ")}} escapes, but no escape guard looks bounded (no >=, attempts, max, count, limit)`,where:{node:c[0]},hint:"guard the escape with an explicit bound so the loop provably terminates"})}let u=new Map;for(let c of r.edges){let f=`${c.on??""}|${c.when??""}`;u.has(c.from)||u.set(c.from,new Map);let h=u.get(c.from);h.has(f)||h.set(f,new Set),h.get(f).add(c.to)}for(let[c,f]of u)for(let[h,g]of f)g.size>1&&h!=="|"&&e.push({level:"warning",code:"graph.ambiguous-routing",message:`node '${c}' has multiple edges with identical trigger/guard (${h}) to different targets: ${[...g].join(", ")}`,where:{node:c},hint:"distinguish the guards, or the transition is nondeterministic"});return e}function Mr(r,e,t){return r.edges.find(i=>i.from===e&&i.to===t)?.when}function Lr(r){return r?/(>=|>|attempts|max|count|limit)/i.test(r):!1}function jr(r,e){let t=0,i=new Map,o=new Map,s=new Set,a=[],d=[],u=c=>{i.set(c,t),o.set(c,t),t++,a.push(c),s.add(c);for(let f of e.get(c)??[])i.has(f)?s.has(f)&&o.set(c,Math.min(o.get(c),i.get(f))):(u(f),o.set(c,Math.min(o.get(c),o.get(f))));if(o.get(c)===i.get(c)){let f=[],h;do h=a.pop(),s.delete(h),f.push(h);while(h!==c);d.push(f.reverse())}};for(let c of r)i.has(c)||u(c);return d}R();var Dr=new Set(["pr-review","pr-fix"]);function qr(r,e){return e.labels?.[r]??r}function On(r){return Dr.has(r.type)||r.context==="pr-diff"||r.context==="pr-review"}function Zt(r,e,t){let i=(o,s)=>{r[o]??={},r[o].types??=[],r[o].types.includes(s)||r[o].types.push(s)};switch(e){case"issues.opened":return i("issues","opened");case"issues.labeled":return i("issues","labeled");case"issue_comment.created":return i("issue_comment","created");case"pull_request.opened":return i("pull_request","opened");case"pull_request.synchronize":return i("pull_request","synchronize");case"pull_request.labeled":return i("pull_request","labeled");case"pull_request.closed":return i("pull_request","closed");case"pull_request_review.submitted":return i("pull_request_review","submitted");case"push":if(On(t))return i("pull_request","synchronize");r.push??={};return;case"workflow_dispatch":r.workflow_dispatch??={};return;default:r[e]??={}}}function Sn(r,e){return r==="push"&&On(e)?"pull_request.synchronize":r}function ti(r){let[e,t]=r.split(".");return t?`(github.event_name == '${e}' && github.event.action == '${t}')`:`github.event_name == '${e}'`}function Br(r,e,t){if(r.on)return{events:r.on.split(",").map(s=>s.trim()).filter(Boolean),guard:r.when?vn(r.when,e,t):void 0};if(!r.when)return;let i=r.when;if(i.startsWith("label="))return{events:[On(e)?"pull_request.labeled":"issues.labeled"],guard:vn(i,e,t)};if(i.startsWith("verdict="))return{events:["pull_request_review.submitted"],guard:vn(i,e,t)}}function vn(r,e,t){if(r.startsWith("label="))return`github.event.label.name == '${qr(r.slice(6),t)}'`;let i=r==="verdict=approve"?"APPROVE":r==="verdict=request_changes"?"REQUEST_CHANGES":void 0;if(i){let o=`contains(github.event.review.body, '**Verdict:** ${i}')`,s=Ur(t);return s?`${o} && ${s}`:o}}function Ur(r){let e=r.identity?.bot_login;return e?`github.event.review.user.login == '${e}'`:void 0}function ei(r){return/^(pull_request|pull_request_review|pull_request_target)\b/.test(r)}function Vr(r){let e=r.repo?.branch_prefix;return e?`startsWith(github.event.pull_request.head.ref, '${e}')`:void 0}function ni(r,e,t){let i=Vr(t),o=[...e].filter(ei);if(!i||o.length===0)return r;let s=[...e].filter(d=>!ei(d)),a=s.length?`(${s.map(ti).join(" || ")} || ${i})`:i;return r?`(${r}) && ${a}`:a}function Wr(r){if(r.attrs.schedule!==void 0)return{group:r.id,"cancel-in-progress":!1};let t=On(r)||r.type==="human-gate"?"${{ github.event.pull_request.number }}":"${{ github.event.issue.number }}";return{group:`${r.id}-${t}`,"cancel-in-progress":r.type==="issue-agent"}}function ii(r){let e={},t=new Map(r.nodes.map(s=>[s.id,s])),i=new Map;for(let s of r.nodes)i.set(s.id,[]);for(let s of r.edges)i.get(s.to)?.push(s);let o=Le(r);for(let s of r.nodes){if(s.type==="start"||s.type==="exit"||o.memberIds.has(s.id))continue;let a=o.byFanin.get(s.id);if(a){let $=a.entryEdge,E=t.get(a.legIds[0]),v={},P=($.on??"").split(",").map(K=>K.trim()).filter(Boolean);for(let K of P)Zt(v,K,E);let M={nodeId:s.id,triggers:v,dispatches:[]},j=new Set(P.map(K=>Sn(K,E))),D=ni($.when?vn($.when,E,r.config):void 0,j,r.config);D&&(M.guard=D);let oe=P.some(K=>Sn(K,E).startsWith("pull_request"))?"${{ github.event.pull_request.number }}":"${{ github.event.issue.number }}";M.concurrency={group:`${s.id}-${oe}`,"cancel-in-progress":!1},e[s.id]=M;continue}if(s.type==="parallel"||s.type==="fan_in")continue;let d={},u=new Set,c=new Set,f=new Set,h=[];if(s.attrs.schedule!==void 0)d.schedule=[{cron:String(s.attrs.schedule)}],d.workflow_dispatch={};else{for(let $ of i.get(s.id)??[]){let E=Br($,s,r.config);if(E){for(let v of E.events)Zt(d,v,s);for(let v of E.events)f.add(Sn(v,s));if(E.guard)u.add(E.guard);else for(let v of E.events)c.add(Sn(v,s))}}if(u.size&&c.size)for(let $ of c)u.add(ti($))}for(let $ of r.edges)$.from===s.id&&$.do&&h.push({toNode:$.to,when:$.when});let g=ni(u.size?[...u].join(" || "):void 0,f,r.config),x={nodeId:s.id,triggers:d,dispatches:h};g&&(x.guard=g),Object.keys(d).length&&(x.concurrency=Wr(s)),e[s.id]=x}return{perNode:e}}R();R();function Gr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ie={},$n={},Ce={},ri;function Ze(){if(ri)return Ce;ri=1;function r(a){return typeof a>"u"||a===null}function e(a){return typeof a=="object"&&a!==null}function t(a){return Array.isArray(a)?a:r(a)?[]:[a]}function i(a,d){if(d){let u=Object.keys(d);for(let c=0,f=u.length;c<f;c+=1){let h=u[c];a[h]=d[h]}}return a}function o(a,d){let u="";for(let c=0;c<d;c+=1)u+=a;return u}function s(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}return Ce.isNothing=r,Ce.isObject=e,Ce.toArray=t,Ce.repeat=o,Ce.isNegativeZero=s,Ce.extend=i,Ce}var ot,oi;function en(){if(oi)return ot;oi=1;function r(t,i){let o="",s=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(o+='in "'+t.mark.name+'" '),o+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!i&&t.mark.snippet&&(o+=`
23
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(o=>t.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Dt(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",o="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?o=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],o=s[4]),t&&o!=="0"?`${t}=${i}:${parseInt(o)+1}`:e})}qt.Command=nt});var Wt=Ce(le=>{"use strict";I();var{Argument:Ut}=An(),{Command:tt}=Bt(),{CommanderError:Tr,InvalidArgumentError:Vt}=Je(),{Help:Nr}=Yn(),{Option:Gt}=Xn();le.program=new tt;le.createCommand=r=>new tt(r);le.createOption=(r,e)=>new Gt(r,e);le.createArgument=(r,e)=>new Ut(r,e);le.Command=tt;le.Option=Gt;le.Argument=Ut;le.Help=Nr;le.CommanderError=Tr;le.InvalidArgumentError=Vt;le.InvalidOptionArgumentError=Vt});var Cn=Ce((es,it)=>{"use strict";I();var kn=process||{},Jt=kn.argv||[],xn=kn.env||{},Hr=!(xn.NO_COLOR||Jt.includes("--no-color"))&&(!!xn.FORCE_COLOR||Jt.includes("--color")||kn.platform==="win32"||(kn.stdout||{}).isTTY&&xn.TERM!=="dumb"||!!xn.CI),Rr=(r,e,t=r)=>i=>{let o=""+i,s=o.indexOf(e,r.length);return~s?r+Ir(o,e,t,s)+e:r+o+e},Ir=(r,e,t,i)=>{let o="",s=0;do o+=r.substring(s,i)+t,s=i+e.length,i=r.indexOf(e,s);while(~i);return o+r.substring(s)},zt=(r=Hr)=>{let e=r?Rr:()=>String;return{isColorSupported:r,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};it.exports=zt();it.exports.createColors=zt});I();I();var Yt=wn(Wt(),1),{program:Bo,createCommand:Uo,createArgument:Vo,createOption:Go,CommanderError:Wo,InvalidArgumentError:Yo,InvalidOptionArgumentError:Ko,Command:Kt,Argument:Jo,Option:zo,Help:Xo}=Yt.default;var Q=wn(Cn(),1),lr=require("child_process"),Y=require("fs"),ne=require("path");I();I();I();var En=["analyst","issue-agent","producer","pr-review","pr-fix","scheduled-agent"];function Xt(r){return r.uses!==void 0}I();function ze(r){let e=r.auth;return e?.mode?{mode:e.mode,appIdSecret:e.app_id_secret??r.identity.app_id_secret,appKeySecret:e.app_key_secret??r.identity.app_key_secret,tokenSecret:e.token_secret}:r.identity.app_id_secret&&r.identity.app_key_secret?{mode:"app",appIdSecret:r.identity.app_id_secret,appKeySecret:r.identity.app_key_secret}:{mode:"github-token"}}I();var Pr=new Set(En);function je(r){let e=new Map(r.nodes.map(a=>[a.id,a])),t=new Map,i=new Map;for(let a of r.nodes)t.set(a.id,[]),i.set(a.id,[]);for(let a of r.edges)t.get(a.to)?.push(a),i.get(a.from)?.push(a);let o=new Map,s=new Set;for(let a of r.nodes){if(a.type!=="fan_in")continue;let d=t.get(a.id)??[];if(d.length<2)continue;let u=[],c,f=!0;for(let $ of d){let E=e.get($.from);if(!E||!Pr.has(E.type)){f=!1;break}let v=t.get(E.id)??[],P=i.get(E.id)??[];if(v.length!==1||P.length!==1||P[0].to!==a.id){f=!1;break}let M=e.get(v[0].from);if(!M||M.type!=="parallel"){f=!1;break}if(v[0].on||v[0].when){f=!1;break}if(c===void 0)c=M.id;else if(c!==M.id){f=!1;break}u.push(E.id)}if(!f||c===void 0)continue;let h=t.get(c)??[],g=i.get(c)??[];if(h.length!==1||!h[0].on)continue;let x=new Set(u);if(!(!g.every($=>x.has($.to))||g.length!==u.length)){o.set(a.id,{parallelId:c,entryEdge:h[0],legIds:u,faninId:a.id}),s.add(c);for(let $ of u)s.add($)}}return{byFanin:o,memberIds:s}}var rt=new Set(En);function Xe(r,e={}){let t=[],i=new Map(r.nodes.map(a=>[a.id,a]));for(let a of r.nodes)a.declared||t.push({level:"error",code:"node.undeclared",message:`node '${a.id}' is referenced in an edge but never declared`,where:{node:a.id,line:a.line},hint:`add a node statement, e.g. ${a.id} [type=...]`});for(let a of r.nodes)rt.has(a.type)&&!a.files.role&&t.push({level:"error",code:"node.missing-role",message:`agent node '${a.id}' (type ${a.type}) needs a role="..." job description`,where:{node:a.id,line:a.line}}),a.type==="human-gate"&&a.attrs.environment===void 0&&t.push({level:"error",code:"node.human-gate-no-environment",message:`human-gate '${a.id}' must set environment=<name> (maps to a protected GitHub Environment)`,where:{node:a.id,line:a.line}}),a.type==="merge-gate"&&!a.files.policy&&t.push({level:"warning",code:"node.merge-gate-no-policy",message:`merge-gate '${a.id}' has no policy="..."; default merge policy will be used`,where:{node:a.id,line:a.line}});if(e.fileExists)for(let a of r.nodes)for(let d of["role","policy","prompt","tools"]){let u=a.files[d];u&&!e.fileExists(u)&&t.push({level:"error",code:"file.missing",message:`node '${a.id}' references ${d}="${u}" which does not exist`,where:{node:a.id,line:a.line,file:u}})}if(e.roles){let a=new Map;for(let u of r.nodes)a.set(u.id,[]);for(let u of r.edges){let c=i.get(u.to);c&&a.get(u.from)?.push({node:c,edge:u})}let d=u=>(e.roles?.get(u.id)?.role??u.id).toLowerCase();for(let u of r.nodes){let c=e.roles.get(u.id);if(!c?.handoffs)continue;let f=a.get(u.id)??[],h=new Set(f.flatMap(x=>[x.node.id.toLowerCase(),d(x.node)])),g=new Set(c.handoffs.map(x=>String(x.to).toLowerCase()));for(let x of c.handoffs)h.has(String(x.to).toLowerCase())||t.push({level:"warning",code:"role.handoff-no-edge",message:`role '${c.role}' (node '${u.id}') declares a handoff to '${x.to}' but there is no matching out-edge`,where:{node:u.id},hint:"add the edge, or remove the handoff so the job description matches the graph"});for(let{node:x,edge:$}of f)x.type==="exit"&&!$.when||!g.has(x.id.toLowerCase())&&!g.has(d(x))&&t.push({level:"warning",code:"role.edge-no-handoff",message:`node '${u.id}' has an out-edge to '${x.id}' not declared as a handoff in role '${c.role}'`,where:{node:u.id,edge:[u.id,x.id]},hint:"document the handoff in the role, or remove the edge"})}}let o=(a,d)=>{if(typeof a=="string"){let u=a.match(/<[A-Za-z][^<>]{0,80}>/);u&&t.push({level:"error",code:"config.placeholder",message:`config value ${d} still contains the placeholder ${u[0]} \u2014 fill it in foundry.config.yaml`,hint:"generated workflows would be broken until every <placeholder> is replaced"})}else if(Array.isArray(a))a.forEach((u,c)=>o(u,`${d}[${c}]`));else if(a&&typeof a=="object")for(let[u,c]of Object.entries(a))o(c,d?`${d}.${u}`:u)};if(o(r.config,""),e.fileExists&&(r.config.runtime?.mode??"pinned")==="vendored"){let a=new Set,d=!1;for(let u of r.nodes)rt.has(u.type)&&(d=!0,a.add("run-agent")),rt.has(u.type)&&u.type!=="scheduled-agent"&&a.add("agent-context"),(u.type==="producer"||u.type==="scheduled-agent")&&a.add("agent-fallback"),u.type==="merge-gate"&&a.add("merge-gate"),u.type==="pr-review"&&u.attrs.gates!==void 0&&a.add("wait-for-checks");for(let u of a)e.fileExists(`actions/${u}/action.yml`)||t.push({level:"warning",code:"runtime.action-not-vendored",message:`runtime.mode is 'vendored' but .github/actions/${u}/ is missing`,hint:"run `gp-foundry vendor` to copy the runtime actions into the repo"});d&&!e.fileExists("agent-setup/action.yml")&&t.push({level:"warning",code:"runtime.agent-setup-missing",message:"generated agent jobs use ./.github/agent-setup, which does not exist",hint:"run `gp-foundry vendor` (or `gp-foundry init`) to scaffold the agent-setup shim"})}{let{byFanin:a,memberIds:d}=je(r);for(let u of r.nodes)if(u.type==="parallel"&&!d.has(u.id)&&t.push({level:"error",code:"diamond.malformed",message:`parallel '${u.id}' is not part of a clean diamond (need: exactly one in-edge carrying on=, \u22652 bare out-edges to agent legs that each flow into one fan_in)`,where:{node:u.id,line:u.line},hint:"see reference/node-types.md \u2014 v1 supports clean parallel\u2192legs\u2192fan_in diamonds only"}),u.type==="fan_in"){let c=a.get(u.id);if(!c)t.push({level:"error",code:"diamond.malformed",message:`fan_in '${u.id}' is not the join of a clean diamond (need \u22652 legs, each with exactly one in-edge from a shared parallel and one out-edge into this fan_in)`,where:{node:u.id,line:u.line},hint:"see reference/node-types.md \u2014 v1 supports clean parallel\u2192legs\u2192fan_in diamonds only"});else{!u.files.role&&u.attrs.on_complete_label===void 0&&t.push({level:"error",code:"diamond.unobservable-join",message:`fan_in '${u.id}' has neither a role nor on_complete_label \u2014 its completion would be unobservable`,where:{node:u.id,line:u.line},hint:'give it a role="..." (synthesize the lanes) and/or on_complete_label=<label> to cascade the next stage'});let f=c.legIds.filter(h=>i.get(h)?.type==="pr-review");f.length&&t.push({level:"warning",code:"diamond.lane-verdict-risk",message:`fan_in '${u.id}' lanes [${f.join(", ")}] are pr-review typed \u2014 if a lane role posts a '**Verdict:**' review, the merge gate acts on ONE lane's opinion and the join is bypassed`,where:{node:u.id},hint:"lane roles must post ANALYSES (plain comments); only the fan_in role posts the verdict"})}}}if(ze(r.config).mode==="github-token"){let a=r.edges.filter(d=>/^(pull_request\.opened|pull_request\.synchronize|push)/.test(d.on??"")||/^(label=|verdict=)/.test(d.when??""));a.length&&t.push({level:r.config.auth?.mode==="github-token"?"error":"warning",code:"auth.github-token-no-cascade",message:`auth mode 'github-token': commits/PRs made with GITHUB_TOKEN do not trigger other workflows, so ${a.length} event-cascade edge(s) (pull_request.opened/synchronize/push) will not fire and the harness will stall`,hint:"use auth.mode 'app' or 'pat' (a fine-grained PAT secret), or drive those stages via explicit dispatch"})}return!r.config.identity?.bot_login&&r.edges.some(a=>/^verdict=/.test(a.when??""))&&t.push({level:"warning",code:"auth.no-bot-login",message:"identity.bot_login is unset, so verdict-triggered workflows (fixer, human-gate) guard only on the verdict marker \u2014 any user who can review the PR can fire them",hint:"set identity.bot_login in foundry.config.yaml to the login that posts the reviews"}),r.nodes.some(a=>a.type==="start"||a.attrs.schedule!==void 0||a.type==="merge-gate")||t.push({level:"warning",code:"graph.no-entry",message:"harness has no entry node (a start node or a scheduled node) \u2014 nothing will trigger it"}),t}I();var Fr=new Set(["exit","merge-gate","human-gate","scheduled-agent","fan_in"]),Qt=new Set(["start"]);function Qe(r){let e=[],t=new Set(r.nodes.map(c=>c.id)),i=new Map(r.nodes.map(c=>[c.id,c])),o=new Map;for(let c of t)o.set(c,[]);for(let c of r.edges)t.has(c.from)&&t.has(c.to)&&o.get(c.from).push(c.to);let s=r.nodes.filter(c=>Qt.has(c.type)||c.attrs.schedule!==void 0||c.type==="merge-gate"),a=new Set,d=s.map(c=>c.id);for(;d.length;){let c=d.pop();if(!a.has(c)){a.add(c);for(let f of o.get(c)??[])d.push(f)}}for(let c of r.nodes)!a.has(c.id)&&!Qt.has(c.type)&&e.push({level:"warning",code:"graph.unreachable",message:`node '${c.id}' is unreachable from any entry (start/scheduled) node`,where:{node:c.id,line:c.line},hint:"add an incoming edge, a schedule=, or a start node that leads here"});for(let c of r.nodes)(o.get(c.id)??[]).length===0&&!Fr.has(c.type)&&e.push({level:"warning",code:"graph.dead-end",message:`node '${c.id}' (type ${c.type}) has no outgoing edge and is not a sink (exit/merge-gate/human-gate)`,where:{node:c.id,line:c.line},hint:"route it to a next node, or make it an exit"});for(let c of Lr(t,o)){if(!(c.length>1||(o.get(c[0])??[]).includes(c[0])))continue;let h=new Set(c),g=[];for(let x of c)for(let $ of o.get(x)??[])h.has($)||g.push({from:x,to:$});g.length===0?e.push({level:"error",code:"graph.unbounded-loop",message:`cycle {${c.join(" \u2192 ")}} has no escape edge \u2014 this is a livelock`,where:{node:c[0]},hint:'add a bounded escape edge (e.g. when="attempts>=N" \u2192 needs-human/exit)'}):g.some(x=>jr(Mr(r,x.from,x.to)))||e.push({level:"warning",code:"graph.loop-escape-unbounded",message:`cycle {${c.join(" \u2192 ")}} escapes, but no escape guard looks bounded (no >=, attempts, max, count, limit)`,where:{node:c[0]},hint:"guard the escape with an explicit bound so the loop provably terminates"})}let u=new Map;for(let c of r.edges){let f=`${c.on??""}|${c.when??""}`;u.has(c.from)||u.set(c.from,new Map);let h=u.get(c.from);h.has(f)||h.set(f,new Set),h.get(f).add(c.to)}for(let[c,f]of u)for(let[h,g]of f)g.size>1&&h!=="|"&&e.push({level:"warning",code:"graph.ambiguous-routing",message:`node '${c}' has multiple edges with identical trigger/guard (${h}) to different targets: ${[...g].join(", ")}`,where:{node:c},hint:"distinguish the guards, or the transition is nondeterministic"});return e}function Mr(r,e,t){return r.edges.find(i=>i.from===e&&i.to===t)?.when}function jr(r){return r?/(>=|>|attempts|max|count|limit)/i.test(r):!1}function Lr(r,e){let t=0,i=new Map,o=new Map,s=new Set,a=[],d=[],u=c=>{i.set(c,t),o.set(c,t),t++,a.push(c),s.add(c);for(let f of e.get(c)??[])i.has(f)?s.has(f)&&o.set(c,Math.min(o.get(c),i.get(f))):(u(f),o.set(c,Math.min(o.get(c),o.get(f))));if(o.get(c)===i.get(c)){let f=[],h;do h=a.pop(),s.delete(h),f.push(h);while(h!==c);d.push(f.reverse())}};for(let c of r)i.has(c)||u(c);return d}I();var Dr=new Set(["pr-review","pr-fix"]);function qr(r,e){return e.labels?.[r]??r}function On(r){return Dr.has(r.type)||r.context==="pr-diff"||r.context==="pr-review"}function Zt(r,e,t){let i=(o,s)=>{r[o]??={},r[o].types??=[],r[o].types.includes(s)||r[o].types.push(s)};switch(e){case"issues.opened":return i("issues","opened");case"issues.labeled":return i("issues","labeled");case"issue_comment.created":return i("issue_comment","created");case"pull_request.opened":return i("pull_request","opened");case"pull_request.synchronize":return i("pull_request","synchronize");case"pull_request.labeled":return i("pull_request","labeled");case"pull_request.closed":return i("pull_request","closed");case"pull_request_review.submitted":return i("pull_request_review","submitted");case"push":if(On(t))return i("pull_request","synchronize");r.push??={};return;case"workflow_dispatch":r.workflow_dispatch??={};return;default:r[e]??={}}}function Sn(r,e){return r==="push"&&On(e)?"pull_request.synchronize":r}function ti(r){let[e,t]=r.split(".");return t?`(github.event_name == '${e}' && github.event.action == '${t}')`:`github.event_name == '${e}'`}function Br(r,e,t){if(r.on)return{events:r.on.split(",").map(s=>s.trim()).filter(Boolean),guard:r.when?vn(r.when,e,t):void 0};if(!r.when)return;let i=r.when;if(i.startsWith("label="))return{events:[On(e)?"pull_request.labeled":"issues.labeled"],guard:vn(i,e,t)};if(i.startsWith("verdict="))return{events:["pull_request_review.submitted"],guard:vn(i,e,t)}}function vn(r,e,t){if(r.startsWith("label="))return`github.event.label.name == '${qr(r.slice(6),t)}'`;let i=r==="verdict=approve"?"APPROVE":r==="verdict=request_changes"?"REQUEST_CHANGES":void 0;if(i){let o=`contains(github.event.review.body, '**Verdict:** ${i}')`,s=Ur(t);return s?`${o} && ${s}`:o}}function Ur(r){let e=r.identity?.bot_login;return e?`github.event.review.user.login == '${e}'`:void 0}function ei(r){return/^(pull_request|pull_request_review|pull_request_target)\b/.test(r)}function Vr(r){let e=r.repo?.branch_prefix;return e?`startsWith(github.event.pull_request.head.ref, '${e}')`:void 0}function ni(r,e,t){let i=Vr(t),o=[...e].filter(ei);if(!i||o.length===0)return r;let s=[...e].filter(d=>!ei(d)),a=s.length?`(${s.map(ti).join(" || ")} || ${i})`:i;return r?`(${r}) && ${a}`:a}function Gr(r){if(r.attrs.schedule!==void 0)return{group:r.id,"cancel-in-progress":!1};let t=On(r)||r.type==="human-gate"?"${{ github.event.pull_request.number }}":"${{ github.event.issue.number }}";return{group:`${r.id}-${t}`,"cancel-in-progress":r.type==="issue-agent"}}function ii(r){let e={},t=new Map(r.nodes.map(s=>[s.id,s])),i=new Map;for(let s of r.nodes)i.set(s.id,[]);for(let s of r.edges)i.get(s.to)?.push(s);let o=je(r);for(let s of r.nodes){if(s.type==="start"||s.type==="exit"||o.memberIds.has(s.id))continue;let a=o.byFanin.get(s.id);if(a){let $=a.entryEdge,E=t.get(a.legIds[0]),v={},P=($.on??"").split(",").map(K=>K.trim()).filter(Boolean);for(let K of P)Zt(v,K,E);let M={nodeId:s.id,triggers:v,dispatches:[]},L=new Set(P.map(K=>Sn(K,E))),D=ni($.when?vn($.when,E,r.config):void 0,L,r.config);D&&(M.guard=D);let oe=P.some(K=>Sn(K,E).startsWith("pull_request"))?"${{ github.event.pull_request.number }}":"${{ github.event.issue.number }}";M.concurrency={group:`${s.id}-${oe}`,"cancel-in-progress":!1},e[s.id]=M;continue}if(s.type==="parallel"||s.type==="fan_in")continue;let d={},u=new Set,c=new Set,f=new Set,h=[];if(s.attrs.schedule!==void 0)d.schedule=[{cron:String(s.attrs.schedule)}],d.workflow_dispatch={};else{for(let $ of i.get(s.id)??[]){let E=Br($,s,r.config);if(E){for(let v of E.events)Zt(d,v,s);for(let v of E.events)f.add(Sn(v,s));if(E.guard)u.add(E.guard);else for(let v of E.events)c.add(Sn(v,s))}}if(u.size&&c.size)for(let $ of c)u.add(ti($))}for(let $ of r.edges)$.from===s.id&&$.do&&h.push({toNode:$.to,when:$.when});let g=ni(u.size?[...u].join(" || "):void 0,f,r.config),x={nodeId:s.id,triggers:d,dispatches:h};g&&(x.guard=g),Object.keys(d).length&&(x.concurrency=Gr(s)),e[s.id]=x}return{perNode:e}}I();I();function Wr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ie={},$n={},Ee={},ri;function Ze(){if(ri)return Ee;ri=1;function r(a){return typeof a>"u"||a===null}function e(a){return typeof a=="object"&&a!==null}function t(a){return Array.isArray(a)?a:r(a)?[]:[a]}function i(a,d){if(d){let u=Object.keys(d);for(let c=0,f=u.length;c<f;c+=1){let h=u[c];a[h]=d[h]}}return a}function o(a,d){let u="";for(let c=0;c<d;c+=1)u+=a;return u}function s(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}return Ee.isNothing=r,Ee.isObject=e,Ee.toArray=t,Ee.repeat=o,Ee.isNegativeZero=s,Ee.extend=i,Ee}var ot,oi;function en(){if(oi)return ot;oi=1;function r(t,i){let o="",s=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(o+='in "'+t.mark.name+'" '),o+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!i&&t.mark.snippet&&(o+=`
24
24
 
25
25
  `+t.mark.snippet),s+" "+o):s}function e(t,i){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=i,this.message=r(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(i){return this.name+": "+r(this,i)},ot=e,ot}var st,si;function Yr(){if(si)return st;si=1;let r=Ze();function e(o,s,a,d,u){let c="",f="",h=Math.floor(u/2)-1;return d-s>h&&(c=" ... ",s=d-h+c.length),a-d>h&&(f=" ...",a=d+h-f.length),{str:c+o.slice(s,a).replace(/\t/g,"\u2192")+f,pos:d-s+c.length}}function t(o,s){return r.repeat(" ",s-o.length)+o}function i(o,s){if(s=Object.create(s||null),!o.buffer)return null;s.maxLength||(s.maxLength=79),typeof s.indent!="number"&&(s.indent=1),typeof s.linesBefore!="number"&&(s.linesBefore=3),typeof s.linesAfter!="number"&&(s.linesAfter=2);let a=/\r?\n|\r|\0/g,d=[0],u=[],c,f=-1;for(;c=a.exec(o.buffer);)u.push(c.index),d.push(c.index+c[0].length),o.position<=c.index&&f<0&&(f=d.length-2);f<0&&(f=d.length-1);let h="",g=Math.min(o.line+s.linesAfter,u.length).toString().length,x=s.maxLength-(s.indent+g+3);for(let E=1;E<=s.linesBefore&&!(f-E<0);E++){let v=e(o.buffer,d[f-E],u[f-E],o.position-(d[f]-d[f-E]),x);h=r.repeat(" ",s.indent)+t((o.line-E+1).toString(),g)+" | "+v.str+`
26
26
  `+h}let $=e(o.buffer,d[f],u[f],o.position,x);h+=r.repeat(" ",s.indent)+t((o.line+1).toString(),g)+" | "+$.str+`
27
27
  `,h+=r.repeat("-",s.indent+g+3+$.pos)+`^
28
28
  `;for(let E=1;E<=s.linesAfter&&!(f+E>=u.length);E++){let v=e(o.buffer,d[f+E],u[f+E],o.position-(d[f]-d[f+E]),x);h+=r.repeat(" ",s.indent)+t((o.line+E+1).toString(),g)+" | "+v.str+`
29
- `}return h.replace(/\n$/,"")}return st=i,st}var at,ai;function re(){if(ai)return at;ai=1;let r=en(),e=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],t=["scalar","sequence","mapping"];function i(s){let a={};return s!==null&&Object.keys(s).forEach(function(d){s[d].forEach(function(u){a[String(u)]=d})}),a}function o(s,a){if(a=a||{},Object.keys(a).forEach(function(d){if(e.indexOf(d)===-1)throw new r('Unknown option "'+d+'" is met in definition of "'+s+'" YAML type.')}),this.options=a,this.tag=s,this.kind=a.kind||null,this.resolve=a.resolve||function(){return!0},this.construct=a.construct||function(d){return d},this.instanceOf=a.instanceOf||null,this.predicate=a.predicate||null,this.represent=a.represent||null,this.representName=a.representName||null,this.defaultStyle=a.defaultStyle||null,this.multi=a.multi||!1,this.styleAliases=i(a.styleAliases||null),t.indexOf(this.kind)===-1)throw new r('Unknown kind "'+this.kind+'" is specified for "'+s+'" YAML type.')}return at=o,at}var lt,li;function $i(){if(li)return lt;li=1;let r=en(),e=re();function t(s,a){let d=[];return s[a].forEach(function(u){let c=d.length;d.forEach(function(f,h){f.tag===u.tag&&f.kind===u.kind&&f.multi===u.multi&&(c=h)}),d[c]=u}),d}function i(){let s={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(d){d.multi?(s.multi[d.kind].push(d),s.multi.fallback.push(d)):s[d.kind][d.tag]=s.fallback[d.tag]=d}for(let d=0,u=arguments.length;d<u;d+=1)arguments[d].forEach(a);return s}function o(s){return this.extend(s)}return o.prototype.extend=function(a){let d=[],u=[];if(a instanceof e)u.push(a);else if(Array.isArray(a))u=u.concat(a);else if(a&&(Array.isArray(a.implicit)||Array.isArray(a.explicit)))a.implicit&&(d=d.concat(a.implicit)),a.explicit&&(u=u.concat(a.explicit));else throw new r("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");d.forEach(function(f){if(!(f instanceof e))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(f.loadKind&&f.loadKind!=="scalar")throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(f.multi)throw new r("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),u.forEach(function(f){if(!(f instanceof e))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let c=Object.create(o.prototype);return c.implicit=(this.implicit||[]).concat(d),c.explicit=(this.explicit||[]).concat(u),c.compiledImplicit=t(c,"implicit"),c.compiledExplicit=t(c,"explicit"),c.compiledTypeMap=i(c.compiledImplicit,c.compiledExplicit),c},lt=o,lt}var ct,ci;function Ti(){if(ci)return ct;ci=1;let r=re();return ct=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),ct}var ut,ui;function Ni(){if(ui)return ut;ui=1;let r=re();return ut=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),ut}var dt,di;function Hi(){if(di)return dt;di=1;let r=re();return dt=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),dt}var ft,fi;function Ii(){if(fi)return ft;fi=1;let r=$i();return ft=new r({explicit:[Ti(),Ni(),Hi()]}),ft}var pt,pi;function Ri(){if(pi)return pt;pi=1;let r=re();function e(o){if(o===null)return!0;let s=o.length;return s===1&&o==="~"||s===4&&(o==="null"||o==="Null"||o==="NULL")}function t(){return null}function i(o){return o===null}return pt=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:e,construct:t,predicate:i,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),pt}var ht,hi;function Pi(){if(hi)return ht;hi=1;let r=re();function e(o){if(o===null)return!1;let s=o.length;return s===4&&(o==="true"||o==="True"||o==="TRUE")||s===5&&(o==="false"||o==="False"||o==="FALSE")}function t(o){return o==="true"||o==="True"||o==="TRUE"}function i(o){return Object.prototype.toString.call(o)==="[object Boolean]"}return ht=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:e,construct:t,predicate:i,represent:{lowercase:function(o){return o?"true":"false"},uppercase:function(o){return o?"TRUE":"FALSE"},camelcase:function(o){return o?"True":"False"}},defaultStyle:"lowercase"}),ht}var mt,mi;function Fi(){if(mi)return mt;mi=1;let r=Ze(),e=re();function t(c){return c>=48&&c<=57||c>=65&&c<=70||c>=97&&c<=102}function i(c){return c>=48&&c<=55}function o(c){return c>=48&&c<=57}function s(c){if(c===null)return!1;let f=c.length,h=0,g=!1;if(!f)return!1;let x=c[h];if((x==="-"||x==="+")&&(x=c[++h]),x==="0"){if(h+1===f)return!0;if(x=c[++h],x==="b"){for(h++;h<f;h++){if(x=c[h],x!=="0"&&x!=="1")return!1;g=!0}return g&&isFinite(a(c))}if(x==="x"){for(h++;h<f;h++){if(!t(c.charCodeAt(h)))return!1;g=!0}return g&&isFinite(a(c))}if(x==="o"){for(h++;h<f;h++){if(!i(c.charCodeAt(h)))return!1;g=!0}return g&&isFinite(a(c))}}for(;h<f;h++){if(!o(c.charCodeAt(h)))return!1;g=!0}return g?isFinite(a(c)):!1}function a(c){let f=c,h=1,g=f[0];if((g==="-"||g==="+")&&(g==="-"&&(h=-1),f=f.slice(1),g=f[0]),f==="0")return 0;if(g==="0"){if(f[1]==="b")return h*parseInt(f.slice(2),2);if(f[1]==="x")return h*parseInt(f.slice(2),16);if(f[1]==="o")return h*parseInt(f.slice(2),8)}return h*parseInt(f,10)}function d(c){return a(c)}function u(c){return Object.prototype.toString.call(c)==="[object Number]"&&c%1===0&&!r.isNegativeZero(c)}return mt=new e("tag:yaml.org,2002:int",{kind:"scalar",resolve:s,construct:d,predicate:u,represent:{binary:function(c){return c>=0?"0b"+c.toString(2):"-0b"+c.toString(2).slice(1)},octal:function(c){return c>=0?"0o"+c.toString(8):"-0o"+c.toString(8).slice(1)},decimal:function(c){return c.toString(10)},hexadecimal:function(c){return c>=0?"0x"+c.toString(16).toUpperCase():"-0x"+c.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),mt}var gt,gi;function Mi(){if(gi)return gt;gi=1;let r=Ze(),e=re(),t=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),i=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function o(c){return c===null||!t.test(c)?!1:isFinite(parseFloat(c,10))?!0:i.test(c)}function s(c){let f=c.toLowerCase(),h=f[0]==="-"?-1:1;return"+-".indexOf(f[0])>=0&&(f=f.slice(1)),f===".inf"?h===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:f===".nan"?NaN:h*parseFloat(f,10)}let a=/^[-+]?[0-9]+e/;function d(c,f){if(isNaN(c))switch(f){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===c)switch(f){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===c)switch(f){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(c))return"-0.0";let h=c.toString(10);return a.test(h)?h.replace("e",".e"):h}function u(c){return Object.prototype.toString.call(c)==="[object Number]"&&(c%1!==0||r.isNegativeZero(c))}return gt=new e("tag:yaml.org,2002:float",{kind:"scalar",resolve:o,construct:s,predicate:u,represent:d,defaultStyle:"lowercase"}),gt}var bt,bi;function Li(){return bi||(bi=1,bt=Ii().extend({implicit:[Ri(),Pi(),Fi(),Mi()]})),bt}var yt,yi;function ji(){return yi||(yi=1,yt=Li()),yt}var wt,wi;function Di(){if(wi)return wt;wi=1;let r=re(),e=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function i(a){return a===null?!1:e.exec(a)!==null||t.exec(a)!==null}function o(a){let d=0,u=null,c=e.exec(a);if(c===null&&(c=t.exec(a)),c===null)throw new Error("Date resolve error");let f=+c[1],h=+c[2]-1,g=+c[3];if(!c[4])return new Date(Date.UTC(f,h,g));let x=+c[4],$=+c[5],E=+c[6];if(c[7]){for(d=c[7].slice(0,3);d.length<3;)d+="0";d=+d}if(c[9]){let P=+c[10],M=+(c[11]||0);u=(P*60+M)*6e4,c[9]==="-"&&(u=-u)}let v=new Date(Date.UTC(f,h,g,x,$,E,d));return u&&v.setTime(v.getTime()-u),v}function s(a){return a.toISOString()}return wt=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:i,construct:o,instanceOf:Date,represent:s}),wt}var _t,_i;function qi(){if(_i)return _t;_i=1;let r=re();function e(t){return t==="<<"||t===null}return _t=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:e}),_t}var At,Ai;function Bi(){if(Ai)return At;Ai=1;let r=re(),e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
30
- \r`;function t(a){if(a===null)return!1;let d=0,u=a.length,c=e;for(let f=0;f<u;f++){let h=c.indexOf(a.charAt(f));if(!(h>64)){if(h<0)return!1;d+=6}}return d%8===0}function i(a){let d=a.replace(/[\r\n=]/g,""),u=d.length,c=e,f=0,h=[];for(let x=0;x<u;x++)x%4===0&&x&&(h.push(f>>16&255),h.push(f>>8&255),h.push(f&255)),f=f<<6|c.indexOf(d.charAt(x));let g=u%4*6;return g===0?(h.push(f>>16&255),h.push(f>>8&255),h.push(f&255)):g===18?(h.push(f>>10&255),h.push(f>>2&255)):g===12&&h.push(f>>4&255),new Uint8Array(h)}function o(a){let d="",u=0,c=a.length,f=e;for(let g=0;g<c;g++)g%3===0&&g&&(d+=f[u>>18&63],d+=f[u>>12&63],d+=f[u>>6&63],d+=f[u&63]),u=(u<<8)+a[g];let h=c%3;return h===0?(d+=f[u>>18&63],d+=f[u>>12&63],d+=f[u>>6&63],d+=f[u&63]):h===2?(d+=f[u>>10&63],d+=f[u>>4&63],d+=f[u<<2&63],d+=f[64]):h===1&&(d+=f[u>>2&63],d+=f[u<<4&63],d+=f[64],d+=f[64]),d}function s(a){return Object.prototype.toString.call(a)==="[object Uint8Array]"}return At=new r("tag:yaml.org,2002:binary",{kind:"scalar",resolve:t,construct:i,predicate:s,represent:o}),At}var xt,xi;function Ui(){if(xi)return xt;xi=1;let r=re(),e=Object.prototype.hasOwnProperty,t=Object.prototype.toString;function i(s){if(s===null)return!0;let a=[],d=s;for(let u=0,c=d.length;u<c;u+=1){let f=d[u],h=!1;if(t.call(f)!=="[object Object]")return!1;let g;for(g in f)if(e.call(f,g))if(!h)h=!0;else return!1;if(!h)return!1;if(a.indexOf(g)===-1)a.push(g);else return!1}return!0}function o(s){return s!==null?s:[]}return xt=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:i,construct:o}),xt}var kt,ki;function Vi(){if(ki)return kt;ki=1;let r=re(),e=Object.prototype.toString;function t(o){if(o===null)return!0;let s=o,a=new Array(s.length);for(let d=0,u=s.length;d<u;d+=1){let c=s[d];if(e.call(c)!=="[object Object]")return!1;let f=Object.keys(c);if(f.length!==1)return!1;a[d]=[f[0],c[f[0]]]}return!0}function i(o){if(o===null)return[];let s=o,a=new Array(s.length);for(let d=0,u=s.length;d<u;d+=1){let c=s[d],f=Object.keys(c);a[d]=[f[0],c[f[0]]]}return a}return kt=new r("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:t,construct:i}),kt}var Ct,Ci;function Wi(){if(Ci)return Ct;Ci=1;let r=re(),e=Object.prototype.hasOwnProperty;function t(o){if(o===null)return!0;let s=o;for(let a in s)if(e.call(s,a)&&s[a]!==null)return!1;return!0}function i(o){return o!==null?o:{}}return Ct=new r("tag:yaml.org,2002:set",{kind:"mapping",resolve:t,construct:i}),Ct}var Et,Ei;function vt(){return Ei||(Ei=1,Et=ji().extend({implicit:[Di(),qi()],explicit:[Bi(),Ui(),Vi(),Wi()]})),Et}var Si;function Kr(){if(Si)return $n;Si=1;let r=Ze(),e=en(),t=Yr(),i=vt(),o=Object.prototype.hasOwnProperty,s=1,a=2,d=3,u=4,c=1,f=2,h=3,g=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,x=/[\x85\u2028\u2029]/,$=/[,\[\]{}]/,E=/^(?:!|!!|![0-9A-Za-z-]+!)$/,v=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function P(n){return Object.prototype.toString.call(n)}function M(n){return n===10||n===13}function j(n){return n===9||n===32}function D(n){return n===9||n===32||n===10||n===13}function Z(n){return n===44||n===91||n===93||n===123||n===125}function oe(n){if(n>=48&&n<=57)return n-48;let p=n|32;return p>=97&&p<=102?p-97+10:-1}function K(n){return n===120?2:n===117?4:n===85?8:0}function Ae(n){return n>=48&&n<=57?n-48:-1}function Oe(n){switch(n){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
31
- `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function L(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}function se(n,p,y){p==="__proto__"?Object.defineProperty(n,p,{configurable:!0,enumerable:!0,writable:!0,value:y}):n[p]=y}let $e=new Array(256),te=new Array(256);for(let n=0;n<256;n++)$e[n]=Oe(n)?1:0,te[n]=Oe(n);function ee(n,p){this.input=n,this.filename=p.filename||null,this.schema=p.schema||i,this.onWarning=p.onWarning||null,this.legacy=p.legacy||!1,this.json=p.json||!1,this.listener=p.listener||null,this.maxDepth=typeof p.maxDepth=="number"?p.maxDepth:100,this.maxTotalMergeKeys=typeof p.maxTotalMergeKeys=="number"?p.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=n.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function ln(n,p){let y={name:n.filename,buffer:n.input.slice(0,-1),position:n.position,line:n.line,column:n.position-n.lineStart};return y.snippet=t(y),new e(p,y)}function H(n,p){throw ln(n,p)}function Re(n,p){n.onWarning&&n.onWarning.call(null,ln(n,p))}function fe(n,p,y){let A=n.anchorMapTransactions;if(A.length!==0){let b=A[A.length-1];o.call(b,p)||(b[p]={existed:o.call(n.anchorMap,p),value:n.anchorMap[p]})}n.anchorMap[p]=y}function Fn(n){n.anchorMapTransactions.push(Object.create(null))}function Te(n){let p=n.anchorMapTransactions.pop(),y=n.anchorMapTransactions;if(y.length===0)return;let A=y[y.length-1],b=Object.keys(p);for(let O=0,l=b.length;O<l;O+=1){let m=b[O];o.call(A,m)||(A[m]=p[m])}}function Mn(n){let p=n.anchorMapTransactions.pop(),y=Object.keys(p);for(let A=y.length-1;A>=0;A-=1){let b=p[y[A]];b.existed?n.anchorMap[y[A]]=b.value:delete n.anchorMap[y[A]]}}function We(n){return{position:n.position,line:n.line,lineStart:n.lineStart,lineIndent:n.lineIndent,firstTabInLine:n.firstTabInLine,tag:n.tag,anchor:n.anchor,kind:n.kind,result:n.result}}function Pe(n,p){n.position=p.position,n.line=p.line,n.lineStart=p.lineStart,n.lineIndent=p.lineIndent,n.firstTabInLine=p.firstTabInLine,n.tag=p.tag,n.anchor=p.anchor,n.kind=p.kind,n.result=p.result}let cn={YAML:function(p,y,A){p.version!==null&&H(p,"duplication of %YAML directive"),A.length!==1&&H(p,"YAML directive accepts exactly one argument");let b=/^([0-9]+)\.([0-9]+)$/.exec(A[0]);b===null&&H(p,"ill-formed argument of the YAML directive");let O=parseInt(b[1],10),l=parseInt(b[2],10);O!==1&&H(p,"unacceptable YAML version of the document"),p.version=A[0],p.checkLineBreaks=l<2,l!==1&&l!==2&&Re(p,"unsupported YAML version of the document")},TAG:function(p,y,A){let b;A.length!==2&&H(p,"TAG directive accepts exactly two arguments");let O=A[0];b=A[1],E.test(O)||H(p,"ill-formed tag handle (first argument) of the TAG directive"),o.call(p.tagMap,O)&&H(p,'there is a previously declared suffix for "'+O+'" tag handle'),v.test(b)||H(p,"ill-formed tag prefix (second argument) of the TAG directive");try{b=decodeURIComponent(b)}catch{H(p,"tag prefix is malformed: "+b)}p.tagMap[O]=b}};function ae(n,p,y,A){if(p<y){let b=n.input.slice(p,y);if(A)for(let O=0,l=b.length;O<l;O+=1){let m=b.charCodeAt(O);m===9||m>=32&&m<=1114111||H(n,"expected valid JSON character")}else g.test(b)&&H(n,"the stream contains non-printable characters");n.result+=b}}function xe(n,p,y,A){r.isObject(y)||H(n,"cannot merge mappings; the provided source object is unacceptable");let b=Object.keys(y);for(let O=0,l=b.length;O<l;O+=1){let m=b[O];n.maxTotalMergeKeys!==-1&&++n.totalMergeKeys>n.maxTotalMergeKeys&&H(n,"merge keys exceeded maxTotalMergeKeys ("+n.maxTotalMergeKeys+")"),o.call(p,m)||(se(p,m,y[m]),A[m]=!0)}}function pe(n,p,y,A,b,O,l,m,C){if(Array.isArray(b)){b=Array.prototype.slice.call(b);for(let w=0,_=b.length;w<_;w+=1)Array.isArray(b[w])&&H(n,"nested arrays are not supported inside keys"),typeof b=="object"&&P(b[w])==="[object Object]"&&(b[w]="[object Object]")}if(typeof b=="object"&&P(b)==="[object Object]"&&(b="[object Object]"),b=String(b),p===null&&(p={}),A==="tag:yaml.org,2002:merge")if(Array.isArray(O))for(let w=0,_=O.length;w<_;w+=1)xe(n,p,O[w],y);else xe(n,p,O,y);else!n.json&&!o.call(y,b)&&o.call(p,b)&&(n.line=l||n.line,n.lineStart=m||n.lineStart,n.position=C||n.position,H(n,"duplicated mapping key")),se(p,b,O),delete y[b];return p}function Fe(n){let p=n.input.charCodeAt(n.position);p===10?n.position++:p===13?(n.position++,n.input.charCodeAt(n.position)===10&&n.position++):H(n,"a line break is expected"),n.line+=1,n.lineStart=n.position,n.firstTabInLine=-1}function z(n,p,y){let A=0,b=n.input.charCodeAt(n.position);for(;b!==0;){for(;j(b);)b===9&&n.firstTabInLine===-1&&(n.firstTabInLine=n.position),b=n.input.charCodeAt(++n.position);if(p&&b===35)do b=n.input.charCodeAt(++n.position);while(b!==10&&b!==13&&b!==0);if(M(b))for(Fe(n),b=n.input.charCodeAt(n.position),A++,n.lineIndent=0;b===32;)n.lineIndent++,b=n.input.charCodeAt(++n.position);else break}return y!==-1&&A!==0&&n.lineIndent<y&&Re(n,"deficient indentation"),A}function Me(n){let p=n.position,y=n.input.charCodeAt(p);return!!((y===45||y===46)&&y===n.input.charCodeAt(p+1)&&y===n.input.charCodeAt(p+2)&&(p+=3,y=n.input.charCodeAt(p),y===0||D(y)))}function he(n,p){p===1?n.result+=" ":p>1&&(n.result+=r.repeat(`
32
- `,p-1))}function un(n,p,y){let A,b,O,l,m,C,w=n.kind,_=n.result,S=n.input.charCodeAt(n.position);if(D(S)||Z(S)||S===35||S===38||S===42||S===33||S===124||S===62||S===39||S===34||S===37||S===64||S===96)return!1;if(S===63||S===45){let k=n.input.charCodeAt(n.position+1);if(D(k)||y&&Z(k))return!1}for(n.kind="scalar",n.result="",A=b=n.position,O=!1;S!==0;){if(S===58){let k=n.input.charCodeAt(n.position+1);if(D(k)||y&&Z(k))break}else if(S===35){let k=n.input.charCodeAt(n.position-1);if(D(k))break}else{if(n.position===n.lineStart&&Me(n)||y&&Z(S))break;if(M(S))if(l=n.line,m=n.lineStart,C=n.lineIndent,z(n,!1,-1),n.lineIndent>=p){O=!0,S=n.input.charCodeAt(n.position);continue}else{n.position=b,n.line=l,n.lineStart=m,n.lineIndent=C;break}}O&&(ae(n,A,b,!1),he(n,n.line-l),A=b=n.position,O=!1),j(S)||(b=n.position+1),S=n.input.charCodeAt(++n.position)}return ae(n,A,b,!1),n.result?!0:(n.kind=w,n.result=_,!1)}function dn(n,p){let y,A,b=n.input.charCodeAt(n.position);if(b!==39)return!1;for(n.kind="scalar",n.result="",n.position++,y=A=n.position;(b=n.input.charCodeAt(n.position))!==0;)if(b===39)if(ae(n,y,n.position,!0),b=n.input.charCodeAt(++n.position),b===39)y=n.position,n.position++,A=n.position;else return!0;else M(b)?(ae(n,y,A,!0),he(n,z(n,!1,p)),y=A=n.position):n.position===n.lineStart&&Me(n)?H(n,"unexpected end of the document within a single quoted scalar"):(n.position++,j(b)||(A=n.position));H(n,"unexpected end of the stream within a single quoted scalar")}function Ge(n,p){let y,A,b,O=n.input.charCodeAt(n.position);if(O!==34)return!1;for(n.kind="scalar",n.result="",n.position++,y=A=n.position;(O=n.input.charCodeAt(n.position))!==0;){if(O===34)return ae(n,y,n.position,!0),n.position++,!0;if(O===92){if(ae(n,y,n.position,!0),O=n.input.charCodeAt(++n.position),M(O))z(n,!1,p);else if(O<256&&$e[O])n.result+=te[O],n.position++;else if((b=K(O))>0){let l=b,m=0;for(;l>0;l--)O=n.input.charCodeAt(++n.position),(b=oe(O))>=0?m=(m<<4)+b:H(n,"expected hexadecimal character");n.result+=L(m),n.position++}else H(n,"unknown escape sequence");y=A=n.position}else M(O)?(ae(n,y,A,!0),he(n,z(n,!1,p)),y=A=n.position):n.position===n.lineStart&&Me(n)?H(n,"unexpected end of the document within a double quoted scalar"):(n.position++,j(O)||(A=n.position))}H(n,"unexpected end of the stream within a double quoted scalar")}function fn(n,p){let y=!0,A,b,O,l=n.tag,m,C=n.anchor,w,_,S,k,N=Object.create(null),T,I,F,q=n.input.charCodeAt(n.position);if(q===91)w=93,k=!1,m=[];else if(q===123)w=125,k=!0,m={};else return!1;for(n.anchor!==null&&fe(n,n.anchor,m),q=n.input.charCodeAt(++n.position);q!==0;){if(z(n,!0,p),q=n.input.charCodeAt(n.position),q===w)return n.position++,n.tag=l,n.anchor=C,n.kind=k?"mapping":"sequence",n.result=m,!0;if(y?q===44&&H(n,"expected the node content, but found ','"):H(n,"missed comma between flow collection entries"),I=T=F=null,_=S=!1,q===63){let G=n.input.charCodeAt(n.position+1);D(G)&&(_=S=!0,n.position++,z(n,!0,p))}A=n.line,b=n.lineStart,O=n.position,ge(n,p,s,!1,!0),I=n.tag,T=n.result,z(n,!0,p),q=n.input.charCodeAt(n.position),(S||n.line===A)&&q===58&&(_=!0,q=n.input.charCodeAt(++n.position),z(n,!0,p),ge(n,p,s,!1,!0),F=n.result),k?pe(n,m,N,I,T,F,A,b,O):_?m.push(pe(n,null,N,I,T,F,A,b,O)):m.push(T),z(n,!0,p),q=n.input.charCodeAt(n.position),q===44?(y=!0,q=n.input.charCodeAt(++n.position)):y=!1}H(n,"unexpected end of the stream within a flow collection")}function pn(n,p){let y,A=c,b=!1,O=!1,l=p,m=0,C=!1,w,_=n.input.charCodeAt(n.position);if(_===124)y=!1;else if(_===62)y=!0;else return!1;for(n.kind="scalar",n.result="";_!==0;)if(_=n.input.charCodeAt(++n.position),_===43||_===45)c===A?A=_===43?h:f:H(n,"repeat of a chomping mode identifier");else if((w=Ae(_))>=0)w===0?H(n,"bad explicit indentation width of a block scalar; it cannot be less than one"):O?H(n,"repeat of an indentation width identifier"):(l=p+w-1,O=!0);else break;if(j(_)){do _=n.input.charCodeAt(++n.position);while(j(_));if(_===35)do _=n.input.charCodeAt(++n.position);while(!M(_)&&_!==0)}for(;_!==0;){for(Fe(n),n.lineIndent=0,_=n.input.charCodeAt(n.position);(!O||n.lineIndent<l)&&_===32;)n.lineIndent++,_=n.input.charCodeAt(++n.position);if(!O&&n.lineIndent>l&&(l=n.lineIndent),M(_)){m++;continue}if(!O&&l===0&&H(n,"missing indentation for block scalar"),n.lineIndent<l){A===h?n.result+=r.repeat(`
29
+ `}return h.replace(/\n$/,"")}return st=i,st}var at,ai;function re(){if(ai)return at;ai=1;let r=en(),e=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],t=["scalar","sequence","mapping"];function i(s){let a={};return s!==null&&Object.keys(s).forEach(function(d){s[d].forEach(function(u){a[String(u)]=d})}),a}function o(s,a){if(a=a||{},Object.keys(a).forEach(function(d){if(e.indexOf(d)===-1)throw new r('Unknown option "'+d+'" is met in definition of "'+s+'" YAML type.')}),this.options=a,this.tag=s,this.kind=a.kind||null,this.resolve=a.resolve||function(){return!0},this.construct=a.construct||function(d){return d},this.instanceOf=a.instanceOf||null,this.predicate=a.predicate||null,this.represent=a.represent||null,this.representName=a.representName||null,this.defaultStyle=a.defaultStyle||null,this.multi=a.multi||!1,this.styleAliases=i(a.styleAliases||null),t.indexOf(this.kind)===-1)throw new r('Unknown kind "'+this.kind+'" is specified for "'+s+'" YAML type.')}return at=o,at}var lt,li;function $i(){if(li)return lt;li=1;let r=en(),e=re();function t(s,a){let d=[];return s[a].forEach(function(u){let c=d.length;d.forEach(function(f,h){f.tag===u.tag&&f.kind===u.kind&&f.multi===u.multi&&(c=h)}),d[c]=u}),d}function i(){let s={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(d){d.multi?(s.multi[d.kind].push(d),s.multi.fallback.push(d)):s[d.kind][d.tag]=s.fallback[d.tag]=d}for(let d=0,u=arguments.length;d<u;d+=1)arguments[d].forEach(a);return s}function o(s){return this.extend(s)}return o.prototype.extend=function(a){let d=[],u=[];if(a instanceof e)u.push(a);else if(Array.isArray(a))u=u.concat(a);else if(a&&(Array.isArray(a.implicit)||Array.isArray(a.explicit)))a.implicit&&(d=d.concat(a.implicit)),a.explicit&&(u=u.concat(a.explicit));else throw new r("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");d.forEach(function(f){if(!(f instanceof e))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(f.loadKind&&f.loadKind!=="scalar")throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(f.multi)throw new r("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),u.forEach(function(f){if(!(f instanceof e))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let c=Object.create(o.prototype);return c.implicit=(this.implicit||[]).concat(d),c.explicit=(this.explicit||[]).concat(u),c.compiledImplicit=t(c,"implicit"),c.compiledExplicit=t(c,"explicit"),c.compiledTypeMap=i(c.compiledImplicit,c.compiledExplicit),c},lt=o,lt}var ct,ci;function Ti(){if(ci)return ct;ci=1;let r=re();return ct=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),ct}var ut,ui;function Ni(){if(ui)return ut;ui=1;let r=re();return ut=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),ut}var dt,di;function Hi(){if(di)return dt;di=1;let r=re();return dt=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),dt}var ft,fi;function Ri(){if(fi)return ft;fi=1;let r=$i();return ft=new r({explicit:[Ti(),Ni(),Hi()]}),ft}var pt,pi;function Ii(){if(pi)return pt;pi=1;let r=re();function e(o){if(o===null)return!0;let s=o.length;return s===1&&o==="~"||s===4&&(o==="null"||o==="Null"||o==="NULL")}function t(){return null}function i(o){return o===null}return pt=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:e,construct:t,predicate:i,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),pt}var ht,hi;function Pi(){if(hi)return ht;hi=1;let r=re();function e(o){if(o===null)return!1;let s=o.length;return s===4&&(o==="true"||o==="True"||o==="TRUE")||s===5&&(o==="false"||o==="False"||o==="FALSE")}function t(o){return o==="true"||o==="True"||o==="TRUE"}function i(o){return Object.prototype.toString.call(o)==="[object Boolean]"}return ht=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:e,construct:t,predicate:i,represent:{lowercase:function(o){return o?"true":"false"},uppercase:function(o){return o?"TRUE":"FALSE"},camelcase:function(o){return o?"True":"False"}},defaultStyle:"lowercase"}),ht}var mt,mi;function Fi(){if(mi)return mt;mi=1;let r=Ze(),e=re();function t(c){return c>=48&&c<=57||c>=65&&c<=70||c>=97&&c<=102}function i(c){return c>=48&&c<=55}function o(c){return c>=48&&c<=57}function s(c){if(c===null)return!1;let f=c.length,h=0,g=!1;if(!f)return!1;let x=c[h];if((x==="-"||x==="+")&&(x=c[++h]),x==="0"){if(h+1===f)return!0;if(x=c[++h],x==="b"){for(h++;h<f;h++){if(x=c[h],x!=="0"&&x!=="1")return!1;g=!0}return g&&isFinite(a(c))}if(x==="x"){for(h++;h<f;h++){if(!t(c.charCodeAt(h)))return!1;g=!0}return g&&isFinite(a(c))}if(x==="o"){for(h++;h<f;h++){if(!i(c.charCodeAt(h)))return!1;g=!0}return g&&isFinite(a(c))}}for(;h<f;h++){if(!o(c.charCodeAt(h)))return!1;g=!0}return g?isFinite(a(c)):!1}function a(c){let f=c,h=1,g=f[0];if((g==="-"||g==="+")&&(g==="-"&&(h=-1),f=f.slice(1),g=f[0]),f==="0")return 0;if(g==="0"){if(f[1]==="b")return h*parseInt(f.slice(2),2);if(f[1]==="x")return h*parseInt(f.slice(2),16);if(f[1]==="o")return h*parseInt(f.slice(2),8)}return h*parseInt(f,10)}function d(c){return a(c)}function u(c){return Object.prototype.toString.call(c)==="[object Number]"&&c%1===0&&!r.isNegativeZero(c)}return mt=new e("tag:yaml.org,2002:int",{kind:"scalar",resolve:s,construct:d,predicate:u,represent:{binary:function(c){return c>=0?"0b"+c.toString(2):"-0b"+c.toString(2).slice(1)},octal:function(c){return c>=0?"0o"+c.toString(8):"-0o"+c.toString(8).slice(1)},decimal:function(c){return c.toString(10)},hexadecimal:function(c){return c>=0?"0x"+c.toString(16).toUpperCase():"-0x"+c.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),mt}var gt,gi;function Mi(){if(gi)return gt;gi=1;let r=Ze(),e=re(),t=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),i=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function o(c){return c===null||!t.test(c)?!1:isFinite(parseFloat(c,10))?!0:i.test(c)}function s(c){let f=c.toLowerCase(),h=f[0]==="-"?-1:1;return"+-".indexOf(f[0])>=0&&(f=f.slice(1)),f===".inf"?h===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:f===".nan"?NaN:h*parseFloat(f,10)}let a=/^[-+]?[0-9]+e/;function d(c,f){if(isNaN(c))switch(f){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===c)switch(f){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===c)switch(f){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(c))return"-0.0";let h=c.toString(10);return a.test(h)?h.replace("e",".e"):h}function u(c){return Object.prototype.toString.call(c)==="[object Number]"&&(c%1!==0||r.isNegativeZero(c))}return gt=new e("tag:yaml.org,2002:float",{kind:"scalar",resolve:o,construct:s,predicate:u,represent:d,defaultStyle:"lowercase"}),gt}var bt,bi;function ji(){return bi||(bi=1,bt=Ri().extend({implicit:[Ii(),Pi(),Fi(),Mi()]})),bt}var yt,yi;function Li(){return yi||(yi=1,yt=ji()),yt}var wt,wi;function Di(){if(wi)return wt;wi=1;let r=re(),e=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function i(a){return a===null?!1:e.exec(a)!==null||t.exec(a)!==null}function o(a){let d=0,u=null,c=e.exec(a);if(c===null&&(c=t.exec(a)),c===null)throw new Error("Date resolve error");let f=+c[1],h=+c[2]-1,g=+c[3];if(!c[4])return new Date(Date.UTC(f,h,g));let x=+c[4],$=+c[5],E=+c[6];if(c[7]){for(d=c[7].slice(0,3);d.length<3;)d+="0";d=+d}if(c[9]){let P=+c[10],M=+(c[11]||0);u=(P*60+M)*6e4,c[9]==="-"&&(u=-u)}let v=new Date(Date.UTC(f,h,g,x,$,E,d));return u&&v.setTime(v.getTime()-u),v}function s(a){return a.toISOString()}return wt=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:i,construct:o,instanceOf:Date,represent:s}),wt}var _t,_i;function qi(){if(_i)return _t;_i=1;let r=re();function e(t){return t==="<<"||t===null}return _t=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:e}),_t}var At,Ai;function Bi(){if(Ai)return At;Ai=1;let r=re(),e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
30
+ \r`;function t(a){if(a===null)return!1;let d=0,u=a.length,c=e;for(let f=0;f<u;f++){let h=c.indexOf(a.charAt(f));if(!(h>64)){if(h<0)return!1;d+=6}}return d%8===0}function i(a){let d=a.replace(/[\r\n=]/g,""),u=d.length,c=e,f=0,h=[];for(let x=0;x<u;x++)x%4===0&&x&&(h.push(f>>16&255),h.push(f>>8&255),h.push(f&255)),f=f<<6|c.indexOf(d.charAt(x));let g=u%4*6;return g===0?(h.push(f>>16&255),h.push(f>>8&255),h.push(f&255)):g===18?(h.push(f>>10&255),h.push(f>>2&255)):g===12&&h.push(f>>4&255),new Uint8Array(h)}function o(a){let d="",u=0,c=a.length,f=e;for(let g=0;g<c;g++)g%3===0&&g&&(d+=f[u>>18&63],d+=f[u>>12&63],d+=f[u>>6&63],d+=f[u&63]),u=(u<<8)+a[g];let h=c%3;return h===0?(d+=f[u>>18&63],d+=f[u>>12&63],d+=f[u>>6&63],d+=f[u&63]):h===2?(d+=f[u>>10&63],d+=f[u>>4&63],d+=f[u<<2&63],d+=f[64]):h===1&&(d+=f[u>>2&63],d+=f[u<<4&63],d+=f[64],d+=f[64]),d}function s(a){return Object.prototype.toString.call(a)==="[object Uint8Array]"}return At=new r("tag:yaml.org,2002:binary",{kind:"scalar",resolve:t,construct:i,predicate:s,represent:o}),At}var xt,xi;function Ui(){if(xi)return xt;xi=1;let r=re(),e=Object.prototype.hasOwnProperty,t=Object.prototype.toString;function i(s){if(s===null)return!0;let a=[],d=s;for(let u=0,c=d.length;u<c;u+=1){let f=d[u],h=!1;if(t.call(f)!=="[object Object]")return!1;let g;for(g in f)if(e.call(f,g))if(!h)h=!0;else return!1;if(!h)return!1;if(a.indexOf(g)===-1)a.push(g);else return!1}return!0}function o(s){return s!==null?s:[]}return xt=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:i,construct:o}),xt}var kt,ki;function Vi(){if(ki)return kt;ki=1;let r=re(),e=Object.prototype.toString;function t(o){if(o===null)return!0;let s=o,a=new Array(s.length);for(let d=0,u=s.length;d<u;d+=1){let c=s[d];if(e.call(c)!=="[object Object]")return!1;let f=Object.keys(c);if(f.length!==1)return!1;a[d]=[f[0],c[f[0]]]}return!0}function i(o){if(o===null)return[];let s=o,a=new Array(s.length);for(let d=0,u=s.length;d<u;d+=1){let c=s[d],f=Object.keys(c);a[d]=[f[0],c[f[0]]]}return a}return kt=new r("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:t,construct:i}),kt}var Ct,Ci;function Gi(){if(Ci)return Ct;Ci=1;let r=re(),e=Object.prototype.hasOwnProperty;function t(o){if(o===null)return!0;let s=o;for(let a in s)if(e.call(s,a)&&s[a]!==null)return!1;return!0}function i(o){return o!==null?o:{}}return Ct=new r("tag:yaml.org,2002:set",{kind:"mapping",resolve:t,construct:i}),Ct}var Et,Ei;function vt(){return Ei||(Ei=1,Et=Li().extend({implicit:[Di(),qi()],explicit:[Bi(),Ui(),Vi(),Gi()]})),Et}var Si;function Kr(){if(Si)return $n;Si=1;let r=Ze(),e=en(),t=Yr(),i=vt(),o=Object.prototype.hasOwnProperty,s=1,a=2,d=3,u=4,c=1,f=2,h=3,g=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,x=/[\x85\u2028\u2029]/,$=/[,\[\]{}]/,E=/^(?:!|!!|![0-9A-Za-z-]+!)$/,v=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function P(n){return Object.prototype.toString.call(n)}function M(n){return n===10||n===13}function L(n){return n===9||n===32}function D(n){return n===9||n===32||n===10||n===13}function Z(n){return n===44||n===91||n===93||n===123||n===125}function oe(n){if(n>=48&&n<=57)return n-48;let p=n|32;return p>=97&&p<=102?p-97+10:-1}function K(n){return n===120?2:n===117?4:n===85?8:0}function xe(n){return n>=48&&n<=57?n-48:-1}function $e(n){switch(n){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
31
+ `;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function j(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}function se(n,p,y){p==="__proto__"?Object.defineProperty(n,p,{configurable:!0,enumerable:!0,writable:!0,value:y}):n[p]=y}let Te=new Array(256),te=new Array(256);for(let n=0;n<256;n++)Te[n]=$e(n)?1:0,te[n]=$e(n);function ee(n,p){this.input=n,this.filename=p.filename||null,this.schema=p.schema||i,this.onWarning=p.onWarning||null,this.legacy=p.legacy||!1,this.json=p.json||!1,this.listener=p.listener||null,this.maxDepth=typeof p.maxDepth=="number"?p.maxDepth:100,this.maxTotalMergeKeys=typeof p.maxTotalMergeKeys=="number"?p.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=n.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function ln(n,p){let y={name:n.filename,buffer:n.input.slice(0,-1),position:n.position,line:n.line,column:n.position-n.lineStart};return y.snippet=t(y),new e(p,y)}function H(n,p){throw ln(n,p)}function Ie(n,p){n.onWarning&&n.onWarning.call(null,ln(n,p))}function fe(n,p,y){let A=n.anchorMapTransactions;if(A.length!==0){let b=A[A.length-1];o.call(b,p)||(b[p]={existed:o.call(n.anchorMap,p),value:n.anchorMap[p]})}n.anchorMap[p]=y}function Fn(n){n.anchorMapTransactions.push(Object.create(null))}function Ne(n){let p=n.anchorMapTransactions.pop(),y=n.anchorMapTransactions;if(y.length===0)return;let A=y[y.length-1],b=Object.keys(p);for(let O=0,l=b.length;O<l;O+=1){let m=b[O];o.call(A,m)||(A[m]=p[m])}}function Mn(n){let p=n.anchorMapTransactions.pop(),y=Object.keys(p);for(let A=y.length-1;A>=0;A-=1){let b=p[y[A]];b.existed?n.anchorMap[y[A]]=b.value:delete n.anchorMap[y[A]]}}function Ge(n){return{position:n.position,line:n.line,lineStart:n.lineStart,lineIndent:n.lineIndent,firstTabInLine:n.firstTabInLine,tag:n.tag,anchor:n.anchor,kind:n.kind,result:n.result}}function Pe(n,p){n.position=p.position,n.line=p.line,n.lineStart=p.lineStart,n.lineIndent=p.lineIndent,n.firstTabInLine=p.firstTabInLine,n.tag=p.tag,n.anchor=p.anchor,n.kind=p.kind,n.result=p.result}let cn={YAML:function(p,y,A){p.version!==null&&H(p,"duplication of %YAML directive"),A.length!==1&&H(p,"YAML directive accepts exactly one argument");let b=/^([0-9]+)\.([0-9]+)$/.exec(A[0]);b===null&&H(p,"ill-formed argument of the YAML directive");let O=parseInt(b[1],10),l=parseInt(b[2],10);O!==1&&H(p,"unacceptable YAML version of the document"),p.version=A[0],p.checkLineBreaks=l<2,l!==1&&l!==2&&Ie(p,"unsupported YAML version of the document")},TAG:function(p,y,A){let b;A.length!==2&&H(p,"TAG directive accepts exactly two arguments");let O=A[0];b=A[1],E.test(O)||H(p,"ill-formed tag handle (first argument) of the TAG directive"),o.call(p.tagMap,O)&&H(p,'there is a previously declared suffix for "'+O+'" tag handle'),v.test(b)||H(p,"ill-formed tag prefix (second argument) of the TAG directive");try{b=decodeURIComponent(b)}catch{H(p,"tag prefix is malformed: "+b)}p.tagMap[O]=b}};function ae(n,p,y,A){if(p<y){let b=n.input.slice(p,y);if(A)for(let O=0,l=b.length;O<l;O+=1){let m=b.charCodeAt(O);m===9||m>=32&&m<=1114111||H(n,"expected valid JSON character")}else g.test(b)&&H(n,"the stream contains non-printable characters");n.result+=b}}function ke(n,p,y,A){r.isObject(y)||H(n,"cannot merge mappings; the provided source object is unacceptable");let b=Object.keys(y);for(let O=0,l=b.length;O<l;O+=1){let m=b[O];n.maxTotalMergeKeys!==-1&&++n.totalMergeKeys>n.maxTotalMergeKeys&&H(n,"merge keys exceeded maxTotalMergeKeys ("+n.maxTotalMergeKeys+")"),o.call(p,m)||(se(p,m,y[m]),A[m]=!0)}}function pe(n,p,y,A,b,O,l,m,C){if(Array.isArray(b)){b=Array.prototype.slice.call(b);for(let w=0,_=b.length;w<_;w+=1)Array.isArray(b[w])&&H(n,"nested arrays are not supported inside keys"),typeof b=="object"&&P(b[w])==="[object Object]"&&(b[w]="[object Object]")}if(typeof b=="object"&&P(b)==="[object Object]"&&(b="[object Object]"),b=String(b),p===null&&(p={}),A==="tag:yaml.org,2002:merge")if(Array.isArray(O))for(let w=0,_=O.length;w<_;w+=1)ke(n,p,O[w],y);else ke(n,p,O,y);else!n.json&&!o.call(y,b)&&o.call(p,b)&&(n.line=l||n.line,n.lineStart=m||n.lineStart,n.position=C||n.position,H(n,"duplicated mapping key")),se(p,b,O),delete y[b];return p}function Fe(n){let p=n.input.charCodeAt(n.position);p===10?n.position++:p===13?(n.position++,n.input.charCodeAt(n.position)===10&&n.position++):H(n,"a line break is expected"),n.line+=1,n.lineStart=n.position,n.firstTabInLine=-1}function z(n,p,y){let A=0,b=n.input.charCodeAt(n.position);for(;b!==0;){for(;L(b);)b===9&&n.firstTabInLine===-1&&(n.firstTabInLine=n.position),b=n.input.charCodeAt(++n.position);if(p&&b===35)do b=n.input.charCodeAt(++n.position);while(b!==10&&b!==13&&b!==0);if(M(b))for(Fe(n),b=n.input.charCodeAt(n.position),A++,n.lineIndent=0;b===32;)n.lineIndent++,b=n.input.charCodeAt(++n.position);else break}return y!==-1&&A!==0&&n.lineIndent<y&&Ie(n,"deficient indentation"),A}function Me(n){let p=n.position,y=n.input.charCodeAt(p);return!!((y===45||y===46)&&y===n.input.charCodeAt(p+1)&&y===n.input.charCodeAt(p+2)&&(p+=3,y=n.input.charCodeAt(p),y===0||D(y)))}function he(n,p){p===1?n.result+=" ":p>1&&(n.result+=r.repeat(`
32
+ `,p-1))}function un(n,p,y){let A,b,O,l,m,C,w=n.kind,_=n.result,S=n.input.charCodeAt(n.position);if(D(S)||Z(S)||S===35||S===38||S===42||S===33||S===124||S===62||S===39||S===34||S===37||S===64||S===96)return!1;if(S===63||S===45){let k=n.input.charCodeAt(n.position+1);if(D(k)||y&&Z(k))return!1}for(n.kind="scalar",n.result="",A=b=n.position,O=!1;S!==0;){if(S===58){let k=n.input.charCodeAt(n.position+1);if(D(k)||y&&Z(k))break}else if(S===35){let k=n.input.charCodeAt(n.position-1);if(D(k))break}else{if(n.position===n.lineStart&&Me(n)||y&&Z(S))break;if(M(S))if(l=n.line,m=n.lineStart,C=n.lineIndent,z(n,!1,-1),n.lineIndent>=p){O=!0,S=n.input.charCodeAt(n.position);continue}else{n.position=b,n.line=l,n.lineStart=m,n.lineIndent=C;break}}O&&(ae(n,A,b,!1),he(n,n.line-l),A=b=n.position,O=!1),L(S)||(b=n.position+1),S=n.input.charCodeAt(++n.position)}return ae(n,A,b,!1),n.result?!0:(n.kind=w,n.result=_,!1)}function dn(n,p){let y,A,b=n.input.charCodeAt(n.position);if(b!==39)return!1;for(n.kind="scalar",n.result="",n.position++,y=A=n.position;(b=n.input.charCodeAt(n.position))!==0;)if(b===39)if(ae(n,y,n.position,!0),b=n.input.charCodeAt(++n.position),b===39)y=n.position,n.position++,A=n.position;else return!0;else M(b)?(ae(n,y,A,!0),he(n,z(n,!1,p)),y=A=n.position):n.position===n.lineStart&&Me(n)?H(n,"unexpected end of the document within a single quoted scalar"):(n.position++,L(b)||(A=n.position));H(n,"unexpected end of the stream within a single quoted scalar")}function We(n,p){let y,A,b,O=n.input.charCodeAt(n.position);if(O!==34)return!1;for(n.kind="scalar",n.result="",n.position++,y=A=n.position;(O=n.input.charCodeAt(n.position))!==0;){if(O===34)return ae(n,y,n.position,!0),n.position++,!0;if(O===92){if(ae(n,y,n.position,!0),O=n.input.charCodeAt(++n.position),M(O))z(n,!1,p);else if(O<256&&Te[O])n.result+=te[O],n.position++;else if((b=K(O))>0){let l=b,m=0;for(;l>0;l--)O=n.input.charCodeAt(++n.position),(b=oe(O))>=0?m=(m<<4)+b:H(n,"expected hexadecimal character");n.result+=j(m),n.position++}else H(n,"unknown escape sequence");y=A=n.position}else M(O)?(ae(n,y,A,!0),he(n,z(n,!1,p)),y=A=n.position):n.position===n.lineStart&&Me(n)?H(n,"unexpected end of the document within a double quoted scalar"):(n.position++,L(O)||(A=n.position))}H(n,"unexpected end of the stream within a double quoted scalar")}function fn(n,p){let y=!0,A,b,O,l=n.tag,m,C=n.anchor,w,_,S,k,N=Object.create(null),T,R,F,q=n.input.charCodeAt(n.position);if(q===91)w=93,k=!1,m=[];else if(q===123)w=125,k=!0,m={};else return!1;for(n.anchor!==null&&fe(n,n.anchor,m),q=n.input.charCodeAt(++n.position);q!==0;){if(z(n,!0,p),q=n.input.charCodeAt(n.position),q===w)return n.position++,n.tag=l,n.anchor=C,n.kind=k?"mapping":"sequence",n.result=m,!0;if(y?q===44&&H(n,"expected the node content, but found ','"):H(n,"missed comma between flow collection entries"),R=T=F=null,_=S=!1,q===63){let W=n.input.charCodeAt(n.position+1);D(W)&&(_=S=!0,n.position++,z(n,!0,p))}A=n.line,b=n.lineStart,O=n.position,ge(n,p,s,!1,!0),R=n.tag,T=n.result,z(n,!0,p),q=n.input.charCodeAt(n.position),(S||n.line===A)&&q===58&&(_=!0,q=n.input.charCodeAt(++n.position),z(n,!0,p),ge(n,p,s,!1,!0),F=n.result),k?pe(n,m,N,R,T,F,A,b,O):_?m.push(pe(n,null,N,R,T,F,A,b,O)):m.push(T),z(n,!0,p),q=n.input.charCodeAt(n.position),q===44?(y=!0,q=n.input.charCodeAt(++n.position)):y=!1}H(n,"unexpected end of the stream within a flow collection")}function pn(n,p){let y,A=c,b=!1,O=!1,l=p,m=0,C=!1,w,_=n.input.charCodeAt(n.position);if(_===124)y=!1;else if(_===62)y=!0;else return!1;for(n.kind="scalar",n.result="";_!==0;)if(_=n.input.charCodeAt(++n.position),_===43||_===45)c===A?A=_===43?h:f:H(n,"repeat of a chomping mode identifier");else if((w=xe(_))>=0)w===0?H(n,"bad explicit indentation width of a block scalar; it cannot be less than one"):O?H(n,"repeat of an indentation width identifier"):(l=p+w-1,O=!0);else break;if(L(_)){do _=n.input.charCodeAt(++n.position);while(L(_));if(_===35)do _=n.input.charCodeAt(++n.position);while(!M(_)&&_!==0)}for(;_!==0;){for(Fe(n),n.lineIndent=0,_=n.input.charCodeAt(n.position);(!O||n.lineIndent<l)&&_===32;)n.lineIndent++,_=n.input.charCodeAt(++n.position);if(!O&&n.lineIndent>l&&(l=n.lineIndent),M(_)){m++;continue}if(!O&&l===0&&H(n,"missing indentation for block scalar"),n.lineIndent<l){A===h?n.result+=r.repeat(`
33
33
  `,b?1+m:m):A===c&&b&&(n.result+=`
34
- `);break}y?j(_)?(C=!0,n.result+=r.repeat(`
34
+ `);break}y?L(_)?(C=!0,n.result+=r.repeat(`
35
35
  `,b?1+m:m)):C?(C=!1,n.result+=r.repeat(`
36
36
  `,m+1)):m===0?b&&(n.result+=" "):n.result+=r.repeat(`
37
37
  `,m):n.result+=r.repeat(`
38
- `,b?1+m:m),b=!0,O=!0,m=0;let S=n.position;for(;!M(_)&&_!==0;)_=n.input.charCodeAt(++n.position);ae(n,S,n.position,!1)}return!0}function me(n,p){let y=n.tag,A=n.anchor,b=[],O=!1;if(n.firstTabInLine!==-1)return!1;n.anchor!==null&&fe(n,n.anchor,b);let l=n.input.charCodeAt(n.position);for(;l!==0&&(n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,H(n,"tab characters must not be used in indentation")),l===45);){let m=n.input.charCodeAt(n.position+1);if(!D(m))break;if(O=!0,n.position++,z(n,!0,-1)&&n.lineIndent<=p){b.push(null),l=n.input.charCodeAt(n.position);continue}let C=n.line;if(ge(n,p,d,!1,!0),b.push(n.result),z(n,!0,-1),l=n.input.charCodeAt(n.position),(n.line===C||n.lineIndent>p)&&l!==0)H(n,"bad indentation of a sequence entry");else if(n.lineIndent<p)break}return O?(n.tag=y,n.anchor=A,n.kind="sequence",n.result=b,!0):!1}function hn(n,p,y){let A,b,O,l,m=n.tag,C=n.anchor,w={},_=Object.create(null),S=null,k=null,N=null,T=!1,I=!1;if(n.firstTabInLine!==-1)return!1;n.anchor!==null&&fe(n,n.anchor,w);let F=n.input.charCodeAt(n.position);for(;F!==0;){!T&&n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,H(n,"tab characters must not be used in indentation"));let q=n.input.charCodeAt(n.position+1),G=n.line;if((F===63||F===58)&&D(q))F===63?(T&&(pe(n,w,_,S,k,null,b,O,l),S=k=N=null),I=!0,T=!0,A=!0):T?(T=!1,A=!0):H(n,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),n.position+=1,F=q;else{if(b=n.line,O=n.lineStart,l=n.position,!ge(n,y,a,!1,!0))break;if(n.line===G){for(F=n.input.charCodeAt(n.position);j(F);)F=n.input.charCodeAt(++n.position);if(F===58)F=n.input.charCodeAt(++n.position),D(F)||H(n,"a whitespace character is expected after the key-value separator within a block mapping"),T&&(pe(n,w,_,S,k,null,b,O,l),S=k=N=null),I=!0,T=!1,A=!1,S=n.tag,k=n.result;else if(I)H(n,"can not read an implicit mapping pair; a colon is missed");else return n.tag=m,n.anchor=C,!0}else if(I)H(n,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.tag=m,n.anchor=C,!0}if((n.line===G||n.lineIndent>p)&&(T&&(b=n.line,O=n.lineStart,l=n.position),ge(n,p,u,!0,A)&&(T?k=n.result:N=n.result),T||(pe(n,w,_,S,k,N,b,O,l),S=k=N=null),z(n,!0,-1),F=n.input.charCodeAt(n.position)),(n.line===G||n.lineIndent>p)&&F!==0)H(n,"bad indentation of a mapping entry");else if(n.lineIndent<p)break}return T&&pe(n,w,_,S,k,null,b,O,l),I&&(n.tag=m,n.anchor=C,n.kind="mapping",n.result=w),I}function Ln(n){let p=!1,y=!1,A,b,O=n.input.charCodeAt(n.position);if(O!==33)return!1;n.tag!==null&&H(n,"duplication of a tag property"),O=n.input.charCodeAt(++n.position),O===60?(p=!0,O=n.input.charCodeAt(++n.position)):O===33?(y=!0,A="!!",O=n.input.charCodeAt(++n.position)):A="!";let l=n.position;if(p){do O=n.input.charCodeAt(++n.position);while(O!==0&&O!==62);n.position<n.length?(b=n.input.slice(l,n.position),O=n.input.charCodeAt(++n.position)):H(n,"unexpected end of the stream within a verbatim tag")}else{for(;O!==0&&!D(O);)O===33&&(y?H(n,"tag suffix cannot contain exclamation marks"):(A=n.input.slice(l-1,n.position+1),E.test(A)||H(n,"named tag handle cannot contain such characters"),y=!0,l=n.position+1)),O=n.input.charCodeAt(++n.position);b=n.input.slice(l,n.position),$.test(b)&&H(n,"tag suffix cannot contain flow indicator characters")}b&&!v.test(b)&&H(n,"tag name cannot contain such characters: "+b);try{b=decodeURIComponent(b)}catch{H(n,"tag name is malformed: "+b)}return p?n.tag=b:o.call(n.tagMap,A)?n.tag=n.tagMap[A]+b:A==="!"?n.tag="!"+b:A==="!!"?n.tag="tag:yaml.org,2002:"+b:H(n,'undeclared tag handle "'+A+'"'),!0}function mn(n){let p=n.input.charCodeAt(n.position);if(p!==38)return!1;n.anchor!==null&&H(n,"duplication of an anchor property"),p=n.input.charCodeAt(++n.position);let y=n.position;for(;p!==0&&!D(p)&&!Z(p);)p=n.input.charCodeAt(++n.position);return n.position===y&&H(n,"name of an anchor node must contain at least one character"),n.anchor=n.input.slice(y,n.position),!0}function gn(n){let p=n.input.charCodeAt(n.position);if(p!==42)return!1;p=n.input.charCodeAt(++n.position);let y=n.position;for(;p!==0&&!D(p)&&!Z(p);)p=n.input.charCodeAt(++n.position);n.position===y&&H(n,"name of an alias node must contain at least one character");let A=n.input.slice(y,n.position);return o.call(n.anchorMap,A)||H(n,'unidentified alias "'+A+'"'),n.result=n.anchorMap[A],z(n,!0,-1),!0}function jn(n,p,y,A){let b=We(n);return Fn(n),Pe(n,p),n.tag=null,n.anchor=null,n.kind=null,n.result=null,hn(n,y,A)&&n.kind==="mapping"?(Te(n),!0):(Mn(n),Pe(n,b),!1)}function ge(n,p,y,A,b){let O,l,m=1,C=!1,w=!1,_=null,S,k,N;n.depth>=n.maxDepth&&H(n,"nesting exceeded maxDepth ("+n.maxDepth+")"),n.depth+=1,n.listener!==null&&n.listener("open",n),n.tag=null,n.anchor=null,n.kind=null,n.result=null;let T=O=l=u===y||d===y;if(A&&z(n,!0,-1)&&(C=!0,n.lineIndent>p?m=1:n.lineIndent===p?m=0:n.lineIndent<p&&(m=-1)),m===1)for(;;){let I=n.input.charCodeAt(n.position),F=We(n);if(C&&(I===33&&n.tag!==null||I===38&&n.anchor!==null)||!Ln(n)&&!mn(n))break;_===null&&(_=F),z(n,!0,-1)?(C=!0,l=T,n.lineIndent>p?m=1:n.lineIndent===p?m=0:n.lineIndent<p&&(m=-1)):l=!1}if(l&&(l=C||b),m===1||u===y)if(s===y||a===y?k=p:k=p+1,N=n.position-n.lineStart,m===1)if(l&&(me(n,N)||hn(n,N,k))||fn(n,k))w=!0;else{let I=n.input.charCodeAt(n.position);_!==null&&T&&!l&&I!==124&&I!==62&&jn(n,_,_.position-_.lineStart,k)||O&&pn(n,k)||dn(n,k)||Ge(n,k)?w=!0:gn(n)?(w=!0,(n.tag!==null||n.anchor!==null)&&H(n,"alias node should not have any properties")):un(n,k,s===y)&&(w=!0,n.tag===null&&(n.tag="?")),n.anchor!==null&&fe(n,n.anchor,n.result)}else m===0&&(w=l&&me(n,N));if(n.tag===null)n.anchor!==null&&fe(n,n.anchor,n.result);else if(n.tag==="?"){n.result!==null&&n.kind!=="scalar"&&H(n,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+n.kind+'"');for(let I=0,F=n.implicitTypes.length;I<F;I+=1)if(S=n.implicitTypes[I],S.resolve(n.result)){n.result=S.construct(n.result),n.tag=S.tag,n.anchor!==null&&fe(n,n.anchor,n.result);break}}else if(n.tag!=="!"){if(o.call(n.typeMap[n.kind||"fallback"],n.tag))S=n.typeMap[n.kind||"fallback"][n.tag];else{S=null;let I=n.typeMap.multi[n.kind||"fallback"];for(let F=0,q=I.length;F<q;F+=1)if(n.tag.slice(0,I[F].tag.length)===I[F].tag){S=I[F];break}}S||H(n,"unknown tag !<"+n.tag+">"),n.result!==null&&S.kind!==n.kind&&H(n,"unacceptable node kind for !<"+n.tag+'> tag; it should be "'+S.kind+'", not "'+n.kind+'"'),S.resolve(n.result,n.tag)?(n.result=S.construct(n.result,n.tag),n.anchor!==null&&fe(n,n.anchor,n.result)):H(n,"cannot resolve a node with !<"+n.tag+"> explicit tag")}return n.listener!==null&&n.listener("close",n),n.depth-=1,n.tag!==null||n.anchor!==null||w}function Dn(n){let p=n.position,y=!1,A;for(n.version=null,n.checkLineBreaks=n.legacy,n.tagMap=Object.create(null),n.anchorMap=Object.create(null);(A=n.input.charCodeAt(n.position))!==0&&(z(n,!0,-1),A=n.input.charCodeAt(n.position),!(n.lineIndent>0||A!==37));){y=!0,A=n.input.charCodeAt(++n.position);let b=n.position;for(;A!==0&&!D(A);)A=n.input.charCodeAt(++n.position);let O=n.input.slice(b,n.position),l=[];for(O.length<1&&H(n,"directive name must not be less than one character in length");A!==0;){for(;j(A);)A=n.input.charCodeAt(++n.position);if(A===35){do A=n.input.charCodeAt(++n.position);while(A!==0&&!M(A));break}if(M(A))break;for(b=n.position;A!==0&&!D(A);)A=n.input.charCodeAt(++n.position);l.push(n.input.slice(b,n.position))}A!==0&&Fe(n),o.call(cn,O)?cn[O](n,O,l):Re(n,'unknown document directive "'+O+'"')}if(z(n,!0,-1),n.lineIndent===0&&n.input.charCodeAt(n.position)===45&&n.input.charCodeAt(n.position+1)===45&&n.input.charCodeAt(n.position+2)===45?(n.position+=3,z(n,!0,-1)):y&&H(n,"directives end mark is expected"),ge(n,n.lineIndent-1,u,!1,!0),z(n,!0,-1),n.checkLineBreaks&&x.test(n.input.slice(p,n.position))&&Re(n,"non-ASCII line breaks are interpreted as content"),n.documents.push(n.result),n.position===n.lineStart&&Me(n)){n.input.charCodeAt(n.position)===46&&(n.position+=3,z(n,!0,-1));return}n.position<n.length-1&&H(n,"end of the stream or a document separator is expected")}function bn(n,p){n=String(n),p=p||{},n.length!==0&&(n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=`
39
- `),n.charCodeAt(0)===65279&&(n=n.slice(1)));let y=new ee(n,p),A=n.indexOf("\0");for(A!==-1&&(y.position=A,H(y,"null byte is not allowed in input")),y.input+="\0";y.input.charCodeAt(y.position)===32;)y.lineIndent+=1,y.position+=1;for(;y.position<y.length-1;)Dn(y);return y.documents}function yn(n,p,y){p!==null&&typeof p=="object"&&typeof y>"u"&&(y=p,p=null);let A=bn(n,y);if(typeof p!="function")return A;for(let b=0,O=A.length;b<O;b+=1)p(A[b])}function qn(n,p){let y=bn(n,p);if(y.length!==0){if(y.length===1)return y[0];throw new e("expected a single document in the stream, but found more")}}return $n.loadAll=yn,$n.load=qn,$n}var St={},vi;function Jr(){if(vi)return St;vi=1;let r=Ze(),e=en(),t=vt(),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty,s=65279,a=9,d=10,u=13,c=32,f=33,h=34,g=35,x=37,$=38,E=39,v=42,P=44,M=45,j=58,D=61,Z=62,oe=63,K=64,Ae=91,Oe=93,L=96,se=123,$e=124,te=125,ee={};ee[0]="\\0",ee[7]="\\a",ee[8]="\\b",ee[9]="\\t",ee[10]="\\n",ee[11]="\\v",ee[12]="\\f",ee[13]="\\r",ee[27]="\\e",ee[34]='\\"',ee[92]="\\\\",ee[133]="\\N",ee[160]="\\_",ee[8232]="\\L",ee[8233]="\\P";let ln=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],H=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Re(l,m){if(m===null)return{};let C={},w=Object.keys(m);for(let _=0,S=w.length;_<S;_+=1){let k=w[_],N=String(m[k]);k.slice(0,2)==="!!"&&(k="tag:yaml.org,2002:"+k.slice(2));let T=l.compiledTypeMap.fallback[k];T&&o.call(T.styleAliases,N)&&(N=T.styleAliases[N]),C[k]=N}return C}function fe(l){let m,C,w=l.toString(16).toUpperCase();if(l<=255)m="x",C=2;else if(l<=65535)m="u",C=4;else if(l<=4294967295)m="U",C=8;else throw new e("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+m+r.repeat("0",C-w.length)+w}let Fn=1,Te=2;function Mn(l){this.schema=l.schema||t,this.indent=Math.max(1,l.indent||2),this.noArrayIndent=l.noArrayIndent||!1,this.skipInvalid=l.skipInvalid||!1,this.flowLevel=r.isNothing(l.flowLevel)?-1:l.flowLevel,this.styleMap=Re(this.schema,l.styles||null),this.sortKeys=l.sortKeys||!1,this.lineWidth=l.lineWidth||80,this.noRefs=l.noRefs||!1,this.noCompatMode=l.noCompatMode||!1,this.condenseFlow=l.condenseFlow||!1,this.quotingType=l.quotingType==='"'?Te:Fn,this.forceQuotes=l.forceQuotes||!1,this.replacer=typeof l.replacer=="function"?l.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function We(l,m){let C=r.repeat(" ",m),w=0,_="",S=l.length;for(;w<S;){let k,N=l.indexOf(`
38
+ `,b?1+m:m),b=!0,O=!0,m=0;let S=n.position;for(;!M(_)&&_!==0;)_=n.input.charCodeAt(++n.position);ae(n,S,n.position,!1)}return!0}function me(n,p){let y=n.tag,A=n.anchor,b=[],O=!1;if(n.firstTabInLine!==-1)return!1;n.anchor!==null&&fe(n,n.anchor,b);let l=n.input.charCodeAt(n.position);for(;l!==0&&(n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,H(n,"tab characters must not be used in indentation")),l===45);){let m=n.input.charCodeAt(n.position+1);if(!D(m))break;if(O=!0,n.position++,z(n,!0,-1)&&n.lineIndent<=p){b.push(null),l=n.input.charCodeAt(n.position);continue}let C=n.line;if(ge(n,p,d,!1,!0),b.push(n.result),z(n,!0,-1),l=n.input.charCodeAt(n.position),(n.line===C||n.lineIndent>p)&&l!==0)H(n,"bad indentation of a sequence entry");else if(n.lineIndent<p)break}return O?(n.tag=y,n.anchor=A,n.kind="sequence",n.result=b,!0):!1}function hn(n,p,y){let A,b,O,l,m=n.tag,C=n.anchor,w={},_=Object.create(null),S=null,k=null,N=null,T=!1,R=!1;if(n.firstTabInLine!==-1)return!1;n.anchor!==null&&fe(n,n.anchor,w);let F=n.input.charCodeAt(n.position);for(;F!==0;){!T&&n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,H(n,"tab characters must not be used in indentation"));let q=n.input.charCodeAt(n.position+1),W=n.line;if((F===63||F===58)&&D(q))F===63?(T&&(pe(n,w,_,S,k,null,b,O,l),S=k=N=null),R=!0,T=!0,A=!0):T?(T=!1,A=!0):H(n,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),n.position+=1,F=q;else{if(b=n.line,O=n.lineStart,l=n.position,!ge(n,y,a,!1,!0))break;if(n.line===W){for(F=n.input.charCodeAt(n.position);L(F);)F=n.input.charCodeAt(++n.position);if(F===58)F=n.input.charCodeAt(++n.position),D(F)||H(n,"a whitespace character is expected after the key-value separator within a block mapping"),T&&(pe(n,w,_,S,k,null,b,O,l),S=k=N=null),R=!0,T=!1,A=!1,S=n.tag,k=n.result;else if(R)H(n,"can not read an implicit mapping pair; a colon is missed");else return n.tag=m,n.anchor=C,!0}else if(R)H(n,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.tag=m,n.anchor=C,!0}if((n.line===W||n.lineIndent>p)&&(T&&(b=n.line,O=n.lineStart,l=n.position),ge(n,p,u,!0,A)&&(T?k=n.result:N=n.result),T||(pe(n,w,_,S,k,N,b,O,l),S=k=N=null),z(n,!0,-1),F=n.input.charCodeAt(n.position)),(n.line===W||n.lineIndent>p)&&F!==0)H(n,"bad indentation of a mapping entry");else if(n.lineIndent<p)break}return T&&pe(n,w,_,S,k,null,b,O,l),R&&(n.tag=m,n.anchor=C,n.kind="mapping",n.result=w),R}function jn(n){let p=!1,y=!1,A,b,O=n.input.charCodeAt(n.position);if(O!==33)return!1;n.tag!==null&&H(n,"duplication of a tag property"),O=n.input.charCodeAt(++n.position),O===60?(p=!0,O=n.input.charCodeAt(++n.position)):O===33?(y=!0,A="!!",O=n.input.charCodeAt(++n.position)):A="!";let l=n.position;if(p){do O=n.input.charCodeAt(++n.position);while(O!==0&&O!==62);n.position<n.length?(b=n.input.slice(l,n.position),O=n.input.charCodeAt(++n.position)):H(n,"unexpected end of the stream within a verbatim tag")}else{for(;O!==0&&!D(O);)O===33&&(y?H(n,"tag suffix cannot contain exclamation marks"):(A=n.input.slice(l-1,n.position+1),E.test(A)||H(n,"named tag handle cannot contain such characters"),y=!0,l=n.position+1)),O=n.input.charCodeAt(++n.position);b=n.input.slice(l,n.position),$.test(b)&&H(n,"tag suffix cannot contain flow indicator characters")}b&&!v.test(b)&&H(n,"tag name cannot contain such characters: "+b);try{b=decodeURIComponent(b)}catch{H(n,"tag name is malformed: "+b)}return p?n.tag=b:o.call(n.tagMap,A)?n.tag=n.tagMap[A]+b:A==="!"?n.tag="!"+b:A==="!!"?n.tag="tag:yaml.org,2002:"+b:H(n,'undeclared tag handle "'+A+'"'),!0}function mn(n){let p=n.input.charCodeAt(n.position);if(p!==38)return!1;n.anchor!==null&&H(n,"duplication of an anchor property"),p=n.input.charCodeAt(++n.position);let y=n.position;for(;p!==0&&!D(p)&&!Z(p);)p=n.input.charCodeAt(++n.position);return n.position===y&&H(n,"name of an anchor node must contain at least one character"),n.anchor=n.input.slice(y,n.position),!0}function gn(n){let p=n.input.charCodeAt(n.position);if(p!==42)return!1;p=n.input.charCodeAt(++n.position);let y=n.position;for(;p!==0&&!D(p)&&!Z(p);)p=n.input.charCodeAt(++n.position);n.position===y&&H(n,"name of an alias node must contain at least one character");let A=n.input.slice(y,n.position);return o.call(n.anchorMap,A)||H(n,'unidentified alias "'+A+'"'),n.result=n.anchorMap[A],z(n,!0,-1),!0}function Ln(n,p,y,A){let b=Ge(n);return Fn(n),Pe(n,p),n.tag=null,n.anchor=null,n.kind=null,n.result=null,hn(n,y,A)&&n.kind==="mapping"?(Ne(n),!0):(Mn(n),Pe(n,b),!1)}function ge(n,p,y,A,b){let O,l,m=1,C=!1,w=!1,_=null,S,k,N;n.depth>=n.maxDepth&&H(n,"nesting exceeded maxDepth ("+n.maxDepth+")"),n.depth+=1,n.listener!==null&&n.listener("open",n),n.tag=null,n.anchor=null,n.kind=null,n.result=null;let T=O=l=u===y||d===y;if(A&&z(n,!0,-1)&&(C=!0,n.lineIndent>p?m=1:n.lineIndent===p?m=0:n.lineIndent<p&&(m=-1)),m===1)for(;;){let R=n.input.charCodeAt(n.position),F=Ge(n);if(C&&(R===33&&n.tag!==null||R===38&&n.anchor!==null)||!jn(n)&&!mn(n))break;_===null&&(_=F),z(n,!0,-1)?(C=!0,l=T,n.lineIndent>p?m=1:n.lineIndent===p?m=0:n.lineIndent<p&&(m=-1)):l=!1}if(l&&(l=C||b),m===1||u===y)if(s===y||a===y?k=p:k=p+1,N=n.position-n.lineStart,m===1)if(l&&(me(n,N)||hn(n,N,k))||fn(n,k))w=!0;else{let R=n.input.charCodeAt(n.position);_!==null&&T&&!l&&R!==124&&R!==62&&Ln(n,_,_.position-_.lineStart,k)||O&&pn(n,k)||dn(n,k)||We(n,k)?w=!0:gn(n)?(w=!0,(n.tag!==null||n.anchor!==null)&&H(n,"alias node should not have any properties")):un(n,k,s===y)&&(w=!0,n.tag===null&&(n.tag="?")),n.anchor!==null&&fe(n,n.anchor,n.result)}else m===0&&(w=l&&me(n,N));if(n.tag===null)n.anchor!==null&&fe(n,n.anchor,n.result);else if(n.tag==="?"){n.result!==null&&n.kind!=="scalar"&&H(n,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+n.kind+'"');for(let R=0,F=n.implicitTypes.length;R<F;R+=1)if(S=n.implicitTypes[R],S.resolve(n.result)){n.result=S.construct(n.result),n.tag=S.tag,n.anchor!==null&&fe(n,n.anchor,n.result);break}}else if(n.tag!=="!"){if(o.call(n.typeMap[n.kind||"fallback"],n.tag))S=n.typeMap[n.kind||"fallback"][n.tag];else{S=null;let R=n.typeMap.multi[n.kind||"fallback"];for(let F=0,q=R.length;F<q;F+=1)if(n.tag.slice(0,R[F].tag.length)===R[F].tag){S=R[F];break}}S||H(n,"unknown tag !<"+n.tag+">"),n.result!==null&&S.kind!==n.kind&&H(n,"unacceptable node kind for !<"+n.tag+'> tag; it should be "'+S.kind+'", not "'+n.kind+'"'),S.resolve(n.result,n.tag)?(n.result=S.construct(n.result,n.tag),n.anchor!==null&&fe(n,n.anchor,n.result)):H(n,"cannot resolve a node with !<"+n.tag+"> explicit tag")}return n.listener!==null&&n.listener("close",n),n.depth-=1,n.tag!==null||n.anchor!==null||w}function Dn(n){let p=n.position,y=!1,A;for(n.version=null,n.checkLineBreaks=n.legacy,n.tagMap=Object.create(null),n.anchorMap=Object.create(null);(A=n.input.charCodeAt(n.position))!==0&&(z(n,!0,-1),A=n.input.charCodeAt(n.position),!(n.lineIndent>0||A!==37));){y=!0,A=n.input.charCodeAt(++n.position);let b=n.position;for(;A!==0&&!D(A);)A=n.input.charCodeAt(++n.position);let O=n.input.slice(b,n.position),l=[];for(O.length<1&&H(n,"directive name must not be less than one character in length");A!==0;){for(;L(A);)A=n.input.charCodeAt(++n.position);if(A===35){do A=n.input.charCodeAt(++n.position);while(A!==0&&!M(A));break}if(M(A))break;for(b=n.position;A!==0&&!D(A);)A=n.input.charCodeAt(++n.position);l.push(n.input.slice(b,n.position))}A!==0&&Fe(n),o.call(cn,O)?cn[O](n,O,l):Ie(n,'unknown document directive "'+O+'"')}if(z(n,!0,-1),n.lineIndent===0&&n.input.charCodeAt(n.position)===45&&n.input.charCodeAt(n.position+1)===45&&n.input.charCodeAt(n.position+2)===45?(n.position+=3,z(n,!0,-1)):y&&H(n,"directives end mark is expected"),ge(n,n.lineIndent-1,u,!1,!0),z(n,!0,-1),n.checkLineBreaks&&x.test(n.input.slice(p,n.position))&&Ie(n,"non-ASCII line breaks are interpreted as content"),n.documents.push(n.result),n.position===n.lineStart&&Me(n)){n.input.charCodeAt(n.position)===46&&(n.position+=3,z(n,!0,-1));return}n.position<n.length-1&&H(n,"end of the stream or a document separator is expected")}function bn(n,p){n=String(n),p=p||{},n.length!==0&&(n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=`
39
+ `),n.charCodeAt(0)===65279&&(n=n.slice(1)));let y=new ee(n,p),A=n.indexOf("\0");for(A!==-1&&(y.position=A,H(y,"null byte is not allowed in input")),y.input+="\0";y.input.charCodeAt(y.position)===32;)y.lineIndent+=1,y.position+=1;for(;y.position<y.length-1;)Dn(y);return y.documents}function yn(n,p,y){p!==null&&typeof p=="object"&&typeof y>"u"&&(y=p,p=null);let A=bn(n,y);if(typeof p!="function")return A;for(let b=0,O=A.length;b<O;b+=1)p(A[b])}function qn(n,p){let y=bn(n,p);if(y.length!==0){if(y.length===1)return y[0];throw new e("expected a single document in the stream, but found more")}}return $n.loadAll=yn,$n.load=qn,$n}var St={},vi;function Jr(){if(vi)return St;vi=1;let r=Ze(),e=en(),t=vt(),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty,s=65279,a=9,d=10,u=13,c=32,f=33,h=34,g=35,x=37,$=38,E=39,v=42,P=44,M=45,L=58,D=61,Z=62,oe=63,K=64,xe=91,$e=93,j=96,se=123,Te=124,te=125,ee={};ee[0]="\\0",ee[7]="\\a",ee[8]="\\b",ee[9]="\\t",ee[10]="\\n",ee[11]="\\v",ee[12]="\\f",ee[13]="\\r",ee[27]="\\e",ee[34]='\\"',ee[92]="\\\\",ee[133]="\\N",ee[160]="\\_",ee[8232]="\\L",ee[8233]="\\P";let ln=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],H=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Ie(l,m){if(m===null)return{};let C={},w=Object.keys(m);for(let _=0,S=w.length;_<S;_+=1){let k=w[_],N=String(m[k]);k.slice(0,2)==="!!"&&(k="tag:yaml.org,2002:"+k.slice(2));let T=l.compiledTypeMap.fallback[k];T&&o.call(T.styleAliases,N)&&(N=T.styleAliases[N]),C[k]=N}return C}function fe(l){let m,C,w=l.toString(16).toUpperCase();if(l<=255)m="x",C=2;else if(l<=65535)m="u",C=4;else if(l<=4294967295)m="U",C=8;else throw new e("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+m+r.repeat("0",C-w.length)+w}let Fn=1,Ne=2;function Mn(l){this.schema=l.schema||t,this.indent=Math.max(1,l.indent||2),this.noArrayIndent=l.noArrayIndent||!1,this.skipInvalid=l.skipInvalid||!1,this.flowLevel=r.isNothing(l.flowLevel)?-1:l.flowLevel,this.styleMap=Ie(this.schema,l.styles||null),this.sortKeys=l.sortKeys||!1,this.lineWidth=l.lineWidth||80,this.noRefs=l.noRefs||!1,this.noCompatMode=l.noCompatMode||!1,this.condenseFlow=l.condenseFlow||!1,this.quotingType=l.quotingType==='"'?Ne:Fn,this.forceQuotes=l.forceQuotes||!1,this.replacer=typeof l.replacer=="function"?l.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ge(l,m){let C=r.repeat(" ",m),w=0,_="",S=l.length;for(;w<S;){let k,N=l.indexOf(`
40
40
  `,w);N===-1?(k=l.slice(w),w=S):(k=l.slice(w,N+1),w=N+1),k.length&&k!==`
41
41
  `&&(_+=C),_+=k}return _}function Pe(l,m){return`
42
- `+r.repeat(" ",l.indent*m)}function cn(l,m){for(let C=0,w=l.implicitTypes.length;C<w;C+=1)if(l.implicitTypes[C].resolve(m))return!0;return!1}function ae(l){return l===c||l===a}function xe(l){return l>=32&&l<=126||l>=161&&l<=55295&&l!==8232&&l!==8233||l>=57344&&l<=65533&&l!==s||l>=65536&&l<=1114111}function pe(l){return xe(l)&&l!==s&&l!==u&&l!==d}function Fe(l,m,C){let w=pe(l),_=w&&!ae(l);return(C?w:w&&l!==P&&l!==Ae&&l!==Oe&&l!==se&&l!==te)&&l!==g&&!(m===j&&!_)||pe(m)&&!ae(m)&&l===g||m===j&&_}function z(l){return xe(l)&&l!==s&&!ae(l)&&l!==M&&l!==oe&&l!==j&&l!==P&&l!==Ae&&l!==Oe&&l!==se&&l!==te&&l!==g&&l!==$&&l!==v&&l!==f&&l!==$e&&l!==D&&l!==Z&&l!==E&&l!==h&&l!==x&&l!==K&&l!==L}function Me(l){return!ae(l)&&l!==j}function he(l,m){let C=l.charCodeAt(m),w;return C>=55296&&C<=56319&&m+1<l.length&&(w=l.charCodeAt(m+1),w>=56320&&w<=57343)?(C-55296)*1024+w-56320+65536:C}function un(l){return/^\n* /.test(l)}let dn=1,Ge=2,fn=3,pn=4,me=5;function hn(l,m,C,w,_,S,k,N){let T,I=0,F=null,q=!1,G=!1,It=w!==-1,Ye=-1,Ke=z(he(l,0))&&Me(he(l,l.length-1));if(m||k)for(T=0;T<l.length;I>=65536?T+=2:T++){if(I=he(l,T),!xe(I))return me;Ke=Ke&&Fe(I,F,N),F=I}else{for(T=0;T<l.length;I>=65536?T+=2:T++){if(I=he(l,T),I===d)q=!0,It&&(G=G||T-Ye-1>w&&l[Ye+1]!==" ",Ye=T);else if(!xe(I))return me;Ke=Ke&&Fe(I,F,N),F=I}G=G||It&&T-Ye-1>w&&l[Ye+1]!==" "}return!q&&!G?Ke&&!k&&!_(l)?dn:S===Te?me:Ge:C>9&&un(l)?me:k?S===Te?me:Ge:G?pn:fn}function Ln(l,m,C,w,_){l.dump=(function(){if(m.length===0)return l.quotingType===Te?'""':"''";if(!l.noCompatMode&&(ln.indexOf(m)!==-1||H.test(m)))return l.quotingType===Te?'"'+m+'"':"'"+m+"'";let S=l.indent*Math.max(1,C),k=l.lineWidth===-1?-1:Math.max(Math.min(l.lineWidth,40),l.lineWidth-S),N=w||l.flowLevel>-1&&C>=l.flowLevel;function T(I){return cn(l,I)}switch(hn(m,N,l.indent,k,T,l.quotingType,l.forceQuotes&&!w,_)){case dn:return m;case Ge:return"'"+m.replace(/'/g,"''")+"'";case fn:return"|"+mn(m,l.indent)+gn(We(m,S));case pn:return">"+mn(m,l.indent)+gn(We(jn(m,k),S));case me:return'"'+Dn(m)+'"';default:throw new e("impossible error: invalid scalar style")}})()}function mn(l,m){let C=un(l)?String(m):"",w=l[l.length-1]===`
42
+ `+r.repeat(" ",l.indent*m)}function cn(l,m){for(let C=0,w=l.implicitTypes.length;C<w;C+=1)if(l.implicitTypes[C].resolve(m))return!0;return!1}function ae(l){return l===c||l===a}function ke(l){return l>=32&&l<=126||l>=161&&l<=55295&&l!==8232&&l!==8233||l>=57344&&l<=65533&&l!==s||l>=65536&&l<=1114111}function pe(l){return ke(l)&&l!==s&&l!==u&&l!==d}function Fe(l,m,C){let w=pe(l),_=w&&!ae(l);return(C?w:w&&l!==P&&l!==xe&&l!==$e&&l!==se&&l!==te)&&l!==g&&!(m===L&&!_)||pe(m)&&!ae(m)&&l===g||m===L&&_}function z(l){return ke(l)&&l!==s&&!ae(l)&&l!==M&&l!==oe&&l!==L&&l!==P&&l!==xe&&l!==$e&&l!==se&&l!==te&&l!==g&&l!==$&&l!==v&&l!==f&&l!==Te&&l!==D&&l!==Z&&l!==E&&l!==h&&l!==x&&l!==K&&l!==j}function Me(l){return!ae(l)&&l!==L}function he(l,m){let C=l.charCodeAt(m),w;return C>=55296&&C<=56319&&m+1<l.length&&(w=l.charCodeAt(m+1),w>=56320&&w<=57343)?(C-55296)*1024+w-56320+65536:C}function un(l){return/^\n* /.test(l)}let dn=1,We=2,fn=3,pn=4,me=5;function hn(l,m,C,w,_,S,k,N){let T,R=0,F=null,q=!1,W=!1,Rt=w!==-1,Ye=-1,Ke=z(he(l,0))&&Me(he(l,l.length-1));if(m||k)for(T=0;T<l.length;R>=65536?T+=2:T++){if(R=he(l,T),!ke(R))return me;Ke=Ke&&Fe(R,F,N),F=R}else{for(T=0;T<l.length;R>=65536?T+=2:T++){if(R=he(l,T),R===d)q=!0,Rt&&(W=W||T-Ye-1>w&&l[Ye+1]!==" ",Ye=T);else if(!ke(R))return me;Ke=Ke&&Fe(R,F,N),F=R}W=W||Rt&&T-Ye-1>w&&l[Ye+1]!==" "}return!q&&!W?Ke&&!k&&!_(l)?dn:S===Ne?me:We:C>9&&un(l)?me:k?S===Ne?me:We:W?pn:fn}function jn(l,m,C,w,_){l.dump=(function(){if(m.length===0)return l.quotingType===Ne?'""':"''";if(!l.noCompatMode&&(ln.indexOf(m)!==-1||H.test(m)))return l.quotingType===Ne?'"'+m+'"':"'"+m+"'";let S=l.indent*Math.max(1,C),k=l.lineWidth===-1?-1:Math.max(Math.min(l.lineWidth,40),l.lineWidth-S),N=w||l.flowLevel>-1&&C>=l.flowLevel;function T(R){return cn(l,R)}switch(hn(m,N,l.indent,k,T,l.quotingType,l.forceQuotes&&!w,_)){case dn:return m;case We:return"'"+m.replace(/'/g,"''")+"'";case fn:return"|"+mn(m,l.indent)+gn(Ge(m,S));case pn:return">"+mn(m,l.indent)+gn(Ge(Ln(m,k),S));case me:return'"'+Dn(m)+'"';default:throw new e("impossible error: invalid scalar style")}})()}function mn(l,m){let C=un(l)?String(m):"",w=l[l.length-1]===`
43
43
  `,S=w&&(l[l.length-2]===`
44
44
  `||l===`
45
45
  `)?"+":w?"":"-";return C+S+`
46
46
  `}function gn(l){return l[l.length-1]===`
47
- `?l.slice(0,-1):l}function jn(l,m){let C=/(\n+)([^\n]*)/g,w=(function(){let N=l.indexOf(`
47
+ `?l.slice(0,-1):l}function Ln(l,m){let C=/(\n+)([^\n]*)/g,w=(function(){let N=l.indexOf(`
48
48
  `);return N=N!==-1?N:l.length,C.lastIndex=N,ge(l.slice(0,N),m)})(),_=l[0]===`
49
49
  `||l[0]===" ",S,k;for(;k=C.exec(l);){let N=k[1],T=k[2];S=T[0]===" ",w+=N+(!_&&!S&&T!==""?`
50
50
  `:"")+ge(T,m),_=S}return w}function ge(l,m){if(l===""||l[0]===" ")return l;let C=/ [^ ]/g,w,_=0,S,k=0,N=0,T="";for(;w=C.exec(l);)N=w.index,N-_>m&&(S=k>_?k:N,T+=`
51
51
  `+l.slice(_,S),_=S+1),k=N;return T+=`
52
52
  `,l.length-_>m&&k>_?T+=l.slice(_,k)+`
53
- `+l.slice(k+1):T+=l.slice(_),T.slice(1)}function Dn(l){let m="",C=0;for(let w=0;w<l.length;C>=65536?w+=2:w++){C=he(l,w);let _=ee[C];!_&&xe(C)?(m+=l[w],C>=65536&&(m+=l[w+1])):m+=_||fe(C)}return m}function bn(l,m,C){let w="",_=l.tag;for(let S=0,k=C.length;S<k;S+=1){let N=C[S];l.replacer&&(N=l.replacer.call(C,String(S),N)),(y(l,m,N,!1,!1)||typeof N>"u"&&y(l,m,null,!1,!1))&&(w!==""&&(w+=","+(l.condenseFlow?"":" ")),w+=l.dump)}l.tag=_,l.dump="["+w+"]"}function yn(l,m,C,w){let _="",S=l.tag;for(let k=0,N=C.length;k<N;k+=1){let T=C[k];l.replacer&&(T=l.replacer.call(C,String(k),T)),(y(l,m+1,T,!0,!0,!1,!0)||typeof T>"u"&&y(l,m+1,null,!0,!0,!1,!0))&&((!w||_!=="")&&(_+=Pe(l,m)),l.dump&&d===l.dump.charCodeAt(0)?_+="-":_+="- ",_+=l.dump)}l.tag=S,l.dump=_||"[]"}function qn(l,m,C){let w="",_=l.tag,S=Object.keys(C);for(let k=0,N=S.length;k<N;k+=1){let T="";w!==""&&(T+=", "),l.condenseFlow&&(T+='"');let I=S[k],F=C[I];l.replacer&&(F=l.replacer.call(C,I,F)),y(l,m,I,!1,!1)&&(l.dump.length>1024&&(T+="? "),T+=l.dump+(l.condenseFlow?'"':"")+":"+(l.condenseFlow?"":" "),y(l,m,F,!1,!1)&&(T+=l.dump,w+=T))}l.tag=_,l.dump="{"+w+"}"}function n(l,m,C,w){let _="",S=l.tag,k=Object.keys(C);if(l.sortKeys===!0)k.sort();else if(typeof l.sortKeys=="function")k.sort(l.sortKeys);else if(l.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let N=0,T=k.length;N<T;N+=1){let I="";(!w||_!=="")&&(I+=Pe(l,m));let F=k[N],q=C[F];if(l.replacer&&(q=l.replacer.call(C,F,q)),!y(l,m+1,F,!0,!0,!0))continue;let G=l.tag!==null&&l.tag!=="?"||l.dump&&l.dump.length>1024;G&&(l.dump&&d===l.dump.charCodeAt(0)?I+="?":I+="? "),I+=l.dump,G&&(I+=Pe(l,m)),y(l,m+1,q,!0,G)&&(l.dump&&d===l.dump.charCodeAt(0)?I+=":":I+=": ",I+=l.dump,_+=I)}l.tag=S,l.dump=_||"{}"}function p(l,m,C){let w=C?l.explicitTypes:l.implicitTypes;for(let _=0,S=w.length;_<S;_+=1){let k=w[_];if((k.instanceOf||k.predicate)&&(!k.instanceOf||typeof m=="object"&&m instanceof k.instanceOf)&&(!k.predicate||k.predicate(m))){if(C?k.multi&&k.representName?l.tag=k.representName(m):l.tag=k.tag:l.tag="?",k.represent){let N=l.styleMap[k.tag]||k.defaultStyle,T;if(i.call(k.represent)==="[object Function]")T=k.represent(m,N);else if(o.call(k.represent,N))T=k.represent[N](m,N);else throw new e("!<"+k.tag+'> tag resolver accepts not "'+N+'" style');l.dump=T}return!0}}return!1}function y(l,m,C,w,_,S,k){l.tag=null,l.dump=C,p(l,C,!1)||p(l,C,!0);let N=i.call(l.dump),T=w;w&&(w=l.flowLevel<0||l.flowLevel>m);let I=N==="[object Object]"||N==="[object Array]",F,q;if(I&&(F=l.duplicates.indexOf(C),q=F!==-1),(l.tag!==null&&l.tag!=="?"||q||l.indent!==2&&m>0)&&(_=!1),q&&l.usedDuplicates[F])l.dump="*ref_"+F;else{if(I&&q&&!l.usedDuplicates[F]&&(l.usedDuplicates[F]=!0),N==="[object Object]")w&&Object.keys(l.dump).length!==0?(n(l,m,l.dump,_),q&&(l.dump="&ref_"+F+l.dump)):(qn(l,m,l.dump),q&&(l.dump="&ref_"+F+" "+l.dump));else if(N==="[object Array]")w&&l.dump.length!==0?(l.noArrayIndent&&!k&&m>0?yn(l,m-1,l.dump,_):yn(l,m,l.dump,_),q&&(l.dump="&ref_"+F+l.dump)):(bn(l,m,l.dump),q&&(l.dump="&ref_"+F+" "+l.dump));else if(N==="[object String]")l.tag!=="?"&&Ln(l,l.dump,m,S,T);else{if(N==="[object Undefined]")return!1;if(l.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+N)}if(l.tag!==null&&l.tag!=="?"){let G=encodeURI(l.tag[0]==="!"?l.tag.slice(1):l.tag).replace(/!/g,"%21");l.tag[0]==="!"?G="!"+G:G.slice(0,18)==="tag:yaml.org,2002:"?G="!!"+G.slice(18):G="!<"+G+">",l.dump=G+" "+l.dump}}return!0}function A(l,m){let C=[],w=[];b(l,C,w);let _=w.length;for(let S=0;S<_;S+=1)m.duplicates.push(C[w[S]]);m.usedDuplicates=new Array(_)}function b(l,m,C){if(l!==null&&typeof l=="object"){let w=m.indexOf(l);if(w!==-1)C.indexOf(w)===-1&&C.push(w);else if(m.push(l),Array.isArray(l))for(let _=0,S=l.length;_<S;_+=1)b(l[_],m,C);else{let _=Object.keys(l);for(let S=0,k=_.length;S<k;S+=1)b(l[_[S]],m,C)}}}function O(l,m){m=m||{};let C=new Mn(m);C.noRefs||A(l,C);let w=l;return C.replacer&&(w=C.replacer.call({"":w},"",w)),y(C,0,w,!0,!0)?C.dump+`
54
- `:""}return St.dump=O,St}var Oi;function zr(){if(Oi)return ie;Oi=1;let r=Kr(),e=Jr();function t(i,o){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+o+" instead, which is now safe by default.")}}return ie.Type=re(),ie.Schema=$i(),ie.FAILSAFE_SCHEMA=Ii(),ie.JSON_SCHEMA=Li(),ie.CORE_SCHEMA=ji(),ie.DEFAULT_SCHEMA=vt(),ie.load=r.load,ie.loadAll=r.loadAll,ie.dump=e.dump,ie.YAMLException=en(),ie.types={binary:Bi(),float:Mi(),map:Hi(),null:Ri(),pairs:Vi(),set:Wi(),timestamp:Di(),bool:Pi(),int:Fi(),merge:qi(),omap:Ui(),seq:Ni(),str:Ti()},ie.safeLoad=t("safeLoad","load"),ie.safeLoadAll=t("safeLoadAll","loadAll"),ie.safeDump=t("safeDump","dump"),ie}var Xr=zr(),ye=Gr(Xr),{Type:ws,Schema:_s,FAILSAFE_SCHEMA:As,JSON_SCHEMA:xs,CORE_SCHEMA:ks,DEFAULT_SCHEMA:Cs,load:Es,loadAll:Ss,dump:vs,YAMLException:Os,types:$s,safeLoad:Ts,safeLoadAll:Ns,safeDump:Hs}=ye;R();R();function nn(r){return`\${{ secrets.${r} }}`}function Ne(r,e){if(!e)return"";let t=r.specDir?.replace(/\/+$/,"");return t?`${t}/${e}`:e}function ue(r){let e=ze(r.config);return e.mode==="app"?"${{ steps.app-token.outputs.token }}":e.mode==="pat"?nn(e.tokenSecret??"AGENT_PAT"):"${{ github.token }}"}function Tn(r){let e=ze(r.config);if(!(e.mode!=="app"||!e.appIdSecret||!e.appKeySecret))return{uses:"actions/create-github-app-token@v3",id:"app-token",name:"Mint app token",with:{"app-id":nn(e.appIdSecret),"private-key":nn(e.appKeySecret)}}}function Nn(r,e={}){let t={token:ue(r)};return e.ref&&(t.ref=e.ref),e.fetchDepth!==void 0&&(t["fetch-depth"]=e.fetchDepth),{uses:"actions/checkout@v5",name:"Checkout",with:t}}function je(){return{uses:"./.github/agent-setup",name:"Setup agent toolchain"}}function Gi(r){let e=r.config.identity,t=e.git_name??e.bot_login??"gp-foundry agent",i=e.git_email??`${e.bot_login??"gp-foundry-agent"}@users.noreply.github.com`;return Ee({name:"Configure git identity",env:{GIT_NAME:t,GIT_EMAIL:i},run:`git config user.name "$GIT_NAME"
55
- git config user.email "$GIT_EMAIL"`})}function tn(r,e,t){let i={type:e,number:t,token:ue(r)},o=r.config.identity?.bot_login;return o&&(i["trusted-authors"]=o),{uses:r.actionRef("agent-context"),id:"ctx",name:"Fetch context",with:i}}function De(r,e){let t=r.node,i=r.config,o={"role-file":Ne(r,t.files.role),model:i.agent.model,"comms-file":Ne(r,"agents/communication.md"),"scope-path":Ne(r,"agents/scope.yaml"),"claude-code-oauth-token":nn(i.agent.oauth_token_secret??"CLAUDE_CODE_OAUTH_TOKEN"),"github-token":ue(r)};e.withContext&&(o["context-file"]="${{ steps.ctx.outputs.context-file }}"),i.agent.conventions&&(o.conventions=i.agent.conventions),i.agent.secrets?.length&&(o["extra-env"]=i.agent.secrets.map(a=>`${a}=${nn(a)}`).join(`
56
- `));let s=t.files.prompt;return s&&(o["prompt-override-file"]=Ne(r,s)),{uses:r.actionRef("run-agent"),name:"Run agent",with:o}}function Ee(r){return{shell:"bash",...r}}var He="${{ github.event.issue.number }}",rn="${{ github.event.pull_request.number }}",Hn="${{ github.event.pull_request.head.sha }}",Yi="${{ github.event.pull_request.head.ref }}";function qe(r,e){let t=r.attrs.timeout;return typeof t=="number"?t:e}function In(r,e){let t=[],i=Tn(r);return i&&t.push(i),t.push(Nn(r,e)),t.push(Gi(r)),t}function Ot(r){let e=r.node,t=e.context??"issue",i=t==="pr-diff"||t==="pr-review",o=i?{contents:"read","pull-requests":"write"}:{contents:"read",issues:"write"},s=[],a=Tn(r);a&&s.push(a),s.push(Nn(r,i?{ref:Hn,fetchDepth:0}:void 0));let d=typeof e.attrs.gates=="string"?e.attrs.gates:void 0,u=i&&d?d.split(",").map(h=>h.trim()).filter(Boolean):[],c=u.map((h,g)=>Qr(`gate-${h}`,g,u));u.forEach((h,g)=>{s.push({uses:r.actionRef("wait-for-checks"),id:c[g],name:`Wait for ${h}`,with:{sha:Hn,"workflow-name":h,token:ue(r)}})}),s.push(je());let f=t==="pr-diff"?"pr-diff":t==="pr-review"?"pr-review":"issue";return s.push(tn(r,f,i?rn:He)),u.length&&s.push(Zr(u,c)),s.push(De(r,{withContext:!0})),{jobId:e.id,name:e.id,permissions:o,timeoutMinutes:qe(e,15+15*u.length),steps:s}}function Qr(r,e,t){let i=a=>a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),o=i(r)||`gate-${e+1}`;return t.filter((a,d)=>d!==e&&i(`gate-${a}`)===o).length>0?`${o}-${e+1}`:o}function Zr(r,e){let t={CONTEXT_FILE:"${{ steps.ctx.outputs.context-file }}"},i=["{",' echo ""',' echo "=== CI GATES ==="'];return r.forEach((o,s)=>{t[`GATE_${s+1}_NAME`]=o,t[`GATE_${s+1}_RESULT`]=`\${{ steps.${e[s]}.outputs.conclusion }}`,i.push(` echo "$GATE_${s+1}_NAME: $GATE_${s+1}_RESULT"`)}),i.push(' echo ""',` echo "A gate whose result is not 'success' is a blocking finding: say which one"`,` echo "failed and request changes. 'timeout' or 'skipped' means CI never gave an"`,' echo "answer \u2014 treat it as unverified, not as a pass."','} >> "$CONTEXT_FILE"'),Ee({name:"Record CI gate results in the context",env:t,run:i.join(`
57
- `)})}function eo(r){let e=r.node,t=r.config,i=In(r);return i.push(Ee({id:"branch",name:"Create branch",env:{ISSUE_NUMBER:He,ISSUE_TITLE:"${{ github.event.issue.title }}",PREFIX:t.repo.branch_prefix},run:[`SLUG=$(printf '%s' "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-' | cut -c1-50 | sed 's/-$//')`,'BRANCH="$PREFIX$ISSUE_NUMBER-$SLUG"','git checkout -b "$BRANCH"','echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"'].join(`
58
- `)})),i.push(je()),i.push(tn(r,"issue",He)),i.push(De(r,{withContext:!0})),i.push({uses:r.actionRef("agent-fallback"),name:"Fallback: commit / push / PR",if:"${{ !cancelled() }}",with:{branch:"${{ steps.branch.outputs.branch }}",token:ue(r),"agent-name":e.id,"base-branch":t.repo.base_branch,"issue-number":He,"pr-title":"${{ github.event.issue.title }}","pr-body":`### \u{1F6E0}\uFE0F Auto-created (fallback)
53
+ `+l.slice(k+1):T+=l.slice(_),T.slice(1)}function Dn(l){let m="",C=0;for(let w=0;w<l.length;C>=65536?w+=2:w++){C=he(l,w);let _=ee[C];!_&&ke(C)?(m+=l[w],C>=65536&&(m+=l[w+1])):m+=_||fe(C)}return m}function bn(l,m,C){let w="",_=l.tag;for(let S=0,k=C.length;S<k;S+=1){let N=C[S];l.replacer&&(N=l.replacer.call(C,String(S),N)),(y(l,m,N,!1,!1)||typeof N>"u"&&y(l,m,null,!1,!1))&&(w!==""&&(w+=","+(l.condenseFlow?"":" ")),w+=l.dump)}l.tag=_,l.dump="["+w+"]"}function yn(l,m,C,w){let _="",S=l.tag;for(let k=0,N=C.length;k<N;k+=1){let T=C[k];l.replacer&&(T=l.replacer.call(C,String(k),T)),(y(l,m+1,T,!0,!0,!1,!0)||typeof T>"u"&&y(l,m+1,null,!0,!0,!1,!0))&&((!w||_!=="")&&(_+=Pe(l,m)),l.dump&&d===l.dump.charCodeAt(0)?_+="-":_+="- ",_+=l.dump)}l.tag=S,l.dump=_||"[]"}function qn(l,m,C){let w="",_=l.tag,S=Object.keys(C);for(let k=0,N=S.length;k<N;k+=1){let T="";w!==""&&(T+=", "),l.condenseFlow&&(T+='"');let R=S[k],F=C[R];l.replacer&&(F=l.replacer.call(C,R,F)),y(l,m,R,!1,!1)&&(l.dump.length>1024&&(T+="? "),T+=l.dump+(l.condenseFlow?'"':"")+":"+(l.condenseFlow?"":" "),y(l,m,F,!1,!1)&&(T+=l.dump,w+=T))}l.tag=_,l.dump="{"+w+"}"}function n(l,m,C,w){let _="",S=l.tag,k=Object.keys(C);if(l.sortKeys===!0)k.sort();else if(typeof l.sortKeys=="function")k.sort(l.sortKeys);else if(l.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let N=0,T=k.length;N<T;N+=1){let R="";(!w||_!=="")&&(R+=Pe(l,m));let F=k[N],q=C[F];if(l.replacer&&(q=l.replacer.call(C,F,q)),!y(l,m+1,F,!0,!0,!0))continue;let W=l.tag!==null&&l.tag!=="?"||l.dump&&l.dump.length>1024;W&&(l.dump&&d===l.dump.charCodeAt(0)?R+="?":R+="? "),R+=l.dump,W&&(R+=Pe(l,m)),y(l,m+1,q,!0,W)&&(l.dump&&d===l.dump.charCodeAt(0)?R+=":":R+=": ",R+=l.dump,_+=R)}l.tag=S,l.dump=_||"{}"}function p(l,m,C){let w=C?l.explicitTypes:l.implicitTypes;for(let _=0,S=w.length;_<S;_+=1){let k=w[_];if((k.instanceOf||k.predicate)&&(!k.instanceOf||typeof m=="object"&&m instanceof k.instanceOf)&&(!k.predicate||k.predicate(m))){if(C?k.multi&&k.representName?l.tag=k.representName(m):l.tag=k.tag:l.tag="?",k.represent){let N=l.styleMap[k.tag]||k.defaultStyle,T;if(i.call(k.represent)==="[object Function]")T=k.represent(m,N);else if(o.call(k.represent,N))T=k.represent[N](m,N);else throw new e("!<"+k.tag+'> tag resolver accepts not "'+N+'" style');l.dump=T}return!0}}return!1}function y(l,m,C,w,_,S,k){l.tag=null,l.dump=C,p(l,C,!1)||p(l,C,!0);let N=i.call(l.dump),T=w;w&&(w=l.flowLevel<0||l.flowLevel>m);let R=N==="[object Object]"||N==="[object Array]",F,q;if(R&&(F=l.duplicates.indexOf(C),q=F!==-1),(l.tag!==null&&l.tag!=="?"||q||l.indent!==2&&m>0)&&(_=!1),q&&l.usedDuplicates[F])l.dump="*ref_"+F;else{if(R&&q&&!l.usedDuplicates[F]&&(l.usedDuplicates[F]=!0),N==="[object Object]")w&&Object.keys(l.dump).length!==0?(n(l,m,l.dump,_),q&&(l.dump="&ref_"+F+l.dump)):(qn(l,m,l.dump),q&&(l.dump="&ref_"+F+" "+l.dump));else if(N==="[object Array]")w&&l.dump.length!==0?(l.noArrayIndent&&!k&&m>0?yn(l,m-1,l.dump,_):yn(l,m,l.dump,_),q&&(l.dump="&ref_"+F+l.dump)):(bn(l,m,l.dump),q&&(l.dump="&ref_"+F+" "+l.dump));else if(N==="[object String]")l.tag!=="?"&&jn(l,l.dump,m,S,T);else{if(N==="[object Undefined]")return!1;if(l.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+N)}if(l.tag!==null&&l.tag!=="?"){let W=encodeURI(l.tag[0]==="!"?l.tag.slice(1):l.tag).replace(/!/g,"%21");l.tag[0]==="!"?W="!"+W:W.slice(0,18)==="tag:yaml.org,2002:"?W="!!"+W.slice(18):W="!<"+W+">",l.dump=W+" "+l.dump}}return!0}function A(l,m){let C=[],w=[];b(l,C,w);let _=w.length;for(let S=0;S<_;S+=1)m.duplicates.push(C[w[S]]);m.usedDuplicates=new Array(_)}function b(l,m,C){if(l!==null&&typeof l=="object"){let w=m.indexOf(l);if(w!==-1)C.indexOf(w)===-1&&C.push(w);else if(m.push(l),Array.isArray(l))for(let _=0,S=l.length;_<S;_+=1)b(l[_],m,C);else{let _=Object.keys(l);for(let S=0,k=_.length;S<k;S+=1)b(l[_[S]],m,C)}}}function O(l,m){m=m||{};let C=new Mn(m);C.noRefs||A(l,C);let w=l;return C.replacer&&(w=C.replacer.call({"":w},"",w)),y(C,0,w,!0,!0)?C.dump+`
54
+ `:""}return St.dump=O,St}var Oi;function zr(){if(Oi)return ie;Oi=1;let r=Kr(),e=Jr();function t(i,o){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+o+" instead, which is now safe by default.")}}return ie.Type=re(),ie.Schema=$i(),ie.FAILSAFE_SCHEMA=Ri(),ie.JSON_SCHEMA=ji(),ie.CORE_SCHEMA=Li(),ie.DEFAULT_SCHEMA=vt(),ie.load=r.load,ie.loadAll=r.loadAll,ie.dump=e.dump,ie.YAMLException=en(),ie.types={binary:Bi(),float:Mi(),map:Hi(),null:Ii(),pairs:Vi(),set:Gi(),timestamp:Di(),bool:Pi(),int:Fi(),merge:qi(),omap:Ui(),seq:Ni(),str:Ti()},ie.safeLoad=t("safeLoad","load"),ie.safeLoadAll=t("safeLoadAll","loadAll"),ie.safeDump=t("safeDump","dump"),ie}var Xr=zr(),ye=Wr(Xr),{Type:ws,Schema:_s,FAILSAFE_SCHEMA:As,JSON_SCHEMA:xs,CORE_SCHEMA:ks,DEFAULT_SCHEMA:Cs,load:Es,loadAll:Ss,dump:vs,YAMLException:Os,types:$s,safeLoad:Ts,safeLoadAll:Ns,safeDump:Hs}=ye;I();I();function nn(r){return`\${{ secrets.${r} }}`}function Se(r,e){if(!e)return"";let t=r.specDir?.replace(/\/+$/,"");return t?`${t}/${e}`:e}function ue(r){let e=ze(r.config);return e.mode==="app"?"${{ steps.app-token.outputs.token }}":e.mode==="pat"?nn(e.tokenSecret??"AGENT_PAT"):"${{ github.token }}"}function Tn(r){let e=ze(r.config);if(!(e.mode!=="app"||!e.appIdSecret||!e.appKeySecret))return{uses:"actions/create-github-app-token@v3",id:"app-token",name:"Mint app token",with:{"app-id":nn(e.appIdSecret),"private-key":nn(e.appKeySecret)}}}function Nn(r,e={}){let t={token:ue(r)};return e.ref&&(t.ref=e.ref),e.fetchDepth!==void 0&&(t["fetch-depth"]=e.fetchDepth),{uses:"actions/checkout@v5",name:"Checkout",with:t}}function Le(){return{uses:"./.github/agent-setup",name:"Setup agent toolchain"}}function Wi(r){let e=r.config.identity,t=e.git_name??e.bot_login??"gp-foundry agent",i=e.git_email??`${e.bot_login??"gp-foundry-agent"}@users.noreply.github.com`;return we({name:"Configure git identity",env:{GIT_NAME:t,GIT_EMAIL:i},run:`git config user.name "$GIT_NAME"
55
+ git config user.email "$GIT_EMAIL"`})}function tn(r,e,t){let i={type:e,number:t,token:ue(r)},o=r.config.identity?.bot_login;return o&&(i["trusted-authors"]=o),{uses:r.actionRef("agent-context"),id:"ctx",name:"Fetch context",with:i}}function De(r,e){let t=r.node,i=r.config,o={"role-file":Se(r,t.files.role),model:i.agent.model,"comms-file":Se(r,"agents/communication.md"),"scope-path":Se(r,"agents/scope.yaml"),"claude-code-oauth-token":nn(i.agent.oauth_token_secret??"CLAUDE_CODE_OAUTH_TOKEN"),"github-token":ue(r)};e.withContext&&(o["context-file"]="${{ steps.ctx.outputs.context-file }}"),i.agent.conventions&&(o.conventions=i.agent.conventions);let s=typeof t.attrs.secrets=="string"?t.attrs.secrets.split(",").map(u=>u.trim()).filter(Boolean):[],a=[...new Set([...i.agent.secrets??[],...s])];a.length&&(o["extra-env"]=a.map(u=>`${u}=${nn(u)}`).join(`
56
+ `));let d=t.files.prompt;return d&&(o["prompt-override-file"]=Se(r,d)),{uses:r.actionRef("run-agent"),name:"Run agent",with:o}}function we(r){return{shell:"bash",...r}}var He="${{ github.event.issue.number }}",rn="${{ github.event.pull_request.number }}",Hn="${{ github.event.pull_request.head.sha }}",Yi="${{ github.event.pull_request.head.ref }}";function qe(r,e){let t=r.attrs.timeout;return typeof t=="number"?t:e}function Rn(r,e){let t=[],i=Tn(r);return i&&t.push(i),t.push(Nn(r,e)),t.push(Wi(r)),t}function Ot(r){let e=r.node,t=e.context??"issue",i=t==="pr-diff"||t==="pr-review",o=i?{contents:"read","pull-requests":"write"}:{contents:"read",issues:"write"},s=[],a=Tn(r);a&&s.push(a),s.push(Nn(r,i?{ref:Hn,fetchDepth:0}:void 0));let d=typeof e.attrs.gates=="string"?e.attrs.gates:void 0,u=i&&d?d.split(",").map(h=>h.trim()).filter(Boolean):[],c=u.map((h,g)=>Qr(`gate-${h}`,g,u));u.forEach((h,g)=>{s.push({uses:r.actionRef("wait-for-checks"),id:c[g],name:`Wait for ${h}`,with:{sha:Hn,"workflow-name":h,token:ue(r)}})}),s.push(Le());let f=t==="pr-diff"?"pr-diff":t==="pr-review"?"pr-review":"issue";return s.push(tn(r,f,i?rn:He)),u.length&&s.push(Zr(u,c)),s.push(De(r,{withContext:!0})),{jobId:e.id,name:e.id,permissions:o,timeoutMinutes:qe(e,15+15*u.length),steps:s}}function Qr(r,e,t){let i=a=>a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),o=i(r)||`gate-${e+1}`;return t.filter((a,d)=>d!==e&&i(`gate-${a}`)===o).length>0?`${o}-${e+1}`:o}function Zr(r,e){let t={CONTEXT_FILE:"${{ steps.ctx.outputs.context-file }}"},i=["{",' echo ""',' echo "=== CI GATES ==="'];return r.forEach((o,s)=>{t[`GATE_${s+1}_NAME`]=o,t[`GATE_${s+1}_RESULT`]=`\${{ steps.${e[s]}.outputs.conclusion }}`,i.push(` echo "$GATE_${s+1}_NAME: $GATE_${s+1}_RESULT"`)}),i.push(' echo ""',` echo "A gate whose result is not 'success' is a blocking finding: say which one"`,` echo "failed and request changes. 'timeout' or 'skipped' means CI never gave an"`,' echo "answer \u2014 treat it as unverified, not as a pass."','} >> "$CONTEXT_FILE"'),we({name:"Record CI gate results in the context",env:t,run:i.join(`
57
+ `)})}function eo(r){let e=r.node,t=r.config,i=Rn(r);return i.push(we({id:"branch",name:"Create branch",env:{ISSUE_NUMBER:He,ISSUE_TITLE:"${{ github.event.issue.title }}",PREFIX:t.repo.branch_prefix},run:[`SLUG=$(printf '%s' "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-' | cut -c1-50 | sed 's/-$//')`,'BRANCH="$PREFIX$ISSUE_NUMBER-$SLUG"','git checkout -b "$BRANCH"','echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"'].join(`
58
+ `)})),i.push(Le()),i.push(tn(r,"issue",He)),i.push(De(r,{withContext:!0})),i.push({uses:r.actionRef("agent-fallback"),name:"Fallback: commit / push / PR",if:"${{ !cancelled() }}",with:{branch:"${{ steps.branch.outputs.branch }}",token:ue(r),"agent-name":e.id,"base-branch":t.repo.base_branch,"issue-number":He,"pr-title":"${{ github.event.issue.title }}","pr-body":`### \u{1F6E0}\uFE0F Auto-created (fallback)
59
59
 
60
60
  The agent finished but didn't open a PR itself, so one was created automatically. See the commits and the linked issue for context.
61
61
 
62
- Closes #${He}`}}),{jobId:e.id,name:e.id,permissions:{contents:"write","pull-requests":"write",issues:"write"},timeoutMinutes:qe(e,30),steps:i}}function no(r){let e=r.node,t=In(r,{ref:Yi,fetchDepth:0}),i=typeof e.attrs.max_attempts=="number"?e.attrs.max_attempts:3,o=`<!-- gp-foundry:attempt:${e.id} -->`,s=r.config.labels?.["needs-human"]??"needs-human",a=r.config.identity?.bot_login??"";t.push(Ee({id:"attempts",name:`Enforce attempt budget (max ${i})`,env:{GH_TOKEN:ue(r),PR:rn,MARKER:o,MAX:String(i),BOT_LOGIN:a},run:["# One request-changes verdict = one attempt. The jq filter reads the bot","# login from the environment (never interpolated into the script), and an","# empty BOT_LOGIN counts any reviewer's request-changes.","# (--paginate emits one count per page, so the counts are summed.)",`COUNT=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR/reviews" --paginate --jq '`," [ .[]",' | select(env.BOT_LOGIN == "" or .user.login == env.BOT_LOGIN)',' | select(.state == "CHANGES_REQUESTED" or ((.body // "") | test("Verdict.*REQUEST_CHANGES")))'," ] | length' 2>/dev/null | awk '{s+=$1} END {print s+0}')",'[ -n "$COUNT" ] || COUNT=0','echo "attempts so far: $COUNT / $MAX"','if [ "$COUNT" -gt "$MAX" ]; then',` gh pr edit "$PR" --add-label "${s}" 2>/dev/null || gh api --method POST "repos/$GITHUB_REPOSITORY/issues/$PR/labels" -f 'labels[]=${s}'`,` gh pr comment "$PR" --body "$(printf '## \u26D4 Attempt budget (${e.id})\\n\\nExhausted (%s/%s requested-changes rounds) \u2014 labeling \`${s}\` and stopping. A human should take this over.\\n\\n%s' "$COUNT" "$MAX" "$MARKER")"`,' echo "exhausted=true" >> "$GITHUB_OUTPUT"',"else",` gh pr comment "$PR" --body "$(printf '%s attempt %s of %s' "$MARKER" "$COUNT" "$MAX")" >/dev/null`,' echo "exhausted=false" >> "$GITHUB_OUTPUT"',"fi"].join(`
63
- `)}));let d="steps.attempts.outputs.exhausted != 'true'";return t.push({...je(),if:d}),t.push({...tn(r,"pr-review",rn),if:d}),t.push({...De(r,{withContext:!0}),if:d}),t.push(Ee({name:"Commit and push fixes",if:`${d} && !cancelled()`,env:{BRANCH:Yi},run:["# Commit anything the agent left uncommitted...",'if [ -n "$(git status --porcelain)" ]; then'," git add -A",` git commit -m "agent fix: ${e.id}"`,"fi","# ...then push if HEAD is ahead of the remote (the agent may have committed itself).",'git fetch origin "$BRANCH" --quiet 2>/dev/null || true','if [ "$(git rev-parse HEAD)" != "$(git rev-parse "origin/$BRANCH" 2>/dev/null || echo none)" ]; then',' git push origin "HEAD:$BRANCH"',' echo "pushed fix to $BRANCH"',"else",' echo "no changes to push"',"fi"].join(`
64
- `)})),{jobId:e.id,name:e.id,permissions:{contents:"write","pull-requests":"write"},timeoutMinutes:qe(e,30),steps:t}}function Ki(r){return`gp-foundry/human-approval (${String(r.attrs.environment??"production")})`}var to="github-actions";function io(r){return`${Ki(r)}@${to}`}function ro(r){let e=r.node,t=In(r,{fetchDepth:0}),o=r.inEdges.map(s=>r.nodeById?.(s.from)).filter(s=>!!s&&s.type==="human-gate").map(io);return t.push({uses:r.actionRef("merge-gate"),name:"Evaluate merge gate",with:{token:ue(r),"checks-token":"${{ github.token }}","policy-path":Ne(r,e.files.policy),"base-branch":r.config.repo.base_branch,"branch-prefix":r.config.repo.branch_prefix,...r.config.identity?.bot_login?{"bot-login":r.config.identity.bot_login}:{},...o.length?{"required-checks":o.join(",")}:{}}}),{jobId:e.id,name:e.id,permissions:{contents:"write","pull-requests":"write",issues:"write",checks:"read"},timeoutMinutes:qe(e,10),steps:t}}function oo(r){let e=r.node,t=String(e.attrs.environment??"production");return{jobId:e.id,name:e.id,permissions:{checks:"write"},environment:t,steps:[Ee({name:"Record the approval on the head commit",env:{GH_TOKEN:"${{ github.token }}",CHECK_NAME:Ki(e),HEAD_SHA:Hn,ENVIRONMENT:t},run:['if ! gh api --method POST "repos/$GITHUB_REPOSITORY/check-runs" \\',' -f name="$CHECK_NAME" \\',' -f head_sha="$HEAD_SHA" \\'," -f status=completed \\"," -f conclusion=success \\"," -f 'output[title]=Approved' \\",' -f "output[summary]=Environment \\"$ENVIRONMENT\\" was approved by a human for $HEAD_SHA."; then',' echo "::error::Approved for $ENVIRONMENT, but publishing the approval check failed."',' echo "::error::The merge gate requires \\"$CHECK_NAME\\" on $HEAD_SHA, so this PR will not merge until it is published."'," exit 1","fi",'echo "Approved for $ENVIRONMENT."'].join(`
65
- `)})]}}function so(r){let e=r.node,t=r.config,i=In(r,{fetchDepth:0});i.push(je()),i.push(De(r,{withContext:!1}));let o=typeof e.attrs.paths=="string"?e.attrs.paths:"";return i.push({uses:r.actionRef("agent-fallback"),name:"Strip protected paths, commit, push",with:{branch:t.repo.base_branch,"base-branch":t.repo.base_branch,token:ue(r),"agent-name":e.id,"scope-path":Ne(r,"agents/scope.yaml"),"commit-message":`chore(${e.id}): scheduled update`,...o?{"allowed-paths":o}:{}}}),{jobId:e.id,name:e.id,permissions:{contents:"write",issues:"write","pull-requests":"write",actions:"write"},timeoutMinutes:qe(e,15),steps:i}}function Ji(r,e,t){let i=r.node,o=[],s=Tn(r);s&&o.push(s),o.push(Nn(r,t?{ref:Hn,fetchDepth:0}:void 0)),o.push(je()),o.push(tn(r,t?"pr-review":"issue",t?rn:He)),i.files.role&&o.push(De(r,{withContext:!0}));let a=i.attrs.on_complete_label;if(typeof a=="string"&&a){let d=r.config.labels?.[a]??a;o.push(Ee({name:"Apply completion label",env:{GH_TOKEN:ue(r),NUM:t?rn:He},run:`gh api --method POST "repos/$GITHUB_REPOSITORY/issues/$NUM/labels" -f 'labels[]=${d}'`}))}return{jobId:i.id,name:i.id,needs:e,permissions:t?{contents:"read","pull-requests":"write",issues:"write"}:{contents:"read",issues:"write"},timeoutMinutes:qe(i,15),steps:o}}var ao={analyst:Ot,"issue-agent":Ot,"pr-review":Ot,producer:eo,"pr-fix":no,"merge-gate":ro,"human-gate":oo,"scheduled-agent":so,start:()=>null,exit:()=>null};function $t(r,e,t){let i=ao[r.type];return i?i(t):null}R();var zi=[" /^immutable_paths[[:space:]]*:/ { grab=1; next }"," grab {",' # A new top-level key (no leading whitespace, ends with ":") ends the list.'," if ($0 ~ /^[^[:space:]#][^:]*:/) { grab=0; next }",' # List item: " - some/path"'," if ($0 ~ /^[[:space:]]*-[[:space:]]*/) {"," line=$0",' sub(/^[[:space:]]*-[[:space:]]*/, "", line) # drop the "- " marker',' sub(/[[:space:]]*#.*$/, "", line) # drop trailing comment',' gsub(/^[[:space:]]+|[[:space:]]+$/, "", line) # trim',` gsub(/^["'\\'']|["'\\'']$/, "", line) # drop surrounding quotes`,' if (line != "") print line'," }"," }"];var lo="# GENERATED FROM harness.dot \u2014 DO NOT EDIT.\n# Edit harness.dot / roles / foundry.config.yaml and run `gp-foundry build`.\n";function co(r){let e=r.runtime??{};if(e.mode==="vendored")return o=>`./.github/actions/${o}`;let t=e.owner_repo??"thegpvc/gp-foundry",i=e.ref??"v1";return o=>`${t}/actions/${o}@${i}`}function uo(r){let e={};return r.name&&(e.name=r.name),r.id&&(e.id=r.id),r.if&&(e.if=r.if),Xt(r)?(e.uses=r.uses,r.with&&Object.keys(r.with).length&&(e.with=r.with)):(r.shell&&(e.shell=r.shell),r.env&&Object.keys(r.env).length&&(e.env=r.env),e.run=r.run),e}function Xi(r){return String(r.attrs.name??r.id)}function fo(r,e){let t=e?`${e.replace(/\/+$/,"")}/agents/scope.yaml`:"agents/scope.yaml";return{name:"immutable-paths guard",on:{pull_request:{types:["opened","synchronize","reopened"]}},permissions:{contents:"read"},jobs:{"immutable-paths":{"runs-on":"ubuntu-latest",if:`startsWith(github.event.pull_request.head.ref, '${r.repo.branch_prefix}')`,"timeout-minutes":5,steps:[{name:"Checkout",uses:"actions/checkout@v5",with:{"fetch-depth":0}},{name:"Fail if the PR touches an immutable path",shell:"bash",env:{SCOPE_PATH:t,BASE_SHA:"${{ github.event.pull_request.base.sha }}",HEAD_SHA:"${{ github.event.pull_request.head.sha }}"},run:["# The immutable_paths list, read without a YAML parser. This scan is","# shared with the agent-fallback composite (src/shared/immutable-paths.ts);","# a test fails if the two copies drift.",'PATHS=""','HAS_KEY=""','if [ -f "$SCOPE_PATH" ]; then',` grep -q '^immutable_paths[[:space:]]*:' "$SCOPE_PATH" && HAS_KEY=1`," PATHS=$(awk '",...zi,` ' "$SCOPE_PATH")`,"fi",'if [ -z "$PATHS" ]; then'," # An absent key falls back to the workflows directory. A key that IS"," # present but yields nothing means the scan could not read it (e.g. a"," # flow-style list) \u2014 silently guarding a different set of paths than"," # the file names is how a green check comes to mean nothing.",' if [ -n "$HAS_KEY" ]; then',' echo "::error::$SCOPE_PATH declares immutable_paths but none could be read."',` echo "Write it as a block list, one '- path/' entry per line; this guard"`,' echo "refuses to run against a list it cannot parse."'," exit 1"," fi",' PATHS=".github/workflows/"',"fi","","# Three-dot: compare against the MERGE BASE, so edits that landed on the","# base branch after this PR forked are not blamed on the PR. --no-renames","# keeps a rename visible as a delete of the protected path, which is","# exactly the move this guard must catch.",'VIOLATIONS=""',"while IFS= read -r P; do",' [ -z "$P" ] && continue',' # A git pathspec, not a substring: "$P" anchors at the repo root and'," # understands the glob forms scope.yaml is written in.",' HITS=$(git diff --no-renames --name-only "$BASE_SHA...$HEAD_SHA" -- "$P" || true)',` [ -n "$HITS" ] && VIOLATIONS="$VIOLATIONS$HITS"$'\\n'`,'done <<< "$PATHS"',"",`if [ -n "$(printf '%s' "$VIOLATIONS" | tr -d '[:space:]')" ]; then`,' echo "::error::This branch changes paths scope.yaml marks immutable:"',` printf '%s\\n' "$VIOLATIONS" | sed '/^$/d' | sort -u | sed 's/^/ - /'`,' echo "Agents must never modify these. If the change is intentional, a human"',' echo "should make it on their own branch."'," exit 1","fi",'echo "No immutable paths touched."'].join(`
66
- `)}]}}}}function Qi(r,e,t=""){let i=[],o=co(r.config),s=new Map(r.nodes.map(g=>[g.id,g])),a=new Map,d=new Map;for(let g of r.nodes)a.set(g.id,[]),d.set(g.id,[]);for(let g of r.edges)a.get(g.from)?.push(g),d.get(g.to)?.push(g);let u=g=>({config:r.config,node:g,outEdges:a.get(g.id)??[],inEdges:d.get(g.id)??[],actionRef:o,nodeById:x=>s.get(x),specDir:t}),c=(g,x)=>{let $={"runs-on":"ubuntu-latest"},E=g.if??x;return E&&($.if=E),g.environment&&($.environment=g.environment),g.permissions&&Object.keys(g.permissions).length&&($.permissions=g.permissions),g.timeoutMinutes&&($["timeout-minutes"]=g.timeoutMinutes),g.needs?.length&&($.needs=g.needs),g.strategy&&($.strategy=g.strategy),$.steps=g.steps.map(uo),$},f=(g,x)=>{let $=ye.dump(x,{lineWidth:-1,noRefs:!0,quotingType:'"'});i.push({path:`.github/workflows/${g}.yml`,contents:lo+$,generated:!0})},h=Le(r);f("immutable-guard",fo(r.config,t));for(let g of r.nodes){if(h.memberIds.has(g.id))continue;let x=e.perNode[g.id];if(!x||Object.keys(x.triggers).length===0)continue;let $=h.byFanin.get(g.id);if($){let v={};for(let j of $.legIds){let D=s.get(j),Z=$t(D,r,u(D));Z&&(v[Z.jobId]=c(Z,x.guard))}let P=JSON.stringify(x.triggers).includes('"pull_request"'),M=Ji(u(g),$.legIds,P);v[M.jobId]=c(M),f(g.id,{name:Xi(g),on:x.triggers,...x.concurrency?{concurrency:x.concurrency}:{},permissions:{contents:"read"},jobs:v});continue}let E=$t(g,r,u(g));E&&f(g.id,{name:Xi(g),on:x.triggers,...x.concurrency?{concurrency:x.concurrency}:{},permissions:{contents:"read"},jobs:{[E.jobId]:c(E,x.guard)}})}return i}R();function po(r){switch(r.type){case"start":case"exit":return["([","])"];case"human-gate":return["{{","}}"];case"merge-gate":return["[/","/]"];case"parallel":case"fan_in":return["[[","]]"];default:return["[","]"]}}function ho(r){let e=r.files.role?.replace(/^.*\//,"").replace(/\.md$/,""),t=e&&e!==r.id?`${e} \xB7 ${r.type}`:r.type;return`${r.id}<br/><small>${t}</small>`}function Rn(r){let e=["```mermaid","flowchart TD"];for(let t of r.nodes){let[i,o]=po(t);e.push(` ${t.id}${i}"${ho(t)}"${o}`)}for(let t of r.edges){let i=[t.on,t.when].filter(Boolean).join(" \xB7 ");e.push(i?` ${t.from} -->|"${i}"| ${t.to}`:` ${t.from} --> ${t.to}`)}return e.push("```",""),`<!-- GENERATED FROM harness.dot \u2014 DO NOT EDIT. Run \`gp-foundry build\`. -->
62
+ Closes #${He}`}}),{jobId:e.id,name:e.id,permissions:{contents:"write","pull-requests":"write",issues:"write"},timeoutMinutes:qe(e,30),steps:i}}function no(r){let e=r.node,t=Rn(r,{ref:Yi,fetchDepth:0}),i=typeof e.attrs.max_attempts=="number"?e.attrs.max_attempts:3,o=`<!-- gp-foundry:attempt:${e.id} -->`,s=r.config.labels?.["needs-human"]??"needs-human",a=r.config.identity?.bot_login??"";t.push(we({id:"attempts",name:`Enforce attempt budget (max ${i})`,env:{GH_TOKEN:ue(r),PR:rn,MARKER:o,MAX:String(i),BOT_LOGIN:a},run:["# One request-changes verdict = one attempt. The jq filter reads the bot","# login from the environment (never interpolated into the script), and an","# empty BOT_LOGIN counts any reviewer's request-changes.","# (--paginate emits one count per page, so the counts are summed.)",`COUNT=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR/reviews" --paginate --jq '`," [ .[]",' | select(env.BOT_LOGIN == "" or .user.login == env.BOT_LOGIN)',' | select(.state == "CHANGES_REQUESTED" or ((.body // "") | test("Verdict.*REQUEST_CHANGES")))'," ] | length' 2>/dev/null | awk '{s+=$1} END {print s+0}')",'[ -n "$COUNT" ] || COUNT=0','echo "attempts so far: $COUNT / $MAX"','if [ "$COUNT" -gt "$MAX" ]; then',` gh pr edit "$PR" --add-label "${s}" 2>/dev/null || gh api --method POST "repos/$GITHUB_REPOSITORY/issues/$PR/labels" -f 'labels[]=${s}'`,` gh pr comment "$PR" --body "$(printf '## \u26D4 Attempt budget (${e.id})\\n\\nExhausted (%s/%s requested-changes rounds) \u2014 labeling \`${s}\` and stopping. A human should take this over.\\n\\n%s' "$COUNT" "$MAX" "$MARKER")"`,' echo "exhausted=true" >> "$GITHUB_OUTPUT"',"else",` gh pr comment "$PR" --body "$(printf '%s attempt %s of %s' "$MARKER" "$COUNT" "$MAX")" >/dev/null`,' echo "exhausted=false" >> "$GITHUB_OUTPUT"',"fi"].join(`
63
+ `)}));let d="steps.attempts.outputs.exhausted != 'true'";return t.push({...Le(),if:d}),t.push({...tn(r,"pr-review",rn),if:d}),t.push({...De(r,{withContext:!0}),if:d}),t.push(we({name:"Commit and push fixes",if:`${d} && !cancelled()`,env:{BRANCH:Yi},run:["# Commit anything the agent left uncommitted...",'if [ -n "$(git status --porcelain)" ]; then'," git add -A",` git commit -m "agent fix: ${e.id}"`,"fi","# ...then push if HEAD is ahead of the remote (the agent may have committed itself).",'git fetch origin "$BRANCH" --quiet 2>/dev/null || true','if [ "$(git rev-parse HEAD)" != "$(git rev-parse "origin/$BRANCH" 2>/dev/null || echo none)" ]; then',' git push origin "HEAD:$BRANCH"',' echo "pushed fix to $BRANCH"',"else",' echo "no changes to push"',"fi"].join(`
64
+ `)})),{jobId:e.id,name:e.id,permissions:{contents:"write","pull-requests":"write"},timeoutMinutes:qe(e,30),steps:t}}function Ki(r){return`gp-foundry/human-approval (${String(r.attrs.environment??"production")})`}var to="github-actions";function io(r){return`${Ki(r)}@${to}`}function ro(r){let e=r.node,t=Rn(r,{fetchDepth:0}),o=r.inEdges.map(s=>r.nodeById?.(s.from)).filter(s=>!!s&&s.type==="human-gate").map(io);return t.push({uses:r.actionRef("merge-gate"),name:"Evaluate merge gate",with:{token:ue(r),"checks-token":"${{ github.token }}","policy-path":Se(r,e.files.policy),"base-branch":r.config.repo.base_branch,"branch-prefix":r.config.repo.branch_prefix,...r.config.identity?.bot_login?{"bot-login":r.config.identity.bot_login}:{},...o.length?{"required-checks":o.join(",")}:{}}}),{jobId:e.id,name:e.id,permissions:{contents:"write","pull-requests":"write",issues:"write",checks:"read"},timeoutMinutes:qe(e,10),steps:t}}function oo(r){let e=r.node,t=String(e.attrs.environment??"production");return{jobId:e.id,name:e.id,permissions:{checks:"write"},environment:t,steps:[we({name:"Record the approval on the head commit",env:{GH_TOKEN:"${{ github.token }}",CHECK_NAME:Ki(e),HEAD_SHA:Hn,ENVIRONMENT:t},run:['if ! gh api --method POST "repos/$GITHUB_REPOSITORY/check-runs" \\',' -f name="$CHECK_NAME" \\',' -f head_sha="$HEAD_SHA" \\'," -f status=completed \\"," -f conclusion=success \\"," -f 'output[title]=Approved' \\",' -f "output[summary]=Environment \\"$ENVIRONMENT\\" was approved by a human for $HEAD_SHA."; then',' echo "::error::Approved for $ENVIRONMENT, but publishing the approval check failed."',' echo "::error::The merge gate requires \\"$CHECK_NAME\\" on $HEAD_SHA, so this PR will not merge until it is published."'," exit 1","fi",'echo "Approved for $ENVIRONMENT."'].join(`
65
+ `)})]}}function so(r){let e=r.node,t=r.config,i=Rn(r,{fetchDepth:0}),o=typeof e.attrs.commit=="string"?e.attrs.commit:"direct",s=typeof e.attrs.paths=="string"?e.attrs.paths:"";return o==="pr"&&i.push(we({id:"branch",name:"Create branch",env:{PREFIX:t.repo.branch_prefix,NODE:e.id,RUN_ID:"${{ github.run_id }}"},run:['BRANCH="$PREFIX$NODE-$RUN_ID"','git checkout -b "$BRANCH"','echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"'].join(`
66
+ `)})),i.push(Le()),i.push(De(r,{withContext:!1})),o==="pr"?i.push({uses:r.actionRef("agent-fallback"),name:"Commit, push branch, open PR",if:"${{ !cancelled() }}",with:{branch:"${{ steps.branch.outputs.branch }}","base-branch":t.repo.base_branch,token:ue(r),"agent-name":e.id,"scope-path":Se(r,"agents/scope.yaml"),"pr-title":`${e.id}: scheduled update`,"pr-body":`Scheduled output from the \`${e.id}\` lane \u2014 review and merge like any agent PR.`,...s?{"allowed-paths":s}:{}}}):o==="direct"&&i.push({uses:r.actionRef("agent-fallback"),name:"Strip protected paths, commit, push",with:{branch:t.repo.base_branch,"base-branch":t.repo.base_branch,token:ue(r),"agent-name":e.id,"scope-path":Se(r,"agents/scope.yaml"),"commit-message":`chore(${e.id}): scheduled update`,...s?{"allowed-paths":s}:{}}}),{jobId:e.id,name:e.id,permissions:{contents:"write",issues:"write","pull-requests":"write",actions:"write"},timeoutMinutes:qe(e,15),steps:i}}function Ji(r,e,t){let i=r.node,o=[],s=Tn(r);s&&o.push(s),o.push(Nn(r,t?{ref:Hn,fetchDepth:0}:void 0)),o.push(Le()),o.push(tn(r,t?"pr-review":"issue",t?rn:He)),i.files.role&&o.push(De(r,{withContext:!0}));let a=i.attrs.on_complete_label;if(typeof a=="string"&&a){let d=r.config.labels?.[a]??a;o.push(we({name:"Apply completion label",env:{GH_TOKEN:ue(r),NUM:t?rn:He},run:`gh api --method POST "repos/$GITHUB_REPOSITORY/issues/$NUM/labels" -f 'labels[]=${d}'`}))}return{jobId:i.id,name:i.id,needs:e,permissions:t?{contents:"read","pull-requests":"write",issues:"write"}:{contents:"read",issues:"write"},timeoutMinutes:qe(i,15),steps:o}}var ao={analyst:Ot,"issue-agent":Ot,"pr-review":Ot,producer:eo,"pr-fix":no,"merge-gate":ro,"human-gate":oo,"scheduled-agent":so,start:()=>null,exit:()=>null};function $t(r,e,t){let i=ao[r.type];return i?i(t):null}I();var zi=[" /^immutable_paths[[:space:]]*:/ { grab=1; next }"," grab {",' # A new top-level key (no leading whitespace, ends with ":") ends the list.'," if ($0 ~ /^[^[:space:]#][^:]*:/) { grab=0; next }",' # List item: " - some/path"'," if ($0 ~ /^[[:space:]]*-[[:space:]]*/) {"," line=$0",' sub(/^[[:space:]]*-[[:space:]]*/, "", line) # drop the "- " marker',' sub(/[[:space:]]*#.*$/, "", line) # drop trailing comment',' gsub(/^[[:space:]]+|[[:space:]]+$/, "", line) # trim',` gsub(/^["'\\'']|["'\\'']$/, "", line) # drop surrounding quotes`,' if (line != "") print line'," }"," }"];var lo="# GENERATED FROM harness.dot \u2014 DO NOT EDIT.\n# Edit harness.dot / roles / foundry.config.yaml and run `gp-foundry build`.\n";function co(r){let e=r.runtime??{};if(e.mode==="vendored")return o=>`./.github/actions/${o}`;let t=e.owner_repo??"thegpvc/gp-foundry",i=e.ref??"v1";return o=>`${t}/actions/${o}@${i}`}function uo(r){let e={};return r.name&&(e.name=r.name),r.id&&(e.id=r.id),r.if&&(e.if=r.if),Xt(r)?(e.uses=r.uses,r.with&&Object.keys(r.with).length&&(e.with=r.with)):(r.shell&&(e.shell=r.shell),r.env&&Object.keys(r.env).length&&(e.env=r.env),e.run=r.run),e}function Xi(r){return String(r.attrs.name??r.id)}function fo(r,e){let t=e?`${e.replace(/\/+$/,"")}/agents/scope.yaml`:"agents/scope.yaml";return{name:"immutable-paths guard",on:{pull_request:{types:["opened","synchronize","reopened"]}},permissions:{contents:"read"},jobs:{"immutable-paths":{"runs-on":"ubuntu-latest",if:`startsWith(github.event.pull_request.head.ref, '${r.repo.branch_prefix}')`,"timeout-minutes":5,steps:[{name:"Checkout",uses:"actions/checkout@v5",with:{"fetch-depth":0}},{name:"Fail if the PR touches an immutable path",shell:"bash",env:{SCOPE_PATH:t,BASE_SHA:"${{ github.event.pull_request.base.sha }}",HEAD_SHA:"${{ github.event.pull_request.head.sha }}"},run:["# The immutable_paths list, read without a YAML parser. This scan is","# shared with the agent-fallback composite (src/shared/immutable-paths.ts);","# a test fails if the two copies drift.",'PATHS=""','HAS_KEY=""','if [ -f "$SCOPE_PATH" ]; then',` grep -q '^immutable_paths[[:space:]]*:' "$SCOPE_PATH" && HAS_KEY=1`," PATHS=$(awk '",...zi,` ' "$SCOPE_PATH")`,"fi",'if [ -z "$PATHS" ]; then'," # An absent key falls back to the workflows directory. A key that IS"," # present but yields nothing means the scan could not read it (e.g. a"," # flow-style list) \u2014 silently guarding a different set of paths than"," # the file names is how a green check comes to mean nothing.",' if [ -n "$HAS_KEY" ]; then',' echo "::error::$SCOPE_PATH declares immutable_paths but none could be read."',` echo "Write it as a block list, one '- path/' entry per line; this guard"`,' echo "refuses to run against a list it cannot parse."'," exit 1"," fi",' PATHS=".github/workflows/"',"fi","","# Three-dot: compare against the MERGE BASE, so edits that landed on the","# base branch after this PR forked are not blamed on the PR. --no-renames","# keeps a rename visible as a delete of the protected path, which is","# exactly the move this guard must catch.",'VIOLATIONS=""',"while IFS= read -r P; do",' [ -z "$P" ] && continue',' # A git pathspec, not a substring: "$P" anchors at the repo root and'," # understands the glob forms scope.yaml is written in.",' HITS=$(git diff --no-renames --name-only "$BASE_SHA...$HEAD_SHA" -- "$P" || true)',` [ -n "$HITS" ] && VIOLATIONS="$VIOLATIONS$HITS"$'\\n'`,'done <<< "$PATHS"',"",`if [ -n "$(printf '%s' "$VIOLATIONS" | tr -d '[:space:]')" ]; then`,' echo "::error::This branch changes paths scope.yaml marks immutable:"',` printf '%s\\n' "$VIOLATIONS" | sed '/^$/d' | sort -u | sed 's/^/ - /'`,' echo "Agents must never modify these. If the change is intentional, a human"',' echo "should make it on their own branch."'," exit 1","fi",'echo "No immutable paths touched."'].join(`
67
+ `)}]}}}}function Qi(r,e,t=""){let i=[],o=co(r.config),s=new Map(r.nodes.map(g=>[g.id,g])),a=new Map,d=new Map;for(let g of r.nodes)a.set(g.id,[]),d.set(g.id,[]);for(let g of r.edges)a.get(g.from)?.push(g),d.get(g.to)?.push(g);let u=g=>({config:r.config,node:g,outEdges:a.get(g.id)??[],inEdges:d.get(g.id)??[],actionRef:o,nodeById:x=>s.get(x),specDir:t}),c=(g,x)=>{let $={"runs-on":"ubuntu-latest"},E=g.if??x;return E&&($.if=E),g.environment&&($.environment=g.environment),g.permissions&&Object.keys(g.permissions).length&&($.permissions=g.permissions),g.timeoutMinutes&&($["timeout-minutes"]=g.timeoutMinutes),g.needs?.length&&($.needs=g.needs),g.strategy&&($.strategy=g.strategy),$.steps=g.steps.map(uo),$},f=(g,x)=>{let $=ye.dump(x,{lineWidth:-1,noRefs:!0,quotingType:'"'});i.push({path:`.github/workflows/${g}.yml`,contents:lo+$,generated:!0})},h=je(r);f("immutable-guard",fo(r.config,t));for(let g of r.nodes){if(h.memberIds.has(g.id))continue;let x=e.perNode[g.id];if(!x||Object.keys(x.triggers).length===0)continue;let $=h.byFanin.get(g.id);if($){let v={};for(let L of $.legIds){let D=s.get(L),Z=$t(D,r,u(D));Z&&(v[Z.jobId]=c(Z,x.guard))}let P=JSON.stringify(x.triggers).includes('"pull_request"'),M=Ji(u(g),$.legIds,P);v[M.jobId]=c(M),f(g.id,{name:Xi(g),on:x.triggers,...x.concurrency?{concurrency:x.concurrency}:{},permissions:{contents:"read"},jobs:v});continue}let E=$t(g,r,u(g));E&&f(g.id,{name:Xi(g),on:x.triggers,...x.concurrency?{concurrency:x.concurrency}:{},permissions:{contents:"read"},jobs:{[E.jobId]:c(E,x.guard)}})}return i}I();function po(r){switch(r.type){case"start":case"exit":return["([","])"];case"human-gate":return["{{","}}"];case"merge-gate":return["[/","/]"];case"parallel":case"fan_in":return["[[","]]"];default:return["[","]"]}}function ho(r){let e=r.files.role?.replace(/^.*\//,"").replace(/\.md$/,""),t=e&&e!==r.id?`${e} \xB7 ${r.type}`:r.type;return`${r.id}<br/><small>${t}</small>`}function In(r){let e=["```mermaid","flowchart TD"];for(let t of r.nodes){let[i,o]=po(t);e.push(` ${t.id}${i}"${ho(t)}"${o}`)}for(let t of r.edges){let i=[t.on,t.when].filter(Boolean).join(" \xB7 ");e.push(i?` ${t.from} -->|"${i}"| ${t.to}`:` ${t.from} --> ${t.to}`)}return e.push("```",""),`<!-- GENERATED FROM harness.dot \u2014 DO NOT EDIT. Run \`gp-foundry build\`. -->
67
68
 
68
69
  # ${r.config?.name&&r.config.name!=="harness"?r.config.name:r.name} \u2014 agent harness
69
70
 
70
71
  ${e.join(`
71
- `)}`}R();var mo=new Set(["start","exit","analyst","issue-agent","producer","pr-review","pr-fix","merge-gate","human-gate","scheduled-agent","parallel","fan_in"]),go=new Set(["role","prompt","policy","tools"]);function bo(r){let e=[],t=[],i=1,o=0,s=r;for(;o<s.length;){let a=s[o];if(a===`
72
+ `)}`}I();var mo=new Set(["start","exit","analyst","issue-agent","producer","pr-review","pr-fix","merge-gate","human-gate","scheduled-agent","parallel","fan_in"]),go=new Set(["role","prompt","policy","tools"]);function bo(r){let e=[],t=[],i=1,o=0,s=r;for(;o<s.length;){let a=s[o];if(a===`
72
73
  `){i++,o++;continue}if(a===" "||a===" "||a==="\r"){o++;continue}if(a==="/"&&s[o+1]==="/"){for(;o<s.length&&s[o]!==`
73
74
  `;)o++;continue}if(a==="/"&&s[o+1]==="*"){for(o+=2;o<s.length&&!(s[o]==="*"&&s[o+1]==="/");)s[o]===`
74
75
  `&&i++,o++;o+=2;continue}if(a==="-"&&s[o+1]===">"){e.push({kind:"arrow",value:"->",line:i}),o+=2;continue}if(a==="{"){e.push({kind:"lbrace",value:a,line:i}),o++;continue}if(a==="}"){e.push({kind:"rbrace",value:a,line:i}),o++;continue}if(a==="["){e.push({kind:"lbrack",value:a,line:i}),o++;continue}if(a==="]"){e.push({kind:"rbrack",value:a,line:i}),o++;continue}if(a==="="){e.push({kind:"eq",value:a,line:i}),o++;continue}if(a===","){e.push({kind:"comma",value:a,line:i}),o++;continue}if(a===";"){e.push({kind:"semi",value:a,line:i}),o++;continue}if(a==='"'){let d=o+1,u="";for(;d<s.length&&s[d]!=='"';){if(s[d]==="\\"&&d+1<s.length){u+=s[d+1],d+=2;continue}s[d]===`
75
- `&&i++,u+=s[d],d++}d>=s.length&&t.push({message:"unterminated string",line:i}),e.push({kind:"id",value:u,line:i}),o=d+1;continue}if(/[A-Za-z0-9_]/.test(a)){let d=o,u="";for(;d<s.length&&/[A-Za-z0-9_.\-]/.test(s[d]);)u+=s[d],d++;e.push({kind:"id",value:u,line:i}),o=d;continue}t.push({message:`unexpected character '${a}'`,line:i}),o++}return{toks:e,errors:t}}function yo(r){return r==="true"?!0:r==="false"?!1:/^-?\d+$/.test(r)?Number(r):r}function on(r){let{toks:e,errors:t}=bo(r),i=[],o=[],s=new Map,a="harness",d=0,u=()=>e[d],c=()=>e[d++],f=(E,v)=>t.push({message:E,line:v});u()?.kind==="id"&&u()?.value==="digraph"?(c(),u()?.kind==="id"&&u()?.value!==void 0&&(a=c().value),u()?.kind==="lbrace"?c():f("expected '{' after digraph header",u()?.line)):f("expected 'digraph' keyword",u()?.line);function h(){let E={};if(u()?.kind!=="lbrack")return{attrs:E};let v=c().line;for(;u()&&u().kind!=="rbrack";){let P=c();if(!P||P.kind!=="id"){f("expected attribute name",P?.line);break}if(u()?.kind!=="eq"){f(`expected '=' after attribute '${P.value}'`,P.line);break}c();let M=c();if(!M||M.kind!=="id"){f(`expected value for attribute '${P.value}'`,M?.line);break}E[P.value]=M.value,u()?.kind==="comma"&&c()}return u()?.kind==="rbrack"?c():f("unterminated attribute list '['",v),{attrs:E,line:v}}function g(E,v){let P=s.get(E);return P||(P={id:E,type:"analyst",attrs:{},files:{},raw:{},line:v},s.set(E,P),i.push(P)),P}function x(E,v,P){E.declared=!0,E.raw={...E.raw,...v},P!==void 0&&(E.line=E.line??P);for(let[M,j]of Object.entries(v))M==="type"?(mo.has(j)||f(`unknown node type '${j}' on node '${E.id}'`,P),E.type=j):M==="context"?E.context=j:go.has(M)?E.files[M]=j:E.attrs[M]=yo(j)}let $=0;for(;u()&&u().kind!=="rbrace"&&!($++>1e5);){let E=u();if(E.kind==="semi"){c();continue}if(E.kind!=="id"){f(`unexpected token '${E.value}'`,E.line),c();continue}let v=c();if(u()?.kind==="arrow"){let P=[{id:v.value,line:v.line}];for(;u()?.kind==="arrow";){c();let D=c();if(!D||D.kind!=="id"){f("expected node id after '->'",D?.line);break}P.push({id:D.value,line:D.line})}let{attrs:M,line:j}=h();for(let D=0;D+1<P.length;D++){let Z=P[D],oe=P[D+1];g(Z.id,Z.line),g(oe.id,oe.line);let K={from:Z.id,to:oe.id,raw:{...M},line:j??Z.line};M.on!==void 0&&(K.on=M.on),M.when!==void 0&&(K.when=M.when),M.do!==void 0&&(K.do=M.do),o.push(K)}}else{let{attrs:P,line:M}=h(),j=g(v.value,v.line);x(j,P,M??v.line)}u()?.kind==="semi"&&c()}return u()?.kind==="rbrace"&&c(),{name:a,nodes:i,edges:o,errors:t}}R();var sn=require("fs");var Be={name:"harness",identity:{},agent:{cli:"claude",model:"claude-opus-4-8",oauth_token_secret:"CLAUDE_CODE_OAUTH_TOKEN"},repo:{base_branch:"main",branch_prefix:"agent/"},labels:{}};function Pn(r){if(!r||!(0,sn.existsSync)(r))return structuredClone(Be);let e=ye.load((0,sn.readFileSync)(r,"utf8"))??{};return{...Be,...e,identity:{...Be.identity,...e.identity??{}},agent:{...Be.agent,...e.agent??{}},repo:{...Be.repo,...e.repo??{}},labels:{...Be.labels,...e.labels??{}}}}function de(r,e){let t=on((0,sn.readFileSync)(r,"utf8")),i=Pn(e);return{harness:{name:t.name,nodes:t.nodes,edges:t.edges,config:i,sourcePath:r},parseErrors:t.errors}}function Ue(r,e={},t={}){let i=[...Xe(r,e),...Qe(r)],o=Qi(r,ii(r),t.specDir??"");return o.push({path:".github/HARNESS.md",contents:Rn(r),generated:!0}),{files:o,diagnostics:i}}function an(r){return r.some(e=>e.level==="error")}R();var wo=/^---\r?\n([\s\S]*?)\r?\n---/;function Zi(r){let e=wo.exec(r);if(e)try{let t=ye.load(e[1]);if(t&&typeof t=="object")return t}catch{return}}R();var er=require("fs"),we=require("path"),nr=require("url"),Ie=wn(Cn(),1);function ce(r){return(0,nr.fileURLToPath)(new URL(`../../${r}`,V))}function J(r){process.stdout.write(JSON.stringify(r,null,2)+`
76
- `)}function Tt(r){for(let e of r){let t=e.level==="error"?Ie.default.red("error"):e.level==="warning"?Ie.default.yellow("warn"):Ie.default.blue("info"),i=e.where?.node?Ie.default.dim(` [${e.where.node}]`):"";process.stderr.write(`${t} ${Ie.default.dim(e.code)}${i} ${e.message}
77
- `),e.hint&&process.stderr.write(` ${Ie.default.dim("hint: "+e.hint)}
78
- `)}}function _e(r){let e=(0,we.resolve)(r.dot??".github/harness.dot"),t=(0,we.dirname)(e),i=r.config?(0,we.resolve)(r.config):void 0;if(!i){for(let s of[(0,we.join)(t,"foundry.config.yaml"),(0,we.join)(t,"agents/foundry.config.yaml")])if((0,er.existsSync)(s)){i=s;break}}let o=t.endsWith(".github")?(0,we.dirname)(t):t;return{dot:e,config:i,base:t,root:o}}R();var Nt=require("child_process"),B=require("fs"),W=require("path");var U=wn(Cn(),1);var Ht=require("path");function Ve(r,e={}){try{return{ok:!0,out:(0,Nt.execFileSync)("gh",r,{encoding:"utf8",stdio:["ignore","pipe","pipe"],cwd:e.cwd}).trim()}}catch(t){return{ok:!1,out:t.stderr?.toString().trim()??String(t.message)}}}function Se(r,e){let t=Ve(r,{cwd:e});if(!t.ok)return null;try{return JSON.parse(t.out)}catch{return null}}function or(){let r=ce("actions");return(0,B.readdirSync)(r,{withFileTypes:!0}).filter(e=>e.isDirectory()&&(0,B.existsSync)((0,W.join)(r,e.name,"action.yml"))).map(e=>e.name)}function sr(r){let e=Pn(r),t=new Map([["build","ready to implement"],["plan","needs design first"]]),i=[];for(let[o,s]of t)i.push({name:e.labels?.[o]??o,description:s,color:o==="build"?"0e8a16":"5319e7"});return i.push({name:"needs-human",description:"agents are blocked; a human should take over",color:"b60205"}),i.push({name:"needs-rebase",description:"PR conflicts with base; the janitor sweep rebases it",color:"d93f0b"}),i}function tr(r){let e={ok:U.default.green("\u2713"),warn:U.default.yellow("!"),fail:U.default.red("\u2717"),skip:U.default.dim("-")};for(let t of r)process.stdout.write(`${e[t.status]} ${t.name.padEnd(28)} ${t.detail}
76
+ `&&i++,u+=s[d],d++}d>=s.length&&t.push({message:"unterminated string",line:i}),e.push({kind:"id",value:u,line:i}),o=d+1;continue}if(/[A-Za-z0-9_]/.test(a)){let d=o,u="";for(;d<s.length&&/[A-Za-z0-9_.\-]/.test(s[d]);)u+=s[d],d++;e.push({kind:"id",value:u,line:i}),o=d;continue}t.push({message:`unexpected character '${a}'`,line:i}),o++}return{toks:e,errors:t}}function yo(r){return r==="true"?!0:r==="false"?!1:/^-?\d+$/.test(r)?Number(r):r}function on(r){let{toks:e,errors:t}=bo(r),i=[],o=[],s=new Map,a="harness",d=0,u=()=>e[d],c=()=>e[d++],f=(E,v)=>t.push({message:E,line:v});u()?.kind==="id"&&u()?.value==="digraph"?(c(),u()?.kind==="id"&&u()?.value!==void 0&&(a=c().value),u()?.kind==="lbrace"?c():f("expected '{' after digraph header",u()?.line)):f("expected 'digraph' keyword",u()?.line);function h(){let E={};if(u()?.kind!=="lbrack")return{attrs:E};let v=c().line;for(;u()&&u().kind!=="rbrack";){let P=c();if(!P||P.kind!=="id"){f("expected attribute name",P?.line);break}if(u()?.kind!=="eq"){f(`expected '=' after attribute '${P.value}'`,P.line);break}c();let M=c();if(!M||M.kind!=="id"){f(`expected value for attribute '${P.value}'`,M?.line);break}E[P.value]=M.value,u()?.kind==="comma"&&c()}return u()?.kind==="rbrack"?c():f("unterminated attribute list '['",v),{attrs:E,line:v}}function g(E,v){let P=s.get(E);return P||(P={id:E,type:"analyst",attrs:{},files:{},raw:{},line:v},s.set(E,P),i.push(P)),P}function x(E,v,P){E.declared=!0,E.raw={...E.raw,...v},P!==void 0&&(E.line=E.line??P);for(let[M,L]of Object.entries(v))M==="type"?(mo.has(L)||f(`unknown node type '${L}' on node '${E.id}'`,P),E.type=L):M==="context"?E.context=L:go.has(M)?E.files[M]=L:E.attrs[M]=yo(L)}let $=0;for(;u()&&u().kind!=="rbrace"&&!($++>1e5);){let E=u();if(E.kind==="semi"){c();continue}if(E.kind!=="id"){f(`unexpected token '${E.value}'`,E.line),c();continue}let v=c();if(u()?.kind==="arrow"){let P=[{id:v.value,line:v.line}];for(;u()?.kind==="arrow";){c();let D=c();if(!D||D.kind!=="id"){f("expected node id after '->'",D?.line);break}P.push({id:D.value,line:D.line})}let{attrs:M,line:L}=h();for(let D=0;D+1<P.length;D++){let Z=P[D],oe=P[D+1];g(Z.id,Z.line),g(oe.id,oe.line);let K={from:Z.id,to:oe.id,raw:{...M},line:L??Z.line};M.on!==void 0&&(K.on=M.on),M.when!==void 0&&(K.when=M.when),M.do!==void 0&&(K.do=M.do),o.push(K)}}else{let{attrs:P,line:M}=h(),L=g(v.value,v.line);x(L,P,M??v.line)}u()?.kind==="semi"&&c()}return u()?.kind==="rbrace"&&c(),{name:a,nodes:i,edges:o,errors:t}}I();var sn=require("fs");var Be={name:"harness",identity:{},agent:{cli:"claude",model:"claude-opus-4-8",oauth_token_secret:"CLAUDE_CODE_OAUTH_TOKEN"},repo:{base_branch:"main",branch_prefix:"agent/"},labels:{}};function Pn(r){if(!r||!(0,sn.existsSync)(r))return structuredClone(Be);let e=ye.load((0,sn.readFileSync)(r,"utf8"))??{};return{...Be,...e,identity:{...Be.identity,...e.identity??{}},agent:{...Be.agent,...e.agent??{}},repo:{...Be.repo,...e.repo??{}},labels:{...Be.labels,...e.labels??{}}}}function de(r,e){let t=on((0,sn.readFileSync)(r,"utf8")),i=Pn(e);return{harness:{name:t.name,nodes:t.nodes,edges:t.edges,config:i,sourcePath:r},parseErrors:t.errors}}function Ue(r,e={},t={}){let i=[...Xe(r,e),...Qe(r)],o=Qi(r,ii(r),t.specDir??"");return o.push({path:".github/HARNESS.md",contents:In(r),generated:!0}),{files:o,diagnostics:i}}function an(r){return r.some(e=>e.level==="error")}I();var wo=/^---\r?\n([\s\S]*?)\r?\n---/;function Zi(r){let e=wo.exec(r);if(e)try{let t=ye.load(e[1]);if(t&&typeof t=="object")return t}catch{return}}I();var er=require("fs"),_e=require("path"),nr=require("url"),Re=wn(Cn(),1);function ce(r){return(0,nr.fileURLToPath)(new URL(`../../${r}`,V))}function J(r){process.stdout.write(JSON.stringify(r,null,2)+`
77
+ `)}function Tt(r){for(let e of r){let t=e.level==="error"?Re.default.red("error"):e.level==="warning"?Re.default.yellow("warn"):Re.default.blue("info"),i=e.where?.node?Re.default.dim(` [${e.where.node}]`):"";process.stderr.write(`${t} ${Re.default.dim(e.code)}${i} ${e.message}
78
+ `),e.hint&&process.stderr.write(` ${Re.default.dim("hint: "+e.hint)}
79
+ `)}}function Ae(r){let e=(0,_e.resolve)(r.dot??".github/harness.dot"),t=(0,_e.dirname)(e),i=r.config?(0,_e.resolve)(r.config):void 0;if(!i){for(let s of[(0,_e.join)(t,"foundry.config.yaml"),(0,_e.join)(t,"agents/foundry.config.yaml")])if((0,er.existsSync)(s)){i=s;break}}let o=t.endsWith(".github")?(0,_e.dirname)(t):t;return{dot:e,config:i,base:t,root:o}}I();var Nt=require("child_process"),B=require("fs"),G=require("path");var U=wn(Cn(),1);var Ht=require("path");function Ve(r,e={}){try{return{ok:!0,out:(0,Nt.execFileSync)("gh",r,{encoding:"utf8",stdio:["ignore","pipe","pipe"],cwd:e.cwd}).trim()}}catch(t){return{ok:!1,out:t.stderr?.toString().trim()??String(t.message)}}}function ve(r,e){let t=Ve(r,{cwd:e});if(!t.ok)return null;try{return JSON.parse(t.out)}catch{return null}}function or(){let r=ce("actions");return(0,B.readdirSync)(r,{withFileTypes:!0}).filter(e=>e.isDirectory()&&(0,B.existsSync)((0,G.join)(r,e.name,"action.yml"))).map(e=>e.name)}function sr(r){let e=Pn(r),t=new Map([["build","ready to implement"],["plan","needs design first"]]),i=[];for(let[o,s]of t)i.push({name:e.labels?.[o]??o,description:s,color:o==="build"?"0e8a16":"5319e7"});return i.push({name:"needs-human",description:"agents are blocked; a human should take over",color:"b60205"}),i.push({name:"needs-rebase",description:"PR conflicts with base; the janitor sweep rebases it",color:"d93f0b"}),i}function tr(r){let e={ok:U.default.green("\u2713"),warn:U.default.yellow("!"),fail:U.default.red("\u2717"),skip:U.default.dim("-")};for(let t of r)process.stdout.write(`${e[t.status]} ${t.name.padEnd(28)} ${t.detail}
79
80
  `),t.hint&&t.status!=="ok"&&process.stdout.write(` ${U.default.dim("hint: "+t.hint)}
80
- `)}function _o(r,e){let t=r.nodes.filter(i=>i.type==="merge-gate");return t.length===0?!1:t.some(i=>{if(!i.files.policy)return!0;let o=(0,W.dirname)(r.sourcePath??""),s=(0,W.join)(e,o,i.files.policy);if(!(0,B.existsSync)(s))return!0;try{let a=ye.load((0,B.readFileSync)(s,"utf8"));return(a?.require_ci??a?.requireCi)!==!1}catch{return!0}})}function ir(r){let e=[];for(let i of or()){let o=ce(`actions/${i}`),s=(0,W.join)(r,".github/actions",i);(0,B.mkdirSync)(s,{recursive:!0}),(0,B.cpSync)((0,W.join)(o,"action.yml"),(0,W.join)(s,"action.yml")),(0,B.existsSync)((0,W.join)(o,"dist"))&&(0,B.cpSync)((0,W.join)(o,"dist"),(0,W.join)(s,"dist"),{recursive:!0}),e.push(`.github/actions/${i}/`)}let t=(0,W.join)(r,".github/agent-setup/action.yml");return(0,B.existsSync)(t)||((0,B.mkdirSync)((0,W.dirname)(t),{recursive:!0}),(0,B.writeFileSync)(t,(0,B.readFileSync)(ce("skill/templates/agent-setup.yml"),"utf8")),e.push(".github/agent-setup/action.yml")),e}function Ao(r){(0,B.mkdirSync)(r,{recursive:!0}),(0,B.cpSync)(ce("skill/SKILL.md"),(0,W.join)(r,"SKILL.md")),(0,B.cpSync)(ce("skill/reference"),(0,W.join)(r,"reference"),{recursive:!0}),(0,B.cpSync)(ce("skill/templates"),(0,W.join)(r,"templates"),{recursive:!0})}function rr(r){let e=[],{dot:t,config:i,base:o,root:s}=_e(r);if(!(0,B.existsSync)(t))return e.push({name:"harness",status:"fail",detail:`no harness.dot at ${t}`,hint:"run `gp-foundry init`"}),{checks:e,failed:!0};let{harness:a,parseErrors:d}=de(t,i),u=L=>(0,B.existsSync)((0,W.join)(o,L)),c=(0,Ht.relative)(s,o).replace(/\\/g,"/"),{files:f,diagnostics:h}=Ue(a,{fileExists:u},{specDir:c}),g=h.filter(L=>L.level==="error").length+d.length,x=h.filter(L=>L.level==="warning");e.push(g?{name:"validate",status:"fail",detail:`${g} error(s)`,hint:"run `gp-foundry validate` for details"}:{name:"validate",status:x.length?"warn":"ok",detail:x.length?`${x.length} warning(s): ${x.map(L=>L.code).join(", ")}`:"no diagnostics"});let $=f.filter(L=>{let se=(0,W.join)(s,L.path);return((0,B.existsSync)(se)?(0,B.readFileSync)(se,"utf8"):null)!==L.contents});if(e.push($.length?{name:"workflows in sync",status:"fail",detail:`${$.length} file(s) drifted: ${$.slice(0,3).map(L=>L.path).join(", ")}${$.length>3?", \u2026":""}`,hint:"run `gp-foundry build`"}:{name:"workflows in sync",status:"ok",detail:`${f.length} generated files match`}),(a.config.runtime?.mode??"pinned")==="vendored"){let L=or().filter(se=>!(0,B.existsSync)((0,W.join)(s,".github/actions",se,"action.yml")));e.push(L.length?{name:"vendored actions",status:"fail",detail:`missing: ${L.join(", ")}`,hint:"run `gp-foundry vendor`"}:{name:"vendored actions",status:"ok",detail:"all runtime actions vendored"})}if(e.push((0,B.existsSync)((0,W.join)(s,".github/agent-setup/action.yml"))?{name:"agent-setup shim",status:"ok",detail:".github/agent-setup/action.yml present"}:{name:"agent-setup shim",status:"fail",detail:"missing \u2014 every agent job needs it",hint:"run `gp-foundry vendor` (or `init`)"}),!Ve(["auth","status"]).ok)return e.push({name:"gh cli",status:"skip",detail:"gh missing or unauthenticated \u2014 skipping repo checks",hint:"install GitHub CLI and `gh auth login`"}),{checks:e,failed:e.some(L=>L.status==="fail")};e.push({name:"gh cli",status:"ok",detail:"authenticated"});let v=Se(["repo","view","--json","nameWithOwner,defaultBranchRef"],s);if(!v)return e.push({name:"github repo",status:"skip",detail:"not a GitHub repo (or no remote) \u2014 skipping labels/secrets checks",hint:"create it with `gh repo create`, then re-run `gp-foundry up` to create labels"}),{checks:e,failed:e.some(L=>L.status==="fail")};e.push({name:"github repo",status:"ok",detail:v.nameWithOwner});let P=v.defaultBranchRef?.name;P&&e.push(P===a.config.repo.base_branch?{name:"base branch",status:"ok",detail:P}:{name:"base branch",status:"fail",detail:`config says '${a.config.repo.base_branch}' but the repo default is '${P}'`,hint:"fix repo.base_branch in foundry.config.yaml and re-run `gp-foundry up`"});let M=new Set((Se(["label","list","--json","name","--limit","1000"],s)??[]).map(L=>L.name)),j=sr(i).map(L=>L.name),D=j.filter(L=>!M.has(L));e.push(D.length?{name:"labels",status:"fail",detail:`missing: ${D.join(", ")}`,hint:"run `gp-foundry up` to create them"}:{name:"labels",status:"ok",detail:j.join(", ")});let Z=new Set((Se(["secret","list","--json","name"],s)??[]).map(L=>L.name)),oe=[a.config.agent.oauth_token_secret??"CLAUDE_CODE_OAUTH_TOKEN"],K=a.config.auth;K?.mode==="pat"&&K.token_secret&&oe.push(K.token_secret),K?.mode==="app"&&oe.push(K.app_id_secret??"APP_ID",K.app_key_secret??"APP_PRIVATE_KEY");let Ae=oe.filter(L=>!Z.has(L));if(e.push(Ae.length?{name:"secrets",status:"fail",detail:`missing: ${Ae.join(", ")}`,hint:`gh secret set ${Ae[0]}`}:{name:"secrets",status:"ok",detail:oe.join(", ")}),_o(a,s)){let se=f.filter(te=>/\/workflows\/.*\.yml$/.test(te.path)&&te.contents.includes("actions/merge-gate")).map(te=>(0,W.join)(s,te.path)).filter(te=>(0,B.existsSync)(te)).map(te=>(0,B.readFileSync)(te,"utf8")),$e=se.filter(te=>!te.includes("checks-token"));se.length&&$e.length&&e.push({name:"merge gate ci read",status:"fail",detail:`${$e.length} merge-gate workflow(s) read check-runs with the harness token`,hint:"a fine-grained PAT cannot be granted the Checks permission, so that read 403s and nothing merges \u2014 run `gp-foundry build` to pass GITHUB_TOKEN instead, then commit"})}let Oe=Ve(["--version"]);try{let L=(0,Nt.execFileSync)("git",["status","--porcelain",".github"],{cwd:s,encoding:"utf8"}).trim();e.push(L?{name:"committed",status:"warn",detail:".github/ has uncommitted changes",hint:"commit + push so GitHub picks them up"}:{name:"committed",status:"ok",detail:".github/ clean"})}catch{e.push({name:"committed",status:"skip",detail:"not a git repo"})}return{checks:e,failed:e.some(L=>L.status==="fail")}}function xo(r){let{dot:e,config:t,root:i}=_e(r);if(!Ve(["auth","status"]).ok)return{error:"gh missing or unauthenticated \u2014 status needs the GitHub CLI",hint:"install the GitHub CLI and run `gh auth login`"};let o=Se(["repo","view","--json","nameWithOwner"],i);if(!o)return{error:"not a GitHub repo (or no remote)",hint:"create it with `gh repo create`, push, then re-run `gp-foundry status`"};let{harness:s}=de(e,t),a=s.config.repo.branch_prefix,d=Date.now(),u=v=>Math.round((d-Date.parse(v))/36e5),c={};for(let v of["plan","build","needs-human"]){let P=v==="needs-human"?"needs-human":s.config.labels?.[v]??v,M=Se(["issue","list","--label",P,"--state","open","--json","number,title,createdAt","--limit","50"],i)??[];c[P]=M.map(j=>({number:j.number,title:j.title,ageHours:u(j.createdAt)}))}let h=(Se(["pr","list","--state","open","--json","number,title,labels,mergeable,headRefName,body,updatedAt","--limit","50"],i)??[]).filter(v=>v.headRefName.startsWith(a)),g=[],x=new Set;for(let v of h)for(let P of v.body?.matchAll(/[Cc]loses #(\d+)/g)??[])x.add(Number(P[1]));let $=s.config.labels?.build??"build";for(let v of c[$]??[])!x.has(v.number)&&v.ageHours>=2&&g.push({kind:"issue-no-pr",number:v.number,title:v.title,detail:`labeled ${$} ${v.ageHours}h ago, no open PR closes it`});for(let v of h)v.updatedAt&&u(v.updatedAt)>=4&&g.push({kind:"pr-idle",number:v.number,title:v.title,detail:`no activity for ${u(v.updatedAt)}h`});let E=(Se(["run","list","--status","failure","--limit","15","--json","name,url,createdAt,conclusion"],i)??[]).filter(v=>u(v.createdAt)<=24).map(v=>({workflow:v.name,url:v.url,ageHours:u(v.createdAt)}));return{repo:o.nameWithOwner,lanes:c,prs:h.map(v=>({number:v.number,title:v.title,labels:v.labels.map(P=>P.name),mergeable:v.mergeable,headRefName:v.headRefName})),stalled:g,recentFailures:E}}function ar(r){r.command("vendor").description("Copy the runtime-core actions into .github/actions/ (self-contained repo)").option("--dir <path>","target repo root",".").option("--json","machine-readable output").action(e=>{let t=ir(e.dir);if(e.json)return J({written:t});for(let i of t)process.stdout.write(U.default.green(`vendored ${i}
81
+ `)}function _o(r,e){let t=r.nodes.filter(i=>i.type==="merge-gate");return t.length===0?!1:t.some(i=>{if(!i.files.policy)return!0;let o=(0,G.dirname)(r.sourcePath??""),s=(0,G.join)(e,o,i.files.policy);if(!(0,B.existsSync)(s))return!0;try{let a=ye.load((0,B.readFileSync)(s,"utf8"));return(a?.require_ci??a?.requireCi)!==!1}catch{return!0}})}function ir(r){let e=[];for(let i of or()){let o=ce(`actions/${i}`),s=(0,G.join)(r,".github/actions",i);(0,B.mkdirSync)(s,{recursive:!0}),(0,B.cpSync)((0,G.join)(o,"action.yml"),(0,G.join)(s,"action.yml")),(0,B.existsSync)((0,G.join)(o,"dist"))&&(0,B.cpSync)((0,G.join)(o,"dist"),(0,G.join)(s,"dist"),{recursive:!0}),e.push(`.github/actions/${i}/`)}let t=(0,G.join)(r,".github/agent-setup/action.yml");return(0,B.existsSync)(t)||((0,B.mkdirSync)((0,G.dirname)(t),{recursive:!0}),(0,B.writeFileSync)(t,(0,B.readFileSync)(ce("skill/templates/agent-setup.yml"),"utf8")),e.push(".github/agent-setup/action.yml")),e}function Ao(r){(0,B.mkdirSync)(r,{recursive:!0}),(0,B.cpSync)(ce("skill/SKILL.md"),(0,G.join)(r,"SKILL.md")),(0,B.cpSync)(ce("skill/reference"),(0,G.join)(r,"reference"),{recursive:!0}),(0,B.cpSync)(ce("skill/templates"),(0,G.join)(r,"templates"),{recursive:!0})}function rr(r){let e=[],{dot:t,config:i,base:o,root:s}=Ae(r);if(!(0,B.existsSync)(t))return e.push({name:"harness",status:"fail",detail:`no harness.dot at ${t}`,hint:"run `gp-foundry init`"}),{checks:e,failed:!0};let{harness:a,parseErrors:d}=de(t,i),u=j=>(0,B.existsSync)((0,G.join)(o,j)),c=(0,Ht.relative)(s,o).replace(/\\/g,"/"),{files:f,diagnostics:h}=Ue(a,{fileExists:u},{specDir:c}),g=h.filter(j=>j.level==="error").length+d.length,x=h.filter(j=>j.level==="warning");e.push(g?{name:"validate",status:"fail",detail:`${g} error(s)`,hint:"run `gp-foundry validate` for details"}:{name:"validate",status:x.length?"warn":"ok",detail:x.length?`${x.length} warning(s): ${x.map(j=>j.code).join(", ")}`:"no diagnostics"});let $=f.filter(j=>{let se=(0,G.join)(s,j.path);return((0,B.existsSync)(se)?(0,B.readFileSync)(se,"utf8"):null)!==j.contents});if(e.push($.length?{name:"workflows in sync",status:"fail",detail:`${$.length} file(s) drifted: ${$.slice(0,3).map(j=>j.path).join(", ")}${$.length>3?", \u2026":""}`,hint:"run `gp-foundry build`"}:{name:"workflows in sync",status:"ok",detail:`${f.length} generated files match`}),(a.config.runtime?.mode??"pinned")==="vendored"){let j=or().filter(se=>!(0,B.existsSync)((0,G.join)(s,".github/actions",se,"action.yml")));e.push(j.length?{name:"vendored actions",status:"fail",detail:`missing: ${j.join(", ")}`,hint:"run `gp-foundry vendor`"}:{name:"vendored actions",status:"ok",detail:"all runtime actions vendored"})}if(e.push((0,B.existsSync)((0,G.join)(s,".github/agent-setup/action.yml"))?{name:"agent-setup shim",status:"ok",detail:".github/agent-setup/action.yml present"}:{name:"agent-setup shim",status:"fail",detail:"missing \u2014 every agent job needs it",hint:"run `gp-foundry vendor` (or `init`)"}),!Ve(["auth","status"]).ok)return e.push({name:"gh cli",status:"skip",detail:"gh missing or unauthenticated \u2014 skipping repo checks",hint:"install GitHub CLI and `gh auth login`"}),{checks:e,failed:e.some(j=>j.status==="fail")};e.push({name:"gh cli",status:"ok",detail:"authenticated"});let v=ve(["repo","view","--json","nameWithOwner,defaultBranchRef"],s);if(!v)return e.push({name:"github repo",status:"skip",detail:"not a GitHub repo (or no remote) \u2014 skipping labels/secrets checks",hint:"create it with `gh repo create`, then re-run `gp-foundry up` to create labels"}),{checks:e,failed:e.some(j=>j.status==="fail")};e.push({name:"github repo",status:"ok",detail:v.nameWithOwner});let P=v.defaultBranchRef?.name;P&&e.push(P===a.config.repo.base_branch?{name:"base branch",status:"ok",detail:P}:{name:"base branch",status:"fail",detail:`config says '${a.config.repo.base_branch}' but the repo default is '${P}'`,hint:"fix repo.base_branch in foundry.config.yaml and re-run `gp-foundry up`"});let M=new Set((ve(["label","list","--json","name","--limit","1000"],s)??[]).map(j=>j.name)),L=sr(i).map(j=>j.name),D=L.filter(j=>!M.has(j));e.push(D.length?{name:"labels",status:"fail",detail:`missing: ${D.join(", ")}`,hint:"run `gp-foundry up` to create them"}:{name:"labels",status:"ok",detail:L.join(", ")});let Z=new Set((ve(["secret","list","--json","name"],s)??[]).map(j=>j.name)),oe=[a.config.agent.oauth_token_secret??"CLAUDE_CODE_OAUTH_TOKEN"],K=a.config.auth;K?.mode==="pat"&&K.token_secret&&oe.push(K.token_secret),K?.mode==="app"&&oe.push(K.app_id_secret??"APP_ID",K.app_key_secret??"APP_PRIVATE_KEY");let xe=oe.filter(j=>!Z.has(j));if(e.push(xe.length?{name:"secrets",status:"fail",detail:`missing: ${xe.join(", ")}`,hint:`gh secret set ${xe[0]}`}:{name:"secrets",status:"ok",detail:oe.join(", ")}),_o(a,s)){let se=f.filter(te=>/\/workflows\/.*\.yml$/.test(te.path)&&te.contents.includes("actions/merge-gate")).map(te=>(0,G.join)(s,te.path)).filter(te=>(0,B.existsSync)(te)).map(te=>(0,B.readFileSync)(te,"utf8")),Te=se.filter(te=>!te.includes("checks-token"));se.length&&Te.length&&e.push({name:"merge gate ci read",status:"fail",detail:`${Te.length} merge-gate workflow(s) read check-runs with the harness token`,hint:"a fine-grained PAT cannot be granted the Checks permission, so that read 403s and nothing merges \u2014 run `gp-foundry build` to pass GITHUB_TOKEN instead, then commit"})}let $e=Ve(["--version"]);try{let j=(0,Nt.execFileSync)("git",["status","--porcelain",".github"],{cwd:s,encoding:"utf8"}).trim();e.push(j?{name:"committed",status:"warn",detail:".github/ has uncommitted changes",hint:"commit + push so GitHub picks them up"}:{name:"committed",status:"ok",detail:".github/ clean"})}catch{e.push({name:"committed",status:"skip",detail:"not a git repo"})}return{checks:e,failed:e.some(j=>j.status==="fail")}}function xo(r){let{dot:e,config:t,root:i}=Ae(r);if(!Ve(["auth","status"]).ok)return{error:"gh missing or unauthenticated \u2014 status needs the GitHub CLI",hint:"install the GitHub CLI and run `gh auth login`"};let o=ve(["repo","view","--json","nameWithOwner"],i);if(!o)return{error:"not a GitHub repo (or no remote)",hint:"create it with `gh repo create`, push, then re-run `gp-foundry status`"};let{harness:s}=de(e,t),a=s.config.repo.branch_prefix,d=Date.now(),u=v=>Math.round((d-Date.parse(v))/36e5),c={};for(let v of["plan","build","needs-human"]){let P=v==="needs-human"?"needs-human":s.config.labels?.[v]??v,M=ve(["issue","list","--label",P,"--state","open","--json","number,title,createdAt","--limit","50"],i)??[];c[P]=M.map(L=>({number:L.number,title:L.title,ageHours:u(L.createdAt)}))}let h=(ve(["pr","list","--state","open","--json","number,title,labels,mergeable,headRefName,body,updatedAt","--limit","50"],i)??[]).filter(v=>v.headRefName.startsWith(a)),g=[],x=new Set;for(let v of h)for(let P of v.body?.matchAll(/[Cc]loses #(\d+)/g)??[])x.add(Number(P[1]));let $=s.config.labels?.build??"build";for(let v of c[$]??[])!x.has(v.number)&&v.ageHours>=2&&g.push({kind:"issue-no-pr",number:v.number,title:v.title,detail:`labeled ${$} ${v.ageHours}h ago, no open PR closes it`});for(let v of h)v.updatedAt&&u(v.updatedAt)>=4&&g.push({kind:"pr-idle",number:v.number,title:v.title,detail:`no activity for ${u(v.updatedAt)}h`});let E=(ve(["run","list","--status","failure","--limit","15","--json","name,url,createdAt,conclusion"],i)??[]).filter(v=>u(v.createdAt)<=24).map(v=>({workflow:v.name,url:v.url,ageHours:u(v.createdAt)}));return{repo:o.nameWithOwner,lanes:c,prs:h.map(v=>({number:v.number,title:v.title,labels:v.labels.map(P=>P.name),mergeable:v.mergeable,headRefName:v.headRefName})),stalled:g,recentFailures:E}}function ar(r){r.command("vendor").description("Copy the runtime-core actions into .github/actions/ (self-contained repo)").option("--dir <path>","target repo root",".").option("--json","machine-readable output").action(e=>{let t=ir(e.dir);if(e.json)return J({written:t});for(let i of t)process.stdout.write(U.default.green(`vendored ${i}
81
82
  `));process.stdout.write(U.default.dim(`commit .github/actions/ \u2014 the generated workflows reference these local paths
82
- `))}),r.command("skill").description("Install the Claude skill (Socratic setup) into .claude/skills/gp-foundry/").option("--user","install for all projects (~/.claude/skills/) instead of this repo").option("--dir <path>","target repo root (project mode)",".").option("--json","machine-readable output").action(e=>{let t=process.env.HOME??process.env.USERPROFILE??".",i=e.user?(0,W.join)(t,".claude/skills/gp-foundry"):(0,W.join)(e.dir,".claude/skills/gp-foundry");if(Ao(i),e.json)return J({installed:i});process.stdout.write(U.default.green(`installed skill \u2192 ${i}
83
+ `))}),r.command("skill").description("Install the Claude skill (Socratic setup) into .claude/skills/gp-foundry/").option("--user","install for all projects (~/.claude/skills/) instead of this repo").option("--dir <path>","target repo root (project mode)",".").option("--json","machine-readable output").action(e=>{let t=process.env.HOME??process.env.USERPROFILE??".",i=e.user?(0,G.join)(t,".claude/skills/gp-foundry"):(0,G.join)(e.dir,".claude/skills/gp-foundry");if(Ao(i),e.json)return J({installed:i});process.stdout.write(U.default.green(`installed skill \u2192 ${i}
83
84
  `)),process.stdout.write(U.default.dim(`In Claude Code, type /gp-foundry (or just ask: "set up an agent pipeline for this repo").
84
85
  The skill interviews you Socratically, drafts harness.dot + roles, and drives this CLI.
85
86
  `))}),r.command("doctor").description("Preflight the factory: config, drift, vendored actions, gh auth, labels, secrets").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action(e=>{let{checks:t,failed:i}=rr(e);e.json?J({ok:!i,checks:t}):(tr(t),process.stdout.write(i?U.default.red(`
@@ -104,18 +105,18 @@ failed runs, last 24h (${t.recentFailures.length})
104
105
  `));for(let i of t.recentFailures.slice(0,10))process.stdout.write(` ${i.workflow} ${U.default.dim(`${i.ageHours}h ago`)} ${i.url}
105
106
  `)}!t.stalled.length&&!t.recentFailures.length&&process.stdout.write(U.default.green(`
106
107
  no stalled work, no recent failures
107
- `))}),r.command("up").description("Bring the factory up: create labels, vendor actions, build workflows, run doctor").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action(e=>{let{dot:t,config:i,base:o,root:s}=_e(e),a={};if(Ve(["auth","status"]).ok&&Se(["repo","view","--json","nameWithOwner"],s)){let E=[];for(let v of sr(i))Ve(["label","create",v.name,"--color",v.color,"--description",v.description],{cwd:s}).ok&&E.push(v.name);a.labels=E,e.json||process.stdout.write(U.default.green(`labels ensured (created: ${E.length?E.join(", "):"none \u2014 already present"})
108
+ `))}),r.command("up").description("Bring the factory up: create labels, vendor actions, build workflows, run doctor").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action(e=>{let{dot:t,config:i,base:o,root:s}=Ae(e),a={};if(Ve(["auth","status"]).ok&&ve(["repo","view","--json","nameWithOwner"],s)){let E=[];for(let v of sr(i))Ve(["label","create",v.name,"--color",v.color,"--description",v.description],{cwd:s}).ok&&E.push(v.name);a.labels=E,e.json||process.stdout.write(U.default.green(`labels ensured (created: ${E.length?E.join(", "):"none \u2014 already present"})
108
109
  `))}else a.labels="skipped (gh unavailable or no GitHub repo)",e.json||process.stdout.write(U.default.yellow("skipped label creation (gh unavailable or no GitHub repo yet) \u2014 re-run `gp-foundry up` once the repo exists\n"));let{harness:d}=de(t,i);(d.config.runtime?.mode??"pinned")==="vendored"&&(a.vendored=ir(s),e.json||process.stdout.write(U.default.green(`vendored ${a.vendored.length} runtime action(s)
109
- `)));let u=E=>(0,B.existsSync)((0,W.join)(o,E)),c=(0,Ht.relative)(s,o).replace(/\\/g,"/"),{files:f,diagnostics:h}=Ue(d,{fileExists:u},{specDir:c});an(h)&&(e.json?J({ok:!1,diagnostics:h}):process.stderr.write(U.default.red("build errors \u2014 run `gp-foundry validate` for details\n")),process.exit(1));for(let E of f){let v=(0,W.join)(s,E.path);(0,B.mkdirSync)((0,W.dirname)(v),{recursive:!0}),(0,B.writeFileSync)(v,E.contents)}a.wrote=f.map(E=>E.path);let g=f.filter(E=>E.path.startsWith(".github/workflows/")).length;e.json||process.stdout.write(U.default.green(`built ${g} workflows + HARNESS.md
110
+ `)));let u=E=>(0,B.existsSync)((0,G.join)(o,E)),c=(0,Ht.relative)(s,o).replace(/\\/g,"/"),{files:f,diagnostics:h}=Ue(d,{fileExists:u},{specDir:c});an(h)&&(e.json?J({ok:!1,diagnostics:h}):process.stderr.write(U.default.red("build errors \u2014 run `gp-foundry validate` for details\n")),process.exit(1));for(let E of f){let v=(0,G.join)(s,E.path);(0,B.mkdirSync)((0,G.dirname)(v),{recursive:!0}),(0,B.writeFileSync)(v,E.contents)}a.wrote=f.map(E=>E.path);let g=f.filter(E=>E.path.startsWith(".github/workflows/")).length;e.json||process.stdout.write(U.default.green(`built ${g} workflows + HARNESS.md
110
111
  `));let{checks:x,failed:$}=rr(e);if(a.checks=x,a.ok=!$,e.json)return J(a);process.stdout.write(`
111
112
  `),tr(x),process.stdout.write($?U.default.yellow(`
112
113
  almost there \u2014 fix the \u2717 items above, commit .github/, push, then file an issue
113
114
  `):U.default.green(`
114
115
  factory is up \u2014 commit .github/, push, then file an issue to watch it run
115
- `)),process.exit($?1:0)})}var ve=new Kt,ko=JSON.parse((0,Y.readFileSync)(ce("package.json"),"utf8")).version;ve.name("gp-foundry").description("Compile a DOT harness spec into GitHub Actions.").version(ko);function Co(r,e){let t=new Map;for(let i of r.nodes){if(!i.files.role)continue;let o=(0,ne.join)(e,i.files.role);if((0,Y.existsSync)(o)){let s=Zi((0,Y.readFileSync)(o,"utf8"));s&&t.set(i.id,s)}}return t}var Eo=[["skill/templates/harness.dot",".github/harness.dot"],["skill/templates/foundry.config.yaml",".github/agents/foundry.config.yaml"],["skill/templates/scope.yaml",".github/agents/scope.yaml"],["skill/templates/policy-merge.yaml",".github/agents/policy/merge.yaml"],["skill/templates/communication.md",".github/agents/communication.md"],["skill/templates/agent-setup.yml",".github/agent-setup/action.yml"]];ve.command("init").description("Scaffold a starter harness (harness.dot + config + roles + scope + policy) into a repo").option("--dir <path>","target repo root",".").option("--force","overwrite existing files").option("--json","machine-readable output").action(r=>{let e=(0,ne.resolve)(r.dir),t=[],i=[],o=(d,u)=>{let c=(0,ne.join)(e,d);if((0,Y.existsSync)(c)&&!r.force){i.push(d);return}(0,Y.mkdirSync)((0,ne.dirname)(c),{recursive:!0}),(0,Y.writeFileSync)(c,u),t.push(d)},s="main";try{let d=(0,lr.execFileSync)("git",["symbolic-ref","--short","HEAD"],{cwd:e,encoding:"utf8"}).trim();d&&(s=d)}catch{}for(let[d,u]of Eo){let c=(0,Y.readFileSync)(ce(d),"utf8");u.endsWith("foundry.config.yaml")&&s!=="main"&&(c=c.replace(/^(\s*base_branch:\s*)main\b/m,`$1${s}`)),o(u,c)}let a=(0,ne.join)(e,".github/harness.dot");if((0,Y.existsSync)(a))for(let d of on((0,Y.readFileSync)(a,"utf8")).nodes){if(!d.files.role)continue;let u=d.files.role.replace(/^.*\//,"").replace(/\.md$/,""),c=ce(`roles/software/${u}.md`),f=(0,Y.existsSync)(c)?c:ce("skill/templates/role.md");o((0,ne.join)(".github",d.files.role),(0,Y.readFileSync)(f,"utf8"))}if(r.json)return J({written:t,skipped:i});for(let d of t)process.stdout.write(Q.default.green(`created ${d}
116
+ `)),process.exit($?1:0)})}var Oe=new Kt,ko=JSON.parse((0,Y.readFileSync)(ce("package.json"),"utf8")).version;Oe.name("gp-foundry").description("Compile a DOT harness spec into GitHub Actions.").version(ko);function Co(r,e){let t=new Map;for(let i of r.nodes){if(!i.files.role)continue;let o=(0,ne.join)(e,i.files.role);if((0,Y.existsSync)(o)){let s=Zi((0,Y.readFileSync)(o,"utf8"));s&&t.set(i.id,s)}}return t}var Eo=[["skill/templates/harness.dot",".github/harness.dot"],["skill/templates/foundry.config.yaml",".github/agents/foundry.config.yaml"],["skill/templates/scope.yaml",".github/agents/scope.yaml"],["skill/templates/policy-merge.yaml",".github/agents/policy/merge.yaml"],["skill/templates/communication.md",".github/agents/communication.md"],["skill/templates/agent-setup.yml",".github/agent-setup/action.yml"]];Oe.command("init").description("Scaffold a starter harness (harness.dot + config + roles + scope + policy) into a repo").option("--dir <path>","target repo root",".").option("--force","overwrite existing files").option("--json","machine-readable output").action(r=>{let e=(0,ne.resolve)(r.dir),t=[],i=[],o=(d,u)=>{let c=(0,ne.join)(e,d);if((0,Y.existsSync)(c)&&!r.force){i.push(d);return}(0,Y.mkdirSync)((0,ne.dirname)(c),{recursive:!0}),(0,Y.writeFileSync)(c,u),t.push(d)},s="main";try{let d=(0,lr.execFileSync)("git",["symbolic-ref","--short","HEAD"],{cwd:e,encoding:"utf8"}).trim();d&&(s=d)}catch{}for(let[d,u]of Eo){let c=(0,Y.readFileSync)(ce(d),"utf8");u.endsWith("foundry.config.yaml")&&s!=="main"&&(c=c.replace(/^(\s*base_branch:\s*)main\b/m,`$1${s}`)),o(u,c)}let a=(0,ne.join)(e,".github/harness.dot");if((0,Y.existsSync)(a))for(let d of on((0,Y.readFileSync)(a,"utf8")).nodes){if(!d.files.role)continue;let u=d.files.role.replace(/^.*\//,"").replace(/\.md$/,""),c=ce(`roles/software/${u}.md`),f=(0,Y.existsSync)(c)?c:ce("skill/templates/role.md");o((0,ne.join)(".github",d.files.role),(0,Y.readFileSync)(f,"utf8"))}if(r.json)return J({written:t,skipped:i});for(let d of t)process.stdout.write(Q.default.green(`created ${d}
116
117
  `));for(let d of i)process.stderr.write(Q.default.yellow(`skipped ${d} (exists; --force to overwrite)
117
118
  `));process.stdout.write(["",Q.default.bold("Next steps \u2014 dark factory in 4 moves:"),` 1. ${Q.default.cyan("gp-foundry up")} vendor actions, create labels, build workflows, run checks`,` 2. set two secrets: ${Q.default.cyan("gh secret set CLAUDE_CODE_OAUTH_TOKEN")} (agent auth)`,` ${Q.default.cyan("gh secret set AGENT_PAT")} (fine-grained PAT: contents/PRs/issues RW)`,` 3. commit + push ${Q.default.cyan(".github/")}`," 4. file an issue \u2192 the \u{1F575}\uFE0F scout triages it and the factory takes it from there","",Q.default.dim("Tune later: .github/harness.dot (topology) \xB7 agents/roles/*.md (behavior) \xB7 agents/policy/merge.yaml (merge rules)"),""].join(`
118
- `))});ve.command("build").description("Compile harness.dot \u2192 .github/workflows/*.yml (+ HARNESS.md)").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--out <dir>","output repo root (default: dir of harness.dot)").option("--check","verify generated files are in sync; exit 1 on drift").option("--dry-run","print what would be written; do not write").option("--force","write even if there are error diagnostics").option("--json","machine-readable output").action(r=>{let{dot:e,config:t,base:i,root:o}=_e(r);(0,Y.existsSync)(e)||(r.json?J({error:`no harness.dot at ${e}`}):process.stderr.write(Q.default.red(`no harness.dot at ${e}
119
+ `))});Oe.command("build").description("Compile harness.dot \u2192 .github/workflows/*.yml (+ HARNESS.md)").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--out <dir>","output repo root (default: dir of harness.dot)").option("--check","verify generated files are in sync; exit 1 on drift").option("--dry-run","print what would be written; do not write").option("--force","write even if there are error diagnostics").option("--json","machine-readable output").action(r=>{let{dot:e,config:t,base:i,root:o}=Ae(r);(0,Y.existsSync)(e)||(r.json?J({error:`no harness.dot at ${e}`}):process.stderr.write(Q.default.red(`no harness.dot at ${e}
119
120
  `)),process.exit(1));let{harness:s,parseErrors:a}=de(e,t);if(a.length){if(r.json)J({parseErrors:a});else for(let g of a)process.stderr.write(Q.default.red(`parse: ${g.message}${g.line?` (line ${g.line})`:""}
120
121
  `));process.exit(1)}let d=(0,ne.resolve)(r.out??o),u=(0,ne.relative)(d,i).replace(/\\/g,"/"),c=g=>(0,Y.existsSync)((0,ne.join)(i,g)),{files:f,diagnostics:h}=Ue(s,{fileExists:c},{specDir:u});if(r.json||Tt(h),r.check){let g=f.filter(x=>{let $=(0,ne.join)(d,x.path);return((0,Y.existsSync)($)?(0,Y.readFileSync)($,"utf8"):null)!==x.contents});if(r.json)J({upToDate:g.length===0,drift:g.map(x=>x.path),diagnostics:h});else if(g.length){for(let x of g)process.stderr.write(Q.default.yellow(`drift: ${x.path}
121
122
  `));process.stderr.write(Q.default.red("generated files are out of date \u2014 run `gp-foundry build`\n"))}else process.stdout.write(Q.default.green(`up to date
@@ -123,11 +124,11 @@ factory is up \u2014 commit .github/, push, then file an issue to watch it run
123
124
  `)),process.exit(1)),r.dryRun){if(r.json)J({diagnostics:h,files:f});else for(let g of f)process.stdout.write(Q.default.cyan(`--- ${g.path}
124
125
  `)+g.contents+`
125
126
  `);return}for(let g of f){let x=(0,ne.join)(d,g.path);(0,Y.mkdirSync)((0,ne.dirname)(x),{recursive:!0}),(0,Y.writeFileSync)(x,g.contents),r.json||process.stdout.write(Q.default.green(`wrote ${g.path}
126
- `))}r.json&&J({ok:!an(h),diagnostics:h,wrote:f.map(g=>g.path)})});ve.command("validate").description("Validate the harness (structural + files + role handoffs + topology)").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action(r=>{let{dot:e,config:t,base:i}=_e(r);(0,Y.existsSync)(e)||(r.json?J({ok:!1,error:`no harness.dot at ${e}`}):process.stderr.write(Q.default.red(`no harness.dot at ${e} \u2014 run \`gp-foundry init\` first
127
+ `))}r.json&&J({ok:!an(h),diagnostics:h,wrote:f.map(g=>g.path)})});Oe.command("validate").description("Validate the harness (structural + files + role handoffs + topology)").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action(r=>{let{dot:e,config:t,base:i}=Ae(r);(0,Y.existsSync)(e)||(r.json?J({ok:!1,error:`no harness.dot at ${e}`}):process.stderr.write(Q.default.red(`no harness.dot at ${e} \u2014 run \`gp-foundry init\` first
127
128
  `)),process.exit(1));let{harness:o,parseErrors:s}=de(e,t),a=f=>(0,Y.existsSync)((0,ne.join)(i,f)),d=Co(o,i),u=[...Xe(o,{fileExists:a,roles:d}),...Qe(o)],c=u.some(f=>f.level==="error")||s.length>0;if(r.json)J({ok:!c,parseErrors:s,diagnostics:u});else{for(let f of s)process.stderr.write(Q.default.red(`parse: ${f.message}
128
- `));Tt(u)}process.exit(c?1:0)});ve.command("graph").description("Print the harness topology (Mermaid, or --json for the IR)").option("--dot <path>","path to harness.dot").option("--json","output the parsed nodes/edges as JSON").action(r=>{let{dot:e}=_e(r);(0,Y.existsSync)(e)||(r.json?J({error:`no harness.dot at ${e}`}):process.stderr.write(Q.default.red(`no harness.dot at ${e} \u2014 run \`gp-foundry init\` first
129
- `)),process.exit(1));let{harness:t}=de(e);r.json?J({name:t.name,nodes:t.nodes,edges:t.edges}):process.stdout.write(Rn(t)+`
130
- `)});ve.command("explain <node>").description("Show the workflow a single node compiles to").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action((r,e)=>{let{dot:t,config:i}=_e(e);(0,Y.existsSync)(t)||(e.json?J({error:`no harness.dot at ${t}`}):process.stderr.write(Q.default.red(`no harness.dot at ${t} \u2014 run \`gp-foundry init\` first
129
+ `));Tt(u)}process.exit(c?1:0)});Oe.command("graph").description("Print the harness topology (Mermaid, or --json for the IR)").option("--dot <path>","path to harness.dot").option("--json","output the parsed nodes/edges as JSON").action(r=>{let{dot:e}=Ae(r);(0,Y.existsSync)(e)||(r.json?J({error:`no harness.dot at ${e}`}):process.stderr.write(Q.default.red(`no harness.dot at ${e} \u2014 run \`gp-foundry init\` first
130
+ `)),process.exit(1));let{harness:t}=de(e);r.json?J({name:t.name,nodes:t.nodes,edges:t.edges}):process.stdout.write(In(t)+`
131
+ `)});Oe.command("explain <node>").description("Show the workflow a single node compiles to").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action((r,e)=>{let{dot:t,config:i}=Ae(e);(0,Y.existsSync)(t)||(e.json?J({error:`no harness.dot at ${t}`}):process.stderr.write(Q.default.red(`no harness.dot at ${t} \u2014 run \`gp-foundry init\` first
131
132
  `)),process.exit(1));let{harness:o}=de(t,i),{files:s}=Ue(o),a=s.find(d=>d.path.endsWith(`/${r}.yml`))??s.find(d=>d.path.startsWith(".github/workflows/")&&new RegExp(`^ ${r}:`,"m").test(d.contents));a||(e.json?J({error:`no generated workflow for node '${r}'`}):process.stderr.write(Q.default.red(`no generated workflow for node '${r}'
132
133
  `)),process.exit(1)),e.json?J({node:r,path:a.path,contents:a.contents}):process.stdout.write(a.contents+`
133
- `)});ar(ve);ve.parseAsync(process.argv);
134
+ `)});ar(Oe);Oe.parseAsync(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thegpvc/gp-foundry",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "description": "Compile a directed-graph spec (harness.dot) into an autonomous GitHub Actions agent harness.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,6 +43,8 @@ Rules of thumb:
43
43
  | `gates="ci.yml,..."` | `pr-review` | named check workflows the review depends on; each conclusion is put in front of the reviewer, and the job timeout grows to cover the waits |
44
44
  | `max_attempts=N` | `pr-fix` | loop bound; pairs with an `attempts>=N` escape edge. Counted from the reviewer's submitted request-changes reviews, which cannot be deleted |
45
45
  | `paths="memory/"` | `scheduled-agent` | optional allowlist of prefixes this lane may write; anything else is reverted before the push |
46
+ | `commit="none\|pr\|direct"` | `scheduled-agent` | how the lane persists output: `direct` (default) commits to base; `pr` opens a reviewed PR; `none` no commit/push (read-only lane) |
47
+ | `secrets="A,B"` | agent types | extra Actions secrets exposed to THIS lane's env (unioned with global `agent.secrets`); least-privilege scoping, e.g. a Sentry token only on the sweeper |
46
48
  | `policy="policy/merge.yaml"` | `merge-gate` | merge-policy file |
47
49
  | `schedule="*/30 * * * *"` | `merge-gate`, sweeps | cron cadence |
48
50
  | `environment=NAME` | `human-gate` | GitHub Environment gating approval (**required** on human-gate) |