faf-cli 7.11.0 → 7.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,100 +1,100 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as TW}from"node:module";var VW=Object.create;var{getPrototypeOf:KW,defineProperty:i4,getOwnPropertyNames:HW}=Object;var BW=Object.prototype.hasOwnProperty;function MW($){return this[$]}var OW,NW,LW=($,Z,X)=>{var z=$!=null&&typeof $==="object";if(z){var J=Z?OW??=new WeakMap:NW??=new WeakMap,Q=J.get($);if(Q)return Q}X=$!=null?VW(KW($)):{};let Y=Z||!$||!$.__esModule?i4(X,"default",{value:$,enumerable:!0}):X;for(let W of HW($))if(!BW.call(Y,W))i4(Y,W,{get:MW.bind($,W),enumerable:!0});if(z)J.set($,Y);return Y};var P=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var DW=($)=>$;function IW($,Z){this[$]=DW.bind(null,Z)}var w9=($,Z)=>{for(var X in Z)i4($,X,{get:Z[X],enumerable:!0,configurable:!0,set:IW.bind(Z,X)})};var v=($,Z)=>()=>($&&(Z=$($=0)),Z);var C0=TW(import.meta.url);var t$=P((AW)=>{class n4 extends Error{constructor($,Z,X){super(X);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Z,this.exitCode=$,this.nestedError=void 0}}class S9 extends n4{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}AW.CommanderError=n4;AW.InvalidArgumentError=S9});var f6=P((EW)=>{var{InvalidArgumentError:FW}=t$();class j9{constructor($,Z){switch(this.description=Z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}default($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,X)=>{if(!this.argChoices.includes(Z))throw new FW(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function CW($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}EW.Argument=j9;EW.humanReadableArgName=CW});var r4=P((jW)=>{var{humanReadableArgName:SW}=f6();class x9{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let Z=$.commands.filter((z)=>!z._hidden),X=$._getHelpCommand();if(X&&!X._hidden)Z.push(X);if(this.sortSubcommands)Z.sort((z,J)=>{return z.name().localeCompare(J.name())});return Z}compareOptions($,Z){let X=(z)=>{return z.short?z.short.replace(/^-/,""):z.long.replace(/^--/,"")};return X($).localeCompare(X(Z))}visibleOptions($){let Z=$.options.filter((z)=>!z.hidden),X=$._getHelpOption();if(X&&!X.hidden){let z=X.short&&$._findOption(X.short),J=X.long&&$._findOption(X.long);if(!z&&!J)Z.push(X);else if(X.long&&!J)Z.push($.createOption(X.long,X.description));else if(X.short&&!z)Z.push($.createOption(X.short,X.description))}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let Z=[];for(let X=$.parent;X;X=X.parent){let z=X.options.filter((J)=>!J.hidden);Z.push(...z)}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((Z)=>{Z.description=Z.description||$._argsDescription[Z.name()]||""});if($.registeredArguments.find((Z)=>Z.description))return $.registeredArguments;return[]}subcommandTerm($){let Z=$.registeredArguments.map((X)=>SW(X)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(z))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(z))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let X="";for(let z=$.parent;z;z=z.parent)X=z.name()+" "+X;return X+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)Z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)Z.push(`env: ${$.envVar}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}formatItemList($,Z,X){if(Z.length===0)return[];return[X.styleTitle($),...Z,""]}groupItems($,Z,X){let z=new Map;return $.forEach((J)=>{let Q=X(J);if(!z.has(Q))z.set(Q,[])}),Z.forEach((J)=>{let Q=X(J);if(!z.has(Q))z.set(Q,[]);z.get(Q).push(J)}),z}formatHelp($,Z){let X=Z.padWidth($,Z),z=Z.helpWidth??80;function J(G,V){return Z.formatItem(G,X,V,Z)}let Q=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)Q=Q.concat([Z.boxWrap(Z.styleCommandDescription(Y),z),""]);let W=Z.visibleArguments($).map((G)=>{return J(Z.styleArgumentTerm(Z.argumentTerm(G)),Z.styleArgumentDescription(Z.argumentDescription(G)))});if(Q=Q.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(G)=>G.helpGroupHeading??"Options:").forEach((G,V)=>{let K=G.map((H)=>{return J(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Z.showGlobalOptions){let G=Z.visibleGlobalOptions($).map((V)=>{return J(Z.styleOptionTerm(Z.optionTerm(V)),Z.styleOptionDescription(Z.optionDescription(V)))});Q=Q.concat(this.formatItemList("Global Options:",G,Z))}return this.groupItems($.commands,Z.visibleCommands($),(G)=>G.helpGroup()||"Commands:").forEach((G,V)=>{let K=G.map((H)=>{return J(Z.styleSubcommandTerm(Z.subcommandTerm(H)),Z.styleSubcommandDescription(Z.subcommandDescription(H)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Q.join(`
2
+ import{createRequire as SW}from"node:module";var IW=Object.create;var{getPrototypeOf:TW,defineProperty:l4,getOwnPropertyNames:AW}=Object;var RW=Object.prototype.hasOwnProperty;function _W($){return this[$]}var FW,CW,PW=($,Z,X)=>{var z=$!=null&&typeof $==="object";if(z){var J=Z?FW??=new WeakMap:CW??=new WeakMap,Q=J.get($);if(Q)return Q}X=$!=null?IW(TW($)):{};let Y=Z||!$||!$.__esModule?l4(X,"default",{value:$,enumerable:!0}):X;for(let W of AW($))if(!RW.call(Y,W))l4(Y,W,{get:_W.bind($,W),enumerable:!0});if(z)J.set($,Y);return Y};var E=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var EW=($)=>$;function wW($,Z){this[$]=EW.bind(null,Z)}var w9=($,Z)=>{for(var X in Z)l4($,X,{get:Z[X],enumerable:!0,configurable:!0,set:wW.bind(Z,X)})};var v=($,Z)=>()=>($&&(Z=$($=0)),Z);var C0=SW(import.meta.url);var t$=E((jW)=>{class d4 extends Error{constructor($,Z,X){super(X);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Z,this.exitCode=$,this.nestedError=void 0}}class S9 extends d4{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}jW.CommanderError=d4;jW.InvalidArgumentError=S9});var f6=E((vW)=>{var{InvalidArgumentError:kW}=t$();class j9{constructor($,Z){switch(this.description=Z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}default($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,X)=>{if(!this.argChoices.includes(Z))throw new kW(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function yW($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}vW.Argument=j9;vW.humanReadableArgName=yW});var p4=E((uW)=>{var{humanReadableArgName:hW}=f6();class x9{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let Z=$.commands.filter((z)=>!z._hidden),X=$._getHelpCommand();if(X&&!X._hidden)Z.push(X);if(this.sortSubcommands)Z.sort((z,J)=>{return z.name().localeCompare(J.name())});return Z}compareOptions($,Z){let X=(z)=>{return z.short?z.short.replace(/^-/,""):z.long.replace(/^--/,"")};return X($).localeCompare(X(Z))}visibleOptions($){let Z=$.options.filter((z)=>!z.hidden),X=$._getHelpOption();if(X&&!X.hidden){let z=X.short&&$._findOption(X.short),J=X.long&&$._findOption(X.long);if(!z&&!J)Z.push(X);else if(X.long&&!J)Z.push($.createOption(X.long,X.description));else if(X.short&&!z)Z.push($.createOption(X.short,X.description))}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let Z=[];for(let X=$.parent;X;X=X.parent){let z=X.options.filter((J)=>!J.hidden);Z.push(...z)}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((Z)=>{Z.description=Z.description||$._argsDescription[Z.name()]||""});if($.registeredArguments.find((Z)=>Z.description))return $.registeredArguments;return[]}subcommandTerm($){let Z=$.registeredArguments.map((X)=>hW(X)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(z))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(z))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let X="";for(let z=$.parent;z;z=z.parent)X=z.name()+" "+X;return X+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)Z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)Z.push(`env: ${$.envVar}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}formatItemList($,Z,X){if(Z.length===0)return[];return[X.styleTitle($),...Z,""]}groupItems($,Z,X){let z=new Map;return $.forEach((J)=>{let Q=X(J);if(!z.has(Q))z.set(Q,[])}),Z.forEach((J)=>{let Q=X(J);if(!z.has(Q))z.set(Q,[]);z.get(Q).push(J)}),z}formatHelp($,Z){let X=Z.padWidth($,Z),z=Z.helpWidth??80;function J(G,V){return Z.formatItem(G,X,V,Z)}let Q=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)Q=Q.concat([Z.boxWrap(Z.styleCommandDescription(Y),z),""]);let W=Z.visibleArguments($).map((G)=>{return J(Z.styleArgumentTerm(Z.argumentTerm(G)),Z.styleArgumentDescription(Z.argumentDescription(G)))});if(Q=Q.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(G)=>G.helpGroupHeading??"Options:").forEach((G,V)=>{let K=G.map((H)=>{return J(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Z.showGlobalOptions){let G=Z.visibleGlobalOptions($).map((V)=>{return J(Z.styleOptionTerm(Z.optionTerm(V)),Z.styleOptionDescription(Z.optionDescription(V)))});Q=Q.concat(this.formatItemList("Global Options:",G,Z))}return this.groupItems($.commands,Z.visibleCommands($),(G)=>G.helpGroup()||"Commands:").forEach((G,V)=>{let K=G.map((H)=>{return J(Z.styleSubcommandTerm(Z.subcommandTerm(H)),Z.styleSubcommandDescription(Z.subcommandDescription(H)))});Q=Q.concat(this.formatItemList(V,K,Z))}),Q.join(`
3
3
  `)}displayWidth($){return b9($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z==="[command]")return this.styleSubcommandText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleCommandText(Z)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleSubcommandText(Z)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,Z){return Math.max(Z.longestOptionTermLength($,Z),Z.longestGlobalOptionTermLength($,Z),Z.longestSubcommandTermLength($,Z),Z.longestArgumentTermLength($,Z))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,Z,X,z){let Q=" ".repeat(2);if(!X)return Q+$;let Y=$.padEnd(Z+$.length-z.displayWidth($)),W=2,q=(this.helpWidth??80)-Z-W-2,G;if(q<this.minWidthToWrap||z.preformatted(X))G=X;else G=z.boxWrap(X,q).replace(/\n/g,`
4
4
  `+" ".repeat(Z+W));return Q+Y+" ".repeat(W)+G.replace(/\n/g,`
5
5
  ${Q}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let X=$.split(/\r\n|\n/),z=/[\s]*[^\s]+/g,J=[];return X.forEach((Q)=>{let Y=Q.match(z);if(Y===null){J.push("");return}let W=[Y.shift()],U=this.displayWidth(W[0]);Y.forEach((q)=>{let G=this.displayWidth(q);if(U+G<=Z){W.push(q),U+=G;return}J.push(W.join(""));let V=q.trimStart();W=[V],U=this.displayWidth(V)}),J.push(W.join(""))}),J.join(`
6
- `)}}function b9($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}jW.Help=x9;jW.stripColor=b9});var s4=P((vW)=>{var{InvalidArgumentError:kW}=t$();class y9{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let X=yW($);if(this.short=X.shortFlag,this.long=X.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,this.helpGroupHeading=void 0}default($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let Z=$;if(typeof $==="string")Z={[$]:!0};return this.implied=Object.assign(this.implied||{},Z),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,X)=>{if(!this.argChoices.includes(Z))throw new kW(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return k9(this.name().replace(/^no-/,""));return k9(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class v9{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((Z)=>{if(Z.negate)this.negativeOptions.set(Z.attributeName(),Z);else this.positiveOptions.set(Z.attributeName(),Z)}),this.negativeOptions.forEach((Z,X)=>{if(this.positiveOptions.has(X))this.dualOptions.add(X)})}valueFromOption($,Z){let X=Z.attributeName();if(!this.dualOptions.has(X))return!0;let z=this.negativeOptions.get(X).presetArg,J=z!==void 0?z:!1;return Z.negate===(J===$)}}function k9($){return $.split("-").reduce((Z,X)=>{return Z+X[0].toUpperCase()+X.slice(1)})}function yW($){let Z,X,z=/^-[^-]$/,J=/^--[^-]/,Q=$.split(/[ |,]+/).concat("guard");if(z.test(Q[0]))Z=Q.shift();if(J.test(Q[0]))X=Q.shift();if(!Z&&z.test(Q[0]))Z=Q.shift();if(!Z&&J.test(Q[0]))Z=X,X=Q.shift();if(Q[0].startsWith("-")){let Y=Q[0],W=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${W}
6
+ `)}}function b9($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}uW.Help=x9;uW.stripColor=b9});var i4=E((pW)=>{var{InvalidArgumentError:lW}=t$();class y9{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let X=dW($);if(this.short=X.shortFlag,this.long=X.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,this.helpGroupHeading=void 0}default($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let Z=$;if(typeof $==="string")Z={[$]:!0};return this.implied=Object.assign(this.implied||{},Z),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,X)=>{if(!this.argChoices.includes(Z))throw new lW(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return k9(this.name().replace(/^no-/,""));return k9(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class v9{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((Z)=>{if(Z.negate)this.negativeOptions.set(Z.attributeName(),Z);else this.positiveOptions.set(Z.attributeName(),Z)}),this.negativeOptions.forEach((Z,X)=>{if(this.positiveOptions.has(X))this.dualOptions.add(X)})}valueFromOption($,Z){let X=Z.attributeName();if(!this.dualOptions.has(X))return!0;let z=this.negativeOptions.get(X).presetArg,J=z!==void 0?z:!1;return Z.negate===(J===$)}}function k9($){return $.split("-").reduce((Z,X)=>{return Z+X[0].toUpperCase()+X.slice(1)})}function dW($){let Z,X,z=/^-[^-]$/,J=/^--[^-]/,Q=$.split(/[ |,]+/).concat("guard");if(z.test(Q[0]))Z=Q.shift();if(J.test(Q[0]))X=Q.shift();if(!Z&&z.test(Q[0]))Z=Q.shift();if(!Z&&J.test(Q[0]))Z=X,X=Q.shift();if(Q[0].startsWith("-")){let Y=Q[0],W=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${W}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
9
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(z.test(Y))throw Error(`${W}
10
10
  - too many short flags`);if(J.test(Y))throw Error(`${W}
11
11
  - too many long flags`);throw Error(`${W}
12
- - unrecognised flag format`)}if(Z===void 0&&X===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:X}}vW.Option=y9;vW.DualOptions=v9});var g9=P((mW)=>{function hW($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let X=[];for(let z=0;z<=$.length;z++)X[z]=[z];for(let z=0;z<=Z.length;z++)X[0][z]=z;for(let z=1;z<=Z.length;z++)for(let J=1;J<=$.length;J++){let Q=1;if($[J-1]===Z[z-1])Q=0;else Q=1;if(X[J][z]=Math.min(X[J-1][z]+1,X[J][z-1]+1,X[J-1][z-1]+Q),J>1&&z>1&&$[J-1]===Z[z-2]&&$[J-2]===Z[z-1])X[J][z]=Math.min(X[J][z],X[J-2][z-2]+1)}return X[$.length][Z.length]}function uW($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let X=$.startsWith("--");if(X)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let z=[],J=3,Q=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let W=hW($,Y),U=Math.max($.length,Y.length);if((U-W)/U>Q){if(W<J)J=W,z=[Y];else if(W===J)z.push(Y)}}),z.sort((Y,W)=>Y.localeCompare(W)),X)z=z.map((Y)=>`--${Y}`);if(z.length>1)return`
12
+ - unrecognised flag format`)}if(Z===void 0&&X===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:X}}pW.Option=y9;pW.DualOptions=v9});var g9=E((aW)=>{function rW($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let X=[];for(let z=0;z<=$.length;z++)X[z]=[z];for(let z=0;z<=Z.length;z++)X[0][z]=z;for(let z=1;z<=Z.length;z++)for(let J=1;J<=$.length;J++){let Q=1;if($[J-1]===Z[z-1])Q=0;else Q=1;if(X[J][z]=Math.min(X[J-1][z]+1,X[J][z-1]+1,X[J-1][z-1]+Q),J>1&&z>1&&$[J-1]===Z[z-2]&&$[J-2]===Z[z-1])X[J][z]=Math.min(X[J][z],X[J-2][z-2]+1)}return X[$.length][Z.length]}function sW($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let X=$.startsWith("--");if(X)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let z=[],J=3,Q=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let W=rW($,Y),U=Math.max($.length,Y.length);if((U-W)/U>Q){if(W<J)J=W,z=[Y];else if(W===J)z.push(Y)}}),z.sort((Y,W)=>Y.localeCompare(W)),X)z=z.map((Y)=>`--${Y}`);if(z.length>1)return`
13
13
  (Did you mean one of ${z.join(", ")}?)`;if(z.length===1)return`
14
- (Did you mean ${z[0]}?)`;return""}mW.suggestSimilar=uW});var m9=P((sW)=>{var lW=C0("node:events").EventEmitter,a4=C0("node:child_process"),Z1=C0("node:path"),h6=C0("node:fs"),a=C0("node:process"),{Argument:dW,humanReadableArgName:pW}=f6(),{CommanderError:o4}=t$(),{Help:iW,stripColor:nW}=r4(),{Option:f9,DualOptions:rW}=s4(),{suggestSimilar:h9}=g9();class e4 extends lW{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",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._savedState=null,this._outputConfiguration={writeOut:(Z)=>a.stdout.write(Z),writeErr:(Z)=>a.stderr.write(Z),outputError:(Z,X)=>X(Z),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>t4()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>t4()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:(Z)=>nW(Z)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let Z=this;Z;Z=Z.parent)$.push(Z);return $}command($,Z,X){let z=Z,J=X;if(typeof z==="object"&&z!==null)J=z,z=null;J=J||{};let[,Q,Y]=$.match(/([^ ]+) *(.*)/),W=this.createCommand(Q);if(z)W.description(z),W._executableHandler=!0;if(J.isDefault)this._defaultCommandName=W._name;if(W._hidden=!!(J.noHelp||J.hidden),W._executableFile=J.executableFile||null,Y)W.arguments(Y);if(this._registerCommand(W),W.parent=this,W.copyInheritedSettings(this),z)return this;return W}createCommand($){return new e4($)}createHelp(){return Object.assign(new iW,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,Z){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);if(Z=Z||{},Z.isDefault)this._defaultCommandName=$._name;if(Z.noHelp||Z.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,Z){return new dW($,Z)}argument($,Z,X,z){let J=this.createArgument($,Z);if(typeof X==="function")J.default(z).argParser(X);else J.default(X);return this.addArgument(J),this}arguments($){return $.trim().split(/ +/).forEach((Z)=>{this.argument(Z)}),this}addArgument($){let Z=this.registeredArguments.slice(-1)[0];if(Z?.variadic)throw Error(`only the last argument can be variadic '${Z.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,Z){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let X=$??"help [command]",[,z,J]=X.match(/([^ ]+) *(.*)/),Q=Z??"display help for command",Y=this.createCommand(z);if(Y.helpOption(!1),J)Y.arguments(J);if(Q)Y.description(Q);if(this._addImplicitHelpCommand=!0,this._helpCommand=Y,$||Z)this._initCommandGroup(Y);return this}addHelpCommand($,Z){if(typeof $!=="object")return this.helpCommand($,Z),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,Z){let X=["preSubcommand","preAction","postAction"];if(!X.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
- Expecting one of '${X.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(Z);else this._lifeCycleHooks[$]=[Z];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(Z)=>{if(Z.code!=="commander.executeSubCommandAsync")throw Z};return this}_exit($,Z,X){if(this._exitCallback)this._exitCallback(new o4($,Z,X));a.exit($)}action($){let Z=(X)=>{let z=this.registeredArguments.length,J=X.slice(0,z);if(this._storeOptionsAsProperties)J[z]=this;else J[z]=this.opts();return J.push(this),$.apply(this,J)};return this._actionHandler=Z,this}createOption($,Z){return new f9($,Z)}_callParseArg($,Z,X,z){try{return $.parseArg(Z,X)}catch(J){if(J.code==="commander.invalidArgument"){let Q=`${z} ${J.message}`;this.error(Q,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption($){let Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let X=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${X}'
14
+ (Did you mean ${z[0]}?)`;return""}aW.suggestSimilar=sW});var m9=E((JU)=>{var tW=C0("node:events").EventEmitter,n4=C0("node:child_process"),$1=C0("node:path"),h6=C0("node:fs"),a=C0("node:process"),{Argument:eW,humanReadableArgName:$U}=f6(),{CommanderError:r4}=t$(),{Help:ZU,stripColor:XU}=p4(),{Option:f9,DualOptions:zU}=i4(),{suggestSimilar:h9}=g9();class a4 extends tW{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",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._savedState=null,this._outputConfiguration={writeOut:(Z)=>a.stdout.write(Z),writeErr:(Z)=>a.stderr.write(Z),outputError:(Z,X)=>X(Z),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>s4()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>s4()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:(Z)=>XU(Z)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let Z=this;Z;Z=Z.parent)$.push(Z);return $}command($,Z,X){let z=Z,J=X;if(typeof z==="object"&&z!==null)J=z,z=null;J=J||{};let[,Q,Y]=$.match(/([^ ]+) *(.*)/),W=this.createCommand(Q);if(z)W.description(z),W._executableHandler=!0;if(J.isDefault)this._defaultCommandName=W._name;if(W._hidden=!!(J.noHelp||J.hidden),W._executableFile=J.executableFile||null,Y)W.arguments(Y);if(this._registerCommand(W),W.parent=this,W.copyInheritedSettings(this),z)return this;return W}createCommand($){return new a4($)}createHelp(){return Object.assign(new ZU,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,Z){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);if(Z=Z||{},Z.isDefault)this._defaultCommandName=$._name;if(Z.noHelp||Z.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,Z){return new eW($,Z)}argument($,Z,X,z){let J=this.createArgument($,Z);if(typeof X==="function")J.default(z).argParser(X);else J.default(X);return this.addArgument(J),this}arguments($){return $.trim().split(/ +/).forEach((Z)=>{this.argument(Z)}),this}addArgument($){let Z=this.registeredArguments.slice(-1)[0];if(Z?.variadic)throw Error(`only the last argument can be variadic '${Z.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,Z){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let X=$??"help [command]",[,z,J]=X.match(/([^ ]+) *(.*)/),Q=Z??"display help for command",Y=this.createCommand(z);if(Y.helpOption(!1),J)Y.arguments(J);if(Q)Y.description(Q);if(this._addImplicitHelpCommand=!0,this._helpCommand=Y,$||Z)this._initCommandGroup(Y);return this}addHelpCommand($,Z){if(typeof $!=="object")return this.helpCommand($,Z),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,Z){let X=["preSubcommand","preAction","postAction"];if(!X.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
+ Expecting one of '${X.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(Z);else this._lifeCycleHooks[$]=[Z];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(Z)=>{if(Z.code!=="commander.executeSubCommandAsync")throw Z};return this}_exit($,Z,X){if(this._exitCallback)this._exitCallback(new r4($,Z,X));a.exit($)}action($){let Z=(X)=>{let z=this.registeredArguments.length,J=X.slice(0,z);if(this._storeOptionsAsProperties)J[z]=this;else J[z]=this.opts();return J.push(this),$.apply(this,J)};return this._actionHandler=Z,this}createOption($,Z){return new f9($,Z)}_callParseArg($,Z,X,z){try{return $.parseArg(Z,X)}catch(J){if(J.code==="commander.invalidArgument"){let Q=`${z} ${J.message}`;this.error(Q,{exitCode:J.exitCode,code:J.code})}throw J}}_registerOption($){let Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let X=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${X}'
17
17
  - already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(z)=>{return[z.name()].concat(z.aliases())},X=Z($).find((z)=>this._findCommand(z));if(X){let z=Z(this._findCommand(X)).join("|"),J=Z($).join("|");throw Error(`cannot add command '${J}' as already have command '${z}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),X=$.attributeName();if($.negate){let J=$.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(X,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(X,$.defaultValue,"default");let z=(J,Q,Y)=>{if(J==null&&$.presetArg!==void 0)J=$.presetArg;let W=this.getOptionValue(X);if(J!==null&&$.parseArg)J=this._callParseArg($,J,W,Q);else if(J!==null&&$.variadic)J=$._collectValue(J,W);if(J==null)if($.negate)J=!1;else if($.isBoolean()||$.optional)J=!0;else J="";this.setOptionValueWithSource(X,J,Y)};if(this.on("option:"+Z,(J)=>{let Q=`error: option '${$.flags}' argument '${J}' is invalid.`;z(J,Q,"cli")}),$.envVar)this.on("optionEnv:"+Z,(J)=>{let Q=`error: option '${$.flags}' value '${J}' from env '${$.envVar}' is invalid.`;z(J,Q,"env")});return this}_optionEx($,Z,X,z,J){if(typeof Z==="object"&&Z instanceof f9)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let Q=this.createOption(Z,X);if(Q.makeOptionMandatory(!!$.mandatory),typeof z==="function")Q.default(J).argParser(z);else if(z instanceof RegExp){let Y=z;z=(W,U)=>{let q=Y.exec(W);return q?q[0]:U},Q.default(J).argParser(z)}else Q.default(z);return this.addOption(Q)}option($,Z,X,z){return this._optionEx({},$,Z,X,z)}requiredOption($,Z,X,z){return this._optionEx({mandatory:!0},$,Z,X,z)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,Z){return this.setOptionValueWithSource($,Z,void 0)}setOptionValueWithSource($,Z,X){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=X,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((X)=>{if(X.getOptionValueSource($)!==void 0)Z=X.getOptionValueSource($)}),Z}_prepareUserArgs($,Z){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(Z=Z||{},$===void 0&&Z.from===void 0){if(a.versions?.electron)Z.from="electron";let z=a.execArgv??[];if(z.includes("-e")||z.includes("--eval")||z.includes("-p")||z.includes("--print"))Z.from="eval"}if($===void 0)$=a.argv;this.rawArgs=$.slice();let X;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],X=$.slice(2);break;case"electron":if(a.defaultApp)this._scriptPath=$[1],X=$.slice(2);else X=$.slice(1);break;case"user":X=$.slice(0);break;case"eval":X=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${Z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",X}parse($,Z){this._prepareForParse();let X=this._prepareUserArgs($,Z);return this._parseCommand([],X),this}async parseAsync($,Z){this._prepareForParse();let X=this._prepareUserArgs($,Z);return await this._parseCommand([],X),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
18
  - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,Z,X){if(h6.existsSync($))return;let z=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",J=`'${$}' does not exist
19
19
  - if '${X}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${z}`;throw Error(J)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function J(q,G){let V=Z1.resolve(q,G);if(h6.existsSync(V))return V;if(z.includes(Z1.extname(G)))return;let K=z.find((H)=>h6.existsSync(`${V}${H}`));if(K)return`${V}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let q;try{q=h6.realpathSync(this._scriptPath)}catch{q=this._scriptPath}Y=Z1.resolve(Z1.dirname(q),Y)}if(Y){let q=J(Y,Q);if(!q&&!$._executableFile&&this._scriptPath){let G=Z1.basename(this._scriptPath,Z1.extname(this._scriptPath));if(G!==this._name)q=J(Y,`${G}-${$._name}`)}Q=q||Q}X=z.includes(Z1.extname(Q));let W;if(a.platform!=="win32")if(X)Z.unshift(Q),Z=u9(a.execArgv).concat(Z),W=a4.spawn(a.argv[0],Z,{stdio:"inherit"});else W=a4.spawn(Q,Z,{stdio:"inherit"});else this._checkForMissingExecutable(Q,Y,$._name),Z.unshift(Q),Z=u9(a.execArgv).concat(Z),W=a4.spawn(a.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((G)=>{a.on(G,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(G)})});let U=this._exitCallback;W.on("close",(q)=>{if(q=q??1,!U)a.exit(q);else U(new o4(q,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(q)=>{if(q.code==="ENOENT")this._checkForMissingExecutable(Q,Y,$._name);else if(q.code==="EACCES")throw Error(`'${Q}' not executable`);if(!U)a.exit(1);else{let G=new o4(1,"commander.executeSubCommandAsync","(error)");G.nestedError=q,U(G)}}),this.runningCommand=W}_dispatchSubcommand($,Z,X){let z=this._findCommand($);if(!z)this.help({error:!0});z._prepareForParse();let J;return J=this._chainOrCallSubCommandHook(J,z,"preSubcommand"),J=this._chainOrCall(J,()=>{if(z._executableHandler)this._executeSubCommand(z,Z.concat(X));else return z._parseCommand(Z,X)}),J}_dispatchHelpCommand($){if(!$)this.help();let Z=this._findCommand($);if(Z&&!Z._executableHandler)Z.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,Z)=>{if($.required&&this.args[Z]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(X,z,J)=>{let Q=z;if(z!==null&&X.parseArg){let Y=`error: command-argument value '${z}' is invalid for argument '${X.name()}'.`;Q=this._callParseArg(X,z,J,Y)}return Q};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((X,z)=>{let J=X.defaultValue;if(X.variadic){if(z<this.args.length){if(J=this.args.slice(z),X.parseArg)J=J.reduce((Q,Y)=>{return $(X,Y,Q)},X.defaultValue)}else if(J===void 0)J=[]}else if(z<this.args.length){if(J=this.args[z],X.parseArg)J=$(X,J,X.defaultValue)}Z[z]=J}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let X=$,z=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[Z]!==void 0).forEach((J)=>{J._lifeCycleHooks[Z].forEach((Q)=>{z.push({hookedCommand:J,callback:Q})})}),Z==="postAction")z.reverse();return z.forEach((J)=>{X=this._chainOrCall(X,()=>{return J.callback(J.hookedCommand,this)})}),X}_chainOrCallSubCommandHook($,Z,X){let z=$;if(this._lifeCycleHooks[X]!==void 0)this._lifeCycleHooks[X].forEach((J)=>{z=this._chainOrCall(z,()=>{return J(this,Z)})});return z}_parseCommand($,Z){let X=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(X.operands),Z=X.unknown,this.args=$.concat(Z),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),Z);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(Z),this._dispatchSubcommand(this._defaultCommandName,$,Z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(X.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=()=>{if(X.unknown.length>0)this.unknownOption(X.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){z(),this._processArguments();let Q;if(Q=this._chainOrCallHooks(Q,"preAction"),Q=this._chainOrCall(Q,()=>this._actionHandler(this.processedArgs)),this.parent)Q=this._chainOrCall(Q,()=>{this.parent.emit(J,$,Z)});return Q=this._chainOrCallHooks(Q,"postAction"),Q}if(this.parent?.listenerCount(J))z(),this._processArguments(),this.parent.emit(J,$,Z);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,Z);if(this.listenerCount("command:*"))this.emit("command:*",$,Z);else if(this.commands.length)this.unknownCommand();else z(),this._processArguments()}else if(this.commands.length)z(),this.help({error:!0});else z(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((Z)=>Z._name===$||Z._aliases.includes($))}_findOption($){return this.options.find((Z)=>Z.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((Z)=>{if(Z.mandatory&&$.getOptionValue(Z.attributeName())===void 0)$.missingMandatoryOptionValue(Z)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((X)=>{let z=X.attributeName();if(this.getOptionValue(z)===void 0)return!1;return this.getOptionValueSource(z)!=="default"});$.filter((X)=>X.conflictsWith.length>0).forEach((X)=>{let z=$.find((J)=>X.conflictsWith.includes(J.attributeName()));if(z)this._conflictingOption(X,z)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],X=[],z=Z;function J(q){return q.length>1&&q[0]==="-"}let Q=(q)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(q))return!1;return!this._getCommandAndAncestors().some((G)=>G.options.map((V)=>V.short).some((V)=>/^-\d$/.test(V)))},Y=null,W=null,U=0;while(U<$.length||W){let q=W??$[U++];if(W=null,q==="--"){if(z===X)z.push(q);z.push(...$.slice(U));break}if(Y&&(!J(q)||Q(q))){this.emit(`option:${Y.name()}`,q);continue}if(Y=null,J(q)){let G=this._findOption(q);if(G){if(G.required){let V=$[U++];if(V===void 0)this.optionMissingArgument(G);this.emit(`option:${G.name()}`,V)}else if(G.optional){let V=null;if(U<$.length&&(!J($[U])||Q($[U])))V=$[U++];this.emit(`option:${G.name()}`,V)}else this.emit(`option:${G.name()}`);Y=G.variadic?G:null;continue}}if(q.length>2&&q[0]==="-"&&q[1]!=="-"){let G=this._findOption(`-${q[1]}`);if(G){if(G.required||G.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${G.name()}`,q.slice(2));else this.emit(`option:${G.name()}`),W=`-${q.slice(2)}`;continue}}if(/^--[^=]+=/.test(q)){let G=q.indexOf("="),V=this._findOption(q.slice(0,G));if(V&&(V.required||V.optional)){this.emit(`option:${V.name()}`,q.slice(G+1));continue}}if(z===Z&&J(q)&&!(this.commands.length===0&&Q(q)))z=X;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&X.length===0){if(this._findCommand(q)){Z.push(q),X.push(...$.slice(U));break}else if(this._getHelpCommand()&&q===this._getHelpCommand().name()){Z.push(q,...$.slice(U));break}else if(this._defaultCommandName){X.push(q,...$.slice(U));break}}if(this._passThroughOptions){z.push(q,...$.slice(U));break}z.push(q)}return{operands:Z,unknown:X}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let X=0;X<Z;X++){let z=this.options[X].attributeName();$[z]=z===this._versionOptionName?this._version:this[z]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
21
+ - ${z}`;throw Error(J)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function J(q,G){let V=$1.resolve(q,G);if(h6.existsSync(V))return V;if(z.includes($1.extname(G)))return;let K=z.find((H)=>h6.existsSync(`${V}${H}`));if(K)return`${V}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let q;try{q=h6.realpathSync(this._scriptPath)}catch{q=this._scriptPath}Y=$1.resolve($1.dirname(q),Y)}if(Y){let q=J(Y,Q);if(!q&&!$._executableFile&&this._scriptPath){let G=$1.basename(this._scriptPath,$1.extname(this._scriptPath));if(G!==this._name)q=J(Y,`${G}-${$._name}`)}Q=q||Q}X=z.includes($1.extname(Q));let W;if(a.platform!=="win32")if(X)Z.unshift(Q),Z=u9(a.execArgv).concat(Z),W=n4.spawn(a.argv[0],Z,{stdio:"inherit"});else W=n4.spawn(Q,Z,{stdio:"inherit"});else this._checkForMissingExecutable(Q,Y,$._name),Z.unshift(Q),Z=u9(a.execArgv).concat(Z),W=n4.spawn(a.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((G)=>{a.on(G,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(G)})});let U=this._exitCallback;W.on("close",(q)=>{if(q=q??1,!U)a.exit(q);else U(new r4(q,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(q)=>{if(q.code==="ENOENT")this._checkForMissingExecutable(Q,Y,$._name);else if(q.code==="EACCES")throw Error(`'${Q}' not executable`);if(!U)a.exit(1);else{let G=new r4(1,"commander.executeSubCommandAsync","(error)");G.nestedError=q,U(G)}}),this.runningCommand=W}_dispatchSubcommand($,Z,X){let z=this._findCommand($);if(!z)this.help({error:!0});z._prepareForParse();let J;return J=this._chainOrCallSubCommandHook(J,z,"preSubcommand"),J=this._chainOrCall(J,()=>{if(z._executableHandler)this._executeSubCommand(z,Z.concat(X));else return z._parseCommand(Z,X)}),J}_dispatchHelpCommand($){if(!$)this.help();let Z=this._findCommand($);if(Z&&!Z._executableHandler)Z.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,Z)=>{if($.required&&this.args[Z]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(X,z,J)=>{let Q=z;if(z!==null&&X.parseArg){let Y=`error: command-argument value '${z}' is invalid for argument '${X.name()}'.`;Q=this._callParseArg(X,z,J,Y)}return Q};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((X,z)=>{let J=X.defaultValue;if(X.variadic){if(z<this.args.length){if(J=this.args.slice(z),X.parseArg)J=J.reduce((Q,Y)=>{return $(X,Y,Q)},X.defaultValue)}else if(J===void 0)J=[]}else if(z<this.args.length){if(J=this.args[z],X.parseArg)J=$(X,J,X.defaultValue)}Z[z]=J}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let X=$,z=[];if(this._getCommandAndAncestors().reverse().filter((J)=>J._lifeCycleHooks[Z]!==void 0).forEach((J)=>{J._lifeCycleHooks[Z].forEach((Q)=>{z.push({hookedCommand:J,callback:Q})})}),Z==="postAction")z.reverse();return z.forEach((J)=>{X=this._chainOrCall(X,()=>{return J.callback(J.hookedCommand,this)})}),X}_chainOrCallSubCommandHook($,Z,X){let z=$;if(this._lifeCycleHooks[X]!==void 0)this._lifeCycleHooks[X].forEach((J)=>{z=this._chainOrCall(z,()=>{return J(this,Z)})});return z}_parseCommand($,Z){let X=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(X.operands),Z=X.unknown,this.args=$.concat(Z),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),Z);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(Z),this._dispatchSubcommand(this._defaultCommandName,$,Z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(X.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=()=>{if(X.unknown.length>0)this.unknownOption(X.unknown[0])},J=`command:${this.name()}`;if(this._actionHandler){z(),this._processArguments();let Q;if(Q=this._chainOrCallHooks(Q,"preAction"),Q=this._chainOrCall(Q,()=>this._actionHandler(this.processedArgs)),this.parent)Q=this._chainOrCall(Q,()=>{this.parent.emit(J,$,Z)});return Q=this._chainOrCallHooks(Q,"postAction"),Q}if(this.parent?.listenerCount(J))z(),this._processArguments(),this.parent.emit(J,$,Z);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,Z);if(this.listenerCount("command:*"))this.emit("command:*",$,Z);else if(this.commands.length)this.unknownCommand();else z(),this._processArguments()}else if(this.commands.length)z(),this.help({error:!0});else z(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((Z)=>Z._name===$||Z._aliases.includes($))}_findOption($){return this.options.find((Z)=>Z.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((Z)=>{if(Z.mandatory&&$.getOptionValue(Z.attributeName())===void 0)$.missingMandatoryOptionValue(Z)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((X)=>{let z=X.attributeName();if(this.getOptionValue(z)===void 0)return!1;return this.getOptionValueSource(z)!=="default"});$.filter((X)=>X.conflictsWith.length>0).forEach((X)=>{let z=$.find((J)=>X.conflictsWith.includes(J.attributeName()));if(z)this._conflictingOption(X,z)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],X=[],z=Z;function J(q){return q.length>1&&q[0]==="-"}let Q=(q)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(q))return!1;return!this._getCommandAndAncestors().some((G)=>G.options.map((V)=>V.short).some((V)=>/^-\d$/.test(V)))},Y=null,W=null,U=0;while(U<$.length||W){let q=W??$[U++];if(W=null,q==="--"){if(z===X)z.push(q);z.push(...$.slice(U));break}if(Y&&(!J(q)||Q(q))){this.emit(`option:${Y.name()}`,q);continue}if(Y=null,J(q)){let G=this._findOption(q);if(G){if(G.required){let V=$[U++];if(V===void 0)this.optionMissingArgument(G);this.emit(`option:${G.name()}`,V)}else if(G.optional){let V=null;if(U<$.length&&(!J($[U])||Q($[U])))V=$[U++];this.emit(`option:${G.name()}`,V)}else this.emit(`option:${G.name()}`);Y=G.variadic?G:null;continue}}if(q.length>2&&q[0]==="-"&&q[1]!=="-"){let G=this._findOption(`-${q[1]}`);if(G){if(G.required||G.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${G.name()}`,q.slice(2));else this.emit(`option:${G.name()}`),W=`-${q.slice(2)}`;continue}}if(/^--[^=]+=/.test(q)){let G=q.indexOf("="),V=this._findOption(q.slice(0,G));if(V&&(V.required||V.optional)){this.emit(`option:${V.name()}`,q.slice(G+1));continue}}if(z===Z&&J(q)&&!(this.commands.length===0&&Q(q)))z=X;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&X.length===0){if(this._findCommand(q)){Z.push(q),X.push(...$.slice(U));break}else if(this._getHelpCommand()&&q===this._getHelpCommand().name()){Z.push(q,...$.slice(U));break}else if(this._defaultCommandName){X.push(q,...$.slice(U));break}}if(this._passThroughOptions){z.push(q,...$.slice(U));break}z.push(q)}return{operands:Z,unknown:X}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let X=0;X<Z;X++){let z=this.options[X].attributeName();$[z]=z===this._versionOptionName?this._version:this[z]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0});let X=Z||{},z=X.exitCode||1,J=X.code||"commander.error";this._exit(z,J,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in a.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,a.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new rW(this.options),Z=(X)=>{return this.getOptionValue(X)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(X))};this.options.filter((X)=>X.implied!==void 0&&Z(X.attributeName())&&$.valueFromOption(this.getOptionValue(X.attributeName()),X)).forEach((X)=>{Object.keys(X.implied).filter((z)=>!Z(z)).forEach((z)=>{this.setOptionValueWithSource(z,X.implied[z],"implied")})})}missingArgument($){let Z=`error: missing required argument '${$}'`;this.error(Z,{code:"commander.missingArgument"})}optionMissingArgument($){let Z=`error: option '${$.flags}' argument missing`;this.error(Z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let Z=`error: required option '${$.flags}' not specified`;this.error(Z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,Z){let X=(Q)=>{let Y=Q.attributeName(),W=this.getOptionValue(Y),U=this.options.find((G)=>G.negate&&Y===G.attributeName()),q=this.options.find((G)=>!G.negate&&Y===G.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return q||Q},z=(Q)=>{let Y=X(Q),W=Y.attributeName();if(this.getOptionValueSource(W)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},J=`error: ${z($)} cannot be used with ${z(Z)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let z=[],J=this;do{let Q=J.createHelp().visibleOptions(J).filter((Y)=>Y.long).map((Y)=>Y.long);z=z.concat(Q),J=J.parent}while(J&&!J._enablePositionalOptions);Z=h9($,z)}let X=`error: unknown option '${$}'${Z}`;this.error(X,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let Z=this.registeredArguments.length,X=Z===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${X} but got ${$.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let z=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(z.push(J.name()),J.alias())z.push(J.alias())}),Z=h9($,z)}let X=`error: unknown command '${$}'${Z}`;this.error(X,{code:"commander.unknownCommand"})}version($,Z,X){if($===void 0)return this._version;this._version=$,Z=Z||"-V, --version",X=X||"output the version number";let z=this.createOption(Z,X);return this._versionOptionName=z.attributeName(),this._registerOption(z),this.on("option:"+z.name(),()=>{this._outputConfiguration.writeOut(`${$}
25
- `),this._exit(0,"commander.version",$)}),this}description($,Z){if($===void 0&&Z===void 0)return this._description;if(this._description=$,Z)this._argsDescription=Z;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let Z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Z=this.commands[this.commands.length-1];if($===Z._name)throw Error("Command alias can't be the same as its name");let X=this.parent?._findCommand($);if(X){let z=[X.name()].concat(X.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${z}'`)}return Z._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((Z)=>this.alias(Z)),this}usage($){if($===void 0){if(this._usage)return this._usage;let Z=this.registeredArguments.map((X)=>{return pW(X)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=Z1.basename($,Z1.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),X=this._getOutputContext($);Z.prepareContext({error:X.error,helpWidth:X.helpWidth,outputHasColors:X.hasColors});let z=Z.formatHelp(this,Z);if(X.hasColors)return z;return this._outputConfiguration.stripColor(z)}_getOutputContext($){$=$||{};let Z=!!$.error,X,z,J;if(Z)X=(Y)=>this._outputConfiguration.writeErr(Y),z=this._outputConfiguration.getErrHasColors(),J=this._outputConfiguration.getErrHelpWidth();else X=(Y)=>this._outputConfiguration.writeOut(Y),z=this._outputConfiguration.getOutHasColors(),J=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!z)Y=this._outputConfiguration.stripColor(Y);return X(Y)},hasColors:z,helpWidth:J}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let X=this._getOutputContext($),z={error:X.error,write:X.write,command:this};this._getCommandAndAncestors().reverse().forEach((Q)=>Q.emit("beforeAllHelp",z)),this.emit("beforeHelp",z);let J=this.helpInformation({error:X.error});if(Z){if(J=Z(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if(X.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",z),this._getCommandAndAncestors().forEach((Q)=>Q.emit("afterAllHelp",z))}helpOption($,Z){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",Z??"display help for command"),$||Z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let Z=Number(a.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let X=["beforeAll","before","after","afterAll"];if(!X.includes($))throw Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0});let X=Z||{},z=X.exitCode||1,J=X.code||"commander.error";this._exit(z,J,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in a.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,a.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new zU(this.options),Z=(X)=>{return this.getOptionValue(X)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(X))};this.options.filter((X)=>X.implied!==void 0&&Z(X.attributeName())&&$.valueFromOption(this.getOptionValue(X.attributeName()),X)).forEach((X)=>{Object.keys(X.implied).filter((z)=>!Z(z)).forEach((z)=>{this.setOptionValueWithSource(z,X.implied[z],"implied")})})}missingArgument($){let Z=`error: missing required argument '${$}'`;this.error(Z,{code:"commander.missingArgument"})}optionMissingArgument($){let Z=`error: option '${$.flags}' argument missing`;this.error(Z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let Z=`error: required option '${$.flags}' not specified`;this.error(Z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,Z){let X=(Q)=>{let Y=Q.attributeName(),W=this.getOptionValue(Y),U=this.options.find((G)=>G.negate&&Y===G.attributeName()),q=this.options.find((G)=>!G.negate&&Y===G.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return q||Q},z=(Q)=>{let Y=X(Q),W=Y.attributeName();if(this.getOptionValueSource(W)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},J=`error: ${z($)} cannot be used with ${z(Z)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let z=[],J=this;do{let Q=J.createHelp().visibleOptions(J).filter((Y)=>Y.long).map((Y)=>Y.long);z=z.concat(Q),J=J.parent}while(J&&!J._enablePositionalOptions);Z=h9($,z)}let X=`error: unknown option '${$}'${Z}`;this.error(X,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let Z=this.registeredArguments.length,X=Z===1?"":"s",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${X} but got ${$.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let z=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(z.push(J.name()),J.alias())z.push(J.alias())}),Z=h9($,z)}let X=`error: unknown command '${$}'${Z}`;this.error(X,{code:"commander.unknownCommand"})}version($,Z,X){if($===void 0)return this._version;this._version=$,Z=Z||"-V, --version",X=X||"output the version number";let z=this.createOption(Z,X);return this._versionOptionName=z.attributeName(),this._registerOption(z),this.on("option:"+z.name(),()=>{this._outputConfiguration.writeOut(`${$}
25
+ `),this._exit(0,"commander.version",$)}),this}description($,Z){if($===void 0&&Z===void 0)return this._description;if(this._description=$,Z)this._argsDescription=Z;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let Z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Z=this.commands[this.commands.length-1];if($===Z._name)throw Error("Command alias can't be the same as its name");let X=this.parent?._findCommand($);if(X){let z=[X.name()].concat(X.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${z}'`)}return Z._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((Z)=>this.alias(Z)),this}usage($){if($===void 0){if(this._usage)return this._usage;let Z=this.registeredArguments.map((X)=>{return $U(X)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=$1.basename($,$1.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),X=this._getOutputContext($);Z.prepareContext({error:X.error,helpWidth:X.helpWidth,outputHasColors:X.hasColors});let z=Z.formatHelp(this,Z);if(X.hasColors)return z;return this._outputConfiguration.stripColor(z)}_getOutputContext($){$=$||{};let Z=!!$.error,X,z,J;if(Z)X=(Y)=>this._outputConfiguration.writeErr(Y),z=this._outputConfiguration.getErrHasColors(),J=this._outputConfiguration.getErrHelpWidth();else X=(Y)=>this._outputConfiguration.writeOut(Y),z=this._outputConfiguration.getOutHasColors(),J=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!z)Y=this._outputConfiguration.stripColor(Y);return X(Y)},hasColors:z,helpWidth:J}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let X=this._getOutputContext($),z={error:X.error,write:X.write,command:this};this._getCommandAndAncestors().reverse().forEach((Q)=>Q.emit("beforeAllHelp",z)),this.emit("beforeHelp",z);let J=this.helpInformation({error:X.error});if(Z){if(J=Z(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if(X.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",z),this._getCommandAndAncestors().forEach((Q)=>Q.emit("afterAllHelp",z))}helpOption($,Z){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",Z??"display help for command"),$||Z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let Z=Number(a.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let X=["beforeAll","before","after","afterAll"];if(!X.includes($))throw Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${X.join("', '")}'`);let z=`${$}Help`;return this.on(z,(J)=>{let Q;if(typeof Z==="function")Q=Z({error:J.error,command:J.command});else Q=Z;if(Q)J.write(`${Q}
27
- `)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((z)=>Z.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function u9($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let X,z="127.0.0.1",J="9229",Q;if((Q=Z.match(/^(--inspect(-brk)?)$/))!==null)X=Q[1];else if((Q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(X=Q[1],/^\d+$/.test(Q[3]))J=Q[3];else z=Q[3];else if((Q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)X=Q[1],z=Q[3],J=Q[4];if(X&&J!=="0")return`${X}=${z}:${parseInt(J)+1}`;return Z})}function t4(){if(a.env.NO_COLOR||a.env.FORCE_COLOR==="0"||a.env.FORCE_COLOR==="false")return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0;return}sW.Command=e4;sW.useColor=t4});var p9=P(($U)=>{var{Argument:c9}=f6(),{Command:$3}=m9(),{CommanderError:tW,InvalidArgumentError:l9}=t$(),{Help:eW}=r4(),{Option:d9}=s4();$U.program=new $3;$U.createCommand=($)=>new $3($);$U.createOption=($,Z)=>new d9($,Z);$U.createArgument=($,Z)=>new c9($,Z);$U.Command=$3;$U.Option=d9;$U.Argument=c9;$U.Help=eW;$U.CommanderError=tW;$U.InvalidArgumentError=l9;$U.InvalidOptionArgumentError=l9});var i=P((DU)=>{var Z3=Symbol.for("yaml.alias"),r9=Symbol.for("yaml.document"),u6=Symbol.for("yaml.map"),s9=Symbol.for("yaml.pair"),X3=Symbol.for("yaml.scalar"),m6=Symbol.for("yaml.seq"),X1=Symbol.for("yaml.node.type"),KU=($)=>!!$&&typeof $==="object"&&$[X1]===Z3,HU=($)=>!!$&&typeof $==="object"&&$[X1]===r9,BU=($)=>!!$&&typeof $==="object"&&$[X1]===u6,MU=($)=>!!$&&typeof $==="object"&&$[X1]===s9,a9=($)=>!!$&&typeof $==="object"&&$[X1]===X3,OU=($)=>!!$&&typeof $==="object"&&$[X1]===m6;function o9($){if($&&typeof $==="object")switch($[X1]){case u6:case m6:return!0}return!1}function NU($){if($&&typeof $==="object")switch($[X1]){case Z3:case u6:case X3:case m6:return!0}return!1}var LU=($)=>(a9($)||o9($))&&!!$.anchor;DU.ALIAS=Z3;DU.DOC=r9;DU.MAP=u6;DU.NODE_TYPE=X1;DU.PAIR=s9;DU.SCALAR=X3;DU.SEQ=m6;DU.hasAnchor=LU;DU.isAlias=KU;DU.isCollection=o9;DU.isDocument=HU;DU.isMap=BU;DU.isNode=NU;DU.isPair=MU;DU.isScalar=a9;DU.isSeq=OU});var e$=P((vU)=>{var q0=i(),R0=Symbol("break visit"),t9=Symbol("skip children"),s0=Symbol("remove node");function c6($,Z){let X=e9(Z);if(q0.isDocument($)){if(z$(null,$.contents,X,Object.freeze([$]))===s0)$.contents=null}else z$(null,$,X,Object.freeze([]))}c6.BREAK=R0;c6.SKIP=t9;c6.REMOVE=s0;function z$($,Z,X,z){let J=$7($,Z,X,z);if(q0.isNode(J)||q0.isPair(J))return Z7($,z,J),z$($,J,X,z);if(typeof J!=="symbol"){if(q0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=z$(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===R0)return R0;else if(Y===s0)Z.items.splice(Q,1),Q-=1}}else if(q0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=z$("key",Z.key,X,z);if(Q===R0)return R0;else if(Q===s0)Z.key=null;let Y=z$("value",Z.value,X,z);if(Y===R0)return R0;else if(Y===s0)Z.value=null}}return J}async function l6($,Z){let X=e9(Z);if(q0.isDocument($)){if(await J$(null,$.contents,X,Object.freeze([$]))===s0)$.contents=null}else await J$(null,$,X,Object.freeze([]))}l6.BREAK=R0;l6.SKIP=t9;l6.REMOVE=s0;async function J$($,Z,X,z){let J=await $7($,Z,X,z);if(q0.isNode(J)||q0.isPair(J))return Z7($,z,J),J$($,J,X,z);if(typeof J!=="symbol"){if(q0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=await J$(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===R0)return R0;else if(Y===s0)Z.items.splice(Q,1),Q-=1}}else if(q0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=await J$("key",Z.key,X,z);if(Q===R0)return R0;else if(Q===s0)Z.key=null;let Y=await J$("value",Z.value,X,z);if(Y===R0)return R0;else if(Y===s0)Z.value=null}}return J}function e9($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function $7($,Z,X,z){if(typeof X==="function")return X($,Z,z);if(q0.isMap(Z))return X.Map?.($,Z,z);if(q0.isSeq(Z))return X.Seq?.($,Z,z);if(q0.isPair(Z))return X.Pair?.($,Z,z);if(q0.isScalar(Z))return X.Scalar?.($,Z,z);if(q0.isAlias(Z))return X.Alias?.($,Z,z);return}function Z7($,Z,X){let z=Z[Z.length-1];if(q0.isCollection(z))z.items[$]=X;else if(q0.isPair(z))if($==="key")z.key=X;else z.value=X;else if(q0.isDocument(z))z.contents=X;else{let J=q0.isAlias(z)?"alias":"scalar";throw Error(`Cannot replace node with ${J} parent`)}}vU.visit=c6;vU.visitAsync=l6});var z3=P((cU)=>{var X7=i(),hU=e$(),uU={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},mU=($)=>$.replace(/[!,[\]{}]/g,(Z)=>uU[Z]);class k0{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},k0.defaultYaml,$),this.tags=Object.assign({},k0.defaultTags,Z)}clone(){let $=new k0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new k0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:k0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},k0.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:k0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},k0.defaultTags),this.atNextDocument=!1;let X=$.trim().split(/[ \t]+/),z=X.shift();switch(z){case"%TAG":{if(X.length!==2){if(Z(0,"%TAG directive should contain exactly two parts"),X.length<2)return!1}let[J,Q]=X;return this.tags[J]=Q,!0}case"%YAML":{if(this.yaml.explicit=!0,X.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[J]=X;if(J==="1.1"||J==="1.2")return this.yaml.version=J,!0;else{let Q=/^\d+\.\d+$/.test(J);return Z(6,`Unsupported YAML version ${J}`,Q),!1}}default:return Z(0,`Unknown directive ${z}`,!0),!1}}tagName($,Z){if($==="!")return"!";if($[0]!=="!")return Z(`Not a valid tag: ${$}`),null;if($[1]==="<"){let Q=$.slice(2,-1);if(Q==="!"||Q==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return Q}let[,X,z]=$.match(/^(.*!)([^!]*)$/s);if(!z)Z(`The ${$} tag has no suffix`);let J=this.tags[X];if(J)try{return J+decodeURIComponent(z)}catch(Q){return Z(String(Q)),null}if(X==="!")return $;return Z(`Could not resolve tag: ${$}`),null}tagString($){for(let[Z,X]of Object.entries(this.tags))if($.startsWith(X))return Z+mU($.substring(X.length));return $[0]==="!"?$:`!<${$}>`}toString($){let Z=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],X=Object.entries(this.tags),z;if($&&X.length>0&&X7.isNode($.contents)){let J={};hU.visit($.contents,(Q,Y)=>{if(X7.isNode(Y)&&Y.tag)J[Y.tag]=!0}),z=Object.keys(J)}else z=[];for(let[J,Q]of X){if(J==="!!"&&Q==="tag:yaml.org,2002:")continue;if(!$||z.some((Y)=>Y.startsWith(Q)))Z.push(`%TAG ${J} ${Q}`)}return Z.join(`
28
- `)}}k0.defaultYaml={explicit:!1,version:"1.2"};k0.defaultTags={"!!":"tag:yaml.org,2002:"};cU.Directives=k0});var d6=P((nU)=>{var z7=i(),dU=e$();function pU($){if(/[\x00-\x19\s,[\]{}]/.test($)){let X=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(X)}return!0}function J7($){let Z=new Set;return dU.visit($,{Value(X,z){if(z.anchor)Z.add(z.anchor)}}),Z}function Q7($,Z){for(let X=1;;++X){let z=`${$}${X}`;if(!Z.has(z))return z}}function iU($,Z){let X=[],z=new Map,J=null;return{onAnchor:(Q)=>{X.push(Q),J??(J=J7($));let Y=Q7(Z,J);return J.add(Y),Y},setAnchors:()=>{for(let Q of X){let Y=z.get(Q);if(typeof Y==="object"&&Y.anchor&&(z7.isScalar(Y.node)||z7.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let W=Error("Failed to resolve repeated object (this should not happen)");throw W.source=Q,W}}},sourceObjects:z}}nU.anchorIsValid=pU;nU.anchorNames=J7;nU.createNodeAnchors=iU;nU.findNewAnchor=Q7});var J3=P((tU)=>{function $2($,Z,X,z){if(z&&typeof z==="object")if(Array.isArray(z))for(let J=0,Q=z.length;J<Q;++J){let Y=z[J],W=$2($,z,String(J),Y);if(W===void 0)delete z[J];else if(W!==Y)z[J]=W}else if(z instanceof Map)for(let J of Array.from(z.keys())){let Q=z.get(J),Y=$2($,z,J,Q);if(Y===void 0)z.delete(J);else if(Y!==Q)z.set(J,Y)}else if(z instanceof Set)for(let J of Array.from(z)){let Q=$2($,z,J,J);if(Q===void 0)z.delete(J);else if(Q!==J)z.delete(J),z.add(Q)}else for(let[J,Q]of Object.entries(z)){let Y=$2($,z,J,Q);if(Y===void 0)delete z[J];else if(Y!==Q)z[J]=Y}return $.call(Z,X,z)}tU.applyReviver=$2});var H1=P((Zq)=>{var $q=i();function Y7($,Z,X){if(Array.isArray($))return $.map((z,J)=>Y7(z,String(J),X));if($&&typeof $.toJSON==="function"){if(!X||!$q.hasAnchor($))return $.toJSON(Z,X);let z={aliasCount:0,count:1,res:void 0};X.anchors.set($,z),X.onCreate=(Q)=>{z.res=Q,delete X.onCreate};let J=$.toJSON(Z,X);if(X.onCreate)X.onCreate(J);return J}if(typeof $==="bigint"&&!X?.keep)return Number($);return $}Zq.toJS=Y7});var p6=P((Qq)=>{var zq=J3(),W7=i(),Jq=H1();class U7{constructor($){Object.defineProperty(this,W7.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:Z,maxAliasCount:X,onAnchor:z,reviver:J}={}){if(!W7.isDocument($))throw TypeError("A document argument is required");let Q={anchors:new Map,doc:$,keep:!0,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof X==="number"?X:100},Y=Jq.toJS(this,"",Q);if(typeof z==="function")for(let{count:W,res:U}of Q.anchors.values())z(U,W);return typeof J==="function"?zq.applyReviver(J,{"":Y},"",Y):Y}}Qq.NodeBase=U7});var Z2=P((Vq)=>{var Wq=d6(),Uq=e$(),Q$=i(),qq=p6(),Gq=H1();class q7 extends qq.NodeBase{constructor($){super(Q$.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,Z){if(Z?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let X;if(Z?.aliasResolveCache)X=Z.aliasResolveCache;else if(X=[],Uq.visit($,{Node:(J,Q)=>{if(Q$.isAlias(Q)||Q$.hasAnchor(Q))X.push(Q)}}),Z)Z.aliasResolveCache=X;let z=void 0;for(let J of X){if(J===this)break;if(J.anchor===this.source)z=J}return z}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:X,doc:z,maxAliasCount:J}=Z,Q=this.resolve(z,Z);if(!Q){let W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=X.get(Q);if(!Y)Gq.toJS(Q,null,Z),Y=X.get(Q);if(Y?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(J>=0){if(Y.count+=1,Y.aliasCount===0)Y.aliasCount=i6(z,Q,X);if(Y.count*Y.aliasCount>J)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return Y.res}toString($,Z,X){let z=`*${this.source}`;if($){if(Wq.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let J=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(J)}if($.implicitKey)return`${z} `}return z}}function i6($,Z,X){if(Q$.isAlias(Z)){let z=Z.resolve($),J=X&&z&&X.get(z);return J?J.count*J.aliasCount:0}else if(Q$.isCollection(Z)){let z=0;for(let J of Z.items){let Q=i6($,J,X);if(Q>z)z=Q}return z}else if(Q$.isPair(Z)){let z=i6($,Z.key,X),J=i6($,Z.value,X);return Math.max(z,J)}return 1}Vq.Alias=q7});var J0=P((Nq)=>{var Hq=i(),Bq=p6(),Mq=H1(),Oq=($)=>!$||typeof $!=="function"&&typeof $!=="object";class y1 extends Bq.NodeBase{constructor($){super(Hq.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:Mq.toJS(this.value,$,Z)}toString(){return String(this.value)}}y1.BLOCK_FOLDED="BLOCK_FOLDED";y1.BLOCK_LITERAL="BLOCK_LITERAL";y1.PLAIN="PLAIN";y1.QUOTE_DOUBLE="QUOTE_DOUBLE";y1.QUOTE_SINGLE="QUOTE_SINGLE";Nq.Scalar=y1;Nq.isScalarValue=Oq});var X2=P((_q)=>{var Iq=Z2(),v1=i(),G7=J0(),Tq="tag:yaml.org,2002:";function Aq($,Z,X){if(Z){let z=X.filter((Q)=>Q.tag===Z),J=z.find((Q)=>!Q.format)??z[0];if(!J)throw Error(`Tag ${Z} not found`);return J}return X.find((z)=>z.identify?.($)&&!z.format)}function Rq($,Z,X){if(v1.isDocument($))$=$.contents;if(v1.isNode($))return $;if(v1.isPair($)){let V=X.schema[v1.MAP].createNode?.(X.schema,null,X);return V.items.push($),V}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:z,onAnchor:J,onTagObj:Q,schema:Y,sourceObjects:W}=X,U=void 0;if(z&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=J($)),new Iq.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=Tq+Z.slice(2);let q=Aq($,Z,Y.tags);if(!q){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let V=new G7.Scalar($);if(U)U.node=V;return V}q=$ instanceof Map?Y[v1.MAP]:(Symbol.iterator in Object($))?Y[v1.SEQ]:Y[v1.MAP]}if(Q)Q(q),delete X.onTagObj;let G=q?.createNode?q.createNode(X.schema,$,X):typeof q?.nodeClass?.from==="function"?q.nodeClass.from(X.schema,$,X):new G7.Scalar($);if(Z)G.tag=Z;else if(!q.default)G.tag=q.tag;if(U)U.node=G;return G}_q.createNode=Rq});var n6=P((Pq)=>{var Cq=X2(),a0=i(),Eq=p6();function Q3($,Z,X){let z=X;for(let J=Z.length-1;J>=0;--J){let Q=Z[J];if(typeof Q==="number"&&Number.isInteger(Q)&&Q>=0){let Y=[];Y[Q]=z,z=Y}else z=new Map([[Q,z]])}return Cq.createNode(z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var V7=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class K7 extends Eq.NodeBase{constructor($,Z){super($);Object.defineProperty(this,"schema",{value:Z,configurable:!0,enumerable:!1,writable:!0})}clone($){let Z=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)Z.schema=$;if(Z.items=Z.items.map((X)=>a0.isNode(X)||a0.isPair(X)?X.clone($):X),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(V7($))this.add(Z);else{let[X,...z]=$,J=this.get(X,!0);if(a0.isCollection(J))J.addIn(z,Z);else if(J===void 0&&this.schema)this.set(X,Q3(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}deleteIn($){let[Z,...X]=$;if(X.length===0)return this.delete(Z);let z=this.get(Z,!0);if(a0.isCollection(z))return z.deleteIn(X);else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}getIn($,Z){let[X,...z]=$,J=this.get(X,!0);if(z.length===0)return!Z&&a0.isScalar(J)?J.value:J;else return a0.isCollection(J)?J.getIn(z,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!a0.isPair(Z))return!1;let X=Z.value;return X==null||$&&a0.isScalar(X)&&X.value==null&&!X.commentBefore&&!X.comment&&!X.tag})}hasIn($){let[Z,...X]=$;if(X.length===0)return this.has(Z);let z=this.get(Z,!0);return a0.isCollection(z)?z.hasIn(X):!1}setIn($,Z){let[X,...z]=$;if(z.length===0)this.set(X,Z);else{let J=this.get(X,!0);if(a0.isCollection(J))J.setIn(z,Z);else if(J===void 0&&this.schema)this.set(X,Q3(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}}Pq.Collection=K7;Pq.collectionFromPath=Q3;Pq.isEmptyPath=V7});var z2=P((kq)=>{var xq=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function Y3($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var bq=($,Z,X)=>$.endsWith(`
29
- `)?Y3(X,Z):X.includes(`
27
+ `)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((z)=>Z.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function u9($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let X,z="127.0.0.1",J="9229",Q;if((Q=Z.match(/^(--inspect(-brk)?)$/))!==null)X=Q[1];else if((Q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(X=Q[1],/^\d+$/.test(Q[3]))J=Q[3];else z=Q[3];else if((Q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)X=Q[1],z=Q[3],J=Q[4];if(X&&J!=="0")return`${X}=${z}:${parseInt(J)+1}`;return Z})}function s4(){if(a.env.NO_COLOR||a.env.FORCE_COLOR==="0"||a.env.FORCE_COLOR==="false")return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0;return}JU.Command=a4;JU.useColor=s4});var p9=E((qU)=>{var{Argument:c9}=f6(),{Command:o4}=m9(),{CommanderError:WU,InvalidArgumentError:l9}=t$(),{Help:UU}=p4(),{Option:d9}=i4();qU.program=new o4;qU.createCommand=($)=>new o4($);qU.createOption=($,Z)=>new d9($,Z);qU.createArgument=($,Z)=>new c9($,Z);qU.Command=o4;qU.Option=d9;qU.Argument=c9;qU.Help=UU;qU.CommanderError=WU;qU.InvalidArgumentError=l9;qU.InvalidOptionArgumentError=l9});var i=E((EU)=>{var t4=Symbol.for("yaml.alias"),r9=Symbol.for("yaml.document"),u6=Symbol.for("yaml.map"),s9=Symbol.for("yaml.pair"),e4=Symbol.for("yaml.scalar"),m6=Symbol.for("yaml.seq"),Z1=Symbol.for("yaml.node.type"),TU=($)=>!!$&&typeof $==="object"&&$[Z1]===t4,AU=($)=>!!$&&typeof $==="object"&&$[Z1]===r9,RU=($)=>!!$&&typeof $==="object"&&$[Z1]===u6,_U=($)=>!!$&&typeof $==="object"&&$[Z1]===s9,a9=($)=>!!$&&typeof $==="object"&&$[Z1]===e4,FU=($)=>!!$&&typeof $==="object"&&$[Z1]===m6;function o9($){if($&&typeof $==="object")switch($[Z1]){case u6:case m6:return!0}return!1}function CU($){if($&&typeof $==="object")switch($[Z1]){case t4:case u6:case e4:case m6:return!0}return!1}var PU=($)=>(a9($)||o9($))&&!!$.anchor;EU.ALIAS=t4;EU.DOC=r9;EU.MAP=u6;EU.NODE_TYPE=Z1;EU.PAIR=s9;EU.SCALAR=e4;EU.SEQ=m6;EU.hasAnchor=PU;EU.isAlias=TU;EU.isCollection=o9;EU.isDocument=AU;EU.isMap=RU;EU.isNode=CU;EU.isPair=_U;EU.isScalar=a9;EU.isSeq=FU});var e$=E((pU)=>{var q0=i(),R0=Symbol("break visit"),t9=Symbol("skip children"),s0=Symbol("remove node");function c6($,Z){let X=e9(Z);if(q0.isDocument($)){if(z$(null,$.contents,X,Object.freeze([$]))===s0)$.contents=null}else z$(null,$,X,Object.freeze([]))}c6.BREAK=R0;c6.SKIP=t9;c6.REMOVE=s0;function z$($,Z,X,z){let J=$7($,Z,X,z);if(q0.isNode(J)||q0.isPair(J))return Z7($,z,J),z$($,J,X,z);if(typeof J!=="symbol"){if(q0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=z$(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===R0)return R0;else if(Y===s0)Z.items.splice(Q,1),Q-=1}}else if(q0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=z$("key",Z.key,X,z);if(Q===R0)return R0;else if(Q===s0)Z.key=null;let Y=z$("value",Z.value,X,z);if(Y===R0)return R0;else if(Y===s0)Z.value=null}}return J}async function l6($,Z){let X=e9(Z);if(q0.isDocument($)){if(await J$(null,$.contents,X,Object.freeze([$]))===s0)$.contents=null}else await J$(null,$,X,Object.freeze([]))}l6.BREAK=R0;l6.SKIP=t9;l6.REMOVE=s0;async function J$($,Z,X,z){let J=await $7($,Z,X,z);if(q0.isNode(J)||q0.isPair(J))return Z7($,z,J),J$($,J,X,z);if(typeof J!=="symbol"){if(q0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let Q=0;Q<Z.items.length;++Q){let Y=await J$(Q,Z.items[Q],X,z);if(typeof Y==="number")Q=Y-1;else if(Y===R0)return R0;else if(Y===s0)Z.items.splice(Q,1),Q-=1}}else if(q0.isPair(Z)){z=Object.freeze(z.concat(Z));let Q=await J$("key",Z.key,X,z);if(Q===R0)return R0;else if(Q===s0)Z.key=null;let Y=await J$("value",Z.value,X,z);if(Y===R0)return R0;else if(Y===s0)Z.value=null}}return J}function e9($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function $7($,Z,X,z){if(typeof X==="function")return X($,Z,z);if(q0.isMap(Z))return X.Map?.($,Z,z);if(q0.isSeq(Z))return X.Seq?.($,Z,z);if(q0.isPair(Z))return X.Pair?.($,Z,z);if(q0.isScalar(Z))return X.Scalar?.($,Z,z);if(q0.isAlias(Z))return X.Alias?.($,Z,z);return}function Z7($,Z,X){let z=Z[Z.length-1];if(q0.isCollection(z))z.items[$]=X;else if(q0.isPair(z))if($==="key")z.key=X;else z.value=X;else if(q0.isDocument(z))z.contents=X;else{let J=q0.isAlias(z)?"alias":"scalar";throw Error(`Cannot replace node with ${J} parent`)}}pU.visit=c6;pU.visitAsync=l6});var $3=E((oU)=>{var X7=i(),rU=e$(),sU={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},aU=($)=>$.replace(/[!,[\]{}]/g,(Z)=>sU[Z]);class k0{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},k0.defaultYaml,$),this.tags=Object.assign({},k0.defaultTags,Z)}clone(){let $=new k0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new k0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:k0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},k0.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:k0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},k0.defaultTags),this.atNextDocument=!1;let X=$.trim().split(/[ \t]+/),z=X.shift();switch(z){case"%TAG":{if(X.length!==2){if(Z(0,"%TAG directive should contain exactly two parts"),X.length<2)return!1}let[J,Q]=X;return this.tags[J]=Q,!0}case"%YAML":{if(this.yaml.explicit=!0,X.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[J]=X;if(J==="1.1"||J==="1.2")return this.yaml.version=J,!0;else{let Q=/^\d+\.\d+$/.test(J);return Z(6,`Unsupported YAML version ${J}`,Q),!1}}default:return Z(0,`Unknown directive ${z}`,!0),!1}}tagName($,Z){if($==="!")return"!";if($[0]!=="!")return Z(`Not a valid tag: ${$}`),null;if($[1]==="<"){let Q=$.slice(2,-1);if(Q==="!"||Q==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return Q}let[,X,z]=$.match(/^(.*!)([^!]*)$/s);if(!z)Z(`The ${$} tag has no suffix`);let J=this.tags[X];if(J)try{return J+decodeURIComponent(z)}catch(Q){return Z(String(Q)),null}if(X==="!")return $;return Z(`Could not resolve tag: ${$}`),null}tagString($){for(let[Z,X]of Object.entries(this.tags))if($.startsWith(X))return Z+aU($.substring(X.length));return $[0]==="!"?$:`!<${$}>`}toString($){let Z=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],X=Object.entries(this.tags),z;if($&&X.length>0&&X7.isNode($.contents)){let J={};rU.visit($.contents,(Q,Y)=>{if(X7.isNode(Y)&&Y.tag)J[Y.tag]=!0}),z=Object.keys(J)}else z=[];for(let[J,Q]of X){if(J==="!!"&&Q==="tag:yaml.org,2002:")continue;if(!$||z.some((Y)=>Y.startsWith(Q)))Z.push(`%TAG ${J} ${Q}`)}return Z.join(`
28
+ `)}}k0.defaultYaml={explicit:!1,version:"1.2"};k0.defaultTags={"!!":"tag:yaml.org,2002:"};oU.Directives=k0});var d6=E((Xq)=>{var z7=i(),eU=e$();function $q($){if(/[\x00-\x19\s,[\]{}]/.test($)){let X=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(X)}return!0}function J7($){let Z=new Set;return eU.visit($,{Value(X,z){if(z.anchor)Z.add(z.anchor)}}),Z}function Q7($,Z){for(let X=1;;++X){let z=`${$}${X}`;if(!Z.has(z))return z}}function Zq($,Z){let X=[],z=new Map,J=null;return{onAnchor:(Q)=>{X.push(Q),J??(J=J7($));let Y=Q7(Z,J);return J.add(Y),Y},setAnchors:()=>{for(let Q of X){let Y=z.get(Q);if(typeof Y==="object"&&Y.anchor&&(z7.isScalar(Y.node)||z7.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let W=Error("Failed to resolve repeated object (this should not happen)");throw W.source=Q,W}}},sourceObjects:z}}Xq.anchorIsValid=$q;Xq.anchorNames=J7;Xq.createNodeAnchors=Zq;Xq.findNewAnchor=Q7});var Z3=E((Wq)=>{function $2($,Z,X,z){if(z&&typeof z==="object")if(Array.isArray(z))for(let J=0,Q=z.length;J<Q;++J){let Y=z[J],W=$2($,z,String(J),Y);if(W===void 0)delete z[J];else if(W!==Y)z[J]=W}else if(z instanceof Map)for(let J of Array.from(z.keys())){let Q=z.get(J),Y=$2($,z,J,Q);if(Y===void 0)z.delete(J);else if(Y!==Q)z.set(J,Y)}else if(z instanceof Set)for(let J of Array.from(z)){let Q=$2($,z,J,J);if(Q===void 0)z.delete(J);else if(Q!==J)z.delete(J),z.add(Q)}else for(let[J,Q]of Object.entries(z)){let Y=$2($,z,J,Q);if(Y===void 0)delete z[J];else if(Y!==Q)z[J]=Y}return $.call(Z,X,z)}Wq.applyReviver=$2});var H1=E((Gq)=>{var qq=i();function Y7($,Z,X){if(Array.isArray($))return $.map((z,J)=>Y7(z,String(J),X));if($&&typeof $.toJSON==="function"){if(!X||!qq.hasAnchor($))return $.toJSON(Z,X);let z={aliasCount:0,count:1,res:void 0};X.anchors.set($,z),X.onCreate=(Q)=>{z.res=Q,delete X.onCreate};let J=$.toJSON(Z,X);if(X.onCreate)X.onCreate(J);return J}if(typeof $==="bigint"&&!X?.keep)return Number($);return $}Gq.toJS=Y7});var p6=E((Bq)=>{var Kq=Z3(),W7=i(),Hq=H1();class U7{constructor($){Object.defineProperty(this,W7.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:Z,maxAliasCount:X,onAnchor:z,reviver:J}={}){if(!W7.isDocument($))throw TypeError("A document argument is required");let Q={anchors:new Map,doc:$,keep:!0,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof X==="number"?X:100},Y=Hq.toJS(this,"",Q);if(typeof z==="function")for(let{count:W,res:U}of Q.anchors.values())z(U,W);return typeof J==="function"?Kq.applyReviver(J,{"":Y},"",Y):Y}}Bq.NodeBase=U7});var Z2=E((Iq)=>{var Oq=d6(),Nq=e$(),Q$=i(),Lq=p6(),Dq=H1();class q7 extends Lq.NodeBase{constructor($){super(Q$.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,Z){if(Z?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let X;if(Z?.aliasResolveCache)X=Z.aliasResolveCache;else if(X=[],Nq.visit($,{Node:(J,Q)=>{if(Q$.isAlias(Q)||Q$.hasAnchor(Q))X.push(Q)}}),Z)Z.aliasResolveCache=X;let z=void 0;for(let J of X){if(J===this)break;if(J.anchor===this.source)z=J}return z}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:X,doc:z,maxAliasCount:J}=Z,Q=this.resolve(z,Z);if(!Q){let W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=X.get(Q);if(!Y)Dq.toJS(Q,null,Z),Y=X.get(Q);if(Y?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(J>=0){if(Y.count+=1,Y.aliasCount===0)Y.aliasCount=i6(z,Q,X);if(Y.count*Y.aliasCount>J)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return Y.res}toString($,Z,X){let z=`*${this.source}`;if($){if(Oq.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let J=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(J)}if($.implicitKey)return`${z} `}return z}}function i6($,Z,X){if(Q$.isAlias(Z)){let z=Z.resolve($),J=X&&z&&X.get(z);return J?J.count*J.aliasCount:0}else if(Q$.isCollection(Z)){let z=0;for(let J of Z.items){let Q=i6($,J,X);if(Q>z)z=Q}return z}else if(Q$.isPair(Z)){let z=i6($,Z.key,X),J=i6($,Z.value,X);return Math.max(z,J)}return 1}Iq.Alias=q7});var J0=E((Cq)=>{var Aq=i(),Rq=p6(),_q=H1(),Fq=($)=>!$||typeof $!=="function"&&typeof $!=="object";class y1 extends Rq.NodeBase{constructor($){super(Aq.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:_q.toJS(this.value,$,Z)}toString(){return String(this.value)}}y1.BLOCK_FOLDED="BLOCK_FOLDED";y1.BLOCK_LITERAL="BLOCK_LITERAL";y1.PLAIN="PLAIN";y1.QUOTE_DOUBLE="QUOTE_DOUBLE";y1.QUOTE_SINGLE="QUOTE_SINGLE";Cq.Scalar=y1;Cq.isScalarValue=Fq});var X2=E((bq)=>{var wq=Z2(),v1=i(),G7=J0(),Sq="tag:yaml.org,2002:";function jq($,Z,X){if(Z){let z=X.filter((Q)=>Q.tag===Z),J=z.find((Q)=>!Q.format)??z[0];if(!J)throw Error(`Tag ${Z} not found`);return J}return X.find((z)=>z.identify?.($)&&!z.format)}function xq($,Z,X){if(v1.isDocument($))$=$.contents;if(v1.isNode($))return $;if(v1.isPair($)){let V=X.schema[v1.MAP].createNode?.(X.schema,null,X);return V.items.push($),V}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:z,onAnchor:J,onTagObj:Q,schema:Y,sourceObjects:W}=X,U=void 0;if(z&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=J($)),new wq.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=Sq+Z.slice(2);let q=jq($,Z,Y.tags);if(!q){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let V=new G7.Scalar($);if(U)U.node=V;return V}q=$ instanceof Map?Y[v1.MAP]:(Symbol.iterator in Object($))?Y[v1.SEQ]:Y[v1.MAP]}if(Q)Q(q),delete X.onTagObj;let G=q?.createNode?q.createNode(X.schema,$,X):typeof q?.nodeClass?.from==="function"?q.nodeClass.from(X.schema,$,X):new G7.Scalar($);if(Z)G.tag=Z;else if(!q.default)G.tag=q.tag;if(U)U.node=G;return G}bq.createNode=xq});var n6=E((gq)=>{var yq=X2(),a0=i(),vq=p6();function X3($,Z,X){let z=X;for(let J=Z.length-1;J>=0;--J){let Q=Z[J];if(typeof Q==="number"&&Number.isInteger(Q)&&Q>=0){let Y=[];Y[Q]=z,z=Y}else z=new Map([[Q,z]])}return yq.createNode(z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var V7=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class K7 extends vq.NodeBase{constructor($,Z){super($);Object.defineProperty(this,"schema",{value:Z,configurable:!0,enumerable:!1,writable:!0})}clone($){let Z=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)Z.schema=$;if(Z.items=Z.items.map((X)=>a0.isNode(X)||a0.isPair(X)?X.clone($):X),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(V7($))this.add(Z);else{let[X,...z]=$,J=this.get(X,!0);if(a0.isCollection(J))J.addIn(z,Z);else if(J===void 0&&this.schema)this.set(X,X3(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}deleteIn($){let[Z,...X]=$;if(X.length===0)return this.delete(Z);let z=this.get(Z,!0);if(a0.isCollection(z))return z.deleteIn(X);else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}getIn($,Z){let[X,...z]=$,J=this.get(X,!0);if(z.length===0)return!Z&&a0.isScalar(J)?J.value:J;else return a0.isCollection(J)?J.getIn(z,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!a0.isPair(Z))return!1;let X=Z.value;return X==null||$&&a0.isScalar(X)&&X.value==null&&!X.commentBefore&&!X.comment&&!X.tag})}hasIn($){let[Z,...X]=$;if(X.length===0)return this.has(Z);let z=this.get(Z,!0);return a0.isCollection(z)?z.hasIn(X):!1}setIn($,Z){let[X,...z]=$;if(z.length===0)this.set(X,Z);else{let J=this.get(X,!0);if(a0.isCollection(J))J.setIn(z,Z);else if(J===void 0&&this.schema)this.set(X,X3(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}}gq.Collection=K7;gq.collectionFromPath=X3;gq.isEmptyPath=V7});var z2=E((lq)=>{var mq=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function z3($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var cq=($,Z,X)=>$.endsWith(`
29
+ `)?z3(X,Z):X.includes(`
30
30
  `)?`
31
- `+Y3(X,Z):($.endsWith(" ")?"":" ")+X;kq.indentComment=Y3;kq.lineComment=bq;kq.stringifyComment=xq});var B7=P((hq)=>{function fq($,Z,X="flow",{indentAtStart:z,lineWidth:J=80,minContentWidth:Q=20,onFold:Y,onOverflow:W}={}){if(!J||J<0)return $;if(J<Q)Q=0;let U=Math.max(1+Q,1+J-Z.length);if($.length<=U)return $;let q=[],G={},V=J-Z.length;if(typeof z==="number")if(z>J-Math.max(2,Q))q.push(0);else V=J-z;let K=void 0,H=void 0,L=!1,B=-1,O=-1,T=-1;if(X==="block"){if(B=H7($,B,Z.length),B!==-1)V=B+U}for(let S;S=$[B+=1];){if(X==="quoted"&&S==="\\"){switch(O=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}T=B}if(S===`
31
+ `+z3(X,Z):($.endsWith(" ")?"":" ")+X;lq.indentComment=z3;lq.lineComment=cq;lq.stringifyComment=mq});var B7=E((rq)=>{function nq($,Z,X="flow",{indentAtStart:z,lineWidth:J=80,minContentWidth:Q=20,onFold:Y,onOverflow:W}={}){if(!J||J<0)return $;if(J<Q)Q=0;let U=Math.max(1+Q,1+J-Z.length);if($.length<=U)return $;let q=[],G={},V=J-Z.length;if(typeof z==="number")if(z>J-Math.max(2,Q))q.push(0);else V=J-z;let K=void 0,H=void 0,L=!1,B=-1,O=-1,T=-1;if(X==="block"){if(B=H7($,B,Z.length),B!==-1)V=B+U}for(let S;S=$[B+=1];){if(X==="quoted"&&S==="\\"){switch(O=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}T=B}if(S===`
32
32
  `){if(X==="block")B=H7($,B,Z.length);V=B+Z.length+U,K=void 0}else{if(S===" "&&H&&H!==" "&&H!==`
33
33
  `&&H!=="\t"){let b=$[B+1];if(b&&b!==" "&&b!==`
34
34
  `&&b!=="\t")K=B}if(B>=V)if(K)q.push(K),V=K+U,K=void 0;else if(X==="quoted"){while(H===" "||H==="\t")H=S,S=$[B+=1],L=!0;let b=B>T+1?B-2:O-1;if(G[b])return $;q.push(b),G[b]=!0,V=b+U,K=void 0}else L=!0}H=S}if(L&&W)W();if(q.length===0)return $;if(Y)Y();let j=$.slice(0,q[0]);for(let S=0;S<q.length;++S){let b=q[S],y=q[S+1]||$.length;if(b===0)j=`
35
35
  ${Z}${$.slice(0,y)}`;else{if(X==="quoted"&&G[b])j+=`${$[b]}\\`;j+=`
36
36
  ${Z}${$.slice(b+1,y)}`}}return j}function H7($,Z,X){let z=Z,J=Z+1,Q=$[J];while(Q===" "||Q==="\t")if(Z<J+X)Q=$[++Z];else{do Q=$[++Z];while(Q&&Q!==`
37
- `);z=Z,J=Z+1,Q=$[J]}return z}hq.FOLD_BLOCK="block";hq.FOLD_FLOW="flow";hq.FOLD_QUOTED="quoted";hq.foldFlowLines=fq});var Q2=P((nq)=>{var c0=J0(),B1=B7(),s6=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),a6=($)=>/^(%|---|\.\.\.)/m.test($);function dq($,Z,X){if(!Z||Z<0)return!1;let z=Z-X,J=$.length;if(J<=z)return!1;for(let Q=0,Y=0;Q<J;++Q)if($[Q]===`
37
+ `);z=Z,J=Z+1,Q=$[J]}return z}rq.FOLD_BLOCK="block";rq.FOLD_FLOW="flow";rq.FOLD_QUOTED="quoted";rq.foldFlowLines=nq});var Q2=E((XG)=>{var c0=J0(),B1=B7(),s6=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),a6=($)=>/^(%|---|\.\.\.)/m.test($);function eq($,Z,X){if(!Z||Z<0)return!1;let z=Z-X,J=$.length;if(J<=z)return!1;for(let Q=0,Y=0;Q<J;++Q)if($[Q]===`
38
38
  `){if(Q-Y>z)return!0;if(Y=Q+1,J-Y<=z)return!1}return!0}function J2($,Z){let X=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return X;let{implicitKey:z}=Z,J=Z.options.doubleQuotedMinMultiLineLength,Q=Z.indent||(a6($)?" ":""),Y="",W=0;for(let U=0,q=X[U];q;q=X[++U]){if(q===" "&&X[U+1]==="\\"&&X[U+2]==="n")Y+=X.slice(W,U)+"\\ ",U+=1,W=U,q="\\";if(q==="\\")switch(X[U+1]){case"u":{Y+=X.slice(W,U);let G=X.substr(U+2,4);switch(G){case"0000":Y+="\\0";break;case"0007":Y+="\\a";break;case"000b":Y+="\\v";break;case"001b":Y+="\\e";break;case"0085":Y+="\\N";break;case"00a0":Y+="\\_";break;case"2028":Y+="\\L";break;case"2029":Y+="\\P";break;default:if(G.substr(0,2)==="00")Y+="\\x"+G.substr(2);else Y+=X.substr(U,6)}U+=5,W=U+1}break;case"n":if(z||X[U+2]==='"'||X.length<J)U+=1;else{Y+=X.slice(W,U)+`
39
39
 
40
40
  `;while(X[U+2]==="\\"&&X[U+3]==="n"&&X[U+4]!=='"')Y+=`
41
- `,U+=2;if(Y+=Q,X[U+2]===" ")Y+="\\";U+=1,W=U+1}break;default:U+=1}}return Y=W?Y+X.slice(W):X,z?Y:B1.foldFlowLines(Y,Q,B1.FOLD_QUOTED,s6(Z,!1))}function W3($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
41
+ `,U+=2;if(Y+=Q,X[U+2]===" ")Y+="\\";U+=1,W=U+1}break;default:U+=1}}return Y=W?Y+X.slice(W):X,z?Y:B1.foldFlowLines(Y,Q,B1.FOLD_QUOTED,s6(Z,!1))}function J3($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
42
  `)||/[ \t]\n|\n[ \t]/.test($))return J2($,Z);let X=Z.indent||(a6($)?" ":""),z="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
- ${X}`)+"'";return Z.implicitKey?z:B1.foldFlowLines(z,X,B1.FOLD_FLOW,s6(Z,!1))}function Y$($,Z){let{singleQuote:X}=Z.options,z;if(X===!1)z=J2;else{let J=$.includes('"'),Q=$.includes("'");if(J&&!Q)z=W3;else if(Q&&!J)z=J2;else z=X?W3:J2}return z($,Z)}var U3;try{U3=new RegExp(`(^|(?<!
43
+ ${X}`)+"'";return Z.implicitKey?z:B1.foldFlowLines(z,X,B1.FOLD_FLOW,s6(Z,!1))}function Y$($,Z){let{singleQuote:X}=Z.options,z;if(X===!1)z=J2;else{let J=$.includes('"'),Q=$.includes("'");if(J&&!Q)z=J3;else if(Q&&!J)z=J2;else z=X?J3:J2}return z($,Z)}var Q3;try{Q3=new RegExp(`(^|(?<!
44
44
  ))
45
45
  +(?!
46
- |$)`,"g")}catch{U3=/\n+(?!\n|$)/g}function r6({comment:$,type:Z,value:X},z,J,Q){let{blockQuote:Y,commentString:W,lineWidth:U}=z.options;if(!Y||/\n[\t ]+$/.test(X))return Y$(X,z);let q=z.indent||(z.forceBlockIndent||a6(X)?" ":""),G=Y==="literal"?!0:Y==="folded"||Z===c0.Scalar.BLOCK_FOLDED?!1:Z===c0.Scalar.BLOCK_LITERAL?!0:!dq(X,U,q.length);if(!X)return G?`|
46
+ |$)`,"g")}catch{Q3=/\n+(?!\n|$)/g}function r6({comment:$,type:Z,value:X},z,J,Q){let{blockQuote:Y,commentString:W,lineWidth:U}=z.options;if(!Y||/\n[\t ]+$/.test(X))return Y$(X,z);let q=z.indent||(z.forceBlockIndent||a6(X)?" ":""),G=Y==="literal"?!0:Y==="folded"||Z===c0.Scalar.BLOCK_FOLDED?!1:Z===c0.Scalar.BLOCK_LITERAL?!0:!eq(X,U,q.length);if(!X)return G?`|
47
47
  `:`>
48
48
  `;let V,K;for(K=X.length;K>0;--K){let y=X[K-1];if(y!==`
49
49
  `&&y!=="\t"&&y!==" ")break}let H=X.substring(K),L=H.indexOf(`
50
50
  `);if(L===-1)V="-";else if(X===H||L!==H.length-1){if(V="+",Q)Q()}else V="";if(H){if(X=X.slice(0,-H.length),H[H.length-1]===`
51
- `)H=H.slice(0,-1);H=H.replace(U3,`$&${q}`)}let B=!1,O,T=-1;for(O=0;O<X.length;++O){let y=X[O];if(y===" ")B=!0;else if(y===`
51
+ `)H=H.slice(0,-1);H=H.replace(Q3,`$&${q}`)}let B=!1,O,T=-1;for(O=0;O<X.length;++O){let y=X[O];if(y===" ")B=!0;else if(y===`
52
52
  `)T=O;else break}let j=X.substring(0,T<O?T+1:O);if(j)X=X.substring(j.length),j=j.replace(/\n+/g,`$&${q}`);let b=(B?q?"2":"1":"")+V;if($){if(b+=" "+W($.replace(/ ?[\r\n]+/g," ")),J)J()}if(!G){let y=X.replace(/\n+/g,`
53
53
  $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${q}`),x=!1,c=s6(z,!0);if(Y!=="folded"&&Z!==c0.Scalar.BLOCK_FOLDED)c.onOverflow=()=>{x=!0};let _=B1.foldFlowLines(`${j}${y}${H}`,q,B1.FOLD_BLOCK,c);if(!x)return`>${b}
54
54
  ${q}${_}`}return X=X.replace(/\n+/g,`$&${q}`),`|${b}
55
- ${q}${j}${X}${H}`}function pq($,Z,X,z){let{type:J,value:Q}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:q,inFlow:G}=Z;if(W&&Q.includes(`
55
+ ${q}${j}${X}${H}`}function $G($,Z,X,z){let{type:J,value:Q}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:q,inFlow:G}=Z;if(W&&Q.includes(`
56
56
  `)||G&&/[[\]{},]/.test(Q))return Y$(Q,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(Q))return W||G||!Q.includes(`
57
57
  `)?Y$(Q,Z):r6($,Z,X,z);if(!W&&!G&&J!==c0.Scalar.PLAIN&&Q.includes(`
58
58
  `))return r6($,Z,X,z);if(a6(Q)){if(U==="")return Z.forceBlockIndent=!0,r6($,Z,X,z);else if(W&&U===q)return Y$(Q,Z)}let V=Q.replace(/\n+/g,`$&
59
- ${U}`);if(Y){let K=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(V),{compat:H,tags:L}=Z.doc.schema;if(L.some(K)||H?.some(K))return Y$(Q,Z)}return W?V:B1.foldFlowLines(V,U,B1.FOLD_FLOW,s6(Z,!1))}function iq($,Z,X,z){let{implicitKey:J,inFlow:Q}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==c0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=c0.Scalar.QUOTE_DOUBLE}let U=(G)=>{switch(G){case c0.Scalar.BLOCK_FOLDED:case c0.Scalar.BLOCK_LITERAL:return J||Q?Y$(Y.value,Z):r6(Y,Z,X,z);case c0.Scalar.QUOTE_DOUBLE:return J2(Y.value,Z);case c0.Scalar.QUOTE_SINGLE:return W3(Y.value,Z);case c0.Scalar.PLAIN:return pq(Y,Z,X,z);default:return null}},q=U(W);if(q===null){let{defaultKeyType:G,defaultStringType:V}=Z.options,K=J&&G||V;if(q=U(K),q===null)throw Error(`Unsupported default string type ${K}`)}return q}nq.stringifyString=iq});var Y2=P((XG)=>{var sq=d6(),M1=i(),aq=z2(),oq=Q2();function tq($,Z){let X=Object.assign({blockQuote:!0,commentString:aq.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,Z),z;switch(X.collectionStyle){case"block":z=!1;break;case"flow":z=!0;break;default:z=null}return{anchors:new Set,doc:$,flowCollectionPadding:X.flowCollectionPadding?" ":"",indent:"",indentStep:typeof X.indent==="number"?" ".repeat(X.indent):" ",inFlow:z,options:X}}function eq($,Z){if(Z.tag){let J=$.filter((Q)=>Q.tag===Z.tag);if(J.length>0)return J.find((Q)=>Q.format===Z.format)??J[0]}let X=void 0,z;if(M1.isScalar(Z)){z=Z.value;let J=$.filter((Q)=>Q.identify?.(z));if(J.length>1){let Q=J.filter((Y)=>Y.test);if(Q.length>0)J=Q}X=J.find((Q)=>Q.format===Z.format)??J.find((Q)=>!Q.format)}else z=Z,X=$.find((J)=>J.nodeClass&&z instanceof J.nodeClass);if(!X){let J=z?.constructor?.name??(z===null?"null":typeof z);throw Error(`Tag not resolved for ${J} value`)}return X}function $G($,Z,{anchors:X,doc:z}){if(!z.directives)return"";let J=[],Q=(M1.isScalar($)||M1.isCollection($))&&$.anchor;if(Q&&sq.anchorIsValid(Q))X.add(Q),J.push(`&${Q}`);let Y=$.tag??(Z.default?null:Z.tag);if(Y)J.push(z.directives.tagString(Y));return J.join(" ")}function ZG($,Z,X,z){if(M1.isPair($))return $.toString(Z,X,z);if(M1.isAlias($)){if(Z.doc.directives)return $.toString(Z);if(Z.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(Z.resolvedAliases)Z.resolvedAliases.add($);else Z.resolvedAliases=new Set([$]);$=$.resolve(Z.doc)}}let J=void 0,Q=M1.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>J=U});J??(J=eq(Z.doc.schema.tags,Q));let Y=$G(Q,J,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof J.stringify==="function"?J.stringify(Q,Z,X,z):M1.isScalar(Q)?oq.stringifyString(Q,Z,X,z):Q.toString(Z,X,z);if(!Y)return W;return M1.isScalar(Q)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
- ${Z.indent}${W}`}XG.createStringifyContext=tq;XG.stringify=ZG});var N7=P((YG)=>{var z1=i(),M7=J0(),O7=Y2(),W2=z2();function QG({key:$,value:Z},X,z,J){let{allNullValues:Q,doc:Y,indent:W,indentStep:U,options:{commentString:q,indentSeq:G,simpleKeys:V}}=X,K=z1.isNode($)&&$.comment||null;if(V){if(K)throw Error("With simple keys, key nodes cannot have comments");if(z1.isCollection($)||!z1.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let H=!V&&(!$||K&&Z==null&&!X.inFlow||z1.isCollection($)||(z1.isScalar($)?$.type===M7.Scalar.BLOCK_FOLDED||$.type===M7.Scalar.BLOCK_LITERAL:typeof $==="object"));X=Object.assign({},X,{allNullValues:!1,implicitKey:!H&&(V||!Q),indent:W+U});let L=!1,B=!1,O=O7.stringify($,X,()=>L=!0,()=>B=!0);if(!H&&!X.inFlow&&O.length>1024){if(V)throw Error("With simple keys, single line scalar must not span more than 1024 characters");H=!0}if(X.inFlow){if(Q||Z==null){if(L&&z)z();return O===""?"?":H?`? ${O}`:O}}else if(Q&&!V||Z==null&&H){if(O=`? ${O}`,K&&!L)O+=W2.lineComment(O,X.indent,q(K));else if(B&&J)J();return O}if(L)K=null;if(H){if(K)O+=W2.lineComment(O,X.indent,q(K));O=`? ${O}
61
- ${W}:`}else if(O=`${O}:`,K)O+=W2.lineComment(O,X.indent,q(K));let T,j,S;if(z1.isNode(Z))T=!!Z.spaceBefore,j=Z.commentBefore,S=Z.comment;else if(T=!1,j=null,S=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(X.implicitKey=!1,!H&&!K&&z1.isScalar(Z))X.indentAtStart=O.length+1;if(B=!1,!G&&U.length>=2&&!X.inFlow&&!H&&z1.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)X.indent=X.indent.substring(2);let b=!1,y=O7.stringify(Z,X,()=>b=!0,()=>B=!0),x=" ";if(K||T||j){if(x=T?`
59
+ ${U}`);if(Y){let K=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(V),{compat:H,tags:L}=Z.doc.schema;if(L.some(K)||H?.some(K))return Y$(Q,Z)}return W?V:B1.foldFlowLines(V,U,B1.FOLD_FLOW,s6(Z,!1))}function ZG($,Z,X,z){let{implicitKey:J,inFlow:Q}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==c0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=c0.Scalar.QUOTE_DOUBLE}let U=(G)=>{switch(G){case c0.Scalar.BLOCK_FOLDED:case c0.Scalar.BLOCK_LITERAL:return J||Q?Y$(Y.value,Z):r6(Y,Z,X,z);case c0.Scalar.QUOTE_DOUBLE:return J2(Y.value,Z);case c0.Scalar.QUOTE_SINGLE:return J3(Y.value,Z);case c0.Scalar.PLAIN:return $G(Y,Z,X,z);default:return null}},q=U(W);if(q===null){let{defaultKeyType:G,defaultStringType:V}=Z.options,K=J&&G||V;if(q=U(K),q===null)throw Error(`Unsupported default string type ${K}`)}return q}XG.stringifyString=ZG});var Y2=E((VG)=>{var JG=d6(),M1=i(),QG=z2(),YG=Q2();function WG($,Z){let X=Object.assign({blockQuote:!0,commentString:QG.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,Z),z;switch(X.collectionStyle){case"block":z=!1;break;case"flow":z=!0;break;default:z=null}return{anchors:new Set,doc:$,flowCollectionPadding:X.flowCollectionPadding?" ":"",indent:"",indentStep:typeof X.indent==="number"?" ".repeat(X.indent):" ",inFlow:z,options:X}}function UG($,Z){if(Z.tag){let J=$.filter((Q)=>Q.tag===Z.tag);if(J.length>0)return J.find((Q)=>Q.format===Z.format)??J[0]}let X=void 0,z;if(M1.isScalar(Z)){z=Z.value;let J=$.filter((Q)=>Q.identify?.(z));if(J.length>1){let Q=J.filter((Y)=>Y.test);if(Q.length>0)J=Q}X=J.find((Q)=>Q.format===Z.format)??J.find((Q)=>!Q.format)}else z=Z,X=$.find((J)=>J.nodeClass&&z instanceof J.nodeClass);if(!X){let J=z?.constructor?.name??(z===null?"null":typeof z);throw Error(`Tag not resolved for ${J} value`)}return X}function qG($,Z,{anchors:X,doc:z}){if(!z.directives)return"";let J=[],Q=(M1.isScalar($)||M1.isCollection($))&&$.anchor;if(Q&&JG.anchorIsValid(Q))X.add(Q),J.push(`&${Q}`);let Y=$.tag??(Z.default?null:Z.tag);if(Y)J.push(z.directives.tagString(Y));return J.join(" ")}function GG($,Z,X,z){if(M1.isPair($))return $.toString(Z,X,z);if(M1.isAlias($)){if(Z.doc.directives)return $.toString(Z);if(Z.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(Z.resolvedAliases)Z.resolvedAliases.add($);else Z.resolvedAliases=new Set([$]);$=$.resolve(Z.doc)}}let J=void 0,Q=M1.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>J=U});J??(J=UG(Z.doc.schema.tags,Q));let Y=qG(Q,J,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof J.stringify==="function"?J.stringify(Q,Z,X,z):M1.isScalar(Q)?YG.stringifyString(Q,Z,X,z):Q.toString(Z,X,z);if(!Y)return W;return M1.isScalar(Q)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
+ ${Z.indent}${W}`}VG.createStringifyContext=WG;VG.stringify=GG});var N7=E((MG)=>{var X1=i(),M7=J0(),O7=Y2(),W2=z2();function BG({key:$,value:Z},X,z,J){let{allNullValues:Q,doc:Y,indent:W,indentStep:U,options:{commentString:q,indentSeq:G,simpleKeys:V}}=X,K=X1.isNode($)&&$.comment||null;if(V){if(K)throw Error("With simple keys, key nodes cannot have comments");if(X1.isCollection($)||!X1.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let H=!V&&(!$||K&&Z==null&&!X.inFlow||X1.isCollection($)||(X1.isScalar($)?$.type===M7.Scalar.BLOCK_FOLDED||$.type===M7.Scalar.BLOCK_LITERAL:typeof $==="object"));X=Object.assign({},X,{allNullValues:!1,implicitKey:!H&&(V||!Q),indent:W+U});let L=!1,B=!1,O=O7.stringify($,X,()=>L=!0,()=>B=!0);if(!H&&!X.inFlow&&O.length>1024){if(V)throw Error("With simple keys, single line scalar must not span more than 1024 characters");H=!0}if(X.inFlow){if(Q||Z==null){if(L&&z)z();return O===""?"?":H?`? ${O}`:O}}else if(Q&&!V||Z==null&&H){if(O=`? ${O}`,K&&!L)O+=W2.lineComment(O,X.indent,q(K));else if(B&&J)J();return O}if(L)K=null;if(H){if(K)O+=W2.lineComment(O,X.indent,q(K));O=`? ${O}
61
+ ${W}:`}else if(O=`${O}:`,K)O+=W2.lineComment(O,X.indent,q(K));let T,j,S;if(X1.isNode(Z))T=!!Z.spaceBefore,j=Z.commentBefore,S=Z.comment;else if(T=!1,j=null,S=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(X.implicitKey=!1,!H&&!K&&X1.isScalar(Z))X.indentAtStart=O.length+1;if(B=!1,!G&&U.length>=2&&!X.inFlow&&!H&&X1.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)X.indent=X.indent.substring(2);let b=!1,y=O7.stringify(Z,X,()=>b=!0,()=>B=!0),x=" ";if(K||T||j){if(x=T?`
62
62
  `:"",j){let c=q(j);x+=`
63
63
  ${W2.indentComment(c,X.indent)}`}if(y===""&&!X.inFlow){if(x===`
64
64
  `&&S)x=`
65
65
 
66
66
  `}else x+=`
67
- ${X.indent}`}else if(!H&&z1.isCollection(Z)){let c=y[0],_=y.indexOf(`
68
- `),n=_!==-1,p=X.inFlow??Z.flow??Z.items.length===0;if(n||!p){let A0=!1;if(n&&(c==="&"||c==="!")){let E=y.indexOf(" ");if(c==="&"&&E!==-1&&E<_&&y[E+1]==="!")E=y.indexOf(" ",E+1);if(E===-1||_<E)A0=!0}if(!A0)x=`
67
+ ${X.indent}`}else if(!H&&X1.isCollection(Z)){let c=y[0],_=y.indexOf(`
68
+ `),n=_!==-1,p=X.inFlow??Z.flow??Z.items.length===0;if(n||!p){let A0=!1;if(n&&(c==="&"||c==="!")){let P=y.indexOf(" ");if(c==="&"&&P!==-1&&P<_&&y[P+1]==="!")P=y.indexOf(" ",P+1);if(P===-1||_<P)A0=!0}if(!A0)x=`
69
69
  ${X.indent}`}}else if(y===""||y[0]===`
70
- `)x="";if(O+=x+y,X.inFlow){if(b&&z)z()}else if(S&&!b)O+=W2.lineComment(O,X.indent,q(S));else if(B&&J)J();return O}YG.stringifyPair=QG});var q3=P((GG)=>{var L7=C0("process");function UG($,...Z){if($==="debug")console.log(...Z)}function qG($,Z){if($==="debug"||$==="warn")if(typeof L7.emitWarning==="function")L7.emitWarning(Z);else console.warn(Z)}GG.debug=UG;GG.warn=qG});var $8=P((BG)=>{var e6=i(),D7=J0(),o6="<<",t6={identify:($)=>$===o6||typeof $==="symbol"&&$.description===o6,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new D7.Scalar(Symbol(o6)),{addToJSMap:I7}),stringify:()=>o6},HG=($,Z)=>(t6.identify(Z)||e6.isScalar(Z)&&(!Z.type||Z.type===D7.Scalar.PLAIN)&&t6.identify(Z.value))&&$?.doc.schema.tags.some((X)=>X.tag===t6.tag&&X.default);function I7($,Z,X){let z=T7($,X);if(e6.isSeq(z))for(let J of z.items)G3($,Z,J);else if(Array.isArray(z))for(let J of z)G3($,Z,J);else G3($,Z,z)}function G3($,Z,X){let z=T7($,X);if(!e6.isMap(z))throw Error("Merge sources must be maps or map aliases");let J=z.toJSON(null,$,Map);for(let[Q,Y]of J)if(Z instanceof Map){if(!Z.has(Q))Z.set(Q,Y)}else if(Z instanceof Set)Z.add(Q);else if(!Object.prototype.hasOwnProperty.call(Z,Q))Object.defineProperty(Z,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0});return Z}function T7($,Z){return $&&e6.isAlias(Z)?Z.resolve($.doc,$):Z}BG.addMergeToJSMap=I7;BG.isMergeKey=HG;BG.merge=t6});var K3=P((AG)=>{var LG=q3(),A7=$8(),DG=Y2(),R7=i(),V3=H1();function IG($,Z,{key:X,value:z}){if(R7.isNode(X)&&X.addToJSMap)X.addToJSMap($,Z,z);else if(A7.isMergeKey($,X))A7.addMergeToJSMap($,Z,z);else{let J=V3.toJS(X,"",$);if(Z instanceof Map)Z.set(J,V3.toJS(z,J,$));else if(Z instanceof Set)Z.add(J);else{let Q=TG(X,J,$),Y=V3.toJS(z,Q,$);if(Q in Z)Object.defineProperty(Z,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0});else Z[Q]=Y}}return Z}function TG($,Z,X){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(R7.isNode($)&&X?.doc){let z=DG.createStringifyContext(X.doc,{});z.anchors=new Set;for(let Q of X.anchors.keys())z.anchors.add(Q.anchor);z.inFlow=!0,z.inStringifyKey=!0;let J=$.toString(z);if(!X.mapKeyWarned){let Q=JSON.stringify(J);if(Q.length>40)Q=Q.substring(0,36)+'..."';LG.warn(X.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${Q}. Set mapAsMap: true to use object keys.`),X.mapKeyWarned=!0}return J}return JSON.stringify(Z)}AG.addPairToJSMap=IG});var O1=P((EG)=>{var _7=X2(),_G=N7(),FG=K3(),Z8=i();function CG($,Z,X){let z=_7.createNode($,void 0,X),J=_7.createNode(Z,void 0,X);return new X8(z,J)}class X8{constructor($,Z=null){Object.defineProperty(this,Z8.NODE_TYPE,{value:Z8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:X}=this;if(Z8.isNode(Z))Z=Z.clone($);if(Z8.isNode(X))X=X.clone($);return new X8(Z,X)}toJSON($,Z){let X=Z?.mapAsMap?new Map:{};return FG.addPairToJSMap(Z,X,this)}toString($,Z,X){return $?.doc?_G.stringifyPair(this,$,Z,X):JSON.stringify(this)}}EG.Pair=X8;EG.createPair=CG});var H3=P((bG)=>{var g1=i(),F7=Y2(),z8=z2();function SG($,Z,X){return(Z.inFlow??$.flow?xG:jG)($,Z,X)}function jG({comment:$,items:Z},X,{blockItemPrefix:z,flowChars:J,itemIndent:Q,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:q}}=X,G=Object.assign({},X,{indent:Q,type:null}),V=!1,K=[];for(let L=0;L<Z.length;++L){let B=Z[L],O=null;if(g1.isNode(B)){if(!V&&B.spaceBefore)K.push("");if(J8(X,K,B.commentBefore,V),B.comment)O=B.comment}else if(g1.isPair(B)){let j=g1.isNode(B.key)?B.key:null;if(j){if(!V&&j.spaceBefore)K.push("");J8(X,K,j.commentBefore,V)}}V=!1;let T=F7.stringify(B,G,()=>O=null,()=>V=!0);if(O)T+=z8.lineComment(T,Q,q(O));if(V&&O)V=!1;K.push(z+T)}let H;if(K.length===0)H=J.start+J.end;else{H=K[0];for(let L=1;L<K.length;++L){let B=K[L];H+=B?`
70
+ `)x="";if(O+=x+y,X.inFlow){if(b&&z)z()}else if(S&&!b)O+=W2.lineComment(O,X.indent,q(S));else if(B&&J)J();return O}MG.stringifyPair=BG});var Y3=E((DG)=>{var L7=C0("process");function NG($,...Z){if($==="debug")console.log(...Z)}function LG($,Z){if($==="debug"||$==="warn")if(typeof L7.emitWarning==="function")L7.emitWarning(Z);else console.warn(Z)}DG.debug=NG;DG.warn=LG});var $8=E((RG)=>{var e6=i(),D7=J0(),o6="<<",t6={identify:($)=>$===o6||typeof $==="symbol"&&$.description===o6,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new D7.Scalar(Symbol(o6)),{addToJSMap:I7}),stringify:()=>o6},AG=($,Z)=>(t6.identify(Z)||e6.isScalar(Z)&&(!Z.type||Z.type===D7.Scalar.PLAIN)&&t6.identify(Z.value))&&$?.doc.schema.tags.some((X)=>X.tag===t6.tag&&X.default);function I7($,Z,X){let z=T7($,X);if(e6.isSeq(z))for(let J of z.items)W3($,Z,J);else if(Array.isArray(z))for(let J of z)W3($,Z,J);else W3($,Z,z)}function W3($,Z,X){let z=T7($,X);if(!e6.isMap(z))throw Error("Merge sources must be maps or map aliases");let J=z.toJSON(null,$,Map);for(let[Q,Y]of J)if(Z instanceof Map){if(!Z.has(Q))Z.set(Q,Y)}else if(Z instanceof Set)Z.add(Q);else if(!Object.prototype.hasOwnProperty.call(Z,Q))Object.defineProperty(Z,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0});return Z}function T7($,Z){return $&&e6.isAlias(Z)?Z.resolve($.doc,$):Z}RG.addMergeToJSMap=I7;RG.isMergeKey=AG;RG.merge=t6});var q3=E((jG)=>{var PG=Y3(),A7=$8(),EG=Y2(),R7=i(),U3=H1();function wG($,Z,{key:X,value:z}){if(R7.isNode(X)&&X.addToJSMap)X.addToJSMap($,Z,z);else if(A7.isMergeKey($,X))A7.addMergeToJSMap($,Z,z);else{let J=U3.toJS(X,"",$);if(Z instanceof Map)Z.set(J,U3.toJS(z,J,$));else if(Z instanceof Set)Z.add(J);else{let Q=SG(X,J,$),Y=U3.toJS(z,Q,$);if(Q in Z)Object.defineProperty(Z,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0});else Z[Q]=Y}}return Z}function SG($,Z,X){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(R7.isNode($)&&X?.doc){let z=EG.createStringifyContext(X.doc,{});z.anchors=new Set;for(let Q of X.anchors.keys())z.anchors.add(Q.anchor);z.inFlow=!0,z.inStringifyKey=!0;let J=$.toString(z);if(!X.mapKeyWarned){let Q=JSON.stringify(J);if(Q.length>40)Q=Q.substring(0,36)+'..."';PG.warn(X.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${Q}. Set mapAsMap: true to use object keys.`),X.mapKeyWarned=!0}return J}return JSON.stringify(Z)}jG.addPairToJSMap=wG});var O1=E((vG)=>{var _7=X2(),bG=N7(),kG=q3(),Z8=i();function yG($,Z,X){let z=_7.createNode($,void 0,X),J=_7.createNode(Z,void 0,X);return new X8(z,J)}class X8{constructor($,Z=null){Object.defineProperty(this,Z8.NODE_TYPE,{value:Z8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:X}=this;if(Z8.isNode(Z))Z=Z.clone($);if(Z8.isNode(X))X=X.clone($);return new X8(Z,X)}toJSON($,Z){let X=Z?.mapAsMap?new Map:{};return kG.addPairToJSMap(Z,X,this)}toString($,Z,X){return $?.doc?bG.stringifyPair(this,$,Z,X):JSON.stringify(this)}}vG.Pair=X8;vG.createPair=yG});var G3=E((cG)=>{var g1=i(),F7=Y2(),z8=z2();function hG($,Z,X){return(Z.inFlow??$.flow?mG:uG)($,Z,X)}function uG({comment:$,items:Z},X,{blockItemPrefix:z,flowChars:J,itemIndent:Q,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:q}}=X,G=Object.assign({},X,{indent:Q,type:null}),V=!1,K=[];for(let L=0;L<Z.length;++L){let B=Z[L],O=null;if(g1.isNode(B)){if(!V&&B.spaceBefore)K.push("");if(J8(X,K,B.commentBefore,V),B.comment)O=B.comment}else if(g1.isPair(B)){let j=g1.isNode(B.key)?B.key:null;if(j){if(!V&&j.spaceBefore)K.push("");J8(X,K,j.commentBefore,V)}}V=!1;let T=F7.stringify(B,G,()=>O=null,()=>V=!0);if(O)T+=z8.lineComment(T,Q,q(O));if(V&&O)V=!1;K.push(z+T)}let H;if(K.length===0)H=J.start+J.end;else{H=K[0];for(let L=1;L<K.length;++L){let B=K[L];H+=B?`
71
71
  ${U}${B}`:`
72
72
  `}}if($){if(H+=`
73
- `+z8.indentComment(q($),U),W)W()}else if(V&&Y)Y();return H}function xG({items:$},Z,{flowChars:X,itemIndent:z}){let{indent:J,indentStep:Q,flowCollectionPadding:Y,options:{commentString:W}}=Z;z+=Q;let U=Object.assign({},Z,{indent:z,inFlow:!0,type:null}),q=!1,G=0,V=[];for(let L=0;L<$.length;++L){let B=$[L],O=null;if(g1.isNode(B)){if(B.spaceBefore)V.push("");if(J8(Z,V,B.commentBefore,!1),B.comment)O=B.comment}else if(g1.isPair(B)){let j=g1.isNode(B.key)?B.key:null;if(j){if(j.spaceBefore)V.push("");if(J8(Z,V,j.commentBefore,!1),j.comment)q=!0}let S=g1.isNode(B.value)?B.value:null;if(S){if(S.comment)O=S.comment;if(S.commentBefore)q=!0}else if(B.value==null&&j?.comment)O=j.comment}if(O)q=!0;let T=F7.stringify(B,U,()=>O=null);if(q||(q=V.length>G||T.includes(`
73
+ `+z8.indentComment(q($),U),W)W()}else if(V&&Y)Y();return H}function mG({items:$},Z,{flowChars:X,itemIndent:z}){let{indent:J,indentStep:Q,flowCollectionPadding:Y,options:{commentString:W}}=Z;z+=Q;let U=Object.assign({},Z,{indent:z,inFlow:!0,type:null}),q=!1,G=0,V=[];for(let L=0;L<$.length;++L){let B=$[L],O=null;if(g1.isNode(B)){if(B.spaceBefore)V.push("");if(J8(Z,V,B.commentBefore,!1),B.comment)O=B.comment}else if(g1.isPair(B)){let j=g1.isNode(B.key)?B.key:null;if(j){if(j.spaceBefore)V.push("");if(J8(Z,V,j.commentBefore,!1),j.comment)q=!0}let S=g1.isNode(B.value)?B.value:null;if(S){if(S.comment)O=S.comment;if(S.commentBefore)q=!0}else if(B.value==null&&j?.comment)O=j.comment}if(O)q=!0;let T=F7.stringify(B,U,()=>O=null);if(q||(q=V.length>G||T.includes(`
74
74
  `)),L<$.length-1)T+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)q||(q=V.reduce((j,S)=>j+S.length+2,2)+(T.length+2)>Z.options.lineWidth);if(q)T+=","}if(O)T+=z8.lineComment(T,z,W(O));V.push(T),G=V.length}let{start:K,end:H}=X;if(V.length===0)return K+H;else{if(!q){let L=V.reduce((B,O)=>B+O.length+2,2);q=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(q){let L=K;for(let B of V)L+=B?`
75
75
  ${Q}${J}${B}`:`
76
76
  `;return`${L}
77
- ${J}${H}`}else return`${K}${Y}${V.join(" ")}${Y}${H}`}}function J8({indent:$,options:{commentString:Z}},X,z,J){if(z&&J)z=z.replace(/^\n+/,"");if(z){let Q=z8.indentComment(Z(z),$);X.push(Q.trimStart())}}bG.stringifyCollection=SG});var L1=P((hG)=>{var yG=H3(),vG=K3(),gG=n6(),N1=i(),Q8=O1(),fG=J0();function U2($,Z){let X=N1.isScalar(Z)?Z.value:Z;for(let z of $)if(N1.isPair(z)){if(z.key===Z||z.key===X)return z;if(N1.isScalar(z.key)&&z.key.value===X)return z}return}class C7 extends gG.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(N1.MAP,$);this.items=[]}static from($,Z,X){let{keepUndefined:z,replacer:J}=X,Q=new this($),Y=(W,U)=>{if(typeof J==="function")U=J.call(Z,W,U);else if(Array.isArray(J)&&!J.includes(W))return;if(U!==void 0||z)Q.items.push(Q8.createPair(W,U,X))};if(Z instanceof Map)for(let[W,U]of Z)Y(W,U);else if(Z&&typeof Z==="object")for(let W of Object.keys(Z))Y(W,Z[W]);if(typeof $.sortMapEntries==="function")Q.items.sort($.sortMapEntries);return Q}add($,Z){let X;if(N1.isPair($))X=$;else if(!$||typeof $!=="object"||!("key"in $))X=new Q8.Pair($,$?.value);else X=new Q8.Pair($.key,$.value);let z=U2(this.items,X.key),J=this.schema?.sortMapEntries;if(z){if(!Z)throw Error(`Key ${X.key} already set`);if(N1.isScalar(z.value)&&fG.isScalarValue(X.value))z.value.value=X.value;else z.value=X.value}else if(J){let Q=this.items.findIndex((Y)=>J(X,Y)<0);if(Q===-1)this.items.push(X);else this.items.splice(Q,0,X)}else this.items.push(X)}delete($){let Z=U2(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let z=U2(this.items,$)?.value;return(!Z&&N1.isScalar(z)?z.value:z)??void 0}has($){return!!U2(this.items,$)}set($,Z){this.add(new Q8.Pair($,Z),!0)}toJSON($,Z,X){let z=X?new X:Z?.mapAsMap?new Map:{};if(Z?.onCreate)Z.onCreate(z);for(let J of this.items)vG.addPairToJSMap(Z,z,J);return z}toString($,Z,X){if(!$)return JSON.stringify(this);for(let z of this.items)if(!N1.isPair(z))throw Error(`Map items must all be pairs; found ${JSON.stringify(z)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return yG.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:X,onComment:Z})}}hG.YAMLMap=C7;hG.findPair=U2});var W$=P((dG)=>{var cG=i(),E7=L1(),lG={collection:"map",default:!0,nodeClass:E7.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!cG.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,X)=>E7.YAMLMap.from($,Z,X)};dG.map=lG});var D1=P((oG)=>{var iG=X2(),nG=H3(),rG=n6(),W8=i(),sG=J0(),aG=H1();class P7 extends rG.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(W8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=Y8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let X=Y8($);if(typeof X!=="number")return;let z=this.items[X];return!Z&&W8.isScalar(z)?z.value:z}has($){let Z=Y8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let X=Y8($);if(typeof X!=="number")throw Error(`Expected a valid index, not ${$}.`);let z=this.items[X];if(W8.isScalar(z)&&sG.isScalarValue(Z))z.value=Z;else this.items[X]=Z}toJSON($,Z){let X=[];if(Z?.onCreate)Z.onCreate(X);let z=0;for(let J of this.items)X.push(aG.toJS(J,String(z++),Z));return X}toString($,Z,X){if(!$)return JSON.stringify(this);return nG.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:X,onComment:Z})}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z)){let Q=0;for(let Y of Z){if(typeof z==="function"){let W=Z instanceof Set?Y:String(Q++);Y=z.call(Z,W,Y)}J.items.push(iG.createNode(Y,void 0,X))}}return J}}function Y8($){let Z=W8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}oG.YAMLSeq=P7});var U$=P((ZV)=>{var eG=i(),w7=D1(),$V={collection:"seq",default:!0,nodeClass:w7.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!eG.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,X)=>w7.YAMLSeq.from($,Z,X)};ZV.seq=$V});var q2=P((QV)=>{var zV=Q2(),JV={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,X,z){return Z=Object.assign({actualString:!0},Z),zV.stringifyString($,Z,X,z)}};QV.string=JV});var U8=P((WV)=>{var S7=J0(),j7={identify:($)=>$==null,createNode:()=>new S7.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new S7.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&j7.test.test($)?$:Z.options.nullStr};WV.nullTag=j7});var B3=P((GV)=>{var qV=J0(),x7={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new qV.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},X){if($&&x7.test.test($)){let z=$[0]==="t"||$[0]==="T";if(Z===z)return $}return Z?X.options.trueStr:X.options.falseStr}};GV.boolTag=x7});var q$=P((HV)=>{function KV({format:$,minFractionDigits:Z,tag:X,value:z}){if(typeof z==="bigint")return String(z);let J=typeof z==="number"?z:Number(z);if(!isFinite(J))return isNaN(J)?".nan":J<0?"-.inf":".inf";let Q=Object.is(z,-0)?"-0":JSON.stringify(z);if(!$&&Z&&(!X||X==="tag:yaml.org,2002:float")&&/^-?\d/.test(Q)&&!Q.includes("e")){let Y=Q.indexOf(".");if(Y<0)Y=Q.length,Q+=".";let W=Z-(Q.length-Y-1);while(W-- >0)Q+="0"}return Q}HV.stringifyNumber=KV});var O3=P((DV)=>{var MV=J0(),M3=q$(),OV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:M3.stringifyNumber},NV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():M3.stringifyNumber($)}},LV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new MV.Scalar(parseFloat($)),X=$.indexOf(".");if(X!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-X-1;return Z},stringify:M3.stringifyNumber};DV.float=LV;DV.floatExp=NV;DV.floatNaN=OV});var L3=P((CV)=>{var b7=q$(),q8=($)=>typeof $==="bigint"||Number.isInteger($),N3=($,Z,X,{intAsBigInt:z})=>z?BigInt($):parseInt($.substring(Z),X);function k7($,Z,X){let{value:z}=$;if(q8(z)&&z>=0)return X+z.toString(Z);return b7.stringifyNumber($)}var RV={identify:($)=>q8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,X)=>N3($,2,8,X),stringify:($)=>k7($,8,"0o")},_V={identify:q8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,X)=>N3($,0,10,X),stringify:b7.stringifyNumber},FV={identify:($)=>q8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,X)=>N3($,2,16,X),stringify:($)=>k7($,16,"0x")};CV.int=_V;CV.intHex=FV;CV.intOct=RV});var y7=P((vV)=>{var SV=W$(),jV=U8(),xV=U$(),bV=q2(),kV=B3(),D3=O3(),I3=L3(),yV=[SV.map,xV.seq,bV.string,jV.nullTag,kV.boolTag,I3.intOct,I3.int,I3.intHex,D3.floatNaN,D3.floatExp,D3.float];vV.schema=yV});var g7=P((dV)=>{var fV=J0(),hV=W$(),uV=U$();function v7($){return typeof $==="bigint"||Number.isInteger($)}var G8=({value:$})=>JSON.stringify($),mV=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:G8},{identify:($)=>$==null,createNode:()=>new fV.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:G8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:G8},{identify:v7,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:X})=>X?BigInt($):parseInt($,10),stringify:({value:$})=>v7($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:G8}],cV={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},lV=[hV.map,uV.seq].concat(mV,cV);dV.schema=lV});var A3=P((rV)=>{var G2=C0("buffer"),T3=J0(),iV=Q2(),nV={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof G2.Buffer==="function")return G2.Buffer.from($,"base64");else if(typeof atob==="function"){let X=atob($.replace(/[\n\r]/g,"")),z=new Uint8Array(X.length);for(let J=0;J<X.length;++J)z[J]=X.charCodeAt(J);return z}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:X},z,J,Q){if(!X)return"";let Y=X,W;if(typeof G2.Buffer==="function")W=Y instanceof G2.Buffer?Y.toString("base64"):G2.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let q=0;q<Y.length;++q)U+=String.fromCharCode(Y[q]);W=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=T3.Scalar.BLOCK_LITERAL),Z!==T3.Scalar.QUOTE_DOUBLE){let U=Math.max(z.options.lineWidth-z.indent.length,z.options.minContentWidth),q=Math.ceil(W.length/U),G=Array(q);for(let V=0,K=0;V<q;++V,K+=U)G[V]=W.substr(K,U);W=G.join(Z===T3.Scalar.BLOCK_LITERAL?`
78
- `:" ")}return iV.stringifyString({comment:$,type:Z,value:W},z,J,Q)}};rV.binary=nV});var K8=P((eV)=>{var V8=i(),R3=O1(),aV=J0(),oV=D1();function f7($,Z){if(V8.isSeq($))for(let X=0;X<$.items.length;++X){let z=$.items[X];if(V8.isPair(z))continue;else if(V8.isMap(z)){if(z.items.length>1)Z("Each pair must have its own sequence indicator");let J=z.items[0]||new R3.Pair(new aV.Scalar(null));if(z.commentBefore)J.key.commentBefore=J.key.commentBefore?`${z.commentBefore}
77
+ ${J}${H}`}else return`${K}${Y}${V.join(" ")}${Y}${H}`}}function J8({indent:$,options:{commentString:Z}},X,z,J){if(z&&J)z=z.replace(/^\n+/,"");if(z){let Q=z8.indentComment(Z(z),$);X.push(Q.trimStart())}}cG.stringifyCollection=hG});var L1=E((rG)=>{var dG=G3(),pG=q3(),iG=n6(),N1=i(),Q8=O1(),nG=J0();function U2($,Z){let X=N1.isScalar(Z)?Z.value:Z;for(let z of $)if(N1.isPair(z)){if(z.key===Z||z.key===X)return z;if(N1.isScalar(z.key)&&z.key.value===X)return z}return}class C7 extends iG.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(N1.MAP,$);this.items=[]}static from($,Z,X){let{keepUndefined:z,replacer:J}=X,Q=new this($),Y=(W,U)=>{if(typeof J==="function")U=J.call(Z,W,U);else if(Array.isArray(J)&&!J.includes(W))return;if(U!==void 0||z)Q.items.push(Q8.createPair(W,U,X))};if(Z instanceof Map)for(let[W,U]of Z)Y(W,U);else if(Z&&typeof Z==="object")for(let W of Object.keys(Z))Y(W,Z[W]);if(typeof $.sortMapEntries==="function")Q.items.sort($.sortMapEntries);return Q}add($,Z){let X;if(N1.isPair($))X=$;else if(!$||typeof $!=="object"||!("key"in $))X=new Q8.Pair($,$?.value);else X=new Q8.Pair($.key,$.value);let z=U2(this.items,X.key),J=this.schema?.sortMapEntries;if(z){if(!Z)throw Error(`Key ${X.key} already set`);if(N1.isScalar(z.value)&&nG.isScalarValue(X.value))z.value.value=X.value;else z.value=X.value}else if(J){let Q=this.items.findIndex((Y)=>J(X,Y)<0);if(Q===-1)this.items.push(X);else this.items.splice(Q,0,X)}else this.items.push(X)}delete($){let Z=U2(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let z=U2(this.items,$)?.value;return(!Z&&N1.isScalar(z)?z.value:z)??void 0}has($){return!!U2(this.items,$)}set($,Z){this.add(new Q8.Pair($,Z),!0)}toJSON($,Z,X){let z=X?new X:Z?.mapAsMap?new Map:{};if(Z?.onCreate)Z.onCreate(z);for(let J of this.items)pG.addPairToJSMap(Z,z,J);return z}toString($,Z,X){if(!$)return JSON.stringify(this);for(let z of this.items)if(!N1.isPair(z))throw Error(`Map items must all be pairs; found ${JSON.stringify(z)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return dG.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:X,onComment:Z})}}rG.YAMLMap=C7;rG.findPair=U2});var W$=E((eG)=>{var oG=i(),P7=L1(),tG={collection:"map",default:!0,nodeClass:P7.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!oG.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,X)=>P7.YAMLMap.from($,Z,X)};eG.map=tG});var D1=E((YV)=>{var ZV=X2(),XV=G3(),zV=n6(),W8=i(),JV=J0(),QV=H1();class E7 extends zV.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(W8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=Y8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let X=Y8($);if(typeof X!=="number")return;let z=this.items[X];return!Z&&W8.isScalar(z)?z.value:z}has($){let Z=Y8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let X=Y8($);if(typeof X!=="number")throw Error(`Expected a valid index, not ${$}.`);let z=this.items[X];if(W8.isScalar(z)&&JV.isScalarValue(Z))z.value=Z;else this.items[X]=Z}toJSON($,Z){let X=[];if(Z?.onCreate)Z.onCreate(X);let z=0;for(let J of this.items)X.push(QV.toJS(J,String(z++),Z));return X}toString($,Z,X){if(!$)return JSON.stringify(this);return XV.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:X,onComment:Z})}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z)){let Q=0;for(let Y of Z){if(typeof z==="function"){let W=Z instanceof Set?Y:String(Q++);Y=z.call(Z,W,Y)}J.items.push(ZV.createNode(Y,void 0,X))}}return J}}function Y8($){let Z=W8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}YV.YAMLSeq=E7});var U$=E((GV)=>{var UV=i(),w7=D1(),qV={collection:"seq",default:!0,nodeClass:w7.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!UV.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,X)=>w7.YAMLSeq.from($,Z,X)};GV.seq=qV});var q2=E((BV)=>{var KV=Q2(),HV={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,X,z){return Z=Object.assign({actualString:!0},Z),KV.stringifyString($,Z,X,z)}};BV.string=HV});var U8=E((OV)=>{var S7=J0(),j7={identify:($)=>$==null,createNode:()=>new S7.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new S7.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&j7.test.test($)?$:Z.options.nullStr};OV.nullTag=j7});var V3=E((DV)=>{var LV=J0(),x7={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new LV.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},X){if($&&x7.test.test($)){let z=$[0]==="t"||$[0]==="T";if(Z===z)return $}return Z?X.options.trueStr:X.options.falseStr}};DV.boolTag=x7});var q$=E((AV)=>{function TV({format:$,minFractionDigits:Z,tag:X,value:z}){if(typeof z==="bigint")return String(z);let J=typeof z==="number"?z:Number(z);if(!isFinite(J))return isNaN(J)?".nan":J<0?"-.inf":".inf";let Q=Object.is(z,-0)?"-0":JSON.stringify(z);if(!$&&Z&&(!X||X==="tag:yaml.org,2002:float")&&/^-?\d/.test(Q)&&!Q.includes("e")){let Y=Q.indexOf(".");if(Y<0)Y=Q.length,Q+=".";let W=Z-(Q.length-Y-1);while(W-- >0)Q+="0"}return Q}AV.stringifyNumber=TV});var H3=E((EV)=>{var _V=J0(),K3=q$(),FV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:K3.stringifyNumber},CV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():K3.stringifyNumber($)}},PV={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new _V.Scalar(parseFloat($)),X=$.indexOf(".");if(X!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-X-1;return Z},stringify:K3.stringifyNumber};EV.float=PV;EV.floatExp=CV;EV.floatNaN=FV});var M3=E((yV)=>{var b7=q$(),q8=($)=>typeof $==="bigint"||Number.isInteger($),B3=($,Z,X,{intAsBigInt:z})=>z?BigInt($):parseInt($.substring(Z),X);function k7($,Z,X){let{value:z}=$;if(q8(z)&&z>=0)return X+z.toString(Z);return b7.stringifyNumber($)}var xV={identify:($)=>q8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,X)=>B3($,2,8,X),stringify:($)=>k7($,8,"0o")},bV={identify:q8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,X)=>B3($,0,10,X),stringify:b7.stringifyNumber},kV={identify:($)=>q8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,X)=>B3($,2,16,X),stringify:($)=>k7($,16,"0x")};yV.int=bV;yV.intHex=kV;yV.intOct=xV});var y7=E((pV)=>{var hV=W$(),uV=U8(),mV=U$(),cV=q2(),lV=V3(),O3=H3(),N3=M3(),dV=[hV.map,mV.seq,cV.string,uV.nullTag,lV.boolTag,N3.intOct,N3.int,N3.intHex,O3.floatNaN,O3.floatExp,O3.float];pV.schema=dV});var g7=E((eV)=>{var nV=J0(),rV=W$(),sV=U$();function v7($){return typeof $==="bigint"||Number.isInteger($)}var G8=({value:$})=>JSON.stringify($),aV=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:G8},{identify:($)=>$==null,createNode:()=>new nV.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:G8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:G8},{identify:v7,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:X})=>X?BigInt($):parseInt($,10),stringify:({value:$})=>v7($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:G8}],oV={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},tV=[rV.map,sV.seq].concat(aV,oV);eV.schema=tV});var D3=E((zK)=>{var G2=C0("buffer"),L3=J0(),ZK=Q2(),XK={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof G2.Buffer==="function")return G2.Buffer.from($,"base64");else if(typeof atob==="function"){let X=atob($.replace(/[\n\r]/g,"")),z=new Uint8Array(X.length);for(let J=0;J<X.length;++J)z[J]=X.charCodeAt(J);return z}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:X},z,J,Q){if(!X)return"";let Y=X,W;if(typeof G2.Buffer==="function")W=Y instanceof G2.Buffer?Y.toString("base64"):G2.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let q=0;q<Y.length;++q)U+=String.fromCharCode(Y[q]);W=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=L3.Scalar.BLOCK_LITERAL),Z!==L3.Scalar.QUOTE_DOUBLE){let U=Math.max(z.options.lineWidth-z.indent.length,z.options.minContentWidth),q=Math.ceil(W.length/U),G=Array(q);for(let V=0,K=0;V<q;++V,K+=U)G[V]=W.substr(K,U);W=G.join(Z===L3.Scalar.BLOCK_LITERAL?`
78
+ `:" ")}return ZK.stringifyString({comment:$,type:Z,value:W},z,J,Q)}};zK.binary=XK});var K8=E((UK)=>{var V8=i(),I3=O1(),QK=J0(),YK=D1();function f7($,Z){if(V8.isSeq($))for(let X=0;X<$.items.length;++X){let z=$.items[X];if(V8.isPair(z))continue;else if(V8.isMap(z)){if(z.items.length>1)Z("Each pair must have its own sequence indicator");let J=z.items[0]||new I3.Pair(new QK.Scalar(null));if(z.commentBefore)J.key.commentBefore=J.key.commentBefore?`${z.commentBefore}
79
79
  ${J.key.commentBefore}`:z.commentBefore;if(z.comment){let Q=J.value??J.key;Q.comment=Q.comment?`${z.comment}
80
- ${Q.comment}`:z.comment}z=J}$.items[X]=V8.isPair(z)?z:new R3.Pair(z)}else Z("Expected a sequence for this tag");return $}function h7($,Z,X){let{replacer:z}=X,J=new oV.YAMLSeq($);J.tag="tag:yaml.org,2002:pairs";let Q=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof z==="function")Y=z.call(Z,String(Q++),Y);let W,U;if(Array.isArray(Y))if(Y.length===2)W=Y[0],U=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let q=Object.keys(Y);if(q.length===1)W=q[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${q.length} keys`)}else W=Y;J.items.push(R3.createPair(W,U,X))}return J}var tV={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:f7,createNode:h7};eV.createPairs=h7;eV.pairs=tV;eV.resolvePairs=f7});var F3=P((QK)=>{var u7=i(),_3=H1(),V2=L1(),zK=D1(),m7=K8();class f1 extends zK.YAMLSeq{constructor(){super();this.add=V2.YAMLMap.prototype.add.bind(this),this.delete=V2.YAMLMap.prototype.delete.bind(this),this.get=V2.YAMLMap.prototype.get.bind(this),this.has=V2.YAMLMap.prototype.has.bind(this),this.set=V2.YAMLMap.prototype.set.bind(this),this.tag=f1.tag}toJSON($,Z){if(!Z)return super.toJSON($);let X=new Map;if(Z?.onCreate)Z.onCreate(X);for(let z of this.items){let J,Q;if(u7.isPair(z))J=_3.toJS(z.key,"",Z),Q=_3.toJS(z.value,J,Z);else J=_3.toJS(z,"",Z);if(X.has(J))throw Error("Ordered maps must not include duplicate keys");X.set(J,Q)}return X}static from($,Z,X){let z=m7.createPairs($,Z,X),J=new this;return J.items=z.items,J}}f1.tag="tag:yaml.org,2002:omap";var JK={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:f1,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=m7.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(u7.isScalar(J))if(z.includes(J.value))Z(`Ordered maps must not include duplicate keys: ${J.value}`);else z.push(J.value);return Object.assign(new f1,X)},createNode:($,Z,X)=>f1.from($,Z,X)};QK.YAMLOMap=f1;QK.omap=JK});var i7=P((UK)=>{var c7=J0();function l7({value:$,source:Z},X){if(Z&&($?d7:p7).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var d7={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new c7.Scalar(!0),stringify:l7},p7={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new c7.Scalar(!1),stringify:l7};UK.falseTag=p7;UK.trueTag=d7});var n7=P((MK)=>{var VK=J0(),C3=q$(),KK={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:C3.stringifyNumber},HK={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():C3.stringifyNumber($)}},BK={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new VK.Scalar(parseFloat($.replace(/_/g,""))),X=$.indexOf(".");if(X!==-1){let z=$.substring(X+1).replace(/_/g,"");if(z[z.length-1]==="0")Z.minFractionDigits=z.length}return Z},stringify:C3.stringifyNumber};MK.float=BK;MK.floatExp=HK;MK.floatNaN=KK});var s7=P((RK)=>{var r7=q$(),K2=($)=>typeof $==="bigint"||Number.isInteger($);function H8($,Z,X,{intAsBigInt:z}){let J=$[0];if(J==="-"||J==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),z){switch(X){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Y=BigInt($);return J==="-"?BigInt(-1)*Y:Y}let Q=parseInt($,X);return J==="-"?-1*Q:Q}function E3($,Z,X){let{value:z}=$;if(K2(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return r7.stringifyNumber($)}var DK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>H8($,2,2,X),stringify:($)=>E3($,2,"0b")},IK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>H8($,1,8,X),stringify:($)=>E3($,8,"0")},TK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>H8($,0,10,X),stringify:r7.stringifyNumber},AK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>H8($,2,16,X),stringify:($)=>E3($,16,"0x")};RK.int=TK;RK.intBin=DK;RK.intHex=AK;RK.intOct=IK});var P3=P((wK)=>{var O8=i(),B8=O1(),M8=L1();class h1 extends M8.YAMLMap{constructor($){super($);this.tag=h1.tag}add($){let Z;if(O8.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new B8.Pair($.key,null);else Z=new B8.Pair($,null);if(!M8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=M8.findPair(this.items,$);return!Z&&O8.isPair(X)?O8.isScalar(X.key)?X.key.value:X.key:X}set($,Z){if(typeof Z!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof Z}`);let X=M8.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new B8.Pair($))}toJSON($,Z){return super.toJSON($,Z,Set)}toString($,Z,X){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),Z,X);else throw Error("Set items must all have null values")}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z))for(let Q of Z){if(typeof z==="function")Q=z.call(Z,Q,Q);J.items.push(B8.createPair(Q,null,X))}return J}}h1.tag="tag:yaml.org,2002:set";var PK={collection:"map",identify:($)=>$ instanceof Set,nodeClass:h1,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>h1.from($,Z,X),resolve($,Z){if(O8.isMap($))if($.hasAllNullValues(!0))return Object.assign(new h1,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};wK.YAMLSet=h1;wK.set=PK});var S3=P((yK)=>{var xK=q$();function w3($,Z){let X=$[0],z=X==="-"||X==="+"?$.substring(1):$,J=(Y)=>Z?BigInt(Y):Number(Y),Q=z.replace(/_/g,"").split(":").reduce((Y,W)=>Y*J(60)+J(W),J(0));return X==="-"?J(-1)*Q:Q}function a7($){let{value:Z}=$,X=(Y)=>Y;if(typeof Z==="bigint")X=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return xK.stringifyNumber($);let z="";if(Z<0)z="-",Z*=X(-1);let J=X(60),Q=[Z%J];if(Z<60)Q.unshift(0);else if(Z=(Z-Q[0])/J,Q.unshift(Z%J),Z>=60)Z=(Z-Q[0])/J,Q.unshift(Z);return z+Q.map((Y)=>String(Y).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var bK={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,Z,{intAsBigInt:X})=>w3($,X),stringify:a7},kK={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>w3($,!1),stringify:a7},o7={identify:($)=>$ instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve($){let Z=$.match(o7.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,z,J,Q,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,q=Date.UTC(X,z-1,J,Q||0,Y||0,W||0,U),G=Z[8];if(G&&G!=="Z"){let V=w3(G,!1);if(Math.abs(V)<30)V*=60;q-=60000*V}return new Date(q)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yK.floatTime=kK;yK.intTime=bK;yK.timestamp=o7});var e7=P((sK)=>{var hK=W$(),uK=U8(),mK=U$(),cK=q2(),lK=A3(),t7=i7(),j3=n7(),N8=s7(),dK=$8(),pK=F3(),iK=K8(),nK=P3(),x3=S3(),rK=[hK.map,mK.seq,cK.string,uK.nullTag,t7.trueTag,t7.falseTag,N8.intBin,N8.intOct,N8.int,N8.intHex,j3.floatNaN,j3.floatExp,j3.float,lK.binary,dK.merge,pK.omap,iK.pairs,nK.set,x3.intTime,x3.floatTime,x3.timestamp];sK.schema=rK});var qX=P((JH)=>{var zX=W$(),oK=U8(),JX=U$(),tK=q2(),eK=B3(),b3=O3(),k3=L3(),$H=y7(),ZH=g7(),QX=A3(),H2=$8(),YX=F3(),WX=K8(),$X=e7(),UX=P3(),L8=S3(),ZX=new Map([["core",$H.schema],["failsafe",[zX.map,JX.seq,tK.string]],["json",ZH.schema],["yaml11",$X.schema],["yaml-1.1",$X.schema]]),XX={binary:QX.binary,bool:eK.boolTag,float:b3.float,floatExp:b3.floatExp,floatNaN:b3.floatNaN,floatTime:L8.floatTime,int:k3.int,intHex:k3.intHex,intOct:k3.intOct,intTime:L8.intTime,map:zX.map,merge:H2.merge,null:oK.nullTag,omap:YX.omap,pairs:WX.pairs,seq:JX.seq,set:UX.set,timestamp:L8.timestamp},XH={"tag:yaml.org,2002:binary":QX.binary,"tag:yaml.org,2002:merge":H2.merge,"tag:yaml.org,2002:omap":YX.omap,"tag:yaml.org,2002:pairs":WX.pairs,"tag:yaml.org,2002:set":UX.set,"tag:yaml.org,2002:timestamp":L8.timestamp};function zH($,Z,X){let z=ZX.get(Z);if(z&&!$)return X&&!z.includes(H2.merge)?z.concat(H2.merge):z.slice();let J=z;if(!J)if(Array.isArray($))J=[];else{let Q=Array.from(ZX.keys()).filter((Y)=>Y!=="yaml11").map((Y)=>JSON.stringify(Y)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${Q} or define customTags array`)}if(Array.isArray($))for(let Q of $)J=J.concat(Q);else if(typeof $==="function")J=$(J.slice());if(X)J=J.concat(H2.merge);return J.reduce((Q,Y)=>{let W=typeof Y==="string"?XX[Y]:Y;if(!W){let U=JSON.stringify(Y),q=Object.keys(XX).map((G)=>JSON.stringify(G)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${q}`)}if(!Q.includes(W))Q.push(W);return Q},[])}JH.coreKnownTags=XH;JH.getTags=zH});var g3=P((VH)=>{var y3=i(),WH=W$(),UH=U$(),qH=q2(),D8=qX(),GH=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class v3{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:J,sortMapEntries:Q,toStringDefaults:Y}){this.compat=Array.isArray($)?D8.getTags($,"compat"):$?D8.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=z?D8.coreKnownTags:{},this.tags=D8.getTags(Z,this.name,X),this.toStringOptions=Y??null,Object.defineProperty(this,y3.MAP,{value:WH.map}),Object.defineProperty(this,y3.SCALAR,{value:qH.string}),Object.defineProperty(this,y3.SEQ,{value:UH.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?GH:null}clone(){let $=Object.create(v3.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}VH.Schema=v3});var GX=P((MH)=>{var HH=i(),f3=Y2(),B2=z2();function BH($,Z){let X=[],z=Z.directives===!0;if(Z.directives!==!1&&$.directives){let U=$.directives.toString($);if(U)X.push(U),z=!0;else if($.directives.docStart)z=!0}if(z)X.push("---");let J=f3.createStringifyContext($,Z),{commentString:Q}=J.options;if($.commentBefore){if(X.length!==1)X.unshift("");let U=Q($.commentBefore);X.unshift(B2.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(HH.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let G=Q($.contents.commentBefore);X.push(B2.indentComment(G,""))}J.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,q=f3.stringify($.contents,J,()=>W=null,U);if(W)q+=B2.lineComment(q,"",Q(W));if((q[0]==="|"||q[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${q}`;else X.push(q)}else X.push(f3.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let U=Q($.comment);if(U.includes(`
80
+ ${Q.comment}`:z.comment}z=J}$.items[X]=V8.isPair(z)?z:new I3.Pair(z)}else Z("Expected a sequence for this tag");return $}function h7($,Z,X){let{replacer:z}=X,J=new YK.YAMLSeq($);J.tag="tag:yaml.org,2002:pairs";let Q=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof z==="function")Y=z.call(Z,String(Q++),Y);let W,U;if(Array.isArray(Y))if(Y.length===2)W=Y[0],U=Y[1];else throw TypeError(`Expected [key, value] tuple: ${Y}`);else if(Y&&Y instanceof Object){let q=Object.keys(Y);if(q.length===1)W=q[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${q.length} keys`)}else W=Y;J.items.push(I3.createPair(W,U,X))}return J}var WK={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:f7,createNode:h7};UK.createPairs=h7;UK.pairs=WK;UK.resolvePairs=f7});var A3=E((BK)=>{var u7=i(),T3=H1(),V2=L1(),KK=D1(),m7=K8();class f1 extends KK.YAMLSeq{constructor(){super();this.add=V2.YAMLMap.prototype.add.bind(this),this.delete=V2.YAMLMap.prototype.delete.bind(this),this.get=V2.YAMLMap.prototype.get.bind(this),this.has=V2.YAMLMap.prototype.has.bind(this),this.set=V2.YAMLMap.prototype.set.bind(this),this.tag=f1.tag}toJSON($,Z){if(!Z)return super.toJSON($);let X=new Map;if(Z?.onCreate)Z.onCreate(X);for(let z of this.items){let J,Q;if(u7.isPair(z))J=T3.toJS(z.key,"",Z),Q=T3.toJS(z.value,J,Z);else J=T3.toJS(z,"",Z);if(X.has(J))throw Error("Ordered maps must not include duplicate keys");X.set(J,Q)}return X}static from($,Z,X){let z=m7.createPairs($,Z,X),J=new this;return J.items=z.items,J}}f1.tag="tag:yaml.org,2002:omap";var HK={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:f1,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=m7.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(u7.isScalar(J))if(z.includes(J.value))Z(`Ordered maps must not include duplicate keys: ${J.value}`);else z.push(J.value);return Object.assign(new f1,X)},createNode:($,Z,X)=>f1.from($,Z,X)};BK.YAMLOMap=f1;BK.omap=HK});var i7=E((NK)=>{var c7=J0();function l7({value:$,source:Z},X){if(Z&&($?d7:p7).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var d7={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new c7.Scalar(!0),stringify:l7},p7={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new c7.Scalar(!1),stringify:l7};NK.falseTag=p7;NK.trueTag=d7});var n7=E((_K)=>{var IK=J0(),R3=q$(),TK={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:R3.stringifyNumber},AK={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():R3.stringifyNumber($)}},RK={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new IK.Scalar(parseFloat($.replace(/_/g,""))),X=$.indexOf(".");if(X!==-1){let z=$.substring(X+1).replace(/_/g,"");if(z[z.length-1]==="0")Z.minFractionDigits=z.length}return Z},stringify:R3.stringifyNumber};_K.float=RK;_K.floatExp=AK;_K.floatNaN=TK});var s7=E((xK)=>{var r7=q$(),K2=($)=>typeof $==="bigint"||Number.isInteger($);function H8($,Z,X,{intAsBigInt:z}){let J=$[0];if(J==="-"||J==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),z){switch(X){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Y=BigInt($);return J==="-"?BigInt(-1)*Y:Y}let Q=parseInt($,X);return J==="-"?-1*Q:Q}function _3($,Z,X){let{value:z}=$;if(K2(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return r7.stringifyNumber($)}var EK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>H8($,2,2,X),stringify:($)=>_3($,2,"0b")},wK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>H8($,1,8,X),stringify:($)=>_3($,8,"0")},SK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>H8($,0,10,X),stringify:r7.stringifyNumber},jK={identify:K2,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>H8($,2,16,X),stringify:($)=>_3($,16,"0x")};xK.int=SK;xK.intBin=EK;xK.intHex=jK;xK.intOct=wK});var F3=E((fK)=>{var O8=i(),B8=O1(),M8=L1();class h1 extends M8.YAMLMap{constructor($){super($);this.tag=h1.tag}add($){let Z;if(O8.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new B8.Pair($.key,null);else Z=new B8.Pair($,null);if(!M8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=M8.findPair(this.items,$);return!Z&&O8.isPair(X)?O8.isScalar(X.key)?X.key.value:X.key:X}set($,Z){if(typeof Z!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof Z}`);let X=M8.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new B8.Pair($))}toJSON($,Z){return super.toJSON($,Z,Set)}toString($,Z,X){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),Z,X);else throw Error("Set items must all have null values")}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z))for(let Q of Z){if(typeof z==="function")Q=z.call(Z,Q,Q);J.items.push(B8.createPair(Q,null,X))}return J}}h1.tag="tag:yaml.org,2002:set";var gK={collection:"map",identify:($)=>$ instanceof Set,nodeClass:h1,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>h1.from($,Z,X),resolve($,Z){if(O8.isMap($))if($.hasAllNullValues(!0))return Object.assign(new h1,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};fK.YAMLSet=h1;fK.set=gK});var P3=E((dK)=>{var mK=q$();function C3($,Z){let X=$[0],z=X==="-"||X==="+"?$.substring(1):$,J=(Y)=>Z?BigInt(Y):Number(Y),Q=z.replace(/_/g,"").split(":").reduce((Y,W)=>Y*J(60)+J(W),J(0));return X==="-"?J(-1)*Q:Q}function a7($){let{value:Z}=$,X=(Y)=>Y;if(typeof Z==="bigint")X=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return mK.stringifyNumber($);let z="";if(Z<0)z="-",Z*=X(-1);let J=X(60),Q=[Z%J];if(Z<60)Q.unshift(0);else if(Z=(Z-Q[0])/J,Q.unshift(Z%J),Z>=60)Z=(Z-Q[0])/J,Q.unshift(Z);return z+Q.map((Y)=>String(Y).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var cK={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,Z,{intAsBigInt:X})=>C3($,X),stringify:a7},lK={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>C3($,!1),stringify:a7},o7={identify:($)=>$ instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve($){let Z=$.match(o7.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,z,J,Q,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,q=Date.UTC(X,z-1,J,Q||0,Y||0,W||0,U),G=Z[8];if(G&&G!=="Z"){let V=C3(G,!1);if(Math.abs(V)<30)V*=60;q-=60000*V}return new Date(q)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};dK.floatTime=lK;dK.intTime=cK;dK.timestamp=o7});var e7=E((JH)=>{var rK=W$(),sK=U8(),aK=U$(),oK=q2(),tK=D3(),t7=i7(),E3=n7(),N8=s7(),eK=$8(),$H=A3(),ZH=K8(),XH=F3(),w3=P3(),zH=[rK.map,aK.seq,oK.string,sK.nullTag,t7.trueTag,t7.falseTag,N8.intBin,N8.intOct,N8.int,N8.intHex,E3.floatNaN,E3.floatExp,E3.float,tK.binary,eK.merge,$H.omap,ZH.pairs,XH.set,w3.intTime,w3.floatTime,w3.timestamp];JH.schema=zH});var qX=E((HH)=>{var zX=W$(),YH=U8(),JX=U$(),WH=q2(),UH=V3(),S3=H3(),j3=M3(),qH=y7(),GH=g7(),QX=D3(),H2=$8(),YX=A3(),WX=K8(),$X=e7(),UX=F3(),L8=P3(),ZX=new Map([["core",qH.schema],["failsafe",[zX.map,JX.seq,WH.string]],["json",GH.schema],["yaml11",$X.schema],["yaml-1.1",$X.schema]]),XX={binary:QX.binary,bool:UH.boolTag,float:S3.float,floatExp:S3.floatExp,floatNaN:S3.floatNaN,floatTime:L8.floatTime,int:j3.int,intHex:j3.intHex,intOct:j3.intOct,intTime:L8.intTime,map:zX.map,merge:H2.merge,null:YH.nullTag,omap:YX.omap,pairs:WX.pairs,seq:JX.seq,set:UX.set,timestamp:L8.timestamp},VH={"tag:yaml.org,2002:binary":QX.binary,"tag:yaml.org,2002:merge":H2.merge,"tag:yaml.org,2002:omap":YX.omap,"tag:yaml.org,2002:pairs":WX.pairs,"tag:yaml.org,2002:set":UX.set,"tag:yaml.org,2002:timestamp":L8.timestamp};function KH($,Z,X){let z=ZX.get(Z);if(z&&!$)return X&&!z.includes(H2.merge)?z.concat(H2.merge):z.slice();let J=z;if(!J)if(Array.isArray($))J=[];else{let Q=Array.from(ZX.keys()).filter((Y)=>Y!=="yaml11").map((Y)=>JSON.stringify(Y)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${Q} or define customTags array`)}if(Array.isArray($))for(let Q of $)J=J.concat(Q);else if(typeof $==="function")J=$(J.slice());if(X)J=J.concat(H2.merge);return J.reduce((Q,Y)=>{let W=typeof Y==="string"?XX[Y]:Y;if(!W){let U=JSON.stringify(Y),q=Object.keys(XX).map((G)=>JSON.stringify(G)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${q}`)}if(!Q.includes(W))Q.push(W);return Q},[])}HH.coreKnownTags=VH;HH.getTags=KH});var k3=E((IH)=>{var x3=i(),OH=W$(),NH=U$(),LH=q2(),D8=qX(),DH=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class b3{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:J,sortMapEntries:Q,toStringDefaults:Y}){this.compat=Array.isArray($)?D8.getTags($,"compat"):$?D8.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=z?D8.coreKnownTags:{},this.tags=D8.getTags(Z,this.name,X),this.toStringOptions=Y??null,Object.defineProperty(this,x3.MAP,{value:OH.map}),Object.defineProperty(this,x3.SCALAR,{value:LH.string}),Object.defineProperty(this,x3.SEQ,{value:NH.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?DH:null}clone(){let $=Object.create(b3.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}IH.Schema=b3});var GX=E((_H)=>{var AH=i(),y3=Y2(),B2=z2();function RH($,Z){let X=[],z=Z.directives===!0;if(Z.directives!==!1&&$.directives){let U=$.directives.toString($);if(U)X.push(U),z=!0;else if($.directives.docStart)z=!0}if(z)X.push("---");let J=y3.createStringifyContext($,Z),{commentString:Q}=J.options;if($.commentBefore){if(X.length!==1)X.unshift("");let U=Q($.commentBefore);X.unshift(B2.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(AH.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let G=Q($.contents.commentBefore);X.push(B2.indentComment(G,""))}J.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,q=y3.stringify($.contents,J,()=>W=null,U);if(W)q+=B2.lineComment(q,"",Q(W));if((q[0]==="|"||q[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${q}`;else X.push(q)}else X.push(y3.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let U=Q($.comment);if(U.includes(`
81
81
  `))X.push("..."),X.push(B2.indentComment(U,""));else X.push(`... ${U}`)}else X.push("...");else{let U=$.comment;if(U&&Y)U=U.replace(/^\n+/,"");if(U){if((!Y||W)&&X[X.length-1]!=="")X.push("");X.push(B2.indentComment(Q(U),""))}}return X.join(`
82
82
  `)+`
83
- `}MH.stringifyDocument=BH});var M2=P((_H)=>{var NH=Z2(),G$=n6(),y0=i(),LH=O1(),DH=H1(),IH=g3(),TH=GX(),h3=d6(),AH=J3(),RH=X2(),u3=z3();class m3{constructor($,Z,X){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,y0.NODE_TYPE,{value:y0.DOC});let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z,Z=void 0;let J=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},X);this.options=J;let{version:Q}=J;if(X?._directives){if(this.directives=X._directives.atDocument(),this.directives.yaml.explicit)Q=this.directives.yaml.version}else this.directives=new u3.Directives({version:Q});this.setSchema(Q,X),this.contents=$===void 0?null:this.createNode($,z,X)}clone(){let $=Object.create(m3.prototype,{[y0.NODE_TYPE]:{value:y0.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=y0.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(V$(this.contents))this.contents.add($)}addIn($,Z){if(V$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let X=h3.anchorNames(this);$.anchor=!Z||X.has(Z)?h3.findNewAnchor(Z||"a",X):Z}return new NH.Alias($.anchor)}createNode($,Z,X){let z=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),z=Z;else if(Array.isArray(Z)){let B=(T)=>typeof T==="number"||T instanceof String||T instanceof Number,O=Z.filter(B).map(String);if(O.length>0)Z=Z.concat(O);z=Z}else if(X===void 0&&Z)X=Z,Z=void 0;let{aliasDuplicateObjects:J,anchorPrefix:Q,flow:Y,keepUndefined:W,onTagObj:U,tag:q}=X??{},{onAnchor:G,setAnchors:V,sourceObjects:K}=h3.createNodeAnchors(this,Q||"a"),H={aliasDuplicateObjects:J??!0,keepUndefined:W??!1,onAnchor:G,onTagObj:U,replacer:z,schema:this.schema,sourceObjects:K},L=RH.createNode($,q,H);if(Y&&y0.isCollection(L))L.flow=!0;return V(),L}createPair($,Z,X={}){let z=this.createNode($,null,X),J=this.createNode(Z,null,X);return new LH.Pair(z,J)}delete($){return V$(this.contents)?this.contents.delete($):!1}deleteIn($){if(G$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return V$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return y0.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(G$.isEmptyPath($))return!Z&&y0.isScalar(this.contents)?this.contents.value:this.contents;return y0.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return y0.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(G$.isEmptyPath($))return this.contents!==void 0;return y0.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=G$.collectionFromPath(this.schema,[$],Z);else if(V$(this.contents))this.contents.set($,Z)}setIn($,Z){if(G$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=G$.collectionFromPath(this.schema,Array.from($),Z);else if(V$(this.contents))this.contents.setIn($,Z)}setSchema($,Z={}){if(typeof $==="number")$=String($);let X;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new u3.Directives({version:"1.1"});X={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new u3.Directives({version:$});X={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;X=null;break;default:{let z=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${z}`)}}if(Z.schema instanceof Object)this.schema=Z.schema;else if(X)this.schema=new IH.Schema(Object.assign(X,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:X,maxAliasCount:z,onAnchor:J,reviver:Q}={}){let Y={anchors:new Map,doc:this,keep:!$,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},W=DH.toJS(this.contents,Z??"",Y);if(typeof J==="function")for(let{count:U,res:q}of Y.anchors.values())J(q,U);return typeof Q==="function"?AH.applyReviver(Q,{"":W},"",W):W}toJSON($,Z){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:Z})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let Z=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${Z}`)}return TH.stringifyDocument(this,$)}}function V$($){if(y0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}_H.Document=m3});var O2=P((EH)=>{class I8 extends Error{constructor($,Z,X,z){super();this.name=$,this.code=X,this.message=z,this.pos=Z}}class VX extends I8{constructor($,Z,X){super("YAMLParseError",$,Z,X)}}class KX extends I8{constructor($,Z,X){super("YAMLWarning",$,Z,X)}}var CH=($,Z)=>(X)=>{if(X.pos[0]===-1)return;X.linePos=X.pos.map((W)=>Z.linePos(W));let{line:z,col:J}=X.linePos[0];X.message+=` at line ${z}, column ${J}`;let Q=J-1,Y=$.substring(Z.lineStarts[z-1],Z.lineStarts[z]).replace(/[\n\r]+$/,"");if(Q>=60&&Y.length>80){let W=Math.min(Q-39,Y.length-79);Y="…"+Y.substring(W),Q-=W-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(z>1&&/^ *$/.test(Y.substring(0,Q))){let W=$.substring(Z.lineStarts[z-2],Z.lineStarts[z-1]);if(W.length>80)W=W.substring(0,79)+`…
83
+ `}_H.stringifyDocument=RH});var M2=E((bH)=>{var CH=Z2(),G$=n6(),y0=i(),PH=O1(),EH=H1(),wH=k3(),SH=GX(),v3=d6(),jH=Z3(),xH=X2(),g3=$3();class f3{constructor($,Z,X){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,y0.NODE_TYPE,{value:y0.DOC});let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z,Z=void 0;let J=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},X);this.options=J;let{version:Q}=J;if(X?._directives){if(this.directives=X._directives.atDocument(),this.directives.yaml.explicit)Q=this.directives.yaml.version}else this.directives=new g3.Directives({version:Q});this.setSchema(Q,X),this.contents=$===void 0?null:this.createNode($,z,X)}clone(){let $=Object.create(f3.prototype,{[y0.NODE_TYPE]:{value:y0.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=y0.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(V$(this.contents))this.contents.add($)}addIn($,Z){if(V$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let X=v3.anchorNames(this);$.anchor=!Z||X.has(Z)?v3.findNewAnchor(Z||"a",X):Z}return new CH.Alias($.anchor)}createNode($,Z,X){let z=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),z=Z;else if(Array.isArray(Z)){let B=(T)=>typeof T==="number"||T instanceof String||T instanceof Number,O=Z.filter(B).map(String);if(O.length>0)Z=Z.concat(O);z=Z}else if(X===void 0&&Z)X=Z,Z=void 0;let{aliasDuplicateObjects:J,anchorPrefix:Q,flow:Y,keepUndefined:W,onTagObj:U,tag:q}=X??{},{onAnchor:G,setAnchors:V,sourceObjects:K}=v3.createNodeAnchors(this,Q||"a"),H={aliasDuplicateObjects:J??!0,keepUndefined:W??!1,onAnchor:G,onTagObj:U,replacer:z,schema:this.schema,sourceObjects:K},L=xH.createNode($,q,H);if(Y&&y0.isCollection(L))L.flow=!0;return V(),L}createPair($,Z,X={}){let z=this.createNode($,null,X),J=this.createNode(Z,null,X);return new PH.Pair(z,J)}delete($){return V$(this.contents)?this.contents.delete($):!1}deleteIn($){if(G$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return V$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return y0.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(G$.isEmptyPath($))return!Z&&y0.isScalar(this.contents)?this.contents.value:this.contents;return y0.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return y0.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(G$.isEmptyPath($))return this.contents!==void 0;return y0.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=G$.collectionFromPath(this.schema,[$],Z);else if(V$(this.contents))this.contents.set($,Z)}setIn($,Z){if(G$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=G$.collectionFromPath(this.schema,Array.from($),Z);else if(V$(this.contents))this.contents.setIn($,Z)}setSchema($,Z={}){if(typeof $==="number")$=String($);let X;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new g3.Directives({version:"1.1"});X={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new g3.Directives({version:$});X={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;X=null;break;default:{let z=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${z}`)}}if(Z.schema instanceof Object)this.schema=Z.schema;else if(X)this.schema=new wH.Schema(Object.assign(X,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:X,maxAliasCount:z,onAnchor:J,reviver:Q}={}){let Y={anchors:new Map,doc:this,keep:!$,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},W=EH.toJS(this.contents,Z??"",Y);if(typeof J==="function")for(let{count:U,res:q}of Y.anchors.values())J(q,U);return typeof Q==="function"?jH.applyReviver(Q,{"":W},"",W):W}toJSON($,Z){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:Z})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let Z=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${Z}`)}return SH.stringifyDocument(this,$)}}function V$($){if(y0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}bH.Document=f3});var O2=E((vH)=>{class I8 extends Error{constructor($,Z,X,z){super();this.name=$,this.code=X,this.message=z,this.pos=Z}}class VX extends I8{constructor($,Z,X){super("YAMLParseError",$,Z,X)}}class KX extends I8{constructor($,Z,X){super("YAMLWarning",$,Z,X)}}var yH=($,Z)=>(X)=>{if(X.pos[0]===-1)return;X.linePos=X.pos.map((W)=>Z.linePos(W));let{line:z,col:J}=X.linePos[0];X.message+=` at line ${z}, column ${J}`;let Q=J-1,Y=$.substring(Z.lineStarts[z-1],Z.lineStarts[z]).replace(/[\n\r]+$/,"");if(Q>=60&&Y.length>80){let W=Math.min(Q-39,Y.length-79);Y="…"+Y.substring(W),Q-=W-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(z>1&&/^ *$/.test(Y.substring(0,Q))){let W=$.substring(Z.lineStarts[z-2],Z.lineStarts[z-1]);if(W.length>80)W=W.substring(0,79)+`…
84
84
  `;Y=W+Y}if(/[^ ]/.test(Y)){let W=1,U=X.linePos[1];if(U?.line===z&&U.col>J)W=Math.max(1,Math.min(U.col-J,80-Q));let q=" ".repeat(Q)+"^".repeat(W);X.message+=`:
85
85
 
86
86
  ${Y}
87
87
  ${q}
88
- `}};EH.YAMLError=I8;EH.YAMLParseError=VX;EH.YAMLWarning=KX;EH.prettifyError=CH});var N2=P((bH)=>{function xH($,{flow:Z,indicator:X,next:z,offset:J,onError:Q,parentIndent:Y,startOnNewline:W}){let U=!1,q=W,G=W,V="",K="",H=!1,L=!1,B=null,O=null,T=null,j=null,S=null,b=null,y=null;for(let _ of $){if(L){if(_.type!=="space"&&_.type!=="newline"&&_.type!=="comma")Q(_.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(q&&_.type!=="comment"&&_.type!=="newline")Q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(_.type){case"space":if(!Z&&(X!=="doc-start"||z?.type!=="flow-collection")&&_.source.includes("\t"))B=_;G=!0;break;case"comment":{if(!G)Q(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let n=_.source.substring(1)||" ";if(!V)V=n;else V+=K+n;K="",q=!1;break}case"newline":if(q){if(V)V+=_.source;else if(!b||X!=="seq-item-ind")U=!0}else K+=_.source;if(q=!0,H=!0,O||T)j=_;G=!0;break;case"anchor":if(O)Q(_,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(_.source.endsWith(":"))Q(_.offset+_.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);O=_,y??(y=_.offset),q=!1,G=!1,L=!0;break;case"tag":{if(T)Q(_,"MULTIPLE_TAGS","A node can have at most one tag");T=_,y??(y=_.offset),q=!1,G=!1,L=!0;break}case X:if(O||T)Q(_,"BAD_PROP_ORDER",`Anchors and tags must be after the ${_.source} indicator`);if(b)Q(_,"UNEXPECTED_TOKEN",`Unexpected ${_.source} in ${Z??"collection"}`);b=_,q=X==="seq-item-ind"||X==="explicit-key-ind",G=!1;break;case"comma":if(Z){if(S)Q(_,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);S=_,q=!1,G=!1;break}default:Q(_,"UNEXPECTED_TOKEN",`Unexpected ${_.type} token`),q=!1,G=!1}}let x=$[$.length-1],c=x?x.offset+x.source.length:J;if(L&&z&&z.type!=="space"&&z.type!=="newline"&&z.type!=="comma"&&(z.type!=="scalar"||z.source!==""))Q(z.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(q&&B.indent<=Y||z?.type==="block-map"||z?.type==="block-seq"))Q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:S,found:b,spaceBefore:U,comment:V,hasNewline:H,anchor:O,tag:T,newlineAfterProp:j,end:c,start:y??c}}bH.resolveProps=xH});var T8=P((yH)=>{function c3($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
89
- `))return!0;if($.end){for(let Z of $.end)if(Z.type==="newline")return!0}return!1;case"flow-collection":for(let Z of $.items){for(let X of Z.start)if(X.type==="newline")return!0;if(Z.sep){for(let X of Z.sep)if(X.type==="newline")return!0}if(c3(Z.key)||c3(Z.value))return!0}return!1;default:return!0}}yH.containsNewline=c3});var l3=P((hH)=>{var gH=T8();function fH($,Z,X){if(Z?.type==="flow-collection"){let z=Z.end[0];if(z.indent===$&&(z.source==="]"||z.source==="}")&&gH.containsNewline(Z))X(z,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}hH.flowIndentCheck=fH});var d3=P((cH)=>{var HX=i();function mH($,Z,X){let{uniqueKeys:z}=$.options;if(z===!1)return!1;let J=typeof z==="function"?z:(Q,Y)=>Q===Y||HX.isScalar(Q)&&HX.isScalar(Y)&&Q.value===Y.value;return Z.some((Q)=>J(Q.key,X))}cH.mapIncludes=mH});var LX=P((rH)=>{var BX=O1(),dH=L1(),MX=N2(),pH=T8(),OX=l3(),iH=d3(),NX="All mapping items must start at the same column";function nH({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??dH.YAMLMap)(X.schema);if(X.atRoot)X.atRoot=!1;let U=z.offset,q=null;for(let G of z.items){let{start:V,key:K,sep:H,value:L}=G,B=MX.resolveProps(V,{indicator:"explicit-key-ind",next:K??H?.[0],offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0}),O=!B.found;if(O){if(K){if(K.type==="block-seq")J(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in K&&K.indent!==z.indent)J(U,"BAD_INDENT",NX)}if(!B.anchor&&!B.tag&&!H){if(q=B.end,B.comment)if(W.comment)W.comment+=`
90
- `+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||pH.containsNewline(K))J(K??V[V.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==z.indent)J(U,"BAD_INDENT",NX);X.atKey=!0;let T=B.end,j=K?$(X,K,B,J):Z(X,T,V,null,B,J);if(X.schema.compat)OX.flowIndentCheck(z.indent,K,J);if(X.atKey=!1,iH.mapIncludes(X,W.items,j))J(T,"DUPLICATE_KEY","Map keys must be unique");let S=MX.resolveProps(H??[],{indicator:"map-value-ind",next:L,offset:j.range[2],onError:J,parentIndent:z.indent,startOnNewline:!K||K.type==="block-scalar"});if(U=S.end,S.found){if(O){if(L?.type==="block-map"&&!S.hasNewline)J(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(X.options.strict&&B.start<S.found.offset-1024)J(j.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let b=L?$(X,L,S,J):Z(X,U,H,null,S,J);if(X.schema.compat)OX.flowIndentCheck(z.indent,L,J);U=b.range[2];let y=new BX.Pair(j,b);if(X.options.keepSourceTokens)y.srcToken=G;W.items.push(y)}else{if(O)J(j.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(S.comment)if(j.comment)j.comment+=`
91
- `+S.comment;else j.comment=S.comment;let b=new BX.Pair(j);if(X.options.keepSourceTokens)b.srcToken=G;W.items.push(b)}}if(q&&q<U)J(q,"IMPOSSIBLE","Map comment with trailing content");return W.range=[z.offset,U,q??U],W}rH.resolveBlockMap=nH});var DX=P(($B)=>{var aH=D1(),oH=N2(),tH=l3();function eH({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??aH.YAMLSeq)(X.schema);if(X.atRoot)X.atRoot=!1;if(X.atKey)X.atKey=!1;let U=z.offset,q=null;for(let{start:G,value:V}of z.items){let K=oH.resolveProps(G,{indicator:"seq-item-ind",next:V,offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0});if(!K.found)if(K.anchor||K.tag||V)if(V?.type==="block-seq")J(K.end,"BAD_INDENT","All sequence items must start at the same column");else J(U,"MISSING_CHAR","Sequence item without - indicator");else{if(q=K.end,K.comment)W.comment=K.comment;continue}let H=V?$(X,V,K,J):Z(X,K.end,G,null,K,J);if(X.schema.compat)tH.flowIndentCheck(z.indent,V,J);U=H.range[2],W.items.push(H)}return W.range=[z.offset,U,q??U],W}$B.resolveBlockSeq=eH});var K$=P((zB)=>{function XB($,Z,X,z){let J="";if($){let Q=!1,Y="";for(let W of $){let{source:U,type:q}=W;switch(q){case"space":Q=!0;break;case"comment":{if(X&&!Q)z(W,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let G=U.substring(1)||" ";if(!J)J=G;else J+=Y+G;Y="";break}case"newline":if(J)Y+=U;Q=!0;break;default:z(W,"UNEXPECTED_TOKEN",`Unexpected ${q} at node end`)}Z+=U.length}}return{comment:J,offset:Z}}zB.resolveEnd=XB});var AX=P((KB)=>{var QB=i(),YB=O1(),IX=L1(),WB=D1(),UB=K$(),TX=N2(),qB=T8(),GB=d3(),p3="Block collections are not allowed within flow collections",i3=($)=>$&&($.type==="block-map"||$.type==="block-seq");function VB({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let Y=z.start.source==="{",W=Y?"flow map":"flow sequence",q=new(Q?.nodeClass??(Y?IX.YAMLMap:WB.YAMLSeq))(X.schema);q.flow=!0;let G=X.atRoot;if(G)X.atRoot=!1;if(X.atKey)X.atKey=!1;let V=z.offset+z.start.source.length;for(let O=0;O<z.items.length;++O){let T=z.items[O],{start:j,key:S,sep:b,value:y}=T,x=TX.resolveProps(j,{flow:W,indicator:"explicit-key-ind",next:S??b?.[0],offset:V,onError:J,parentIndent:z.indent,startOnNewline:!1});if(!x.found){if(!x.anchor&&!x.tag&&!b&&!y){if(O===0&&x.comma)J(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(O<z.items.length-1)J(x.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(x.comment)if(q.comment)q.comment+=`
92
- `+x.comment;else q.comment=x.comment;V=x.end;continue}if(!Y&&X.options.strict&&qB.containsNewline(S))J(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(O===0){if(x.comma)J(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!x.comma)J(x.start,"MISSING_CHAR",`Missing , between ${W} items`);if(x.comment){let c="";$:for(let _ of j)switch(_.type){case"comma":case"space":break;case"comment":c=_.source.substring(1);break $;default:break $}if(c){let _=q.items[q.items.length-1];if(QB.isPair(_))_=_.value??_.key;if(_.comment)_.comment+=`
93
- `+c;else _.comment=c;x.comment=x.comment.substring(c.length+1)}}}if(!Y&&!b&&!x.found){let c=y?$(X,y,x,J):Z(X,x.end,b,null,x,J);if(q.items.push(c),V=c.range[2],i3(y))J(c.range,"BLOCK_IN_FLOW",p3)}else{X.atKey=!0;let c=x.end,_=S?$(X,S,x,J):Z(X,c,j,null,x,J);if(i3(S))J(_.range,"BLOCK_IN_FLOW",p3);X.atKey=!1;let n=TX.resolveProps(b??[],{flow:W,indicator:"map-value-ind",next:y,offset:_.range[2],onError:J,parentIndent:z.indent,startOnNewline:!1});if(n.found){if(!Y&&!x.found&&X.options.strict){if(b)for(let E of b){if(E===n.found)break;if(E.type==="newline"){J(E,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(x.start<n.found.offset-1024)J(n.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(y)if("source"in y&&y.source?.[0]===":")J(y,"MISSING_CHAR",`Missing space after : in ${W}`);else J(n.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let p=y?$(X,y,n,J):n.found?Z(X,n.end,b,null,n,J):null;if(p){if(i3(y))J(p.range,"BLOCK_IN_FLOW",p3)}else if(n.comment)if(_.comment)_.comment+=`
94
- `+n.comment;else _.comment=n.comment;let A0=new YB.Pair(_,p);if(X.options.keepSourceTokens)A0.srcToken=T;if(Y){let E=q;if(GB.mapIncludes(X,E.items,_))J(c,"DUPLICATE_KEY","Map keys must be unique");E.items.push(A0)}else{let E=new IX.YAMLMap(X.schema);E.flow=!0,E.items.push(A0);let d=(p??_).range;E.range=[_.range[0],d[1],d[2]],q.items.push(E)}V=p?p.range[2]:n.end}}let K=Y?"}":"]",[H,...L]=z.end,B=V;if(H?.source===K)B=H.offset+H.source.length;else{let O=W[0].toUpperCase()+W.substring(1),T=G?`${O} must end with a ${K}`:`${O} in block collection must be sufficiently indented and end with a ${K}`;if(J(V,G?"MISSING_CHAR":"BAD_INDENT",T),H&&H.source.length!==1)L.unshift(H)}if(L.length>0){let O=UB.resolveEnd(L,B,X.options.strict,J);if(O.comment)if(q.comment)q.comment+=`
95
- `+O.comment;else q.comment=O.comment;q.range=[z.offset,B,O.offset]}else q.range=[z.offset,B,B];return q}KB.resolveFlowCollection=VB});var RX=P((AB)=>{var BB=i(),MB=J0(),OB=L1(),NB=D1(),LB=LX(),DB=DX(),IB=AX();function n3($,Z,X,z,J,Q){let Y=X.type==="block-map"?LB.resolveBlockMap($,Z,X,z,Q):X.type==="block-seq"?DB.resolveBlockSeq($,Z,X,z,Q):IB.resolveFlowCollection($,Z,X,z,Q),W=Y.constructor;if(J==="!"||J===W.tagName)return Y.tag=W.tagName,Y;if(J)Y.tag=J;return Y}function TB($,Z,X,z,J){let Q=z.tag,Y=!Q?null:Z.directives.tagName(Q.source,(K)=>J(Q,"TAG_RESOLVE_FAILED",K));if(X.type==="block-seq"){let{anchor:K,newlineAfterProp:H}=z,L=K&&Q?K.offset>Q.offset?K:Q:K??Q;if(L&&(!H||H.offset<L.offset))J(L,"MISSING_CHAR","Missing newline after block sequence props")}let W=X.type==="block-map"?"map":X.type==="block-seq"?"seq":X.start.source==="{"?"map":"seq";if(!Q||!Y||Y==="!"||Y===OB.YAMLMap.tagName&&W==="map"||Y===NB.YAMLSeq.tagName&&W==="seq")return n3($,Z,X,J,Y);let U=Z.schema.tags.find((K)=>K.tag===Y&&K.collection===W);if(!U){let K=Z.schema.knownTags[Y];if(K?.collection===W)Z.schema.tags.push(Object.assign({},K,{default:!1})),U=K;else{if(K)J(Q,"BAD_COLLECTION_TYPE",`${K.tag} used for ${W} collection, but expects ${K.collection??"scalar"}`,!0);else J(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return n3($,Z,X,J,Y)}}let q=n3($,Z,X,J,Y,U),G=U.resolve?.(q,(K)=>J(Q,"TAG_RESOLVE_FAILED",K),Z.options)??q,V=BB.isNode(G)?G:new MB.Scalar(G);if(V.range=q.range,V.tag=Y,U?.format)V.format=U.format;return V}AB.composeCollection=TB});var s3=P((EB)=>{var r3=J0();function _B($,Z,X){let z=Z.offset,J=FB(Z,$.options.strict,X);if(!J)return{value:"",type:null,comment:"",range:[z,z,z]};let Q=J.mode===">"?r3.Scalar.BLOCK_FOLDED:r3.Scalar.BLOCK_LITERAL,Y=Z.source?CB(Z.source):[],W=Y.length;for(let B=Y.length-1;B>=0;--B){let O=Y[B][1];if(O===""||O==="\r")W=B;else break}if(W===0){let B=J.chomp==="+"&&Y.length>0?`
88
+ `}};vH.YAMLError=I8;vH.YAMLParseError=VX;vH.YAMLWarning=KX;vH.prettifyError=yH});var N2=E((cH)=>{function mH($,{flow:Z,indicator:X,next:z,offset:J,onError:Q,parentIndent:Y,startOnNewline:W}){let U=!1,q=W,G=W,V="",K="",H=!1,L=!1,B=null,O=null,T=null,j=null,S=null,b=null,y=null;for(let _ of $){if(L){if(_.type!=="space"&&_.type!=="newline"&&_.type!=="comma")Q(_.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(q&&_.type!=="comment"&&_.type!=="newline")Q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(_.type){case"space":if(!Z&&(X!=="doc-start"||z?.type!=="flow-collection")&&_.source.includes("\t"))B=_;G=!0;break;case"comment":{if(!G)Q(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let n=_.source.substring(1)||" ";if(!V)V=n;else V+=K+n;K="",q=!1;break}case"newline":if(q){if(V)V+=_.source;else if(!b||X!=="seq-item-ind")U=!0}else K+=_.source;if(q=!0,H=!0,O||T)j=_;G=!0;break;case"anchor":if(O)Q(_,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(_.source.endsWith(":"))Q(_.offset+_.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);O=_,y??(y=_.offset),q=!1,G=!1,L=!0;break;case"tag":{if(T)Q(_,"MULTIPLE_TAGS","A node can have at most one tag");T=_,y??(y=_.offset),q=!1,G=!1,L=!0;break}case X:if(O||T)Q(_,"BAD_PROP_ORDER",`Anchors and tags must be after the ${_.source} indicator`);if(b)Q(_,"UNEXPECTED_TOKEN",`Unexpected ${_.source} in ${Z??"collection"}`);b=_,q=X==="seq-item-ind"||X==="explicit-key-ind",G=!1;break;case"comma":if(Z){if(S)Q(_,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);S=_,q=!1,G=!1;break}default:Q(_,"UNEXPECTED_TOKEN",`Unexpected ${_.type} token`),q=!1,G=!1}}let x=$[$.length-1],c=x?x.offset+x.source.length:J;if(L&&z&&z.type!=="space"&&z.type!=="newline"&&z.type!=="comma"&&(z.type!=="scalar"||z.source!==""))Q(z.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(q&&B.indent<=Y||z?.type==="block-map"||z?.type==="block-seq"))Q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:S,found:b,spaceBefore:U,comment:V,hasNewline:H,anchor:O,tag:T,newlineAfterProp:j,end:c,start:y??c}}cH.resolveProps=mH});var T8=E((dH)=>{function h3($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
89
+ `))return!0;if($.end){for(let Z of $.end)if(Z.type==="newline")return!0}return!1;case"flow-collection":for(let Z of $.items){for(let X of Z.start)if(X.type==="newline")return!0;if(Z.sep){for(let X of Z.sep)if(X.type==="newline")return!0}if(h3(Z.key)||h3(Z.value))return!0}return!1;default:return!0}}dH.containsNewline=h3});var u3=E((rH)=>{var iH=T8();function nH($,Z,X){if(Z?.type==="flow-collection"){let z=Z.end[0];if(z.indent===$&&(z.source==="]"||z.source==="}")&&iH.containsNewline(Z))X(z,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}rH.flowIndentCheck=nH});var m3=E((oH)=>{var HX=i();function aH($,Z,X){let{uniqueKeys:z}=$.options;if(z===!1)return!1;let J=typeof z==="function"?z:(Q,Y)=>Q===Y||HX.isScalar(Q)&&HX.isScalar(Y)&&Q.value===Y.value;return Z.some((Q)=>J(Q.key,X))}oH.mapIncludes=aH});var LX=E((zB)=>{var BX=O1(),eH=L1(),MX=N2(),$B=T8(),OX=u3(),ZB=m3(),NX="All mapping items must start at the same column";function XB({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??eH.YAMLMap)(X.schema);if(X.atRoot)X.atRoot=!1;let U=z.offset,q=null;for(let G of z.items){let{start:V,key:K,sep:H,value:L}=G,B=MX.resolveProps(V,{indicator:"explicit-key-ind",next:K??H?.[0],offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0}),O=!B.found;if(O){if(K){if(K.type==="block-seq")J(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in K&&K.indent!==z.indent)J(U,"BAD_INDENT",NX)}if(!B.anchor&&!B.tag&&!H){if(q=B.end,B.comment)if(W.comment)W.comment+=`
90
+ `+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||$B.containsNewline(K))J(K??V[V.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==z.indent)J(U,"BAD_INDENT",NX);X.atKey=!0;let T=B.end,j=K?$(X,K,B,J):Z(X,T,V,null,B,J);if(X.schema.compat)OX.flowIndentCheck(z.indent,K,J);if(X.atKey=!1,ZB.mapIncludes(X,W.items,j))J(T,"DUPLICATE_KEY","Map keys must be unique");let S=MX.resolveProps(H??[],{indicator:"map-value-ind",next:L,offset:j.range[2],onError:J,parentIndent:z.indent,startOnNewline:!K||K.type==="block-scalar"});if(U=S.end,S.found){if(O){if(L?.type==="block-map"&&!S.hasNewline)J(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(X.options.strict&&B.start<S.found.offset-1024)J(j.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let b=L?$(X,L,S,J):Z(X,U,H,null,S,J);if(X.schema.compat)OX.flowIndentCheck(z.indent,L,J);U=b.range[2];let y=new BX.Pair(j,b);if(X.options.keepSourceTokens)y.srcToken=G;W.items.push(y)}else{if(O)J(j.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(S.comment)if(j.comment)j.comment+=`
91
+ `+S.comment;else j.comment=S.comment;let b=new BX.Pair(j);if(X.options.keepSourceTokens)b.srcToken=G;W.items.push(b)}}if(q&&q<U)J(q,"IMPOSSIBLE","Map comment with trailing content");return W.range=[z.offset,U,q??U],W}zB.resolveBlockMap=XB});var DX=E((qB)=>{var QB=D1(),YB=N2(),WB=u3();function UB({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let W=new(Q?.nodeClass??QB.YAMLSeq)(X.schema);if(X.atRoot)X.atRoot=!1;if(X.atKey)X.atKey=!1;let U=z.offset,q=null;for(let{start:G,value:V}of z.items){let K=YB.resolveProps(G,{indicator:"seq-item-ind",next:V,offset:U,onError:J,parentIndent:z.indent,startOnNewline:!0});if(!K.found)if(K.anchor||K.tag||V)if(V?.type==="block-seq")J(K.end,"BAD_INDENT","All sequence items must start at the same column");else J(U,"MISSING_CHAR","Sequence item without - indicator");else{if(q=K.end,K.comment)W.comment=K.comment;continue}let H=V?$(X,V,K,J):Z(X,K.end,G,null,K,J);if(X.schema.compat)WB.flowIndentCheck(z.indent,V,J);U=H.range[2],W.items.push(H)}return W.range=[z.offset,U,q??U],W}qB.resolveBlockSeq=UB});var K$=E((KB)=>{function VB($,Z,X,z){let J="";if($){let Q=!1,Y="";for(let W of $){let{source:U,type:q}=W;switch(q){case"space":Q=!0;break;case"comment":{if(X&&!Q)z(W,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let G=U.substring(1)||" ";if(!J)J=G;else J+=Y+G;Y="";break}case"newline":if(J)Y+=U;Q=!0;break;default:z(W,"UNEXPECTED_TOKEN",`Unexpected ${q} at node end`)}Z+=U.length}}return{comment:J,offset:Z}}KB.resolveEnd=VB});var AX=E((TB)=>{var BB=i(),MB=O1(),IX=L1(),OB=D1(),NB=K$(),TX=N2(),LB=T8(),DB=m3(),c3="Block collections are not allowed within flow collections",l3=($)=>$&&($.type==="block-map"||$.type==="block-seq");function IB({composeNode:$,composeEmptyNode:Z},X,z,J,Q){let Y=z.start.source==="{",W=Y?"flow map":"flow sequence",q=new(Q?.nodeClass??(Y?IX.YAMLMap:OB.YAMLSeq))(X.schema);q.flow=!0;let G=X.atRoot;if(G)X.atRoot=!1;if(X.atKey)X.atKey=!1;let V=z.offset+z.start.source.length;for(let O=0;O<z.items.length;++O){let T=z.items[O],{start:j,key:S,sep:b,value:y}=T,x=TX.resolveProps(j,{flow:W,indicator:"explicit-key-ind",next:S??b?.[0],offset:V,onError:J,parentIndent:z.indent,startOnNewline:!1});if(!x.found){if(!x.anchor&&!x.tag&&!b&&!y){if(O===0&&x.comma)J(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(O<z.items.length-1)J(x.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(x.comment)if(q.comment)q.comment+=`
92
+ `+x.comment;else q.comment=x.comment;V=x.end;continue}if(!Y&&X.options.strict&&LB.containsNewline(S))J(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(O===0){if(x.comma)J(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!x.comma)J(x.start,"MISSING_CHAR",`Missing , between ${W} items`);if(x.comment){let c="";$:for(let _ of j)switch(_.type){case"comma":case"space":break;case"comment":c=_.source.substring(1);break $;default:break $}if(c){let _=q.items[q.items.length-1];if(BB.isPair(_))_=_.value??_.key;if(_.comment)_.comment+=`
93
+ `+c;else _.comment=c;x.comment=x.comment.substring(c.length+1)}}}if(!Y&&!b&&!x.found){let c=y?$(X,y,x,J):Z(X,x.end,b,null,x,J);if(q.items.push(c),V=c.range[2],l3(y))J(c.range,"BLOCK_IN_FLOW",c3)}else{X.atKey=!0;let c=x.end,_=S?$(X,S,x,J):Z(X,c,j,null,x,J);if(l3(S))J(_.range,"BLOCK_IN_FLOW",c3);X.atKey=!1;let n=TX.resolveProps(b??[],{flow:W,indicator:"map-value-ind",next:y,offset:_.range[2],onError:J,parentIndent:z.indent,startOnNewline:!1});if(n.found){if(!Y&&!x.found&&X.options.strict){if(b)for(let P of b){if(P===n.found)break;if(P.type==="newline"){J(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(x.start<n.found.offset-1024)J(n.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(y)if("source"in y&&y.source?.[0]===":")J(y,"MISSING_CHAR",`Missing space after : in ${W}`);else J(n.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let p=y?$(X,y,n,J):n.found?Z(X,n.end,b,null,n,J):null;if(p){if(l3(y))J(p.range,"BLOCK_IN_FLOW",c3)}else if(n.comment)if(_.comment)_.comment+=`
94
+ `+n.comment;else _.comment=n.comment;let A0=new MB.Pair(_,p);if(X.options.keepSourceTokens)A0.srcToken=T;if(Y){let P=q;if(DB.mapIncludes(X,P.items,_))J(c,"DUPLICATE_KEY","Map keys must be unique");P.items.push(A0)}else{let P=new IX.YAMLMap(X.schema);P.flow=!0,P.items.push(A0);let d=(p??_).range;P.range=[_.range[0],d[1],d[2]],q.items.push(P)}V=p?p.range[2]:n.end}}let K=Y?"}":"]",[H,...L]=z.end,B=V;if(H?.source===K)B=H.offset+H.source.length;else{let O=W[0].toUpperCase()+W.substring(1),T=G?`${O} must end with a ${K}`:`${O} in block collection must be sufficiently indented and end with a ${K}`;if(J(V,G?"MISSING_CHAR":"BAD_INDENT",T),H&&H.source.length!==1)L.unshift(H)}if(L.length>0){let O=NB.resolveEnd(L,B,X.options.strict,J);if(O.comment)if(q.comment)q.comment+=`
95
+ `+O.comment;else q.comment=O.comment;q.range=[z.offset,B,O.offset]}else q.range=[z.offset,B,B];return q}TB.resolveFlowCollection=IB});var RX=E((jB)=>{var RB=i(),_B=J0(),FB=L1(),CB=D1(),PB=LX(),EB=DX(),wB=AX();function d3($,Z,X,z,J,Q){let Y=X.type==="block-map"?PB.resolveBlockMap($,Z,X,z,Q):X.type==="block-seq"?EB.resolveBlockSeq($,Z,X,z,Q):wB.resolveFlowCollection($,Z,X,z,Q),W=Y.constructor;if(J==="!"||J===W.tagName)return Y.tag=W.tagName,Y;if(J)Y.tag=J;return Y}function SB($,Z,X,z,J){let Q=z.tag,Y=!Q?null:Z.directives.tagName(Q.source,(K)=>J(Q,"TAG_RESOLVE_FAILED",K));if(X.type==="block-seq"){let{anchor:K,newlineAfterProp:H}=z,L=K&&Q?K.offset>Q.offset?K:Q:K??Q;if(L&&(!H||H.offset<L.offset))J(L,"MISSING_CHAR","Missing newline after block sequence props")}let W=X.type==="block-map"?"map":X.type==="block-seq"?"seq":X.start.source==="{"?"map":"seq";if(!Q||!Y||Y==="!"||Y===FB.YAMLMap.tagName&&W==="map"||Y===CB.YAMLSeq.tagName&&W==="seq")return d3($,Z,X,J,Y);let U=Z.schema.tags.find((K)=>K.tag===Y&&K.collection===W);if(!U){let K=Z.schema.knownTags[Y];if(K?.collection===W)Z.schema.tags.push(Object.assign({},K,{default:!1})),U=K;else{if(K)J(Q,"BAD_COLLECTION_TYPE",`${K.tag} used for ${W} collection, but expects ${K.collection??"scalar"}`,!0);else J(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return d3($,Z,X,J,Y)}}let q=d3($,Z,X,J,Y,U),G=U.resolve?.(q,(K)=>J(Q,"TAG_RESOLVE_FAILED",K),Z.options)??q,V=RB.isNode(G)?G:new _B.Scalar(G);if(V.range=q.range,V.tag=Y,U?.format)V.format=U.format;return V}jB.composeCollection=SB});var i3=E((vB)=>{var p3=J0();function bB($,Z,X){let z=Z.offset,J=kB(Z,$.options.strict,X);if(!J)return{value:"",type:null,comment:"",range:[z,z,z]};let Q=J.mode===">"?p3.Scalar.BLOCK_FOLDED:p3.Scalar.BLOCK_LITERAL,Y=Z.source?yB(Z.source):[],W=Y.length;for(let B=Y.length-1;B>=0;--B){let O=Y[B][1];if(O===""||O==="\r")W=B;else break}if(W===0){let B=J.chomp==="+"&&Y.length>0?`
96
96
  `.repeat(Math.max(1,Y.length-1)):"",O=z+J.length;if(Z.source)O+=Z.source.length;return{value:B,type:Q,comment:J.comment,range:[z,O,O]}}let U=Z.indent+J.indent,q=Z.offset+J.length,G=0;for(let B=0;B<W;++B){let[O,T]=Y[B];if(T===""||T==="\r"){if(J.indent===0&&O.length>U)U=O.length}else{if(O.length<U)X(q+O.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(J.indent===0)U=O.length;if(G=B,U===0&&!$.atRoot)X(q,"BAD_INDENT","Block scalar values in collections must be indented");break}q+=O.length+T.length+1}for(let B=Y.length-1;B>=W;--B)if(Y[B][0].length>U)W=B+1;let V="",K="",H=!1;for(let B=0;B<G;++B)V+=Y[B][0].slice(U)+`
97
- `;for(let B=G;B<W;++B){let[O,T]=Y[B];q+=O.length+T.length+1;let j=T[T.length-1]==="\r";if(j)T=T.slice(0,-1);if(T&&O.length<U){let b=`Block scalar lines must not be less indented than their ${J.indent?"explicit indentation indicator":"first line"}`;X(q-T.length-(j?2:1),"BAD_INDENT",b),O=""}if(Q===r3.Scalar.BLOCK_LITERAL)V+=K+O.slice(U)+T,K=`
97
+ `;for(let B=G;B<W;++B){let[O,T]=Y[B];q+=O.length+T.length+1;let j=T[T.length-1]==="\r";if(j)T=T.slice(0,-1);if(T&&O.length<U){let b=`Block scalar lines must not be less indented than their ${J.indent?"explicit indentation indicator":"first line"}`;X(q-T.length-(j?2:1),"BAD_INDENT",b),O=""}if(Q===p3.Scalar.BLOCK_LITERAL)V+=K+O.slice(U)+T,K=`
98
98
  `;else if(O.length>U||T[0]==="\t"){if(K===" ")K=`
99
99
  `;else if(!H&&K===`
100
100
  `)K=`
@@ -107,46 +107,46 @@ ${q}
107
107
  `+Y[B][0].slice(U);if(V[V.length-1]!==`
108
108
  `)V+=`
109
109
  `;break;default:V+=`
110
- `}let L=z+J.length+Z.source.length;return{value:V,type:Q,comment:J.comment,range:[z,L,L]}}function FB({offset:$,props:Z},X,z){if(Z[0].type!=="block-scalar-header")return z(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:J}=Z[0],Q=J[0],Y=0,W="",U=-1;for(let K=1;K<J.length;++K){let H=J[K];if(!W&&(H==="-"||H==="+"))W=H;else{let L=Number(H);if(!Y&&L)Y=L;else if(U===-1)U=$+K}}if(U!==-1)z(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${J}`);let q=!1,G="",V=J.length;for(let K=1;K<Z.length;++K){let H=Z[K];switch(H.type){case"space":q=!0;case"newline":V+=H.source.length;break;case"comment":if(X&&!q)z(H,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");V+=H.source.length,G=H.source.substring(1);break;case"error":z(H,"UNEXPECTED_TOKEN",H.message),V+=H.source.length;break;default:{let L=`Unexpected token in block scalar header: ${H.type}`;z(H,"UNEXPECTED_TOKEN",L);let B=H.source;if(B&&typeof B==="string")V+=B.length}}}return{mode:Q,indent:Y,chomp:W,comment:G,length:V}}function CB($){let Z=$.split(/\n( *)/),X=Z[0],z=X.match(/^( *)/),Q=[z?.[1]?[z[1],X.slice(z[1].length)]:["",X]];for(let Y=1;Y<Z.length;Y+=2)Q.push([Z[Y],Z[Y+1]]);return Q}EB.resolveBlockScalar=_B});var o3=P((gB)=>{var a3=J0(),wB=K$();function SB($,Z,X){let{offset:z,type:J,source:Q,end:Y}=$,W,U,q=(K,H,L)=>X(z+K,H,L);switch(J){case"scalar":W=a3.Scalar.PLAIN,U=jB(Q,q);break;case"single-quoted-scalar":W=a3.Scalar.QUOTE_SINGLE,U=xB(Q,q);break;case"double-quoted-scalar":W=a3.Scalar.QUOTE_DOUBLE,U=bB(Q,q);break;default:return X($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${J}`),{value:"",type:null,comment:"",range:[z,z+Q.length,z+Q.length]}}let G=z+Q.length,V=wB.resolveEnd(Y,G,Z,X);return{value:U,type:W,comment:V.comment,range:[z,G,V.offset]}}function jB($,Z){let X="";switch($[0]){case"\t":X="a tab character";break;case",":X="flow indicator character ,";break;case"%":X="directive indicator character %";break;case"|":case">":{X=`block scalar indicator ${$[0]}`;break}case"@":case"`":{X=`reserved character ${$[0]}`;break}}if(X)Z(0,"BAD_SCALAR_START",`Plain value cannot start with ${X}`);return _X($)}function xB($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return _X($.slice(1,-1)).replace(/''/g,"'")}function _X($){let Z,X;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
110
+ `}let L=z+J.length+Z.source.length;return{value:V,type:Q,comment:J.comment,range:[z,L,L]}}function kB({offset:$,props:Z},X,z){if(Z[0].type!=="block-scalar-header")return z(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:J}=Z[0],Q=J[0],Y=0,W="",U=-1;for(let K=1;K<J.length;++K){let H=J[K];if(!W&&(H==="-"||H==="+"))W=H;else{let L=Number(H);if(!Y&&L)Y=L;else if(U===-1)U=$+K}}if(U!==-1)z(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${J}`);let q=!1,G="",V=J.length;for(let K=1;K<Z.length;++K){let H=Z[K];switch(H.type){case"space":q=!0;case"newline":V+=H.source.length;break;case"comment":if(X&&!q)z(H,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");V+=H.source.length,G=H.source.substring(1);break;case"error":z(H,"UNEXPECTED_TOKEN",H.message),V+=H.source.length;break;default:{let L=`Unexpected token in block scalar header: ${H.type}`;z(H,"UNEXPECTED_TOKEN",L);let B=H.source;if(B&&typeof B==="string")V+=B.length}}}return{mode:Q,indent:Y,chomp:W,comment:G,length:V}}function yB($){let Z=$.split(/\n( *)/),X=Z[0],z=X.match(/^( *)/),Q=[z?.[1]?[z[1],X.slice(z[1].length)]:["",X]];for(let Y=1;Y<Z.length;Y+=2)Q.push([Z[Y],Z[Y+1]]);return Q}vB.resolveBlockScalar=bB});var r3=E((iB)=>{var n3=J0(),fB=K$();function hB($,Z,X){let{offset:z,type:J,source:Q,end:Y}=$,W,U,q=(K,H,L)=>X(z+K,H,L);switch(J){case"scalar":W=n3.Scalar.PLAIN,U=uB(Q,q);break;case"single-quoted-scalar":W=n3.Scalar.QUOTE_SINGLE,U=mB(Q,q);break;case"double-quoted-scalar":W=n3.Scalar.QUOTE_DOUBLE,U=cB(Q,q);break;default:return X($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${J}`),{value:"",type:null,comment:"",range:[z,z+Q.length,z+Q.length]}}let G=z+Q.length,V=fB.resolveEnd(Y,G,Z,X);return{value:U,type:W,comment:V.comment,range:[z,G,V.offset]}}function uB($,Z){let X="";switch($[0]){case"\t":X="a tab character";break;case",":X="flow indicator character ,";break;case"%":X="directive indicator character %";break;case"|":case">":{X=`block scalar indicator ${$[0]}`;break}case"@":case"`":{X=`reserved character ${$[0]}`;break}}if(X)Z(0,"BAD_SCALAR_START",`Plain value cannot start with ${X}`);return _X($)}function mB($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return _X($.slice(1,-1)).replace(/''/g,"'")}function _X($){let Z,X;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
111
111
  `,"sy"),X=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
112
112
  `,"sy")}catch{Z=/(.*?)[ \t]*\r?\n/sy,X=/[ \t]*(.*?)[ \t]*\r?\n/sy}let z=Z.exec($);if(!z)return $;let J=z[1],Q=" ",Y=Z.lastIndex;X.lastIndex=Y;while(z=X.exec($)){if(z[1]==="")if(Q===`
113
113
  `)J+=Q;else Q=`
114
- `;else J+=Q+z[1],Q=" ";Y=X.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,z=W.exec($),J+Q+(z?.[1]??"")}function bB($,Z){let X="";for(let z=1;z<$.length-1;++z){let J=$[z];if(J==="\r"&&$[z+1]===`
114
+ `;else J+=Q+z[1],Q=" ";Y=X.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,z=W.exec($),J+Q+(z?.[1]??"")}function cB($,Z){let X="";for(let z=1;z<$.length-1;++z){let J=$[z];if(J==="\r"&&$[z+1]===`
115
115
  `)continue;if(J===`
116
- `){let{fold:Q,offset:Y}=kB($,z);X+=Q,z=Y}else if(J==="\\"){let Q=$[++z],Y=yB[Q];if(Y)X+=Y;else if(Q===`
116
+ `){let{fold:Q,offset:Y}=lB($,z);X+=Q,z=Y}else if(J==="\\"){let Q=$[++z],Y=dB[Q];if(Y)X+=Y;else if(Q===`
117
117
  `){Q=$[z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="\r"&&$[z+1]===`
118
- `){Q=$[++z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="x"||Q==="u"||Q==="U"){let W=Q==="x"?2:Q==="u"?4:8;X+=vB($,z+1,W,Z),z+=W}else{let W=$.substr(z-1,2);Z(z-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),X+=W}}else if(J===" "||J==="\t"){let Q=z,Y=$[z+1];while(Y===" "||Y==="\t")Y=$[++z+1];if(Y!==`
118
+ `){Q=$[++z+1];while(Q===" "||Q==="\t")Q=$[++z+1]}else if(Q==="x"||Q==="u"||Q==="U"){let W=Q==="x"?2:Q==="u"?4:8;X+=pB($,z+1,W,Z),z+=W}else{let W=$.substr(z-1,2);Z(z-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),X+=W}}else if(J===" "||J==="\t"){let Q=z,Y=$[z+1];while(Y===" "||Y==="\t")Y=$[++z+1];if(Y!==`
119
119
  `&&!(Y==="\r"&&$[z+2]===`
120
- `))X+=z>Q?$.slice(Q,z+1):J}else X+=J}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return X}function kB($,Z){let X="",z=$[Z+1];while(z===" "||z==="\t"||z===`
120
+ `))X+=z>Q?$.slice(Q,z+1):J}else X+=J}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return X}function lB($,Z){let X="",z=$[Z+1];while(z===" "||z==="\t"||z===`
121
121
  `||z==="\r"){if(z==="\r"&&$[Z+2]!==`
122
122
  `)break;if(z===`
123
123
  `)X+=`
124
- `;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var yB={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
125
- `,r:"\r",t:"\t",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function vB($,Z,X,z){let J=$.substr(Z,X),Y=J.length===X&&/^[0-9a-fA-F]+$/.test(J)?parseInt(J,16):NaN;try{return String.fromCodePoint(Y)}catch{let W=$.substr(Z-2,X+2);return z(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}}gB.resolveFlowScalar=SB});var CX=P((dB)=>{var u1=i(),FX=J0(),hB=s3(),uB=o3();function mB($,Z,X,z){let{value:J,type:Q,comment:Y,range:W}=Z.type==="block-scalar"?hB.resolveBlockScalar($,Z,z):uB.resolveFlowScalar(Z,$.options.strict,z),U=X?$.directives.tagName(X.source,(V)=>z(X,"TAG_RESOLVE_FAILED",V)):null,q;if($.options.stringKeys&&$.atKey)q=$.schema[u1.SCALAR];else if(U)q=cB($.schema,J,U,X,z);else if(Z.type==="scalar")q=lB($,J,Z,z);else q=$.schema[u1.SCALAR];let G;try{let V=q.resolve(J,(K)=>z(X??Z,"TAG_RESOLVE_FAILED",K),$.options);G=u1.isScalar(V)?V:new FX.Scalar(V)}catch(V){let K=V instanceof Error?V.message:String(V);z(X??Z,"TAG_RESOLVE_FAILED",K),G=new FX.Scalar(J)}if(G.range=W,G.source=J,Q)G.type=Q;if(U)G.tag=U;if(q.format)G.format=q.format;if(Y)G.comment=Y;return G}function cB($,Z,X,z,J){if(X==="!")return $[u1.SCALAR];let Q=[];for(let W of $.tags)if(!W.collection&&W.tag===X)if(W.default&&W.test)Q.push(W);else return W;for(let W of Q)if(W.test?.test(Z))return W;let Y=$.knownTags[X];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return J(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${X}`,X!=="tag:yaml.org,2002:str"),$[u1.SCALAR]}function lB({atKey:$,directives:Z,schema:X},z,J,Q){let Y=X.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(z))||X[u1.SCALAR];if(X.compat){let W=X.compat.find((U)=>U.default&&U.test?.test(z))??X[u1.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),q=Z.tagString(W.tag),G=`Value may be parsed as either ${U} or ${q}`;Q(J,"TAG_RESOLVE_FAILED",G,!0)}}return Y}dB.composeScalar=mB});var EX=P((nB)=>{function iB($,Z,X){if(Z){X??(X=Z.length);for(let z=X-1;z>=0;--z){let J=Z[z];switch(J.type){case"space":case"comment":case"newline":$-=J.source.length;continue}J=Z[++z];while(J?.type==="space")$+=J.source.length,J=Z[++z];break}}return $}nB.emptyScalarPosition=iB});var SX=P((XM)=>{var sB=Z2(),aB=i(),oB=RX(),PX=CX(),tB=K$(),eB=EX(),$M={composeNode:wX,composeEmptyNode:t3};function wX($,Z,X,z){let J=$.atKey,{spaceBefore:Q,comment:Y,anchor:W,tag:U}=X,q,G=!0;switch(Z.type){case"alias":if(q=ZM($,Z,z),W||U)z(Z,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(q=PX.composeScalar($,Z,U,z),W)q.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(q=oB.composeCollection($M,$,Z,X,z),W)q.anchor=W.source.substring(1)}catch(V){let K=V instanceof Error?V.message:String(V);z(Z,"RESOURCE_EXHAUSTION",K)}break;default:{let V=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;z(Z,"UNEXPECTED_TOKEN",V),G=!1}}if(q??(q=t3($,Z.offset,void 0,null,X,z)),W&&q.anchor==="")z(W,"BAD_ALIAS","Anchor cannot be an empty string");if(J&&$.options.stringKeys&&(!aB.isScalar(q)||typeof q.value!=="string"||q.tag&&q.tag!=="tag:yaml.org,2002:str"))z(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(Q)q.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")q.comment=Y;else q.commentBefore=Y;if($.options.keepSourceTokens&&G)q.srcToken=Z;return q}function t3($,Z,X,z,{spaceBefore:J,comment:Q,anchor:Y,tag:W,end:U},q){let G={type:"scalar",offset:eB.emptyScalarPosition(Z,X,z),indent:-1,source:""},V=PX.composeScalar($,G,W,q);if(Y){if(V.anchor=Y.source.substring(1),V.anchor==="")q(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(J)V.spaceBefore=!0;if(Q)V.comment=Q,V.range[2]=U;return V}function ZM({options:$},{offset:Z,source:X,end:z},J){let Q=new sB.Alias(X.substring(1));if(Q.source==="")J(Z,"BAD_ALIAS","Alias cannot be an empty string");if(Q.source.endsWith(":"))J(Z+X.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Y=Z+X.length,W=tB.resolveEnd(z,Y,$.strict,J);if(Q.range=[Z,Y,W.offset],W.comment)Q.comment=W.comment;return Q}XM.composeEmptyNode=t3;XM.composeNode=wX});var xX=P((qM)=>{var QM=M2(),jX=SX(),YM=K$(),WM=N2();function UM($,Z,{offset:X,start:z,value:J,end:Q},Y){let W=Object.assign({_directives:Z},$),U=new QM.Document(void 0,W),q={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},G=WM.resolveProps(z,{indicator:"doc-start",next:J??Q?.[0],offset:X,onError:Y,parentIndent:0,startOnNewline:!0});if(G.found){if(U.directives.docStart=!0,J&&(J.type==="block-map"||J.type==="block-seq")&&!G.hasNewline)Y(G.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=J?jX.composeNode(q,J,G,Y):jX.composeEmptyNode(q,G.end,z,null,G,Y);let V=U.contents.range[2],K=YM.resolveEnd(Q,V,!1,Y);if(K.comment)U.comment=K.comment;return U.range=[X,V,K.offset],U}qM.composeDoc=UM});var e3=P((OM)=>{var VM=C0("process"),KM=z3(),HM=M2(),L2=O2(),bX=i(),BM=xX(),MM=K$();function D2($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:Z,source:X}=$;return[Z,Z+(typeof X==="string"?X.length:1)]}function kX($){let Z="",X=!1,z=!1;for(let J=0;J<$.length;++J){let Q=$[J];switch(Q[0]){case"#":Z+=(Z===""?"":z?`
124
+ `;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var dB={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
125
+ `,r:"\r",t:"\t",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function pB($,Z,X,z){let J=$.substr(Z,X),Y=J.length===X&&/^[0-9a-fA-F]+$/.test(J)?parseInt(J,16):NaN;try{return String.fromCodePoint(Y)}catch{let W=$.substr(Z-2,X+2);return z(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}}iB.resolveFlowScalar=hB});var CX=E((eB)=>{var u1=i(),FX=J0(),rB=i3(),sB=r3();function aB($,Z,X,z){let{value:J,type:Q,comment:Y,range:W}=Z.type==="block-scalar"?rB.resolveBlockScalar($,Z,z):sB.resolveFlowScalar(Z,$.options.strict,z),U=X?$.directives.tagName(X.source,(V)=>z(X,"TAG_RESOLVE_FAILED",V)):null,q;if($.options.stringKeys&&$.atKey)q=$.schema[u1.SCALAR];else if(U)q=oB($.schema,J,U,X,z);else if(Z.type==="scalar")q=tB($,J,Z,z);else q=$.schema[u1.SCALAR];let G;try{let V=q.resolve(J,(K)=>z(X??Z,"TAG_RESOLVE_FAILED",K),$.options);G=u1.isScalar(V)?V:new FX.Scalar(V)}catch(V){let K=V instanceof Error?V.message:String(V);z(X??Z,"TAG_RESOLVE_FAILED",K),G=new FX.Scalar(J)}if(G.range=W,G.source=J,Q)G.type=Q;if(U)G.tag=U;if(q.format)G.format=q.format;if(Y)G.comment=Y;return G}function oB($,Z,X,z,J){if(X==="!")return $[u1.SCALAR];let Q=[];for(let W of $.tags)if(!W.collection&&W.tag===X)if(W.default&&W.test)Q.push(W);else return W;for(let W of Q)if(W.test?.test(Z))return W;let Y=$.knownTags[X];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return J(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${X}`,X!=="tag:yaml.org,2002:str"),$[u1.SCALAR]}function tB({atKey:$,directives:Z,schema:X},z,J,Q){let Y=X.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(z))||X[u1.SCALAR];if(X.compat){let W=X.compat.find((U)=>U.default&&U.test?.test(z))??X[u1.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),q=Z.tagString(W.tag),G=`Value may be parsed as either ${U} or ${q}`;Q(J,"TAG_RESOLVE_FAILED",G,!0)}}return Y}eB.composeScalar=aB});var PX=E((XM)=>{function ZM($,Z,X){if(Z){X??(X=Z.length);for(let z=X-1;z>=0;--z){let J=Z[z];switch(J.type){case"space":case"comment":case"newline":$-=J.source.length;continue}J=Z[++z];while(J?.type==="space")$+=J.source.length,J=Z[++z];break}}return $}XM.emptyScalarPosition=ZM});var SX=E((VM)=>{var JM=Z2(),QM=i(),YM=RX(),EX=CX(),WM=K$(),UM=PX(),qM={composeNode:wX,composeEmptyNode:s3};function wX($,Z,X,z){let J=$.atKey,{spaceBefore:Q,comment:Y,anchor:W,tag:U}=X,q,G=!0;switch(Z.type){case"alias":if(q=GM($,Z,z),W||U)z(Z,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(q=EX.composeScalar($,Z,U,z),W)q.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(q=YM.composeCollection(qM,$,Z,X,z),W)q.anchor=W.source.substring(1)}catch(V){let K=V instanceof Error?V.message:String(V);z(Z,"RESOURCE_EXHAUSTION",K)}break;default:{let V=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;z(Z,"UNEXPECTED_TOKEN",V),G=!1}}if(q??(q=s3($,Z.offset,void 0,null,X,z)),W&&q.anchor==="")z(W,"BAD_ALIAS","Anchor cannot be an empty string");if(J&&$.options.stringKeys&&(!QM.isScalar(q)||typeof q.value!=="string"||q.tag&&q.tag!=="tag:yaml.org,2002:str"))z(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(Q)q.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")q.comment=Y;else q.commentBefore=Y;if($.options.keepSourceTokens&&G)q.srcToken=Z;return q}function s3($,Z,X,z,{spaceBefore:J,comment:Q,anchor:Y,tag:W,end:U},q){let G={type:"scalar",offset:UM.emptyScalarPosition(Z,X,z),indent:-1,source:""},V=EX.composeScalar($,G,W,q);if(Y){if(V.anchor=Y.source.substring(1),V.anchor==="")q(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(J)V.spaceBefore=!0;if(Q)V.comment=Q,V.range[2]=U;return V}function GM({options:$},{offset:Z,source:X,end:z},J){let Q=new JM.Alias(X.substring(1));if(Q.source==="")J(Z,"BAD_ALIAS","Alias cannot be an empty string");if(Q.source.endsWith(":"))J(Z+X.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Y=Z+X.length,W=WM.resolveEnd(z,Y,$.strict,J);if(Q.range=[Z,Y,W.offset],W.comment)Q.comment=W.comment;return Q}VM.composeEmptyNode=s3;VM.composeNode=wX});var xX=E((LM)=>{var BM=M2(),jX=SX(),MM=K$(),OM=N2();function NM($,Z,{offset:X,start:z,value:J,end:Q},Y){let W=Object.assign({_directives:Z},$),U=new BM.Document(void 0,W),q={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},G=OM.resolveProps(z,{indicator:"doc-start",next:J??Q?.[0],offset:X,onError:Y,parentIndent:0,startOnNewline:!0});if(G.found){if(U.directives.docStart=!0,J&&(J.type==="block-map"||J.type==="block-seq")&&!G.hasNewline)Y(G.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=J?jX.composeNode(q,J,G,Y):jX.composeEmptyNode(q,G.end,z,null,G,Y);let V=U.contents.range[2],K=MM.resolveEnd(Q,V,!1,Y);if(K.comment)U.comment=K.comment;return U.range=[X,V,K.offset],U}LM.composeDoc=NM});var a3=E((FM)=>{var IM=C0("process"),TM=$3(),AM=M2(),L2=O2(),bX=i(),RM=xX(),_M=K$();function D2($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:Z,source:X}=$;return[Z,Z+(typeof X==="string"?X.length:1)]}function kX($){let Z="",X=!1,z=!1;for(let J=0;J<$.length;++J){let Q=$[J];switch(Q[0]){case"#":Z+=(Z===""?"":z?`
126
126
 
127
127
  `:`
128
- `)+(Q.substring(1)||" "),X=!0,z=!1;break;case"%":if($[J+1]?.[0]!=="#")J+=1;X=!1;break;default:if(!X)z=!0;X=!1}}return{comment:Z,afterEmptyLine:z}}class yX{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,X,z,J)=>{let Q=D2(Z);if(J)this.warnings.push(new L2.YAMLWarning(Q,X,z));else this.errors.push(new L2.YAMLParseError(Q,X,z))},this.directives=new KM.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:X,afterEmptyLine:z}=kX(this.prelude);if(X){let J=$.contents;if(Z)$.comment=$.comment?`${$.comment}
128
+ `)+(Q.substring(1)||" "),X=!0,z=!1;break;case"%":if($[J+1]?.[0]!=="#")J+=1;X=!1;break;default:if(!X)z=!0;X=!1}}return{comment:Z,afterEmptyLine:z}}class yX{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,X,z,J)=>{let Q=D2(Z);if(J)this.warnings.push(new L2.YAMLWarning(Q,X,z));else this.errors.push(new L2.YAMLParseError(Q,X,z))},this.directives=new TM.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:X,afterEmptyLine:z}=kX(this.prelude);if(X){let J=$.contents;if(Z)$.comment=$.comment?`${$.comment}
129
129
  ${X}`:X;else if(z||$.directives.docStart||!J)$.commentBefore=X;else if(bX.isCollection(J)&&!J.flow&&J.items.length>0){let Q=J.items[0];if(bX.isPair(Q))Q=Q.key;let Y=Q.commentBefore;Q.commentBefore=Y?`${X}
130
130
  ${Y}`:X}else{let Q=J.commentBefore;J.commentBefore=Q?`${X}
131
- ${Q}`:X}}if(Z){for(let J=0;J<this.errors.length;++J)$.errors.push(this.errors[J]);for(let J=0;J<this.warnings.length;++J)$.warnings.push(this.warnings[J])}else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:kX(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,Z=!1,X=-1){for(let z of $)yield*this.next(z);yield*this.end(Z,X)}*next($){if(VM.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,X,z)=>{let J=D2($);J[0]+=Z,this.onError(J,"BAD_DIRECTIVE",X,z)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=BM.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!Z.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(Z,!1),this.doc)yield this.doc;this.doc=Z,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let Z=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,X=new L2.YAMLParseError(D2($),"UNEXPECTED_TOKEN",Z);if(this.atDirectives||!this.doc)this.errors.push(X);else this.doc.errors.push(X);break}case"doc-end":{if(!this.doc){this.errors.push(new L2.YAMLParseError(D2($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=MM.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),Z.comment){let X=this.doc.comment;this.doc.comment=X?`${X}
132
- ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new L2.YAMLParseError(D2($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,Z=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let X=Object.assign({_directives:this.directives},this.options),z=new HM.Document(void 0,X);if(this.atDirectives)this.onError(Z,"MISSING_CHAR","Missing directives-end indicator line");z.range=[0,Z,Z],this.decorate(z,!1),yield z}}}OM.Composer=yX});var fX=P((FM)=>{var LM=s3(),DM=o3(),IM=O2(),vX=Q2();function TM($,Z=!0,X){if($){let z=(J,Q,Y)=>{let W=typeof J==="number"?J:Array.isArray(J)?J[0]:J.offset;if(X)X(W,Q,Y);else throw new IM.YAMLParseError([W,W+1],Q,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return DM.resolveFlowScalar($,Z,z);case"block-scalar":return LM.resolveBlockScalar({options:{strict:Z}},$,z)}}return null}function AM($,Z){let{implicitKey:X=!1,indent:z,inFlow:J=!1,offset:Q=-1,type:Y="PLAIN"}=Z,W=vX.stringifyString({type:Y,value:$},{implicitKey:X,indent:z>0?" ".repeat(z):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}}),U=Z.end??[{type:"newline",offset:-1,indent:z,source:`
131
+ ${Q}`:X}}if(Z){for(let J=0;J<this.errors.length;++J)$.errors.push(this.errors[J]);for(let J=0;J<this.warnings.length;++J)$.warnings.push(this.warnings[J])}else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:kX(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,Z=!1,X=-1){for(let z of $)yield*this.next(z);yield*this.end(Z,X)}*next($){if(IM.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,X,z)=>{let J=D2($);J[0]+=Z,this.onError(J,"BAD_DIRECTIVE",X,z)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=RM.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!Z.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(Z,!1),this.doc)yield this.doc;this.doc=Z,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let Z=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,X=new L2.YAMLParseError(D2($),"UNEXPECTED_TOKEN",Z);if(this.atDirectives||!this.doc)this.errors.push(X);else this.doc.errors.push(X);break}case"doc-end":{if(!this.doc){this.errors.push(new L2.YAMLParseError(D2($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=_M.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),Z.comment){let X=this.doc.comment;this.doc.comment=X?`${X}
132
+ ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new L2.YAMLParseError(D2($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,Z=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let X=Object.assign({_directives:this.directives},this.options),z=new AM.Document(void 0,X);if(this.atDirectives)this.onError(Z,"MISSING_CHAR","Missing directives-end indicator line");z.range=[0,Z,Z],this.decorate(z,!1),yield z}}}FM.Composer=yX});var fX=E((kM)=>{var PM=i3(),EM=r3(),wM=O2(),vX=Q2();function SM($,Z=!0,X){if($){let z=(J,Q,Y)=>{let W=typeof J==="number"?J:Array.isArray(J)?J[0]:J.offset;if(X)X(W,Q,Y);else throw new wM.YAMLParseError([W,W+1],Q,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return EM.resolveFlowScalar($,Z,z);case"block-scalar":return PM.resolveBlockScalar({options:{strict:Z}},$,z)}}return null}function jM($,Z){let{implicitKey:X=!1,indent:z,inFlow:J=!1,offset:Q=-1,type:Y="PLAIN"}=Z,W=vX.stringifyString({type:Y,value:$},{implicitKey:X,indent:z>0?" ".repeat(z):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}}),U=Z.end??[{type:"newline",offset:-1,indent:z,source:`
133
133
  `}];switch(W[0]){case"|":case">":{let q=W.indexOf(`
134
134
  `),G=W.substring(0,q),V=W.substring(q+1)+`
135
135
  `,K=[{type:"block-scalar-header",offset:Q,indent:z,source:G}];if(!gX(K,U))K.push({type:"newline",offset:-1,indent:z,source:`
136
- `});return{type:"block-scalar",offset:Q,indent:z,props:K,source:V}}case'"':return{type:"double-quoted-scalar",offset:Q,indent:z,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:Q,indent:z,source:W,end:U};default:return{type:"scalar",offset:Q,indent:z,source:W,end:U}}}function RM($,Z,X={}){let{afterKey:z=!1,implicitKey:J=!1,inFlow:Q=!1,type:Y}=X,W="indent"in $?$.indent:null;if(z&&typeof W==="number")W+=2;if(!Y)switch($.type){case"single-quoted-scalar":Y="QUOTE_SINGLE";break;case"double-quoted-scalar":Y="QUOTE_DOUBLE";break;case"block-scalar":{let q=$.props[0];if(q.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=q.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=vX.stringifyString({type:Y,value:Z},{implicitKey:J||W===null,indent:W!==null&&W>0?" ".repeat(W):"",inFlow:Q,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":_M($,U);break;case'"':$Z($,U,"double-quoted-scalar");break;case"'":$Z($,U,"single-quoted-scalar");break;default:$Z($,U,"scalar")}}function _M($,Z){let X=Z.indexOf(`
136
+ `});return{type:"block-scalar",offset:Q,indent:z,props:K,source:V}}case'"':return{type:"double-quoted-scalar",offset:Q,indent:z,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:Q,indent:z,source:W,end:U};default:return{type:"scalar",offset:Q,indent:z,source:W,end:U}}}function xM($,Z,X={}){let{afterKey:z=!1,implicitKey:J=!1,inFlow:Q=!1,type:Y}=X,W="indent"in $?$.indent:null;if(z&&typeof W==="number")W+=2;if(!Y)switch($.type){case"single-quoted-scalar":Y="QUOTE_SINGLE";break;case"double-quoted-scalar":Y="QUOTE_DOUBLE";break;case"block-scalar":{let q=$.props[0];if(q.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=q.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=vX.stringifyString({type:Y,value:Z},{implicitKey:J||W===null,indent:W!==null&&W>0?" ".repeat(W):"",inFlow:Q,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":bM($,U);break;case'"':o3($,U,"double-quoted-scalar");break;case"'":o3($,U,"single-quoted-scalar");break;default:o3($,U,"scalar")}}function bM($,Z){let X=Z.indexOf(`
137
137
  `),z=Z.substring(0,X),J=Z.substring(X+1)+`
138
138
  `;if($.type==="block-scalar"){let Q=$.props[0];if(Q.type!=="block-scalar-header")throw Error("Invalid block scalar header");Q.source=z,$.source=J}else{let{offset:Q}=$,Y="indent"in $?$.indent:-1,W=[{type:"block-scalar-header",offset:Q,indent:Y,source:z}];if(!gX(W,"end"in $?$.end:void 0))W.push({type:"newline",offset:-1,indent:Y,source:`
139
- `});for(let U of Object.keys($))if(U!=="type"&&U!=="offset")delete $[U];Object.assign($,{type:"block-scalar",indent:Y,props:W,source:J})}}function gX($,Z){if(Z)for(let X of Z)switch(X.type){case"space":case"comment":$.push(X);break;case"newline":return $.push(X),!0}return!1}function $Z($,Z,X){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=X,$.source=Z;break;case"block-scalar":{let z=$.props.slice(1),J=Z.length;if($.props[0].type==="block-scalar-header")J-=$.props[0].source.length;for(let Q of z)Q.offset+=J;delete $.props,Object.assign($,{type:X,source:Z,end:z});break}case"block-map":case"block-seq":{let J={type:"newline",offset:$.offset+Z.length,indent:$.indent,source:`
140
- `};delete $.items,Object.assign($,{type:X,source:Z,end:[J]});break}default:{let z="indent"in $?$.indent:-1,J="end"in $&&Array.isArray($.end)?$.end.filter((Q)=>Q.type==="space"||Q.type==="comment"||Q.type==="newline"):[];for(let Q of Object.keys($))if(Q!=="type"&&Q!=="offset")delete $[Q];Object.assign($,{type:X,indent:z,source:Z,end:J})}}}FM.createScalarToken=AM;FM.resolveAsScalar=TM;FM.setScalarValue=RM});var hX=P((SM)=>{var wM=($)=>("type"in $)?R8($):A8($);function R8($){switch($.type){case"block-scalar":{let Z="";for(let X of $.props)Z+=R8(X);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let X of $.items)Z+=A8(X);return Z}case"flow-collection":{let Z=$.start.source;for(let X of $.items)Z+=A8(X);for(let X of $.end)Z+=X.source;return Z}case"document":{let Z=A8($);if($.end)for(let X of $.end)Z+=X.source;return Z}default:{let Z=$.source;if("end"in $&&$.end)for(let X of $.end)Z+=X.source;return Z}}}function A8({start:$,key:Z,sep:X,value:z}){let J="";for(let Q of $)J+=Q.source;if(Z)J+=R8(Z);if(X)for(let Q of X)J+=Q.source;if(z)J+=R8(z);return J}SM.stringify=wM});var cX=P((bM)=>{var ZZ=Symbol("break visit"),xM=Symbol("skip children"),uX=Symbol("remove item");function m1($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};mX(Object.freeze([]),$,Z)}m1.BREAK=ZZ;m1.SKIP=xM;m1.REMOVE=uX;m1.itemAtPath=($,Z)=>{let X=$;for(let[z,J]of Z){let Q=X?.[z];if(Q&&"items"in Q)X=Q.items[J];else return}return X};m1.parentCollection=($,Z)=>{let X=m1.itemAtPath($,Z.slice(0,-1)),z=Z[Z.length-1][0],J=X?.[z];if(J&&"items"in J)return J;throw Error("Parent collection not found")};function mX($,Z,X){let z=X(Z,$);if(typeof z==="symbol")return z;for(let J of["key","value"]){let Q=Z[J];if(Q&&"items"in Q){for(let Y=0;Y<Q.items.length;++Y){let W=mX(Object.freeze($.concat([[J,Y]])),Q.items[Y],X);if(typeof W==="number")Y=W-1;else if(W===ZZ)return ZZ;else if(W===uX)Q.items.splice(Y,1),Y-=1}if(typeof z==="function"&&J==="key")z=z(Z,$)}}return typeof z==="function"?z(Z,$):z}bM.visit=m1});var _8=P((mM)=>{var XZ=fX(),yM=hX(),vM=cX(),zZ="\uFEFF",JZ="\x02",QZ="\x18",YZ="\x1F",gM=($)=>!!$&&("items"in $),fM=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function hM($){switch($){case zZ:return"<BOM>";case JZ:return"<DOC>";case QZ:return"<FLOW_END>";case YZ:return"<SCALAR>";default:return JSON.stringify($)}}function uM($){switch($){case zZ:return"byte-order-mark";case JZ:return"doc-mode";case QZ:return"flow-error-end";case YZ:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
139
+ `});for(let U of Object.keys($))if(U!=="type"&&U!=="offset")delete $[U];Object.assign($,{type:"block-scalar",indent:Y,props:W,source:J})}}function gX($,Z){if(Z)for(let X of Z)switch(X.type){case"space":case"comment":$.push(X);break;case"newline":return $.push(X),!0}return!1}function o3($,Z,X){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=X,$.source=Z;break;case"block-scalar":{let z=$.props.slice(1),J=Z.length;if($.props[0].type==="block-scalar-header")J-=$.props[0].source.length;for(let Q of z)Q.offset+=J;delete $.props,Object.assign($,{type:X,source:Z,end:z});break}case"block-map":case"block-seq":{let J={type:"newline",offset:$.offset+Z.length,indent:$.indent,source:`
140
+ `};delete $.items,Object.assign($,{type:X,source:Z,end:[J]});break}default:{let z="indent"in $?$.indent:-1,J="end"in $&&Array.isArray($.end)?$.end.filter((Q)=>Q.type==="space"||Q.type==="comment"||Q.type==="newline"):[];for(let Q of Object.keys($))if(Q!=="type"&&Q!=="offset")delete $[Q];Object.assign($,{type:X,indent:z,source:Z,end:J})}}}kM.createScalarToken=jM;kM.resolveAsScalar=SM;kM.setScalarValue=xM});var hX=E((hM)=>{var fM=($)=>("type"in $)?R8($):A8($);function R8($){switch($.type){case"block-scalar":{let Z="";for(let X of $.props)Z+=R8(X);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let X of $.items)Z+=A8(X);return Z}case"flow-collection":{let Z=$.start.source;for(let X of $.items)Z+=A8(X);for(let X of $.end)Z+=X.source;return Z}case"document":{let Z=A8($);if($.end)for(let X of $.end)Z+=X.source;return Z}default:{let Z=$.source;if("end"in $&&$.end)for(let X of $.end)Z+=X.source;return Z}}}function A8({start:$,key:Z,sep:X,value:z}){let J="";for(let Q of $)J+=Q.source;if(Z)J+=R8(Z);if(X)for(let Q of X)J+=Q.source;if(z)J+=R8(z);return J}hM.stringify=fM});var cX=E((cM)=>{var t3=Symbol("break visit"),mM=Symbol("skip children"),uX=Symbol("remove item");function m1($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};mX(Object.freeze([]),$,Z)}m1.BREAK=t3;m1.SKIP=mM;m1.REMOVE=uX;m1.itemAtPath=($,Z)=>{let X=$;for(let[z,J]of Z){let Q=X?.[z];if(Q&&"items"in Q)X=Q.items[J];else return}return X};m1.parentCollection=($,Z)=>{let X=m1.itemAtPath($,Z.slice(0,-1)),z=Z[Z.length-1][0],J=X?.[z];if(J&&"items"in J)return J;throw Error("Parent collection not found")};function mX($,Z,X){let z=X(Z,$);if(typeof z==="symbol")return z;for(let J of["key","value"]){let Q=Z[J];if(Q&&"items"in Q){for(let Y=0;Y<Q.items.length;++Y){let W=mX(Object.freeze($.concat([[J,Y]])),Q.items[Y],X);if(typeof W==="number")Y=W-1;else if(W===t3)return t3;else if(W===uX)Q.items.splice(Y,1),Y-=1}if(typeof z==="function"&&J==="key")z=z(Z,$)}}return typeof z==="function"?z(Z,$):z}cM.visit=m1});var _8=E((aM)=>{var e3=fX(),dM=hX(),pM=cX(),$Z="\uFEFF",ZZ="\x02",XZ="\x18",zZ="\x1F",iM=($)=>!!$&&("items"in $),nM=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function rM($){switch($){case $Z:return"<BOM>";case ZZ:return"<DOC>";case XZ:return"<FLOW_END>";case zZ:return"<SCALAR>";default:return JSON.stringify($)}}function sM($){switch($){case $Z:return"byte-order-mark";case ZZ:return"doc-mode";case XZ:return"flow-error-end";case zZ:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
141
141
  `:case`\r
142
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch($[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}mM.createScalarToken=XZ.createScalarToken;mM.resolveAsScalar=XZ.resolveAsScalar;mM.setScalarValue=XZ.setScalarValue;mM.stringify=yM.stringify;mM.visit=vM.visit;mM.BOM=zZ;mM.DOCUMENT=JZ;mM.FLOW_END=QZ;mM.SCALAR=YZ;mM.isCollection=gM;mM.isScalar=fM;mM.prettyToken=hM;mM.tokenType=uM});var UZ=P((zO)=>{var I2=_8();function l0($){switch($){case void 0:case" ":case`
143
- `:case"\r":case"\t":return!0;default:return!1}}var lX=new Set("0123456789ABCDEFabcdef"),ZO=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),F8=new Set(",[]{}"),XO=new Set(` ,[]{}
144
- \r `),WZ=($)=>!$||XO.has($);class dX{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex($,Z=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!Z;let X=this.next??"stream";while(X&&(Z||this.hasChars(1)))X=yield*this.parseNext(X)}atLineEnd(){let $=this.pos,Z=this.buffer[$];while(Z===" "||Z==="\t")Z=this.buffer[++$];if(!Z||Z==="#"||Z===`
142
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch($[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}aM.createScalarToken=e3.createScalarToken;aM.resolveAsScalar=e3.resolveAsScalar;aM.setScalarValue=e3.setScalarValue;aM.stringify=dM.stringify;aM.visit=pM.visit;aM.BOM=$Z;aM.DOCUMENT=ZZ;aM.FLOW_END=XZ;aM.SCALAR=zZ;aM.isCollection=iM;aM.isScalar=nM;aM.prettyToken=rM;aM.tokenType=sM});var QZ=E((KO)=>{var I2=_8();function l0($){switch($){case void 0:case" ":case`
143
+ `:case"\r":case"\t":return!0;default:return!1}}var lX=new Set("0123456789ABCDEFabcdef"),GO=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),F8=new Set(",[]{}"),VO=new Set(` ,[]{}
144
+ \r `),JZ=($)=>!$||VO.has($);class dX{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex($,Z=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!Z;let X=this.next??"stream";while(X&&(Z||this.hasChars(1)))X=yield*this.parseNext(X)}atLineEnd(){let $=this.pos,Z=this.buffer[$];while(Z===" "||Z==="\t")Z=this.buffer[++$];if(!Z||Z==="#"||Z===`
145
145
  `)return!0;if(Z==="\r")return this.buffer[$+1]===`
146
146
  `;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let Z=this.buffer[$];if(this.indentNext>0){let X=0;while(Z===" ")Z=this.buffer[++X+$];if(Z==="\r"){let z=this.buffer[X+$+1];if(z===`
147
147
  `||!z&&!this.atEnd)return $+X+1}return Z===`
148
148
  `||X>=this.indentNext||!Z&&!this.atEnd?$+X:-1}if(Z==="-"||Z==="."){let X=this.buffer.substr($,3);if((X==="---"||X==="...")&&l0(this.buffer[$+3]))return-1}return $}getLine(){let $=this.lineEndPos;if(typeof $!=="number"||$!==-1&&$<this.pos)$=this.buffer.indexOf(`
149
- `,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===I2.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let Z=$.length,X=$.indexOf("#");while(X!==-1){let J=$[X-1];if(J===" "||J==="\t"){Z=X-1;break}else X=$.indexOf("#",X+1)}while(!0){let J=$[Z-1];if(J===" "||J==="\t")Z-=1;else break}let z=(yield*this.pushCount(Z))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-z),this.pushNewline(),"stream"}if(this.atLineEnd()){let Z=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-Z),yield*this.pushNewline(),"stream"}return yield I2.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let Z=this.peek(3);if((Z==="---"||Z==="...")&&l0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,Z==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!l0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,Z]=this.peek(2);if(!Z&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&l0(Z)){let X=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=X,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let Z=yield*this.pushIndicators();switch($[Z]){case"#":yield*this.pushCount($.length-Z);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(WZ),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return Z+=yield*this.parseBlockScalarHeader(),Z+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-Z),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,Z,X=-1;do{if($=yield*this.pushNewline(),$>0)Z=yield*this.pushSpaces(!1),this.indentValue=X=Z;else Z=0;Z+=yield*this.pushSpaces(!0)}while($+Z>0);let z=this.getLine();if(z===null)return this.setNext("flow");if(X!==-1&&X<this.indentNext&&z[0]!=="#"||X===0&&(z.startsWith("---")||z.startsWith("..."))&&l0(z[3])){if(!(X===this.indentNext-1&&this.flowLevel===1&&(z[0]==="]"||z[0]==="}")))return this.flowLevel=0,yield I2.FLOW_END,yield*this.parseLineStart()}let J=0;while(z[J]===",")J+=yield*this.pushCount(1),J+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(J+=yield*this.pushIndicators(),z[J]){case void 0:return"flow";case"#":return yield*this.pushCount(z.length-J),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(WZ),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let Q=this.charAt(1);if(this.flowKey||l0(Q)||Q===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let J=0;while(this.buffer[Z-1-J]==="\\")J+=1;if(J%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let X=this.buffer.substring(0,Z),z=X.indexOf(`
149
+ `,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===I2.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let Z=$.length,X=$.indexOf("#");while(X!==-1){let J=$[X-1];if(J===" "||J==="\t"){Z=X-1;break}else X=$.indexOf("#",X+1)}while(!0){let J=$[Z-1];if(J===" "||J==="\t")Z-=1;else break}let z=(yield*this.pushCount(Z))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-z),this.pushNewline(),"stream"}if(this.atLineEnd()){let Z=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-Z),yield*this.pushNewline(),"stream"}return yield I2.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let Z=this.peek(3);if((Z==="---"||Z==="...")&&l0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,Z==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!l0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,Z]=this.peek(2);if(!Z&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&l0(Z)){let X=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=X,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let Z=yield*this.pushIndicators();switch($[Z]){case"#":yield*this.pushCount($.length-Z);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(JZ),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return Z+=yield*this.parseBlockScalarHeader(),Z+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-Z),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,Z,X=-1;do{if($=yield*this.pushNewline(),$>0)Z=yield*this.pushSpaces(!1),this.indentValue=X=Z;else Z=0;Z+=yield*this.pushSpaces(!0)}while($+Z>0);let z=this.getLine();if(z===null)return this.setNext("flow");if(X!==-1&&X<this.indentNext&&z[0]!=="#"||X===0&&(z.startsWith("---")||z.startsWith("..."))&&l0(z[3])){if(!(X===this.indentNext-1&&this.flowLevel===1&&(z[0]==="]"||z[0]==="}")))return this.flowLevel=0,yield I2.FLOW_END,yield*this.parseLineStart()}let J=0;while(z[J]===",")J+=yield*this.pushCount(1),J+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(J+=yield*this.pushIndicators(),z[J]){case void 0:return"flow";case"#":return yield*this.pushCount(z.length-J),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(JZ),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let Q=this.charAt(1);if(this.flowKey||l0(Q)||Q===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let J=0;while(this.buffer[Z-1-J]==="\\")J+=1;if(J%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let X=this.buffer.substring(0,Z),z=X.indexOf(`
150
150
  `,this.pos);if(z!==-1){while(z!==-1){let J=this.continueScalar(z+1);if(J===-1)break;z=X.indexOf(`
151
151
  `,J)}if(z!==-1)Z=z-(X[z-1]==="\r"?2:1)}if(Z===-1){if(!this.atEnd)return this.setNext("quoted-scalar");Z=this.buffer.length}return yield*this.pushToIndex(Z+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let Z=this.buffer[++$];if(Z==="+")this.blockScalarKeep=!0;else if(Z>"0"&&Z<="9")this.blockScalarIndent=Number(Z)-1;else if(Z!=="-")break}return yield*this.pushUntil((Z)=>l0(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,X;$:for(let J=this.pos;X=this.buffer[J];++J)switch(X){case" ":Z+=1;break;case`
152
152
  `:$=J,Z=0;break;case"\r":{let Q=this.buffer[J+1];if(!Q&&!this.atEnd)return this.setNext("block-scalar");if(Q===`
@@ -156,21 +156,21 @@ ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.pus
156
156
  `&&J>=this.pos&&J+1+Z>Y)$=J;else break}while(!0);return yield I2.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,Z=this.pos-1,X=this.pos-1,z;while(z=this.buffer[++X])if(z===":"){let J=this.buffer[X+1];if(l0(J)||$&&F8.has(J))break;Z=X}else if(l0(z)){let J=this.buffer[X+1];if(z==="\r")if(J===`
157
157
  `)X+=1,z=`
158
158
  `,J=this.buffer[X+1];else Z=X;if(J==="#"||$&&F8.has(J))break;if(z===`
159
- `){let Q=this.continueScalar(X+1);if(Q===-1)break;X=Math.max(X,Q-2)}}else{if($&&F8.has(z))break;Z=X}if(!z&&!this.atEnd)return this.setNext("plain-scalar");return yield I2.SCALAR,yield*this.pushToIndex(Z+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,Z){let X=this.buffer.slice(this.pos,$);if(X)return yield X,this.pos+=X.length,X.length;else if(Z)yield"";return 0}*pushIndicators(){let $=0;$:while(!0){switch(this.charAt(0)){case"!":$+=yield*this.pushTag(),$+=yield*this.pushSpaces(!0);continue $;case"&":$+=yield*this.pushUntil(WZ),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,X=this.charAt(1);if(l0(X)||Z&&F8.has(X)){if(!Z)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;$+=yield*this.pushCount(1),$+=yield*this.pushSpaces(!0);continue $}}}break $}return $}*pushTag(){if(this.charAt(1)==="<"){let $=this.pos+2,Z=this.buffer[$];while(!l0(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(ZO.has(Z))Z=this.buffer[++$];else if(Z==="%"&&lX.has(this.buffer[$+1])&&lX.has(this.buffer[$+2]))Z=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
159
+ `){let Q=this.continueScalar(X+1);if(Q===-1)break;X=Math.max(X,Q-2)}}else{if($&&F8.has(z))break;Z=X}if(!z&&!this.atEnd)return this.setNext("plain-scalar");return yield I2.SCALAR,yield*this.pushToIndex(Z+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,Z){let X=this.buffer.slice(this.pos,$);if(X)return yield X,this.pos+=X.length,X.length;else if(Z)yield"";return 0}*pushIndicators(){let $=0;$:while(!0){switch(this.charAt(0)){case"!":$+=yield*this.pushTag(),$+=yield*this.pushSpaces(!0);continue $;case"&":$+=yield*this.pushUntil(JZ),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,X=this.charAt(1);if(l0(X)||Z&&F8.has(X)){if(!Z)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;$+=yield*this.pushCount(1),$+=yield*this.pushSpaces(!0);continue $}}}break $}return $}*pushTag(){if(this.charAt(1)==="<"){let $=this.pos+2,Z=this.buffer[$];while(!l0(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(GO.has(Z))Z=this.buffer[++$];else if(Z==="%"&&lX.has(this.buffer[$+1])&&lX.has(this.buffer[$+2]))Z=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
160
160
  `)return yield*this.pushCount(1);else if($==="\r"&&this.charAt(1)===`
161
- `)return yield*this.pushCount(2);else return 0}*pushSpaces($){let Z=this.pos-1,X;do X=this.buffer[++Z];while(X===" "||$&&X==="\t");let z=Z-this.pos;if(z>0)yield this.buffer.substr(this.pos,z),this.pos=Z;return z}*pushUntil($){let Z=this.pos,X=this.buffer[Z];while(!$(X))X=this.buffer[++Z];return yield*this.pushToIndex(Z,!1)}}zO.Lexer=dX});var qZ=P((QO)=>{class pX{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let Z=0,X=this.lineStarts.length;while(Z<X){let J=Z+X>>1;if(this.lineStarts[J]<$)Z=J+1;else X=J}if(this.lineStarts[Z]===$)return{line:Z+1,col:1};if(Z===0)return{line:0,col:$};let z=this.lineStarts[Z-1];return{line:Z,col:$-z+1}}}}QO.LineCounter=pX});var GZ=P((qO)=>{var WO=C0("process"),iX=_8(),UO=UZ();function I1($,Z){for(let X=0;X<$.length;++X)if($[X].type===Z)return!0;return!1}function nX($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function sX($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function C8($){switch($.type){case"document":return $.start;case"block-map":{let Z=$.items[$.items.length-1];return Z.sep??Z.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function H$($){if($.length===0)return[];let Z=$.length;$:while(--Z>=0)switch($[Z].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++Z]?.type==="space");return $.splice(Z,$.length)}function E8($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let X=0;X<Z.length;++X)$.push(Z[X])}function rX($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!I1(Z.start,"explicit-key-ind")&&!I1(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,sX(Z.value))if(Z.value.end)E8(Z.value.end,Z.sep);else Z.value.end=Z.sep;else E8(Z.start,Z.sep);delete Z.sep}}}class aX{constructor($){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new UO.Lexer,this.onNewLine=$}*parse($,Z=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let X of this.lexer.lex($,Z))yield*this.next(X);if(!Z)yield*this.end()}*next($){if(this.source=$,WO.env.LOG_TOKENS)console.log("|",iX.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=iX.tokenType($);if(!Z){let X=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:X,source:$}),this.offset+=$.length}else if(Z==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=Z,yield*this.step(),Z){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+$.length);break;case"space":if(this.atNewLine&&$[0]===" ")this.indent+=$.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=$.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=$.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let $=this.peek(1);if(this.type==="doc-end"&&$?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!$)return yield*this.stream();switch($.type){case"document":return yield*this.document($);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar($);case"block-scalar":return yield*this.blockScalar($);case"block-map":return yield*this.blockMap($);case"block-seq":return yield*this.blockSequence($);case"flow-collection":return yield*this.flowCollection($);case"doc-end":return yield*this.documentEnd($)}yield*this.pop()}peek($){return this.stack[this.stack.length-$]}*pop($){let Z=$??this.stack.pop();if(!Z)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield Z;else{let X=this.peek(1);if(Z.type==="block-scalar")Z.indent="indent"in X?X.indent:0;else if(Z.type==="flow-collection"&&X.type==="document")Z.indent=0;if(Z.type==="flow-collection")rX(Z);switch(X.type){case"document":X.value=Z;break;case"block-scalar":X.props.push(Z);break;case"block-map":{let z=X.items[X.items.length-1];if(z.value){X.items.push({start:[],key:Z,sep:[]}),this.onKeyLine=!0;return}else if(z.sep)z.value=Z;else{Object.assign(z,{key:Z,sep:[]}),this.onKeyLine=!z.explicitKey;return}break}case"block-seq":{let z=X.items[X.items.length-1];if(z.value)X.items.push({start:[],value:Z});else z.value=Z;break}case"flow-collection":{let z=X.items[X.items.length-1];if(!z||z.value)X.items.push({start:[],key:Z,sep:[]});else if(z.sep)z.value=Z;else Object.assign(z,{key:Z,sep:[]});return}default:yield*this.pop(),yield*this.pop(Z)}if((X.type==="document"||X.type==="block-map"||X.type==="block-seq")&&(Z.type==="block-map"||Z.type==="block-seq")){let z=Z.items[Z.items.length-1];if(z&&!z.sep&&!z.value&&z.start.length>0&&nX(z.start)===-1&&(Z.indent===0||z.start.every((J)=>J.type!=="comment"||J.indent<Z.indent))){if(X.type==="document")X.end=z.start;else X.items.push({start:z.start});Z.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let $={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")$.start.push(this.sourceToken);this.stack.push($);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document($){if($.value)return yield*this.lineEnd($);switch(this.type){case"doc-start":{if(nX($.start)!==-1)yield*this.pop(),yield*this.step();else $.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":$.start.push(this.sourceToken);return}let Z=this.startBlockValue($);if(Z)this.stack.push(Z);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar($){if(this.type==="map-value-ind"){let Z=C8(this.peek(2)),X=H$(Z),z;if($.end)z=$.end,z.push(this.sourceToken),delete $.end;else z=[this.sourceToken];let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}else yield*this.lineEnd($)}*blockScalar($){switch(this.type){case"space":case"comment":case"newline":$.props.push(this.sourceToken);return;case"scalar":if($.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let Z=this.source.indexOf(`
161
+ `)return yield*this.pushCount(2);else return 0}*pushSpaces($){let Z=this.pos-1,X;do X=this.buffer[++Z];while(X===" "||$&&X==="\t");let z=Z-this.pos;if(z>0)yield this.buffer.substr(this.pos,z),this.pos=Z;return z}*pushUntil($){let Z=this.pos,X=this.buffer[Z];while(!$(X))X=this.buffer[++Z];return yield*this.pushToIndex(Z,!1)}}KO.Lexer=dX});var YZ=E((BO)=>{class pX{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let Z=0,X=this.lineStarts.length;while(Z<X){let J=Z+X>>1;if(this.lineStarts[J]<$)Z=J+1;else X=J}if(this.lineStarts[Z]===$)return{line:Z+1,col:1};if(Z===0)return{line:0,col:$};let z=this.lineStarts[Z-1];return{line:Z,col:$-z+1}}}}BO.LineCounter=pX});var WZ=E((LO)=>{var OO=C0("process"),iX=_8(),NO=QZ();function I1($,Z){for(let X=0;X<$.length;++X)if($[X].type===Z)return!0;return!1}function nX($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function sX($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function C8($){switch($.type){case"document":return $.start;case"block-map":{let Z=$.items[$.items.length-1];return Z.sep??Z.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function H$($){if($.length===0)return[];let Z=$.length;$:while(--Z>=0)switch($[Z].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++Z]?.type==="space");return $.splice(Z,$.length)}function P8($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let X=0;X<Z.length;++X)$.push(Z[X])}function rX($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!I1(Z.start,"explicit-key-ind")&&!I1(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,sX(Z.value))if(Z.value.end)P8(Z.value.end,Z.sep);else Z.value.end=Z.sep;else P8(Z.start,Z.sep);delete Z.sep}}}class aX{constructor($){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new NO.Lexer,this.onNewLine=$}*parse($,Z=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let X of this.lexer.lex($,Z))yield*this.next(X);if(!Z)yield*this.end()}*next($){if(this.source=$,OO.env.LOG_TOKENS)console.log("|",iX.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=iX.tokenType($);if(!Z){let X=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:X,source:$}),this.offset+=$.length}else if(Z==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=Z,yield*this.step(),Z){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+$.length);break;case"space":if(this.atNewLine&&$[0]===" ")this.indent+=$.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=$.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=$.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let $=this.peek(1);if(this.type==="doc-end"&&$?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!$)return yield*this.stream();switch($.type){case"document":return yield*this.document($);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar($);case"block-scalar":return yield*this.blockScalar($);case"block-map":return yield*this.blockMap($);case"block-seq":return yield*this.blockSequence($);case"flow-collection":return yield*this.flowCollection($);case"doc-end":return yield*this.documentEnd($)}yield*this.pop()}peek($){return this.stack[this.stack.length-$]}*pop($){let Z=$??this.stack.pop();if(!Z)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield Z;else{let X=this.peek(1);if(Z.type==="block-scalar")Z.indent="indent"in X?X.indent:0;else if(Z.type==="flow-collection"&&X.type==="document")Z.indent=0;if(Z.type==="flow-collection")rX(Z);switch(X.type){case"document":X.value=Z;break;case"block-scalar":X.props.push(Z);break;case"block-map":{let z=X.items[X.items.length-1];if(z.value){X.items.push({start:[],key:Z,sep:[]}),this.onKeyLine=!0;return}else if(z.sep)z.value=Z;else{Object.assign(z,{key:Z,sep:[]}),this.onKeyLine=!z.explicitKey;return}break}case"block-seq":{let z=X.items[X.items.length-1];if(z.value)X.items.push({start:[],value:Z});else z.value=Z;break}case"flow-collection":{let z=X.items[X.items.length-1];if(!z||z.value)X.items.push({start:[],key:Z,sep:[]});else if(z.sep)z.value=Z;else Object.assign(z,{key:Z,sep:[]});return}default:yield*this.pop(),yield*this.pop(Z)}if((X.type==="document"||X.type==="block-map"||X.type==="block-seq")&&(Z.type==="block-map"||Z.type==="block-seq")){let z=Z.items[Z.items.length-1];if(z&&!z.sep&&!z.value&&z.start.length>0&&nX(z.start)===-1&&(Z.indent===0||z.start.every((J)=>J.type!=="comment"||J.indent<Z.indent))){if(X.type==="document")X.end=z.start;else X.items.push({start:z.start});Z.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let $={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")$.start.push(this.sourceToken);this.stack.push($);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document($){if($.value)return yield*this.lineEnd($);switch(this.type){case"doc-start":{if(nX($.start)!==-1)yield*this.pop(),yield*this.step();else $.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":$.start.push(this.sourceToken);return}let Z=this.startBlockValue($);if(Z)this.stack.push(Z);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar($){if(this.type==="map-value-ind"){let Z=C8(this.peek(2)),X=H$(Z),z;if($.end)z=$.end,z.push(this.sourceToken),delete $.end;else z=[this.sourceToken];let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}else yield*this.lineEnd($)}*blockScalar($){switch(this.type){case"space":case"comment":case"newline":$.props.push(this.sourceToken);return;case"scalar":if($.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let Z=this.source.indexOf(`
162
162
  `)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
163
- `,Z)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){E8(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let X=!this.onKeyLine&&this.indent===$.indent,z=X&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",J=[];if(z&&Z.sep&&!Z.value){let Q=[];for(let Y=0;Y<Z.sep.length;++Y){let W=Z.sep[Y];switch(W.type){case"newline":Q.push(Y);break;case"space":break;case"comment":if(W.indent>$.indent)Q.length=0;break;default:Q.length=0}}if(Q.length>=2)J=Z.sep.splice(Q[1])}switch(this.type){case"anchor":case"tag":if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(I1(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let Q=H$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(I1(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]});else if(sX(Z.key)&&!I1(Z.sep,"newline")){let Q=H$(Z.start),Y=Z.key,W=Z.sep;W.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:Y,sep:W}]})}else if(J.length>0)Z.sep=Z.sep.concat(J,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||z)$.items.push({start:J,key:null,sep:[this.sourceToken]});else if(I1(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Z.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(z||Z.value)$.items.push({start:J,key:Q,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]}),this.onKeyLine=!0;return}default:{let Q=this.startBlockValue($);if(Q){if(Q.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!I1(Z.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(X)$.items.push({start:J});this.stack.push(Q);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){E8(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||I1(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let X=this.startBlockValue($);if(X){this.stack.push(X);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let X;do yield*this.pop(),X=this.peek(1);while(X?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let z=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:z,sep:[]});else if(Z.sep)this.stack.push(z);else Object.assign(Z,{key:z,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let X=this.startBlockValue($);if(X)this.stack.push(X);else yield*this.pop(),yield*this.step()}else{let X=this.peek(2);if(X.type==="block-map"&&(this.type==="map-value-ind"&&X.indent===$.indent||this.type==="newline"&&!X.items[X.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&X.type!=="flow-collection"){let z=C8(X),J=H$(z);rX($);let Q=$.end.splice(1,$.end.length);Q.push(this.sourceToken);let Y={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:J,key:$,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=Y}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let Z=this.source.indexOf(`
163
+ `,Z)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){P8(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let X=!this.onKeyLine&&this.indent===$.indent,z=X&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",J=[];if(z&&Z.sep&&!Z.value){let Q=[];for(let Y=0;Y<Z.sep.length;++Y){let W=Z.sep[Y];switch(W.type){case"newline":Q.push(Y);break;case"space":break;case"comment":if(W.indent>$.indent)Q.length=0;break;default:Q.length=0}}if(Q.length>=2)J=Z.sep.splice(Q[1])}switch(this.type){case"anchor":case"tag":if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(I1(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let Q=H$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(I1(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]});else if(sX(Z.key)&&!I1(Z.sep,"newline")){let Q=H$(Z.start),Y=Z.key,W=Z.sep;W.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:Y,sep:W}]})}else if(J.length>0)Z.sep=Z.sep.concat(J,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||z)$.items.push({start:J,key:null,sep:[this.sourceToken]});else if(I1(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Z.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(z||Z.value)$.items.push({start:J,key:Q,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]}),this.onKeyLine=!0;return}default:{let Q=this.startBlockValue($);if(Q){if(Q.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!I1(Z.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(X)$.items.push({start:J});this.stack.push(Q);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){P8(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||I1(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let X=this.startBlockValue($);if(X){this.stack.push(X);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let X;do yield*this.pop(),X=this.peek(1);while(X?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let z=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:z,sep:[]});else if(Z.sep)this.stack.push(z);else Object.assign(Z,{key:z,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let X=this.startBlockValue($);if(X)this.stack.push(X);else yield*this.pop(),yield*this.step()}else{let X=this.peek(2);if(X.type==="block-map"&&(this.type==="map-value-ind"&&X.indent===$.indent||this.type==="newline"&&!X.items[X.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&X.type!=="flow-collection"){let z=C8(X),J=H$(z);rX($);let Q=$.end.splice(1,$.end.length);Q.push(this.sourceToken);let Y={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:J,key:$,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=Y}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let Z=this.source.indexOf(`
164
164
  `)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
165
- `,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=C8($),X=H$(Z);return X.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=C8($),X=H$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((X)=>X.type==="newline"||X.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}qO.Parser=aX});var Zz=P((LO)=>{var oX=e3(),VO=M2(),T2=O2(),KO=q3(),HO=i(),BO=qZ(),tX=GZ();function eX($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new BO.LineCounter||null,prettyErrors:Z}}function MO($,Z={}){let{lineCounter:X,prettyErrors:z}=eX(Z),J=new tX.Parser(X?.addNewLine),Q=new oX.Composer(Z),Y=Array.from(Q.compose(J.parse($)));if(z&&X)for(let W of Y)W.errors.forEach(T2.prettifyError($,X)),W.warnings.forEach(T2.prettifyError($,X));if(Y.length>0)return Y;return Object.assign([],{empty:!0},Q.streamInfo())}function $z($,Z={}){let{lineCounter:X,prettyErrors:z}=eX(Z),J=new tX.Parser(X?.addNewLine),Q=new oX.Composer(Z),Y=null;for(let W of Q.compose(J.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new T2.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)Y.errors.forEach(T2.prettifyError($,X)),Y.warnings.forEach(T2.prettifyError($,X));return Y}function OO($,Z,X){let z=void 0;if(typeof Z==="function")z=Z;else if(X===void 0&&Z&&typeof Z==="object")X=Z;let J=$z($,X);if(!J)return null;if(J.warnings.forEach((Q)=>KO.warn(J.options.logLevel,Q)),J.errors.length>0)if(J.options.logLevel!=="silent")throw J.errors[0];else J.errors=[];return J.toJS(Object.assign({reviver:z},X))}function NO($,Z,X){let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z;if(typeof X==="string")X=X.length;if(typeof X==="number"){let J=Math.round(X);X=J<1?void 0:J>8?{indent:8}:{indent:J}}if($===void 0){let{keepUndefined:J}=X??Z??{};if(!J)return}if(HO.isDocument($)&&!z)return $.toString(X);return new VO.Document($,z,X).toString(X)}LO.parse=OO;LO.parseAllDocuments=MO;LO.parseDocument=$z;LO.stringify=NO});var Uz={};w9(Uz,{orange:()=>H0,italic:()=>qN,fafCyanDeep:()=>w8,fafCyan:()=>I,dim:()=>M,bold:()=>A,FAF_HEX:()=>R2});var HZ=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,A,M,qN,R2,I=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,w8=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,H0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var l=v(()=>{A=HZ("1"),M=HZ("2"),qN=HZ("3"),R2={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var $5=P((Vb,dA)=>{dA.exports={name:"faf-cli",version:"7.11.0",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && tsc -p tsconfig.build.json",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint src/**/*.ts",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)",prepublishOnly:"bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","bi-sync","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^2.0.3",open:"^11.0.0",yaml:"^2.9.0"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.5",picomatch:"^4.0.5"},engines:{node:">=18.0.0"},publishConfig:{access:"public"}}});function w($,Z,X,z,J){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!J)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!J:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?J.call($,X):J?J.value=X:Z.set($,X),X}function N($,Z,X,z){if(X==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!z:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?z:X==="a"?z.call($):z?z.value:Z.get($)}var W1=()=>{};var X5=function(){let{crypto:$}=globalThis;if($?.randomUUID)return X5=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),X=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(z)=>(+z^X()&15>>+z/4).toString(16))};function U1($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var i2=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var k,W0,O0,C1,w$,S$,j$,x$,b$,k$,y$,v$,g$;var _0=v(()=>{k=class k extends Error{};W0=class W0 extends k{constructor($,Z,X,z,J){super(`${W0.makeMessage($,Z,X)}`);this.status=$,this.headers=z,this.requestID=z?.get("request-id"),this.error=Z,this.type=J??null}static makeMessage($,Z,X){let z=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):X;if($&&z)return`${$} ${z}`;if($)return`${$} status code (no body)`;if(z)return z;return"(no status code or body)"}static generate($,Z,X,z){if(!$||!z)return new C1({message:X,cause:i2(Z)});let J=Z,Q=J?.error?.type;if($===400)return new S$($,J,X,z,Q);if($===401)return new j$($,J,X,z,Q);if($===403)return new x$($,J,X,z,Q);if($===404)return new b$($,J,X,z,Q);if($===409)return new k$($,J,X,z,Q);if($===422)return new y$($,J,X,z,Q);if($===429)return new v$($,J,X,z,Q);if($>=500)return new g$($,J,X,z,Q);return new W0($,J,X,z,Q)}};O0=class O0 extends W0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};C1=class C1 extends W0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};w$=class w$ extends C1{constructor({message:$}={}){super({message:$??"Request timed out."})}};S$=class S$ extends W0{};j$=class j$ extends W0{};x$=class x$ extends W0{};b$=class b$ extends W0{};k$=class k$ extends W0{};y$=class y$ extends W0{};v$=class v$ extends W0{};g$=class g$ extends W0{}});function O4($){if(typeof $!=="object")return{};return $??{}}function Q5($){if(!$)return!0;for(let Z in $)return!1;return!0}function cQ($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var CR,mQ=($)=>{return CR.test($)},z5=($)=>(z5=Array.isArray,z5($)),J5,lQ=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new k(`${$} must be an integer`);if(Z<0)throw new k(`${$} must be a positive integer`);return Z},N4=($)=>{try{return JSON.parse($)}catch(Z){return}};var r1=v(()=>{_0();CR=/^[a-z][a-z0-9+.-]*:/i,J5=z5});var dQ=($)=>new Promise((Z)=>setTimeout(Z,$));var E1="0.91.1";function ER(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function wR(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:X}of $){let z=X.exec(navigator.userAgent);if(z){let J=z[1]||0,Q=z[2]||0,Y=z[3]||0;return{browser:Z,version:`${J}.${Q}.${Y}`}}}return null}var rQ=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},PR=()=>{let $=ER();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":E1,"X-Stainless-OS":iQ(Deno.build.os),"X-Stainless-Arch":pQ(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":E1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":E1,"X-Stainless-OS":iQ(globalThis.process.platform??"unknown"),"X-Stainless-Arch":pQ(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=wR();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":E1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":E1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},pQ=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},iQ=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},nQ,sQ=()=>{return nQ??(nQ=PR())};var Y5=()=>{};function aQ(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function W5(...$){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...$)}function L4($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return W5({start(){},async pull(X){let{done:z,value:J}=await Z.next();if(z)X.close();else X.enqueue(J)},async cancel(){await Z.return?.()}})}function n2($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let X=await Z.read();if(X?.done)Z.releaseLock();return X}catch(X){throw Z.releaseLock(),X}},async return(){let X=Z.cancel();return Z.releaseLock(),await X,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function oQ($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var tQ=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function eQ($){return Object.entries($).filter(([Z,X])=>typeof X<"u").map(([Z,X])=>{if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(X)}`;if(X===null)return`${encodeURIComponent(Z)}=`;throw new k(`Cannot stringify type ${typeof X}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var $Y=v(()=>{_0()});function zY($){let Z=0;for(let J of $)Z+=J.length;let X=new Uint8Array(Z),z=0;for(let J of $)X.set(J,z),z+=J.length;return X}function r2($){let Z;return(ZY??(Z=new globalThis.TextEncoder,ZY=Z.encode.bind(Z)))($)}function U5($){let Z;return(XY??(Z=new globalThis.TextDecoder,XY=Z.decode.bind(Z)))($)}var ZY,XY;class P1{constructor(){S0.set(this,void 0),j0.set(this,void 0),w(this,S0,new Uint8Array,"f"),w(this,j0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?r2($):$;w(this,S0,zY([N(this,S0,"f"),Z]),"f");let X=[],z;while((z=xR(N(this,S0,"f"),N(this,j0,"f")))!=null){if(z.carriage&&N(this,j0,"f")==null){w(this,j0,z.index,"f");continue}if(N(this,j0,"f")!=null&&(z.index!==N(this,j0,"f")+1||z.carriage)){X.push(U5(N(this,S0,"f").subarray(0,N(this,j0,"f")-1))),w(this,S0,N(this,S0,"f").subarray(N(this,j0,"f")),"f"),w(this,j0,null,"f");continue}let J=N(this,j0,"f")!==null?z.preceding-1:z.preceding,Q=U5(N(this,S0,"f").subarray(0,J));X.push(Q),w(this,S0,N(this,S0,"f").subarray(z.index),"f"),w(this,j0,null,"f")}return X}flush(){if(!N(this,S0,"f").length)return[];return this.decode(`
166
- `)}}function xR($,Z){for(let J=Z??0;J<$.length;J++){if($[J]===10)return{preceding:J,index:J+1,carriage:!1};if($[J]===13)return{preceding:J,index:J+1,carriage:!0}}return null}function JY($){for(let z=0;z<$.length-1;z++){if($[z]===10&&$[z+1]===10)return z+2;if($[z]===13&&$[z+1]===13)return z+2;if($[z]===13&&$[z+1]===10&&z+3<$.length&&$[z+2]===13&&$[z+3]===10)return z+4}return-1}var S0,j0;var q5=v(()=>{W1();S0=new WeakMap,j0=new WeakMap;P1.NEWLINE_CHARS=new Set([`
167
- `,"\r"]);P1.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function s2(){}function D4($,Z,X){if(!Z||I4[$]>I4[X])return s2;else return Z[$].bind(Z)}function M0($){let Z=$.logger,X=$.logLevel??"off";if(!Z)return bR;let z=QY.get(Z);if(z&&z[0]===X)return z[1];let J={error:D4("error",Z,X),warn:D4("warn",Z,X),info:D4("info",Z,X),debug:D4("debug",Z,X)};return QY.set(Z,[X,J]),J}var I4,G5=($,Z,X)=>{if(!$)return;if(cQ(I4,$))return $;M0(X).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(I4))}`);return},bR,QY,q1=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,X])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":X]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var T4=v(()=>{r1();I4={off:0,error:200,warn:300,info:400,debug:500};bR={error:s2,warn:s2,info:s2,debug:s2},QY=new WeakMap});async function*kR($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}let X=new YY,z=new P1,J=n2($.body);for await(let Q of yR(J))for(let Y of z.decode(Q)){let W=X.decode(Y);if(W)yield W}for(let Q of z.flush()){let Y=X.decode(Q);if(Y)yield Y}}async function*yR($){let Z=new Uint8Array;for await(let X of $){if(X==null)continue;let z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?r2(X):X,J=new Uint8Array(Z.length+z.length);J.set(Z),J.set(z,Z.length),Z=J;let Q;while((Q=JY(Z))!==-1)yield Z.slice(0,Q),Z=Z.slice(Q)}if(Z.length>0)yield Z}class YY{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let J={event:this.event,data:this.data.join(`
168
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],J}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,X,z]=vR($,":");if(z.startsWith(" "))z=z.substring(1);if(Z==="event")this.event=z;else if(Z==="data")this.data.push(z);return null}}function vR($,Z){let X=$.indexOf(Z);if(X!==-1)return[$.substring(0,X),Z,$.substring(X+Z.length)];return[$,"",""]}var a2,x0;var V5=v(()=>{W1();_0();q5();r1();T4();_0();x0=class x0{constructor($,Z,X){this.iterator=$,a2.set(this,void 0),this.controller=Z,w(this,a2,X,"f")}static fromSSEResponse($,Z,X){let z=!1,J=X?M0(X):console;async function*Q(){if(z)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let W of kR($,Z)){if(W.event==="completion")try{yield JSON.parse(W.data)}catch(U){throw J.error("Could not parse message into JSON:",W.data),J.error("From chunk:",W.raw),U}if(W.event==="message_start"||W.event==="message_delta"||W.event==="message_stop"||W.event==="content_block_start"||W.event==="content_block_delta"||W.event==="content_block_stop"||W.event==="message"||W.event==="user.message"||W.event==="user.interrupt"||W.event==="user.tool_confirmation"||W.event==="user.custom_tool_result"||W.event==="agent.message"||W.event==="agent.thinking"||W.event==="agent.tool_use"||W.event==="agent.tool_result"||W.event==="agent.mcp_tool_use"||W.event==="agent.mcp_tool_result"||W.event==="agent.custom_tool_use"||W.event==="agent.thread_context_compacted"||W.event==="session.status_running"||W.event==="session.status_idle"||W.event==="session.status_rescheduled"||W.event==="session.status_terminated"||W.event==="session.error"||W.event==="session.deleted"||W.event==="span.model_request_start"||W.event==="span.model_request_end")try{yield JSON.parse(W.data)}catch(U){throw J.error("Could not parse message into JSON:",W.data),J.error("From chunk:",W.raw),U}if(W.event==="ping")continue;if(W.event==="error"){let U=N4(W.data)??W.data,q=U?.error?.type;throw new W0(void 0,U,void 0,$.headers,q)}}Y=!0}catch(W){if(U1(W))return;throw W}finally{if(!Y)Z.abort()}}return new x0(Q,Z,X)}static fromReadableStream($,Z,X){let z=!1;async function*J(){let Y=new P1,W=n2($);for await(let U of W)for(let q of Y.decode(U))yield q;for(let U of Y.flush())yield U}async function*Q(){if(z)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let W of J()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(U1(W))return;throw W}finally{if(!Y)Z.abort()}}return new x0(Q,Z,X)}[(a2=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],X=this.iterator(),z=(J)=>{return{next:()=>{if(J.length===0){let Q=X.next();$.push(Q),Z.push(Q)}return J.shift()}}};return[new x0(()=>z($),this.controller,N(this,a2,"f")),new x0(()=>z(Z),this.controller,N(this,a2,"f"))]}toReadableStream(){let $=this,Z;return W5({async start(){Z=$[Symbol.asyncIterator]()},async pull(X){try{let{value:z,done:J}=await Z.next();if(J)return X.close();let Q=r2(JSON.stringify(z)+`
169
- `);X.enqueue(Q)}catch(z){X.error(z)}},async cancel(){await Z.return?.()}})}}});async function A4($,Z){let{response:X,requestLogID:z,retryOfRequestLogID:J,startTime:Q}=Z,Y=await(async()=>{if(Z.options.stream){if(M0($).debug("response",X.status,X.url,X.headers,X.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(X,Z.controller);return x0.fromSSEResponse(X,Z.controller)}if(X.status===204)return null;if(Z.options.__binaryResponse)return X;let U=X.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(X.headers.get("content-length")==="0")return;let K=await X.json();return K5(K,X)}return await X.text()})();return M0($).debug(`[${z}] response parsed`,q1({retryOfRequestLogID:J,url:X.url,status:X.status,body:Y,durationMs:Date.now()-Q})),Y}function K5($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var H5=v(()=>{V5();T4()});var o2,w1;var R4=v(()=>{W1();H5();w1=class w1 extends Promise{constructor($,Z,X=A4){super((z)=>{z(null)});this.responsePromise=Z,this.parseResponse=X,o2.set(this,void 0),w(this,o2,$,"f")}_thenUnwrap($){return new w1(N(this,o2,"f"),this.responsePromise,async(Z,X)=>K5($(await this.parseResponse(Z,X),X),X.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,Z]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:Z,request_id:Z.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(N(this,o2,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};o2=new WeakMap});var _4,B5,t2,r0,o;var z0=v(()=>{W1();_0();H5();R4();r1();B5=class B5{constructor($,Z,X,z){_4.set(this,void 0),w(this,_4,$,"f"),this.options=z,this.response=Z,this.body=X}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new k("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await N(this,_4,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(_4=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};t2=class t2 extends w1{constructor($,Z,X){super($,Z,async(z,J)=>new X(z,J.response,await A4(z,J),J.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};r0=class r0 extends B5{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.has_more=X.has_more||!1,this.first_id=X.first_id||null,this.last_id=X.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let Z=this.first_id;if(!Z)return null;return{...this.options,query:{...O4(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...O4(this.options.query),after_id:$}}}};o=class o extends B5{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.next_page=X.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...O4(this.options.query),page:$}}}}});function s1($,Z,X){return O5(),new File($,Z??"unknown_file",X)}function e2($,Z){let X=typeof $==="object"&&$!==null&&(("name"in $)&&$.name&&String($.name)||("url"in $)&&$.url&&String($.url)||("filename"in $)&&$.filename&&String($.filename)||("path"in $)&&$.path&&String($.path))||"";return Z?X.split(/[\\/]/).pop()||void 0:X}function fR($){let Z=typeof $==="function"?$:$.fetch,X=WY.get(Z);if(X)return X;let z=(async()=>{try{let J="Response"in Z?Z.Response:(await Z("data:,")).constructor,Q=new FormData;if(Q.toString()===await new J(Q).text())return!1;return!0}catch{return!0}})();return WY.set(Z,z),z}var O5=()=>{if(typeof File>"u"){let{process:$}=globalThis,Z=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(Z?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},N5=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",f$=async($,Z,X=!0)=>{return{...$,body:await hR($.body,Z,X)}},WY,hR=async($,Z,X=!0)=>{if(!await fR(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let z=new FormData;return await Promise.all(Object.entries($||{}).map(([J,Q])=>M5(z,J,Q,X))),z},uR=($)=>$ instanceof Blob&&("name"in $),M5=async($,Z,X,z)=>{if(X===void 0)return;if(X==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")$.append(Z,String(X));else if(X instanceof Response){let J={},Q=X.headers.get("Content-Type");if(Q)J={type:Q};$.append(Z,s1([await X.blob()],e2(X,z),J))}else if(N5(X))$.append(Z,s1([await new Response(L4(X)).blob()],e2(X,z)));else if(uR(X))$.append(Z,s1([X],e2(X,z),{type:X.type}));else if(Array.isArray(X))await Promise.all(X.map((J)=>M5($,Z+"[]",J,z)));else if(typeof X==="object")await Promise.all(Object.entries(X).map(([J,Q])=>M5($,`${Z}[${J}]`,Q,z)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${X} instead`)};var h$=v(()=>{WY=new WeakMap});async function $6($,Z,X){if(O5(),$=await $,Z||(Z=e2($,!0)),mR($)){if($ instanceof File&&Z==null&&X==null)return $;return s1([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...X})}if(cR($)){let J=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),s1(await L5(J),Z,X)}let z=await L5($);if(!X?.type){let J=z.find((Q)=>typeof Q==="object"&&("type"in Q)&&Q.type);if(typeof J==="string")X={...X,type:J}}return s1(z,Z,X)}async function L5($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(UY($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(N5($))for await(let X of $)Z.push(...await L5(X));else{let X=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${X?`; constructor: ${X}`:""}${lR($)}`)}return Z}function lR($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((X)=>`"${X}"`).join(", ")}]`}var UY=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",mR=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&UY($),cR=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var qY=v(()=>{h$();h$()});var D5=v(()=>{qY()});var GY=()=>{};class h{constructor($){this._client=$}}function*pR($){if(!$)return;if(VY in $){let{values:z,nulls:J}=$;yield*z.entries();for(let Q of J)yield[Q,null];return}let Z=!1,X;if($ instanceof Headers)X=$.entries();else if(J5($))X=$;else Z=!0,X=Object.entries($??{});for(let z of X){let J=z[0];if(typeof J!=="string")throw TypeError("expected header name to be a string");let Q=J5(z[1])?z[1]:[z[1]],Y=!1;for(let W of Q){if(W===void 0)continue;if(Z&&!Y)Y=!0,yield[J,null];yield[J,W]}}}var VY,D=($)=>{let Z=new Headers,X=new Set;for(let z of $){let J=new Set;for(let[Q,Y]of pR(z)){let W=Q.toLowerCase();if(!J.has(W))Z.delete(Q),J.add(W);if(Y===null)Z.delete(Q),X.add(W);else Z.append(Q,Y),X.delete(W)}}return{[VY]:!0,values:Z,nulls:X}};var e=v(()=>{r1();VY=Symbol.for("brand.privateNullableHeaders")});function HY($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var KY,iR=($=HY)=>function(X,...z){if(X.length===1)return X[0];let J=!1,Q=[],Y=X.reduce((G,V,K)=>{if(/[?#]/.test(V))J=!0;let H=z[K],L=(J?encodeURIComponent:$)(""+H);if(K!==z.length&&(H==null||typeof H==="object"&&H.toString===Object.getPrototypeOf(Object.getPrototypeOf(H.hasOwnProperty??KY)??KY)?.toString))L=H+"",Q.push({start:G.length+V.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(H).slice(8,-1)} is not a valid path parameter`});return G+V+(K===z.length?"":L)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,q;while((q=U.exec(W))!==null)Q.push({start:q.index,length:q[0].length,error:`Value "${q[0]}" can't be safely passed as a path parameter`});if(Q.sort((G,V)=>G.start-V.start),Q.length>0){let G=0,V=Q.reduce((K,H)=>{let L=" ".repeat(H.start-G),B="^".repeat(H.length);return G=H.start+H.length,K+L+B},"");throw new k(`Path parameters result in path with invalid segments:
165
+ `,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=C8($),X=H$(Z);return X.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=C8($),X=H$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((X)=>X.type==="newline"||X.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}LO.Parser=aX});var Zz=E((PO)=>{var oX=a3(),IO=M2(),T2=O2(),TO=Y3(),AO=i(),RO=YZ(),tX=WZ();function eX($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new RO.LineCounter||null,prettyErrors:Z}}function _O($,Z={}){let{lineCounter:X,prettyErrors:z}=eX(Z),J=new tX.Parser(X?.addNewLine),Q=new oX.Composer(Z),Y=Array.from(Q.compose(J.parse($)));if(z&&X)for(let W of Y)W.errors.forEach(T2.prettifyError($,X)),W.warnings.forEach(T2.prettifyError($,X));if(Y.length>0)return Y;return Object.assign([],{empty:!0},Q.streamInfo())}function $z($,Z={}){let{lineCounter:X,prettyErrors:z}=eX(Z),J=new tX.Parser(X?.addNewLine),Q=new oX.Composer(Z),Y=null;for(let W of Q.compose(J.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new T2.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)Y.errors.forEach(T2.prettifyError($,X)),Y.warnings.forEach(T2.prettifyError($,X));return Y}function FO($,Z,X){let z=void 0;if(typeof Z==="function")z=Z;else if(X===void 0&&Z&&typeof Z==="object")X=Z;let J=$z($,X);if(!J)return null;if(J.warnings.forEach((Q)=>TO.warn(J.options.logLevel,Q)),J.errors.length>0)if(J.options.logLevel!=="silent")throw J.errors[0];else J.errors=[];return J.toJS(Object.assign({reviver:z},X))}function CO($,Z,X){let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z;if(typeof X==="string")X=X.length;if(typeof X==="number"){let J=Math.round(X);X=J<1?void 0:J>8?{indent:8}:{indent:J}}if($===void 0){let{keepUndefined:J}=X??Z??{};if(!J)return}if(AO.isDocument($)&&!z)return $.toString(X);return new IO.Document($,z,X).toString(X)}PO.parse=FO;PO.parseAllDocuments=_O;PO.parseDocument=$z;PO.stringify=CO});var Uz={};w9(Uz,{orange:()=>H0,italic:()=>LN,fafCyanDeep:()=>w8,fafCyan:()=>I,dim:()=>M,bold:()=>A,FAF_HEX:()=>R2});var GZ=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,A,M,LN,R2,I=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,w8=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,H0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var l=v(()=>{A=GZ("1"),M=GZ("2"),LN=GZ("3"),R2={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var $5=E((Rb,$R)=>{$R.exports={name:"faf-cli",version:"7.12.0",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && tsc -p tsconfig.build.json",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint src/**/*.ts",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)",prepublishOnly:"bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","bi-sync","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^2.0.3",open:"^11.0.0",yaml:"^2.9.0"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.5",picomatch:"^4.0.5"},engines:{node:">=18.0.0"},publishConfig:{access:"public"}}});function w($,Z,X,z,J){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!J)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!J:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?J.call($,X):J?J.value=X:Z.set($,X),X}function N($,Z,X,z){if(X==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!z:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?z:X==="a"?z.call($):z?z.value:Z.get($)}var W1=()=>{};var X5=function(){let{crypto:$}=globalThis;if($?.randomUUID)return X5=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),X=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(z)=>(+z^X()&15>>+z/4).toString(16))};function U1($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var i2=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var k,W0,O0,C1,w$,S$,j$,x$,b$,k$,y$,v$,g$;var _0=v(()=>{k=class k extends Error{};W0=class W0 extends k{constructor($,Z,X,z,J){super(`${W0.makeMessage($,Z,X)}`);this.status=$,this.headers=z,this.requestID=z?.get("request-id"),this.error=Z,this.type=J??null}static makeMessage($,Z,X){let z=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):X;if($&&z)return`${$} ${z}`;if($)return`${$} status code (no body)`;if(z)return z;return"(no status code or body)"}static generate($,Z,X,z){if(!$||!z)return new C1({message:X,cause:i2(Z)});let J=Z,Q=J?.error?.type;if($===400)return new S$($,J,X,z,Q);if($===401)return new j$($,J,X,z,Q);if($===403)return new x$($,J,X,z,Q);if($===404)return new b$($,J,X,z,Q);if($===409)return new k$($,J,X,z,Q);if($===422)return new y$($,J,X,z,Q);if($===429)return new v$($,J,X,z,Q);if($>=500)return new g$($,J,X,z,Q);return new W0($,J,X,z,Q)}};O0=class O0 extends W0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};C1=class C1 extends W0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};w$=class w$ extends C1{constructor({message:$}={}){super({message:$??"Request timed out."})}};S$=class S$ extends W0{};j$=class j$ extends W0{};x$=class x$ extends W0{};b$=class b$ extends W0{};k$=class k$ extends W0{};y$=class y$ extends W0{};v$=class v$ extends W0{};g$=class g$ extends W0{}});function H4($){if(typeof $!=="object")return{};return $??{}}function Q5($){if(!$)return!0;for(let Z in $)return!1;return!0}function oQ($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var vR,aQ=($)=>{return vR.test($)},z5=($)=>(z5=Array.isArray,z5($)),J5,tQ=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new k(`${$} must be an integer`);if(Z<0)throw new k(`${$} must be a positive integer`);return Z},B4=($)=>{try{return JSON.parse($)}catch(Z){return}};var r1=v(()=>{_0();vR=/^[a-z][a-z0-9+.-]*:/i,J5=z5});var eQ=($)=>new Promise((Z)=>setTimeout(Z,$));var P1="0.91.1";function gR(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function hR(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:X}of $){let z=X.exec(navigator.userAgent);if(z){let J=z[1]||0,Q=z[2]||0,Y=z[3]||0;return{browser:Z,version:`${J}.${Q}.${Y}`}}}return null}var zY=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},fR=()=>{let $=gR();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":P1,"X-Stainless-OS":ZY(Deno.build.os),"X-Stainless-Arch":$Y(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":P1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":P1,"X-Stainless-OS":ZY(globalThis.process.platform??"unknown"),"X-Stainless-Arch":$Y(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=hR();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":P1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":P1,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},$Y=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},ZY=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},XY,JY=()=>{return XY??(XY=fR())};var Y5=()=>{};function QY(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function W5(...$){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...$)}function M4($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return W5({start(){},async pull(X){let{done:z,value:J}=await Z.next();if(z)X.close();else X.enqueue(J)},async cancel(){await Z.return?.()}})}function n2($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let X=await Z.read();if(X?.done)Z.releaseLock();return X}catch(X){throw Z.releaseLock(),X}},async return(){let X=Z.cancel();return Z.releaseLock(),await X,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function YY($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var WY=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function UY($){return Object.entries($).filter(([Z,X])=>typeof X<"u").map(([Z,X])=>{if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(X)}`;if(X===null)return`${encodeURIComponent(Z)}=`;throw new k(`Cannot stringify type ${typeof X}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var qY=v(()=>{_0()});function KY($){let Z=0;for(let J of $)Z+=J.length;let X=new Uint8Array(Z),z=0;for(let J of $)X.set(J,z),z+=J.length;return X}function r2($){let Z;return(GY??(Z=new globalThis.TextEncoder,GY=Z.encode.bind(Z)))($)}function U5($){let Z;return(VY??(Z=new globalThis.TextDecoder,VY=Z.decode.bind(Z)))($)}var GY,VY;class E1{constructor(){S0.set(this,void 0),j0.set(this,void 0),w(this,S0,new Uint8Array,"f"),w(this,j0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?r2($):$;w(this,S0,KY([N(this,S0,"f"),Z]),"f");let X=[],z;while((z=cR(N(this,S0,"f"),N(this,j0,"f")))!=null){if(z.carriage&&N(this,j0,"f")==null){w(this,j0,z.index,"f");continue}if(N(this,j0,"f")!=null&&(z.index!==N(this,j0,"f")+1||z.carriage)){X.push(U5(N(this,S0,"f").subarray(0,N(this,j0,"f")-1))),w(this,S0,N(this,S0,"f").subarray(N(this,j0,"f")),"f"),w(this,j0,null,"f");continue}let J=N(this,j0,"f")!==null?z.preceding-1:z.preceding,Q=U5(N(this,S0,"f").subarray(0,J));X.push(Q),w(this,S0,N(this,S0,"f").subarray(z.index),"f"),w(this,j0,null,"f")}return X}flush(){if(!N(this,S0,"f").length)return[];return this.decode(`
166
+ `)}}function cR($,Z){for(let J=Z??0;J<$.length;J++){if($[J]===10)return{preceding:J,index:J+1,carriage:!1};if($[J]===13)return{preceding:J,index:J+1,carriage:!0}}return null}function HY($){for(let z=0;z<$.length-1;z++){if($[z]===10&&$[z+1]===10)return z+2;if($[z]===13&&$[z+1]===13)return z+2;if($[z]===13&&$[z+1]===10&&z+3<$.length&&$[z+2]===13&&$[z+3]===10)return z+4}return-1}var S0,j0;var q5=v(()=>{W1();S0=new WeakMap,j0=new WeakMap;E1.NEWLINE_CHARS=new Set([`
167
+ `,"\r"]);E1.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function s2(){}function O4($,Z,X){if(!Z||N4[$]>N4[X])return s2;else return Z[$].bind(Z)}function M0($){let Z=$.logger,X=$.logLevel??"off";if(!Z)return lR;let z=BY.get(Z);if(z&&z[0]===X)return z[1];let J={error:O4("error",Z,X),warn:O4("warn",Z,X),info:O4("info",Z,X),debug:O4("debug",Z,X)};return BY.set(Z,[X,J]),J}var N4,G5=($,Z,X)=>{if(!$)return;if(oQ(N4,$))return $;M0(X).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(N4))}`);return},lR,BY,q1=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,X])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":X]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var L4=v(()=>{r1();N4={off:0,error:200,warn:300,info:400,debug:500};lR={error:s2,warn:s2,info:s2,debug:s2},BY=new WeakMap});async function*dR($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}let X=new MY,z=new E1,J=n2($.body);for await(let Q of pR(J))for(let Y of z.decode(Q)){let W=X.decode(Y);if(W)yield W}for(let Q of z.flush()){let Y=X.decode(Q);if(Y)yield Y}}async function*pR($){let Z=new Uint8Array;for await(let X of $){if(X==null)continue;let z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?r2(X):X,J=new Uint8Array(Z.length+z.length);J.set(Z),J.set(z,Z.length),Z=J;let Q;while((Q=HY(Z))!==-1)yield Z.slice(0,Q),Z=Z.slice(Q)}if(Z.length>0)yield Z}class MY{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let J={event:this.event,data:this.data.join(`
168
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],J}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,X,z]=iR($,":");if(z.startsWith(" "))z=z.substring(1);if(Z==="event")this.event=z;else if(Z==="data")this.data.push(z);return null}}function iR($,Z){let X=$.indexOf(Z);if(X!==-1)return[$.substring(0,X),Z,$.substring(X+Z.length)];return[$,"",""]}var a2,x0;var V5=v(()=>{W1();_0();q5();r1();L4();_0();x0=class x0{constructor($,Z,X){this.iterator=$,a2.set(this,void 0),this.controller=Z,w(this,a2,X,"f")}static fromSSEResponse($,Z,X){let z=!1,J=X?M0(X):console;async function*Q(){if(z)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let W of dR($,Z)){if(W.event==="completion")try{yield JSON.parse(W.data)}catch(U){throw J.error("Could not parse message into JSON:",W.data),J.error("From chunk:",W.raw),U}if(W.event==="message_start"||W.event==="message_delta"||W.event==="message_stop"||W.event==="content_block_start"||W.event==="content_block_delta"||W.event==="content_block_stop"||W.event==="message"||W.event==="user.message"||W.event==="user.interrupt"||W.event==="user.tool_confirmation"||W.event==="user.custom_tool_result"||W.event==="agent.message"||W.event==="agent.thinking"||W.event==="agent.tool_use"||W.event==="agent.tool_result"||W.event==="agent.mcp_tool_use"||W.event==="agent.mcp_tool_result"||W.event==="agent.custom_tool_use"||W.event==="agent.thread_context_compacted"||W.event==="session.status_running"||W.event==="session.status_idle"||W.event==="session.status_rescheduled"||W.event==="session.status_terminated"||W.event==="session.error"||W.event==="session.deleted"||W.event==="span.model_request_start"||W.event==="span.model_request_end")try{yield JSON.parse(W.data)}catch(U){throw J.error("Could not parse message into JSON:",W.data),J.error("From chunk:",W.raw),U}if(W.event==="ping")continue;if(W.event==="error"){let U=B4(W.data)??W.data,q=U?.error?.type;throw new W0(void 0,U,void 0,$.headers,q)}}Y=!0}catch(W){if(U1(W))return;throw W}finally{if(!Y)Z.abort()}}return new x0(Q,Z,X)}static fromReadableStream($,Z,X){let z=!1;async function*J(){let Y=new E1,W=n2($);for await(let U of W)for(let q of Y.decode(U))yield q;for(let U of Y.flush())yield U}async function*Q(){if(z)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Y=!1;try{for await(let W of J()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(U1(W))return;throw W}finally{if(!Y)Z.abort()}}return new x0(Q,Z,X)}[(a2=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],X=this.iterator(),z=(J)=>{return{next:()=>{if(J.length===0){let Q=X.next();$.push(Q),Z.push(Q)}return J.shift()}}};return[new x0(()=>z($),this.controller,N(this,a2,"f")),new x0(()=>z(Z),this.controller,N(this,a2,"f"))]}toReadableStream(){let $=this,Z;return W5({async start(){Z=$[Symbol.asyncIterator]()},async pull(X){try{let{value:z,done:J}=await Z.next();if(J)return X.close();let Q=r2(JSON.stringify(z)+`
169
+ `);X.enqueue(Q)}catch(z){X.error(z)}},async cancel(){await Z.return?.()}})}}});async function D4($,Z){let{response:X,requestLogID:z,retryOfRequestLogID:J,startTime:Q}=Z,Y=await(async()=>{if(Z.options.stream){if(M0($).debug("response",X.status,X.url,X.headers,X.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(X,Z.controller);return x0.fromSSEResponse(X,Z.controller)}if(X.status===204)return null;if(Z.options.__binaryResponse)return X;let U=X.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(X.headers.get("content-length")==="0")return;let K=await X.json();return K5(K,X)}return await X.text()})();return M0($).debug(`[${z}] response parsed`,q1({retryOfRequestLogID:J,url:X.url,status:X.status,body:Y,durationMs:Date.now()-Q})),Y}function K5($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var H5=v(()=>{V5();L4()});var o2,w1;var I4=v(()=>{W1();H5();w1=class w1 extends Promise{constructor($,Z,X=D4){super((z)=>{z(null)});this.responsePromise=Z,this.parseResponse=X,o2.set(this,void 0),w(this,o2,$,"f")}_thenUnwrap($){return new w1(N(this,o2,"f"),this.responsePromise,async(Z,X)=>K5($(await this.parseResponse(Z,X),X),X.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,Z]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:Z,request_id:Z.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(N(this,o2,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};o2=new WeakMap});var T4,B5,t2,r0,o;var z0=v(()=>{W1();_0();H5();I4();r1();B5=class B5{constructor($,Z,X,z){T4.set(this,void 0),w(this,T4,$,"f"),this.options=z,this.response=Z,this.body=X}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new k("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await N(this,T4,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(T4=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};t2=class t2 extends w1{constructor($,Z,X){super($,Z,async(z,J)=>new X(z,J.response,await D4(z,J),J.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};r0=class r0 extends B5{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.has_more=X.has_more||!1,this.first_id=X.first_id||null,this.last_id=X.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let Z=this.first_id;if(!Z)return null;return{...this.options,query:{...H4(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...H4(this.options.query),after_id:$}}}};o=class o extends B5{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.next_page=X.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...H4(this.options.query),page:$}}}}});function s1($,Z,X){return O5(),new File($,Z??"unknown_file",X)}function e2($,Z){let X=typeof $==="object"&&$!==null&&(("name"in $)&&$.name&&String($.name)||("url"in $)&&$.url&&String($.url)||("filename"in $)&&$.filename&&String($.filename)||("path"in $)&&$.path&&String($.path))||"";return Z?X.split(/[\\/]/).pop()||void 0:X}function rR($){let Z=typeof $==="function"?$:$.fetch,X=OY.get(Z);if(X)return X;let z=(async()=>{try{let J="Response"in Z?Z.Response:(await Z("data:,")).constructor,Q=new FormData;if(Q.toString()===await new J(Q).text())return!1;return!0}catch{return!0}})();return OY.set(Z,z),z}var O5=()=>{if(typeof File>"u"){let{process:$}=globalThis,Z=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(Z?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},N5=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",f$=async($,Z,X=!0)=>{return{...$,body:await sR($.body,Z,X)}},OY,sR=async($,Z,X=!0)=>{if(!await rR(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let z=new FormData;return await Promise.all(Object.entries($||{}).map(([J,Q])=>M5(z,J,Q,X))),z},aR=($)=>$ instanceof Blob&&("name"in $),M5=async($,Z,X,z)=>{if(X===void 0)return;if(X==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")$.append(Z,String(X));else if(X instanceof Response){let J={},Q=X.headers.get("Content-Type");if(Q)J={type:Q};$.append(Z,s1([await X.blob()],e2(X,z),J))}else if(N5(X))$.append(Z,s1([await new Response(M4(X)).blob()],e2(X,z)));else if(aR(X))$.append(Z,s1([X],e2(X,z),{type:X.type}));else if(Array.isArray(X))await Promise.all(X.map((J)=>M5($,Z+"[]",J,z)));else if(typeof X==="object")await Promise.all(Object.entries(X).map(([J,Q])=>M5($,`${Z}[${J}]`,Q,z)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${X} instead`)};var h$=v(()=>{OY=new WeakMap});async function $6($,Z,X){if(O5(),$=await $,Z||(Z=e2($,!0)),oR($)){if($ instanceof File&&Z==null&&X==null)return $;return s1([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...X})}if(tR($)){let J=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),s1(await L5(J),Z,X)}let z=await L5($);if(!X?.type){let J=z.find((Q)=>typeof Q==="object"&&("type"in Q)&&Q.type);if(typeof J==="string")X={...X,type:J}}return s1(z,Z,X)}async function L5($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(NY($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(N5($))for await(let X of $)Z.push(...await L5(X));else{let X=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${X?`; constructor: ${X}`:""}${eR($)}`)}return Z}function eR($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((X)=>`"${X}"`).join(", ")}]`}var NY=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",oR=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&NY($),tR=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var LY=v(()=>{h$();h$()});var D5=v(()=>{LY()});var DY=()=>{};class h{constructor($){this._client=$}}function*Z_($){if(!$)return;if(IY in $){let{values:z,nulls:J}=$;yield*z.entries();for(let Q of J)yield[Q,null];return}let Z=!1,X;if($ instanceof Headers)X=$.entries();else if(J5($))X=$;else Z=!0,X=Object.entries($??{});for(let z of X){let J=z[0];if(typeof J!=="string")throw TypeError("expected header name to be a string");let Q=J5(z[1])?z[1]:[z[1]],Y=!1;for(let W of Q){if(W===void 0)continue;if(Z&&!Y)Y=!0,yield[J,null];yield[J,W]}}}var IY,D=($)=>{let Z=new Headers,X=new Set;for(let z of $){let J=new Set;for(let[Q,Y]of Z_(z)){let W=Q.toLowerCase();if(!J.has(W))Z.delete(Q),J.add(W);if(Y===null)Z.delete(Q),X.add(W);else Z.append(Q,Y),X.delete(W)}}return{[IY]:!0,values:Z,nulls:X}};var e=v(()=>{r1();IY=Symbol.for("brand.privateNullableHeaders")});function AY($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var TY,X_=($=AY)=>function(X,...z){if(X.length===1)return X[0];let J=!1,Q=[],Y=X.reduce((G,V,K)=>{if(/[?#]/.test(V))J=!0;let H=z[K],L=(J?encodeURIComponent:$)(""+H);if(K!==z.length&&(H==null||typeof H==="object"&&H.toString===Object.getPrototypeOf(Object.getPrototypeOf(H.hasOwnProperty??TY)??TY)?.toString))L=H+"",Q.push({start:G.length+V.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(H).slice(8,-1)} is not a valid path parameter`});return G+V+(K===z.length?"":L)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,q;while((q=U.exec(W))!==null)Q.push({start:q.index,length:q[0].length,error:`Value "${q[0]}" can't be safely passed as a path parameter`});if(Q.sort((G,V)=>G.start-V.start),Q.length>0){let G=0,V=Q.reduce((K,H)=>{let L=" ".repeat(H.start-G),B="^".repeat(H.length);return G=H.start+H.length,K+L+B},"");throw new k(`Path parameters result in path with invalid segments:
170
170
  ${Q.map((K)=>K.error).join(`
171
171
  `)}
172
172
  ${Y}
173
- ${V}`)}return Y},C;var U0=v(()=>{_0();KY=Object.freeze(Object.create(null)),C=iR(HY)});var Z6;var I5=v(()=>{z0();e();U0();Z6=class Z6 extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/environments?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/environments/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/environments/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/environments?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/environments/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/environments/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});function F4($){return typeof $==="object"&&$!==null&&X6 in $}function T5($,Z){let X=new Set;if($){for(let z of $)if(F4(z))X.add(z[X6])}if(Z)for(let z of Z){if(F4(z))X.add(z[X6]);if(Array.isArray(z.content)){for(let J of z.content)if(F4(J))X.add(J[X6])}}return Array.from(X)}function C4($,Z){let X=T5($,Z);if(X.length===0)return{};return{"x-stainless-helper":X.join(", ")}}function BY($){if(F4($))return{"x-stainless-helper":$[X6]};return{}}var X6;var z6=v(()=>{X6=Symbol("anthropic.sdk.stainlessHelper")});var J6;var A5=v(()=>{z0();e();z6();h$();U0();J6=class J6 extends h{list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/files?beta=true",r0,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/files/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}download($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/files/${$}/content?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},X?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/files/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}upload($,Z){let{betas:X,...z}=$;return this._client.post("/v1/files?beta=true",f$({body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},BY(z.file),Z?.headers])},this._client))}}});var Q6;var R5=v(()=>{z0();e();U0();Q6=class Q6 extends h{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/models/${$}?beta=true`,{...X,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models?beta=true",r0,{query:z,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var Y6;var _5=v(()=>{z0();e();U0();Y6=class Y6 extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/user_profiles?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/user_profiles/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/user_profiles/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}}});var W6;var F5=v(()=>{z0();e();U0();W6=class W6 extends h{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/agents/${$}/versions?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var u$;var C5=v(()=>{F5();F5();z0();e();U0();u$=class u$ extends h{constructor(){super(...arguments);this.versions=new W6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/agents?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z,...J}=Z??{};return this._client.get(C`/v1/agents/${$}?beta=true`,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/agents/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/agents?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/agents/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};u$.Versions=W6});var U6;var E5=v(()=>{z0();e();U0();U6=class U6 extends h{create($,Z,X){let{view:z,betas:J,...Q}=Z;return this._client.post(C`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:z},body:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(C`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{memory_store_id:z,view:J,betas:Q,...Y}=Z;return this._client.post(C`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{view:J},body:Y,...X,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/memory_stores/${$}/memories?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{memory_store_id:z,expected_content_sha256:J,betas:Q}=Z;return this._client.delete(C`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{expected_content_sha256:J},...X,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var q6;var P5=v(()=>{z0();e();U0();q6=class q6 extends h{retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(C`/v1/memory_stores/${z}/memory_versions/${$}?beta=true`,{query:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/memory_stores/${$}/memory_versions?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}redact($,Z,X){let{memory_store_id:z,betas:J}=Z;return this._client.post(C`/v1/memory_stores/${z}/memory_versions/${$}/redact?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var a1;var w5=v(()=>{E5();E5();P5();P5();z0();e();U0();a1=class a1 extends h{constructor(){super(...arguments);this.memories=new U6(this._client),this.memoryVersions=new q6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/memory_stores?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/memory_stores/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/memory_stores/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/memory_stores/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/memory_stores/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};a1.Memories=U6;a1.MemoryVersions=q6});var m$=v(()=>{_0()});var E4;var S5=v(()=>{E4={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}});function MY($){return $?.output_format??$?.output_config?.format}function j5($,Z,X){let z=MY(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text"){let Q=Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(Q,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return J}),parsed_output:null};return x5($,Z,X)}function x5($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=X_(Z,Q.text);if(z===null)z=Y;let W=Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return Q});return{...$,content:J,parsed_output:z}}function X_($,Z){let X=MY($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new k(`Failed to parse structured output: ${z}`)}}var b5=v(()=>{_0()});var z_=($)=>{let Z=0,X=[];while(Z<$.length){let z=$[Z];if(z==="\\"){Z++;continue}if(z==="{"){X.push({type:"brace",value:"{"}),Z++;continue}if(z==="}"){X.push({type:"brace",value:"}"}),Z++;continue}if(z==="["){X.push({type:"paren",value:"["}),Z++;continue}if(z==="]"){X.push({type:"paren",value:"]"}),Z++;continue}if(z===":"){X.push({type:"separator",value:":"}),Z++;continue}if(z===","){X.push({type:"delimiter",value:","}),Z++;continue}if(z==='"'){let W="",U=!1;z=$[++Z];while(z!=='"'){if(Z===$.length){U=!0;break}if(z==="\\"){if(Z++,Z===$.length){U=!0;break}W+=z+$[Z],z=$[++Z]}else W+=z,z=$[++Z]}if(z=$[++Z],!U)X.push({type:"string",value:W});continue}if(z&&/\s/.test(z)){Z++;continue}let Q=/[0-9]/;if(z&&Q.test(z)||z==="-"||z==="."){let W="";if(z==="-")W+=z,z=$[++Z];while(z&&Q.test(z)||z===".")W+=z,z=$[++Z];X.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(z&&Y.test(z)){let W="";while(z&&Y.test(z)){if(Z===$.length)break;W+=z,z=$[++Z]}if(W=="true"||W=="false"||W==="null")X.push({type:"name",value:W});else{Z++;continue}continue}Z++}return X},c$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),c$($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),c$($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),c$($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),c$($);break;case"delimiter":return $=$.slice(0,$.length-1),c$($);break}return $},J_=($)=>{let Z=[];if($.map((X)=>{if(X.type==="brace")if(X.value==="{")Z.push("}");else Z.splice(Z.lastIndexOf("}"),1);if(X.type==="paren")if(X.value==="[")Z.push("]");else Z.splice(Z.lastIndexOf("]"),1)}),Z.length>0)Z.reverse().map((X)=>{if(X==="}")$.push({type:"brace",value:"}"});else if(X==="]")$.push({type:"paren",value:"]"})});return $},Q_=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},P4=($)=>JSON.parse(Q_(J_(c$(z_($)))));var k5=()=>{};var y5=v(()=>{V5()});function DY($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function IY($){}var h0,S1,l$,G6,w4,V6,K6,S4,H6,G1,B6,j4,x4,o1,b4,k4,M6,v5,OY,y4,g5,f5,h5,NY,LY="__json_buf",O6;var TY=v(()=>{W1();k5();m$();y5();b5();O6=class O6{constructor($,Z){h0.add(this),this.messages=[],this.receivedMessages=[],S1.set(this,void 0),l$.set(this,null),this.controller=new AbortController,G6.set(this,void 0),w4.set(this,()=>{}),V6.set(this,()=>{}),K6.set(this,void 0),S4.set(this,()=>{}),H6.set(this,()=>{}),G1.set(this,{}),B6.set(this,!1),j4.set(this,!1),x4.set(this,!1),o1.set(this,!1),b4.set(this,void 0),k4.set(this,void 0),M6.set(this,void 0),y4.set(this,(X)=>{if(w(this,j4,!0,"f"),U1(X))X=new O0;if(X instanceof O0)return w(this,x4,!0,"f"),this._emit("abort",X);if(X instanceof k)return this._emit("error",X);if(X instanceof Error){let z=new k(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new k(String(X)))}),w(this,G6,new Promise((X,z)=>{w(this,w4,X,"f"),w(this,V6,z,"f")}),"f"),w(this,K6,new Promise((X,z)=>{w(this,S4,X,"f"),w(this,H6,z,"f")}),"f"),N(this,G6,"f").catch(()=>{}),N(this,K6,"f").catch(()=>{}),w(this,l$,$,"f"),w(this,M6,Z?.logger??console,"f")}get response(){return N(this,b4,"f")}get request_id(){return N(this,k4,"f")}async withResponse(){w(this,o1,!0,"f");let $=await N(this,G6,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new O6(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new O6(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return w(J,l$,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},N(this,y4,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{N(this,h0,"m",g5).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)N(this,h0,"m",f5).call(this,W);if(Y.controller.signal?.aborted)throw new O0;N(this,h0,"m",h5).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;w(this,b4,$,"f"),w(this,k4,$?.headers.get("request-id"),"f"),N(this,w4,"f").call(this,$),this._emit("connect")}get ended(){return N(this,B6,"f")}get errored(){return N(this,j4,"f")}get aborted(){return N(this,x4,"f")}abort(){this.controller.abort()}on($,Z){return(N(this,G1,"f")[$]||(N(this,G1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=N(this,G1,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(N(this,G1,"f")[$]||(N(this,G1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(w(this,o1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){w(this,o1,!0,"f"),await N(this,K6,"f")}get currentMessage(){return N(this,S1,"f")}async finalMessage(){return await this.done(),N(this,h0,"m",v5).call(this)}async finalText(){return await this.done(),N(this,h0,"m",OY).call(this)}_emit($,...Z){if(N(this,B6,"f"))return;if($==="end")w(this,B6,!0,"f"),N(this,S4,"f").call(this);let X=N(this,G1,"f")[$];if(X)N(this,G1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!N(this,o1,"f")&&!X?.length)Promise.reject(z);N(this,V6,"f").call(this,z),N(this,H6,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!N(this,o1,"f")&&!X?.length)Promise.reject(z);N(this,V6,"f").call(this,z),N(this,H6,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",N(this,h0,"m",v5).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{N(this,h0,"m",g5).call(this),this._connected(null);let J=x0.fromReadableStream($,this.controller);for await(let Q of J)N(this,h0,"m",f5).call(this,Q);if(J.controller.signal?.aborted)throw new O0;N(this,h0,"m",h5).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(S1=new WeakMap,l$=new WeakMap,G6=new WeakMap,w4=new WeakMap,V6=new WeakMap,K6=new WeakMap,S4=new WeakMap,H6=new WeakMap,G1=new WeakMap,B6=new WeakMap,j4=new WeakMap,x4=new WeakMap,o1=new WeakMap,b4=new WeakMap,k4=new WeakMap,M6=new WeakMap,y4=new WeakMap,h0=new WeakSet,v5=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},OY=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},g5=function(){if(this.ended)return;w(this,S1,void 0,"f")},f5=function(Z){if(this.ended)return;let X=N(this,h0,"m",NY).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(DY(z)&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}case"compaction_delta":{if(z.type==="compaction"&&z.content)this._emit("compaction",z.content);break}default:IY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(j5(X,N(this,l$,"f"),{logger:N(this,M6,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{w(this,S1,X,"f");break}case"content_block_start":case"message_delta":break}},h5=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=N(this,S1,"f");if(!Z)throw new k("request ended without sending any chunks");return w(this,S1,void 0,"f"),j5(Z,N(this,l$,"f"),{logger:N(this,M6,"f")})},NY=function(Z){let X=N(this,S1,"f");if(Z.type==="message_start"){if(X)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new k(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.container=Z.delta.container,X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,X.context_management=Z.context_management,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)X.usage.iterations=Z.usage.iterations;return X;case"content_block_start":return X.content.push(Z.content_block),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&DY(z)){let J=z[LY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,LY,{value:J,enumerable:!1,writable:!0}),J)try{Q.input=P4(J)}catch(Y){let W=new k(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${J}`);N(this,y4,"f").call(this,W)}X.content[Z.index]=Q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}case"compaction_delta":{if(z?.type==="compaction")X.content[Z.index]={...z,content:(z.content||"")+Z.delta.content};break}default:IY(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new x0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var d$;var v4=v(()=>{d$=class d$ extends Error{constructor($){let Z=typeof $==="string"?$:$.map((X)=>{if(X.type==="text")return X.text;return`[${X.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var AY=1e5,RY=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
173
+ ${V}`)}return Y},C;var U0=v(()=>{_0();TY=Object.freeze(Object.create(null)),C=X_(AY)});var Z6;var I5=v(()=>{z0();e();U0();Z6=class Z6 extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/environments?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/environments/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/environments/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/environments?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/environments/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/environments/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});function A4($){return typeof $==="object"&&$!==null&&X6 in $}function T5($,Z){let X=new Set;if($){for(let z of $)if(A4(z))X.add(z[X6])}if(Z)for(let z of Z){if(A4(z))X.add(z[X6]);if(Array.isArray(z.content)){for(let J of z.content)if(A4(J))X.add(J[X6])}}return Array.from(X)}function R4($,Z){let X=T5($,Z);if(X.length===0)return{};return{"x-stainless-helper":X.join(", ")}}function RY($){if(A4($))return{"x-stainless-helper":$[X6]};return{}}var X6;var z6=v(()=>{X6=Symbol("anthropic.sdk.stainlessHelper")});var J6;var A5=v(()=>{z0();e();z6();h$();U0();J6=class J6 extends h{list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/files?beta=true",r0,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/files/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}download($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/files/${$}/content?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},X?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/files/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}upload($,Z){let{betas:X,...z}=$;return this._client.post("/v1/files?beta=true",f$({body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},RY(z.file),Z?.headers])},this._client))}}});var Q6;var R5=v(()=>{z0();e();U0();Q6=class Q6 extends h{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/models/${$}?beta=true`,{...X,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models?beta=true",r0,{query:z,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var Y6;var _5=v(()=>{z0();e();U0();Y6=class Y6 extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/user_profiles?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/user_profiles/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/user_profiles/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},X?.headers])})}}});var W6;var F5=v(()=>{z0();e();U0();W6=class W6 extends h{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/agents/${$}/versions?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var u$;var C5=v(()=>{F5();F5();z0();e();U0();u$=class u$ extends h{constructor(){super(...arguments);this.versions=new W6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/agents?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z,...J}=Z??{};return this._client.get(C`/v1/agents/${$}?beta=true`,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/agents/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/agents?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/agents/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};u$.Versions=W6});var U6;var P5=v(()=>{z0();e();U0();U6=class U6 extends h{create($,Z,X){let{view:z,betas:J,...Q}=Z;return this._client.post(C`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:z},body:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(C`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{memory_store_id:z,view:J,betas:Q,...Y}=Z;return this._client.post(C`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{view:J},body:Y,...X,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/memory_stores/${$}/memories?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{memory_store_id:z,expected_content_sha256:J,betas:Q}=Z;return this._client.delete(C`/v1/memory_stores/${z}/memories/${$}?beta=true`,{query:{expected_content_sha256:J},...X,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var q6;var E5=v(()=>{z0();e();U0();q6=class q6 extends h{retrieve($,Z,X){let{memory_store_id:z,betas:J,...Q}=Z;return this._client.get(C`/v1/memory_stores/${z}/memory_versions/${$}?beta=true`,{query:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/memory_stores/${$}/memory_versions?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}redact($,Z,X){let{memory_store_id:z,betas:J}=Z;return this._client.post(C`/v1/memory_stores/${z}/memory_versions/${$}/redact?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var a1;var w5=v(()=>{P5();P5();E5();E5();z0();e();U0();a1=class a1 extends h{constructor(){super(...arguments);this.memories=new U6(this._client),this.memoryVersions=new q6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/memory_stores?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/memory_stores/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/memory_stores/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/memory_stores/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/memory_stores/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};a1.Memories=U6;a1.MemoryVersions=q6});var m$=v(()=>{_0()});var _4;var S5=v(()=>{_4={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}});function _Y($){return $?.output_format??$?.output_config?.format}function j5($,Z,X){let z=_Y(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text"){let Q=Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(Q,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return J}),parsed_output:null};return x5($,Z,X)}function x5($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=K_(Z,Q.text);if(z===null)z=Y;let W=Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return Q});return{...$,content:J,parsed_output:z}}function K_($,Z){let X=_Y($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new k(`Failed to parse structured output: ${z}`)}}var b5=v(()=>{_0()});var H_=($)=>{let Z=0,X=[];while(Z<$.length){let z=$[Z];if(z==="\\"){Z++;continue}if(z==="{"){X.push({type:"brace",value:"{"}),Z++;continue}if(z==="}"){X.push({type:"brace",value:"}"}),Z++;continue}if(z==="["){X.push({type:"paren",value:"["}),Z++;continue}if(z==="]"){X.push({type:"paren",value:"]"}),Z++;continue}if(z===":"){X.push({type:"separator",value:":"}),Z++;continue}if(z===","){X.push({type:"delimiter",value:","}),Z++;continue}if(z==='"'){let W="",U=!1;z=$[++Z];while(z!=='"'){if(Z===$.length){U=!0;break}if(z==="\\"){if(Z++,Z===$.length){U=!0;break}W+=z+$[Z],z=$[++Z]}else W+=z,z=$[++Z]}if(z=$[++Z],!U)X.push({type:"string",value:W});continue}if(z&&/\s/.test(z)){Z++;continue}let Q=/[0-9]/;if(z&&Q.test(z)||z==="-"||z==="."){let W="";if(z==="-")W+=z,z=$[++Z];while(z&&Q.test(z)||z===".")W+=z,z=$[++Z];X.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(z&&Y.test(z)){let W="";while(z&&Y.test(z)){if(Z===$.length)break;W+=z,z=$[++Z]}if(W=="true"||W=="false"||W==="null")X.push({type:"name",value:W});else{Z++;continue}continue}Z++}return X},c$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),c$($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),c$($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),c$($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),c$($);break;case"delimiter":return $=$.slice(0,$.length-1),c$($);break}return $},B_=($)=>{let Z=[];if($.map((X)=>{if(X.type==="brace")if(X.value==="{")Z.push("}");else Z.splice(Z.lastIndexOf("}"),1);if(X.type==="paren")if(X.value==="[")Z.push("]");else Z.splice(Z.lastIndexOf("]"),1)}),Z.length>0)Z.reverse().map((X)=>{if(X==="}")$.push({type:"brace",value:"}"});else if(X==="]")$.push({type:"paren",value:"]"})});return $},M_=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},F4=($)=>JSON.parse(M_(B_(c$(H_($)))));var k5=()=>{};var y5=v(()=>{V5()});function EY($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function wY($){}var h0,S1,l$,G6,C4,V6,K6,P4,H6,G1,B6,E4,w4,o1,S4,j4,M6,v5,FY,x4,g5,f5,h5,CY,PY="__json_buf",O6;var SY=v(()=>{W1();k5();m$();y5();b5();O6=class O6{constructor($,Z){h0.add(this),this.messages=[],this.receivedMessages=[],S1.set(this,void 0),l$.set(this,null),this.controller=new AbortController,G6.set(this,void 0),C4.set(this,()=>{}),V6.set(this,()=>{}),K6.set(this,void 0),P4.set(this,()=>{}),H6.set(this,()=>{}),G1.set(this,{}),B6.set(this,!1),E4.set(this,!1),w4.set(this,!1),o1.set(this,!1),S4.set(this,void 0),j4.set(this,void 0),M6.set(this,void 0),x4.set(this,(X)=>{if(w(this,E4,!0,"f"),U1(X))X=new O0;if(X instanceof O0)return w(this,w4,!0,"f"),this._emit("abort",X);if(X instanceof k)return this._emit("error",X);if(X instanceof Error){let z=new k(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new k(String(X)))}),w(this,G6,new Promise((X,z)=>{w(this,C4,X,"f"),w(this,V6,z,"f")}),"f"),w(this,K6,new Promise((X,z)=>{w(this,P4,X,"f"),w(this,H6,z,"f")}),"f"),N(this,G6,"f").catch(()=>{}),N(this,K6,"f").catch(()=>{}),w(this,l$,$,"f"),w(this,M6,Z?.logger??console,"f")}get response(){return N(this,S4,"f")}get request_id(){return N(this,j4,"f")}async withResponse(){w(this,o1,!0,"f");let $=await N(this,G6,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new O6(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new O6(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return w(J,l$,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},N(this,x4,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{N(this,h0,"m",g5).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)N(this,h0,"m",f5).call(this,W);if(Y.controller.signal?.aborted)throw new O0;N(this,h0,"m",h5).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;w(this,S4,$,"f"),w(this,j4,$?.headers.get("request-id"),"f"),N(this,C4,"f").call(this,$),this._emit("connect")}get ended(){return N(this,B6,"f")}get errored(){return N(this,E4,"f")}get aborted(){return N(this,w4,"f")}abort(){this.controller.abort()}on($,Z){return(N(this,G1,"f")[$]||(N(this,G1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=N(this,G1,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(N(this,G1,"f")[$]||(N(this,G1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(w(this,o1,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){w(this,o1,!0,"f"),await N(this,K6,"f")}get currentMessage(){return N(this,S1,"f")}async finalMessage(){return await this.done(),N(this,h0,"m",v5).call(this)}async finalText(){return await this.done(),N(this,h0,"m",FY).call(this)}_emit($,...Z){if(N(this,B6,"f"))return;if($==="end")w(this,B6,!0,"f"),N(this,P4,"f").call(this);let X=N(this,G1,"f")[$];if(X)N(this,G1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!N(this,o1,"f")&&!X?.length)Promise.reject(z);N(this,V6,"f").call(this,z),N(this,H6,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!N(this,o1,"f")&&!X?.length)Promise.reject(z);N(this,V6,"f").call(this,z),N(this,H6,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",N(this,h0,"m",v5).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{N(this,h0,"m",g5).call(this),this._connected(null);let J=x0.fromReadableStream($,this.controller);for await(let Q of J)N(this,h0,"m",f5).call(this,Q);if(J.controller.signal?.aborted)throw new O0;N(this,h0,"m",h5).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(S1=new WeakMap,l$=new WeakMap,G6=new WeakMap,C4=new WeakMap,V6=new WeakMap,K6=new WeakMap,P4=new WeakMap,H6=new WeakMap,G1=new WeakMap,B6=new WeakMap,E4=new WeakMap,w4=new WeakMap,o1=new WeakMap,S4=new WeakMap,j4=new WeakMap,M6=new WeakMap,x4=new WeakMap,h0=new WeakSet,v5=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},FY=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},g5=function(){if(this.ended)return;w(this,S1,void 0,"f")},f5=function(Z){if(this.ended)return;let X=N(this,h0,"m",CY).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(EY(z)&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}case"compaction_delta":{if(z.type==="compaction"&&z.content)this._emit("compaction",z.content);break}default:wY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(j5(X,N(this,l$,"f"),{logger:N(this,M6,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{w(this,S1,X,"f");break}case"content_block_start":case"message_delta":break}},h5=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=N(this,S1,"f");if(!Z)throw new k("request ended without sending any chunks");return w(this,S1,void 0,"f"),j5(Z,N(this,l$,"f"),{logger:N(this,M6,"f")})},CY=function(Z){let X=N(this,S1,"f");if(Z.type==="message_start"){if(X)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new k(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.container=Z.delta.container,X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,X.context_management=Z.context_management,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)X.usage.iterations=Z.usage.iterations;return X;case"content_block_start":return X.content.push(Z.content_block),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&EY(z)){let J=z[PY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,PY,{value:J,enumerable:!1,writable:!0}),J)try{Q.input=F4(J)}catch(Y){let W=new k(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${J}`);N(this,x4,"f").call(this,W)}X.content[Z.index]=Q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}case"compaction_delta":{if(z?.type==="compaction")X.content[Z.index]={...z,content:(z.content||"")+Z.delta.content};break}default:wY(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new x0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var d$;var b4=v(()=>{d$=class d$ extends Error{constructor($){let Z=typeof $==="string"?$:$.map((X)=>{if(X.type==="text")return X.text;return`[${X.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var jY=1e5,xY=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
174
174
  1. Task Overview
175
175
  The user's core request and success criteria
176
176
  Any clarifications or constraints they specified
@@ -192,74 +192,74 @@ User preferences or style requirements
192
192
  Domain-specific details that aren't obvious
193
193
  Any promises made to the user
194
194
  Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
195
- Wrap your summary in <summary></summary> tags.`;function FY(){let $,Z;return{promise:new Promise((z,J)=>{$=z,Z=J}),resolve:$,reject:Z}}async function Y_($,Z=$.messages.at(-1),X){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let z=Z.content.filter((Q)=>Q.type==="tool_use");if(z.length===0)return null;return{role:"user",content:await Promise.all(z.map(async(Q)=>{let Y=$.tools.find((W)=>("name"in W?W.name:W.mcp_server_name)===Q.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:Q.id,content:`Error: Tool '${Q.name}' not found`,is_error:!0};try{let W=Q.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let U=await Y.run(W,{toolUseBlock:Q,signal:X?.signal});return{type:"tool_result",tool_use_id:Q.id,content:U}}catch(W){return{type:"tool_result",tool_use_id:Q.id,content:W instanceof d$?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var N6,p$,t1,K0,F0,b0,V1,j1,L6,_Y,u5,D6;var m5=v(()=>{W1();v4();_0();e();z6();D6=class D6{constructor($,Z,X){N6.add(this),this.client=$,p$.set(this,!1),t1.set(this,!1),K0.set(this,void 0),F0.set(this,void 0),b0.set(this,void 0),V1.set(this,void 0),j1.set(this,void 0),L6.set(this,0),w(this,K0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let J=["BetaToolRunner",...T5(Z.tools,Z.messages)].join(", ");if(w(this,F0,{...X,headers:D([{"x-stainless-helper":J},X?.headers])},"f"),w(this,j1,FY(),"f"),Z.compactionControl?.enabled)console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(p$=new WeakMap,t1=new WeakMap,K0=new WeakMap,F0=new WeakMap,b0=new WeakMap,V1=new WeakMap,j1=new WeakMap,L6=new WeakMap,N6=new WeakSet,_Y=async function(){let Z=N(this,K0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let X=0;if(N(this,b0,"f")!==void 0)try{let U=await N(this,b0,"f");X=U.usage.input_tokens+(U.usage.cache_creation_input_tokens??0)+(U.usage.cache_read_input_tokens??0)+U.usage.output_tokens}catch{return!1}let z=Z.contextTokenThreshold??AY;if(X<z)return!1;let J=Z.model??N(this,K0,"f").params.model,Q=Z.summaryPrompt??RY,Y=N(this,K0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let q=U.content.filter((G)=>G.type!=="tool_use");if(q.length===0)Y.pop();else U.content=q}}let W=await this.client.beta.messages.create({model:J,messages:[...Y,{role:"user",content:[{type:"text",text:Q}]}],max_tokens:N(this,K0,"f").params.max_tokens},{signal:N(this,F0,"f").signal,headers:D([N(this,F0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new k("Expected text response for compaction");return N(this,K0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(N(this,p$,"f"))throw new k("Cannot iterate over a consumed stream");w(this,p$,!0,"f"),w(this,t1,!0,"f"),w(this,V1,void 0,"f");try{while(!0){let Z;try{if(N(this,K0,"f").params.max_iterations&&N(this,L6,"f")>=N(this,K0,"f").params.max_iterations)break;w(this,t1,!1,"f"),w(this,V1,void 0,"f"),w(this,L6,($=N(this,L6,"f"),$++,$),"f"),w(this,b0,void 0,"f");let{max_iterations:X,compactionControl:z,...J}=N(this,K0,"f").params;if(J.stream)Z=this.client.beta.messages.stream({...J},N(this,F0,"f")),w(this,b0,Z.finalMessage(),"f"),N(this,b0,"f").catch(()=>{}),yield Z;else w(this,b0,this.client.beta.messages.create({...J,stream:!1},N(this,F0,"f")),"f"),yield N(this,b0,"f");if(!await N(this,N6,"m",_Y).call(this)){if(!N(this,t1,"f")){let{role:W,content:U}=await N(this,b0,"f");N(this,K0,"f").params.messages.push({role:W,content:U})}let Y=await N(this,N6,"m",u5).call(this,N(this,K0,"f").params.messages.at(-1));if(Y)N(this,K0,"f").params.messages.push(Y);else if(!N(this,t1,"f"))break}}finally{if(Z)Z.abort()}}if(!N(this,b0,"f"))throw new k("ToolRunner concluded without a message from the server");N(this,j1,"f").resolve(await N(this,b0,"f"))}catch(Z){throw w(this,p$,!1,"f"),N(this,j1,"f").promise.catch(()=>{}),N(this,j1,"f").reject(Z),w(this,j1,FY(),"f"),Z}}setMessagesParams($){if(typeof $==="function")N(this,K0,"f").params=$(N(this,K0,"f").params);else N(this,K0,"f").params=$;w(this,t1,!0,"f"),w(this,V1,void 0,"f")}setRequestOptions($){if(typeof $==="function")w(this,F0,$(N(this,F0,"f")),"f");else w(this,F0,{...N(this,F0,"f"),...$},"f")}async generateToolResponse($=N(this,F0,"f").signal){let Z=await N(this,b0,"f")??this.params.messages.at(-1);if(!Z)return null;return N(this,N6,"m",u5).call(this,Z,$)}done(){return N(this,j1,"f").promise}async runUntilDone(){if(!N(this,p$,"f"))for await(let $ of this);return this.done()}get params(){return N(this,K0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};u5=async function(Z,X=N(this,F0,"f").signal){if(N(this,V1,"f")!==void 0)return N(this,V1,"f");return w(this,V1,Y_(N(this,K0,"f").params,Z,{...N(this,F0,"f"),signal:X}),"f"),N(this,V1,"f")}});var i$;var c5=v(()=>{_0();q5();i$=class i${constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new P1;for await(let Z of this.iterator)for(let X of $.decode(Z))yield JSON.parse(X);for(let Z of $.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}return new i$(n2($.body),Z)}}});var I6;var l5=v(()=>{z0();e();c5();m$();U0();I6=class I6 extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/messages/batches?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/messages/batches/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",r0,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/messages/batches/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}cancel($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/messages/batches/${$}/cancel?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}async results($,Z={},X){let z=await this.retrieve($);if(!z.results_url)throw new k(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);let{betas:J}=Z??{};return this._client.get(z.results_url,{...X,headers:D([{"anthropic-beta":[...J??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},X?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,Y)=>i$.fromResponse(Y.response,Y.controller))}}});function EY($){if(!$.output_format)return $;if($.output_config?.format)throw new k("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...X}=$;return{...X,output_config:{...$.output_config,format:Z}}}var CY,U_,x1;var d5=v(()=>{m$();S5();e();z6();b5();TY();m5();v4();l5();l5();m5();v4();CY={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},U_=["claude-mythos-preview","claude-opus-4-6"];x1=class x1 extends h{constructor(){super(...arguments);this.batches=new I6(this._client)}create($,Z){let X=EY($),{betas:z,...J}=X;if(J.model in CY)console.warn(`The model '${J.model}' is deprecated and will reach end-of-life on ${CY[J.model]}
196
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(U_.includes(J.model)&&J.thinking&&J.thinking.type==="enabled")console.warn(`Using Claude with ${J.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let Q=this._client._options.timeout;if(!J.stream&&Q==null){let W=E4[J.model]??void 0;Q=this._client.calculateNonstreamingTimeout(J.max_tokens,W)}let Y=C4(J.tools,J.messages);return this._client.post("/v1/messages?beta=true",{body:J,timeout:Q??600000,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Y,Z?.headers]),stream:X.stream??!1})}parse($,Z){return Z={...Z,headers:D([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((X)=>x5(X,$,{logger:this._client.logger??console}))}stream($,Z){return O6.createMessage(this,$,Z)}countTokens($,Z){let X=EY($),{betas:z,...J}=X;return this._client.post("/v1/messages/count_tokens?beta=true",{body:J,...Z,headers:D([{"anthropic-beta":[...z??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new D6(this._client,$,Z)}};x1.Batches=I6;x1.BetaToolRunner=D6;x1.ToolError=d$});var T6;var p5=v(()=>{z0();e();U0();T6=class T6 extends h{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/sessions/${$}/events?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}send($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/sessions/${$}/events?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}stream($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/sessions/${$}/events/stream?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers]),stream:!0})}}});var A6;var i5=v(()=>{z0();e();U0();A6=class A6 extends h{retrieve($,Z,X){let{session_id:z,betas:J}=Z;return this._client.get(C`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{session_id:z,betas:J,...Q}=Z;return this._client.post(C`/v1/sessions/${z}/resources/${$}?beta=true`,{body:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/sessions/${$}/resources?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{session_id:z,betas:J}=Z;return this._client.delete(C`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}add($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/sessions/${$}/resources?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var e1;var n5=v(()=>{p5();p5();i5();i5();z0();e();U0();e1=class e1 extends h{constructor(){super(...arguments);this.events=new T6(this._client),this.resources=new A6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/sessions?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/sessions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/sessions/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/sessions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/sessions/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};e1.Events=T6;e1.Resources=A6});var R6;var r5=v(()=>{z0();e();h$();U0();R6=class R6 extends h{create($,Z={},X){let{betas:z,...J}=Z??{};return this._client.post(C`/v1/skills/${$}/versions?beta=true`,f$({body:J,...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])},this._client))}retrieve($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.get(C`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/skills/${$}/versions?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}delete($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.delete(C`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}}});var n$;var s5=v(()=>{r5();r5();z0();e();h$();U0();n$=class n$ extends h{constructor(){super(...arguments);this.versions=new R6(this._client)}create($={},Z){let{betas:X,...z}=$??{};return this._client.post("/v1/skills?beta=true",f$({body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/skills/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/skills?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/skills/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}};n$.Versions=R6});var _6;var a5=v(()=>{z0();e();U0();_6=class _6 extends h{create($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/vaults/${$}/credentials?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}retrieve($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.get(C`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{vault_id:z,betas:J,...Q}=Z;return this._client.post(C`/v1/vaults/${z}/credentials/${$}?beta=true`,{body:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/vaults/${$}/credentials?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.delete(C`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.post(C`/v1/vaults/${z}/credentials/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var r$;var o5=v(()=>{a5();a5();z0();e();U0();r$=class r$ extends h{constructor(){super(...arguments);this.credentials=new _6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/vaults?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/vaults/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/vaults/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/vaults/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/vaults/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};r$.Credentials=_6});var L0;var t5=v(()=>{I5();I5();A5();A5();R5();R5();_5();_5();C5();C5();w5();w5();d5();d5();n5();n5();s5();s5();o5();o5();L0=class L0 extends h{constructor(){super(...arguments);this.models=new Q6(this._client),this.messages=new x1(this._client),this.agents=new u$(this._client),this.environments=new Z6(this._client),this.sessions=new e1(this._client),this.vaults=new r$(this._client),this.memoryStores=new a1(this._client),this.files=new J6(this._client),this.skills=new n$(this._client),this.userProfiles=new Y6(this._client)}};L0.Models=Q6;L0.Messages=x1;L0.Agents=u$;L0.Environments=Z6;L0.Sessions=e1;L0.Vaults=r$;L0.MemoryStores=a1;L0.Files=J6;L0.Skills=n$;L0.UserProfiles=Y6});var s$;var e5=v(()=>{e();s$=class s$ extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/complete",{body:z,timeout:this._client._options.timeout??600000,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function PY($){return $?.output_config?.format}function $9($,Z,X){let z=PY(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text")return Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return J}),parsed_output:null};return Z9($,Z,X)}function Z9($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=N_(Z,Q.text);if(z===null)z=Y;return Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1})}return Q});return{...$,content:J,parsed_output:z}}function N_($,Z){let X=PY($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new k(`Failed to parse structured output: ${z}`)}}var X9=v(()=>{_0()});function xY($){return $.type==="tool_use"||$.type==="server_tool_use"}function bY($){}var u0,b1,a$,F6,g4,C6,E6,f4,P6,K1,w6,h4,u4,$$,m4,c4,S6,z9,wY,J9,Q9,Y9,W9,SY,jY="__json_buf",j6;var kY=v(()=>{W1();m$();y5();k5();X9();j6=class j6{constructor($,Z){u0.add(this),this.messages=[],this.receivedMessages=[],b1.set(this,void 0),a$.set(this,null),this.controller=new AbortController,F6.set(this,void 0),g4.set(this,()=>{}),C6.set(this,()=>{}),E6.set(this,void 0),f4.set(this,()=>{}),P6.set(this,()=>{}),K1.set(this,{}),w6.set(this,!1),h4.set(this,!1),u4.set(this,!1),$$.set(this,!1),m4.set(this,void 0),c4.set(this,void 0),S6.set(this,void 0),J9.set(this,(X)=>{if(w(this,h4,!0,"f"),U1(X))X=new O0;if(X instanceof O0)return w(this,u4,!0,"f"),this._emit("abort",X);if(X instanceof k)return this._emit("error",X);if(X instanceof Error){let z=new k(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new k(String(X)))}),w(this,F6,new Promise((X,z)=>{w(this,g4,X,"f"),w(this,C6,z,"f")}),"f"),w(this,E6,new Promise((X,z)=>{w(this,f4,X,"f"),w(this,P6,z,"f")}),"f"),N(this,F6,"f").catch(()=>{}),N(this,E6,"f").catch(()=>{}),w(this,a$,$,"f"),w(this,S6,Z?.logger??console,"f")}get response(){return N(this,m4,"f")}get request_id(){return N(this,c4,"f")}async withResponse(){w(this,$$,!0,"f");let $=await N(this,F6,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new j6(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new j6(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return w(J,a$,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},N(this,J9,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{N(this,u0,"m",Q9).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)N(this,u0,"m",Y9).call(this,W);if(Y.controller.signal?.aborted)throw new O0;N(this,u0,"m",W9).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;w(this,m4,$,"f"),w(this,c4,$?.headers.get("request-id"),"f"),N(this,g4,"f").call(this,$),this._emit("connect")}get ended(){return N(this,w6,"f")}get errored(){return N(this,h4,"f")}get aborted(){return N(this,u4,"f")}abort(){this.controller.abort()}on($,Z){return(N(this,K1,"f")[$]||(N(this,K1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=N(this,K1,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(N(this,K1,"f")[$]||(N(this,K1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(w(this,$$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){w(this,$$,!0,"f"),await N(this,E6,"f")}get currentMessage(){return N(this,b1,"f")}async finalMessage(){return await this.done(),N(this,u0,"m",z9).call(this)}async finalText(){return await this.done(),N(this,u0,"m",wY).call(this)}_emit($,...Z){if(N(this,w6,"f"))return;if($==="end")w(this,w6,!0,"f"),N(this,f4,"f").call(this);let X=N(this,K1,"f")[$];if(X)N(this,K1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!N(this,$$,"f")&&!X?.length)Promise.reject(z);N(this,C6,"f").call(this,z),N(this,P6,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!N(this,$$,"f")&&!X?.length)Promise.reject(z);N(this,C6,"f").call(this,z),N(this,P6,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",N(this,u0,"m",z9).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{N(this,u0,"m",Q9).call(this),this._connected(null);let J=x0.fromReadableStream($,this.controller);for await(let Q of J)N(this,u0,"m",Y9).call(this,Q);if(J.controller.signal?.aborted)throw new O0;N(this,u0,"m",W9).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(b1=new WeakMap,a$=new WeakMap,F6=new WeakMap,g4=new WeakMap,C6=new WeakMap,E6=new WeakMap,f4=new WeakMap,P6=new WeakMap,K1=new WeakMap,w6=new WeakMap,h4=new WeakMap,u4=new WeakMap,$$=new WeakMap,m4=new WeakMap,c4=new WeakMap,S6=new WeakMap,J9=new WeakMap,u0=new WeakSet,z9=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},wY=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},Q9=function(){if(this.ended)return;w(this,b1,void 0,"f")},Y9=function(Z){if(this.ended)return;let X=N(this,u0,"m",SY).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(xY(z)&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}default:bY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage($9(X,N(this,a$,"f"),{logger:N(this,S6,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{w(this,b1,X,"f");break}case"content_block_start":case"message_delta":break}},W9=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=N(this,b1,"f");if(!Z)throw new k("request ended without sending any chunks");return w(this,b1,void 0,"f"),$9(Z,N(this,a$,"f"),{logger:N(this,S6,"f")})},SY=function(Z){let X=N(this,b1,"f");if(Z.type==="message_start"){if(X)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new k(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;return X;case"content_block_start":return X.content.push({...Z.content_block}),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&xY(z)){let J=z[jY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,jY,{value:J,enumerable:!1,writable:!0}),J)Q.input=P4(J);X.content[Z.index]=Q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}default:bY(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new x0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var x6;var U9=v(()=>{z0();e();c5();m$();U0();x6=class x6 extends h{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(C`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",r0,{query:$,...Z})}delete($,Z){return this._client.delete(C`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(C`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let X=await this.retrieve($);if(!X.results_url)throw new k(`No batch \`results_url\`; Has it finished processing? ${X.processing_status} - ${X.id}`);return this._client.get(X.results_url,{...Z,headers:D([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((z,J)=>i$.fromResponse(J.response,J.controller))}}});var Z$,yY,D_;var q9=v(()=>{e();z6();kY();X9();U9();U9();S5();Z$=class Z$ extends h{constructor(){super(...arguments);this.batches=new x6(this._client)}create($,Z){if($.model in yY)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${yY[$.model]}
197
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(D_.includes($.model)&&$.thinking&&$.thinking.type==="enabled")console.warn(`Using Claude with ${$.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let X=this._client._options.timeout;if(!$.stream&&X==null){let J=E4[$.model]??void 0;X=this._client.calculateNonstreamingTimeout($.max_tokens,J)}let z=C4($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:X??600000,...Z,headers:D([z,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((X)=>Z9(X,$,{logger:this._client.logger??console}))}stream($,Z){return j6.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};yY={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026"},D_=["claude-mythos-preview","claude-opus-4-6"];Z$.Batches=x6});var o$;var G9=v(()=>{z0();e();U0();o$=class o$ extends h{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/models/${$}`,{...X,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models",r0,{query:z,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var vY=v(()=>{t5();e5();q9();G9();GY()});var b6=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};class X0{constructor({baseURL:$=b6("ANTHROPIC_BASE_URL"),apiKey:Z=b6("ANTHROPIC_API_KEY")??null,authToken:X=b6("ANTHROPIC_AUTH_TOKEN")??null,...z}={}){V9.add(this),l4.set(this,void 0);let J={apiKey:Z,authToken:X,...z,baseURL:$||"https://api.anthropic.com"};if(!J.dangerouslyAllowBrowser&&rQ())throw new k(`It looks like you're running in a browser-like environment.
195
+ Wrap your summary in <summary></summary> tags.`;function kY(){let $,Z;return{promise:new Promise((z,J)=>{$=z,Z=J}),resolve:$,reject:Z}}async function O_($,Z=$.messages.at(-1),X){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let z=Z.content.filter((Q)=>Q.type==="tool_use");if(z.length===0)return null;return{role:"user",content:await Promise.all(z.map(async(Q)=>{let Y=$.tools.find((W)=>("name"in W?W.name:W.mcp_server_name)===Q.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:Q.id,content:`Error: Tool '${Q.name}' not found`,is_error:!0};try{let W=Q.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let U=await Y.run(W,{toolUseBlock:Q,signal:X?.signal});return{type:"tool_result",tool_use_id:Q.id,content:U}}catch(W){return{type:"tool_result",tool_use_id:Q.id,content:W instanceof d$?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var N6,p$,t1,K0,F0,b0,V1,j1,L6,bY,u5,D6;var m5=v(()=>{W1();b4();_0();e();z6();D6=class D6{constructor($,Z,X){N6.add(this),this.client=$,p$.set(this,!1),t1.set(this,!1),K0.set(this,void 0),F0.set(this,void 0),b0.set(this,void 0),V1.set(this,void 0),j1.set(this,void 0),L6.set(this,0),w(this,K0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let J=["BetaToolRunner",...T5(Z.tools,Z.messages)].join(", ");if(w(this,F0,{...X,headers:D([{"x-stainless-helper":J},X?.headers])},"f"),w(this,j1,kY(),"f"),Z.compactionControl?.enabled)console.warn('Anthropic: The `compactionControl` parameter is deprecated and will be removed in a future version. Use server-side compaction instead by passing `edits: [{ type: "compact_20260112" }]` in the params passed to `toolRunner()`. See https://platform.claude.com/docs/en/build-with-claude/compaction')}async*[(p$=new WeakMap,t1=new WeakMap,K0=new WeakMap,F0=new WeakMap,b0=new WeakMap,V1=new WeakMap,j1=new WeakMap,L6=new WeakMap,N6=new WeakSet,bY=async function(){let Z=N(this,K0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let X=0;if(N(this,b0,"f")!==void 0)try{let U=await N(this,b0,"f");X=U.usage.input_tokens+(U.usage.cache_creation_input_tokens??0)+(U.usage.cache_read_input_tokens??0)+U.usage.output_tokens}catch{return!1}let z=Z.contextTokenThreshold??jY;if(X<z)return!1;let J=Z.model??N(this,K0,"f").params.model,Q=Z.summaryPrompt??xY,Y=N(this,K0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let q=U.content.filter((G)=>G.type!=="tool_use");if(q.length===0)Y.pop();else U.content=q}}let W=await this.client.beta.messages.create({model:J,messages:[...Y,{role:"user",content:[{type:"text",text:Q}]}],max_tokens:N(this,K0,"f").params.max_tokens},{signal:N(this,F0,"f").signal,headers:D([N(this,F0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new k("Expected text response for compaction");return N(this,K0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(N(this,p$,"f"))throw new k("Cannot iterate over a consumed stream");w(this,p$,!0,"f"),w(this,t1,!0,"f"),w(this,V1,void 0,"f");try{while(!0){let Z;try{if(N(this,K0,"f").params.max_iterations&&N(this,L6,"f")>=N(this,K0,"f").params.max_iterations)break;w(this,t1,!1,"f"),w(this,V1,void 0,"f"),w(this,L6,($=N(this,L6,"f"),$++,$),"f"),w(this,b0,void 0,"f");let{max_iterations:X,compactionControl:z,...J}=N(this,K0,"f").params;if(J.stream)Z=this.client.beta.messages.stream({...J},N(this,F0,"f")),w(this,b0,Z.finalMessage(),"f"),N(this,b0,"f").catch(()=>{}),yield Z;else w(this,b0,this.client.beta.messages.create({...J,stream:!1},N(this,F0,"f")),"f"),yield N(this,b0,"f");if(!await N(this,N6,"m",bY).call(this)){if(!N(this,t1,"f")){let{role:W,content:U}=await N(this,b0,"f");N(this,K0,"f").params.messages.push({role:W,content:U})}let Y=await N(this,N6,"m",u5).call(this,N(this,K0,"f").params.messages.at(-1));if(Y)N(this,K0,"f").params.messages.push(Y);else if(!N(this,t1,"f"))break}}finally{if(Z)Z.abort()}}if(!N(this,b0,"f"))throw new k("ToolRunner concluded without a message from the server");N(this,j1,"f").resolve(await N(this,b0,"f"))}catch(Z){throw w(this,p$,!1,"f"),N(this,j1,"f").promise.catch(()=>{}),N(this,j1,"f").reject(Z),w(this,j1,kY(),"f"),Z}}setMessagesParams($){if(typeof $==="function")N(this,K0,"f").params=$(N(this,K0,"f").params);else N(this,K0,"f").params=$;w(this,t1,!0,"f"),w(this,V1,void 0,"f")}setRequestOptions($){if(typeof $==="function")w(this,F0,$(N(this,F0,"f")),"f");else w(this,F0,{...N(this,F0,"f"),...$},"f")}async generateToolResponse($=N(this,F0,"f").signal){let Z=await N(this,b0,"f")??this.params.messages.at(-1);if(!Z)return null;return N(this,N6,"m",u5).call(this,Z,$)}done(){return N(this,j1,"f").promise}async runUntilDone(){if(!N(this,p$,"f"))for await(let $ of this);return this.done()}get params(){return N(this,K0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};u5=async function(Z,X=N(this,F0,"f").signal){if(N(this,V1,"f")!==void 0)return N(this,V1,"f");return w(this,V1,O_(N(this,K0,"f").params,Z,{...N(this,F0,"f"),signal:X}),"f"),N(this,V1,"f")}});var i$;var c5=v(()=>{_0();q5();i$=class i${constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new E1;for await(let Z of this.iterator)for(let X of $.decode(Z))yield JSON.parse(X);for(let Z of $.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}return new i$(n2($.body),Z)}}});var I6;var l5=v(()=>{z0();e();c5();m$();U0();I6=class I6 extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/messages/batches?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/messages/batches/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",r0,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/messages/batches/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}cancel($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/messages/batches/${$}/cancel?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}async results($,Z={},X){let z=await this.retrieve($);if(!z.results_url)throw new k(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);let{betas:J}=Z??{};return this._client.get(z.results_url,{...X,headers:D([{"anthropic-beta":[...J??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},X?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,Y)=>i$.fromResponse(Y.response,Y.controller))}}});function vY($){if(!$.output_format)return $;if($.output_config?.format)throw new k("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...X}=$;return{...X,output_config:{...$.output_config,format:Z}}}var yY,L_,x1;var d5=v(()=>{m$();S5();e();z6();b5();SY();m5();b4();l5();l5();m5();b4();yY={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},L_=["claude-mythos-preview","claude-opus-4-6"];x1=class x1 extends h{constructor(){super(...arguments);this.batches=new I6(this._client)}create($,Z){let X=vY($),{betas:z,...J}=X;if(J.model in yY)console.warn(`The model '${J.model}' is deprecated and will reach end-of-life on ${yY[J.model]}
196
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(L_.includes(J.model)&&J.thinking&&J.thinking.type==="enabled")console.warn(`Using Claude with ${J.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let Q=this._client._options.timeout;if(!J.stream&&Q==null){let W=_4[J.model]??void 0;Q=this._client.calculateNonstreamingTimeout(J.max_tokens,W)}let Y=R4(J.tools,J.messages);return this._client.post("/v1/messages?beta=true",{body:J,timeout:Q??600000,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Y,Z?.headers]),stream:X.stream??!1})}parse($,Z){return Z={...Z,headers:D([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((X)=>x5(X,$,{logger:this._client.logger??console}))}stream($,Z){return O6.createMessage(this,$,Z)}countTokens($,Z){let X=vY($),{betas:z,...J}=X;return this._client.post("/v1/messages/count_tokens?beta=true",{body:J,...Z,headers:D([{"anthropic-beta":[...z??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new D6(this._client,$,Z)}};x1.Batches=I6;x1.BetaToolRunner=D6;x1.ToolError=d$});var T6;var p5=v(()=>{z0();e();U0();T6=class T6 extends h{list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/sessions/${$}/events?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}send($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/sessions/${$}/events?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}stream($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/sessions/${$}/events/stream?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers]),stream:!0})}}});var A6;var i5=v(()=>{z0();e();U0();A6=class A6 extends h{retrieve($,Z,X){let{session_id:z,betas:J}=Z;return this._client.get(C`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{session_id:z,betas:J,...Q}=Z;return this._client.post(C`/v1/sessions/${z}/resources/${$}?beta=true`,{body:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/sessions/${$}/resources?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{session_id:z,betas:J}=Z;return this._client.delete(C`/v1/sessions/${z}/resources/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}add($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/sessions/${$}/resources?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var e1;var n5=v(()=>{p5();p5();i5();i5();z0();e();U0();e1=class e1 extends h{constructor(){super(...arguments);this.events=new T6(this._client),this.resources=new A6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/sessions?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/sessions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/sessions/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/sessions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/sessions/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};e1.Events=T6;e1.Resources=A6});var R6;var r5=v(()=>{z0();e();h$();U0();R6=class R6 extends h{create($,Z={},X){let{betas:z,...J}=Z??{};return this._client.post(C`/v1/skills/${$}/versions?beta=true`,f$({body:J,...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])},this._client))}retrieve($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.get(C`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/skills/${$}/versions?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}delete($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.delete(C`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}}});var n$;var s5=v(()=>{r5();r5();z0();e();h$();U0();n$=class n$ extends h{constructor(){super(...arguments);this.versions=new R6(this._client)}create($={},Z){let{betas:X,...z}=$??{};return this._client.post("/v1/skills?beta=true",f$({body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/skills/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/skills?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/skills/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}};n$.Versions=R6});var _6;var a5=v(()=>{z0();e();U0();_6=class _6 extends h{create($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/vaults/${$}/credentials?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}retrieve($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.get(C`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{vault_id:z,betas:J,...Q}=Z;return this._client.post(C`/v1/vaults/${z}/credentials/${$}?beta=true`,{body:Q,...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(C`/v1/vaults/${$}/credentials?beta=true`,o,{query:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}delete($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.delete(C`/v1/vaults/${z}/credentials/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z,X){let{vault_id:z,betas:J}=Z;return this._client.post(C`/v1/vaults/${z}/credentials/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}}});var r$;var o5=v(()=>{a5();a5();z0();e();U0();r$=class r$ extends h{constructor(){super(...arguments);this.credentials=new _6(this._client)}create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/vaults?beta=true",{body:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/vaults/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}update($,Z,X){let{betas:z,...J}=Z;return this._client.post(C`/v1/vaults/${$}?beta=true`,{body:J,...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",o,{query:z,...Z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(C`/v1/vaults/${$}?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}archive($,Z={},X){let{betas:z}=Z??{};return this._client.post(C`/v1/vaults/${$}/archive?beta=true`,{...X,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},X?.headers])})}};r$.Credentials=_6});var L0;var t5=v(()=>{I5();I5();A5();A5();R5();R5();_5();_5();C5();C5();w5();w5();d5();d5();n5();n5();s5();s5();o5();o5();L0=class L0 extends h{constructor(){super(...arguments);this.models=new Q6(this._client),this.messages=new x1(this._client),this.agents=new u$(this._client),this.environments=new Z6(this._client),this.sessions=new e1(this._client),this.vaults=new r$(this._client),this.memoryStores=new a1(this._client),this.files=new J6(this._client),this.skills=new n$(this._client),this.userProfiles=new Y6(this._client)}};L0.Models=Q6;L0.Messages=x1;L0.Agents=u$;L0.Environments=Z6;L0.Sessions=e1;L0.Vaults=r$;L0.MemoryStores=a1;L0.Files=J6;L0.Skills=n$;L0.UserProfiles=Y6});var s$;var e5=v(()=>{e();s$=class s$ extends h{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/complete",{body:z,timeout:this._client._options.timeout??600000,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function gY($){return $?.output_config?.format}function $9($,Z,X){let z=gY(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text")return Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return J}),parsed_output:null};return Z9($,Z,X)}function Z9($,Z,X){let z=null,J=$.content.map((Q)=>{if(Q.type==="text"){let Y=P_(Z,Q.text);if(z===null)z=Y;return Object.defineProperty({...Q},"parsed_output",{value:Y,enumerable:!1})}return Q});return{...$,content:J,parsed_output:z}}function P_($,Z){let X=gY($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new k(`Failed to parse structured output: ${z}`)}}var X9=v(()=>{_0()});function mY($){return $.type==="tool_use"||$.type==="server_tool_use"}function cY($){}var u0,b1,a$,F6,k4,C6,P6,y4,E6,K1,w6,v4,g4,$$,f4,h4,S6,z9,fY,J9,Q9,Y9,W9,hY,uY="__json_buf",j6;var lY=v(()=>{W1();m$();y5();k5();X9();j6=class j6{constructor($,Z){u0.add(this),this.messages=[],this.receivedMessages=[],b1.set(this,void 0),a$.set(this,null),this.controller=new AbortController,F6.set(this,void 0),k4.set(this,()=>{}),C6.set(this,()=>{}),P6.set(this,void 0),y4.set(this,()=>{}),E6.set(this,()=>{}),K1.set(this,{}),w6.set(this,!1),v4.set(this,!1),g4.set(this,!1),$$.set(this,!1),f4.set(this,void 0),h4.set(this,void 0),S6.set(this,void 0),J9.set(this,(X)=>{if(w(this,v4,!0,"f"),U1(X))X=new O0;if(X instanceof O0)return w(this,g4,!0,"f"),this._emit("abort",X);if(X instanceof k)return this._emit("error",X);if(X instanceof Error){let z=new k(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new k(String(X)))}),w(this,F6,new Promise((X,z)=>{w(this,k4,X,"f"),w(this,C6,z,"f")}),"f"),w(this,P6,new Promise((X,z)=>{w(this,y4,X,"f"),w(this,E6,z,"f")}),"f"),N(this,F6,"f").catch(()=>{}),N(this,P6,"f").catch(()=>{}),w(this,a$,$,"f"),w(this,S6,Z?.logger??console,"f")}get response(){return N(this,f4,"f")}get request_id(){return N(this,h4,"f")}async withResponse(){w(this,$$,!0,"f");let $=await N(this,F6,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new j6(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new j6(Z,{logger:z});for(let Q of Z.messages)J._addMessageParam(Q);return w(J,a$,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},N(this,J9,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{N(this,u0,"m",Q9).call(this);let{response:Q,data:Y}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(Q);for await(let W of Y)N(this,u0,"m",Y9).call(this,W);if(Y.controller.signal?.aborted)throw new O0;N(this,u0,"m",W9).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;w(this,f4,$,"f"),w(this,h4,$?.headers.get("request-id"),"f"),N(this,k4,"f").call(this,$),this._emit("connect")}get ended(){return N(this,w6,"f")}get errored(){return N(this,v4,"f")}get aborted(){return N(this,g4,"f")}abort(){this.controller.abort()}on($,Z){return(N(this,K1,"f")[$]||(N(this,K1,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=N(this,K1,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(N(this,K1,"f")[$]||(N(this,K1,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(w(this,$$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){w(this,$$,!0,"f"),await N(this,P6,"f")}get currentMessage(){return N(this,b1,"f")}async finalMessage(){return await this.done(),N(this,u0,"m",z9).call(this)}async finalText(){return await this.done(),N(this,u0,"m",fY).call(this)}_emit($,...Z){if(N(this,w6,"f"))return;if($==="end")w(this,w6,!0,"f"),N(this,y4,"f").call(this);let X=N(this,K1,"f")[$];if(X)N(this,K1,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!N(this,$$,"f")&&!X?.length)Promise.reject(z);N(this,C6,"f").call(this,z),N(this,E6,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!N(this,$$,"f")&&!X?.length)Promise.reject(z);N(this,C6,"f").call(this,z),N(this,E6,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",N(this,u0,"m",z9).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{N(this,u0,"m",Q9).call(this),this._connected(null);let J=x0.fromReadableStream($,this.controller);for await(let Q of J)N(this,u0,"m",Y9).call(this,Q);if(J.controller.signal?.aborted)throw new O0;N(this,u0,"m",W9).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(b1=new WeakMap,a$=new WeakMap,F6=new WeakMap,k4=new WeakMap,C6=new WeakMap,P6=new WeakMap,y4=new WeakMap,E6=new WeakMap,K1=new WeakMap,w6=new WeakMap,v4=new WeakMap,g4=new WeakMap,$$=new WeakMap,f4=new WeakMap,h4=new WeakMap,S6=new WeakMap,J9=new WeakMap,u0=new WeakSet,z9=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},fY=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},Q9=function(){if(this.ended)return;w(this,b1,void 0,"f")},Y9=function(Z){if(this.ended)return;let X=N(this,u0,"m",hY).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(mY(z)&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}default:cY(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage($9(X,N(this,a$,"f"),{logger:N(this,S6,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{w(this,b1,X,"f");break}case"content_block_start":case"message_delta":break}},W9=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=N(this,b1,"f");if(!Z)throw new k("request ended without sending any chunks");return w(this,b1,void 0,"f"),$9(Z,N(this,a$,"f"),{logger:N(this,S6,"f")})},hY=function(Z){let X=N(this,b1,"f");if(Z.type==="message_start"){if(X)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new k(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;return X;case"content_block_start":return X.content.push({...Z.content_block}),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&mY(z)){let J=z[uY]||"";J+=Z.delta.partial_json;let Q={...z};if(Object.defineProperty(Q,uY,{value:J,enumerable:!1,writable:!0}),J)Q.input=F4(J);X.content[Z.index]=Q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}default:cY(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,Q)=>Z.push({resolve:J,reject:Q})).then((J)=>J?{value:J,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new x0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var x6;var U9=v(()=>{z0();e();c5();m$();U0();x6=class x6 extends h{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(C`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",r0,{query:$,...Z})}delete($,Z){return this._client.delete(C`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(C`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let X=await this.retrieve($);if(!X.results_url)throw new k(`No batch \`results_url\`; Has it finished processing? ${X.processing_status} - ${X.id}`);return this._client.get(X.results_url,{...Z,headers:D([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((z,J)=>i$.fromResponse(J.response,J.controller))}}});var Z$,dY,w_;var q9=v(()=>{e();z6();lY();X9();U9();U9();S5();Z$=class Z$ extends h{constructor(){super(...arguments);this.batches=new x6(this._client)}create($,Z){if($.model in dY)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${dY[$.model]}
197
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(w_.includes($.model)&&$.thinking&&$.thinking.type==="enabled")console.warn(`Using Claude with ${$.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let X=this._client._options.timeout;if(!$.stream&&X==null){let J=_4[$.model]??void 0;X=this._client.calculateNonstreamingTimeout($.max_tokens,J)}let z=R4($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:X??600000,...Z,headers:D([z,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((X)=>Z9(X,$,{logger:this._client.logger??console}))}stream($,Z){return j6.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};dY={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026","claude-opus-4-0":"June 15th, 2026","claude-opus-4-20250514":"June 15th, 2026","claude-sonnet-4-0":"June 15th, 2026","claude-sonnet-4-20250514":"June 15th, 2026"},w_=["claude-mythos-preview","claude-opus-4-6"];Z$.Batches=x6});var o$;var G9=v(()=>{z0();e();U0();o$=class o$ extends h{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(C`/v1/models/${$}`,{...X,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models",r0,{query:z,...Z,headers:D([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var pY=v(()=>{t5();e5();q9();G9();DY()});var b6=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};class X0{constructor({baseURL:$=b6("ANTHROPIC_BASE_URL"),apiKey:Z=b6("ANTHROPIC_API_KEY")??null,authToken:X=b6("ANTHROPIC_AUTH_TOKEN")??null,...z}={}){V9.add(this),u4.set(this,void 0);let J={apiKey:Z,authToken:X,...z,baseURL:$||"https://api.anthropic.com"};if(!J.dangerouslyAllowBrowser&&zY())throw new k(`It looks like you're running in a browser-like environment.
198
198
 
199
199
  This is disabled by default, as it risks exposing your secret API credentials to attackers.
200
200
  If you understand the risks and have appropriate mitigations in place,
201
201
  you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
202
202
 
203
203
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
204
- `);this.baseURL=J.baseURL,this.timeout=J.timeout??K9.DEFAULT_TIMEOUT,this.logger=J.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=G5(J.logLevel,"ClientOptions.logLevel",this)??G5(b6("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??aQ(),w(this,l4,tQ,"f"),this._options=J,this.apiKey=typeof Z==="string"?Z:null,this.authToken=X}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return D([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return D([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return D([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return eQ($)}getUserAgent(){return`${this.constructor.name}/JS ${E1}`}defaultIdempotencyKey(){return`stainless-node-retry-${X5()}`}makeStatusError($,Z,X,z){return W0.generate($,Z,X,z)}buildURL($,Z,X){let z=!N(this,V9,"m",gY).call(this)&&X||this.baseURL,J=mQ($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Q=this.defaultQuery(),Y=Object.fromEntries(J.searchParams);if(!Q5(Q)||!Q5(Y))Z={...Y,...Q,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))J.search=this.stringifyQuery(Z);return J.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:X}){}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,X){return this.request(Promise.resolve(X).then((z)=>{return{method:$,path:Z,...z}}))}request($,Z=null){return new w1(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,X){let z=await $,J=z.maxRetries??this.maxRetries;if(Z==null)Z=J;await this.prepareOptions(z);let{req:Q,url:Y,timeout:W}=await this.buildRequest(z,{retryCount:J-Z});await this.prepareRequest(Q,{url:Y,options:z});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),q=X===void 0?"":`, retryOf: ${X}`,G=Date.now();if(M0(this).debug(`[${U}] sending request`,q1({retryOfRequestLogID:X,method:z.method,url:Y,options:z,headers:Q.headers})),z.signal?.aborted)throw new O0;let V=new AbortController,K=await this.fetchWithTimeout(Y,Q,W,V).catch(i2),H=Date.now();if(K instanceof globalThis.Error){let O=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new O0;let T=U1(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return M0(this).info(`[${U}] connection ${T?"timed out":"failed"} - ${O}`),M0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (${O})`,q1({retryOfRequestLogID:X,url:Y,durationMs:H-G,message:K.message})),this.retryRequest(z,Z,X??U);if(M0(this).info(`[${U}] connection ${T?"timed out":"failed"} - error; no more retries left`),M0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (error; no more retries left)`,q1({retryOfRequestLogID:X,url:Y,durationMs:H-G,message:K.message})),T)throw new w$;throw new C1({cause:K})}let L=[...K.headers.entries()].filter(([O])=>O==="request-id").map(([O,T])=>", "+O+": "+JSON.stringify(T)).join(""),B=`[${U}${q}${L}] ${Q.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${H-G}ms`;if(!K.ok){let O=await this.shouldRetry(K);if(Z&&O){let x=`retrying, ${Z} attempts remaining`;return await oQ(K.body),M0(this).info(`${B} - ${x}`),M0(this).debug(`[${U}] response error (${x})`,q1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:H-G})),this.retryRequest(z,Z,X??U,K.headers)}let T=O?"error; no more retries left":"error; not retryable";M0(this).info(`${B} - ${T}`);let j=await K.text().catch((x)=>i2(x).message),S=N4(j),b=S?void 0:j;throw M0(this).debug(`[${U}] response error (${T})`,q1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,message:b,durationMs:Date.now()-G})),this.makeStatusError(K.status,S,b,K.headers)}return M0(this).info(B),M0(this).debug(`[${U}] response start`,q1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:H-G})),{response:K,options:z,controller:V,requestLogID:U,retryOfRequestLogID:X,startTime:G}}getAPIList($,Z,X){return this.requestAPIList(Z,X&&"then"in X?X.then((z)=>({method:"get",path:$,...z})):{method:"get",path:$,...X})}requestAPIList($,Z){let X=this.makeRequest(Z,null,void 0);return new t2(this,X,$)}async fetchWithTimeout($,Z,X,z){let{signal:J,method:Q,...Y}=Z||{},W=this._makeAbort(z);if(J)J.addEventListener("abort",W,{once:!0});let U=setTimeout(W,X),q=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,G={signal:z.signal,...q?{duplex:"half"}:{},method:"GET",...Y};if(Q)G.method=Q.toUpperCase();try{return await this.fetch.call(void 0,$,G)}finally{clearTimeout(U)}}async shouldRetry($){let Z=$.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Z,X,z){let J,Q=z?.get("retry-after-ms");if(Q){let W=parseFloat(Q);if(!Number.isNaN(W))J=W}let Y=z?.get("retry-after");if(Y&&!J){let W=parseFloat(Y);if(!Number.isNaN(W))J=W*1000;else J=Date.parse(Y)-Date.now()}if(J===void 0){let W=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await dQ(J),this.makeRequest($,Z-1,X)}calculateDefaultRetryTimeoutMillis($,Z){let J=Z-$,Q=Math.min(0.5*Math.pow(2,J),8),Y=1-Math.random()*0.25;return Q*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let X={...$},{method:z,path:J,query:Q,defaultBaseURL:Y}=X,W=this.buildURL(J,Q,Y);if("timeout"in X)lQ("timeout",X.timeout);X.timeout=X.timeout??this.timeout;let{bodyHeaders:U,body:q}=this.buildBody({options:X}),G=await this.buildHeaders({options:$,method:z,bodyHeaders:U,retryCount:Z});return{req:{method:z,headers:G,...X.signal&&{signal:X.signal},...globalThis.ReadableStream&&q instanceof globalThis.ReadableStream&&{duplex:"half"},...q&&{body:q},...this.fetchOptions??{},...X.fetchOptions??{}},url:W,timeout:X.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:X,retryCount:z}){let J={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let Q=D([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...sQ(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,X,$.headers]);return this.validateHeaders(Q),Q.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let X=D([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&X.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:L4($)};else if(typeof $==="object"&&X.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return N(this,l4,"f").call(this,{body:$,headers:X})}}var V9,K9,l4,gY,H9="\\n\\nHuman:",B9="\\n\\nAssistant:",k1;var M9=v(()=>{W1();r1();Y5();$Y();_0();z0();D5();vY();R4();e5();G9();t5();q9();Y5();e();T4();r1();K9=X0,l4=new WeakMap,V9=new WeakSet,gY=function(){return this.baseURL!=="https://api.anthropic.com"};X0.Anthropic=K9;X0.HUMAN_PROMPT=H9;X0.AI_PROMPT=B9;X0.DEFAULT_TIMEOUT=600000;X0.AnthropicError=k;X0.APIError=W0;X0.APIConnectionError=C1;X0.APIConnectionTimeoutError=w$;X0.APIUserAbortError=O0;X0.NotFoundError=b$;X0.ConflictError=k$;X0.RateLimitError=v$;X0.BadRequestError=S$;X0.AuthenticationError=j$;X0.InternalServerError=g$;X0.PermissionDeniedError=x$;X0.UnprocessableEntityError=y$;X0.toFile=$6;k1=class k1 extends X0{constructor(){super(...arguments);this.completions=new s$(this),this.messages=new Z$(this),this.models=new o$(this),this.beta=new L0(this)}};k1.Completions=s$;k1.Messages=Z$;k1.Models=o$;k1.Beta=L0});var fY={};w9(fY,{toFile:()=>$6,default:()=>k1,UnprocessableEntityError:()=>y$,RateLimitError:()=>v$,PermissionDeniedError:()=>x$,PagePromise:()=>t2,NotFoundError:()=>b$,InternalServerError:()=>g$,HUMAN_PROMPT:()=>H9,ConflictError:()=>k$,BaseAnthropic:()=>X0,BadRequestError:()=>S$,AuthenticationError:()=>j$,AnthropicError:()=>k,Anthropic:()=>k1,APIUserAbortError:()=>O0,APIPromise:()=>w1,APIError:()=>W0,APIConnectionTimeoutError:()=>w$,APIConnectionError:()=>C1,AI_PROMPT:()=>B9});var hY=v(()=>{M9();D5();R4();M9();z0();_0()});var i9=LW(p9(),1),{program:bF,createCommand:kF,createArgument:yF,createOption:vF,CommanderError:gF,InvalidArgumentError:fF,InvalidOptionArgumentError:hF,Command:n9,Argument:uF,Option:mF,Help:cF}=i9.default;import{readFileSync as Qz,writeFileSync as YN,existsSync as zz}from"fs";import{join as Jz,dirname as Yz,basename as WN}from"path";import{execFileSync as UN}from"child_process";var RO=e3(),_O=M2(),FO=g3(),VZ=O2(),CO=Z2(),T1=i(),EO=O1(),PO=J0(),wO=L1(),SO=D1(),WE=_8(),jO=UZ(),xO=qZ(),bO=GZ(),P8=Zz(),Xz=e$();var kO=RO.Composer,yO=_O.Document,vO=FO.Schema,gO=VZ.YAMLError,fO=VZ.YAMLParseError,hO=VZ.YAMLWarning,uO=CO.Alias,mO=T1.isAlias,cO=T1.isCollection,lO=T1.isDocument,dO=T1.isMap,pO=T1.isNode,iO=T1.isPair,nO=T1.isScalar,rO=T1.isSeq,sO=EO.Pair,aO=PO.Scalar,oO=wO.YAMLMap,tO=SO.YAMLSeq;var eO=jO.Lexer,$N=xO.LineCounter,ZN=bO.Parser,D0=P8.parse,XN=P8.parseAllDocuments,zN=P8.parseDocument,A2=P8.stringify,JN=Xz.visit,QN=Xz.visitAsync;function m($){let Z=Qz($,"utf-8");return D0(Z)}function KZ($){let Z=$._meta,X={...$};delete X._meta;let z=A2(X,{lineWidth:0});if(Z?.found&&Z.found.length>0){let J=Z.found.join(" + ");z=z.replace(/^(\s+type:\s+\S+)(\s*)$/m,(Q,Y,W)=>{if(W.includes("#"))return Q;return`${Y} # found: ${J}`})}return z}function $0($,Z){YN($,KZ(Z),"utf-8")}function u($){return Qz($,"utf-8")}function Wz($){return D0($)}function f($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=Jz($,z);if(zz(J))return J}let X=Yz($);if(X!==$)for(let z of Z){let J=Jz(X,z);if(zz(J))return J}return null}function B$($,Z=process.cwd()){return UN("git",["-C",Yz($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+WN($)}l();var M$=[{name:"TROPHY",indicator:`${H0("✪")} ${H0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${H0(A("★"))} ${H0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I("◆")} ${I("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${w8("◇")} ${w8("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${A("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${M("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${M("○")} RED`,threshold:1},{name:"WHITE",indicator:`${M("♡")}`,threshold:0}];function d0($){return $.indicator}function A1($){for(let Z of M$)if($>=Z.threshold)return Z;return M$[M$.length-1]}var BZ=null;function _2(){if(BZ)return BZ;try{let $=C0("faf-scoring-kernel");return BZ=$,$}catch{throw Error(`faf-scoring-kernel not installed.
204
+ `);this.baseURL=J.baseURL,this.timeout=J.timeout??K9.DEFAULT_TIMEOUT,this.logger=J.logger??console;let Q="warn";this.logLevel=Q,this.logLevel=G5(J.logLevel,"ClientOptions.logLevel",this)??G5(b6("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??Q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??QY(),w(this,u4,WY,"f"),this._options=J,this.apiKey=typeof Z==="string"?Z:null,this.authToken=X}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return D([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return D([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return D([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return UY($)}getUserAgent(){return`${this.constructor.name}/JS ${P1}`}defaultIdempotencyKey(){return`stainless-node-retry-${X5()}`}makeStatusError($,Z,X,z){return W0.generate($,Z,X,z)}buildURL($,Z,X){let z=!N(this,V9,"m",iY).call(this)&&X||this.baseURL,J=aQ($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),Q=this.defaultQuery(),Y=Object.fromEntries(J.searchParams);if(!Q5(Q)||!Q5(Y))Z={...Y,...Q,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))J.search=this.stringifyQuery(Z);return J.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:X}){}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,X){return this.request(Promise.resolve(X).then((z)=>{return{method:$,path:Z,...z}}))}request($,Z=null){return new w1(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,X){let z=await $,J=z.maxRetries??this.maxRetries;if(Z==null)Z=J;await this.prepareOptions(z);let{req:Q,url:Y,timeout:W}=await this.buildRequest(z,{retryCount:J-Z});await this.prepareRequest(Q,{url:Y,options:z});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),q=X===void 0?"":`, retryOf: ${X}`,G=Date.now();if(M0(this).debug(`[${U}] sending request`,q1({retryOfRequestLogID:X,method:z.method,url:Y,options:z,headers:Q.headers})),z.signal?.aborted)throw new O0;let V=new AbortController,K=await this.fetchWithTimeout(Y,Q,W,V).catch(i2),H=Date.now();if(K instanceof globalThis.Error){let O=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new O0;let T=U1(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return M0(this).info(`[${U}] connection ${T?"timed out":"failed"} - ${O}`),M0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (${O})`,q1({retryOfRequestLogID:X,url:Y,durationMs:H-G,message:K.message})),this.retryRequest(z,Z,X??U);if(M0(this).info(`[${U}] connection ${T?"timed out":"failed"} - error; no more retries left`),M0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (error; no more retries left)`,q1({retryOfRequestLogID:X,url:Y,durationMs:H-G,message:K.message})),T)throw new w$;throw new C1({cause:K})}let L=[...K.headers.entries()].filter(([O])=>O==="request-id").map(([O,T])=>", "+O+": "+JSON.stringify(T)).join(""),B=`[${U}${q}${L}] ${Q.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${H-G}ms`;if(!K.ok){let O=await this.shouldRetry(K);if(Z&&O){let x=`retrying, ${Z} attempts remaining`;return await YY(K.body),M0(this).info(`${B} - ${x}`),M0(this).debug(`[${U}] response error (${x})`,q1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:H-G})),this.retryRequest(z,Z,X??U,K.headers)}let T=O?"error; no more retries left":"error; not retryable";M0(this).info(`${B} - ${T}`);let j=await K.text().catch((x)=>i2(x).message),S=B4(j),b=S?void 0:j;throw M0(this).debug(`[${U}] response error (${T})`,q1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,message:b,durationMs:Date.now()-G})),this.makeStatusError(K.status,S,b,K.headers)}return M0(this).info(B),M0(this).debug(`[${U}] response start`,q1({retryOfRequestLogID:X,url:K.url,status:K.status,headers:K.headers,durationMs:H-G})),{response:K,options:z,controller:V,requestLogID:U,retryOfRequestLogID:X,startTime:G}}getAPIList($,Z,X){return this.requestAPIList(Z,X&&"then"in X?X.then((z)=>({method:"get",path:$,...z})):{method:"get",path:$,...X})}requestAPIList($,Z){let X=this.makeRequest(Z,null,void 0);return new t2(this,X,$)}async fetchWithTimeout($,Z,X,z){let{signal:J,method:Q,...Y}=Z||{},W=this._makeAbort(z);if(J)J.addEventListener("abort",W,{once:!0});let U=setTimeout(W,X),q=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,G={signal:z.signal,...q?{duplex:"half"}:{},method:"GET",...Y};if(Q)G.method=Q.toUpperCase();try{return await this.fetch.call(void 0,$,G)}finally{clearTimeout(U)}}async shouldRetry($){let Z=$.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,Z,X,z){let J,Q=z?.get("retry-after-ms");if(Q){let W=parseFloat(Q);if(!Number.isNaN(W))J=W}let Y=z?.get("retry-after");if(Y&&!J){let W=parseFloat(Y);if(!Number.isNaN(W))J=W*1000;else J=Date.parse(Y)-Date.now()}if(J===void 0){let W=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await eQ(J),this.makeRequest($,Z-1,X)}calculateDefaultRetryTimeoutMillis($,Z){let J=Z-$,Q=Math.min(0.5*Math.pow(2,J),8),Y=1-Math.random()*0.25;return Q*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let X={...$},{method:z,path:J,query:Q,defaultBaseURL:Y}=X,W=this.buildURL(J,Q,Y);if("timeout"in X)tQ("timeout",X.timeout);X.timeout=X.timeout??this.timeout;let{bodyHeaders:U,body:q}=this.buildBody({options:X}),G=await this.buildHeaders({options:$,method:z,bodyHeaders:U,retryCount:Z});return{req:{method:z,headers:G,...X.signal&&{signal:X.signal},...globalThis.ReadableStream&&q instanceof globalThis.ReadableStream&&{duplex:"half"},...q&&{body:q},...this.fetchOptions??{},...X.fetchOptions??{}},url:W,timeout:X.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:X,retryCount:z}){let J={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let Q=D([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...JY(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,X,$.headers]);return this.validateHeaders(Q),Q.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let X=D([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&X.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:M4($)};else if(typeof $==="object"&&X.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return N(this,u4,"f").call(this,{body:$,headers:X})}}var V9,K9,u4,iY,H9="\\n\\nHuman:",B9="\\n\\nAssistant:",k1;var M9=v(()=>{W1();r1();Y5();qY();_0();z0();D5();pY();I4();e5();G9();t5();q9();Y5();e();L4();r1();K9=X0,u4=new WeakMap,V9=new WeakSet,iY=function(){return this.baseURL!=="https://api.anthropic.com"};X0.Anthropic=K9;X0.HUMAN_PROMPT=H9;X0.AI_PROMPT=B9;X0.DEFAULT_TIMEOUT=600000;X0.AnthropicError=k;X0.APIError=W0;X0.APIConnectionError=C1;X0.APIConnectionTimeoutError=w$;X0.APIUserAbortError=O0;X0.NotFoundError=b$;X0.ConflictError=k$;X0.RateLimitError=v$;X0.BadRequestError=S$;X0.AuthenticationError=j$;X0.InternalServerError=g$;X0.PermissionDeniedError=x$;X0.UnprocessableEntityError=y$;X0.toFile=$6;k1=class k1 extends X0{constructor(){super(...arguments);this.completions=new s$(this),this.messages=new Z$(this),this.models=new o$(this),this.beta=new L0(this)}};k1.Completions=s$;k1.Messages=Z$;k1.Models=o$;k1.Beta=L0});var nY={};w9(nY,{toFile:()=>$6,default:()=>k1,UnprocessableEntityError:()=>y$,RateLimitError:()=>v$,PermissionDeniedError:()=>x$,PagePromise:()=>t2,NotFoundError:()=>b$,InternalServerError:()=>g$,HUMAN_PROMPT:()=>H9,ConflictError:()=>k$,BaseAnthropic:()=>X0,BadRequestError:()=>S$,AuthenticationError:()=>j$,AnthropicError:()=>k,Anthropic:()=>k1,APIUserAbortError:()=>O0,APIPromise:()=>w1,APIError:()=>W0,APIConnectionTimeoutError:()=>w$,APIConnectionError:()=>C1,AI_PROMPT:()=>B9});var rY=v(()=>{M9();D5();I4();M9();z0();_0()});var i9=PW(p9(),1),{program:lF,createCommand:dF,createArgument:pF,createOption:iF,CommanderError:nF,InvalidArgumentError:rF,InvalidOptionArgumentError:sF,Command:n9,Argument:aF,Option:oF,Help:tF}=i9.default;import{readFileSync as Qz,writeFileSync as MN,existsSync as zz}from"fs";import{join as Jz,dirname as Yz,basename as ON}from"path";import{execFileSync as NN}from"child_process";var xO=a3(),bO=M2(),kO=k3(),UZ=O2(),yO=Z2(),T1=i(),vO=O1(),gO=J0(),fO=L1(),hO=D1(),NP=_8(),uO=QZ(),mO=YZ(),cO=WZ(),E8=Zz(),Xz=e$();var lO=xO.Composer,dO=bO.Document,pO=kO.Schema,iO=UZ.YAMLError,nO=UZ.YAMLParseError,rO=UZ.YAMLWarning,sO=yO.Alias,aO=T1.isAlias,oO=T1.isCollection,tO=T1.isDocument,eO=T1.isMap,$N=T1.isNode,ZN=T1.isPair,XN=T1.isScalar,zN=T1.isSeq,JN=vO.Pair,QN=gO.Scalar,YN=fO.YAMLMap,WN=hO.YAMLSeq;var UN=uO.Lexer,qN=mO.LineCounter,GN=cO.Parser,D0=E8.parse,VN=E8.parseAllDocuments,KN=E8.parseDocument,A2=E8.stringify,HN=Xz.visit,BN=Xz.visitAsync;function m($){let Z=Qz($,"utf-8");return D0(Z)}function qZ($){let Z=$._meta,X={...$};delete X._meta;let z=A2(X,{lineWidth:0});if(Z?.found&&Z.found.length>0){let J=Z.found.join(" + ");z=z.replace(/^(\s+type:\s+\S+)(\s*)$/m,(Q,Y,W)=>{if(W.includes("#"))return Q;return`${Y} # found: ${J}`})}return z}function $0($,Z){MN($,qZ(Z),"utf-8")}function u($){return Qz($,"utf-8")}function Wz($){return D0($)}function f($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=Jz($,z);if(zz(J))return J}let X=Yz($);if(X!==$)for(let z of Z){let J=Jz(X,z);if(zz(J))return J}return null}function B$($,Z=process.cwd()){return NN("git",["-C",Yz($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+ON($)}l();var M$=[{name:"TROPHY",indicator:`${H0("✪")} ${H0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${H0(A("★"))} ${H0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I("◆")} ${I("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${w8("◇")} ${w8("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${A("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${M("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${M("○")} RED`,threshold:1},{name:"WHITE",indicator:`${M("♡")}`,threshold:0}];function d0($){return $.indicator}function A1($){for(let Z of M$)if($>=Z.threshold)return Z;return M$[M$.length-1]}var VZ=null;function _2(){if(VZ)return VZ;try{let $=C0("faf-scoring-kernel");return VZ=$,$}catch{throw Error(`faf-scoring-kernel not installed.
205
205
 
206
206
  Run: npm install faf-scoring-kernel
207
- `)}}function G0($){return JSON.parse(_2().score_faf($))}function qz($){return _2().validate_faf($)}function S8($){return _2().compile_fafb($)}function Gz($){return JSON.parse(_2().decompile_fafb($))}function Vz(){return _2().sdk_version()}var Kz=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function Hz($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function Bz($){let Z=$.match(/^about:\s*\n((?:[ \t]+.*\n?)*)/m);if(!Z)return null;let X=Z[1]??"",z=X.match(/^[ \t]+represents:\s*(\S+)\s*$/m);if(!z)return null;let J=z[1],Q=X.match(/^[ \t]+source_score:\s*(\d+)\s*$/m),Y=-1;if(Q){let W=parseInt(Q[1],10);if(W>=0&&W<=100)Y=W}return{represents:J,sourceScore:Y}}function B0($){return{score:$.score,tier:A1($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function Q0($){let Z=Bz($);if(Z){let X=Z.sourceScore;return{score:X,tier:X>=0?A1(X):M$[M$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents}}return B0(G0($))}l();l();import{existsSync as GN,readFileSync as VN,writeFileSync as KN,mkdirSync as HN}from"fs";import{join as Mz}from"path";import{homedir as BN}from"os";var MN=95,ON=30,NN=3,Oz=Mz(BN(),".config","faf"),MZ=Mz(Oz,"star-nudge"),LN="github.com/Wolfe-Jam/faf-cli";function DN($){if($.score<MN)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??NN))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??ON)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function IN(){try{if(!GN(MZ))return{shown:0,lastShownMs:null};let $=VN(MZ,"utf-8").trim();if($.startsWith("{")){let X=JSON.parse($),z=X.last?Date.parse(X.last):NaN;return{shown:Number.isFinite(X.shown)?Number(X.shown):0,lastShownMs:Number.isFinite(z)?z:null}}let Z=Date.parse($);return{shown:1,lastShownMs:Number.isFinite(Z)?Z:null}}catch{return{shown:0,lastShownMs:null}}}function TN($,Z){try{HN(Oz,{recursive:!0}),KN(MZ,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}))}catch{}}function Nz($){let Z=Date.now(),X=IN();if(!DN({score:$,isTTY:Boolean(process.stdout.isTTY),isCI:Boolean(process.env.CI),optedOut:Boolean(process.env.FAF_NO_NUDGE),shownCount:X.shown,lastShownMs:X.lastShownMs,nowMs:Z}))return;console.log(""),console.log(` ${H0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${LN}`),TN(X.shown,Z)}function Y0($,Z,X=!1){let z=d0($.tier),J=A(`${$.score}%`);if(console.log(`${z} ${J} ${M(`${$.populated}/${$.active} slots`)} ${M("—")} ${Z}`),$.tier.name==="TROPHY")console.log(M(" Trophy. AI never has to guess."));else if($.empty>0){let Q=Object.entries($.slots).filter(([,q])=>q==="empty").map(([q])=>q),Y=Q.slice(0,3).join(", "),W=Q.length>3?`, +${Q.length-3} more`:"",U=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${U} from Trophy: ${Y}${W}`))}if(X)console.log(""),AN($);Nz($.score)}function AN($){for(let[Z,X]of Object.entries($.slots)){let z=X==="populated"?I("●"):X==="slotignored"?M("—"):M("○");console.log(` ${z} ${X==="slotignored"?M(`${Z}: N/A`):Z}`)}}l();function j8($,Z={}){let X=$??f();if(!X)console.error(`Error: project.faf not found
208
-
209
- Run 'faf init' to create one.`),process.exit(2);let z=u(X),J=Q0(z);if(Z.json){let Q=m(X),Y={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",source:X,...J};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(`${d0(J.tier)} ${A(`${J.score}%`)}`);return}Y0(J,X,Z.verbose)}import{existsSync as bI}from"fs";import{join as $J}from"path";var Z0=[{index:1,path:"project.name",label:"Name",description:"Project name",category:"project"},{index:2,path:"project.goal",label:"Goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",label:"Language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",label:"Who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",label:"What",description:"What are they building",category:"human"},{index:6,path:"human_context.why",label:"Why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",label:"Where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",label:"When",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",label:"Framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",label:"CSS",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",label:"UI Library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",label:"State",description:"State management",category:"frontend"},{index:14,path:"stack.backend",label:"Backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",label:"API",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",label:"Runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",label:"Database",description:"Database",category:"backend"},{index:18,path:"stack.connection",label:"Connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",label:"Hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",label:"Build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",label:"CI/CD",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",label:"Monorepo",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",label:"Package Manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",label:"Workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",label:"Packages",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",label:"Build Orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",label:"Admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",label:"Cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",label:"Search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",label:"Storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",label:"Versioning",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",label:"Shared Configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",label:"Remote Cache",description:"Remote build cache",category:"enterprise_ops"}],O$=new Map(Z0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),vE=new Map(Z0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),gE=new Map(Z0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function F2($,Z){let X=(J)=>{let Q=J.split("."),Y=$;for(let W of Q)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},z=X(Z.path);if(z!==void 0)return z;if(Z.canonical)return X(Z.canonical);return}var fE=Z0.filter(($)=>$.index<=21);var OZ=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);function P0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return OZ.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var N$={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var R1="3.0";import{existsSync as F,readFileSync as t0,readdirSync as _Z}from"fs";import{join as R}from"path";var Lz=[{name:"Next.js",slug:"nextjs",category:"frontend",signals:[{type:"dependency",key:"next"},{type:"file",pattern:"next.config.*"}]},{name:"React",slug:"react",category:"frontend",signals:[{type:"dependency",key:"react"}]},{name:"SvelteKit",slug:"sveltekit",category:"frontend",signals:[{type:"dependency",key:"@sveltejs/kit"},{type:"file",pattern:"svelte.config.*"}]},{name:"Svelte",slug:"svelte",category:"frontend",signals:[{type:"dependency",key:"svelte"},{type:"devDependency",key:"svelte"}]},{name:"Vue.js",slug:"vue",category:"frontend",signals:[{type:"dependency",key:"vue"}]},{name:"Nuxt",slug:"nuxt",category:"frontend",signals:[{type:"dependency",key:"nuxt"},{type:"file",pattern:"nuxt.config.*"}]},{name:"Angular",slug:"angular",category:"frontend",signals:[{type:"dependency",key:"@angular/core"},{type:"file",pattern:"angular.json"}]},{name:"Astro",slug:"astro",category:"frontend",signals:[{type:"dependency",key:"astro"},{type:"file",pattern:"astro.config.*"}]},{name:"Solid",slug:"solid",category:"frontend",signals:[{type:"dependency",key:"solid-js"}]},{name:"Remix",slug:"remix",category:"frontend",signals:[{type:"dependency",key:"@remix-run/react"}]},{name:"Gatsby",slug:"gatsby",category:"frontend",signals:[{type:"dependency",key:"gatsby"},{type:"file",pattern:"gatsby-config.*"}]},{name:"Qwik",slug:"qwik",category:"frontend",signals:[{type:"dependency",key:"@builder.io/qwik"}]},{name:"Vercel (SvelteKit)",slug:"adapter-vercel",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-vercel"},{type:"devDependency",key:"@sveltejs/adapter-vercel"}]},{name:"Node (SvelteKit)",slug:"adapter-node",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-node"},{type:"devDependency",key:"@sveltejs/adapter-node"}]},{name:"Static (SvelteKit)",slug:"adapter-static",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-static"},{type:"devDependency",key:"@sveltejs/adapter-static"}]},{name:"Cloudflare (SvelteKit)",slug:"adapter-cloudflare",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-cloudflare"},{type:"devDependency",key:"@sveltejs/adapter-cloudflare"}]},{name:"Netlify (SvelteKit)",slug:"adapter-netlify",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-netlify"},{type:"devDependency",key:"@sveltejs/adapter-netlify"}]},{name:"Tailwind CSS",slug:"tailwind",category:"css",signals:[{type:"dependency",key:"tailwindcss"},{type:"devDependency",key:"tailwindcss"},{type:"file",pattern:"tailwind.config.*"}]},{name:"Bootstrap",slug:"bootstrap",category:"css",signals:[{type:"dependency",key:"bootstrap"}]},{name:"Styled Components",slug:"styled-components",category:"css",signals:[{type:"dependency",key:"styled-components"}]},{name:"shadcn/ui",slug:"shadcn",category:"ui",signals:[{type:"file",pattern:"components.json"},{type:"dependency",key:"@radix-ui/react-dialog"}]},{name:"Material UI",slug:"mui",category:"ui",signals:[{type:"dependency",key:"@mui/material"}]},{name:"Chakra UI",slug:"chakra",category:"ui",signals:[{type:"dependency",key:"@chakra-ui/react"}]},{name:"Ant Design",slug:"antd",category:"ui",signals:[{type:"dependency",key:"antd"}]},{name:"Redux",slug:"redux",category:"state",signals:[{type:"dependency",key:"@reduxjs/toolkit"}]},{name:"Zustand",slug:"zustand",category:"state",signals:[{type:"dependency",key:"zustand"}]},{name:"Jotai",slug:"jotai",category:"state",signals:[{type:"dependency",key:"jotai"}]},{name:"Pinia",slug:"pinia",category:"state",signals:[{type:"dependency",key:"pinia"}]},{name:"Express",slug:"express",category:"backend",signals:[{type:"dependency",key:"express"}]},{name:"Fastify",slug:"fastify",category:"backend",signals:[{type:"dependency",key:"fastify"}]},{name:"Hono",slug:"hono",category:"backend",signals:[{type:"dependency",key:"hono"}]},{name:"Elysia",slug:"elysia",category:"backend",signals:[{type:"dependency",key:"elysia"}]},{name:"NestJS",slug:"nestjs",category:"backend",signals:[{type:"dependency",key:"@nestjs/core"}]},{name:"Koa",slug:"koa",category:"backend",signals:[{type:"dependency",key:"koa"}]},{name:"Django",slug:"django",category:"backend",signals:[{type:"file",pattern:"manage.py"},{type:"file",pattern:"settings.py"}]},{name:"Flask",slug:"flask",category:"backend",signals:[{type:"content",pattern:"app.py",key:"flask"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"content",pattern:"main.py",key:"fastapi"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"content",pattern:"Gemfile",key:"rails"},{type:"content",pattern:"Gemfile.lock",key:"rails ("},{type:"file",pattern:"config/application.rb"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"content",pattern:"pom.xml",key:"spring-boot"},{type:"content",pattern:"build.gradle",key:"springframework.boot"},{type:"content",pattern:"build.gradle.kts",key:"springframework.boot"},{type:"content",pattern:"gradle/libs.versions.toml",key:"springframework.boot"}]},{name:"Vapor",slug:"vapor",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"vapor/vapor"},{type:"content",pattern:"Package.swift",key:'product(name: "Vapor"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Vapor'"},{type:"file",pattern:"Sources/App/configure.swift"}]},{name:"Hummingbird",slug:"hummingbird",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"hummingbird-project/hummingbird"},{type:"content",pattern:"Package.swift",key:'product(name: "Hummingbird"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Hummingbird'"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK",slug:"mcp",category:"ai",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}];import{existsSync as Dz,readFileSync as _N,readdirSync as FN}from"fs";import{join as NZ}from"path";var L$={version:2,_doc:"SINGLE SOURCE of Dart/Flutter detection KNOWLEDGE (A+B hybrid, the Truth-is-faf-cli spec). faf-cli imports this directly; faf-python-sdk vendors a synced copy (phase 2); MCPs compose it. Bolster Dart/Flutter by editing THIS file. Logic stays in dart.ts. Refreshed 2026-08-01 (knowledge v2) — community receipt on top of 6.13.0 Dart Edition.",flutterDeps:["flutter"],mcpDeps:["dart_mcp","mcp_server","mcp_dart","dart_mcp_server","mcp","dart_mcpserver"],serverFrameworks:[["serverpod","Serverpod"],["dart_frog","Dart Frog"],["conduit","Conduit"],["angel3_framework","Angel3"],["alfred","Alfred"],["shelf","Shelf"],["jaspr","Jaspr"],["relic","Relic"]],stateManagement:[["flutter_riverpod","Riverpod"],["hooks_riverpod","Riverpod"],["riverpod_annotation","Riverpod"],["riverpod","Riverpod"],["flutter_bloc","Bloc"],["bloc","Bloc"],["provider","Provider"],["get","GetX"],["flutter_mobx","MobX"],["mobx","MobX"],["signals","Signals"],["flutter_hooks","Hooks"]],routing:[["go_router","go_router"],["auto_route","auto_route"],["beamer","Beamer"],["routemaster","Routemaster"]]};var CN=L$.flutterDeps,EN=L$.mcpDeps,PN=L$.serverFrameworks,wN=L$.stateManagement,SN=L$.routing;function jN($){let Z=new Set,X=!1;for(let z of $.split(`
210
- `)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(z)){X=!0;continue}if(/^\S/.test(z))X=!1;if(X){let J=z.match(/^\s{2}([a-zA-Z0-9_]+):/);if(J)Z.add(J[1].toLowerCase())}}return Z}function x8($){let Z=NZ($,"pubspec.yaml");if(!Dz(Z))return null;let X;try{X=_N(Z,"utf-8")}catch{return null}let z=jN(X),J=(S)=>z.has(S.toLowerCase()),Q=CN.some(J)||/^flutter:\s*$/m.test(X)||/\bsdk:\s*flutter\b/.test(X),Y=EN.find(J),W=PN.find(([S])=>J(S)),U=wN.find(([S])=>J(S)),q=U?U[1]:"",G=SN.find(([S])=>J(S)),V=G?G[1]:"",K=J("flutter_test")?"flutter_test":J("test")?"test":"",H=/^executables:\s*$/m.test(X),L=!1;try{L=FN(NZ($,"bin")).some((S)=>S.endsWith(".dart"))}catch{}let B=H||L,O,T="",j;if(Q)if(T="Flutter",Dz(NZ($,"lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(X))O="mobile",j="pubspec.yaml (Flutter app)";else O="library",j="pubspec.yaml (Flutter package)";else if(Y)O="mcp",j=`pubspec.yaml + ${Y} (Dart MCP server)`;else if(W)O="backend",T=W[1],j=`pubspec.yaml + ${W[0]} (Dart backend)`;else if(B)O="cli",j=H?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else O="library",j="pubspec.yaml (Dart package)";return{appType:O,isFlutter:Q,framework:T,stateManagement:q,routing:V,testing:K,found:j}}import{existsSync as LZ,readFileSync as Az,readdirSync as Iz,statSync as bN}from"fs";import{join as k8}from"path";var b8={version:1,_doc:"SINGLE SOURCE of Go detection KNOWLEDGE (A+B hybrid, Truth-is-faf-cli). faf-cli imports this directly; SDKs/MCPs compose it. Bolster Go by editing THIS file. Logic stays in go.ts. Content-aware: go.mod ≠ one bucket — backend · CLI · MCP · library. 2026-08-01 initial (Dart composition pattern).",mcpModules:["github.com/mark3labs/mcp-go","github.com/modelcontextprotocol/go-sdk","github.com/metoro-io/mcp-golang","github.com/ThinkInAIXYZ/go-mcp"],serverFrameworks:[["github.com/gin-gonic/gin","Gin"],["github.com/labstack/echo","Echo"],["github.com/labstack/echo/v4","Echo"],["github.com/gofiber/fiber","Fiber"],["github.com/gofiber/fiber/v2","Fiber"],["github.com/go-chi/chi","Chi"],["github.com/go-chi/chi/v5","Chi"],["github.com/gorilla/mux","Gorilla Mux"],["github.com/gofiber/fiber/v3","Fiber"],["google.golang.org/grpc","gRPC"],["connectrpc.com/connect","Connect"],["github.com/go-kratos/kratos","Kratos"],["github.com/go-kratos/kratos/v2","Kratos"],["github.com/zeromicro/go-zero","go-zero"],["github.com/cloudwego/hertz","Hertz"]],cliFrameworks:[["github.com/spf13/cobra","Cobra"],["github.com/urfave/cli","urfave/cli"],["github.com/urfave/cli/v2","urfave/cli"],["github.com/alecthomas/kingpin","Kingpin"],["github.com/alecthomas/kong","Kong"]]};var kN=b8.mcpModules,yN=b8.serverFrameworks,vN=b8.cliFrameworks;function gN($){let Z=new Set,X=!1;for(let z of $.split(`
211
- `)){let J=z.replace(/\/\/.*$/,"").trim();if(!J)continue;if(/^require\s*\(\s*$/.test(J)){X=!0;continue}if(X){if(J===")"){X=!1;continue}let Y=J.match(/^(\S+)/);if(Y)Z.add(Y[1].toLowerCase());continue}let Q=J.match(/^require\s+(\S+)/);if(Q&&Q[1]!=="(")Z.add(Q[1].toLowerCase())}return Z}function Rz($,Z){let X=Z.toLowerCase();for(let z of $)if(z===X||z.startsWith(`${X}/`))return!0;return!1}function Tz($,Z){let X;for(let z of Z){if(!Rz($,z[0]))continue;if(!X||z[0].length>X[0].length)X=z}return X}function fN($,Z){let X;for(let z of Z){if(!Rz($,z))continue;if(!X||z.length>X.length)X=z}return X}function hN($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function uN($){let Z=k8($,"cmd");if(!LZ(Z))return!1;try{for(let X of Iz(Z)){let z=k8(Z,X);try{if(bN(z).isDirectory()){if(Iz(z).some((Q)=>Q.endsWith(".go")))return!0}else if(X.endsWith(".go"))return!0}catch{}}}catch{}return!1}function mN($){let Z=k8($,"main.go");if(!LZ(Z))return!1;try{let X=Az(Z,"utf-8");return/^package\s+main\b/m.test(X)}catch{return!1}}function y8($){let Z=k8($,"go.mod");if(!LZ(Z))return null;let X;try{X=Az(Z,"utf-8")}catch{return null}let z=hN(X),J=gN(X),Q=fN(J,kN),Y=Tz(J,yN),W=Tz(J,vN),U=uN($),q=mN($),G,V="",K;if(Q)G="mcp",K=`go.mod + ${Q} (Go MCP server)`;else if(Y)G="backend",V=Y[1],K=`go.mod + ${Y[0]} (Go backend)`;else if(W)G="cli",V=W[1],K=`go.mod + ${W[0]} (Go CLI)`;else if(U)G="cli",K="go.mod + cmd/ (Go CLI layout)";else if(q&&!Y)G="cli",K="go.mod + main.go package main (Go CLI)";else G="library",K="go.mod (Go module)";return{appType:G,modulePath:z,framework:V,found:K}}import{existsSync as lN,readFileSync as dN,readdirSync as pN}from"fs";import{join as iN}from"path";var c1={version:1,_doc:"SINGLE SOURCE of C# /.NET detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster C# by editing THIS file. Logic stays in csharp.ts. Content-aware: .csproj alone ≠ type — Sdk first, then props/packages. Kill line: .csproj alone ≠ type. 2026-08-01 initial.",mcpPackages:["ModelContextProtocol","ModelContextProtocol.AspNetCore","ModelContextProtocol.Core","ModelContextProtocol.Extensions.Tasks","ModelContextProtocol.Extensions.Apps"],cliPackages:[["System.CommandLine","System.CommandLine"],["Spectre.Console.Cli","Spectre.Console"],["Spectre.Console","Spectre.Console"],["McMaster.Extensions.CommandLineUtils","McMaster"]],testPackages:[["Microsoft.NET.Test.Sdk","VSTest"],["xunit.v3","xUnit"],["xunit","xUnit"],["NUnit","NUnit"],["MSTest.TestFramework","MSTest"],["MSTest","MSTest"]],grpcServerPackages:["Grpc.AspNetCore"],specializedSdks:[["Microsoft.NET.Sdk.Web","web","ASP.NET Core"],["Microsoft.NET.Sdk.Worker","worker","Worker"],["Microsoft.NET.Sdk.BlazorWebAssembly","blazor-wasm","Blazor WebAssembly"],["Microsoft.NET.Sdk.Razor","razor-lib","Razor Class Library"],["MSTest.Sdk","test","MSTest"],["Aspire.AppHost.Sdk","aspire","Aspire AppHost"]],baseSdk:"Microsoft.NET.Sdk"};var nN=c1.mcpPackages.map(($)=>$.toLowerCase()),rN=c1.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),sN=c1.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),aN=c1.grpcServerPackages.map(($)=>$.toLowerCase()),oN=c1.specializedSdks,_z=c1.baseSdk.toLowerCase();function tN($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),X=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),z=(Z?.[1]||X?.[1]||"").trim(),J=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),Q=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||Q||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),q=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),G=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),V=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),K=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());let H=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))H.add(L[1].toLowerCase());return{sdk:z,outputType:J,targetFramework:W,isTestProject:U,useMaui:q,useWpf:G,useWindowsForms:V,packages:K,frameworkRefs:H}}function DZ($,Z){let X=Z.toLowerCase();if($.has(X))return!0;for(let z of $)if(z===X||z.startsWith(`${X}.`))return!0;return!1}function Fz($,Z){let X;for(let[z,J]of Z){if(!DZ($,z))continue;if(!X||z.length>X[0].length)X=[z,J]}return X}function eN($){let Z;for(let X of nN){if(!DZ($,X))continue;if(!Z||X.length>Z.length)Z=X}for(let X of $)if(X==="modelcontextprotocol"||X.startsWith("modelcontextprotocol.")){if(!Z||X.length>Z.length)Z=X}return Z}function $L($){let Z=$.toLowerCase();if(!Z)return;let X;for(let z of oN){let J=z[0].toLowerCase();if(Z===J||Z.startsWith(`${J}/`)){if(!X||J.length>X[0].length)X=z}}return X}function v8($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function ZL($,Z){if($==="mcp")return 0;if($==="mobile")return 1;if($==="backend")return 2;if($==="cli")return 3;if(Z&&Z!=="")return 4;return 5}function XL($,Z){let X=Z.replace(/\.csproj$/i,""),{sdk:z,packages:J,frameworkRefs:Q,outputType:Y}=$,W,U="",q,G=eN(J),V=$L(z),K=Fz(J,sN),H=Fz(J,rN),L=aN.some((O)=>DZ(J,O)),B=Q.has("microsoft.aspnetcore.app");if(G)W="mcp",U="MCP",q=`${Z} + ${G} (C# MCP server)`;else if($.isTestProject||V?.[1]==="test"||K)W="library",U=K?.[1]||(V?.[1]==="test"?V[2]:"Test"),q=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",q=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",q=`${Z} + ${U}`;else if(V?.[1]==="web")W="backend",U=L?"gRPC":V[2],q=`${Z} + Sdk=${V[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(V?.[1]==="worker")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Worker)`;else if(V?.[1]==="blazor-wasm")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Blazor WASM)`;else if(V?.[1]==="aspire")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Aspire)`;else if(V?.[1]==="razor-lib")W="library",U=V[2],q=`${Z} + Sdk=${V[0]} (Razor class library)`;else if(B&&v8(Y))W="backend",U="ASP.NET Core",q=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!v8(Y))W="library",U="ASP.NET Core",q=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(H&&(v8(Y)||!Y))W="cli",U=H[1],q=`${Z} + ${H[0]} (C# CLI)`;else if(v8(Y))W="cli",q=`${Z} + OutputType=Exe (C# console)`;else{W="library";let O=z?` Sdk=${z}`:"";if(q=`${Z}${O} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!z||z.toLowerCase()===_z||z.toLowerCase().startsWith(`${_z}/`))q=`${Z} (C# class library)`}return{appType:W,projectName:X,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:U,found:q}}function D$($){if(!lN($))return[];try{return pN($).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}catch{return[]}}function g8($){let Z=D$($);if(Z.length===0)return null;let X=null,z=999;for(let J of Z){let Q=iN($,J),Y;try{Y=dN(Q,"utf-8")}catch{continue}let W=tN(Y),U=XL(W,J),q=ZL(U.appType,U.framework);if(!X||q<z)X=U,z=q}return X}import{existsSync as l1,readFileSync as JL,readdirSync as QL,statSync as YL}from"fs";import{join as v0}from"path";var p0={version:1,_doc:"SINGLE SOURCE of JVM (Java/Kotlin) detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster JVM by editing THIS file. Logic stays in jvm.ts. Kill line: pom / gradle alone ≠ type. Content-aware: plugins · parents · packaging · deps · version catalogs. One brand JVM — Android/KMP are facets, not a second Kotlin Edition. 2026-08-03 initial (post-intel).",mcpArtifacts:["io.modelcontextprotocol.sdk:mcp","io.modelcontextprotocol.sdk:mcp-core","io.modelcontextprotocol.sdk:mcp-spring-webflux","io.modelcontextprotocol.sdk:mcp-spring-webmvc","org.springframework.ai:spring-ai-starter-mcp-server","org.springframework.ai:spring-ai-starter-mcp-server-webmvc","org.springframework.ai:spring-ai-starter-mcp-server-webflux","org.springframework.ai:spring-ai-starter-mcp-client","org.springframework.ai:spring-ai-mcp-server-spring-boot-starter","org.springframework.ai:spring-ai-mcp-client-spring-boot-starter","io.modelcontextprotocol:kotlin-sdk","io.modelcontextprotocol.kotlin:mcp"],webPlugins:[["org.springframework.boot","Spring Boot"],["io.quarkus","Quarkus"],["io.quarkus.gradle.plugin","Quarkus"],["io.micronaut.application","Micronaut"],["io.micronaut.library","Micronaut"]],webParents:[["org.springframework.boot:spring-boot-starter-parent","Spring Boot"],["io.quarkus.platform:quarkus-bom","Quarkus"],["io.micronaut.platform:micronaut-parent","Micronaut"]],webArtifacts:[["org.springframework.boot:spring-boot-starter-web","Spring Boot"],["org.springframework.boot:spring-boot-starter-webflux","Spring Boot"],["org.springframework.boot:spring-boot-starter","Spring Boot"],["io.quarkus:quarkus-core","Quarkus"],["io.micronaut:micronaut-http-server-netty","Micronaut"],["io.ktor:ktor-server-core","Ktor"],["io.ktor:ktor-server-netty","Ktor"],["io.ktor:ktor-server-cio","Ktor"]],androidPlugins:["com.android.application","com.android.library","com.android.kotlin.multiplatform.library"],kmpPlugins:["org.jetbrains.kotlin.multiplatform","kotlin-multiplatform"],jvmKotlinPlugins:["org.jetbrains.kotlin.jvm","kotlin-jvm","org.jetbrains.kotlin.android","kotlin-android"],cliPlugins:[["org.gradle.application","application"],["application","application"]],cliArtifacts:[["info.picocli:picocli","Picocli"],["com.github.ajalt.clikt:clikt","Clikt"],["com.github.ajalt.clikt:clikt-jvm","Clikt"]],libraryPlugins:["java-library","org.gradle.java-library"]};var WL=p0.mcpArtifacts.map(($)=>$.toLowerCase()),UL=p0.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),qL=p0.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),GL=p0.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),WP=p0.androidPlugins.map(($)=>$.toLowerCase()),VL=p0.kmpPlugins.map(($)=>$.toLowerCase()),KL=p0.jvmKotlinPlugins.map(($)=>$.toLowerCase()),HL=p0.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),BL=p0.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),ML=p0.libraryPlugins.map(($)=>$.toLowerCase()),OL=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function IZ($){return OL.some((Z)=>l1(v0($,Z)))}function E2($){try{return JL($,"utf-8")}catch{return null}}function NL($){let Z=new Map,X=new Map,z="";for(let J of $.split(`
212
- `)){let Q=J.replace(/#.*$/,"").trim();if(!Q)continue;let Y=Q.match(/^\[([^\]]+)\]$/);if(Y){z=Y[1].trim().toLowerCase();continue}let W=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(W&&(z==="plugins"||z.endsWith(".plugins"))){Z.set(W[1].replace(/-/g,".").toLowerCase(),W[2].toLowerCase()),Z.set(W[1].toLowerCase(),W[2].toLowerCase());continue}let U=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(U&&(z==="libraries"||z.endsWith(".libraries"))){let V=U[1].toLowerCase();X.set(V,U[2].toLowerCase()),X.set(V.replace(/-/g,"."),U[2].toLowerCase());continue}let q=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(q&&(z==="libraries"||z.endsWith(".libraries"))){let V=`${q[2]}:${q[3]}`.toLowerCase(),K=q[1].toLowerCase();X.set(K,V),X.set(K.replace(/-/g,"."),V);continue}let G=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(G){let V=G[1].toLowerCase(),K=G[2];if(z==="plugins"||z.endsWith(".plugins")){let H=K.split(":")[0].toLowerCase();Z.set(V,H),Z.set(V.replace(/-/g,"."),H)}else if(z==="libraries"||z.endsWith(".libraries")){let H=K.split(":");if(H.length>=2){let L=`${H[0]}:${H[1]}`.toLowerCase();X.set(V,L),X.set(V.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:X}}function LL($){let Z=v0($,"gradle","libs.versions.toml");if(!l1(Z))return{plugins:new Map,libraries:new Map};let X=E2(Z);if(!X)return{plugins:new Map,libraries:new Map};return NL(X)}function DL($){let Z=[];for(let X of $.matchAll(/include\s*\(\s*([^)]+)\)/g))for(let z of X[1].split(",")){let J=z.replace(/['":\s]/g,"").replace(/^:/,"");if(J)Z.push(J.replace(/:/g,"/"))}for(let X of $.matchAll(/include\s+((?:['"][^'"]+['"]\s*,?\s*)+)/g))for(let z of X[1].split(",")){let J=z.replace(/['":\s]/g,"").replace(/^:/,"");if(J)Z.push(J.replace(/:/g,"/"))}for(let X of $.matchAll(/project\s*\(\s*["']:([^"']+)["']\s*\)\s*\.projectDir\s*=\s*file\s*\(\s*["']([^"']+)["']\s*\)/g))Z.push(X[2].replace(/^\.\//,""));return[...new Set(Z)]}function IL($,Z){let X=new Set;for(let z of $.matchAll(/\bid\s*\(\s*["']([^"']+)["']\s*\)/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/\bid\s+['"]([^'"]+)['"]/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/plugins\s*\{([\s\S]*?)\}/g))for(let J of z[1].split(/[\n;]/)){let Q=J.replace(/\/\/.*$/,"").trim();if(!Q||Q.startsWith("id")||Q.startsWith("kotlin")||Q.startsWith("alias"))continue;let Y=Q.match(/^`([a-zA-Z0-9.-]+)`$/)||Q.match(/^([a-zA-Z][a-zA-Z0-9.-]*)$/);if(Y)X.add(Y[1].toLowerCase())}for(let z of $.matchAll(/\bkotlin\s*\(\s*["']([^"']+)["']\s*\)/g)){let J=z[1].toLowerCase();if(J==="jvm")X.add("org.jetbrains.kotlin.jvm");else if(J==="multiplatform")X.add("org.jetbrains.kotlin.multiplatform");else if(J==="android")X.add("org.jetbrains.kotlin.android");else X.add(`org.jetbrains.kotlin.${J}`)}for(let z of $.matchAll(/libs\.plugins\.([A-Za-z0-9_.]+)/g)){let J=z[1].toLowerCase(),Q=Z.plugins.get(J)||Z.plugins.get(J.replace(/\./g,"-"))||Z.plugins.get(J.replace(/-/g,"."));if(Q)X.add(Q);else if(J.includes("spring")&&J.includes("boot"))X.add("org.springframework.boot")}for(let z of $.matchAll(/apply\s+plugin\s*:\s*['"]([^'"]+)['"]/g))X.add(z[1].toLowerCase());return X}function TL($,Z){let X=new Set;for(let z of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let J=z[1].toLowerCase();if(J.startsWith("plugins."))continue;let Q=[J,J.replace(/\./g,"-"),J.replace(/-/g,".")];for(let Y of Q){let W=Z.libraries.get(Y);if(W){X.add(W.includes(":")?W.split(":").slice(0,2).join(":"):W);break}}}return X}function Pz($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),X=new Set,z=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(z){let Y=z[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=z[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)X.add(`${Y}:${W}`.toLowerCase())}let J=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let W=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),U=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(W&&U)J.add(`${W}:${U}`.toLowerCase())}let Q=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))Q.push(Y[1].trim());return{packaging:Z,parents:X,artifacts:J,modules:Q}}function J1($,Z){let X=Z.toLowerCase();if($.has(X))return!0;for(let z of $)if(z===X||z.endsWith(`.${X}`)||z===X.replace(/^org\.gradle\./,""))return!0;return!1}function C2($,Z,X){let z;for(let[J,Q]of Z){let Y=!1;if(X==="plugin")Y=J1($,J);else if(Y=$.has(J)||[...$].some((W)=>W===J||W.startsWith(`${J}:`)||W.startsWith(`${J}.`)),!Y&&X==="artifact")Y=[...$].some((W)=>W===J||W.startsWith(`${J}`));if(!Y)continue;if(!z||J.length>z[0].length)z=[J,Q]}return z}function AL($){let Z;for(let X of WL)for(let z of $){if(z===X||z.startsWith(`${X}:`)||z.startsWith(X.replace(/:mcp$/,":"))){if(!Z||X.length>Z.length)Z=X}if(z.startsWith("io.modelcontextprotocol")||z.includes("spring-ai-starter-mcp")||z.includes("spring-ai-mcp")){if(!Z||z.length>Z.length)Z=z}}return Z}function wz($){let Z=new Set,X=!1,z=!1,J=[v0($,"src"),v0($,"src","main")],Q=(Y,W)=>{if(W>4||!l1(Y))return;let U;try{U=QL(Y)}catch{return}for(let q of U){if(q==="androidMain"||q==="commonMain"||q==="jvmMain"||q==="iosMain")Z.add(q);let G=v0(Y,q);try{if(YL(G).isDirectory())Q(G,W+1);else if(q.endsWith(".kt")||q.endsWith(".kts"))X=!0;else if(q.endsWith(".java"))z=!0}catch{}}};for(let Y of J)Q(Y,0);return{kotlin:X,java:z,hints:Z}}function RL($){let Z=[],X=$.plugins,z=$.artifacts,J=VL.some((b)=>J1(X,b))||$.sourceHints.has("commonMain"),Q=J1(X,"com.android.application"),Y=J1(X,"com.android.library")||J1(X,"com.android.kotlin.multiplatform.library");if(Q||Y)Z.push("android");if(J)Z.push("multiplatform");let W=AL(z),U=C2(X,UL,"plugin"),q=C2($.parents,qL,"parent"),G=C2(z,GL,"artifact"),V=C2(X,HL,"plugin"),K=C2(z,BL,"artifact"),H=ML.some((b)=>J1(X,b)),L=$.packaging==="pom",B,O="",T;if(Q)B="mobile",O=J?"Android+KMP":"Android",T=`${$.path||"root"} + com.android.application (${O})`;else if(W)B="mcp",O="MCP",Z.push("mcp"),T=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||q||G){B="backend",O=U?.[1]||q?.[1]||G?.[1]||"JVM";let b=U?.[0]||q?.[0]||G?.[0]||"web";T=`${$.path||"root"} + ${b} (JVM backend)`}else if(J&&!Y)B="library",O="Kotlin Multiplatform",T=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",O=J?"Android+KMP":"Android",T=`${$.path||"root"} + android library (${O})`;else if(K||$.hasApplicationPlugin&&($.hasMainClass||V)||V&&$.hasMainClass)B="cli",O=K?.[1]||"application",T=K?`${$.path||"root"} + ${K[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!H)B="cli",O="application",T=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",T=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let b=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(T=`${$.path||"root"} (${b} library)`,H)T=`${$.path||"root"} + java-library (JVM library)`}let j="Java";if($.kotlinSources&&$.javaSources)j="Java/Kotlin";else if($.kotlinSources||KL.some((b)=>J1(X,b))||J)j="Kotlin";let S=[...new Set(Z)];return{appType:B,framework:O,facets:S,found:T,buildTool:$.buildTool,mainLanguage:j}}function _L($,Z){if($==="mcp")return 0;if($==="mobile")return 1;if(Z.includes("multiplatform")&&$==="backend")return 2;if($==="backend")return 3;if($==="cli")return 4;if(Z.includes("multiplatform"))return 5;if(Z.includes("android"))return 6;return 7}function Cz($,Z,X){let z=Z?v0($,Z):$,J=v0(z,"build.gradle.kts"),Q=v0(z,"build.gradle"),Y=l1(J)?J:l1(Q)?Q:null;if(!Y)return null;let W=E2(Y);if(!W)return null;let U=IL(W,X),q=TL(W,X),G=wz(z),V=/mainClass\s*[.=]/.test(W)||/mainClassName\s*=/.test(W)||/Main-Class/.test(W),K=J1(U,"application")||J1(U,"org.gradle.application");return{path:Z||"build.gradle",plugins:U,artifacts:q,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:K,sourceHints:G.hints,kotlinSources:G.kotlin||Y.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function Ez($,Z){let X=Z?v0($,Z):$,z=v0(X,"pom.xml");if(!l1(z))return null;let J=E2(z);if(!J)return null;let{packaging:Q,parents:Y,artifacts:W}=Pz(J),U=wz(X);return{path:Z?`${Z}/pom.xml`:"pom.xml",plugins:new Set,artifacts:W,packaging:Q,parents:Y,hasMainClass:/<mainClass>/.test(J),hasApplicationPlugin:!1,sourceHints:U.hints,kotlinSources:U.kotlin,javaSources:U.java,buildTool:"maven"}}function P2($){if(!IZ($))return null;let Z=LL($),X=[],z=null;for(let q of["settings.gradle.kts","settings.gradle"]){let G=v0($,q);if(l1(G)){z=E2(G);break}}let J=z?DL(z):[],Q=Cz($,"",Z);if(Q)X.push(Q);for(let q of J){let G=Cz($,q,Z);if(G)X.push(G)}let Y=Ez($,"");if(Y){X.push(Y);let q=E2(v0($,"pom.xml"));if(q){let{modules:G}=Pz(q);for(let V of G){let K=Ez($,V);if(K)X.push(K)}}}if(X.length===0&&z)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(X.length===0)return null;let W=null,U=999;for(let q of X){let G=RL(q),V=_L(G.appType,G.facets);if(!W||V<U)W={appType:G.appType,framework:G.framework,buildTool:G.buildTool,mainLanguage:G.mainLanguage,facets:G.facets,found:G.found},U=V}if(W&&J.length>0&&!W.found.includes("multi-project"));return W}import{existsSync as j2,readFileSync as CL,readdirSync as f8,statSync as EL}from"fs";import{join as i0}from"path";var w2={version:1,_doc:"SINGLE SOURCE of Ruby detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Kill line: Gemfile alone ≠ Rails. Content-aware: gem names + light layout. 2026-08-03 initial (post-intel ruby-edition).",mcpGems:["mcp","fast-mcp","fast_mcp","rails-mcp-server","rails_mcp_server","ruby-mcp-client","ruby_mcp_client","ruby_llm-mcp","ruby_llm_mcp"],webGems:[["rails","Rails"],["railties","Rails"],["sinatra","Sinatra"],["sinatra-contrib","Sinatra"],["roda","Roda"],["grape","Grape"],["hanami","Hanami"],["hanami-controller","Hanami"],["rack","Rack"]],cliGems:[["thor","Thor"],["gli","GLI"],["commander","Commander"],["slop","Slop"]],railsLayoutFiles:["config/application.rb","config/routes.rb","bin/rails","config/environment.rb"]};var PL=w2.mcpGems.map(($)=>$.toLowerCase()),wL=w2.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),Sz=w2.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),SL=w2.railsLayoutFiles;function jL($){return j2(i0($,"Gemfile"))||j2(i0($,"gems.rb"))||xL($)}function xL($){try{return f8($).some((Z)=>Z.endsWith(".gemspec"))}catch{return!1}}function S2($){try{return CL($,"utf-8")}catch{return null}}function bL($){let Z=new Set;for(let X of $.split(`
213
- `)){let z=X.replace(/#.*$/,"").trim();if(!z)continue;let J=z.match(/^\s*gem\s+['"]([^'"]+)['"]/i)||z.match(/^\s*gem\s+:([A-Za-z0-9_.-]+)/i);if(J)Z.add(J[1].toLowerCase())}return Z}function kL($){let Z=new Set,X=!1;for(let z of $.split(`
214
- `)){let J=z.replace(/\r$/,"");if(/^\s*specs:\s*$/.test(J)){X=!0;continue}if(X){if(/^[A-Z]/.test(J)||J.startsWith("PLATFORMS")||J.startsWith("DEPENDENCIES")||J.startsWith("BUNDLED")||J.startsWith("RUBY VERSION")||J.startsWith("CHECKSUMS")){X=!1;continue}let Q=J.match(/^\s{2,}([a-zA-Z0-9_.-]+)\s*\(/);if(Q)Z.add(Q[1].toLowerCase())}}return Z}function yL($){let Z=new Set;for(let X of $.split(`
215
- `)){let J=X.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(J)Z.add(J[1].toLowerCase())}return Z}function vL($){let Z=new Set,X=[];for(let J of["Gemfile","gems.rb"]){let Q=i0($,J),Y=S2(Q);if(Y){for(let W of bL(Y))Z.add(W);X.push(J)}}let z=S2(i0($,"Gemfile.lock"))||S2(i0($,"gems.locked"));if(z){for(let J of kL(z))Z.add(J);X.push("Gemfile.lock")}try{for(let J of f8($)){if(!J.endsWith(".gemspec"))continue;let Q=S2(i0($,J));if(Q){for(let Y of yL(Q))Z.add(Y);X.push(J)}}}catch{}return{gems:Z,sources:X}}function x2($,Z){let X=Z.toLowerCase();if($.has(X))return!0;return!1}function TZ($,Z){let X;for(let[z,J]of Z){if(!x2($,z))continue;if(!X||z.length>X[0].length)X=[z,J]}return X}function gL($){let Z;for(let X of PL)if(x2($,X)&&(!Z||X.length>Z.length))Z=X;return Z}function jz($){for(let Z of SL)if(j2(i0($,Z)))return Z;return}function fL($,Z){let X=TZ(Z,Sz);if(X)return{hit:!0,why:X[0]};try{for(let J of f8($)){if(!J.endsWith(".gemspec"))continue;let Q=S2(i0($,J));if(Q&&/executables\s*=/.test(Q)&&!/executables\s*=\s*\[\s*\]/.test(Q))return{hit:!0,why:`${J} executables`}}}catch{}let z=i0($,"bin");if(j2(z))try{let Q=f8(z).filter((Y)=>{if(Y==="setup"||Y==="console"||Y==="rake")return!1;try{return EL(i0(z,Y)).isFile()}catch{return!1}}).filter((Y)=>Y!=="rails");if(Q.length>0&&!x2(Z,"rails")&&!jz($))return{hit:!0,why:`bin/${Q[0]}`}}catch{}return{hit:!1,why:""}}function h8($){if(!jL($))return null;let{gems:Z,sources:X}=vL($),z=X[0]||"Gemfile",J=X.some((O)=>O==="Gemfile"||O==="gems.rb"||O.includes("lock"))?"bundler":"rubygems",Q=gL(Z),Y=TZ(Z,wL),W=jz($),U=x2(Z,"rails")||x2(Z,"railties"),q=fL($,Z),G=j2(i0($,"config.ru")),V=U||!!W,K=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!G)?Y:void 0,H,L="",B;if(Q)H="mcp",L="MCP",B=`${z} + gem ${Q} (Ruby MCP)`;else if(V)if(H="backend",L="Rails",U&&W)B=`${z} + rails + ${W} (Rails)`;else if(U)B=`${z} + gem rails (Rails)`;else B=`${W} (Rails layout)`;else if(K)H="backend",L=K[1],B=`${z} + gem ${K[0]} (Ruby backend)`;else if(q.hit)H="cli",L=TZ(Z,Sz)?.[1]||"",B=`${z} + ${q.why} (Ruby CLI)`;else H="library",B=`${z} (Ruby library)`;return{appType:H,framework:L,packageManager:J,found:B}}import{existsSync as AZ,readFileSync as uL,readdirSync as mL,statSync as cL}from"fs";import{join as b2}from"path";var o0={version:1,_doc:"SINGLE SOURCE of Swift detection KNOWLEDGE (Truth-is-faf-cli). Kill line: Package.swift alone ≠ app. Static parse of products + package URLs + product names + light xcodeproj productType. Never execute Package.swift / swift build. 2026-08-03 post-intel swift-edition.",mcpPackageUrls:["modelcontextprotocol/swift-sdk","github.com/modelcontextprotocol/swift-sdk"],mcpProducts:["MCP"],serverPackageUrls:[["vapor/vapor","Vapor"],["github.com/vapor/vapor","Vapor"],["hummingbird-project/hummingbird","Hummingbird"],["github.com/hummingbird-project/hummingbird","Hummingbird"]],serverProducts:[["Vapor","Vapor"],["Hummingbird","Hummingbird"]],cliPackageUrls:[["apple/swift-argument-parser","ArgumentParser"],["github.com/apple/swift-argument-parser","ArgumentParser"]],cliProducts:[["ArgumentParser","ArgumentParser"]],appProductTypes:["com.apple.product-type.application"],cliProductTypes:["com.apple.product-type.tool"],vaporLayoutFiles:["Sources/App/configure.swift","Sources/App/routes.swift","Sources/App/entrypoint.swift"]};var lL=o0.mcpPackageUrls.map(($)=>$.toLowerCase()),dL=o0.mcpProducts.map(($)=>$.toLowerCase()),pL=o0.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),iL=o0.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),nL=o0.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),rL=o0.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),sL=o0.appProductTypes,aL=o0.cliProductTypes,oL=o0.vaporLayoutFiles;function tL($){return AZ(b2($,"Package.swift"))||RZ($).length>0}function RZ($){try{return mL($).filter((Z)=>{if(!Z.endsWith(".xcodeproj"))return!1;try{return cL(b2($,Z)).isDirectory()}catch{return!1}})}catch{return[]}}function kz($){try{return uL($,"utf-8")}catch{return null}}function eL($){let Z=$D($),X=Z.toLowerCase(),z=[],J=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,Q;while((Q=J.exec(Z))!==null)z.push(Q[1]);let Y=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((Q=Y.exec(Z))!==null)z.push(Q[1]);let W=[],U=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((Q=U.exec(Z))!==null)W.push(Q[1]);let q=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((Q=q.exec(Z))!==null)W.push(Q[1]);let G=/\.library\s*\(/.test(X),V=/\.executable\s*\(/.test(X),K=/\.plugin\s*\(/.test(X)&&!G&&!V?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(X),H=/\.executabletarget\s*\(/.test(X),L=/\.target\s*\(/.test(X)&&!H?!0:(X.match(/\.target\s*\(/g)||[]).length>(X.match(/\.executabletarget\s*\(/g)||[]).length+(X.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:z,productNames:W,hasLibraryProduct:G,hasExecutableProduct:V,hasPluginProduct:!!K,hasExecutableTarget:H,hasLibraryTarget:L}}function $D($){let Z="",X=0;while(X<$.length){if($[X]==='"'||$[X]==="'"){let z=$[X];Z+=z,X++;while(X<$.length){if($[X]==="\\"&&X+1<$.length){Z+=$[X]+$[X+1],X+=2;continue}if(Z+=$[X],$[X]===z){X++;break}X++}continue}if($[X]==="/"&&$[X+1]==="/"){X+=2;while(X<$.length&&$[X]!==`
216
- `)X++;continue}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<$.length&&!($[X]==="*"&&$[X+1]==="/"))X++;X+=2;continue}Z+=$[X],X++}return Z}function ZD($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let J of Z)for(let Q of X)if(Q.includes(J)&&(!z||J.length>z.length))z=J;return z}function xz($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let[J,Q]of Z)for(let Y of X)if(Y.includes(J)&&(!z||J.length>z[0].length))z=[J,Q];return z}function bz($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let[J,Q]of Z)if(X.includes(J)&&(!z||J.length>z[0].length))z=[J,Q];return z}function XD($){let Z=$.map((X)=>X.toLowerCase());return dL.some((X)=>Z.includes(X))}function zD($){let Z=!1,X=!1,z;for(let J of RZ($)){let Q=b2($,J,"project.pbxproj"),Y=kz(Q);if(!Y)continue;for(let W of sL)if(Y.includes(W))Z=!0,z=W;for(let W of aL)if(Y.includes(W)){if(X=!0,!z)z=W}}return{hasApplication:Z,hasTool:X,hit:z}}function JD($){for(let Z of oL)if(AZ(b2($,Z)))return Z;return}function k2($){if(!tL($))return null;let Z=b2($,"Package.swift"),X=AZ(Z),z=RZ($),J=z.length>0,Q=null;if(X){let n=kz(Z);if(n)Q=eL(n)}let Y=J?zD($):{hasApplication:!1,hasTool:!1},W=JD($),U=Q?.packageUrls??[],q=Q?.productNames??[],G=ZD(U,lL),V=XD(q),K=xz(U,pL),H=bz(q,iL),L=xz(U,nL),B=bz(q,rL),O=!!(G||V),T=!!(K||H||W),j=!!(Q?.hasExecutableProduct||Q?.hasExecutableTarget),S=!!(L||B),b=Y.hasApplication,y=X&&J?"spm+xcode":X?"spm":"xcode",x,c="",_;if(O)if(x="mcp",c="MCP",V)_="Package.swift + product MCP (Swift MCP)";else _=`Package.swift + ${G} (Swift MCP)`;else if(T)if(x="backend",c=H?.[1]||K?.[1]||(W?"Vapor":""),H)_=`Package.swift + product ${H[1]} (Swift backend)`;else if(K)_=`Package.swift + ${K[1]} (Swift backend)`;else _=`${W} (Swift backend layout)`;else if(b)x="app",c="",_=`${z[0]} + ${Y.hit||"application"} (Swift app)`;else if(S||j&&!T&&!O)if(x="cli",c=B?.[1]||L?.[1]||"",B)_=`Package.swift + product ${B[1]} (Swift CLI)`;else if(L)_=`Package.swift + ${L[1]} (Swift CLI)`;else if(Q?.hasExecutableProduct)_="Package.swift + .executable product (Swift CLI)";else _="Package.swift + .executableTarget (Swift CLI)";else if(Y.hasTool&&!X)x="cli",_=`${z[0]} + tool productType (Swift CLI)`;else if(X)if(x="library",Q?.hasLibraryProduct)_="Package.swift + .library product (Swift library)";else _="Package.swift (Swift library)";else x="library",_=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:x,framework:c,packageManager:y,found:_}}function QD($){let Z=R($,"Cargo.toml");if(!F(Z))return null;try{let z=t0(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}catch{return null}}function YD($){let Z=R($,"Cargo.toml");if(!F(Z))return!1;try{let X=t0(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(X)}catch{return!1}}function WD($,Z){if(Z?.keywords?.some((z)=>/^sdk(?:\s|-|$)|-sdk$/i.test(z)))return'package.json keywords contains "sdk"';if(Z?.name&&/(?:^|[-_/])sdk(?:[-_/]|$)/i.test(Z.name))return`package.json name "${Z.name}" → sdk`;let X=QD($);if(X&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(X))return`Cargo.toml name "${X}" → sdk`;return null}function UD($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let X of Z){let z=R($,X);if(!F(z))continue;try{let J=JSON.parse(t0(z,"utf-8"));if(typeof J.manifest_version==="number")return`${X} manifest_version ${J.manifest_version} (browser extension)`}catch{}}return null}function qD($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,X=R($,"pyproject.toml");if(F(X))try{let Q=t0(X,"utf-8").match(Z);if(Q)return`pyproject.toml depends on ${Q[1]}`}catch{}let z=R($,"requirements.txt");if(F(z))try{let Q=t0(z,"utf-8").match(Z);if(Q)return`requirements.txt contains ${Q[1]}`}catch{}return null}function GD($,Z){let X=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let z of X)if(Z.dependencies?.[z]||Z.devDependencies?.[z])return`${z} dependency`}if(F(R($,"ios"))&&F(R($,"android")))return"ios/ + android/ dirs";return null}function VD($,Z){let X=R($,"Cargo.toml");if(F(X))try{let J=t0(X,"utf-8");if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(J))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(J))return"Cargo.toml wasm-bindgen/wasm-pack"}catch{}let z=R($,"build.zig");if(F(z))try{let J=t0(z,"utf-8");if(/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(J))return"build.zig wasm target"}catch{}if(Z?.keywords?.some((J)=>/^wasm(?:-|$)|webassembly/i.test(J)))return'package.json keywords contains "wasm"';return null}function KD($,Z){if(!F(R($,"index.html")))return null;if(Z?.dependencies||Z?.devDependencies){let X={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((J)=>X[J]))return null}return"index.html (vanilla, no frontend framework)"}function HD($,Z){if(Z?.name&&/specification|^@.*\/spec/i.test(Z.name))return`package name "${Z.name}" → documentation`;if(Z?.keywords?.some((X)=>/^(specification|format-spec|standard)$/i.test(X)))return'package keywords contains "specification"';if(Z?.bin)return null;if(Z?.files&&Z.files.length>0){let X=/^(dist|src|lib|build|bin)(\/|$)|\/(dist|src|lib|build|bin)(\/|$)|(\.|\/)(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,z=Z.files.some((Q)=>X.test(Q)),J=Z.files.some((Q)=>/\.(md|MD)$|examples?\//.test(Q)||Q==="README.md"||Q==="docs"||Q==="docs/");if(!z&&J)return"package.json files = docs/examples only (no source)"}return null}function BD($,Z,X){let z=X.find((J)=>J.slug==="astro"||J.slug==="gatsby");if(z)return`${z.name} (static-site framework)`;if(Z?.keywords?.some((J)=>/^(website|marketing|landing|brochure|portfolio)$/i.test(J)))return'package keywords contains "website"/"marketing"/"landing"';return null}function MD($,Z){if(!Z)return null;let X={...Z.dependencies??{},...Z.devDependencies??{}},z=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],J=["stripe","@stripe/stripe-js","lemonsqueezy"],Q=z.some((W)=>X[W]),Y=J.some((W)=>X[W]);if(Q&&Y)return"auth + payment dependencies";return null}function OD($,Z,X){if(Z?.keywords?.some((Q)=>/mcpaas/i.test(Q)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let z=X.some((Q)=>Q.slug==="mcp"),J=X.some((Q)=>Q.category==="database");if(z&&J&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function ND($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||F(R($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}var LD=new Set(["node_modules","dist","build","out","vendor","target","coverage","docs","doc","e2e","tests","test","__tests__","scripts","deploy","bin","public","examples","example","fixtures","assets","static","migrations","config","contracts","proto","protos"]),yz=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,DD=new Set(["frontend","backend","database","css","ui","state"]);function ID($){if(F(R($,"pyproject.toml"))||F(R($,"manage.py"))||F(R($,"setup.py"))||u8($,"requirements*.txt"))return!0;if(F(R($,"go.mod")))return!0;if(F(R($,"Cargo.toml")))return!0;if(F(R($,"Gemfile")))return!0;if(F(R($,"pom.xml"))||u8($,"build.gradle*"))return!0;if(D$($).length>0)return!0;let Z=_1($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function m8($){let Z;try{Z=_Z($,{withFileTypes:!0})}catch{return[]}let X=[];for(let z of Z){if(!z.isDirectory()||z.name.startsWith(".")||LD.has(z.name))continue;let J=R($,z.name);if(!ID(J))continue;let Q=l8(J);if(Q==="Unknown")continue;let Y=c8(J).filter((G)=>DD.has(G.category)),W=Y.find((G)=>G.category==="frontend"),U=Y.find((G)=>G.category==="backend"),q=W??U??Y[0]??null;X.push({name:z.name,language:Q,topFramework:q?.name??null,frontend:!!W,backend:!!U||yz.test(Q),hasFramework:!!q,appRoot:F(R(J,"manage.py"))||F(R(J,"config.ru"))||F(R(J,"bin/rails"))||F(R(J,"artisan"))})}return X}function TD($,Z){if(Z?.workspaces||F(R($,"pnpm-workspace.yaml")))return null;let X=m8($),z=new Set(X.map((J)=>J.language));if(X.length<2||z.size<2)return null;if(!X.some((J)=>J.frontend)||!X.some((J)=>J.backend))return null;return`polyglot: ${X.map((J)=>`${J.name}/ (${J.language})`).join(", ")}`}function vz($){let Z=m8($);if(Z.length<2)return null;let X=(Y)=>(Y.appRoot?2:0)+(yz.test(Y.language)?2:0)+(Y.hasFramework?1:0)+(Y.frontend?0.5:0),z=[...Z].sort((Y,W)=>X(W)-X(Y)),J=new Set,Q=[];for(let Y of z){if(J.has(Y.language))continue;J.add(Y.language);let W=Y.frontend?"frontend":Y.backend?"backend":"service";Q.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${W})`:`${Y.language} (${W})`)}return Q.join("; ")}function _1($){let Z=R($,"package.json");if(!F(Z))return null;try{return JSON.parse(t0(Z,"utf-8"))}catch{return null}}function u8($,Z){if(!Z.includes("*"))return F(R($,Z));let X=Z.split("/");if(X.length===1){let W=Z.split("*")[0];try{return _Z($).some((U)=>U.startsWith(W))}catch{return!1}}let z=R($,...X.slice(0,-1)),J=X[X.length-1],Q=J.split("*")[0],Y=J.split("*")[1]||"";try{return _Z(z).some((W)=>W.startsWith(Q)&&W.endsWith(Y))}catch{return!1}}function AD($,Z,X){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return u8(X,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!u8(X,$.pattern))return!1;try{let z=R(X,$.pattern);if(!F(z))return!1;return t0(z,"utf-8").toLowerCase().includes($.key.toLowerCase())}catch{return!1}}default:return!1}}function c8($){let Z=_1($);return Lz.map((X)=>{let J=X.signals.filter((Q)=>AD(Q,Z,$)).length/X.signals.length;return{name:X.name,slug:X.slug,category:X.category,confidence:J}}).filter((X)=>X.confidence>0).sort((X,z)=>z.confidence-X.confidence)}function l8($){let Z=_1($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(F(R($,"tsconfig.json")))return"TypeScript";if(F(R($,"Cargo.toml")))return"Rust";if(F(R($,"go.mod")))return"Go";if(D$($).length>0)return"C#";if(F(R($,"pyproject.toml"))||F(R($,"setup.py")))return"Python";if(F(R($,"Gemfile")))return"Ruby";if(IZ($)){let X=P2($);if(X)return X.mainLanguage==="Java/Kotlin"?"Kotlin":X.mainLanguage;return"Java"}if(F(R($,"Package.swift")))return"Swift";if(F(R($,"build.zig")))return"Zig";if(F(R($,"pubspec.yaml")))return"Dart";if(Z)return"JavaScript";return"Unknown"}function gz($){let Z=_1($),X=c8($),z=[],J=HD($,Z);if(J)return z.push(J),{type:"documentation",found:z};let Q=WD($,Z);if(Q)return z.push(Q),{type:"sdk",found:z};let Y=UD($);if(Y)return z.push(Y),{type:"extension",found:z};let W=OD($,Z,X);if(W)return z.push(W),{type:"mcpaas",found:z};let U=MD($,Z);if(U)return z.push(U),{type:"saas",found:z};let q=VD($,Z);if(q)return z.push(q),{type:"wasm",found:z};let G=x8($);if(G)return z.push(G.found),{type:G.appType,found:z};let V=y8($);if(V)return z.push(V.found),{type:V.appType,found:z};let K=g8($);if(K)return z.push(K.found),{type:K.appType,found:z};let H=P2($);if(H)return z.push(H.found),{type:H.appType,found:z};let L=h8($);if(L)return z.push(L.found),{type:L.appType,found:z};let B=k2($);if(B)return z.push(B.found),{type:B.appType,found:z};let O=GD($,Z);if(O)return z.push(O),{type:"mobile",found:z};if(X.some((r)=>r.slug==="mcp"))return z.push("MCP SDK signal"),{type:"mcp",found:z};if(Z?.bin)return z.push("package.json bin"),{type:"cli",found:z};if(YD($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(F(R($,"build.zig"))){if(z.push("build.zig"),F(R($,"src/main.zig")))return z.push("src/main.zig"),{type:"cli",found:z};if(F(R($,"src/root.zig")))return z.push("src/root.zig"),{type:"library",found:z}}let j=X.some((r)=>r.slug==="svelte"||r.slug==="sveltekit");if(Z?.private===!0&&(F(R($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&j)return z.push("private workspace","Svelte"),{type:"framework",found:z};if(j)return z.push("Svelte/SvelteKit"),{type:"svelte",found:z};let b=X.some((r)=>r.category==="frontend"),y=X.some((r)=>r.category==="backend");if(Z?.private&&(Z.workspaces||F(R($,"pnpm-workspace.yaml")))&&b&&y)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let x=ND($,Z);if(x)return z.push(x),{type:"monorepo-root",found:z};let c=BD($,Z,X);if(c)return z.push(c),{type:"website",found:z};if(X.some((r)=>r.slug==="nextjs"||r.slug==="nuxt"))return z.push(X.find((r)=>r.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:z};let n=X.some((r)=>r.category==="frontend"),p=X.some((r)=>r.category==="backend");if(n&&p)return z.push("frontend framework","backend framework"),{type:"fullstack",found:z};if(n)return z.push("frontend framework"),{type:"frontend",found:z};if(p)return z.push("backend framework"),{type:"backend",found:z};let A0=qD($);if(A0)return z.push(A0),{type:"data-science",found:z};let E=KD($,Z);if(E)return z.push(E),{type:"html",found:z};let d=TD($,Z);if(d)return z.push(d),{type:"fullstack",found:z};if(Z?.main&&!Z?.bin)return z.push("package.json main (no bin)"),{type:"library",found:z};return z.push("no classifying signals — fallback"),{type:"library",found:z}}function fz($){if(F(R($,"bunfig.toml")))return"Bun";if(F(R($,"deno.json"))||F(R($,"deno.jsonc")))return"Deno";if(_1($))return"Node.js";if(F(R($,"Cargo.toml")))return"Rust";if(F(R($,"go.mod")))return"Go";if(D$($).length>0)return".NET";if(F(R($,"pubspec.yaml")))return"Dart";return"Unknown"}function hz($){if(F(R($,"pubspec.yaml")))return"pub";if(F(R($,"go.mod")))return"go modules";if(D$($).length>0)return"NuGet";if(F(R($,"pom.xml")))return"maven";if(F(R($,"build.gradle"))||F(R($,"build.gradle.kts"))||F(R($,"settings.gradle"))||F(R($,"settings.gradle.kts")))return"gradle";if(F(R($,"bun.lockb"))||F(R($,"bun.lock")))return"bun";if(F(R($,"pnpm-lock.yaml")))return"pnpm";if(F(R($,"yarn.lock")))return"yarn";if(F(R($,"package-lock.json")))return"npm";return"npm"}function uz($){if(F(R($,".github/workflows")))return"GitHub Actions";if(F(R($,".gitlab-ci.yml")))return"GitLab CI";if(F(R($,".circleci")))return"CircleCI";if(F(R($,"Jenkinsfile")))return"Jenkins";return null}function mz($){if(F(R($,"vercel.json")))return"Vercel";if(F(R($,"netlify.toml")))return"Netlify";if(F(R($,"wrangler.toml")))return"Cloudflare";if(F(R($,"Dockerfile")))return"Docker";if(F(R($,"fly.toml")))return"Fly.io";if(F(R($,"render.yaml")))return"Render";return null}function cz($){let Z=R($,"svelte.config.js");if(!F(Z))return null;try{let z=t0(Z,"utf-8").match(/@sveltejs\/adapter-(\w+)/);if(z){let J=z[1];switch(J){case"vercel":return"Vercel";case"node":return"Node";case"static":return"Static";case"cloudflare":return"Cloudflare";case"netlify":return"Netlify";case"auto":return"Auto";default:return J}}return null}catch{return null}}function lz($){let Z=_1($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return"Vite";if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(F(R($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function d8($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((X)=>F(R($,X)))}function p8($,Z){let X={};if(Z?.scripts){for(let z of["build","test","lint","dev","start"])if(Z.scripts[z]){let J=F(R($,"bun.lock"))||F(R($,"bun.lockb"))?"bun run":"npm run";X[z]=`${J} ${z}`}}if(F(R($,"Cargo.toml"))){if(!X.build)X.build="cargo build --release";if(!X.test)X.test="cargo test";if(!X.lint)X.lint="cargo clippy"}if(F(R($,"build.zig"))){if(!X.build)X.build="zig build";if(!X.test)X.test="zig build test"}if(F(R($,"go.mod"))){if(!X.build)X.build="go build ./...";if(!X.test)X.test="go test ./..."}if(F(R($,"pyproject.toml"))||F(R($,"pytest.ini"))){if(!X.test)X.test="pytest"}return X}function dz($,Z,X,z){let J=[];if(z&&z!=="Unknown")J.push(z);let Q=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of X)if(Q.has(Y.category))J.push(Y.name);if(F(R($,"bunfig.toml")))J.push("Bun");else if(F(R($,"deno.json"))||F(R($,"deno.jsonc")))J.push("Deno");if(J.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!J.some((U)=>U.toLowerCase().includes(W.toLowerCase())))J.push(W)}return J}function i8($){let Z=_1($),X=c8($),z=gz($),J=z.type,Q=z.found.some((s)=>s.startsWith("polyglot:")),Y=Q&&vz($)||l8($),W=fz($),U=hz($),q=uz($),G=mz($),V=lz($),K=X.find((s)=>s.category==="frontend"),H=X.find((s)=>s.category==="css"),L=X.find((s)=>s.category==="ui"),B=X.find((s)=>s.category==="state"),O=X.find((s)=>s.category==="backend"),T=X.find((s)=>s.category==="database"),j=N$[J]||N$.library,S=J==="framework",b=X.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),y=S&&b?"svelte":S?null:null,x=J==="svelte"||y==="svelte",c=x?cz($):null,_=x&&X.some((s)=>s.slug==="sveltekit"),n=new Set(["css_framework","ui_library","database","connection","hosting"]),p={},A0=Z0.filter((s)=>s.path.startsWith("stack."));for(let s of A0){let t=s.path.replace("stack.","");if(!j.includes(s.category)){p[t]="slotignored";continue}if(S&&n.has(t)){p[t]="slotignored";continue}switch(t){case"frontend":p[t]=K?.name??(J==="cli"?"CLI":"");break;case"css_framework":p[t]=H?.name??"";break;case"ui_library":p[t]=L?.name??"";break;case"state_management":p[t]=x?B?.name??"Runes":B?.name??"";break;case"backend":p[t]=x?_?"SvelteKit":O?.name??"":O?.name??"";break;case"api_type":p[t]=_?"Server Routes":"";break;case"runtime":p[t]=W!=="Unknown"?W:"";break;case"database":p[t]=T?.name??"";break;case"connection":p[t]=T?.name??"";break;case"hosting":if(x&&c)p[t]=c;else p[t]=G??"";break;case"build":p[t]=x?"Vite":V??"";break;case"cicd":p[t]=q??"";break;case"package_manager":p[t]=U;break;default:p[t]="";break}}let E={},d=Z0.filter((s)=>s.path.startsWith("monorepo."));for(let s of d){let t=s.path.replace("monorepo.","");if(!j.includes(s.category))E[t]="slotignored";else E[t]=""}let r={name:Z?.name??$.split("/").pop()??"project",goal:Q?"":Z?.description??"",main_language:Y,type:J};if(S&&y)r.framework=y;let m0=dz($,Z,X,Q?l8($):Y);if(Q){for(let s of m8($))for(let t of[s.language,s.topFramework])if(t&&!m0.includes(t))m0.push(t)}let E9=d8($),P9=p8($,Z),g6={faf_version:R1,project:r,stack:p,human_context:{who:"",what:Q?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:E,_meta:{found:z.found}};if(m0.length>0)g6.tech_stack=m0;if(E9.length>0)g6.key_files=E9;if(Object.keys(P9).length>0)g6.commands=P9;return g6}import{existsSync as _D,readFileSync as FD}from"fs";import{join as CD}from"path";var pz={MIN_LENGTH:8,MAX_LENGTH:280},RD=[/^(see|see\s+the?)\s+readme/i,/^(tbd|todo|fixme|coming\s+soon)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+users|for\s+developers)\.?$/i,/^(description|goal|name|title)\.?$/i,/^lorem\s+ipsum/i,/^example(\s+\w+)?\.?$/i];function n0($){let Z=$.trim();if(Z.length<pz.MIN_LENGTH)return!1;if(Z.length>pz.MAX_LENGTH)return!1;if(RD.some((X)=>X.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
217
- `).length>4)return!1;return!0}function ED($){let Z=$.split(`
207
+ `)}}function G0($){return JSON.parse(_2().score_faf($))}function qz($){return _2().validate_faf($)}function S8($){return _2().compile_fafb($)}function Gz($){return JSON.parse(_2().decompile_fafb($))}function Vz(){return _2().sdk_version()}var Kz=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function Hz($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function Bz($){let Z=$.match(/^about:\s*\n((?:[ \t]+.*\n?)*)/m);if(!Z)return null;let X=Z[1]??"",z=X.match(/^[ \t]+represents:\s*(\S+)\s*$/m);if(!z)return null;let J=z[1],Q=X.match(/^[ \t]+source_score:\s*(\d+)\s*$/m),Y=-1;if(Q){let W=parseInt(Q[1],10);if(W>=0&&W<=100)Y=W}return{represents:J,sourceScore:Y}}function B0($){return{score:$.score,tier:A1($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function Q0($){let Z=Bz($);if(Z){let X=Z.sourceScore;return{score:X,tier:X>=0?A1(X):M$[M$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents}}return B0(G0($))}l();l();import{existsSync as DN,readFileSync as IN,writeFileSync as TN,mkdirSync as AN}from"fs";import{join as Mz}from"path";import{homedir as RN}from"os";var _N=95,FN=30,CN=3,Oz=Mz(RN(),".config","faf"),KZ=Mz(Oz,"star-nudge"),PN="github.com/Wolfe-Jam/faf-cli";function EN($){if($.score<_N)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??CN))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??FN)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function wN(){try{if(!DN(KZ))return{shown:0,lastShownMs:null};let $=IN(KZ,"utf-8").trim();if($.startsWith("{")){let X=JSON.parse($),z=X.last?Date.parse(X.last):NaN;return{shown:Number.isFinite(X.shown)?Number(X.shown):0,lastShownMs:Number.isFinite(z)?z:null}}let Z=Date.parse($);return{shown:1,lastShownMs:Number.isFinite(Z)?Z:null}}catch{return{shown:0,lastShownMs:null}}}function SN($,Z){try{AN(Oz,{recursive:!0}),TN(KZ,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}))}catch{}}function Nz($){let Z=Date.now(),X=wN();if(!EN({score:$,isTTY:Boolean(process.stdout.isTTY),isCI:Boolean(process.env.CI),optedOut:Boolean(process.env.FAF_NO_NUDGE),shownCount:X.shown,lastShownMs:X.lastShownMs,nowMs:Z}))return;console.log(""),console.log(` ${H0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${PN}`),SN(X.shown,Z)}function Y0($,Z,X=!1){let z=d0($.tier),J=A(`${$.score}%`);if(console.log(`${z} ${J} ${M(`${$.populated}/${$.active} slots`)} ${M("—")} ${Z}`),$.tier.name==="TROPHY")console.log(M(" Trophy. AI never has to guess."));else if($.empty>0){let Q=Object.entries($.slots).filter(([,q])=>q==="empty").map(([q])=>q),Y=Q.slice(0,3).join(", "),W=Q.length>3?`, +${Q.length-3} more`:"",U=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${U} from Trophy: ${Y}${W}`))}if(X)console.log(""),jN($);Nz($.score)}function jN($){for(let[Z,X]of Object.entries($.slots)){let z=X==="populated"?I("●"):X==="slotignored"?M("—"):M("○");console.log(` ${z} ${X==="slotignored"?M(`${Z}: N/A`):Z}`)}}l();function j8($,Z={}){let X=$??f();if(!X)console.error(`Error: project.faf not found
208
+
209
+ Run 'faf init' to create one.`),process.exit(2);let z=u(X),J=Q0(z);if(Z.json){let Q=m(X),Y={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",source:X,...J};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(`${d0(J.tier)} ${A(`${J.score}%`)}`);return}Y0(J,X,Z.verbose)}import{existsSync as cI}from"fs";import{join as ZJ}from"path";var Z0=[{index:1,path:"project.name",label:"Name",description:"Project name",category:"project"},{index:2,path:"project.goal",label:"Goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",label:"Language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",label:"Who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",label:"What",description:"What are they building",category:"human"},{index:6,path:"human_context.why",label:"Why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",label:"Where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",label:"When",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",label:"Framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",label:"CSS",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",label:"UI Library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",label:"State",description:"State management",category:"frontend"},{index:14,path:"stack.backend",label:"Backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",label:"API",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",label:"Runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",label:"Database",description:"Database",category:"backend"},{index:18,path:"stack.connection",label:"Connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",label:"Hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",label:"Build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",label:"CI/CD",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",label:"Monorepo",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",label:"Package Manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",label:"Workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",label:"Packages",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",label:"Build Orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",label:"Admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",label:"Cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",label:"Search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",label:"Storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",label:"Versioning",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",label:"Shared Configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",label:"Remote Cache",description:"Remote build cache",category:"enterprise_ops"}],O$=new Map(Z0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),iP=new Map(Z0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),nP=new Map(Z0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function F2($,Z){let X=(J)=>{let Q=J.split("."),Y=$;for(let W of Q)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},z=X(Z.path);if(z!==void 0)return z;if(Z.canonical)return X(Z.canonical);return}var rP=Z0.filter(($)=>$.index<=21);var HZ=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);function E0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return HZ.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var N$={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var R1="3.0";import{existsSync as F,readFileSync as t0,readdirSync as TZ}from"fs";import{join as R}from"path";var Lz=[{name:"Next.js",slug:"nextjs",category:"frontend",signals:[{type:"dependency",key:"next"},{type:"file",pattern:"next.config.*"}]},{name:"React",slug:"react",category:"frontend",signals:[{type:"dependency",key:"react"}]},{name:"SvelteKit",slug:"sveltekit",category:"frontend",signals:[{type:"dependency",key:"@sveltejs/kit"},{type:"file",pattern:"svelte.config.*"}]},{name:"Svelte",slug:"svelte",category:"frontend",signals:[{type:"dependency",key:"svelte"},{type:"devDependency",key:"svelte"}]},{name:"Vue.js",slug:"vue",category:"frontend",signals:[{type:"dependency",key:"vue"}]},{name:"Nuxt",slug:"nuxt",category:"frontend",signals:[{type:"dependency",key:"nuxt"},{type:"file",pattern:"nuxt.config.*"}]},{name:"Angular",slug:"angular",category:"frontend",signals:[{type:"dependency",key:"@angular/core"},{type:"file",pattern:"angular.json"}]},{name:"Astro",slug:"astro",category:"frontend",signals:[{type:"dependency",key:"astro"},{type:"file",pattern:"astro.config.*"}]},{name:"Solid",slug:"solid",category:"frontend",signals:[{type:"dependency",key:"solid-js"}]},{name:"Remix",slug:"remix",category:"frontend",signals:[{type:"dependency",key:"@remix-run/react"}]},{name:"Gatsby",slug:"gatsby",category:"frontend",signals:[{type:"dependency",key:"gatsby"},{type:"file",pattern:"gatsby-config.*"}]},{name:"Qwik",slug:"qwik",category:"frontend",signals:[{type:"dependency",key:"@builder.io/qwik"}]},{name:"Vercel (SvelteKit)",slug:"adapter-vercel",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-vercel"},{type:"devDependency",key:"@sveltejs/adapter-vercel"}]},{name:"Node (SvelteKit)",slug:"adapter-node",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-node"},{type:"devDependency",key:"@sveltejs/adapter-node"}]},{name:"Static (SvelteKit)",slug:"adapter-static",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-static"},{type:"devDependency",key:"@sveltejs/adapter-static"}]},{name:"Cloudflare (SvelteKit)",slug:"adapter-cloudflare",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-cloudflare"},{type:"devDependency",key:"@sveltejs/adapter-cloudflare"}]},{name:"Netlify (SvelteKit)",slug:"adapter-netlify",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-netlify"},{type:"devDependency",key:"@sveltejs/adapter-netlify"}]},{name:"Tailwind CSS",slug:"tailwind",category:"css",signals:[{type:"dependency",key:"tailwindcss"},{type:"devDependency",key:"tailwindcss"},{type:"file",pattern:"tailwind.config.*"}]},{name:"Bootstrap",slug:"bootstrap",category:"css",signals:[{type:"dependency",key:"bootstrap"}]},{name:"Styled Components",slug:"styled-components",category:"css",signals:[{type:"dependency",key:"styled-components"}]},{name:"shadcn/ui",slug:"shadcn",category:"ui",signals:[{type:"file",pattern:"components.json"},{type:"dependency",key:"@radix-ui/react-dialog"}]},{name:"Material UI",slug:"mui",category:"ui",signals:[{type:"dependency",key:"@mui/material"}]},{name:"Chakra UI",slug:"chakra",category:"ui",signals:[{type:"dependency",key:"@chakra-ui/react"}]},{name:"Ant Design",slug:"antd",category:"ui",signals:[{type:"dependency",key:"antd"}]},{name:"Redux",slug:"redux",category:"state",signals:[{type:"dependency",key:"@reduxjs/toolkit"}]},{name:"Zustand",slug:"zustand",category:"state",signals:[{type:"dependency",key:"zustand"}]},{name:"Jotai",slug:"jotai",category:"state",signals:[{type:"dependency",key:"jotai"}]},{name:"Pinia",slug:"pinia",category:"state",signals:[{type:"dependency",key:"pinia"}]},{name:"Express",slug:"express",category:"backend",signals:[{type:"dependency",key:"express"}]},{name:"Fastify",slug:"fastify",category:"backend",signals:[{type:"dependency",key:"fastify"}]},{name:"Hono",slug:"hono",category:"backend",signals:[{type:"dependency",key:"hono"}]},{name:"Elysia",slug:"elysia",category:"backend",signals:[{type:"dependency",key:"elysia"}]},{name:"NestJS",slug:"nestjs",category:"backend",signals:[{type:"dependency",key:"@nestjs/core"}]},{name:"Koa",slug:"koa",category:"backend",signals:[{type:"dependency",key:"koa"}]},{name:"Django",slug:"django",category:"backend",signals:[{type:"file",pattern:"manage.py"},{type:"file",pattern:"settings.py"}]},{name:"Flask",slug:"flask",category:"backend",signals:[{type:"content",pattern:"app.py",key:"flask"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"content",pattern:"main.py",key:"fastapi"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"content",pattern:"Gemfile",key:"rails"},{type:"content",pattern:"Gemfile.lock",key:"rails ("},{type:"file",pattern:"config/application.rb"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"content",pattern:"pom.xml",key:"spring-boot"},{type:"content",pattern:"build.gradle",key:"springframework.boot"},{type:"content",pattern:"build.gradle.kts",key:"springframework.boot"},{type:"content",pattern:"gradle/libs.versions.toml",key:"springframework.boot"}]},{name:"Vapor",slug:"vapor",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"vapor/vapor"},{type:"content",pattern:"Package.swift",key:'product(name: "Vapor"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Vapor'"},{type:"file",pattern:"Sources/App/configure.swift"}]},{name:"Hummingbird",slug:"hummingbird",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"hummingbird-project/hummingbird"},{type:"content",pattern:"Package.swift",key:'product(name: "Hummingbird"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Hummingbird'"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK",slug:"mcp",category:"ai",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}];import{existsSync as Dz,readFileSync as bN,readdirSync as kN}from"fs";import{join as BZ}from"path";var L$={version:2,_doc:"SINGLE SOURCE of Dart/Flutter detection KNOWLEDGE (A+B hybrid, the Truth-is-faf-cli spec). faf-cli imports this directly; faf-python-sdk vendors a synced copy (phase 2); MCPs compose it. Bolster Dart/Flutter by editing THIS file. Logic stays in dart.ts. Refreshed 2026-08-01 (knowledge v2) — community receipt on top of 6.13.0 Dart Edition.",flutterDeps:["flutter"],mcpDeps:["dart_mcp","mcp_server","mcp_dart","dart_mcp_server","mcp","dart_mcpserver"],serverFrameworks:[["serverpod","Serverpod"],["dart_frog","Dart Frog"],["conduit","Conduit"],["angel3_framework","Angel3"],["alfred","Alfred"],["shelf","Shelf"],["jaspr","Jaspr"],["relic","Relic"]],stateManagement:[["flutter_riverpod","Riverpod"],["hooks_riverpod","Riverpod"],["riverpod_annotation","Riverpod"],["riverpod","Riverpod"],["flutter_bloc","Bloc"],["bloc","Bloc"],["provider","Provider"],["get","GetX"],["flutter_mobx","MobX"],["mobx","MobX"],["signals","Signals"],["flutter_hooks","Hooks"]],routing:[["go_router","go_router"],["auto_route","auto_route"],["beamer","Beamer"],["routemaster","Routemaster"]]};var yN=L$.flutterDeps,vN=L$.mcpDeps,gN=L$.serverFrameworks,fN=L$.stateManagement,hN=L$.routing;function uN($){let Z=new Set,X=!1;for(let z of $.split(`
210
+ `)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(z)){X=!0;continue}if(/^\S/.test(z))X=!1;if(X){let J=z.match(/^\s{2}([a-zA-Z0-9_]+):/);if(J)Z.add(J[1].toLowerCase())}}return Z}function x8($){let Z=BZ($,"pubspec.yaml");if(!Dz(Z))return null;let X;try{X=bN(Z,"utf-8")}catch{return null}let z=uN(X),J=(S)=>z.has(S.toLowerCase()),Q=yN.some(J)||/^flutter:\s*$/m.test(X)||/\bsdk:\s*flutter\b/.test(X),Y=vN.find(J),W=gN.find(([S])=>J(S)),U=fN.find(([S])=>J(S)),q=U?U[1]:"",G=hN.find(([S])=>J(S)),V=G?G[1]:"",K=J("flutter_test")?"flutter_test":J("test")?"test":"",H=/^executables:\s*$/m.test(X),L=!1;try{L=kN(BZ($,"bin")).some((S)=>S.endsWith(".dart"))}catch{}let B=H||L,O,T="",j;if(Q)if(T="Flutter",Dz(BZ($,"lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(X))O="mobile",j="pubspec.yaml (Flutter app)";else O="library",j="pubspec.yaml (Flutter package)";else if(Y)O="mcp",j=`pubspec.yaml + ${Y} (Dart MCP server)`;else if(W)O="backend",T=W[1],j=`pubspec.yaml + ${W[0]} (Dart backend)`;else if(B)O="cli",j=H?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else O="library",j="pubspec.yaml (Dart package)";return{appType:O,isFlutter:Q,framework:T,stateManagement:q,routing:V,testing:K,found:j}}import{existsSync as MZ,readFileSync as Az,readdirSync as Iz,statSync as cN}from"fs";import{join as k8}from"path";var b8={version:1,_doc:"SINGLE SOURCE of Go detection KNOWLEDGE (A+B hybrid, Truth-is-faf-cli). faf-cli imports this directly; SDKs/MCPs compose it. Bolster Go by editing THIS file. Logic stays in go.ts. Content-aware: go.mod ≠ one bucket — backend · CLI · MCP · library. 2026-08-01 initial (Dart composition pattern).",mcpModules:["github.com/mark3labs/mcp-go","github.com/modelcontextprotocol/go-sdk","github.com/metoro-io/mcp-golang","github.com/ThinkInAIXYZ/go-mcp"],serverFrameworks:[["github.com/gin-gonic/gin","Gin"],["github.com/labstack/echo","Echo"],["github.com/labstack/echo/v4","Echo"],["github.com/gofiber/fiber","Fiber"],["github.com/gofiber/fiber/v2","Fiber"],["github.com/go-chi/chi","Chi"],["github.com/go-chi/chi/v5","Chi"],["github.com/gorilla/mux","Gorilla Mux"],["github.com/gofiber/fiber/v3","Fiber"],["google.golang.org/grpc","gRPC"],["connectrpc.com/connect","Connect"],["github.com/go-kratos/kratos","Kratos"],["github.com/go-kratos/kratos/v2","Kratos"],["github.com/zeromicro/go-zero","go-zero"],["github.com/cloudwego/hertz","Hertz"]],cliFrameworks:[["github.com/spf13/cobra","Cobra"],["github.com/urfave/cli","urfave/cli"],["github.com/urfave/cli/v2","urfave/cli"],["github.com/alecthomas/kingpin","Kingpin"],["github.com/alecthomas/kong","Kong"]]};var lN=b8.mcpModules,dN=b8.serverFrameworks,pN=b8.cliFrameworks;function iN($){let Z=new Set,X=!1;for(let z of $.split(`
211
+ `)){let J=z.replace(/\/\/.*$/,"").trim();if(!J)continue;if(/^require\s*\(\s*$/.test(J)){X=!0;continue}if(X){if(J===")"){X=!1;continue}let Y=J.match(/^(\S+)/);if(Y)Z.add(Y[1].toLowerCase());continue}let Q=J.match(/^require\s+(\S+)/);if(Q&&Q[1]!=="(")Z.add(Q[1].toLowerCase())}return Z}function Rz($,Z){let X=Z.toLowerCase();for(let z of $)if(z===X||z.startsWith(`${X}/`))return!0;return!1}function Tz($,Z){let X;for(let z of Z){if(!Rz($,z[0]))continue;if(!X||z[0].length>X[0].length)X=z}return X}function nN($,Z){let X;for(let z of Z){if(!Rz($,z))continue;if(!X||z.length>X.length)X=z}return X}function rN($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function sN($){let Z=k8($,"cmd");if(!MZ(Z))return!1;try{for(let X of Iz(Z)){let z=k8(Z,X);try{if(cN(z).isDirectory()){if(Iz(z).some((Q)=>Q.endsWith(".go")))return!0}else if(X.endsWith(".go"))return!0}catch{}}}catch{}return!1}function aN($){let Z=k8($,"main.go");if(!MZ(Z))return!1;try{let X=Az(Z,"utf-8");return/^package\s+main\b/m.test(X)}catch{return!1}}function y8($){let Z=k8($,"go.mod");if(!MZ(Z))return null;let X;try{X=Az(Z,"utf-8")}catch{return null}let z=rN(X),J=iN(X),Q=nN(J,lN),Y=Tz(J,dN),W=Tz(J,pN),U=sN($),q=aN($),G,V="",K;if(Q)G="mcp",K=`go.mod + ${Q} (Go MCP server)`;else if(Y)G="backend",V=Y[1],K=`go.mod + ${Y[0]} (Go backend)`;else if(W)G="cli",V=W[1],K=`go.mod + ${W[0]} (Go CLI)`;else if(U)G="cli",K="go.mod + cmd/ (Go CLI layout)";else if(q&&!Y)G="cli",K="go.mod + main.go package main (Go CLI)";else G="library",K="go.mod (Go module)";return{appType:G,modulePath:z,framework:V,found:K}}import{existsSync as tN,readFileSync as eN,readdirSync as $L}from"fs";import{join as ZL}from"path";var c1={version:1,_doc:"SINGLE SOURCE of C# /.NET detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster C# by editing THIS file. Logic stays in csharp.ts. Content-aware: .csproj alone ≠ type — Sdk first, then props/packages. Kill line: .csproj alone ≠ type. 2026-08-01 initial.",mcpPackages:["ModelContextProtocol","ModelContextProtocol.AspNetCore","ModelContextProtocol.Core","ModelContextProtocol.Extensions.Tasks","ModelContextProtocol.Extensions.Apps"],cliPackages:[["System.CommandLine","System.CommandLine"],["Spectre.Console.Cli","Spectre.Console"],["Spectre.Console","Spectre.Console"],["McMaster.Extensions.CommandLineUtils","McMaster"]],testPackages:[["Microsoft.NET.Test.Sdk","VSTest"],["xunit.v3","xUnit"],["xunit","xUnit"],["NUnit","NUnit"],["MSTest.TestFramework","MSTest"],["MSTest","MSTest"]],grpcServerPackages:["Grpc.AspNetCore"],specializedSdks:[["Microsoft.NET.Sdk.Web","web","ASP.NET Core"],["Microsoft.NET.Sdk.Worker","worker","Worker"],["Microsoft.NET.Sdk.BlazorWebAssembly","blazor-wasm","Blazor WebAssembly"],["Microsoft.NET.Sdk.Razor","razor-lib","Razor Class Library"],["MSTest.Sdk","test","MSTest"],["Aspire.AppHost.Sdk","aspire","Aspire AppHost"]],baseSdk:"Microsoft.NET.Sdk"};var XL=c1.mcpPackages.map(($)=>$.toLowerCase()),zL=c1.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),JL=c1.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),QL=c1.grpcServerPackages.map(($)=>$.toLowerCase()),YL=c1.specializedSdks,_z=c1.baseSdk.toLowerCase();function WL($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),X=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),z=(Z?.[1]||X?.[1]||"").trim(),J=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),Q=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||Q||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),q=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),G=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),V=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),K=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());let H=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))H.add(L[1].toLowerCase());return{sdk:z,outputType:J,targetFramework:W,isTestProject:U,useMaui:q,useWpf:G,useWindowsForms:V,packages:K,frameworkRefs:H}}function OZ($,Z){let X=Z.toLowerCase();if($.has(X))return!0;for(let z of $)if(z===X||z.startsWith(`${X}.`))return!0;return!1}function Fz($,Z){let X;for(let[z,J]of Z){if(!OZ($,z))continue;if(!X||z.length>X[0].length)X=[z,J]}return X}function UL($){let Z;for(let X of XL){if(!OZ($,X))continue;if(!Z||X.length>Z.length)Z=X}for(let X of $)if(X==="modelcontextprotocol"||X.startsWith("modelcontextprotocol.")){if(!Z||X.length>Z.length)Z=X}return Z}function qL($){let Z=$.toLowerCase();if(!Z)return;let X;for(let z of YL){let J=z[0].toLowerCase();if(Z===J||Z.startsWith(`${J}/`)){if(!X||J.length>X[0].length)X=z}}return X}function v8($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function GL($,Z){if($==="mcp")return 0;if($==="mobile")return 1;if($==="backend")return 2;if($==="cli")return 3;if(Z&&Z!=="")return 4;return 5}function VL($,Z){let X=Z.replace(/\.csproj$/i,""),{sdk:z,packages:J,frameworkRefs:Q,outputType:Y}=$,W,U="",q,G=UL(J),V=qL(z),K=Fz(J,JL),H=Fz(J,zL),L=QL.some((O)=>OZ(J,O)),B=Q.has("microsoft.aspnetcore.app");if(G)W="mcp",U="MCP",q=`${Z} + ${G} (C# MCP server)`;else if($.isTestProject||V?.[1]==="test"||K)W="library",U=K?.[1]||(V?.[1]==="test"?V[2]:"Test"),q=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",q=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",q=`${Z} + ${U}`;else if(V?.[1]==="web")W="backend",U=L?"gRPC":V[2],q=`${Z} + Sdk=${V[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(V?.[1]==="worker")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Worker)`;else if(V?.[1]==="blazor-wasm")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Blazor WASM)`;else if(V?.[1]==="aspire")W="backend",U=V[2],q=`${Z} + Sdk=${V[0]} (Aspire)`;else if(V?.[1]==="razor-lib")W="library",U=V[2],q=`${Z} + Sdk=${V[0]} (Razor class library)`;else if(B&&v8(Y))W="backend",U="ASP.NET Core",q=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!v8(Y))W="library",U="ASP.NET Core",q=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(H&&(v8(Y)||!Y))W="cli",U=H[1],q=`${Z} + ${H[0]} (C# CLI)`;else if(v8(Y))W="cli",q=`${Z} + OutputType=Exe (C# console)`;else{W="library";let O=z?` Sdk=${z}`:"";if(q=`${Z}${O} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!z||z.toLowerCase()===_z||z.toLowerCase().startsWith(`${_z}/`))q=`${Z} (C# class library)`}return{appType:W,projectName:X,targetFramework:$.targetFramework,sdk:z||"Microsoft.NET.Sdk",framework:U,found:q}}function D$($){if(!tN($))return[];try{return $L($).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}catch{return[]}}function g8($){let Z=D$($);if(Z.length===0)return null;let X=null,z=999;for(let J of Z){let Q=ZL($,J),Y;try{Y=eN(Q,"utf-8")}catch{continue}let W=WL(Y),U=VL(W,J),q=GL(U.appType,U.framework);if(!X||q<z)X=U,z=q}return X}import{existsSync as l1,readFileSync as HL,readdirSync as BL,statSync as ML}from"fs";import{join as v0}from"path";var p0={version:1,_doc:"SINGLE SOURCE of JVM (Java/Kotlin) detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster JVM by editing THIS file. Logic stays in jvm.ts. Kill line: pom / gradle alone ≠ type. Content-aware: plugins · parents · packaging · deps · version catalogs. One brand JVM — Android/KMP are facets, not a second Kotlin Edition. 2026-08-03 initial (post-intel).",mcpArtifacts:["io.modelcontextprotocol.sdk:mcp","io.modelcontextprotocol.sdk:mcp-core","io.modelcontextprotocol.sdk:mcp-spring-webflux","io.modelcontextprotocol.sdk:mcp-spring-webmvc","org.springframework.ai:spring-ai-starter-mcp-server","org.springframework.ai:spring-ai-starter-mcp-server-webmvc","org.springframework.ai:spring-ai-starter-mcp-server-webflux","org.springframework.ai:spring-ai-starter-mcp-client","org.springframework.ai:spring-ai-mcp-server-spring-boot-starter","org.springframework.ai:spring-ai-mcp-client-spring-boot-starter","io.modelcontextprotocol:kotlin-sdk","io.modelcontextprotocol.kotlin:mcp"],webPlugins:[["org.springframework.boot","Spring Boot"],["io.quarkus","Quarkus"],["io.quarkus.gradle.plugin","Quarkus"],["io.micronaut.application","Micronaut"],["io.micronaut.library","Micronaut"]],webParents:[["org.springframework.boot:spring-boot-starter-parent","Spring Boot"],["io.quarkus.platform:quarkus-bom","Quarkus"],["io.micronaut.platform:micronaut-parent","Micronaut"]],webArtifacts:[["org.springframework.boot:spring-boot-starter-web","Spring Boot"],["org.springframework.boot:spring-boot-starter-webflux","Spring Boot"],["org.springframework.boot:spring-boot-starter","Spring Boot"],["io.quarkus:quarkus-core","Quarkus"],["io.micronaut:micronaut-http-server-netty","Micronaut"],["io.ktor:ktor-server-core","Ktor"],["io.ktor:ktor-server-netty","Ktor"],["io.ktor:ktor-server-cio","Ktor"]],androidPlugins:["com.android.application","com.android.library","com.android.kotlin.multiplatform.library"],kmpPlugins:["org.jetbrains.kotlin.multiplatform","kotlin-multiplatform"],jvmKotlinPlugins:["org.jetbrains.kotlin.jvm","kotlin-jvm","org.jetbrains.kotlin.android","kotlin-android"],cliPlugins:[["org.gradle.application","application"],["application","application"]],cliArtifacts:[["info.picocli:picocli","Picocli"],["com.github.ajalt.clikt:clikt","Clikt"],["com.github.ajalt.clikt:clikt-jvm","Clikt"]],libraryPlugins:["java-library","org.gradle.java-library"]};var OL=p0.mcpArtifacts.map(($)=>$.toLowerCase()),NL=p0.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),LL=p0.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),DL=p0.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),NE=p0.androidPlugins.map(($)=>$.toLowerCase()),IL=p0.kmpPlugins.map(($)=>$.toLowerCase()),TL=p0.jvmKotlinPlugins.map(($)=>$.toLowerCase()),AL=p0.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),RL=p0.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),_L=p0.libraryPlugins.map(($)=>$.toLowerCase()),FL=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function NZ($){return FL.some((Z)=>l1(v0($,Z)))}function P2($){try{return HL($,"utf-8")}catch{return null}}function CL($){let Z=new Map,X=new Map,z="";for(let J of $.split(`
212
+ `)){let Q=J.replace(/#.*$/,"").trim();if(!Q)continue;let Y=Q.match(/^\[([^\]]+)\]$/);if(Y){z=Y[1].trim().toLowerCase();continue}let W=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(W&&(z==="plugins"||z.endsWith(".plugins"))){Z.set(W[1].replace(/-/g,".").toLowerCase(),W[2].toLowerCase()),Z.set(W[1].toLowerCase(),W[2].toLowerCase());continue}let U=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(U&&(z==="libraries"||z.endsWith(".libraries"))){let V=U[1].toLowerCase();X.set(V,U[2].toLowerCase()),X.set(V.replace(/-/g,"."),U[2].toLowerCase());continue}let q=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(q&&(z==="libraries"||z.endsWith(".libraries"))){let V=`${q[2]}:${q[3]}`.toLowerCase(),K=q[1].toLowerCase();X.set(K,V),X.set(K.replace(/-/g,"."),V);continue}let G=Q.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(G){let V=G[1].toLowerCase(),K=G[2];if(z==="plugins"||z.endsWith(".plugins")){let H=K.split(":")[0].toLowerCase();Z.set(V,H),Z.set(V.replace(/-/g,"."),H)}else if(z==="libraries"||z.endsWith(".libraries")){let H=K.split(":");if(H.length>=2){let L=`${H[0]}:${H[1]}`.toLowerCase();X.set(V,L),X.set(V.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:X}}function PL($){let Z=v0($,"gradle","libs.versions.toml");if(!l1(Z))return{plugins:new Map,libraries:new Map};let X=P2(Z);if(!X)return{plugins:new Map,libraries:new Map};return CL(X)}function EL($){let Z=[];for(let X of $.matchAll(/include\s*\(\s*([^)]+)\)/g))for(let z of X[1].split(",")){let J=z.replace(/['":\s]/g,"").replace(/^:/,"");if(J)Z.push(J.replace(/:/g,"/"))}for(let X of $.matchAll(/include\s+((?:['"][^'"]+['"]\s*,?\s*)+)/g))for(let z of X[1].split(",")){let J=z.replace(/['":\s]/g,"").replace(/^:/,"");if(J)Z.push(J.replace(/:/g,"/"))}for(let X of $.matchAll(/project\s*\(\s*["']:([^"']+)["']\s*\)\s*\.projectDir\s*=\s*file\s*\(\s*["']([^"']+)["']\s*\)/g))Z.push(X[2].replace(/^\.\//,""));return[...new Set(Z)]}function wL($,Z){let X=new Set;for(let z of $.matchAll(/\bid\s*\(\s*["']([^"']+)["']\s*\)/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/\bid\s+['"]([^'"]+)['"]/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/plugins\s*\{([\s\S]*?)\}/g))for(let J of z[1].split(/[\n;]/)){let Q=J.replace(/\/\/.*$/,"").trim();if(!Q||Q.startsWith("id")||Q.startsWith("kotlin")||Q.startsWith("alias"))continue;let Y=Q.match(/^`([a-zA-Z0-9.-]+)`$/)||Q.match(/^([a-zA-Z][a-zA-Z0-9.-]*)$/);if(Y)X.add(Y[1].toLowerCase())}for(let z of $.matchAll(/\bkotlin\s*\(\s*["']([^"']+)["']\s*\)/g)){let J=z[1].toLowerCase();if(J==="jvm")X.add("org.jetbrains.kotlin.jvm");else if(J==="multiplatform")X.add("org.jetbrains.kotlin.multiplatform");else if(J==="android")X.add("org.jetbrains.kotlin.android");else X.add(`org.jetbrains.kotlin.${J}`)}for(let z of $.matchAll(/libs\.plugins\.([A-Za-z0-9_.]+)/g)){let J=z[1].toLowerCase(),Q=Z.plugins.get(J)||Z.plugins.get(J.replace(/\./g,"-"))||Z.plugins.get(J.replace(/-/g,"."));if(Q)X.add(Q);else if(J.includes("spring")&&J.includes("boot"))X.add("org.springframework.boot")}for(let z of $.matchAll(/apply\s+plugin\s*:\s*['"]([^'"]+)['"]/g))X.add(z[1].toLowerCase());return X}function SL($,Z){let X=new Set;for(let z of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))X.add(z[1].toLowerCase());for(let z of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let J=z[1].toLowerCase();if(J.startsWith("plugins."))continue;let Q=[J,J.replace(/\./g,"-"),J.replace(/-/g,".")];for(let Y of Q){let W=Z.libraries.get(Y);if(W){X.add(W.includes(":")?W.split(":").slice(0,2).join(":"):W);break}}}return X}function Ez($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),X=new Set,z=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(z){let Y=z[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=z[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)X.add(`${Y}:${W}`.toLowerCase())}let J=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let W=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),U=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(W&&U)J.add(`${W}:${U}`.toLowerCase())}let Q=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))Q.push(Y[1].trim());return{packaging:Z,parents:X,artifacts:J,modules:Q}}function z1($,Z){let X=Z.toLowerCase();if($.has(X))return!0;for(let z of $)if(z===X||z.endsWith(`.${X}`)||z===X.replace(/^org\.gradle\./,""))return!0;return!1}function C2($,Z,X){let z;for(let[J,Q]of Z){let Y=!1;if(X==="plugin")Y=z1($,J);else if(Y=$.has(J)||[...$].some((W)=>W===J||W.startsWith(`${J}:`)||W.startsWith(`${J}.`)),!Y&&X==="artifact")Y=[...$].some((W)=>W===J||W.startsWith(`${J}`));if(!Y)continue;if(!z||J.length>z[0].length)z=[J,Q]}return z}function jL($){let Z;for(let X of OL)for(let z of $){if(z===X||z.startsWith(`${X}:`)||z.startsWith(X.replace(/:mcp$/,":"))){if(!Z||X.length>Z.length)Z=X}if(z.startsWith("io.modelcontextprotocol")||z.includes("spring-ai-starter-mcp")||z.includes("spring-ai-mcp")){if(!Z||z.length>Z.length)Z=z}}return Z}function wz($){let Z=new Set,X=!1,z=!1,J=[v0($,"src"),v0($,"src","main")],Q=(Y,W)=>{if(W>4||!l1(Y))return;let U;try{U=BL(Y)}catch{return}for(let q of U){if(q==="androidMain"||q==="commonMain"||q==="jvmMain"||q==="iosMain")Z.add(q);let G=v0(Y,q);try{if(ML(G).isDirectory())Q(G,W+1);else if(q.endsWith(".kt")||q.endsWith(".kts"))X=!0;else if(q.endsWith(".java"))z=!0}catch{}}};for(let Y of J)Q(Y,0);return{kotlin:X,java:z,hints:Z}}function xL($){let Z=[],X=$.plugins,z=$.artifacts,J=IL.some((b)=>z1(X,b))||$.sourceHints.has("commonMain"),Q=z1(X,"com.android.application"),Y=z1(X,"com.android.library")||z1(X,"com.android.kotlin.multiplatform.library");if(Q||Y)Z.push("android");if(J)Z.push("multiplatform");let W=jL(z),U=C2(X,NL,"plugin"),q=C2($.parents,LL,"parent"),G=C2(z,DL,"artifact"),V=C2(X,AL,"plugin"),K=C2(z,RL,"artifact"),H=_L.some((b)=>z1(X,b)),L=$.packaging==="pom",B,O="",T;if(Q)B="mobile",O=J?"Android+KMP":"Android",T=`${$.path||"root"} + com.android.application (${O})`;else if(W)B="mcp",O="MCP",Z.push("mcp"),T=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||q||G){B="backend",O=U?.[1]||q?.[1]||G?.[1]||"JVM";let b=U?.[0]||q?.[0]||G?.[0]||"web";T=`${$.path||"root"} + ${b} (JVM backend)`}else if(J&&!Y)B="library",O="Kotlin Multiplatform",T=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",O=J?"Android+KMP":"Android",T=`${$.path||"root"} + android library (${O})`;else if(K||$.hasApplicationPlugin&&($.hasMainClass||V)||V&&$.hasMainClass)B="cli",O=K?.[1]||"application",T=K?`${$.path||"root"} + ${K[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!H)B="cli",O="application",T=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",T=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let b=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(T=`${$.path||"root"} (${b} library)`,H)T=`${$.path||"root"} + java-library (JVM library)`}let j="Java";if($.kotlinSources&&$.javaSources)j="Java/Kotlin";else if($.kotlinSources||TL.some((b)=>z1(X,b))||J)j="Kotlin";let S=[...new Set(Z)];return{appType:B,framework:O,facets:S,found:T,buildTool:$.buildTool,mainLanguage:j}}function bL($,Z){if($==="mcp")return 0;if($==="mobile")return 1;if(Z.includes("multiplatform")&&$==="backend")return 2;if($==="backend")return 3;if($==="cli")return 4;if(Z.includes("multiplatform"))return 5;if(Z.includes("android"))return 6;return 7}function Cz($,Z,X){let z=Z?v0($,Z):$,J=v0(z,"build.gradle.kts"),Q=v0(z,"build.gradle"),Y=l1(J)?J:l1(Q)?Q:null;if(!Y)return null;let W=P2(Y);if(!W)return null;let U=wL(W,X),q=SL(W,X),G=wz(z),V=/mainClass\s*[.=]/.test(W)||/mainClassName\s*=/.test(W)||/Main-Class/.test(W),K=z1(U,"application")||z1(U,"org.gradle.application");return{path:Z||"build.gradle",plugins:U,artifacts:q,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:K,sourceHints:G.hints,kotlinSources:G.kotlin||Y.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function Pz($,Z){let X=Z?v0($,Z):$,z=v0(X,"pom.xml");if(!l1(z))return null;let J=P2(z);if(!J)return null;let{packaging:Q,parents:Y,artifacts:W}=Ez(J),U=wz(X);return{path:Z?`${Z}/pom.xml`:"pom.xml",plugins:new Set,artifacts:W,packaging:Q,parents:Y,hasMainClass:/<mainClass>/.test(J),hasApplicationPlugin:!1,sourceHints:U.hints,kotlinSources:U.kotlin,javaSources:U.java,buildTool:"maven"}}function E2($){if(!NZ($))return null;let Z=PL($),X=[],z=null;for(let q of["settings.gradle.kts","settings.gradle"]){let G=v0($,q);if(l1(G)){z=P2(G);break}}let J=z?EL(z):[],Q=Cz($,"",Z);if(Q)X.push(Q);for(let q of J){let G=Cz($,q,Z);if(G)X.push(G)}let Y=Pz($,"");if(Y){X.push(Y);let q=P2(v0($,"pom.xml"));if(q){let{modules:G}=Ez(q);for(let V of G){let K=Pz($,V);if(K)X.push(K)}}}if(X.length===0&&z)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(X.length===0)return null;let W=null,U=999;for(let q of X){let G=xL(q),V=bL(G.appType,G.facets);if(!W||V<U)W={appType:G.appType,framework:G.framework,buildTool:G.buildTool,mainLanguage:G.mainLanguage,facets:G.facets,found:G.found},U=V}if(W&&J.length>0&&!W.found.includes("multi-project"));return W}import{existsSync as j2,readFileSync as yL,readdirSync as f8,statSync as vL}from"fs";import{join as i0}from"path";var w2={version:1,_doc:"SINGLE SOURCE of Ruby detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Kill line: Gemfile alone ≠ Rails. Content-aware: gem names + light layout. 2026-08-03 initial (post-intel ruby-edition).",mcpGems:["mcp","fast-mcp","fast_mcp","rails-mcp-server","rails_mcp_server","ruby-mcp-client","ruby_mcp_client","ruby_llm-mcp","ruby_llm_mcp"],webGems:[["rails","Rails"],["railties","Rails"],["sinatra","Sinatra"],["sinatra-contrib","Sinatra"],["roda","Roda"],["grape","Grape"],["hanami","Hanami"],["hanami-controller","Hanami"],["rack","Rack"]],cliGems:[["thor","Thor"],["gli","GLI"],["commander","Commander"],["slop","Slop"]],railsLayoutFiles:["config/application.rb","config/routes.rb","bin/rails","config/environment.rb"]};var gL=w2.mcpGems.map(($)=>$.toLowerCase()),fL=w2.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),Sz=w2.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),hL=w2.railsLayoutFiles;function uL($){return j2(i0($,"Gemfile"))||j2(i0($,"gems.rb"))||mL($)}function mL($){try{return f8($).some((Z)=>Z.endsWith(".gemspec"))}catch{return!1}}function S2($){try{return yL($,"utf-8")}catch{return null}}function cL($){let Z=new Set;for(let X of $.split(`
213
+ `)){let z=X.replace(/#.*$/,"").trim();if(!z)continue;let J=z.match(/^\s*gem\s+['"]([^'"]+)['"]/i)||z.match(/^\s*gem\s+:([A-Za-z0-9_.-]+)/i);if(J)Z.add(J[1].toLowerCase())}return Z}function lL($){let Z=new Set,X=!1;for(let z of $.split(`
214
+ `)){let J=z.replace(/\r$/,"");if(/^\s*specs:\s*$/.test(J)){X=!0;continue}if(X){if(/^[A-Z]/.test(J)||J.startsWith("PLATFORMS")||J.startsWith("DEPENDENCIES")||J.startsWith("BUNDLED")||J.startsWith("RUBY VERSION")||J.startsWith("CHECKSUMS")){X=!1;continue}let Q=J.match(/^\s{2,}([a-zA-Z0-9_.-]+)\s*\(/);if(Q)Z.add(Q[1].toLowerCase())}}return Z}function dL($){let Z=new Set;for(let X of $.split(`
215
+ `)){let J=X.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(J)Z.add(J[1].toLowerCase())}return Z}function pL($){let Z=new Set,X=[];for(let J of["Gemfile","gems.rb"]){let Q=i0($,J),Y=S2(Q);if(Y){for(let W of cL(Y))Z.add(W);X.push(J)}}let z=S2(i0($,"Gemfile.lock"))||S2(i0($,"gems.locked"));if(z){for(let J of lL(z))Z.add(J);X.push("Gemfile.lock")}try{for(let J of f8($)){if(!J.endsWith(".gemspec"))continue;let Q=S2(i0($,J));if(Q){for(let Y of dL(Q))Z.add(Y);X.push(J)}}}catch{}return{gems:Z,sources:X}}function x2($,Z){let X=Z.toLowerCase();if($.has(X))return!0;return!1}function LZ($,Z){let X;for(let[z,J]of Z){if(!x2($,z))continue;if(!X||z.length>X[0].length)X=[z,J]}return X}function iL($){let Z;for(let X of gL)if(x2($,X)&&(!Z||X.length>Z.length))Z=X;return Z}function jz($){for(let Z of hL)if(j2(i0($,Z)))return Z;return}function nL($,Z){let X=LZ(Z,Sz);if(X)return{hit:!0,why:X[0]};try{for(let J of f8($)){if(!J.endsWith(".gemspec"))continue;let Q=S2(i0($,J));if(Q&&/executables\s*=/.test(Q)&&!/executables\s*=\s*\[\s*\]/.test(Q))return{hit:!0,why:`${J} executables`}}}catch{}let z=i0($,"bin");if(j2(z))try{let Q=f8(z).filter((Y)=>{if(Y==="setup"||Y==="console"||Y==="rake")return!1;try{return vL(i0(z,Y)).isFile()}catch{return!1}}).filter((Y)=>Y!=="rails");if(Q.length>0&&!x2(Z,"rails")&&!jz($))return{hit:!0,why:`bin/${Q[0]}`}}catch{}return{hit:!1,why:""}}function h8($){if(!uL($))return null;let{gems:Z,sources:X}=pL($),z=X[0]||"Gemfile",J=X.some((O)=>O==="Gemfile"||O==="gems.rb"||O.includes("lock"))?"bundler":"rubygems",Q=iL(Z),Y=LZ(Z,fL),W=jz($),U=x2(Z,"rails")||x2(Z,"railties"),q=nL($,Z),G=j2(i0($,"config.ru")),V=U||!!W,K=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!G)?Y:void 0,H,L="",B;if(Q)H="mcp",L="MCP",B=`${z} + gem ${Q} (Ruby MCP)`;else if(V)if(H="backend",L="Rails",U&&W)B=`${z} + rails + ${W} (Rails)`;else if(U)B=`${z} + gem rails (Rails)`;else B=`${W} (Rails layout)`;else if(K)H="backend",L=K[1],B=`${z} + gem ${K[0]} (Ruby backend)`;else if(q.hit)H="cli",L=LZ(Z,Sz)?.[1]||"",B=`${z} + ${q.why} (Ruby CLI)`;else H="library",B=`${z} (Ruby library)`;return{appType:H,framework:L,packageManager:J,found:B}}import{existsSync as DZ,readFileSync as sL,readdirSync as aL,statSync as oL}from"fs";import{join as b2}from"path";var o0={version:1,_doc:"SINGLE SOURCE of Swift detection KNOWLEDGE (Truth-is-faf-cli). Kill line: Package.swift alone ≠ app. Static parse of products + package URLs + product names + light xcodeproj productType. Never execute Package.swift / swift build. 2026-08-03 post-intel swift-edition.",mcpPackageUrls:["modelcontextprotocol/swift-sdk","github.com/modelcontextprotocol/swift-sdk"],mcpProducts:["MCP"],serverPackageUrls:[["vapor/vapor","Vapor"],["github.com/vapor/vapor","Vapor"],["hummingbird-project/hummingbird","Hummingbird"],["github.com/hummingbird-project/hummingbird","Hummingbird"]],serverProducts:[["Vapor","Vapor"],["Hummingbird","Hummingbird"]],cliPackageUrls:[["apple/swift-argument-parser","ArgumentParser"],["github.com/apple/swift-argument-parser","ArgumentParser"]],cliProducts:[["ArgumentParser","ArgumentParser"]],appProductTypes:["com.apple.product-type.application"],cliProductTypes:["com.apple.product-type.tool"],vaporLayoutFiles:["Sources/App/configure.swift","Sources/App/routes.swift","Sources/App/entrypoint.swift"]};var tL=o0.mcpPackageUrls.map(($)=>$.toLowerCase()),eL=o0.mcpProducts.map(($)=>$.toLowerCase()),$D=o0.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),ZD=o0.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),XD=o0.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),zD=o0.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),JD=o0.appProductTypes,QD=o0.cliProductTypes,YD=o0.vaporLayoutFiles;function WD($){return DZ(b2($,"Package.swift"))||IZ($).length>0}function IZ($){try{return aL($).filter((Z)=>{if(!Z.endsWith(".xcodeproj"))return!1;try{return oL(b2($,Z)).isDirectory()}catch{return!1}})}catch{return[]}}function kz($){try{return sL($,"utf-8")}catch{return null}}function UD($){let Z=qD($),X=Z.toLowerCase(),z=[],J=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,Q;while((Q=J.exec(Z))!==null)z.push(Q[1]);let Y=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((Q=Y.exec(Z))!==null)z.push(Q[1]);let W=[],U=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((Q=U.exec(Z))!==null)W.push(Q[1]);let q=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((Q=q.exec(Z))!==null)W.push(Q[1]);let G=/\.library\s*\(/.test(X),V=/\.executable\s*\(/.test(X),K=/\.plugin\s*\(/.test(X)&&!G&&!V?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(X),H=/\.executabletarget\s*\(/.test(X),L=/\.target\s*\(/.test(X)&&!H?!0:(X.match(/\.target\s*\(/g)||[]).length>(X.match(/\.executabletarget\s*\(/g)||[]).length+(X.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:z,productNames:W,hasLibraryProduct:G,hasExecutableProduct:V,hasPluginProduct:!!K,hasExecutableTarget:H,hasLibraryTarget:L}}function qD($){let Z="",X=0;while(X<$.length){if($[X]==='"'||$[X]==="'"){let z=$[X];Z+=z,X++;while(X<$.length){if($[X]==="\\"&&X+1<$.length){Z+=$[X]+$[X+1],X+=2;continue}if(Z+=$[X],$[X]===z){X++;break}X++}continue}if($[X]==="/"&&$[X+1]==="/"){X+=2;while(X<$.length&&$[X]!==`
216
+ `)X++;continue}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<$.length&&!($[X]==="*"&&$[X+1]==="/"))X++;X+=2;continue}Z+=$[X],X++}return Z}function GD($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let J of Z)for(let Q of X)if(Q.includes(J)&&(!z||J.length>z.length))z=J;return z}function xz($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let[J,Q]of Z)for(let Y of X)if(Y.includes(J)&&(!z||J.length>z[0].length))z=[J,Q];return z}function bz($,Z){let X=$.map((J)=>J.toLowerCase()),z;for(let[J,Q]of Z)if(X.includes(J)&&(!z||J.length>z[0].length))z=[J,Q];return z}function VD($){let Z=$.map((X)=>X.toLowerCase());return eL.some((X)=>Z.includes(X))}function KD($){let Z=!1,X=!1,z;for(let J of IZ($)){let Q=b2($,J,"project.pbxproj"),Y=kz(Q);if(!Y)continue;for(let W of JD)if(Y.includes(W))Z=!0,z=W;for(let W of QD)if(Y.includes(W)){if(X=!0,!z)z=W}}return{hasApplication:Z,hasTool:X,hit:z}}function HD($){for(let Z of YD)if(DZ(b2($,Z)))return Z;return}function k2($){if(!WD($))return null;let Z=b2($,"Package.swift"),X=DZ(Z),z=IZ($),J=z.length>0,Q=null;if(X){let n=kz(Z);if(n)Q=UD(n)}let Y=J?KD($):{hasApplication:!1,hasTool:!1},W=HD($),U=Q?.packageUrls??[],q=Q?.productNames??[],G=GD(U,tL),V=VD(q),K=xz(U,$D),H=bz(q,ZD),L=xz(U,XD),B=bz(q,zD),O=!!(G||V),T=!!(K||H||W),j=!!(Q?.hasExecutableProduct||Q?.hasExecutableTarget),S=!!(L||B),b=Y.hasApplication,y=X&&J?"spm+xcode":X?"spm":"xcode",x,c="",_;if(O)if(x="mcp",c="MCP",V)_="Package.swift + product MCP (Swift MCP)";else _=`Package.swift + ${G} (Swift MCP)`;else if(T)if(x="backend",c=H?.[1]||K?.[1]||(W?"Vapor":""),H)_=`Package.swift + product ${H[1]} (Swift backend)`;else if(K)_=`Package.swift + ${K[1]} (Swift backend)`;else _=`${W} (Swift backend layout)`;else if(b)x="app",c="",_=`${z[0]} + ${Y.hit||"application"} (Swift app)`;else if(S||j&&!T&&!O)if(x="cli",c=B?.[1]||L?.[1]||"",B)_=`Package.swift + product ${B[1]} (Swift CLI)`;else if(L)_=`Package.swift + ${L[1]} (Swift CLI)`;else if(Q?.hasExecutableProduct)_="Package.swift + .executable product (Swift CLI)";else _="Package.swift + .executableTarget (Swift CLI)";else if(Y.hasTool&&!X)x="cli",_=`${z[0]} + tool productType (Swift CLI)`;else if(X)if(x="library",Q?.hasLibraryProduct)_="Package.swift + .library product (Swift library)";else _="Package.swift (Swift library)";else x="library",_=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:x,framework:c,packageManager:y,found:_}}function BD($){let Z=R($,"Cargo.toml");if(!F(Z))return null;try{let z=t0(Z,"utf-8").match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}catch{return null}}function MD($){let Z=R($,"Cargo.toml");if(!F(Z))return!1;try{let X=t0(Z,"utf-8");return/^\s*\[\[bin\]\]/m.test(X)}catch{return!1}}function OD($,Z){if(Z?.keywords?.some((z)=>/^sdk(?:\s|-|$)|-sdk$/i.test(z)))return'package.json keywords contains "sdk"';if(Z?.name&&/(?:^|[-_/])sdk(?:[-_/]|$)/i.test(Z.name))return`package.json name "${Z.name}" → sdk`;let X=BD($);if(X&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(X))return`Cargo.toml name "${X}" → sdk`;return null}function ND($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let X of Z){let z=R($,X);if(!F(z))continue;try{let J=JSON.parse(t0(z,"utf-8"));if(typeof J.manifest_version==="number")return`${X} manifest_version ${J.manifest_version} (browser extension)`}catch{}}return null}function LD($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,X=R($,"pyproject.toml");if(F(X))try{let Q=t0(X,"utf-8").match(Z);if(Q)return`pyproject.toml depends on ${Q[1]}`}catch{}let z=R($,"requirements.txt");if(F(z))try{let Q=t0(z,"utf-8").match(Z);if(Q)return`requirements.txt contains ${Q[1]}`}catch{}return null}function DD($,Z){let X=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let z of X)if(Z.dependencies?.[z]||Z.devDependencies?.[z])return`${z} dependency`}if(F(R($,"ios"))&&F(R($,"android")))return"ios/ + android/ dirs";return null}function ID($,Z){let X=R($,"Cargo.toml");if(F(X))try{let J=t0(X,"utf-8");if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(J))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(J))return"Cargo.toml wasm-bindgen/wasm-pack"}catch{}let z=R($,"build.zig");if(F(z))try{let J=t0(z,"utf-8");if(/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(J))return"build.zig wasm target"}catch{}if(Z?.keywords?.some((J)=>/^wasm(?:-|$)|webassembly/i.test(J)))return'package.json keywords contains "wasm"';return null}function TD($,Z){if(!F(R($,"index.html")))return null;if(Z?.dependencies||Z?.devDependencies){let X={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((J)=>X[J]))return null}return"index.html (vanilla, no frontend framework)"}function AD($,Z){if(Z?.name&&/specification|^@.*\/spec/i.test(Z.name))return`package name "${Z.name}" → documentation`;if(Z?.keywords?.some((X)=>/^(specification|format-spec|standard)$/i.test(X)))return'package keywords contains "specification"';if(Z?.bin)return null;if(Z?.files&&Z.files.length>0){let X=/^(dist|src|lib|build|bin)(\/|$)|\/(dist|src|lib|build|bin)(\/|$)|(\.|\/)(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,z=Z.files.some((Q)=>X.test(Q)),J=Z.files.some((Q)=>/\.(md|MD)$|examples?\//.test(Q)||Q==="README.md"||Q==="docs"||Q==="docs/");if(!z&&J)return"package.json files = docs/examples only (no source)"}return null}function RD($,Z,X){let z=X.find((J)=>J.slug==="astro"||J.slug==="gatsby");if(z)return`${z.name} (static-site framework)`;if(Z?.keywords?.some((J)=>/^(website|marketing|landing|brochure|portfolio)$/i.test(J)))return'package keywords contains "website"/"marketing"/"landing"';return null}function _D($,Z){if(!Z)return null;let X={...Z.dependencies??{},...Z.devDependencies??{}},z=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],J=["stripe","@stripe/stripe-js","lemonsqueezy"],Q=z.some((W)=>X[W]),Y=J.some((W)=>X[W]);if(Q&&Y)return"auth + payment dependencies";return null}function FD($,Z,X){if(Z?.keywords?.some((Q)=>/mcpaas/i.test(Q)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let z=X.some((Q)=>Q.slug==="mcp"),J=X.some((Q)=>Q.category==="database");if(z&&J&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function CD($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||F(R($,"pnpm-workspace.yaml"))))return null;return"private workspace + multi-package"}var PD=new Set(["node_modules","dist","build","out","vendor","target","coverage","docs","doc","e2e","tests","test","__tests__","scripts","deploy","bin","public","examples","example","fixtures","assets","static","migrations","config","contracts","proto","protos"]),yz=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,ED=new Set(["frontend","backend","database","css","ui","state"]);function wD($){if(F(R($,"pyproject.toml"))||F(R($,"manage.py"))||F(R($,"setup.py"))||u8($,"requirements*.txt"))return!0;if(F(R($,"go.mod")))return!0;if(F(R($,"Cargo.toml")))return!0;if(F(R($,"Gemfile")))return!0;if(F(R($,"pom.xml"))||u8($,"build.gradle*"))return!0;if(D$($).length>0)return!0;let Z=_1($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function m8($){let Z;try{Z=TZ($,{withFileTypes:!0})}catch{return[]}let X=[];for(let z of Z){if(!z.isDirectory()||z.name.startsWith(".")||PD.has(z.name))continue;let J=R($,z.name);if(!wD(J))continue;let Q=l8(J);if(Q==="Unknown")continue;let Y=c8(J).filter((G)=>ED.has(G.category)),W=Y.find((G)=>G.category==="frontend"),U=Y.find((G)=>G.category==="backend"),q=W??U??Y[0]??null;X.push({name:z.name,language:Q,topFramework:q?.name??null,frontend:!!W,backend:!!U||yz.test(Q),hasFramework:!!q,appRoot:F(R(J,"manage.py"))||F(R(J,"config.ru"))||F(R(J,"bin/rails"))||F(R(J,"artisan"))})}return X}function SD($,Z){if(Z?.workspaces||F(R($,"pnpm-workspace.yaml")))return null;let X=m8($),z=new Set(X.map((J)=>J.language));if(X.length<2||z.size<2)return null;if(!X.some((J)=>J.frontend)||!X.some((J)=>J.backend))return null;return`polyglot: ${X.map((J)=>`${J.name}/ (${J.language})`).join(", ")}`}function vz($){let Z=m8($);if(Z.length<2)return null;let X=(Y)=>(Y.appRoot?2:0)+(yz.test(Y.language)?2:0)+(Y.hasFramework?1:0)+(Y.frontend?0.5:0),z=[...Z].sort((Y,W)=>X(W)-X(Y)),J=new Set,Q=[];for(let Y of z){if(J.has(Y.language))continue;J.add(Y.language);let W=Y.frontend?"frontend":Y.backend?"backend":"service";Q.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${W})`:`${Y.language} (${W})`)}return Q.join("; ")}function _1($){let Z=R($,"package.json");if(!F(Z))return null;try{return JSON.parse(t0(Z,"utf-8"))}catch{return null}}function u8($,Z){if(!Z.includes("*"))return F(R($,Z));let X=Z.split("/");if(X.length===1){let W=Z.split("*")[0];try{return TZ($).some((U)=>U.startsWith(W))}catch{return!1}}let z=R($,...X.slice(0,-1)),J=X[X.length-1],Q=J.split("*")[0],Y=J.split("*")[1]||"";try{return TZ(z).some((W)=>W.startsWith(Q)&&W.endsWith(Y))}catch{return!1}}function jD($,Z,X){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return u8(X,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!u8(X,$.pattern))return!1;try{let z=R(X,$.pattern);if(!F(z))return!1;return t0(z,"utf-8").toLowerCase().includes($.key.toLowerCase())}catch{return!1}}default:return!1}}function c8($){let Z=_1($);return Lz.map((X)=>{let J=X.signals.filter((Q)=>jD(Q,Z,$)).length/X.signals.length;return{name:X.name,slug:X.slug,category:X.category,confidence:J}}).filter((X)=>X.confidence>0).sort((X,z)=>z.confidence-X.confidence)}function l8($){let Z=_1($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(F(R($,"tsconfig.json")))return"TypeScript";if(F(R($,"Cargo.toml")))return"Rust";if(F(R($,"go.mod")))return"Go";if(D$($).length>0)return"C#";if(F(R($,"pyproject.toml"))||F(R($,"setup.py")))return"Python";if(F(R($,"Gemfile")))return"Ruby";if(NZ($)){let X=E2($);if(X)return X.mainLanguage==="Java/Kotlin"?"Kotlin":X.mainLanguage;return"Java"}if(F(R($,"Package.swift")))return"Swift";if(F(R($,"build.zig")))return"Zig";if(F(R($,"pubspec.yaml")))return"Dart";if(Z)return"JavaScript";return"Unknown"}function gz($){let Z=_1($),X=c8($),z=[],J=AD($,Z);if(J)return z.push(J),{type:"documentation",found:z};let Q=OD($,Z);if(Q)return z.push(Q),{type:"sdk",found:z};let Y=ND($);if(Y)return z.push(Y),{type:"extension",found:z};let W=FD($,Z,X);if(W)return z.push(W),{type:"mcpaas",found:z};let U=_D($,Z);if(U)return z.push(U),{type:"saas",found:z};let q=ID($,Z);if(q)return z.push(q),{type:"wasm",found:z};let G=x8($);if(G)return z.push(G.found),{type:G.appType,found:z};let V=y8($);if(V)return z.push(V.found),{type:V.appType,found:z};let K=g8($);if(K)return z.push(K.found),{type:K.appType,found:z};let H=E2($);if(H)return z.push(H.found),{type:H.appType,found:z};let L=h8($);if(L)return z.push(L.found),{type:L.appType,found:z};let B=k2($);if(B)return z.push(B.found),{type:B.appType,found:z};let O=DD($,Z);if(O)return z.push(O),{type:"mobile",found:z};if(X.some((r)=>r.slug==="mcp"))return z.push("MCP SDK signal"),{type:"mcp",found:z};if(Z?.bin)return z.push("package.json bin"),{type:"cli",found:z};if(MD($))return z.push("Cargo.toml [[bin]]"),{type:"cli",found:z};if(F(R($,"build.zig"))){if(z.push("build.zig"),F(R($,"src/main.zig")))return z.push("src/main.zig"),{type:"cli",found:z};if(F(R($,"src/root.zig")))return z.push("src/root.zig"),{type:"library",found:z}}let j=X.some((r)=>r.slug==="svelte"||r.slug==="sveltekit");if(Z?.private===!0&&(F(R($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&j)return z.push("private workspace","Svelte"),{type:"framework",found:z};if(j)return z.push("Svelte/SvelteKit"),{type:"svelte",found:z};let b=X.some((r)=>r.category==="frontend"),y=X.some((r)=>r.category==="backend");if(Z?.private&&(Z.workspaces||F(R($,"pnpm-workspace.yaml")))&&b&&y)return z.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:z};let x=CD($,Z);if(x)return z.push(x),{type:"monorepo-root",found:z};let c=RD($,Z,X);if(c)return z.push(c),{type:"website",found:z};if(X.some((r)=>r.slug==="nextjs"||r.slug==="nuxt"))return z.push(X.find((r)=>r.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:z};let n=X.some((r)=>r.category==="frontend"),p=X.some((r)=>r.category==="backend");if(n&&p)return z.push("frontend framework","backend framework"),{type:"fullstack",found:z};if(n)return z.push("frontend framework"),{type:"frontend",found:z};if(p)return z.push("backend framework"),{type:"backend",found:z};let A0=LD($);if(A0)return z.push(A0),{type:"data-science",found:z};let P=TD($,Z);if(P)return z.push(P),{type:"html",found:z};let d=SD($,Z);if(d)return z.push(d),{type:"fullstack",found:z};if(Z?.main&&!Z?.bin)return z.push("package.json main (no bin)"),{type:"library",found:z};return z.push("no classifying signals — fallback"),{type:"library",found:z}}function fz($){if(F(R($,"bunfig.toml")))return"Bun";if(F(R($,"deno.json"))||F(R($,"deno.jsonc")))return"Deno";if(_1($))return"Node.js";if(F(R($,"Cargo.toml")))return"Rust";if(F(R($,"go.mod")))return"Go";if(D$($).length>0)return".NET";if(F(R($,"pubspec.yaml")))return"Dart";return"Unknown"}function hz($){if(F(R($,"pubspec.yaml")))return"pub";if(F(R($,"go.mod")))return"go modules";if(D$($).length>0)return"NuGet";if(F(R($,"pom.xml")))return"maven";if(F(R($,"build.gradle"))||F(R($,"build.gradle.kts"))||F(R($,"settings.gradle"))||F(R($,"settings.gradle.kts")))return"gradle";if(F(R($,"bun.lockb"))||F(R($,"bun.lock")))return"bun";if(F(R($,"pnpm-lock.yaml")))return"pnpm";if(F(R($,"yarn.lock")))return"yarn";if(F(R($,"package-lock.json")))return"npm";return"npm"}function uz($){if(F(R($,".github/workflows")))return"GitHub Actions";if(F(R($,".gitlab-ci.yml")))return"GitLab CI";if(F(R($,".circleci")))return"CircleCI";if(F(R($,"Jenkinsfile")))return"Jenkins";return null}function mz($){if(F(R($,"vercel.json")))return"Vercel";if(F(R($,"netlify.toml")))return"Netlify";if(F(R($,"wrangler.toml")))return"Cloudflare";if(F(R($,"Dockerfile")))return"Docker";if(F(R($,"fly.toml")))return"Fly.io";if(F(R($,"render.yaml")))return"Render";return null}function cz($){let Z=R($,"svelte.config.js");if(!F(Z))return null;try{let z=t0(Z,"utf-8").match(/@sveltejs\/adapter-(\w+)/);if(z){let J=z[1];switch(J){case"vercel":return"Vercel";case"node":return"Node";case"static":return"Static";case"cloudflare":return"Cloudflare";case"netlify":return"Netlify";case"auto":return"Auto";default:return J}}return null}catch{return null}}function lz($){let Z=_1($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return"Vite";if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(F(R($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function d8($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((X)=>F(R($,X)))}function p8($,Z){let X={};if(Z?.scripts){for(let z of["build","test","lint","dev","start"])if(Z.scripts[z]){let J=F(R($,"bun.lock"))||F(R($,"bun.lockb"))?"bun run":"npm run";X[z]=`${J} ${z}`}}if(F(R($,"Cargo.toml"))){if(!X.build)X.build="cargo build --release";if(!X.test)X.test="cargo test";if(!X.lint)X.lint="cargo clippy"}if(F(R($,"build.zig"))){if(!X.build)X.build="zig build";if(!X.test)X.test="zig build test"}if(F(R($,"go.mod"))){if(!X.build)X.build="go build ./...";if(!X.test)X.test="go test ./..."}if(F(R($,"pyproject.toml"))||F(R($,"pytest.ini"))){if(!X.test)X.test="pytest"}return X}function dz($,Z,X,z){let J=[];if(z&&z!=="Unknown")J.push(z);let Q=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of X)if(Q.has(Y.category))J.push(Y.name);if(F(R($,"bunfig.toml")))J.push("Bun");else if(F(R($,"deno.json"))||F(R($,"deno.jsonc")))J.push("Deno");if(J.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!J.some((U)=>U.toLowerCase().includes(W.toLowerCase())))J.push(W)}return J}function AZ($){let Z=_1($),X=c8($),z=gz($),J=z.type,Q=z.found.some((s)=>s.startsWith("polyglot:")),Y=Q&&vz($)||l8($),W=fz($),U=hz($),q=uz($),G=mz($),V=lz($),K=X.find((s)=>s.category==="frontend"),H=X.find((s)=>s.category==="css"),L=X.find((s)=>s.category==="ui"),B=X.find((s)=>s.category==="state"),O=X.find((s)=>s.category==="backend"),T=X.find((s)=>s.category==="database"),j=N$[J]||N$.library,S=J==="framework",b=X.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),y=S&&b?"svelte":S?null:null,x=J==="svelte"||y==="svelte",c=x?cz($):null,_=x&&X.some((s)=>s.slug==="sveltekit"),n=new Set(["css_framework","ui_library","database","connection","hosting"]),p={},A0=Z0.filter((s)=>s.path.startsWith("stack."));for(let s of A0){let t=s.path.replace("stack.","");if(!j.includes(s.category)){p[t]="slotignored";continue}if(S&&n.has(t)){p[t]="slotignored";continue}switch(t){case"frontend":p[t]=K?.name??(J==="cli"?"CLI":"");break;case"css_framework":p[t]=H?.name??"";break;case"ui_library":p[t]=L?.name??"";break;case"state_management":p[t]=x?B?.name??"Runes":B?.name??"";break;case"backend":p[t]=x?_?"SvelteKit":O?.name??"":O?.name??"";break;case"api_type":p[t]=_?"Server Routes":"";break;case"runtime":p[t]=W!=="Unknown"?W:"";break;case"database":p[t]=T?.name??"";break;case"connection":p[t]=T?.name??"";break;case"hosting":if(x&&c)p[t]=c;else p[t]=G??"";break;case"build":p[t]=x?"Vite":V??"";break;case"cicd":p[t]=q??"";break;case"package_manager":p[t]=U;break;default:p[t]="";break}}let P={},d=Z0.filter((s)=>s.path.startsWith("monorepo."));for(let s of d){let t=s.path.replace("monorepo.","");if(!j.includes(s.category))P[t]="slotignored";else P[t]=""}let r={name:Z?.name??$.split("/").pop()??"project",goal:Q?"":Z?.description??"",main_language:Y,type:J};if(S&&y)r.framework=y;let m0=dz($,Z,X,Q?l8($):Y);if(Q){for(let s of m8($))for(let t of[s.language,s.topFramework])if(t&&!m0.includes(t))m0.push(t)}let P9=d8($),E9=p8($,Z),g6={faf_version:R1,project:r,stack:p,human_context:{who:"",what:Q?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:P,_meta:{found:z.found}};if(m0.length>0)g6.tech_stack=m0;if(P9.length>0)g6.key_files=P9;if(Object.keys(E9).length>0)g6.commands=E9;return g6}import{existsSync as bD,readFileSync as kD}from"fs";import{join as yD}from"path";var pz={MIN_LENGTH:8,MAX_LENGTH:280},xD=[/^(see|see\s+the?)\s+readme/i,/^(tbd|todo|fixme|coming\s+soon)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+users|for\s+developers)\.?$/i,/^(description|goal|name|title)\.?$/i,/^lorem\s+ipsum/i,/^example(\s+\w+)?\.?$/i];function n0($){let Z=$.trim();if(Z.length<pz.MIN_LENGTH)return!1;if(Z.length>pz.MAX_LENGTH)return!1;if(xD.some((X)=>X.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
217
+ `).length>4)return!1;return!0}function vD($){let Z=$.split(`
218
218
  `),X=0;while(X<Z.length&&/^(#\s|$)/.test(Z[X].trim()))X++;while(X<Z.length){let z=Z[X].trim();if(/^\[!\[/.test(z)){X++;continue}if(/^!\[/.test(z)){X++;continue}if(/^<img\s/i.test(z)){X++;continue}if(z===""){X++;continue}break}return Z.slice(X).join(`
219
- `)}function PD($){let X=ED($).split(`
219
+ `)}function gD($){let X=vD($).split(`
220
220
  `),z=[];for(let J of X){let Q=J.trim();if(Q===""){if(z.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(Q))break;if(/^\*\*[^*]+\*\*\s*$/.test(Q)&&z.length===0)continue;z.push(Q)}if(z.length===0)return null;return z.join(" ").trim()}function d1($,Z){let X=$.split(`
221
- `),z=0;while(z<X.length){let Q=X[z].trim().match(/^(#{1,6})\s+(.+)$/);if(Q&&Z.test(Q[2])){let Y=Q[1].length,W=[];z++;while(z<X.length){let U=X[z].trim(),q=U.match(/^(#{1,6})\s+/);if(q&&q[1].length<=Y)break;if(U===""){if(W.length>0)break;z++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),z++}if(W.length===0)return null;return W.join(" ").trim()}z++}return null}function wD($){let Z=d1($,/^(use\s+cases?|goal)\b/i);if(Z&&n0(Z))return Z;let X=PD($);if(X&&n0(X))return X;return}function SD($){let Z=d1($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&n0(Z))return Z;return}function jD($){let Z=d1($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&n0(Z))return Z;return}function xD($){let Z=d1($,/^(why|motivation|problem|rationale)\b/i);if(Z&&n0(Z))return Z;return}function bD($){let Z=d1($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&n0(Z))return Z;return}function kD($){let Z=d1($,/^(status|history|timeline|since|launched)\b/i);if(Z&&n0(Z))return Z;return}function yD($){let Z=d1($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&n0(Z))return Z;return}function FZ($){let Z=["README.md","README.MD","Readme.md","readme.md"],X=null;for(let H of Z){let L=CD($,H);if(_D(L)){X=L;break}}if(!X)return{};let z;try{z=FD(X,"utf-8")}catch{return{}}z=z.replace(/<!--[\s\S]*?-->/g,"");let J={},Q=wD(z);if(Q)J.project={goal:Q};let Y={},W=SD(z);if(W)Y.what=W;let U=jD(z);if(U)Y.who=U;let q=xD(z);if(q)Y.why=q;let G=bD(z);if(G)Y.where=G;let V=kD(z);if(V)Y.when=V;let K=yD(z);if(K)Y.how=K;if(Object.keys(Y).length>0)J.human_context=Y;return J}import{existsSync as vD,readFileSync as gD}from"fs";import{join as fD}from"path";function hD($,Z){let X=$.split(`
222
- `),z=!1;for(let J of X){let Q=J.trim();if(/^\[/.test(Q)){z=Q==="[package]";continue}if(!z)continue;let Y=Q.match(new RegExp(`^${Z}\\s*=\\s*(.+)$`));if(Y){let W=Y[1].trim();W=W.replace(/\s*#.*$/,"").trim();let U=W.match(/^"((?:[^"\\]|\\.)*)"$/)||W.match(/^'((?:[^'\\]|\\.)*)'$/);if(U)return U[1];return W}}return null}function CZ($){let Z=fD($,"Cargo.toml");if(!vD(Z))return{};let X;try{X=gD(Z,"utf-8")}catch{return{}}let z=hD(X,"description");if(z&&n0(z))return{project:{goal:z}};return{}}import{readFileSync as uD,readdirSync as mD}from"fs";import{join as iz}from"path";var cD=[{re:/^postgres|postgis|pgvector/,slot:"database",label:"PostgreSQL"},{re:/^mysql/,slot:"database",label:"MySQL"},{re:/^mariadb/,slot:"database",label:"MariaDB"},{re:/^mongo/,slot:"database",label:"MongoDB"},{re:/clickhouse/,slot:"database",label:"ClickHouse"},{re:/^cockroach/,slot:"database",label:"CockroachDB"},{re:/^redis|^valkey/,slot:"cache",label:"Redis"},{re:/^memcached/,slot:"cache",label:"Memcached"},{re:/elasticsearch/,slot:"search",label:"Elasticsearch"},{re:/opensearch/,slot:"search",label:"OpenSearch"},{re:/meilisearch/,slot:"search",label:"Meilisearch"},{re:/typesense/,slot:"search",label:"Typesense"},{re:/qdrant/,slot:"search",label:"Qdrant (vector)"},{re:/weaviate/,slot:"search",label:"Weaviate (vector)"},{re:/^minio/,slot:"storage",label:"MinIO (S3-compatible)"},{re:/localstack/,slot:"storage",label:"LocalStack (AWS)"},{re:/rabbitmq/,slot:"runtime",label:"RabbitMQ"},{re:/kafka/,slot:"runtime",label:"Kafka"},{re:/nats/,slot:"runtime",label:"NATS"},{re:/temporalio\/|temporal-server|temporal:/,slot:"runtime",label:"Temporal"}],lD=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function dD($){let Z=[],X=(z,J)=>{let Q;try{Q=mD(z,{withFileTypes:!0})}catch{return}for(let Y of Q)if(Y.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(Y.name))Z.push(iz(z,Y.name));else if(Y.isDirectory()&&J>0&&!Y.name.startsWith(".")&&!lD.has(Y.name))X(iz(z,Y.name),J-1)};return X($,1),Z}function y2($){return[...$].join(" · ")}function EZ($){let Z=dD($);if(Z.length===0)return{};let X={database:new Set,cache:new Set,search:new Set,storage:new Set,runtime:new Set};for(let J of Z){let Q;try{Q=uD(J,"utf-8")}catch{continue}for(let Y of Q.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let W=Y[1].toLowerCase(),U=W.replace(/:[^/]*$/,"").split("/").pop()??W,q=W.replace(/:[^/]*$/,"");for(let{re:G,slot:V,label:K}of cD)if(G.test(U)||G.test(q))X[V].add(K)}}let z={};if(X.database.size)z.database=y2(X.database);if(X.cache.size)z.cache=y2(X.cache);if(X.search.size)z.search=y2(X.search);if(X.storage.size)z.storage=y2(X.storage);if(X.runtime.size)z.runtime=`Docker Compose (${y2(X.runtime)})`;if(Object.keys(z).length===0&&!X.runtime.size)return{stack:{hosting:"Docker Compose"}};return z.hosting="Docker Compose",{stack:z}}import{existsSync as n8,readFileSync as pD,readdirSync as iD}from"fs";import{join as v2}from"path";var nD=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),rD=[{file:"Makefile",runner:"make",targets:($)=>[...$.matchAll(/^([a-zA-Z][\w-]*)\s*:(?!=)/gm)].map((Z)=>Z[1])},{file:"justfile",runner:"just",targets:($)=>[...$.matchAll(/^([a-zA-Z][\w-]*)\s*(?:\([^)]*\))?\s*:/gm)].map((Z)=>Z[1])},{file:"Taskfile.yml",runner:"task",targets:($)=>{let Z=$.indexOf("tasks:");if(Z===-1)return[];return[...$.slice(Z).matchAll(/^\s{2}([a-zA-Z][\w-]*):/gm)].map((X)=>X[1])}}];function PZ($,Z){for(let X of Z){let z=$.find((J)=>X.test(J));if(z)return z}return null}function sD($){let Z=[$];try{for(let X of iD($,{withFileTypes:!0}))if(X.isDirectory()&&!X.name.startsWith(".")&&!nD.has(X.name))Z.push(v2($,X.name))}catch{}return Z}function aD($){let Z=0;if(n8(v2($,"manage.py"))||n8(v2($,"pyproject.toml"))||n8(v2($,"Gemfile")))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function wZ($){let Z=[];for(let z of sD($)){let J=z===$,Q=J?"":`cd ${z.slice($.length+1)} && `;for(let Y of rD){let W=v2(z,Y.file);if(!n8(W))continue;let U;try{U=pD(W,"utf-8")}catch{continue}let q=Y.targets(U);if(q.length===0)continue;let G={},V=PZ(q,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),K=PZ(q,[/^build$/i,/^compile$/i,/^build/i]),H=PZ(q,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(V)G.test=`${Q}${Y.runner} ${V}`;if(K)G.build=`${Q}${Y.runner} ${K}`;if(H)G.lint=`${Q}${Y.runner} ${H}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(J?10:aD(z)),commands:G})}}let X=Z.sort((z,J)=>J.score-z.score)[0];return X?{commands:X.commands}:{}}import{existsSync as oD}from"fs";import{join as tD}from"path";var eD=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function SZ($){for(let Z of eD)if(oD(tD($,Z)))return{security:{secrets:".env",example:Z}};return{}}function $I($,Z){let X={project:{...Z.project??{},...$.project??{}},human_context:{...Z.human_context??{},...$.human_context??{}},stack:{...Z.stack??{},...$.stack??{}},commands:{...Z.commands??{},...$.commands??{}},security:{...Z.security??{},...$.security??{}}};for(let z of["project","human_context","stack","commands","security"])if(X[z]&&Object.keys(X[z]).length===0)delete X[z];return X}function r8($){return[FZ($),CZ($),EZ($),wZ($),SZ($)].reduce($I,{})}import{existsSync as ZI,readdirSync as nz,readFileSync as XI}from"fs";import{join as xZ,dirname as zI,extname as JI,resolve as QI}from"path";var jZ={"package.json":{frameworks:["Node.js","JavaScript","TypeScript"],slots:{packageManager:"npm/yarn/pnpm",mainLanguage:"JavaScript/TypeScript"},priority:35,intelligence:"ultra-high"},"README.md":{frameworks:[],slots:{targetUser:"developers",coreProblem:"understanding project",missionPurpose:"project documentation"},priority:25,intelligence:"high"},"requirements.txt":{frameworks:["Python"],slots:{packageManager:"pip",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},Pipfile:{frameworks:["Python"],slots:{packageManager:"pipenv",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},"pyproject.toml":{frameworks:["Python"],slots:{mainLanguage:"Python",runtime:"Python",backend:"Python"},priority:36,intelligence:"ultra-high"},Gemfile:{frameworks:["Ruby"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:35,intelligence:"ultra-high"},"Gemfile.lock":{frameworks:["Ruby"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:34,intelligence:"high"},"composer.json":{frameworks:["PHP","Laravel","Symfony"],slots:{packageManager:"composer",mainLanguage:"PHP"},priority:35,intelligence:"ultra-high"},"Cargo.toml":{frameworks:["Rust"],slots:{packageManager:"cargo",mainLanguage:"Rust",buildTool:"cargo"},priority:36,intelligence:"ultra-high"},"go.mod":{frameworks:["Go"],slots:{packageManager:"go modules",mainLanguage:"Go",buildTool:"go build"},priority:36,intelligence:"ultra-high"},"Package.swift":{frameworks:["Swift"],slots:{packageManager:"spm",mainLanguage:"Swift",buildTool:"swift build"},priority:36,intelligence:"ultra-high"},"*.csproj":{frameworks:["C#",".NET"],slots:{packageManager:"NuGet",mainLanguage:"C#",buildTool:"dotnet"},priority:36,intelligence:"ultra-high"},"pubspec.yaml":{frameworks:["Dart"],slots:{packageManager:"pub",mainLanguage:"Dart"},priority:35,intelligence:"ultra-high"},"pom.xml":{frameworks:["Java"],slots:{packageManager:"maven",mainLanguage:"Java",buildTool:"maven"},priority:35,intelligence:"ultra-high"},"build.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"settings.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:34,intelligence:"high"},"settings.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:34,intelligence:"high"},"next.config.js":{frameworks:["Next.js"],slots:{framework:"Next.js",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.mjs":{frameworks:["Next.js"],slots:{framework:"Next.js",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.ts":{frameworks:["Next.js 13+"],slots:{framework:"Next.js 13+",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.js":{frameworks:["Nuxt 2"],slots:{framework:"Nuxt 2",runtime:"Node.js",buildTool:"Nuxt",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.ts":{frameworks:["Nuxt 3"],slots:{framework:"Nuxt 3",runtime:"Node.js",buildTool:"Nuxt",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"svelte.config.js":{frameworks:["SvelteKit"],slots:{framework:"SvelteKit",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"angular.json":{frameworks:["Angular"],slots:{framework:"Angular",buildTool:"Angular CLI",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manifest.json":{frameworks:["Chrome Extension","Browser Extension"],slots:{framework:"Chrome Extension",runtime:"Chrome/Browser",mainLanguage:"JavaScript",hosting:"Chrome Web Store",apiType:"Chrome APIs"},priority:35,intelligence:"ultra-high",confirmWith:["popup.html","background.js","content.js"]},"vue.config.js":{frameworks:["Vue"],slots:{framework:"Vue",buildTool:"Vue CLI",mainLanguage:"JavaScript"},priority:30,intelligence:"high"},"remix.config.js":{frameworks:["Remix"],slots:{framework:"Remix",runtime:"Node.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.js":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.ts":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"astro.config.mjs":{frameworks:["Astro"],slots:{framework:"Astro",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"redwood.toml":{frameworks:["RedwoodJS"],slots:{framework:"RedwoodJS",buildTool:"Webpack",mainLanguage:"JavaScript/TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"blitz.config.ts":{frameworks:["Blitz.js"],slots:{framework:"Blitz.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"qwik.config.ts":{frameworks:["Qwik"],slots:{framework:"Qwik",buildTool:"Vite",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manage.py":{frameworks:["Django"],slots:{framework:"Django",backend:"Django",mainLanguage:"Python",server:"Django",apiType:"Django Views"},priority:30,intelligence:"high"},artisan:{frameworks:["Laravel"],slots:{framework:"Laravel",backend:"Laravel",mainLanguage:"PHP",server:"PHP",apiType:"Laravel Routes"},priority:30,intelligence:"high"},"mix.exs":{frameworks:["Phoenix","Elixir"],slots:{framework:"Phoenix",backend:"Phoenix",mainLanguage:"Elixir",server:"BEAM"},priority:30,intelligence:"high"},"nest-cli.json":{frameworks:["NestJS"],slots:{framework:"NestJS",backend:"NestJS",mainLanguage:"TypeScript",server:"Node.js",apiType:"REST API"},priority:30,intelligence:"high"},"strapi.config.js":{frameworks:["Strapi"],slots:{backend:"Strapi",apiType:"REST API",database:"Required",server:"Node.js"},priority:30,intelligence:"high"},Dockerfile:{frameworks:["Docker"],slots:{hosting:"Docker",connection:"Containerized"},priority:30,intelligence:"high"},"docker-compose.yml":{frameworks:["Docker Compose"],slots:{hosting:"Docker",connection:"Multi-container"},priority:30,intelligence:"high"},"docker-compose.yaml":{frameworks:["Docker Compose"],slots:{hosting:"Docker",connection:"Multi-container"},priority:30,intelligence:"high"},"kubernetes.yml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes",connection:"Orchestrated"},priority:30,intelligence:"high"},"k8s.yaml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes",connection:"Orchestrated"},priority:30,intelligence:"high"},"vercel.json":{frameworks:["Vercel"],slots:{hosting:"Vercel",cicd:"Vercel"},priority:30,intelligence:"high"},"netlify.toml":{frameworks:["Netlify"],slots:{hosting:"Netlify",cicd:"Netlify"},priority:30,intelligence:"high"},"render.yaml":{frameworks:["Render"],slots:{hosting:"Render",cicd:"Render"},priority:30,intelligence:"high"},"fly.toml":{frameworks:["Fly.io"],slots:{hosting:"Fly.io",cicd:"Fly.io"},priority:30,intelligence:"high"},"railway.json":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"railway.toml":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"app.yaml":{frameworks:["Google App Engine"],slots:{hosting:"Google Cloud",cicd:"Google Cloud"},priority:30,intelligence:"high"},Procfile:{frameworks:["Heroku"],slots:{hosting:"Heroku",cicd:"Heroku"},priority:30,intelligence:"high"},"vite.config.js":{frameworks:["Vite"],slots:{buildTool:"Vite"},priority:25,intelligence:"medium"},"vite.config.ts":{frameworks:["Vite"],slots:{buildTool:"Vite",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"webpack.config.js":{frameworks:["Webpack"],slots:{buildTool:"Webpack"},priority:25,intelligence:"medium"},"rollup.config.js":{frameworks:["Rollup"],slots:{buildTool:"Rollup"},priority:25,intelligence:"medium"},"esbuild.config.js":{frameworks:["esbuild"],slots:{buildTool:"esbuild"},priority:25,intelligence:"medium"},"parcel.config.js":{frameworks:["Parcel"],slots:{buildTool:"Parcel"},priority:25,intelligence:"medium"},"snowpack.config.js":{frameworks:["Snowpack"],slots:{buildTool:"Snowpack"},priority:25,intelligence:"medium"},"tsconfig.json":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"jsconfig.json":{frameworks:["JavaScript"],slots:{mainLanguage:"JavaScript"},priority:20,intelligence:"medium"},"babel.config.js":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},".babelrc":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},"jest.config.js":{frameworks:["Jest"],slots:{cicd:"Jest"},priority:25,intelligence:"medium"},"jest.config.ts":{frameworks:["Jest"],slots:{cicd:"Jest",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"vitest.config.ts":{frameworks:["Vitest"],slots:{cicd:"Vitest",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"cypress.config.js":{frameworks:["Cypress"],slots:{cicd:"Cypress"},priority:25,intelligence:"medium"},"playwright.config.ts":{frameworks:["Playwright"],slots:{cicd:"Playwright",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"karma.conf.js":{frameworks:["Karma"],slots:{cicd:"Karma"},priority:20,intelligence:"medium"},"mocha.opts":{frameworks:["Mocha"],slots:{cicd:"Mocha"},priority:20,intelligence:"medium"},".rspec":{frameworks:["RSpec"],slots:{cicd:"RSpec",mainLanguage:"Ruby"},priority:25,intelligence:"medium"},"pytest.ini":{frameworks:["Pytest"],slots:{cicd:"Pytest",mainLanguage:"Python"},priority:25,intelligence:"medium"},"phpunit.xml":{frameworks:["PHPUnit"],slots:{cicd:"PHPUnit",mainLanguage:"PHP"},priority:25,intelligence:"medium"},"schema.prisma":{frameworks:["Prisma"],slots:{database:"Prisma ORM",connection:"Prisma"},priority:25,intelligence:"medium"},"drizzle.config.ts":{frameworks:["Drizzle"],slots:{database:"Drizzle ORM",connection:"Drizzle",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ormconfig.js":{frameworks:["TypeORM"],slots:{database:"TypeORM",connection:"TypeORM"},priority:25,intelligence:"medium"},"knexfile.js":{frameworks:["Knex.js"],slots:{database:"Knex.js",connection:"Knex.js"},priority:25,intelligence:"medium"},"sequelize.config.js":{frameworks:["Sequelize"],slots:{database:"Sequelize",connection:"Sequelize"},priority:25,intelligence:"medium"},"alembic.ini":{frameworks:["Alembic"],slots:{database:"Alembic",mainLanguage:"Python"},priority:25,intelligence:"medium"},".github/workflows":{frameworks:["GitHub Actions"],slots:{cicd:"GitHub Actions"},priority:25,intelligence:"medium"},".gitlab-ci.yml":{frameworks:["GitLab CI"],slots:{cicd:"GitLab CI"},priority:25,intelligence:"medium"},Jenkinsfile:{frameworks:["Jenkins"],slots:{cicd:"Jenkins"},priority:25,intelligence:"medium"},".circleci/config.yml":{frameworks:["CircleCI"],slots:{cicd:"CircleCI"},priority:25,intelligence:"medium"},".travis.yml":{frameworks:["Travis CI"],slots:{cicd:"Travis CI"},priority:25,intelligence:"medium"},"azure-pipelines.yml":{frameworks:["Azure DevOps"],slots:{cicd:"Azure DevOps"},priority:25,intelligence:"medium"},"bitbucket-pipelines.yml":{frameworks:["Bitbucket Pipelines"],slots:{cicd:"Bitbucket Pipelines"},priority:25,intelligence:"medium"},"tailwind.config.js":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS"},priority:20,intelligence:"medium"},"tailwind.config.ts":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"postcss.config.js":{frameworks:["PostCSS"],slots:{cssFramework:"PostCSS"},priority:20,intelligence:"medium"},"uno.config.ts":{frameworks:["UnoCSS"],slots:{cssFramework:"UnoCSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"styled-components.config.js":{frameworks:["styled-components"],slots:{cssFramework:"styled-components",uiLibrary:"styled-components"},priority:20,intelligence:"medium"},"emotion.config.js":{frameworks:["Emotion"],slots:{cssFramework:"Emotion",uiLibrary:"Emotion"},priority:20,intelligence:"medium"},"metro.config.js":{frameworks:["React Native"],slots:{framework:"React Native",mainLanguage:"JavaScript"},priority:25,intelligence:"medium"},"expo.config.js":{frameworks:["Expo"],slots:{framework:"React Native",buildTool:"Expo"},priority:25,intelligence:"medium"},"app.json":{frameworks:["React Native","Expo"],slots:{framework:"React Native"},priority:20,intelligence:"medium",confirmWith:["expo"]},"capacitor.config.ts":{frameworks:["Capacitor"],slots:{framework:"Capacitor",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ionic.config.json":{frameworks:["Ionic"],slots:{framework:"Ionic",uiLibrary:"Ionic"},priority:25,intelligence:"medium"},"nx.json":{frameworks:["Nx"],slots:{buildTool:"Nx"},priority:25,intelligence:"medium"},"turbo.json":{frameworks:["Turborepo"],slots:{buildTool:"Turborepo"},priority:25,intelligence:"medium"},"lerna.json":{frameworks:["Lerna"],slots:{buildTool:"Lerna"},priority:25,intelligence:"medium"},"rush.json":{frameworks:["Rush"],slots:{buildTool:"Rush"},priority:25,intelligence:"medium"},"pnpm-workspace.yaml":{frameworks:["pnpm workspaces"],slots:{packageManager:"pnpm",buildTool:"pnpm workspaces"},priority:25,intelligence:"medium"},"*.svelte":{frameworks:["Svelte","SvelteKit"],slots:{framework:"Svelte"},priority:15,intelligence:"low"},"*.vue":{frameworks:["Vue"],slots:{framework:"Vue"},priority:15,intelligence:"low"},"*.jsx":{frameworks:["React"],slots:{framework:"React",mainLanguage:"JavaScript"},priority:15,intelligence:"low"},"*.ts":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.tsx":{frameworks:["React","TypeScript"],slots:{framework:"React",mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.py":{frameworks:["Python"],slots:{mainLanguage:"Python"},priority:15,intelligence:"low"},"*.rb":{frameworks:["Ruby"],slots:{mainLanguage:"Ruby"},priority:15,intelligence:"low"},"*.php":{frameworks:["PHP"],slots:{mainLanguage:"PHP"},priority:15,intelligence:"low"},"*.java":{frameworks:["Java"],slots:{mainLanguage:"Java"},priority:15,intelligence:"low"},"*.kt":{frameworks:["Kotlin"],slots:{mainLanguage:"Kotlin"},priority:15,intelligence:"low"},"*.swift":{frameworks:["Swift"],slots:{mainLanguage:"Swift"},priority:15,intelligence:"low"},"*.go":{frameworks:["Go"],slots:{mainLanguage:"Go"},priority:15,intelligence:"low"},"*.rs":{frameworks:["Rust"],slots:{mainLanguage:"Rust"},priority:15,intelligence:"low"},"*.dart":{frameworks:["Flutter","Dart"],slots:{mainLanguage:"Dart"},priority:15,intelligence:"low"},"*.ex":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.exs":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.scala":{frameworks:["Scala"],slots:{mainLanguage:"Scala"},priority:15,intelligence:"low"},"*.clj":{frameworks:["Clojure"],slots:{mainLanguage:"Clojure"},priority:15,intelligence:"low"},"*.lua":{frameworks:["Lua"],slots:{mainLanguage:"Lua"},priority:15,intelligence:"low"},"*.r":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.R":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.jl":{frameworks:["Julia"],slots:{mainLanguage:"Julia"},priority:15,intelligence:"low"},"*.nim":{frameworks:["Nim"],slots:{mainLanguage:"Nim"},priority:15,intelligence:"low"},"*.zig":{frameworks:["Zig"],slots:{mainLanguage:"Zig"},priority:15,intelligence:"low"},"build.zig":{frameworks:["Zig"],slots:{packageManager:"Zig Package Manager",mainLanguage:"Zig",buildTool:"zig build",framework:"Zig",build:"zig build"},priority:35,intelligence:"ultra-high"},"openapi.json":{frameworks:["OpenAPI"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"openapi.yaml":{frameworks:["OpenAPI"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"swagger.json":{frameworks:["Swagger"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"graphql.schema":{frameworks:["GraphQL"],slots:{apiType:"GraphQL",backend:"GraphQL Server"},priority:30,intelligence:"high"},"schema.graphql":{frameworks:["GraphQL"],slots:{apiType:"GraphQL",backend:"GraphQL Server"},priority:30,intelligence:"high"},".graphqlconfig":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:25,intelligence:"medium"},"redux.config.js":{frameworks:["Redux"],slots:{stateManagement:"Redux"},priority:20,intelligence:"medium"},"mobx.config.js":{frameworks:["MobX"],slots:{stateManagement:"MobX"},priority:20,intelligence:"medium"},"vuex.config.js":{frameworks:["Vuex"],slots:{stateManagement:"Vuex",framework:"Vue"},priority:20,intelligence:"medium"},"pinia.config.js":{frameworks:["Pinia"],slots:{stateManagement:"Pinia",framework:"Vue"},priority:20,intelligence:"medium"},"zustand.config.js":{frameworks:["Zustand"],slots:{stateManagement:"Zustand"},priority:20,intelligence:"medium"},".eslintrc.js":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".eslintrc.json":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".prettierrc":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},".prettierrc.json":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},"biome.json":{frameworks:["Biome"],slots:{},priority:15,intelligence:"low"},".editorconfig":{frameworks:["EditorConfig"],slots:{},priority:10,intelligence:"low"},"serverless.yml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"serverless.yaml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"sam.yaml":{frameworks:["AWS SAM"],slots:{hosting:"AWS Lambda",backend:"AWS SAM",cicd:"AWS SAM CLI"},priority:30,intelligence:"high"},"template.yaml":{frameworks:["AWS SAM","CloudFormation"],slots:{hosting:"AWS",backend:"AWS SAM/CloudFormation",cicd:"AWS"},priority:25,intelligence:"medium",confirmWith:["samconfig.toml"]},"amplify.yml":{frameworks:["AWS Amplify"],slots:{hosting:"AWS Amplify",backend:"AWS Amplify",cicd:"AWS Amplify"},priority:30,intelligence:"high"},Podfile:{frameworks:["CocoaPods","Swift"],slots:{packageManager:"CocoaPods",mainLanguage:"Swift/Objective-C"},priority:30,intelligence:"high"},"build.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"*.ipynb":{frameworks:["Jupyter","Python"],slots:{mainLanguage:"Python",framework:"Jupyter Notebook"},priority:30,intelligence:"high"},MLproject:{frameworks:["MLflow"],slots:{mainLanguage:"Python",framework:"MLflow",backend:"MLflow",cicd:"MLflow"},priority:30,intelligence:"high"},"dvc.yaml":{frameworks:["DVC","Data Version Control"],slots:{mainLanguage:"Python",framework:"DVC",cicd:"DVC Pipelines"},priority:30,intelligence:"high"},"dvc.lock":{frameworks:["DVC"],slots:{framework:"DVC"},priority:20,intelligence:"medium"},"wrangler.toml":{frameworks:["Cloudflare Workers","Cloudflare"],slots:{hosting:"Cloudflare Workers",backend:"Cloudflare Workers",runtime:"V8 Isolates"},priority:30,intelligence:"high"},"deno.json":{frameworks:["Deno"],slots:{runtime:"Deno",mainLanguage:"TypeScript",packageManager:"Deno"},priority:30,intelligence:"high"},"bun.lockb":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",mainLanguage:"TypeScript/JavaScript"},priority:30,intelligence:"high"},"codecov.yml":{frameworks:["Codecov"],slots:{cicd:"Codecov"},priority:25,intelligence:"high"},"dependabot.yml":{frameworks:["Dependabot","GitHub"],slots:{cicd:"Dependabot"},priority:25,intelligence:"high"},"renovate.json":{frameworks:["Renovate"],slots:{cicd:"Renovate"},priority:25,intelligence:"high"},Makefile:{frameworks:["Make","GNU Make"],slots:{buildTool:"Make"},priority:30,intelligence:"high"},"CMakeLists.txt":{frameworks:["CMake","C","C++"],slots:{buildTool:"CMake",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"meson.build":{frameworks:["Meson","C","C++"],slots:{buildTool:"Meson",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"*.c":{frameworks:["C"],slots:{mainLanguage:"C"},priority:30,intelligence:"high"},"*.cpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cc":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.h":{frameworks:["C","C++"],slots:{mainLanguage:"C/C++"},priority:25,intelligence:"high"},"*.hpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.hxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:20,intelligence:"medium"},".env":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.example":{frameworks:[],slots:{},priority:25,intelligence:"high"},".env.local":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.development":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.production":{frameworks:[],slots:{},priority:20,intelligence:"medium"},"skaffold.yaml":{frameworks:["Skaffold","Kubernetes"],slots:{hosting:"Kubernetes",cicd:"Skaffold"},priority:30,intelligence:"high"},"Chart.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes",backend:"Helm"},priority:30,intelligence:"high"},"values.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:25,intelligence:"high",confirmWith:["Chart.yaml"]},"pulumi.yaml":{frameworks:["Pulumi"],slots:{hosting:"Cloud",cicd:"Pulumi"},priority:30,intelligence:"high"},"Pulumi.yaml":{frameworks:["Pulumi"],slots:{hosting:"Cloud",cicd:"Pulumi"},priority:30,intelligence:"high"},"terragrunt.hcl":{frameworks:["Terragrunt","Terraform"],slots:{hosting:"Cloud",cicd:"Terragrunt"},priority:30,intelligence:"high"},"ansible.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:30,intelligence:"high"},"playbook.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:25,intelligence:"high"},"*.cs":{frameworks:["C#",".NET","Unity"],slots:{mainLanguage:"C#"},priority:30,intelligence:"high"},"*.m":{frameworks:["Objective-C","iOS"],slots:{mainLanguage:"Objective-C"},priority:25,intelligence:"high"},".nvmrc":{frameworks:["Node.js","nvm"],slots:{runtime:"Node.js"},priority:25,intelligence:"high"},".tool-versions":{frameworks:["asdf"],slots:{},priority:25,intelligence:"high"},".ruby-version":{frameworks:["Ruby","rbenv"],slots:{mainLanguage:"Ruby",runtime:"Ruby"},priority:25,intelligence:"high"},".python-version":{frameworks:["Python","pyenv"],slots:{mainLanguage:"Python",runtime:"Python"},priority:25,intelligence:"high"},".dockerignore":{frameworks:["Docker"],slots:{},priority:20,intelligence:"medium"},".gitattributes":{frameworks:["Git"],slots:{},priority:15,intelligence:"low"},".npmrc":{frameworks:["npm","Node.js"],slots:{packageManager:"npm"},priority:20,intelligence:"medium"},"sonar-project.properties":{frameworks:["SonarQube","SonarCloud"],slots:{cicd:"SonarQube"},priority:25,intelligence:"high"},"*.fs":{frameworks:["F#",".NET"],slots:{mainLanguage:"F#"},priority:25,intelligence:"high"},"*.mm":{frameworks:["Objective-C++","iOS","macOS"],slots:{mainLanguage:"Objective-C++"},priority:25,intelligence:"high"},"build.zig.zon":{frameworks:["Zig"],slots:{mainLanguage:"Zig",packageManager:"Zig Package Manager",buildTool:"zig build"},priority:35,intelligence:"ultra-high"},"gleam.toml":{frameworks:["Gleam","BEAM","Erlang"],slots:{mainLanguage:"Gleam",runtime:"BEAM",packageManager:"Gleam"},priority:30,intelligence:"high"},"bunfig.toml":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",buildTool:"Bun"},priority:30,intelligence:"high"},"mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},".mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},"manifest.toml":{frameworks:["Flox","Nix"],slots:{},priority:25,intelligence:"high",confirmWith:[".flox"]},justfile:{frameworks:["Just"],slots:{buildTool:"Just"},priority:25,intelligence:"high"},".pre-commit-config.yaml":{frameworks:["pre-commit"],slots:{cicd:"pre-commit"},priority:25,intelligence:"high"},"CLAUDE.md":{frameworks:["Claude Code"],slots:{},priority:30,intelligence:"high",confirmWith:[".claude"]}};var YI=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),WI=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),UI={mainLanguage:["project","main_language"],main_language:["project","main_language"],framework:["stack","frontend"],cssFramework:["stack","css_framework"],css:["stack","css_framework"],uiLibrary:["stack","ui_library"],ui_library:["stack","ui_library"],stateManagement:["stack","state_management"],state:["stack","state_management"],backend:["stack","backend"],apiType:["stack","api_type"],api:["stack","api_type"],runtime:["stack","runtime"],database:["stack","database"],db:["stack","database"],connection:["stack","connection"],hosting:["stack","hosting"],buildTool:["stack","build"],build_tool:["stack","build"],build:["stack","build"],packageManager:["stack","package_manager"],pkg_manager:["stack","package_manager"],cicd:["stack","cicd"]},qI=[["packageManager","package-manager"],["pkg_manager","package-manager"],["mainLanguage","language"],["main_language","language"],["framework","framework"],["backend","backend"],["database","database"],["db","database"],["cicd","ci-cd"],["hosting","hosting"],["buildTool","build"],["build_tool","build"],["build","build"],["runtime","runtime"],["cssFramework","css"],["css","css"],["uiLibrary","ui-library"],["stateManagement","state-management"],["apiType","api"],["api","api"]];function GI($,Z){for(let[X,z]of qI)if(X in $)return z;return Z.length>0?"framework":"config"}function VI($){try{let Z=JSON.parse(XI($,"utf-8")),X=["background","content_scripts","action","browser_action","permissions"].some((z)=>(z in Z));if(typeof Z.manifest_version==="number"&&X)return"chrome";return"other"}catch{return"other"}}function KI($){let Z=[],X=QI($),z=ZI(xZ($,".git")),J=new Set;for(let Q=0;Q<10;Q++){let Y;try{Y=nz(X)}catch{break}for(let U of Y){if(U.toLowerCase().endsWith(".csproj")){let G=g8(X);if(G){let V={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="mobile"&&G.framework)V.framework=G.framework;if(G.targetFramework)V.runtime=G.targetFramework;let K=G.framework?[G.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:V,priority:36,frameworks:K,fileName:U})}continue}if(U.endsWith(".xcodeproj")){let G=k2(X);if(G){let V={mainLanguage:"Swift",packageManager:G.packageManager==="spm"?"spm":"Xcode",buildTool:G.packageManager.includes("spm")?"swift build":"xcodebuild"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="app")V.framework=G.framework||"Swift App";let K=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:36,frameworks:K,fileName:U})}continue}let q=jZ[U];if(!q)continue;if(U==="manifest.json"&&VI(xZ(X,U))!=="chrome")continue;if(U==="pubspec.yaml"){let G=x8(X);if(G){let V={mainLanguage:"Dart",packageManager:"pub"};if(G.isFlutter){if(V.framework="Flutter",G.stateManagement)V.stateManagement=G.stateManagement}else if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="mcp")V.apiType="MCP";Z.push({slots:V,priority:q.priority,frameworks:G.isFlutter?["Flutter","Dart"]:["Dart"],fileName:U});continue}}if(U==="go.mod"){let G=y8(X);if(G){let V={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";let K=G.framework?[G.framework,"Go"]:["Go"];Z.push({slots:V,priority:q.priority,frameworks:K,fileName:U});continue}}if(U==="Gemfile"||U==="Gemfile.lock"||U==="gems.rb"){let G=h8(X);if(G){let V={mainLanguage:"Ruby",packageManager:G.packageManager};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";let K=G.framework?[G.framework,"Ruby"]:["Ruby"];Z.push({slots:V,priority:q.priority??35,frameworks:K,fileName:U});continue}}if(U==="Package.swift"){let G=k2(X);if(G){let V={mainLanguage:"Swift",packageManager:G.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="app")V.framework=G.framework||"SwiftUI/App";let K=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:q.priority??36,frameworks:K,fileName:U});continue}}if(U==="pom.xml"||U==="build.gradle"||U==="build.gradle.kts"||U==="settings.gradle"||U==="settings.gradle.kts"){if(J.has(X))continue;J.add(X);let G=P2(X);if(G){let V={mainLanguage:G.mainLanguage==="Java/Kotlin"?"Kotlin":G.mainLanguage,packageManager:G.buildTool==="maven"?"maven":"gradle",buildTool:G.buildTool};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="mobile")V.framework=G.framework||"Android";if(G.facets.includes("multiplatform"))V.framework=G.framework||"Kotlin Multiplatform";let K=G.framework?[G.framework,"JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:V,priority:q.priority??35,frameworks:K,fileName:U});continue}}Z.push({slots:q.slots||{},priority:q.priority,frameworks:q.frameworks,fileName:U})}if(z&&Q===0)break;let W=zI(X);if(W===X)break;X=W}return Z}function HI($){let Z=[];for(let X of rz($,2,{count:0})){let z=jZ[`*${X}`],J=z?.slots?.mainLanguage;if(J)Z.push({slots:{mainLanguage:J},priority:z.priority,frameworks:z.frameworks})}return Z}function BI($){let Z=[...KI($),...HI($)],X={},z={},J=new Set;for(let q of Z){q.frameworks.forEach((G)=>J.add(G));for(let[G,V]of Object.entries(q.slots))if(V&&!V.includes("/")&&(!(G in X)||q.priority>z[G]))X[G]=V,z[G]=q.priority}let Q=new Map;for(let q of Z){if(!q.fileName)continue;if(!Q.has(q.fileName))Q.set(q.fileName,{fileName:q.fileName,category:GI(q.slots,q.frameworks),priority:q.priority})}let Y=[...Q.values()].sort((q,G)=>G.priority-q.priority||q.fileName.localeCompare(G.fileName)),W=[];if(X.mainLanguage)W.push(X.mainLanguage.toLowerCase());if(X.framework)W.push(X.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:X,frameworks:[...J],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function s8($){let{slotFills:Z}=BI($),X={};for(let[z,J]of Object.entries(Z)){let Q=UI[z];if(!Q||!J)continue;let[Y,W]=Q;if(Y==="project")(X.project??={})[W]=J;else(X.stack??={})[W]=J}return X}function rz($,Z,X){let z=new Set;if(Z<0||X.count>400)return z;let J;try{J=nz($,{withFileTypes:!0})}catch{return z}for(let Q of J){if(X.count++>400)break;if(!Q.isDirectory()){let Y=JI(Q.name);if(WI.has(Y))z.add(Y);continue}if(YI.has(Q.name)||Q.name.startsWith("."))continue;for(let Y of rz(xZ($,Q.name),Z-1,X))z.add(Y)}return z}import{existsSync as sz,readFileSync as az}from"fs";import{join as oz}from"path";var N0=($,Z,X)=>({value:$,source:Z,confidence:X});function MI($,Z={}){let X=Z.toolingRoot?null:OI($),z=NI($),J={},Q=(Y,W)=>{if(W)J[Y]=W};return Q("what",II(X,z)),Q("who",TI(z)),Q("why",AI(z)),Q("where",RI(X,z)),Q("when",_I(z)),Q("how",FI(X,z)),J}function a8($,Z={}){let X=MI($,Z),z={};return Object.keys(X).forEach((J)=>{let Q=X[J];if(Q)z[J]=Q.value}),z}function OI($){let Z=oz($,"package.json");if(!sz(Z))return null;try{return JSON.parse(az(Z,"utf-8"))}catch{return null}}function NI($){let Z=oz($,"README.md");if(!sz(Z))return"";let X;try{X=az(Z,"utf-8")}catch{return""}return X.replace(/<!--[\s\S]*?-->/g,"").split(`
221
+ `),z=0;while(z<X.length){let Q=X[z].trim().match(/^(#{1,6})\s+(.+)$/);if(Q&&Z.test(Q[2])){let Y=Q[1].length,W=[];z++;while(z<X.length){let U=X[z].trim(),q=U.match(/^(#{1,6})\s+/);if(q&&q[1].length<=Y)break;if(U===""){if(W.length>0)break;z++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),z++}if(W.length===0)return null;return W.join(" ").trim()}z++}return null}function fD($){let Z=d1($,/^(use\s+cases?|goal)\b/i);if(Z&&n0(Z))return Z;let X=gD($);if(X&&n0(X))return X;return}function hD($){let Z=d1($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&n0(Z))return Z;return}function uD($){let Z=d1($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&n0(Z))return Z;return}function mD($){let Z=d1($,/^(why|motivation|problem|rationale)\b/i);if(Z&&n0(Z))return Z;return}function cD($){let Z=d1($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&n0(Z))return Z;return}function lD($){let Z=d1($,/^(status|history|timeline|since|launched)\b/i);if(Z&&n0(Z))return Z;return}function dD($){let Z=d1($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&n0(Z))return Z;return}function RZ($){let Z=["README.md","README.MD","Readme.md","readme.md"],X=null;for(let H of Z){let L=yD($,H);if(bD(L)){X=L;break}}if(!X)return{};let z;try{z=kD(X,"utf-8")}catch{return{}}z=z.replace(/<!--[\s\S]*?-->/g,"");let J={},Q=fD(z);if(Q)J.project={goal:Q};let Y={},W=hD(z);if(W)Y.what=W;let U=uD(z);if(U)Y.who=U;let q=mD(z);if(q)Y.why=q;let G=cD(z);if(G)Y.where=G;let V=lD(z);if(V)Y.when=V;let K=dD(z);if(K)Y.how=K;if(Object.keys(Y).length>0)J.human_context=Y;return J}import{existsSync as pD,readFileSync as iD}from"fs";import{join as nD}from"path";function rD($,Z){let X=$.split(`
222
+ `),z=!1;for(let J of X){let Q=J.trim();if(/^\[/.test(Q)){z=Q==="[package]";continue}if(!z)continue;let Y=Q.match(new RegExp(`^${Z}\\s*=\\s*(.+)$`));if(Y){let W=Y[1].trim();W=W.replace(/\s*#.*$/,"").trim();let U=W.match(/^"((?:[^"\\]|\\.)*)"$/)||W.match(/^'((?:[^'\\]|\\.)*)'$/);if(U)return U[1];return W}}return null}function _Z($){let Z=nD($,"Cargo.toml");if(!pD(Z))return{};let X;try{X=iD(Z,"utf-8")}catch{return{}}let z=rD(X,"description");if(z&&n0(z))return{project:{goal:z}};return{}}import{readFileSync as sD,readdirSync as aD}from"fs";import{join as iz}from"path";var oD=[{re:/^postgres|postgis|pgvector/,slot:"database",label:"PostgreSQL"},{re:/^mysql/,slot:"database",label:"MySQL"},{re:/^mariadb/,slot:"database",label:"MariaDB"},{re:/^mongo/,slot:"database",label:"MongoDB"},{re:/clickhouse/,slot:"database",label:"ClickHouse"},{re:/^cockroach/,slot:"database",label:"CockroachDB"},{re:/^redis|^valkey/,slot:"cache",label:"Redis"},{re:/^memcached/,slot:"cache",label:"Memcached"},{re:/elasticsearch/,slot:"search",label:"Elasticsearch"},{re:/opensearch/,slot:"search",label:"OpenSearch"},{re:/meilisearch/,slot:"search",label:"Meilisearch"},{re:/typesense/,slot:"search",label:"Typesense"},{re:/qdrant/,slot:"search",label:"Qdrant (vector)"},{re:/weaviate/,slot:"search",label:"Weaviate (vector)"},{re:/^minio/,slot:"storage",label:"MinIO (S3-compatible)"},{re:/localstack/,slot:"storage",label:"LocalStack (AWS)"},{re:/rabbitmq/,slot:"runtime",label:"RabbitMQ"},{re:/kafka/,slot:"runtime",label:"Kafka"},{re:/nats/,slot:"runtime",label:"NATS"},{re:/temporalio\/|temporal-server|temporal:/,slot:"runtime",label:"Temporal"}],tD=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function eD($){let Z=[],X=(z,J)=>{let Q;try{Q=aD(z,{withFileTypes:!0})}catch{return}for(let Y of Q)if(Y.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(Y.name))Z.push(iz(z,Y.name));else if(Y.isDirectory()&&J>0&&!Y.name.startsWith(".")&&!tD.has(Y.name))X(iz(z,Y.name),J-1)};return X($,1),Z}function y2($){return[...$].join(" · ")}function FZ($){let Z=eD($);if(Z.length===0)return{};let X={database:new Set,cache:new Set,search:new Set,storage:new Set,runtime:new Set};for(let J of Z){let Q;try{Q=sD(J,"utf-8")}catch{continue}for(let Y of Q.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let W=Y[1].toLowerCase(),U=W.replace(/:[^/]*$/,"").split("/").pop()??W,q=W.replace(/:[^/]*$/,"");for(let{re:G,slot:V,label:K}of oD)if(G.test(U)||G.test(q))X[V].add(K)}}let z={};if(X.database.size)z.database=y2(X.database);if(X.cache.size)z.cache=y2(X.cache);if(X.search.size)z.search=y2(X.search);if(X.storage.size)z.storage=y2(X.storage);if(X.runtime.size)z.runtime=`Docker Compose (${y2(X.runtime)})`;if(Object.keys(z).length===0&&!X.runtime.size)return{stack:{hosting:"Docker Compose"}};return z.hosting="Docker Compose",{stack:z}}import{existsSync as i8,readFileSync as $I,readdirSync as ZI}from"fs";import{join as v2}from"path";var XI=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),zI=[{file:"Makefile",runner:"make",targets:($)=>[...$.matchAll(/^([a-zA-Z][\w-]*)\s*:(?!=)/gm)].map((Z)=>Z[1])},{file:"justfile",runner:"just",targets:($)=>[...$.matchAll(/^([a-zA-Z][\w-]*)\s*(?:\([^)]*\))?\s*:/gm)].map((Z)=>Z[1])},{file:"Taskfile.yml",runner:"task",targets:($)=>{let Z=$.indexOf("tasks:");if(Z===-1)return[];return[...$.slice(Z).matchAll(/^\s{2}([a-zA-Z][\w-]*):/gm)].map((X)=>X[1])}}];function CZ($,Z){for(let X of Z){let z=$.find((J)=>X.test(J));if(z)return z}return null}function JI($){let Z=[$];try{for(let X of ZI($,{withFileTypes:!0}))if(X.isDirectory()&&!X.name.startsWith(".")&&!XI.has(X.name))Z.push(v2($,X.name))}catch{}return Z}function QI($){let Z=0;if(i8(v2($,"manage.py"))||i8(v2($,"pyproject.toml"))||i8(v2($,"Gemfile")))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function PZ($){let Z=[];for(let z of JI($)){let J=z===$,Q=J?"":`cd ${z.slice($.length+1)} && `;for(let Y of zI){let W=v2(z,Y.file);if(!i8(W))continue;let U;try{U=$I(W,"utf-8")}catch{continue}let q=Y.targets(U);if(q.length===0)continue;let G={},V=CZ(q,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),K=CZ(q,[/^build$/i,/^compile$/i,/^build/i]),H=CZ(q,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(V)G.test=`${Q}${Y.runner} ${V}`;if(K)G.build=`${Q}${Y.runner} ${K}`;if(H)G.lint=`${Q}${Y.runner} ${H}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(J?10:QI(z)),commands:G})}}let X=Z.sort((z,J)=>J.score-z.score)[0];return X?{commands:X.commands}:{}}import{existsSync as YI}from"fs";import{join as WI}from"path";var UI=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function EZ($){for(let Z of UI)if(YI(WI($,Z)))return{security:{secrets:".env",example:Z}};return{}}function qI($,Z){let X={project:{...Z.project??{},...$.project??{}},human_context:{...Z.human_context??{},...$.human_context??{}},stack:{...Z.stack??{},...$.stack??{}},commands:{...Z.commands??{},...$.commands??{}},security:{...Z.security??{},...$.security??{}}};for(let z of["project","human_context","stack","commands","security"])if(X[z]&&Object.keys(X[z]).length===0)delete X[z];return X}function wZ($){return[RZ($),_Z($),FZ($),PZ($),EZ($)].reduce(qI,{})}import{existsSync as GI,readdirSync as nz,readFileSync as VI}from"fs";import{join as jZ,dirname as KI,extname as HI,resolve as BI}from"path";var SZ={"package.json":{frameworks:["Node.js","JavaScript","TypeScript"],slots:{packageManager:"npm/yarn/pnpm",mainLanguage:"JavaScript/TypeScript"},priority:35,intelligence:"ultra-high"},"README.md":{frameworks:[],slots:{targetUser:"developers",coreProblem:"understanding project",missionPurpose:"project documentation"},priority:25,intelligence:"high"},"requirements.txt":{frameworks:["Python"],slots:{packageManager:"pip",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},Pipfile:{frameworks:["Python"],slots:{packageManager:"pipenv",mainLanguage:"Python"},priority:35,intelligence:"ultra-high"},"pyproject.toml":{frameworks:["Python"],slots:{mainLanguage:"Python",runtime:"Python",backend:"Python"},priority:36,intelligence:"ultra-high"},Gemfile:{frameworks:["Ruby"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:35,intelligence:"ultra-high"},"Gemfile.lock":{frameworks:["Ruby"],slots:{packageManager:"bundler",mainLanguage:"Ruby"},priority:34,intelligence:"high"},"composer.json":{frameworks:["PHP","Laravel","Symfony"],slots:{packageManager:"composer",mainLanguage:"PHP"},priority:35,intelligence:"ultra-high"},"Cargo.toml":{frameworks:["Rust"],slots:{packageManager:"cargo",mainLanguage:"Rust",buildTool:"cargo"},priority:36,intelligence:"ultra-high"},"go.mod":{frameworks:["Go"],slots:{packageManager:"go modules",mainLanguage:"Go",buildTool:"go build"},priority:36,intelligence:"ultra-high"},"Package.swift":{frameworks:["Swift"],slots:{packageManager:"spm",mainLanguage:"Swift",buildTool:"swift build"},priority:36,intelligence:"ultra-high"},"*.csproj":{frameworks:["C#",".NET"],slots:{packageManager:"NuGet",mainLanguage:"C#",buildTool:"dotnet"},priority:36,intelligence:"ultra-high"},"pubspec.yaml":{frameworks:["Dart"],slots:{packageManager:"pub",mainLanguage:"Dart"},priority:35,intelligence:"ultra-high"},"pom.xml":{frameworks:["Java"],slots:{packageManager:"maven",mainLanguage:"Java",buildTool:"maven"},priority:35,intelligence:"ultra-high"},"build.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"settings.gradle":{frameworks:["Java","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Java",buildTool:"gradle"},priority:34,intelligence:"high"},"settings.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:34,intelligence:"high"},"next.config.js":{frameworks:["Next.js"],slots:{framework:"Next.js",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.mjs":{frameworks:["Next.js"],slots:{framework:"Next.js",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.ts":{frameworks:["Next.js 13+"],slots:{framework:"Next.js 13+",runtime:"Node.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.js":{frameworks:["Nuxt 2"],slots:{framework:"Nuxt 2",runtime:"Node.js",buildTool:"Nuxt",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.ts":{frameworks:["Nuxt 3"],slots:{framework:"Nuxt 3",runtime:"Node.js",buildTool:"Nuxt",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"svelte.config.js":{frameworks:["SvelteKit"],slots:{framework:"SvelteKit",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"angular.json":{frameworks:["Angular"],slots:{framework:"Angular",buildTool:"Angular CLI",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manifest.json":{frameworks:["Chrome Extension","Browser Extension"],slots:{framework:"Chrome Extension",runtime:"Chrome/Browser",mainLanguage:"JavaScript",hosting:"Chrome Web Store",apiType:"Chrome APIs"},priority:35,intelligence:"ultra-high",confirmWith:["popup.html","background.js","content.js"]},"vue.config.js":{frameworks:["Vue"],slots:{framework:"Vue",buildTool:"Vue CLI",mainLanguage:"JavaScript"},priority:30,intelligence:"high"},"remix.config.js":{frameworks:["Remix"],slots:{framework:"Remix",runtime:"Node.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.js":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"gatsby-config.ts":{frameworks:["Gatsby"],slots:{framework:"Gatsby",buildTool:"Gatsby",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"astro.config.mjs":{frameworks:["Astro"],slots:{framework:"Astro",buildTool:"Vite",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"redwood.toml":{frameworks:["RedwoodJS"],slots:{framework:"RedwoodJS",buildTool:"Webpack",mainLanguage:"JavaScript/TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"blitz.config.ts":{frameworks:["Blitz.js"],slots:{framework:"Blitz.js",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js",database:"Prisma"},priority:30,intelligence:"high"},"qwik.config.ts":{frameworks:["Qwik"],slots:{framework:"Qwik",buildTool:"Vite",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"manage.py":{frameworks:["Django"],slots:{framework:"Django",backend:"Django",mainLanguage:"Python",server:"Django",apiType:"Django Views"},priority:30,intelligence:"high"},artisan:{frameworks:["Laravel"],slots:{framework:"Laravel",backend:"Laravel",mainLanguage:"PHP",server:"PHP",apiType:"Laravel Routes"},priority:30,intelligence:"high"},"mix.exs":{frameworks:["Phoenix","Elixir"],slots:{framework:"Phoenix",backend:"Phoenix",mainLanguage:"Elixir",server:"BEAM"},priority:30,intelligence:"high"},"nest-cli.json":{frameworks:["NestJS"],slots:{framework:"NestJS",backend:"NestJS",mainLanguage:"TypeScript",server:"Node.js",apiType:"REST API"},priority:30,intelligence:"high"},"strapi.config.js":{frameworks:["Strapi"],slots:{backend:"Strapi",apiType:"REST API",database:"Required",server:"Node.js"},priority:30,intelligence:"high"},Dockerfile:{frameworks:["Docker"],slots:{hosting:"Docker",connection:"Containerized"},priority:30,intelligence:"high"},"docker-compose.yml":{frameworks:["Docker Compose"],slots:{hosting:"Docker",connection:"Multi-container"},priority:30,intelligence:"high"},"docker-compose.yaml":{frameworks:["Docker Compose"],slots:{hosting:"Docker",connection:"Multi-container"},priority:30,intelligence:"high"},"kubernetes.yml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes",connection:"Orchestrated"},priority:30,intelligence:"high"},"k8s.yaml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes",connection:"Orchestrated"},priority:30,intelligence:"high"},"vercel.json":{frameworks:["Vercel"],slots:{hosting:"Vercel",cicd:"Vercel"},priority:30,intelligence:"high"},"netlify.toml":{frameworks:["Netlify"],slots:{hosting:"Netlify",cicd:"Netlify"},priority:30,intelligence:"high"},"render.yaml":{frameworks:["Render"],slots:{hosting:"Render",cicd:"Render"},priority:30,intelligence:"high"},"fly.toml":{frameworks:["Fly.io"],slots:{hosting:"Fly.io",cicd:"Fly.io"},priority:30,intelligence:"high"},"railway.json":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"railway.toml":{frameworks:["Railway"],slots:{hosting:"Railway",cicd:"Railway"},priority:30,intelligence:"high"},"app.yaml":{frameworks:["Google App Engine"],slots:{hosting:"Google Cloud",cicd:"Google Cloud"},priority:30,intelligence:"high"},Procfile:{frameworks:["Heroku"],slots:{hosting:"Heroku",cicd:"Heroku"},priority:30,intelligence:"high"},"vite.config.js":{frameworks:["Vite"],slots:{buildTool:"Vite"},priority:25,intelligence:"medium"},"vite.config.ts":{frameworks:["Vite"],slots:{buildTool:"Vite",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"webpack.config.js":{frameworks:["Webpack"],slots:{buildTool:"Webpack"},priority:25,intelligence:"medium"},"rollup.config.js":{frameworks:["Rollup"],slots:{buildTool:"Rollup"},priority:25,intelligence:"medium"},"esbuild.config.js":{frameworks:["esbuild"],slots:{buildTool:"esbuild"},priority:25,intelligence:"medium"},"parcel.config.js":{frameworks:["Parcel"],slots:{buildTool:"Parcel"},priority:25,intelligence:"medium"},"snowpack.config.js":{frameworks:["Snowpack"],slots:{buildTool:"Snowpack"},priority:25,intelligence:"medium"},"tsconfig.json":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"jsconfig.json":{frameworks:["JavaScript"],slots:{mainLanguage:"JavaScript"},priority:20,intelligence:"medium"},"babel.config.js":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},".babelrc":{frameworks:["Babel"],slots:{buildTool:"Babel"},priority:20,intelligence:"medium"},"jest.config.js":{frameworks:["Jest"],slots:{cicd:"Jest"},priority:25,intelligence:"medium"},"jest.config.ts":{frameworks:["Jest"],slots:{cicd:"Jest",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"vitest.config.ts":{frameworks:["Vitest"],slots:{cicd:"Vitest",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"cypress.config.js":{frameworks:["Cypress"],slots:{cicd:"Cypress"},priority:25,intelligence:"medium"},"playwright.config.ts":{frameworks:["Playwright"],slots:{cicd:"Playwright",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"karma.conf.js":{frameworks:["Karma"],slots:{cicd:"Karma"},priority:20,intelligence:"medium"},"mocha.opts":{frameworks:["Mocha"],slots:{cicd:"Mocha"},priority:20,intelligence:"medium"},".rspec":{frameworks:["RSpec"],slots:{cicd:"RSpec",mainLanguage:"Ruby"},priority:25,intelligence:"medium"},"pytest.ini":{frameworks:["Pytest"],slots:{cicd:"Pytest",mainLanguage:"Python"},priority:25,intelligence:"medium"},"phpunit.xml":{frameworks:["PHPUnit"],slots:{cicd:"PHPUnit",mainLanguage:"PHP"},priority:25,intelligence:"medium"},"schema.prisma":{frameworks:["Prisma"],slots:{database:"Prisma ORM",connection:"Prisma"},priority:25,intelligence:"medium"},"drizzle.config.ts":{frameworks:["Drizzle"],slots:{database:"Drizzle ORM",connection:"Drizzle",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ormconfig.js":{frameworks:["TypeORM"],slots:{database:"TypeORM",connection:"TypeORM"},priority:25,intelligence:"medium"},"knexfile.js":{frameworks:["Knex.js"],slots:{database:"Knex.js",connection:"Knex.js"},priority:25,intelligence:"medium"},"sequelize.config.js":{frameworks:["Sequelize"],slots:{database:"Sequelize",connection:"Sequelize"},priority:25,intelligence:"medium"},"alembic.ini":{frameworks:["Alembic"],slots:{database:"Alembic",mainLanguage:"Python"},priority:25,intelligence:"medium"},".github/workflows":{frameworks:["GitHub Actions"],slots:{cicd:"GitHub Actions"},priority:25,intelligence:"medium"},".gitlab-ci.yml":{frameworks:["GitLab CI"],slots:{cicd:"GitLab CI"},priority:25,intelligence:"medium"},Jenkinsfile:{frameworks:["Jenkins"],slots:{cicd:"Jenkins"},priority:25,intelligence:"medium"},".circleci/config.yml":{frameworks:["CircleCI"],slots:{cicd:"CircleCI"},priority:25,intelligence:"medium"},".travis.yml":{frameworks:["Travis CI"],slots:{cicd:"Travis CI"},priority:25,intelligence:"medium"},"azure-pipelines.yml":{frameworks:["Azure DevOps"],slots:{cicd:"Azure DevOps"},priority:25,intelligence:"medium"},"bitbucket-pipelines.yml":{frameworks:["Bitbucket Pipelines"],slots:{cicd:"Bitbucket Pipelines"},priority:25,intelligence:"medium"},"tailwind.config.js":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS"},priority:20,intelligence:"medium"},"tailwind.config.ts":{frameworks:["Tailwind CSS"],slots:{cssFramework:"Tailwind CSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"postcss.config.js":{frameworks:["PostCSS"],slots:{cssFramework:"PostCSS"},priority:20,intelligence:"medium"},"uno.config.ts":{frameworks:["UnoCSS"],slots:{cssFramework:"UnoCSS",mainLanguage:"TypeScript"},priority:20,intelligence:"medium"},"styled-components.config.js":{frameworks:["styled-components"],slots:{cssFramework:"styled-components",uiLibrary:"styled-components"},priority:20,intelligence:"medium"},"emotion.config.js":{frameworks:["Emotion"],slots:{cssFramework:"Emotion",uiLibrary:"Emotion"},priority:20,intelligence:"medium"},"metro.config.js":{frameworks:["React Native"],slots:{framework:"React Native",mainLanguage:"JavaScript"},priority:25,intelligence:"medium"},"expo.config.js":{frameworks:["Expo"],slots:{framework:"React Native",buildTool:"Expo"},priority:25,intelligence:"medium"},"app.json":{frameworks:["React Native","Expo"],slots:{framework:"React Native"},priority:20,intelligence:"medium",confirmWith:["expo"]},"capacitor.config.ts":{frameworks:["Capacitor"],slots:{framework:"Capacitor",mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"ionic.config.json":{frameworks:["Ionic"],slots:{framework:"Ionic",uiLibrary:"Ionic"},priority:25,intelligence:"medium"},"nx.json":{frameworks:["Nx"],slots:{buildTool:"Nx"},priority:25,intelligence:"medium"},"turbo.json":{frameworks:["Turborepo"],slots:{buildTool:"Turborepo"},priority:25,intelligence:"medium"},"lerna.json":{frameworks:["Lerna"],slots:{buildTool:"Lerna"},priority:25,intelligence:"medium"},"rush.json":{frameworks:["Rush"],slots:{buildTool:"Rush"},priority:25,intelligence:"medium"},"pnpm-workspace.yaml":{frameworks:["pnpm workspaces"],slots:{packageManager:"pnpm",buildTool:"pnpm workspaces"},priority:25,intelligence:"medium"},"*.svelte":{frameworks:["Svelte","SvelteKit"],slots:{framework:"Svelte"},priority:15,intelligence:"low"},"*.vue":{frameworks:["Vue"],slots:{framework:"Vue"},priority:15,intelligence:"low"},"*.jsx":{frameworks:["React"],slots:{framework:"React",mainLanguage:"JavaScript"},priority:15,intelligence:"low"},"*.ts":{frameworks:["TypeScript"],slots:{mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.tsx":{frameworks:["React","TypeScript"],slots:{framework:"React",mainLanguage:"TypeScript"},priority:15,intelligence:"low"},"*.py":{frameworks:["Python"],slots:{mainLanguage:"Python"},priority:15,intelligence:"low"},"*.rb":{frameworks:["Ruby"],slots:{mainLanguage:"Ruby"},priority:15,intelligence:"low"},"*.php":{frameworks:["PHP"],slots:{mainLanguage:"PHP"},priority:15,intelligence:"low"},"*.java":{frameworks:["Java"],slots:{mainLanguage:"Java"},priority:15,intelligence:"low"},"*.kt":{frameworks:["Kotlin"],slots:{mainLanguage:"Kotlin"},priority:15,intelligence:"low"},"*.swift":{frameworks:["Swift"],slots:{mainLanguage:"Swift"},priority:15,intelligence:"low"},"*.go":{frameworks:["Go"],slots:{mainLanguage:"Go"},priority:15,intelligence:"low"},"*.rs":{frameworks:["Rust"],slots:{mainLanguage:"Rust"},priority:15,intelligence:"low"},"*.dart":{frameworks:["Flutter","Dart"],slots:{mainLanguage:"Dart"},priority:15,intelligence:"low"},"*.ex":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.exs":{frameworks:["Elixir"],slots:{mainLanguage:"Elixir"},priority:15,intelligence:"low"},"*.scala":{frameworks:["Scala"],slots:{mainLanguage:"Scala"},priority:15,intelligence:"low"},"*.clj":{frameworks:["Clojure"],slots:{mainLanguage:"Clojure"},priority:15,intelligence:"low"},"*.lua":{frameworks:["Lua"],slots:{mainLanguage:"Lua"},priority:15,intelligence:"low"},"*.r":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.R":{frameworks:["R"],slots:{mainLanguage:"R"},priority:15,intelligence:"low"},"*.jl":{frameworks:["Julia"],slots:{mainLanguage:"Julia"},priority:15,intelligence:"low"},"*.nim":{frameworks:["Nim"],slots:{mainLanguage:"Nim"},priority:15,intelligence:"low"},"*.zig":{frameworks:["Zig"],slots:{mainLanguage:"Zig"},priority:15,intelligence:"low"},"build.zig":{frameworks:["Zig"],slots:{packageManager:"Zig Package Manager",mainLanguage:"Zig",buildTool:"zig build",framework:"Zig",build:"zig build"},priority:35,intelligence:"ultra-high"},"openapi.json":{frameworks:["OpenAPI"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"openapi.yaml":{frameworks:["OpenAPI"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"swagger.json":{frameworks:["Swagger"],slots:{apiType:"REST API",backend:"API Server"},priority:30,intelligence:"high"},"graphql.schema":{frameworks:["GraphQL"],slots:{apiType:"GraphQL",backend:"GraphQL Server"},priority:30,intelligence:"high"},"schema.graphql":{frameworks:["GraphQL"],slots:{apiType:"GraphQL",backend:"GraphQL Server"},priority:30,intelligence:"high"},".graphqlconfig":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:25,intelligence:"medium"},"redux.config.js":{frameworks:["Redux"],slots:{stateManagement:"Redux"},priority:20,intelligence:"medium"},"mobx.config.js":{frameworks:["MobX"],slots:{stateManagement:"MobX"},priority:20,intelligence:"medium"},"vuex.config.js":{frameworks:["Vuex"],slots:{stateManagement:"Vuex",framework:"Vue"},priority:20,intelligence:"medium"},"pinia.config.js":{frameworks:["Pinia"],slots:{stateManagement:"Pinia",framework:"Vue"},priority:20,intelligence:"medium"},"zustand.config.js":{frameworks:["Zustand"],slots:{stateManagement:"Zustand"},priority:20,intelligence:"medium"},".eslintrc.js":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".eslintrc.json":{frameworks:["ESLint"],slots:{},priority:15,intelligence:"low"},".prettierrc":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},".prettierrc.json":{frameworks:["Prettier"],slots:{},priority:15,intelligence:"low"},"biome.json":{frameworks:["Biome"],slots:{},priority:15,intelligence:"low"},".editorconfig":{frameworks:["EditorConfig"],slots:{},priority:10,intelligence:"low"},"serverless.yml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"serverless.yaml":{frameworks:["Serverless Framework"],slots:{hosting:"AWS Lambda/Azure/GCP",backend:"Serverless",apiType:"API Gateway"},priority:30,intelligence:"high"},"sam.yaml":{frameworks:["AWS SAM"],slots:{hosting:"AWS Lambda",backend:"AWS SAM",cicd:"AWS SAM CLI"},priority:30,intelligence:"high"},"template.yaml":{frameworks:["AWS SAM","CloudFormation"],slots:{hosting:"AWS",backend:"AWS SAM/CloudFormation",cicd:"AWS"},priority:25,intelligence:"medium",confirmWith:["samconfig.toml"]},"amplify.yml":{frameworks:["AWS Amplify"],slots:{hosting:"AWS Amplify",backend:"AWS Amplify",cicd:"AWS Amplify"},priority:30,intelligence:"high"},Podfile:{frameworks:["CocoaPods","Swift"],slots:{packageManager:"CocoaPods",mainLanguage:"Swift/Objective-C"},priority:30,intelligence:"high"},"build.gradle.kts":{frameworks:["Kotlin","Gradle"],slots:{packageManager:"gradle",mainLanguage:"Kotlin",buildTool:"gradle"},priority:35,intelligence:"ultra-high"},"*.ipynb":{frameworks:["Jupyter","Python"],slots:{mainLanguage:"Python",framework:"Jupyter Notebook"},priority:30,intelligence:"high"},MLproject:{frameworks:["MLflow"],slots:{mainLanguage:"Python",framework:"MLflow",backend:"MLflow",cicd:"MLflow"},priority:30,intelligence:"high"},"dvc.yaml":{frameworks:["DVC","Data Version Control"],slots:{mainLanguage:"Python",framework:"DVC",cicd:"DVC Pipelines"},priority:30,intelligence:"high"},"dvc.lock":{frameworks:["DVC"],slots:{framework:"DVC"},priority:20,intelligence:"medium"},"wrangler.toml":{frameworks:["Cloudflare Workers","Cloudflare"],slots:{hosting:"Cloudflare Workers",backend:"Cloudflare Workers",runtime:"V8 Isolates"},priority:30,intelligence:"high"},"deno.json":{frameworks:["Deno"],slots:{runtime:"Deno",mainLanguage:"TypeScript",packageManager:"Deno"},priority:30,intelligence:"high"},"bun.lockb":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",mainLanguage:"TypeScript/JavaScript"},priority:30,intelligence:"high"},"codecov.yml":{frameworks:["Codecov"],slots:{cicd:"Codecov"},priority:25,intelligence:"high"},"dependabot.yml":{frameworks:["Dependabot","GitHub"],slots:{cicd:"Dependabot"},priority:25,intelligence:"high"},"renovate.json":{frameworks:["Renovate"],slots:{cicd:"Renovate"},priority:25,intelligence:"high"},Makefile:{frameworks:["Make","GNU Make"],slots:{buildTool:"Make"},priority:30,intelligence:"high"},"CMakeLists.txt":{frameworks:["CMake","C","C++"],slots:{buildTool:"CMake",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"meson.build":{frameworks:["Meson","C","C++"],slots:{buildTool:"Meson",mainLanguage:"C/C++"},priority:30,intelligence:"high"},"*.c":{frameworks:["C"],slots:{mainLanguage:"C"},priority:30,intelligence:"high"},"*.cpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cc":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:30,intelligence:"high"},"*.cxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.h":{frameworks:["C","C++"],slots:{mainLanguage:"C/C++"},priority:25,intelligence:"high"},"*.hpp":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:25,intelligence:"high"},"*.hxx":{frameworks:["C++"],slots:{mainLanguage:"C++"},priority:20,intelligence:"medium"},".env":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.example":{frameworks:[],slots:{},priority:25,intelligence:"high"},".env.local":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.development":{frameworks:[],slots:{},priority:20,intelligence:"medium"},".env.production":{frameworks:[],slots:{},priority:20,intelligence:"medium"},"skaffold.yaml":{frameworks:["Skaffold","Kubernetes"],slots:{hosting:"Kubernetes",cicd:"Skaffold"},priority:30,intelligence:"high"},"Chart.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes",backend:"Helm"},priority:30,intelligence:"high"},"values.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:25,intelligence:"high",confirmWith:["Chart.yaml"]},"pulumi.yaml":{frameworks:["Pulumi"],slots:{hosting:"Cloud",cicd:"Pulumi"},priority:30,intelligence:"high"},"Pulumi.yaml":{frameworks:["Pulumi"],slots:{hosting:"Cloud",cicd:"Pulumi"},priority:30,intelligence:"high"},"terragrunt.hcl":{frameworks:["Terragrunt","Terraform"],slots:{hosting:"Cloud",cicd:"Terragrunt"},priority:30,intelligence:"high"},"ansible.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:30,intelligence:"high"},"playbook.yml":{frameworks:["Ansible"],slots:{cicd:"Ansible"},priority:25,intelligence:"high"},"*.cs":{frameworks:["C#",".NET","Unity"],slots:{mainLanguage:"C#"},priority:30,intelligence:"high"},"*.m":{frameworks:["Objective-C","iOS"],slots:{mainLanguage:"Objective-C"},priority:25,intelligence:"high"},".nvmrc":{frameworks:["Node.js","nvm"],slots:{runtime:"Node.js"},priority:25,intelligence:"high"},".tool-versions":{frameworks:["asdf"],slots:{},priority:25,intelligence:"high"},".ruby-version":{frameworks:["Ruby","rbenv"],slots:{mainLanguage:"Ruby",runtime:"Ruby"},priority:25,intelligence:"high"},".python-version":{frameworks:["Python","pyenv"],slots:{mainLanguage:"Python",runtime:"Python"},priority:25,intelligence:"high"},".dockerignore":{frameworks:["Docker"],slots:{},priority:20,intelligence:"medium"},".gitattributes":{frameworks:["Git"],slots:{},priority:15,intelligence:"low"},".npmrc":{frameworks:["npm","Node.js"],slots:{packageManager:"npm"},priority:20,intelligence:"medium"},"sonar-project.properties":{frameworks:["SonarQube","SonarCloud"],slots:{cicd:"SonarQube"},priority:25,intelligence:"high"},"*.fs":{frameworks:["F#",".NET"],slots:{mainLanguage:"F#"},priority:25,intelligence:"high"},"*.mm":{frameworks:["Objective-C++","iOS","macOS"],slots:{mainLanguage:"Objective-C++"},priority:25,intelligence:"high"},"build.zig.zon":{frameworks:["Zig"],slots:{mainLanguage:"Zig",packageManager:"Zig Package Manager",buildTool:"zig build"},priority:35,intelligence:"ultra-high"},"gleam.toml":{frameworks:["Gleam","BEAM","Erlang"],slots:{mainLanguage:"Gleam",runtime:"BEAM",packageManager:"Gleam"},priority:30,intelligence:"high"},"bunfig.toml":{frameworks:["Bun"],slots:{runtime:"Bun",packageManager:"Bun",buildTool:"Bun"},priority:30,intelligence:"high"},"mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},".mise.toml":{frameworks:["mise"],slots:{},priority:25,intelligence:"high"},"manifest.toml":{frameworks:["Flox","Nix"],slots:{},priority:25,intelligence:"high",confirmWith:[".flox"]},justfile:{frameworks:["Just"],slots:{buildTool:"Just"},priority:25,intelligence:"high"},".pre-commit-config.yaml":{frameworks:["pre-commit"],slots:{cicd:"pre-commit"},priority:25,intelligence:"high"},"CLAUDE.md":{frameworks:["Claude Code"],slots:{},priority:30,intelligence:"high",confirmWith:[".claude"]}};var MI=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),OI=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),NI={mainLanguage:["project","main_language"],main_language:["project","main_language"],framework:["stack","frontend"],cssFramework:["stack","css_framework"],css:["stack","css_framework"],uiLibrary:["stack","ui_library"],ui_library:["stack","ui_library"],stateManagement:["stack","state_management"],state:["stack","state_management"],backend:["stack","backend"],apiType:["stack","api_type"],api:["stack","api_type"],runtime:["stack","runtime"],database:["stack","database"],db:["stack","database"],connection:["stack","connection"],hosting:["stack","hosting"],buildTool:["stack","build"],build_tool:["stack","build"],build:["stack","build"],packageManager:["stack","package_manager"],pkg_manager:["stack","package_manager"],cicd:["stack","cicd"]},LI=[["packageManager","package-manager"],["pkg_manager","package-manager"],["mainLanguage","language"],["main_language","language"],["framework","framework"],["backend","backend"],["database","database"],["db","database"],["cicd","ci-cd"],["hosting","hosting"],["buildTool","build"],["build_tool","build"],["build","build"],["runtime","runtime"],["cssFramework","css"],["css","css"],["uiLibrary","ui-library"],["stateManagement","state-management"],["apiType","api"],["api","api"]];function DI($,Z){for(let[X,z]of LI)if(X in $)return z;return Z.length>0?"framework":"config"}function II($){try{let Z=JSON.parse(VI($,"utf-8")),X=["background","content_scripts","action","browser_action","permissions"].some((z)=>(z in Z));if(typeof Z.manifest_version==="number"&&X)return"chrome";return"other"}catch{return"other"}}function TI($){let Z=[],X=BI($),z=GI(jZ($,".git")),J=new Set;for(let Q=0;Q<10;Q++){let Y;try{Y=nz(X)}catch{break}for(let U of Y){if(U.toLowerCase().endsWith(".csproj")){let G=g8(X);if(G){let V={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="mobile"&&G.framework)V.framework=G.framework;if(G.targetFramework)V.runtime=G.targetFramework;let K=G.framework?[G.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:V,priority:36,frameworks:K,fileName:U})}continue}if(U.endsWith(".xcodeproj")){let G=k2(X);if(G){let V={mainLanguage:"Swift",packageManager:G.packageManager==="spm"?"spm":"Xcode",buildTool:G.packageManager.includes("spm")?"swift build":"xcodebuild"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="app")V.framework=G.framework||"Swift App";let K=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:36,frameworks:K,fileName:U})}continue}let q=SZ[U];if(!q)continue;if(U==="manifest.json"&&II(jZ(X,U))!=="chrome")continue;if(U==="pubspec.yaml"){let G=x8(X);if(G){let V={mainLanguage:"Dart",packageManager:"pub"};if(G.isFlutter){if(V.framework="Flutter",G.stateManagement)V.stateManagement=G.stateManagement}else if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="mcp")V.apiType="MCP";Z.push({slots:V,priority:q.priority,frameworks:G.isFlutter?["Flutter","Dart"]:["Dart"],fileName:U});continue}}if(U==="go.mod"){let G=y8(X);if(G){let V={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";let K=G.framework?[G.framework,"Go"]:["Go"];Z.push({slots:V,priority:q.priority,frameworks:K,fileName:U});continue}}if(U==="Gemfile"||U==="Gemfile.lock"||U==="gems.rb"){let G=h8(X);if(G){let V={mainLanguage:"Ruby",packageManager:G.packageManager};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";let K=G.framework?[G.framework,"Ruby"]:["Ruby"];Z.push({slots:V,priority:q.priority??35,frameworks:K,fileName:U});continue}}if(U==="Package.swift"){let G=k2(X);if(G){let V={mainLanguage:"Swift",packageManager:G.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="app")V.framework=G.framework||"SwiftUI/App";let K=G.framework?[G.framework,"Swift"]:["Swift"];Z.push({slots:V,priority:q.priority??36,frameworks:K,fileName:U});continue}}if(U==="pom.xml"||U==="build.gradle"||U==="build.gradle.kts"||U==="settings.gradle"||U==="settings.gradle.kts"){if(J.has(X))continue;J.add(X);let G=E2(X);if(G){let V={mainLanguage:G.mainLanguage==="Java/Kotlin"?"Kotlin":G.mainLanguage,packageManager:G.buildTool==="maven"?"maven":"gradle",buildTool:G.buildTool};if(G.appType==="backend"&&G.framework)V.backend=G.framework;else if(G.appType==="cli"&&G.framework)V.framework=G.framework;else if(G.appType==="mcp")V.apiType="MCP";else if(G.appType==="mobile")V.framework=G.framework||"Android";if(G.facets.includes("multiplatform"))V.framework=G.framework||"Kotlin Multiplatform";let K=G.framework?[G.framework,"JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",G.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:V,priority:q.priority??35,frameworks:K,fileName:U});continue}}Z.push({slots:q.slots||{},priority:q.priority,frameworks:q.frameworks,fileName:U})}if(z&&Q===0)break;let W=KI(X);if(W===X)break;X=W}return Z}function AI($){let Z=[];for(let X of rz($,2,{count:0})){let z=SZ[`*${X}`],J=z?.slots?.mainLanguage;if(J)Z.push({slots:{mainLanguage:J},priority:z.priority,frameworks:z.frameworks})}return Z}function RI($){let Z=[...TI($),...AI($)],X={},z={},J=new Set;for(let q of Z){q.frameworks.forEach((G)=>J.add(G));for(let[G,V]of Object.entries(q.slots))if(V&&!V.includes("/")&&(!(G in X)||q.priority>z[G]))X[G]=V,z[G]=q.priority}let Q=new Map;for(let q of Z){if(!q.fileName)continue;if(!Q.has(q.fileName))Q.set(q.fileName,{fileName:q.fileName,category:DI(q.slots,q.frameworks),priority:q.priority})}let Y=[...Q.values()].sort((q,G)=>G.priority-q.priority||q.fileName.localeCompare(G.fileName)),W=[];if(X.mainLanguage)W.push(X.mainLanguage.toLowerCase());if(X.framework)W.push(X.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:X,frameworks:[...J],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function xZ($){let{slotFills:Z}=RI($),X={};for(let[z,J]of Object.entries(Z)){let Q=NI[z];if(!Q||!J)continue;let[Y,W]=Q;if(Y==="project")(X.project??={})[W]=J;else(X.stack??={})[W]=J}return X}function rz($,Z,X){let z=new Set;if(Z<0||X.count>400)return z;let J;try{J=nz($,{withFileTypes:!0})}catch{return z}for(let Q of J){if(X.count++>400)break;if(!Q.isDirectory()){let Y=HI(Q.name);if(OI.has(Y))z.add(Y);continue}if(MI.has(Q.name)||Q.name.startsWith("."))continue;for(let Y of rz(jZ($,Q.name),Z-1,X))z.add(Y)}return z}import{existsSync as sz,readFileSync as az}from"fs";import{join as oz}from"path";var N0=($,Z,X)=>({value:$,source:Z,confidence:X});function _I($,Z={}){let X=Z.toolingRoot?null:FI($),z=CI($),J={},Q=(Y,W)=>{if(W)J[Y]=W};return Q("what",wI(X,z)),Q("who",SI(z)),Q("why",jI(z)),Q("where",xI(X,z)),Q("when",bI(z)),Q("how",kI(X,z)),J}function bZ($,Z={}){let X=_I($,Z),z={};return Object.keys(X).forEach((J)=>{let Q=X[J];if(Q)z[J]=Q.value}),z}function FI($){let Z=oz($,"package.json");if(!sz(Z))return null;try{return JSON.parse(az(Z,"utf-8"))}catch{return null}}function CI($){let Z=oz($,"README.md");if(!sz(Z))return"";let X;try{X=az(Z,"utf-8")}catch{return""}return X.replace(/<!--[\s\S]*?-->/g,"").split(`
223
223
  `).filter((z)=>!/^\s*\[!\[/.test(z)&&!/^\s*!\[/.test(z)).join(`
224
- `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function p1($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function LI($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function I$($,Z){let X=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),z=$.match(X);if(!z||!z[2]||z[2].trim().length<=20||LI(z[2])>0.4)return null;return{body:p1(z[2]),heading:z[1].trim()}}function DI($){let Z=$.trim();if(/^>/.test(Z))return!0;if(/\b(nightly (release|build)|pre-?release|work[-\s]in[-\s]progress|rough edges|early (access|testing|preview)|use at your own risk|not (yet )?production[-\s]?ready|expect (rough|breaking)|experimental release)\b/i.test(Z))return!0;let X=Z.split(/[·|]/).map((z)=>z.trim()).filter(Boolean);if(X.length>=3&&X.every((z)=>z.length<=24))return!0;return!1}function g2($,Z,X=30){for(let z of Z){let J=$.match(z);if(J&&J[1]&&J[1].trim().length>=X)return p1(J[1])}return null}function II($,Z){if($?.description&&$.description.length>20)return N0(p1($.description),"package.json:description",0.95);let X=I$(Z,"Purpose|What|About|Overview|Description");if(X)return N0(X.body,`README:## ${X.heading}`,0.8);let z=Z.split(/\n\s*\n/).map((Q)=>Q.replace(/\s+/g," ").trim()).find((Q)=>Q.length>30&&!Q.startsWith("#")&&!DI(Q));if(z)return N0(p1(z),"README:first-paragraph",0.5);let J=g2(Z,[/(?:core|main|primary)\s+(?:problem|challenge)(?:\s+is)?\s*:?\s*([^.\n]{30,})/i,/solves?\s+(?:the\s+)?(?:problem\s+of\s+)?([^.\n]{30,})/i]);return J?N0(J,"README:problem-heuristic",0.6):null}function TI($){let Z=I$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return N0(Z.body,`README:## ${Z.heading}`,0.8);let X=g2($,[/\b(?:designed|built|made)\s+for\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i,/\bfor\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i],8);return X?N0(X,"README:audience-heuristic",0.6):null}function AI($){let Z=I$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return N0(Z.body,`README:## ${Z.heading}`,0.8);let X=g2($,[/(?:our\s+|the\s+)?(?:mission|purpose|goal)\s+is\s+([^.\n]{30,})/i,/\b(?:mission|purpose|goal)\s*:\s*([^.\n]{30,})/i,/(?:built|created|designed)\s+(?:because|to)\s+([^.\n]{30,})/i]);return X?N0(X,"README:mission-heuristic",0.6):null}function RI($,Z){let X=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(X)return N0(p1(X.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return N0(p1($.homepage),"package.json:homepage",0.9);let z=g2(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return z?N0(z,"README:deploy-heuristic",0.6):null}function _I($){let Z=I$($,"Timeline|Status|Release|Roadmap");if(Z)return N0(Z.body,`README:## ${Z.heading}`,0.8);let X=g2($,[/\b(production\s+since\s+[^.\n]{4,60})/i,/\b((?:in\s+)?(?:production|beta|alpha|development)\s+since\s+[^.\n]{4,60})/i,/\bsince\s+((?:[A-Z][a-z]+\s+)?\d{4}[^.\n]{0,40})/],4);return X?N0(X,"README:since-heuristic",0.6):null}function FI($,Z){let X=$?.scripts?Object.keys($.scripts):[],z=["start","dev","build"].filter((Y)=>X.includes(Y));if(z.length)return N0(p1(z.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let J=I$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(J)return N0(J.body,`README:## ${J.heading}`,0.8);let Q=I$(Z,"Architecture|Approach|How it works|Methodology|How");return Q?N0(Q.body,`README:## ${Q.heading}`,0.7):null}function T$($){let Z=i8($),X=r8($),z={};if(X.stack)z.stack=X.stack;if(X.commands)z.commands=X.commands;if(X.security)z.security=X.security;let J={};if(X.project)J.project=X.project;if(X.human_context)J.human_context=X.human_context;let Q=e0(e0(z,Z),J);CI(Q);let W=(Z._meta?.found??[]).some((q)=>q.startsWith("polyglot:")),U=e0(Q,s8($));return e0(U,{human_context:a8($,{toolingRoot:W})})}function CI($){let Z=$.project?.type??"library",X=N$[Z]||N$.library;for(let z of Z0){if(X.includes(z.category))continue;let[J,Q]=z.path.split(".");if(J==="stack"&&$.stack)$.stack[Q]="slotignored";if(J==="monorepo"&&$.monorepo)$.monorepo[Q]="slotignored"}}function e0($,Z){let X={...$};for(let[z,J]of Object.entries(Z)){let Q=X[z];if(P0(Q))X[z]=J;else if(typeof J==="object"&&J!==null&&!Array.isArray(J)&&typeof Q==="object"&&Q!==null&&!Array.isArray(Q))X[z]=e0(Q,J)}return X}import{existsSync as tz,readFileSync as EI,writeFileSync as PI}from"fs";import{join as wI,basename as SI}from"path";import{createHash as jI}from"crypto";class Q1{projectPath;dnaPath;dna=null;constructor($){this.projectPath=$,this.dnaPath=wI($,".faf-dna")}exists(){return tz(this.dnaPath)}birth($){let Z=new Date().toISOString();return this.dna={birthCertificate:{born:Z,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Z,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Z},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Z,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Z,format:"faf-dna-v1"},this.save(),this.dna}recordGrowth($,Z){if(!this.dna&&!this.load())return null;let X=this.dna;if($===X.current.score)return X;let z=new Date().toISOString(),J=X.birthCertificate.birthDNA,Q=$-J,Y=this.incrementVersion(X.versions[X.versions.length-1].version);return X.versions.push({version:Y,timestamp:z,score:$,changes:Z,growth:Q}),X.current={version:Y,score:$,lastSync:z},X.growth.totalGrowth=Q,X.growth.daysActive=this.daysSince(X.birthCertificate.born),this.updateMilestones($,Y,z),this.save(),X}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,X=$.growth.milestones.find((Q)=>Q.type==="peak"),z=$.current.score,J=`${Z}%`;if(X&&X.score!==Z){if(J+=` → ${X.score}%`,z<X.score)J+=` ← ${z}%`}else if(z!==Z)J+=` → ${z}%`;return J}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,born:$.birthCertificate.born}}getLog(){if(!this.dna&&!this.load())return[];return this.dna.versions.map(($)=>{let Z=$.growth>50?"\uD83D\uDE80":$.growth>20?"\uD83D\uDCC8":"\uD83D\uDCCA";return`${$.version} — ${$.score}% ${Z} (${$.timestamp.split("T")[0]}) ${$.changes.join(", ")}`})}load(){if(this.dna)return this.dna;if(!tz(this.dnaPath))return null;try{return this.dna=JSON.parse(EI(this.dnaPath,"utf-8")),this.dna}catch{return null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString(),PI(this.dnaPath,`${JSON.stringify(this.dna,null,2)}
225
- `,"utf-8")}generateProjectDNA(){return jI("sha256").update([this.projectPath,Date.now().toString(),Math.random().toString(36)].join(":")).digest("hex").substring(0,16)}generateCertificate(){let $=new Date().getFullYear(),Z=Math.random().toString(36).substring(2,6).toUpperCase(),X=SI(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${X}-${Z}`}incrementVersion($){let[Z,X,z]=$.replace("v","").split(".").map(Number);return`v${Z}.${X}.${z+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,X){if(!this.dna)return;let z=this.dna.growth.milestones,J=(U)=>z.some((q)=>q.type===U),Q=(U,q,G)=>z.push({type:U,score:$,date:X,version:Z,label:q,emoji:G});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!J("doubled"))Q("doubled","Doubled","2️⃣");let Y=z.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)z.splice(z.indexOf(Y),1);Q("peak","Peak","\uD83C\uDFD4️")}let W=z.findIndex((U)=>U.type==="current");if(W>=0)z.splice(W,1);Q("current","Current","\uD83D\uDCCD")}}l();l();import{homedir as ez}from"os";import{resolve as o8}from"path";function xI($=process.cwd()){let Z=o8($),X=o8(ez());if(Z===X)return!0;if(Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return!0;return!1}function A$($=process.cwd(),Z="faf"){if(!xI($))return;let X=o8($)===o8(ez())?"your home directory (~)":"the filesystem root";console.error(`${I("faf")}: ${X} is not a project.`),console.error(""),console.error(` ${A("cd")} into a real repo (or any folder you mean to own), then run again:`),console.error(M(" cd /path/to/your-project")),console.error(M(` ${Z}`)),console.error(""),console.error(M(" Home will never be a git repo for this. project.faf belongs with the code.")),process.exit(1)}function bZ($={}){A$(process.cwd(),"faf init");let Z=process.cwd(),X=$.output?$.output.endsWith(".faf")?$.output:$J(Z,$.output):$J(Z,"project.faf");if(bI(X)&&!$.force)console.error(`project.faf already exists. Use ${A("--force")} to overwrite.`),process.exit(1);let z=T$(Z);$0(X,z);let J=u(X),Q=Q0(J),Y=new Q1(Z);if(!Y.exists()||$.force)Y.birth(Q.score);if(console.log(`${I("created")} ${X}`),Y0(Q,X),console.log(M(` \uD83E\uDDEC Birth DNA ${Q.score}% — your journey starts here (faf dna)`)),Q.score<100)console.log(M(`
226
- run ${A("'faf go'")} to fill empty slots`))}l();function ZJ(){let $=new Q1(process.cwd());if(!$.load())console.error(`${A("×")} No FAF DNA found. Run ${A("'faf init'")} to start your journey.`),process.exit(1);let Z=$.getJourney(),X=$.getBirthDNADisplay(),z=X.born.split("T")[0];console.log(),console.log(H0(A("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${I(A(Z))}`),console.log(),console.log(M(` Birth DNA ${X.birthDNA}% (born ${z}) · current ${X.current}% · growth ${X.growth>=0?"+":""}${X.growth}%`));let J=$.getLog();if(J.length>1){console.log(),console.log(M(" history:"));for(let Q of J)console.log(M(` ${Q}`))}console.log()}import{existsSync as kI}from"fs";import{join as yI}from"path";l();function t8(){A$(process.cwd(),"faf auto");let $=process.cwd(),Z=yI($,"project.faf");if(kI(Z)){let Q=m(Z),Y=e0(Q,r8($)),W=e0(Y,i8($)),U=e0(W,s8($)),q=e0(U,{human_context:a8($)});$0(Z,q),console.log(`${I("updated")} ${Z}`)}else $0(Z,T$($)),console.log(`${I("created")} ${Z}`);let X=u(Z),z=B0(G0(X)),J=new Q1($);if(J.exists())J.recordGrowth(z.score,["faf auto"]);if(Y0(z,Z),z.score<100)console.log(M(`
227
- run ${A("'faf go'")} to reach ✪ Trophy`))}import{existsSync as lI}from"fs";import{join as dI}from"path";var R$="(terse — 3-4 words)",vI=[{path:"project.name",question:"What is the name of this project?",header:"Name",type:"text",required:!0},{path:"project.goal",question:"What does this project do? (one sentence)",header:"Goal",type:"text",required:!0},{path:"human_context.who",question:`Who is this for? ${R$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${R$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${R$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${R$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${R$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${R$}`,header:"How",type:"text",required:!0}],gI=[{path:"project.main_language",question:"What is the primary programming language?",header:"Language",type:"select",required:!0,options:[{label:"TypeScript",value:"TypeScript",description:"JavaScript with types"},{label:"JavaScript",value:"JavaScript",description:"Vanilla JS or Node.js"},{label:"Python",value:"Python",description:"Python 3.x"},{label:"Rust",value:"Rust",description:"Systems programming"},{label:"Go",value:"Go",description:"Golang"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.frontend",question:"What frontend framework does it use?",header:"Frontend",type:"select",required:!1,options:[{label:"React",value:"React",description:"React.js"},{label:"Vue",value:"Vue",description:"Vue.js"},{label:"Svelte",value:"Svelte",description:"Svelte/SvelteKit"},{label:"Next.js",value:"Next.js",description:"React framework"},{label:"None",value:"None",description:"No frontend"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.backend",question:"What backend framework does it use?",header:"Backend",type:"select",required:!1,options:[{label:"Express",value:"Express",description:"Node.js Express"},{label:"Fastify",value:"Fastify",description:"Node.js Fastify"},{label:"Django",value:"Django",description:"Python Django"},{label:"FastAPI",value:"FastAPI",description:"Python FastAPI"},{label:"None",value:"None",description:"No backend"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.database",question:"What database does it use?",header:"Database",type:"select",required:!1,options:[{label:"PostgreSQL",value:"PostgreSQL",description:"Postgres"},{label:"MySQL",value:"MySQL",description:"MySQL/MariaDB"},{label:"SQLite",value:"SQLite",description:"Embedded SQL"},{label:"MongoDB",value:"MongoDB",description:"Document store"},{label:"None",value:"None",description:"No database"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.runtime",question:"What runtime does it run on?",header:"Runtime",type:"text",required:!1},{path:"stack.hosting",question:"Where is it hosted or distributed?",header:"Hosting",type:"text",required:!1},{path:"stack.build",question:"What is the build tool?",header:"Build",type:"text",required:!1},{path:"stack.cicd",question:"What CI/CD does it use?",header:"CI/CD",type:"text",required:!1}],e8=[...vI,...gI],fI=new Map(e8.map(($)=>[$.path,$])),GS=Object.fromEntries(e8.map(($)=>[$.path,$]));function $4($){let Z=fI.get($);if(Z)return Z.question;let X=O$.get($)??Z0.find((z)=>z.canonical===$);return X?`${X.description}?`.replace(/\?\?$/,"?"):`${$}?`}function yZ($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||P0(Z)}return!1}function hI($,Z){let X=$;for(let z of Z.split("."))if(X&&typeof X==="object"&&z in X)X=X[z];else return;return X}function uI($){if($==="project.goal")return!0;return O$.get($)?.category==="human"}function mI($,Z=yZ){let X=[],z=[];for(let J of e8){let Q=hI($,J.path);if(Q==="slotignored")continue;if(!Z(Q))continue;(uI(J.path)?X:z).push(J.path)}return{human:X,sourceable:z}}function cI($,Z,X=yZ){let z=mI(Z,X),J;if($>=100||z.human.length===0&&z.sourceable.length===0)J="done";else if(z.sourceable.length>0)J="can-source";else J="needs-human";let Q=J==="needs-human"?kZ(z):[];return{status:J,score:$,gaps:z,ask:Q}}function kZ($){return $.human.map((Z)=>({path:Z,question:$4(Z)}))}function XJ($,Z={}){let X=Math.max(1,Z.maxRounds??5),z=Z.isEmpty??yZ,J=[],Q=0;for(let W=0;W<=X;W++){let U=$.read();if(!U)return{status:"no-faf",score:0,rounds:Q,history:J,ask:[]};let q=$.score(U.yaml);J.push(q);let G=cI(q,U.data,z);if(G.status==="done")return{status:"done",score:q,rounds:Q,history:J,ask:[]};if(G.status==="needs-human")return{status:"needs-human",score:q,rounds:Q,history:J,ask:G.ask};if(J.length>=2&&q<=J[J.length-2])return G.gaps.human.length?{status:"needs-human",score:q,rounds:Q,history:J,ask:kZ(G.gaps)}:{status:"stuck",score:q,rounds:Q,history:J,ask:[]};if(Q>=X)return{status:"capped",score:q,rounds:Q,history:J,ask:kZ(G.gaps)};$.runAuto(),Q++}return{status:"capped",score:J[J.length-1]??0,rounds:Q,history:J,ask:[]}}l();function zJ($={}){let Z=process.cwd(),X=dI(Z,"project.faf"),z=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;pI(XJ({read:()=>lI(X)?{data:m(X),yaml:u(X)}:{data:{},yaml:""},score:(Q)=>Q?B0(G0(Q)).score:0,runAuto:()=>t8()},{maxRounds:z}))}function pI($){if($.history.length>1)console.log(M(`
224
+ `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function p1($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function PI($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function I$($,Z){let X=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),z=$.match(X);if(!z||!z[2]||z[2].trim().length<=20||PI(z[2])>0.4)return null;return{body:p1(z[2]),heading:z[1].trim()}}function EI($){let Z=$.trim();if(/^>/.test(Z))return!0;if(/\b(nightly (release|build)|pre-?release|work[-\s]in[-\s]progress|rough edges|early (access|testing|preview)|use at your own risk|not (yet )?production[-\s]?ready|expect (rough|breaking)|experimental release)\b/i.test(Z))return!0;let X=Z.split(/[·|]/).map((z)=>z.trim()).filter(Boolean);if(X.length>=3&&X.every((z)=>z.length<=24))return!0;return!1}function g2($,Z,X=30){for(let z of Z){let J=$.match(z);if(J&&J[1]&&J[1].trim().length>=X)return p1(J[1])}return null}function wI($,Z){if($?.description&&$.description.length>20)return N0(p1($.description),"package.json:description",0.95);let X=I$(Z,"Purpose|What|About|Overview|Description");if(X)return N0(X.body,`README:## ${X.heading}`,0.8);let z=Z.split(/\n\s*\n/).map((Q)=>Q.replace(/\s+/g," ").trim()).find((Q)=>Q.length>30&&!Q.startsWith("#")&&!EI(Q));if(z)return N0(p1(z),"README:first-paragraph",0.5);let J=g2(Z,[/(?:core|main|primary)\s+(?:problem|challenge)(?:\s+is)?\s*:?\s*([^.\n]{30,})/i,/solves?\s+(?:the\s+)?(?:problem\s+of\s+)?([^.\n]{30,})/i]);return J?N0(J,"README:problem-heuristic",0.6):null}function SI($){let Z=I$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return N0(Z.body,`README:## ${Z.heading}`,0.8);let X=g2($,[/\b(?:designed|built|made)\s+for\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i,/\bfor\s+((?:[a-z][a-z-]*\s+)?(?:developers?|teams?|engineers?|builders?|founders?)[^.\n]{0,80})/i],8);return X?N0(X,"README:audience-heuristic",0.6):null}function jI($){let Z=I$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return N0(Z.body,`README:## ${Z.heading}`,0.8);let X=g2($,[/(?:our\s+|the\s+)?(?:mission|purpose|goal)\s+is\s+([^.\n]{30,})/i,/\b(?:mission|purpose|goal)\s*:\s*([^.\n]{30,})/i,/(?:built|created|designed)\s+(?:because|to)\s+([^.\n]{30,})/i]);return X?N0(X,"README:mission-heuristic",0.6):null}function xI($,Z){let X=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(X)return N0(p1(X.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return N0(p1($.homepage),"package.json:homepage",0.9);let z=g2(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return z?N0(z,"README:deploy-heuristic",0.6):null}function bI($){let Z=I$($,"Timeline|Status|Release|Roadmap");if(Z)return N0(Z.body,`README:## ${Z.heading}`,0.8);let X=g2($,[/\b(production\s+since\s+[^.\n]{4,60})/i,/\b((?:in\s+)?(?:production|beta|alpha|development)\s+since\s+[^.\n]{4,60})/i,/\bsince\s+((?:[A-Z][a-z]+\s+)?\d{4}[^.\n]{0,40})/],4);return X?N0(X,"README:since-heuristic",0.6):null}function kI($,Z){let X=$?.scripts?Object.keys($.scripts):[],z=["start","dev","build"].filter((Y)=>X.includes(Y));if(z.length)return N0(p1(z.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let J=I$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(J)return N0(J.body,`README:## ${J.heading}`,0.8);let Q=I$(Z,"Architecture|Approach|How it works|Methodology|How");return Q?N0(Q.body,`README:## ${Q.heading}`,0.7):null}function T$($){let Z=AZ($),X=wZ($),z={};if(X.stack)z.stack=X.stack;if(X.commands)z.commands=X.commands;if(X.security)z.security=X.security;let J={};if(X.project)J.project=X.project;if(X.human_context)J.human_context=X.human_context;let Q=J1(J1(z,Z),J);yI(Q);let W=(Z._meta?.found??[]).some((q)=>q.startsWith("polyglot:")),U=J1(Q,xZ($));return J1(U,{human_context:bZ($,{toolingRoot:W})})}function tz($,Z){let X=J1(Z,wZ($)),z=J1(X,AZ($)),J=J1(z,xZ($));return J1(J,{human_context:bZ($)})}function yI($){let Z=$.project?.type??"library",X=N$[Z]||N$.library;for(let z of Z0){if(X.includes(z.category))continue;let[J,Q]=z.path.split(".");if(J==="stack"&&$.stack)$.stack[Q]="slotignored";if(J==="monorepo"&&$.monorepo)$.monorepo[Q]="slotignored"}}function J1($,Z){let X={...$};for(let[z,J]of Object.entries(Z)){let Q=X[z];if(E0(Q))X[z]=J;else if(typeof J==="object"&&J!==null&&!Array.isArray(J)&&typeof Q==="object"&&Q!==null&&!Array.isArray(Q))X[z]=J1(Q,J)}return X}import{existsSync as ez,readFileSync as vI,writeFileSync as gI}from"fs";import{join as fI,basename as hI}from"path";import{createHash as uI}from"crypto";class Q1{projectPath;dnaPath;dna=null;constructor($){this.projectPath=$,this.dnaPath=fI($,".faf-dna")}exists(){return ez(this.dnaPath)}birth($){let Z=new Date().toISOString();return this.dna={birthCertificate:{born:Z,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:Z,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:Z},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:Z,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:Z,format:"faf-dna-v1"},this.save(),this.dna}recordGrowth($,Z){if(!this.dna&&!this.load())return null;let X=this.dna;if($===X.current.score)return X;let z=new Date().toISOString(),J=X.birthCertificate.birthDNA,Q=$-J,Y=this.incrementVersion(X.versions[X.versions.length-1].version);return X.versions.push({version:Y,timestamp:z,score:$,changes:Z,growth:Q}),X.current={version:Y,score:$,lastSync:z},X.growth.totalGrowth=Q,X.growth.daysActive=this.daysSince(X.birthCertificate.born),this.updateMilestones($,Y,z),this.save(),X}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,X=$.growth.milestones.find((Q)=>Q.type==="peak"),z=$.current.score,J=`${Z}%`;if(X&&X.score!==Z){if(J+=` → ${X.score}%`,z<X.score)J+=` ← ${z}%`}else if(z!==Z)J+=` → ${z}%`;return J}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,born:$.birthCertificate.born}}getLog(){if(!this.dna&&!this.load())return[];return this.dna.versions.map(($)=>{let Z=$.growth>50?"\uD83D\uDE80":$.growth>20?"\uD83D\uDCC8":"\uD83D\uDCCA";return`${$.version} — ${$.score}% ${Z} (${$.timestamp.split("T")[0]}) ${$.changes.join(", ")}`})}load(){if(this.dna)return this.dna;if(!ez(this.dnaPath))return null;try{return this.dna=JSON.parse(vI(this.dnaPath,"utf-8")),this.dna}catch{return null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString(),gI(this.dnaPath,`${JSON.stringify(this.dna,null,2)}
225
+ `,"utf-8")}generateProjectDNA(){return uI("sha256").update([this.projectPath,Date.now().toString(),Math.random().toString(36)].join(":")).digest("hex").substring(0,16)}generateCertificate(){let $=new Date().getFullYear(),Z=Math.random().toString(36).substring(2,6).toUpperCase(),X=hI(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${X}-${Z}`}incrementVersion($){let[Z,X,z]=$.replace("v","").split(".").map(Number);return`v${Z}.${X}.${z+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,X){if(!this.dna)return;let z=this.dna.growth.milestones,J=(U)=>z.some((q)=>q.type===U),Q=(U,q,G)=>z.push({type:U,score:$,date:X,version:Z,label:q,emoji:G});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!J("doubled"))Q("doubled","Doubled","2️⃣");let Y=z.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)z.splice(z.indexOf(Y),1);Q("peak","Peak","\uD83C\uDFD4️")}let W=z.findIndex((U)=>U.type==="current");if(W>=0)z.splice(W,1);Q("current","Current","\uD83D\uDCCD")}}l();l();import{homedir as $J}from"os";import{resolve as n8}from"path";function mI($=process.cwd()){let Z=n8($),X=n8($J());if(Z===X)return!0;if(Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return!0;return!1}function A$($=process.cwd(),Z="faf"){if(!mI($))return;let X=n8($)===n8($J())?"your home directory (~)":"the filesystem root";console.error(`${I("faf")}: ${X} is not a project.`),console.error(""),console.error(` ${A("cd")} into a real repo (or any folder you mean to own), then run again:`),console.error(M(" cd /path/to/your-project")),console.error(M(` ${Z}`)),console.error(""),console.error(M(" Home will never be a git repo for this. project.faf belongs with the code.")),process.exit(1)}function kZ($={}){A$(process.cwd(),"faf init");let Z=process.cwd(),X=$.output?$.output.endsWith(".faf")?$.output:ZJ(Z,$.output):ZJ(Z,"project.faf");if(cI(X)&&!$.force)console.error(`project.faf already exists. Use ${A("--force")} to overwrite.`),process.exit(1);let z=T$(Z);$0(X,z);let J=u(X),Q=Q0(J),Y=new Q1(Z);if(!Y.exists()||$.force)Y.birth(Q.score);if(console.log(`${I("created")} ${X}`),Y0(Q,X),console.log(M(` \uD83E\uDDEC Birth DNA ${Q.score}% — your journey starts here (faf dna)`)),Q.score<100)console.log(M(`
226
+ run ${A("'faf go'")} to fill empty slots`))}l();function XJ(){let $=new Q1(process.cwd());if(!$.load())console.error(`${A("×")} No FAF DNA found. Run ${A("'faf init'")} to start your journey.`),process.exit(1);let Z=$.getJourney(),X=$.getBirthDNADisplay(),z=X.born.split("T")[0];console.log(),console.log(H0(A("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${I(A(Z))}`),console.log(),console.log(M(` Birth DNA ${X.birthDNA}% (born ${z}) · current ${X.current}% · growth ${X.growth>=0?"+":""}${X.growth}%`));let J=$.getLog();if(J.length>1){console.log(),console.log(M(" history:"));for(let Q of J)console.log(M(` ${Q}`))}console.log()}import{existsSync as lI}from"fs";import{join as dI}from"path";l();function r8(){A$(process.cwd(),"faf auto");let $=process.cwd(),Z=dI($,"project.faf");if(lI(Z))$0(Z,tz($,m(Z))),console.log(`${I("updated")} ${Z}`);else $0(Z,T$($)),console.log(`${I("created")} ${Z}`);let X=u(Z),z=B0(G0(X)),J=new Q1($);if(J.exists())J.recordGrowth(z.score,["faf auto"]);if(Y0(z,Z),z.score<100)console.log(M(`
227
+ run ${A("'faf go'")} to reach ✪ Trophy`))}import{existsSync as tI}from"fs";import{join as eI}from"path";var R$="(terse — 3-4 words)",pI=[{path:"project.name",question:"What is the name of this project?",header:"Name",type:"text",required:!0},{path:"project.goal",question:"What does this project do? (one sentence)",header:"Goal",type:"text",required:!0},{path:"human_context.who",question:`Who is this for? ${R$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${R$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${R$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${R$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${R$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${R$}`,header:"How",type:"text",required:!0}],iI=[{path:"project.main_language",question:"What is the primary programming language?",header:"Language",type:"select",required:!0,options:[{label:"TypeScript",value:"TypeScript",description:"JavaScript with types"},{label:"JavaScript",value:"JavaScript",description:"Vanilla JS or Node.js"},{label:"Python",value:"Python",description:"Python 3.x"},{label:"Rust",value:"Rust",description:"Systems programming"},{label:"Go",value:"Go",description:"Golang"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.frontend",question:"What frontend framework does it use?",header:"Frontend",type:"select",required:!1,options:[{label:"React",value:"React",description:"React.js"},{label:"Vue",value:"Vue",description:"Vue.js"},{label:"Svelte",value:"Svelte",description:"Svelte/SvelteKit"},{label:"Next.js",value:"Next.js",description:"React framework"},{label:"None",value:"None",description:"No frontend"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.backend",question:"What backend framework does it use?",header:"Backend",type:"select",required:!1,options:[{label:"Express",value:"Express",description:"Node.js Express"},{label:"Fastify",value:"Fastify",description:"Node.js Fastify"},{label:"Django",value:"Django",description:"Python Django"},{label:"FastAPI",value:"FastAPI",description:"Python FastAPI"},{label:"None",value:"None",description:"No backend"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.database",question:"What database does it use?",header:"Database",type:"select",required:!1,options:[{label:"PostgreSQL",value:"PostgreSQL",description:"Postgres"},{label:"MySQL",value:"MySQL",description:"MySQL/MariaDB"},{label:"SQLite",value:"SQLite",description:"Embedded SQL"},{label:"MongoDB",value:"MongoDB",description:"Document store"},{label:"None",value:"None",description:"No database"},{label:"Other",value:"Other",description:"Specify manually"}]},{path:"stack.runtime",question:"What runtime does it run on?",header:"Runtime",type:"text",required:!1},{path:"stack.hosting",question:"Where is it hosted or distributed?",header:"Hosting",type:"text",required:!1},{path:"stack.build",question:"What is the build tool?",header:"Build",type:"text",required:!1},{path:"stack.cicd",question:"What CI/CD does it use?",header:"CI/CD",type:"text",required:!1}],s8=[...pI,...iI],nI=new Map(s8.map(($)=>[$.path,$])),OS=Object.fromEntries(s8.map(($)=>[$.path,$]));function a8($){let Z=nI.get($);if(Z)return Z.question;let X=O$.get($)??Z0.find((z)=>z.canonical===$);return X?`${X.description}?`.replace(/\?\?$/,"?"):`${$}?`}function vZ($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||E0(Z)}return!1}function rI($,Z){let X=$;for(let z of Z.split("."))if(X&&typeof X==="object"&&z in X)X=X[z];else return;return X}function sI($){if($==="project.goal")return!0;return O$.get($)?.category==="human"}function aI($,Z=vZ){let X=[],z=[];for(let J of s8){let Q=rI($,J.path);if(Q==="slotignored")continue;if(!Z(Q))continue;(sI(J.path)?X:z).push(J.path)}return{human:X,sourceable:z}}function oI($,Z,X=vZ){let z=aI(Z,X),J;if($>=100||z.human.length===0&&z.sourceable.length===0)J="done";else if(z.sourceable.length>0)J="can-source";else J="needs-human";let Q=J==="needs-human"?yZ(z):[];return{status:J,score:$,gaps:z,ask:Q}}function yZ($){return $.human.map((Z)=>({path:Z,question:a8(Z)}))}function zJ($,Z={}){let X=Math.max(1,Z.maxRounds??5),z=Z.isEmpty??vZ,J=[],Q=0;for(let W=0;W<=X;W++){let U=$.read();if(!U)return{status:"no-faf",score:0,rounds:Q,history:J,ask:[]};let q=$.score(U.yaml);J.push(q);let G=oI(q,U.data,z);if(G.status==="done")return{status:"done",score:q,rounds:Q,history:J,ask:[]};if(G.status==="needs-human")return{status:"needs-human",score:q,rounds:Q,history:J,ask:G.ask};if(J.length>=2&&q<=J[J.length-2])return G.gaps.human.length?{status:"needs-human",score:q,rounds:Q,history:J,ask:yZ(G.gaps)}:{status:"stuck",score:q,rounds:Q,history:J,ask:[]};if(Q>=X)return{status:"capped",score:q,rounds:Q,history:J,ask:yZ(G.gaps)};$.runAuto(),Q++}return{status:"capped",score:J[J.length-1]??0,rounds:Q,history:J,ask:[]}}l();function JJ($={}){let Z=process.cwd(),X=eI(Z,"project.faf"),z=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;$T(zJ({read:()=>tI(X)?{data:m(X),yaml:u(X)}:{data:{},yaml:""},score:(Q)=>Q?B0(G0(Q)).score:0,runAuto:()=>r8()},{maxRounds:z}))}function $T($){if($.history.length>1)console.log(M(`
228
228
  climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${I("done")} — ✪ 100% AI-readiness. The .faf is complete.`);break;case"needs-human":{let Z=$.ask.length;console.log(`${A("Sourced everything detection can.")} ${Z} question${Z===1?"":"s"} only you can answer:`);for(let X of $.ask)console.log(` ${M("•")} ${X.question}`);console.log(M(`
229
- Answer with ${A("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${A(`Stopped at ${$.score}%.`)} The remaining gaps need evidence detection couldn't find, and there's nothing only you can answer. Add the missing manifests/README, then re-run.`);break;case"capped":console.log(`${A(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${A("'faf loop'")} to continue, or raise ${M("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${A("'faf init'")} first.`);break}}import{existsSync as z4,statSync as VJ}from"fs";import{join as KJ,dirname as zT}from"path";import{readFileSync as tI,existsSync as eI,statSync as PS}from"fs";import{join as QJ}from"path";import{readFileSync as iI,writeFileSync as Z4,existsSync as nI}from"fs";var rI="<!-- faf:start -->",sI="<!-- faf:end -->",aI="<!-- faf:";function g0($,Z,X=rI,z=sI){let J=`${X}
229
+ Answer with ${A("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${A(`Stopped at ${$.score}%.`)} The remaining gaps need evidence detection couldn't find, and there's nothing only you can answer. Add the missing manifests/README, then re-run.`);break;case"capped":console.log(`${A(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${A("'faf loop'")} to continue, or raise ${M("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${A("'faf init'")} first.`);break}}import{existsSync as e8,statSync as LJ}from"fs";import{join as DJ,dirname as KT}from"path";import{readFileSync as WT,existsSync as UT,statSync as kS}from"fs";import{join as KJ}from"path";import{readFileSync as ZT,writeFileSync as o8,existsSync as XT}from"fs";var WJ="<!-- faf:start -->",UJ="<!-- faf:end -->",zT="<!-- faf: ";function qJ($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,X,z)=>Z!==""||X<z.length-1)??[]}var GJ=($)=>$.replace(/\r?\n$|\r$/,""),JT=($)=>$.startsWith("```")||$.startsWith("~~~");function QJ($,Z,X,z){let J=0,Q=!1,Y=-1;for(let W of qJ($)){let U=GJ(W),q=J===0&&U.charCodeAt(0)===65279?1:0,G=U.slice(q),V=G.trimEnd();if(Y===-1){if(z&&JT(G.trim()))Q=!Q;else if(!Q&&V===Z)Y=J+q}else if(V===X)return{start:Y,end:J+U.length};J+=W.length}return null}function YJ($,Z){return qJ($).some((X)=>GJ(X).replace(/^\uFEFF/,"").trimEnd()===Z)}function QT($,Z=WJ,X=UJ){return QJ($,Z,X,!0)??QJ($,Z,X,!1)}function g0($,Z,X=WJ,z=UJ){let J=`${X}
230
230
  ${Z.trim()}
231
- ${z}`;if(!nI($)){Z4($,`${J}
232
- `,"utf-8");return}let Q=iI($,"utf-8"),Y=Q.indexOf(X),W=Q.indexOf(z);if(Y!==-1&&W!==-1&&W>Y){let U=Q.slice(0,Y),q=Q.slice(W+z.length);Z4($,`${U}${J}${q}`,"utf-8");return}if(Q.trimStart().startsWith(aI)){Z4($,`${J}
233
- `,"utf-8");return}Z4($,`${J}
231
+ ${z}`;if(!XT($)){o8($,`${J}
232
+ `,"utf-8");return}let Q=ZT($,"utf-8"),Y=QT(Q,X,z);if(Y){o8($,`${Q.slice(0,Y.start)}${J}${Q.slice(Y.end)}`,"utf-8");return}if(Q.trimStart().startsWith(zT)&&!YJ(Q,X)&&!YJ(Q,z)){o8($,`${J}
233
+ `,"utf-8");return}o8($,`${J}
234
234
 
235
- ${Q}`,"utf-8")}var oI=new Set(["API","CI","CD","MCP","CLI","SDK","UI","UX","AI","ML","DB","ORM","OS","HTTP","HTTPS","REST","RPC","JSON","YAML","XML","SQL","CSS","HTML","AWS","GCP","CDN","DNS","JWT","ID","IP","URL","URI","TS","JS"]);function vZ($){return $.split("_").map((Z)=>{if(!Z)return Z;let X=Z.toUpperCase();return oI.has(X)?X:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function I0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function f0($){let Z=O$.get($);if(Z?.label)return Z.label;let X=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return vZ(X)}var YJ="CLAUDE.md",$T="STATUS: BI-SYNC ACTIVE";function WJ($){let Z=QJ($,YJ);if(!eI(Z))return null;return tI(Z,"utf-8")}function UJ($,Z){g0(QJ($,YJ),Z)}function Y1($,Z={}){let X=String($.project?.name??"").trim(),z=String($.project?.main_language??"").trim(),J=String($.project?.type??"").trim(),Q=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[X,z,J,Q].join(" | ")} -->`,W=[];if(Z.doc)W.push(`doc=${Z.doc}`);else W.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")W.push(`score=${Z.score}`);if(W.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)W.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${W.join(" | ")} -->`;return`${Y}
236
- ${U}`}function qJ($){let Z=[],X=$.project?.name??"Project",z=$.project?.main_language??"",J=$.project?.goal??"";if(Z.push(Y1($)),Z.push(""),Z.push(`# CLAUDE.md — ${X}`),Z.push(""),J)Z.push("## What This Is"),Z.push(""),Z.push(J),Z.push("");let Q=$.stack??{},Y=[];if(z)Y.push(`**Language:** ${z}`);for(let[q,G]of Object.entries(Q))if(G&&G!=="slotignored"&&String(G).trim())Y.push(`**${f0(`stack.${q}`)}:** ${G}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let q of Y)Z.push(`- ${q}`);Z.push("")}let W=$.human_context??{},U=[["who",W.who],["what",W.what],["why",W.why],["where",W.where],["when",W.when],["how",W.how]].filter(([,q])=>q&&String(q).trim()).map(([q,G])=>`- **${f0(`human_context.${q}`)}:** ${G}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${$T} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
237
- `)}function JJ($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function X4($){let Z={project:{}},X=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(X)Z.project.name=JJ(X[1].trim());if(!Z.project.name){let Q=$.match(/\*\*Name:\*\*\s*(.+)/);if(Q)Z.project.name=JJ(Q[1].trim())}let z=$.match(/## What This Is\s*\n\s*\n(.+)/);if(z)Z.project.goal=z[1].trim();if(!Z.project.goal){let Q=$.match(/\*\*What Building:\*\*\s*(.+)/);if(Q)Z.project.goal=Q[1].trim()}let J=$.match(/\*\*Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim();if(!Z.project.main_language){let Q=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(Q)Z.project.main_language=Q[1].trim()}return Z}import{readFileSync as kS,writeFileSync as ZT,existsSync as yS}from"fs";import{join as XT}from"path";function GJ($,Z){ZT(XT($,"MEMORY.md"),Z,"utf-8")}l();function _$(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function gZ($={}){let Z=process.cwd(),X=f(Z);if(!X)console.error(`Error: project.faf not found
235
+ ${Q}`,"utf-8")}var YT=new Set(["API","CI","CD","MCP","CLI","SDK","UI","UX","AI","ML","DB","ORM","OS","HTTP","HTTPS","REST","RPC","JSON","YAML","XML","SQL","CSS","HTML","AWS","GCP","CDN","DNS","JWT","ID","IP","URL","URI","TS","JS"]);function gZ($){return $.split("_").map((Z)=>{if(!Z)return Z;let X=Z.toUpperCase();return YT.has(X)?X:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function I0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function f0($){let Z=O$.get($);if(Z?.label)return Z.label;let X=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return gZ(X)}var HJ="CLAUDE.md",qT="STATUS: BI-SYNC ACTIVE";function BJ($){let Z=KJ($,HJ);if(!UT(Z))return null;return WT(Z,"utf-8")}function MJ($,Z){g0(KJ($,HJ),Z)}function Y1($,Z={}){let X=String($.project?.name??"").trim(),z=String($.project?.main_language??"").trim(),J=String($.project?.type??"").trim(),Q=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[X,z,J,Q].join(" | ")} -->`,W=[];if(Z.doc)W.push(`doc=${Z.doc}`);else W.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")W.push(`score=${Z.score}`);if(W.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)W.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${W.join(" | ")} -->`;return`${Y}
236
+ ${U}`}function OJ($){let Z=[],X=$.project?.name??"Project",z=$.project?.main_language??"",J=$.project?.goal??"";if(Z.push(Y1($)),Z.push(""),Z.push(`# CLAUDE.md — ${X}`),Z.push(""),J)Z.push("## What This Is"),Z.push(""),Z.push(J),Z.push("");let Q=$.stack??{},Y=[];if(z)Y.push(`**Language:** ${z}`);for(let[q,G]of Object.entries(Q))if(G&&G!=="slotignored"&&String(G).trim())Y.push(`**${f0(`stack.${q}`)}:** ${G}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let q of Y)Z.push(`- ${q}`);Z.push("")}let W=$.human_context??{},U=[["who",W.who],["what",W.what],["why",W.why],["where",W.where],["when",W.when],["how",W.how]].filter(([,q])=>q&&String(q).trim()).map(([q,G])=>`- **${f0(`human_context.${q}`)}:** ${G}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${qT} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
237
+ `)}function VJ($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function t8($){let Z={project:{}},X=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(X)Z.project.name=VJ(X[1].trim());if(!Z.project.name){let Q=$.match(/\*\*Name:\*\*\s*(.+)/);if(Q)Z.project.name=VJ(Q[1].trim())}let z=$.match(/## What This Is\s*\n\s*\n(.+)/);if(z)Z.project.goal=z[1].trim();if(!Z.project.goal){let Q=$.match(/\*\*What Building:\*\*\s*(.+)/);if(Q)Z.project.goal=Q[1].trim()}let J=$.match(/\*\*Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim();if(!Z.project.main_language){let Q=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(Q)Z.project.main_language=Q[1].trim()}return Z}import{readFileSync as uS,writeFileSync as GT,existsSync as mS}from"fs";import{join as VT}from"path";function NJ($,Z){GT(VT($,"MEMORY.md"),Z,"utf-8")}l();function _$(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function fZ($={}){let Z=process.cwd(),X=f(Z);if(!X)console.error(`Error: project.faf not found
238
238
 
239
- Run 'faf init' to create one.`),process.exit(2);let z=KJ(Z,"CLAUDE.md"),J=KJ(Z,"MEMORY.md"),Q=$.direction??"auto";if(Q==="auto")HJ(X,z,Z);else if(Q==="push")BJ(X,Z);else if(Q==="pull")JT(X,z);if(_$())MJ(X,J,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),YT(X,z,J,Z)}function HJ($,Z,X){BJ($,X)}function BJ($,Z){let X=m($),z=qJ(X);UJ(Z,z),console.log(`${I("◆")} sync .faf → CLAUDE.md ${M("← bi-sync")}`);let J=B0(G0(u($)));Y0(J,$)}function JT($,Z){let X=B0(G0(u($)));if(X.tier.name!=="TROPHY")console.error(`${A("×")} sync --pull blocked: requires ✪ Trophy (currently ${X.score}%)`),console.error(M(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let z=WJ(zT(Z));if(!z){console.error("CLAUDE.md not found.");return}let J=X4(z),Q=m($);if(J.project?.name)Q.project={...Q.project,name:J.project.name};if(J.project?.goal)Q.project={...Q.project,goal:J.project.goal};if(J.project?.main_language)Q.project={...Q.project,main_language:J.project.main_language};$0($,Q),console.log(`${I("◆")} sync CLAUDE.md → .faf ${M("← bi-sync (Trophy-gated)")}`);let Y=B0(G0(u($)));Y0(Y,$)}function MJ($,Z,X){let z=m($),J=VJ($).mtimeMs,Q=z4(Z)?VJ(Z).mtimeMs:0;if(!z4(Z)||J>Q){let Y=QT(z);GJ(X,Y),console.log(`${I("◆")} sync .faf → MEMORY.md ${M("← tri-sync")}`)}else console.log(`${I("◆")} sync MEMORY.md → .faf ${M("← tri-sync")}`)}function QT($){let Z=$.project??{},X=[`# ${Z.name??"Project"} — Memory Topics`,"","> Authored by faf sync (tri-sync)",""];if(Z.name)X.push(`- **Project:** ${Z.name}`);if(Z.goal)X.push(`- **Goal:** ${Z.goal}`);if(Z.main_language)X.push(`- **Language:** ${Z.main_language}`);if(Z.type)X.push(`- **Type:** ${Z.type}`);return`${X.join(`
239
+ Run 'faf init' to create one.`),process.exit(2);let z=DJ(Z,"CLAUDE.md"),J=DJ(Z,"MEMORY.md"),Q=$.direction??"auto";if(Q==="auto")IJ(X,z,Z);else if(Q==="push")TJ(X,Z);else if(Q==="pull")HT(X,z);if(_$())AJ(X,J,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),MT(X,z,J,Z)}function IJ($,Z,X){TJ($,X)}function TJ($,Z){let X=m($),z=OJ(X);MJ(Z,z),console.log(`${I("◆")} sync .faf → CLAUDE.md ${M("← bi-sync")}`);let J=B0(G0(u($)));Y0(J,$)}function HT($,Z){let X=B0(G0(u($)));if(X.tier.name!=="TROPHY")console.error(`${A("×")} sync --pull blocked: requires ✪ Trophy (currently ${X.score}%)`),console.error(M(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let z=BJ(KT(Z));if(!z){console.error("CLAUDE.md not found.");return}let J=t8(z),Q=m($);if(J.project?.name)Q.project={...Q.project,name:J.project.name};if(J.project?.goal)Q.project={...Q.project,goal:J.project.goal};if(J.project?.main_language)Q.project={...Q.project,main_language:J.project.main_language};$0($,Q),console.log(`${I("◆")} sync CLAUDE.md → .faf ${M("← bi-sync (Trophy-gated)")}`);let Y=B0(G0(u($)));Y0(Y,$)}function AJ($,Z,X){let z=m($),J=LJ($).mtimeMs,Q=e8(Z)?LJ(Z).mtimeMs:0;if(!e8(Z)||J>Q){let Y=BT(z);NJ(X,Y),console.log(`${I("◆")} sync .faf → MEMORY.md ${M("← tri-sync")}`)}else console.log(`${I("◆")} sync MEMORY.md → .faf ${M("← tri-sync")}`)}function BT($){let Z=$.project??{},X=[`# ${Z.name??"Project"} — Memory Topics`,"","> Authored by faf sync (tri-sync)",""];if(Z.name)X.push(`- **Project:** ${Z.name}`);if(Z.goal)X.push(`- **Goal:** ${Z.goal}`);if(Z.main_language)X.push(`- **Language:** ${Z.main_language}`);if(Z.type)X.push(`- **Type:** ${Z.type}`);return`${X.join(`
240
240
  `)}
241
- `}function YT($,Z,X,z){let{watch:J}=C0("fs"),Q=null,Y=()=>{if(Q)clearTimeout(Q);Q=setTimeout(()=>{if(console.log(M("change detected...")),HJ($,Z,z),_$())MJ($,X,z)},200)};if(J($,Y),z4(Z))J(Z,Y);if(_$()&&z4(X))J(X,Y)}import{writeFileSync as WT}from"fs";l();function OJ($,Z={}){let X=$??f();if(!X)console.error(`Error: project.faf not found
241
+ `}function MT($,Z,X,z){let{watch:J}=C0("fs"),Q=null,Y=()=>{if(Q)clearTimeout(Q);Q=setTimeout(()=>{if(console.log(M("change detected...")),IJ($,Z,z),_$())AJ($,X,z)},200)};if(J($,Y),e8(Z))J(Z,Y);if(_$()&&e8(X))J(X,Y)}import{writeFileSync as OT}from"fs";l();function RJ($,Z={}){let X=$??f();if(!X)console.error(`Error: project.faf not found
242
242
 
243
- Run 'faf init' to create one.`),process.exit(2);let z=u(X),J=S8(z),Q=Z.output??X.replace(/\.faf$/,".fafb");WT(Q,J),console.log(`${I("compiled")} ${Q} ${M(`(${J.length} bytes)`)}`)}import{readFileSync as UT}from"fs";function NJ($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let X=new Uint8Array(UT($));if(String.fromCharCode(X[0],X[1],X[2],X[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let z=Gz(X);console.log(JSON.stringify(z,null,2))}function LJ($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let X=$;if(!X.faf_version)Z.push("Missing required field: faf_version");if(!X.project?.name)Z.push("Missing required field: project.name");if(X.app_type==="about")Z.push("about is not an app_type — declare about.represents (owner/repo) instead");if(X.about!==void 0){if(!Hz(X)||typeof X.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!Kz.test(X.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${X.about.represents})`);if(X.about.source_score!==void 0){let z=X.about.source_score;if(typeof z!=="number"||z<0||z>100)Z.push(`about.source_score must be a number 0-100 (got: ${z})`)}}return{valid:Z.length===0,errors:Z}}l();function fZ($,Z={}){let X=$??f();if(!X)console.error(`Error: project.faf not found
243
+ Run 'faf init' to create one.`),process.exit(2);let z=u(X),J=S8(z),Q=Z.output??X.replace(/\.faf$/,".fafb");OT(Q,J),console.log(`${I("compiled")} ${Q} ${M(`(${J.length} bytes)`)}`)}import{readFileSync as NT}from"fs";function _J($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let X=new Uint8Array(NT($));if(String.fromCharCode(X[0],X[1],X[2],X[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let z=Gz(X);console.log(JSON.stringify(z,null,2))}function FJ($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let X=$;if(!X.faf_version)Z.push("Missing required field: faf_version");if(!X.project?.name)Z.push("Missing required field: project.name");if(X.app_type==="about")Z.push("about is not an app_type — declare about.represents (owner/repo) instead");if(X.about!==void 0){if(!Hz(X)||typeof X.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!Kz.test(X.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${X.about.represents})`);if(X.about.source_score!==void 0){let z=X.about.source_score;if(typeof z!=="number"||z<0||z>100)Z.push(`about.source_score must be a number 0-100 (got: ${z})`)}}return{valid:Z.length===0,errors:Z}}l();function hZ($,Z={}){let X=$??f();if(!X)console.error(`Error: project.faf not found
244
244
 
245
- Run 'faf init' to create one.`),process.exit(2);let z=m(X),J=LJ(z);if(!J.valid){console.log(`${A("invalid")} ${X}`);for(let W of J.errors)console.log(` ${M("x")} ${W}`);process.exit(3)}let Q=u(X);if(!qz(Q))console.log(`${A("invalid yaml")} ${X}`),process.exit(3);console.log(`${I("valid")} ${X}`);let Y=Q0(Q);if(Y0(Y,X,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
246
- --strict requires 100%`)),process.exit(1)}import{mkdirSync as pT}from"fs";import{resolve as iT}from"path";import{join as qT}from"path";var w0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),DJ=($)=>Array.isArray($)?$.join(", "):String($),GT=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),VT=new Set(["target_user","core_problem","mission_purpose"]);function KT($){let Z=[],X=(E="")=>Z.push(E),z=$.ai_instructions,J=$.preferences,Q=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??Q?.key_files,q=w0($.project?.default_branch)?String($.project?.default_branch):"main",G=W?Object.entries(W).filter(([,E])=>w0(E)):[],V=G.filter(([E])=>/test/i.test(E)),K=G.filter(([E])=>/lint|check/i.test(E)&&!/test/i.test(E)),H=G.filter(([E])=>!/test|lint|check/i.test(E)),L=(E)=>{let d=E.toLowerCase();if(/install|deps/.test(d))return 0;if(/^build$|build/.test(d)&&!/rebuild/.test(d))return 1;if(/^dev$|develop/.test(d))return 2;if(/^start$|run/.test(d))return 3;return 4},B=[...H].sort((E,d)=>L(E[0])-L(d[0])||E[0].localeCompare(d[0])),O=[...V,...K],T=V[0]?.[1],j=B.find(([E])=>/build/i.test(E))?.[1];X(Y1($)),X(),X(`# AGENTS.md — ${$.project?.name??"Project"}`),X();let S=[];if($.project?.main_language)S.push(String($.project.main_language));if(w0($.project?.type))S.push(`type: ${String($.project?.type)}`);if(w0($.project?.version))S.push(`v${String($.project?.version)}`);let b=$.project?.goal?String($.project.goal).trim():"";if(S.length)b+=(b?" — ":"")+S.join(" · ");if(b)X(b),X();if(X("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand content outside `<!-- faf:start -->` … `<!-- faf:end -->` is preserved."),X(),B.length){X("## Setup & build"),X(),X("```bash");for(let[E,d]of B)X(`${d} # ${E}`);X("```"),X()}if(O.length){X("## Run the tests"),X(),X("```bash");for(let[,E]of O)X(E);X("```"),X()}if(U&&U.length){X("## Where things live"),X();let E=U.map((d)=>{let r=String(d),m0=r.indexOf(" — ");return m0>0?{path:r.slice(0,m0),role:r.slice(m0+3)}:{path:r,role:""}});if(E.some((d)=>d.role)){X("| Path | Role |"),X("|------|------|");for(let d of E)X(`| \`${d.path}\` | ${d.role} |`)}else for(let d of E)X(`- \`${d.path}\``);X()}let y=new Map,x=(E)=>{if(!E)return;for(let[d,r]of Object.entries(E)){if(GT.has(d)||!w0(r))continue;let m0=vZ(d);if(!y.has(m0))y.set(m0,DJ(r))}};x(z?.working_style),x(J);let c=$.conventions??[];if(y.size||c.length){X("## Conventions"),X();for(let[E,d]of y)X(`- **${E}:** ${d}`);for(let E of c)if(w0(E))X(`- ${E}`);X()}let _=(z?.warnings??[]).filter((E)=>w0(E)),n=["read the tree"];if(T)n.push(`run the tests (\`${T}\`)`);if(j)n.push("build the project");for(let[,E]of K.slice(0,1))n.push(`\`${E}\``);X("## Guardrails"),X();for(let E of _)X(`- ${E}`);X(`- **Always OK:** ${[...new Set(n)].join(" · ")}.`),X("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),X(`- **Never:** force-push · push straight to \`${q}\` (branch and open a PR) · commit secrets.`),X();let p=[];for(let[,E]of K)p.push(`\`${E}\` exits 0`);for(let[,E]of V)p.push(`\`${E}\` passes`);if(p.push("changes committed with a conventional message"),X("## Definition of Done"),X(),X(`Done when: ${[...new Set(p)].join(" · ")}.`),X(),X("## When stuck"),X(),X(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${q}\`.`),X(),Y&&(w0(Y.secrets)||(Y.never??[]).length)){if(X("## Security & secrets"),X(),w0(Y.secrets)){let E=w0(Y.example)?` (see \`${Y.example}\`)`:"";X(`- Secrets live in \`${Y.secrets}\`${E}. Never read or commit them.`)}for(let E of Y.never??[])if(w0(E))X(`- Never read or commit \`${E}\`.`);X()}if(X("## Commit & PR"),X(),J&&w0(J.commit_style))X(`- Commit style: ${DJ(J.commit_style)}`);else X("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(X(`- Branch off \`${q}\` and open a PR — never commit to \`${q}\` directly.`),X("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),X(),$.stack){let E=[];for(let[d,r]of Object.entries($.stack)){if(VT.has(d))continue;if(I0(r))E.push(`- **${f0(`stack.${d}`)}:** ${r.trim()}`)}if(E.length){X("## Stack"),X();for(let d of E)X(d);X()}}let A0=$.generated;if(w0(A0))X(`*Context authored: ${String(A0)}*`);return Z.join(`
247
- `)}function IJ($,Z){g0(qT($,"AGENTS.md"),KT(Z))}import{existsSync as J4,readFileSync as TJ}from"fs";import{join as f2}from"path";function HT($,Z){let X=[],z=(U)=>J4(f2($,U)),J=(U)=>{try{return TJ(f2($,U),"utf-8")}catch{return""}};if(z("tsconfig.json")&&/"strict"\s*:\s*true/.test(J("tsconfig.json")))X.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")X.push("ESM modules (`type: module`)");let Q=[],Y=Z?.devDependencies??{};if(z(".eslintrc")||z(".eslintrc.json")||z(".eslintrc.cjs")||z("eslint.config.js")||z("eslint.config.mjs")||"eslint"in Y)Q.push("ESLint");if(z(".prettierrc")||z(".prettierrc.json")||z("prettier.config.js")||"prettier"in Y)Q.push("Prettier");let W=z("pyproject.toml")?J("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))Q.push("black");if(/\[tool\.ruff\]/.test(W))Q.push("ruff");if(/\[tool\.mypy\]/.test(W))Q.push("mypy");if(z("rustfmt.toml")||z(".rustfmt.toml"))Q.push("rustfmt");if(Q.length)X.push(`Style enforced by ${Q.join(" · ")} — obey the configs`);return X}function hZ($,Z){let X={...Z},z=null,J=f2($,"package.json");if(J4(J))try{z=JSON.parse(TJ(J,"utf-8"))}catch{z=null}let Q=p8($,z);if(Object.keys(Q).length)X.commands={...Q,...Z.commands??{}};let Y=Z.key_files??Z.instant_context?.key_files;if(!Y||Y.length===0){let W=d8($);if(W.length)X.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((q)=>J4(f2($,q)));if(U){let q=[".env.example",".env.sample",".env.template"].find((G)=>J4(f2($,G)));X.security={secrets:U,...q?{example:q}:{}}}}if(!Z.conventions){let W=HT($,z);if(W.length)X.conventions=W}return X}import{join as BT}from"path";function MT($){let Z=[];if(Z.push(Y1($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Authored from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[X,z]of Object.entries($.stack))if(I0(z))Z.push(`# ${f0(`stack.${X}`)}: ${z.trim()}`)}return Z.push(""),Z.join(`
248
- `)}function AJ($,Z){g0(BT($,".cursorrules"),MT(Z),"# faf:start","# faf:end")}import{join as OT}from"path";var NT=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),LT=new Set(["target_user","core_problem","mission_purpose"]);function DT($){let Z=[],X=$.instant_context,z=$.commands,J=$.key_files??X?.key_files,Q=z?Object.entries(z).filter(([,K])=>NT(K)):[],Y=Q.filter(([K])=>/test/i.test(K)),W=Q.filter(([K])=>/lint|check/i.test(K)&&!/test/i.test(K)),U=Q.filter(([K])=>!/test|lint|check/i.test(K)),q=(K)=>{let H=K.toLowerCase();if(/install|deps/.test(H))return 0;if(/^build$|build/.test(H)&&!/rebuild/.test(H))return 1;if(/^dev$|develop/.test(H))return 2;if(/^start$|run/.test(H))return 3;return 4},G=[...U].sort((K,H)=>q(K[0])-q(H[0])||K[0].localeCompare(H[0])),V=[...Y,...W];if(Z.push(Y1($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Authored from project.faf — refresh with `faf export --gemini`."),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if(G.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[K,H]of G)Z.push(`${H} # ${K}`);Z.push("```")}if(V.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,K]of V)Z.push(K);Z.push("```")}if(J&&J.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let K of J)Z.push(`- \`${K}\``)}if($.stack){let K=[];for(let[H,L]of Object.entries($.stack)){if(LT.has(H))continue;if(I0(L))K.push(`- ${f0(`stack.${H}`)}: ${L.trim()}`)}if(K.length){Z.push(""),Z.push("## Stack");for(let H of K)Z.push(H)}}return Z.push(""),Z.push("## Before changing things"),Z.push(""),Z.push("- Ask first: dependency installs, deletions, migrations, schema changes, publish/release."),Z.push("- Never: force-push · push straight to `main` · commit secrets."),Z.push(""),Z.join(`
249
- `)}function RJ($,Z){g0(OT($,"GEMINI.md"),DT(Z))}import{join as _J}from"path";import{mkdirSync as IT}from"fs";var FJ=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],TT=new Set([...FJ.map(([$])=>$),"cicd"]);function AT($){let Z=[],X=$.project?.name??"Project";if(Z.push(Y1($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${X}`),Z.push(""),Z.push("> Authored from project.faf by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable."),Z.push(""),I0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let z=$.stack??{},J=[];if(I0($.project?.main_language))J.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[q,G]of Object.entries(z)){if(TT.has(q))continue;if(I0(G))J.push(`- **${f0(`stack.${q}`)}:** ${G.trim()}`)}if(J.length>0)Z.push("## Tech stack","",...J,"");let Q=[];for(let[q,G]of FJ){let V=z[q];if(I0(V))Q.push(`- ${G} \`${V.trim()}\`.`)}if(I0(z.cicd))Q.push(`- CI runs on ${z.cicd.trim()}.`);if(Q.length>0)Z.push("## Build & run","",...Q,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,q])=>I0(q)).map(([q,G])=>`- **${f0(`human_context.${q}`)}:** ${G.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
250
- `)}function CJ($,Z){IT(_J($,".github"),{recursive:!0}),g0(_J($,".github","copilot-instructions.md"),AT(Z))}import{existsSync as RT,mkdirSync as _T,readFileSync as FT,writeFileSync as EJ}from"fs";import{join as PJ}from"path";var CT="https://mcpaas.live/grok/mcp/v1",wJ="mcp_servers.grok-faf-mcp";function ET($){return[`[${wJ}]`,`url = "${CT}"`,""].join(`
251
- `)}function SJ($,Z){let X=PJ($,".grok"),z=PJ(X,"config.toml"),J=ET(Z);if(!RT(z))return _T(X,{recursive:!0}),EJ(z,`# grok-faf-mcp — wired by FAF from project.faf
245
+ Run 'faf init' to create one.`),process.exit(2);let z=m(X),J=FJ(z);if(!J.valid){console.log(`${A("invalid")} ${X}`);for(let W of J.errors)console.log(` ${M("x")} ${W}`);process.exit(3)}let Q=u(X);if(!qz(Q))console.log(`${A("invalid yaml")} ${X}`),process.exit(3);console.log(`${I("valid")} ${X}`);let Y=Q0(Q);if(Y0(Y,X,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
246
+ --strict requires 100%`)),process.exit(1)}import{mkdirSync as ZA}from"fs";import{resolve as XA}from"path";import{join as LT}from"path";var w0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),CJ=($)=>Array.isArray($)?$.join(", "):String($),DT=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),IT=new Set(["target_user","core_problem","mission_purpose"]);function TT($){let Z=[],X=(P="")=>Z.push(P),z=$.ai_instructions,J=$.preferences,Q=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??Q?.key_files,q=w0($.project?.default_branch)?String($.project?.default_branch):"main",G=W?Object.entries(W).filter(([,P])=>w0(P)):[],V=G.filter(([P])=>/test/i.test(P)),K=G.filter(([P])=>/lint|check/i.test(P)&&!/test/i.test(P)),H=G.filter(([P])=>!/test|lint|check/i.test(P)),L=(P)=>{let d=P.toLowerCase();if(/install|deps/.test(d))return 0;if(/^build$|build/.test(d)&&!/rebuild/.test(d))return 1;if(/^dev$|develop/.test(d))return 2;if(/^start$|run/.test(d))return 3;return 4},B=[...H].sort((P,d)=>L(P[0])-L(d[0])||P[0].localeCompare(d[0])),O=[...V,...K],T=V[0]?.[1],j=B.find(([P])=>/build/i.test(P))?.[1];X(Y1($)),X(),X(`# AGENTS.md — ${$.project?.name??"Project"}`),X();let S=[];if($.project?.main_language)S.push(String($.project.main_language));if(w0($.project?.type))S.push(`type: ${String($.project?.type)}`);if(w0($.project?.version))S.push(`v${String($.project?.version)}`);let b=$.project?.goal?String($.project.goal).trim():"";if(S.length)b+=(b?" — ":"")+S.join(" · ");if(b)X(b),X();if(X("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand-written content outside the managed block is preserved."),X(),B.length){X("## Setup & build"),X(),X("```bash");for(let[P,d]of B)X(`${d} # ${P}`);X("```"),X()}if(O.length){X("## Run the tests"),X(),X("```bash");for(let[,P]of O)X(P);X("```"),X()}if(U&&U.length){X("## Where things live"),X();let P=U.map((d)=>{let r=String(d),m0=r.indexOf(" — ");return m0>0?{path:r.slice(0,m0),role:r.slice(m0+3)}:{path:r,role:""}});if(P.some((d)=>d.role)){X("| Path | Role |"),X("|------|------|");for(let d of P)X(`| \`${d.path}\` | ${d.role} |`)}else for(let d of P)X(`- \`${d.path}\``);X()}let y=new Map,x=(P)=>{if(!P)return;for(let[d,r]of Object.entries(P)){if(DT.has(d)||!w0(r))continue;let m0=gZ(d);if(!y.has(m0))y.set(m0,CJ(r))}};x(z?.working_style),x(J);let c=$.conventions??[];if(y.size||c.length){X("## Conventions"),X();for(let[P,d]of y)X(`- **${P}:** ${d}`);for(let P of c)if(w0(P))X(`- ${P}`);X()}let _=(z?.warnings??[]).filter((P)=>w0(P)),n=["read the tree"];if(T)n.push(`run the tests (\`${T}\`)`);if(j)n.push("build the project");for(let[,P]of K.slice(0,1))n.push(`\`${P}\``);X("## Guardrails"),X();for(let P of _)X(`- ${P}`);X(`- **Always OK:** ${[...new Set(n)].join(" · ")}.`),X("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),X(`- **Never:** force-push · push straight to \`${q}\` (branch and open a PR) · commit secrets.`),X();let p=[];for(let[,P]of K)p.push(`\`${P}\` exits 0`);for(let[,P]of V)p.push(`\`${P}\` passes`);if(p.push("changes committed with a conventional message"),X("## Definition of Done"),X(),X(`Done when: ${[...new Set(p)].join(" · ")}.`),X(),X("## When stuck"),X(),X(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${q}\`.`),X(),Y&&(w0(Y.secrets)||(Y.never??[]).length)){if(X("## Security & secrets"),X(),w0(Y.secrets)){let P=w0(Y.example)?` (see \`${Y.example}\`)`:"";X(`- Secrets live in \`${Y.secrets}\`${P}. Never read or commit them.`)}for(let P of Y.never??[])if(w0(P))X(`- Never read or commit \`${P}\`.`);X()}if(X("## Commit & PR"),X(),J&&w0(J.commit_style))X(`- Commit style: ${CJ(J.commit_style)}`);else X("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(X(`- Branch off \`${q}\` and open a PR — never commit to \`${q}\` directly.`),X("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),X(),$.stack){let P=[];for(let[d,r]of Object.entries($.stack)){if(IT.has(d))continue;if(I0(r))P.push(`- **${f0(`stack.${d}`)}:** ${r.trim()}`)}if(P.length){X("## Stack"),X();for(let d of P)X(d);X()}}let A0=$.generated;if(w0(A0))X(`*Context authored: ${String(A0)}*`);return Z.join(`
247
+ `)}function PJ($,Z){g0(LT($,"AGENTS.md"),TT(Z))}import{existsSync as $4,readFileSync as EJ}from"fs";import{join as f2}from"path";function AT($,Z){let X=[],z=(U)=>$4(f2($,U)),J=(U)=>{try{return EJ(f2($,U),"utf-8")}catch{return""}};if(z("tsconfig.json")&&/"strict"\s*:\s*true/.test(J("tsconfig.json")))X.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")X.push("ESM modules (`type: module`)");let Q=[],Y=Z?.devDependencies??{};if(z(".eslintrc")||z(".eslintrc.json")||z(".eslintrc.cjs")||z("eslint.config.js")||z("eslint.config.mjs")||"eslint"in Y)Q.push("ESLint");if(z(".prettierrc")||z(".prettierrc.json")||z("prettier.config.js")||"prettier"in Y)Q.push("Prettier");let W=z("pyproject.toml")?J("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))Q.push("black");if(/\[tool\.ruff\]/.test(W))Q.push("ruff");if(/\[tool\.mypy\]/.test(W))Q.push("mypy");if(z("rustfmt.toml")||z(".rustfmt.toml"))Q.push("rustfmt");if(Q.length)X.push(`Style enforced by ${Q.join(" · ")} — obey the configs`);return X}function uZ($,Z){let X={...Z},z=null,J=f2($,"package.json");if($4(J))try{z=JSON.parse(EJ(J,"utf-8"))}catch{z=null}let Q=p8($,z);if(Object.keys(Q).length)X.commands={...Q,...Z.commands??{}};let Y=Z.key_files??Z.instant_context?.key_files;if(!Y||Y.length===0){let W=d8($);if(W.length)X.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((q)=>$4(f2($,q)));if(U){let q=[".env.example",".env.sample",".env.template"].find((G)=>$4(f2($,G)));X.security={secrets:U,...q?{example:q}:{}}}}if(!Z.conventions){let W=AT($,z);if(W.length)X.conventions=W}return X}import{join as RT}from"path";function _T($){let Z=[];if(Z.push(Y1($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Authored from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[X,z]of Object.entries($.stack))if(I0(z))Z.push(`# ${f0(`stack.${X}`)}: ${z.trim()}`)}return Z.push(""),Z.join(`
248
+ `)}function wJ($,Z){g0(RT($,".cursorrules"),_T(Z),"# faf:start","# faf:end")}import{join as FT}from"path";var CT=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),PT=new Set(["target_user","core_problem","mission_purpose"]);function ET($){let Z=[],X=$.instant_context,z=$.commands,J=$.key_files??X?.key_files,Q=z?Object.entries(z).filter(([,K])=>CT(K)):[],Y=Q.filter(([K])=>/test/i.test(K)),W=Q.filter(([K])=>/lint|check/i.test(K)&&!/test/i.test(K)),U=Q.filter(([K])=>!/test|lint|check/i.test(K)),q=(K)=>{let H=K.toLowerCase();if(/install|deps/.test(H))return 0;if(/^build$|build/.test(H)&&!/rebuild/.test(H))return 1;if(/^dev$|develop/.test(H))return 2;if(/^start$|run/.test(H))return 3;return 4},G=[...U].sort((K,H)=>q(K[0])-q(H[0])||K[0].localeCompare(H[0])),V=[...Y,...W];if(Z.push(Y1($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Authored from project.faf — refresh with `faf export --gemini`."),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if(G.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[K,H]of G)Z.push(`${H} # ${K}`);Z.push("```")}if(V.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,K]of V)Z.push(K);Z.push("```")}if(J&&J.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let K of J)Z.push(`- \`${K}\``)}if($.stack){let K=[];for(let[H,L]of Object.entries($.stack)){if(PT.has(H))continue;if(I0(L))K.push(`- ${f0(`stack.${H}`)}: ${L.trim()}`)}if(K.length){Z.push(""),Z.push("## Stack");for(let H of K)Z.push(H)}}return Z.push(""),Z.push("## Before changing things"),Z.push(""),Z.push("- Ask first: dependency installs, deletions, migrations, schema changes, publish/release."),Z.push("- Never: force-push · push straight to `main` · commit secrets."),Z.push(""),Z.join(`
249
+ `)}function SJ($,Z){g0(FT($,"GEMINI.md"),ET(Z))}import{join as jJ}from"path";import{mkdirSync as wT}from"fs";var xJ=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],ST=new Set([...xJ.map(([$])=>$),"cicd"]);function jT($){let Z=[],X=$.project?.name??"Project";if(Z.push(Y1($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${X}`),Z.push(""),Z.push("> Authored from project.faf by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable."),Z.push(""),I0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let z=$.stack??{},J=[];if(I0($.project?.main_language))J.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[q,G]of Object.entries(z)){if(ST.has(q))continue;if(I0(G))J.push(`- **${f0(`stack.${q}`)}:** ${G.trim()}`)}if(J.length>0)Z.push("## Tech stack","",...J,"");let Q=[];for(let[q,G]of xJ){let V=z[q];if(I0(V))Q.push(`- ${G} \`${V.trim()}\`.`)}if(I0(z.cicd))Q.push(`- CI runs on ${z.cicd.trim()}.`);if(Q.length>0)Z.push("## Build & run","",...Q,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,q])=>I0(q)).map(([q,G])=>`- **${f0(`human_context.${q}`)}:** ${G.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
250
+ `)}function bJ($,Z){wT(jJ($,".github"),{recursive:!0}),g0(jJ($,".github","copilot-instructions.md"),jT(Z))}import{existsSync as xT,mkdirSync as bT,readFileSync as kT,writeFileSync as kJ}from"fs";import{join as yJ}from"path";var yT="https://mcpaas.live/grok/mcp/v1",vJ="mcp_servers.grok-faf-mcp";function vT($){return[`[${vJ}]`,`url = "${yT}"`,""].join(`
251
+ `)}function gJ($,Z){let X=yJ($,".grok"),z=yJ(X,"config.toml"),J=vT(Z);if(!xT(z))return bT(X,{recursive:!0}),kJ(z,`# grok-faf-mcp — wired by FAF from project.faf
252
252
 
253
- `+J,"utf-8"),"created";let Q=FT(z,"utf-8");if(Q.includes(`[${wJ}]`))return"unchanged";let Y=Q.endsWith(`
253
+ `+J,"utf-8"),"created";let Q=kT(z,"utf-8");if(Q.includes(`[${vJ}]`))return"unchanged";let Y=Q.endsWith(`
254
254
 
255
255
  `)?"":Q.endsWith(`
256
256
  `)?`
257
257
  `:`
258
258
 
259
- `;return EJ(z,Q+Y+J,"utf-8"),"merged"}import{join as PT}from"path";var wT=[{key:"who",heading:"Who"},{key:"what",heading:"What"},{key:"why",heading:"Why"},{key:"where",heading:"Where"},{key:"when",heading:"When"},{key:"how",heading:"How"}];function mZ($){if(!I0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function uZ($,Z){if(!$)return null;return mZ($[Z])}function ST($){let Z=[],X=mZ($.project?.name)??"Project",z=mZ($.project?.goal);if(Z.push(`# ${X}`),Z.push(""),z)Z.push(`> ${z}`),Z.push("");let J=$.human_context;for(let{key:Y,heading:W}of wT){let U=uZ(J,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let Q=uZ($.project,"homepage")??uZ($.project,"url");if(Q&&/^(https?:)?\/\//i.test(Q))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${Q})`),Z.push("");return`${Z.join(`
259
+ `;return kJ(z,Q+Y+J,"utf-8"),"merged"}import{join as gT}from"path";var fT=[{key:"who",heading:"Who"},{key:"what",heading:"What"},{key:"why",heading:"Why"},{key:"where",heading:"Where"},{key:"when",heading:"When"},{key:"how",heading:"How"}];function cZ($){if(!I0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function mZ($,Z){if(!$)return null;return cZ($[Z])}function hT($){let Z=[],X=cZ($.project?.name)??"Project",z=cZ($.project?.goal);if(Z.push(`# ${X}`),Z.push(""),z)Z.push(`> ${z}`),Z.push("");let J=$.human_context;for(let{key:Y,heading:W}of fT){let U=mZ(J,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let Q=mZ($.project,"homepage")??mZ($.project,"url");if(Q&&/^(https?:)?\/\//i.test(Q))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${Q})`),Z.push("");return`${Z.join(`
260
260
  `).trimEnd()}
261
- `}function jJ($,Z){g0(PT($,"llms.txt"),ST(Z))}l();import{writeFileSync as jT}from"fs";import{join as xT}from"path";var xJ=R2.orange,bT=R2.cyan,kT=R2.cyanDeep,yT="#FF9500",vT="#FF3B30",gT="#E6EDF3",fT="#6E7681",bJ={TROPHY:{glyph:"✪",color:xJ},GOLD:{glyph:"★",color:xJ},SILVER:{glyph:"◆",color:bT},BRONZE:{glyph:"◇",color:kT},GREEN:{glyph:"●",color:gT},YELLOW:{glyph:"●",color:yT},RED:{glyph:"○",color:vT},WHITE:{glyph:"♡",color:fT}};function F$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var kJ=["who","what","why","where","when","how"];function Q4($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,X])=>`<div class="row"><div class="k">${F$(Z)}</div><div class="v">${F$(X)}</div></div>`).join(`
262
- `)}function hT($,Z,X="project.faf"){let z=F$($.project?.name??"Project"),J=Z.tier?.name??"WHITE",Q=bJ[J]??bJ.WHITE,Y=Z.inherited?Z.represents?`inherited from ${F$(Z.represents)}`:"inherited":`${Z.score}%`,W=J==="TROPHY"&&!Z.inherited,U=$.human_context??{},q=kJ.map((B)=>[B,U[B]]),G=Object.entries(U).filter(([B])=>!kJ.includes(B)),V=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],K=Object.entries($.stack??{}),H=K.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=K.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
261
+ `}function fJ($,Z){g0(gT($,"llms.txt"),hT(Z))}l();import{writeFileSync as uT}from"fs";import{join as mT}from"path";import{deprecate as cT}from"node:util";var hJ=R2.orange,lT=R2.cyan,dT=R2.cyanDeep,pT="#FF9500",iT="#FF3B30",nT="#E6EDF3",rT="#6E7681",uJ={TROPHY:{glyph:"✪",color:hJ},GOLD:{glyph:"★",color:hJ},SILVER:{glyph:"◆",color:lT},BRONZE:{glyph:"◇",color:dT},GREEN:{glyph:"●",color:nT},YELLOW:{glyph:"●",color:pT},RED:{glyph:"○",color:iT},WHITE:{glyph:"♡",color:rT}};function F$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var mJ=["who","what","why","where","when","how"];function Z4($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,X])=>`<div class="row"><div class="k">${F$(Z)}</div><div class="v">${F$(X)}</div></div>`).join(`
262
+ `)}function cJ($,Z,X="project.faf"){let z=F$($.project?.name??"Project"),J=Z.tier?.name??"WHITE",Q=uJ[J]??uJ.WHITE,Y=Z.inherited?Z.represents?`inherited from ${F$(Z.represents)}`:"inherited":`${Z.score}%`,W=J==="TROPHY"&&!Z.inherited,U=$.human_context??{},q=mJ.map((B)=>[B,U[B]]),G=Object.entries(U).filter(([B])=>!mJ.includes(B)),V=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],K=Object.entries($.stack??{}),H=K.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=K.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
263
263
  <html lang="en">
264
264
  <head>
265
265
  <meta charset="UTF-8">
@@ -308,18 +308,18 @@ ${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots fill
308
308
 
309
309
  <section>
310
310
  <h2>The 6 W's</h2>
311
- ${Q4(q)||'<p class="muted">No human_context yet.</p>'}
312
- ${G.length?Q4(G):""}
311
+ ${Z4(q)||'<p class="muted">No human_context yet.</p>'}
312
+ ${G.length?Z4(G):""}
313
313
  </section>
314
314
 
315
315
  <section>
316
316
  <h2>Project</h2>
317
- ${Q4(V)||'<p class="muted">—</p>'}
317
+ ${Z4(V)||'<p class="muted">—</p>'}
318
318
  </section>
319
319
 
320
320
  <section>
321
321
  <h2>Stack</h2>
322
- ${H.length?Q4(H):'<p class="muted">No active stack slots.</p>'}
322
+ ${H.length?Z4(H):'<p class="muted">No active stack slots.</p>'}
323
323
  </section>
324
324
 
325
325
  <footer>
@@ -329,76 +329,76 @@ Rendered on-demand from your current <strong>${F$(X)}</strong><br>
329
329
  </div>
330
330
  </body>
331
331
  </html>
332
- `}function Y4($,Z,X,z="project.faf"){jT(xT($,"project.html"),hT(Z,X,z),"utf-8")}import{writeFileSync as uT}from"fs";import{join as mT}from"path";var yJ="application/vnd.faf+yaml",cT="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",lT=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function gJ($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&lT.test(Z))return Z;let X=$.project?.homepage??$.project?.website??$.project?.url,z="local";if(X)try{z=new URL(X).hostname.replace(/^www\./,"").split(".").reverse().join(".")}catch{}let J=Z.replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")||"project";return`${z}/${J}`}function dT($){let Z=String($.project?.goal??$.context??$.project?.name??"MCP server").replace(/\s+/g," ").trim();if(!Z)return"MCP server";return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function h2($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:yJ,iana:`https://www.iana.org/assignments/media-types/${yJ}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function cZ($,Z={}){let X={$schema:cT,name:gJ($),version:String($.project?.version??"0.1.0"),description:dT($)},z=dZ($)??$.project?.name;if(z&&z.length<=100)X.title=z;let J=$.project?.homepage??$.project?.website??$.project?.url;if(J)X.websiteUrl=J;if(Z.remoteUrl)X.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return X._meta={"one.faf/context":h2($,Z)},X}var lZ="io.modelcontextprotocol.registry/publisher-provided",vJ=4096;function fJ($,Z={}){let X={"one.faf/context":h2($,Z)},z=new TextEncoder().encode(JSON.stringify(X)).length;if(z>vJ)throw Error(`publisher-provided _meta is ${z}B — exceeds the registry ${vJ}B cap`);return{[lZ]:X}}function hJ($){return gJ($)}function dZ($){let Z=$.project?.title;if(typeof Z==="string"){let X=Z.trim();if(X&&X.length<=100)return X}return}function uJ($,Z,X={}){let z=cZ(Z,X),J=mT($,"server-card");return uT(J,`${JSON.stringify(z,null,2)}
333
- `,"utf-8"),J}l();function i1($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
332
+ `}function X4($,Z,X,z="project.faf"){uT(mT($,"project.html"),cJ(Z,X,z),"utf-8")}var ej=cT(cJ,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{writeFileSync as sT}from"fs";import{join as aT}from"path";import{deprecate as oT}from"node:util";var lJ="application/vnd.faf+yaml",tT="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",eT=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function pJ($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&eT.test(Z))return Z;let X=$.project?.homepage??$.project?.website??$.project?.url,z="local";if(X)try{z=new URL(X).hostname.replace(/^www\./,"").split(".").reverse().join(".")}catch{}let J=Z.replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")||"project";return`${z}/${J}`}function $A($){let Z=String($.project?.goal??$.context??$.project?.name??"MCP server").replace(/\s+/g," ").trim();if(!Z)return"MCP server";return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function h2($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:lJ,iana:`https://www.iana.org/assignments/media-types/${lJ}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function z4($,Z={}){let X={$schema:tT,name:pJ($),version:String($.project?.version??"0.1.0"),description:$A($)},z=dZ($)??$.project?.name;if(z&&z.length<=100)X.title=z;let J=$.project?.homepage??$.project?.website??$.project?.url;if(J)X.websiteUrl=J;if(Z.remoteUrl)X.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return X._meta={"one.faf/context":h2($,Z)},X}var lZ="io.modelcontextprotocol.registry/publisher-provided",dJ=4096;function iJ($,Z={}){let X={"one.faf/context":h2($,Z)},z=new TextEncoder().encode(JSON.stringify(X)).length;if(z>dJ)throw Error(`publisher-provided _meta is ${z}B — exceeds the registry ${dJ}B cap`);return{[lZ]:X}}function nJ($){return pJ($)}function dZ($){let Z=$.project?.title;if(typeof Z==="string"){let X=Z.trim();if(X&&X.length<=100)return X}return}function rJ($,Z,X={}){let z=z4(Z,X),J=aT($,"server-card");return sT(J,`${JSON.stringify(z,null,2)}
333
+ `,"utf-8"),J}var Jx=oT(z4,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");l();function i1($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
334
334
 
335
- Run 'faf init' to create one.`),process.exit(2);let X=$.output?iT(process.cwd(),$.output):process.cwd();if($.output)pT(X,{recursive:!0});let z=m(Z),J=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card;if(J||$.agents)IJ(X,hZ(X,z)),console.log(" AGENTS.md");if(J||$.cursor)AJ(X,z),console.log(" .cursorrules");if(J||$.gemini)RJ(X,hZ(X,z)),console.log(" GEMINI.md");if(J||$.copilot)CJ(X,z),console.log(" .github/copilot-instructions.md");if($.grok){let Y=SJ(X,z);console.log(` .grok/config.toml (${Y})`)}if($.llms)jJ(X,z),console.log(" llms.txt");if(J||$.html){let Y=Q0(u(Z));Y4(X,z,Y,Z),console.log(" project.html")}let Q=z.app_type==="server-card"||z.project?.type==="server-card";if($.card||J&&Q){let Y=uJ(X,z);console.log(` ${Y.replace(`${X}/`,"")}`)}console.log(`${I("exported")} ${M(`from ${Z}`)}`)}import{existsSync as sJ,readFileSync as YA,writeFileSync as WA}from"fs";import{resolve as nZ}from"path";import{existsSync as mJ,mkdirSync as nT,readFileSync as rT,writeFileSync as sT}from"fs";import{dirname as lJ,join as cJ}from"path";var aT="https://faf.one/context",oT="JSONRPC",dJ="1.0",pZ=["a2a","mcp","registry","catalog"];function pJ($){return D0(rT($,"utf-8"))}function iJ($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let z of Z){let J=cJ($,z);if(mJ(J))return J}let X=lJ($);if(X!==$)for(let z of Z){let J=cJ(X,z);if(mJ(J))return J}return null}function tT($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function iZ($,Z={}){let X=tT($);if(X.length>0)return X;let z=Z.doorUrl?.trim();if(z)return[{protocol:"a2a",location:z,version:dJ}];return[]}function eT($,Z,X={}){let z=$.agent??{},J=iZ($,X);if(J.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let Q=String(z.displayName??$.metadata?.persona??z.name??"").trim(),Y=String(z.description??"").trim(),W=String(z.version??"").trim(),U=String(z.vendor??"").trim(),q=String(z.homepage??"").trim();if(!Q||!Y||!W||!U||!q)throw Error("A2A card needs agent.displayName|name, description, version, vendor, homepage in .fafa");let G=h2(Z,X),V=($.capabilities??[]).map((K)=>{let H=String(K.name??"").trim();if(!H)throw Error("A2A skill missing capabilities[].name");let L=Array.isArray(K.tags)?K.tags.map(String):[];return{id:H,name:H,description:String(K.description??"").trim()||H,tags:L}});return{name:Q,description:Y,supportedInterfaces:J.map((K)=>({url:String(K.location),protocolBinding:oT,protocolVersion:String(K.version??dJ)})),provider:{organization:U,url:q},version:W,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[{uri:aT,description:"FAF context provenance — the durable context block (one context, every door).",required:!1,params:G}]},defaultInputModes:["text/plain","application/json"],defaultOutputModes:["text/plain","application/json"],skills:V}}function $A($){let Z=$.agent?.homepage;if(!Z)return"local";try{return new URL(Z).hostname.replace(/^www\./,"")}catch{return"local"}}function ZA($,Z){if(Z.a2aCardUrl)return Z.a2aCardUrl;let X=$.agent?.homepage;if(X)try{return new URL("/.well-known/agent-card.json",X).href}catch{}return"/.well-known/agent-card.json"}function XA($,Z,X={}){let z=$A($),J=$.agent??{},Q=String(J.name??"agent"),Y=X.now??Z.generated??new Date().toISOString(),W=[];if(iZ($,X).length>0)W.push({identifier:`urn:air:${z}:a2a:${Q}`,displayName:String(J.displayName??J.name??"A2A Agent Card"),type:"application/a2a-agent-card+json",description:"A2A v1.0 Agent Card. Projected from .fafa.",url:ZA($,X),updatedAt:Y});let U=zA($,"fafa");if(U)W.push({identifier:`urn:air:${z}:agent:${Q}`,displayName:String(J.displayName??J.name??".fafa"),type:"application/vnd.fafa+yaml",description:"FAF agent passport (.fafa).",url:U,updatedAt:Y});return W}function zA($,Z){let X=$.agent?.homepage;if(!X)return;try{return new URL(`/.well-known/${Z}`,X).href}catch{return}}function JA($,Z){let X=$.findIndex((z)=>z.identifier===Z.identifier);if(X>=0)return X;if(Z.type==="application/a2a-agent-card+json"||Z.type==="application/json"||Z.identifier.includes(":a2a:"))return $.findIndex((z)=>z.identifier.includes(":a2a:")||z.type==="application/a2a-agent-card+json"||String(z.url??"").includes("agent-card.json"));if(Z.type==="application/vnd.fafa+yaml")return $.findIndex((z)=>z.type==="application/vnd.fafa+yaml");return-1}function nJ($,Z){let X=$?{...$,entries:[...$.entries??[]]}:{specVersion:"1.0",entries:[]};for(let z of Z){let J=JA(X.entries,z);if(J>=0)X.entries[J]={...X.entries[J],url:z.url,type:z.type,...z.updatedAt?{updatedAt:z.updatedAt}:{}};else X.entries.push(z)}return X}function W4($){let Z=$.opts??{},X=new Set($.targets?.length?$.targets:pZ),J={block:h2($.faf,Z)};if(X.has("mcp"))J.mcp=cZ($.faf,Z);if(X.has("registry")){let Q=dZ($.faf);J.registry={name:hJ($.faf),...Q?{title:Q}:{},_meta:fJ($.faf,Z)}}if(X.has("a2a")||X.has("catalog")){if(!$.fafa){if($.targets?.includes("a2a")||$.targets?.includes("catalog"))throw Error("A2A/catalog require a .fafa (agent.fafa). Will not invent an agent.")}}if(X.has("a2a")&&$.fafa)if(iZ($.fafa,Z).length===0){if($.targets?.includes("a2a"))throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.")}else J.a2a=eT($.fafa,$.faf,Z);if(X.has("catalog")&&$.fafa)J.catalog=XA($.fafa,$.faf,Z);return QA(J),J}function QA($){let Z=JSON.stringify($.block),X=[];if($.a2a)X.push(JSON.stringify($.a2a.capabilities.extensions[0].params));if($.mcp){let z=$.mcp._meta;X.push(JSON.stringify(z["one.faf/context"]))}if($.registry){let z=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];X.push(JSON.stringify(z["one.faf/context"]))}for(let z of X)if(z!==Z)throw Error("context block drifted across card targets — one projector, one block")}function u2($,Z){nT(lJ($),{recursive:!0}),sT($,`${JSON.stringify(Z,null,2)}
336
- `,"utf-8")}function rJ($){if(!$)return;let Z=$.split(",").map((z)=>z.trim().toLowerCase()).filter(Boolean),X=Z.filter((z)=>!pZ.includes(z));if(X.length)throw Error(`unknown card target: ${X.join(", ")} (use ${pZ.join(",")})`);return Z}l();var UA=["$schema","name","title","description","icons","version","repository","websiteUrl","packages","remotes","_meta"];function aJ($={}){let Z=$.faf?nZ($.faf):f();if(!Z||!sJ(Z))console.error(`Error: project.faf not found
335
+ Run 'faf init' to create one.`),process.exit(2);let X=$.output?XA(process.cwd(),$.output):process.cwd();if($.output)ZA(X,{recursive:!0});let z=m(Z),J=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card;if(J||$.agents)PJ(X,uZ(X,z)),console.log(" AGENTS.md");if(J||$.cursor)wJ(X,z),console.log(" .cursorrules");if(J||$.gemini)SJ(X,uZ(X,z)),console.log(" GEMINI.md");if(J||$.copilot)bJ(X,z),console.log(" .github/copilot-instructions.md");if($.grok){let Y=gJ(X,z);console.log(` .grok/config.toml (${Y})`)}if($.llms)fJ(X,z),console.log(" llms.txt");if(J||$.html){let Y=Q0(u(Z));X4(X,z,Y,Z),console.log(" project.html")}let Q=z.app_type==="server-card"||z.project?.type==="server-card";if($.card||J&&Q){let Y=rJ(X,z);console.log(` ${Y.replace(`${X}/`,"")}`)}console.log(`${I("exported")} ${M(`from ${Z}`)}`)}import{existsSync as JQ,readFileSync as OA,writeFileSync as NA}from"fs";import{resolve as nZ}from"path";import{existsSync as sJ,mkdirSync as zA,readFileSync as JA,writeFileSync as QA}from"fs";import{dirname as oJ,join as aJ}from"path";import{deprecate as YA}from"node:util";var WA="https://faf.one/context",UA="JSONRPC",tJ="1.0",pZ=["a2a","mcp","registry","catalog"];function eJ($){return D0(JA($,"utf-8"))}function $Q($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let z of Z){let J=aJ($,z);if(sJ(J))return J}let X=oJ($);if(X!==$)for(let z of Z){let J=aJ(X,z);if(sJ(J))return J}return null}function qA($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function iZ($,Z={}){let X=qA($);if(X.length>0)return X;let z=Z.doorUrl?.trim();if(z)return[{protocol:"a2a",location:z,version:tJ}];return[]}function ZQ($,Z,X={}){let z=$.agent??{},J=iZ($,X);if(J.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let Q=String(z.displayName??$.metadata?.persona??z.name??"").trim(),Y=String(z.description??"").trim(),W=String(z.version??"").trim(),U=String(z.vendor??"").trim(),q=String(z.homepage??"").trim();if(!Q||!Y||!W||!U||!q)throw Error("A2A card needs agent.displayName|name, description, version, vendor, homepage in .fafa");let G=h2(Z,X),V=($.capabilities??[]).map((K)=>{let H=String(K.name??"").trim();if(!H)throw Error("A2A skill missing capabilities[].name");let L=Array.isArray(K.tags)?K.tags.map(String):[];return{id:H,name:H,description:String(K.description??"").trim()||H,tags:L}});return{name:Q,description:Y,supportedInterfaces:J.map((K)=>({url:String(K.location),protocolBinding:UA,protocolVersion:String(K.version??tJ)})),provider:{organization:U,url:q},version:W,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[{uri:WA,description:"FAF context provenance — the durable context block (one context, every door).",required:!1,params:G}]},defaultInputModes:["text/plain","application/json"],defaultOutputModes:["text/plain","application/json"],skills:V}}var Cx=YA(ZQ,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function GA($){let Z=$.agent?.homepage;if(!Z)return"local";try{return new URL(Z).hostname.replace(/^www\./,"")}catch{return"local"}}function VA($,Z){if(Z.a2aCardUrl)return Z.a2aCardUrl;let X=$.agent?.homepage;if(X)try{return new URL("/.well-known/agent-card.json",X).href}catch{}return"/.well-known/agent-card.json"}function KA($,Z,X={}){let z=GA($),J=$.agent??{},Q=String(J.name??"agent"),Y=X.now??Z.generated??new Date().toISOString(),W=[];if(iZ($,X).length>0)W.push({identifier:`urn:air:${z}:a2a:${Q}`,displayName:String(J.displayName??J.name??"A2A Agent Card"),type:"application/a2a-agent-card+json",description:"A2A v1.0 Agent Card. Projected from .fafa.",url:VA($,X),updatedAt:Y});let U=HA($,"fafa");if(U)W.push({identifier:`urn:air:${z}:agent:${Q}`,displayName:String(J.displayName??J.name??".fafa"),type:"application/vnd.fafa+yaml",description:"FAF agent passport (.fafa).",url:U,updatedAt:Y});return W}function HA($,Z){let X=$.agent?.homepage;if(!X)return;try{return new URL(`/.well-known/${Z}`,X).href}catch{return}}function BA($,Z){let X=$.findIndex((z)=>z.identifier===Z.identifier);if(X>=0)return X;if(Z.type==="application/a2a-agent-card+json"||Z.type==="application/json"||Z.identifier.includes(":a2a:"))return $.findIndex((z)=>z.identifier.includes(":a2a:")||z.type==="application/a2a-agent-card+json"||String(z.url??"").includes("agent-card.json"));if(Z.type==="application/vnd.fafa+yaml")return $.findIndex((z)=>z.type==="application/vnd.fafa+yaml");return-1}function XQ($,Z){let X=$?{...$,entries:[...$.entries??[]]}:{specVersion:"1.0",entries:[]};for(let z of Z){let J=BA(X.entries,z);if(J>=0)X.entries[J]={...X.entries[J],url:z.url,type:z.type,...z.updatedAt?{updatedAt:z.updatedAt}:{}};else X.entries.push(z)}return X}function J4($){let Z=$.opts??{},X=new Set($.targets?.length?$.targets:pZ),J={block:h2($.faf,Z)};if(X.has("mcp"))J.mcp=z4($.faf,Z);if(X.has("registry")){let Q=dZ($.faf);J.registry={name:nJ($.faf),...Q?{title:Q}:{},_meta:iJ($.faf,Z)}}if(X.has("a2a")||X.has("catalog")){if(!$.fafa){if($.targets?.includes("a2a")||$.targets?.includes("catalog"))throw Error("A2A/catalog require a .fafa (agent.fafa). Will not invent an agent.")}}if(X.has("a2a")&&$.fafa)if(iZ($.fafa,Z).length===0){if($.targets?.includes("a2a"))throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.")}else J.a2a=ZQ($.fafa,$.faf,Z);if(X.has("catalog")&&$.fafa)J.catalog=KA($.fafa,$.faf,Z);return MA(J),J}function MA($){let Z=JSON.stringify($.block),X=[];if($.a2a)X.push(JSON.stringify($.a2a.capabilities.extensions[0].params));if($.mcp){let z=$.mcp._meta;X.push(JSON.stringify(z["one.faf/context"]))}if($.registry){let z=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];X.push(JSON.stringify(z["one.faf/context"]))}for(let z of X)if(z!==Z)throw Error("context block drifted across card targets — one projector, one block")}function u2($,Z){zA(oJ($),{recursive:!0}),QA($,`${JSON.stringify(Z,null,2)}
336
+ `,"utf-8")}function zQ($){if(!$)return;let Z=$.split(",").map((z)=>z.trim().toLowerCase()).filter(Boolean),X=Z.filter((z)=>!pZ.includes(z));if(X.length)throw Error(`unknown card target: ${X.join(", ")} (use ${pZ.join(",")})`);return Z}l();var LA=["$schema","name","title","description","icons","version","repository","websiteUrl","packages","remotes","_meta"];function QQ($={}){let Z=$.faf?nZ($.faf):f();if(!Z||!JQ(Z))console.error(`Error: project.faf not found
337
337
 
338
- Run 'faf init' to create one.`),process.exit(2);let X=m(Z),z=nZ($.in??"./server.json");if(!sJ(z))console.error(`Error: ${z} not found.
338
+ Run 'faf init' to create one.`),process.exit(2);let X=m(Z),z=nZ($.in??"./server.json");if(!JQ(z))console.error(`Error: ${z} not found.
339
339
 
340
340
  'faf server-card' patches the identity into an existing registry server.json;
341
- it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=JSON.parse(YA(z,"utf-8")),Y=J._meta?.[lZ]?.["one.faf/context"]?.generated,W=$.generated??Y,U=W4({faf:X,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),q=U.registry.name,G=U.registry.title,V=U.registry._meta,K={...J,name:q,...$.setVersion?{version:$.setVersion}:{},_meta:{...J._meta??{},...V}};if(G)K.title=G;else delete K.title;let H={};for(let O of UA)if(O in K&&K[O]!==void 0)H[O]=K[O];for(let O of Object.keys(K))if(!(O in H)&&K[O]!==void 0)H[O]=K[O];let L=`${JSON.stringify(H,null,2)}
342
- `;if($.check){process.stdout.write(L);return}let B=nZ($.out??z);WA(B,L),console.error(`${I("✓")} ${B} — name=${q} title=${G??"(none)"} ${M("(identity emitted from faf-cli)")}`)}import{existsSync as U4,readFileSync as oJ}from"fs";import{join as q4,resolve as rZ}from"path";l();function tJ($={}){let Z=$.dir?rZ($.dir):process.cwd(),X;try{X=rJ($.target)}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}let z=$.faf?rZ($.faf):f(Z);if(!z||!U4(z))console.error(`Error: project.faf not found
341
+ it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=JSON.parse(OA(z,"utf-8")),Y=J._meta?.[lZ]?.["one.faf/context"]?.generated,W=$.generated??Y,U=J4({faf:X,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),q=U.registry.name,G=U.registry.title,V=U.registry._meta,K={...J,name:q,...$.setVersion?{version:$.setVersion}:{},_meta:{...J._meta??{},...V}};if(G)K.title=G;else delete K.title;let H={};for(let O of LA)if(O in K&&K[O]!==void 0)H[O]=K[O];for(let O of Object.keys(K))if(!(O in H)&&K[O]!==void 0)H[O]=K[O];let L=`${JSON.stringify(H,null,2)}
342
+ `;if($.check){process.stdout.write(L);return}let B=nZ($.out??z);NA(B,L),console.error(`${I("✓")} ${B} — name=${q} title=${G??"(none)"} ${M("(identity emitted from faf-cli)")}`)}import{existsSync as Q4,readFileSync as YQ}from"fs";import{join as Y4,resolve as rZ}from"path";l();function WQ($={}){let Z=$.dir?rZ($.dir):process.cwd(),X;try{X=zQ($.target)}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}let z=$.faf?rZ($.faf):f(Z);if(!z||!Q4(z))console.error(`Error: project.faf not found
343
343
 
344
- Run 'faf init' to create one.`),process.exit(2);let J=m(z),Q=$.fafa?rZ($.fafa):iJ(Z),Y=Q&&U4(Q)?pJ(Q):void 0,W;try{W=W4({faf:J,fafa:Y,targets:X,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer}})}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(W,null,2)}
345
- `);return}let U=[];if(W.a2a){let q=q4(Z,".well-known","agent-card.json");u2(q,W.a2a),U.push(q)}if(W.mcp){let q=q4(Z,"server-card");u2(q,W.mcp),U.push(q)}if(W.catalog){let q=q4(Z,".well-known","ai-catalog.json"),G;if(U4(q))G=JSON.parse(oJ(q,"utf-8"));u2(q,nJ(G,W.catalog)),U.push(q)}if(W.registry){let q=q4(Z,"server.json");if(U4(q)){let G=JSON.parse(oJ(q,"utf-8")),V={...G,name:W.registry.name,_meta:{...G._meta??{},...W.registry._meta}};if(W.registry.title)V.title=W.registry.title;u2(q,V),U.push(q)}else if(X?.includes("registry"))console.error(`Error: ${q} not found.
344
+ Run 'faf init' to create one.`),process.exit(2);let J=m(z),Q=$.fafa?rZ($.fafa):$Q(Z),Y=Q&&Q4(Q)?eJ(Q):void 0,W;try{W=J4({faf:J,fafa:Y,targets:X,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer}})}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(W,null,2)}
345
+ `);return}let U=[];if(W.a2a){let q=Y4(Z,".well-known","agent-card.json");u2(q,W.a2a),U.push(q)}if(W.mcp){let q=Y4(Z,"server-card");u2(q,W.mcp),U.push(q)}if(W.catalog){let q=Y4(Z,".well-known","ai-catalog.json"),G;if(Q4(q))G=JSON.parse(YQ(q,"utf-8"));u2(q,XQ(G,W.catalog)),U.push(q)}if(W.registry){let q=Y4(Z,"server.json");if(Q4(q)){let G=JSON.parse(YQ(q,"utf-8")),V={...G,name:W.registry.name,_meta:{...G._meta??{},...W.registry._meta}};if(W.registry.title)V.title=W.registry.title;u2(q,V),U.push(q)}else if(X?.includes("registry"))console.error(`Error: ${q} not found.
346
346
 
347
- Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(U.length===0){console.error(`${I("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog; server.json for registry")}`);return}for(let q of U)console.error(`${I("✓")} ${q}`)}import{join as qA}from"path";import GA from"open";l();function VA($){if(process.env.CI)return!1;try{return GA($).catch(()=>{return}),!0}catch{return!1}}function eJ(){let $=f();if(!$)console.error(`Error: project.faf not found
347
+ Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(U.length===0){console.error(`${I("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog; server.json for registry")}`);return}for(let q of U)console.error(`${I("✓")} ${q}`)}import{join as DA}from"path";import IA from"open";l();function TA($){if(process.env.CI)return!1;try{return IA($).catch(()=>{return}),!0}catch{return!1}}function UQ(){let $=f();if(!$)console.error(`Error: project.faf not found
348
348
 
349
- Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=m($),z=Q0(u($));Y4(Z,X,z,$);let J=qA(Z,"project.html"),Q=VA(J);console.log(" project.html"),console.log(Q?`${I("opened")} ${M("in your browser")}`:`${I("rendered")} ${M(`file://${J}`)}`)}import{mkdirSync as KA,rmSync as HA,existsSync as BA}from"fs";import{join as $Q,resolve as MA}from"path";import{execFileSync as OA}from"child_process";import{tmpdir as NA}from"os";l();function LA($){let Z=($??"").trim();if(!Z)throw Error("Please provide a GitHub URL.");if(/[\s;&|`$(){}<>\\^'"!*?[\]]/.test(Z))throw Error(`Refusing unsafe URL: ${JSON.stringify($)}`);let X=Z.replace(/\/+$/,"").replace(/\.git$/i,""),z=X.match(/^(?:github\.com\/)?([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*)$/);if(z)return`https://github.com/${z[1]}/${z[2]}.git`;if(/^https?:\/\/[A-Za-z0-9._\-/:@~%]+$/.test(X))return`${X}.git`;throw Error(`Not a recognized GitHub repo URL: ${JSON.stringify($)}`)}function DA($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function IA($,Z,X){return["clone","--depth","1",...X?["--branch",X]:[],"--",$,Z]}function TA($,Z=process.cwd()){if($.stdout)return{outputPath:null};let X=$.output?MA(Z,$.output):$Q(Z,"project.faf");if(BA(X)&&!$.force)throw Error(`${X} already exists — refusing to overwrite your context.
350
- `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:X}}function ZQ($,Z={},X=process.cwd()){let z;try{z=LA($)}catch(Y){console.error(`Error: ${Y.message}
349
+ Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=m($),z=Q0(u($));X4(Z,X,z,$);let J=DA(Z,"project.html"),Q=TA(J);console.log(" project.html"),console.log(Q?`${I("opened")} ${M("in your browser")}`:`${I("rendered")} ${M(`file://${J}`)}`)}import{mkdirSync as AA,rmSync as RA,existsSync as _A}from"fs";import{join as qQ,resolve as FA}from"path";import{execFileSync as CA}from"child_process";import{tmpdir as PA}from"os";l();function EA($){let Z=($??"").trim();if(!Z)throw Error("Please provide a GitHub URL.");if(/[\s;&|`$(){}<>\\^'"!*?[\]]/.test(Z))throw Error(`Refusing unsafe URL: ${JSON.stringify($)}`);let X=Z.replace(/\/+$/,"").replace(/\.git$/i,""),z=X.match(/^(?:github\.com\/)?([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*)$/);if(z)return`https://github.com/${z[1]}/${z[2]}.git`;if(/^https?:\/\/[A-Za-z0-9._\-/:@~%]+$/.test(X))return`${X}.git`;throw Error(`Not a recognized GitHub repo URL: ${JSON.stringify($)}`)}function wA($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function SA($,Z,X){return["clone","--depth","1",...X?["--branch",X]:[],"--",$,Z]}function jA($,Z=process.cwd()){if($.stdout)return{outputPath:null};let X=$.output?FA(Z,$.output):qQ(Z,"project.faf");if(_A(X)&&!$.force)throw Error(`${X} already exists — refusing to overwrite your context.
350
+ `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:X}}function GQ($,Z={},X=process.cwd()){let z;try{z=EA($)}catch(Y){console.error(`Error: ${Y.message}
351
351
 
352
- Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let J;try{J=TA(Z,X)}catch(Y){console.error(`Error: ${Y.message}`),process.exit(1);return}let Q=$Q(NA(),`faf-git-${Date.now()}`);KA(Q,{recursive:!0});try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{OA("git",IA(z,Q,Z.ref),{stdio:"pipe"})}catch(q){let V=(q?.stderr?.toString()??"").trim().split(`
352
+ Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let J;try{J=jA(Z,X)}catch(Y){console.error(`Error: ${Y.message}`),process.exit(1);return}let Q=qQ(PA(),`faf-git-${Date.now()}`);AA(Q,{recursive:!0});try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{CA("git",SA(z,Q,Z.ref),{stdio:"pipe"})}catch(q){let V=(q?.stderr?.toString()??"").trim().split(`
353
353
  `).slice(-2).join(" ").trim()||"git clone failed",K=Z.ref?`
354
354
 
355
355
  (does the branch/tag '${Z.ref}' exist?)`:"";console.error(`Error: could not clone ${$}
356
356
 
357
- ${V}${K}`),process.exit(1)}let Y=T$(Q);if(Y.project&&/^faf-git-\d+$/.test(String(Y.project.name??"")))Y.project.name=DA(z);if(J.outputPath===null){process.stdout.write(KZ(Y));return}$0(J.outputPath,Y),console.log(`${I("created")} ${J.outputPath}`);let W=u(J.outputPath),U=B0(G0(W));Y0(U,J.outputPath)}finally{HA(Q,{recursive:!0,force:!0})}}import{execFileSync as F1}from"child_process";import{readFileSync as YQ,existsSync as WQ,appendFileSync as AA}from"fs";import{join as RA}from"path";var C$=($)=>String($).trim(),_A="slotignored",XQ=($)=>P0($)||typeof $==="string"&&$.trim().toLowerCase()===_A;function FA($,Z){let X=[],z=0,J=0;for(let Q of Z0){let Y=F2($,Q),W=F2(Z,Q),U=!XQ(Y),q=!XQ(W);if(U)z++;if(q)J++;let G=Q.label??Q.path.split(".").pop()??Q.path,V={path:Q.path,label:G,category:String(Q.category)};if(!U&&q)X.push({...V,kind:"added",to:C$(W)});else if(U&&!q)X.push({...V,kind:"removed",from:C$(Y)});else if(U&&q&&C$(Y)!==C$(W))X.push({...V,kind:"changed",from:C$(Y),to:C$(W)})}return{changes:X,filledBase:z,filledTarget:J}}function zQ($){if(!$.trim())return 0;try{return Q0($).score??0}catch{return 0}}function JQ($){if(!$.trim())return{};try{return Wz($)??{}}catch{return{}}}function K4($,Z){let{changes:X,filledBase:z,filledTarget:J}=FA(JQ($),JQ(Z)),Q=zQ($),Y=zQ(Z);return{changes:X,scoreBase:Q,scoreTarget:Y,scoreDelta:Y-Q,filledBase:z,filledTarget:J}}var CA={added:"+",removed:"-",changed:"~"},QQ=($)=>$>0?`+${$}`:`${$}`,G4=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function UQ($,Z,X){let z=[],J=d0(A1($.scoreBase)),Q=d0(A1($.scoreTarget));if(z.push(`project.faf ${Z} → ${X}`),z.push(`Score: ${$.scoreBase}% ${J} → ${$.scoreTarget}% ${Q} (${QQ($.scoreDelta)})`),z.push(""),$.changes.length===0)z.push(" (no slot changes)");else{let Y="";for(let W of $.changes){if(W.category!==Y)z.push(` ${W.category}`),Y=W.category;let U=CA[W.kind],q=W.label.padEnd(16);if(W.kind==="changed")z.push(` ${U} ${q} ${G4(W.from)} → ${G4(W.to)}`);else if(W.kind==="added")z.push(` ${U} ${q} ${G4(W.to)} (added)`);else z.push(` ${U} ${q} ${G4(W.from)} (removed)`)}}return z.push(""),z.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${QQ($.filledTarget-$.filledBase)})`),z.join(`
358
- `)}function EA($,Z){try{return F1("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function m2($,Z){if(!EA($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function E$($,Z,X){try{return F1("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function qQ($){let Z=$[0]??"project.faf";try{if($.length<5){console.log(`${Z} — unmerged (resolve the conflict, then \`faf diff\`)`);return}let X=(Q)=>Q&&Q!=="/dev/null"&&WQ(Q)?YQ(Q,"utf-8"):"",z=(Q,Y)=>{if(!Q||Q==="/dev/null")return"(absent)";if(!Y||/^0+$/.test(Y))return"(working tree)";return Y.slice(0,7)},J=K4(X($[1]),X($[4]));console.log(UQ(J,z($[1],$[2]),z($[4],$[5])))}catch(X){console.log(`${Z} — faf diff unavailable (${X instanceof Error?X.message:"error"})`)}}var V4="*.faf diff=faf";function sZ($){let[Z,...X]=$.trim().split(/\s+/);try{return F1(Z,X,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function GQ($){try{return F1("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}catch{throw console.error("Error: not a git repository."),process.exit(2),Error("unreachable")}}function PA($){let Z=GQ($),X=RA(Z,".gitattributes"),z=WQ(X)?YQ(X,"utf-8"):"";if(!z.split(`
359
- `).some((J)=>J.trim()===V4))AA(X,`${z&&!z.endsWith(`
357
+ ${V}${K}`),process.exit(1)}let Y=T$(Q);if(Y.project&&/^faf-git-\d+$/.test(String(Y.project.name??"")))Y.project.name=wA(z);if(J.outputPath===null){process.stdout.write(qZ(Y));return}$0(J.outputPath,Y),console.log(`${I("created")} ${J.outputPath}`);let W=u(J.outputPath),U=B0(G0(W));Y0(U,J.outputPath)}finally{RA(Q,{recursive:!0,force:!0})}}import{execFileSync as F1}from"child_process";import{readFileSync as MQ,existsSync as OQ,appendFileSync as xA}from"fs";import{join as bA}from"path";var C$=($)=>String($).trim(),kA="slotignored",VQ=($)=>E0($)||typeof $==="string"&&$.trim().toLowerCase()===kA;function yA($,Z){let X=[],z=0,J=0;for(let Q of Z0){let Y=F2($,Q),W=F2(Z,Q),U=!VQ(Y),q=!VQ(W);if(U)z++;if(q)J++;let G=Q.label??Q.path.split(".").pop()??Q.path,V={path:Q.path,label:G,category:String(Q.category)};if(!U&&q)X.push({...V,kind:"added",to:C$(W)});else if(U&&!q)X.push({...V,kind:"removed",from:C$(Y)});else if(U&&q&&C$(Y)!==C$(W))X.push({...V,kind:"changed",from:C$(Y),to:C$(W)})}return{changes:X,filledBase:z,filledTarget:J}}function KQ($){if(!$.trim())return 0;try{return Q0($).score??0}catch{return 0}}function HQ($){if(!$.trim())return{};try{return Wz($)??{}}catch{return{}}}function q4($,Z){let{changes:X,filledBase:z,filledTarget:J}=yA(HQ($),HQ(Z)),Q=KQ($),Y=KQ(Z);return{changes:X,scoreBase:Q,scoreTarget:Y,scoreDelta:Y-Q,filledBase:z,filledTarget:J}}var vA={added:"+",removed:"-",changed:"~"},BQ=($)=>$>0?`+${$}`:`${$}`,W4=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function NQ($,Z,X){let z=[],J=d0(A1($.scoreBase)),Q=d0(A1($.scoreTarget));if(z.push(`project.faf ${Z} → ${X}`),z.push(`Score: ${$.scoreBase}% ${J} → ${$.scoreTarget}% ${Q} (${BQ($.scoreDelta)})`),z.push(""),$.changes.length===0)z.push(" (no slot changes)");else{let Y="";for(let W of $.changes){if(W.category!==Y)z.push(` ${W.category}`),Y=W.category;let U=vA[W.kind],q=W.label.padEnd(16);if(W.kind==="changed")z.push(` ${U} ${q} ${W4(W.from)} → ${W4(W.to)}`);else if(W.kind==="added")z.push(` ${U} ${q} ${W4(W.to)} (added)`);else z.push(` ${U} ${q} ${W4(W.from)} (removed)`)}}return z.push(""),z.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${BQ($.filledTarget-$.filledBase)})`),z.join(`
358
+ `)}function gA($,Z){try{return F1("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function m2($,Z){if(!gA($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function P$($,Z,X){try{return F1("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function LQ($){let Z=$[0]??"project.faf";try{if($.length<5){console.log(`${Z} — unmerged (resolve the conflict, then \`faf diff\`)`);return}let X=(Q)=>Q&&Q!=="/dev/null"&&OQ(Q)?MQ(Q,"utf-8"):"",z=(Q,Y)=>{if(!Q||Q==="/dev/null")return"(absent)";if(!Y||/^0+$/.test(Y))return"(working tree)";return Y.slice(0,7)},J=q4(X($[1]),X($[4]));console.log(NQ(J,z($[1],$[2]),z($[4],$[5])))}catch(X){console.log(`${Z} — faf diff unavailable (${X instanceof Error?X.message:"error"})`)}}var U4="*.faf diff=faf";function sZ($){let[Z,...X]=$.trim().split(/\s+/);try{return F1(Z,X,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function DQ($){try{return F1("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}catch{throw console.error("Error: not a git repository."),process.exit(2),Error("unreachable")}}function fA($){let Z=DQ($),X=bA(Z,".gitattributes"),z=OQ(X)?MQ(X,"utf-8"):"";if(!z.split(`
359
+ `).some((J)=>J.trim()===U4))xA(X,`${z&&!z.endsWith(`
360
360
  `)?`
361
- `:""}${V4}
362
- `),console.log(`✅ .gitattributes ${V4}`);else console.log(`• .gitattributes already opts in (${V4})`);if(F1("git",["config","diff.faf.command","faf-cli diff-driver"],{cwd:$}),console.log("✅ git config diff.faf.command = faf-cli diff-driver"),console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!sZ("faf-cli diff-driver"))console.log("\n⚠ the `faf-cli` on your PATH does not support `diff-driver` yet (needs faf-cli ≥ 7.0)."),console.log(" `git diff` on .faf files falls back to the raw text diff until you upgrade.")}function wA($){GQ($);try{F1("git",["config","--unset","diff.faf.command"],{cwd:$,stdio:"pipe"})}catch{}console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete).")}function VQ($,Z={},X=process.cwd()){if(Z.installDriver)return PA(X);if(Z.uninstallDriver)return wA(X);let z=f(X);if(!z)console.error(`Error: project.faf not found
361
+ `:""}${U4}
362
+ `),console.log(`✅ .gitattributes ${U4}`);else console.log(`• .gitattributes already opts in (${U4})`);if(F1("git",["config","diff.faf.command","faf-cli diff-driver"],{cwd:$}),console.log("✅ git config diff.faf.command = faf-cli diff-driver"),console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!sZ("faf-cli diff-driver"))console.log("\n⚠ the `faf-cli` on your PATH does not support `diff-driver` yet (needs faf-cli ≥ 7.0)."),console.log(" `git diff` on .faf files falls back to the raw text diff until you upgrade.")}function hA($){DQ($);try{F1("git",["config","--unset","diff.faf.command"],{cwd:$,stdio:"pipe"})}catch{}console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete).")}function IQ($,Z={},X=process.cwd()){if(Z.installDriver)return fA(X);if(Z.uninstallDriver)return hA(X);let z=f(X);if(!z)console.error(`Error: project.faf not found
363
363
 
364
- Run 'faf init' to create one.`),process.exit(2);let J;try{J=F1("git",["rev-parse","--show-toplevel"],{cwd:X,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf diff compares .faf versions across git history."),process.exit(2);return}let Q=B$(z,X),Y,W,U,q;if(!$)Y="HEAD",W="(working tree)",U=E$("HEAD",Q,X),q=u(z);else if($.includes("...")){let[V,K]=$.split("...");m2(V,X),m2(K,X);let H;try{H=F1("git",["merge-base",V,K],{cwd:X,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${V}' and '${K}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=H.slice(0,7),W=K,U=E$(H,Q,X),q=E$(K,Q,X)}else if($.includes("..")){let[V,K]=$.split("..");m2(V,X),m2(K,X),Y=V,W=K,U=E$(V,Q,X),q=E$(K,Q,X)}else m2($,X),Y=$,W="(working tree)",U=E$($,Q,X),q=u(z);let G=K4(U,q);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...G},null,2));else console.log(UQ(G,Y,W))}import{execFileSync as aZ}from"child_process";function SA($){if(!$.trim())return 0;try{return Q0($).score??0}catch{return 0}}var jA=($)=>$>0?`+${$}`:`${$}`;function xA($){let Z=$.map((X)=>({...X,score:SA(X.raw)}));return Z.map((X,z)=>{let J=Z[z+1];return{hex:X.hex,date:X.date,subject:X.subject,score:X.score,delta:J?X.score-J.score:null,first:!J}})}function bA($,Z="project.faf"){if($.length===0)return`${Z} — no history (no commits touch it yet)`;let X=[];X.push(`${Z} — score timeline (${$.length} commit${$.length===1?"":"s"})`),X.push("");for(let z of $){let J=`${String(z.score).padStart(3)}%`,Q=z.first?" new ":z.delta===0?" ·":jA(z.delta).padStart(4);X.push(` ${J} ${Q} ${z.date} ${z.hex} ${d0(A1(z.score))} ${z.subject}`)}return X.join(`
365
- `)}function kA($,Z,X){try{return aZ("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function KQ($={},Z=process.cwd()){let X=f(Z);if(!X)console.error(`Error: project.faf not found
364
+ Run 'faf init' to create one.`),process.exit(2);let J;try{J=F1("git",["rev-parse","--show-toplevel"],{cwd:X,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf diff compares .faf versions across git history."),process.exit(2);return}let Q=B$(z,X),Y,W,U,q;if(!$)Y="HEAD",W="(working tree)",U=P$("HEAD",Q,X),q=u(z);else if($.includes("...")){let[V,K]=$.split("...");m2(V,X),m2(K,X);let H;try{H=F1("git",["merge-base",V,K],{cwd:X,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${V}' and '${K}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=H.slice(0,7),W=K,U=P$(H,Q,X),q=P$(K,Q,X)}else if($.includes("..")){let[V,K]=$.split("..");m2(V,X),m2(K,X),Y=V,W=K,U=P$(V,Q,X),q=P$(K,Q,X)}else m2($,X),Y=$,W="(working tree)",U=P$($,Q,X),q=u(z);let G=q4(U,q);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...G},null,2));else console.log(NQ(G,Y,W))}import{execFileSync as aZ}from"child_process";function uA($){if(!$.trim())return 0;try{return Q0($).score??0}catch{return 0}}var mA=($)=>$>0?`+${$}`:`${$}`;function cA($){let Z=$.map((X)=>({...X,score:uA(X.raw)}));return Z.map((X,z)=>{let J=Z[z+1];return{hex:X.hex,date:X.date,subject:X.subject,score:X.score,delta:J?X.score-J.score:null,first:!J}})}function lA($,Z="project.faf"){if($.length===0)return`${Z} — no history (no commits touch it yet)`;let X=[];X.push(`${Z} — score timeline (${$.length} commit${$.length===1?"":"s"})`),X.push("");for(let z of $){let J=`${String(z.score).padStart(3)}%`,Q=z.first?" new ":z.delta===0?" ·":mA(z.delta).padStart(4);X.push(` ${J} ${Q} ${z.date} ${z.hex} ${d0(A1(z.score))} ${z.subject}`)}return X.join(`
365
+ `)}function dA($,Z,X){try{return aZ("git",["show",`${$}:${Z}`],{cwd:X,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function TQ($={},Z=process.cwd()){let X=f(Z);if(!X)console.error(`Error: project.faf not found
366
366
 
367
367
  Run 'faf init' to create one.`),process.exit(2);let z;try{z=aZ("git",["rev-parse","--show-toplevel"],{cwd:Z,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf log reads the .faf score across git history."),process.exit(2);return}let J=B$(X,Z),Q=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=aZ("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",J],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
368
- `).filter(Boolean).map((H)=>{let[L,B,O]=H.split("\x1F");return{hex:L,date:B,subject:O??""}}),U=Q>0?Math.min(W.length,Q+1):W.length,q=W.slice(0,U).map((H)=>({...H,raw:kA(H.hex,J,Z)})),G=xA(q),V=Q>0?G.slice(0,Q):G;if($.reverse)V=[...V].reverse();let K=W.length;if($.json)console.log(JSON.stringify({file:J,total:K,count:V.length,entries:V},null,2));else{let H=bA(V,J.split("/").pop()??"project.faf");if(Q>0&&K>V.length)H+=`
368
+ `).filter(Boolean).map((H)=>{let[L,B,O]=H.split("\x1F");return{hex:L,date:B,subject:O??""}}),U=Q>0?Math.min(W.length,Q+1):W.length,q=W.slice(0,U).map((H)=>({...H,raw:dA(H.hex,J,Z)})),G=cA(q),V=Q>0?G.slice(0,Q):G;if($.reverse)V=[...V].reverse();let K=W.length;if($.json)console.log(JSON.stringify({file:J,total:K,count:V.length,entries:V},null,2));else{let H=lA(V,J.split("/").pop()??"project.faf");if(Q>0&&K>V.length)H+=`
369
369
 
370
- … showing ${V.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(H)}}import{execFileSync as H4}from"child_process";import{existsSync as oZ,readFileSync as tZ,writeFileSync as MQ,chmodSync as yA,mkdirSync as vA}from"fs";import{resolve as gA,dirname as fA}from"path";var B4="# >>> faf >>>",c2="# <<< faf <<<",HQ="faf-cli hooks-run",hA=($)=>$>0?`+${$}`:`${$}`;function OQ($){return H4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function BQ($,Z){try{return H4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function NQ($,Z){try{return H4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function eZ($){let Z=H4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return gA($,Z)}function LQ($={},Z=process.cwd()){try{let X;try{X=OQ(Z)}catch{return}let z=f(Z);if(!z)return;let J=B$(z,Z),Q=BQ(`:${J}`,Z);if(Q===null)return;let Y=BQ(`HEAD:${J}`,Z)??"",W=K4(Y,Q),U=`${W.scoreBase}% → ${W.scoreTarget}% (${hA(W.scoreDelta)})`;if(W.scoreDelta<0){if(console.error(`⚠ faf: context regressed ${U} — ${W.changes.length} slot change(s)`),$.strict)console.error(" commit blocked (--strict). Fix with `faf score` / `faf sync`, or `git commit --no-verify` to override."),process.exit(1)}else console.log(`✓ faf: context ${U}`)}catch(X){console.error(`faf hooks: skipped (${X instanceof Error?X.message:"error"})`)}}function uA($,Z){let X=$.trim().split(/\s+/)[0],z=Z?`${$} --strict || exit 1`:`${$} || true`;return[B4,`if command -v ${X} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${z}`,"fi",c2,""].join(`
371
- `)}function mA($,Z={}){let X;try{X=OQ($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let z=NQ("core.hooksPath",$);if(z){let G=Z.runnerCmd??HQ;return console.error(`Error: core.hooksPath is set (${z}) — a hook manager (husky/lefthook/pre-commit) owns hooks here.`),console.error(" faf won't touch a managed hooks directory. Add this to your pre-commit yourself:"),console.error(` ${G}${Z.strict?" --strict":""}`),!1}let J=eZ($),Q=Z.runnerCmd??HQ;if(!sZ(Q)){let G=Q.trim().split(/\s+/)[0];if(Z.strict)return console.error(`Error: \`${G}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0).`),console.error(" A --strict hook against an older faf-cli would BLOCK your commits. Upgrade, then re-install."),!1;console.log(`⚠ \`${G}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=uA(Q,!!Z.strict),W=oZ(J)?tZ(J,"utf-8"):"",U=W.indexOf(B4),q=W.indexOf(c2);if(U!==-1&&q!==-1){let G=W.slice(q+c2.length).replace(/^\n/,"");W=W.slice(0,U)+Y+G}else if(W.trim())W=W.endsWith(`
370
+ … showing ${V.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(H)}}import{execFileSync as G4}from"child_process";import{existsSync as oZ,readFileSync as tZ,writeFileSync as _Q,chmodSync as pA,mkdirSync as iA}from"fs";import{resolve as nA,dirname as rA}from"path";var V4="# >>> faf >>>",c2="# <<< faf <<<",AQ="faf-cli hooks-run",sA=($)=>$>0?`+${$}`:`${$}`;function FQ($){return G4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function RQ($,Z){try{return G4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function CQ($,Z){try{return G4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function eZ($){let Z=G4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return nA($,Z)}function PQ($={},Z=process.cwd()){try{let X;try{X=FQ(Z)}catch{return}let z=f(Z);if(!z)return;let J=B$(z,Z),Q=RQ(`:${J}`,Z);if(Q===null)return;let Y=RQ(`HEAD:${J}`,Z)??"",W=q4(Y,Q),U=`${W.scoreBase}% → ${W.scoreTarget}% (${sA(W.scoreDelta)})`;if(W.scoreDelta<0){if(console.error(`⚠ faf: context regressed ${U} — ${W.changes.length} slot change(s)`),$.strict)console.error(" commit blocked (--strict). Fix with `faf score` / `faf sync`, or `git commit --no-verify` to override."),process.exit(1)}else console.log(`✓ faf: context ${U}`)}catch(X){console.error(`faf hooks: skipped (${X instanceof Error?X.message:"error"})`)}}function aA($,Z){let X=$.trim().split(/\s+/)[0],z=Z?`${$} --strict || exit 1`:`${$} || true`;return[V4,`if command -v ${X} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${z}`,"fi",c2,""].join(`
371
+ `)}function oA($,Z={}){let X;try{X=FQ($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let z=CQ("core.hooksPath",$);if(z){let G=Z.runnerCmd??AQ;return console.error(`Error: core.hooksPath is set (${z}) — a hook manager (husky/lefthook/pre-commit) owns hooks here.`),console.error(" faf won't touch a managed hooks directory. Add this to your pre-commit yourself:"),console.error(` ${G}${Z.strict?" --strict":""}`),!1}let J=eZ($),Q=Z.runnerCmd??AQ;if(!sZ(Q)){let G=Q.trim().split(/\s+/)[0];if(Z.strict)return console.error(`Error: \`${G}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0).`),console.error(" A --strict hook against an older faf-cli would BLOCK your commits. Upgrade, then re-install."),!1;console.log(`⚠ \`${G}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=aA(Q,!!Z.strict),W=oZ(J)?tZ(J,"utf-8"):"",U=W.indexOf(V4),q=W.indexOf(c2);if(U!==-1&&q!==-1){let G=W.slice(q+c2.length).replace(/^\n/,"");W=W.slice(0,U)+Y+G}else if(W.trim())W=W.endsWith(`
372
372
  `)?`${W}
373
373
  ${Y}`:`${W}
374
374
 
375
375
  ${Y}`;else W=`#!/bin/sh
376
- ${Y}`;return vA(fA(J),{recursive:!0}),MQ(J,W),yA(J,493),console.log(`✅ pre-commit context guard installed — ${Z.strict?"STRICT (blocks on score regression)":"warn (informs only)"}`),console.log(" Skips when no .faf is staged · respects `git commit --no-verify` · fails open."),!0}function cA($){let Z;try{Z=eZ($)}catch{return console.error("Error: not a git repository."),!1}if(!oZ(Z))return console.log("• no pre-commit hook to clean."),!0;let X=tZ(Z,"utf-8"),z=X.indexOf(B4),J=X.indexOf(c2);if(z===-1||J===-1)return console.log("• faf block not found in pre-commit — nothing to remove."),!0;let Q=(X.slice(0,z)+X.slice(J+c2.length).replace(/^\n/,"")).replace(/^#!\/bin\/sh\s*$/,`#!/bin/sh
377
- `);return MQ(Z,Q),console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function lA($){let Z;try{Z=eZ($)}catch{console.error("Error: not a git repository.");return}let X=NQ("core.hooksPath",$),z=oZ(Z)?tZ(Z,"utf-8"):"",J=z.includes(B4),Q=/hooks-run --strict/.test(z);if(console.log("faf pre-commit context guard"),console.log(` installed: ${J?`yes (${Q?"strict":"warn"})`:"no"}`),X)console.log(` ⚠ core.hooksPath = ${X} (a hook manager owns hooks — faf won't install here)`);if(!J&&!X)console.log(" → `faf hooks --install` (add --strict to block on regression)")}function DQ($={}){let Z=process.cwd();if($.install){if(!mA(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!cA(Z))process.exit(2);return}lA(Z)}l();function IQ($={}){if($.version||Object.keys($).length===0)pA()}function pA(){let $=$5();console.log(`${I(A("faf"))} v${$.version}`),console.log(M(`kernel ${Vz()} IANA application/vnd.faf+yaml`))}var l2=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"systems"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"},{name:"FAFm",extensions:[".fafm"],category:"faf"}];l();function TQ(){console.log(`${I("formats")} ${M("— supported file types")}
378
- `);let $=new Map;for(let Z of l2){let X=$.get(Z.category)??[];X.push(Z),$.set(Z.category,X)}for(let[Z,X]of $){console.log(` ${A(Z)}`);for(let z of X)console.log(` ${z.name} ${M(z.extensions.join(", "))}`);console.log()}console.log(M(` ${l2.length} formats across ${$.size} categories`))}l();import{readdirSync as iA,rmSync as nA}from"fs";import{tmpdir as rA}from"os";import{join as sA}from"path";function AQ(){let $=rA(),Z=0;try{let X=iA($);for(let z of X)if(z.startsWith("faf-git-"))nA(sA($,z),{recursive:!0,force:!0}),Z++}catch{}if(Z>0)console.log(`${I("cleared")} ${Z} cached director${Z===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function RQ($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
376
+ ${Y}`;return iA(rA(J),{recursive:!0}),_Q(J,W),pA(J,493),console.log(`✅ pre-commit context guard installed — ${Z.strict?"STRICT (blocks on score regression)":"warn (informs only)"}`),console.log(" Skips when no .faf is staged · respects `git commit --no-verify` · fails open."),!0}function tA($){let Z;try{Z=eZ($)}catch{return console.error("Error: not a git repository."),!1}if(!oZ(Z))return console.log("• no pre-commit hook to clean."),!0;let X=tZ(Z,"utf-8"),z=X.indexOf(V4),J=X.indexOf(c2);if(z===-1||J===-1)return console.log("• faf block not found in pre-commit — nothing to remove."),!0;let Q=(X.slice(0,z)+X.slice(J+c2.length).replace(/^\n/,"")).replace(/^#!\/bin\/sh\s*$/,`#!/bin/sh
377
+ `);return _Q(Z,Q),console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function eA($){let Z;try{Z=eZ($)}catch{console.error("Error: not a git repository.");return}let X=CQ("core.hooksPath",$),z=oZ(Z)?tZ(Z,"utf-8"):"",J=z.includes(V4),Q=/hooks-run --strict/.test(z);if(console.log("faf pre-commit context guard"),console.log(` installed: ${J?`yes (${Q?"strict":"warn"})`:"no"}`),X)console.log(` ⚠ core.hooksPath = ${X} (a hook manager owns hooks — faf won't install here)`);if(!J&&!X)console.log(" → `faf hooks --install` (add --strict to block on regression)")}function EQ($={}){let Z=process.cwd();if($.install){if(!oA(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!tA(Z))process.exit(2);return}eA(Z)}l();function wQ($={}){if($.version||Object.keys($).length===0)ZR()}function ZR(){let $=$5();console.log(`${I(A("faf"))} v${$.version}`),console.log(M(`kernel ${Vz()} IANA application/vnd.faf+yaml`))}var l2=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"systems"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"},{name:"FAFm",extensions:[".fafm"],category:"faf"}];l();function SQ(){console.log(`${I("formats")} ${M("— supported file types")}
378
+ `);let $=new Map;for(let Z of l2){let X=$.get(Z.category)??[];X.push(Z),$.set(Z.category,X)}for(let[Z,X]of $){console.log(` ${A(Z)}`);for(let z of X)console.log(` ${z.name} ${M(z.extensions.join(", "))}`);console.log()}console.log(M(` ${l2.length} formats across ${$.size} categories`))}l();import{readdirSync as XR,rmSync as zR}from"fs";import{tmpdir as JR}from"os";import{join as QR}from"path";function jQ(){let $=JR(),Z=0;try{let X=XR($);for(let z of X)if(z.startsWith("faf-git-"))zR(QR($,z),{recursive:!0,force:!0}),Z++}catch{}if(Z>0)console.log(`${I("cleared")} ${Z} cached director${Z===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function xQ($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
379
379
 
380
- Run 'faf init' to create one.`),process.exit(2);if($.json){let X=m(Z);console.log(JSON.stringify(X,null,2))}else{let X=u(Z);console.log(X)}}l();function _Q(){let $=f();if(!$)console.error(`Error: project.faf not found
380
+ Run 'faf init' to create one.`),process.exit(2);if($.json){let X=m(Z);console.log(JSON.stringify(X,null,2))}else{let X=u(Z);console.log(X)}}l();function bQ(){let $=f();if(!$)console.error(`Error: project.faf not found
381
381
 
382
- Run 'faf init' to create one.`),process.exit(2);let Z=m($),X=[];for(let z of Z0){let[J,Q]=z.path.split("."),W=Z[J]?.[Q];if(P0(W)||W==="slotignored")continue;X.push(`${z.path}: ${W}`)}if(X.length===0){console.log(M("no populated slots"));return}console.log(X.join(`
383
- `))}import{existsSync as aA,statSync as FQ}from"fs";import{dirname as oA,join as tA}from"path";var eA=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],$R=1000;function CQ($,Z=oA($)){let X=FQ($).mtimeMs,z=eA.map((J)=>{let Q=tA(Z,J);if(!aA(Q))return{file:J,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=FQ(Q).mtimeMs,W=Y-X,U;if(Math.abs(W)<$R)U="in-sync";else if(W>0)U="newer";else U="older";return{file:J,exists:!0,mtime_ms:Y,status:U,delta_ms:W}});return{source:$,source_mtime_ms:X,targets:z,drifted:z.filter((J)=>J.status==="newer"||J.status==="older").length,in_sync:z.filter((J)=>J.status==="in-sync").length,missing:z.filter((J)=>J.status==="missing").length}}l();function PQ($={}){let Z=f();if(!Z){if($.json)console.log(JSON.stringify({error:"project.faf not found",hint:"run 'faf init' to create one"},null,2));else console.error(`Error: project.faf not found
382
+ Run 'faf init' to create one.`),process.exit(2);let Z=m($),X=[];for(let z of Z0){let[J,Q]=z.path.split("."),W=Z[J]?.[Q];if(E0(W)||W==="slotignored")continue;X.push(`${z.path}: ${W}`)}if(X.length===0){console.log(M("no populated slots"));return}console.log(X.join(`
383
+ `))}import{existsSync as YR,statSync as kQ}from"fs";import{dirname as WR,join as UR}from"path";var qR=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],GR=1000;function yQ($,Z=WR($)){let X=kQ($).mtimeMs,z=qR.map((J)=>{let Q=UR(Z,J);if(!YR(Q))return{file:J,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=kQ(Q).mtimeMs,W=Y-X,U;if(Math.abs(W)<GR)U="in-sync";else if(W>0)U="newer";else U="older";return{file:J,exists:!0,mtime_ms:Y,status:U,delta_ms:W}});return{source:$,source_mtime_ms:X,targets:z,drifted:z.filter((J)=>J.status==="newer"||J.status==="older").length,in_sync:z.filter((J)=>J.status==="in-sync").length,missing:z.filter((J)=>J.status==="missing").length}}l();function gQ($={}){let Z=f();if(!Z){if($.json)console.log(JSON.stringify({error:"project.faf not found",hint:"run 'faf init' to create one"},null,2));else console.error(`Error: project.faf not found
384
384
 
385
- Run 'faf init' to create one.`);process.exit(2)}let X=CQ(Z,process.cwd());if($.json){let z=m(Z),J={faf_version:z.faf_version??"unknown",project:z.project?.name??"unknown",...X};console.log(JSON.stringify(J,null,2));return}ZR(X)}function ZR($){console.log(`${I("drift")} ${M("— context file sync status")}
386
- `),console.log(` ${A(".faf")} ${M(EQ($.source_mtime_ms))}`);for(let Z of $.targets){if(Z.status==="missing"||Z.mtime_ms===null){console.log(` ${M("○")} ${Z.file} ${M("missing")}`);continue}let X=M(EQ(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${I("●")} ${Z.file} ${M("in sync")}`);else if(Z.status==="newer")console.log(` ${A("!")} ${Z.file} ${A("newer")} ${X}`);else console.log(` ${M("○")} ${Z.file} ${M("older")} ${X}`)}if($.drifted>0)console.log(M(`
387
- run ${A("'faf sync'")} to resolve drift`))}function EQ($){let Z=Date.now()-$,X=Math.floor(Z/1000);if(X<60)return`${X}s ago`;let z=Math.floor(X/60);if(z<60)return`${z}m ago`;let J=Math.floor(z/60);if(J<24)return`${J}h ago`;return`${Math.floor(J/24)}d ago`}l();function wQ($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
385
+ Run 'faf init' to create one.`);process.exit(2)}let X=yQ(Z,process.cwd());if($.json){let z=m(Z),J={faf_version:z.faf_version??"unknown",project:z.project?.name??"unknown",...X};console.log(JSON.stringify(J,null,2));return}VR(X)}function VR($){console.log(`${I("drift")} ${M("— context file sync status")}
386
+ `),console.log(` ${A(".faf")} ${M(vQ($.source_mtime_ms))}`);for(let Z of $.targets){if(Z.status==="missing"||Z.mtime_ms===null){console.log(` ${M("○")} ${Z.file} ${M("missing")}`);continue}let X=M(vQ(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${I("●")} ${Z.file} ${M("in sync")}`);else if(Z.status==="newer")console.log(` ${A("!")} ${Z.file} ${A("newer")} ${X}`);else console.log(` ${M("○")} ${Z.file} ${M("older")} ${X}`)}if($.drifted>0)console.log(M(`
387
+ run ${A("'faf sync'")} to resolve drift`))}function vQ($){let Z=Date.now()-$,X=Math.floor(Z/1000);if(X<60)return`${X}s ago`;let z=Math.floor(X/60);if(z<60)return`${z}m ago`;let J=Math.floor(z/60);if(J<24)return`${J}h ago`;return`${Math.floor(J/24)}d ago`}l();function fQ($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
388
388
 
389
389
  Example: faf edit project.name "My Project"`),process.exit(1);let X=f();if(!X)console.error(`Error: project.faf not found
390
390
 
391
- Run 'faf init' to create one.`),process.exit(2);let z=m(X),J=$.split(".");if(J.length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let[Q,Y]=J;if(!z[Q]||typeof z[Q]!=="object")z[Q]={};z[Q][Y]=Z,$0(X,z),console.log(`${I("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as M4,readFileSync as Z5}from"fs";import{join as d2}from"path";l();function SQ(){let $=process.cwd(),Z=[],X={faf_version:R1,project:{}},z=d2($,"CLAUDE.md");if(M4(z)){let U=Z5(z,"utf-8"),q=X4(U);if(q.project?.name)X.project.name=q.project.name;if(q.project?.goal)X.project.goal=q.project.goal;if(q.project?.main_language)X.project.main_language=q.project.main_language;Z.push("CLAUDE.md")}let J=d2($,"AGENTS.md");if(M4(J)){let U=Z5(J,"utf-8");if(!X.project.name){let q=U.match(/^#\s+(.+)/m);if(q)X.project.name=q[1].trim()}Z.push("AGENTS.md")}let Q=d2($,"GEMINI.md");if(M4(Q)){let U=Z5(Q,"utf-8");if(!X.project.name){let q=U.match(/^#\s+(.+)/m);if(q)X.project.name=q[1].trim()}Z.push("GEMINI.md")}let Y=d2($,".cursorrules");if(M4(Y))Z.push(".cursorrules");if(Z.length===0)console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2);let W=f($);if(W){let U=m(W);if(!U.project)U.project={};if(X.project.name&&!U.project.name)U.project.name=X.project.name;if(X.project.goal&&!U.project.goal)U.project.goal=X.project.goal;if(X.project.main_language&&!U.project.main_language)U.project.main_language=X.project.main_language;$0(W,U),console.log(`${I("◆")} recover merged into ${W}`)}else{let U=d2($,"project.faf");$0(U,X),console.log(`${I("◆")} recover created ${U}`)}console.log(M(` sources: ${Z.join(", ")}`))}l();var p2=R1;function jQ($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
391
+ Run 'faf init' to create one.`),process.exit(2);let z=m(X),J=$.split(".");if(J.length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let[Q,Y]=J;if(!z[Q]||typeof z[Q]!=="object")z[Q]={};z[Q][Y]=Z,$0(X,z),console.log(`${I("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as K4,readFileSync as Z5}from"fs";import{join as d2}from"path";l();function hQ(){let $=process.cwd(),Z=[],X={faf_version:R1,project:{}},z=d2($,"CLAUDE.md");if(K4(z)){let U=Z5(z,"utf-8"),q=t8(U);if(q.project?.name)X.project.name=q.project.name;if(q.project?.goal)X.project.goal=q.project.goal;if(q.project?.main_language)X.project.main_language=q.project.main_language;Z.push("CLAUDE.md")}let J=d2($,"AGENTS.md");if(K4(J)){let U=Z5(J,"utf-8");if(!X.project.name){let q=U.match(/^#\s+(.+)/m);if(q)X.project.name=q[1].trim()}Z.push("AGENTS.md")}let Q=d2($,"GEMINI.md");if(K4(Q)){let U=Z5(Q,"utf-8");if(!X.project.name){let q=U.match(/^#\s+(.+)/m);if(q)X.project.name=q[1].trim()}Z.push("GEMINI.md")}let Y=d2($,".cursorrules");if(K4(Y))Z.push(".cursorrules");if(Z.length===0)console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2);let W=f($);if(W){let U=m(W);if(!U.project)U.project={};if(X.project.name&&!U.project.name)U.project.name=X.project.name;if(X.project.goal&&!U.project.goal)U.project.goal=X.project.goal;if(X.project.main_language&&!U.project.main_language)U.project.main_language=X.project.main_language;$0(W,U),console.log(`${I("◆")} recover merged into ${W}`)}else{let U=d2($,"project.faf");$0(U,X),console.log(`${I("◆")} recover created ${U}`)}console.log(M(` sources: ${Z.join(", ")}`))}l();var p2=R1;function uQ($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
392
392
 
393
- Run 'faf init' to create one.`),process.exit(2);let X=m(Z),z=X.faf_version??"unknown";if(z===p2){console.log(`${I("◆")} migrate already at v${p2}`);return}if(X.faf_version=p2,!X.project)X.project={};if(!X.stack)X.stack={};if(!X.human_context)X.human_context={};if(!X.monorepo)X.monorepo={};if($.dryRun){console.log(`${I("◆")} migrate ${M("(dry run)")} v${z} → v${p2}`),console.log(M(` would update ${Z}`));return}$0(Z,X),console.log(`${I("◆")} migrate v${z} → v${p2}`),console.log(M(` updated ${Z}`))}l();function xQ($){if($==="features")zR();else if($==="activate")JR();else XR()}function XR(){let $=_$();if(console.log(`${I("pro")} ${M("— FAF Pro status")}
394
- `),console.log(` Status: ${$?H0(A("PRO")):A("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function zR(){console.log(`${I("pro")} ${M("— Pro features")}
395
- `);let $=[["tri-sync",".faf ↔ CLAUDE.md ↔ MEMORY.md"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,X]of $)console.log(` ${I("◆")} ${A(Z)} ${M("—")} ${X}`);console.log("")}function JR(){console.log(`${I("pro")} ${M("— activate")}
396
- `),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(M(" export FAF_PRO=1")),console.log(""),console.log(M(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as QR}from"zlib";l();function bQ($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
393
+ Run 'faf init' to create one.`),process.exit(2);let X=m(Z),z=X.faf_version??"unknown";if(z===p2){console.log(`${I("◆")} migrate already at v${p2}`);return}if(X.faf_version=p2,!X.project)X.project={};if(!X.stack)X.stack={};if(!X.human_context)X.human_context={};if(!X.monorepo)X.monorepo={};if($.dryRun){console.log(`${I("◆")} migrate ${M("(dry run)")} v${z} → v${p2}`),console.log(M(` would update ${Z}`));return}$0(Z,X),console.log(`${I("◆")} migrate v${z} → v${p2}`),console.log(M(` updated ${Z}`))}l();function mQ($){if($==="features")HR();else if($==="activate")BR();else KR()}function KR(){let $=_$();if(console.log(`${I("pro")} ${M("— FAF Pro status")}
394
+ `),console.log(` Status: ${$?H0(A("PRO")):A("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function HR(){console.log(`${I("pro")} ${M("— Pro features")}
395
+ `);let $=[["tri-sync",".faf ↔ CLAUDE.md ↔ MEMORY.md"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,X]of $)console.log(` ${I("◆")} ${A(Z)} ${M("—")} ${X}`);console.log("")}function BR(){console.log(`${I("pro")} ${M("— activate")}
396
+ `),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(M(" export FAF_PRO=1")),console.log(""),console.log(M(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as MR}from"zlib";l();function cQ($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
397
397
 
398
- Run 'faf init' to create one.`),process.exit(2);let X=u(Z),J=QR(Buffer.from(X)).toString("base64url");if($.raw){console.log(J);return}let Q=`https://faf.one/share?d=${J}`;if(console.log(`${I("◆")} share ${M(Z)}
398
+ Run 'faf init' to create one.`),process.exit(2);let X=u(Z),J=MR(Buffer.from(X)).toString("base64url");if($.raw){console.log(J);return}let Q=`https://faf.one/share?d=${J}`;if(console.log(`${I("◆")} share ${M(Z)}
399
399
  `),console.log(` ${Q}`),$.copy)try{let{execSync:Y}=C0("child_process"),W=process.platform;if(W==="darwin")Y("pbcopy",{input:Q});else if(W==="linux")Y("xclip -selection clipboard",{input:Q});console.log(M(`
400
400
  copied to clipboard`))}catch{console.log(M(`
401
- copy failed — install xclip or pbcopy`))}}import{mkdirSync as YR,writeFileSync as WR,rmSync as UR}from"fs";import{tmpdir as qR}from"os";import{join as kQ}from"path";l();function yQ(){let $=kQ(qR(),`faf-demo-${Date.now()}`);YR($,{recursive:!0}),console.log(`${I("demo")} ${M("— FAF in action")}
401
+ copy failed — install xclip or pbcopy`))}}import{mkdirSync as OR,writeFileSync as NR,rmSync as LR}from"fs";import{tmpdir as DR}from"os";import{join as lQ}from"path";l();function dQ(){let $=lQ(DR(),`faf-demo-${Date.now()}`);OR($,{recursive:!0}),console.log(`${I("demo")} ${M("— FAF in action")}
402
402
  `);let Z=`faf_version: 2.5.0
403
403
  project:
404
404
  name: acme-app
@@ -424,18 +424,18 @@ human_context:
424
424
  where: Cloud (Vercel + AWS)
425
425
  when: "2026"
426
426
  how: Agile sprints with CI/CD
427
- `,X=kQ($,"project.faf");WR(X,Z),console.log(` ${A("1.")} Created sample project.faf`),console.log(M(` ${X}
428
- `)),console.log(` ${A("2.")} Scoring...`);let z=B0(G0(u(X)));console.log(""),Y0(z,"project.faf",!0),UR($,{recursive:!0,force:!0}),console.log(`
429
- ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}l();function vQ($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let X=$.toLowerCase(),z=!Z.slots&&!Z.formats,J=0;if(z||Z.slots){let Q=Z0.filter((Y)=>Y.path.toLowerCase().includes(X)||Y.description.toLowerCase().includes(X)||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${I("slots")} ${M(`— ${Q.length} match${Q.length===1?"":"es"}`)}
427
+ `,X=lQ($,"project.faf");NR(X,Z),console.log(` ${A("1.")} Created sample project.faf`),console.log(M(` ${X}
428
+ `)),console.log(` ${A("2.")} Scoring...`);let z=B0(G0(u(X)));console.log(""),Y0(z,"project.faf",!0),LR($,{recursive:!0,force:!0}),console.log(`
429
+ ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}l();function pQ($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let X=$.toLowerCase(),z=!Z.slots&&!Z.formats,J=0;if(z||Z.slots){let Q=Z0.filter((Y)=>Y.path.toLowerCase().includes(X)||Y.description.toLowerCase().includes(X)||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${I("slots")} ${M(`— ${Q.length} match${Q.length===1?"":"es"}`)}
430
430
  `);for(let Y of Q)console.log(` ${A(`#${Y.index}`)} ${Y.path} ${M("—")} ${Y.description} ${M(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(z||Z.formats){let Q=l2.filter((Y)=>Y.name.toLowerCase().includes(X)||Y.extensions.some((W)=>W.toLowerCase().includes(X))||Y.category.toLowerCase().includes(X));if(Q.length>0){console.log(`${I("formats")} ${M(`— ${Q.length} match${Q.length===1?"":"es"}`)}
431
- `);for(let Y of Q)console.log(` ${A(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(J===0)console.log(M(` No results for "${$}"`))}import{writeFileSync as gQ,existsSync as P$,mkdirSync as GR}from"fs";import{join as n1}from"path";l();var VR="Wolfe-Jam/faf-taf-git@v2.2.0";function fQ($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){MR(Z);return}OR(Z)}function KR($){if(P$(n1($,"bun.lockb"))||P$(n1($,"bun.lock")))return"bun";if(P$(n1($,"pnpm-lock.yaml")))return"pnpm";if(P$(n1($,"yarn.lock")))return"yarn";return"npm"}var HR={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
431
+ `);for(let Y of Q)console.log(` ${A(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),J+=Q.length}}if(J===0)console.log(M(` No results for "${$}"`))}import{writeFileSync as iQ,existsSync as E$,mkdirSync as IR}from"fs";import{join as n1}from"path";l();var TR="Wolfe-Jam/faf-taf-git@v2.2.0";function nQ($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){FR(Z);return}CR(Z)}function AR($){if(E$(n1($,"bun.lockb"))||E$(n1($,"bun.lock")))return"bun";if(E$(n1($,"pnpm-lock.yaml")))return"pnpm";if(E$(n1($,"yarn.lock")))return"yarn";return"npm"}var RR={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
432
432
  - uses: actions/setup-node@v4
433
433
  with:
434
434
  node-version: 20`,install:"pnpm install --frozen-lockfile",test:"pnpm test"},yarn:{setup:` - uses: actions/setup-node@v4
435
435
  with:
436
436
  node-version: 20`,install:"yarn install --frozen-lockfile",test:"yarn test"},npm:{setup:` - uses: actions/setup-node@v4
437
437
  with:
438
- node-version: 20`,install:"npm ci",test:"npm test"}};function BR($){let Z=`name: TAF Receipts
438
+ node-version: 20`,install:"npm ci",test:"npm test"}};function _R($){let Z=`name: TAF Receipts
439
439
  `+`# Prints a Test Receipt (.taf) on every push — proof over time, cannot be gamed.
440
440
  `+`# Generated by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/faf-taf-git
441
441
  on:
@@ -447,7 +447,7 @@ jobs:
447
447
  runs-on: ubuntu-latest
448
448
  steps:
449
449
  - uses: actions/checkout@v4
450
- `,X;if(P$(n1($,"package.json"))){let J=HR[KR($)];X=`${J.setup}
450
+ `,X;if(E$(n1($,"package.json"))){let J=RR[AR($)];X=`${J.setup}
451
451
  - run: ${J.install}
452
452
  - name: Run tests
453
453
  run: ${J.test} 2>&1 | tee test-output.txt
@@ -458,28 +458,28 @@ jobs:
458
458
  echo "TODO: your test command" 2>&1 | tee test-output.txt
459
459
  `;let z=` - name: Print TAF receipt
460
460
  if: github.event_name == 'push'
461
- uses: ${VR}
461
+ uses: ${TR}
462
462
  with:
463
463
  test-output-file: test-output.txt
464
464
  auto-commit: 'true'
465
465
  commit-message: 'chore(taf): update .taf receipt [skip ci]'
466
466
  target-branch: taf-receipts
467
- `;return Z+X+z}function MR($){let Z=process.cwd(),X=BR(Z),z=n1(Z,".github","workflows","taf.yml");if($.write){if(P$(z)){console.error(`${A("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(M(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run."));return}GR(n1(Z,".github","workflows"),{recursive:!0}),gQ(z,X,"utf-8"),console.log(`${I("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${I("TAF setup")} ${M("— Test Receipt Printer: proof over time, cannot be gamed")}
468
- `),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(X),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function OR($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=f();if(!Z)console.error(`Error: project.faf not found
467
+ `;return Z+X+z}function FR($){let Z=process.cwd(),X=_R(Z),z=n1(Z,".github","workflows","taf.yml");if($.write){if(E$(z)){console.error(`${A("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(M(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run."));return}IR(n1(Z,".github","workflows"),{recursive:!0}),iQ(z,X,"utf-8"),console.log(`${I("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${I("TAF setup")} ${M("— Test Receipt Printer: proof over time, cannot be gamed")}
468
+ `),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(X),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function CR($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=f();if(!Z)console.error(`Error: project.faf not found
469
469
 
470
- Run 'faf init' to create one.`),process.exit(2);let X=m(Z),z=u(Z),J=Q0(z),Q={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:X.project?.name??"unknown",faf_version:X.faf_version??"unknown",score:J.score,tier:J.tier.name,populated:J.populated,active:J.active,total:J.total,slots:J.slots},Y=JSON.stringify(Q,null,2);if($.output)gQ($.output,Y,"utf-8"),console.log(`${I("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as NR}from"readline";import{existsSync as hQ,readFileSync as LR,writeFileSync as DR,unlinkSync as IR}from"fs";import{join as TR}from"path";l();var AR=".faf-session.json";function RR($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function _R($,Z,X){let z=Z.split("."),J=$;for(let Q=0;Q<z.length-1;Q++){if(!J[z[Q]]||typeof J[z[Q]]!=="object")J[z[Q]]={};J=J[z[Q]]}J[z[z.length-1]]=X}async function uQ($={}){A$(process.cwd(),"faf go");let Z=f();if(!Z)console.error(`Error: project.faf not found
470
+ Run 'faf init' to create one.`),process.exit(2);let X=m(Z),z=u(Z),J=Q0(z),Q={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:X.project?.name??"unknown",faf_version:X.faf_version??"unknown",score:J.score,tier:J.tier.name,populated:J.populated,active:J.active,total:J.total,slots:J.slots},Y=JSON.stringify(Q,null,2);if($.output)iQ($.output,Y,"utf-8"),console.log(`${I("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as PR}from"readline";import{existsSync as rQ,readFileSync as ER,writeFileSync as wR,unlinkSync as SR}from"fs";import{join as jR}from"path";l();var xR=".faf-session.json";function bR($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function kR($,Z,X){let z=Z.split("."),J=$;for(let Q=0;Q<z.length-1;Q++){if(!J[z[Q]]||typeof J[z[Q]]!=="object")J[z[Q]]={};J=J[z[Q]]}J[z[z.length-1]]=X}async function sQ($={}){A$(process.cwd(),"faf go");let Z=f();if(!Z)console.error(`Error: project.faf not found
471
471
 
472
- Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=TR(X,AR),J=0;if($.resume&&hQ(z))try{J=JSON.parse(LR(z,"utf-8")).slotIndex,console.log(M(` resuming from slot #${J+1}`))}catch{}let Q=m(Z),Y=Z0.filter((H)=>{let L=RR(Q,H.path);return P0(L)&&L!=="slotignored"});if(Y.length===0){console.log(`${I("◆")} go all slots populated — ✪ Trophy`);let H=B0(G0(u(Z)));Y0(H,Z);return}console.log(`${I("go")} ${M("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(M(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
473
- `));let U=NR({input:process.stdin,output:process.stdout}),q=(H)=>new Promise((L)=>U.question(H,L)),G=0,V=Y.slice(J);for(let H=0;H<V.length;H++){let L=V[H],B=await q(` ${A(`#${L.index}`)} ${$4(L.path)} ${M(`(${L.path})`)}: `);if(B.toLowerCase()==="quit"){let O={slotIndex:J+H,fafPath:Z};DR(z,JSON.stringify(O),"utf-8"),console.log(M(`
474
- session saved. Resume with: faf go --resume`));break}if(B.toLowerCase()==="skip"||B.trim()==="")continue;_R(Q,L.path,B.trim()),G++}if(U.close(),G>0)$0(Z,Q),console.log(`
475
- ${I("◆")} go filled ${G} slot${G===1?"":"s"}`);let K=B0(G0(u(Z)));if(Y0(K,Z),hQ(z))try{IR(z)}catch{}}l();var T_=[/^(tbd|see\s+readme|todo|fixme|coming\s+soon|n\/a|unknown|none|null|not\s+specified)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+(users|developers|teams|engineers))\.?$/i,/^(general\s+purpose|various|multiple|description|goal|name|title)\.?$/i];function A_($){if(typeof $!=="string")return!1;let Z=$.trim();if(Z.length<4||Z.length>280)return!1;return!T_.some((X)=>X.test(Z))}function R_($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function __($,Z,X){let z=Z.split("."),J=$;for(let Q=0;Q<z.length-1;Q++){if(!J[z[Q]]||typeof J[z[Q]]!=="object")J[z[Q]]={};J=J[z[Q]]}J[z[z.length-1]]=X}async function uY($){if($==="analyze")await C_();else if($==="enhance")await F_();else console.log(`${I("ai")} ${M("— AI-powered features")}
476
- `),console.log(` ${A("faf ai enhance")} ${M("— fill empty slots via Claude")}`),console.log(` ${A("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function mY(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
472
+ Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=jR(X,xR),J=0;if($.resume&&rQ(z))try{J=JSON.parse(ER(z,"utf-8")).slotIndex,console.log(M(` resuming from slot #${J+1}`))}catch{}let Q=m(Z),Y=Z0.filter((H)=>{let L=bR(Q,H.path);return E0(L)&&L!=="slotignored"});if(Y.length===0){console.log(`${I("◆")} go all slots populated — ✪ Trophy`);let H=B0(G0(u(Z)));Y0(H,Z);return}console.log(`${I("go")} ${M("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(M(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
473
+ `));let U=PR({input:process.stdin,output:process.stdout}),q=(H)=>new Promise((L)=>U.question(H,L)),G=0,V=Y.slice(J);for(let H=0;H<V.length;H++){let L=V[H],B=await q(` ${A(`#${L.index}`)} ${a8(L.path)} ${M(`(${L.path})`)}: `);if(B.toLowerCase()==="quit"){let O={slotIndex:J+H,fafPath:Z};wR(z,JSON.stringify(O),"utf-8"),console.log(M(`
474
+ session saved. Resume with: faf go --resume`));break}if(B.toLowerCase()==="skip"||B.trim()==="")continue;kR(Q,L.path,B.trim()),G++}if(U.close(),G>0)$0(Z,Q),console.log(`
475
+ ${I("◆")} go filled ${G} slot${G===1?"":"s"}`);let K=B0(G0(u(Z)));if(Y0(K,Z),rQ(z))try{SR(z)}catch{}}l();var j_=[/^(tbd|see\s+readme|todo|fixme|coming\s+soon|n\/a|unknown|none|null|not\s+specified)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+(users|developers|teams|engineers))\.?$/i,/^(general\s+purpose|various|multiple|description|goal|name|title)\.?$/i];function x_($){if(typeof $!=="string")return!1;let Z=$.trim();if(Z.length<4||Z.length>280)return!1;return!j_.some((X)=>X.test(Z))}function b_($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function k_($,Z,X){let z=Z.split("."),J=$;for(let Q=0;Q<z.length-1;Q++){if(!J[z[Q]]||typeof J[z[Q]]!=="object")J[z[Q]]={};J=J[z[Q]]}J[z[z.length-1]]=X}async function sY($){if($==="analyze")await v_();else if($==="enhance")await y_();else console.log(`${I("ai")} ${M("— AI-powered features")}
476
+ `),console.log(` ${A("faf ai enhance")} ${M("— fill empty slots via Claude")}`),console.log(` ${A("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function aY(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
477
477
 
478
- export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (hY(),fY));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
478
+ export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (rY(),nY));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
479
479
 
480
- npm install @anthropic-ai/sdk`),process.exit(2)}}async function F_(){let $=f();if(!$)console.error(`Error: project.faf not found
480
+ npm install @anthropic-ai/sdk`),process.exit(2)}}async function y_(){let $=f();if(!$)console.error(`Error: project.faf not found
481
481
 
482
- Run 'faf init' to create one.`),process.exit(2);let Z=m($),X=u($),z=Z0.filter((U)=>{let q=R_(Z,U.path);return P0(q)&&q!=="slotignored"});if(z.length===0){console.log(`${I("◆")} ai enhance all slots populated`);return}console.log(`${I("ai")} enhance ${M(`extracting from ${z.length} empty slots...`)}`);let J=await mY(),Q=z.map((U)=>`- ${U.path}: ${U.description}`).join(`
482
+ Run 'faf init' to create one.`),process.exit(2);let Z=m($),X=u($),z=Z0.filter((U)=>{let q=b_(Z,U.path);return E0(q)&&q!=="slotignored"});if(z.length===0){console.log(`${I("◆")} ai enhance all slots populated`);return}console.log(`${I("ai")} enhance ${M(`extracting from ${z.length} empty slots...`)}`);let J=await aY(),Q=z.map((U)=>`- ${U.path}: ${U.description}`).join(`
483
483
  `),Y=`You are extracting concrete content from a project's .faf file to fill empty slots. STRICT RULES:
484
484
 
485
485
  1. Return JSON mapping dot-paths to values OR null.
@@ -495,54 +495,54 @@ ${X}
495
495
  Empty slots to fill (return null if no concrete evidence):
496
496
  ${Q}
497
497
 
498
- Respond with ONLY valid JSON, no markdown fences. Each value is either a short string (with concrete evidence) or null (leave empty).`,W=await J.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:Y}]});try{let U=W.content[0].text,q=JSON.parse(U),G=0,V=0;for(let K of z){let H=q[K.path];if(H===null||H===void 0)continue;if(A_(H))__(Z,K.path,H),console.log(` ${I("●")} ${K.path} ${M("←")} ${H}`),G++;else console.log(` ${M("○")} ${K.path} ${M("— rejected as slop, left empty")}`),V++}if(G>0){$0($,Z),console.log(`
498
+ Respond with ONLY valid JSON, no markdown fences. Each value is either a short string (with concrete evidence) or null (leave empty).`,W=await J.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:Y}]});try{let U=W.content[0].text,q=JSON.parse(U),G=0,V=0;for(let K of z){let H=q[K.path];if(H===null||H===void 0)continue;if(x_(H))k_(Z,K.path,H),console.log(` ${I("●")} ${K.path} ${M("←")} ${H}`),G++;else console.log(` ${M("○")} ${K.path} ${M("— rejected as slop, left empty")}`),V++}if(G>0){$0($,Z),console.log(`
499
499
  ${I("◆")} ai enhance filled ${G} slot${G===1?"":"s"}${V>0?` (${V} rejected)`:""}`);let K=B0(G0(u($)));Y0(K,$)}else if(V>0)console.log(`
500
500
  ${M("all extractions rejected as slop. Run")} ${A("'faf go'")} ${M("for interview-fill.")}`);else console.log(`
501
- ${M("no concrete evidence for empty slots. Run")} ${A("'faf go'")} ${M("for interview-fill.")}`)}catch{console.error("Error: Could not parse AI response.")}}async function C_(){let $=f();if(!$)console.error(`Error: project.faf not found
501
+ ${M("no concrete evidence for empty slots. Run")} ${A("'faf go'")} ${M("for interview-fill.")}`)}catch{console.error("Error: Could not parse AI response.")}}async function v_(){let $=f();if(!$)console.error(`Error: project.faf not found
502
502
 
503
- Run 'faf init' to create one.`),process.exit(2);let Z=u($);console.log(`${I("ai")} analyze ${M("getting suggestions...")}`);let z=await(await mY()).messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:`Analyze this .faf project context file and provide 3-5 specific suggestions for improvement. Focus on completeness, accuracy, and best practices.
503
+ Run 'faf init' to create one.`),process.exit(2);let Z=u($);console.log(`${I("ai")} analyze ${M("getting suggestions...")}`);let z=await(await aY()).messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:`Analyze this .faf project context file and provide 3-5 specific suggestions for improvement. Focus on completeness, accuracy, and best practices.
504
504
 
505
505
  ${Z}
506
506
 
507
- Be concise. One line per suggestion.`}]});console.log(""),console.log(z.content[0].text)}import{existsSync as O9,readFileSync as N9,readdirSync as E_}from"fs";import{join as cY}from"path";l();function lY($,Z){if($==="import")P_(Z);else if($==="export")w_();else console.log(`${I("conductor")} ${M("— conductor integration")}
508
- `),console.log(` ${A("faf conductor import <path>")} ${M("— import conductor config into .faf")}`),console.log(` ${A("faf conductor export")} ${M("— author conductor config from .faf")}`)}function P_($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!O9($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:R1,project:{}};if(O9($)&&$.endsWith(".json")){let J=JSON.parse(N9($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else if(O9($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let J=D0(N9($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else try{let J=E_($);for(let Q of J){let Y=cY($,Q);if(Q.endsWith(".json"))try{let W=JSON.parse(N9(Y,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!Z.project.goal)Z.project.goal=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let X=process.cwd(),z=f(X);if(z){let J=m(z);if(!J.project)J.project={};if(Z.project.name&&!J.project.name)J.project.name=Z.project.name;if(Z.project.goal&&!J.project.goal)J.project.goal=Z.project.goal;if(Z.project.main_language&&!J.project.main_language)J.project.main_language=Z.project.main_language;$0(z,J),console.log(`${I("◆")} conductor import merged into ${z}`)}else{let J=cY(X,"project.faf");$0(J,Z),console.log(`${I("◆")} conductor import created ${J}`)}}function w_(){let $=f();if(!$)console.error(`Error: project.faf not found
507
+ Be concise. One line per suggestion.`}]});console.log(""),console.log(z.content[0].text)}import{existsSync as O9,readFileSync as N9,readdirSync as g_}from"fs";import{join as oY}from"path";l();function tY($,Z){if($==="import")f_(Z);else if($==="export")h_();else console.log(`${I("conductor")} ${M("— conductor integration")}
508
+ `),console.log(` ${A("faf conductor import <path>")} ${M("— import conductor config into .faf")}`),console.log(` ${A("faf conductor export")} ${M("— author conductor config from .faf")}`)}function f_($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!O9($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:R1,project:{}};if(O9($)&&$.endsWith(".json")){let J=JSON.parse(N9($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else if(O9($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let J=D0(N9($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else try{let J=g_($);for(let Q of J){let Y=oY($,Q);if(Q.endsWith(".json"))try{let W=JSON.parse(N9(Y,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!Z.project.goal)Z.project.goal=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let X=process.cwd(),z=f(X);if(z){let J=m(z);if(!J.project)J.project={};if(Z.project.name&&!J.project.name)J.project.name=Z.project.name;if(Z.project.goal&&!J.project.goal)J.project.goal=Z.project.goal;if(Z.project.main_language&&!J.project.main_language)J.project.main_language=Z.project.main_language;$0(z,J),console.log(`${I("◆")} conductor import merged into ${z}`)}else{let J=oY(X,"project.faf");$0(J,Z),console.log(`${I("◆")} conductor import created ${J}`)}}function h_(){let $=f();if(!$)console.error(`Error: project.faf not found
509
509
 
510
- Run 'faf init' to create one.`),process.exit(2);let Z=m($),X={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(X,null,2))}l();import{readdirSync as S_,readFileSync as j_,existsSync as x_}from"fs";import{join as b_}from"path";var k_=["BRAKE","ENGINE","AERO","TYRE","PIT"],y_=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function v_($){let Z=$.match(y_);if(!Z)return null;return Z[1].toUpperCase()}function g_($){let Z=$.toLowerCase();if(Z.endsWith(".test.ts")||Z.endsWith(".test.js")||Z.endsWith(".test.tsx")||Z.endsWith(".test.jsx")||Z.endsWith(".spec.ts")||Z.endsWith(".spec.js"))return{ok:!0,lang:"typescript"};if(Z.endsWith(".rs"))return{ok:!0,lang:"rust"};if(Z.endsWith("_test.go"))return{ok:!0,lang:"go"};if((Z.startsWith("test_")||Z.endsWith("_test.py"))&&Z.endsWith(".py"))return{ok:!0,lang:"python"};if(Z.endsWith(".zig"))return{ok:!0,lang:"zig"};return{ok:!1}}function f_($,Z){let X=[];switch(Z){case"typescript":{let z=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,J=[],Q;while((Q=z.exec($))!==null)J.push({idx:Q.index,type:Q[1]==="describe"?"describe":"test",name:Q[3]});let Y=[],W=0,U=null,q=0;for(let G=0;G<$.length;G++){while(q<J.length&&J[q].idx===G){let K=J[q];if(K.type==="describe")U=K.name;else{let H=Y.map((B)=>B.name),L=H.length>0?`${H.join(" > ")} > ${K.name}`:K.name;X.push(L)}q++}let V=$[G];if(V==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(V==="}"){W--;while(Y.length>0&&W<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let z=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"python":{let z=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"zig":{let z=/\btest\s+"((?:\\.|[^"\\])+)"/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"go":{let z=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}}return X}var h_=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function dY($,Z=[]){let X;try{X=S_($,{withFileTypes:!0})}catch{return Z}for(let z of X){if(h_.has(z.name))continue;if(z.name.startsWith(".")&&z.name!==".")continue;let J=b_($,z.name);if(z.isDirectory())dY(J,Z);else if(z.isFile())Z.push(J)}return Z}function u_($){let Z=[];if(!x_($))return Z;let X=dY($);for(let z of X){let J=z.split("/").pop()??"",Q=g_(J);if(!Q.ok||!Q.lang)continue;let Y;try{Y=j_(z,"utf-8")}catch{continue}if(Q.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(Q.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=f_(Y,Q.lang),U=z.replace(`${$}/`,"");for(let q of W)Z.push({file:U,language:Q.lang,testName:q,tier:v_(q)})}return Z}function m_($){let Z={BRAKE:0,ENGINE:0,AERO:0,TYRE:0,PIT:0},X={},z=0,J=[],Q=new Set;for(let Y of $)if(Q.add(Y.file),X[Y.language]=(X[Y.language]??0)+1,Y.tier)Z[Y.tier]++;else if(z++,J.length<5)J.push(`${Y.file}: ${Y.testName}`);return{totalTests:$.length,byTier:Z,untiered:z,untieredExamples:J,filesScanned:Q.size,byLanguage:X}}function c_($){if(console.log(`${I(A("faf wjttc"))} ${M("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${A(String($.filesScanned))}`),console.log(` Tests found: ${A(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(M(" no tests found"));return}console.log(M(" Tiers:"));for(let Z of k_){let X=$.byTier[Z],z=(X/$.totalTests*100).toFixed(0),J=Z==="BRAKE"?H0("●"):Z==="ENGINE"?I("●"):Z==="AERO"?M("●"):Z==="TYRE"?I("◐"):M("○");console.log(` ${J} ${Z.padEnd(7)} ${A(String(X).padStart(4))} ${M(`(${z}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${M("○")} ${"untiered".padEnd(7)} ${A(String($.untiered).padStart(4))} ${M(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(M(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${M("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(M(" Languages:"));for(let[Z,X]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${A(String(X))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(H0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function pY($={}){let Z=$.path??"tests",X=u_(Z),z=m_(X);if($.json)console.log(JSON.stringify(z,null,2));else c_(z);if($.strict&&z.untiered>0)process.exit(1)}import{createHash as rY}from"crypto";import{readFileSync as sY,writeFileSync as l_,existsSync as aY}from"fs";import{join as oY,dirname as d_}from"path";l();var iY="faf-bench/1",p_={"project.name":"What is the project's name?","project.goal":"What is the project's goal — what is it for?","project.main_language":"What is the primary programming language?","human_context.who":"Who is this project for?","human_context.what":"What are they building?","human_context.why":"Why does this project exist?","human_context.where":"Where does it run or get distributed?","human_context.when":"When — what is the project's timeline or stage?","human_context.how":"How is it built or used?"};function i_($,Z){return p_[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var n_=[["typescript","ts"],["javascript","js"],["python","py","python3"],["node","nodejs","node js","node.js"],["github actions","gh actions","actions"],["postgresql","postgres","pg"],["kubernetes","k8s"],["npm","npm registry"],["cloudflare workers","cf workers","workers"],["google cloud run","cloud run","gcp cloud run"]],k6=new Map;n_.forEach(($,Z)=>$.forEach((X)=>k6.set(X,Z)));var r_=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function L9($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function nY($){return L9($).split(" ").filter((Z)=>Z&&!r_.has(Z))}function s_($,Z){let X=L9($),z=L9(Z);if(!X||!z)return!1;if(X===z)return!0;let J=k6.get(X);if(J!==void 0&&k6.get(z)===J)return!0;let Q=nY($);if(Q.length===0)return!1;let Y=new Set(nY(Z));return Q.every((W)=>{if(Y.has(W))return!0;let U=k6.get(W);return U!==void 0&&[...Y].some((q)=>k6.get(q)===U)})}function a_($){let Z=Q0($),X=D0($),z=[],J={},Q=0;for(let U of Z0){if(Z.slots[U.path]!=="populated")continue;let q=F2(X,U);if(typeof q!=="string")continue;let G=q.trim();if(!G||OZ.has(G.toLowerCase()))continue;Q+=1,z.push({n:Q,path:U.path,question:i_(U.path,U.description)}),J[Q]=G}let Y=JSON.stringify({v:iY,q:z.map((U)=>[U.path,U.question])}),W=rY("sha256").update(Y).digest("hex").slice(0,12);return{version:iY,qsetHash:W,questions:z,answers:J}}function o_($,Z){let X=$.questions.map((J)=>{let Q=Z[String(J.n)]??Z[J.path]??"";return{n:J.n,path:J.path,ok:typeof Q==="string"&&Q.trim()!==""&&s_($.answers[J.n],Q)}}),z=$.questions.filter((J)=>!X[J.n-1].ok);return{correct:X.filter((J)=>J.ok).length,total:$.questions.length,misses:z,perQuestion:X}}var tY=".faf-bench.json";function t_($){let Z=oY($,tY);if(!aY(Z))return null;try{return JSON.parse(sY(Z,"utf-8"))}catch{return null}}function e_($,Z){l_(oY($,tY),`${JSON.stringify(Z,null,2)}
511
- `,"utf-8")}function D9($,Z){let X=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:X,hash:rY("sha256").update(X).digest("hex")}}var d4=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function $F($,Z){let{cold:X,faf:z}=$;console.log(`
510
+ Run 'faf init' to create one.`),process.exit(2);let Z=m($),X={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(X,null,2))}l();import{readdirSync as u_,readFileSync as m_,existsSync as c_}from"fs";import{join as l_}from"path";var d_=["BRAKE","ENGINE","AERO","TYRE","PIT"],p_=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function i_($){let Z=$.match(p_);if(!Z)return null;return Z[1].toUpperCase()}function n_($){let Z=$.toLowerCase();if(Z.endsWith(".test.ts")||Z.endsWith(".test.js")||Z.endsWith(".test.tsx")||Z.endsWith(".test.jsx")||Z.endsWith(".spec.ts")||Z.endsWith(".spec.js"))return{ok:!0,lang:"typescript"};if(Z.endsWith(".rs"))return{ok:!0,lang:"rust"};if(Z.endsWith("_test.go"))return{ok:!0,lang:"go"};if((Z.startsWith("test_")||Z.endsWith("_test.py"))&&Z.endsWith(".py"))return{ok:!0,lang:"python"};if(Z.endsWith(".zig"))return{ok:!0,lang:"zig"};return{ok:!1}}function r_($,Z){let X=[];switch(Z){case"typescript":{let z=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,J=[],Q;while((Q=z.exec($))!==null)J.push({idx:Q.index,type:Q[1]==="describe"?"describe":"test",name:Q[3]});let Y=[],W=0,U=null,q=0;for(let G=0;G<$.length;G++){while(q<J.length&&J[q].idx===G){let K=J[q];if(K.type==="describe")U=K.name;else{let H=Y.map((B)=>B.name),L=H.length>0?`${H.join(" > ")} > ${K.name}`:K.name;X.push(L)}q++}let V=$[G];if(V==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(V==="}"){W--;while(Y.length>0&&W<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let z=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"python":{let z=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"zig":{let z=/\btest\s+"((?:\\.|[^"\\])+)"/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}case"go":{let z=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,J;while((J=z.exec($))!==null)X.push(J[1]);break}}return X}var s_=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function eY($,Z=[]){let X;try{X=u_($,{withFileTypes:!0})}catch{return Z}for(let z of X){if(s_.has(z.name))continue;if(z.name.startsWith(".")&&z.name!==".")continue;let J=l_($,z.name);if(z.isDirectory())eY(J,Z);else if(z.isFile())Z.push(J)}return Z}function a_($){let Z=[];if(!c_($))return Z;let X=eY($);for(let z of X){let J=z.split("/").pop()??"",Q=n_(J);if(!Q.ok||!Q.lang)continue;let Y;try{Y=m_(z,"utf-8")}catch{continue}if(Q.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(Q.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=r_(Y,Q.lang),U=z.replace(`${$}/`,"");for(let q of W)Z.push({file:U,language:Q.lang,testName:q,tier:i_(q)})}return Z}function o_($){let Z={BRAKE:0,ENGINE:0,AERO:0,TYRE:0,PIT:0},X={},z=0,J=[],Q=new Set;for(let Y of $)if(Q.add(Y.file),X[Y.language]=(X[Y.language]??0)+1,Y.tier)Z[Y.tier]++;else if(z++,J.length<5)J.push(`${Y.file}: ${Y.testName}`);return{totalTests:$.length,byTier:Z,untiered:z,untieredExamples:J,filesScanned:Q.size,byLanguage:X}}function t_($){if(console.log(`${I(A("faf wjttc"))} ${M("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${A(String($.filesScanned))}`),console.log(` Tests found: ${A(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(M(" no tests found"));return}console.log(M(" Tiers:"));for(let Z of d_){let X=$.byTier[Z],z=(X/$.totalTests*100).toFixed(0),J=Z==="BRAKE"?H0("●"):Z==="ENGINE"?I("●"):Z==="AERO"?M("●"):Z==="TYRE"?I("◐"):M("○");console.log(` ${J} ${Z.padEnd(7)} ${A(String(X).padStart(4))} ${M(`(${z}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${M("○")} ${"untiered".padEnd(7)} ${A(String($.untiered).padStart(4))} ${M(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(M(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${M("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(M(" Languages:"));for(let[Z,X]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${A(String(X))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(H0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function $W($={}){let Z=$.path??"tests",X=a_(Z),z=o_(X);if($.json)console.log(JSON.stringify(z,null,2));else t_(z);if($.strict&&z.untiered>0)process.exit(1)}import{createHash as zW}from"crypto";import{readFileSync as JW,writeFileSync as e_,existsSync as QW}from"fs";import{join as YW,dirname as $F}from"path";l();var ZW="faf-bench/1",ZF={"project.name":"What is the project's name?","project.goal":"What is the project's goal — what is it for?","project.main_language":"What is the primary programming language?","human_context.who":"Who is this project for?","human_context.what":"What are they building?","human_context.why":"Why does this project exist?","human_context.where":"Where does it run or get distributed?","human_context.when":"When — what is the project's timeline or stage?","human_context.how":"How is it built or used?"};function XF($,Z){return ZF[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var zF=[["typescript","ts"],["javascript","js"],["python","py","python3"],["node","nodejs","node js","node.js"],["github actions","gh actions","actions"],["postgresql","postgres","pg"],["kubernetes","k8s"],["npm","npm registry"],["cloudflare workers","cf workers","workers"],["google cloud run","cloud run","gcp cloud run"]],k6=new Map;zF.forEach(($,Z)=>$.forEach((X)=>k6.set(X,Z)));var JF=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function L9($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function XW($){return L9($).split(" ").filter((Z)=>Z&&!JF.has(Z))}function QF($,Z){let X=L9($),z=L9(Z);if(!X||!z)return!1;if(X===z)return!0;let J=k6.get(X);if(J!==void 0&&k6.get(z)===J)return!0;let Q=XW($);if(Q.length===0)return!1;let Y=new Set(XW(Z));return Q.every((W)=>{if(Y.has(W))return!0;let U=k6.get(W);return U!==void 0&&[...Y].some((q)=>k6.get(q)===U)})}function YF($){let Z=Q0($),X=D0($),z=[],J={},Q=0;for(let U of Z0){if(Z.slots[U.path]!=="populated")continue;let q=F2(X,U);if(typeof q!=="string")continue;let G=q.trim();if(!G||HZ.has(G.toLowerCase()))continue;Q+=1,z.push({n:Q,path:U.path,question:XF(U.path,U.description)}),J[Q]=G}let Y=JSON.stringify({v:ZW,q:z.map((U)=>[U.path,U.question])}),W=zW("sha256").update(Y).digest("hex").slice(0,12);return{version:ZW,qsetHash:W,questions:z,answers:J}}function WF($,Z){let X=$.questions.map((J)=>{let Q=Z[String(J.n)]??Z[J.path]??"";return{n:J.n,path:J.path,ok:typeof Q==="string"&&Q.trim()!==""&&QF($.answers[J.n],Q)}}),z=$.questions.filter((J)=>!X[J.n-1].ok);return{correct:X.filter((J)=>J.ok).length,total:$.questions.length,misses:z,perQuestion:X}}var WW=".faf-bench.json";function UF($){let Z=YW($,WW);if(!QW(Z))return null;try{return JSON.parse(JW(Z,"utf-8"))}catch{return null}}function qF($,Z){e_(YW($,WW),`${JSON.stringify(Z,null,2)}
511
+ `,"utf-8")}function D9($,Z){let X=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:X,hash:zW("sha256").update(X).digest("hex")}}var m4=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function GF($,Z){let{cold:X,faf:z}=$;console.log(`
512
512
  ${A(`faf bench — ${Z}`)}
513
- `),console.log(` ${M("without context")} ${I("with .faf")}`),console.log(`answers ${X.score}/${X.total} ${A(`${z.score}/${z.total}`)}`),console.log(`tokens ${d4(X.tokens)} ${d4(z.tokens)}`);let J=X.total-X.score;if(J>0)console.log(`
513
+ `),console.log(` ${M("without context")} ${I("with .faf")}`),console.log(`answers ${X.score}/${X.total} ${A(`${z.score}/${z.total}`)}`),console.log(`tokens ${m4(X.tokens)} ${m4(z.tokens)}`);let J=X.total-X.score;if(J>0)console.log(`
514
514
  ${M(`The ${J} missing answer${J===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let Q=D9($,Z);console.log(`
515
- ${H0("✪ BENCH RECEIPT")}`),console.log(M(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${z.model??X.model??"unreported"}`)),console.log(M(` cold ${X.score}/${X.total} · faf ${z.score}/${z.total} · sha256: ${Q.hash.slice(0,16)}…`))}function ZF($,Z){let X=$.cold,z=X.total-X.score;if(console.log(`
515
+ ${H0("✪ BENCH RECEIPT")}`),console.log(M(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${z.model??X.model??"unreported"}`)),console.log(M(` cold ${X.score}/${X.total} · faf ${z.score}/${z.total} · sha256: ${Q.hash.slice(0,16)}…`))}function VF($,Z){let X=$.cold,z=X.total-X.score;if(console.log(`
516
516
  ${A(`faf bench — ${Z}`)} ${H0("Trouble ahead, expensive trouble.")}
517
- `),console.log(` ${M("without context")}`),console.log(`answers ${X.score}/${X.total} ${M("— the AI is guessing at what you are building")}`),X.tokens!==void 0)console.log(`tokens ${d4(X.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(z>0)console.log(`
517
+ `),console.log(` ${M("without context")}`),console.log(`answers ${X.score}/${X.total} ${M("— the AI is guessing at what you are building")}`),X.tokens!==void 0)console.log(`tokens ${m4(X.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(z>0)console.log(`
518
518
  ${z} answer${z===1?"":"s"} missing: the stack it can dig out (you pay for the dig);`),console.log("what you are trying to DO, it cannot derive at any price."),console.log("Both are already in your repo — unstructured.");console.log(`
519
- ${I("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var XF="https://mcpaas.live/bench/submit";async function zF($,Z){try{let X=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});console.log(M(X.ok?` ✪ submitted to ${Z}`:` submit failed (${X.status})`))}catch{console.log(M(" submit skipped (endpoint unreachable)"))}}function eY($,Z,X={}){let z=X.file??f();if(!z)console.error(`Error: project.faf not found
519
+ ${I("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var KF="https://mcpaas.live/bench/submit";async function HF($,Z){try{let X=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});console.log(M(X.ok?` ✪ submitted to ${Z}`:` submit failed (${X.status})`))}catch{console.log(M(" submit skipped (endpoint unreachable)"))}}function UW($,Z,X={}){let z=X.file??f();if(!z)console.error(`Error: project.faf not found
520
520
 
521
- Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let J=u(z),Q=a_(J),Y=d_(z),W=D0(J)?.project?.name??Y.split("/").pop();if(Q.questions.length===0)console.error("Error: no populated slots to derive questions from.\n\n Run `faf go` to fill the .faf first."),process.exit(2);if($==="questions"){if(X.json){console.log(JSON.stringify({version:Q.version,qsetHash:Q.qsetHash,questions:Q.questions.map(({n:U,question:q})=>({n:U,question:q}))},null,2));return}console.log(`
521
+ Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let J=u(z),Q=YF(J),Y=$F(z),W=D0(J)?.project?.name??Y.split("/").pop();if(Q.questions.length===0)console.error("Error: no populated slots to derive questions from.\n\n Run `faf go` to fill the .faf first."),process.exit(2);if($==="questions"){if(X.json){console.log(JSON.stringify({version:Q.version,qsetHash:Q.qsetHash,questions:Q.questions.map(({n:U,question:q})=>({n:U,question:q}))},null,2));return}console.log(`
522
522
  ${A(`faf bench — ${Q.questions.length} questions`)} ${M(`qset ${Q.qsetHash}`)}
523
523
  `);for(let U of Q.questions)console.log(` ${String(U.n).padStart(2)}. ${U.question}`);console.log(`
524
- ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!aY(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(sY(Z,"utf-8")),q=U.answers??U,G=o_(Q,q),V={score:G.correct,total:G.total,...X.tokens?{tokens:parseInt(X.tokens,10)}:{},...X.model?{model:X.model}:{}},K=t_(Y),H=K&&K.qsetHash===Q.qsetHash?K:{version:Q.version,qsetHash:Q.qsetHash,protocol:"in-session"};if(X.cold)H.cold=V;else if(X.faf)H.faf=V;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(e_(Y,H),X.json){let L=D9(H,W);console.log(JSON.stringify({...H,receipt:L.hash,perQuestion:G.perQuestion},null,2));return}if(H.cold&&H.faf)$F(H,W);if(X.submit&&H.cold&&H.faf){let{cold:L,faf:B}=H,O=D9(H,W);zF({date:new Date().toISOString().slice(0,10),model:B.model??L.model??X.model??"unreported",repo:W,qset:H.qsetHash,cold:`${L.score}/${L.total}`,faf:`${B.score}/${B.total}`,sha256:O.hash.slice(0,16)},X.endpoint??XF)}else if(H.cold)ZF(H,W);else console.log(`
525
- ${A(`faf bench — ${W}`)} ${I("with .faf")}: ${A(`${V.score}/${V.total}`)} ${M(`tokens ${d4(V.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
524
+ ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!QW(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(JW(Z,"utf-8")),q=U.answers??U,G=WF(Q,q),V={score:G.correct,total:G.total,...X.tokens?{tokens:parseInt(X.tokens,10)}:{},...X.model?{model:X.model}:{}},K=UF(Y),H=K&&K.qsetHash===Q.qsetHash?K:{version:Q.version,qsetHash:Q.qsetHash,protocol:"in-session"};if(X.cold)H.cold=V;else if(X.faf)H.faf=V;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(qF(Y,H),X.json){let L=D9(H,W);console.log(JSON.stringify({...H,receipt:L.hash,perQuestion:G.perQuestion},null,2));return}if(H.cold&&H.faf)GF(H,W);if(X.submit&&H.cold&&H.faf){let{cold:L,faf:B}=H,O=D9(H,W);HF({date:new Date().toISOString().slice(0,10),model:B.model??L.model??X.model??"unreported",repo:W,qset:H.qsetHash,cold:`${L.score}/${L.total}`,faf:`${B.score}/${B.total}`,sha256:O.hash.slice(0,16)},X.endpoint??KF)}else if(H.cold)VF(H,W);else console.log(`
525
+ ${A(`faf bench — ${W}`)} ${I("with .faf")}: ${A(`${V.score}/${V.total}`)} ${M(`tokens ${m4(V.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
526
526
  ${A("faf bench — agent-native protocol")} ${M(`qset ${Q.qsetHash} · ${Q.questions.length} questions`)}
527
527
  `),console.log(`${A("COLD phase")} ${M("(fresh AI session, repo access)")}`),console.log(' 1. Instruct: "Answer these questions from the repository.'),console.log(' Do NOT read project.faf, CLAUDE.md, AGENTS.md, or any *.faf file."'),console.log(` 2. ${I("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${I("faf bench grade cold.json --cold --tokens <used> --model <name>")}
528
528
  `),console.log(`${A("FAF phase")} ${M("(same questions, context first)")}`),console.log(' 4. Instruct: "Read project.faf, then answer the same questions." → faf.json'),console.log(` 5. ${I("faf bench grade faf.json --faf --tokens <used> --model <name>")}
529
- `),console.log(M("Grading is mechanical against your own project.faf — the .faf IS the answer key.")),console.log(M(`Receipts carry protocol: in-session (honor-system cold). qset ${Q.qsetHash}.`))}import{existsSync as JF,writeFileSync as QF}from"fs";l();function $W($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
529
+ `),console.log(M("Grading is mechanical against your own project.faf — the .faf IS the answer key.")),console.log(M(`Receipts carry protocol: in-session (honor-system cold). qset ${Q.qsetHash}.`))}import{existsSync as BF,writeFileSync as MF}from"fs";l();function qW($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
530
530
 
531
- Run 'faf init' to create one.`),process.exit(2);let X=u(Z),z=Q0(X),J=new Q1(process.cwd()),Q=J.load()?J.getBirthDNADisplay():null,Y=Q?Q.current:null,W=Y!==null&&Y!==void 0?z.score-Y:0,U=Y!==null&&Y!==void 0&&W!==0,q=Z.replace(/\.faf$/,".fafb"),G=null;if(JF(q)){let V=S8(X);QF(q,V),G=V.length}if($.json)console.log(JSON.stringify({reGrounded:!0,score:z.score,tier:z.tier,baseline:Y,delta:W,drifted:U,fafb:G!==null&&G!==void 0?{reCompiled:!0,bytes:G}:{reCompiled:!1},journey:J.getJourney()||null},null,2));else{if(console.log(`${I("refresh")} ${M("— re-grounding on the live .faf")}
532
- `),U){let V=W>0?"↑":"↓";console.log(` drift: ${M(`${Y}%`)} ${V} ${A(`${z.score}%`)} ${M(`(${W>0?"+":""}${W})`)}`)}else if(Y!==null&&Y!==void 0)console.log(` no drift ${M(`— steady at ${z.score}%`)}`);else console.log(` baseline set ${M(`— ${z.score}%`)}`);if(G!==null&&G!==void 0)console.log(` .fafb re-compiled ${M(`(${G} bytes — fast tier current)`)}`);console.log(` re-grounded: ${d0(z.tier)} ${A(`${z.score}%`)}`)}if(J.exists())J.recordGrowth(z.score,["refresh — re-grounded"]);else J.birth(z.score)}l();import{existsSync as UW}from"fs";import{resolve as v6}from"path";var ZW=["ephemeral","standard","high","critical"],X$=Object.fromEntries(ZW.map(($,Z)=>[$,Z])),I9=new Set(["user","feedback","project","reference"]),T9=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),A9=new Set(["facts","sessions","preferences","custom"]),R9={low:"ephemeral",medium:"standard"};import{readFileSync as YF,writeFileSync as WF,existsSync as UF}from"fs";function y6(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function T0($){return $===null||$===void 0}function p4($){if(T0($))return"standard";if(R9[$])return R9[$];if($ in X$)return $;return"standard"}var qF=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function XW($){if(typeof $==="string")return{text:$,id:null,type:null,priority:"standard",tags:[],links:[],timestamp:null,source:null,extra:{}};if(!$||typeof $!=="object"||!("text"in $))throw Error(`fact must be a string or a mapping with 'text': ${JSON.stringify($)}`);let Z=$,X={};for(let[z,J]of Object.entries(Z))if(!qF.has(z))X[z]=J;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:p4(Z.priority),tags:Array.isArray(Z.tags)?Z.tags.slice():[],links:Array.isArray(Z.links)?Z.links.slice():[],timestamp:Z.timestamp??null,source:Z.source??null,extra:X}}function zW($){if(T0($.id)&&T0($.type)&&$.tags.length===0&&$.links.length===0&&T0($.timestamp)&&T0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let X={text:$.text};if(!T0($.id))X.id=$.id;if(!T0($.type))X.type=$.type;if(X.priority=$.priority,$.tags.length)X.tags=$.tags;if($.links.length)X.links=$.links;if(!T0($.timestamp))X.timestamp=$.timestamp;if(!T0($.source))X.source=$.source;return Object.assign(X,$.extra),X}class $1{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??y6(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.slice():[],this._byId=new Map,this._facts.forEach((X,z)=>{if(!T0(X.id))this._byId.set(X.id,z)}),this._index=Z.index?Z.index.slice():[],this._sessions=Z.sessions?structuredClone(Z.sessions):[],this._preferences=Z.preferences?{...Z.preferences}:{},this._custom=Z.custom?{...Z.custom}:{},this._extra=Z.extra?{...Z.extra}:{},this._memoryExtra=Z.memoryExtra?{...Z.memoryExtra}:{}}get facts(){return this._facts}get index(){return this._index}get sessions(){return this._sessions}get preferences(){return this._preferences}get custom(){return this._custom}get extra(){return this._extra}get memoryExtra(){return this._memoryExtra}static load($){if(!UF($))throw Error(`soul file not found: ${$}`);let Z=YF($,"utf-8"),X=D0(Z);if(!X||typeof X!=="object")throw Error("soul is not a YAML mapping");let z=X.memory&&typeof X.memory==="object"?X.memory:{},J=Array.isArray(z.facts)?z.facts:[],Q={};for(let[U,q]of Object.entries(X))if(!T9.has(U))Q[U]=structuredClone(q);let Y={};for(let[U,q]of Object.entries(z))if(!A9.has(U))Y[U]=structuredClone(q);let W=new $1(String(X.namepoint??$.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(X.profile??"voice"),facts:J.map(XW),retention:String(X.retention??"forever"),created:X.created??null,index:Array.isArray(X.index)?X.index.slice():[],sessions:Array.isArray(z.sessions)?structuredClone(z.sessions):[],preferences:z.preferences&&typeof z.preferences==="object"?structuredClone(z.preferences):{},custom:z.custom&&typeof z.custom==="object"?structuredClone(z.custom):{},extra:Q,memoryExtra:Y});return W.last_etched=String(X.last_etched??W.created),W}static fromFile($){return $1.load($)}toDoc(){let $={facts:this._facts.map(zW),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[X,z]of Object.entries(this._memoryExtra))if(!A9.has(X))$[X]=structuredClone(z);let Z={version:"1.1",profile:this.profile,namepoint:this.namepoint,created:this.created,last_etched:this.last_etched,retention:this.retention,index:this._index.slice(),memory:$};for(let[X,z]of Object.entries(this._extra))if(!T9.has(X))Z[X]=structuredClone(z);return Z}toYaml(){return A2(this.toDoc(),{lineWidth:100})}rebuildIndex($=80){return this._index=this._facts.map((Z)=>`${Z.id??"?"} — ${Z.text.slice(0,$)}`),this._index}save($,Z={}){if(Z.reindex!==!1)this.rebuildIndex();return WF($,this.toYaml(),"utf-8"),$}toFile($,Z={}){return this.save($,Z)}add($){if(!T0($.id)&&this._byId.has($.id)){let Z=this._byId.get($.id);if(Z!==void 0)this._facts[Z]=$}else if(this._facts.push($),!T0($.id))this._byId.set($.id,this._facts.length-1);if($.timestamp&&$.timestamp>(this.last_etched||""))this.last_etched=$.timestamp;return $}etch($,Z={}){return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:p4(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:y6(),source:Z.source??null,extra:{}})}recall($,Z={}){let X=X$[p4(Z.minPriority??"ephemeral")]??0,z=($??"").toLowerCase(),J=new Set(Z.tags??[]),Q=[];this._facts.forEach((W,U)=>{if(z&&!W.text.toLowerCase().includes(z))return;if(J.size>0&&![...J].some((q)=>W.tags.includes(q)))return;if(!T0(Z.type)&&W.type!==Z.type)return;if((X$[W.priority]??1)<X)return;Q.push([U,W])}),Q.sort((W,U)=>{let q=X$[W[1].priority]??1,G=X$[U[1].priority]??1;if(G!==q)return G-q;let V=W[1].timestamp??"",K=U[1].timestamp??"";if(K!==V)return K<V?-1:K>V?1:0;return U[0]-W[0]});let Y=Q.map(([,W])=>W);if(!T0(Z.limit))return Y.slice(0,Z.limit);return Y}getFact($){let Z=this._byId.get($);return Z===void 0?null:this._facts[Z]}deleteFact($){let Z=this._byId.get($);if(Z===void 0)return!1;return this._facts.splice(Z,1),this._byId.clear(),this._facts.forEach((X,z)=>{if(!T0(X.id))this._byId.set(X.id,z)}),!0}}import{readdirSync as GF,readFileSync as VF,statSync as JW,existsSync as KF}from"fs";import{join as HF,basename as QW,resolve as BF}from"path";var YW=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),MF=/\[\[([^\]]+)\]\]/g;function OF($){let Z=JW($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function NF($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let X=D0(Z[1]);if(!X||typeof X!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:X,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function LF($,Z,X){if(!X.name)return null;let z=X.metadata&&typeof X.metadata==="object"?X.metadata:{},J=z.type;if(typeof J!=="string"||!I9.has(J))return null;let Q=String(X.name).trim(),W=(X.description!==void 0&&X.description!==null&&String(X.description).trim()?String(X.description).trim():"")||Q,U={};if(z.originSessionId)U.provenance=[`session:${z.originSessionId}`];let q=[...new Set([...Z.matchAll(MF)].map((G)=>G[1]))].sort();return{text:W,id:Q,type:J,priority:"standard",tags:[],links:q,timestamp:OF($),source:`claude-code memory: ${QW($)}`,extra:U}}function _9($,Z={}){let X=BF($);if(!KF(X))throw Error(`Claude memory directory not found: ${X}`);if(!JW(X).isDirectory())throw Error(`Claude memory path is not a directory: ${X}`);let z=Z.skip??YW,J=Z.namepoint??`@claude-code:${QW(X)}`,Q=[],Y=GF(X).filter((V)=>V.endsWith(".md")).sort();for(let V of Y){if(z.has(V))continue;let K=HF(X,V),H;try{H=VF(K,"utf-8")}catch{continue}let{fm:L,body:B}=NF(H);if(!L)continue;let O=LF(K,B,L);if(O)Q.push(O)}let W=Q.map((V)=>V.timestamp).filter(Boolean),U=W.length?W.reduce((V,K)=>V<K?V:K):y6(),q=W.length?W.reduce((V,K)=>V>K?V:K):U,G=new $1(J,{profile:"knowledge",facts:Q,created:U});return G.last_etched=q,G.rebuildIndex(),G}function F9(){return v6(process.cwd(),"soul.fafm")}function C9($){let Z=v6($??F9());if(!UW(Z))console.error(`Error: soul file not found: ${Z}
531
+ Run 'faf init' to create one.`),process.exit(2);let X=u(Z),z=Q0(X),J=new Q1(process.cwd()),Q=J.load()?J.getBirthDNADisplay():null,Y=Q?Q.current:null,W=Y!==null&&Y!==void 0?z.score-Y:0,U=Y!==null&&Y!==void 0&&W!==0,q=Z.replace(/\.faf$/,".fafb"),G=null;if(BF(q)){let V=S8(X);MF(q,V),G=V.length}if($.json)console.log(JSON.stringify({reGrounded:!0,score:z.score,tier:z.tier,baseline:Y,delta:W,drifted:U,fafb:G!==null&&G!==void 0?{reCompiled:!0,bytes:G}:{reCompiled:!1},journey:J.getJourney()||null},null,2));else{if(console.log(`${I("refresh")} ${M("— re-grounding on the live .faf")}
532
+ `),U){let V=W>0?"↑":"↓";console.log(` drift: ${M(`${Y}%`)} ${V} ${A(`${z.score}%`)} ${M(`(${W>0?"+":""}${W})`)}`)}else if(Y!==null&&Y!==void 0)console.log(` no drift ${M(`— steady at ${z.score}%`)}`);else console.log(` baseline set ${M(`— ${z.score}%`)}`);if(G!==null&&G!==void 0)console.log(` .fafb re-compiled ${M(`(${G} bytes — fast tier current)`)}`);console.log(` re-grounded: ${d0(z.tier)} ${A(`${z.score}%`)}`)}if(J.exists())J.recordGrowth(z.score,["refresh — re-grounded"]);else J.birth(z.score)}l();import{existsSync as NW}from"fs";import{resolve as v6}from"path";var GW=["ephemeral","standard","high","critical"],X$=Object.fromEntries(GW.map(($,Z)=>[$,Z])),I9=new Set(["user","feedback","project","reference"]),T9=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),A9=new Set(["facts","sessions","preferences","custom"]),R9={low:"ephemeral",medium:"standard"};import{readFileSync as OF,writeFileSync as NF,existsSync as LF}from"fs";function y6(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function T0($){return $===null||$===void 0}function c4($){if(T0($))return"standard";if(R9[$])return R9[$];if($ in X$)return $;return"standard"}var DF=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function VW($){if(typeof $==="string")return{text:$,id:null,type:null,priority:"standard",tags:[],links:[],timestamp:null,source:null,extra:{}};if(!$||typeof $!=="object"||!("text"in $))throw Error(`fact must be a string or a mapping with 'text': ${JSON.stringify($)}`);let Z=$,X={};for(let[z,J]of Object.entries(Z))if(!DF.has(z))X[z]=J;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:c4(Z.priority),tags:Array.isArray(Z.tags)?Z.tags.slice():[],links:Array.isArray(Z.links)?Z.links.slice():[],timestamp:Z.timestamp??null,source:Z.source??null,extra:X}}function KW($){if(T0($.id)&&T0($.type)&&$.tags.length===0&&$.links.length===0&&T0($.timestamp)&&T0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let X={text:$.text};if(!T0($.id))X.id=$.id;if(!T0($.type))X.type=$.type;if(X.priority=$.priority,$.tags.length)X.tags=$.tags;if($.links.length)X.links=$.links;if(!T0($.timestamp))X.timestamp=$.timestamp;if(!T0($.source))X.source=$.source;return Object.assign(X,$.extra),X}class e0{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??y6(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.slice():[],this._byId=new Map,this._facts.forEach((X,z)=>{if(!T0(X.id))this._byId.set(X.id,z)}),this._index=Z.index?Z.index.slice():[],this._sessions=Z.sessions?structuredClone(Z.sessions):[],this._preferences=Z.preferences?{...Z.preferences}:{},this._custom=Z.custom?{...Z.custom}:{},this._extra=Z.extra?{...Z.extra}:{},this._memoryExtra=Z.memoryExtra?{...Z.memoryExtra}:{}}get facts(){return this._facts}get index(){return this._index}get sessions(){return this._sessions}get preferences(){return this._preferences}get custom(){return this._custom}get extra(){return this._extra}get memoryExtra(){return this._memoryExtra}static load($){if(!LF($))throw Error(`soul file not found: ${$}`);let Z=OF($,"utf-8"),X=D0(Z);if(!X||typeof X!=="object")throw Error("soul is not a YAML mapping");let z=X.memory&&typeof X.memory==="object"?X.memory:{},J=Array.isArray(z.facts)?z.facts:[],Q={};for(let[U,q]of Object.entries(X))if(!T9.has(U))Q[U]=structuredClone(q);let Y={};for(let[U,q]of Object.entries(z))if(!A9.has(U))Y[U]=structuredClone(q);let W=new e0(String(X.namepoint??$.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(X.profile??"voice"),facts:J.map(VW),retention:String(X.retention??"forever"),created:X.created??null,index:Array.isArray(X.index)?X.index.slice():[],sessions:Array.isArray(z.sessions)?structuredClone(z.sessions):[],preferences:z.preferences&&typeof z.preferences==="object"?structuredClone(z.preferences):{},custom:z.custom&&typeof z.custom==="object"?structuredClone(z.custom):{},extra:Q,memoryExtra:Y});return W.last_etched=String(X.last_etched??W.created),W}static fromFile($){return e0.load($)}toDoc(){let $={facts:this._facts.map(KW),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[X,z]of Object.entries(this._memoryExtra))if(!A9.has(X))$[X]=structuredClone(z);let Z={version:"1.1",profile:this.profile,namepoint:this.namepoint,created:this.created,last_etched:this.last_etched,retention:this.retention,index:this._index.slice(),memory:$};for(let[X,z]of Object.entries(this._extra))if(!T9.has(X))Z[X]=structuredClone(z);return Z}toYaml(){return A2(this.toDoc(),{lineWidth:100})}rebuildIndex($=80){return this._index=this._facts.map((Z)=>`${Z.id??"?"} — ${Z.text.slice(0,$)}`),this._index}save($,Z={}){if(Z.reindex!==!1)this.rebuildIndex();return NF($,this.toYaml(),"utf-8"),$}toFile($,Z={}){return this.save($,Z)}add($){if(!T0($.id)&&this._byId.has($.id)){let Z=this._byId.get($.id);if(Z!==void 0)this._facts[Z]=$}else if(this._facts.push($),!T0($.id))this._byId.set($.id,this._facts.length-1);if($.timestamp&&$.timestamp>(this.last_etched||""))this.last_etched=$.timestamp;return $}etch($,Z={}){return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:c4(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:y6(),source:Z.source??null,extra:{}})}recall($,Z={}){let X=X$[c4(Z.minPriority??"ephemeral")]??0,z=($??"").toLowerCase(),J=new Set(Z.tags??[]),Q=[];this._facts.forEach((W,U)=>{if(z&&!W.text.toLowerCase().includes(z))return;if(J.size>0&&![...J].some((q)=>W.tags.includes(q)))return;if(!T0(Z.type)&&W.type!==Z.type)return;if((X$[W.priority]??1)<X)return;Q.push([U,W])}),Q.sort((W,U)=>{let q=X$[W[1].priority]??1,G=X$[U[1].priority]??1;if(G!==q)return G-q;let V=W[1].timestamp??"",K=U[1].timestamp??"";if(K!==V)return K<V?-1:K>V?1:0;return U[0]-W[0]});let Y=Q.map(([,W])=>W);if(!T0(Z.limit))return Y.slice(0,Z.limit);return Y}getFact($){let Z=this._byId.get($);return Z===void 0?null:this._facts[Z]}deleteFact($){let Z=this._byId.get($);if(Z===void 0)return!1;return this._facts.splice(Z,1),this._byId.clear(),this._facts.forEach((X,z)=>{if(!T0(X.id))this._byId.set(X.id,z)}),!0}}import{readdirSync as IF,readFileSync as TF,statSync as HW,existsSync as AF}from"fs";import{join as RF,basename as BW,resolve as _F}from"path";var MW=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),FF=/\[\[([^\]]+)\]\]/g;function CF($){let Z=HW($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function PF($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let X=D0(Z[1]);if(!X||typeof X!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:X,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function EF($,Z,X){if(!X.name)return null;let z=X.metadata&&typeof X.metadata==="object"?X.metadata:{},J=z.type;if(typeof J!=="string"||!I9.has(J))return null;let Q=String(X.name).trim(),W=(X.description!==void 0&&X.description!==null&&String(X.description).trim()?String(X.description).trim():"")||Q,U={};if(z.originSessionId)U.provenance=[`session:${z.originSessionId}`];let q=[...new Set([...Z.matchAll(FF)].map((G)=>G[1]))].sort();return{text:W,id:Q,type:J,priority:"standard",tags:[],links:q,timestamp:CF($),source:`claude-code memory: ${BW($)}`,extra:U}}function _9($,Z={}){let X=_F($);if(!AF(X))throw Error(`Claude memory directory not found: ${X}`);if(!HW(X).isDirectory())throw Error(`Claude memory path is not a directory: ${X}`);let z=Z.skip??MW,J=Z.namepoint??`@claude-code:${BW(X)}`,Q=[],Y=IF(X).filter((V)=>V.endsWith(".md")).sort();for(let V of Y){if(z.has(V))continue;let K=RF(X,V),H;try{H=TF(K,"utf-8")}catch{continue}let{fm:L,body:B}=PF(H);if(!L)continue;let O=EF(K,B,L);if(O)Q.push(O)}let W=Q.map((V)=>V.timestamp).filter(Boolean),U=W.length?W.reduce((V,K)=>V<K?V:K):y6(),q=W.length?W.reduce((V,K)=>V>K?V:K):U,G=new e0(J,{profile:"knowledge",facts:Q,created:U});return G.last_etched=q,G.rebuildIndex(),G}function F9(){return v6(process.cwd(),"soul.fafm")}function C9($){let Z=v6($??F9());if(!NW(Z))console.error(`Error: soul file not found: ${Z}
533
533
 
534
- Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return $1.load(Z)}function DF($,Z){if(!$)console.error(`Error: directory required
534
+ Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return e0.load(Z)}function wF($,Z){if(!$)console.error(`Error: directory required
535
535
 
536
- faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let X=v6($);try{let z=_9(X,{namepoint:Z.namepoint}),J=v6(Z.output??F9());z.toFile(J),console.log(`${I("memory convert")} ${M("—")} ${z.facts.length} facts → ${J}`),console.log(M(` namepoint ${z.namepoint} profile ${z.profile} index ${z.index.length}`))}catch(z){console.error(`Error: ${z instanceof Error?z.message:z}`),process.exit(1)}}function IF($){let Z=C9($.file);if($.json){console.log(JSON.stringify(Z.facts.map((X)=>({id:X.id,text:X.text,type:X.type,priority:X.priority,tags:X.tags})),null,2));return}console.log(`${I("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
537
- `);for(let X of Z.recall()){let z=X.id?A(X.id):M("(no-id)"),J=[X.type,X.priority].filter(Boolean).join(" · ");if(console.log(` ${z} ${X.text.slice(0,80)}`),J)console.log(M(` ${J}`))}}function TF($,Z){let X=C9(Z.file),z=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,J=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,Q=X.recall($??null,{tags:z,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(J)?J:null});if(Z.json){console.log(JSON.stringify(Q.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${I("memory recall")} ${M(`— ${Q.length} hit(s)`)}${$?M(` for "${$}"`):""}
538
- `);for(let Y of Q)console.log(` ${Y.id?A(Y.id):M("?")} ${Y.text}`)}function AF($,Z){if(!$)console.error(`Error: text required
536
+ faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let X=v6($);try{let z=_9(X,{namepoint:Z.namepoint}),J=v6(Z.output??F9());z.toFile(J),console.log(`${I("memory convert")} ${M("—")} ${z.facts.length} facts → ${J}`),console.log(M(` namepoint ${z.namepoint} profile ${z.profile} index ${z.index.length}`))}catch(z){console.error(`Error: ${z instanceof Error?z.message:z}`),process.exit(1)}}function SF($){let Z=C9($.file);if($.json){console.log(JSON.stringify(Z.facts.map((X)=>({id:X.id,text:X.text,type:X.type,priority:X.priority,tags:X.tags})),null,2));return}console.log(`${I("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
537
+ `);for(let X of Z.recall()){let z=X.id?A(X.id):M("(no-id)"),J=[X.type,X.priority].filter(Boolean).join(" · ");if(console.log(` ${z} ${X.text.slice(0,80)}`),J)console.log(M(` ${J}`))}}function jF($,Z){let X=C9(Z.file),z=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,J=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,Q=X.recall($??null,{tags:z,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(J)?J:null});if(Z.json){console.log(JSON.stringify(Q.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${I("memory recall")} ${M(`— ${Q.length} hit(s)`)}${$?M(` for "${$}"`):""}
538
+ `);for(let Y of Q)console.log(` ${Y.id?A(Y.id):M("?")} ${Y.text}`)}function xF($,Z){if(!$)console.error(`Error: text required
539
539
 
540
- faf memory etch "a durable fact" [--id slug]`),process.exit(2);let X=v6(Z.file??F9()),z=UW(X)?$1.load(X):new $1(Z.namepoint??"@local",{profile:"knowledge"}),J=z.etch($,{id:Z.id,type:Z.type,priority:Z.priority});z.toFile(X),console.log(`${I("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${X}`)}function RF($){let Z=C9($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${I("memory show")} ${M(`— ${Z.namepoint}`)}
540
+ faf memory etch "a durable fact" [--id slug]`),process.exit(2);let X=v6(Z.file??F9()),z=NW(X)?e0.load(X):new e0(Z.namepoint??"@local",{profile:"knowledge"}),J=z.etch($,{id:Z.id,type:Z.type,priority:Z.priority});z.toFile(X),console.log(`${I("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${X}`)}function bF($){let Z=C9($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${I("memory show")} ${M(`— ${Z.namepoint}`)}
541
541
  `),console.log(` profile ${Z.profile}`),console.log(` facts ${Z.facts.length}`),console.log(` index ${Z.index.length}`),console.log(` created ${Z.created}`),console.log(` last_etched ${Z.last_etched}`),Z.index.length){console.log(`
542
- ${A("index")}`);for(let X of Z.index.slice(0,20))console.log(M(` ${X}`));if(Z.index.length>20)console.log(M(` … +${Z.index.length-20} more`))}}function qW($,Z,X={}){if(Z&&typeof Z==="object")X=Z,Z=void 0;switch($){case"convert":DF(Z,X);break;case"ls":case"list":IF(X);break;case"recall":TF(Z,X);break;case"etch":AF(Z,X);break;case"show":RF(X);break;case void 0:case"help":WW();break;default:console.error(`Unknown memory subcommand: ${$}`),WW(),process.exit(2)}}function WW(){console.log(`${I("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
542
+ ${A("index")}`);for(let X of Z.index.slice(0,20))console.log(M(` ${X}`));if(Z.index.length>20)console.log(M(` … +${Z.index.length-20} more`))}}function LW($,Z,X={}){if(Z&&typeof Z==="object")X=Z,Z=void 0;switch($){case"convert":wF(Z,X);break;case"ls":case"list":SF(X);break;case"recall":jF(Z,X);break;case"etch":xF(Z,X);break;case"show":bF(X);break;case void 0:case"help":OW();break;default:console.error(`Unknown memory subcommand: ${$}`),OW(),process.exit(2)}}function OW(){console.log(`${I("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
543
543
  `),console.log(" convert <dir> Claude Code memory dir → soul.fafm"),console.log(" etch <text> Write a fact (creates soul.fafm if needed)"),console.log(" ls List facts (ranked)"),console.log(" recall [query] Deterministic recall"),console.log(` show Soul summary
544
- `),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:GW}=$5(),g=new n9;g.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(GW,"-v, --version");g.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>bZ($));g.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>ZJ());g.command("auto").description("Zero to 100% in one command").action(()=>t8());g.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>zJ($));g.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>uQ($));g.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>j8($,Z));g.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger").option("--endpoint <url>","Override the submit endpoint").action(($,Z,X)=>eY($,Z,X));g.command("show").description("Render project.faf → project.html and open it").action(()=>eJ());g.command("sync").description(".faf ↔ CLAUDE.md (bi-sync, mtime auto-direction)").option("--watch","Watch for changes").option("--direction <dir>","Force direction: auto|push|pull","auto").action(($)=>gZ($));g.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>OJ($,Z));g.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>NJ($,Z));g.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>ZQ($,Z));g.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>VQ($,Z));g.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>qQ($??[]));g.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>KQ($));g.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>DQ($));g.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>LQ($));g.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--llms","Author llms.txt (llmstxt.org view of authored 6Ws — opt-in)").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (.well-known/mcp/server-card) with the FAF context-block").option("--all","Author all formats").option("--output <path>","Write exported files to this directory instead of the current one").action(($)=>i1($));g.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").action(($)=>aJ($));g.command("cards").description("Project .faf + .fafa onto A2A / MCP / registry / catalog cards — one context block, every door").option("--target <list>","Comma list: a2a,mcp,registry,catalog (default: whatever inputs allow)").option("--faf <path>","project.faf path (default: auto-discover)").option("--fafa <path>","agent.fafa path (default: auto-discover)").option("--dir <path>","Working directory (default: cwd)").option("--a2a-url <url>","Public URL of the A2A card (catalog row)").option("--door-url <url>","A2A door when .fafa has no a2a endpoint").option("--faf-pointer <url>","Absolute .faf pointer for served cards (default: ./project.faf)").option("--check","Print projected cards to stdout, do not write").action(($)=>tJ($));g.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").option("--verbose","Show slot breakdown").action(($,Z)=>fZ($,Z));g.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>IQ($));g.command("formats").description("Show supported formats").action(()=>TQ());g.command("clear").description("Clear cached data").action(()=>AQ());g.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>RQ($));g.command("context").description("Author context output").action(()=>_Q());g.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>$W($));g.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>PQ($));g.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>wQ($,Z));g.command("recover").description("Recover .faf from context files").action(()=>SQ());g.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>jQ($));g.command("pro [subcommand]").description("Pro features & licensing").action(($)=>xQ($));g.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>bQ($));g.command("demo").description("Demo walkthrough").action(()=>yQ());g.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>vQ($,Z));g.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` wires the CI receipt printer; bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").action(($,Z)=>fQ($,Z));g.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>uY($));g.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>lY($,Z));g.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>pY($));g.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").action(($,Z,X)=>qW($,Z,X));g.command("bi-sync",{hidden:!0}).action(()=>gZ());g.command("status",{hidden:!0}).action(()=>j8(void 0,{status:!0}));g.command("agents",{hidden:!0}).action(()=>i1({agents:!0}));g.command("cursor",{hidden:!0}).action(()=>i1({cursor:!0}));g.command("gemini",{hidden:!0}).action(()=>i1({gemini:!0}));g.command("grok",{hidden:!0}).action(()=>i1({grok:!0}));g.command("llms",{hidden:!0}).action(()=>i1({llms:!0}));g.command("validate",{hidden:!0}).action(($)=>fZ($));g.command("yolo",{hidden:!0}).action(()=>bZ({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:X}=await Promise.resolve().then(() => (l(),Uz)),z=process.cwd().replace(process.env.HOME??"","~"),J="\x1B[38;2;150;150;150m",Q="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${X($("faf"))} ${Z(`v${GW}`)}`);let q="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${q}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${z}`)}`),console.log("");try{await j8(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${X("faf --help")} ${Z("for commands")}`)})();else g.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',""].join(`
544
+ `),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:DW}=$5(),g=new n9;g.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(DW,"-v, --version");g.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>kZ($));g.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>XJ());g.command("auto").description("Zero to 100% in one command").action(()=>r8());g.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>JJ($));g.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>sQ($));g.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>j8($,Z));g.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger").option("--endpoint <url>","Override the submit endpoint").action(($,Z,X)=>UW($,Z,X));g.command("show").description("Render project.faf → project.html and open it").action(()=>UQ());g.command("sync").description(".faf ↔ CLAUDE.md (bi-sync, mtime auto-direction)").option("--watch","Watch for changes").option("--direction <dir>","Force direction: auto|push|pull","auto").action(($)=>fZ($));g.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>RJ($,Z));g.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>_J($,Z));g.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>GQ($,Z));g.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>IQ($,Z));g.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>LQ($??[]));g.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>TQ($));g.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>EQ($));g.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>PQ($));g.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--llms","Author llms.txt (llmstxt.org view of authored 6Ws — opt-in)").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (.well-known/mcp/server-card) with the FAF context-block").option("--all","Author all formats").option("--output <path>","Write exported files to this directory instead of the current one").action(($)=>i1($));g.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").action(($)=>QQ($));g.command("cards").description("Project .faf + .fafa onto A2A / MCP / registry / catalog cards — one context block, every door").option("--target <list>","Comma list: a2a,mcp,registry,catalog (default: whatever inputs allow)").option("--faf <path>","project.faf path (default: auto-discover)").option("--fafa <path>","agent.fafa path (default: auto-discover)").option("--dir <path>","Working directory (default: cwd)").option("--a2a-url <url>","Public URL of the A2A card (catalog row)").option("--door-url <url>","A2A door when .fafa has no a2a endpoint").option("--faf-pointer <url>","Absolute .faf pointer for served cards (default: ./project.faf)").option("--check","Print projected cards to stdout, do not write").action(($)=>WQ($));g.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").option("--verbose","Show slot breakdown").action(($,Z)=>hZ($,Z));g.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>wQ($));g.command("formats").description("Show supported formats").action(()=>SQ());g.command("clear").description("Clear cached data").action(()=>jQ());g.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>xQ($));g.command("context").description("Author context output").action(()=>bQ());g.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>qW($));g.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>gQ($));g.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>fQ($,Z));g.command("recover").description("Recover .faf from context files").action(()=>hQ());g.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>uQ($));g.command("pro [subcommand]").description("Pro features & licensing").action(($)=>mQ($));g.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>cQ($));g.command("demo").description("Demo walkthrough").action(()=>dQ());g.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>pQ($,Z));g.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` wires the CI receipt printer; bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").action(($,Z)=>nQ($,Z));g.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>sY($));g.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>tY($,Z));g.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>$W($));g.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").action(($,Z,X)=>LW($,Z,X));g.command("bi-sync",{hidden:!0}).action(()=>fZ());g.command("status",{hidden:!0}).action(()=>j8(void 0,{status:!0}));g.command("agents",{hidden:!0}).action(()=>i1({agents:!0}));g.command("cursor",{hidden:!0}).action(()=>i1({cursor:!0}));g.command("gemini",{hidden:!0}).action(()=>i1({gemini:!0}));g.command("grok",{hidden:!0}).action(()=>i1({grok:!0}));g.command("llms",{hidden:!0}).action(()=>i1({llms:!0}));g.command("validate",{hidden:!0}).action(($)=>hZ($));g.command("yolo",{hidden:!0}).action(()=>kZ({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:X}=await Promise.resolve().then(() => (l(),Uz)),z=process.cwd().replace(process.env.HOME??"","~"),J="\x1B[38;2;150;150;150m",Q="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${X($("faf"))} ${Z(`v${DW}`)}`);let q="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${q}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${z}`)}`),console.log("");try{await j8(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${X("faf --help")} ${Z("for commands")}`)})();else g.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',""].join(`
545
545
  `)),g.parse(process.argv);
546
546
 
547
- //# debugId=9E6DC302F130068C64756E2164756E21
547
+ //# debugId=7F47BC5B1322056064756E2164756E21
548
548
  //# sourceMappingURL=cli.js.map