faf-cli 8.1.0 → 8.2.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 BK}from"node:module";var XK=Object.create;var{getPrototypeOf:JK,defineProperty:lZ,getOwnPropertyNames:YK}=Object;var WK=Object.prototype.hasOwnProperty;function UK($){return this[$]}var GK,VK,HK=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?GK??=new WeakMap:VK??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?XK(JK($)):{};let Y=Z||!$||!$.__esModule?lZ(z,"default",{value:$,enumerable:!0}):z;for(let W of YK($))if(!WK.call(Y,W))lZ(Y,W,{get:UK.bind($,W),enumerable:!0});if(Q)X.set($,Y);return Y};var P=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var KK=($)=>$;function qK($,Z){this[$]=KK.bind(null,Z)}var RQ=($,Z)=>{for(var z in Z)lZ($,z,{get:Z[z],enumerable:!0,configurable:!0,set:qK.bind(Z,z)})};var v=($,Z)=>()=>($&&(Z=$($=0)),Z);var n0=BK(import.meta.url);var D1=P((MK)=>{class dZ extends Error{constructor($,Z,z){super(z);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Z,this.exitCode=$,this.nestedError=void 0}}class PQ extends dZ{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}MK.CommanderError=dZ;MK.InvalidArgumentError=PQ});var T8=P((IK)=>{var{InvalidArgumentError:DK}=D1();class FQ{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,z)=>{if(!this.argChoices.includes(Z))throw new DK(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,z);return Z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function OK($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}IK.Argument=FQ;IK.humanReadableArgName=OK});var iZ=P((_K)=>{var{humanReadableArgName:CK}=T8();class SQ{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((Q)=>!Q._hidden),z=$._getHelpCommand();if(z&&!z._hidden)Z.push(z);if(this.sortSubcommands)Z.sort((Q,X)=>{return Q.name().localeCompare(X.name())});return Z}compareOptions($,Z){let z=(Q)=>{return Q.short?Q.short.replace(/^-/,""):Q.long.replace(/^--/,"")};return z($).localeCompare(z(Z))}visibleOptions($){let Z=$.options.filter((Q)=>!Q.hidden),z=$._getHelpOption();if(z&&!z.hidden){let Q=z.short&&$._findOption(z.short),X=z.long&&$._findOption(z.long);if(!Q&&!X)Z.push(z);else if(z.long&&!X)Z.push($.createOption(z.long,z.description));else if(z.short&&!Q)Z.push($.createOption(z.short,z.description))}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let Z=[];for(let z=$.parent;z;z=z.parent){let Q=z.options.filter((X)=>!X.hidden);Z.push(...Q)}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((z)=>CK(z)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(Q))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(Q))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let z="";for(let Q=$.parent;Q;Q=Q.parent)z=Q.name()+" "+z;return z+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).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 z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}formatItemList($,Z,z){if(Z.length===0)return[];return[z.styleTitle($),...Z,""]}groupItems($,Z,z){let Q=new Map;return $.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[])}),Z.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[]);Q.get(J).push(X)}),Q}formatHelp($,Z){let z=Z.padWidth($,Z),Q=Z.helpWidth??80;function X(V,H){return Z.formatItem(V,z,H,Z)}let J=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)J=J.concat([Z.boxWrap(Z.styleCommandDescription(Y),Q),""]);let W=Z.visibleArguments($).map((V)=>{return X(Z.styleArgumentTerm(Z.argumentTerm(V)),Z.styleArgumentDescription(Z.argumentDescription(V)))});if(J=J.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(V)=>V.helpGroupHeading??"Options:").forEach((V,H)=>{let K=V.map((q)=>{return X(Z.styleOptionTerm(Z.optionTerm(q)),Z.styleOptionDescription(Z.optionDescription(q)))});J=J.concat(this.formatItemList(H,K,Z))}),Z.showGlobalOptions){let V=Z.visibleGlobalOptions($).map((H)=>{return X(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});J=J.concat(this.formatItemList("Global Options:",V,Z))}return this.groupItems($.commands,Z.visibleCommands($),(V)=>V.helpGroup()||"Commands:").forEach((V,H)=>{let K=V.map((q)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(q)),Z.styleSubcommandDescription(Z.subcommandDescription(q)))});J=J.concat(this.formatItemList(H,K,Z))}),J.join(`
3
- `)}displayWidth($){return EQ($).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,z,Q){let J=" ".repeat(2);if(!z)return J+$;let Y=$.padEnd(Z+$.length-Q.displayWidth($)),W=2,G=(this.helpWidth??80)-Z-W-2,V;if(G<this.minWidthToWrap||Q.preformatted(z))V=z;else V=Q.boxWrap(z,G).replace(/\n/g,`
2
+ import{createRequire as FK}from"node:module";var LK=Object.create;var{getPrototypeOf:NK,defineProperty:rZ,getOwnPropertyNames:OK}=Object;var DK=Object.prototype.hasOwnProperty;function IK($){return this[$]}var TK,AK,CK=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?TK??=new WeakMap:AK??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?LK(NK($)):{};let Y=Z||!$||!$.__esModule?rZ(z,"default",{value:$,enumerable:!0}):z;for(let W of OK($))if(!DK.call(Y,W))rZ(Y,W,{get:IK.bind($,W),enumerable:!0});if(Q)X.set($,Y);return Y};var F=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var _K=($)=>$;function RK($,Z){this[$]=_K.bind(null,Z)}var kQ=($,Z)=>{for(var z in Z)rZ($,z,{get:Z[z],enumerable:!0,configurable:!0,set:RK.bind(Z,z)})};var g=($,Z)=>()=>($&&(Z=$($=0)),Z);var n0=FK(import.meta.url);var T1=F((PK)=>{class sZ extends Error{constructor($,Z,z){super(z);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Z,this.exitCode=$,this.nestedError=void 0}}class bQ extends sZ{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}PK.CommanderError=sZ;PK.InvalidArgumentError=bQ});var C8=F((xK)=>{var{InvalidArgumentError:jK}=T1();class vQ{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,z)=>{if(!this.argChoices.includes(Z))throw new jK(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,z);return Z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function wK($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}xK.Argument=vQ;xK.humanReadableArgName=wK});var oZ=F((vK)=>{var{humanReadableArgName:bK}=C8();class gQ{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((Q)=>!Q._hidden),z=$._getHelpCommand();if(z&&!z._hidden)Z.push(z);if(this.sortSubcommands)Z.sort((Q,X)=>{return Q.name().localeCompare(X.name())});return Z}compareOptions($,Z){let z=(Q)=>{return Q.short?Q.short.replace(/^-/,""):Q.long.replace(/^--/,"")};return z($).localeCompare(z(Z))}visibleOptions($){let Z=$.options.filter((Q)=>!Q.hidden),z=$._getHelpOption();if(z&&!z.hidden){let Q=z.short&&$._findOption(z.short),X=z.long&&$._findOption(z.long);if(!Q&&!X)Z.push(z);else if(z.long&&!X)Z.push($.createOption(z.long,z.description));else if(z.short&&!Q)Z.push($.createOption(z.short,z.description))}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let Z=[];for(let z=$.parent;z;z=z.parent){let Q=z.options.filter((X)=>!X.hidden);Z.push(...Q)}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((z)=>bK(z)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(Q))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(Q))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let z="";for(let Q=$.parent;Q;Q=Q.parent)z=Q.name()+" "+z;return z+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).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 z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}formatItemList($,Z,z){if(Z.length===0)return[];return[z.styleTitle($),...Z,""]}groupItems($,Z,z){let Q=new Map;return $.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[])}),Z.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[]);Q.get(J).push(X)}),Q}formatHelp($,Z){let z=Z.padWidth($,Z),Q=Z.helpWidth??80;function X(V,H){return Z.formatItem(V,z,H,Z)}let J=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)J=J.concat([Z.boxWrap(Z.styleCommandDescription(Y),Q),""]);let W=Z.visibleArguments($).map((V)=>{return X(Z.styleArgumentTerm(Z.argumentTerm(V)),Z.styleArgumentDescription(Z.argumentDescription(V)))});if(J=J.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(V)=>V.helpGroupHeading??"Options:").forEach((V,H)=>{let K=V.map((q)=>{return X(Z.styleOptionTerm(Z.optionTerm(q)),Z.styleOptionDescription(Z.optionDescription(q)))});J=J.concat(this.formatItemList(H,K,Z))}),Z.showGlobalOptions){let V=Z.visibleGlobalOptions($).map((H)=>{return X(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});J=J.concat(this.formatItemList("Global Options:",V,Z))}return this.groupItems($.commands,Z.visibleCommands($),(V)=>V.helpGroup()||"Commands:").forEach((V,H)=>{let K=V.map((q)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(q)),Z.styleSubcommandDescription(Z.subcommandDescription(q)))});J=J.concat(this.formatItemList(H,K,Z))}),J.join(`
3
+ `)}displayWidth($){return hQ($).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,z,Q){let J=" ".repeat(2);if(!z)return J+$;let Y=$.padEnd(Z+$.length-Q.displayWidth($)),W=2,G=(this.helpWidth??80)-Z-W-2,V;if(G<this.minWidthToWrap||Q.preformatted(z))V=z;else V=Q.boxWrap(z,G).replace(/\n/g,`
4
4
  `+" ".repeat(Z+W));return J+Y+" ".repeat(W)+V.replace(/\n/g,`
5
5
  ${J}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let z=$.split(/\r\n|\n/),Q=/[\s]*[^\s]+/g,X=[];return z.forEach((J)=>{let Y=J.match(Q);if(Y===null){X.push("");return}let W=[Y.shift()],U=this.displayWidth(W[0]);Y.forEach((G)=>{let V=this.displayWidth(G);if(U+V<=Z){W.push(G),U+=V;return}X.push(W.join(""));let H=G.trimStart();W=[H],U=this.displayWidth(H)}),X.push(W.join(""))}),X.join(`
6
- `)}}function EQ($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}_K.Help=SQ;_K.stripColor=EQ});var nZ=P((EK)=>{var{InvalidArgumentError:FK}=D1();class wQ{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=SK($);if(this.short=z.shortFlag,this.long=z.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,z)=>{if(!this.argChoices.includes(Z))throw new FK(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,z);return Z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return jQ(this.name().replace(/^no-/,""));return jQ(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class xQ{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,z)=>{if(this.positiveOptions.has(z))this.dualOptions.add(z)})}valueFromOption($,Z){let z=Z.attributeName();if(!this.dualOptions.has(z))return!0;let Q=this.negativeOptions.get(z).presetArg,X=Q!==void 0?Q:!1;return Z.negate===(X===$)}}function jQ($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function SK($){let Z,z,Q=/^-[^-]$/,X=/^--[^-]/,J=$.split(/[ |,]+/).concat("guard");if(Q.test(J[0]))Z=J.shift();if(X.test(J[0]))z=J.shift();if(!Z&&Q.test(J[0]))Z=J.shift();if(!Z&&X.test(J[0]))Z=z,z=J.shift();if(J[0].startsWith("-")){let Y=J[0],W=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${W}
6
+ `)}}function hQ($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}vK.Help=gQ;vK.stripColor=hQ});var aZ=F((mK)=>{var{InvalidArgumentError:fK}=T1();class uQ{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=uK($);if(this.short=z.shortFlag,this.long=z.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,z)=>{if(!this.argChoices.includes(Z))throw new fK(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,z);return Z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return fQ(this.name().replace(/^no-/,""));return fQ(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class mQ{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,z)=>{if(this.positiveOptions.has(z))this.dualOptions.add(z)})}valueFromOption($,Z){let z=Z.attributeName();if(!this.dualOptions.has(z))return!0;let Q=this.negativeOptions.get(z).presetArg,X=Q!==void 0?Q:!1;return Z.negate===(X===$)}}function fQ($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function uK($){let Z,z,Q=/^-[^-]$/,X=/^--[^-]/,J=$.split(/[ |,]+/).concat("guard");if(Q.test(J[0]))Z=J.shift();if(X.test(J[0]))z=J.shift();if(!Z&&Q.test(J[0]))Z=J.shift();if(!Z&&X.test(J[0]))Z=z,z=J.shift();if(J[0].startsWith("-")){let Y=J[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(Q.test(Y))throw Error(`${W}
10
10
  - too many short flags`);if(X.test(Y))throw Error(`${W}
11
11
  - too many long flags`);throw Error(`${W}
12
- - unrecognised flag format`)}if(Z===void 0&&z===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:z}}EK.Option=wQ;EK.DualOptions=xQ});var yQ=P((kK)=>{function xK($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let z=[];for(let Q=0;Q<=$.length;Q++)z[Q]=[Q];for(let Q=0;Q<=Z.length;Q++)z[0][Q]=Q;for(let Q=1;Q<=Z.length;Q++)for(let X=1;X<=$.length;X++){let J=1;if($[X-1]===Z[Q-1])J=0;else J=1;if(z[X][Q]=Math.min(z[X-1][Q]+1,z[X][Q-1]+1,z[X-1][Q-1]+J),X>1&&Q>1&&$[X-1]===Z[Q-2]&&$[X-2]===Z[Q-1])z[X][Q]=Math.min(z[X][Q],z[X-2][Q-2]+1)}return z[$.length][Z.length]}function yK($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let z=$.startsWith("--");if(z)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let Q=[],X=3,J=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let W=xK($,Y),U=Math.max($.length,Y.length);if((U-W)/U>J){if(W<X)X=W,Q=[Y];else if(W===X)Q.push(Y)}}),Q.sort((Y,W)=>Y.localeCompare(W)),z)Q=Q.map((Y)=>`--${Y}`);if(Q.length>1)return`
12
+ - unrecognised flag format`)}if(Z===void 0&&z===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:z}}mK.Option=uQ;mK.DualOptions=mQ});var cQ=F((iK)=>{function lK($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let z=[];for(let Q=0;Q<=$.length;Q++)z[Q]=[Q];for(let Q=0;Q<=Z.length;Q++)z[0][Q]=Q;for(let Q=1;Q<=Z.length;Q++)for(let X=1;X<=$.length;X++){let J=1;if($[X-1]===Z[Q-1])J=0;else J=1;if(z[X][Q]=Math.min(z[X-1][Q]+1,z[X][Q-1]+1,z[X-1][Q-1]+J),X>1&&Q>1&&$[X-1]===Z[Q-2]&&$[X-2]===Z[Q-1])z[X][Q]=Math.min(z[X][Q],z[X-2][Q-2]+1)}return z[$.length][Z.length]}function dK($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let z=$.startsWith("--");if(z)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let Q=[],X=3,J=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let W=lK($,Y),U=Math.max($.length,Y.length);if((U-W)/U>J){if(W<X)X=W,Q=[Y];else if(W===X)Q.push(Y)}}),Q.sort((Y,W)=>Y.localeCompare(W)),z)Q=Q.map((Y)=>`--${Y}`);if(Q.length>1)return`
13
13
  (Did you mean one of ${Q.join(", ")}?)`;if(Q.length===1)return`
14
- (Did you mean ${Q[0]}?)`;return""}kK.suggestSimilar=yK});var gQ=P((cK)=>{var vK=n0("node:events").EventEmitter,rZ=n0("node:child_process"),k2=n0("node:path"),A8=n0("node:fs"),e=n0("node:process"),{Argument:gK,humanReadableArgName:hK}=T8(),{CommanderError:sZ}=D1(),{Help:fK,stripColor:uK}=iZ(),{Option:kQ,DualOptions:mK}=nZ(),{suggestSimilar:bQ}=yQ();class aZ extends vK{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)=>e.stdout.write(Z),writeErr:(Z)=>e.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>e.stdout.isTTY?e.stdout.columns:void 0,getErrHelpWidth:()=>e.stderr.isTTY?e.stderr.columns:void 0,getOutHasColors:()=>oZ()??(e.stdout.isTTY&&e.stdout.hasColors?.()),getErrHasColors:()=>oZ()??(e.stderr.isTTY&&e.stderr.hasColors?.()),stripColor:(Z)=>uK(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,z){let Q=Z,X=z;if(typeof Q==="object"&&Q!==null)X=Q,Q=null;X=X||{};let[,J,Y]=$.match(/([^ ]+) *(.*)/),W=this.createCommand(J);if(Q)W.description(Q),W._executableHandler=!0;if(X.isDefault)this._defaultCommandName=W._name;if(W._hidden=!!(X.noHelp||X.hidden),W._executableFile=X.executableFile||null,Y)W.arguments(Y);if(this._registerCommand(W),W.parent=this,W.copyInheritedSettings(this),Q)return this;return W}createCommand($){return new aZ($)}createHelp(){return Object.assign(new fK,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 gK($,Z)}argument($,Z,z,Q){let X=this.createArgument($,Z);if(typeof z==="function")X.default(Q).argParser(z);else X.default(z);return this.addArgument(X),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 z=$??"help [command]",[,Q,X]=z.match(/([^ ]+) *(.*)/),J=Z??"display help for command",Y=this.createCommand(Q);if(Y.helpOption(!1),X)Y.arguments(X);if(J)Y.description(J);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 z=["preSubcommand","preAction","postAction"];if(!z.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
- Expecting one of '${z.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,z){if(this._exitCallback)this._exitCallback(new sZ($,Z,z));e.exit($)}action($){let Z=(z)=>{let Q=this.registeredArguments.length,X=z.slice(0,Q);if(this._storeOptionsAsProperties)X[Q]=this;else X[Q]=this.opts();return X.push(this),$.apply(this,X)};return this._actionHandler=Z,this}createOption($,Z){return new kQ($,Z)}_callParseArg($,Z,z,Q){try{return $.parseArg(Z,z)}catch(X){if(X.code==="commander.invalidArgument"){let J=`${Q} ${X.message}`;this.error(J,{exitCode:X.exitCode,code:X.code})}throw X}}_registerOption($){let Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let z=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${z}'
17
- - already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(Q)=>{return[Q.name()].concat(Q.aliases())},z=Z($).find((Q)=>this._findCommand(Q));if(z){let Q=Z(this._findCommand(z)).join("|"),X=Z($).join("|");throw Error(`cannot add command '${X}' as already have command '${Q}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),z=$.attributeName();if($.negate){let X=$.long.replace(/^--no-/,"--");if(!this._findOption(X))this.setOptionValueWithSource(z,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(z,$.defaultValue,"default");let Q=(X,J,Y)=>{if(X==null&&$.presetArg!==void 0)X=$.presetArg;let W=this.getOptionValue(z);if(X!==null&&$.parseArg)X=this._callParseArg($,X,W,J);else if(X!==null&&$.variadic)X=$._collectValue(X,W);if(X==null)if($.negate)X=!1;else if($.isBoolean()||$.optional)X=!0;else X="";this.setOptionValueWithSource(z,X,Y)};if(this.on("option:"+Z,(X)=>{let J=`error: option '${$.flags}' argument '${X}' is invalid.`;Q(X,J,"cli")}),$.envVar)this.on("optionEnv:"+Z,(X)=>{let J=`error: option '${$.flags}' value '${X}' from env '${$.envVar}' is invalid.`;Q(X,J,"env")});return this}_optionEx($,Z,z,Q,X){if(typeof Z==="object"&&Z instanceof kQ)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(Z,z);if(J.makeOptionMandatory(!!$.mandatory),typeof Q==="function")J.default(X).argParser(Q);else if(Q instanceof RegExp){let Y=Q;Q=(W,U)=>{let G=Y.exec(W);return G?G[0]:U},J.default(X).argParser(Q)}else J.default(Q);return this.addOption(J)}option($,Z,z,Q){return this._optionEx({},$,Z,z,Q)}requiredOption($,Z,z,Q){return this._optionEx({mandatory:!0},$,Z,z,Q)}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,z){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=z,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((z)=>{if(z.getOptionValueSource($)!==void 0)Z=z.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(e.versions?.electron)Z.from="electron";let Q=e.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=e.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if(e.defaultApp)this._scriptPath=$[1],z=$.slice(2);else z=$.slice(1);break;case"user":z=$.slice(0);break;case"eval":z=$.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",z}parse($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return this._parseCommand([],z),this}async parseAsync($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return await this._parseCommand([],z),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
- - 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,z){if(A8.existsSync($))return;let Q=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",X=`'${$}' does not exist
14
+ (Did you mean ${Q[0]}?)`;return""}iK.suggestSimilar=dK});var iQ=F(($q)=>{var rK=n0("node:events").EventEmitter,tZ=n0("node:child_process"),b2=n0("node:path"),_8=n0("node:fs"),e=n0("node:process"),{Argument:sK,humanReadableArgName:oK}=C8(),{CommanderError:eZ}=T1(),{Help:aK,stripColor:tK}=oZ(),{Option:pQ,DualOptions:eK}=aZ(),{suggestSimilar:lQ}=cQ();class Z7 extends rK{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)=>e.stdout.write(Z),writeErr:(Z)=>e.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>e.stdout.isTTY?e.stdout.columns:void 0,getErrHelpWidth:()=>e.stderr.isTTY?e.stderr.columns:void 0,getOutHasColors:()=>$7()??(e.stdout.isTTY&&e.stdout.hasColors?.()),getErrHasColors:()=>$7()??(e.stderr.isTTY&&e.stderr.hasColors?.()),stripColor:(Z)=>tK(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,z){let Q=Z,X=z;if(typeof Q==="object"&&Q!==null)X=Q,Q=null;X=X||{};let[,J,Y]=$.match(/([^ ]+) *(.*)/),W=this.createCommand(J);if(Q)W.description(Q),W._executableHandler=!0;if(X.isDefault)this._defaultCommandName=W._name;if(W._hidden=!!(X.noHelp||X.hidden),W._executableFile=X.executableFile||null,Y)W.arguments(Y);if(this._registerCommand(W),W.parent=this,W.copyInheritedSettings(this),Q)return this;return W}createCommand($){return new Z7($)}createHelp(){return Object.assign(new aK,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 sK($,Z)}argument($,Z,z,Q){let X=this.createArgument($,Z);if(typeof z==="function")X.default(Q).argParser(z);else X.default(z);return this.addArgument(X),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 z=$??"help [command]",[,Q,X]=z.match(/([^ ]+) *(.*)/),J=Z??"display help for command",Y=this.createCommand(Q);if(Y.helpOption(!1),X)Y.arguments(X);if(J)Y.description(J);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 z=["preSubcommand","preAction","postAction"];if(!z.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
16
+ Expecting one of '${z.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,z){if(this._exitCallback)this._exitCallback(new eZ($,Z,z));e.exit($)}action($){let Z=(z)=>{let Q=this.registeredArguments.length,X=z.slice(0,Q);if(this._storeOptionsAsProperties)X[Q]=this;else X[Q]=this.opts();return X.push(this),$.apply(this,X)};return this._actionHandler=Z,this}createOption($,Z){return new pQ($,Z)}_callParseArg($,Z,z,Q){try{return $.parseArg(Z,z)}catch(X){if(X.code==="commander.invalidArgument"){let J=`${Q} ${X.message}`;this.error(J,{exitCode:X.exitCode,code:X.code})}throw X}}_registerOption($){let Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let z=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${z}'
17
+ - already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(Q)=>{return[Q.name()].concat(Q.aliases())},z=Z($).find((Q)=>this._findCommand(Q));if(z){let Q=Z(this._findCommand(z)).join("|"),X=Z($).join("|");throw Error(`cannot add command '${X}' as already have command '${Q}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),z=$.attributeName();if($.negate){let X=$.long.replace(/^--no-/,"--");if(!this._findOption(X))this.setOptionValueWithSource(z,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(z,$.defaultValue,"default");let Q=(X,J,Y)=>{if(X==null&&$.presetArg!==void 0)X=$.presetArg;let W=this.getOptionValue(z);if(X!==null&&$.parseArg)X=this._callParseArg($,X,W,J);else if(X!==null&&$.variadic)X=$._collectValue(X,W);if(X==null)if($.negate)X=!1;else if($.isBoolean()||$.optional)X=!0;else X="";this.setOptionValueWithSource(z,X,Y)};if(this.on("option:"+Z,(X)=>{let J=`error: option '${$.flags}' argument '${X}' is invalid.`;Q(X,J,"cli")}),$.envVar)this.on("optionEnv:"+Z,(X)=>{let J=`error: option '${$.flags}' value '${X}' from env '${$.envVar}' is invalid.`;Q(X,J,"env")});return this}_optionEx($,Z,z,Q,X){if(typeof Z==="object"&&Z instanceof pQ)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(Z,z);if(J.makeOptionMandatory(!!$.mandatory),typeof Q==="function")J.default(X).argParser(Q);else if(Q instanceof RegExp){let Y=Q;Q=(W,U)=>{let G=Y.exec(W);return G?G[0]:U},J.default(X).argParser(Q)}else J.default(Q);return this.addOption(J)}option($,Z,z,Q){return this._optionEx({},$,Z,z,Q)}requiredOption($,Z,z,Q){return this._optionEx({mandatory:!0},$,Z,z,Q)}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,z){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=z,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((z)=>{if(z.getOptionValueSource($)!==void 0)Z=z.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(e.versions?.electron)Z.from="electron";let Q=e.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=e.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if(e.defaultApp)this._scriptPath=$[1],z=$.slice(2);else z=$.slice(1);break;case"user":z=$.slice(0);break;case"eval":z=$.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",z}parse($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return this._parseCommand([],z),this}async parseAsync($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return await this._parseCommand([],z),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
+ - 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,z){if(_8.existsSync($))return;let Q=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",X=`'${$}' does not exist
19
19
  - if '${z}' 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
- - ${Q}`;throw Error(X)}_executeSubCommand($,Z){Z=Z.slice();let z=!1,Q=[".js",".ts",".tsx",".mjs",".cjs"];function X(G,V){let H=k2.resolve(G,V);if(A8.existsSync(H))return H;if(Q.includes(k2.extname(V)))return;let K=Q.find((q)=>A8.existsSync(`${H}${q}`));if(K)return`${H}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=A8.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=k2.resolve(k2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=k2.basename(this._scriptPath,k2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(k2.extname(J));let W;if(e.platform!=="win32")if(z)Z.unshift(J),Z=vQ(e.execArgv).concat(Z),W=rZ.spawn(e.argv[0],Z,{stdio:"inherit"});else W=rZ.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=vQ(e.execArgv).concat(Z),W=rZ.spawn(e.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{e.on(V,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(V)})});let U=this._exitCallback;W.on("close",(G)=>{if(G=G??1,!U)e.exit(G);else U(new sZ(G,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(G)=>{if(G.code==="ENOENT")this._checkForMissingExecutable(J,Y,$._name);else if(G.code==="EACCES")throw Error(`'${J}' not executable`);if(!U)e.exit(1);else{let V=new sZ(1,"commander.executeSubCommandAsync","(error)");V.nestedError=G,U(V)}}),this.runningCommand=W}_dispatchSubcommand($,Z,z){let Q=this._findCommand($);if(!Q)this.help({error:!0});Q._prepareForParse();let X;return X=this._chainOrCallSubCommandHook(X,Q,"preSubcommand"),X=this._chainOrCall(X,()=>{if(Q._executableHandler)this._executeSubCommand(Q,Z.concat(z));else return Q._parseCommand(Z,z)}),X}_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 $=(z,Q,X)=>{let J=Q;if(Q!==null&&z.parseArg){let Y=`error: command-argument value '${Q}' is invalid for argument '${z.name()}'.`;J=this._callParseArg(z,Q,X,Y)}return J};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((z,Q)=>{let X=z.defaultValue;if(z.variadic){if(Q<this.args.length){if(X=this.args.slice(Q),z.parseArg)X=X.reduce((J,Y)=>{return $(z,Y,J)},z.defaultValue)}else if(X===void 0)X=[]}else if(Q<this.args.length){if(X=this.args[Q],z.parseArg)X=$(z,X,z.defaultValue)}Z[Q]=X}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let z=$,Q=[];if(this._getCommandAndAncestors().reverse().filter((X)=>X._lifeCycleHooks[Z]!==void 0).forEach((X)=>{X._lifeCycleHooks[Z].forEach((J)=>{Q.push({hookedCommand:X,callback:J})})}),Z==="postAction")Q.reverse();return Q.forEach((X)=>{z=this._chainOrCall(z,()=>{return X.callback(X.hookedCommand,this)})}),z}_chainOrCallSubCommandHook($,Z,z){let Q=$;if(this._lifeCycleHooks[z]!==void 0)this._lifeCycleHooks[z].forEach((X)=>{Q=this._chainOrCall(Q,()=>{return X(this,Z)})});return Q}_parseCommand($,Z){let z=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(z.operands),Z=z.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(z.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=()=>{if(z.unknown.length>0)this.unknownOption(z.unknown[0])},X=`command:${this.name()}`;if(this._actionHandler){Q(),this._processArguments();let J;if(J=this._chainOrCallHooks(J,"preAction"),J=this._chainOrCall(J,()=>this._actionHandler(this.processedArgs)),this.parent)J=this._chainOrCall(J,()=>{this.parent.emit(X,$,Z)});return J=this._chainOrCallHooks(J,"postAction"),J}if(this.parent?.listenerCount(X))Q(),this._processArguments(),this.parent.emit(X,$,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 Q(),this._processArguments()}else if(this.commands.length)Q(),this.help({error:!0});else Q(),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((z)=>{let Q=z.attributeName();if(this.getOptionValue(Q)===void 0)return!1;return this.getOptionValueSource(Q)!=="default"});$.filter((z)=>z.conflictsWith.length>0).forEach((z)=>{let Q=$.find((X)=>z.conflictsWith.includes(X.attributeName()));if(Q)this._conflictingOption(z,Q)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],z=[],Q=Z;function X(G){return G.length>1&&G[0]==="-"}let J=(G)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(G))return!1;return!this._getCommandAndAncestors().some((V)=>V.options.map((H)=>H.short).some((H)=>/^-\d$/.test(H)))},Y=null,W=null,U=0;while(U<$.length||W){let G=W??$[U++];if(W=null,G==="--"){if(Q===z)Q.push(G);Q.push(...$.slice(U));break}if(Y&&(!X(G)||J(G))){this.emit(`option:${Y.name()}`,G);continue}if(Y=null,X(G)){let V=this._findOption(G);if(V){if(V.required){let H=$[U++];if(H===void 0)this.optionMissingArgument(V);this.emit(`option:${V.name()}`,H)}else if(V.optional){let H=null;if(U<$.length&&(!X($[U])||J($[U])))H=$[U++];this.emit(`option:${V.name()}`,H)}else this.emit(`option:${V.name()}`);Y=V.variadic?V:null;continue}}if(G.length>2&&G[0]==="-"&&G[1]!=="-"){let V=this._findOption(`-${G[1]}`);if(V){if(V.required||V.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${V.name()}`,G.slice(2));else this.emit(`option:${V.name()}`),W=`-${G.slice(2)}`;continue}}if(/^--[^=]+=/.test(G)){let V=G.indexOf("="),H=this._findOption(G.slice(0,V));if(H&&(H.required||H.optional)){this.emit(`option:${H.name()}`,G.slice(V+1));continue}}if(Q===Z&&X(G)&&!(this.commands.length===0&&J(G)))Q=z;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&z.length===0){if(this._findCommand(G)){Z.push(G),z.push(...$.slice(U));break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){Z.push(G,...$.slice(U));break}else if(this._defaultCommandName){z.push(G,...$.slice(U));break}}if(this._passThroughOptions){Q.push(G,...$.slice(U));break}Q.push(G)}return{operands:Z,unknown:z}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let z=0;z<Z;z++){let Q=this.options[z].attributeName();$[Q]=Q===this._versionOptionName?this._version:this[Q]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
21
+ - ${Q}`;throw Error(X)}_executeSubCommand($,Z){Z=Z.slice();let z=!1,Q=[".js",".ts",".tsx",".mjs",".cjs"];function X(G,V){let H=b2.resolve(G,V);if(_8.existsSync(H))return H;if(Q.includes(b2.extname(V)))return;let K=Q.find((q)=>_8.existsSync(`${H}${q}`));if(K)return`${H}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=_8.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=b2.resolve(b2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=b2.basename(this._scriptPath,b2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(b2.extname(J));let W;if(e.platform!=="win32")if(z)Z.unshift(J),Z=dQ(e.execArgv).concat(Z),W=tZ.spawn(e.argv[0],Z,{stdio:"inherit"});else W=tZ.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=dQ(e.execArgv).concat(Z),W=tZ.spawn(e.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{e.on(V,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(V)})});let U=this._exitCallback;W.on("close",(G)=>{if(G=G??1,!U)e.exit(G);else U(new eZ(G,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(G)=>{if(G.code==="ENOENT")this._checkForMissingExecutable(J,Y,$._name);else if(G.code==="EACCES")throw Error(`'${J}' not executable`);if(!U)e.exit(1);else{let V=new eZ(1,"commander.executeSubCommandAsync","(error)");V.nestedError=G,U(V)}}),this.runningCommand=W}_dispatchSubcommand($,Z,z){let Q=this._findCommand($);if(!Q)this.help({error:!0});Q._prepareForParse();let X;return X=this._chainOrCallSubCommandHook(X,Q,"preSubcommand"),X=this._chainOrCall(X,()=>{if(Q._executableHandler)this._executeSubCommand(Q,Z.concat(z));else return Q._parseCommand(Z,z)}),X}_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 $=(z,Q,X)=>{let J=Q;if(Q!==null&&z.parseArg){let Y=`error: command-argument value '${Q}' is invalid for argument '${z.name()}'.`;J=this._callParseArg(z,Q,X,Y)}return J};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((z,Q)=>{let X=z.defaultValue;if(z.variadic){if(Q<this.args.length){if(X=this.args.slice(Q),z.parseArg)X=X.reduce((J,Y)=>{return $(z,Y,J)},z.defaultValue)}else if(X===void 0)X=[]}else if(Q<this.args.length){if(X=this.args[Q],z.parseArg)X=$(z,X,z.defaultValue)}Z[Q]=X}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let z=$,Q=[];if(this._getCommandAndAncestors().reverse().filter((X)=>X._lifeCycleHooks[Z]!==void 0).forEach((X)=>{X._lifeCycleHooks[Z].forEach((J)=>{Q.push({hookedCommand:X,callback:J})})}),Z==="postAction")Q.reverse();return Q.forEach((X)=>{z=this._chainOrCall(z,()=>{return X.callback(X.hookedCommand,this)})}),z}_chainOrCallSubCommandHook($,Z,z){let Q=$;if(this._lifeCycleHooks[z]!==void 0)this._lifeCycleHooks[z].forEach((X)=>{Q=this._chainOrCall(Q,()=>{return X(this,Z)})});return Q}_parseCommand($,Z){let z=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(z.operands),Z=z.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(z.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Q=()=>{if(z.unknown.length>0)this.unknownOption(z.unknown[0])},X=`command:${this.name()}`;if(this._actionHandler){Q(),this._processArguments();let J;if(J=this._chainOrCallHooks(J,"preAction"),J=this._chainOrCall(J,()=>this._actionHandler(this.processedArgs)),this.parent)J=this._chainOrCall(J,()=>{this.parent.emit(X,$,Z)});return J=this._chainOrCallHooks(J,"postAction"),J}if(this.parent?.listenerCount(X))Q(),this._processArguments(),this.parent.emit(X,$,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 Q(),this._processArguments()}else if(this.commands.length)Q(),this.help({error:!0});else Q(),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((z)=>{let Q=z.attributeName();if(this.getOptionValue(Q)===void 0)return!1;return this.getOptionValueSource(Q)!=="default"});$.filter((z)=>z.conflictsWith.length>0).forEach((z)=>{let Q=$.find((X)=>z.conflictsWith.includes(X.attributeName()));if(Q)this._conflictingOption(z,Q)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],z=[],Q=Z;function X(G){return G.length>1&&G[0]==="-"}let J=(G)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(G))return!1;return!this._getCommandAndAncestors().some((V)=>V.options.map((H)=>H.short).some((H)=>/^-\d$/.test(H)))},Y=null,W=null,U=0;while(U<$.length||W){let G=W??$[U++];if(W=null,G==="--"){if(Q===z)Q.push(G);Q.push(...$.slice(U));break}if(Y&&(!X(G)||J(G))){this.emit(`option:${Y.name()}`,G);continue}if(Y=null,X(G)){let V=this._findOption(G);if(V){if(V.required){let H=$[U++];if(H===void 0)this.optionMissingArgument(V);this.emit(`option:${V.name()}`,H)}else if(V.optional){let H=null;if(U<$.length&&(!X($[U])||J($[U])))H=$[U++];this.emit(`option:${V.name()}`,H)}else this.emit(`option:${V.name()}`);Y=V.variadic?V:null;continue}}if(G.length>2&&G[0]==="-"&&G[1]!=="-"){let V=this._findOption(`-${G[1]}`);if(V){if(V.required||V.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${V.name()}`,G.slice(2));else this.emit(`option:${V.name()}`),W=`-${G.slice(2)}`;continue}}if(/^--[^=]+=/.test(G)){let V=G.indexOf("="),H=this._findOption(G.slice(0,V));if(H&&(H.required||H.optional)){this.emit(`option:${H.name()}`,G.slice(V+1));continue}}if(Q===Z&&X(G)&&!(this.commands.length===0&&J(G)))Q=z;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&z.length===0){if(this._findCommand(G)){Z.push(G),z.push(...$.slice(U));break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){Z.push(G,...$.slice(U));break}else if(this._defaultCommandName){z.push(G,...$.slice(U));break}}if(this._passThroughOptions){Q.push(G,...$.slice(U));break}Q.push(G)}return{operands:Z,unknown:z}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let z=0;z<Z;z++){let Q=this.options[z].attributeName();$[Q]=Q===this._versionOptionName?this._version:this[Q]}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 z=Z||{},Q=z.exitCode||1,X=z.code||"commander.error";this._exit(Q,X,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in e.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,e.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new mK(this.options),Z=(z)=>{return this.getOptionValue(z)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(z))};this.options.filter((z)=>z.implied!==void 0&&Z(z.attributeName())&&$.valueFromOption(this.getOptionValue(z.attributeName()),z)).forEach((z)=>{Object.keys(z.implied).filter((Q)=>!Z(Q)).forEach((Q)=>{this.setOptionValueWithSource(Q,z.implied[Q],"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 z=(J)=>{let Y=J.attributeName(),W=this.getOptionValue(Y),U=this.options.find((V)=>V.negate&&Y===V.attributeName()),G=this.options.find((V)=>!V.negate&&Y===V.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return G||J},Q=(J)=>{let Y=z(J),W=Y.attributeName();if(this.getOptionValueSource(W)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},X=`error: ${Q($)} cannot be used with ${Q(Z)}`;this.error(X,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let Q=[],X=this;do{let J=X.createHelp().visibleOptions(X).filter((Y)=>Y.long).map((Y)=>Y.long);Q=Q.concat(J),X=X.parent}while(X&&!X._enablePositionalOptions);Z=bQ($,Q)}let z=`error: unknown option '${$}'${Z}`;this.error(z,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let Z=this.registeredArguments.length,z=Z===1?"":"s",X=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${z} but got ${$.length}.`;this.error(X,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let Q=[];this.createHelp().visibleCommands(this).forEach((X)=>{if(Q.push(X.name()),X.alias())Q.push(X.alias())}),Z=bQ($,Q)}let z=`error: unknown command '${$}'${Z}`;this.error(z,{code:"commander.unknownCommand"})}version($,Z,z){if($===void 0)return this._version;this._version=$,Z=Z||"-V, --version",z=z||"output the version number";let Q=this.createOption(Z,z);return this._versionOptionName=Q.attributeName(),this._registerOption(Q),this.on("option:"+Q.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 z=this.parent?._findCommand($);if(z){let Q=[z.name()].concat(z.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${Q}'`)}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((z)=>{return hK(z)});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=k2.basename($,k2.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),z=this._getOutputContext($);Z.prepareContext({error:z.error,helpWidth:z.helpWidth,outputHasColors:z.hasColors});let Q=Z.formatHelp(this,Z);if(z.hasColors)return Q;return this._outputConfiguration.stripColor(Q)}_getOutputContext($){$=$||{};let Z=!!$.error,z,Q,X;if(Z)z=(Y)=>this._outputConfiguration.writeErr(Y),Q=this._outputConfiguration.getErrHasColors(),X=this._outputConfiguration.getErrHelpWidth();else z=(Y)=>this._outputConfiguration.writeOut(Y),Q=this._outputConfiguration.getOutHasColors(),X=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!Q)Y=this._outputConfiguration.stripColor(Y);return z(Y)},hasColors:Q,helpWidth:X}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let z=this._getOutputContext($),Q={error:z.error,write:z.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let X=this.helpInformation({error:z.error});if(Z){if(X=Z(X),typeof X!=="string"&&!Buffer.isBuffer(X))throw Error("outputHelp callback must return a string or a Buffer")}if(z.write(X),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",Q))}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(e.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let z=["beforeAll","before","after","afterAll"];if(!z.includes($))throw Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0});let z=Z||{},Q=z.exitCode||1,X=z.code||"commander.error";this._exit(Q,X,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in e.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,e.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new eK(this.options),Z=(z)=>{return this.getOptionValue(z)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(z))};this.options.filter((z)=>z.implied!==void 0&&Z(z.attributeName())&&$.valueFromOption(this.getOptionValue(z.attributeName()),z)).forEach((z)=>{Object.keys(z.implied).filter((Q)=>!Z(Q)).forEach((Q)=>{this.setOptionValueWithSource(Q,z.implied[Q],"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 z=(J)=>{let Y=J.attributeName(),W=this.getOptionValue(Y),U=this.options.find((V)=>V.negate&&Y===V.attributeName()),G=this.options.find((V)=>!V.negate&&Y===V.attributeName());if(U&&(U.presetArg===void 0&&W===!1||U.presetArg!==void 0&&W===U.presetArg))return U;return G||J},Q=(J)=>{let Y=z(J),W=Y.attributeName();if(this.getOptionValueSource(W)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},X=`error: ${Q($)} cannot be used with ${Q(Z)}`;this.error(X,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let Q=[],X=this;do{let J=X.createHelp().visibleOptions(X).filter((Y)=>Y.long).map((Y)=>Y.long);Q=Q.concat(J),X=X.parent}while(X&&!X._enablePositionalOptions);Z=lQ($,Q)}let z=`error: unknown option '${$}'${Z}`;this.error(z,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let Z=this.registeredArguments.length,z=Z===1?"":"s",X=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${z} but got ${$.length}.`;this.error(X,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let Q=[];this.createHelp().visibleCommands(this).forEach((X)=>{if(Q.push(X.name()),X.alias())Q.push(X.alias())}),Z=lQ($,Q)}let z=`error: unknown command '${$}'${Z}`;this.error(z,{code:"commander.unknownCommand"})}version($,Z,z){if($===void 0)return this._version;this._version=$,Z=Z||"-V, --version",z=z||"output the version number";let Q=this.createOption(Z,z);return this._versionOptionName=Q.attributeName(),this._registerOption(Q),this.on("option:"+Q.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 z=this.parent?._findCommand($);if(z){let Q=[z.name()].concat(z.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${Q}'`)}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((z)=>{return oK(z)});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=b2.basename($,b2.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),z=this._getOutputContext($);Z.prepareContext({error:z.error,helpWidth:z.helpWidth,outputHasColors:z.hasColors});let Q=Z.formatHelp(this,Z);if(z.hasColors)return Q;return this._outputConfiguration.stripColor(Q)}_getOutputContext($){$=$||{};let Z=!!$.error,z,Q,X;if(Z)z=(Y)=>this._outputConfiguration.writeErr(Y),Q=this._outputConfiguration.getErrHasColors(),X=this._outputConfiguration.getErrHelpWidth();else z=(Y)=>this._outputConfiguration.writeOut(Y),Q=this._outputConfiguration.getOutHasColors(),X=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!Q)Y=this._outputConfiguration.stripColor(Y);return z(Y)},hasColors:Q,helpWidth:X}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let z=this._getOutputContext($),Q={error:z.error,write:z.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let X=this.helpInformation({error:z.error});if(Z){if(X=Z(X),typeof X!=="string"&&!Buffer.isBuffer(X))throw Error("outputHelp callback must return a string or a Buffer")}if(z.write(X),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",Q))}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(e.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let z=["beforeAll","before","after","afterAll"];if(!z.includes($))throw Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${z.join("', '")}'`);let Q=`${$}Help`;return this.on(Q,(X)=>{let J;if(typeof Z==="function")J=Z({error:X.error,command:X.command});else J=Z;if(J)X.write(`${J}
27
- `)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((Q)=>Z.is(Q)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function vQ($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let z,Q="127.0.0.1",X="9229",J;if((J=Z.match(/^(--inspect(-brk)?)$/))!==null)z=J[1];else if((J=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(z=J[1],/^\d+$/.test(J[3]))X=J[3];else Q=J[3];else if((J=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)z=J[1],Q=J[3],X=J[4];if(z&&X!=="0")return`${z}=${Q}:${parseInt(X)+1}`;return Z})}function oZ(){if(e.env.NO_COLOR||e.env.FORCE_COLOR==="0"||e.env.FORCE_COLOR==="false")return!1;if(e.env.FORCE_COLOR||e.env.CLICOLOR_FORCE!==void 0)return!0;return}cK.Command=aZ;cK.useColor=oZ});var mQ=P((nK)=>{var{Argument:hQ}=T8(),{Command:tZ}=gQ(),{CommanderError:dK,InvalidArgumentError:fQ}=D1(),{Help:iK}=iZ(),{Option:uQ}=nZ();nK.program=new tZ;nK.createCommand=($)=>new tZ($);nK.createOption=($,Z)=>new uQ($,Z);nK.createArgument=($,Z)=>new hQ($,Z);nK.Command=tZ;nK.Option=uQ;nK.Argument=hQ;nK.Help=iK;nK.CommanderError=dK;nK.InvalidArgumentError=fQ;nK.InvalidOptionArgumentError=fQ});var t=P((Kq)=>{var eZ=Symbol.for("yaml.alias"),lQ=Symbol.for("yaml.document"),C8=Symbol.for("yaml.map"),dQ=Symbol.for("yaml.pair"),$7=Symbol.for("yaml.scalar"),_8=Symbol.for("yaml.seq"),b2=Symbol.for("yaml.node.type"),Jq=($)=>!!$&&typeof $==="object"&&$[b2]===eZ,Yq=($)=>!!$&&typeof $==="object"&&$[b2]===lQ,Wq=($)=>!!$&&typeof $==="object"&&$[b2]===C8,Uq=($)=>!!$&&typeof $==="object"&&$[b2]===dQ,iQ=($)=>!!$&&typeof $==="object"&&$[b2]===$7,Gq=($)=>!!$&&typeof $==="object"&&$[b2]===_8;function nQ($){if($&&typeof $==="object")switch($[b2]){case C8:case _8:return!0}return!1}function Vq($){if($&&typeof $==="object")switch($[b2]){case eZ:case C8:case $7:case _8:return!0}return!1}var Hq=($)=>(iQ($)||nQ($))&&!!$.anchor;Kq.ALIAS=eZ;Kq.DOC=lQ;Kq.MAP=C8;Kq.NODE_TYPE=b2;Kq.PAIR=dQ;Kq.SCALAR=$7;Kq.SEQ=_8;Kq.hasAnchor=Hq;Kq.isAlias=Jq;Kq.isCollection=nQ;Kq.isDocument=Yq;Kq.isMap=Wq;Kq.isNode=Vq;Kq.isPair=Uq;Kq.isScalar=iQ;Kq.isSeq=Gq});var O1=P((Eq)=>{var A0=t(),m0=Symbol("break visit"),rQ=Symbol("skip children"),S2=Symbol("remove node");function R8($,Z){let z=sQ(Z);if(A0.isDocument($)){if(H$(null,$.contents,z,Object.freeze([$]))===S2)$.contents=null}else H$(null,$,z,Object.freeze([]))}R8.BREAK=m0;R8.SKIP=rQ;R8.REMOVE=S2;function H$($,Z,z,Q){let X=oQ($,Z,z,Q);if(A0.isNode(X)||A0.isPair(X))return aQ($,Q,X),H$($,X,z,Q);if(typeof X!=="symbol"){if(A0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=H$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===m0)return m0;else if(Y===S2)Z.items.splice(J,1),J-=1}}else if(A0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=H$("key",Z.key,z,Q);if(J===m0)return m0;else if(J===S2)Z.key=null;let Y=H$("value",Z.value,z,Q);if(Y===m0)return m0;else if(Y===S2)Z.value=null}}return X}async function P8($,Z){let z=sQ(Z);if(A0.isDocument($)){if(await K$(null,$.contents,z,Object.freeze([$]))===S2)$.contents=null}else await K$(null,$,z,Object.freeze([]))}P8.BREAK=m0;P8.SKIP=rQ;P8.REMOVE=S2;async function K$($,Z,z,Q){let X=await oQ($,Z,z,Q);if(A0.isNode(X)||A0.isPair(X))return aQ($,Q,X),K$($,X,z,Q);if(typeof X!=="symbol"){if(A0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=await K$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===m0)return m0;else if(Y===S2)Z.items.splice(J,1),J-=1}}else if(A0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await K$("key",Z.key,z,Q);if(J===m0)return m0;else if(J===S2)Z.key=null;let Y=await K$("value",Z.value,z,Q);if(Y===m0)return m0;else if(Y===S2)Z.value=null}}return X}function sQ($){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 oQ($,Z,z,Q){if(typeof z==="function")return z($,Z,Q);if(A0.isMap(Z))return z.Map?.($,Z,Q);if(A0.isSeq(Z))return z.Seq?.($,Z,Q);if(A0.isPair(Z))return z.Pair?.($,Z,Q);if(A0.isScalar(Z))return z.Scalar?.($,Z,Q);if(A0.isAlias(Z))return z.Alias?.($,Z,Q);return}function aQ($,Z,z){let Q=Z[Z.length-1];if(A0.isCollection(Q))Q.items[$]=z;else if(A0.isPair(Q))if($==="key")Q.key=z;else Q.value=z;else if(A0.isDocument(Q))Q.contents=z;else{let X=A0.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}Eq.visit=R8;Eq.visitAsync=P8});var Z7=P((bq)=>{var tQ=t(),xq=O1(),yq={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},kq=($)=>$.replace(/[!,[\]{}]/g,(Z)=>yq[Z]);class Z2{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Z2.defaultYaml,$),this.tags=Object.assign({},Z2.defaultTags,Z)}clone(){let $=new Z2(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new Z2(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Z2.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Z2.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:Z2.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Z2.defaultTags),this.atNextDocument=!1;let z=$.trim().split(/[ \t]+/),Q=z.shift();switch(Q){case"%TAG":{if(z.length!==2){if(Z(0,"%TAG directive should contain exactly two parts"),z.length<2)return!1}let[X,J]=z;return this.tags[X]=J,!0}case"%YAML":{if(this.yaml.explicit=!0,z.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[X]=z;if(X==="1.1"||X==="1.2")return this.yaml.version=X,!0;else{let J=/^\d+\.\d+$/.test(X);return Z(6,`Unsupported YAML version ${X}`,J),!1}}default:return Z(0,`Unknown directive ${Q}`,!0),!1}}tagName($,Z){if($==="!")return"!";if($[0]!=="!")return Z(`Not a valid tag: ${$}`),null;if($[1]==="<"){let J=$.slice(2,-1);if(J==="!"||J==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return J}let[,z,Q]=$.match(/^(.*!)([^!]*)$/s);if(!Q)Z(`The ${$} tag has no suffix`);let X=this.tags[z];if(X)try{return X+decodeURIComponent(Q)}catch(J){return Z(String(J)),null}if(z==="!")return $;return Z(`Could not resolve tag: ${$}`),null}tagString($){for(let[Z,z]of Object.entries(this.tags))if($.startsWith(z))return Z+kq($.substring(z.length));return $[0]==="!"?$:`!<${$}>`}toString($){let Z=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],z=Object.entries(this.tags),Q;if($&&z.length>0&&tQ.isNode($.contents)){let X={};xq.visit($.contents,(J,Y)=>{if(tQ.isNode(Y)&&Y.tag)X[Y.tag]=!0}),Q=Object.keys(X)}else Q=[];for(let[X,J]of z){if(X==="!!"&&J==="tag:yaml.org,2002:")continue;if(!$||Q.some((Y)=>Y.startsWith(J)))Z.push(`%TAG ${X} ${J}`)}return Z.join(`
28
- `)}}Z2.defaultYaml={explicit:!1,version:"1.2"};Z2.defaultTags={"!!":"tag:yaml.org,2002:"};bq.Directives=Z2});var F8=P((uq)=>{var eQ=t(),gq=O1();function hq($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function $X($){let Z=new Set;return gq.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function ZX($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function fq($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=$X($));let Y=ZX(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(eQ.isScalar(Y.node)||eQ.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let W=Error("Failed to resolve repeated object (this should not happen)");throw W.source=J,W}}},sourceObjects:Q}}uq.anchorIsValid=hq;uq.anchorNames=$X;uq.createNodeAnchors=fq;uq.findNewAnchor=ZX});var z7=P((dq)=>{function I1($,Z,z,Q){if(Q&&typeof Q==="object")if(Array.isArray(Q))for(let X=0,J=Q.length;X<J;++X){let Y=Q[X],W=I1($,Q,String(X),Y);if(W===void 0)delete Q[X];else if(W!==Y)Q[X]=W}else if(Q instanceof Map)for(let X of Array.from(Q.keys())){let J=Q.get(X),Y=I1($,Q,X,J);if(Y===void 0)Q.delete(X);else if(Y!==J)Q.set(X,Y)}else if(Q instanceof Set)for(let X of Array.from(Q)){let J=I1($,Q,X,X);if(J===void 0)Q.delete(X);else if(J!==X)Q.delete(X),Q.add(J)}else for(let[X,J]of Object.entries(Q)){let Y=I1($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}dq.applyReviver=I1});var $6=P((rq)=>{var nq=t();function zX($,Z,z){if(Array.isArray($))return $.map((Q,X)=>zX(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!nq.hasAnchor($))return $.toJSON(Z,z);let Q={aliasCount:0,count:1,res:void 0};z.anchors.set($,Q),z.onCreate=(J)=>{Q.res=J,delete z.onCreate};let X=$.toJSON(Z,z);if(z.onCreate)z.onCreate(X);return X}if(typeof $==="bigint"&&!z?.keep)return Number($);return $}rq.toJS=zX});var S8=P((tq)=>{var oq=z7(),QX=t(),aq=$6();class XX{constructor($){Object.defineProperty(this,QX.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:z,onAnchor:Q,reviver:X}={}){if(!QX.isDocument($))throw TypeError("A document argument is required");let J={anchors:new Map,doc:$,keep:!0,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},Y=aq.toJS(this,"",J);if(typeof Q==="function")for(let{count:W,res:U}of J.anchors.values())Q(U,W);return typeof X==="function"?oq.applyReviver(X,{"":Y},"",Y):Y}}tq.NodeBase=XX});var T1=P((XB)=>{var $B=F8(),ZB=O1(),q$=t(),zB=S8(),QB=$6();class JX extends zB.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 z;if(Z?.aliasResolveCache)z=Z.aliasResolveCache;else if(z=[],ZB.visit($,{Node:(X,J)=>{if(q$.isAlias(J)||q$.hasAnchor(J))z.push(J)}}),Z)Z.aliasResolveCache=z;let Q=void 0;for(let X of z){if(X===this)break;if(X.anchor===this.source)Q=X}return Q}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:z,doc:Q,maxAliasCount:X}=Z,J=this.resolve(Q,Z);if(!J){let W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=z.get(J);if(!Y)QB.toJS(J,null,Z),Y=z.get(J);if(Y?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(X>=0){if(Y.count+=1,Y.aliasCount===0)Y.aliasCount=E8(Q,J,z);if(Y.count*Y.aliasCount>X)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return Y.res}toString($,Z,z){let Q=`*${this.source}`;if($){if($B.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let X=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(X)}if($.implicitKey)return`${Q} `}return Q}}function E8($,Z,z){if(q$.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(q$.isCollection(Z)){let Q=0;for(let X of Z.items){let J=E8($,X,z);if(J>Q)Q=J}return Q}else if(q$.isPair(Z)){let Q=E8($,Z.key,z),X=E8($,Z.value,z);return Math.max(Q,X)}return 1}XB.Alias=JX});var N0=P((VB)=>{var YB=t(),WB=S8(),UB=$6(),GB=($)=>!$||typeof $!=="function"&&typeof $!=="object";class S6 extends WB.NodeBase{constructor($){super(YB.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:UB.toJS(this.value,$,Z)}toString(){return String(this.value)}}S6.BLOCK_FOLDED="BLOCK_FOLDED";S6.BLOCK_LITERAL="BLOCK_LITERAL";S6.PLAIN="PLAIN";S6.QUOTE_DOUBLE="QUOTE_DOUBLE";S6.QUOTE_SINGLE="QUOTE_SINGLE";VB.Scalar=S6;VB.isScalarValue=GB});var A1=P((NB)=>{var qB=T1(),E6=t(),YX=N0(),BB="tag:yaml.org,2002:";function MB($,Z,z){if(Z){let Q=z.filter((J)=>J.tag===Z),X=Q.find((J)=>!J.format)??Q[0];if(!X)throw Error(`Tag ${Z} not found`);return X}return z.find((Q)=>Q.identify?.($)&&!Q.format)}function LB($,Z,z){if(E6.isDocument($))$=$.contents;if(E6.isNode($))return $;if(E6.isPair($)){let H=z.schema[E6.MAP].createNode?.(z.schema,null,z);return H.items.push($),H}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:Q,onAnchor:X,onTagObj:J,schema:Y,sourceObjects:W}=z,U=void 0;if(Q&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=X($)),new qB.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=BB+Z.slice(2);let G=MB($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new YX.Scalar($);if(U)U.node=H;return H}G=$ instanceof Map?Y[E6.MAP]:(Symbol.iterator in Object($))?Y[E6.SEQ]:Y[E6.MAP]}if(J)J(G),delete z.onTagObj;let V=G?.createNode?G.createNode(z.schema,$,z):typeof G?.nodeClass?.from==="function"?G.nodeClass.from(z.schema,$,z):new YX.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(U)U.node=V;return V}NB.createNode=LB});var j8=P((TB)=>{var OB=A1(),E2=t(),IB=S8();function Q7($,Z,z){let Q=z;for(let X=Z.length-1;X>=0;--X){let J=Z[X];if(typeof J==="number"&&Number.isInteger(J)&&J>=0){let Y=[];Y[J]=Q,Q=Y}else Q=new Map([[J,Q]])}return OB.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var WX=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class UX extends IB.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((z)=>E2.isNode(z)||E2.isPair(z)?z.clone($):z),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(WX($))this.add(Z);else{let[z,...Q]=$,X=this.get(z,!0);if(E2.isCollection(X))X.addIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,Q7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}deleteIn($){let[Z,...z]=$;if(z.length===0)return this.delete(Z);let Q=this.get(Z,!0);if(E2.isCollection(Q))return Q.deleteIn(z);else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${z}`)}getIn($,Z){let[z,...Q]=$,X=this.get(z,!0);if(Q.length===0)return!Z&&E2.isScalar(X)?X.value:X;else return E2.isCollection(X)?X.getIn(Q,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!E2.isPair(Z))return!1;let z=Z.value;return z==null||$&&E2.isScalar(z)&&z.value==null&&!z.commentBefore&&!z.comment&&!z.tag})}hasIn($){let[Z,...z]=$;if(z.length===0)return this.has(Z);let Q=this.get(Z,!0);return E2.isCollection(Q)?Q.hasIn(z):!1}setIn($,Z){let[z,...Q]=$;if(Q.length===0)this.set(z,Z);else{let X=this.get(z,!0);if(E2.isCollection(X))X.setIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,Q7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}TB.Collection=UX;TB.collectionFromPath=Q7;TB.isEmptyPath=WX});var C1=P((FB)=>{var RB=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function X7($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var PB=($,Z,z)=>$.endsWith(`
29
- `)?X7(z,Z):z.includes(`
27
+ `)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((Q)=>Z.is(Q)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function dQ($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let z,Q="127.0.0.1",X="9229",J;if((J=Z.match(/^(--inspect(-brk)?)$/))!==null)z=J[1];else if((J=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(z=J[1],/^\d+$/.test(J[3]))X=J[3];else Q=J[3];else if((J=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)z=J[1],Q=J[3],X=J[4];if(z&&X!=="0")return`${z}=${Q}:${parseInt(X)+1}`;return Z})}function $7(){if(e.env.NO_COLOR||e.env.FORCE_COLOR==="0"||e.env.FORCE_COLOR==="false")return!1;if(e.env.FORCE_COLOR||e.env.CLICOLOR_FORCE!==void 0)return!0;return}$q.Command=Z7;$q.useColor=$7});var oQ=F((Jq)=>{var{Argument:nQ}=C8(),{Command:z7}=iQ(),{CommanderError:Qq,InvalidArgumentError:rQ}=T1(),{Help:Xq}=oZ(),{Option:sQ}=aZ();Jq.program=new z7;Jq.createCommand=($)=>new z7($);Jq.createOption=($,Z)=>new sQ($,Z);Jq.createArgument=($,Z)=>new nQ($,Z);Jq.Command=z7;Jq.Option=sQ;Jq.Argument=nQ;Jq.Help=Xq;Jq.CommanderError=Qq;Jq.InvalidArgumentError=rQ;Jq.InvalidOptionArgumentError=rQ});var t=F((_q)=>{var Q7=Symbol.for("yaml.alias"),eQ=Symbol.for("yaml.document"),R8=Symbol.for("yaml.map"),$X=Symbol.for("yaml.pair"),X7=Symbol.for("yaml.scalar"),F8=Symbol.for("yaml.seq"),v2=Symbol.for("yaml.node.type"),Nq=($)=>!!$&&typeof $==="object"&&$[v2]===Q7,Oq=($)=>!!$&&typeof $==="object"&&$[v2]===eQ,Dq=($)=>!!$&&typeof $==="object"&&$[v2]===R8,Iq=($)=>!!$&&typeof $==="object"&&$[v2]===$X,ZX=($)=>!!$&&typeof $==="object"&&$[v2]===X7,Tq=($)=>!!$&&typeof $==="object"&&$[v2]===F8;function zX($){if($&&typeof $==="object")switch($[v2]){case R8:case F8:return!0}return!1}function Aq($){if($&&typeof $==="object")switch($[v2]){case Q7:case R8:case X7:case F8:return!0}return!1}var Cq=($)=>(ZX($)||zX($))&&!!$.anchor;_q.ALIAS=Q7;_q.DOC=eQ;_q.MAP=R8;_q.NODE_TYPE=v2;_q.PAIR=$X;_q.SCALAR=X7;_q.SEQ=F8;_q.hasAnchor=Cq;_q.isAlias=Nq;_q.isCollection=zX;_q.isDocument=Oq;_q.isMap=Dq;_q.isNode=Aq;_q.isPair=Iq;_q.isScalar=ZX;_q.isSeq=Tq});var A1=F((mq)=>{var A0=t(),m0=Symbol("break visit"),QX=Symbol("skip children"),S2=Symbol("remove node");function P8($,Z){let z=XX(Z);if(A0.isDocument($)){if(M$(null,$.contents,z,Object.freeze([$]))===S2)$.contents=null}else M$(null,$,z,Object.freeze([]))}P8.BREAK=m0;P8.SKIP=QX;P8.REMOVE=S2;function M$($,Z,z,Q){let X=JX($,Z,z,Q);if(A0.isNode(X)||A0.isPair(X))return YX($,Q,X),M$($,X,z,Q);if(typeof X!=="symbol"){if(A0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=M$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===m0)return m0;else if(Y===S2)Z.items.splice(J,1),J-=1}}else if(A0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=M$("key",Z.key,z,Q);if(J===m0)return m0;else if(J===S2)Z.key=null;let Y=M$("value",Z.value,z,Q);if(Y===m0)return m0;else if(Y===S2)Z.value=null}}return X}async function S8($,Z){let z=XX(Z);if(A0.isDocument($)){if(await L$(null,$.contents,z,Object.freeze([$]))===S2)$.contents=null}else await L$(null,$,z,Object.freeze([]))}S8.BREAK=m0;S8.SKIP=QX;S8.REMOVE=S2;async function L$($,Z,z,Q){let X=await JX($,Z,z,Q);if(A0.isNode(X)||A0.isPair(X))return YX($,Q,X),L$($,X,z,Q);if(typeof X!=="symbol"){if(A0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=await L$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===m0)return m0;else if(Y===S2)Z.items.splice(J,1),J-=1}}else if(A0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await L$("key",Z.key,z,Q);if(J===m0)return m0;else if(J===S2)Z.key=null;let Y=await L$("value",Z.value,z,Q);if(Y===m0)return m0;else if(Y===S2)Z.value=null}}return X}function XX($){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 JX($,Z,z,Q){if(typeof z==="function")return z($,Z,Q);if(A0.isMap(Z))return z.Map?.($,Z,Q);if(A0.isSeq(Z))return z.Seq?.($,Z,Q);if(A0.isPair(Z))return z.Pair?.($,Z,Q);if(A0.isScalar(Z))return z.Scalar?.($,Z,Q);if(A0.isAlias(Z))return z.Alias?.($,Z,Q);return}function YX($,Z,z){let Q=Z[Z.length-1];if(A0.isCollection(Q))Q.items[$]=z;else if(A0.isPair(Q))if($==="key")Q.key=z;else Q.value=z;else if(A0.isDocument(Q))Q.contents=z;else{let X=A0.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}mq.visit=P8;mq.visitAsync=S8});var J7=F((nq)=>{var WX=t(),lq=A1(),dq={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},iq=($)=>$.replace(/[!,[\]{}]/g,(Z)=>dq[Z]);class Z2{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Z2.defaultYaml,$),this.tags=Object.assign({},Z2.defaultTags,Z)}clone(){let $=new Z2(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new Z2(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Z2.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Z2.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:Z2.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Z2.defaultTags),this.atNextDocument=!1;let z=$.trim().split(/[ \t]+/),Q=z.shift();switch(Q){case"%TAG":{if(z.length!==2){if(Z(0,"%TAG directive should contain exactly two parts"),z.length<2)return!1}let[X,J]=z;return this.tags[X]=J,!0}case"%YAML":{if(this.yaml.explicit=!0,z.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[X]=z;if(X==="1.1"||X==="1.2")return this.yaml.version=X,!0;else{let J=/^\d+\.\d+$/.test(X);return Z(6,`Unsupported YAML version ${X}`,J),!1}}default:return Z(0,`Unknown directive ${Q}`,!0),!1}}tagName($,Z){if($==="!")return"!";if($[0]!=="!")return Z(`Not a valid tag: ${$}`),null;if($[1]==="<"){let J=$.slice(2,-1);if(J==="!"||J==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return J}let[,z,Q]=$.match(/^(.*!)([^!]*)$/s);if(!Q)Z(`The ${$} tag has no suffix`);let X=this.tags[z];if(X)try{return X+decodeURIComponent(Q)}catch(J){return Z(String(J)),null}if(z==="!")return $;return Z(`Could not resolve tag: ${$}`),null}tagString($){for(let[Z,z]of Object.entries(this.tags))if($.startsWith(z))return Z+iq($.substring(z.length));return $[0]==="!"?$:`!<${$}>`}toString($){let Z=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],z=Object.entries(this.tags),Q;if($&&z.length>0&&WX.isNode($.contents)){let X={};lq.visit($.contents,(J,Y)=>{if(WX.isNode(Y)&&Y.tag)X[Y.tag]=!0}),Q=Object.keys(X)}else Q=[];for(let[X,J]of z){if(X==="!!"&&J==="tag:yaml.org,2002:")continue;if(!$||Q.some((Y)=>Y.startsWith(J)))Z.push(`%TAG ${X} ${J}`)}return Z.join(`
28
+ `)}}Z2.defaultYaml={explicit:!1,version:"1.2"};Z2.defaultTags={"!!":"tag:yaml.org,2002:"};nq.Directives=Z2});var E8=F((tq)=>{var UX=t(),sq=A1();function oq($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function GX($){let Z=new Set;return sq.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function VX($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function aq($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=GX($));let Y=VX(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(UX.isScalar(Y.node)||UX.isCollection(Y.node)))Y.node.anchor=Y.anchor;else{let W=Error("Failed to resolve repeated object (this should not happen)");throw W.source=J,W}}},sourceObjects:Q}}tq.anchorIsValid=oq;tq.anchorNames=GX;tq.createNodeAnchors=aq;tq.findNewAnchor=VX});var Y7=F((QB)=>{function C1($,Z,z,Q){if(Q&&typeof Q==="object")if(Array.isArray(Q))for(let X=0,J=Q.length;X<J;++X){let Y=Q[X],W=C1($,Q,String(X),Y);if(W===void 0)delete Q[X];else if(W!==Y)Q[X]=W}else if(Q instanceof Map)for(let X of Array.from(Q.keys())){let J=Q.get(X),Y=C1($,Q,X,J);if(Y===void 0)Q.delete(X);else if(Y!==J)Q.set(X,Y)}else if(Q instanceof Set)for(let X of Array.from(Q)){let J=C1($,Q,X,X);if(J===void 0)Q.delete(X);else if(J!==X)Q.delete(X),Q.add(J)}else for(let[X,J]of Object.entries(Q)){let Y=C1($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}QB.applyReviver=C1});var z6=F((YB)=>{var JB=t();function HX($,Z,z){if(Array.isArray($))return $.map((Q,X)=>HX(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!JB.hasAnchor($))return $.toJSON(Z,z);let Q={aliasCount:0,count:1,res:void 0};z.anchors.set($,Q),z.onCreate=(J)=>{Q.res=J,delete z.onCreate};let X=$.toJSON(Z,z);if(z.onCreate)z.onCreate(X);return X}if(typeof $==="bigint"&&!z?.keep)return Number($);return $}YB.toJS=HX});var j8=F((VB)=>{var UB=Y7(),KX=t(),GB=z6();class qX{constructor($){Object.defineProperty(this,KX.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:z,onAnchor:Q,reviver:X}={}){if(!KX.isDocument($))throw TypeError("A document argument is required");let J={anchors:new Map,doc:$,keep:!0,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},Y=GB.toJS(this,"",J);if(typeof Q==="function")for(let{count:W,res:U}of J.anchors.values())Q(U,W);return typeof X==="function"?UB.applyReviver(X,{"":Y},"",Y):Y}}VB.NodeBase=qX});var _1=F((LB)=>{var KB=E8(),qB=A1(),N$=t(),BB=j8(),MB=z6();class BX extends BB.NodeBase{constructor($){super(N$.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 z;if(Z?.aliasResolveCache)z=Z.aliasResolveCache;else if(z=[],qB.visit($,{Node:(X,J)=>{if(N$.isAlias(J)||N$.hasAnchor(J))z.push(J)}}),Z)Z.aliasResolveCache=z;let Q=void 0;for(let X of z){if(X===this)break;if(X.anchor===this.source)Q=X}return Q}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:z,doc:Q,maxAliasCount:X}=Z,J=this.resolve(Q,Z);if(!J){let W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=z.get(J);if(!Y)MB.toJS(J,null,Z),Y=z.get(J);if(Y?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(X>=0){if(Y.count+=1,Y.aliasCount===0)Y.aliasCount=w8(Q,J,z);if(Y.count*Y.aliasCount>X)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return Y.res}toString($,Z,z){let Q=`*${this.source}`;if($){if(KB.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let X=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(X)}if($.implicitKey)return`${Q} `}return Q}}function w8($,Z,z){if(N$.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(N$.isCollection(Z)){let Q=0;for(let X of Z.items){let J=w8($,X,z);if(J>Q)Q=J}return Q}else if(N$.isPair(Z)){let Q=w8($,Z.key,z),X=w8($,Z.value,z);return Math.max(Q,X)}return 1}LB.Alias=BX});var N0=F((AB)=>{var OB=t(),DB=j8(),IB=z6(),TB=($)=>!$||typeof $!=="function"&&typeof $!=="object";class j6 extends DB.NodeBase{constructor($){super(OB.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:IB.toJS(this.value,$,Z)}toString(){return String(this.value)}}j6.BLOCK_FOLDED="BLOCK_FOLDED";j6.BLOCK_LITERAL="BLOCK_LITERAL";j6.PLAIN="PLAIN";j6.QUOTE_DOUBLE="QUOTE_DOUBLE";j6.QUOTE_SINGLE="QUOTE_SINGLE";AB.Scalar=j6;AB.isScalarValue=TB});var R1=F((EB)=>{var RB=_1(),w6=t(),MX=N0(),FB="tag:yaml.org,2002:";function PB($,Z,z){if(Z){let Q=z.filter((J)=>J.tag===Z),X=Q.find((J)=>!J.format)??Q[0];if(!X)throw Error(`Tag ${Z} not found`);return X}return z.find((Q)=>Q.identify?.($)&&!Q.format)}function SB($,Z,z){if(w6.isDocument($))$=$.contents;if(w6.isNode($))return $;if(w6.isPair($)){let H=z.schema[w6.MAP].createNode?.(z.schema,null,z);return H.items.push($),H}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:Q,onAnchor:X,onTagObj:J,schema:Y,sourceObjects:W}=z,U=void 0;if(Q&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=X($)),new RB.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=FB+Z.slice(2);let G=PB($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new MX.Scalar($);if(U)U.node=H;return H}G=$ instanceof Map?Y[w6.MAP]:(Symbol.iterator in Object($))?Y[w6.SEQ]:Y[w6.MAP]}if(J)J(G),delete z.onTagObj;let V=G?.createNode?G.createNode(z.schema,$,z):typeof G?.nodeClass?.from==="function"?G.nodeClass.from(z.schema,$,z):new MX.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(U)U.node=V;return V}EB.createNode=SB});var x8=F((yB)=>{var wB=R1(),E2=t(),xB=j8();function W7($,Z,z){let Q=z;for(let X=Z.length-1;X>=0;--X){let J=Z[X];if(typeof J==="number"&&Number.isInteger(J)&&J>=0){let Y=[];Y[J]=Q,Q=Y}else Q=new Map([[J,Q]])}return wB.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var LX=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class NX extends xB.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((z)=>E2.isNode(z)||E2.isPair(z)?z.clone($):z),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(LX($))this.add(Z);else{let[z,...Q]=$,X=this.get(z,!0);if(E2.isCollection(X))X.addIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,W7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}deleteIn($){let[Z,...z]=$;if(z.length===0)return this.delete(Z);let Q=this.get(Z,!0);if(E2.isCollection(Q))return Q.deleteIn(z);else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${z}`)}getIn($,Z){let[z,...Q]=$,X=this.get(z,!0);if(Q.length===0)return!Z&&E2.isScalar(X)?X.value:X;else return E2.isCollection(X)?X.getIn(Q,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!E2.isPair(Z))return!1;let z=Z.value;return z==null||$&&E2.isScalar(z)&&z.value==null&&!z.commentBefore&&!z.comment&&!z.tag})}hasIn($){let[Z,...z]=$;if(z.length===0)return this.has(Z);let Q=this.get(Z,!0);return E2.isCollection(Q)?Q.hasIn(z):!1}setIn($,Z){let[z,...Q]=$;if(Q.length===0)this.set(z,Z);else{let X=this.get(z,!0);if(E2.isCollection(X))X.setIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,W7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}yB.Collection=NX;yB.collectionFromPath=W7;yB.isEmptyPath=LX});var F1=F((fB)=>{var gB=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function U7($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var hB=($,Z,z)=>$.endsWith(`
29
+ `)?U7(z,Z):z.includes(`
30
30
  `)?`
31
- `+X7(z,Z):($.endsWith(" ")?"":" ")+z;FB.indentComment=X7;FB.lineComment=PB;FB.stringifyComment=RB});var VX=P((xB)=>{function wB($,Z,z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:J=20,onFold:Y,onOverflow:W}={}){if(!X||X<0)return $;if(X<J)J=0;let U=Math.max(1+J,1+X-Z.length);if($.length<=U)return $;let G=[],V={},H=X-Z.length;if(typeof Q==="number")if(Q>X-Math.max(2,J))G.push(0);else H=X-Q;let K=void 0,q=void 0,L=!1,B=-1,N=-1,I=-1;if(z==="block"){if(B=GX($,B,Z.length),B!==-1)H=B+U}for(let y;y=$[B+=1];){if(z==="quoted"&&y==="\\"){switch(N=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}I=B}if(y===`
32
- `){if(z==="block")B=GX($,B,Z.length);H=B+Z.length+U,K=void 0}else{if(y===" "&&q&&q!==" "&&q!==`
31
+ `+U7(z,Z):($.endsWith(" ")?"":" ")+z;fB.indentComment=U7;fB.lineComment=hB;fB.stringifyComment=gB});var DX=F((lB)=>{function pB($,Z,z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:J=20,onFold:Y,onOverflow:W}={}){if(!X||X<0)return $;if(X<J)J=0;let U=Math.max(1+J,1+X-Z.length);if($.length<=U)return $;let G=[],V={},H=X-Z.length;if(typeof Q==="number")if(Q>X-Math.max(2,J))G.push(0);else H=X-Q;let K=void 0,q=void 0,L=!1,B=-1,N=-1,I=-1;if(z==="block"){if(B=OX($,B,Z.length),B!==-1)H=B+U}for(let w;w=$[B+=1];){if(z==="quoted"&&w==="\\"){switch(N=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}I=B}if(w===`
32
+ `){if(z==="block")B=OX($,B,Z.length);H=B+Z.length+U,K=void 0}else{if(w===" "&&q&&q!==" "&&q!==`
33
33
  `&&q!=="\t"){let E=$[B+1];if(E&&E!==" "&&E!==`
34
- `&&E!=="\t")K=B}if(B>=H)if(K)G.push(K),H=K+U,K=void 0;else if(z==="quoted"){while(q===" "||q==="\t")q=y,y=$[B+=1],L=!0;let E=B>I+1?B-2:N-1;if(V[E])return $;G.push(E),V[E]=!0,H=E+U,K=void 0}else L=!0}q=y}if(L&&W)W();if(G.length===0)return $;if(Y)Y();let _=$.slice(0,G[0]);for(let y=0;y<G.length;++y){let E=G[y],w=G[y+1]||$.length;if(E===0)_=`
35
- ${Z}${$.slice(0,w)}`;else{if(z==="quoted"&&V[E])_+=`${$[E]}\\`;_+=`
36
- ${Z}${$.slice(E+1,w)}`}}return _}function GX($,Z,z){let Q=Z,X=Z+1,J=$[X];while(J===" "||J==="\t")if(Z<X+z)J=$[++Z];else{do J=$[++Z];while(J&&J!==`
37
- `);Q=Z,X=Z+1,J=$[X]}return Q}xB.FOLD_BLOCK="block";xB.FOLD_FLOW="flow";xB.FOLD_QUOTED="quoted";xB.foldFlowLines=wB});var R1=P((uB)=>{var B2=N0(),Z6=VX(),x8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),y8=($)=>/^(%|---|\.\.\.)/m.test($);function gB($,Z,z){if(!Z||Z<0)return!1;let Q=Z-z,X=$.length;if(X<=Q)return!1;for(let J=0,Y=0;J<X;++J)if($[J]===`
38
- `){if(J-Y>Q)return!0;if(Y=J+1,X-Y<=Q)return!1}return!0}function _1($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(y8($)?" ":""),Y="",W=0;for(let U=0,G=z[U];G;G=z[++U]){if(G===" "&&z[U+1]==="\\"&&z[U+2]==="n")Y+=z.slice(W,U)+"\\ ",U+=1,W=U,G="\\";if(G==="\\")switch(z[U+1]){case"u":{Y+=z.slice(W,U);let V=z.substr(U+2,4);switch(V){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(V.substr(0,2)==="00")Y+="\\x"+V.substr(2);else Y+=z.substr(U,6)}U+=5,W=U+1}break;case"n":if(Q||z[U+2]==='"'||z.length<X)U+=1;else{Y+=z.slice(W,U)+`
34
+ `&&E!=="\t")K=B}if(B>=H)if(K)G.push(K),H=K+U,K=void 0;else if(z==="quoted"){while(q===" "||q==="\t")q=w,w=$[B+=1],L=!0;let E=B>I+1?B-2:N-1;if(V[E])return $;G.push(E),V[E]=!0,H=E+U,K=void 0}else L=!0}q=w}if(L&&W)W();if(G.length===0)return $;if(Y)Y();let _=$.slice(0,G[0]);for(let w=0;w<G.length;++w){let E=G[w],x=G[w+1]||$.length;if(E===0)_=`
35
+ ${Z}${$.slice(0,x)}`;else{if(z==="quoted"&&V[E])_+=`${$[E]}\\`;_+=`
36
+ ${Z}${$.slice(E+1,x)}`}}return _}function OX($,Z,z){let Q=Z,X=Z+1,J=$[X];while(J===" "||J==="\t")if(Z<X+z)J=$[++Z];else{do J=$[++Z];while(J&&J!==`
37
+ `);Q=Z,X=Z+1,J=$[X]}return Q}lB.FOLD_BLOCK="block";lB.FOLD_FLOW="flow";lB.FOLD_QUOTED="quoted";lB.foldFlowLines=pB});var S1=F((tB)=>{var M2=N0(),Q6=DX(),k8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),b8=($)=>/^(%|---|\.\.\.)/m.test($);function sB($,Z,z){if(!Z||Z<0)return!1;let Q=Z-z,X=$.length;if(X<=Q)return!1;for(let J=0,Y=0;J<X;++J)if($[J]===`
38
+ `){if(J-Y>Q)return!0;if(Y=J+1,X-Y<=Q)return!1}return!0}function P1($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(b8($)?" ":""),Y="",W=0;for(let U=0,G=z[U];G;G=z[++U]){if(G===" "&&z[U+1]==="\\"&&z[U+2]==="n")Y+=z.slice(W,U)+"\\ ",U+=1,W=U,G="\\";if(G==="\\")switch(z[U+1]){case"u":{Y+=z.slice(W,U);let V=z.substr(U+2,4);switch(V){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(V.substr(0,2)==="00")Y+="\\x"+V.substr(2);else Y+=z.substr(U,6)}U+=5,W=U+1}break;case"n":if(Q||z[U+2]==='"'||z.length<X)U+=1;else{Y+=z.slice(W,U)+`
39
39
 
40
40
  `;while(z[U+2]==="\\"&&z[U+3]==="n"&&z[U+4]!=='"')Y+=`
41
- `,U+=2;if(Y+=J,z[U+2]===" ")Y+="\\";U+=1,W=U+1}break;default:U+=1}}return Y=W?Y+z.slice(W):z,Q?Y:Z6.foldFlowLines(Y,J,Z6.FOLD_QUOTED,x8(Z,!1))}function J7($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
- `)||/[ \t]\n|\n[ \t]/.test($))return _1($,Z);let z=Z.indent||(y8($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
- ${z}`)+"'";return Z.implicitKey?Q:Z6.foldFlowLines(Q,z,Z6.FOLD_FLOW,x8(Z,!1))}function B$($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=_1;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=J7;else if(J&&!X)Q=_1;else Q=z?J7:_1}return Q($,Z)}var Y7;try{Y7=new RegExp(`(^|(?<!
41
+ `,U+=2;if(Y+=J,z[U+2]===" ")Y+="\\";U+=1,W=U+1}break;default:U+=1}}return Y=W?Y+z.slice(W):z,Q?Y:Q6.foldFlowLines(Y,J,Q6.FOLD_QUOTED,k8(Z,!1))}function G7($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
+ `)||/[ \t]\n|\n[ \t]/.test($))return P1($,Z);let z=Z.indent||(b8($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
+ ${z}`)+"'";return Z.implicitKey?Q:Q6.foldFlowLines(Q,z,Q6.FOLD_FLOW,k8(Z,!1))}function O$($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=P1;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=G7;else if(J&&!X)Q=P1;else Q=z?G7:P1}return Q($,Z)}var V7;try{V7=new RegExp(`(^|(?<!
44
44
  ))
45
45
  +(?!
46
- |$)`,"g")}catch{Y7=/\n+(?!\n|$)/g}function w8({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:W,lineWidth:U}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return B$(z,Q);let G=Q.indent||(Q.forceBlockIndent||y8(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===B2.Scalar.BLOCK_FOLDED?!1:Z===B2.Scalar.BLOCK_LITERAL?!0:!gB(z,U,G.length);if(!z)return V?`|
46
+ |$)`,"g")}catch{V7=/\n+(?!\n|$)/g}function y8({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:W,lineWidth:U}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return O$(z,Q);let G=Q.indent||(Q.forceBlockIndent||b8(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===M2.Scalar.BLOCK_FOLDED?!1:Z===M2.Scalar.BLOCK_LITERAL?!0:!sB(z,U,G.length);if(!z)return V?`|
47
47
  `:`>
48
- `;let H,K;for(K=z.length;K>0;--K){let w=z[K-1];if(w!==`
49
- `&&w!=="\t"&&w!==" ")break}let q=z.substring(K),L=q.indexOf(`
48
+ `;let H,K;for(K=z.length;K>0;--K){let x=z[K-1];if(x!==`
49
+ `&&x!=="\t"&&x!==" ")break}let q=z.substring(K),L=q.indexOf(`
50
50
  `);if(L===-1)H="-";else if(z===q||L!==q.length-1){if(H="+",J)J()}else H="";if(q){if(z=z.slice(0,-q.length),q[q.length-1]===`
51
- `)q=q.slice(0,-1);q=q.replace(Y7,`$&${G}`)}let B=!1,N,I=-1;for(N=0;N<z.length;++N){let w=z[N];if(w===" ")B=!0;else if(w===`
52
- `)I=N;else break}let _=z.substring(0,I<N?I+1:N);if(_)z=z.substring(_.length),_=_.replace(/\n+/g,`$&${G}`);let E=(B?G?"2":"1":"")+H;if($){if(E+=" "+W($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let w=z.replace(/\n+/g,`
53
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),j=!1,u=x8(Q,!0);if(Y!=="folded"&&Z!==B2.Scalar.BLOCK_FOLDED)u.onOverflow=()=>{j=!0};let S=Z6.foldFlowLines(`${_}${w}${q}`,G,Z6.FOLD_BLOCK,u);if(!j)return`>${E}
51
+ `)q=q.slice(0,-1);q=q.replace(V7,`$&${G}`)}let B=!1,N,I=-1;for(N=0;N<z.length;++N){let x=z[N];if(x===" ")B=!0;else if(x===`
52
+ `)I=N;else break}let _=z.substring(0,I<N?I+1:N);if(_)z=z.substring(_.length),_=_.replace(/\n+/g,`$&${G}`);let E=(B?G?"2":"1":"")+H;if($){if(E+=" "+W($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let x=z.replace(/\n+/g,`
53
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),j=!1,m=k8(Q,!0);if(Y!=="folded"&&Z!==M2.Scalar.BLOCK_FOLDED)m.onOverflow=()=>{j=!0};let S=Q6.foldFlowLines(`${_}${x}${q}`,G,Q6.FOLD_BLOCK,m);if(!j)return`>${E}
54
54
  ${G}${S}`}return z=z.replace(/\n+/g,`$&${G}`),`|${E}
55
- ${G}${_}${z}${q}`}function hB($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:V}=Z;if(W&&J.includes(`
56
- `)||V&&/[[\]{},]/.test(J))return B$(J,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(J))return W||V||!J.includes(`
57
- `)?B$(J,Z):w8($,Z,z,Q);if(!W&&!V&&X!==B2.Scalar.PLAIN&&J.includes(`
58
- `))return w8($,Z,z,Q);if(y8(J)){if(U==="")return Z.forceBlockIndent=!0,w8($,Z,z,Q);else if(W&&U===G)return B$(J,Z)}let H=J.replace(/\n+/g,`$&
59
- ${U}`);if(Y){let K=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(H),{compat:q,tags:L}=Z.doc.schema;if(L.some(K)||q?.some(K))return B$(J,Z)}return W?H:Z6.foldFlowLines(H,U,Z6.FOLD_FLOW,x8(Z,!1))}function fB($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==B2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=B2.Scalar.QUOTE_DOUBLE}let U=(V)=>{switch(V){case B2.Scalar.BLOCK_FOLDED:case B2.Scalar.BLOCK_LITERAL:return X||J?B$(Y.value,Z):w8(Y,Z,z,Q);case B2.Scalar.QUOTE_DOUBLE:return _1(Y.value,Z);case B2.Scalar.QUOTE_SINGLE:return J7(Y.value,Z);case B2.Scalar.PLAIN:return hB(Y,Z,z,Q);default:return null}},G=U(W);if(G===null){let{defaultKeyType:V,defaultStringType:H}=Z.options,K=X&&V||H;if(G=U(K),G===null)throw Error(`Unsupported default string type ${K}`)}return G}uB.stringifyString=fB});var P1=P((sB)=>{var cB=F8(),z6=t(),pB=C1(),lB=R1();function dB($,Z){let z=Object.assign({blockQuote:!0,commentString:pB.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),Q;switch(z.collectionStyle){case"block":Q=!1;break;case"flow":Q=!0;break;default:Q=null}return{anchors:new Set,doc:$,flowCollectionPadding:z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof z.indent==="number"?" ".repeat(z.indent):" ",inFlow:Q,options:z}}function iB($,Z){if(Z.tag){let X=$.filter((J)=>J.tag===Z.tag);if(X.length>0)return X.find((J)=>J.format===Z.format)??X[0]}let z=void 0,Q;if(z6.isScalar(Z)){Q=Z.value;let X=$.filter((J)=>J.identify?.(Q));if(X.length>1){let J=X.filter((Y)=>Y.test);if(J.length>0)X=J}z=X.find((J)=>J.format===Z.format)??X.find((J)=>!J.format)}else Q=Z,z=$.find((X)=>X.nodeClass&&Q instanceof X.nodeClass);if(!z){let X=Q?.constructor?.name??(Q===null?"null":typeof Q);throw Error(`Tag not resolved for ${X} value`)}return z}function nB($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=(z6.isScalar($)||z6.isCollection($))&&$.anchor;if(J&&cB.anchorIsValid(J))z.add(J),X.push(`&${J}`);let Y=$.tag??(Z.default?null:Z.tag);if(Y)X.push(Q.directives.tagString(Y));return X.join(" ")}function rB($,Z,z,Q){if(z6.isPair($))return $.toString(Z,z,Q);if(z6.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 X=void 0,J=z6.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>X=U});X??(X=iB(Z.doc.schema.tags,J));let Y=nB(J,X,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof X.stringify==="function"?X.stringify(J,Z,z,Q):z6.isScalar(J)?lB.stringifyString(J,Z,z,Q):J.toString(Z,z,Q);if(!Y)return W;return z6.isScalar(J)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
- ${Z.indent}${W}`}sB.createStringifyContext=dB;sB.stringify=rB});var qX=P((eB)=>{var v2=t(),HX=N0(),KX=P1(),F1=C1();function tB({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:V,simpleKeys:H}}=z,K=v2.isNode($)&&$.comment||null;if(H){if(K)throw Error("With simple keys, key nodes cannot have comments");if(v2.isCollection($)||!v2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let q=!H&&(!$||K&&Z==null&&!z.inFlow||v2.isCollection($)||(v2.isScalar($)?$.type===HX.Scalar.BLOCK_FOLDED||$.type===HX.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!q&&(H||!J),indent:W+U});let L=!1,B=!1,N=KX.stringify($,z,()=>L=!0,()=>B=!0);if(!q&&!z.inFlow&&N.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");q=!0}if(z.inFlow){if(J||Z==null){if(L&&Q)Q();return N===""?"?":q?`? ${N}`:N}}else if(J&&!H||Z==null&&q){if(N=`? ${N}`,K&&!L)N+=F1.lineComment(N,z.indent,G(K));else if(B&&X)X();return N}if(L)K=null;if(q){if(K)N+=F1.lineComment(N,z.indent,G(K));N=`? ${N}
61
- ${W}:`}else if(N=`${N}:`,K)N+=F1.lineComment(N,z.indent,G(K));let I,_,y;if(v2.isNode(Z))I=!!Z.spaceBefore,_=Z.commentBefore,y=Z.comment;else if(I=!1,_=null,y=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!q&&!K&&v2.isScalar(Z))z.indentAtStart=N.length+1;if(B=!1,!V&&U.length>=2&&!z.inFlow&&!q&&v2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let E=!1,w=KX.stringify(Z,z,()=>E=!0,()=>B=!0),j=" ";if(K||I||_){if(j=I?`
62
- `:"",_){let u=G(_);j+=`
63
- ${F1.indentComment(u,z.indent)}`}if(w===""&&!z.inFlow){if(j===`
64
- `&&y)j=`
55
+ ${G}${_}${z}${q}`}function oB($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:V}=Z;if(W&&J.includes(`
56
+ `)||V&&/[[\]{},]/.test(J))return O$(J,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(J))return W||V||!J.includes(`
57
+ `)?O$(J,Z):y8($,Z,z,Q);if(!W&&!V&&X!==M2.Scalar.PLAIN&&J.includes(`
58
+ `))return y8($,Z,z,Q);if(b8(J)){if(U==="")return Z.forceBlockIndent=!0,y8($,Z,z,Q);else if(W&&U===G)return O$(J,Z)}let H=J.replace(/\n+/g,`$&
59
+ ${U}`);if(Y){let K=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(H),{compat:q,tags:L}=Z.doc.schema;if(L.some(K)||q?.some(K))return O$(J,Z)}return W?H:Q6.foldFlowLines(H,U,Q6.FOLD_FLOW,k8(Z,!1))}function aB($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==M2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=M2.Scalar.QUOTE_DOUBLE}let U=(V)=>{switch(V){case M2.Scalar.BLOCK_FOLDED:case M2.Scalar.BLOCK_LITERAL:return X||J?O$(Y.value,Z):y8(Y,Z,z,Q);case M2.Scalar.QUOTE_DOUBLE:return P1(Y.value,Z);case M2.Scalar.QUOTE_SINGLE:return G7(Y.value,Z);case M2.Scalar.PLAIN:return oB(Y,Z,z,Q);default:return null}},G=U(W);if(G===null){let{defaultKeyType:V,defaultStringType:H}=Z.options,K=X&&V||H;if(G=U(K),G===null)throw Error(`Unsupported default string type ${K}`)}return G}tB.stringifyString=aB});var E1=F((WM)=>{var $M=E8(),X6=t(),ZM=F1(),zM=S1();function QM($,Z){let z=Object.assign({blockQuote:!0,commentString:ZM.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),Q;switch(z.collectionStyle){case"block":Q=!1;break;case"flow":Q=!0;break;default:Q=null}return{anchors:new Set,doc:$,flowCollectionPadding:z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof z.indent==="number"?" ".repeat(z.indent):" ",inFlow:Q,options:z}}function XM($,Z){if(Z.tag){let X=$.filter((J)=>J.tag===Z.tag);if(X.length>0)return X.find((J)=>J.format===Z.format)??X[0]}let z=void 0,Q;if(X6.isScalar(Z)){Q=Z.value;let X=$.filter((J)=>J.identify?.(Q));if(X.length>1){let J=X.filter((Y)=>Y.test);if(J.length>0)X=J}z=X.find((J)=>J.format===Z.format)??X.find((J)=>!J.format)}else Q=Z,z=$.find((X)=>X.nodeClass&&Q instanceof X.nodeClass);if(!z){let X=Q?.constructor?.name??(Q===null?"null":typeof Q);throw Error(`Tag not resolved for ${X} value`)}return z}function JM($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=(X6.isScalar($)||X6.isCollection($))&&$.anchor;if(J&&$M.anchorIsValid(J))z.add(J),X.push(`&${J}`);let Y=$.tag??(Z.default?null:Z.tag);if(Y)X.push(Q.directives.tagString(Y));return X.join(" ")}function YM($,Z,z,Q){if(X6.isPair($))return $.toString(Z,z,Q);if(X6.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 X=void 0,J=X6.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>X=U});X??(X=XM(Z.doc.schema.tags,J));let Y=JM(J,X,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof X.stringify==="function"?X.stringify(J,Z,z,Q):X6.isScalar(J)?zM.stringifyString(J,Z,z,Q):J.toString(Z,z,Q);if(!Y)return W;return X6.isScalar(J)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
+ ${Z.indent}${W}`}WM.createStringifyContext=QM;WM.stringify=YM});var AX=F((HM)=>{var g2=t(),IX=N0(),TX=E1(),j1=F1();function VM({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:V,simpleKeys:H}}=z,K=g2.isNode($)&&$.comment||null;if(H){if(K)throw Error("With simple keys, key nodes cannot have comments");if(g2.isCollection($)||!g2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let q=!H&&(!$||K&&Z==null&&!z.inFlow||g2.isCollection($)||(g2.isScalar($)?$.type===IX.Scalar.BLOCK_FOLDED||$.type===IX.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!q&&(H||!J),indent:W+U});let L=!1,B=!1,N=TX.stringify($,z,()=>L=!0,()=>B=!0);if(!q&&!z.inFlow&&N.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");q=!0}if(z.inFlow){if(J||Z==null){if(L&&Q)Q();return N===""?"?":q?`? ${N}`:N}}else if(J&&!H||Z==null&&q){if(N=`? ${N}`,K&&!L)N+=j1.lineComment(N,z.indent,G(K));else if(B&&X)X();return N}if(L)K=null;if(q){if(K)N+=j1.lineComment(N,z.indent,G(K));N=`? ${N}
61
+ ${W}:`}else if(N=`${N}:`,K)N+=j1.lineComment(N,z.indent,G(K));let I,_,w;if(g2.isNode(Z))I=!!Z.spaceBefore,_=Z.commentBefore,w=Z.comment;else if(I=!1,_=null,w=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!q&&!K&&g2.isScalar(Z))z.indentAtStart=N.length+1;if(B=!1,!V&&U.length>=2&&!z.inFlow&&!q&&g2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let E=!1,x=TX.stringify(Z,z,()=>E=!0,()=>B=!0),j=" ";if(K||I||_){if(j=I?`
62
+ `:"",_){let m=G(_);j+=`
63
+ ${j1.indentComment(m,z.indent)}`}if(x===""&&!z.inFlow){if(j===`
64
+ `&&w)j=`
65
65
 
66
66
  `}else j+=`
67
- ${z.indent}`}else if(!q&&v2.isCollection(Z)){let u=w[0],S=w.indexOf(`
68
- `),d=S!==-1,T0=z.inFlow??Z.flow??Z.items.length===0;if(d||!T0){let j0=!1;if(d&&(u==="&"||u==="!")){let Z0=w.indexOf(" ");if(u==="&"&&Z0!==-1&&Z0<S&&w[Z0+1]==="!")Z0=w.indexOf(" ",Z0+1);if(Z0===-1||S<Z0)j0=!0}if(!j0)j=`
69
- ${z.indent}`}}else if(w===""||w[0]===`
70
- `)j="";if(N+=j+w,z.inFlow){if(E&&Q)Q()}else if(y&&!E)N+=F1.lineComment(N,z.indent,G(y));else if(B&&X)X();return N}eB.stringifyPair=tB});var W7=P((QM)=>{var BX=n0("process");function ZM($,...Z){if($==="debug")console.log(...Z)}function zM($,Z){if($==="debug"||$==="warn")if(typeof BX.emitWarning==="function")BX.emitWarning(Z);else console.warn(Z)}QM.debug=ZM;QM.warn=zM});var g8=P((WM)=>{var v8=t(),MX=N0(),k8="<<",b8={identify:($)=>$===k8||typeof $==="symbol"&&$.description===k8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new MX.Scalar(Symbol(k8)),{addToJSMap:LX}),stringify:()=>k8},YM=($,Z)=>(b8.identify(Z)||v8.isScalar(Z)&&(!Z.type||Z.type===MX.Scalar.PLAIN)&&b8.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===b8.tag&&z.default);function LX($,Z,z){let Q=NX($,z);if(v8.isSeq(Q))for(let X of Q.items)U7($,Z,X);else if(Array.isArray(Q))for(let X of Q)U7($,Z,X);else U7($,Z,Q)}function U7($,Z,z){let Q=NX($,z);if(!v8.isMap(Q))throw Error("Merge sources must be maps or map aliases");let X=Q.toJSON(null,$,Map);for(let[J,Y]of X)if(Z instanceof Map){if(!Z.has(J))Z.set(J,Y)}else if(Z instanceof Set)Z.add(J);else if(!Object.prototype.hasOwnProperty.call(Z,J))Object.defineProperty(Z,J,{value:Y,writable:!0,enumerable:!0,configurable:!0});return Z}function NX($,Z){return $&&v8.isAlias(Z)?Z.resolve($.doc,$):Z}WM.addMergeToJSMap=LX;WM.isMergeKey=YM;WM.merge=b8});var V7=P((MM)=>{var HM=W7(),DX=g8(),KM=P1(),OX=t(),G7=$6();function qM($,Z,{key:z,value:Q}){if(OX.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(DX.isMergeKey($,z))DX.addMergeToJSMap($,Z,Q);else{let X=G7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,G7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=BM(z,X,$),Y=G7.toJS(Q,J,$);if(J in Z)Object.defineProperty(Z,J,{value:Y,writable:!0,enumerable:!0,configurable:!0});else Z[J]=Y}}return Z}function BM($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(OX.isNode($)&&z?.doc){let Q=KM.createStringifyContext(z.doc,{});Q.anchors=new Set;for(let J of z.anchors.keys())Q.anchors.add(J.anchor);Q.inFlow=!0,Q.inStringifyKey=!0;let X=$.toString(Q);if(!z.mapKeyWarned){let J=JSON.stringify(X);if(J.length>40)J=J.substring(0,36)+'..."';HM.warn(z.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${J}. Set mapAsMap: true to use object keys.`),z.mapKeyWarned=!0}return X}return JSON.stringify(Z)}MM.addPairToJSMap=qM});var Q6=P((IM)=>{var IX=A1(),NM=qX(),DM=V7(),h8=t();function OM($,Z,z){let Q=IX.createNode($,void 0,z),X=IX.createNode(Z,void 0,z);return new f8(Q,X)}class f8{constructor($,Z=null){Object.defineProperty(this,h8.NODE_TYPE,{value:h8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(h8.isNode(Z))Z=Z.clone($);if(h8.isNode(z))z=z.clone($);return new f8(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return DM.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?NM.stringifyPair(this,$,Z,z):JSON.stringify(this)}}IM.Pair=f8;IM.createPair=OM});var H7=P((PM)=>{var j6=t(),TX=P1(),u8=C1();function CM($,Z,z){return(Z.inFlow??$.flow?RM:_M)($,Z,z)}function _M({comment:$,items:Z},z,{blockItemPrefix:Q,flowChars:X,itemIndent:J,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:G}}=z,V=Object.assign({},z,{indent:J,type:null}),H=!1,K=[];for(let L=0;L<Z.length;++L){let B=Z[L],N=null;if(j6.isNode(B)){if(!H&&B.spaceBefore)K.push("");if(m8(z,K,B.commentBefore,H),B.comment)N=B.comment}else if(j6.isPair(B)){let _=j6.isNode(B.key)?B.key:null;if(_){if(!H&&_.spaceBefore)K.push("");m8(z,K,_.commentBefore,H)}}H=!1;let I=TX.stringify(B,V,()=>N=null,()=>H=!0);if(N)I+=u8.lineComment(I,J,G(N));if(H&&N)H=!1;K.push(Q+I)}let q;if(K.length===0)q=X.start+X.end;else{q=K[0];for(let L=1;L<K.length;++L){let B=K[L];q+=B?`
67
+ ${z.indent}`}else if(!q&&g2.isCollection(Z)){let m=x[0],S=x.indexOf(`
68
+ `),i=S!==-1,T0=z.inFlow??Z.flow??Z.items.length===0;if(i||!T0){let j0=!1;if(i&&(m==="&"||m==="!")){let Z0=x.indexOf(" ");if(m==="&"&&Z0!==-1&&Z0<S&&x[Z0+1]==="!")Z0=x.indexOf(" ",Z0+1);if(Z0===-1||S<Z0)j0=!0}if(!j0)j=`
69
+ ${z.indent}`}}else if(x===""||x[0]===`
70
+ `)j="";if(N+=j+x,z.inFlow){if(E&&Q)Q()}else if(w&&!E)N+=j1.lineComment(N,z.indent,G(w));else if(B&&X)X();return N}HM.stringifyPair=VM});var H7=F((MM)=>{var CX=n0("process");function qM($,...Z){if($==="debug")console.log(...Z)}function BM($,Z){if($==="debug"||$==="warn")if(typeof CX.emitWarning==="function")CX.emitWarning(Z);else console.warn(Z)}MM.debug=qM;MM.warn=BM});var f8=F((DM)=>{var h8=t(),_X=N0(),v8="<<",g8={identify:($)=>$===v8||typeof $==="symbol"&&$.description===v8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new _X.Scalar(Symbol(v8)),{addToJSMap:RX}),stringify:()=>v8},OM=($,Z)=>(g8.identify(Z)||h8.isScalar(Z)&&(!Z.type||Z.type===_X.Scalar.PLAIN)&&g8.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===g8.tag&&z.default);function RX($,Z,z){let Q=FX($,z);if(h8.isSeq(Q))for(let X of Q.items)K7($,Z,X);else if(Array.isArray(Q))for(let X of Q)K7($,Z,X);else K7($,Z,Q)}function K7($,Z,z){let Q=FX($,z);if(!h8.isMap(Q))throw Error("Merge sources must be maps or map aliases");let X=Q.toJSON(null,$,Map);for(let[J,Y]of X)if(Z instanceof Map){if(!Z.has(J))Z.set(J,Y)}else if(Z instanceof Set)Z.add(J);else if(!Object.prototype.hasOwnProperty.call(Z,J))Object.defineProperty(Z,J,{value:Y,writable:!0,enumerable:!0,configurable:!0});return Z}function FX($,Z){return $&&h8.isAlias(Z)?Z.resolve($.doc,$):Z}DM.addMergeToJSMap=RX;DM.isMergeKey=OM;DM.merge=g8});var B7=F((PM)=>{var CM=H7(),PX=f8(),_M=E1(),SX=t(),q7=z6();function RM($,Z,{key:z,value:Q}){if(SX.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(PX.isMergeKey($,z))PX.addMergeToJSMap($,Z,Q);else{let X=q7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,q7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=FM(z,X,$),Y=q7.toJS(Q,J,$);if(J in Z)Object.defineProperty(Z,J,{value:Y,writable:!0,enumerable:!0,configurable:!0});else Z[J]=Y}}return Z}function FM($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(SX.isNode($)&&z?.doc){let Q=_M.createStringifyContext(z.doc,{});Q.anchors=new Set;for(let J of z.anchors.keys())Q.anchors.add(J.anchor);Q.inFlow=!0,Q.inStringifyKey=!0;let X=$.toString(Q);if(!z.mapKeyWarned){let J=JSON.stringify(X);if(J.length>40)J=J.substring(0,36)+'..."';CM.warn(z.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${J}. Set mapAsMap: true to use object keys.`),z.mapKeyWarned=!0}return X}return JSON.stringify(Z)}PM.addPairToJSMap=RM});var J6=F((xM)=>{var EX=R1(),EM=AX(),jM=B7(),u8=t();function wM($,Z,z){let Q=EX.createNode($,void 0,z),X=EX.createNode(Z,void 0,z);return new m8(Q,X)}class m8{constructor($,Z=null){Object.defineProperty(this,u8.NODE_TYPE,{value:u8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(u8.isNode(Z))Z=Z.clone($);if(u8.isNode(z))z=z.clone($);return new m8(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return jM.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?EM.stringifyPair(this,$,Z,z):JSON.stringify(this)}}xM.Pair=m8;xM.createPair=wM});var M7=F((hM)=>{var x6=t(),jX=E1(),c8=F1();function bM($,Z,z){return(Z.inFlow??$.flow?gM:vM)($,Z,z)}function vM({comment:$,items:Z},z,{blockItemPrefix:Q,flowChars:X,itemIndent:J,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:G}}=z,V=Object.assign({},z,{indent:J,type:null}),H=!1,K=[];for(let L=0;L<Z.length;++L){let B=Z[L],N=null;if(x6.isNode(B)){if(!H&&B.spaceBefore)K.push("");if(p8(z,K,B.commentBefore,H),B.comment)N=B.comment}else if(x6.isPair(B)){let _=x6.isNode(B.key)?B.key:null;if(_){if(!H&&_.spaceBefore)K.push("");p8(z,K,_.commentBefore,H)}}H=!1;let I=jX.stringify(B,V,()=>N=null,()=>H=!0);if(N)I+=c8.lineComment(I,J,G(N));if(H&&N)H=!1;K.push(Q+I)}let q;if(K.length===0)q=X.start+X.end;else{q=K[0];for(let L=1;L<K.length;++L){let B=K[L];q+=B?`
71
71
  ${U}${B}`:`
72
72
  `}}if($){if(q+=`
73
- `+u8.indentComment(G($),U),W)W()}else if(H&&Y)Y();return q}function RM({items:$},Z,{flowChars:z,itemIndent:Q}){let{indent:X,indentStep:J,flowCollectionPadding:Y,options:{commentString:W}}=Z;Q+=J;let U=Object.assign({},Z,{indent:Q,inFlow:!0,type:null}),G=!1,V=0,H=[];for(let L=0;L<$.length;++L){let B=$[L],N=null;if(j6.isNode(B)){if(B.spaceBefore)H.push("");if(m8(Z,H,B.commentBefore,!1),B.comment)N=B.comment}else if(j6.isPair(B)){let _=j6.isNode(B.key)?B.key:null;if(_){if(_.spaceBefore)H.push("");if(m8(Z,H,_.commentBefore,!1),_.comment)G=!0}let y=j6.isNode(B.value)?B.value:null;if(y){if(y.comment)N=y.comment;if(y.commentBefore)G=!0}else if(B.value==null&&_?.comment)N=_.comment}if(N)G=!0;let I=TX.stringify(B,U,()=>N=null);if(G||(G=H.length>V||I.includes(`
74
- `)),L<$.length-1)I+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=H.reduce((_,y)=>_+y.length+2,2)+(I.length+2)>Z.options.lineWidth);if(G)I+=","}if(N)I+=u8.lineComment(I,Q,W(N));H.push(I),V=H.length}let{start:K,end:q}=z;if(H.length===0)return K+q;else{if(!G){let L=H.reduce((B,N)=>B+N.length+2,2);G=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(G){let L=K;for(let B of H)L+=B?`
73
+ `+c8.indentComment(G($),U),W)W()}else if(H&&Y)Y();return q}function gM({items:$},Z,{flowChars:z,itemIndent:Q}){let{indent:X,indentStep:J,flowCollectionPadding:Y,options:{commentString:W}}=Z;Q+=J;let U=Object.assign({},Z,{indent:Q,inFlow:!0,type:null}),G=!1,V=0,H=[];for(let L=0;L<$.length;++L){let B=$[L],N=null;if(x6.isNode(B)){if(B.spaceBefore)H.push("");if(p8(Z,H,B.commentBefore,!1),B.comment)N=B.comment}else if(x6.isPair(B)){let _=x6.isNode(B.key)?B.key:null;if(_){if(_.spaceBefore)H.push("");if(p8(Z,H,_.commentBefore,!1),_.comment)G=!0}let w=x6.isNode(B.value)?B.value:null;if(w){if(w.comment)N=w.comment;if(w.commentBefore)G=!0}else if(B.value==null&&_?.comment)N=_.comment}if(N)G=!0;let I=jX.stringify(B,U,()=>N=null);if(G||(G=H.length>V||I.includes(`
74
+ `)),L<$.length-1)I+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=H.reduce((_,w)=>_+w.length+2,2)+(I.length+2)>Z.options.lineWidth);if(G)I+=","}if(N)I+=c8.lineComment(I,Q,W(N));H.push(I),V=H.length}let{start:K,end:q}=z;if(H.length===0)return K+q;else{if(!G){let L=H.reduce((B,N)=>B+N.length+2,2);G=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(G){let L=K;for(let B of H)L+=B?`
75
75
  ${J}${X}${B}`:`
76
76
  `;return`${L}
77
- ${X}${q}`}else return`${K}${Y}${H.join(" ")}${Y}${q}`}}function m8({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=u8.indentComment(Z(Q),$);z.push(J.trimStart())}}PM.stringifyCollection=CM});var J6=P((xM)=>{var SM=H7(),EM=V7(),jM=j8(),X6=t(),c8=Q6(),wM=N0();function S1($,Z){let z=X6.isScalar(Z)?Z.value:Z;for(let Q of $)if(X6.isPair(Q)){if(Q.key===Z||Q.key===z)return Q;if(X6.isScalar(Q.key)&&Q.key.value===z)return Q}return}class AX extends jM.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(X6.MAP,$);this.items=[]}static from($,Z,z){let{keepUndefined:Q,replacer:X}=z,J=new this($),Y=(W,U)=>{if(typeof X==="function")U=X.call(Z,W,U);else if(Array.isArray(X)&&!X.includes(W))return;if(U!==void 0||Q)J.items.push(c8.createPair(W,U,z))};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")J.items.sort($.sortMapEntries);return J}add($,Z){let z;if(X6.isPair($))z=$;else if(!$||typeof $!=="object"||!("key"in $))z=new c8.Pair($,$?.value);else z=new c8.Pair($.key,$.value);let Q=S1(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if(X6.isScalar(Q.value)&&wM.isScalarValue(z.value))Q.value.value=z.value;else Q.value=z.value}else if(X){let J=this.items.findIndex((Y)=>X(z,Y)<0);if(J===-1)this.items.push(z);else this.items.splice(J,0,z)}else this.items.push(z)}delete($){let Z=S1(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=S1(this.items,$)?.value;return(!Z&&X6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!S1(this.items,$)}set($,Z){this.add(new c8.Pair($,Z),!0)}toJSON($,Z,z){let Q=z?new z:Z?.mapAsMap?new Map:{};if(Z?.onCreate)Z.onCreate(Q);for(let X of this.items)EM.addPairToJSMap(Z,Q,X);return Q}toString($,Z,z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!X6.isPair(Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(Q)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return SM.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}xM.YAMLMap=AX;xM.findPair=S1});var M$=P((gM)=>{var bM=t(),CX=J6(),vM={collection:"map",default:!0,nodeClass:CX.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!bM.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>CX.YAMLMap.from($,Z,z)};gM.map=vM});var Y6=P((lM)=>{var fM=A1(),uM=H7(),mM=j8(),l8=t(),cM=N0(),pM=$6();class _X extends mM.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(l8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=p8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=p8($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&l8.isScalar(Q)?Q.value:Q}has($){let Z=p8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=p8($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(l8.isScalar(Q)&&cM.isScalarValue(Z))Q.value=Z;else this.items[z]=Z}toJSON($,Z){let z=[];if(Z?.onCreate)Z.onCreate(z);let Q=0;for(let X of this.items)z.push(pM.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return uM.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:z,onComment:Z})}static from($,Z,z){let{replacer:Q}=z,X=new this($);if(Z&&Symbol.iterator in Object(Z)){let J=0;for(let Y of Z){if(typeof Q==="function"){let W=Z instanceof Set?Y:String(J++);Y=Q.call(Z,W,Y)}X.items.push(fM.createNode(Y,void 0,z))}}return X}}function p8($){let Z=l8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}lM.YAMLSeq=_X});var L$=P((rM)=>{var iM=t(),RX=Y6(),nM={collection:"seq",default:!0,nodeClass:RX.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!iM.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>RX.YAMLSeq.from($,Z,z)};rM.seq=nM});var E1=P((tM)=>{var oM=R1(),aM={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),oM.stringifyString($,Z,z,Q)}};tM.string=aM});var d8=P(($L)=>{var PX=N0(),FX={identify:($)=>$==null,createNode:()=>new PX.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new PX.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&FX.test.test($)?$:Z.options.nullStr};$L.nullTag=FX});var K7=P((QL)=>{var zL=N0(),SX={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new zL.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&SX.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};QL.boolTag=SX});var N$=P((YL)=>{function JL({format:$,minFractionDigits:Z,tag:z,value:Q}){if(typeof Q==="bigint")return String(Q);let X=typeof Q==="number"?Q:Number(Q);if(!isFinite(X))return isNaN(X)?".nan":X<0?"-.inf":".inf";let J=Object.is(Q,-0)?"-0":JSON.stringify(Q);if(!$&&Z&&(!z||z==="tag:yaml.org,2002:float")&&/^-?\d/.test(J)&&!J.includes("e")){let Y=J.indexOf(".");if(Y<0)Y=J.length,J+=".";let W=Z-(J.length-Y-1);while(W-- >0)J+="0"}return J}YL.stringifyNumber=JL});var B7=P((KL)=>{var UL=N0(),q7=N$(),GL={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:q7.stringifyNumber},VL={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():q7.stringifyNumber($)}},HL={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new UL.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:q7.stringifyNumber};KL.float=HL;KL.floatExp=VL;KL.floatNaN=GL});var L7=P((OL)=>{var EX=N$(),i8=($)=>typeof $==="bigint"||Number.isInteger($),M7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function jX($,Z,z){let{value:Q}=$;if(i8(Q)&&Q>=0)return z+Q.toString(Z);return EX.stringifyNumber($)}var LL={identify:($)=>i8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>M7($,2,8,z),stringify:($)=>jX($,8,"0o")},NL={identify:i8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>M7($,0,10,z),stringify:EX.stringifyNumber},DL={identify:($)=>i8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>M7($,2,16,z),stringify:($)=>jX($,16,"0x")};OL.int=NL;OL.intHex=DL;OL.intOct=LL});var wX=P((EL)=>{var CL=M$(),_L=d8(),RL=L$(),PL=E1(),FL=K7(),N7=B7(),D7=L7(),SL=[CL.map,RL.seq,PL.string,_L.nullTag,FL.boolTag,D7.intOct,D7.int,D7.intHex,N7.floatNaN,N7.floatExp,N7.float];EL.schema=SL});var yX=P((gL)=>{var wL=N0(),xL=M$(),yL=L$();function xX($){return typeof $==="bigint"||Number.isInteger($)}var n8=({value:$})=>JSON.stringify($),kL=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:n8},{identify:($)=>$==null,createNode:()=>new wL.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:n8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:n8},{identify:xX,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>xX($)?$.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:n8}],bL={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},vL=[xL.map,yL.seq].concat(kL,bL);gL.schema=vL});var I7=P((mL)=>{var j1=n0("buffer"),O7=N0(),fL=R1(),uL={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof j1.Buffer==="function")return j1.Buffer.from($,"base64");else if(typeof atob==="function"){let z=atob($.replace(/[\n\r]/g,"")),Q=new Uint8Array(z.length);for(let X=0;X<z.length;++X)Q[X]=z.charCodeAt(X);return Q}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:z},Q,X,J){if(!z)return"";let Y=z,W;if(typeof j1.Buffer==="function")W=Y instanceof j1.Buffer?Y.toString("base64"):j1.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let G=0;G<Y.length;++G)U+=String.fromCharCode(Y[G]);W=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=O7.Scalar.BLOCK_LITERAL),Z!==O7.Scalar.QUOTE_DOUBLE){let U=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),G=Math.ceil(W.length/U),V=Array(G);for(let H=0,K=0;H<G;++H,K+=U)V[H]=W.substr(K,U);W=V.join(Z===O7.Scalar.BLOCK_LITERAL?`
78
- `:" ")}return fL.stringifyString({comment:$,type:Z,value:W},Q,X,J)}};mL.binary=uL});var s8=P((iL)=>{var r8=t(),T7=Q6(),pL=N0(),lL=Y6();function kX($,Z){if(r8.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if(r8.isPair(Q))continue;else if(r8.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new T7.Pair(new pL.Scalar(null));if(Q.commentBefore)X.key.commentBefore=X.key.commentBefore?`${Q.commentBefore}
77
+ ${X}${q}`}else return`${K}${Y}${H.join(" ")}${Y}${q}`}}function p8({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=c8.indentComment(Z(Q),$);z.push(J.trimStart())}}hM.stringifyCollection=bM});var W6=F((lM)=>{var uM=M7(),mM=B7(),cM=x8(),Y6=t(),l8=J6(),pM=N0();function w1($,Z){let z=Y6.isScalar(Z)?Z.value:Z;for(let Q of $)if(Y6.isPair(Q)){if(Q.key===Z||Q.key===z)return Q;if(Y6.isScalar(Q.key)&&Q.key.value===z)return Q}return}class wX extends cM.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(Y6.MAP,$);this.items=[]}static from($,Z,z){let{keepUndefined:Q,replacer:X}=z,J=new this($),Y=(W,U)=>{if(typeof X==="function")U=X.call(Z,W,U);else if(Array.isArray(X)&&!X.includes(W))return;if(U!==void 0||Q)J.items.push(l8.createPair(W,U,z))};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")J.items.sort($.sortMapEntries);return J}add($,Z){let z;if(Y6.isPair($))z=$;else if(!$||typeof $!=="object"||!("key"in $))z=new l8.Pair($,$?.value);else z=new l8.Pair($.key,$.value);let Q=w1(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if(Y6.isScalar(Q.value)&&pM.isScalarValue(z.value))Q.value.value=z.value;else Q.value=z.value}else if(X){let J=this.items.findIndex((Y)=>X(z,Y)<0);if(J===-1)this.items.push(z);else this.items.splice(J,0,z)}else this.items.push(z)}delete($){let Z=w1(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=w1(this.items,$)?.value;return(!Z&&Y6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!w1(this.items,$)}set($,Z){this.add(new l8.Pair($,Z),!0)}toJSON($,Z,z){let Q=z?new z:Z?.mapAsMap?new Map:{};if(Z?.onCreate)Z.onCreate(Q);for(let X of this.items)mM.addPairToJSMap(Z,Q,X);return Q}toString($,Z,z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!Y6.isPair(Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(Q)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return uM.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}lM.YAMLMap=wX;lM.findPair=w1});var D$=F((sM)=>{var nM=t(),xX=W6(),rM={collection:"map",default:!0,nodeClass:xX.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!nM.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>xX.YAMLMap.from($,Z,z)};sM.map=rM});var U6=F((zL)=>{var aM=R1(),tM=M7(),eM=x8(),i8=t(),$L=N0(),ZL=z6();class yX extends eM.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(i8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=d8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=d8($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&i8.isScalar(Q)?Q.value:Q}has($){let Z=d8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=d8($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(i8.isScalar(Q)&&$L.isScalarValue(Z))Q.value=Z;else this.items[z]=Z}toJSON($,Z){let z=[];if(Z?.onCreate)Z.onCreate(z);let Q=0;for(let X of this.items)z.push(ZL.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return tM.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:z,onComment:Z})}static from($,Z,z){let{replacer:Q}=z,X=new this($);if(Z&&Symbol.iterator in Object(Z)){let J=0;for(let Y of Z){if(typeof Q==="function"){let W=Z instanceof Set?Y:String(J++);Y=Q.call(Z,W,Y)}X.items.push(aM.createNode(Y,void 0,z))}}return X}}function d8($){let Z=i8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}zL.YAMLSeq=yX});var I$=F((YL)=>{var XL=t(),kX=U6(),JL={collection:"seq",default:!0,nodeClass:kX.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!XL.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>kX.YAMLSeq.from($,Z,z)};YL.seq=JL});var x1=F((VL)=>{var UL=S1(),GL={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),UL.stringifyString($,Z,z,Q)}};VL.string=GL});var n8=F((KL)=>{var bX=N0(),vX={identify:($)=>$==null,createNode:()=>new bX.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new bX.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&vX.test.test($)?$:Z.options.nullStr};KL.nullTag=vX});var L7=F((ML)=>{var BL=N0(),gX={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new BL.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&gX.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};ML.boolTag=gX});var T$=F((OL)=>{function NL({format:$,minFractionDigits:Z,tag:z,value:Q}){if(typeof Q==="bigint")return String(Q);let X=typeof Q==="number"?Q:Number(Q);if(!isFinite(X))return isNaN(X)?".nan":X<0?"-.inf":".inf";let J=Object.is(Q,-0)?"-0":JSON.stringify(Q);if(!$&&Z&&(!z||z==="tag:yaml.org,2002:float")&&/^-?\d/.test(J)&&!J.includes("e")){let Y=J.indexOf(".");if(Y<0)Y=J.length,J+=".";let W=Z-(J.length-Y-1);while(W-- >0)J+="0"}return J}OL.stringifyNumber=NL});var O7=F((_L)=>{var IL=N0(),N7=T$(),TL={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:N7.stringifyNumber},AL={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():N7.stringifyNumber($)}},CL={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new IL.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:N7.stringifyNumber};_L.float=CL;_L.floatExp=AL;_L.floatNaN=TL});var I7=F((wL)=>{var hX=T$(),r8=($)=>typeof $==="bigint"||Number.isInteger($),D7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function fX($,Z,z){let{value:Q}=$;if(r8(Q)&&Q>=0)return z+Q.toString(Z);return hX.stringifyNumber($)}var SL={identify:($)=>r8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>D7($,2,8,z),stringify:($)=>fX($,8,"0o")},EL={identify:r8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>D7($,0,10,z),stringify:hX.stringifyNumber},jL={identify:($)=>r8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>D7($,2,16,z),stringify:($)=>fX($,16,"0x")};wL.int=EL;wL.intHex=jL;wL.intOct=SL});var uX=F((mL)=>{var bL=D$(),vL=n8(),gL=I$(),hL=x1(),fL=L7(),T7=O7(),A7=I7(),uL=[bL.map,gL.seq,hL.string,vL.nullTag,fL.boolTag,A7.intOct,A7.int,A7.intHex,T7.floatNaN,T7.floatExp,T7.float];mL.schema=uL});var cX=F((sL)=>{var pL=N0(),lL=D$(),dL=I$();function mX($){return typeof $==="bigint"||Number.isInteger($)}var s8=({value:$})=>JSON.stringify($),iL=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:s8},{identify:($)=>$==null,createNode:()=>new pL.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:s8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:s8},{identify:mX,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>mX($)?$.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:s8}],nL={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},rL=[lL.map,dL.seq].concat(iL,nL);sL.schema=rL});var _7=F((eL)=>{var y1=n0("buffer"),C7=N0(),aL=S1(),tL={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof y1.Buffer==="function")return y1.Buffer.from($,"base64");else if(typeof atob==="function"){let z=atob($.replace(/[\n\r]/g,"")),Q=new Uint8Array(z.length);for(let X=0;X<z.length;++X)Q[X]=z.charCodeAt(X);return Q}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:z},Q,X,J){if(!z)return"";let Y=z,W;if(typeof y1.Buffer==="function")W=Y instanceof y1.Buffer?Y.toString("base64"):y1.Buffer.from(Y.buffer).toString("base64");else if(typeof btoa==="function"){let U="";for(let G=0;G<Y.length;++G)U+=String.fromCharCode(Y[G]);W=btoa(U)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=C7.Scalar.BLOCK_LITERAL),Z!==C7.Scalar.QUOTE_DOUBLE){let U=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),G=Math.ceil(W.length/U),V=Array(G);for(let H=0,K=0;H<G;++H,K+=U)V[H]=W.substr(K,U);W=V.join(Z===C7.Scalar.BLOCK_LITERAL?`
78
+ `:" ")}return aL.stringifyString({comment:$,type:Z,value:W},Q,X,J)}};eL.binary=tL});var a8=F((XN)=>{var o8=t(),R7=J6(),ZN=N0(),zN=U6();function pX($,Z){if(o8.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if(o8.isPair(Q))continue;else if(o8.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new R7.Pair(new ZN.Scalar(null));if(Q.commentBefore)X.key.commentBefore=X.key.commentBefore?`${Q.commentBefore}
79
79
  ${X.key.commentBefore}`:Q.commentBefore;if(Q.comment){let J=X.value??X.key;J.comment=J.comment?`${Q.comment}
80
- ${J.comment}`:Q.comment}Q=X}$.items[z]=r8.isPair(Q)?Q:new T7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function bX($,Z,z){let{replacer:Q}=z,X=new lL.YAMLSeq($);X.tag="tag:yaml.org,2002:pairs";let J=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof Q==="function")Y=Q.call(Z,String(J++),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 G=Object.keys(Y);if(G.length===1)W=G[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else W=Y;X.items.push(T7.createPair(W,U,z))}return X}var dL={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:kX,createNode:bX};iL.createPairs=bX;iL.pairs=dL;iL.resolvePairs=kX});var C7=P((tL)=>{var vX=t(),A7=$6(),w1=J6(),oL=Y6(),gX=s8();class w6 extends oL.YAMLSeq{constructor(){super();this.add=w1.YAMLMap.prototype.add.bind(this),this.delete=w1.YAMLMap.prototype.delete.bind(this),this.get=w1.YAMLMap.prototype.get.bind(this),this.has=w1.YAMLMap.prototype.has.bind(this),this.set=w1.YAMLMap.prototype.set.bind(this),this.tag=w6.tag}toJSON($,Z){if(!Z)return super.toJSON($);let z=new Map;if(Z?.onCreate)Z.onCreate(z);for(let Q of this.items){let X,J;if(vX.isPair(Q))X=A7.toJS(Q.key,"",Z),J=A7.toJS(Q.value,X,Z);else X=A7.toJS(Q,"",Z);if(z.has(X))throw Error("Ordered maps must not include duplicate keys");z.set(X,J)}return z}static from($,Z,z){let Q=gX.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}w6.tag="tag:yaml.org,2002:omap";var aL={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:w6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=gX.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(vX.isScalar(X))if(Q.includes(X.value))Z(`Ordered maps must not include duplicate keys: ${X.value}`);else Q.push(X.value);return Object.assign(new w6,z)},createNode:($,Z,z)=>w6.from($,Z,z)};tL.YAMLOMap=w6;tL.omap=aL});var cX=P((ZN)=>{var hX=N0();function fX({value:$,source:Z},z){if(Z&&($?uX:mX).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var uX={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new hX.Scalar(!0),stringify:fX},mX={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new hX.Scalar(!1),stringify:fX};ZN.falseTag=mX;ZN.trueTag=uX});var pX=P((UN)=>{var XN=N0(),_7=N$(),JN={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:_7.stringifyNumber},YN={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():_7.stringifyNumber($)}},WN={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new XN.Scalar(parseFloat($.replace(/_/g,""))),z=$.indexOf(".");if(z!==-1){let Q=$.substring(z+1).replace(/_/g,"");if(Q[Q.length-1]==="0")Z.minFractionDigits=Q.length}return Z},stringify:_7.stringifyNumber};UN.float=WN;UN.floatExp=YN;UN.floatNaN=JN});var dX=P((LN)=>{var lX=N$(),x1=($)=>typeof $==="bigint"||Number.isInteger($);function o8($,Z,z,{intAsBigInt:Q}){let X=$[0];if(X==="-"||X==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),Q){switch(z){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Y=BigInt($);return X==="-"?BigInt(-1)*Y:Y}let J=parseInt($,z);return X==="-"?-1*J:J}function R7($,Z,z){let{value:Q}=$;if(x1(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return lX.stringifyNumber($)}var KN={identify:x1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>o8($,2,2,z),stringify:($)=>R7($,2,"0b")},qN={identify:x1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>o8($,1,8,z),stringify:($)=>R7($,8,"0")},BN={identify:x1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>o8($,0,10,z),stringify:lX.stringifyNumber},MN={identify:x1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>o8($,2,16,z),stringify:($)=>R7($,16,"0x")};LN.int=BN;LN.intBin=KN;LN.intHex=MN;LN.intOct=qN});var P7=P((AN)=>{var e8=t(),a8=Q6(),t8=J6();class x6 extends t8.YAMLMap{constructor($){super($);this.tag=x6.tag}add($){let Z;if(e8.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new a8.Pair($.key,null);else Z=new a8.Pair($,null);if(!t8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=t8.findPair(this.items,$);return!Z&&e8.isPair(z)?e8.isScalar(z.key)?z.key.value:z.key:z}set($,Z){if(typeof Z!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof Z}`);let z=t8.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new a8.Pair($))}toJSON($,Z){return super.toJSON($,Z,Set)}toString($,Z,z){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),Z,z);else throw Error("Set items must all have null values")}static from($,Z,z){let{replacer:Q}=z,X=new this($);if(Z&&Symbol.iterator in Object(Z))for(let J of Z){if(typeof Q==="function")J=Q.call(Z,J,J);X.items.push(a8.createPair(J,null,z))}return X}}x6.tag="tag:yaml.org,2002:set";var TN={collection:"map",identify:($)=>$ instanceof Set,nodeClass:x6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>x6.from($,Z,z),resolve($,Z){if(e8.isMap($))if($.hasAllNullValues(!0))return Object.assign(new x6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};AN.YAMLSet=x6;AN.set=TN});var S7=P((SN)=>{var RN=N$();function F7($,Z){let z=$[0],Q=z==="-"||z==="+"?$.substring(1):$,X=(Y)=>Z?BigInt(Y):Number(Y),J=Q.replace(/_/g,"").split(":").reduce((Y,W)=>Y*X(60)+X(W),X(0));return z==="-"?X(-1)*J:J}function iX($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return RN.stringifyNumber($);let Q="";if(Z<0)Q="-",Z*=z(-1);let X=z(60),J=[Z%X];if(Z<60)J.unshift(0);else if(Z=(Z-J[0])/X,J.unshift(Z%X),Z>=60)Z=(Z-J[0])/X,J.unshift(Z);return Q+J.map((Y)=>String(Y).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var PN={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:z})=>F7($,z),stringify:iX},FN={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:($)=>F7($,!1),stringify:iX},nX={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(nX.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,z,Q,X,J,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,G=Date.UTC(z,Q-1,X,J||0,Y||0,W||0,U),V=Z[8];if(V&&V!=="Z"){let H=F7(V,!1);if(Math.abs(H)<30)H*=60;G-=60000*H}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};SN.floatTime=FN;SN.intTime=PN;SN.timestamp=nX});var sX=P((cN)=>{var xN=M$(),yN=d8(),kN=L$(),bN=E1(),vN=I7(),rX=cX(),E7=pX(),$5=dX(),gN=g8(),hN=C7(),fN=s8(),uN=P7(),j7=S7(),mN=[xN.map,kN.seq,bN.string,yN.nullTag,rX.trueTag,rX.falseTag,$5.intBin,$5.intOct,$5.int,$5.intHex,E7.floatNaN,E7.floatExp,E7.float,vN.binary,gN.merge,hN.omap,fN.pairs,uN.set,j7.intTime,j7.floatTime,j7.timestamp];cN.schema=mN});var JJ=P((aN)=>{var eX=M$(),lN=d8(),$J=L$(),dN=E1(),iN=K7(),w7=B7(),x7=L7(),nN=wX(),rN=yX(),ZJ=I7(),y1=g8(),zJ=C7(),QJ=s8(),oX=sX(),XJ=P7(),Z5=S7(),aX=new Map([["core",nN.schema],["failsafe",[eX.map,$J.seq,dN.string]],["json",rN.schema],["yaml11",oX.schema],["yaml-1.1",oX.schema]]),tX={binary:ZJ.binary,bool:iN.boolTag,float:w7.float,floatExp:w7.floatExp,floatNaN:w7.floatNaN,floatTime:Z5.floatTime,int:x7.int,intHex:x7.intHex,intOct:x7.intOct,intTime:Z5.intTime,map:eX.map,merge:y1.merge,null:lN.nullTag,omap:zJ.omap,pairs:QJ.pairs,seq:$J.seq,set:XJ.set,timestamp:Z5.timestamp},sN={"tag:yaml.org,2002:binary":ZJ.binary,"tag:yaml.org,2002:merge":y1.merge,"tag:yaml.org,2002:omap":zJ.omap,"tag:yaml.org,2002:pairs":QJ.pairs,"tag:yaml.org,2002:set":XJ.set,"tag:yaml.org,2002:timestamp":Z5.timestamp};function oN($,Z,z){let Q=aX.get(Z);if(Q&&!$)return z&&!Q.includes(y1.merge)?Q.concat(y1.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(aX.keys()).filter((Y)=>Y!=="yaml11").map((Y)=>JSON.stringify(Y)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${J} or define customTags array`)}if(Array.isArray($))for(let J of $)X=X.concat(J);else if(typeof $==="function")X=$(X.slice());if(z)X=X.concat(y1.merge);return X.reduce((J,Y)=>{let W=typeof Y==="string"?tX[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(tX).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${G}`)}if(!J.includes(W))J.push(W);return J},[])}aN.coreKnownTags=sN;aN.getTags=oN});var b7=P((XD)=>{var y7=t(),$D=M$(),ZD=L$(),zD=E1(),z5=JJ(),QD=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class k7{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?z5.getTags($,"compat"):$?z5.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?z5.coreKnownTags:{},this.tags=z5.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,y7.MAP,{value:$D.map}),Object.defineProperty(this,y7.SCALAR,{value:zD.string}),Object.defineProperty(this,y7.SEQ,{value:ZD.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?QD:null}clone(){let $=Object.create(k7.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}XD.Schema=k7});var YJ=P((UD)=>{var YD=t(),v7=P1(),k1=C1();function WD($,Z){let z=[],Q=Z.directives===!0;if(Z.directives!==!1&&$.directives){let U=$.directives.toString($);if(U)z.push(U),Q=!0;else if($.directives.docStart)Q=!0}if(Q)z.push("---");let X=v7.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let U=J($.commentBefore);z.unshift(k1.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(YD.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(k1.indentComment(V,""))}X.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=v7.stringify($.contents,X,()=>W=null,U);if(W)G+=k1.lineComment(G,"",J(W));if((G[0]==="|"||G[0]===">")&&z[z.length-1]==="---")z[z.length-1]=`--- ${G}`;else z.push(G)}else z.push(v7.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let U=J($.comment);if(U.includes(`
81
- `))z.push("..."),z.push(k1.indentComment(U,""));else z.push(`... ${U}`)}else z.push("...");else{let U=$.comment;if(U&&Y)U=U.replace(/^\n+/,"");if(U){if((!Y||W)&&z[z.length-1]!=="")z.push("");z.push(k1.indentComment(J(U),""))}}return z.join(`
80
+ ${J.comment}`:Q.comment}Q=X}$.items[z]=o8.isPair(Q)?Q:new R7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function lX($,Z,z){let{replacer:Q}=z,X=new zN.YAMLSeq($);X.tag="tag:yaml.org,2002:pairs";let J=0;if(Z&&Symbol.iterator in Object(Z))for(let Y of Z){if(typeof Q==="function")Y=Q.call(Z,String(J++),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 G=Object.keys(Y);if(G.length===1)W=G[0],U=Y[W];else throw TypeError(`Expected tuple with one key, not ${G.length} keys`)}else W=Y;X.items.push(R7.createPair(W,U,z))}return X}var QN={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:pX,createNode:lX};XN.createPairs=lX;XN.pairs=QN;XN.resolvePairs=pX});var P7=F((VN)=>{var dX=t(),F7=z6(),k1=W6(),UN=U6(),iX=a8();class y6 extends UN.YAMLSeq{constructor(){super();this.add=k1.YAMLMap.prototype.add.bind(this),this.delete=k1.YAMLMap.prototype.delete.bind(this),this.get=k1.YAMLMap.prototype.get.bind(this),this.has=k1.YAMLMap.prototype.has.bind(this),this.set=k1.YAMLMap.prototype.set.bind(this),this.tag=y6.tag}toJSON($,Z){if(!Z)return super.toJSON($);let z=new Map;if(Z?.onCreate)Z.onCreate(z);for(let Q of this.items){let X,J;if(dX.isPair(Q))X=F7.toJS(Q.key,"",Z),J=F7.toJS(Q.value,X,Z);else X=F7.toJS(Q,"",Z);if(z.has(X))throw Error("Ordered maps must not include duplicate keys");z.set(X,J)}return z}static from($,Z,z){let Q=iX.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}y6.tag="tag:yaml.org,2002:omap";var GN={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:y6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=iX.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(dX.isScalar(X))if(Q.includes(X.value))Z(`Ordered maps must not include duplicate keys: ${X.value}`);else Q.push(X.value);return Object.assign(new y6,z)},createNode:($,Z,z)=>y6.from($,Z,z)};VN.YAMLOMap=y6;VN.omap=GN});var aX=F((qN)=>{var nX=N0();function rX({value:$,source:Z},z){if(Z&&($?sX:oX).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var sX={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new nX.Scalar(!0),stringify:rX},oX={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new nX.Scalar(!1),stringify:rX};qN.falseTag=oX;qN.trueTag=sX});var tX=F((IN)=>{var LN=N0(),S7=T$(),NN={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:S7.stringifyNumber},ON={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():S7.stringifyNumber($)}},DN={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new LN.Scalar(parseFloat($.replace(/_/g,""))),z=$.indexOf(".");if(z!==-1){let Q=$.substring(z+1).replace(/_/g,"");if(Q[Q.length-1]==="0")Z.minFractionDigits=Q.length}return Z},stringify:S7.stringifyNumber};IN.float=DN;IN.floatExp=ON;IN.floatNaN=NN});var $J=F((SN)=>{var eX=T$(),b1=($)=>typeof $==="bigint"||Number.isInteger($);function t8($,Z,z,{intAsBigInt:Q}){let X=$[0];if(X==="-"||X==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),Q){switch(z){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Y=BigInt($);return X==="-"?BigInt(-1)*Y:Y}let J=parseInt($,z);return X==="-"?-1*J:J}function E7($,Z,z){let{value:Q}=$;if(b1(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return eX.stringifyNumber($)}var _N={identify:b1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>t8($,2,2,z),stringify:($)=>E7($,2,"0b")},RN={identify:b1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>t8($,1,8,z),stringify:($)=>E7($,8,"0")},FN={identify:b1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>t8($,0,10,z),stringify:eX.stringifyNumber},PN={identify:b1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>t8($,2,16,z),stringify:($)=>E7($,16,"0x")};SN.int=FN;SN.intBin=_N;SN.intHex=PN;SN.intOct=RN});var j7=F((kN)=>{var Z5=t(),e8=J6(),$5=W6();class k6 extends $5.YAMLMap{constructor($){super($);this.tag=k6.tag}add($){let Z;if(Z5.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new e8.Pair($.key,null);else Z=new e8.Pair($,null);if(!$5.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=$5.findPair(this.items,$);return!Z&&Z5.isPair(z)?Z5.isScalar(z.key)?z.key.value:z.key:z}set($,Z){if(typeof Z!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof Z}`);let z=$5.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new e8.Pair($))}toJSON($,Z){return super.toJSON($,Z,Set)}toString($,Z,z){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),Z,z);else throw Error("Set items must all have null values")}static from($,Z,z){let{replacer:Q}=z,X=new this($);if(Z&&Symbol.iterator in Object(Z))for(let J of Z){if(typeof Q==="function")J=Q.call(Z,J,J);X.items.push(e8.createPair(J,null,z))}return X}}k6.tag="tag:yaml.org,2002:set";var yN={collection:"map",identify:($)=>$ instanceof Set,nodeClass:k6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>k6.from($,Z,z),resolve($,Z){if(Z5.isMap($))if($.hasAllNullValues(!0))return Object.assign(new k6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};kN.YAMLSet=k6;kN.set=yN});var x7=F((uN)=>{var gN=T$();function w7($,Z){let z=$[0],Q=z==="-"||z==="+"?$.substring(1):$,X=(Y)=>Z?BigInt(Y):Number(Y),J=Q.replace(/_/g,"").split(":").reduce((Y,W)=>Y*X(60)+X(W),X(0));return z==="-"?X(-1)*J:J}function ZJ($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return gN.stringifyNumber($);let Q="";if(Z<0)Q="-",Z*=z(-1);let X=z(60),J=[Z%X];if(Z<60)J.unshift(0);else if(Z=(Z-J[0])/X,J.unshift(Z%X),Z>=60)Z=(Z-J[0])/X,J.unshift(Z);return Q+J.map((Y)=>String(Y).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var hN={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:z})=>w7($,z),stringify:ZJ},fN={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:($)=>w7($,!1),stringify:ZJ},zJ={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(zJ.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,z,Q,X,J,Y,W]=Z.map(Number),U=Z[7]?Number((Z[7]+"00").substr(1,3)):0,G=Date.UTC(z,Q-1,X,J||0,Y||0,W||0,U),V=Z[8];if(V&&V!=="Z"){let H=w7(V,!1);if(Math.abs(H)<30)H*=60;G-=60000*H}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};uN.floatTime=fN;uN.intTime=hN;uN.timestamp=zJ});var XJ=F(($O)=>{var lN=D$(),dN=n8(),iN=I$(),nN=x1(),rN=_7(),QJ=aX(),y7=tX(),z5=$J(),sN=f8(),oN=P7(),aN=a8(),tN=j7(),k7=x7(),eN=[lN.map,iN.seq,nN.string,dN.nullTag,QJ.trueTag,QJ.falseTag,z5.intBin,z5.intOct,z5.int,z5.intHex,y7.floatNaN,y7.floatExp,y7.float,rN.binary,sN.merge,oN.omap,aN.pairs,tN.set,k7.intTime,k7.floatTime,k7.timestamp];$O.schema=eN});var BJ=F((GO)=>{var UJ=D$(),zO=n8(),GJ=I$(),QO=x1(),XO=L7(),b7=O7(),v7=I7(),JO=uX(),YO=cX(),VJ=_7(),v1=f8(),HJ=P7(),KJ=a8(),JJ=XJ(),qJ=j7(),Q5=x7(),YJ=new Map([["core",JO.schema],["failsafe",[UJ.map,GJ.seq,QO.string]],["json",YO.schema],["yaml11",JJ.schema],["yaml-1.1",JJ.schema]]),WJ={binary:VJ.binary,bool:XO.boolTag,float:b7.float,floatExp:b7.floatExp,floatNaN:b7.floatNaN,floatTime:Q5.floatTime,int:v7.int,intHex:v7.intHex,intOct:v7.intOct,intTime:Q5.intTime,map:UJ.map,merge:v1.merge,null:zO.nullTag,omap:HJ.omap,pairs:KJ.pairs,seq:GJ.seq,set:qJ.set,timestamp:Q5.timestamp},WO={"tag:yaml.org,2002:binary":VJ.binary,"tag:yaml.org,2002:merge":v1.merge,"tag:yaml.org,2002:omap":HJ.omap,"tag:yaml.org,2002:pairs":KJ.pairs,"tag:yaml.org,2002:set":qJ.set,"tag:yaml.org,2002:timestamp":Q5.timestamp};function UO($,Z,z){let Q=YJ.get(Z);if(Q&&!$)return z&&!Q.includes(v1.merge)?Q.concat(v1.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(YJ.keys()).filter((Y)=>Y!=="yaml11").map((Y)=>JSON.stringify(Y)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${J} or define customTags array`)}if(Array.isArray($))for(let J of $)X=X.concat(J);else if(typeof $==="function")X=$(X.slice());if(z)X=X.concat(v1.merge);return X.reduce((J,Y)=>{let W=typeof Y==="string"?WJ[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(WJ).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${G}`)}if(!J.includes(W))J.push(W);return J},[])}GO.coreKnownTags=WO;GO.getTags=UO});var f7=F((LO)=>{var g7=t(),KO=D$(),qO=I$(),BO=x1(),X5=BJ(),MO=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class h7{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?X5.getTags($,"compat"):$?X5.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?X5.coreKnownTags:{},this.tags=X5.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,g7.MAP,{value:KO.map}),Object.defineProperty(this,g7.SCALAR,{value:BO.string}),Object.defineProperty(this,g7.SEQ,{value:qO.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?MO:null}clone(){let $=Object.create(h7.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}LO.Schema=h7});var MJ=F((IO)=>{var OO=t(),u7=E1(),g1=F1();function DO($,Z){let z=[],Q=Z.directives===!0;if(Z.directives!==!1&&$.directives){let U=$.directives.toString($);if(U)z.push(U),Q=!0;else if($.directives.docStart)Q=!0}if(Q)z.push("---");let X=u7.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let U=J($.commentBefore);z.unshift(g1.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(OO.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(g1.indentComment(V,""))}X.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=u7.stringify($.contents,X,()=>W=null,U);if(W)G+=g1.lineComment(G,"",J(W));if((G[0]==="|"||G[0]===">")&&z[z.length-1]==="---")z[z.length-1]=`--- ${G}`;else z.push(G)}else z.push(u7.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let U=J($.comment);if(U.includes(`
81
+ `))z.push("..."),z.push(g1.indentComment(U,""));else z.push(`... ${U}`)}else z.push("...");else{let U=$.comment;if(U&&Y)U=U.replace(/^\n+/,"");if(U){if((!Y||W)&&z[z.length-1]!=="")z.push("");z.push(g1.indentComment(J(U),""))}}return z.join(`
82
82
  `)+`
83
- `}UD.stringifyDocument=WD});var b1=P((ND)=>{var VD=T1(),D$=j8(),z2=t(),HD=Q6(),KD=$6(),qD=b7(),BD=YJ(),g7=F8(),MD=z7(),LD=A1(),h7=Z7();class f7{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,z2.NODE_TYPE,{value:z2.DOC});let Q=null;if(typeof Z==="function"||Array.isArray(Z))Q=Z;else if(z===void 0&&Z)z=Z,Z=void 0;let X=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},z);this.options=X;let{version:J}=X;if(z?._directives){if(this.directives=z._directives.atDocument(),this.directives.yaml.explicit)J=this.directives.yaml.version}else this.directives=new h7.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(f7.prototype,{[z2.NODE_TYPE]:{value:z2.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=z2.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(O$(this.contents))this.contents.add($)}addIn($,Z){if(O$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=g7.anchorNames(this);$.anchor=!Z||z.has(Z)?g7.findNewAnchor(Z||"a",z):Z}return new VD.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let B=(I)=>typeof I==="number"||I instanceof String||I instanceof Number,N=Z.filter(B).map(String);if(N.length>0)Z=Z.concat(N);Q=Z}else if(z===void 0&&Z)z=Z,Z=void 0;let{aliasDuplicateObjects:X,anchorPrefix:J,flow:Y,keepUndefined:W,onTagObj:U,tag:G}=z??{},{onAnchor:V,setAnchors:H,sourceObjects:K}=g7.createNodeAnchors(this,J||"a"),q={aliasDuplicateObjects:X??!0,keepUndefined:W??!1,onAnchor:V,onTagObj:U,replacer:Q,schema:this.schema,sourceObjects:K},L=LD.createNode($,G,q);if(Y&&z2.isCollection(L))L.flow=!0;return H(),L}createPair($,Z,z={}){let Q=this.createNode($,null,z),X=this.createNode(Z,null,z);return new HD.Pair(Q,X)}delete($){return O$(this.contents)?this.contents.delete($):!1}deleteIn($){if(D$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return O$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return z2.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(D$.isEmptyPath($))return!Z&&z2.isScalar(this.contents)?this.contents.value:this.contents;return z2.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return z2.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(D$.isEmptyPath($))return this.contents!==void 0;return z2.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=D$.collectionFromPath(this.schema,[$],Z);else if(O$(this.contents))this.contents.set($,Z)}setIn($,Z){if(D$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=D$.collectionFromPath(this.schema,Array.from($),Z);else if(O$(this.contents))this.contents.setIn($,Z)}setSchema($,Z={}){if(typeof $==="number")$=String($);let z;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new h7.Directives({version:"1.1"});z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new h7.Directives({version:$});z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;z=null;break;default:{let Q=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${Q}`)}}if(Z.schema instanceof Object)this.schema=Z.schema;else if(z)this.schema=new qD.Schema(Object.assign(z,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:z,maxAliasCount:Q,onAnchor:X,reviver:J}={}){let Y={anchors:new Map,doc:this,keep:!$,mapAsMap:z===!0,mapKeyWarned:!1,maxAliasCount:typeof Q==="number"?Q:100},W=KD.toJS(this.contents,Z??"",Y);if(typeof X==="function")for(let{count:U,res:G}of Y.anchors.values())X(G,U);return typeof J==="function"?MD.applyReviver(J,{"":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 BD.stringifyDocument(this,$)}}function O$($){if(z2.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}ND.Document=f7});var v1=P((ID)=>{class Q5 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class WJ extends Q5{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class UJ extends Q5{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var OD=($,Z)=>(z)=>{if(z.pos[0]===-1)return;z.linePos=z.pos.map((W)=>Z.linePos(W));let{line:Q,col:X}=z.linePos[0];z.message+=` at line ${Q}, column ${X}`;let J=X-1,Y=$.substring(Z.lineStarts[Q-1],Z.lineStarts[Q]).replace(/[\n\r]+$/,"");if(J>=60&&Y.length>80){let W=Math.min(J-39,Y.length-79);Y="…"+Y.substring(W),J-=W-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(Q>1&&/^ *$/.test(Y.substring(0,J))){let W=$.substring(Z.lineStarts[Q-2],Z.lineStarts[Q-1]);if(W.length>80)W=W.substring(0,79)+`…
83
+ `}IO.stringifyDocument=DO});var h1=F((EO)=>{var AO=_1(),A$=x8(),z2=t(),CO=J6(),_O=z6(),RO=f7(),FO=MJ(),m7=E8(),PO=Y7(),SO=R1(),c7=J7();class p7{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,z2.NODE_TYPE,{value:z2.DOC});let Q=null;if(typeof Z==="function"||Array.isArray(Z))Q=Z;else if(z===void 0&&Z)z=Z,Z=void 0;let X=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},z);this.options=X;let{version:J}=X;if(z?._directives){if(this.directives=z._directives.atDocument(),this.directives.yaml.explicit)J=this.directives.yaml.version}else this.directives=new c7.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(p7.prototype,{[z2.NODE_TYPE]:{value:z2.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=z2.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(C$(this.contents))this.contents.add($)}addIn($,Z){if(C$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=m7.anchorNames(this);$.anchor=!Z||z.has(Z)?m7.findNewAnchor(Z||"a",z):Z}return new AO.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let B=(I)=>typeof I==="number"||I instanceof String||I instanceof Number,N=Z.filter(B).map(String);if(N.length>0)Z=Z.concat(N);Q=Z}else if(z===void 0&&Z)z=Z,Z=void 0;let{aliasDuplicateObjects:X,anchorPrefix:J,flow:Y,keepUndefined:W,onTagObj:U,tag:G}=z??{},{onAnchor:V,setAnchors:H,sourceObjects:K}=m7.createNodeAnchors(this,J||"a"),q={aliasDuplicateObjects:X??!0,keepUndefined:W??!1,onAnchor:V,onTagObj:U,replacer:Q,schema:this.schema,sourceObjects:K},L=SO.createNode($,G,q);if(Y&&z2.isCollection(L))L.flow=!0;return H(),L}createPair($,Z,z={}){let Q=this.createNode($,null,z),X=this.createNode(Z,null,z);return new CO.Pair(Q,X)}delete($){return C$(this.contents)?this.contents.delete($):!1}deleteIn($){if(A$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return C$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return z2.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(A$.isEmptyPath($))return!Z&&z2.isScalar(this.contents)?this.contents.value:this.contents;return z2.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return z2.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(A$.isEmptyPath($))return this.contents!==void 0;return z2.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=A$.collectionFromPath(this.schema,[$],Z);else if(C$(this.contents))this.contents.set($,Z)}setIn($,Z){if(A$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=A$.collectionFromPath(this.schema,Array.from($),Z);else if(C$(this.contents))this.contents.setIn($,Z)}setSchema($,Z={}){if(typeof $==="number")$=String($);let z;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new c7.Directives({version:"1.1"});z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new c7.Directives({version:$});z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;z=null;break;default:{let Q=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${Q}`)}}if(Z.schema instanceof Object)this.schema=Z.schema;else if(z)this.schema=new RO.Schema(Object.assign(z,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:z,maxAliasCount:Q,onAnchor:X,reviver:J}={}){let Y={anchors:new Map,doc:this,keep:!$,mapAsMap:z===!0,mapKeyWarned:!1,maxAliasCount:typeof Q==="number"?Q:100},W=_O.toJS(this.contents,Z??"",Y);if(typeof X==="function")for(let{count:U,res:G}of Y.anchors.values())X(G,U);return typeof J==="function"?PO.applyReviver(J,{"":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 FO.stringifyDocument(this,$)}}function C$($){if(z2.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}EO.Document=p7});var f1=F((xO)=>{class J5 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class LJ extends J5{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class NJ extends J5{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var wO=($,Z)=>(z)=>{if(z.pos[0]===-1)return;z.linePos=z.pos.map((W)=>Z.linePos(W));let{line:Q,col:X}=z.linePos[0];z.message+=` at line ${Q}, column ${X}`;let J=X-1,Y=$.substring(Z.lineStarts[Q-1],Z.lineStarts[Q]).replace(/[\n\r]+$/,"");if(J>=60&&Y.length>80){let W=Math.min(J-39,Y.length-79);Y="…"+Y.substring(W),J-=W-1}if(Y.length>80)Y=Y.substring(0,79)+"…";if(Q>1&&/^ *$/.test(Y.substring(0,J))){let W=$.substring(Z.lineStarts[Q-2],Z.lineStarts[Q-1]);if(W.length>80)W=W.substring(0,79)+`…
84
84
  `;Y=W+Y}if(/[^ ]/.test(Y)){let W=1,U=z.linePos[1];if(U?.line===Q&&U.col>X)W=Math.max(1,Math.min(U.col-X,80-J));let G=" ".repeat(J)+"^".repeat(W);z.message+=`:
85
85
 
86
86
  ${Y}
87
87
  ${G}
88
- `}};ID.YAMLError=Q5;ID.YAMLParseError=WJ;ID.YAMLWarning=UJ;ID.prettifyError=OD});var g1=P((PD)=>{function RD($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,V=W,H="",K="",q=!1,L=!1,B=null,N=null,I=null,_=null,y=null,E=null,w=null;for(let S of $){if(L){if(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma")J(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(G&&S.type!=="comment"&&S.type!=="newline")J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(S.type){case"space":if(!Z&&(z!=="doc-start"||Q?.type!=="flow-collection")&&S.source.includes("\t"))B=S;V=!0;break;case"comment":{if(!V)J(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=S.source.substring(1)||" ";if(!H)H=d;else H+=K+d;K="",G=!1;break}case"newline":if(G){if(H)H+=S.source;else if(!E||z!=="seq-item-ind")U=!0}else K+=S.source;if(G=!0,q=!0,N||I)_=S;V=!0;break;case"anchor":if(N)J(S,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(S.source.endsWith(":"))J(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);N=S,w??(w=S.offset),G=!1,V=!1,L=!0;break;case"tag":{if(I)J(S,"MULTIPLE_TAGS","A node can have at most one tag");I=S,w??(w=S.offset),G=!1,V=!1,L=!0;break}case z:if(N||I)J(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`);if(E)J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${Z??"collection"}`);E=S,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(y)J(S,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);y=S,G=!1,V=!1;break}default:J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),G=!1,V=!1}}let j=$[$.length-1],u=j?j.offset+j.source.length:X;if(L&&Q&&Q.type!=="space"&&Q.type!=="newline"&&Q.type!=="comma"&&(Q.type!=="scalar"||Q.source!==""))J(Q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(G&&B.indent<=Y||Q?.type==="block-map"||Q?.type==="block-seq"))J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:y,found:E,spaceBefore:U,comment:H,hasNewline:q,anchor:N,tag:I,newlineAfterProp:_,end:u,start:w??u}}PD.resolveProps=RD});var X5=P((SD)=>{function u7($){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 z of Z.start)if(z.type==="newline")return!0;if(Z.sep){for(let z of Z.sep)if(z.type==="newline")return!0}if(u7(Z.key)||u7(Z.value))return!0}return!1;default:return!0}}SD.containsNewline=u7});var m7=P((xD)=>{var jD=X5();function wD($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&jD.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}xD.flowIndentCheck=wD});var c7=P((bD)=>{var GJ=t();function kD($,Z,z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(J,Y)=>J===Y||GJ.isScalar(J)&&GJ.isScalar(Y)&&J.value===Y.value;return Z.some((J)=>X(J.key,z))}bD.mapIncludes=kD});var BJ=P((mD)=>{var VJ=Q6(),gD=J6(),HJ=g1(),hD=X5(),KJ=m7(),fD=c7(),qJ="All mapping items must start at the same column";function uD({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??gD.YAMLMap)(z.schema);if(z.atRoot)z.atRoot=!1;let U=Q.offset,G=null;for(let V of Q.items){let{start:H,key:K,sep:q,value:L}=V,B=HJ.resolveProps(H,{indicator:"explicit-key-ind",next:K??q?.[0],offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0}),N=!B.found;if(N){if(K){if(K.type==="block-seq")X(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in K&&K.indent!==Q.indent)X(U,"BAD_INDENT",qJ)}if(!B.anchor&&!B.tag&&!q){if(G=B.end,B.comment)if(W.comment)W.comment+=`
90
- `+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||hD.containsNewline(K))X(K??H[H.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==Q.indent)X(U,"BAD_INDENT",qJ);z.atKey=!0;let I=B.end,_=K?$(z,K,B,X):Z(z,I,H,null,B,X);if(z.schema.compat)KJ.flowIndentCheck(Q.indent,K,X);if(z.atKey=!1,fD.mapIncludes(z,W.items,_))X(I,"DUPLICATE_KEY","Map keys must be unique");let y=HJ.resolveProps(q??[],{indicator:"map-value-ind",next:L,offset:_.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!K||K.type==="block-scalar"});if(U=y.end,y.found){if(N){if(L?.type==="block-map"&&!y.hasNewline)X(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&B.start<y.found.offset-1024)X(_.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let E=L?$(z,L,y,X):Z(z,U,q,null,y,X);if(z.schema.compat)KJ.flowIndentCheck(Q.indent,L,X);U=E.range[2];let w=new VJ.Pair(_,E);if(z.options.keepSourceTokens)w.srcToken=V;W.items.push(w)}else{if(N)X(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(y.comment)if(_.comment)_.comment+=`
91
- `+y.comment;else _.comment=y.comment;let E=new VJ.Pair(_);if(z.options.keepSourceTokens)E.srcToken=V;W.items.push(E)}}if(G&&G<U)X(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[Q.offset,U,G??U],W}mD.resolveBlockMap=uD});var MJ=P((nD)=>{var pD=Y6(),lD=g1(),dD=m7();function iD({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??pD.YAMLSeq)(z.schema);if(z.atRoot)z.atRoot=!1;if(z.atKey)z.atKey=!1;let U=Q.offset,G=null;for(let{start:V,value:H}of Q.items){let K=lD.resolveProps(V,{indicator:"seq-item-ind",next:H,offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!K.found)if(K.anchor||K.tag||H)if(H?.type==="block-seq")X(K.end,"BAD_INDENT","All sequence items must start at the same column");else X(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=K.end,K.comment)W.comment=K.comment;continue}let q=H?$(z,H,K,X):Z(z,K.end,V,null,K,X);if(z.schema.compat)dD.flowIndentCheck(Q.indent,H,X);U=q.range[2],W.items.push(q)}return W.range=[Q.offset,U,G??U],W}nD.resolveBlockSeq=iD});var I$=P((oD)=>{function sD($,Z,z,Q){let X="";if($){let J=!1,Y="";for(let W of $){let{source:U,type:G}=W;switch(G){case"space":J=!0;break;case"comment":{if(z&&!J)Q(W,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let V=U.substring(1)||" ";if(!X)X=V;else X+=Y+V;Y="";break}case"newline":if(X)Y+=U;J=!0;break;default:Q(W,"UNEXPECTED_TOKEN",`Unexpected ${G} at node end`)}Z+=U.length}}return{comment:X,offset:Z}}oD.resolveEnd=sD});var DJ=P((JO)=>{var tD=t(),eD=Q6(),LJ=J6(),$O=Y6(),ZO=I$(),NJ=g1(),zO=X5(),QO=c7(),p7="Block collections are not allowed within flow collections",l7=($)=>$&&($.type==="block-map"||$.type==="block-seq");function XO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let Y=Q.start.source==="{",W=Y?"flow map":"flow sequence",G=new(J?.nodeClass??(Y?LJ.YAMLMap:$O.YAMLSeq))(z.schema);G.flow=!0;let V=z.atRoot;if(V)z.atRoot=!1;if(z.atKey)z.atKey=!1;let H=Q.offset+Q.start.source.length;for(let N=0;N<Q.items.length;++N){let I=Q.items[N],{start:_,key:y,sep:E,value:w}=I,j=NJ.resolveProps(_,{flow:W,indicator:"explicit-key-ind",next:y??E?.[0],offset:H,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!j.found){if(!j.anchor&&!j.tag&&!E&&!w){if(N===0&&j.comma)X(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(N<Q.items.length-1)X(j.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(j.comment)if(G.comment)G.comment+=`
92
- `+j.comment;else G.comment=j.comment;H=j.end;continue}if(!Y&&z.options.strict&&zO.containsNewline(y))X(y,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(N===0){if(j.comma)X(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!j.comma)X(j.start,"MISSING_CHAR",`Missing , between ${W} items`);if(j.comment){let u="";$:for(let S of _)switch(S.type){case"comma":case"space":break;case"comment":u=S.source.substring(1);break $;default:break $}if(u){let S=G.items[G.items.length-1];if(tD.isPair(S))S=S.value??S.key;if(S.comment)S.comment+=`
93
- `+u;else S.comment=u;j.comment=j.comment.substring(u.length+1)}}}if(!Y&&!E&&!j.found){let u=w?$(z,w,j,X):Z(z,j.end,E,null,j,X);if(G.items.push(u),H=u.range[2],l7(w))X(u.range,"BLOCK_IN_FLOW",p7)}else{z.atKey=!0;let u=j.end,S=y?$(z,y,j,X):Z(z,u,_,null,j,X);if(l7(y))X(S.range,"BLOCK_IN_FLOW",p7);z.atKey=!1;let d=NJ.resolveProps(E??[],{flow:W,indicator:"map-value-ind",next:w,offset:S.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(d.found){if(!Y&&!j.found&&z.options.strict){if(E)for(let Z0 of E){if(Z0===d.found)break;if(Z0.type==="newline"){X(Z0,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(j.start<d.found.offset-1024)X(d.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(w)if("source"in w&&w.source?.[0]===":")X(w,"MISSING_CHAR",`Missing space after : in ${W}`);else X(d.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let T0=w?$(z,w,d,X):d.found?Z(z,d.end,E,null,d,X):null;if(T0){if(l7(w))X(T0.range,"BLOCK_IN_FLOW",p7)}else if(d.comment)if(S.comment)S.comment+=`
94
- `+d.comment;else S.comment=d.comment;let j0=new eD.Pair(S,T0);if(z.options.keepSourceTokens)j0.srcToken=I;if(Y){let Z0=G;if(QO.mapIncludes(z,Z0.items,S))X(u,"DUPLICATE_KEY","Map keys must be unique");Z0.items.push(j0)}else{let Z0=new LJ.YAMLMap(z.schema);Z0.flow=!0,Z0.items.push(j0);let k=(T0??S).range;Z0.range=[S.range[0],k[1],k[2]],G.items.push(Z0)}H=T0?T0.range[2]:d.end}}let K=Y?"}":"]",[q,...L]=Q.end,B=H;if(q?.source===K)B=q.offset+q.source.length;else{let N=W[0].toUpperCase()+W.substring(1),I=V?`${N} must end with a ${K}`:`${N} in block collection must be sufficiently indented and end with a ${K}`;if(X(H,V?"MISSING_CHAR":"BAD_INDENT",I),q&&q.source.length!==1)L.unshift(q)}if(L.length>0){let N=ZO.resolveEnd(L,B,z.options.strict,X);if(N.comment)if(G.comment)G.comment+=`
95
- `+N.comment;else G.comment=N.comment;G.range=[Q.offset,B,N.offset]}else G.range=[Q.offset,B,B];return G}JO.resolveFlowCollection=XO});var OJ=P((MO)=>{var WO=t(),UO=N0(),GO=J6(),VO=Y6(),HO=BJ(),KO=MJ(),qO=DJ();function d7($,Z,z,Q,X,J){let Y=z.type==="block-map"?HO.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?KO.resolveBlockSeq($,Z,z,Q,J):qO.resolveFlowCollection($,Z,z,Q,J),W=Y.constructor;if(X==="!"||X===W.tagName)return Y.tag=W.tagName,Y;if(X)Y.tag=X;return Y}function BO($,Z,z,Q,X){let J=Q.tag,Y=!J?null:Z.directives.tagName(J.source,(K)=>X(J,"TAG_RESOLVE_FAILED",K));if(z.type==="block-seq"){let{anchor:K,newlineAfterProp:q}=Q,L=K&&J?K.offset>J.offset?K:J:K??J;if(L&&(!q||q.offset<L.offset))X(L,"MISSING_CHAR","Missing newline after block sequence props")}let W=z.type==="block-map"?"map":z.type==="block-seq"?"seq":z.start.source==="{"?"map":"seq";if(!J||!Y||Y==="!"||Y===GO.YAMLMap.tagName&&W==="map"||Y===VO.YAMLSeq.tagName&&W==="seq")return d7($,Z,z,X,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)X(J,"BAD_COLLECTION_TYPE",`${K.tag} used for ${W} collection, but expects ${K.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return d7($,Z,z,X,Y)}}let G=d7($,Z,z,X,Y,U),V=U.resolve?.(G,(K)=>X(J,"TAG_RESOLVE_FAILED",K),Z.options)??G,H=WO.isNode(V)?V:new UO.Scalar(V);if(H.range=G.range,H.tag=Y,U?.format)H.format=U.format;return H}MO.composeCollection=BO});var n7=P((IO)=>{var i7=N0();function NO($,Z,z){let Q=Z.offset,X=DO(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?i7.Scalar.BLOCK_FOLDED:i7.Scalar.BLOCK_LITERAL,Y=Z.source?OO(Z.source):[],W=Y.length;for(let B=Y.length-1;B>=0;--B){let N=Y[B][1];if(N===""||N==="\r")W=B;else break}if(W===0){let B=X.chomp==="+"&&Y.length>0?`
88
+ `}};xO.YAMLError=J5;xO.YAMLParseError=LJ;xO.YAMLWarning=NJ;xO.prettifyError=wO});var u1=F((hO)=>{function gO($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,V=W,H="",K="",q=!1,L=!1,B=null,N=null,I=null,_=null,w=null,E=null,x=null;for(let S of $){if(L){if(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma")J(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(G&&S.type!=="comment"&&S.type!=="newline")J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(S.type){case"space":if(!Z&&(z!=="doc-start"||Q?.type!=="flow-collection")&&S.source.includes("\t"))B=S;V=!0;break;case"comment":{if(!V)J(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let i=S.source.substring(1)||" ";if(!H)H=i;else H+=K+i;K="",G=!1;break}case"newline":if(G){if(H)H+=S.source;else if(!E||z!=="seq-item-ind")U=!0}else K+=S.source;if(G=!0,q=!0,N||I)_=S;V=!0;break;case"anchor":if(N)J(S,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(S.source.endsWith(":"))J(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);N=S,x??(x=S.offset),G=!1,V=!1,L=!0;break;case"tag":{if(I)J(S,"MULTIPLE_TAGS","A node can have at most one tag");I=S,x??(x=S.offset),G=!1,V=!1,L=!0;break}case z:if(N||I)J(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`);if(E)J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${Z??"collection"}`);E=S,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(w)J(S,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);w=S,G=!1,V=!1;break}default:J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),G=!1,V=!1}}let j=$[$.length-1],m=j?j.offset+j.source.length:X;if(L&&Q&&Q.type!=="space"&&Q.type!=="newline"&&Q.type!=="comma"&&(Q.type!=="scalar"||Q.source!==""))J(Q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(G&&B.indent<=Y||Q?.type==="block-map"||Q?.type==="block-seq"))J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:w,found:E,spaceBefore:U,comment:H,hasNewline:q,anchor:N,tag:I,newlineAfterProp:_,end:m,start:x??m}}hO.resolveProps=gO});var Y5=F((uO)=>{function l7($){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 z of Z.start)if(z.type==="newline")return!0;if(Z.sep){for(let z of Z.sep)if(z.type==="newline")return!0}if(l7(Z.key)||l7(Z.value))return!0}return!1;default:return!0}}uO.containsNewline=l7});var d7=F((lO)=>{var cO=Y5();function pO($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&cO.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}lO.flowIndentCheck=pO});var i7=F((nO)=>{var OJ=t();function iO($,Z,z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(J,Y)=>J===Y||OJ.isScalar(J)&&OJ.isScalar(Y)&&J.value===Y.value;return Z.some((J)=>X(J.key,z))}nO.mapIncludes=iO});var CJ=F((eO)=>{var DJ=J6(),sO=W6(),IJ=u1(),oO=Y5(),TJ=d7(),aO=i7(),AJ="All mapping items must start at the same column";function tO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??sO.YAMLMap)(z.schema);if(z.atRoot)z.atRoot=!1;let U=Q.offset,G=null;for(let V of Q.items){let{start:H,key:K,sep:q,value:L}=V,B=IJ.resolveProps(H,{indicator:"explicit-key-ind",next:K??q?.[0],offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0}),N=!B.found;if(N){if(K){if(K.type==="block-seq")X(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in K&&K.indent!==Q.indent)X(U,"BAD_INDENT",AJ)}if(!B.anchor&&!B.tag&&!q){if(G=B.end,B.comment)if(W.comment)W.comment+=`
90
+ `+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||oO.containsNewline(K))X(K??H[H.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==Q.indent)X(U,"BAD_INDENT",AJ);z.atKey=!0;let I=B.end,_=K?$(z,K,B,X):Z(z,I,H,null,B,X);if(z.schema.compat)TJ.flowIndentCheck(Q.indent,K,X);if(z.atKey=!1,aO.mapIncludes(z,W.items,_))X(I,"DUPLICATE_KEY","Map keys must be unique");let w=IJ.resolveProps(q??[],{indicator:"map-value-ind",next:L,offset:_.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!K||K.type==="block-scalar"});if(U=w.end,w.found){if(N){if(L?.type==="block-map"&&!w.hasNewline)X(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&B.start<w.found.offset-1024)X(_.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let E=L?$(z,L,w,X):Z(z,U,q,null,w,X);if(z.schema.compat)TJ.flowIndentCheck(Q.indent,L,X);U=E.range[2];let x=new DJ.Pair(_,E);if(z.options.keepSourceTokens)x.srcToken=V;W.items.push(x)}else{if(N)X(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(w.comment)if(_.comment)_.comment+=`
91
+ `+w.comment;else _.comment=w.comment;let E=new DJ.Pair(_);if(z.options.keepSourceTokens)E.srcToken=V;W.items.push(E)}}if(G&&G<U)X(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[Q.offset,U,G??U],W}eO.resolveBlockMap=tO});var _J=F((JD)=>{var ZD=U6(),zD=u1(),QD=d7();function XD({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??ZD.YAMLSeq)(z.schema);if(z.atRoot)z.atRoot=!1;if(z.atKey)z.atKey=!1;let U=Q.offset,G=null;for(let{start:V,value:H}of Q.items){let K=zD.resolveProps(V,{indicator:"seq-item-ind",next:H,offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!K.found)if(K.anchor||K.tag||H)if(H?.type==="block-seq")X(K.end,"BAD_INDENT","All sequence items must start at the same column");else X(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=K.end,K.comment)W.comment=K.comment;continue}let q=H?$(z,H,K,X):Z(z,K.end,V,null,K,X);if(z.schema.compat)QD.flowIndentCheck(Q.indent,H,X);U=q.range[2],W.items.push(q)}return W.range=[Q.offset,U,G??U],W}JD.resolveBlockSeq=XD});var _$=F((UD)=>{function WD($,Z,z,Q){let X="";if($){let J=!1,Y="";for(let W of $){let{source:U,type:G}=W;switch(G){case"space":J=!0;break;case"comment":{if(z&&!J)Q(W,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let V=U.substring(1)||" ";if(!X)X=V;else X+=Y+V;Y="";break}case"newline":if(X)Y+=U;J=!0;break;default:Q(W,"UNEXPECTED_TOKEN",`Unexpected ${G} at node end`)}Z+=U.length}}return{comment:X,offset:Z}}UD.resolveEnd=WD});var PJ=F((ND)=>{var VD=t(),HD=J6(),RJ=W6(),KD=U6(),qD=_$(),FJ=u1(),BD=Y5(),MD=i7(),n7="Block collections are not allowed within flow collections",r7=($)=>$&&($.type==="block-map"||$.type==="block-seq");function LD({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let Y=Q.start.source==="{",W=Y?"flow map":"flow sequence",G=new(J?.nodeClass??(Y?RJ.YAMLMap:KD.YAMLSeq))(z.schema);G.flow=!0;let V=z.atRoot;if(V)z.atRoot=!1;if(z.atKey)z.atKey=!1;let H=Q.offset+Q.start.source.length;for(let N=0;N<Q.items.length;++N){let I=Q.items[N],{start:_,key:w,sep:E,value:x}=I,j=FJ.resolveProps(_,{flow:W,indicator:"explicit-key-ind",next:w??E?.[0],offset:H,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!j.found){if(!j.anchor&&!j.tag&&!E&&!x){if(N===0&&j.comma)X(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(N<Q.items.length-1)X(j.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(j.comment)if(G.comment)G.comment+=`
92
+ `+j.comment;else G.comment=j.comment;H=j.end;continue}if(!Y&&z.options.strict&&BD.containsNewline(w))X(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(N===0){if(j.comma)X(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!j.comma)X(j.start,"MISSING_CHAR",`Missing , between ${W} items`);if(j.comment){let m="";$:for(let S of _)switch(S.type){case"comma":case"space":break;case"comment":m=S.source.substring(1);break $;default:break $}if(m){let S=G.items[G.items.length-1];if(VD.isPair(S))S=S.value??S.key;if(S.comment)S.comment+=`
93
+ `+m;else S.comment=m;j.comment=j.comment.substring(m.length+1)}}}if(!Y&&!E&&!j.found){let m=x?$(z,x,j,X):Z(z,j.end,E,null,j,X);if(G.items.push(m),H=m.range[2],r7(x))X(m.range,"BLOCK_IN_FLOW",n7)}else{z.atKey=!0;let m=j.end,S=w?$(z,w,j,X):Z(z,m,_,null,j,X);if(r7(w))X(S.range,"BLOCK_IN_FLOW",n7);z.atKey=!1;let i=FJ.resolveProps(E??[],{flow:W,indicator:"map-value-ind",next:x,offset:S.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(i.found){if(!Y&&!j.found&&z.options.strict){if(E)for(let Z0 of E){if(Z0===i.found)break;if(Z0.type==="newline"){X(Z0,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(j.start<i.found.offset-1024)X(i.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(x)if("source"in x&&x.source?.[0]===":")X(x,"MISSING_CHAR",`Missing space after : in ${W}`);else X(i.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let T0=x?$(z,x,i,X):i.found?Z(z,i.end,E,null,i,X):null;if(T0){if(r7(x))X(T0.range,"BLOCK_IN_FLOW",n7)}else if(i.comment)if(S.comment)S.comment+=`
94
+ `+i.comment;else S.comment=i.comment;let j0=new HD.Pair(S,T0);if(z.options.keepSourceTokens)j0.srcToken=I;if(Y){let Z0=G;if(MD.mapIncludes(z,Z0.items,S))X(m,"DUPLICATE_KEY","Map keys must be unique");Z0.items.push(j0)}else{let Z0=new RJ.YAMLMap(z.schema);Z0.flow=!0,Z0.items.push(j0);let b=(T0??S).range;Z0.range=[S.range[0],b[1],b[2]],G.items.push(Z0)}H=T0?T0.range[2]:i.end}}let K=Y?"}":"]",[q,...L]=Q.end,B=H;if(q?.source===K)B=q.offset+q.source.length;else{let N=W[0].toUpperCase()+W.substring(1),I=V?`${N} must end with a ${K}`:`${N} in block collection must be sufficiently indented and end with a ${K}`;if(X(H,V?"MISSING_CHAR":"BAD_INDENT",I),q&&q.source.length!==1)L.unshift(q)}if(L.length>0){let N=qD.resolveEnd(L,B,z.options.strict,X);if(N.comment)if(G.comment)G.comment+=`
95
+ `+N.comment;else G.comment=N.comment;G.range=[Q.offset,B,N.offset]}else G.range=[Q.offset,B,B];return G}ND.resolveFlowCollection=LD});var SJ=F((PD)=>{var DD=t(),ID=N0(),TD=W6(),AD=U6(),CD=CJ(),_D=_J(),RD=PJ();function s7($,Z,z,Q,X,J){let Y=z.type==="block-map"?CD.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?_D.resolveBlockSeq($,Z,z,Q,J):RD.resolveFlowCollection($,Z,z,Q,J),W=Y.constructor;if(X==="!"||X===W.tagName)return Y.tag=W.tagName,Y;if(X)Y.tag=X;return Y}function FD($,Z,z,Q,X){let J=Q.tag,Y=!J?null:Z.directives.tagName(J.source,(K)=>X(J,"TAG_RESOLVE_FAILED",K));if(z.type==="block-seq"){let{anchor:K,newlineAfterProp:q}=Q,L=K&&J?K.offset>J.offset?K:J:K??J;if(L&&(!q||q.offset<L.offset))X(L,"MISSING_CHAR","Missing newline after block sequence props")}let W=z.type==="block-map"?"map":z.type==="block-seq"?"seq":z.start.source==="{"?"map":"seq";if(!J||!Y||Y==="!"||Y===TD.YAMLMap.tagName&&W==="map"||Y===AD.YAMLSeq.tagName&&W==="seq")return s7($,Z,z,X,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)X(J,"BAD_COLLECTION_TYPE",`${K.tag} used for ${W} collection, but expects ${K.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return s7($,Z,z,X,Y)}}let G=s7($,Z,z,X,Y,U),V=U.resolve?.(G,(K)=>X(J,"TAG_RESOLVE_FAILED",K),Z.options)??G,H=DD.isNode(V)?V:new ID.Scalar(V);if(H.range=G.range,H.tag=Y,U?.format)H.format=U.format;return H}PD.composeCollection=FD});var a7=F((xD)=>{var o7=N0();function ED($,Z,z){let Q=Z.offset,X=jD(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?o7.Scalar.BLOCK_FOLDED:o7.Scalar.BLOCK_LITERAL,Y=Z.source?wD(Z.source):[],W=Y.length;for(let B=Y.length-1;B>=0;--B){let N=Y[B][1];if(N===""||N==="\r")W=B;else break}if(W===0){let B=X.chomp==="+"&&Y.length>0?`
96
96
  `.repeat(Math.max(1,Y.length-1)):"",N=Q+X.length;if(Z.source)N+=Z.source.length;return{value:B,type:J,comment:X.comment,range:[Q,N,N]}}let U=Z.indent+X.indent,G=Z.offset+X.length,V=0;for(let B=0;B<W;++B){let[N,I]=Y[B];if(I===""||I==="\r"){if(X.indent===0&&N.length>U)U=N.length}else{if(N.length<U)z(G+N.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)U=N.length;if(V=B,U===0&&!$.atRoot)z(G,"BAD_INDENT","Block scalar values in collections must be indented");break}G+=N.length+I.length+1}for(let B=Y.length-1;B>=W;--B)if(Y[B][0].length>U)W=B+1;let H="",K="",q=!1;for(let B=0;B<V;++B)H+=Y[B][0].slice(U)+`
97
- `;for(let B=V;B<W;++B){let[N,I]=Y[B];G+=N.length+I.length+1;let _=I[I.length-1]==="\r";if(_)I=I.slice(0,-1);if(I&&N.length<U){let E=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-I.length-(_?2:1),"BAD_INDENT",E),N=""}if(J===i7.Scalar.BLOCK_LITERAL)H+=K+N.slice(U)+I,K=`
97
+ `;for(let B=V;B<W;++B){let[N,I]=Y[B];G+=N.length+I.length+1;let _=I[I.length-1]==="\r";if(_)I=I.slice(0,-1);if(I&&N.length<U){let E=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-I.length-(_?2:1),"BAD_INDENT",E),N=""}if(J===o7.Scalar.BLOCK_LITERAL)H+=K+N.slice(U)+I,K=`
98
98
  `;else if(N.length>U||I[0]==="\t"){if(K===" ")K=`
99
99
  `;else if(!q&&K===`
100
100
  `)K=`
@@ -107,70 +107,70 @@ ${G}
107
107
  `+Y[B][0].slice(U);if(H[H.length-1]!==`
108
108
  `)H+=`
109
109
  `;break;default:H+=`
110
- `}let L=Q+X.length+Z.source.length;return{value:H,type:J,comment:X.comment,range:[Q,L,L]}}function DO({offset:$,props:Z},z,Q){if(Z[0].type!=="block-scalar-header")return Q(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:X}=Z[0],J=X[0],Y=0,W="",U=-1;for(let K=1;K<X.length;++K){let q=X[K];if(!W&&(q==="-"||q==="+"))W=q;else{let L=Number(q);if(!Y&&L)Y=L;else if(U===-1)U=$+K}}if(U!==-1)Q(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",H=X.length;for(let K=1;K<Z.length;++K){let q=Z[K];switch(q.type){case"space":G=!0;case"newline":H+=q.source.length;break;case"comment":if(z&&!G)Q(q,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=q.source.length,V=q.source.substring(1);break;case"error":Q(q,"UNEXPECTED_TOKEN",q.message),H+=q.source.length;break;default:{let L=`Unexpected token in block scalar header: ${q.type}`;Q(q,"UNEXPECTED_TOKEN",L);let B=q.source;if(B&&typeof B==="string")H+=B.length}}}return{mode:J,indent:Y,chomp:W,comment:V,length:H}}function OO($){let Z=$.split(/\n( *)/),z=Z[0],Q=z.match(/^( *)/),J=[Q?.[1]?[Q[1],z.slice(Q[1].length)]:["",z]];for(let Y=1;Y<Z.length;Y+=2)J.push([Z[Y],Z[Y+1]]);return J}IO.resolveBlockScalar=NO});var s7=P((jO)=>{var r7=N0(),AO=I$();function CO($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,W,U,G=(K,q,L)=>z(Q+K,q,L);switch(X){case"scalar":W=r7.Scalar.PLAIN,U=_O(J,G);break;case"single-quoted-scalar":W=r7.Scalar.QUOTE_SINGLE,U=RO(J,G);break;case"double-quoted-scalar":W=r7.Scalar.QUOTE_DOUBLE,U=PO(J,G);break;default:return z($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${X}`),{value:"",type:null,comment:"",range:[Q,Q+J.length,Q+J.length]}}let V=Q+J.length,H=AO.resolveEnd(Y,V,Z,z);return{value:U,type:W,comment:H.comment,range:[Q,V,H.offset]}}function _O($,Z){let z="";switch($[0]){case"\t":z="a tab character";break;case",":z="flow indicator character ,";break;case"%":z="directive indicator character %";break;case"|":case">":{z=`block scalar indicator ${$[0]}`;break}case"@":case"`":{z=`reserved character ${$[0]}`;break}}if(z)Z(0,"BAD_SCALAR_START",`Plain value cannot start with ${z}`);return IJ($)}function RO($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return IJ($.slice(1,-1)).replace(/''/g,"'")}function IJ($){let Z,z;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
110
+ `}let L=Q+X.length+Z.source.length;return{value:H,type:J,comment:X.comment,range:[Q,L,L]}}function jD({offset:$,props:Z},z,Q){if(Z[0].type!=="block-scalar-header")return Q(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:X}=Z[0],J=X[0],Y=0,W="",U=-1;for(let K=1;K<X.length;++K){let q=X[K];if(!W&&(q==="-"||q==="+"))W=q;else{let L=Number(q);if(!Y&&L)Y=L;else if(U===-1)U=$+K}}if(U!==-1)Q(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",H=X.length;for(let K=1;K<Z.length;++K){let q=Z[K];switch(q.type){case"space":G=!0;case"newline":H+=q.source.length;break;case"comment":if(z&&!G)Q(q,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=q.source.length,V=q.source.substring(1);break;case"error":Q(q,"UNEXPECTED_TOKEN",q.message),H+=q.source.length;break;default:{let L=`Unexpected token in block scalar header: ${q.type}`;Q(q,"UNEXPECTED_TOKEN",L);let B=q.source;if(B&&typeof B==="string")H+=B.length}}}return{mode:J,indent:Y,chomp:W,comment:V,length:H}}function wD($){let Z=$.split(/\n( *)/),z=Z[0],Q=z.match(/^( *)/),J=[Q?.[1]?[Q[1],z.slice(Q[1].length)]:["",z]];for(let Y=1;Y<Z.length;Y+=2)J.push([Z[Y],Z[Y+1]]);return J}xD.resolveBlockScalar=ED});var e7=F((cD)=>{var t7=N0(),kD=_$();function bD($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,W,U,G=(K,q,L)=>z(Q+K,q,L);switch(X){case"scalar":W=t7.Scalar.PLAIN,U=vD(J,G);break;case"single-quoted-scalar":W=t7.Scalar.QUOTE_SINGLE,U=gD(J,G);break;case"double-quoted-scalar":W=t7.Scalar.QUOTE_DOUBLE,U=hD(J,G);break;default:return z($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${X}`),{value:"",type:null,comment:"",range:[Q,Q+J.length,Q+J.length]}}let V=Q+J.length,H=kD.resolveEnd(Y,V,Z,z);return{value:U,type:W,comment:H.comment,range:[Q,V,H.offset]}}function vD($,Z){let z="";switch($[0]){case"\t":z="a tab character";break;case",":z="flow indicator character ,";break;case"%":z="directive indicator character %";break;case"|":case">":{z=`block scalar indicator ${$[0]}`;break}case"@":case"`":{z=`reserved character ${$[0]}`;break}}if(z)Z(0,"BAD_SCALAR_START",`Plain value cannot start with ${z}`);return EJ($)}function gD($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return EJ($.slice(1,-1)).replace(/''/g,"'")}function EJ($){let Z,z;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
111
111
  `,"sy"),z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
112
112
  `,"sy")}catch{Z=/(.*?)[ \t]*\r?\n/sy,z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let Q=Z.exec($);if(!Q)return $;let X=Q[1],J=" ",Y=Z.lastIndex;z.lastIndex=Y;while(Q=z.exec($)){if(Q[1]==="")if(J===`
113
113
  `)X+=J;else J=`
114
- `;else X+=J+Q[1],J=" ";Y=z.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,Q=W.exec($),X+J+(Q?.[1]??"")}function PO($,Z){let z="";for(let Q=1;Q<$.length-1;++Q){let X=$[Q];if(X==="\r"&&$[Q+1]===`
114
+ `;else X+=J+Q[1],J=" ";Y=z.lastIndex}let W=/[ \t]*(.*)/sy;return W.lastIndex=Y,Q=W.exec($),X+J+(Q?.[1]??"")}function hD($,Z){let z="";for(let Q=1;Q<$.length-1;++Q){let X=$[Q];if(X==="\r"&&$[Q+1]===`
115
115
  `)continue;if(X===`
116
- `){let{fold:J,offset:Y}=FO($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=SO[J];if(Y)z+=Y;else if(J===`
116
+ `){let{fold:J,offset:Y}=fD($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=uD[J];if(Y)z+=Y;else if(J===`
117
117
  `){J=$[Q+1];while(J===" "||J==="\t")J=$[++Q+1]}else if(J==="\r"&&$[Q+1]===`
118
- `){J=$[++Q+1];while(J===" "||J==="\t")J=$[++Q+1]}else if(J==="x"||J==="u"||J==="U"){let W=J==="x"?2:J==="u"?4:8;z+=EO($,Q+1,W,Z),Q+=W}else{let W=$.substr(Q-1,2);Z(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),z+=W}}else if(X===" "||X==="\t"){let J=Q,Y=$[Q+1];while(Y===" "||Y==="\t")Y=$[++Q+1];if(Y!==`
118
+ `){J=$[++Q+1];while(J===" "||J==="\t")J=$[++Q+1]}else if(J==="x"||J==="u"||J==="U"){let W=J==="x"?2:J==="u"?4:8;z+=mD($,Q+1,W,Z),Q+=W}else{let W=$.substr(Q-1,2);Z(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),z+=W}}else if(X===" "||X==="\t"){let J=Q,Y=$[Q+1];while(Y===" "||Y==="\t")Y=$[++Q+1];if(Y!==`
119
119
  `&&!(Y==="\r"&&$[Q+2]===`
120
- `))z+=Q>J?$.slice(J,Q+1):X}else z+=X}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return z}function FO($,Z){let z="",Q=$[Z+1];while(Q===" "||Q==="\t"||Q===`
120
+ `))z+=Q>J?$.slice(J,Q+1):X}else z+=X}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return z}function fD($,Z){let z="",Q=$[Z+1];while(Q===" "||Q==="\t"||Q===`
121
121
  `||Q==="\r"){if(Q==="\r"&&$[Z+2]!==`
122
122
  `)break;if(Q===`
123
123
  `)z+=`
124
- `;Z+=1,Q=$[Z+1]}if(!z)z=" ";return{fold:z,offset:Z}}var SO={"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 EO($,Z,z,Q){let X=$.substr(Z,z),Y=X.length===z&&/^[0-9a-fA-F]+$/.test(X)?parseInt(X,16):NaN;try{return String.fromCodePoint(Y)}catch{let W=$.substr(Z-2,z+2);return Q(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}}jO.resolveFlowScalar=CO});var AJ=P((gO)=>{var y6=t(),TJ=N0(),xO=n7(),yO=s7();function kO($,Z,z,Q){let{value:X,type:J,comment:Y,range:W}=Z.type==="block-scalar"?xO.resolveBlockScalar($,Z,Q):yO.resolveFlowScalar(Z,$.options.strict,Q),U=z?$.directives.tagName(z.source,(H)=>Q(z,"TAG_RESOLVE_FAILED",H)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[y6.SCALAR];else if(U)G=bO($.schema,X,U,z,Q);else if(Z.type==="scalar")G=vO($,X,Z,Q);else G=$.schema[y6.SCALAR];let V;try{let H=G.resolve(X,(K)=>Q(z??Z,"TAG_RESOLVE_FAILED",K),$.options);V=y6.isScalar(H)?H:new TJ.Scalar(H)}catch(H){let K=H instanceof Error?H.message:String(H);Q(z??Z,"TAG_RESOLVE_FAILED",K),V=new TJ.Scalar(X)}if(V.range=W,V.source=X,J)V.type=J;if(U)V.tag=U;if(G.format)V.format=G.format;if(Y)V.comment=Y;return V}function bO($,Z,z,Q,X){if(z==="!")return $[y6.SCALAR];let J=[];for(let W of $.tags)if(!W.collection&&W.tag===z)if(W.default&&W.test)J.push(W);else return W;for(let W of J)if(W.test?.test(Z))return W;let Y=$.knownTags[z];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return X(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${z}`,z!=="tag:yaml.org,2002:str"),$[y6.SCALAR]}function vO({atKey:$,directives:Z,schema:z},Q,X,J){let Y=z.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(Q))||z[y6.SCALAR];if(z.compat){let W=z.compat.find((U)=>U.default&&U.test?.test(Q))??z[y6.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),G=Z.tagString(W.tag),V=`Value may be parsed as either ${U} or ${G}`;J(X,"TAG_RESOLVE_FAILED",V,!0)}}return Y}gO.composeScalar=kO});var CJ=P((uO)=>{function fO($,Z,z){if(Z){z??(z=Z.length);for(let Q=z-1;Q>=0;--Q){let X=Z[Q];switch(X.type){case"space":case"comment":case"newline":$-=X.source.length;continue}X=Z[++Q];while(X?.type==="space")$+=X.source.length,X=Z[++Q];break}}return $}uO.emptyScalarPosition=fO});var PJ=P((sO)=>{var cO=T1(),pO=t(),lO=OJ(),_J=AJ(),dO=I$(),iO=CJ(),nO={composeNode:RJ,composeEmptyNode:o7};function RJ($,Z,z,Q){let X=$.atKey,{spaceBefore:J,comment:Y,anchor:W,tag:U}=z,G,V=!0;switch(Z.type){case"alias":if(G=rO($,Z,Q),W||U)Q(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(G=_J.composeScalar($,Z,U,Q),W)G.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=lO.composeCollection(nO,$,Z,z,Q),W)G.anchor=W.source.substring(1)}catch(H){let K=H instanceof Error?H.message:String(H);Q(Z,"RESOURCE_EXHAUSTION",K)}break;default:{let H=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",H),V=!1}}if(G??(G=o7($,Z.offset,void 0,null,z,Q)),W&&G.anchor==="")Q(W,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!pO.isScalar(G)||typeof G.value!=="string"||G.tag&&G.tag!=="tag:yaml.org,2002:str"))Q(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(J)G.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")G.comment=Y;else G.commentBefore=Y;if($.options.keepSourceTokens&&V)G.srcToken=Z;return G}function o7($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:W,end:U},G){let V={type:"scalar",offset:iO.emptyScalarPosition(Z,z,Q),indent:-1,source:""},H=_J.composeScalar($,V,W,G);if(Y){if(H.anchor=Y.source.substring(1),H.anchor==="")G(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(X)H.spaceBefore=!0;if(J)H.comment=J,H.range[2]=U;return H}function rO({options:$},{offset:Z,source:z,end:Q},X){let J=new cO.Alias(z.substring(1));if(J.source==="")X(Z,"BAD_ALIAS","Alias cannot be an empty string");if(J.source.endsWith(":"))X(Z+z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Y=Z+z.length,W=dO.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,W.offset],W.comment)J.comment=W.comment;return J}sO.composeEmptyNode=o7;sO.composeNode=RJ});var SJ=P((zI)=>{var tO=b1(),FJ=PJ(),eO=I$(),$I=g1();function ZI($,Z,{offset:z,start:Q,value:X,end:J},Y){let W=Object.assign({_directives:Z},$),U=new tO.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},V=$I.resolveProps(Q,{indicator:"doc-start",next:X??J?.[0],offset:z,onError:Y,parentIndent:0,startOnNewline:!0});if(V.found){if(U.directives.docStart=!0,X&&(X.type==="block-map"||X.type==="block-seq")&&!V.hasNewline)Y(V.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=X?FJ.composeNode(G,X,V,Y):FJ.composeEmptyNode(G,V.end,Q,null,V,Y);let H=U.contents.range[2],K=eO.resolveEnd(J,H,!1,Y);if(K.comment)U.comment=K.comment;return U.range=[z,H,K.offset],U}zI.composeDoc=ZI});var a7=P((GI)=>{var XI=n0("process"),JI=Z7(),YI=b1(),h1=v1(),EJ=t(),WI=SJ(),UI=I$();function f1($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:Z,source:z}=$;return[Z,Z+(typeof z==="string"?z.length:1)]}function jJ($){let Z="",z=!1,Q=!1;for(let X=0;X<$.length;++X){let J=$[X];switch(J[0]){case"#":Z+=(Z===""?"":Q?`
124
+ `;Z+=1,Q=$[Z+1]}if(!z)z=" ";return{fold:z,offset:Z}}var uD={"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 mD($,Z,z,Q){let X=$.substr(Z,z),Y=X.length===z&&/^[0-9a-fA-F]+$/.test(X)?parseInt(X,16):NaN;try{return String.fromCodePoint(Y)}catch{let W=$.substr(Z-2,z+2);return Q(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${W}`),W}}cD.resolveFlowScalar=bD});var wJ=F((sD)=>{var b6=t(),jJ=N0(),lD=a7(),dD=e7();function iD($,Z,z,Q){let{value:X,type:J,comment:Y,range:W}=Z.type==="block-scalar"?lD.resolveBlockScalar($,Z,Q):dD.resolveFlowScalar(Z,$.options.strict,Q),U=z?$.directives.tagName(z.source,(H)=>Q(z,"TAG_RESOLVE_FAILED",H)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[b6.SCALAR];else if(U)G=nD($.schema,X,U,z,Q);else if(Z.type==="scalar")G=rD($,X,Z,Q);else G=$.schema[b6.SCALAR];let V;try{let H=G.resolve(X,(K)=>Q(z??Z,"TAG_RESOLVE_FAILED",K),$.options);V=b6.isScalar(H)?H:new jJ.Scalar(H)}catch(H){let K=H instanceof Error?H.message:String(H);Q(z??Z,"TAG_RESOLVE_FAILED",K),V=new jJ.Scalar(X)}if(V.range=W,V.source=X,J)V.type=J;if(U)V.tag=U;if(G.format)V.format=G.format;if(Y)V.comment=Y;return V}function nD($,Z,z,Q,X){if(z==="!")return $[b6.SCALAR];let J=[];for(let W of $.tags)if(!W.collection&&W.tag===z)if(W.default&&W.test)J.push(W);else return W;for(let W of J)if(W.test?.test(Z))return W;let Y=$.knownTags[z];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return X(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${z}`,z!=="tag:yaml.org,2002:str"),$[b6.SCALAR]}function rD({atKey:$,directives:Z,schema:z},Q,X,J){let Y=z.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(Q))||z[b6.SCALAR];if(z.compat){let W=z.compat.find((U)=>U.default&&U.test?.test(Q))??z[b6.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),G=Z.tagString(W.tag),V=`Value may be parsed as either ${U} or ${G}`;J(X,"TAG_RESOLVE_FAILED",V,!0)}}return Y}sD.composeScalar=iD});var xJ=F((tD)=>{function aD($,Z,z){if(Z){z??(z=Z.length);for(let Q=z-1;Q>=0;--Q){let X=Z[Q];switch(X.type){case"space":case"comment":case"newline":$-=X.source.length;continue}X=Z[++Q];while(X?.type==="space")$+=X.source.length,X=Z[++Q];break}}return $}tD.emptyScalarPosition=aD});var bJ=F((WI)=>{var $I=_1(),ZI=t(),zI=SJ(),yJ=wJ(),QI=_$(),XI=xJ(),JI={composeNode:kJ,composeEmptyNode:$3};function kJ($,Z,z,Q){let X=$.atKey,{spaceBefore:J,comment:Y,anchor:W,tag:U}=z,G,V=!0;switch(Z.type){case"alias":if(G=YI($,Z,Q),W||U)Q(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(G=yJ.composeScalar($,Z,U,Q),W)G.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=zI.composeCollection(JI,$,Z,z,Q),W)G.anchor=W.source.substring(1)}catch(H){let K=H instanceof Error?H.message:String(H);Q(Z,"RESOURCE_EXHAUSTION",K)}break;default:{let H=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",H),V=!1}}if(G??(G=$3($,Z.offset,void 0,null,z,Q)),W&&G.anchor==="")Q(W,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!ZI.isScalar(G)||typeof G.value!=="string"||G.tag&&G.tag!=="tag:yaml.org,2002:str"))Q(U??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(J)G.spaceBefore=!0;if(Y)if(Z.type==="scalar"&&Z.source==="")G.comment=Y;else G.commentBefore=Y;if($.options.keepSourceTokens&&V)G.srcToken=Z;return G}function $3($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:W,end:U},G){let V={type:"scalar",offset:XI.emptyScalarPosition(Z,z,Q),indent:-1,source:""},H=yJ.composeScalar($,V,W,G);if(Y){if(H.anchor=Y.source.substring(1),H.anchor==="")G(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(X)H.spaceBefore=!0;if(J)H.comment=J,H.range[2]=U;return H}function YI({options:$},{offset:Z,source:z,end:Q},X){let J=new $I.Alias(z.substring(1));if(J.source==="")X(Z,"BAD_ALIAS","Alias cannot be an empty string");if(J.source.endsWith(":"))X(Z+z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Y=Z+z.length,W=QI.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,W.offset],W.comment)J.comment=W.comment;return J}WI.composeEmptyNode=$3;WI.composeNode=kJ});var gJ=F((BI)=>{var VI=h1(),vJ=bJ(),HI=_$(),KI=u1();function qI($,Z,{offset:z,start:Q,value:X,end:J},Y){let W=Object.assign({_directives:Z},$),U=new VI.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},V=KI.resolveProps(Q,{indicator:"doc-start",next:X??J?.[0],offset:z,onError:Y,parentIndent:0,startOnNewline:!0});if(V.found){if(U.directives.docStart=!0,X&&(X.type==="block-map"||X.type==="block-seq")&&!V.hasNewline)Y(V.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}U.contents=X?vJ.composeNode(G,X,V,Y):vJ.composeEmptyNode(G,V.end,Q,null,V,Y);let H=U.contents.range[2],K=HI.resolveEnd(J,H,!1,Y);if(K.comment)U.comment=K.comment;return U.range=[z,H,K.offset],U}BI.composeDoc=qI});var Z3=F((TI)=>{var LI=n0("process"),NI=J7(),OI=h1(),m1=f1(),hJ=t(),DI=gJ(),II=_$();function c1($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:Z,source:z}=$;return[Z,Z+(typeof z==="string"?z.length:1)]}function fJ($){let Z="",z=!1,Q=!1;for(let X=0;X<$.length;++X){let J=$[X];switch(J[0]){case"#":Z+=(Z===""?"":Q?`
126
126
 
127
127
  `:`
128
- `)+(J.substring(1)||" "),z=!0,Q=!1;break;case"%":if($[X+1]?.[0]!=="#")X+=1;z=!1;break;default:if(!z)Q=!0;z=!1}}return{comment:Z,afterEmptyLine:Q}}class wJ{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=f1(Z);if(X)this.warnings.push(new h1.YAMLWarning(J,z,Q));else this.errors.push(new h1.YAMLParseError(J,z,Q))},this.directives=new JI.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=jJ(this.prelude);if(z){let X=$.contents;if(Z)$.comment=$.comment?`${$.comment}
129
- ${z}`:z;else if(Q||$.directives.docStart||!X)$.commentBefore=z;else if(EJ.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(EJ.isPair(J))J=J.key;let Y=J.commentBefore;J.commentBefore=Y?`${z}
128
+ `)+(J.substring(1)||" "),z=!0,Q=!1;break;case"%":if($[X+1]?.[0]!=="#")X+=1;z=!1;break;default:if(!z)Q=!0;z=!1}}return{comment:Z,afterEmptyLine:Q}}class uJ{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=c1(Z);if(X)this.warnings.push(new m1.YAMLWarning(J,z,Q));else this.errors.push(new m1.YAMLParseError(J,z,Q))},this.directives=new NI.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=fJ(this.prelude);if(z){let X=$.contents;if(Z)$.comment=$.comment?`${$.comment}
129
+ ${z}`:z;else if(Q||$.directives.docStart||!X)$.commentBefore=z;else if(hJ.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(hJ.isPair(J))J=J.key;let Y=J.commentBefore;J.commentBefore=Y?`${z}
130
130
  ${Y}`:z}else{let J=X.commentBefore;X.commentBefore=J?`${z}
131
- ${J}`:z}}if(Z){for(let X=0;X<this.errors.length;++X)$.errors.push(this.errors[X]);for(let X=0;X<this.warnings.length;++X)$.warnings.push(this.warnings[X])}else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:jJ(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,Z=!1,z=-1){for(let Q of $)yield*this.next(Q);yield*this.end(Z,z)}*next($){if(XI.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=f1($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=WI.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,z=new h1.YAMLParseError(f1($),"UNEXPECTED_TOKEN",Z);if(this.atDirectives||!this.doc)this.errors.push(z);else this.doc.errors.push(z);break}case"doc-end":{if(!this.doc){this.errors.push(new h1.YAMLParseError(f1($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=UI.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),Z.comment){let z=this.doc.comment;this.doc.comment=z?`${z}
132
- ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new h1.YAMLParseError(f1($),"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 z=Object.assign({_directives:this.directives},this.options),Q=new YI.Document(void 0,z);if(this.atDirectives)this.onError(Z,"MISSING_CHAR","Missing directives-end indicator line");Q.range=[0,Z,Z],this.decorate(Q,!1),yield Q}}}GI.Composer=wJ});var kJ=P((DI)=>{var HI=n7(),KI=s7(),qI=v1(),xJ=R1();function BI($,Z=!0,z){if($){let Q=(X,J,Y)=>{let W=typeof X==="number"?X:Array.isArray(X)?X[0]:X.offset;if(z)z(W,J,Y);else throw new qI.YAMLParseError([W,W+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return KI.resolveFlowScalar($,Z,Q);case"block-scalar":return HI.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function MI($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,W=xJ.stringifyString({type:Y,value:$},{implicitKey:z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),U=Z.end??[{type:"newline",offset:-1,indent:Q,source:`
131
+ ${J}`:z}}if(Z){for(let X=0;X<this.errors.length;++X)$.errors.push(this.errors[X]);for(let X=0;X<this.warnings.length;++X)$.warnings.push(this.warnings[X])}else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:fJ(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,Z=!1,z=-1){for(let Q of $)yield*this.next(Q);yield*this.end(Z,z)}*next($){if(LI.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=c1($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=DI.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,z=new m1.YAMLParseError(c1($),"UNEXPECTED_TOKEN",Z);if(this.atDirectives||!this.doc)this.errors.push(z);else this.doc.errors.push(z);break}case"doc-end":{if(!this.doc){this.errors.push(new m1.YAMLParseError(c1($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=II.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),Z.comment){let z=this.doc.comment;this.doc.comment=z?`${z}
132
+ ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new m1.YAMLParseError(c1($),"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 z=Object.assign({_directives:this.directives},this.options),Q=new OI.Document(void 0,z);if(this.atDirectives)this.onError(Z,"MISSING_CHAR","Missing directives-end indicator line");Q.range=[0,Z,Z],this.decorate(Q,!1),yield Q}}}TI.Composer=uJ});var pJ=F((jI)=>{var CI=a7(),_I=e7(),RI=f1(),mJ=S1();function FI($,Z=!0,z){if($){let Q=(X,J,Y)=>{let W=typeof X==="number"?X:Array.isArray(X)?X[0]:X.offset;if(z)z(W,J,Y);else throw new RI.YAMLParseError([W,W+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return _I.resolveFlowScalar($,Z,Q);case"block-scalar":return CI.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function PI($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,W=mJ.stringifyString({type:Y,value:$},{implicitKey:z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),U=Z.end??[{type:"newline",offset:-1,indent:Q,source:`
133
133
  `}];switch(W[0]){case"|":case">":{let G=W.indexOf(`
134
134
  `),V=W.substring(0,G),H=W.substring(G+1)+`
135
- `,K=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!yJ(K,U))K.push({type:"newline",offset:-1,indent:Q,source:`
136
- `});return{type:"block-scalar",offset:J,indent:Q,props:K,source:H}}case'"':return{type:"double-quoted-scalar",offset:J,indent:Q,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:J,indent:Q,source:W,end:U};default:return{type:"scalar",offset:J,indent:Q,source:W,end:U}}}function LI($,Z,z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:J=!1,type:Y}=z,W="indent"in $?$.indent:null;if(Q&&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 G=$.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=G.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=xJ.stringifyString({type:Y,value:Z},{implicitKey:X||W===null,indent:W!==null&&W>0?" ".repeat(W):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":NI($,U);break;case'"':t7($,U,"double-quoted-scalar");break;case"'":t7($,U,"single-quoted-scalar");break;default:t7($,U,"scalar")}}function NI($,Z){let z=Z.indexOf(`
135
+ `,K=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!cJ(K,U))K.push({type:"newline",offset:-1,indent:Q,source:`
136
+ `});return{type:"block-scalar",offset:J,indent:Q,props:K,source:H}}case'"':return{type:"double-quoted-scalar",offset:J,indent:Q,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:J,indent:Q,source:W,end:U};default:return{type:"scalar",offset:J,indent:Q,source:W,end:U}}}function SI($,Z,z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:J=!1,type:Y}=z,W="indent"in $?$.indent:null;if(Q&&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 G=$.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");Y=G.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Y="PLAIN"}let U=mJ.stringifyString({type:Y,value:Z},{implicitKey:X||W===null,indent:W!==null&&W>0?" ".repeat(W):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}});switch(U[0]){case"|":case">":EI($,U);break;case'"':z3($,U,"double-quoted-scalar");break;case"'":z3($,U,"single-quoted-scalar");break;default:z3($,U,"scalar")}}function EI($,Z){let z=Z.indexOf(`
137
137
  `),Q=Z.substring(0,z),X=Z.substring(z+1)+`
138
- `;if($.type==="block-scalar"){let J=$.props[0];if(J.type!=="block-scalar-header")throw Error("Invalid block scalar header");J.source=Q,$.source=X}else{let{offset:J}=$,Y="indent"in $?$.indent:-1,W=[{type:"block-scalar-header",offset:J,indent:Y,source:Q}];if(!yJ(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:X})}}function yJ($,Z){if(Z)for(let z of Z)switch(z.type){case"space":case"comment":$.push(z);break;case"newline":return $.push(z),!0}return!1}function t7($,Z,z){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=z,$.source=Z;break;case"block-scalar":{let Q=$.props.slice(1),X=Z.length;if($.props[0].type==="block-scalar-header")X-=$.props[0].source.length;for(let J of Q)J.offset+=X;delete $.props,Object.assign($,{type:z,source:Z,end:Q});break}case"block-map":case"block-seq":{let X={type:"newline",offset:$.offset+Z.length,indent:$.indent,source:`
140
- `};delete $.items,Object.assign($,{type:z,source:Z,end:[X]});break}default:{let Q="indent"in $?$.indent:-1,X="end"in $&&Array.isArray($.end)?$.end.filter((J)=>J.type==="space"||J.type==="comment"||J.type==="newline"):[];for(let J of Object.keys($))if(J!=="type"&&J!=="offset")delete $[J];Object.assign($,{type:z,indent:Q,source:Z,end:X})}}}DI.createScalarToken=MI;DI.resolveAsScalar=BI;DI.setScalarValue=LI});var bJ=P((CI)=>{var AI=($)=>("type"in $)?Y5($):J5($);function Y5($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=Y5(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=J5(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=J5(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=J5($);if($.end)for(let z of $.end)Z+=z.source;return Z}default:{let Z=$.source;if("end"in $&&$.end)for(let z of $.end)Z+=z.source;return Z}}}function J5({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=Y5(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=Y5(Q);return X}CI.stringify=AI});var hJ=P((PI)=>{var e7=Symbol("break visit"),RI=Symbol("skip children"),vJ=Symbol("remove item");function k6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};gJ(Object.freeze([]),$,Z)}k6.BREAK=e7;k6.SKIP=RI;k6.REMOVE=vJ;k6.itemAtPath=($,Z)=>{let z=$;for(let[Q,X]of Z){let J=z?.[Q];if(J&&"items"in J)z=J.items[X];else return}return z};k6.parentCollection=($,Z)=>{let z=k6.itemAtPath($,Z.slice(0,-1)),Q=Z[Z.length-1][0],X=z?.[Q];if(X&&"items"in X)return X;throw Error("Parent collection not found")};function gJ($,Z,z){let Q=z(Z,$);if(typeof Q==="symbol")return Q;for(let X of["key","value"]){let J=Z[X];if(J&&"items"in J){for(let Y=0;Y<J.items.length;++Y){let W=gJ(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof W==="number")Y=W-1;else if(W===e7)return e7;else if(W===vJ)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}PI.visit=k6});var W5=P((kI)=>{var $3=kJ(),SI=bJ(),EI=hJ(),Z3="\uFEFF",z3="\x02",Q3="\x18",X3="\x1F",jI=($)=>!!$&&("items"in $),wI=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function xI($){switch($){case Z3:return"<BOM>";case z3:return"<DOC>";case Q3:return"<FLOW_END>";case X3:return"<SCALAR>";default:return JSON.stringify($)}}function yI($){switch($){case Z3:return"byte-order-mark";case z3:return"doc-mode";case Q3:return"flow-error-end";case X3:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
138
+ `;if($.type==="block-scalar"){let J=$.props[0];if(J.type!=="block-scalar-header")throw Error("Invalid block scalar header");J.source=Q,$.source=X}else{let{offset:J}=$,Y="indent"in $?$.indent:-1,W=[{type:"block-scalar-header",offset:J,indent:Y,source:Q}];if(!cJ(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:X})}}function cJ($,Z){if(Z)for(let z of Z)switch(z.type){case"space":case"comment":$.push(z);break;case"newline":return $.push(z),!0}return!1}function z3($,Z,z){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=z,$.source=Z;break;case"block-scalar":{let Q=$.props.slice(1),X=Z.length;if($.props[0].type==="block-scalar-header")X-=$.props[0].source.length;for(let J of Q)J.offset+=X;delete $.props,Object.assign($,{type:z,source:Z,end:Q});break}case"block-map":case"block-seq":{let X={type:"newline",offset:$.offset+Z.length,indent:$.indent,source:`
140
+ `};delete $.items,Object.assign($,{type:z,source:Z,end:[X]});break}default:{let Q="indent"in $?$.indent:-1,X="end"in $&&Array.isArray($.end)?$.end.filter((J)=>J.type==="space"||J.type==="comment"||J.type==="newline"):[];for(let J of Object.keys($))if(J!=="type"&&J!=="offset")delete $[J];Object.assign($,{type:z,indent:Q,source:Z,end:X})}}}jI.createScalarToken=PI;jI.resolveAsScalar=FI;jI.setScalarValue=SI});var lJ=F((bI)=>{var kI=($)=>("type"in $)?U5($):W5($);function U5($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=U5(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=W5(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=W5(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=W5($);if($.end)for(let z of $.end)Z+=z.source;return Z}default:{let Z=$.source;if("end"in $&&$.end)for(let z of $.end)Z+=z.source;return Z}}}function W5({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=U5(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=U5(Q);return X}bI.stringify=kI});var nJ=F((hI)=>{var Q3=Symbol("break visit"),gI=Symbol("skip children"),dJ=Symbol("remove item");function v6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};iJ(Object.freeze([]),$,Z)}v6.BREAK=Q3;v6.SKIP=gI;v6.REMOVE=dJ;v6.itemAtPath=($,Z)=>{let z=$;for(let[Q,X]of Z){let J=z?.[Q];if(J&&"items"in J)z=J.items[X];else return}return z};v6.parentCollection=($,Z)=>{let z=v6.itemAtPath($,Z.slice(0,-1)),Q=Z[Z.length-1][0],X=z?.[Q];if(X&&"items"in X)return X;throw Error("Parent collection not found")};function iJ($,Z,z){let Q=z(Z,$);if(typeof Q==="symbol")return Q;for(let X of["key","value"]){let J=Z[X];if(J&&"items"in J){for(let Y=0;Y<J.items.length;++Y){let W=iJ(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof W==="number")Y=W-1;else if(W===Q3)return Q3;else if(W===dJ)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}hI.visit=v6});var G5=F((iI)=>{var X3=pJ(),uI=lJ(),mI=nJ(),J3="\uFEFF",Y3="\x02",W3="\x18",U3="\x1F",cI=($)=>!!$&&("items"in $),pI=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function lI($){switch($){case J3:return"<BOM>";case Y3:return"<DOC>";case W3:return"<FLOW_END>";case U3:return"<SCALAR>";default:return JSON.stringify($)}}function dI($){switch($){case J3:return"byte-order-mark";case Y3:return"doc-mode";case W3:return"flow-error-end";case U3: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}kI.createScalarToken=$3.createScalarToken;kI.resolveAsScalar=$3.resolveAsScalar;kI.setScalarValue=$3.setScalarValue;kI.stringify=SI.stringify;kI.visit=EI.visit;kI.BOM=Z3;kI.DOCUMENT=z3;kI.FLOW_END=Q3;kI.SCALAR=X3;kI.isCollection=jI;kI.isScalar=wI;kI.prettyToken=xI;kI.tokenType=yI});var Y3=P((oI)=>{var u1=W5();function M2($){switch($){case void 0:case" ":case`
143
- `:case"\r":case"\t":return!0;default:return!1}}var fJ=new Set("0123456789ABCDEFabcdef"),rI=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),U5=new Set(",[]{}"),sI=new Set(` ,[]{}
144
- \r `),J3=($)=>!$||sI.has($);class uJ{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 z=this.next??"stream";while(z&&(Z||this.hasChars(1)))z=yield*this.parseNext(z)}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}iI.createScalarToken=X3.createScalarToken;iI.resolveAsScalar=X3.resolveAsScalar;iI.setScalarValue=X3.setScalarValue;iI.stringify=uI.stringify;iI.visit=mI.visit;iI.BOM=J3;iI.DOCUMENT=Y3;iI.FLOW_END=W3;iI.SCALAR=U3;iI.isCollection=cI;iI.isScalar=pI;iI.prettyToken=lI;iI.tokenType=dI});var V3=F((UT)=>{var p1=G5();function L2($){switch($){case void 0:case" ":case`
143
+ `:case"\r":case"\t":return!0;default:return!1}}var rJ=new Set("0123456789ABCDEFabcdef"),YT=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),V5=new Set(",[]{}"),WT=new Set(` ,[]{}
144
+ \r `),G3=($)=>!$||WT.has($);class sJ{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 z=this.next??"stream";while(z&&(Z||this.hasChars(1)))z=yield*this.parseNext(z)}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 z=0;while(Z===" ")Z=this.buffer[++z+$];if(Z==="\r"){let Q=this.buffer[z+$+1];if(Q===`
147
147
  `||!Q&&!this.atEnd)return $+z+1}return Z===`
148
- `||z>=this.indentNext||!Z&&!this.atEnd?$+z:-1}if(Z==="-"||Z==="."){let z=this.buffer.substr($,3);if((z==="---"||z==="...")&&M2(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]===u1.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let Z=$.length,z=$.indexOf("#");while(z!==-1){let X=$[z-1];if(X===" "||X==="\t"){Z=z-1;break}else z=$.indexOf("#",z+1)}while(!0){let X=$[Z-1];if(X===" "||X==="\t")Z-=1;else break}let Q=(yield*this.pushCount(Z))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-Q),this.pushNewline(),"stream"}if(this.atLineEnd()){let Z=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-Z),yield*this.pushNewline(),"stream"}return yield u1.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==="...")&&M2(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&&!M2(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(($==="-"||$==="?"||$===":")&&M2(Z)){let z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=z,"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(J3),"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,z=-1;do{if($=yield*this.pushNewline(),$>0)Z=yield*this.pushSpaces(!1),this.indentValue=z=Z;else Z=0;Z+=yield*this.pushSpaces(!0)}while($+Z>0);let Q=this.getLine();if(Q===null)return this.setNext("flow");if(z!==-1&&z<this.indentNext&&Q[0]!=="#"||z===0&&(Q.startsWith("---")||Q.startsWith("..."))&&M2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield u1.FLOW_END,yield*this.parseLineStart()}let X=0;while(Q[X]===",")X+=yield*this.pushCount(1),X+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(X+=yield*this.pushIndicators(),Q[X]){case void 0:return"flow";case"#":return yield*this.pushCount(Q.length-X),"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(J3),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||M2(J)||J===",")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 X=0;while(this.buffer[Z-1-X]==="\\")X+=1;if(X%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let z=this.buffer.substring(0,Z),Q=z.indexOf(`
148
+ `||z>=this.indentNext||!Z&&!this.atEnd?$+z:-1}if(Z==="-"||Z==="."){let z=this.buffer.substr($,3);if((z==="---"||z==="...")&&L2(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]===p1.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let Z=$.length,z=$.indexOf("#");while(z!==-1){let X=$[z-1];if(X===" "||X==="\t"){Z=z-1;break}else z=$.indexOf("#",z+1)}while(!0){let X=$[Z-1];if(X===" "||X==="\t")Z-=1;else break}let Q=(yield*this.pushCount(Z))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-Q),this.pushNewline(),"stream"}if(this.atLineEnd()){let Z=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-Z),yield*this.pushNewline(),"stream"}return yield p1.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==="...")&&L2(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&&!L2(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(($==="-"||$==="?"||$===":")&&L2(Z)){let z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=z,"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(G3),"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,z=-1;do{if($=yield*this.pushNewline(),$>0)Z=yield*this.pushSpaces(!1),this.indentValue=z=Z;else Z=0;Z+=yield*this.pushSpaces(!0)}while($+Z>0);let Q=this.getLine();if(Q===null)return this.setNext("flow");if(z!==-1&&z<this.indentNext&&Q[0]!=="#"||z===0&&(Q.startsWith("---")||Q.startsWith("..."))&&L2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield p1.FLOW_END,yield*this.parseLineStart()}let X=0;while(Q[X]===",")X+=yield*this.pushCount(1),X+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(X+=yield*this.pushIndicators(),Q[X]){case void 0:return"flow";case"#":return yield*this.pushCount(Q.length-X),"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(G3),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||L2(J)||J===",")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 X=0;while(this.buffer[Z-1-X]==="\\")X+=1;if(X%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let z=this.buffer.substring(0,Z),Q=z.indexOf(`
150
150
  `,this.pos);if(Q!==-1){while(Q!==-1){let X=this.continueScalar(Q+1);if(X===-1)break;Q=z.indexOf(`
151
- `,X)}if(Q!==-1)Z=Q-(z[Q-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)=>M2(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,z;$:for(let X=this.pos;z=this.buffer[X];++X)switch(z){case" ":Z+=1;break;case`
151
+ `,X)}if(Q!==-1)Z=Q-(z[Q-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)=>L2(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,z;$:for(let X=this.pos;z=this.buffer[X];++X)switch(z){case" ":Z+=1;break;case`
152
152
  `:$=X,Z=0;break;case"\r":{let J=this.buffer[X+1];if(!J&&!this.atEnd)return this.setNext("block-scalar");if(J===`
153
153
  `)break}default:break $}if(!z&&!this.atEnd)return this.setNext("block-scalar");if(Z>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=Z;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let X=this.continueScalar($+1);if(X===-1)break;$=this.buffer.indexOf(`
154
154
  `,X)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let Q=$+1;z=this.buffer[Q];while(z===" ")z=this.buffer[++Q];if(z==="\t"){while(z==="\t"||z===" "||z==="\r"||z===`
155
155
  `)z=this.buffer[++Q];$=Q-1}else if(!this.blockScalarKeep)do{let X=$-1,J=this.buffer[X];if(J==="\r")J=this.buffer[--X];let Y=X;while(J===" ")J=this.buffer[--X];if(J===`
156
- `&&X>=this.pos&&X+1+Z>Y)$=X;else break}while(!0);return yield u1.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,Z=this.pos-1,z=this.pos-1,Q;while(Q=this.buffer[++z])if(Q===":"){let X=this.buffer[z+1];if(M2(X)||$&&U5.has(X))break;Z=z}else if(M2(Q)){let X=this.buffer[z+1];if(Q==="\r")if(X===`
156
+ `&&X>=this.pos&&X+1+Z>Y)$=X;else break}while(!0);return yield p1.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,Z=this.pos-1,z=this.pos-1,Q;while(Q=this.buffer[++z])if(Q===":"){let X=this.buffer[z+1];if(L2(X)||$&&V5.has(X))break;Z=z}else if(L2(Q)){let X=this.buffer[z+1];if(Q==="\r")if(X===`
157
157
  `)z+=1,Q=`
158
- `,X=this.buffer[z+1];else Z=z;if(X==="#"||$&&U5.has(X))break;if(Q===`
159
- `){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&U5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield u1.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 z=this.buffer.slice(this.pos,$);if(z)return yield z,this.pos+=z.length,z.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(J3),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(M2(z)||Z&&U5.has(z)){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(!M2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(rI.has(Z))Z=this.buffer[++$];else if(Z==="%"&&fJ.has(this.buffer[$+1])&&fJ.has(this.buffer[$+2]))Z=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
158
+ `,X=this.buffer[z+1];else Z=z;if(X==="#"||$&&V5.has(X))break;if(Q===`
159
+ `){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&V5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield p1.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 z=this.buffer.slice(this.pos,$);if(z)return yield z,this.pos+=z.length,z.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(G3),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(L2(z)||Z&&V5.has(z)){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(!L2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(YT.has(Z))Z=this.buffer[++$];else if(Z==="%"&&rJ.has(this.buffer[$+1])&&rJ.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,z;do z=this.buffer[++Z];while(z===" "||$&&z==="\t");let Q=Z-this.pos;if(Q>0)yield this.buffer.substr(this.pos,Q),this.pos=Z;return Q}*pushUntil($){let Z=this.pos,z=this.buffer[Z];while(!$(z))z=this.buffer[++Z];return yield*this.pushToIndex(Z,!1)}}oI.Lexer=uJ});var W3=P((tI)=>{class mJ{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let Z=0,z=this.lineStarts.length;while(Z<z){let X=Z+z>>1;if(this.lineStarts[X]<$)Z=X+1;else z=X}if(this.lineStarts[Z]===$)return{line:Z+1,col:1};if(Z===0)return{line:0,col:$};let Q=this.lineStarts[Z-1];return{line:Z,col:$-Q+1}}}}tI.LineCounter=mJ});var U3=P((zT)=>{var $T=n0("process"),cJ=W5(),ZT=Y3();function W6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function pJ($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function dJ($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function G5($){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 T$($){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 V5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function lJ($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!W6(Z.start,"explicit-key-ind")&&!W6(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,dJ(Z.value))if(Z.value.end)V5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else V5(Z.start,Z.sep);delete Z.sep}}}class iJ{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 ZT.Lexer,this.onNewLine=$}*parse($,Z=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let z of this.lexer.lex($,Z))yield*this.next(z);if(!Z)yield*this.end()}*next($){if(this.source=$,$T.env.LOG_TOKENS)console.log("|",cJ.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=cJ.tokenType($);if(!Z){let z=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:z,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 z=this.peek(1);if(Z.type==="block-scalar")Z.indent="indent"in z?z.indent:0;else if(Z.type==="flow-collection"&&z.type==="document")Z.indent=0;if(Z.type==="flow-collection")lJ(Z);switch(z.type){case"document":z.value=Z;break;case"block-scalar":z.props.push(Z);break;case"block-map":{let Q=z.items[z.items.length-1];if(Q.value){z.items.push({start:[],key:Z,sep:[]}),this.onKeyLine=!0;return}else if(Q.sep)Q.value=Z;else{Object.assign(Q,{key:Z,sep:[]}),this.onKeyLine=!Q.explicitKey;return}break}case"block-seq":{let Q=z.items[z.items.length-1];if(Q.value)z.items.push({start:[],value:Z});else Q.value=Z;break}case"flow-collection":{let Q=z.items[z.items.length-1];if(!Q||Q.value)z.items.push({start:[],key:Z,sep:[]});else if(Q.sep)Q.value=Z;else Object.assign(Q,{key:Z,sep:[]});return}default:yield*this.pop(),yield*this.pop(Z)}if((z.type==="document"||z.type==="block-map"||z.type==="block-seq")&&(Z.type==="block-map"||Z.type==="block-seq")){let Q=Z.items[Z.items.length-1];if(Q&&!Q.sep&&!Q.value&&Q.start.length>0&&pJ(Q.start)===-1&&(Z.indent===0||Q.start.every((X)=>X.type!=="comment"||X.indent<Z.indent))){if(z.type==="document")z.end=Q.start;else z.items.push({start:Q.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(pJ($.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=G5(this.peek(2)),z=T$(Z),Q;if($.end)Q=$.end,Q.push(this.sourceToken),delete $.end;else Q=[this.sourceToken];let X={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:z,key:$,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=X}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,z;do z=this.buffer[++Z];while(z===" "||$&&z==="\t");let Q=Z-this.pos;if(Q>0)yield this.buffer.substr(this.pos,Q),this.pos=Z;return Q}*pushUntil($){let Z=this.pos,z=this.buffer[Z];while(!$(z))z=this.buffer[++Z];return yield*this.pushToIndex(Z,!1)}}UT.Lexer=sJ});var H3=F((VT)=>{class oJ{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let Z=0,z=this.lineStarts.length;while(Z<z){let X=Z+z>>1;if(this.lineStarts[X]<$)Z=X+1;else z=X}if(this.lineStarts[Z]===$)return{line:Z+1,col:1};if(Z===0)return{line:0,col:$};let Q=this.lineStarts[Z-1];return{line:Z,col:$-Q+1}}}}VT.LineCounter=oJ});var K3=F((BT)=>{var KT=n0("process"),aJ=G5(),qT=V3();function G6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function tJ($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function $Y($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function H5($){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 R$($){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 K5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function eJ($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!G6(Z.start,"explicit-key-ind")&&!G6(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,$Y(Z.value))if(Z.value.end)K5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else K5(Z.start,Z.sep);delete Z.sep}}}class ZY{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 qT.Lexer,this.onNewLine=$}*parse($,Z=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let z of this.lexer.lex($,Z))yield*this.next(z);if(!Z)yield*this.end()}*next($){if(this.source=$,KT.env.LOG_TOKENS)console.log("|",aJ.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=aJ.tokenType($);if(!Z){let z=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:z,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 z=this.peek(1);if(Z.type==="block-scalar")Z.indent="indent"in z?z.indent:0;else if(Z.type==="flow-collection"&&z.type==="document")Z.indent=0;if(Z.type==="flow-collection")eJ(Z);switch(z.type){case"document":z.value=Z;break;case"block-scalar":z.props.push(Z);break;case"block-map":{let Q=z.items[z.items.length-1];if(Q.value){z.items.push({start:[],key:Z,sep:[]}),this.onKeyLine=!0;return}else if(Q.sep)Q.value=Z;else{Object.assign(Q,{key:Z,sep:[]}),this.onKeyLine=!Q.explicitKey;return}break}case"block-seq":{let Q=z.items[z.items.length-1];if(Q.value)z.items.push({start:[],value:Z});else Q.value=Z;break}case"flow-collection":{let Q=z.items[z.items.length-1];if(!Q||Q.value)z.items.push({start:[],key:Z,sep:[]});else if(Q.sep)Q.value=Z;else Object.assign(Q,{key:Z,sep:[]});return}default:yield*this.pop(),yield*this.pop(Z)}if((z.type==="document"||z.type==="block-map"||z.type==="block-seq")&&(Z.type==="block-map"||Z.type==="block-seq")){let Q=Z.items[Z.items.length-1];if(Q&&!Q.sep&&!Q.value&&Q.start.length>0&&tJ(Q.start)===-1&&(Z.indent===0||Q.start.every((X)=>X.type!=="comment"||X.indent<Z.indent))){if(z.type==="document")z.end=Q.start;else z.items.push({start:Q.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(tJ($.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=H5(this.peek(2)),z=R$(Z),Q;if($.end)Q=$.end,Q.push(this.sourceToken),delete $.end;else Q=[this.sourceToken];let X={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:z,key:$,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=X}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 z="end"in Z.value?Z.value.end:void 0;if((Array.isArray(z)?z[z.length-1]:void 0)?.type==="comment")z?.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 Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){V5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let z=!this.onKeyLine&&this.indent===$.indent,Q=z&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&Z.sep&&!Z.value){let J=[];for(let Y=0;Y<Z.sep.length;++Y){let W=Z.sep[Y];switch(W.type){case"newline":J.push(Y);break;case"space":break;case"comment":if(W.indent>$.indent)J.length=0;break;default:J.length=0}}if(J.length>=2)X=Z.sep.splice(J[1])}switch(this.type){case"anchor":case"tag":if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X}),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(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X,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(W6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=T$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(W6(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]});else if(dJ(Z.key)&&!W6(Z.sep,"newline")){let J=T$(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:J,key:Y,sep:W}]})}else if(X.length>0)Z.sep=Z.sep.concat(X,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||Q)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(W6(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 J=this.flowScalar(this.type);if(Q||Z.value)$.items.push({start:X,key:J,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(J);else Object.assign(Z,{key:J,sep:[]}),this.onKeyLine=!0;return}default:{let J=this.startBlockValue($);if(J){if(J.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!W6(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(z)$.items.push({start:X});this.stack.push(J);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let z="end"in Z.value?Z.value.end:void 0;if((Array.isArray(z)?z[z.length-1]:void 0)?.type==="comment")z?.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 Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){V5(Q,Z.start),Q.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||W6(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let z=this.startBlockValue($);if(z){this.stack.push(z);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let z;do yield*this.pop(),z=this.peek(1);while(z?.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 Q=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:Q,sep:[]});else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let z=this.startBlockValue($);if(z)this.stack.push(z);else yield*this.pop(),yield*this.step()}else{let z=this.peek(2);if(z.type==="block-map"&&(this.type==="map-value-ind"&&z.indent===$.indent||this.type==="newline"&&!z.items[z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&z.type!=="flow-collection"){let Q=G5(z),X=T$(Q);lJ($);let J=$.end.splice(1,$.end.length);J.push(this.sourceToken);let Y={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:J}]};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 z="end"in Z.value?Z.value.end:void 0;if((Array.isArray(z)?z[z.length-1]:void 0)?.type==="comment")z?.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 Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){K5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let z=!this.onKeyLine&&this.indent===$.indent,Q=z&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&Z.sep&&!Z.value){let J=[];for(let Y=0;Y<Z.sep.length;++Y){let W=Z.sep[Y];switch(W.type){case"newline":J.push(Y);break;case"space":break;case"comment":if(W.indent>$.indent)J.length=0;break;default:J.length=0}}if(J.length>=2)X=Z.sep.splice(J[1])}switch(this.type){case"anchor":case"tag":if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X}),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(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X,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(G6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=R$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(G6(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]});else if($Y(Z.key)&&!G6(Z.sep,"newline")){let J=R$(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:J,key:Y,sep:W}]})}else if(X.length>0)Z.sep=Z.sep.concat(X,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||Q)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(G6(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 J=this.flowScalar(this.type);if(Q||Z.value)$.items.push({start:X,key:J,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(J);else Object.assign(Z,{key:J,sep:[]}),this.onKeyLine=!0;return}default:{let J=this.startBlockValue($);if(J){if(J.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!G6(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(z)$.items.push({start:X});this.stack.push(J);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let z="end"in Z.value?Z.value.end:void 0;if((Array.isArray(z)?z[z.length-1]:void 0)?.type==="comment")z?.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 Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){K5(Q,Z.start),Q.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||G6(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let z=this.startBlockValue($);if(z){this.stack.push(z);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let z;do yield*this.pop(),z=this.peek(1);while(z?.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 Q=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:Q,sep:[]});else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let z=this.startBlockValue($);if(z)this.stack.push(z);else yield*this.pop(),yield*this.step()}else{let z=this.peek(2);if(z.type==="block-map"&&(this.type==="map-value-ind"&&z.indent===$.indent||this.type==="newline"&&!z.items[z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&z.type!=="flow-collection"){let Q=H5(z),X=R$(Q);eJ($);let J=$.end.splice(1,$.end.length);J.push(this.sourceToken);let Y={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:J}]};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=G5($),z=T$(Z);return z.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=G5($),z=T$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((z)=>z.type==="newline"||z.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()}}}zT.Parser=iJ});var aJ=P((HT)=>{var nJ=a7(),XT=b1(),m1=v1(),JT=W7(),YT=t(),WT=W3(),rJ=U3();function sJ($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new WT.LineCounter||null,prettyErrors:Z}}function UT($,Z={}){let{lineCounter:z,prettyErrors:Q}=sJ(Z),X=new rJ.Parser(z?.addNewLine),J=new nJ.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let W of Y)W.errors.forEach(m1.prettifyError($,z)),W.warnings.forEach(m1.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function oJ($,Z={}){let{lineCounter:z,prettyErrors:Q}=sJ(Z),X=new rJ.Parser(z?.addNewLine),J=new nJ.Composer(Z),Y=null;for(let W of J.compose(X.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new m1.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(m1.prettifyError($,z)),Y.warnings.forEach(m1.prettifyError($,z));return Y}function GT($,Z,z){let Q=void 0;if(typeof Z==="function")Q=Z;else if(z===void 0&&Z&&typeof Z==="object")z=Z;let X=oJ($,z);if(!X)return null;if(X.warnings.forEach((J)=>JT.warn(X.options.logLevel,J)),X.errors.length>0)if(X.options.logLevel!=="silent")throw X.errors[0];else X.errors=[];return X.toJS(Object.assign({reviver:Q},z))}function VT($,Z,z){let Q=null;if(typeof Z==="function"||Array.isArray(Z))Q=Z;else if(z===void 0&&Z)z=Z;if(typeof z==="string")z=z.length;if(typeof z==="number"){let X=Math.round(z);z=X<1?void 0:X>8?{indent:8}:{indent:X}}if($===void 0){let{keepUndefined:X}=z??Z??{};if(!X)return}if(YT.isDocument($)&&!Q)return $.toString(z);return new XT.Document($,Q,z).toString(z)}HT.parse=GT;HT.parseAllDocuments=UT;HT.parseDocument=oJ;HT.stringify=VT});var sY={};RQ(sY,{orange:()=>P0,italic:()=>JC,fafCyanDeep:()=>S5,fafCyan:()=>T,dim:()=>M,bold:()=>C,FAF_HEX:()=>Z4});var w3=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,C,M,JC,Z4,T=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,S5=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,P0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var i=v(()=>{C=w3("1"),M=w3("2"),JC=w3("3"),Z4={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var n9=P((Jp,cj)=>{cj.exports={name:"faf-cli",version:"8.1.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"},"./pack":{types:"./dist/interop/pack.d.ts",default:"./dist/pack.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 && bun build src/interop/pack.ts --outdir dist --target=browser --minify --sourcemap=linked && 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)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","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":"^3.0.0",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:">=22.0.0"},publishConfig:{access:"public"}}});function F($,Z,z,Q,X){if(Q==="m")throw TypeError("Private method is not writable");if(Q==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!X:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return Q==="a"?X.call($,z):X?X.value=z:Z.set($,z),z}function D($,Z,z,Q){if(z==="a"&&!Q)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!Q:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return z==="m"?Q:z==="a"?Q.call($):Q?Q.value:Z.get($)}var r2=()=>{};var t9=function(){let{crypto:$}=globalThis;if($?.randomUUID)return t9=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),z=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(Q)=>(+Q^z()&15>>+Q/4).toString(16))};function s2($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var E4=($)=>{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 x,O0,x0,O6,i$,n$,r$,s$,o$,a$,t$,e$,$1;var d0=v(()=>{x=class x extends Error{};O0=class O0 extends x{constructor($,Z,z,Q,X){super(`${O0.makeMessage($,Z,z)}`);this.status=$,this.headers=Q,this.requestID=Q?.get("request-id"),this.error=Z,this.type=X??null}static makeMessage($,Z,z){let Q=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):z;if($&&Q)return`${$} ${Q}`;if($)return`${$} status code (no body)`;if(Q)return Q;return"(no status code or body)"}static generate($,Z,z,Q){if(!$||!Q)return new O6({message:z,cause:E4(Z)});let X=Z,J=X?.error?.type;if($===400)return new n$($,X,z,Q,J);if($===401)return new r$($,X,z,Q,J);if($===403)return new s$($,X,z,Q,J);if($===404)return new o$($,X,z,Q,J);if($===409)return new a$($,X,z,Q,J);if($===422)return new t$($,X,z,Q,J);if($===429)return new e$($,X,z,Q,J);if($>=500)return new $1($,X,z,Q,J);return new O0($,X,z,Q,J)}};x0=class x0 extends O0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};O6=class O6 extends O0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};i$=class i$ extends O6{constructor({message:$}={}){super({message:$??"Request timed out."})}};n$=class n$ extends O0{};r$=class r$ extends O0{};s$=class s$ extends O0{};o$=class o$ extends O0{};a$=class a$ extends O0{};t$=class t$ extends O0{};e$=class e$ extends O0{};$1=class $1 extends O0{}});function MZ($){if(typeof $!=="object")return{};return $??{}}function Zz($){if(!$)return!0;for(let Z in $)return!1;return!0}function wV($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var Iw,jV=($)=>{return Iw.test($)},e9=($)=>(e9=Array.isArray,e9($)),$z,xV=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new x(`${$} must be an integer`);if(Z<0)throw new x(`${$} must be a positive integer`);return Z},LZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var z$=v(()=>{d0();Iw=/^[a-z][a-z0-9+.-]*:/i,$z=e9});var yV=($)=>new Promise((Z)=>setTimeout(Z,$));var I6="0.91.1";function Tw(){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 Cw(){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:z}of $){let Q=z.exec(navigator.userAgent);if(Q){let X=Q[1]||0,J=Q[2]||0,Y=Q[3]||0;return{browser:Z,version:`${X}.${J}.${Y}`}}}return null}var gV=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},Aw=()=>{let $=Tw();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I6,"X-Stainless-OS":bV(Deno.build.os),"X-Stainless-Arch":kV(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":I6,"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":I6,"X-Stainless-OS":bV(globalThis.process.platform??"unknown"),"X-Stainless-Arch":kV(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=Cw();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I6,"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":I6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},kV=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},bV=($)=>{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"},vV,hV=()=>{return vV??(vV=Aw())};var zz=()=>{};function fV(){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 Qz(...$){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 NZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return Qz({start(){},async pull(z){let{done:Q,value:X}=await Z.next();if(Q)z.close();else z.enqueue(X)},async cancel(){await Z.return?.()}})}function j4($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let z=await Z.read();if(z?.done)Z.releaseLock();return z}catch(z){throw Z.releaseLock(),z}},async return(){let z=Z.cancel();return Z.releaseLock(),await z,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function uV($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var mV=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function cV($){return Object.entries($).filter(([Z,z])=>typeof z<"u").map(([Z,z])=>{if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(z)}`;if(z===null)return`${encodeURIComponent(Z)}=`;throw new x(`Cannot stringify type ${typeof z}; 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 pV=v(()=>{d0()});function iV($){let Z=0;for(let X of $)Z+=X.length;let z=new Uint8Array(Z),Q=0;for(let X of $)z.set(X,Q),Q+=X.length;return z}function w4($){let Z;return(lV??(Z=new globalThis.TextEncoder,lV=Z.encode.bind(Z)))($)}function Xz($){let Z;return(dV??(Z=new globalThis.TextDecoder,dV=Z.decode.bind(Z)))($)}var lV,dV;class T6{constructor(){a0.set(this,void 0),t0.set(this,void 0),F(this,a0,new Uint8Array,"f"),F(this,t0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?w4($):$;F(this,a0,iV([D(this,a0,"f"),Z]),"f");let z=[],Q;while((Q=Pw(D(this,a0,"f"),D(this,t0,"f")))!=null){if(Q.carriage&&D(this,t0,"f")==null){F(this,t0,Q.index,"f");continue}if(D(this,t0,"f")!=null&&(Q.index!==D(this,t0,"f")+1||Q.carriage)){z.push(Xz(D(this,a0,"f").subarray(0,D(this,t0,"f")-1))),F(this,a0,D(this,a0,"f").subarray(D(this,t0,"f")),"f"),F(this,t0,null,"f");continue}let X=D(this,t0,"f")!==null?Q.preceding-1:Q.preceding,J=Xz(D(this,a0,"f").subarray(0,X));z.push(J),F(this,a0,D(this,a0,"f").subarray(Q.index),"f"),F(this,t0,null,"f")}return z}flush(){if(!D(this,a0,"f").length)return[];return this.decode(`
166
- `)}}function Pw($,Z){for(let X=Z??0;X<$.length;X++){if($[X]===10)return{preceding:X,index:X+1,carriage:!1};if($[X]===13)return{preceding:X,index:X+1,carriage:!0}}return null}function nV($){for(let Q=0;Q<$.length-1;Q++){if($[Q]===10&&$[Q+1]===10)return Q+2;if($[Q]===13&&$[Q+1]===13)return Q+2;if($[Q]===13&&$[Q+1]===10&&Q+3<$.length&&$[Q+2]===13&&$[Q+3]===10)return Q+4}return-1}var a0,t0;var Jz=v(()=>{r2();a0=new WeakMap,t0=new WeakMap;T6.NEWLINE_CHARS=new Set([`
167
- `,"\r"]);T6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function x4(){}function DZ($,Z,z){if(!Z||OZ[$]>OZ[z])return x4;else return Z[$].bind(Z)}function E0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return Fw;let Q=rV.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:DZ("error",Z,z),warn:DZ("warn",Z,z),info:DZ("info",Z,z),debug:DZ("debug",Z,z)};return rV.set(Z,[z,X]),X}var OZ,Yz=($,Z,z)=>{if(!$)return;if(wV(OZ,$))return $;E0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(OZ))}`);return},Fw,rV,o2=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,z])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":z]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var IZ=v(()=>{z$();OZ={off:0,error:200,warn:300,info:400,debug:500};Fw={error:x4,warn:x4,info:x4,debug:x4},rV=new WeakMap});async function*Sw($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new x("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 x("Attempted to iterate over a response with no body")}let z=new sV,Q=new T6,X=j4($.body);for await(let J of Ew(X))for(let Y of Q.decode(J)){let W=z.decode(Y);if(W)yield W}for(let J of Q.flush()){let Y=z.decode(J);if(Y)yield Y}}async function*Ew($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?w4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=nV(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class sV{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 X={event:this.event,data:this.data.join(`
168
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],X}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,z,Q]=jw($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function jw($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var y4,e0;var Wz=v(()=>{r2();d0();Jz();z$();IZ();d0();e0=class e0{constructor($,Z,z){this.iterator=$,y4.set(this,void 0),this.controller=Z,F(this,y4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?E0(z):console;async function*J(){if(Q)throw new x("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of Sw($,Z)){if(W.event==="completion")try{yield JSON.parse(W.data)}catch(U){throw X.error("Could not parse message into JSON:",W.data),X.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 X.error("Could not parse message into JSON:",W.data),X.error("From chunk:",W.raw),U}if(W.event==="ping")continue;if(W.event==="error"){let U=LZ(W.data)??W.data,G=U?.error?.type;throw new O0(void 0,U,void 0,$.headers,G)}}Y=!0}catch(W){if(s2(W))return;throw W}finally{if(!Y)Z.abort()}}return new e0(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new T6,W=j4($);for await(let U of W)for(let G of Y.decode(U))yield G;for(let U of Y.flush())yield U}async function*J(){if(Q)throw new x("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of X()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(s2(W))return;throw W}finally{if(!Y)Z.abort()}}return new e0(J,Z,z)}[(y4=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],z=this.iterator(),Q=(X)=>{return{next:()=>{if(X.length===0){let J=z.next();$.push(J),Z.push(J)}return X.shift()}}};return[new e0(()=>Q($),this.controller,D(this,y4,"f")),new e0(()=>Q(Z),this.controller,D(this,y4,"f"))]}toReadableStream(){let $=this,Z;return Qz({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=w4(JSON.stringify(Q)+`
169
- `);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function TZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(E0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return e0.fromSSEResponse(z,Z.controller)}if(z.status===204)return null;if(Z.options.__binaryResponse)return z;let U=z.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(z.headers.get("content-length")==="0")return;let K=await z.json();return Uz(K,z)}return await z.text()})();return E0($).debug(`[${Q}] response parsed`,o2({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function Uz($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var Gz=v(()=>{Wz();IZ()});var k4,A6;var AZ=v(()=>{r2();Gz();A6=class A6 extends Promise{constructor($,Z,z=TZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,k4.set(this,void 0),F(this,k4,$,"f")}_thenUnwrap($){return new A6(D(this,k4,"f"),this.responsePromise,async(Z,z)=>Uz($(await this.parseResponse(Z,z),z),z.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(D(this,k4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};k4=new WeakMap});var CZ,Vz,b4,F2,z0;var H0=v(()=>{r2();d0();Gz();AZ();z$();Vz=class Vz{constructor($,Z,z,Q){CZ.set(this,void 0),F(this,CZ,$,"f"),this.options=Q,this.response=Z,this.body=z}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new x("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await D(this,CZ,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(CZ=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};b4=class b4 extends A6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await TZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};F2=class F2 extends Vz{constructor($,Z,z,Q){super($,Z,z,Q);this.data=z.data||[],this.has_more=z.has_more||!1,this.first_id=z.first_id||null,this.last_id=z.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:{...MZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...MZ(this.options.query),after_id:$}}}};z0=class z0 extends Vz{constructor($,Z,z,Q){super($,Z,z,Q);this.data=z.data||[],this.next_page=z.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...MZ(this.options.query),page:$}}}}});function Q$($,Z,z){return Kz(),new File($,Z??"unknown_file",z)}function v4($,Z){let z=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?z.split(/[\\/]/).pop()||void 0:z}function xw($){let Z=typeof $==="function"?$:$.fetch,z=oV.get(Z);if(z)return z;let Q=(async()=>{try{let X="Response"in Z?Z.Response:(await Z("data:,")).constructor,J=new FormData;if(J.toString()===await new X(J).text())return!1;return!0}catch{return!0}})();return oV.set(Z,Q),Q}var Kz=()=>{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`.":""))}},qz=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",Z1=async($,Z,z=!0)=>{return{...$,body:await yw($.body,Z,z)}},oV,yw=async($,Z,z=!0)=>{if(!await xw(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let Q=new FormData;return await Promise.all(Object.entries($||{}).map(([X,J])=>Hz(Q,X,J,z))),Q},kw=($)=>$ instanceof Blob&&("name"in $),Hz=async($,Z,z,Q)=>{if(z===void 0)return;if(z==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")$.append(Z,String(z));else if(z instanceof Response){let X={},J=z.headers.get("Content-Type");if(J)X={type:J};$.append(Z,Q$([await z.blob()],v4(z,Q),X))}else if(qz(z))$.append(Z,Q$([await new Response(NZ(z)).blob()],v4(z,Q)));else if(kw(z))$.append(Z,Q$([z],v4(z,Q),{type:z.type}));else if(Array.isArray(z))await Promise.all(z.map((X)=>Hz($,Z+"[]",X,Q)));else if(typeof z==="object")await Promise.all(Object.entries(z).map(([X,J])=>Hz($,`${Z}[${X}]`,J,Q)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${z} instead`)};var z1=v(()=>{oV=new WeakMap});async function g4($,Z,z){if(Kz(),$=await $,Z||(Z=v4($,!0)),bw($)){if($ instanceof File&&Z==null&&z==null)return $;return Q$([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(vw($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),Q$(await Bz(X),Z,z)}let Q=await Bz($);if(!z?.type){let X=Q.find((J)=>typeof J==="object"&&("type"in J)&&J.type);if(typeof X==="string")z={...z,type:X}}return Q$(Q,Z,z)}async function Bz($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(aV($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(qz($))for await(let z of $)Z.push(...await Bz(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${gw($)}`)}return Z}function gw($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var aV=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",bw=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&aV($),vw=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var tV=v(()=>{z1();z1()});var Mz=v(()=>{tV()});var eV=()=>{};class c{constructor($){this._client=$}}function*fw($){if(!$)return;if($H in $){let{values:Q,nulls:X}=$;yield*Q.entries();for(let J of X)yield[J,null];return}let Z=!1,z;if($ instanceof Headers)z=$.entries();else if($z($))z=$;else Z=!0,z=Object.entries($??{});for(let Q of z){let X=Q[0];if(typeof X!=="string")throw TypeError("expected header name to be a string");let J=$z(Q[1])?Q[1]:[Q[1]],Y=!1;for(let W of J){if(W===void 0)continue;if(Z&&!Y)Y=!0,yield[X,null];yield[X,W]}}}var $H,O=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of fw(Q)){let W=J.toLowerCase();if(!X.has(W))Z.delete(J),X.add(W);if(Y===null)Z.delete(J),z.add(W);else Z.append(J,Y),z.delete(W)}}return{[$H]:!0,values:Z,nulls:z}};var W0=v(()=>{z$();$H=Symbol.for("brand.privateNullableHeaders")});function zH($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var ZH,uw=($=zH)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,H,K)=>{if(/[?#]/.test(H))X=!0;let q=Q[K],L=(X?encodeURIComponent:$)(""+q);if(K!==Q.length&&(q==null||typeof q==="object"&&q.toString===Object.getPrototypeOf(Object.getPrototypeOf(q.hasOwnProperty??ZH)??ZH)?.toString))L=q+"",J.push({start:V.length+H.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(q).slice(8,-1)} is not a valid path parameter`});return V+H+(K===Q.length?"":L)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=U.exec(W))!==null)J.push({start:G.index,length:G[0].length,error:`Value "${G[0]}" can't be safely passed as a path parameter`});if(J.sort((V,H)=>V.start-H.start),J.length>0){let V=0,H=J.reduce((K,q)=>{let L=" ".repeat(q.start-V),B="^".repeat(q.length);return V=q.start+q.length,K+L+B},"");throw new x(`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=H5($),z=R$(Z);return z.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=H5($),z=R$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((z)=>z.type==="newline"||z.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()}}}BT.Parser=ZY});var YY=F((CT)=>{var zY=Z3(),LT=h1(),l1=f1(),NT=H7(),OT=t(),DT=H3(),QY=K3();function XY($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new DT.LineCounter||null,prettyErrors:Z}}function IT($,Z={}){let{lineCounter:z,prettyErrors:Q}=XY(Z),X=new QY.Parser(z?.addNewLine),J=new zY.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let W of Y)W.errors.forEach(l1.prettifyError($,z)),W.warnings.forEach(l1.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function JY($,Z={}){let{lineCounter:z,prettyErrors:Q}=XY(Z),X=new QY.Parser(z?.addNewLine),J=new zY.Composer(Z),Y=null;for(let W of J.compose(X.parse($),!0,$.length))if(!Y)Y=W;else if(Y.options.logLevel!=="silent"){Y.errors.push(new l1.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(l1.prettifyError($,z)),Y.warnings.forEach(l1.prettifyError($,z));return Y}function TT($,Z,z){let Q=void 0;if(typeof Z==="function")Q=Z;else if(z===void 0&&Z&&typeof Z==="object")z=Z;let X=JY($,z);if(!X)return null;if(X.warnings.forEach((J)=>NT.warn(X.options.logLevel,J)),X.errors.length>0)if(X.options.logLevel!=="silent")throw X.errors[0];else X.errors=[];return X.toJS(Object.assign({reviver:Q},z))}function AT($,Z,z){let Q=null;if(typeof Z==="function"||Array.isArray(Z))Q=Z;else if(z===void 0&&Z)z=Z;if(typeof z==="string")z=z.length;if(typeof z==="number"){let X=Math.round(z);z=X<1?void 0:X>8?{indent:8}:{indent:X}}if($===void 0){let{keepUndefined:X}=z??Z??{};if(!X)return}if(OT.isDocument($)&&!Q)return $.toString(z);return new LT.Document($,Q,z).toString(z)}CT.parse=TT;CT.parseAllDocuments=IT;CT.parseDocument=JY;CT.stringify=AT});var XW={};kQ(XW,{orange:()=>F0,italic:()=>NC,fafCyanDeep:()=>j5,fafCyan:()=>T,dim:()=>M,bold:()=>C,FAF_HEX:()=>X4});var b3=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,C,M,NC,X4,T=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,j5=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,F0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var n=g(()=>{C=b3("1"),M=b3("2"),NC=b3("3"),X4={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var zz=F((xp,Ww)=>{Ww.exports={name:"faf-cli",version:"8.2.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"},"./pack":{types:"./dist/interop/pack.d.ts",default:"./dist/pack.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 && bun build src/interop/pack.ts --outdir dist --target=browser --minify --sourcemap=linked && 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)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","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":"^3.0.0",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:">=22.0.0"},publishConfig:{access:"public"}}});function P($,Z,z,Q,X){if(Q==="m")throw TypeError("Private method is not writable");if(Q==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!X:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return Q==="a"?X.call($,z):X?X.value=z:Z.set($,z),z}function O($,Z,z,Q){if(z==="a"&&!Q)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!Q:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return z==="m"?Q:z==="a"?Q.call($):Q?Q.value:Z.get($)}var o2=()=>{};var Wz=function(){let{crypto:$}=globalThis;if($?.randomUUID)return Wz=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),z=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(Q)=>(+Q^z()&15>>+Q/4).toString(16))};function a2($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var w4=($)=>{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 y,D0,x0,T6,s$,o$,a$,t$,e$,$1,Z1,z1,Q1;var d0=g(()=>{y=class y extends Error{};D0=class D0 extends y{constructor($,Z,z,Q,X){super(`${D0.makeMessage($,Z,z)}`);this.status=$,this.headers=Q,this.requestID=Q?.get("request-id"),this.error=Z,this.type=X??null}static makeMessage($,Z,z){let Q=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):z;if($&&Q)return`${$} ${Q}`;if($)return`${$} status code (no body)`;if(Q)return Q;return"(no status code or body)"}static generate($,Z,z,Q){if(!$||!Q)return new T6({message:z,cause:w4(Z)});let X=Z,J=X?.error?.type;if($===400)return new o$($,X,z,Q,J);if($===401)return new a$($,X,z,Q,J);if($===403)return new t$($,X,z,Q,J);if($===404)return new e$($,X,z,Q,J);if($===409)return new $1($,X,z,Q,J);if($===422)return new Z1($,X,z,Q,J);if($===429)return new z1($,X,z,Q,J);if($>=500)return new Q1($,X,z,Q,J);return new D0($,X,z,Q,J)}};x0=class x0 extends D0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};T6=class T6 extends D0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};s$=class s$ extends T6{constructor({message:$}={}){super({message:$??"Request timed out."})}};o$=class o$ extends D0{};a$=class a$ extends D0{};t$=class t$ extends D0{};e$=class e$ extends D0{};$1=class $1 extends D0{};Z1=class Z1 extends D0{};z1=class z1 extends D0{};Q1=class Q1 extends D0{}});function DZ($){if(typeof $!=="object")return{};return $??{}}function Vz($){if(!$)return!0;for(let Z in $)return!1;return!0}function pV($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var fw,cV=($)=>{return fw.test($)},Uz=($)=>(Uz=Array.isArray,Uz($)),Gz,lV=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new y(`${$} must be an integer`);if(Z<0)throw new y(`${$} must be a positive integer`);return Z},IZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var Y$=g(()=>{d0();fw=/^[a-z][a-z0-9+.-]*:/i,Gz=Uz});var dV=($)=>new Promise((Z)=>setTimeout(Z,$));var A6="0.91.1";function uw(){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 cw(){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:z}of $){let Q=z.exec(navigator.userAgent);if(Q){let X=Q[1]||0,J=Q[2]||0,Y=Q[3]||0;return{browser:Z,version:`${X}.${J}.${Y}`}}}return null}var sV=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},mw=()=>{let $=uw();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":A6,"X-Stainless-OS":nV(Deno.build.os),"X-Stainless-Arch":iV(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":A6,"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":A6,"X-Stainless-OS":nV(globalThis.process.platform??"unknown"),"X-Stainless-Arch":iV(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=cw();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":A6,"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":A6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},iV=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},nV=($)=>{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"},rV,oV=()=>{return rV??(rV=mw())};var Hz=()=>{};function aV(){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 Kz(...$){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 TZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return Kz({start(){},async pull(z){let{done:Q,value:X}=await Z.next();if(Q)z.close();else z.enqueue(X)},async cancel(){await Z.return?.()}})}function x4($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let z=await Z.read();if(z?.done)Z.releaseLock();return z}catch(z){throw Z.releaseLock(),z}},async return(){let z=Z.cancel();return Z.releaseLock(),await z,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function tV($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var eV=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function $H($){return Object.entries($).filter(([Z,z])=>typeof z<"u").map(([Z,z])=>{if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(z)}`;if(z===null)return`${encodeURIComponent(Z)}=`;throw new y(`Cannot stringify type ${typeof z}; 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 ZH=g(()=>{d0()});function XH($){let Z=0;for(let X of $)Z+=X.length;let z=new Uint8Array(Z),Q=0;for(let X of $)z.set(X,Q),Q+=X.length;return z}function y4($){let Z;return(zH??(Z=new globalThis.TextEncoder,zH=Z.encode.bind(Z)))($)}function qz($){let Z;return(QH??(Z=new globalThis.TextDecoder,QH=Z.decode.bind(Z)))($)}var zH,QH;class C6{constructor(){a0.set(this,void 0),t0.set(this,void 0),P(this,a0,new Uint8Array,"f"),P(this,t0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?y4($):$;P(this,a0,XH([O(this,a0,"f"),Z]),"f");let z=[],Q;while((Q=dw(O(this,a0,"f"),O(this,t0,"f")))!=null){if(Q.carriage&&O(this,t0,"f")==null){P(this,t0,Q.index,"f");continue}if(O(this,t0,"f")!=null&&(Q.index!==O(this,t0,"f")+1||Q.carriage)){z.push(qz(O(this,a0,"f").subarray(0,O(this,t0,"f")-1))),P(this,a0,O(this,a0,"f").subarray(O(this,t0,"f")),"f"),P(this,t0,null,"f");continue}let X=O(this,t0,"f")!==null?Q.preceding-1:Q.preceding,J=qz(O(this,a0,"f").subarray(0,X));z.push(J),P(this,a0,O(this,a0,"f").subarray(Q.index),"f"),P(this,t0,null,"f")}return z}flush(){if(!O(this,a0,"f").length)return[];return this.decode(`
166
+ `)}}function dw($,Z){for(let X=Z??0;X<$.length;X++){if($[X]===10)return{preceding:X,index:X+1,carriage:!1};if($[X]===13)return{preceding:X,index:X+1,carriage:!0}}return null}function JH($){for(let Q=0;Q<$.length-1;Q++){if($[Q]===10&&$[Q+1]===10)return Q+2;if($[Q]===13&&$[Q+1]===13)return Q+2;if($[Q]===13&&$[Q+1]===10&&Q+3<$.length&&$[Q+2]===13&&$[Q+3]===10)return Q+4}return-1}var a0,t0;var Bz=g(()=>{o2();a0=new WeakMap,t0=new WeakMap;C6.NEWLINE_CHARS=new Set([`
167
+ `,"\r"]);C6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function k4(){}function AZ($,Z,z){if(!Z||CZ[$]>CZ[z])return k4;else return Z[$].bind(Z)}function E0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return iw;let Q=YH.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:AZ("error",Z,z),warn:AZ("warn",Z,z),info:AZ("info",Z,z),debug:AZ("debug",Z,z)};return YH.set(Z,[z,X]),X}var CZ,Mz=($,Z,z)=>{if(!$)return;if(pV(CZ,$))return $;E0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(CZ))}`);return},iw,YH,t2=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,z])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":z]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var _Z=g(()=>{Y$();CZ={off:0,error:200,warn:300,info:400,debug:500};iw={error:k4,warn:k4,info:k4,debug:k4},YH=new WeakMap});async function*nw($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new y("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 y("Attempted to iterate over a response with no body")}let z=new WH,Q=new C6,X=x4($.body);for await(let J of rw(X))for(let Y of Q.decode(J)){let W=z.decode(Y);if(W)yield W}for(let J of Q.flush()){let Y=z.decode(J);if(Y)yield Y}}async function*rw($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?y4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=JH(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class WH{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 X={event:this.event,data:this.data.join(`
168
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],X}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,z,Q]=sw($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function sw($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var b4,e0;var Lz=g(()=>{o2();d0();Bz();Y$();_Z();d0();e0=class e0{constructor($,Z,z){this.iterator=$,b4.set(this,void 0),this.controller=Z,P(this,b4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?E0(z):console;async function*J(){if(Q)throw new y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of nw($,Z)){if(W.event==="completion")try{yield JSON.parse(W.data)}catch(U){throw X.error("Could not parse message into JSON:",W.data),X.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 X.error("Could not parse message into JSON:",W.data),X.error("From chunk:",W.raw),U}if(W.event==="ping")continue;if(W.event==="error"){let U=IZ(W.data)??W.data,G=U?.error?.type;throw new D0(void 0,U,void 0,$.headers,G)}}Y=!0}catch(W){if(a2(W))return;throw W}finally{if(!Y)Z.abort()}}return new e0(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new C6,W=x4($);for await(let U of W)for(let G of Y.decode(U))yield G;for(let U of Y.flush())yield U}async function*J(){if(Q)throw new y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of X()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(a2(W))return;throw W}finally{if(!Y)Z.abort()}}return new e0(J,Z,z)}[(b4=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],z=this.iterator(),Q=(X)=>{return{next:()=>{if(X.length===0){let J=z.next();$.push(J),Z.push(J)}return X.shift()}}};return[new e0(()=>Q($),this.controller,O(this,b4,"f")),new e0(()=>Q(Z),this.controller,O(this,b4,"f"))]}toReadableStream(){let $=this,Z;return Kz({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=y4(JSON.stringify(Q)+`
169
+ `);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function RZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(E0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return e0.fromSSEResponse(z,Z.controller)}if(z.status===204)return null;if(Z.options.__binaryResponse)return z;let U=z.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(z.headers.get("content-length")==="0")return;let K=await z.json();return Nz(K,z)}return await z.text()})();return E0($).debug(`[${Q}] response parsed`,t2({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function Nz($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var Oz=g(()=>{Lz();_Z()});var v4,_6;var FZ=g(()=>{o2();Oz();_6=class _6 extends Promise{constructor($,Z,z=RZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,v4.set(this,void 0),P(this,v4,$,"f")}_thenUnwrap($){return new _6(O(this,v4,"f"),this.responsePromise,async(Z,z)=>Nz($(await this.parseResponse(Z,z),z),z.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(O(this,v4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};v4=new WeakMap});var PZ,Dz,g4,P2,z0;var H0=g(()=>{o2();d0();Oz();FZ();Y$();Dz=class Dz{constructor($,Z,z,Q){PZ.set(this,void 0),P(this,PZ,$,"f"),this.options=Q,this.response=Z,this.body=z}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new y("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await O(this,PZ,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(PZ=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};g4=class g4 extends _6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await RZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};P2=class P2 extends Dz{constructor($,Z,z,Q){super($,Z,z,Q);this.data=z.data||[],this.has_more=z.has_more||!1,this.first_id=z.first_id||null,this.last_id=z.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:{...DZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...DZ(this.options.query),after_id:$}}}};z0=class z0 extends Dz{constructor($,Z,z,Q){super($,Z,z,Q);this.data=z.data||[],this.next_page=z.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...DZ(this.options.query),page:$}}}}});function W$($,Z,z){return Tz(),new File($,Z??"unknown_file",z)}function h4($,Z){let z=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?z.split(/[\\/]/).pop()||void 0:z}function aw($){let Z=typeof $==="function"?$:$.fetch,z=UH.get(Z);if(z)return z;let Q=(async()=>{try{let X="Response"in Z?Z.Response:(await Z("data:,")).constructor,J=new FormData;if(J.toString()===await new X(J).text())return!1;return!0}catch{return!0}})();return UH.set(Z,Q),Q}var Tz=()=>{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`.":""))}},Az=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",X1=async($,Z,z=!0)=>{return{...$,body:await tw($.body,Z,z)}},UH,tw=async($,Z,z=!0)=>{if(!await aw(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let Q=new FormData;return await Promise.all(Object.entries($||{}).map(([X,J])=>Iz(Q,X,J,z))),Q},ew=($)=>$ instanceof Blob&&("name"in $),Iz=async($,Z,z,Q)=>{if(z===void 0)return;if(z==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")$.append(Z,String(z));else if(z instanceof Response){let X={},J=z.headers.get("Content-Type");if(J)X={type:J};$.append(Z,W$([await z.blob()],h4(z,Q),X))}else if(Az(z))$.append(Z,W$([await new Response(TZ(z)).blob()],h4(z,Q)));else if(ew(z))$.append(Z,W$([z],h4(z,Q),{type:z.type}));else if(Array.isArray(z))await Promise.all(z.map((X)=>Iz($,Z+"[]",X,Q)));else if(typeof z==="object")await Promise.all(Object.entries(z).map(([X,J])=>Iz($,`${Z}[${X}]`,J,Q)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${z} instead`)};var J1=g(()=>{UH=new WeakMap});async function f4($,Z,z){if(Tz(),$=await $,Z||(Z=h4($,!0)),$x($)){if($ instanceof File&&Z==null&&z==null)return $;return W$([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(Zx($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),W$(await Cz(X),Z,z)}let Q=await Cz($);if(!z?.type){let X=Q.find((J)=>typeof J==="object"&&("type"in J)&&J.type);if(typeof X==="string")z={...z,type:X}}return W$(Q,Z,z)}async function Cz($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(GH($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(Az($))for await(let z of $)Z.push(...await Cz(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${zx($)}`)}return Z}function zx($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var GH=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",$x=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&GH($),Zx=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var VH=g(()=>{J1();J1()});var _z=g(()=>{VH()});var HH=()=>{};class p{constructor($){this._client=$}}function*Xx($){if(!$)return;if(KH in $){let{values:Q,nulls:X}=$;yield*Q.entries();for(let J of X)yield[J,null];return}let Z=!1,z;if($ instanceof Headers)z=$.entries();else if(Gz($))z=$;else Z=!0,z=Object.entries($??{});for(let Q of z){let X=Q[0];if(typeof X!=="string")throw TypeError("expected header name to be a string");let J=Gz(Q[1])?Q[1]:[Q[1]],Y=!1;for(let W of J){if(W===void 0)continue;if(Z&&!Y)Y=!0,yield[X,null];yield[X,W]}}}var KH,D=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of Xx(Q)){let W=J.toLowerCase();if(!X.has(W))Z.delete(J),X.add(W);if(Y===null)Z.delete(J),z.add(W);else Z.append(J,Y),z.delete(W)}}return{[KH]:!0,values:Z,nulls:z}};var W0=g(()=>{Y$();KH=Symbol.for("brand.privateNullableHeaders")});function BH($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var qH,Jx=($=BH)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,H,K)=>{if(/[?#]/.test(H))X=!0;let q=Q[K],L=(X?encodeURIComponent:$)(""+q);if(K!==Q.length&&(q==null||typeof q==="object"&&q.toString===Object.getPrototypeOf(Object.getPrototypeOf(q.hasOwnProperty??qH)??qH)?.toString))L=q+"",J.push({start:V.length+H.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(q).slice(8,-1)} is not a valid path parameter`});return V+H+(K===Q.length?"":L)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=U.exec(W))!==null)J.push({start:G.index,length:G[0].length,error:`Value "${G[0]}" can't be safely passed as a path parameter`});if(J.sort((V,H)=>V.start-H.start),J.length>0){let V=0,H=J.reduce((K,q)=>{let L=" ".repeat(q.start-V),B="^".repeat(q.length);return V=q.start+q.length,K+L+B},"");throw new y(`Path parameters result in path with invalid segments:
170
170
  ${J.map((K)=>K.error).join(`
171
171
  `)}
172
172
  ${Y}
173
- ${H}`)}return Y},R;var I0=v(()=>{d0();ZH=Object.freeze(Object.create(null)),R=uw(zH)});var h4;var Lz=v(()=>{H0();W0();I0();h4=class h4 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/environments/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/environments/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/environments?beta=true",z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/environments/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/environments/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function _Z($){return typeof $==="object"&&$!==null&&f4 in $}function Nz($,Z){let z=new Set;if($){for(let Q of $)if(_Z(Q))z.add(Q[f4])}if(Z)for(let Q of Z){if(_Z(Q))z.add(Q[f4]);if(Array.isArray(Q.content)){for(let X of Q.content)if(_Z(X))z.add(X[f4])}}return Array.from(z)}function RZ($,Z){let z=Nz($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function QH($){if(_Z($))return{"x-stainless-helper":$[f4]};return{}}var f4;var u4=v(()=>{f4=Symbol("anthropic.sdk.stainlessHelper")});var m4;var Dz=v(()=>{H0();W0();u4();z1();I0();m4=class m4 extends c{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",F2,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/files/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}download($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/files/${$}/content?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},z?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/files/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}upload($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/files?beta=true",Z1({body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},QH(Q.file),Z?.headers])},this._client))}}});var c4;var Oz=v(()=>{H0();W0();I0();c4=class c4 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}?beta=true`,{...z,headers:O([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models?beta=true",F2,{query:Q,...Z,headers:O([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var p4;var Iz=v(()=>{H0();W0();I0();p4=class p4 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/user_profiles/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/user_profiles/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var l4;var Tz=v(()=>{H0();W0();I0();l4=class l4 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/agents/${$}/versions?beta=true`,z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var Q1;var Az=v(()=>{Tz();Tz();H0();W0();I0();Q1=class Q1 extends c{constructor(){super(...arguments);this.versions=new l4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.get(R`/v1/agents/${$}?beta=true`,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/agents/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/agents?beta=true",z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/agents/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};Q1.Versions=l4});var d4;var Cz=v(()=>{H0();W0();I0();d4=class d4 extends c{create($,Z,z){let{view:Q,betas:X,...J}=Z;return this._client.post(R`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:Q},body:J,...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:J,...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{memory_store_id:Q,view:X,betas:J,...Y}=Z;return this._client.post(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{view:X},body:Y,...z,headers:O([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memories?beta=true`,z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{memory_store_id:Q,expected_content_sha256:X,betas:J}=Z;return this._client.delete(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{expected_content_sha256:X},...z,headers:O([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var i4;var _z=v(()=>{H0();W0();I0();i4=class i4 extends c{retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(R`/v1/memory_stores/${Q}/memory_versions/${$}?beta=true`,{query:J,...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memory_versions?beta=true`,z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}redact($,Z,z){let{memory_store_id:Q,betas:X}=Z;return this._client.post(R`/v1/memory_stores/${Q}/memory_versions/${$}/redact?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var X$;var Rz=v(()=>{Cz();Cz();_z();_z();H0();W0();I0();X$=class X$ extends c{constructor(){super(...arguments);this.memories=new d4(this._client),this.memoryVersions=new i4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/memory_stores/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/memory_stores/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/memory_stores/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/memory_stores/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};X$.Memories=d4;X$.MemoryVersions=i4});var X1=v(()=>{d0()});var PZ;var Pz=v(()=>{PZ={"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 XH($){return $?.output_format??$?.output_config?.format}function Fz($,Z,z){let Q=XH(Z);if(!Z||!("parse"in(Q??{})))return{...$,content:$.content.map((X)=>{if(X.type==="text"){let J=Object.defineProperty({...X},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(J,"parsed",{get(){return z.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return X}),parsed_output:null};return Sz($,Z,z)}function Sz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=ow(Z,J.text);if(Q===null)Q=Y;let W=Object.defineProperty({...J},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"parsed",{get(){return z.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return J});return{...$,content:X,parsed_output:Q}}function ow($,Z){let z=XH($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new x(`Failed to parse structured output: ${Q}`)}}var Ez=v(()=>{d0()});var aw=($)=>{let Z=0,z=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"){Z++;continue}if(Q==="{"){z.push({type:"brace",value:"{"}),Z++;continue}if(Q==="}"){z.push({type:"brace",value:"}"}),Z++;continue}if(Q==="["){z.push({type:"paren",value:"["}),Z++;continue}if(Q==="]"){z.push({type:"paren",value:"]"}),Z++;continue}if(Q===":"){z.push({type:"separator",value:":"}),Z++;continue}if(Q===","){z.push({type:"delimiter",value:","}),Z++;continue}if(Q==='"'){let W="",U=!1;Q=$[++Z];while(Q!=='"'){if(Z===$.length){U=!0;break}if(Q==="\\"){if(Z++,Z===$.length){U=!0;break}W+=Q+$[Z],Q=$[++Z]}else W+=Q,Q=$[++Z]}if(Q=$[++Z],!U)z.push({type:"string",value:W});continue}if(Q&&/\s/.test(Q)){Z++;continue}let J=/[0-9]/;if(Q&&J.test(Q)||Q==="-"||Q==="."){let W="";if(Q==="-")W+=Q,Q=$[++Z];while(Q&&J.test(Q)||Q===".")W+=Q,Q=$[++Z];z.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(Q&&Y.test(Q)){let W="";while(Q&&Y.test(Q)){if(Z===$.length)break;W+=Q,Q=$[++Z]}if(W=="true"||W=="false"||W==="null")z.push({type:"name",value:W});else{Z++;continue}continue}Z++}return z},J1=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),J1($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),J1($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),J1($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),J1($);break;case"delimiter":return $=$.slice(0,$.length-1),J1($);break}return $},tw=($)=>{let Z=[];if($.map((z)=>{if(z.type==="brace")if(z.value==="{")Z.push("}");else Z.splice(Z.lastIndexOf("}"),1);if(z.type==="paren")if(z.value==="[")Z.push("]");else Z.splice(Z.lastIndexOf("]"),1)}),Z.length>0)Z.reverse().map((z)=>{if(z==="}")$.push({type:"brace",value:"}"});else if(z==="]")$.push({type:"paren",value:"]"})});return $},ew=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},FZ=($)=>JSON.parse(ew(tw(J1(aw($)))));var jz=()=>{};var wz=v(()=>{Wz()});function UH($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function GH($){}var H2,C6,Y1,n4,SZ,r4,s4,EZ,o4,a2,a4,jZ,wZ,J$,xZ,yZ,t4,xz,JH,kZ,yz,kz,bz,YH,WH="__json_buf",e4;var VH=v(()=>{r2();jz();X1();wz();Ez();e4=class e4{constructor($,Z){H2.add(this),this.messages=[],this.receivedMessages=[],C6.set(this,void 0),Y1.set(this,null),this.controller=new AbortController,n4.set(this,void 0),SZ.set(this,()=>{}),r4.set(this,()=>{}),s4.set(this,void 0),EZ.set(this,()=>{}),o4.set(this,()=>{}),a2.set(this,{}),a4.set(this,!1),jZ.set(this,!1),wZ.set(this,!1),J$.set(this,!1),xZ.set(this,void 0),yZ.set(this,void 0),t4.set(this,void 0),kZ.set(this,(z)=>{if(F(this,jZ,!0,"f"),s2(z))z=new x0;if(z instanceof x0)return F(this,wZ,!0,"f"),this._emit("abort",z);if(z instanceof x)return this._emit("error",z);if(z instanceof Error){let Q=new x(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new x(String(z)))}),F(this,n4,new Promise((z,Q)=>{F(this,SZ,z,"f"),F(this,r4,Q,"f")}),"f"),F(this,s4,new Promise((z,Q)=>{F(this,EZ,z,"f"),F(this,o4,Q,"f")}),"f"),D(this,n4,"f").catch(()=>{}),D(this,s4,"f").catch(()=>{}),F(this,Y1,$,"f"),F(this,t4,Z?.logger??console,"f")}get response(){return D(this,xZ,"f")}get request_id(){return D(this,yZ,"f")}async withResponse(){F(this,J$,!0,"f");let $=await D(this,n4,"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 e4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new e4(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return F(X,Y1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},D(this,kZ,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{D(this,H2,"m",yz).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)D(this,H2,"m",kz).call(this,W);if(Y.controller.signal?.aborted)throw new x0;D(this,H2,"m",bz).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;F(this,xZ,$,"f"),F(this,yZ,$?.headers.get("request-id"),"f"),D(this,SZ,"f").call(this,$),this._emit("connect")}get ended(){return D(this,a4,"f")}get errored(){return D(this,jZ,"f")}get aborted(){return D(this,wZ,"f")}abort(){this.controller.abort()}on($,Z){return(D(this,a2,"f")[$]||(D(this,a2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=D(this,a2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(D(this,a2,"f")[$]||(D(this,a2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(F(this,J$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){F(this,J$,!0,"f"),await D(this,s4,"f")}get currentMessage(){return D(this,C6,"f")}async finalMessage(){return await this.done(),D(this,H2,"m",xz).call(this)}async finalText(){return await this.done(),D(this,H2,"m",JH).call(this)}_emit($,...Z){if(D(this,a4,"f"))return;if($==="end")F(this,a4,!0,"f"),D(this,EZ,"f").call(this);let z=D(this,a2,"f")[$];if(z)D(this,a2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!D(this,J$,"f")&&!z?.length)Promise.reject(Q);D(this,r4,"f").call(this,Q),D(this,o4,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!D(this,J$,"f")&&!z?.length)Promise.reject(Q);D(this,r4,"f").call(this,Q),D(this,o4,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",D(this,H2,"m",xz).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,Q;if(z){if(z.aborted)this.controller.abort();Q=this.controller.abort.bind(this.controller),z.addEventListener("abort",Q)}try{D(this,H2,"m",yz).call(this),this._connected(null);let X=e0.fromReadableStream($,this.controller);for await(let J of X)D(this,H2,"m",kz).call(this,J);if(X.controller.signal?.aborted)throw new x0;D(this,H2,"m",bz).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(C6=new WeakMap,Y1=new WeakMap,n4=new WeakMap,SZ=new WeakMap,r4=new WeakMap,s4=new WeakMap,EZ=new WeakMap,o4=new WeakMap,a2=new WeakMap,a4=new WeakMap,jZ=new WeakMap,wZ=new WeakMap,J$=new WeakMap,xZ=new WeakMap,yZ=new WeakMap,t4=new WeakMap,kZ=new WeakMap,H2=new WeakSet,xz=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},JH=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new x("stream ended without producing a content block with type=text");return Z.join(" ")},yz=function(){if(this.ended)return;F(this,C6,void 0,"f")},kz=function(Z){if(this.ended)return;let z=D(this,H2,"m",YH).call(this,Z);switch(this._emit("streamEvent",Z,z),Z.type){case"content_block_delta":{let Q=z.content.at(-1);switch(Z.delta.type){case"text_delta":{if(Q.type==="text")this._emit("text",Z.delta.text,Q.text||"");break}case"citations_delta":{if(Q.type==="text")this._emit("citation",Z.delta.citation,Q.citations??[]);break}case"input_json_delta":{if(UH(Q)&&Q.input)this._emit("inputJson",Z.delta.partial_json,Q.input);break}case"thinking_delta":{if(Q.type==="thinking")this._emit("thinking",Z.delta.thinking,Q.thinking);break}case"signature_delta":{if(Q.type==="thinking")this._emit("signature",Q.signature);break}case"compaction_delta":{if(Q.type==="compaction"&&Q.content)this._emit("compaction",Q.content);break}default:GH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(Fz(z,D(this,Y1,"f"),{logger:D(this,t4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{F(this,C6,z,"f");break}case"content_block_start":case"message_delta":break}},bz=function(){if(this.ended)throw new x("stream has ended, this shouldn't happen");let Z=D(this,C6,"f");if(!Z)throw new x("request ended without sending any chunks");return F(this,C6,void 0,"f"),Fz(Z,D(this,Y1,"f"),{logger:D(this,t4,"f")})},YH=function(Z){let z=D(this,C6,"f");if(Z.type==="message_start"){if(z)throw new x(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new x(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.container=Z.delta.container,z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,z.context_management=Z.context_management,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)z.usage.iterations=Z.usage.iterations;return z;case"content_block_start":return z.content.push(Z.content_block),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&UH(Q)){let X=Q[WH]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,WH,{value:X,enumerable:!1,writable:!0}),X)try{J.input=FZ(X)}catch(Y){let W=new x(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);D(this,kZ,"f").call(this,W)}z.content[Z.index]=J}break}case"thinking_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,thinking:Q.thinking+Z.delta.thinking};break}case"signature_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,signature:Z.delta.signature};break}case"compaction_delta":{if(Q?.type==="compaction")z.content[Z.index]={...Q,content:(Q.content||"")+Z.delta.content};break}default:GH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,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 e0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var W1;var bZ=v(()=>{W1=class W1 extends Error{constructor($){let Z=typeof $==="string"?$:$.map((z)=>{if(z.type==="text")return z.text;return`[${z.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var HH=1e5,KH=`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
+ ${H}`)}return Y},R;var I0=g(()=>{d0();qH=Object.freeze(Object.create(null)),R=Jx(BH)});var u4;var Rz=g(()=>{H0();W0();I0();u4=class u4 extends p{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/environments/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/environments/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/environments?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/environments/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/environments/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function SZ($){return typeof $==="object"&&$!==null&&m4 in $}function Fz($,Z){let z=new Set;if($){for(let Q of $)if(SZ(Q))z.add(Q[m4])}if(Z)for(let Q of Z){if(SZ(Q))z.add(Q[m4]);if(Array.isArray(Q.content)){for(let X of Q.content)if(SZ(X))z.add(X[m4])}}return Array.from(z)}function EZ($,Z){let z=Fz($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function MH($){if(SZ($))return{"x-stainless-helper":$[m4]};return{}}var m4;var c4=g(()=>{m4=Symbol("anthropic.sdk.stainlessHelper")});var p4;var Pz=g(()=>{H0();W0();c4();J1();I0();p4=class p4 extends p{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",P2,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/files/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}download($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/files/${$}/content?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},z?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/files/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}upload($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/files?beta=true",X1({body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},MH(Q.file),Z?.headers])},this._client))}}});var l4;var Sz=g(()=>{H0();W0();I0();l4=class l4 extends p{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}?beta=true`,{...z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models?beta=true",P2,{query:Q,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var d4;var Ez=g(()=>{H0();W0();I0();d4=class d4 extends p{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/user_profiles/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/user_profiles/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var i4;var jz=g(()=>{H0();W0();I0();i4=class i4 extends p{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/agents/${$}/versions?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var Y1;var wz=g(()=>{jz();jz();H0();W0();I0();Y1=class Y1 extends p{constructor(){super(...arguments);this.versions=new i4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.get(R`/v1/agents/${$}?beta=true`,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/agents/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/agents?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/agents/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};Y1.Versions=i4});var n4;var xz=g(()=>{H0();W0();I0();n4=class n4 extends p{create($,Z,z){let{view:Q,betas:X,...J}=Z;return this._client.post(R`/v1/memory_stores/${$}/memories?beta=true`,{query:{view:Q},body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{memory_store_id:Q,view:X,betas:J,...Y}=Z;return this._client.post(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{view:X},body:Y,...z,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memories?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{memory_store_id:Q,expected_content_sha256:X,betas:J}=Z;return this._client.delete(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{expected_content_sha256:X},...z,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var r4;var yz=g(()=>{H0();W0();I0();r4=class r4 extends p{retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(R`/v1/memory_stores/${Q}/memory_versions/${$}?beta=true`,{query:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memory_versions?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}redact($,Z,z){let{memory_store_id:Q,betas:X}=Z;return this._client.post(R`/v1/memory_stores/${Q}/memory_versions/${$}/redact?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var U$;var kz=g(()=>{xz();xz();yz();yz();H0();W0();I0();U$=class U$ extends p{constructor(){super(...arguments);this.memories=new n4(this._client),this.memoryVersions=new r4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/memory_stores/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/memory_stores/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/memory_stores/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/memory_stores/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};U$.Memories=n4;U$.MemoryVersions=r4});var W1=g(()=>{d0()});var jZ;var bz=g(()=>{jZ={"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 LH($){return $?.output_format??$?.output_config?.format}function vz($,Z,z){let Q=LH(Z);if(!Z||!("parse"in(Q??{})))return{...$,content:$.content.map((X)=>{if(X.type==="text"){let J=Object.defineProperty({...X},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(J,"parsed",{get(){return z.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return X}),parsed_output:null};return gz($,Z,z)}function gz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=Mx(Z,J.text);if(Q===null)Q=Y;let W=Object.defineProperty({...J},"parsed_output",{value:Y,enumerable:!1});return Object.defineProperty(W,"parsed",{get(){return z.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Y},enumerable:!1})}return J});return{...$,content:X,parsed_output:Q}}function Mx($,Z){let z=LH($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new y(`Failed to parse structured output: ${Q}`)}}var hz=g(()=>{d0()});var Lx=($)=>{let Z=0,z=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"){Z++;continue}if(Q==="{"){z.push({type:"brace",value:"{"}),Z++;continue}if(Q==="}"){z.push({type:"brace",value:"}"}),Z++;continue}if(Q==="["){z.push({type:"paren",value:"["}),Z++;continue}if(Q==="]"){z.push({type:"paren",value:"]"}),Z++;continue}if(Q===":"){z.push({type:"separator",value:":"}),Z++;continue}if(Q===","){z.push({type:"delimiter",value:","}),Z++;continue}if(Q==='"'){let W="",U=!1;Q=$[++Z];while(Q!=='"'){if(Z===$.length){U=!0;break}if(Q==="\\"){if(Z++,Z===$.length){U=!0;break}W+=Q+$[Z],Q=$[++Z]}else W+=Q,Q=$[++Z]}if(Q=$[++Z],!U)z.push({type:"string",value:W});continue}if(Q&&/\s/.test(Q)){Z++;continue}let J=/[0-9]/;if(Q&&J.test(Q)||Q==="-"||Q==="."){let W="";if(Q==="-")W+=Q,Q=$[++Z];while(Q&&J.test(Q)||Q===".")W+=Q,Q=$[++Z];z.push({type:"number",value:W});continue}let Y=/[a-z]/i;if(Q&&Y.test(Q)){let W="";while(Q&&Y.test(Q)){if(Z===$.length)break;W+=Q,Q=$[++Z]}if(W=="true"||W=="false"||W==="null")z.push({type:"name",value:W});else{Z++;continue}continue}Z++}return z},U1=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),U1($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),U1($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),U1($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),U1($);break;case"delimiter":return $=$.slice(0,$.length-1),U1($);break}return $},Nx=($)=>{let Z=[];if($.map((z)=>{if(z.type==="brace")if(z.value==="{")Z.push("}");else Z.splice(Z.lastIndexOf("}"),1);if(z.type==="paren")if(z.value==="[")Z.push("]");else Z.splice(Z.lastIndexOf("]"),1)}),Z.length>0)Z.reverse().map((z)=>{if(z==="}")$.push({type:"brace",value:"}"});else if(z==="]")$.push({type:"paren",value:"]"})});return $},Ox=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},wZ=($)=>JSON.parse(Ox(Nx(U1(Lx($)))));var fz=()=>{};var uz=g(()=>{Lz()});function IH($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function TH($){}var K2,R6,G1,s4,xZ,o4,a4,yZ,t4,e2,e4,kZ,bZ,G$,vZ,gZ,$8,mz,NH,hZ,cz,pz,lz,OH,DH="__json_buf",Z8;var AH=g(()=>{o2();fz();W1();uz();hz();Z8=class Z8{constructor($,Z){K2.add(this),this.messages=[],this.receivedMessages=[],R6.set(this,void 0),G1.set(this,null),this.controller=new AbortController,s4.set(this,void 0),xZ.set(this,()=>{}),o4.set(this,()=>{}),a4.set(this,void 0),yZ.set(this,()=>{}),t4.set(this,()=>{}),e2.set(this,{}),e4.set(this,!1),kZ.set(this,!1),bZ.set(this,!1),G$.set(this,!1),vZ.set(this,void 0),gZ.set(this,void 0),$8.set(this,void 0),hZ.set(this,(z)=>{if(P(this,kZ,!0,"f"),a2(z))z=new x0;if(z instanceof x0)return P(this,bZ,!0,"f"),this._emit("abort",z);if(z instanceof y)return this._emit("error",z);if(z instanceof Error){let Q=new y(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new y(String(z)))}),P(this,s4,new Promise((z,Q)=>{P(this,xZ,z,"f"),P(this,o4,Q,"f")}),"f"),P(this,a4,new Promise((z,Q)=>{P(this,yZ,z,"f"),P(this,t4,Q,"f")}),"f"),O(this,s4,"f").catch(()=>{}),O(this,a4,"f").catch(()=>{}),P(this,G1,$,"f"),P(this,$8,Z?.logger??console,"f")}get response(){return O(this,vZ,"f")}get request_id(){return O(this,gZ,"f")}async withResponse(){P(this,G$,!0,"f");let $=await O(this,s4,"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 Z8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new Z8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return P(X,G1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},O(this,hZ,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{O(this,K2,"m",cz).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)O(this,K2,"m",pz).call(this,W);if(Y.controller.signal?.aborted)throw new x0;O(this,K2,"m",lz).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;P(this,vZ,$,"f"),P(this,gZ,$?.headers.get("request-id"),"f"),O(this,xZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,e4,"f")}get errored(){return O(this,kZ,"f")}get aborted(){return O(this,bZ,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,e2,"f")[$]||(O(this,e2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,e2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(O(this,e2,"f")[$]||(O(this,e2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(P(this,G$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){P(this,G$,!0,"f"),await O(this,a4,"f")}get currentMessage(){return O(this,R6,"f")}async finalMessage(){return await this.done(),O(this,K2,"m",mz).call(this)}async finalText(){return await this.done(),O(this,K2,"m",NH).call(this)}_emit($,...Z){if(O(this,e4,"f"))return;if($==="end")P(this,e4,!0,"f"),O(this,yZ,"f").call(this);let z=O(this,e2,"f")[$];if(z)O(this,e2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,G$,"f")&&!z?.length)Promise.reject(Q);O(this,o4,"f").call(this,Q),O(this,t4,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,G$,"f")&&!z?.length)Promise.reject(Q);O(this,o4,"f").call(this,Q),O(this,t4,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,K2,"m",mz).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,Q;if(z){if(z.aborted)this.controller.abort();Q=this.controller.abort.bind(this.controller),z.addEventListener("abort",Q)}try{O(this,K2,"m",cz).call(this),this._connected(null);let X=e0.fromReadableStream($,this.controller);for await(let J of X)O(this,K2,"m",pz).call(this,J);if(X.controller.signal?.aborted)throw new x0;O(this,K2,"m",lz).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(R6=new WeakMap,G1=new WeakMap,s4=new WeakMap,xZ=new WeakMap,o4=new WeakMap,a4=new WeakMap,yZ=new WeakMap,t4=new WeakMap,e2=new WeakMap,e4=new WeakMap,kZ=new WeakMap,bZ=new WeakMap,G$=new WeakMap,vZ=new WeakMap,gZ=new WeakMap,$8=new WeakMap,hZ=new WeakMap,K2=new WeakSet,mz=function(){if(this.receivedMessages.length===0)throw new y("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},NH=function(){if(this.receivedMessages.length===0)throw new y("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new y("stream ended without producing a content block with type=text");return Z.join(" ")},cz=function(){if(this.ended)return;P(this,R6,void 0,"f")},pz=function(Z){if(this.ended)return;let z=O(this,K2,"m",OH).call(this,Z);switch(this._emit("streamEvent",Z,z),Z.type){case"content_block_delta":{let Q=z.content.at(-1);switch(Z.delta.type){case"text_delta":{if(Q.type==="text")this._emit("text",Z.delta.text,Q.text||"");break}case"citations_delta":{if(Q.type==="text")this._emit("citation",Z.delta.citation,Q.citations??[]);break}case"input_json_delta":{if(IH(Q)&&Q.input)this._emit("inputJson",Z.delta.partial_json,Q.input);break}case"thinking_delta":{if(Q.type==="thinking")this._emit("thinking",Z.delta.thinking,Q.thinking);break}case"signature_delta":{if(Q.type==="thinking")this._emit("signature",Q.signature);break}case"compaction_delta":{if(Q.type==="compaction"&&Q.content)this._emit("compaction",Q.content);break}default:TH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(vz(z,O(this,G1,"f"),{logger:O(this,$8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{P(this,R6,z,"f");break}case"content_block_start":case"message_delta":break}},lz=function(){if(this.ended)throw new y("stream has ended, this shouldn't happen");let Z=O(this,R6,"f");if(!Z)throw new y("request ended without sending any chunks");return P(this,R6,void 0,"f"),vz(Z,O(this,G1,"f"),{logger:O(this,$8,"f")})},OH=function(Z){let z=O(this,R6,"f");if(Z.type==="message_start"){if(z)throw new y(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new y(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.container=Z.delta.container,z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,z.context_management=Z.context_management,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)z.usage.iterations=Z.usage.iterations;return z;case"content_block_start":return z.content.push(Z.content_block),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&IH(Q)){let X=Q[DH]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,DH,{value:X,enumerable:!1,writable:!0}),X)try{J.input=wZ(X)}catch(Y){let W=new y(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);O(this,hZ,"f").call(this,W)}z.content[Z.index]=J}break}case"thinking_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,thinking:Q.thinking+Z.delta.thinking};break}case"signature_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,signature:Z.delta.signature};break}case"compaction_delta":{if(Q?.type==="compaction")z.content[Z.index]={...Q,content:(Q.content||"")+Z.delta.content};break}default:TH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,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 e0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var V1;var fZ=g(()=>{V1=class V1 extends Error{constructor($){let Z=typeof $==="string"?$:$.map((z)=>{if(z.type==="text")return z.text;return`[${z.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var CH=1e5,_H=`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,115 +192,115 @@ 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 BH(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function $x($,Z=$.messages.at(-1),z){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let Q=Z.content.filter((J)=>J.type==="tool_use");if(Q.length===0)return null;return{role:"user",content:await Promise.all(Q.map(async(J)=>{let Y=$.tools.find((W)=>("name"in W?W.name:W.mcp_server_name)===J.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:J.id,content:`Error: Tool '${J.name}' not found`,is_error:!0};try{let W=J.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let U=await Y.run(W,{toolUseBlock:J,signal:z?.signal});return{type:"tool_result",tool_use_id:J.id,content:U}}catch(W){return{type:"tool_result",tool_use_id:J.id,content:W instanceof W1?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var $8,U1,Y$,R0,i0,$2,t2,_6,Z8,qH,vz,z8;var gz=v(()=>{r2();bZ();d0();W0();u4();z8=class z8{constructor($,Z,z){$8.add(this),this.client=$,U1.set(this,!1),Y$.set(this,!1),R0.set(this,void 0),i0.set(this,void 0),$2.set(this,void 0),t2.set(this,void 0),_6.set(this,void 0),Z8.set(this,0),F(this,R0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...Nz(Z.tools,Z.messages)].join(", ");if(F(this,i0,{...z,headers:O([{"x-stainless-helper":X},z?.headers])},"f"),F(this,_6,BH(),"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*[(U1=new WeakMap,Y$=new WeakMap,R0=new WeakMap,i0=new WeakMap,$2=new WeakMap,t2=new WeakMap,_6=new WeakMap,Z8=new WeakMap,$8=new WeakSet,qH=async function(){let Z=D(this,R0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(D(this,$2,"f")!==void 0)try{let U=await D(this,$2,"f");z=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 Q=Z.contextTokenThreshold??HH;if(z<Q)return!1;let X=Z.model??D(this,R0,"f").params.model,J=Z.summaryPrompt??KH,Y=D(this,R0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let G=U.content.filter((V)=>V.type!=="tool_use");if(G.length===0)Y.pop();else U.content=G}}let W=await this.client.beta.messages.create({model:X,messages:[...Y,{role:"user",content:[{type:"text",text:J}]}],max_tokens:D(this,R0,"f").params.max_tokens},{signal:D(this,i0,"f").signal,headers:O([D(this,i0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new x("Expected text response for compaction");return D(this,R0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(D(this,U1,"f"))throw new x("Cannot iterate over a consumed stream");F(this,U1,!0,"f"),F(this,Y$,!0,"f"),F(this,t2,void 0,"f");try{while(!0){let Z;try{if(D(this,R0,"f").params.max_iterations&&D(this,Z8,"f")>=D(this,R0,"f").params.max_iterations)break;F(this,Y$,!1,"f"),F(this,t2,void 0,"f"),F(this,Z8,($=D(this,Z8,"f"),$++,$),"f"),F(this,$2,void 0,"f");let{max_iterations:z,compactionControl:Q,...X}=D(this,R0,"f").params;if(X.stream)Z=this.client.beta.messages.stream({...X},D(this,i0,"f")),F(this,$2,Z.finalMessage(),"f"),D(this,$2,"f").catch(()=>{}),yield Z;else F(this,$2,this.client.beta.messages.create({...X,stream:!1},D(this,i0,"f")),"f"),yield D(this,$2,"f");if(!await D(this,$8,"m",qH).call(this)){if(!D(this,Y$,"f")){let{role:W,content:U}=await D(this,$2,"f");D(this,R0,"f").params.messages.push({role:W,content:U})}let Y=await D(this,$8,"m",vz).call(this,D(this,R0,"f").params.messages.at(-1));if(Y)D(this,R0,"f").params.messages.push(Y);else if(!D(this,Y$,"f"))break}}finally{if(Z)Z.abort()}}if(!D(this,$2,"f"))throw new x("ToolRunner concluded without a message from the server");D(this,_6,"f").resolve(await D(this,$2,"f"))}catch(Z){throw F(this,U1,!1,"f"),D(this,_6,"f").promise.catch(()=>{}),D(this,_6,"f").reject(Z),F(this,_6,BH(),"f"),Z}}setMessagesParams($){if(typeof $==="function")D(this,R0,"f").params=$(D(this,R0,"f").params);else D(this,R0,"f").params=$;F(this,Y$,!0,"f"),F(this,t2,void 0,"f")}setRequestOptions($){if(typeof $==="function")F(this,i0,$(D(this,i0,"f")),"f");else F(this,i0,{...D(this,i0,"f"),...$},"f")}async generateToolResponse($=D(this,i0,"f").signal){let Z=await D(this,$2,"f")??this.params.messages.at(-1);if(!Z)return null;return D(this,$8,"m",vz).call(this,Z,$)}done(){return D(this,_6,"f").promise}async runUntilDone(){if(!D(this,U1,"f"))for await(let $ of this);return this.done()}get params(){return D(this,R0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};vz=async function(Z,z=D(this,i0,"f").signal){if(D(this,t2,"f")!==void 0)return D(this,t2,"f");return F(this,t2,$x(D(this,R0,"f").params,Z,{...D(this,i0,"f"),signal:z}),"f"),D(this,t2,"f")}});var G1;var hz=v(()=>{d0();Jz();G1=class G1{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new T6;for await(let Z of this.iterator)for(let z of $.decode(Z))yield JSON.parse(z);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 x("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 x("Attempted to iterate over a response with no body")}return new G1(j4($.body),Z)}}});var Q8;var fz=v(()=>{H0();W0();hz();X1();I0();Q8=class Q8 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/messages/batches/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",F2,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/messages/batches/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}cancel($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/messages/batches/${$}/cancel?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}async results($,Z={},z){let Q=await this.retrieve($);if(!Q.results_url)throw new x(`No batch \`results_url\`; Has it finished processing? ${Q.processing_status} - ${Q.id}`);let{betas:X}=Z??{};return this._client.get(Q.results_url,{...z,headers:O([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((J,Y)=>G1.fromResponse(Y.response,Y.controller))}}});function LH($){if(!$.output_format)return $;if($.output_config?.format)throw new x("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...z}=$;return{...z,output_config:{...$.output_config,format:Z}}}var MH,zx,R6;var uz=v(()=>{X1();Pz();W0();u4();Ez();VH();gz();bZ();fz();fz();gz();bZ();MH={"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"},zx=["claude-mythos-preview","claude-opus-4-6"];R6=class R6 extends c{constructor(){super(...arguments);this.batches=new Q8(this._client)}create($,Z){let z=LH($),{betas:Q,...X}=z;if(X.model in MH)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${MH[X.model]}
196
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(zx.includes(X.model)&&X.thinking&&X.thinking.type==="enabled")console.warn(`Using Claude with ${X.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 J=this._client._options.timeout;if(!X.stream&&J==null){let W=PZ[X.model]??void 0;J=this._client.calculateNonstreamingTimeout(X.max_tokens,W)}let Y=RZ(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:O([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:O([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>Sz(z,$,{logger:this._client.logger??console}))}stream($,Z){return e4.createMessage(this,$,Z)}countTokens($,Z){let z=LH($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:O([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new z8(this._client,$,Z)}};R6.Batches=Q8;R6.BetaToolRunner=z8;R6.ToolError=W1});var X8;var mz=v(()=>{H0();W0();I0();X8=class X8 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/events?beta=true`,z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}send($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}/events?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}stream($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/sessions/${$}/events/stream?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var J8;var cz=v(()=>{H0();W0();I0();J8=class J8 extends c{retrieve($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.get(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{session_id:Q,betas:X,...J}=Z;return this._client.post(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{body:J,...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/resources?beta=true`,z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.delete(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}add($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}/resources?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var W$;var pz=v(()=>{mz();mz();cz();cz();H0();W0();I0();W$=class W$ extends c{constructor(){super(...arguments);this.events=new X8(this._client),this.resources=new J8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/sessions/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/sessions/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/sessions/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};W$.Events=X8;W$.Resources=J8});var Y8;var lz=v(()=>{H0();W0();z1();I0();Y8=class Y8 extends c{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(R`/v1/skills/${$}/versions?beta=true`,Z1({body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])},this._client))}retrieve($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.get(R`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/skills/${$}/versions?beta=true`,z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}delete($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.delete(R`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var V1;var dz=v(()=>{lz();lz();H0();W0();z1();I0();V1=class V1 extends c{constructor(){super(...arguments);this.versions=new Y8(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",Z1({body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/skills/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/skills/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};V1.Versions=Y8});var W8;var iz=v(()=>{H0();W0();I0();W8=class W8 extends c{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.get(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{vault_id:Q,betas:X,...J}=Z;return this._client.post(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{body:J,...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/vaults/${$}/credentials?beta=true`,z0,{query:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.delete(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.post(R`/v1/vaults/${Q}/credentials/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var H1;var nz=v(()=>{iz();iz();H0();W0();I0();H1=class H1 extends c{constructor(){super(...arguments);this.credentials=new W8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/vaults/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}?beta=true`,{body:X,...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",z0,{query:Q,...Z,headers:O([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/vaults/${$}?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/vaults/${$}/archive?beta=true`,{...z,headers:O([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};H1.Credentials=W8});var g0;var rz=v(()=>{Lz();Lz();Dz();Dz();Oz();Oz();Iz();Iz();Az();Az();Rz();Rz();uz();uz();pz();pz();dz();dz();nz();nz();g0=class g0 extends c{constructor(){super(...arguments);this.models=new c4(this._client),this.messages=new R6(this._client),this.agents=new Q1(this._client),this.environments=new h4(this._client),this.sessions=new W$(this._client),this.vaults=new H1(this._client),this.memoryStores=new X$(this._client),this.files=new m4(this._client),this.skills=new V1(this._client),this.userProfiles=new p4(this._client)}};g0.Models=c4;g0.Messages=R6;g0.Agents=Q1;g0.Environments=h4;g0.Sessions=W$;g0.Vaults=H1;g0.MemoryStores=X$;g0.Files=m4;g0.Skills=V1;g0.UserProfiles=p4});var K1;var sz=v(()=>{W0();K1=class K1 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:O([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function NH($){return $?.output_config?.format}function oz($,Z,z){let Q=NH(Z);if(!Z||!("parse"in(Q??{})))return{...$,content:$.content.map((X)=>{if(X.type==="text")return Object.defineProperty({...X},"parsed_output",{value:null,enumerable:!1});return X}),parsed_output:null};return az($,Z,z)}function az($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=Hx(Z,J.text);if(Q===null)Q=Y;return Object.defineProperty({...J},"parsed_output",{value:Y,enumerable:!1})}return J});return{...$,content:X,parsed_output:Q}}function Hx($,Z){let z=NH($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new x(`Failed to parse structured output: ${Q}`)}}var tz=v(()=>{d0()});function TH($){return $.type==="tool_use"||$.type==="server_tool_use"}function AH($){}var K2,P6,q1,U8,vZ,G8,V8,gZ,H8,e2,K8,hZ,fZ,U$,uZ,mZ,q8,ez,DH,$Q,ZQ,zQ,QQ,OH,IH="__json_buf",B8;var CH=v(()=>{r2();X1();wz();jz();tz();B8=class B8{constructor($,Z){K2.add(this),this.messages=[],this.receivedMessages=[],P6.set(this,void 0),q1.set(this,null),this.controller=new AbortController,U8.set(this,void 0),vZ.set(this,()=>{}),G8.set(this,()=>{}),V8.set(this,void 0),gZ.set(this,()=>{}),H8.set(this,()=>{}),e2.set(this,{}),K8.set(this,!1),hZ.set(this,!1),fZ.set(this,!1),U$.set(this,!1),uZ.set(this,void 0),mZ.set(this,void 0),q8.set(this,void 0),$Q.set(this,(z)=>{if(F(this,hZ,!0,"f"),s2(z))z=new x0;if(z instanceof x0)return F(this,fZ,!0,"f"),this._emit("abort",z);if(z instanceof x)return this._emit("error",z);if(z instanceof Error){let Q=new x(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new x(String(z)))}),F(this,U8,new Promise((z,Q)=>{F(this,vZ,z,"f"),F(this,G8,Q,"f")}),"f"),F(this,V8,new Promise((z,Q)=>{F(this,gZ,z,"f"),F(this,H8,Q,"f")}),"f"),D(this,U8,"f").catch(()=>{}),D(this,V8,"f").catch(()=>{}),F(this,q1,$,"f"),F(this,q8,Z?.logger??console,"f")}get response(){return D(this,uZ,"f")}get request_id(){return D(this,mZ,"f")}async withResponse(){F(this,U$,!0,"f");let $=await D(this,U8,"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 B8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new B8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return F(X,q1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},D(this,$Q,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{D(this,K2,"m",ZQ).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)D(this,K2,"m",zQ).call(this,W);if(Y.controller.signal?.aborted)throw new x0;D(this,K2,"m",QQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;F(this,uZ,$,"f"),F(this,mZ,$?.headers.get("request-id"),"f"),D(this,vZ,"f").call(this,$),this._emit("connect")}get ended(){return D(this,K8,"f")}get errored(){return D(this,hZ,"f")}get aborted(){return D(this,fZ,"f")}abort(){this.controller.abort()}on($,Z){return(D(this,e2,"f")[$]||(D(this,e2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=D(this,e2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(D(this,e2,"f")[$]||(D(this,e2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(F(this,U$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){F(this,U$,!0,"f"),await D(this,V8,"f")}get currentMessage(){return D(this,P6,"f")}async finalMessage(){return await this.done(),D(this,K2,"m",ez).call(this)}async finalText(){return await this.done(),D(this,K2,"m",DH).call(this)}_emit($,...Z){if(D(this,K8,"f"))return;if($==="end")F(this,K8,!0,"f"),D(this,gZ,"f").call(this);let z=D(this,e2,"f")[$];if(z)D(this,e2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!D(this,U$,"f")&&!z?.length)Promise.reject(Q);D(this,G8,"f").call(this,Q),D(this,H8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!D(this,U$,"f")&&!z?.length)Promise.reject(Q);D(this,G8,"f").call(this,Q),D(this,H8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",D(this,K2,"m",ez).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,Q;if(z){if(z.aborted)this.controller.abort();Q=this.controller.abort.bind(this.controller),z.addEventListener("abort",Q)}try{D(this,K2,"m",ZQ).call(this),this._connected(null);let X=e0.fromReadableStream($,this.controller);for await(let J of X)D(this,K2,"m",zQ).call(this,J);if(X.controller.signal?.aborted)throw new x0;D(this,K2,"m",QQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(P6=new WeakMap,q1=new WeakMap,U8=new WeakMap,vZ=new WeakMap,G8=new WeakMap,V8=new WeakMap,gZ=new WeakMap,H8=new WeakMap,e2=new WeakMap,K8=new WeakMap,hZ=new WeakMap,fZ=new WeakMap,U$=new WeakMap,uZ=new WeakMap,mZ=new WeakMap,q8=new WeakMap,$Q=new WeakMap,K2=new WeakSet,ez=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},DH=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new x("stream ended without producing a content block with type=text");return Z.join(" ")},ZQ=function(){if(this.ended)return;F(this,P6,void 0,"f")},zQ=function(Z){if(this.ended)return;let z=D(this,K2,"m",OH).call(this,Z);switch(this._emit("streamEvent",Z,z),Z.type){case"content_block_delta":{let Q=z.content.at(-1);switch(Z.delta.type){case"text_delta":{if(Q.type==="text")this._emit("text",Z.delta.text,Q.text||"");break}case"citations_delta":{if(Q.type==="text")this._emit("citation",Z.delta.citation,Q.citations??[]);break}case"input_json_delta":{if(TH(Q)&&Q.input)this._emit("inputJson",Z.delta.partial_json,Q.input);break}case"thinking_delta":{if(Q.type==="thinking")this._emit("thinking",Z.delta.thinking,Q.thinking);break}case"signature_delta":{if(Q.type==="thinking")this._emit("signature",Q.signature);break}default:AH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(oz(z,D(this,q1,"f"),{logger:D(this,q8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{F(this,P6,z,"f");break}case"content_block_start":case"message_delta":break}},QQ=function(){if(this.ended)throw new x("stream has ended, this shouldn't happen");let Z=D(this,P6,"f");if(!Z)throw new x("request ended without sending any chunks");return F(this,P6,void 0,"f"),oz(Z,D(this,q1,"f"),{logger:D(this,q8,"f")})},OH=function(Z){let z=D(this,P6,"f");if(Z.type==="message_start"){if(z)throw new x(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new x(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;return z;case"content_block_start":return z.content.push({...Z.content_block}),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&TH(Q)){let X=Q[IH]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,IH,{value:X,enumerable:!1,writable:!0}),X)J.input=FZ(X);z.content[Z.index]=J}break}case"thinking_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,thinking:Q.thinking+Z.delta.thinking};break}case"signature_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,signature:Z.delta.signature};break}default:AH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,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 e0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var M8;var XQ=v(()=>{H0();W0();hz();X1();I0();M8=class M8 extends c{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(R`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",F2,{query:$,...Z})}delete($,Z){return this._client.delete(R`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(R`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let z=await this.retrieve($);if(!z.results_url)throw new x(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:O([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>G1.fromResponse(X.response,X.controller))}}});var G$,_H,qx;var JQ=v(()=>{W0();u4();CH();tz();XQ();XQ();Pz();G$=class G$ extends c{constructor(){super(...arguments);this.batches=new M8(this._client)}create($,Z){if($.model in _H)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${_H[$.model]}
197
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(qx.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 z=this._client._options.timeout;if(!$.stream&&z==null){let X=PZ[$.model]??void 0;z=this._client.calculateNonstreamingTimeout($.max_tokens,X)}let Q=RZ($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:O([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>az(z,$,{logger:this._client.logger??console}))}stream($,Z){return B8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};_H={"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"},qx=["claude-mythos-preview","claude-opus-4-6"];G$.Batches=M8});var B1;var YQ=v(()=>{H0();W0();I0();B1=class B1 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}`,{...z,headers:O([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",F2,{query:Q,...Z,headers:O([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var RH=v(()=>{rz();sz();JQ();YQ();eV()});var L8=($)=>{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 U0{constructor({baseURL:$=L8("ANTHROPIC_BASE_URL"),apiKey:Z=L8("ANTHROPIC_API_KEY")??null,authToken:z=L8("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){WQ.add(this),cZ.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&gV())throw new x(`It looks like you're running in a browser-like environment.
195
+ Wrap your summary in <summary></summary> tags.`;function FH(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function Dx($,Z=$.messages.at(-1),z){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let Q=Z.content.filter((J)=>J.type==="tool_use");if(Q.length===0)return null;return{role:"user",content:await Promise.all(Q.map(async(J)=>{let Y=$.tools.find((W)=>("name"in W?W.name:W.mcp_server_name)===J.name);if(!Y||!("run"in Y))return{type:"tool_result",tool_use_id:J.id,content:`Error: Tool '${J.name}' not found`,is_error:!0};try{let W=J.input;if("parse"in Y&&Y.parse)W=Y.parse(W);let U=await Y.run(W,{toolUseBlock:J,signal:z?.signal});return{type:"tool_result",tool_use_id:J.id,content:U}}catch(W){return{type:"tool_result",tool_use_id:J.id,content:W instanceof V1?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var z8,H1,V$,R0,i0,$2,$6,F6,Q8,RH,dz,X8;var iz=g(()=>{o2();fZ();d0();W0();c4();X8=class X8{constructor($,Z,z){z8.add(this),this.client=$,H1.set(this,!1),V$.set(this,!1),R0.set(this,void 0),i0.set(this,void 0),$2.set(this,void 0),$6.set(this,void 0),F6.set(this,void 0),Q8.set(this,0),P(this,R0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...Fz(Z.tools,Z.messages)].join(", ");if(P(this,i0,{...z,headers:D([{"x-stainless-helper":X},z?.headers])},"f"),P(this,F6,FH(),"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*[(H1=new WeakMap,V$=new WeakMap,R0=new WeakMap,i0=new WeakMap,$2=new WeakMap,$6=new WeakMap,F6=new WeakMap,Q8=new WeakMap,z8=new WeakSet,RH=async function(){let Z=O(this,R0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(O(this,$2,"f")!==void 0)try{let U=await O(this,$2,"f");z=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 Q=Z.contextTokenThreshold??CH;if(z<Q)return!1;let X=Z.model??O(this,R0,"f").params.model,J=Z.summaryPrompt??_H,Y=O(this,R0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let G=U.content.filter((V)=>V.type!=="tool_use");if(G.length===0)Y.pop();else U.content=G}}let W=await this.client.beta.messages.create({model:X,messages:[...Y,{role:"user",content:[{type:"text",text:J}]}],max_tokens:O(this,R0,"f").params.max_tokens},{signal:O(this,i0,"f").signal,headers:D([O(this,i0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new y("Expected text response for compaction");return O(this,R0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(O(this,H1,"f"))throw new y("Cannot iterate over a consumed stream");P(this,H1,!0,"f"),P(this,V$,!0,"f"),P(this,$6,void 0,"f");try{while(!0){let Z;try{if(O(this,R0,"f").params.max_iterations&&O(this,Q8,"f")>=O(this,R0,"f").params.max_iterations)break;P(this,V$,!1,"f"),P(this,$6,void 0,"f"),P(this,Q8,($=O(this,Q8,"f"),$++,$),"f"),P(this,$2,void 0,"f");let{max_iterations:z,compactionControl:Q,...X}=O(this,R0,"f").params;if(X.stream)Z=this.client.beta.messages.stream({...X},O(this,i0,"f")),P(this,$2,Z.finalMessage(),"f"),O(this,$2,"f").catch(()=>{}),yield Z;else P(this,$2,this.client.beta.messages.create({...X,stream:!1},O(this,i0,"f")),"f"),yield O(this,$2,"f");if(!await O(this,z8,"m",RH).call(this)){if(!O(this,V$,"f")){let{role:W,content:U}=await O(this,$2,"f");O(this,R0,"f").params.messages.push({role:W,content:U})}let Y=await O(this,z8,"m",dz).call(this,O(this,R0,"f").params.messages.at(-1));if(Y)O(this,R0,"f").params.messages.push(Y);else if(!O(this,V$,"f"))break}}finally{if(Z)Z.abort()}}if(!O(this,$2,"f"))throw new y("ToolRunner concluded without a message from the server");O(this,F6,"f").resolve(await O(this,$2,"f"))}catch(Z){throw P(this,H1,!1,"f"),O(this,F6,"f").promise.catch(()=>{}),O(this,F6,"f").reject(Z),P(this,F6,FH(),"f"),Z}}setMessagesParams($){if(typeof $==="function")O(this,R0,"f").params=$(O(this,R0,"f").params);else O(this,R0,"f").params=$;P(this,V$,!0,"f"),P(this,$6,void 0,"f")}setRequestOptions($){if(typeof $==="function")P(this,i0,$(O(this,i0,"f")),"f");else P(this,i0,{...O(this,i0,"f"),...$},"f")}async generateToolResponse($=O(this,i0,"f").signal){let Z=await O(this,$2,"f")??this.params.messages.at(-1);if(!Z)return null;return O(this,z8,"m",dz).call(this,Z,$)}done(){return O(this,F6,"f").promise}async runUntilDone(){if(!O(this,H1,"f"))for await(let $ of this);return this.done()}get params(){return O(this,R0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};dz=async function(Z,z=O(this,i0,"f").signal){if(O(this,$6,"f")!==void 0)return O(this,$6,"f");return P(this,$6,Dx(O(this,R0,"f").params,Z,{...O(this,i0,"f"),signal:z}),"f"),O(this,$6,"f")}});var K1;var nz=g(()=>{d0();Bz();K1=class K1{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new C6;for await(let Z of this.iterator)for(let z of $.decode(Z))yield JSON.parse(z);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 y("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 y("Attempted to iterate over a response with no body")}return new K1(x4($.body),Z)}}});var J8;var rz=g(()=>{H0();W0();nz();W1();I0();J8=class J8 extends p{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/messages/batches/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",P2,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/messages/batches/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}cancel($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/messages/batches/${$}/cancel?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}async results($,Z={},z){let Q=await this.retrieve($);if(!Q.results_url)throw new y(`No batch \`results_url\`; Has it finished processing? ${Q.processing_status} - ${Q.id}`);let{betas:X}=Z??{};return this._client.get(Q.results_url,{...z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((J,Y)=>K1.fromResponse(Y.response,Y.controller))}}});function SH($){if(!$.output_format)return $;if($.output_config?.format)throw new y("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...z}=$;return{...z,output_config:{...$.output_config,format:Z}}}var PH,Tx,P6;var sz=g(()=>{W1();bz();W0();c4();hz();AH();iz();fZ();rz();rz();iz();fZ();PH={"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"},Tx=["claude-mythos-preview","claude-opus-4-6"];P6=class P6 extends p{constructor(){super(...arguments);this.batches=new J8(this._client)}create($,Z){let z=SH($),{betas:Q,...X}=z;if(X.model in PH)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${PH[X.model]}
196
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Tx.includes(X.model)&&X.thinking&&X.thinking.type==="enabled")console.warn(`Using Claude with ${X.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 J=this._client._options.timeout;if(!X.stream&&J==null){let W=jZ[X.model]??void 0;J=this._client.calculateNonstreamingTimeout(X.max_tokens,W)}let Y=EZ(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:D([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>gz(z,$,{logger:this._client.logger??console}))}stream($,Z){return Z8.createMessage(this,$,Z)}countTokens($,Z){let z=SH($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:D([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new X8(this._client,$,Z)}};P6.Batches=J8;P6.BetaToolRunner=X8;P6.ToolError=V1});var Y8;var oz=g(()=>{H0();W0();I0();Y8=class Y8 extends p{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/events?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}send($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}/events?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}stream($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/sessions/${$}/events/stream?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var W8;var az=g(()=>{H0();W0();I0();W8=class W8 extends p{retrieve($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.get(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{session_id:Q,betas:X,...J}=Z;return this._client.post(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/resources?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.delete(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}add($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}/resources?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var H$;var tz=g(()=>{oz();oz();az();az();H0();W0();I0();H$=class H$ extends p{constructor(){super(...arguments);this.events=new Y8(this._client),this.resources=new W8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/sessions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/sessions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/sessions/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};H$.Events=Y8;H$.Resources=W8});var U8;var ez=g(()=>{H0();W0();J1();I0();U8=class U8 extends p{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(R`/v1/skills/${$}/versions?beta=true`,X1({body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])},this._client))}retrieve($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.get(R`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/skills/${$}/versions?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}delete($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.delete(R`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var q1;var $Q=g(()=>{ez();ez();H0();W0();J1();I0();q1=class q1 extends p{constructor(){super(...arguments);this.versions=new U8(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",X1({body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/skills/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/skills/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};q1.Versions=U8});var G8;var ZQ=g(()=>{H0();W0();I0();G8=class G8 extends p{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.get(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{vault_id:Q,betas:X,...J}=Z;return this._client.post(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/vaults/${$}/credentials?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.delete(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.post(R`/v1/vaults/${Q}/credentials/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var B1;var zQ=g(()=>{ZQ();ZQ();H0();W0();I0();B1=class B1 extends p{constructor(){super(...arguments);this.credentials=new G8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/vaults/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/vaults/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/vaults/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};B1.Credentials=G8});var g0;var QQ=g(()=>{Rz();Rz();Pz();Pz();Sz();Sz();Ez();Ez();wz();wz();kz();kz();sz();sz();tz();tz();$Q();$Q();zQ();zQ();g0=class g0 extends p{constructor(){super(...arguments);this.models=new l4(this._client),this.messages=new P6(this._client),this.agents=new Y1(this._client),this.environments=new u4(this._client),this.sessions=new H$(this._client),this.vaults=new B1(this._client),this.memoryStores=new U$(this._client),this.files=new p4(this._client),this.skills=new q1(this._client),this.userProfiles=new d4(this._client)}};g0.Models=l4;g0.Messages=P6;g0.Agents=Y1;g0.Environments=u4;g0.Sessions=H$;g0.Vaults=B1;g0.MemoryStores=U$;g0.Files=p4;g0.Skills=q1;g0.UserProfiles=d4});var M1;var XQ=g(()=>{W0();M1=class M1 extends p{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function EH($){return $?.output_config?.format}function JQ($,Z,z){let Q=EH(Z);if(!Z||!("parse"in(Q??{})))return{...$,content:$.content.map((X)=>{if(X.type==="text")return Object.defineProperty({...X},"parsed_output",{value:null,enumerable:!1});return X}),parsed_output:null};return YQ($,Z,z)}function YQ($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=jx(Z,J.text);if(Q===null)Q=Y;return Object.defineProperty({...J},"parsed_output",{value:Y,enumerable:!1})}return J});return{...$,content:X,parsed_output:Q}}function jx($,Z){let z=EH($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new y(`Failed to parse structured output: ${Q}`)}}var WQ=g(()=>{d0()});function yH($){return $.type==="tool_use"||$.type==="server_tool_use"}function kH($){}var q2,S6,L1,V8,uZ,H8,K8,mZ,q8,Z6,B8,cZ,pZ,K$,lZ,dZ,M8,UQ,jH,GQ,VQ,HQ,KQ,wH,xH="__json_buf",L8;var bH=g(()=>{o2();W1();uz();fz();WQ();L8=class L8{constructor($,Z){q2.add(this),this.messages=[],this.receivedMessages=[],S6.set(this,void 0),L1.set(this,null),this.controller=new AbortController,V8.set(this,void 0),uZ.set(this,()=>{}),H8.set(this,()=>{}),K8.set(this,void 0),mZ.set(this,()=>{}),q8.set(this,()=>{}),Z6.set(this,{}),B8.set(this,!1),cZ.set(this,!1),pZ.set(this,!1),K$.set(this,!1),lZ.set(this,void 0),dZ.set(this,void 0),M8.set(this,void 0),GQ.set(this,(z)=>{if(P(this,cZ,!0,"f"),a2(z))z=new x0;if(z instanceof x0)return P(this,pZ,!0,"f"),this._emit("abort",z);if(z instanceof y)return this._emit("error",z);if(z instanceof Error){let Q=new y(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new y(String(z)))}),P(this,V8,new Promise((z,Q)=>{P(this,uZ,z,"f"),P(this,H8,Q,"f")}),"f"),P(this,K8,new Promise((z,Q)=>{P(this,mZ,z,"f"),P(this,q8,Q,"f")}),"f"),O(this,V8,"f").catch(()=>{}),O(this,K8,"f").catch(()=>{}),P(this,L1,$,"f"),P(this,M8,Z?.logger??console,"f")}get response(){return O(this,lZ,"f")}get request_id(){return O(this,dZ,"f")}async withResponse(){P(this,K$,!0,"f");let $=await O(this,V8,"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 L8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new L8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return P(X,L1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},O(this,GQ,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{O(this,q2,"m",VQ).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)O(this,q2,"m",HQ).call(this,W);if(Y.controller.signal?.aborted)throw new x0;O(this,q2,"m",KQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;P(this,lZ,$,"f"),P(this,dZ,$?.headers.get("request-id"),"f"),O(this,uZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,B8,"f")}get errored(){return O(this,cZ,"f")}get aborted(){return O(this,pZ,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,Z6,"f")[$]||(O(this,Z6,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,Z6,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(O(this,Z6,"f")[$]||(O(this,Z6,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(P(this,K$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){P(this,K$,!0,"f"),await O(this,K8,"f")}get currentMessage(){return O(this,S6,"f")}async finalMessage(){return await this.done(),O(this,q2,"m",UQ).call(this)}async finalText(){return await this.done(),O(this,q2,"m",jH).call(this)}_emit($,...Z){if(O(this,B8,"f"))return;if($==="end")P(this,B8,!0,"f"),O(this,mZ,"f").call(this);let z=O(this,Z6,"f")[$];if(z)O(this,Z6,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,K$,"f")&&!z?.length)Promise.reject(Q);O(this,H8,"f").call(this,Q),O(this,q8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,K$,"f")&&!z?.length)Promise.reject(Q);O(this,H8,"f").call(this,Q),O(this,q8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,q2,"m",UQ).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,Q;if(z){if(z.aborted)this.controller.abort();Q=this.controller.abort.bind(this.controller),z.addEventListener("abort",Q)}try{O(this,q2,"m",VQ).call(this),this._connected(null);let X=e0.fromReadableStream($,this.controller);for await(let J of X)O(this,q2,"m",HQ).call(this,J);if(X.controller.signal?.aborted)throw new x0;O(this,q2,"m",KQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(S6=new WeakMap,L1=new WeakMap,V8=new WeakMap,uZ=new WeakMap,H8=new WeakMap,K8=new WeakMap,mZ=new WeakMap,q8=new WeakMap,Z6=new WeakMap,B8=new WeakMap,cZ=new WeakMap,pZ=new WeakMap,K$=new WeakMap,lZ=new WeakMap,dZ=new WeakMap,M8=new WeakMap,GQ=new WeakMap,q2=new WeakSet,UQ=function(){if(this.receivedMessages.length===0)throw new y("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},jH=function(){if(this.receivedMessages.length===0)throw new y("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new y("stream ended without producing a content block with type=text");return Z.join(" ")},VQ=function(){if(this.ended)return;P(this,S6,void 0,"f")},HQ=function(Z){if(this.ended)return;let z=O(this,q2,"m",wH).call(this,Z);switch(this._emit("streamEvent",Z,z),Z.type){case"content_block_delta":{let Q=z.content.at(-1);switch(Z.delta.type){case"text_delta":{if(Q.type==="text")this._emit("text",Z.delta.text,Q.text||"");break}case"citations_delta":{if(Q.type==="text")this._emit("citation",Z.delta.citation,Q.citations??[]);break}case"input_json_delta":{if(yH(Q)&&Q.input)this._emit("inputJson",Z.delta.partial_json,Q.input);break}case"thinking_delta":{if(Q.type==="thinking")this._emit("thinking",Z.delta.thinking,Q.thinking);break}case"signature_delta":{if(Q.type==="thinking")this._emit("signature",Q.signature);break}default:kH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(JQ(z,O(this,L1,"f"),{logger:O(this,M8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{P(this,S6,z,"f");break}case"content_block_start":case"message_delta":break}},KQ=function(){if(this.ended)throw new y("stream has ended, this shouldn't happen");let Z=O(this,S6,"f");if(!Z)throw new y("request ended without sending any chunks");return P(this,S6,void 0,"f"),JQ(Z,O(this,L1,"f"),{logger:O(this,M8,"f")})},wH=function(Z){let z=O(this,S6,"f");if(Z.type==="message_start"){if(z)throw new y(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new y(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;return z;case"content_block_start":return z.content.push({...Z.content_block}),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&yH(Q)){let X=Q[xH]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,xH,{value:X,enumerable:!1,writable:!0}),X)J.input=wZ(X);z.content[Z.index]=J}break}case"thinking_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,thinking:Q.thinking+Z.delta.thinking};break}case"signature_delta":{if(Q?.type==="thinking")z.content[Z.index]={...Q,signature:Z.delta.signature};break}default:kH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,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 e0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var N8;var qQ=g(()=>{H0();W0();nz();W1();I0();N8=class N8 extends p{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(R`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",P2,{query:$,...Z})}delete($,Z){return this._client.delete(R`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(R`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let z=await this.retrieve($);if(!z.results_url)throw new y(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:D([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>K1.fromResponse(X.response,X.controller))}}});var q$,vH,xx;var BQ=g(()=>{W0();c4();bH();WQ();qQ();qQ();bz();q$=class q$ extends p{constructor(){super(...arguments);this.batches=new N8(this._client)}create($,Z){if($.model in vH)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${vH[$.model]}
197
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(xx.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 z=this._client._options.timeout;if(!$.stream&&z==null){let X=jZ[$.model]??void 0;z=this._client.calculateNonstreamingTimeout($.max_tokens,X)}let Q=EZ($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:D([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>YQ(z,$,{logger:this._client.logger??console}))}stream($,Z){return L8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};vH={"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"},xx=["claude-mythos-preview","claude-opus-4-6"];q$.Batches=N8});var N1;var MQ=g(()=>{H0();W0();I0();N1=class N1 extends p{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}`,{...z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",P2,{query:Q,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var gH=g(()=>{QQ();XQ();BQ();MQ();HH()});var O8=($)=>{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 U0{constructor({baseURL:$=O8("ANTHROPIC_BASE_URL"),apiKey:Z=O8("ANTHROPIC_API_KEY")??null,authToken:z=O8("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){LQ.add(this),iZ.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&sV())throw new y(`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=X.baseURL,this.timeout=X.timeout??UQ.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=Yz(X.logLevel,"ClientOptions.logLevel",this)??Yz(L8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??fV(),F(this,cZ,mV,"f"),this._options=X,this.apiKey=typeof Z==="string"?Z:null,this.authToken=z}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 O([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return O([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return O([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return cV($)}getUserAgent(){return`${this.constructor.name}/JS ${I6}`}defaultIdempotencyKey(){return`stainless-node-retry-${t9()}`}makeStatusError($,Z,z,Q){return O0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!D(this,WQ,"m",PH).call(this)&&z||this.baseURL,X=jV($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!Zz(J)||!Zz(Y))Z={...Y,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))X.search=this.stringifyQuery(Z);return X.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new x("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:z}){}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,z){return this.request(Promise.resolve(z).then((Q)=>{return{method:$,path:Z,...Q}}))}request($,Z=null){return new A6(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,z){let Q=await $,X=Q.maxRetries??this.maxRetries;if(Z==null)Z=X;await this.prepareOptions(Q);let{req:J,url:Y,timeout:W}=await this.buildRequest(Q,{retryCount:X-Z});await this.prepareRequest(J,{url:Y,options:Q});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=z===void 0?"":`, retryOf: ${z}`,V=Date.now();if(E0(this).debug(`[${U}] sending request`,o2({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new x0;let H=new AbortController,K=await this.fetchWithTimeout(Y,J,W,H).catch(E4),q=Date.now();if(K instanceof globalThis.Error){let N=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new x0;let I=s2(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return E0(this).info(`[${U}] connection ${I?"timed out":"failed"} - ${N}`),E0(this).debug(`[${U}] connection ${I?"timed out":"failed"} (${N})`,o2({retryOfRequestLogID:z,url:Y,durationMs:q-V,message:K.message})),this.retryRequest(Q,Z,z??U);if(E0(this).info(`[${U}] connection ${I?"timed out":"failed"} - error; no more retries left`),E0(this).debug(`[${U}] connection ${I?"timed out":"failed"} (error; no more retries left)`,o2({retryOfRequestLogID:z,url:Y,durationMs:q-V,message:K.message})),I)throw new i$;throw new O6({cause:K})}let L=[...K.headers.entries()].filter(([N])=>N==="request-id").map(([N,I])=>", "+N+": "+JSON.stringify(I)).join(""),B=`[${U}${G}${L}] ${J.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${q-V}ms`;if(!K.ok){let N=await this.shouldRetry(K);if(Z&&N){let j=`retrying, ${Z} attempts remaining`;return await uV(K.body),E0(this).info(`${B} - ${j}`),E0(this).debug(`[${U}] response error (${j})`,o2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:q-V})),this.retryRequest(Q,Z,z??U,K.headers)}let I=N?"error; no more retries left":"error; not retryable";E0(this).info(`${B} - ${I}`);let _=await K.text().catch((j)=>E4(j).message),y=LZ(_),E=y?void 0:_;throw E0(this).debug(`[${U}] response error (${I})`,o2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,message:E,durationMs:Date.now()-V})),this.makeStatusError(K.status,y,E,K.headers)}return E0(this).info(B),E0(this).debug(`[${U}] response start`,o2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:q-V})),{response:K,options:Q,controller:H,requestLogID:U,retryOfRequestLogID:z,startTime:V}}getAPIList($,Z,z){return this.requestAPIList(Z,z&&"then"in z?z.then((Q)=>({method:"get",path:$,...Q})):{method:"get",path:$,...z})}requestAPIList($,Z){let z=this.makeRequest(Z,null,void 0);return new b4(this,z,$)}async fetchWithTimeout($,Z,z,Q){let{signal:X,method:J,...Y}=Z||{},W=this._makeAbort(Q);if(X)X.addEventListener("abort",W,{once:!0});let U=setTimeout(W,z),G=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,V={signal:Q.signal,...G?{duplex:"half"}:{},method:"GET",...Y};if(J)V.method=J.toUpperCase();try{return await this.fetch.call(void 0,$,V)}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,z,Q){let X,J=Q?.get("retry-after-ms");if(J){let W=parseFloat(J);if(!Number.isNaN(W))X=W}let Y=Q?.get("retry-after");if(Y&&!X){let W=parseFloat(Y);if(!Number.isNaN(W))X=W*1000;else X=Date.parse(Y)-Date.now()}if(X===void 0){let W=$.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await yV(X),this.makeRequest($,Z-1,z)}calculateDefaultRetryTimeoutMillis($,Z){let X=Z-$,J=Math.min(0.5*Math.pow(2,X),8),Y=1-Math.random()*0.25;return J*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new x("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 z={...$},{method:Q,path:X,query:J,defaultBaseURL:Y}=z,W=this.buildURL(X,J,Y);if("timeout"in z)xV("timeout",z.timeout);z.timeout=z.timeout??this.timeout;let{bodyHeaders:U,body:G}=this.buildBody({options:z}),V=await this.buildHeaders({options:$,method:Q,bodyHeaders:U,retryCount:Z});return{req:{method:Q,headers:V,...z.signal&&{signal:z.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...z.fetchOptions??{}},url:W,timeout:z.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:z,retryCount:Q}){let X={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let J=O([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...hV(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,z,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let z=O([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&z.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:NZ($)};else if(typeof $==="object"&&z.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return D(this,cZ,"f").call(this,{body:$,headers:z})}}var WQ,UQ,cZ,PH,GQ="\\n\\nHuman:",VQ="\\n\\nAssistant:",F6;var HQ=v(()=>{r2();z$();zz();pV();d0();H0();Mz();RH();AZ();sz();YQ();rz();JQ();zz();W0();IZ();z$();UQ=U0,cZ=new WeakMap,WQ=new WeakSet,PH=function(){return this.baseURL!=="https://api.anthropic.com"};U0.Anthropic=UQ;U0.HUMAN_PROMPT=GQ;U0.AI_PROMPT=VQ;U0.DEFAULT_TIMEOUT=600000;U0.AnthropicError=x;U0.APIError=O0;U0.APIConnectionError=O6;U0.APIConnectionTimeoutError=i$;U0.APIUserAbortError=x0;U0.NotFoundError=o$;U0.ConflictError=a$;U0.RateLimitError=e$;U0.BadRequestError=n$;U0.AuthenticationError=r$;U0.InternalServerError=$1;U0.PermissionDeniedError=s$;U0.UnprocessableEntityError=t$;U0.toFile=g4;F6=class F6 extends U0{constructor(){super(...arguments);this.completions=new K1(this),this.messages=new G$(this),this.models=new B1(this),this.beta=new g0(this)}};F6.Completions=K1;F6.Messages=G$;F6.Models=B1;F6.Beta=g0});var FH={};RQ(FH,{toFile:()=>g4,default:()=>F6,UnprocessableEntityError:()=>t$,RateLimitError:()=>e$,PermissionDeniedError:()=>s$,PagePromise:()=>b4,NotFoundError:()=>o$,InternalServerError:()=>$1,HUMAN_PROMPT:()=>GQ,ConflictError:()=>a$,BaseAnthropic:()=>U0,BadRequestError:()=>n$,AuthenticationError:()=>r$,AnthropicError:()=>x,Anthropic:()=>F6,APIUserAbortError:()=>x0,APIPromise:()=>A6,APIError:()=>O0,APIConnectionTimeoutError:()=>i$,APIConnectionError:()=>O6,AI_PROMPT:()=>VQ});var SH=v(()=>{HQ();Mz();AZ();HQ();H0();d0()});var cQ=HK(mQ(),1),{program:gy,createCommand:hy,createArgument:fy,createOption:uy,CommanderError:my,InvalidArgumentError:cy,InvalidOptionArgumentError:py,Command:pQ,Argument:ly,Option:dy,Help:iy}=cQ.default;import{lstatSync as nY}from"fs";import{join as lY,dirname as P5,basename as tA,resolve as S$}from"path";import{execFileSync as eA}from"child_process";var LT=a7(),NT=b1(),DT=b7(),G3=v1(),OT=T1(),U6=t(),IT=Q6(),TT=N0(),AT=J6(),CT=Y6(),Hb=W5(),_T=Y3(),RT=W3(),PT=U3(),H5=aJ(),tJ=O1();var FT=LT.Composer,K5=NT.Document,ST=DT.Schema,ET=G3.YAMLError,q5=G3.YAMLParseError,jT=G3.YAMLWarning,wT=OT.Alias,g2=U6.isAlias,b6=U6.isCollection,xT=U6.isDocument,q0=U6.isMap,L2=U6.isNode,yT=U6.isPair,C0=U6.isScalar,h2=U6.isSeq,kT=IT.Pair,bT=TT.Scalar,A$=AT.YAMLMap,c1=CT.YAMLSeq;var vT=_T.Lexer,gT=RT.LineCounter,hT=PT.Parser,r0=H5.parse,fT=H5.parseAllDocuments,v6=H5.parseDocument,g6=H5.stringify,uT=tJ.visit,mT=tJ.visitAsync;import{accessSync as eJ,closeSync as M5,constants as $Y,existsSync as cT,fchmodSync as ZY,fchownSync as pT,fsyncSync as zY,lstatSync as l1,mkdirSync as QY,mkdtempSync as lT,openSync as B3,readdirSync as XY,readFileSync as L5,readlinkSync as dT,realpathSync as iT,renameSync as nT,rmSync as JY,statSync as C$,unlinkSync as YY,writeFileSync as WY}from"fs";import{randomBytes as rT}from"crypto";import{tmpdir as UY}from"os";import{basename as G6,dirname as h6,isAbsolute as GY,join as j2,relative as M3,resolve as Q2,sep as B5}from"path";class b extends Error{reason;path;onWrite;constructor($,Z,z,Q={}){super(z,Q.cause===void 0?void 0:{cause:Q.cause});this.name="SafePathError",this.reason=$,this.path=Z,this.onWrite=Q.onWrite===!0}}var y0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),sT=new Set(Object.values(y0).map(($)=>$.toLowerCase())),oT=($,Z)=>$.toLowerCase()===Z.toLowerCase(),V3=($)=>sT.has($.toLowerCase());function _$($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var aT=/\.fafm?$/i,tT=/^[a-z][a-z0-9-]*$/,N2=($)=>iT.native($),V6=($)=>$?.code;function d1($,Z){let z=M3($,Z);return z===""||z!==".."&&!z.startsWith(`..${B5}`)&&!GY(z)}function VY($){try{return dT($)}catch{return"?"}}function eT($,Z,z,Q){let X;try{X=N2(z)}catch(J){let Y=V6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new b("dangling",Z,`${Z} is a link to ${VY(z)}, which does not exist. faf does not create files through a link — refused.`);throw J}if(!d1($,X))throw new b("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(_$(X)&&!(Q.inGit&&h6(X)===$))throw new b("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!C$(X).isFile())throw new b("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return $A(Z,X,Q.read),X}function $A($,Z,z){let Q=G6($),X=G6(Z),J=V3(Q)&&V3(X);if(z&&!aT.test(X)&&!J){let Y=V3(Q)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new b("not-faf",$,`${$} is a link to ${Z}, which is not ${Y} — refused.`)}if(!z&&!oT(Q,X)&&!J)throw new b("other-file",$,`${$} is a link to ${Z}, a file with another name — refused (faf follows a link only to a file of the same name, or from one AI context file to another).`)}function ZA($,Z,z,Q){if(G6(Q2($))!=="hooks"||!tT.test(G6(Z)))throw new b("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(Q!==z)throw new b("git",Z,`${Z} is not directly in the hooks folder ${z} — refused.`)}function zA($,Z,z){if(G6($)!=="config"||z!==Z)throw new b("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function l($,Z,z={}){let Q=N2(Q2($)),X=Q2($,Z),J=N2(h6(X));if(!d1(Q,J))throw new b("outside",X,`${X} is in ${J}, outside ${Q} — refused.`);let Y=z.allowGitHooks===!0,W=z.allowGitConfig===!0;if(Y)ZA($,X,Q,J);if(W)zA(X,Q,J);let U=j2(J,G6(X));if(_$(U)&&!Y&&!W)throw new b("git",X,U===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${U}, inside .git/ — refused.`);let G;try{G=l1(U)}catch(V){if(V6(V)==="ENOENT")return U;throw V}if(G.isSymbolicLink())return eT(Q,X,U,{read:z.read===!0,inGit:Y||W});if(!G.isFile())throw new b("not-a-file",X,`${X} is not a regular file — refused.`);return N2(U)}var QA=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function XA($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return QA.decode($)}catch{}throw new b("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function Q0($){return XA(L5($),$)}function k0($){try{return L5($)}catch(Z){if(V6(Z)==="ENOENT")return null;throw Z}}function p1($,Z){let z=Q2(j2($,Z));if(!cT(z))return null;let Q,X;try{Q=N2(JA($)),X=N2(z)}catch{return null}if(!d1(Q,X)||_$(M3(Q,X)))return null;return X}var K3=[];function JA($){let Z=Q2($);return K3.find((z)=>Z===z||Z.startsWith(z.endsWith(B5)?z:z+B5))??Z}function R$($,Z){K3.push(Q2($));try{return Z()}finally{K3.pop()}}function A($,Z){return p1($,Z)!==null}function m($,Z){let z=p1($,Z);if(z===null)return null;try{return C$(z).isFile()?L5(z,"utf-8"):null}catch{return null}}function D2($,Z){let z=p1($,Z);if(z===null)return null;try{return C$(z)}catch{return null}}function X0($,Z="."){let z=p1($,Z);if(z===null)return null;let Q;try{Q=XY(z,{withFileTypes:!0})}catch{return null}return Q.filter((X)=>!X.isSymbolicLink()||p1($,j2(Z,X.name))!==null)}function YA($){try{let Z=C$($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(V6(Z)==="ENOENT")return;throw Z}}class f2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var H3=($)=>new b("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function L3($,Z,z){if(Z!==void 0){let X=k0($),J=Z===null?null:typeof Z==="string"?Buffer.from(Z,"utf-8"):Buffer.from(Z);if(!(X===null||J===null?X===J:X.equals(J)))throw H3($)}if(!z)return;let Q;try{Q=C$($)}catch(X){if(V6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw H3($);try{eJ($,$Y.W_OK)}catch{throw H3($)}}function WA($,Z){if(process.platform!=="win32")try{pT($,Z.uid,Z.gid)}catch{}ZY($,Z.mode)}function UA($){if(process.platform==="win32")return;try{let Z=B3($,"r");try{zY(Z)}finally{M5(Z)}}catch{}}function GA($,Z,z,Q){if($.fd=B3($.path,"wx",Q??z?.mode??438),$.created=!0,WY($.fd,Z),z)WA($.fd,z);if(Q!==void 0)ZY($.fd,Q);zY($.fd),M5($.fd),$.fd=void 0}function VA($){if($.fd!==void 0)try{M5($.fd)}catch{}if($.created)try{YY($.path)}catch{}}function HA($,Z,z){let Q=h6($),X={path:j2(Q,`.${G6($).slice(0,100)}.${process.pid}.${rT(6).toString("hex")}.faf-tmp`),created:!1},J=YA($);try{if(J)eJ($,$Y.W_OK);GA(X,Z,J,z.mode),L3($,z.expect,J),nT(X.path,$)}catch(Y){if(VA(X),Y instanceof b)throw Y;let W=V6(Y)??(Y instanceof Error?Y.message:String(Y));throw new f2($,`${$}: not written${J?"; original kept":""} (${W})`,{cause:Y})}UA(Q)}function KA($){return $ instanceof b&&!$.onWrite?new b($.reason,$.path,$.message,{onWrite:!0}):$}function a($,Z,z={}){let Q=Q2($),X;try{X=l(z.root??h6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw KA(J)}return HA(X,Z,z),X}function w2($,Z,z){let Q=Q2($),X=z.root??h6(Q),J=l(X,Q),Y=k0(J);if(z.expect!==void 0)L3(J,z.expect,void 0);if(Y!==null&&z.force!==!0&&!z.owns(Y))throw new b("not-owned",Q,`${Q} has no ${z.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return a(J,Z,{root:X,expect:Y})}function w0($,Z=$){let z=Q2($);QY(z,{recursive:!0});let Q=N2(z),X=Q2(z,Z),J=M3(z,X);if(J===".."||J.startsWith(`..${B5}`)||GY(J))throw new b("outside",X,`${X} is outside ${Q} — refused.`,{onWrite:!0});let Y=Q;for(let W of J.split(/[\\/]/).filter(Boolean)){let U=j2(Y,W);if(_$(U))throw new b("git",X,`${X} runs through ${U}, inside .git/ — refused.`,{onWrite:!0});Y=qA(Q,X,U)}return Y}function qA($,Z,z){let Q;try{Q=l1(z)}catch(J){if(V6(J)!=="ENOENT")throw J;return QY(z),z}let X=z;if(Q.isSymbolicLink()){try{X=N2(z)}catch{throw new b("dangling",Z,`${z} is a link to ${VY(z)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!d1($,X))throw new b("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(_$(X))throw new b("git",Z,`${z} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!C$(X).isDirectory())throw new b("not-a-file",Z,`${z} is not a folder — refused.`,{onWrite:!0});return X}function N5($,Z){let z=Q2($),Q=N2(Q2(Z.root??h6(z))),X=N2(h6(z));if(!d1(Q,X))throw new b("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=j2(X,G6(z));if(_$(J))throw new b("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=l1(J)}catch(W){if(V6(W)==="ENOENT")return!1;throw W}if(!Y.isFile())throw new b("not-a-file",z,`${z} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return L3(J,Z.expect,void 0),YY(J),!0}var q3=new Set,HY=".faf-temp",KY="faf made this temp folder; `faf clear` removes it.\n";function D5($){let Z=N2(lT(j2(UY(),$)));q3.add(Z);let z=B3(j2(Z,HY),"wx",420);try{WY(z,KY)}finally{M5(z)}return Z}function O5($){if(!q3.has($))throw Error(`${$} is not a temp folder faf made — not removed`);JY($,{recursive:!0,force:!0}),q3.delete($)}function BA($){let Z=j2($,HY);try{if(!l1(Z).isFile())return!1;return L5(Z,"utf-8")===KY}catch{return!1}}var MA=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function qY($){let Z=UY(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${MA($)}[A-Za-z0-9]{6}$`),X=0;for(let J of XY(Z)){if(!Q.test(J))continue;let Y=j2(Z,J);try{let W=l1(Y);if(!W.isDirectory()||z!==void 0&&W.uid!==z||!BA(Y))continue;JY(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function $0($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function f6($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if($===null||$===void 0)return"empty";if(typeof $==="string"){let Z=$.length>40?`${$.slice(0,40)}…`:$;return`a string (${JSON.stringify(Z)})`}if(typeof $==="object")return"a mapping";return`a ${typeof $} (${String($)})`}function i1($,Z){if($===null||$===void 0)return{};if(!$0($))throw new b("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${f6($)}. `+"faf left it unchanged — fix it by hand.");return $}var J0=[{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"}],H6=new Map(J0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),BY=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),Ib=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function n1($,Z){let z=(X)=>{let J=X.split("."),Y=$;for(let W of J)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},Q=z(Z.path);if(Q!==void 0)return Q;if(Z.canonical)return z(Z.canonical);return}var Tb=J0.filter(($)=>$.index<=21);var N3=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]);var r1="slotignored";function P$($){return typeof $==="string"&&$.trim()!==""&&G0($)}function G0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return N3.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var F$="no classifying signals — fallback",LA=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]);function m6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(u6,$))return null;if(!u6[$].includes(Z.category))return!1;return!($==="framework"&&LA.has(Z.path))}var u6={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 IY=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function MY($){return typeof $==="object"&&$.collection===void 0}function NA($,Z){let z=$.source;if(typeof z!=="string"||z.includes(`
205
- `)||typeof $.value!=="number")return;let Q=Z.find((J)=>J.default===!0&&J.test?.test(z));if(!Q||!IY.has(Q.tag))return;let X;try{X=Q.resolve(z,()=>{return},{})}catch{return}return Object.is(C0(X)?X.value:X,$.value)?z:void 0}function DA($){let Z=$.filter(MY);return $.map((z)=>{if(!MY(z)||!IY.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,W)=>NA(X,Z)??Q(X,J,Y,W)}})}var I5={keepSourceTokens:!0,customTags:DA};function OA($,Z){let z=/^( *)[^\s#-][^#]*?:[ \t]*(?:#.*)?$/.exec($),Q=/^( *)(\S)/.exec(Z);if(!z||!Q||Q[2]==="#")return{};let X=Q[1].length-z[1].length;if(Q[2]==="-")return X>=0?{indentSeq:X>0}:{};return X>=1&&X<=8?{indent:X}:{}}function IA($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=OA(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function A3($,Z){let z=v6($,I5);if(z.errors.length>0){let Q=z.errors[0].message.split(`
206
- `)[0];throw Error(`${Z}: not valid YAML (${Q}) — faf left it unchanged.`,{cause:z.errors[0]})}return z}function c6($,Z,z,Q){$.edits.push({start:Z,end:z,text:Q,seq:$.edits.length})}function s1($,Z){return $.lastIndexOf(`
207
- `,Z-1)+1}function TY($,Z){if(Z>0&&$[Z-1]===`
204
+ `);this.baseURL=X.baseURL,this.timeout=X.timeout??NQ.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=Mz(X.logLevel,"ClientOptions.logLevel",this)??Mz(O8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??aV(),P(this,iZ,eV,"f"),this._options=X,this.apiKey=typeof Z==="string"?Z:null,this.authToken=z}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 $H($)}getUserAgent(){return`${this.constructor.name}/JS ${A6}`}defaultIdempotencyKey(){return`stainless-node-retry-${Wz()}`}makeStatusError($,Z,z,Q){return D0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!O(this,LQ,"m",hH).call(this)&&z||this.baseURL,X=cV($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!Vz(J)||!Vz(Y))Z={...Y,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))X.search=this.stringifyQuery(Z);return X.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new y("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:z}){}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,z){return this.request(Promise.resolve(z).then((Q)=>{return{method:$,path:Z,...Q}}))}request($,Z=null){return new _6(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,z){let Q=await $,X=Q.maxRetries??this.maxRetries;if(Z==null)Z=X;await this.prepareOptions(Q);let{req:J,url:Y,timeout:W}=await this.buildRequest(Q,{retryCount:X-Z});await this.prepareRequest(J,{url:Y,options:Q});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=z===void 0?"":`, retryOf: ${z}`,V=Date.now();if(E0(this).debug(`[${U}] sending request`,t2({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new x0;let H=new AbortController,K=await this.fetchWithTimeout(Y,J,W,H).catch(w4),q=Date.now();if(K instanceof globalThis.Error){let N=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new x0;let I=a2(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return E0(this).info(`[${U}] connection ${I?"timed out":"failed"} - ${N}`),E0(this).debug(`[${U}] connection ${I?"timed out":"failed"} (${N})`,t2({retryOfRequestLogID:z,url:Y,durationMs:q-V,message:K.message})),this.retryRequest(Q,Z,z??U);if(E0(this).info(`[${U}] connection ${I?"timed out":"failed"} - error; no more retries left`),E0(this).debug(`[${U}] connection ${I?"timed out":"failed"} (error; no more retries left)`,t2({retryOfRequestLogID:z,url:Y,durationMs:q-V,message:K.message})),I)throw new s$;throw new T6({cause:K})}let L=[...K.headers.entries()].filter(([N])=>N==="request-id").map(([N,I])=>", "+N+": "+JSON.stringify(I)).join(""),B=`[${U}${G}${L}] ${J.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${q-V}ms`;if(!K.ok){let N=await this.shouldRetry(K);if(Z&&N){let j=`retrying, ${Z} attempts remaining`;return await tV(K.body),E0(this).info(`${B} - ${j}`),E0(this).debug(`[${U}] response error (${j})`,t2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:q-V})),this.retryRequest(Q,Z,z??U,K.headers)}let I=N?"error; no more retries left":"error; not retryable";E0(this).info(`${B} - ${I}`);let _=await K.text().catch((j)=>w4(j).message),w=IZ(_),E=w?void 0:_;throw E0(this).debug(`[${U}] response error (${I})`,t2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,message:E,durationMs:Date.now()-V})),this.makeStatusError(K.status,w,E,K.headers)}return E0(this).info(B),E0(this).debug(`[${U}] response start`,t2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:q-V})),{response:K,options:Q,controller:H,requestLogID:U,retryOfRequestLogID:z,startTime:V}}getAPIList($,Z,z){return this.requestAPIList(Z,z&&"then"in z?z.then((Q)=>({method:"get",path:$,...Q})):{method:"get",path:$,...z})}requestAPIList($,Z){let z=this.makeRequest(Z,null,void 0);return new g4(this,z,$)}async fetchWithTimeout($,Z,z,Q){let{signal:X,method:J,...Y}=Z||{},W=this._makeAbort(Q);if(X)X.addEventListener("abort",W,{once:!0});let U=setTimeout(W,z),G=globalThis.ReadableStream&&Y.body instanceof globalThis.ReadableStream||typeof Y.body==="object"&&Y.body!==null&&Symbol.asyncIterator in Y.body,V={signal:Q.signal,...G?{duplex:"half"}:{},method:"GET",...Y};if(J)V.method=J.toUpperCase();try{return await this.fetch.call(void 0,$,V)}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,z,Q){let X,J=Q?.get("retry-after-ms");if(J){let W=parseFloat(J);if(!Number.isNaN(W))X=W}let Y=Q?.get("retry-after");if(Y&&!X){let W=parseFloat(Y);if(!Number.isNaN(W))X=W*1000;else X=Date.parse(Y)-Date.now()}if(X===void 0){let W=$.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(Z,W)}return await dV(X),this.makeRequest($,Z-1,z)}calculateDefaultRetryTimeoutMillis($,Z){let X=Z-$,J=Math.min(0.5*Math.pow(2,X),8),Y=1-Math.random()*0.25;return J*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new y("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 z={...$},{method:Q,path:X,query:J,defaultBaseURL:Y}=z,W=this.buildURL(X,J,Y);if("timeout"in z)lV("timeout",z.timeout);z.timeout=z.timeout??this.timeout;let{bodyHeaders:U,body:G}=this.buildBody({options:z}),V=await this.buildHeaders({options:$,method:Q,bodyHeaders:U,retryCount:Z});return{req:{method:Q,headers:V,...z.signal&&{signal:z.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...z.fetchOptions??{}},url:W,timeout:z.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:z,retryCount:Q}){let X={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let J=D([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...oV(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,z,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let z=D([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&z.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:TZ($)};else if(typeof $==="object"&&z.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return O(this,iZ,"f").call(this,{body:$,headers:z})}}var LQ,NQ,iZ,hH,OQ="\\n\\nHuman:",DQ="\\n\\nAssistant:",E6;var IQ=g(()=>{o2();Y$();Hz();ZH();d0();H0();_z();gH();FZ();XQ();MQ();QQ();BQ();Hz();W0();_Z();Y$();NQ=U0,iZ=new WeakMap,LQ=new WeakSet,hH=function(){return this.baseURL!=="https://api.anthropic.com"};U0.Anthropic=NQ;U0.HUMAN_PROMPT=OQ;U0.AI_PROMPT=DQ;U0.DEFAULT_TIMEOUT=600000;U0.AnthropicError=y;U0.APIError=D0;U0.APIConnectionError=T6;U0.APIConnectionTimeoutError=s$;U0.APIUserAbortError=x0;U0.NotFoundError=e$;U0.ConflictError=$1;U0.RateLimitError=z1;U0.BadRequestError=o$;U0.AuthenticationError=a$;U0.InternalServerError=Q1;U0.PermissionDeniedError=t$;U0.UnprocessableEntityError=Z1;U0.toFile=f4;E6=class E6 extends U0{constructor(){super(...arguments);this.completions=new M1(this),this.messages=new q$(this),this.models=new N1(this),this.beta=new g0(this)}};E6.Completions=M1;E6.Messages=q$;E6.Models=N1;E6.Beta=g0});var fH={};kQ(fH,{toFile:()=>f4,default:()=>E6,UnprocessableEntityError:()=>Z1,RateLimitError:()=>z1,PermissionDeniedError:()=>t$,PagePromise:()=>g4,NotFoundError:()=>e$,InternalServerError:()=>Q1,HUMAN_PROMPT:()=>OQ,ConflictError:()=>$1,BaseAnthropic:()=>U0,BadRequestError:()=>o$,AuthenticationError:()=>a$,AnthropicError:()=>y,Anthropic:()=>E6,APIUserAbortError:()=>x0,APIPromise:()=>_6,APIError:()=>D0,APIConnectionTimeoutError:()=>s$,APIConnectionError:()=>T6,AI_PROMPT:()=>DQ});var uH=g(()=>{IQ();_z();FZ();IQ();H0();d0()});var aQ=CK(oQ(),1),{program:zk,createCommand:Qk,createArgument:Xk,createOption:Jk,CommanderError:Yk,InvalidArgumentError:Wk,InvalidOptionArgumentError:Uk,Command:tQ,Argument:Gk,Option:Vk,Help:Hk}=aQ.default;import{lstatSync as zW}from"fs";import{join as eY,dirname as S5,basename as VC,resolve as x$}from"path";import{execFileSync as HC}from"child_process";var ST=Z3(),ET=h1(),jT=f7(),q3=f1(),wT=_1(),V6=t(),xT=J6(),yT=N0(),kT=W6(),bT=U6(),jb=G5(),vT=V3(),gT=H3(),hT=K3(),q5=YY(),WY=A1();var fT=ST.Composer,B5=ET.Document,uT=jT.Schema,mT=q3.YAMLError,M5=q3.YAMLParseError,cT=q3.YAMLWarning,pT=wT.Alias,h2=V6.isAlias,g6=V6.isCollection,lT=V6.isDocument,q0=V6.isMap,N2=V6.isNode,dT=V6.isPair,C0=V6.isScalar,f2=V6.isSeq,iT=xT.Pair,nT=yT.Scalar,F$=kT.YAMLMap,d1=bT.YAMLSeq;var rT=vT.Lexer,sT=gT.LineCounter,oT=hT.Parser,r0=q5.parse,aT=q5.parseAllDocuments,h6=q5.parseDocument,f6=q5.stringify,tT=WY.visit,eT=WY.visitAsync;import{accessSync as UY,closeSync as N5,constants as GY,existsSync as $A,fchmodSync as VY,fchownSync as ZA,fsyncSync as HY,lstatSync as n1,mkdirSync as KY,mkdtempSync as zA,openSync as O3,readdirSync as qY,readFileSync as O5,readlinkSync as QA,realpathSync as XA,renameSync as JA,rmSync as BY,statSync as P$,unlinkSync as MY,writeFileSync as LY}from"fs";import{randomBytes as YA}from"crypto";import{tmpdir as NY}from"os";import{basename as H6,dirname as u6,isAbsolute as OY,join as j2,relative as D3,resolve as Q2,sep as L5}from"path";class v extends Error{reason;path;onWrite;constructor($,Z,z,Q={}){super(z,Q.cause===void 0?void 0:{cause:Q.cause});this.name="SafePathError",this.reason=$,this.path=Z,this.onWrite=Q.onWrite===!0}}var y0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),WA=new Set(Object.values(y0).map(($)=>$.toLowerCase())),UA=($,Z)=>$.toLowerCase()===Z.toLowerCase(),B3=($)=>WA.has($.toLowerCase());function S$($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var GA=/\.fafm?$/i,VA=/^[a-z][a-z0-9-]*$/,O2=($)=>XA.native($),K6=($)=>$?.code;function r1($,Z){let z=D3($,Z);return z===""||z!==".."&&!z.startsWith(`..${L5}`)&&!OY(z)}function DY($){try{return QA($)}catch{return"?"}}function HA($,Z,z,Q){let X;try{X=O2(z)}catch(J){let Y=K6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new v("dangling",Z,`${Z} is a link to ${DY(z)}, which does not exist. faf does not create files through a link — refused.`);throw J}if(!r1($,X))throw new v("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(S$(X)&&!(Q.inGit&&u6(X)===$))throw new v("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!P$(X).isFile())throw new v("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return KA(Z,X,Q.read),X}function KA($,Z,z){let Q=H6($),X=H6(Z),J=B3(Q)&&B3(X);if(z&&!GA.test(X)&&!J){let Y=B3(Q)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new v("not-faf",$,`${$} is a link to ${Z}, which is not ${Y} — refused.`)}if(!z&&!UA(Q,X)&&!J)throw new v("other-file",$,`${$} is a link to ${Z}, a file with another name — refused (faf follows a link only to a file of the same name, or from one AI context file to another).`)}function qA($,Z,z,Q){if(H6(Q2($))!=="hooks"||!VA.test(H6(Z)))throw new v("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(Q!==z)throw new v("git",Z,`${Z} is not directly in the hooks folder ${z} — refused.`)}function BA($,Z,z){if(H6($)!=="config"||z!==Z)throw new v("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function d($,Z,z={}){let Q=O2(Q2($)),X=Q2($,Z),J=O2(u6(X));if(!r1(Q,J))throw new v("outside",X,`${X} is in ${J}, outside ${Q} — refused.`);let Y=z.allowGitHooks===!0,W=z.allowGitConfig===!0;if(Y)qA($,X,Q,J);if(W)BA(X,Q,J);let U=j2(J,H6(X));if(S$(U)&&!Y&&!W)throw new v("git",X,U===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${U}, inside .git/ — refused.`);let G;try{G=n1(U)}catch(V){if(K6(V)==="ENOENT")return U;throw V}if(G.isSymbolicLink())return HA(Q,X,U,{read:z.read===!0,inGit:Y||W});if(!G.isFile())throw new v("not-a-file",X,`${X} is not a regular file — refused.`);return O2(U)}var MA=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function LA($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return MA.decode($)}catch{}throw new v("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function Q0($){return LA(O5($),$)}function k0($){try{return O5($)}catch(Z){if(K6(Z)==="ENOENT")return null;throw Z}}function i1($,Z){let z=Q2(j2($,Z));if(!$A(z))return null;let Q,X;try{Q=O2(NA($)),X=O2(z)}catch{return null}if(!r1(Q,X)||S$(D3(Q,X)))return null;return X}var L3=[];function NA($){let Z=Q2($);return L3.find((z)=>Z===z||Z.startsWith(z.endsWith(L5)?z:z+L5))??Z}function E$($,Z){L3.push(Q2($));try{return Z()}finally{L3.pop()}}function A($,Z){return i1($,Z)!==null}function c($,Z){let z=i1($,Z);if(z===null)return null;try{return P$(z).isFile()?O5(z,"utf-8"):null}catch{return null}}function D2($,Z){let z=i1($,Z);if(z===null)return null;try{return P$(z)}catch{return null}}function X0($,Z="."){let z=i1($,Z);if(z===null)return null;let Q;try{Q=qY(z,{withFileTypes:!0})}catch{return null}return Q.filter((X)=>!X.isSymbolicLink()||i1($,j2(Z,X.name))!==null)}function OA($){try{let Z=P$($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(K6(Z)==="ENOENT")return;throw Z}}class u2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var M3=($)=>new v("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function I3($,Z,z){if(Z!==void 0){let X=k0($),J=Z===null?null:typeof Z==="string"?Buffer.from(Z,"utf-8"):Buffer.from(Z);if(!(X===null||J===null?X===J:X.equals(J)))throw M3($)}if(!z)return;let Q;try{Q=P$($)}catch(X){if(K6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw M3($);try{UY($,GY.W_OK)}catch{throw M3($)}}function DA($,Z){if(process.platform!=="win32")try{ZA($,Z.uid,Z.gid)}catch{}VY($,Z.mode)}function IA($){if(process.platform==="win32")return;try{let Z=O3($,"r");try{HY(Z)}finally{N5(Z)}}catch{}}function TA($,Z,z,Q){if($.fd=O3($.path,"wx",Q??z?.mode??438),$.created=!0,LY($.fd,Z),z)DA($.fd,z);if(Q!==void 0)VY($.fd,Q);HY($.fd),N5($.fd),$.fd=void 0}function AA($){if($.fd!==void 0)try{N5($.fd)}catch{}if($.created)try{MY($.path)}catch{}}function CA($,Z,z){let Q=u6($),X={path:j2(Q,`.${H6($).slice(0,100)}.${process.pid}.${YA(6).toString("hex")}.faf-tmp`),created:!1},J=OA($);try{if(J)UY($,GY.W_OK);TA(X,Z,J,z.mode),I3($,z.expect,J),JA(X.path,$)}catch(Y){if(AA(X),Y instanceof v)throw Y;let W=K6(Y)??(Y instanceof Error?Y.message:String(Y));throw new u2($,`${$}: not written${J?"; original kept":""} (${W})`,{cause:Y})}IA(Q)}function _A($){return $ instanceof v&&!$.onWrite?new v($.reason,$.path,$.message,{onWrite:!0}):$}function a($,Z,z={}){let Q=Q2($),X;try{X=d(z.root??u6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw _A(J)}return CA(X,Z,z),X}function w2($,Z,z){let Q=Q2($),X=z.root??u6(Q),J=d(X,Q),Y=k0(J);if(z.expect!==void 0)I3(J,z.expect,void 0);if(Y!==null&&z.force!==!0&&!z.owns(Y))throw new v("not-owned",Q,`${Q} has no ${z.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return a(J,Z,{root:X,expect:Y})}function w0($,Z=$){let z=Q2($);KY(z,{recursive:!0});let Q=O2(z),X=Q2(z,Z),J=D3(z,X);if(J===".."||J.startsWith(`..${L5}`)||OY(J))throw new v("outside",X,`${X} is outside ${Q} — refused.`,{onWrite:!0});let Y=Q;for(let W of J.split(/[\\/]/).filter(Boolean)){let U=j2(Y,W);if(S$(U))throw new v("git",X,`${X} runs through ${U}, inside .git/ — refused.`,{onWrite:!0});Y=RA(Q,X,U)}return Y}function RA($,Z,z){let Q;try{Q=n1(z)}catch(J){if(K6(J)!=="ENOENT")throw J;return KY(z),z}let X=z;if(Q.isSymbolicLink()){try{X=O2(z)}catch{throw new v("dangling",Z,`${z} is a link to ${DY(z)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!r1($,X))throw new v("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(S$(X))throw new v("git",Z,`${z} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!P$(X).isDirectory())throw new v("not-a-file",Z,`${z} is not a folder — refused.`,{onWrite:!0});return X}function D5($,Z){let z=Q2($),Q=O2(Q2(Z.root??u6(z))),X=O2(u6(z));if(!r1(Q,X))throw new v("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=j2(X,H6(z));if(S$(J))throw new v("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=n1(J)}catch(W){if(K6(W)==="ENOENT")return!1;throw W}if(!Y.isFile())throw new v("not-a-file",z,`${z} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return I3(J,Z.expect,void 0),MY(J),!0}var N3=new Set,IY=".faf-temp",TY="faf made this temp folder; `faf clear` removes it.\n";function I5($){let Z=O2(zA(j2(NY(),$)));N3.add(Z);let z=O3(j2(Z,IY),"wx",420);try{LY(z,TY)}finally{N5(z)}return Z}function T5($){if(!N3.has($))throw Error(`${$} is not a temp folder faf made — not removed`);BY($,{recursive:!0,force:!0}),N3.delete($)}function FA($){let Z=j2($,IY);try{if(!n1(Z).isFile())return!1;return O5(Z,"utf-8")===TY}catch{return!1}}var PA=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function AY($){let Z=NY(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${PA($)}[A-Za-z0-9]{6}$`),X=0;for(let J of qY(Z)){if(!Q.test(J))continue;let Y=j2(Z,J);try{let W=n1(Y);if(!W.isDirectory()||z!==void 0&&W.uid!==z||!FA(Y))continue;BY(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function $0($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function m6($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if($===null||$===void 0)return"empty";if(typeof $==="string"){let Z=$.length>40?`${$.slice(0,40)}…`:$;return`a string (${JSON.stringify(Z)})`}if(typeof $==="object")return"a mapping";return`a ${typeof $} (${String($)})`}function s1($,Z){if($===null||$===void 0)return{};if(!$0($))throw new v("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${m6($)}. `+"faf left it unchanged — fix it by hand.");return $}var J0=[{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"}],q6=new Map(J0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),CY=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),fb=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function o1($,Z){let z=(X)=>{let J=X.split("."),Y=$;for(let W of J)if(Y&&typeof Y==="object"&&W in Y)Y=Y[W];else return;return Y},Q=z(Z.path);if(Q!==void 0)return Q;if(Z.canonical)return z(Z.canonical);return}var ub=J0.filter(($)=>$.index<=21);var T3=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]);var a1="slotignored";function j$($){return typeof $==="string"&&$.trim()!==""&&G0($)}function G0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return T3.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var w$="no classifying signals — fallback",SA=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]);function p6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(c6,$))return null;if(!c6[$].includes(Z.category))return!1;return!($==="framework"&&SA.has(Z.path))}var c6={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 EY=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function _Y($){return typeof $==="object"&&$.collection===void 0}function EA($,Z){let z=$.source;if(typeof z!=="string"||z.includes(`
205
+ `)||typeof $.value!=="number")return;let Q=Z.find((J)=>J.default===!0&&J.test?.test(z));if(!Q||!EY.has(Q.tag))return;let X;try{X=Q.resolve(z,()=>{return},{})}catch{return}return Object.is(C0(X)?X.value:X,$.value)?z:void 0}function jA($){let Z=$.filter(_Y);return $.map((z)=>{if(!_Y(z)||!EY.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,W)=>EA(X,Z)??Q(X,J,Y,W)}})}var A5={keepSourceTokens:!0,customTags:jA};function wA($,Z){let z=/^( *)[^\s#-][^#]*?:[ \t]*(?:#.*)?$/.exec($),Q=/^( *)(\S)/.exec(Z);if(!z||!Q||Q[2]==="#")return{};let X=Q[1].length-z[1].length;if(Q[2]==="-")return X>=0?{indentSeq:X>0}:{};return X>=1&&X<=8?{indent:X}:{}}function xA($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=wA(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function F3($,Z){let z=h6($,A5);if(z.errors.length>0){let Q=z.errors[0].message.split(`
206
+ `)[0];throw Error(`${Z}: not valid YAML (${Q}) — faf left it unchanged.`,{cause:z.errors[0]})}return z}function l6($,Z,z,Q){$.edits.push({start:Z,end:z,text:Q,seq:$.edits.length})}function t1($,Z){return $.lastIndexOf(`
207
+ `,Z-1)+1}function jY($,Z){if(Z>0&&$[Z-1]===`
208
208
  `)return Z;let z=$.indexOf(`
209
- `,Z);return z<0?$.length:z+1}function LY($,Z){let z=Z;if($[z-1]===`
210
- `){if(z--,$[z-1]==="\r")z--}return z}function O2($){return $!==null&&$!==void 0}function c0($){let Z=L2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function AY($,Z){let z=c0($),Q=c0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function CY($){if(C0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return b6($)&&!$.flow}function T5($,Z){return $.anchor===Z.anchor&&$.tag===Z.tag&&$.comment===Z.comment&&$.commentBefore===Z.commentBefore&&!!$.spaceBefore===!!Z.spaceBefore}function _Y($,Z){return Object.is($.value,Z.value)&&$.type===Z.type&&$.format===Z.format&&$.minFractionDigits===Z.minFractionDigits&&T5($,Z)}function RY($,Z,z,Q){let X=new K5(void 0,I5);X.contents=Z(X);let Y=X.toString($.piece).replace(/\n+$/,"").slice(z),W=Y.startsWith(" ")&&!Y.includes(`
209
+ `,Z);return z<0?$.length:z+1}function RY($,Z){let z=Z;if($[z-1]===`
210
+ `){if(z--,$[z-1]==="\r")z--}return z}function I2($){return $!==null&&$!==void 0}function c0($){let Z=N2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function wY($,Z){let z=c0($),Q=c0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function xY($){if(C0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return g6($)&&!$.flow}function C5($,Z){return $.anchor===Z.anchor&&$.tag===Z.tag&&$.comment===Z.comment&&$.commentBefore===Z.commentBefore&&!!$.spaceBefore===!!Z.spaceBefore}function yY($,Z){return Object.is($.value,Z.value)&&$.type===Z.type&&$.format===Z.format&&$.minFractionDigits===Z.minFractionDigits&&C5($,Z)}function kY($,Z,z,Q){let X=new B5(void 0,A5);X.contents=Z(X);let Y=X.toString($.piece).replace(/\n+$/,"").slice(z),W=Y.startsWith(" ")&&!Y.includes(`
211
211
  `),U=" ".repeat(Q),G=Y.replace(/\n(?=.)/g,`
212
- ${U}`).replace(/\n/g,$.eol);return{inline:W,text:W?Y.slice(1):G}}function O3($,Z,z){return RY($,(Q)=>{let X=new A$;return X.items.push(Q.createPair("k",Z)),X},2,z)}function TA($,Z,z){let Q=RY($,()=>{let X=new c1;return X.items.push(Z),X},1,z);if(Q.inline)return Q;return Q.text.startsWith(" ")?{inline:!1,text:Q.text.slice(1)}:null}function AA($){if(!L2($)||!O2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function CA($,Z){if(!L2($)||!L2(Z))return Z;let z=$,Q=Z;if(!z.anchor&&!z.tag||z.anchor!==Q.anchor||z.tag!==Q.tag)return Z;let X=Z.clone();return X.anchor=void 0,X.tag=void 0,X}function _A($,Z){let z=c0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function RA($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function NY($,Z,z,Q,X=!1){let J=c0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,W=L2(z)?z.comment:void 0,U=!O2(Y)||Y===W,G=U?AA(z):z,V=X?G:CA(Z,G),H=Q.kind==="value"?O3($,V,Q.col):TA($,V,Q.col);return H?{range:J,keepTail:U,newComment:W,piece:H}:null}function PA($,Z,z,Q){if(!Q)return LY($,TY($,z[2]));return CY(Z)?LY($,z[1]):z[1]}function o1($,Z,z,Q,X){let J=NY($,Z,z,Q);if(!J)return!1;let Y=PA($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!CY(Z)||Q.kind==="item"))return FA($,J,Y,Q,X),!0;let W=J.keepTail?Z.comment:J.newComment;if(X!==void 0||O2(W))return!1;let U=Q.kind==="value"?NY($,Z,z,Q,!0):J;return U!==null&&SA($,U.range[0],Y,U.piece,Q)}function FA($,Z,z,Q,X){let[J,Y]=Z.range,U=J===Y&&Q.kind==="value"?RA($.src,J,Z.piece.text):Z.piece.text;c6($,J,z,U+(X===void 0?"":` #${X}`))}function SA($,Z,z,Q,X){if(X.kind==="item")return c6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=_A($.src,X.key);if(J<0)return!1;return c6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function EA($,Z){return T5({...$,comment:void 0},{...Z,comment:void 0})}function jA($,Z){if(O2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
213
- `)?void 0:Z.comment}function wA($,Z,z,Q){if(_Y(Z,z))return!0;if(!EA(Z,z))return!1;let X=jA(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return o1($,Z,z,Q,X)}function xA($,Z,z,Q){if(!T5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return O3($,Z,0).text===O3($,z,0).text||o1($,Z,z,Q);if(z.items.length===0)return o1($,Z,z,Q);return q0(Z)?vA($,Z,z):hA($,Z,z)}function C3($,Z,z,Q){if(!AY(Z,z))return o1($,Z,z,Q);if(C0(Z))return wA($,Z,z,Q);if(g2(Z))return g2(z)&&Z.source===z.source&&T5(Z,z)||o1($,Z,z,Q);if(!b6(Z)||!b6(z))return!1;return xA($,Z,z,Q)}function PY($,Z){return Z-s1($,Z)}function _3($,Z,z){let Q=$.slice(s1($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function I3($){return L2($)&&(O2($.commentBefore)||!!$.spaceBefore)}function R3($,Z,z){let Q=c0(Z)??c0(z);return Q?TY($.src,Q[2]):-1}function FY($,Z,z){let Q=new K5(void 0,I5);Q.contents=Z;let X=" ".repeat(z);return Q.toString($.piece).replace(/\n+$/,"").split(`
214
- `).map((Y)=>Y?X+Y:Y).join($.eol)+$.eol}function yA($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
215
- `);c6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function SY($,Z,z,Q,X,J){let Y=z;if(Y<0){let W=c0(Z);if(!W||I3(Z)||!_3($.src,W[0],J))return!1;Y=s1($.src,W[0])}return yA($,Y,FY($,Q,X)),!0}function kA($,Z,z){let Q=s1($,z),X=Z,J=O2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let W=s1($,Q-1),U=$.slice(W,Q).trim();if(J&&U.startsWith("#"))Q=W;else if(Y&&U==="")Q=W,Y=!1;else break}return Q}function EY($,Z,z,Q){let X=c0(Z);if(!X||!_3($.src,X[0],Q))return!1;let J=R3($,z,Z);if(J<0)return!1;return c6($,kA($.src,Z,X[0]),J,""),!0}function jY($,Z){let z=new Map,Q=(X)=>{let J=c0(X);return J?J.join(":"):void 0};return $.forEach((X,J)=>{let Y=Q(Z(X));if(Y!==void 0&&!z.has(Y))z.set(Y,J)}),(X)=>{let J=Q(Z(X)),Y=J===void 0?void 0:z.get(J);return Y!==void 0&&AY(Z($[Y]),Z(X))?Y:-1}}function bA($,Z){return C0($)&&C0(Z)?_Y($,Z):$===Z}function vA($,Z,z){let Q=Z.items[0]?.key,X=c0(Q);if(!X)return!1;let J=PY($.src,X[0]),Y=new Set,W=(H,K)=>{if(H.length===0)return!0;let q=new A$;q.items.push(...H);let L=K<0?-1:R3($,Z.items[K].value,Z.items[K].key);return SY($,Q,L,q,J,!1)},U=jY(Z.items,(H)=>H.key),G=-1,V=[];for(let H of z.items){let K=U(H);if(K<0){V.push(H);continue}if(K<=G||!W(V,G)||!bA(Z.items[K].key,H.key))return!1;if(V=[],!C3($,Z.items[K].value,H.value,{kind:"value",key:Z.items[K].key,col:J}))return!1;Y.add(K),G=K}if(!W(V,G))return!1;return Z.items.every((H,K)=>Y.has(K)||gA($,Z,K))}function gA($,Z,z){let Q=Z.items[z],X=c0(Q.key);if(!X)return!1;if(_3($.src,X[0],!1))return EY($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=c0(J?.key);if(z!==0||!Y||I3(Q.key)||I3(J.key))return!1;return c6($,X[0],Y[0],""),!0}function hA($,Z,z){let Q=c0(Z);if(!Q||Z.items.length===0)return!1;let X=PY($.src,Q[0]),J=new Set,Y=(V,H)=>{if(V.length===0)return!0;let K=new c1;K.items.push(...V);let q=H<0?-1:R3($,Z.items[H]);return SY($,Z.items[0],q,K,X,!0)},W=jY(Z.items,(V)=>V),U=-1,G=[];for(let V of z.items){let H=W(V);if(H<0){G.push(V);continue}if(H<=U||!Y(G,U))return!1;if(G=[],!C3($,Z.items[H],V,{kind:"item",col:X}))return!1;J.add(H),U=H}if(!Y(G,U))return!1;return Z.items.every((V,H)=>J.has(H)||EY($,V,V,!0))}function fA($,Z){let z=[...Z].sort((J,Y)=>Y.start-J.start||Y.end-J.end||Y.seq-J.seq),Q=$,X=1/0;for(let J of z){if(J.end>X)return null;Q=Q.slice(0,J.start)+J.text+Q.slice(J.end),X=J.start}return Q}function uA($,Z,z){if(!q0(z)&&!h2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
216
- `)?$.eol:"",X=Z.commentBefore?$.eol:"";return c6($,$.src.length,$.src.length,Q+X+FY($,z,0)),!0}function mA($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!O2(Q))return!O2(X)||uA($,Z,X);return O2(X)&&C3($,Q,X,{kind:"root"})}function cA($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!mA(J,Z,z))return null;return fA($,J.edits)}var DY=($)=>$.replace(/^[ \t]*\n/gm,"");function pA($,Z,z,Q){let X=v6($,I5);if(X.errors.length>0||!B0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||DY(J)===DY(z)}function A5($,Z,z="YAML"){let{text:Q,changed:X}=lA($,Z,z);return{text:Q,changed:X}}function lA($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=A3(X,z),Y=dA(J);Z(Y);let W={text:$,changed:!1,spliced:!1};if(B0(Y.toJS(),J.toJS()))return W;let U={lineWidth:0,...IA(X)},G=Y.toString(U);if(G===J.toString(U))return W;let V=X.includes(`\r
212
+ ${U}`).replace(/\n/g,$.eol);return{inline:W,text:W?Y.slice(1):G}}function C3($,Z,z){return kY($,(Q)=>{let X=new F$;return X.items.push(Q.createPair("k",Z)),X},2,z)}function yA($,Z,z){let Q=kY($,()=>{let X=new d1;return X.items.push(Z),X},1,z);if(Q.inline)return Q;return Q.text.startsWith(" ")?{inline:!1,text:Q.text.slice(1)}:null}function kA($){if(!N2($)||!I2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function bA($,Z){if(!N2($)||!N2(Z))return Z;let z=$,Q=Z;if(!z.anchor&&!z.tag||z.anchor!==Q.anchor||z.tag!==Q.tag)return Z;let X=Z.clone();return X.anchor=void 0,X.tag=void 0,X}function vA($,Z){let z=c0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function gA($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function FY($,Z,z,Q,X=!1){let J=c0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,W=N2(z)?z.comment:void 0,U=!I2(Y)||Y===W,G=U?kA(z):z,V=X?G:bA(Z,G),H=Q.kind==="value"?C3($,V,Q.col):yA($,V,Q.col);return H?{range:J,keepTail:U,newComment:W,piece:H}:null}function hA($,Z,z,Q){if(!Q)return RY($,jY($,z[2]));return xY(Z)?RY($,z[1]):z[1]}function e1($,Z,z,Q,X){let J=FY($,Z,z,Q);if(!J)return!1;let Y=hA($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!xY(Z)||Q.kind==="item"))return fA($,J,Y,Q,X),!0;let W=J.keepTail?Z.comment:J.newComment;if(X!==void 0||I2(W))return!1;let U=Q.kind==="value"?FY($,Z,z,Q,!0):J;return U!==null&&uA($,U.range[0],Y,U.piece,Q)}function fA($,Z,z,Q,X){let[J,Y]=Z.range,U=J===Y&&Q.kind==="value"?gA($.src,J,Z.piece.text):Z.piece.text;l6($,J,z,U+(X===void 0?"":` #${X}`))}function uA($,Z,z,Q,X){if(X.kind==="item")return l6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=vA($.src,X.key);if(J<0)return!1;return l6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function mA($,Z){return C5({...$,comment:void 0},{...Z,comment:void 0})}function cA($,Z){if(I2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
213
+ `)?void 0:Z.comment}function pA($,Z,z,Q){if(yY(Z,z))return!0;if(!mA(Z,z))return!1;let X=cA(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return e1($,Z,z,Q,X)}function lA($,Z,z,Q){if(!C5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return C3($,Z,0).text===C3($,z,0).text||e1($,Z,z,Q);if(z.items.length===0)return e1($,Z,z,Q);return q0(Z)?rA($,Z,z):oA($,Z,z)}function P3($,Z,z,Q){if(!wY(Z,z))return e1($,Z,z,Q);if(C0(Z))return pA($,Z,z,Q);if(h2(Z))return h2(z)&&Z.source===z.source&&C5(Z,z)||e1($,Z,z,Q);if(!g6(Z)||!g6(z))return!1;return lA($,Z,z,Q)}function bY($,Z){return Z-t1($,Z)}function S3($,Z,z){let Q=$.slice(t1($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function _3($){return N2($)&&(I2($.commentBefore)||!!$.spaceBefore)}function E3($,Z,z){let Q=c0(Z)??c0(z);return Q?jY($.src,Q[2]):-1}function vY($,Z,z){let Q=new B5(void 0,A5);Q.contents=Z;let X=" ".repeat(z);return Q.toString($.piece).replace(/\n+$/,"").split(`
214
+ `).map((Y)=>Y?X+Y:Y).join($.eol)+$.eol}function dA($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
215
+ `);l6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function gY($,Z,z,Q,X,J){let Y=z;if(Y<0){let W=c0(Z);if(!W||_3(Z)||!S3($.src,W[0],J))return!1;Y=t1($.src,W[0])}return dA($,Y,vY($,Q,X)),!0}function iA($,Z,z){let Q=t1($,z),X=Z,J=I2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let W=t1($,Q-1),U=$.slice(W,Q).trim();if(J&&U.startsWith("#"))Q=W;else if(Y&&U==="")Q=W,Y=!1;else break}return Q}function hY($,Z,z,Q){let X=c0(Z);if(!X||!S3($.src,X[0],Q))return!1;let J=E3($,z,Z);if(J<0)return!1;return l6($,iA($.src,Z,X[0]),J,""),!0}function fY($,Z){let z=new Map,Q=(X)=>{let J=c0(X);return J?J.join(":"):void 0};return $.forEach((X,J)=>{let Y=Q(Z(X));if(Y!==void 0&&!z.has(Y))z.set(Y,J)}),(X)=>{let J=Q(Z(X)),Y=J===void 0?void 0:z.get(J);return Y!==void 0&&wY(Z($[Y]),Z(X))?Y:-1}}function nA($,Z){return C0($)&&C0(Z)?yY($,Z):$===Z}function rA($,Z,z){let Q=Z.items[0]?.key,X=c0(Q);if(!X)return!1;let J=bY($.src,X[0]),Y=new Set,W=(H,K)=>{if(H.length===0)return!0;let q=new F$;q.items.push(...H);let L=K<0?-1:E3($,Z.items[K].value,Z.items[K].key);return gY($,Q,L,q,J,!1)},U=fY(Z.items,(H)=>H.key),G=-1,V=[];for(let H of z.items){let K=U(H);if(K<0){V.push(H);continue}if(K<=G||!W(V,G)||!nA(Z.items[K].key,H.key))return!1;if(V=[],!P3($,Z.items[K].value,H.value,{kind:"value",key:Z.items[K].key,col:J}))return!1;Y.add(K),G=K}if(!W(V,G))return!1;return Z.items.every((H,K)=>Y.has(K)||sA($,Z,K))}function sA($,Z,z){let Q=Z.items[z],X=c0(Q.key);if(!X)return!1;if(S3($.src,X[0],!1))return hY($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=c0(J?.key);if(z!==0||!Y||_3(Q.key)||_3(J.key))return!1;return l6($,X[0],Y[0],""),!0}function oA($,Z,z){let Q=c0(Z);if(!Q||Z.items.length===0)return!1;let X=bY($.src,Q[0]),J=new Set,Y=(V,H)=>{if(V.length===0)return!0;let K=new d1;K.items.push(...V);let q=H<0?-1:E3($,Z.items[H]);return gY($,Z.items[0],q,K,X,!0)},W=fY(Z.items,(V)=>V),U=-1,G=[];for(let V of z.items){let H=W(V);if(H<0){G.push(V);continue}if(H<=U||!Y(G,U))return!1;if(G=[],!P3($,Z.items[H],V,{kind:"item",col:X}))return!1;J.add(H),U=H}if(!Y(G,U))return!1;return Z.items.every((V,H)=>J.has(H)||hY($,V,V,!0))}function aA($,Z){let z=[...Z].sort((J,Y)=>Y.start-J.start||Y.end-J.end||Y.seq-J.seq),Q=$,X=1/0;for(let J of z){if(J.end>X)return null;Q=Q.slice(0,J.start)+J.text+Q.slice(J.end),X=J.start}return Q}function tA($,Z,z){if(!q0(z)&&!f2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
216
+ `)?$.eol:"",X=Z.commentBefore?$.eol:"";return l6($,$.src.length,$.src.length,Q+X+vY($,z,0)),!0}function eA($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!I2(Q))return!I2(X)||tA($,Z,X);return I2(X)&&P3($,Q,X,{kind:"root"})}function $C($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!eA(J,Z,z))return null;return aA($,J.edits)}var PY=($)=>$.replace(/^[ \t]*\n/gm,"");function ZC($,Z,z,Q){let X=h6($,A5);if(X.errors.length>0||!B0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||PY(J)===PY(z)}function _5($,Z,z="YAML"){let{text:Q,changed:X}=zC($,Z,z);return{text:Q,changed:X}}function zC($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=F3(X,z),Y=QC(J);Z(Y);let W={text:$,changed:!1,spliced:!1};if(B0(Y.toJS(),J.toJS()))return W;let U={lineWidth:0,...xA(X)},G=Y.toString(U);if(G===J.toString(U))return W;let V=X.includes(`\r
217
217
  `)?`\r
218
218
  `:`
219
- `,H=cA(X,J,Y,V,{...U,verifyAliasOrder:!1}),K=H!==null&&pA(H,Y,G,U),q=K&&H!==null?H:G.replace(/\r?\n/g,V);return{text:Q+q,changed:Q+q!==$,spliced:K}}function dA($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function B0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>B0(z,Z[Q]));if($0($)&&$0(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&B0($[Q],Z[Q]))}return!1}function t1($){let Z=C0($.key)?$.key.value:$.key;return typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean"?String(Z):void 0}function K6($,Z){return $.items.find((z)=>t1(z)===Z)}function wY($,Z){return L2(Z)?Z.toJS($):Z}function iA($,Z,z,Q){return Q.keepAliases===!0&&g2(Z)||B0(wY($,Z),z)}function C5($,Z,z,Q={}){if(iA($,Z,z,Q))return Z;if($0(z)&&q0(Z))return rA($,Z,z,Q),Z;if(Array.isArray(z)&&h2(Z))return aA($,Z,z,Q),Z;if(!$0(z)&&!Array.isArray(z)&&C0(Z))return Z.value=z,Z;return nA(Z,$.createNode(z))}function nA($,Z){if(!C0($)&&!g2($))return Z;let z=$,Q=Z;if(b6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=D3(Q.commentBefore,z.commentBefore,z.comment),Z;if(b6(Z))Z.flow=!0;return Q.comment=D3(Q.comment??z.comment),Q.commentBefore=D3(Q.commentBefore??z.commentBefore),Z}function D3(...$){let Z=$.filter(O2);return Z.length>0?Z.join(`
220
- `):void 0}function rA($,Z,z,Q={}){for(let[X,J]of Object.entries(z)){if(J===void 0)continue;let Y=K6(Z,X);if(Y)Y.value=C5($,Y.value,J,Q);else Z.items.push($.createPair(X,J))}if(!Q.prune)return;Z.items=Z.items.filter((X)=>{let J=t1(X);return J===void 0||z[J]!==void 0})}function P3($,Z,z,Q){let X=$0(z)?z:{};for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=K6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(Object.prototype.hasOwnProperty.call(X,J)&&B0(X[J],Y))continue;else if($0(Y)&&$0(X[J])&&q0(W.value))P3($,W.value,X[J],Y);else W.value=C5($,W.value,Y,{keepAliases:!0})}}function a1($,Z,z){if(g2($))z.push({path:[...Z],node:$});else if(q0($))for(let Q of $.items){let X=t1(Q);if(X!==void 0)a1(Q.value,[...Z,X],z)}else if(h2($))$.items.forEach((Q,X)=>a1(Q,[...Z,X],z))}function OY($,Z){let z=$;for(let Q of Z)if(Array.isArray(z)&&typeof Q==="number")z=z[Q];else if($0(z)&&typeof Q==="string")z=z[Q];else return;return z}function xY($,Z,z){let Q=[];return a1($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=OY(Z,X);return Y!==void 0&&!B0(OY(z,X),Y)&&!B0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function yY($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=sA(z,Z[X]);let Q=Z[Z.length-1];if(q0(z)&&typeof Q==="string"){let X=K6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(h2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>c0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function sA($,Z){if(q0($)&&typeof Z==="string")return K6($,Z)?.value;if(h2($)&&typeof Z==="number")return $.items[Z];return}function kY($,Z){let z=[];a1($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=yY(Z,X);if(!Y||g2(Y.node)&&Y.node.source===J.source)continue;if(!Y.put(J.clone()))continue;Q.push({path:X.join("."),alias:`*${J.source}`})}return Q}function T3($,Z,z,Q){if(!L2($)||g2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(q0($))for(let J of $.items){let Y=t1(J);if(Y!==void 0)T3(J.value,[...Z,Y],z,Q)}else if(h2($))$.items.forEach((J,Y)=>T3(J,[...Z,Y],z,Q))}function bY($,Z){let z=[];a1($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];T3($.contents,[],Q,X);let J=[];for(let{path:Y,node:W}of X){let U=yY(Z,Y);if(!U)continue;let G=W.anchor;if(L2(U.node)&&U.node.anchor===G&&B0(W.toJS($),U.node.toJS(Z))||!U.put(W.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function oA($,Z){let z=$.length,Q=Z.length,X=Array.from({length:z+1},()=>Array(Q+1).fill(0));for(let Y=z-1;Y>=0;Y--)for(let W=Q-1;W>=0;W--)X[Y][W]=B0($[Y],Z[W])?X[Y+1][W+1]+1:Math.max(X[Y+1][W],X[Y][W+1]);let J=[];for(let Y=0,W=0;Y<z&&W<Q;)if(B0($[Y],Z[W]))J.push([Y,W]),Y++,W++;else if(X[Y+1][W]>=X[Y][W+1])Y++;else W++;return J}function aA($,Z,z,Q){let X=Z.items,J=X.map((G)=>wY($,G)),Y=[],W=0,U=0;for(let[G,V]of[...oA(J,z),[X.length,z.length]]){for(;W<G&&U<V;W++,U++)Y.push(C5($,X[W],z[U],Q));for(;U<V;U++)Y.push($.createNode(z[U]));if(G<X.length)Y.push(X[G]);W=G+1,U=V+1}Z.items=Y}function e1($,Z,z,Q){if(B0(z,Q))return Z;if(!$0(z)||!$0(Q)||!q0(Z))return C5($,Z,Q);let X=new Set(Object.keys(z).filter((J)=>!(J in Q)||Q[J]===void 0));Z.items=Z.items.filter((J)=>{let Y=t1(J);return Y===void 0||!X.has(Y)});for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=K6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(!B0(z[J],Y))W.value=e1($,W.value,z[J],Y)}return Z}function vY($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new A$,Q=$.contents;if(!q0(Q))throw Error(`${z}: the document is not a mapping — faf left it unchanged.`);let X=Q;for(let J of Z){let Y=K6(X,J);if(Y&&q0(Y.value)){X=Y.value;continue}if(Y&&!fY(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let W=new A$;if(Y)Y.value=hY(Y.value,W);else X.items.push($.createPair(J,W));X=W}return X}function _5($,Z,z,Q,X){if(B0(z,Q))return;let J=vY($,Z.slice(0,-1),X),Y=Z[Z.length-1],W=K6(J,Y);if(Q===void 0)J.items=J.items.filter((U)=>U!==W);else if(!W)J.items.push($.createPair(Y,Q));else W.value=e1($,W.value,z,Q)}function gY($,Z,z){let Q=vY($,Z.slice(0,-1),z),X=Z[Z.length-1],J=K6(Q,X);if(J&&h2(J.value))return J.value;if(J&&!fY(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new c1;if(J)J.value=hY(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function hY($,Z){if(!C0($))return Z;let z=[$.commentBefore,$.comment].filter(O2);if(z.length>0)Z.commentBefore=z.join(`
221
- `);return Z}function fY($){if($===null||$===void 0)return!0;return C0($)&&($.value===null||$.value===void 0)}var F3=new WeakMap;function $4($){return typeof $==="object"&&$!==null?F3.get($):void 0}function R5($,Z){F3.set($,Z)}function uY($,Z){let z=$4($);if(z)F3.set(Z,z);return Z}var mY=new WeakSet;function cY($){return mY.add($),$}function pY($){return typeof $==="object"&&$!==null&&mY.has($)}function F5($){let Z=S$($);return l(P5(Z),Z,{read:!0})}function S3($){if($ instanceof q5)return $;let Z=$?.cause;return Z instanceof q5?Z:null}function E3($,Z){let z=Z.message.split(`
222
- `)[0].replace(/ at line \d+, column \d+:?\s*$/,"").replace(/:\s*$/,""),Q=Z.linePos?.[0]?.line,X=S$($);return new b("not-yaml",X,`${X} is not valid YAML (${z}${Q===void 0?"":`, line ${Q}`}) — faf left it unchanged`,{cause:Z})}function n($,Z){try{return Z()}catch(z){if(z instanceof b)throw z;let Q=(z instanceof Error?z.message:String(z)).split(`
223
- `)[0].trim(),X=S$($);throw new b("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function r($){let Z=F5($),z=Q0(Z),Q;try{Q=r0(z)}catch(J){let Y=S3(J);if(Y)throw E3($,Y);throw J}let X=i1(Q,$);return R5(X,{real:Z,text:z}),X}function j3($){let Z=$._meta,z={...$};delete z._meta;let Q=g6(z,{lineWidth:0});if(Z?.found&&Z.found.length>0){let X=Z.found.join(" + ");Q=Q.replace(/^(\s+type:\s+\S+)(\s*)$/m,(J,Y,W)=>{if(W.includes("#"))return J;return`${Y} # found: ${X}`})}return Q}function $C($,Z,z,Q,X=!1){let J=F5($),Y=Q0(J),W=[],U;try{U=A5(Y,(G)=>{rY(G,$);let V=G.clone();if(Z(G),W=kY(V,G),X)W=[...W,...bY(V,G)];if(Q)W=[...W,...Q(G,V.toJS()).filter((H)=>!W.some((K)=>K.path===H.path))]},$)}catch(G){let V=S3(G);if(V)throw E3($,V);throw G}if(!U.changed)return{written:!1,text:Y,keptAliases:W};return a($,U.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:U.text,keptAliases:W}}function p0($){if($.kind==="anchor")return`${$.path} holds an anchor (${$.alias}) that an alias reads — faf left it as written`;return`${$.path} is an alias (${$.alias}) — faf left it as written`}function dY($){try{return nY($),!0}catch{return!1}}function ZC($){let Z=$.getIn(["project","type"],!0);return C0(Z)?Z.value:Z}function rY($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!q0(z))throw new b("not-yaml",S$(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${f6($.toJS())}. faf left it unchanged — fix it by hand.`)}function zC($,Z,z){rY($,z);let Q=$.contents,X=q0(Q)&&Q.items.some((V)=>C0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,W=ZC($),U=q0(Q)?$.toJS():{},G=q0(Q)?Q:$.createNode({});if($.contents=G,P3($,G,U,X?{...Z}:Y),!X)XC($,J?.found,W)}function QC($,Z){let z=$.contents;if(q0(z)&&z.items.some((J)=>C0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function XC($,Z,z){if(!Z||Z.length===0||!G0(z))return;let Q=$.getIn(["project","type"],!0);if(C0(Q)&&!G0(Q.value)&&(Q.comment===null||Q.comment===void 0))Q.comment=` found: ${Z.join(" + ")}`}function M0($,Z,z={}){if(!z.replace&&dY($)){let W=$C($,(U)=>zC(U,Z,$),$4(Z),(U,G)=>xY(U,QC(U,Z),G),pY(Z));R5(Z,{real:F5($),text:W.text});for(let U of W.keptAliases??[])z.onAliasKept?.(U);return W.written}let Q=S$($),X=j3(Z),J=dY($)?k0(l(P5(Q),Q)):null,Y=a($,X,{expect:J});return R5(Z,{real:Y,text:X}),!0}function p($){return Q0(F5($))}function X2($,Z){let z;try{z=r0($)}catch(Q){let X=S3(Q);if(Z!==void 0&&X)throw E3(Z,X);throw Q}return Z===void 0?z:i1(z,Z)}function iY($,Z){let z;try{z=nY(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return l($,S$(Z),{read:!0}),!0}function f($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=lY($,Q);if(iY($,X))return X}let z=P5($);if(z!==$)for(let Q of Z){let X=lY(z,Q);if(iY(z,X))return X}return null}function E$($,Z=process.cwd()){return eA("git",["-C",P5($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+tA($)}i();var j$=[{name:"TROPHY",indicator:`${P0("✪")} ${P0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${P0(C("★"))} ${P0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${T("◆")} ${T("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${S5("◇")} ${S5("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${C("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${M("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${M("○")} RED`,threshold:1},{name:"WHITE",indicator:`${M("♡")}`,threshold:0}];function I2($){return $.indicator}function q6($){for(let Z of j$)if($>=Z.threshold)return Z;return j$[j$.length-1]}var x3=null;function z4(){if(x3)return x3;try{let $=n0("faf-scoring-kernel");return x3=$,$}catch{throw Error(`faf-scoring-kernel not installed.
219
+ `,H=$C(X,J,Y,V,{...U,verifyAliasOrder:!1}),K=H!==null&&ZC(H,Y,G,U),q=K&&H!==null?H:G.replace(/\r?\n/g,V);return{text:Q+q,changed:Q+q!==$,spliced:K}}function QC($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function B0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>B0(z,Z[Q]));if($0($)&&$0(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&B0($[Q],Z[Q]))}return!1}function Z4($){let Z=C0($.key)?$.key.value:$.key;return typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean"?String(Z):void 0}function B6($,Z){return $.items.find((z)=>Z4(z)===Z)}function uY($,Z){return N2(Z)?Z.toJS($):Z}function XC($,Z,z,Q){return Q.keepAliases===!0&&h2(Z)||B0(uY($,Z),z)}function R5($,Z,z,Q={}){if(XC($,Z,z,Q))return Z;if($0(z)&&q0(Z))return YC($,Z,z,Q),Z;if(Array.isArray(z)&&f2(Z))return GC($,Z,z,Q),Z;if(!$0(z)&&!Array.isArray(z)&&C0(Z))return Z.value=z,Z;return JC(Z,$.createNode(z))}function JC($,Z){if(!C0($)&&!h2($))return Z;let z=$,Q=Z;if(g6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=A3(Q.commentBefore,z.commentBefore,z.comment),Z;if(g6(Z))Z.flow=!0;return Q.comment=A3(Q.comment??z.comment),Q.commentBefore=A3(Q.commentBefore??z.commentBefore),Z}function A3(...$){let Z=$.filter(I2);return Z.length>0?Z.join(`
220
+ `):void 0}function YC($,Z,z,Q={}){for(let[X,J]of Object.entries(z)){if(J===void 0)continue;let Y=B6(Z,X);if(Y)Y.value=R5($,Y.value,J,Q);else Z.items.push($.createPair(X,J))}if(!Q.prune)return;Z.items=Z.items.filter((X)=>{let J=Z4(X);return J===void 0||z[J]!==void 0})}function j3($,Z,z,Q){let X=$0(z)?z:{};for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=B6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(Object.prototype.hasOwnProperty.call(X,J)&&B0(X[J],Y))continue;else if($0(Y)&&$0(X[J])&&q0(W.value))j3($,W.value,X[J],Y);else W.value=R5($,W.value,Y,{keepAliases:!0})}}function $4($,Z,z){if(h2($))z.push({path:[...Z],node:$});else if(q0($))for(let Q of $.items){let X=Z4(Q);if(X!==void 0)$4(Q.value,[...Z,X],z)}else if(f2($))$.items.forEach((Q,X)=>$4(Q,[...Z,X],z))}function SY($,Z){let z=$;for(let Q of Z)if(Array.isArray(z)&&typeof Q==="number")z=z[Q];else if($0(z)&&typeof Q==="string")z=z[Q];else return;return z}function mY($,Z,z){let Q=[];return $4($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=SY(Z,X);return Y!==void 0&&!B0(SY(z,X),Y)&&!B0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function cY($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=WC(z,Z[X]);let Q=Z[Z.length-1];if(q0(z)&&typeof Q==="string"){let X=B6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(f2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>c0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function WC($,Z){if(q0($)&&typeof Z==="string")return B6($,Z)?.value;if(f2($)&&typeof Z==="number")return $.items[Z];return}function pY($,Z){let z=[];$4($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=cY(Z,X);if(!Y||h2(Y.node)&&Y.node.source===J.source)continue;if(!Y.put(J.clone()))continue;Q.push({path:X.join("."),alias:`*${J.source}`})}return Q}function R3($,Z,z,Q){if(!N2($)||h2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(q0($))for(let J of $.items){let Y=Z4(J);if(Y!==void 0)R3(J.value,[...Z,Y],z,Q)}else if(f2($))$.items.forEach((J,Y)=>R3(J,[...Z,Y],z,Q))}function lY($,Z){let z=[];$4($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];R3($.contents,[],Q,X);let J=[];for(let{path:Y,node:W}of X){let U=cY(Z,Y);if(!U)continue;let G=W.anchor;if(N2(U.node)&&U.node.anchor===G&&B0(W.toJS($),U.node.toJS(Z))||!U.put(W.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function UC($,Z){let z=$.length,Q=Z.length,X=Array.from({length:z+1},()=>Array(Q+1).fill(0));for(let Y=z-1;Y>=0;Y--)for(let W=Q-1;W>=0;W--)X[Y][W]=B0($[Y],Z[W])?X[Y+1][W+1]+1:Math.max(X[Y+1][W],X[Y][W+1]);let J=[];for(let Y=0,W=0;Y<z&&W<Q;)if(B0($[Y],Z[W]))J.push([Y,W]),Y++,W++;else if(X[Y+1][W]>=X[Y][W+1])Y++;else W++;return J}function GC($,Z,z,Q){let X=Z.items,J=X.map((G)=>uY($,G)),Y=[],W=0,U=0;for(let[G,V]of[...UC(J,z),[X.length,z.length]]){for(;W<G&&U<V;W++,U++)Y.push(R5($,X[W],z[U],Q));for(;U<V;U++)Y.push($.createNode(z[U]));if(G<X.length)Y.push(X[G]);W=G+1,U=V+1}Z.items=Y}function z4($,Z,z,Q){if(B0(z,Q))return Z;if(!$0(z)||!$0(Q)||!q0(Z))return R5($,Z,Q);let X=new Set(Object.keys(z).filter((J)=>!(J in Q)||Q[J]===void 0));Z.items=Z.items.filter((J)=>{let Y=Z4(J);return Y===void 0||!X.has(Y)});for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=B6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(!B0(z[J],Y))W.value=z4($,W.value,z[J],Y)}return Z}function dY($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new F$,Q=$.contents;if(!q0(Q))throw Error(`${z}: the document is not a mapping — faf left it unchanged.`);let X=Q;for(let J of Z){let Y=B6(X,J);if(Y&&q0(Y.value)){X=Y.value;continue}if(Y&&!rY(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let W=new F$;if(Y)Y.value=nY(Y.value,W);else X.items.push($.createPair(J,W));X=W}return X}function F5($,Z,z,Q,X){if(B0(z,Q))return;let J=dY($,Z.slice(0,-1),X),Y=Z[Z.length-1],W=B6(J,Y);if(Q===void 0)J.items=J.items.filter((U)=>U!==W);else if(!W)J.items.push($.createPair(Y,Q));else W.value=z4($,W.value,z,Q)}function iY($,Z,z){let Q=dY($,Z.slice(0,-1),z),X=Z[Z.length-1],J=B6(Q,X);if(J&&f2(J.value))return J.value;if(J&&!rY(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new d1;if(J)J.value=nY(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function nY($,Z){if(!C0($))return Z;let z=[$.commentBefore,$.comment].filter(I2);if(z.length>0)Z.commentBefore=z.join(`
221
+ `);return Z}function rY($){if($===null||$===void 0)return!0;return C0($)&&($.value===null||$.value===void 0)}var w3=new WeakMap;function Q4($){return typeof $==="object"&&$!==null?w3.get($):void 0}function P5($,Z){w3.set($,Z)}function sY($,Z){let z=Q4($);if(z)w3.set(Z,z);return Z}var oY=new WeakSet;function aY($){return oY.add($),$}function tY($){return typeof $==="object"&&$!==null&&oY.has($)}function E5($){let Z=x$($);return d(S5(Z),Z,{read:!0})}function x3($){if($ instanceof M5)return $;let Z=$?.cause;return Z instanceof M5?Z:null}function y3($,Z){let z=Z.message.split(`
222
+ `)[0].replace(/ at line \d+, column \d+:?\s*$/,"").replace(/:\s*$/,""),Q=Z.linePos?.[0]?.line,X=x$($);return new v("not-yaml",X,`${X} is not valid YAML (${z}${Q===void 0?"":`, line ${Q}`}) — faf left it unchanged`,{cause:Z})}function s($,Z){try{return Z()}catch(z){if(z instanceof v)throw z;let Q=(z instanceof Error?z.message:String(z)).split(`
223
+ `)[0].trim(),X=x$($);throw new v("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function o($){let Z=E5($),z=Q0(Z),Q;try{Q=r0(z)}catch(J){let Y=x3(J);if(Y)throw y3($,Y);throw J}let X=s1(Q,$);return P5(X,{real:Z,text:z}),X}function k3($){let Z=$._meta,z={...$};delete z._meta;let Q=f6(z,{lineWidth:0});if(Z?.found&&Z.found.length>0){let X=Z.found.join(" + ");Q=Q.replace(/^(\s+type:\s+\S+)(\s*)$/m,(J,Y,W)=>{if(W.includes("#"))return J;return`${Y} # found: ${X}`})}return Q}function KC($,Z,z,Q,X=!1){let J=E5($),Y=Q0(J),W=[],U;try{U=_5(Y,(G)=>{QW(G,$);let V=G.clone();if(Z(G),W=pY(V,G),X)W=[...W,...lY(V,G)];if(Q)W=[...W,...Q(G,V.toJS()).filter((H)=>!W.some((K)=>K.path===H.path))]},$)}catch(G){let V=x3(G);if(V)throw y3($,V);throw G}if(!U.changed)return{written:!1,text:Y,keptAliases:W};return a($,U.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:U.text,keptAliases:W}}function p0($){if($.kind==="anchor")return`${$.path} holds an anchor (${$.alias}) that an alias reads — faf left it as written`;return`${$.path} is an alias (${$.alias}) — faf left it as written`}function $W($){try{return zW($),!0}catch{return!1}}function qC($){let Z=$.getIn(["project","type"],!0);return C0(Z)?Z.value:Z}function QW($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!q0(z))throw new v("not-yaml",x$(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${m6($.toJS())}. faf left it unchanged — fix it by hand.`)}function BC($,Z,z){QW($,z);let Q=$.contents,X=q0(Q)&&Q.items.some((V)=>C0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,W=qC($),U=q0(Q)?$.toJS():{},G=q0(Q)?Q:$.createNode({});if($.contents=G,j3($,G,U,X?{...Z}:Y),!X)LC($,J?.found,W)}function MC($,Z){let z=$.contents;if(q0(z)&&z.items.some((J)=>C0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function LC($,Z,z){if(!Z||Z.length===0||!G0(z))return;let Q=$.getIn(["project","type"],!0);if(C0(Q)&&!G0(Q.value)&&(Q.comment===null||Q.comment===void 0))Q.comment=` found: ${Z.join(" + ")}`}function M0($,Z,z={}){if(!z.replace&&$W($)){let W=KC($,(U)=>BC(U,Z,$),Q4(Z),(U,G)=>mY(U,MC(U,Z),G),tY(Z));P5(Z,{real:E5($),text:W.text});for(let U of W.keptAliases??[])z.onAliasKept?.(U);return W.written}let Q=x$($),X=k3(Z),J=$W($)?k0(d(S5(Q),Q)):null,Y=a($,X,{expect:J});return P5(Z,{real:Y,text:X}),!0}function l($){return Q0(E5($))}function X2($,Z){let z;try{z=r0($)}catch(Q){let X=x3(Q);if(Z!==void 0&&X)throw y3(Z,X);throw Q}return Z===void 0?z:s1(z,Z)}function ZW($,Z){let z;try{z=zW(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return d($,x$(Z),{read:!0}),!0}function u($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=eY($,Q);if(ZW($,X))return X}let z=S5($);if(z!==$)for(let Q of Z){let X=eY(z,Q);if(ZW(z,X))return X}return null}function y$($,Z=process.cwd()){return HC("git",["-C",S5($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+VC($)}n();var k$=[{name:"TROPHY",indicator:`${F0("✪")} ${F0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${F0(C("★"))} ${F0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${T("◆")} ${T("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${j5("◇")} ${j5("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${C("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${M("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${M("○")} RED`,threshold:1},{name:"WHITE",indicator:`${M("♡")}`,threshold:0}];function T2($){return $.indicator}function M6($){for(let Z of k$)if($>=Z.threshold)return Z;return k$[k$.length-1]}var v3=null;function J4(){if(v3)return v3;try{let $=n0("faf-scoring-kernel");return v3=$,$}catch{throw Error(`faf-scoring-kernel not installed.
224
224
 
225
225
  Run: npm install faf-scoring-kernel
226
- `)}}var y3=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function YC($){let Z={};for(let[z,Q]of Object.entries($.slots??{}))Z[BY.get(z)??z]=Q;return{...$,slots:Z}}function F0($){return YC(JSON.parse(z4().score_faf(y3($))))}function oY($){return z4().validate_faf(y3($))}function E5($){return z4().compile_fafb(y3($))}function aY($){return JSON.parse(z4().decompile_fafb($))}function tY(){return z4().sdk_version()}var eY=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function $W($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function ZW($){let Z=$.match(/^about:\s*\n((?:[ \t]+.*\n?)*)/m);if(!Z)return null;let z=Z[1]??"",Q=z.match(/^[ \t]+represents:\s*(\S+)\s*$/m);if(!Q)return null;let X=Q[1],J=z.match(/^[ \t]+source_score:\s*(\d+)\s*$/m),Y=-1;if(J){let W=parseInt(J[1],10);if(W>=0&&W<=100)Y=W}return{represents:X,sourceScore:Y}}function k3($){return $.unknown?"unknown (—)":`${$.score}%`}function b0($){return{score:$.score,tier:q6($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function D0($){let Z=ZW($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?q6(z):j$[j$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents,...z<0?{unknown:!0}:{}}}return b0(F0($))}function WC($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function b3($){try{let Z=v6($,{logLevel:"error"}).getIn(["project","type"],!0);return C0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(F$)}catch{return!1}}function UC($,Z,z,Q,X){if(z===!0||z===null&&Q)return`${$} says '${Z}' — this app-type needs it, so it counts as empty until filled.`;if(z===!1&&X)return`${$} says '${Z}' — this app-type doesn't use it; faf auto marks it slotignored.`;return null}function GC($){try{let Z=v6($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return $0(z)?z:null}catch{return null}}function j5($,Z,z={}){let Q=GC($);if(Q===null)return[];let X=$0(Q.project)&&!b3($)?Q.project.type:void 0,J=[];for(let Y of J0){let W=WC(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!P$(W))continue;let U=u6.library.includes(Y.category),G=UC(Y.path,String(W).trim(),m6(X,Y),U,z.outOfType!==!1);if(G!==null)J.push(G)}return J}i();i();import{existsSync as VC,readFileSync as HC}from"fs";import{join as zW}from"path";import{homedir as KC}from"os";var qC=95,BC=30,MC=3,v3=zW(KC(),".config","faf"),g3=zW(v3,"star-nudge"),LC="github.com/Wolfe-Jam/faf-cli";function NC($){if($.score<qC)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??MC))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??BC)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function DC(){try{if(!VC(g3))return{shown:0,lastShownMs:null};let $=HC(g3,"utf-8").trim();if($.startsWith("{")){let z=JSON.parse($),Q=z.last?Date.parse(z.last):NaN;return{shown:Number.isFinite(z.shown)?Number(z.shown):0,lastShownMs:Number.isFinite(Q)?Q:null}}let Z=Date.parse($);return{shown:1,lastShownMs:Number.isFinite(Z)?Z:null}}catch{return{shown:0,lastShownMs:null}}}function OC($){let Z=new TextDecoder().decode($).trim();try{let z=JSON.parse(Z);return typeof z==="object"&&z!==null&&Object.keys(z).every((Q)=>Q==="shown"||Q==="last")}catch{return/^\d{4}-\d{2}-\d{2}T[\d:.]+Z$/.test(Z)}}function IC($,Z){try{w0(v3),w2(g3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:v3,owns:OC,mark:"faf star-nudge state"})}catch{}}function QW($){let Z=Date.now(),z=DC();if(!NC({score:$,isTTY:Boolean(process.stdout.isTTY),isCI:Boolean(process.env.CI),optedOut:Boolean(process.env.FAF_NO_NUDGE),shownCount:z.shown,lastShownMs:z.lastShownMs,nowMs:Z}))return;console.log(""),console.log(` ${P0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${LC}`),IC(z.shown,Z)}function S0($,Z,z=!1,Q=[]){if($.unknown){let Y=$.represents?`about-repo for ${$.represents}`:"about-repo";console.log(`${M("—")} ${C("unknown")} ${M(`${Y} — no about.source_score`)} ${M("—")} ${Z}`);return}let X=I2($.tier),J=C(`${$.score}%`);if(console.log(`${X} ${J} ${M(`${$.populated}/${$.active} slots`)} ${M("—")} ${Z}`),$.tier.name==="TROPHY")console.log(M(" Trophy. AI never has to guess."));else if($.empty>0){let Y=Object.entries($.slots).filter(([,V])=>V==="empty").map(([V])=>V),W=Y.slice(0,3).join(", "),U=Y.length>3?`, +${Y.length-3} more`:"",G=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${G} from Trophy: ${W}${U}`))}if(TC(Q),z)console.log(""),AC($);QW($.score)}function TC($){for(let Z of $)console.log(M(` ${Z}`))}function AC($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?T("●"):z==="slotignored"?M("—"):M("○");console.log(` ${Q} ${z==="slotignored"?M(`${Z}: slotignored`):Z}`)}}i();function w5($,Z={}){let z=$??f();if(!z)console.error(`Error: project.faf not found
227
-
228
- Run 'faf init' to create one.`),process.exit(2);let Q=p(z);X2(Q,z);let X=n(z,()=>D0(Q));if(Z.json){let J=r(z),Y={faf_version:J.faf_version??"unknown",project:J.project?.name??"unknown",source:z,...X};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(X.unknown?`— ${C(k3(X))}`:`${I2(X.tier)} ${C(k3(X))}`);return}S0(X,z,Z.verbose,j5(Q,X))}import{existsSync as eP}from"fs";import{join as nW}from"path";var B6="3.0";import{join as NW}from"path";var XW=[{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{join as _C}from"path";var w$={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 RC=w$.flutterDeps,PC=w$.mcpDeps,FC=w$.serverFrameworks,SC=w$.stateManagement,EC=w$.routing;function jC($){let Z=new Set,z=!1;for(let Q of $.split(`
229
- `)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(Q)){z=!0;continue}if(/^\S/.test(Q))z=!1;if(z){let X=Q.match(/^\s{2}([a-zA-Z0-9_]+):/);if(X)Z.add(X[1].toLowerCase())}}return Z}function x5($){let Z=m($,"pubspec.yaml");if(Z===null)return null;let z=jC(Z),Q=(_)=>z.has(_.toLowerCase()),X=RC.some(Q)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),J=PC.find(Q),Y=FC.find(([_])=>Q(_)),W=SC.find(([_])=>Q(_)),U=W?W[1]:"",G=EC.find(([_])=>Q(_)),V=G?G[1]:"",H=Q("flutter_test")?"flutter_test":Q("test")?"test":"",K=/^executables:\s*$/m.test(Z),q=(X0($,"bin")??[]).some((_)=>_.name.endsWith(".dart")),L=K||q,B,N="",I;if(X)if(N="Flutter",A($,_C("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))B="mobile",I="pubspec.yaml (Flutter app)";else B="library",I="pubspec.yaml (Flutter package)";else if(J)B="mcp",I=`pubspec.yaml + ${J} (Dart MCP server)`;else if(Y)B="backend",N=Y[1],I=`pubspec.yaml + ${Y[0]} (Dart backend)`;else if(L)B="cli",I=K?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else B="library",I="pubspec.yaml (Dart package)";return{appType:B,isFlutter:X,framework:N,stateManagement:U,routing:V,testing:H,found:I}}import{join as xC}from"path";var y5={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 yC=y5.mcpModules,kC=y5.serverFrameworks,bC=y5.cliFrameworks;function vC($){let Z=new Set,z=!1;for(let Q of $.split(`
230
- `)){let X=Q.replace(/\/\/.*$/,"").trim();if(!X)continue;if(/^require\s*\(\s*$/.test(X)){z=!0;continue}if(z){if(X===")"){z=!1;continue}let Y=X.match(/^(\S+)/);if(Y)Z.add(Y[1].toLowerCase());continue}let J=X.match(/^require\s+(\S+)/);if(J&&J[1]!=="(")Z.add(J[1].toLowerCase())}return Z}function YW($,Z){let z=Z.toLowerCase();for(let Q of $)if(Q===z||Q.startsWith(`${z}/`))return!0;return!1}function JW($,Z){let z;for(let Q of Z){if(!YW($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function gC($,Z){let z;for(let Q of Z){if(!YW($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function hC($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function fC($){for(let{name:Z}of X0($,"cmd")??[]){let z=xC("cmd",Z),Q=D2($,z);if(Q?.isDirectory()){if((X0($,z)??[]).some((X)=>X.name.endsWith(".go")))return!0}else if(Q&&Z.endsWith(".go"))return!0}return!1}function uC($){let Z=m($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function k5($){let Z=m($,"go.mod");if(Z===null)return null;let z=hC(Z),Q=vC(Z),X=gC(Q,yC),J=JW(Q,kC),Y=JW(Q,bC),W=fC($),U=uC($),G,V="",H;if(X)G="mcp",H=`go.mod + ${X} (Go MCP server)`;else if(J)G="backend",V=J[1],H=`go.mod + ${J[0]} (Go backend)`;else if(Y)G="cli",V=Y[1],H=`go.mod + ${Y[0]} (Go CLI)`;else if(W)G="cli",H="go.mod + cmd/ (Go CLI layout)";else if(U&&!J)G="cli",H="go.mod + main.go package main (Go CLI)";else G="library",H="go.mod (Go module)";return{appType:G,modulePath:z,framework:V,found:H}}var p6={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 cC=p6.mcpPackages.map(($)=>$.toLowerCase()),pC=p6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),lC=p6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),dC=p6.grpcServerPackages.map(($)=>$.toLowerCase()),iC=p6.specializedSdks,WW=p6.baseSdk.toLowerCase();function nC($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),z=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),Q=(Z?.[1]||z?.[1]||"").trim(),X=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),J=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||J||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),G=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),V=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),H=/<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 q=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))q.add(L[1].toLowerCase());return{sdk:Q,outputType:X,targetFramework:W,isTestProject:U,useMaui:G,useWpf:V,useWindowsForms:H,packages:K,frameworkRefs:q}}function h3($,Z){let z=Z.toLowerCase();if($.has(z))return!0;for(let Q of $)if(Q===z||Q.startsWith(`${z}.`))return!0;return!1}function UW($,Z){let z;for(let[Q,X]of Z){if(!h3($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function rC($){let Z;for(let z of cC){if(!h3($,z))continue;if(!Z||z.length>Z.length)Z=z}for(let z of $)if(z==="modelcontextprotocol"||z.startsWith("modelcontextprotocol.")){if(!Z||z.length>Z.length)Z=z}return Z}function sC($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of iC){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function b5($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function oC($,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 aC($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,W,U="",G,V=rC(X),H=sC(Q),K=UW(X,lC),q=UW(X,pC),L=dC.some((N)=>h3(X,N)),B=J.has("microsoft.aspnetcore.app");if(V)W="mcp",U="MCP",G=`${Z} + ${V} (C# MCP server)`;else if($.isTestProject||H?.[1]==="test"||K)W="library",U=K?.[1]||(H?.[1]==="test"?H[2]:"Test"),G=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",G=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",G=`${Z} + ${U}`;else if(H?.[1]==="web")W="backend",U=L?"gRPC":H[2],G=`${Z} + Sdk=${H[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(H?.[1]==="worker")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Worker)`;else if(H?.[1]==="blazor-wasm")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Blazor WASM)`;else if(H?.[1]==="aspire")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Aspire)`;else if(H?.[1]==="razor-lib")W="library",U=H[2],G=`${Z} + Sdk=${H[0]} (Razor class library)`;else if(B&&b5(Y))W="backend",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!b5(Y))W="library",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(q&&(b5(Y)||!Y))W="cli",U=q[1],G=`${Z} + ${q[0]} (C# CLI)`;else if(b5(Y))W="cli",G=`${Z} + OutputType=Exe (C# console)`;else{W="library";let N=Q?` Sdk=${Q}`:"";if(G=`${Z}${N} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!Q||Q.toLowerCase()===WW||Q.toLowerCase().startsWith(`${WW}/`))G=`${Z} (C# class library)`}return{appType:W,projectName:z,targetFramework:$.targetFramework,sdk:Q||"Microsoft.NET.Sdk",framework:U,found:G}}function x$($){return(X0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function v5($){let Z=x$($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=m($,X);if(J===null)continue;let Y=nC(J),W=aC(Y,X),U=oC(W.appType,W.framework);if(!z||U<Q)z=W,Q=U}return z}import{join as l6}from"path";var T2={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 eC=T2.mcpArtifacts.map(($)=>$.toLowerCase()),$_=T2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),Z_=T2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),z_=T2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),xv=T2.androidPlugins.map(($)=>$.toLowerCase()),Q_=T2.kmpPlugins.map(($)=>$.toLowerCase()),X_=T2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),J_=T2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),Y_=T2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),W_=T2.libraryPlugins.map(($)=>$.toLowerCase()),U_=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function f3($){return U_.some((Z)=>A($,Z))}function G_($){let Z=new Map,z=new Map,Q="";for(let X of $.split(`
231
- `)){let J=X.replace(/#.*$/,"").trim();if(!J)continue;let Y=J.match(/^\[([^\]]+)\]$/);if(Y){Q=Y[1].trim().toLowerCase();continue}let W=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(W&&(Q==="plugins"||Q.endsWith(".plugins"))){Z.set(W[1].replace(/-/g,".").toLowerCase(),W[2].toLowerCase()),Z.set(W[1].toLowerCase(),W[2].toLowerCase());continue}let U=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(U&&(Q==="libraries"||Q.endsWith(".libraries"))){let H=U[1].toLowerCase();z.set(H,U[2].toLowerCase()),z.set(H.replace(/-/g,"."),U[2].toLowerCase());continue}let G=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(G&&(Q==="libraries"||Q.endsWith(".libraries"))){let H=`${G[2]}:${G[3]}`.toLowerCase(),K=G[1].toLowerCase();z.set(K,H),z.set(K.replace(/-/g,"."),H);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let H=V[1].toLowerCase(),K=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let q=K.split(":")[0].toLowerCase();Z.set(H,q),Z.set(H.replace(/-/g,"."),q)}else if(Q==="libraries"||Q.endsWith(".libraries")){let q=K.split(":");if(q.length>=2){let L=`${q[0]}:${q[1]}`.toLowerCase();z.set(H,L),z.set(H.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:z}}function V_($){let Z=m($,l6("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return G_(Z)}function H_($){let Z=[];for(let z of $.matchAll(/include\s*\(\s*([^)]+)\)/g))for(let Q of z[1].split(",")){let X=Q.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let z of $.matchAll(/include\s+((?:['"][^'"]+['"]\s*,?\s*)+)/g))for(let Q of z[1].split(",")){let X=Q.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let z of $.matchAll(/project\s*\(\s*["']:([^"']+)["']\s*\)\s*\.projectDir\s*=\s*file\s*\(\s*["']([^"']+)["']\s*\)/g))Z.push(z[2].replace(/^\.\//,""));return[...new Set(Z)]}function K_($,Z){let z=new Set;for(let Q of $.matchAll(/\bid\s*\(\s*["']([^"']+)["']\s*\)/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/\bid\s+['"]([^'"]+)['"]/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/plugins\s*\{([\s\S]*?)\}/g))for(let X of Q[1].split(/[\n;]/)){let J=X.replace(/\/\/.*$/,"").trim();if(!J||J.startsWith("id")||J.startsWith("kotlin")||J.startsWith("alias"))continue;let Y=J.match(/^`([a-zA-Z0-9.-]+)`$/)||J.match(/^([a-zA-Z][a-zA-Z0-9.-]*)$/);if(Y)z.add(Y[1].toLowerCase())}for(let Q of $.matchAll(/\bkotlin\s*\(\s*["']([^"']+)["']\s*\)/g)){let X=Q[1].toLowerCase();if(X==="jvm")z.add("org.jetbrains.kotlin.jvm");else if(X==="multiplatform")z.add("org.jetbrains.kotlin.multiplatform");else if(X==="android")z.add("org.jetbrains.kotlin.android");else z.add(`org.jetbrains.kotlin.${X}`)}for(let Q of $.matchAll(/libs\.plugins\.([A-Za-z0-9_.]+)/g)){let X=Q[1].toLowerCase(),J=Z.plugins.get(X)||Z.plugins.get(X.replace(/\./g,"-"))||Z.plugins.get(X.replace(/-/g,"."));if(J)z.add(J);else if(X.includes("spring")&&X.includes("boot"))z.add("org.springframework.boot")}for(let Q of $.matchAll(/apply\s+plugin\s*:\s*['"]([^'"]+)['"]/g))z.add(Q[1].toLowerCase());return z}function q_($,Z){let z=new Set;for(let Q of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let X=Q[1].toLowerCase();if(X.startsWith("plugins."))continue;let J=[X,X.replace(/\./g,"-"),X.replace(/-/g,".")];for(let Y of J){let W=Z.libraries.get(Y);if(W){z.add(W.includes(":")?W.split(":").slice(0,2).join(":"):W);break}}}return z}function HW($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),z=new Set,Q=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(Q){let Y=Q[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=Q[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)z.add(`${Y}:${W}`.toLowerCase())}let X=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)X.add(`${W}:${U}`.toLowerCase())}let J=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))J.push(Y[1].trim());return{packaging:Z,parents:z,artifacts:X,modules:J}}function u2($,Z){let z=Z.toLowerCase();if($.has(z))return!0;for(let Q of $)if(Q===z||Q.endsWith(`.${z}`)||Q===z.replace(/^org\.gradle\./,""))return!0;return!1}function Q4($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=u2($,X);else if(Y=$.has(X)||[...$].some((W)=>W===X||W.startsWith(`${X}:`)||W.startsWith(`${X}.`)),!Y&&z==="artifact")Y=[...$].some((W)=>W===X||W.startsWith(`${X}`));if(!Y)continue;if(!Q||X.length>Q[0].length)Q=[X,J]}return Q}function B_($){let Z;for(let z of eC)for(let Q of $){if(Q===z||Q.startsWith(`${z}:`)||Q.startsWith(z.replace(/:mcp$/,":"))){if(!Z||z.length>Z.length)Z=z}if(Q.startsWith("io.modelcontextprotocol")||Q.includes("spring-ai-starter-mcp")||Q.includes("spring-ai-mcp")){if(!Z||Q.length>Z.length)Z=Q}}return Z}function KW($,Z){let z=new Set,Q=!1,X=!1,J=[l6(Z,"src"),l6(Z,"src","main")],Y=(W,U)=>{if(U>4)return;let G=X0($,W);if(!G)return;for(let{name:V}of G){if(V==="androidMain"||V==="commonMain"||V==="jvmMain"||V==="iosMain")z.add(V);let H=l6(W,V),K=D2($,H);if(!K)continue;if(K.isDirectory())Y(H,U+1);else if(V.endsWith(".kt")||V.endsWith(".kts"))Q=!0;else if(V.endsWith(".java"))X=!0}};for(let W of J)Y(W,0);return{kotlin:Q,java:X,hints:z}}function M_($){let Z=[],z=$.plugins,Q=$.artifacts,X=Q_.some((E)=>u2(z,E))||$.sourceHints.has("commonMain"),J=u2(z,"com.android.application"),Y=u2(z,"com.android.library")||u2(z,"com.android.kotlin.multiplatform.library");if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let W=B_(Q),U=Q4(z,$_,"plugin"),G=Q4($.parents,Z_,"parent"),V=Q4(Q,z_,"artifact"),H=Q4(z,J_,"plugin"),K=Q4(Q,Y_,"artifact"),q=W_.some((E)=>u2(z,E)),L=$.packaging==="pom",B,N="",I;if(J)B="mobile",N=X?"Android+KMP":"Android",I=`${$.path||"root"} + com.android.application (${N})`;else if(W)B="mcp",N="MCP",Z.push("mcp"),I=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||G||V){B="backend",N=U?.[1]||G?.[1]||V?.[1]||"JVM";let E=U?.[0]||G?.[0]||V?.[0]||"web";I=`${$.path||"root"} + ${E} (JVM backend)`}else if(X&&!Y)B="library",N="Kotlin Multiplatform",I=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",N=X?"Android+KMP":"Android",I=`${$.path||"root"} + android library (${N})`;else if(K||$.hasApplicationPlugin&&($.hasMainClass||H)||H&&$.hasMainClass)B="cli",N=K?.[1]||"application",I=K?`${$.path||"root"} + ${K[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!q)B="cli",N="application",I=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",I=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let E=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(I=`${$.path||"root"} (${E} library)`,q)I=`${$.path||"root"} + java-library (JVM library)`}let _="Java";if($.kotlinSources&&$.javaSources)_="Java/Kotlin";else if($.kotlinSources||X_.some((E)=>u2(z,E))||X)_="Kotlin";let y=[...new Set(Z)];return{appType:B,framework:N,facets:y,found:I,buildTool:$.buildTool,mainLanguage:_}}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 GW($,Z,z){let Q=l6(Z,"build.gradle.kts"),X=l6(Z,"build.gradle"),J=A($,Q)?Q:A($,X)?X:null;if(!J)return null;let Y=m($,J);if(!Y)return null;let W=K_(Y,z),U=q_(Y,z),G=KW($,Z),V=/mainClass\s*[.=]/.test(Y)||/mainClassName\s*=/.test(Y)||/Main-Class/.test(Y),H=u2(W,"application")||u2(W,"org.gradle.application");return{path:Z||"build.gradle",plugins:W,artifacts:U,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:H,sourceHints:G.hints,kotlinSources:G.kotlin||J.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function VW($,Z){let z=m($,l6(Z,"pom.xml"));if(!z)return null;let{packaging:Q,parents:X,artifacts:J}=HW(z),Y=KW($,Z);return{path:Z?`${Z}/pom.xml`:"pom.xml",plugins:new Set,artifacts:J,packaging:Q,parents:X,hasMainClass:/<mainClass>/.test(z),hasApplicationPlugin:!1,sourceHints:Y.hints,kotlinSources:Y.kotlin,javaSources:Y.java,buildTool:"maven"}}function X4($){if(!f3($))return null;let Z=V_($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"])if(A($,G)){Q=m($,G);break}let X=Q?H_(Q):[],J=GW($,"",Z);if(J)z.push(J);for(let G of X){let V=GW($,G,Z);if(V)z.push(V)}let Y=VW($,"");if(Y){z.push(Y);let G=m($,"pom.xml");if(G){let{modules:V}=HW(G);for(let H of V){let K=VW($,H);if(K)z.push(K)}}}if(z.length===0&&Q)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(z.length===0)return null;let W=null,U=999;for(let G of z){let V=M_(G),H=L_(V.appType,V.facets);if(!W||H<U)W={appType:V.appType,framework:V.framework,buildTool:V.buildTool,mainLanguage:V.mainLanguage,facets:V.facets,found:V.found},U=H}if(W&&X.length>0&&!W.found.includes("multi-project"));return W}import{join as D_}from"path";var J4={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 O_=J4.mcpGems.map(($)=>$.toLowerCase()),I_=J4.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),qW=J4.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),T_=J4.railsLayoutFiles;function A_($){return A($,"Gemfile")||A($,"gems.rb")||C_($)}function C_($){return(X0($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function __($){let Z=new Set;for(let z of $.split(`
232
- `)){let Q=z.replace(/#.*$/,"").trim();if(!Q)continue;let X=Q.match(/^\s*gem\s+['"]([^'"]+)['"]/i)||Q.match(/^\s*gem\s+:([A-Za-z0-9_.-]+)/i);if(X)Z.add(X[1].toLowerCase())}return Z}function R_($){let Z=new Set,z=!1;for(let Q of $.split(`
233
- `)){let X=Q.replace(/\r$/,"");if(/^\s*specs:\s*$/.test(X)){z=!0;continue}if(z){if(/^[A-Z]/.test(X)||X.startsWith("PLATFORMS")||X.startsWith("DEPENDENCIES")||X.startsWith("BUNDLED")||X.startsWith("RUBY VERSION")||X.startsWith("CHECKSUMS")){z=!1;continue}let J=X.match(/^\s{2,}([a-zA-Z0-9_.-]+)\s*\(/);if(J)Z.add(J[1].toLowerCase())}}return Z}function P_($){let Z=new Set;for(let z of $.split(`
234
- `)){let X=z.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(X)Z.add(X[1].toLowerCase())}return Z}function F_($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=m($,X);if(J){for(let Y of __(J))Z.add(Y);z.push(X)}}let Q=m($,"Gemfile.lock")||m($,"gems.locked");if(Q){for(let X of R_(Q))Z.add(X);z.push("Gemfile.lock")}for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=m($,X);if(J){for(let Y of P_(J))Z.add(Y);z.push(X)}}return{gems:Z,sources:z}}function Y4($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function u3($,Z){let z;for(let[Q,X]of Z){if(!Y4($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function S_($){let Z;for(let z of O_)if(Y4($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function BW($){for(let Z of T_)if(A($,Z))return Z;return}function E_($,Z){let z=u3(Z,qW);if(z)return{hit:!0,why:z[0]};for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=m($,X);if(J&&/executables\s*=/.test(J)&&!/executables\s*=\s*\[\s*\]/.test(J))return{hit:!0,why:`${X} executables`}}let Q=X0($,"bin");if(Q){let J=Q.map((Y)=>Y.name).filter((Y)=>{if(Y==="setup"||Y==="console"||Y==="rake")return!1;return D2($,D_("bin",Y))?.isFile()===!0}).filter((Y)=>Y!=="rails");if(J.length>0&&!Y4(Z,"rails")&&!BW($))return{hit:!0,why:`bin/${J[0]}`}}return{hit:!1,why:""}}function g5($){if(!A_($))return null;let{gems:Z,sources:z}=F_($),Q=z[0]||"Gemfile",X=z.some((N)=>N==="Gemfile"||N==="gems.rb"||N.includes("lock"))?"bundler":"rubygems",J=S_(Z),Y=u3(Z,I_),W=BW($),U=Y4(Z,"rails")||Y4(Z,"railties"),G=E_($,Z),V=A($,"config.ru"),H=U||!!W,K=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!V)?Y:void 0,q,L="",B;if(J)q="mcp",L="MCP",B=`${Q} + gem ${J} (Ruby MCP)`;else if(H)if(q="backend",L="Rails",U&&W)B=`${Q} + rails + ${W} (Rails)`;else if(U)B=`${Q} + gem rails (Rails)`;else B=`${W} (Rails layout)`;else if(K)q="backend",L=K[1],B=`${Q} + gem ${K[0]} (Ruby backend)`;else if(G.hit)q="cli",L=u3(Z,qW)?.[1]||"",B=`${Q} + ${G.why} (Ruby CLI)`;else q="library",B=`${Q} (Ruby library)`;return{appType:q,framework:L,packageManager:X,found:B}}import{join as w_}from"path";var x2={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 x_=x2.mcpPackageUrls.map(($)=>$.toLowerCase()),y_=x2.mcpProducts.map(($)=>$.toLowerCase()),k_=x2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),b_=x2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),v_=x2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),g_=x2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),h_=x2.appProductTypes,f_=x2.cliProductTypes,u_=x2.vaporLayoutFiles;function m_($){return A($,"Package.swift")||m3($).length>0}function m3($){return(X0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&D2($,Z)?.isDirectory()===!0)}function c_($){let Z=p_($),z=Z.toLowerCase(),Q=[],X=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,J;while((J=X.exec(Z))!==null)Q.push(J[1]);let Y=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((J=Y.exec(Z))!==null)Q.push(J[1]);let W=[],U=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((J=U.exec(Z))!==null)W.push(J[1]);let G=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((J=G.exec(Z))!==null)W.push(J[1]);let V=/\.library\s*\(/.test(z),H=/\.executable\s*\(/.test(z),K=/\.plugin\s*\(/.test(z)&&!V&&!H?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(z),q=/\.executabletarget\s*\(/.test(z),L=/\.target\s*\(/.test(z)&&!q?!0:(z.match(/\.target\s*\(/g)||[]).length>(z.match(/\.executabletarget\s*\(/g)||[]).length+(z.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:Q,productNames:W,hasLibraryProduct:V,hasExecutableProduct:H,hasPluginProduct:!!K,hasExecutableTarget:q,hasLibraryTarget:L}}function p_($){let Z="",z=0;while(z<$.length){if($[z]==='"'||$[z]==="'"){let Q=$[z];Z+=Q,z++;while(z<$.length){if($[z]==="\\"&&z+1<$.length){Z+=$[z]+$[z+1],z+=2;continue}if(Z+=$[z],$[z]===Q){z++;break}z++}continue}if($[z]==="/"&&$[z+1]==="/"){z+=2;while(z<$.length&&$[z]!==`
235
- `)z++;continue}if($[z]==="/"&&$[z+1]==="*"){z+=2;while(z<$.length&&!($[z]==="*"&&$[z+1]==="/"))z++;z+=2;continue}Z+=$[z],z++}return Z}function l_($,Z){let z=$.map((X)=>X.toLowerCase()),Q;for(let X of Z)for(let J of z)if(J.includes(X)&&(!Q||X.length>Q.length))Q=X;return Q}function MW($,Z){let z=$.map((X)=>X.toLowerCase()),Q;for(let[X,J]of Z)for(let Y of z)if(Y.includes(X)&&(!Q||X.length>Q[0].length))Q=[X,J];return Q}function LW($,Z){let z=$.map((X)=>X.toLowerCase()),Q;for(let[X,J]of Z)if(z.includes(X)&&(!Q||X.length>Q[0].length))Q=[X,J];return Q}function d_($){let Z=$.map((z)=>z.toLowerCase());return y_.some((z)=>Z.includes(z))}function i_($){let Z=!1,z=!1,Q;for(let X of m3($)){let J=m($,w_(X,"project.pbxproj"));if(!J)continue;for(let Y of h_)if(J.includes(Y))Z=!0,Q=Y;for(let Y of f_)if(J.includes(Y)){if(z=!0,!Q)Q=Y}}return{hasApplication:Z,hasTool:z,hit:Q}}function n_($){for(let Z of u_)if(A($,Z))return Z;return}function W4($){if(!m_($))return null;let Z=A($,"Package.swift"),z=m3($),Q=z.length>0,X=null;if(Z){let S=m($,"Package.swift");if(S)X=c_(S)}let J=Q?i_($):{hasApplication:!1,hasTool:!1},Y=n_($),W=X?.packageUrls??[],U=X?.productNames??[],G=l_(W,x_),V=d_(U),H=MW(W,k_),K=LW(U,b_),q=MW(W,v_),L=LW(U,g_),B=!!(G||V),N=!!(H||K||Y),I=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),_=!!(q||L),y=J.hasApplication,E=Z&&Q?"spm+xcode":Z?"spm":"xcode",w,j="",u;if(B)if(w="mcp",j="MCP",V)u="Package.swift + product MCP (Swift MCP)";else u=`Package.swift + ${G} (Swift MCP)`;else if(N)if(w="backend",j=K?.[1]||H?.[1]||(Y?"Vapor":""),K)u=`Package.swift + product ${K[1]} (Swift backend)`;else if(H)u=`Package.swift + ${H[1]} (Swift backend)`;else u=`${Y} (Swift backend layout)`;else if(y)w="app",j="",u=`${z[0]} + ${J.hit||"application"} (Swift app)`;else if(_||I&&!N&&!B)if(w="cli",j=L?.[1]||q?.[1]||"",L)u=`Package.swift + product ${L[1]} (Swift CLI)`;else if(q)u=`Package.swift + ${q[1]} (Swift CLI)`;else if(X?.hasExecutableProduct)u="Package.swift + .executable product (Swift CLI)";else u="Package.swift + .executableTarget (Swift CLI)";else if(J.hasTool&&!Z)w="cli",u=`${z[0]} + tool productType (Swift CLI)`;else if(Z)if(w="library",X?.hasLibraryProduct)u="Package.swift + .library product (Swift library)";else u="Package.swift (Swift library)";else w="library",u=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:w,framework:j,packageManager:E,found:u}}function r_($){let Z=m($,"Cargo.toml");if(Z===null)return null;let z=Z.match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}function s_($){let Z=m($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function o_($,Z){if(Z?.keywords?.some((Q)=>/^sdk(?:\s|-|$)|-sdk$/i.test(Q)))return'package.json keywords contains "sdk"';if(Z?.name&&/(?:^|[-_/])sdk(?:[-_/]|$)/i.test(Z.name))return`package.json name "${Z.name}" → sdk`;let z=r_($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function a_($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let z of Z){let Q=m($,z);if(Q===null)continue;try{let X=JSON.parse(Q);if(typeof X.manifest_version==="number")return`${z} manifest_version ${X.manifest_version} (browser extension)`}catch{}}return null}function t_($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=m($,"pyproject.toml");if(z!==null){let X=z.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let Q=m($,"requirements.txt");if(Q!==null){let X=Q.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function e_($,Z){let z=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let Q of z)if(Z.dependencies?.[Q]||Z.devDependencies?.[Q])return`${Q} dependency`}if(A($,"ios")&&A($,"android"))return"ios/ + android/ dirs";return null}function $R($,Z){let z=m($,"Cargo.toml");if(z!==null){if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(z))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(z))return"Cargo.toml wasm-bindgen/wasm-pack"}let Q=m($,"build.zig");if(Q!==null&&/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(Q))return"build.zig wasm target";if(Z?.keywords?.some((X)=>/^wasm(?:-|$)|webassembly/i.test(X)))return'package.json keywords contains "wasm"';return null}function ZR($,Z){if(!A($,"index.html"))return null;if(Z?.dependencies||Z?.devDependencies){let z={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>z[X]))return null}return"index.html (vanilla, no frontend framework)"}function zR($,Z){if(Z?.name&&/specification|^@.*\/spec/i.test(Z.name))return`package name "${Z.name}" → documentation`;if(Z?.keywords?.some((z)=>/^(specification|format-spec|standard)$/i.test(z)))return'package keywords contains "specification"';if(Z?.bin)return null;if(Z?.files&&Z.files.length>0){let z=/^(dist|src|lib|build|bin)(\/|$)|\/(dist|src|lib|build|bin)(\/|$)|(\.|\/)(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,Q=Z.files.some((J)=>z.test(J)),X=Z.files.some((J)=>/\.(md|MD)$|examples?\//.test(J)||J==="README.md"||J==="docs"||J==="docs/");if(!Q&&X)return"package.json files = docs/examples only (no source)"}return null}function QR($,Z,z){let Q=z.find((X)=>X.slug==="astro"||X.slug==="gatsby");if(Q)return`${Q.name} (static-site framework)`;if(Z?.keywords?.some((X)=>/^(website|marketing|landing|brochure|portfolio)$/i.test(X)))return'package keywords contains "website"/"marketing"/"landing"';return null}function XR($,Z){if(!Z)return null;let z={...Z.dependencies??{},...Z.devDependencies??{}},Q=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],X=["stripe","@stripe/stripe-js","lemonsqueezy"],J=Q.some((W)=>z[W]),Y=X.some((W)=>z[W]);if(J&&Y)return"auth + payment dependencies";return null}function JR($,Z,z){if(Z?.keywords?.some((J)=>/mcpaas/i.test(J)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let Q=z.some((J)=>J.slug==="mcp"),X=z.some((J)=>J.category==="database");if(Q&&X&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function YR($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||A($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var WR=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"]),DW=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,UR=new Set(["frontend","backend","database","css","ui","state"]);function GR($){if(A($,"pyproject.toml")||A($,"manage.py")||A($,"setup.py")||h5($,"requirements*.txt"))return!0;if(A($,"go.mod"))return!0;if(A($,"Cargo.toml"))return!0;if(A($,"Gemfile"))return!0;if(A($,"pom.xml")||h5($,"build.gradle*"))return!0;if(x$($).length>0)return!0;let Z=A2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function f5($){return R$($,()=>VR($))}function VR($){let Z=X0($)??[],z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||WR.has(Q.name))continue;let X=NW($,Q.name);if(!GR(X))continue;let J=m5(X);if(!J)continue;let Y=u5(X).filter((V)=>UR.has(V.category)),W=Y.find((V)=>V.category==="frontend"),U=Y.find((V)=>V.category==="backend"),G=W??U??Y[0]??null;z.push({name:Q.name,language:J,topFramework:G?.name??null,frontend:!!W,backend:!!U||DW.test(J),hasFramework:!!G,appRoot:A(X,"manage.py")||A(X,"config.ru")||A(X,"bin/rails")||A(X,"artisan")})}return z}function HR($,Z){if(Z?.workspaces||A($,"pnpm-workspace.yaml"))return null;let z=f5($),Q=new Set(z.map((X)=>X.language));if(z.length<2||Q.size<2)return null;if(!z.some((X)=>X.frontend)||!z.some((X)=>X.backend))return null;return`polyglot: ${z.map((X)=>`${X.name}/ (${X.language})`).join(", ")}`}function OW($){let Z=f5($);if(Z.length<2)return null;let z=(Y)=>(Y.appRoot?2:0)+(DW.test(Y.language)?2:0)+(Y.hasFramework?1:0)+(Y.frontend?0.5:0),Q=[...Z].sort((Y,W)=>z(W)-z(Y)),X=new Set,J=[];for(let Y of Q){if(X.has(Y.language))continue;X.add(Y.language);let W=Y.frontend?"frontend":Y.backend?"backend":"service";J.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${W})`:`${Y.language} (${W})`)}return J.join("; ")}function A2($){let Z=m($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function h5($,Z){if(!Z.includes("*"))return A($,Z);let z=Z.split("/");if(z.length===1){let W=Z.split("*")[0];return(X0($)??[]).some((U)=>U.name.startsWith(W))}let Q=NW(...z.slice(0,-1)),X=z[z.length-1],J=X.split("*")[0],Y=X.split("*")[1]||"";return(X0($,Q)??[]).some((W)=>W.name.startsWith(J)&&W.name.endsWith(Y))}function KR($,Z,z){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return h5(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!h5(z,$.pattern))return!1;let Q=m(z,$.pattern);return Q!==null&&Q.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function u5($){let Z=A2($);return XW.map((z)=>{let X=z.signals.filter((J)=>KR(J,Z,$)).length/z.signals.length;return{name:z.name,slug:z.slug,category:z.category,confidence:X}}).filter((z)=>z.confidence>0).sort((z,Q)=>Q.confidence-z.confidence)}function m5($){let Z=A2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(A($,"tsconfig.json"))return"TypeScript";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(x$($).length>0)return"C#";if(A($,"pyproject.toml")||A($,"setup.py"))return"Python";if(A($,"Gemfile"))return"Ruby";if(f3($)){let z=X4($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(A($,"Package.swift"))return"Swift";if(A($,"build.zig"))return"Zig";if(A($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function IW($){let Z=A2($),z=u5($),Q=[],X=zR($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=o_($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=a_($);if(Y)return Q.push(Y),{type:"extension",found:Q};let W=JR($,Z,z);if(W)return Q.push(W),{type:"mcpaas",found:Q};let U=XR($,Z);if(U)return Q.push(U),{type:"saas",found:Q};let G=$R($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=x5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let H=k5($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let K=v5($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let q=X4($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let L=g5($);if(L)return Q.push(L.found),{type:L.appType,found:Q};let B=W4($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let N=e_($,Z);if(N)return Q.push(N),{type:"mobile",found:Q};if(z.some((h)=>h.slug==="mcp"))return Q.push("MCP SDK signal"),{type:"mcp",found:Q};if(Z?.bin)return Q.push("package.json bin"),{type:"cli",found:Q};if(s_($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(A($,"build.zig")){if(Q.push("build.zig"),A($,"src/main.zig"))return Q.push("src/main.zig"),{type:"cli",found:Q};if(A($,"src/root.zig"))return Q.push("src/root.zig"),{type:"library",found:Q}}let _=z.some((h)=>h.slug==="svelte"||h.slug==="sveltekit");if(Z?.private===!0&&(A($,"pnpm-workspace.yaml")||Z?.workspaces!==void 0)&&_)return Q.push("private workspace","Svelte"),{type:"framework",found:Q};if(_)return Q.push("Svelte/SvelteKit"),{type:"svelte",found:Q};let E=z.some((h)=>h.category==="frontend"),w=z.some((h)=>h.category==="backend");if(Z?.private&&(Z.workspaces||A($,"pnpm-workspace.yaml"))&&E&&w)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let j=YR($,Z);if(j)return Q.push(j),{type:"monorepo-root",found:Q};let u=QR($,Z,z);if(u)return Q.push(u),{type:"website",found:Q};if(z.some((h)=>h.slug==="nextjs"||h.slug==="nuxt"))return Q.push(z.find((h)=>h.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let d=z.some((h)=>h.category==="frontend"),T0=z.some((h)=>h.category==="backend");if(d&&T0)return Q.push("frontend framework","backend framework"),{type:"fullstack",found:Q};if(d)return Q.push("frontend framework"),{type:"frontend",found:Q};if(T0)return Q.push("backend framework"),{type:"backend",found:Q};let j0=t_($);if(j0)return Q.push(j0),{type:"data-science",found:Q};let Z0=ZR($,Z);if(Z0)return Q.push(Z0),{type:"html",found:Q};let k=HR($,Z);if(k)return Q.push(k),{type:"fullstack",found:Q};if(Z?.main&&!Z?.bin)return Q.push("package.json main (no bin)"),{type:"library",found:Q};return Q.push(F$),{type:"library",found:Q}}function TW($){if(A($,"bunfig.toml"))return"Bun";if(A($,"deno.json")||A($,"deno.jsonc"))return"Deno";if(A2($))return"Node.js";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(x$($).length>0)return".NET";if(A($,"pubspec.yaml"))return"Dart";return""}var qR=new Set(["npm","pnpm","yarn","bun"]);function BR($){let Z=A2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return qR.has(z)?z:""}function MR($){if(A($,"pubspec.yaml"))return"pub";if(A($,"go.mod"))return"go modules";if(x$($).length>0)return"NuGet";if(A($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>A($,z))?"gradle":""}var LR=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function AW($){return MR($)||BR($)||(LR.find(([Z])=>A($,Z))?.[1]??"")}function CW($){if(A($,".github/workflows"))return"GitHub Actions";if(A($,".gitlab-ci.yml"))return"GitLab CI";if(A($,".circleci"))return"CircleCI";if(A($,"Jenkinsfile"))return"Jenkins";return null}function _W($){if(A($,"vercel.json"))return"Vercel";if(A($,"netlify.toml"))return"Netlify";if(A($,"wrangler.toml"))return"Cloudflare";if(A($,"fly.toml"))return"Fly.io";if(A($,"render.yaml"))return"Render";return null}function RW($){let Z=m($,"svelte.config.js");if(Z===null)return null;let z=Z.match(/@sveltejs\/adapter-(\w+)/);if(z){let Q=z[1];switch(Q){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 Q}}return null}function PW($){let Z=A2($);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(A($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function c5($){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((z)=>A($,z))}function p5($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=A($,"bun.lock")||A($,"bun.lockb")?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(A($,"Cargo.toml")){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&NR($))z.lint="cargo clippy"}if(A($,"build.zig")){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(c3($,"build.zig")))z.test="zig build test"}if(A($,"go.mod")){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&DR($))z.test="pytest";return z}function c3($,Z){return m($,Z)??""}function NR($){if(A($,"clippy.toml")||A($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(c3($,"Cargo.toml"))}function DR($){if(A($,"pytest.ini")||A($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(c3($,Z)))}function FW($,Z,z,Q){let X=[];if(Q&&Q!=="Unknown")X.push(Q);let J=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of z)if(J.has(Y.category))X.push(Y.name);if(A($,"bunfig.toml"))X.push("Bun");else if(A($,"deno.json")||A($,"deno.jsonc"))X.push("Deno");if(X.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!X.some((U)=>U.toLowerCase().includes(W.toLowerCase())))X.push(W)}return X}function OR($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function SW($){return p3($).data}function p3($){let Z=A2($),z=u5($),Q=IW($),X=Q.type,J=Q.found.some((o)=>o.startsWith("polyglot:")),Y=J&&OW($)||m5($),W=TW($),U=AW($),G=CW($),V=_W($),H=PW($),K=z.find((o)=>o.category==="frontend"),q=z.find((o)=>o.category==="css"),L=z.find((o)=>o.category==="ui"),B=z.find((o)=>o.category==="state"),N=z.find((o)=>o.category==="backend"),I=z.find((o)=>o.category==="database"),_=(o)=>m6(X,o)??m6("library",o)===!0,y=X==="framework",E=z.some((o)=>o.slug==="svelte"||o.slug==="sveltekit"),w=y&&E?"svelte":y?null:null,j=X==="svelte"||w==="svelte",u=j?RW($):null,S=j&&z.some((o)=>o.slug==="sveltekit"),d={},T0=J0.filter((o)=>o.path.startsWith("stack."));for(let o of T0){let Y0=o.path.replace("stack.","");switch(Y0){case"frontend":d[Y0]=K?.name??"";break;case"css_framework":d[Y0]=q?.name??"";break;case"ui_library":d[Y0]=L?.name??"";break;case"state_management":d[Y0]=B?.name??(j&&OR(Z)>=5?"Runes":"");break;case"backend":d[Y0]=j?S?"SvelteKit":N?.name??"":N?.name??"";break;case"api_type":d[Y0]=S?"Server Routes":"";break;case"runtime":d[Y0]=W;break;case"database":d[Y0]=I?.name??"";break;case"connection":d[Y0]=I?.name??"";break;case"hosting":if(j&&u)d[Y0]=u;else d[Y0]=V??"";break;case"build":d[Y0]=S?"Vite":H??"";break;case"cicd":d[Y0]=G??"";break;case"package_manager":d[Y0]=U;break;default:d[Y0]="";break}}let j0={};for(let o of T0){let Y0=o.path.replace("stack.","");j0[Y0]=_(o)?d[Y0]:"slotignored"}let Z0={},k=J0.filter((o)=>o.path.startsWith("monorepo."));for(let o of k){let Y0=o.path.replace("monorepo.","");if(!_(o))Z0[Y0]="slotignored";else Z0[Y0]=""}let h={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(y&&w)h.framework=w;let L0=FW($,Z,z,J?m5($):Y);if(J){for(let o of f5($))for(let Y0 of[o.language,o.topFramework])if(Y0&&!L0.includes(Y0))L0.push(Y0)}let q2=c5($),_Q=p5($,Z),I8={faf_version:B6,project:h,stack:j0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:Z0,_meta:{found:Q.found}};if(L0.length>0)I8.tech_stack=L0;if(q2.length>0)I8.key_files=q2;if(Object.keys(_Q).length>0)I8.commands=_Q;return{data:I8,facts:d}}var EW={MIN_LENGTH:8,MAX_LENGTH:280},IR=[/^(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 C2($){let Z=$.trim();if(Z.length<EW.MIN_LENGTH)return!1;if(Z.length>EW.MAX_LENGTH)return!1;if(IR.some((z)=>z.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
236
- `).length>4)return!1;return!0}function TR($){let Z=$.split(`
226
+ `)}}var g3=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function OC($){let Z={};for(let[z,Q]of Object.entries($.slots??{}))Z[CY.get(z)??z]=Q;return{...$,slots:Z}}function P0($){return OC(JSON.parse(J4().score_faf(g3($))))}function JW($){return J4().validate_faf(g3($))}function w5($){return J4().compile_fafb(g3($))}function YW($){return JSON.parse(J4().decompile_fafb($))}function WW(){return J4().sdk_version()}var UW=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function GW($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function VW($){let Z=$.match(/^about:\s*\n((?:[ \t]+.*\n?)*)/m);if(!Z)return null;let z=Z[1]??"",Q=z.match(/^[ \t]+represents:\s*(\S+)\s*$/m);if(!Q)return null;let X=Q[1],J=z.match(/^[ \t]+source_score:\s*(\d+)\s*$/m),Y=-1;if(J){let W=parseInt(J[1],10);if(W>=0&&W<=100)Y=W}return{represents:X,sourceScore:Y}}function h3($){return $.unknown?"unknown (—)":`${$.score}%`}function b0($){return{score:$.score,tier:M6($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function O0($){let Z=VW($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?M6(z):k$[k$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents,...z<0?{unknown:!0}:{}}}return b0(P0($))}function DC($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function f3($){try{let Z=h6($,{logLevel:"error"}).getIn(["project","type"],!0);return C0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(w$)}catch{return!1}}function IC($,Z,z,Q,X){if(z===!0||z===null&&Q)return`${$} says '${Z}' — this app-type needs it, so it counts as empty until filled.`;if(z===!1&&X)return`${$} says '${Z}' — this app-type doesn't use it; faf auto marks it slotignored.`;return null}function TC($){try{let Z=h6($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return $0(z)?z:null}catch{return null}}function x5($,Z,z={}){let Q=TC($);if(Q===null)return[];let X=$0(Q.project)&&!f3($)?Q.project.type:void 0,J=[];for(let Y of J0){let W=DC(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!j$(W))continue;let U=c6.library.includes(Y.category),G=IC(Y.path,String(W).trim(),p6(X,Y),U,z.outOfType!==!1);if(G!==null)J.push(G)}return J}n();n();import{existsSync as AC,readFileSync as CC}from"fs";import{join as HW}from"path";import{homedir as _C}from"os";var RC=95,FC=30,PC=3,u3=HW(_C(),".config","faf"),m3=HW(u3,"star-nudge"),SC="github.com/Wolfe-Jam/faf-cli";function EC($){if($.score<RC)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??PC))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??FC)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function jC(){try{if(!AC(m3))return{shown:0,lastShownMs:null};let $=CC(m3,"utf-8").trim();if($.startsWith("{")){let z=JSON.parse($),Q=z.last?Date.parse(z.last):NaN;return{shown:Number.isFinite(z.shown)?Number(z.shown):0,lastShownMs:Number.isFinite(Q)?Q:null}}let Z=Date.parse($);return{shown:1,lastShownMs:Number.isFinite(Z)?Z:null}}catch{return{shown:0,lastShownMs:null}}}function wC($){let Z=new TextDecoder().decode($).trim();try{let z=JSON.parse(Z);return typeof z==="object"&&z!==null&&Object.keys(z).every((Q)=>Q==="shown"||Q==="last")}catch{return/^\d{4}-\d{2}-\d{2}T[\d:.]+Z$/.test(Z)}}function xC($,Z){try{w0(u3),w2(m3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:u3,owns:wC,mark:"faf star-nudge state"})}catch{}}function KW($){let Z=Date.now(),z=jC();if(!EC({score:$,isTTY:Boolean(process.stdout.isTTY),isCI:Boolean(process.env.CI),optedOut:Boolean(process.env.FAF_NO_NUDGE),shownCount:z.shown,lastShownMs:z.lastShownMs,nowMs:Z}))return;console.log(""),console.log(` ${F0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${SC}`),xC(z.shown,Z)}function S0($,Z,z=!1,Q=[]){if($.unknown){let Y=$.represents?`about-repo for ${$.represents}`:"about-repo";console.log(`${M("—")} ${C("unknown")} ${M(`${Y} — no about.source_score`)} ${M("—")} ${Z}`);return}let X=T2($.tier),J=C(`${$.score}%`);if(console.log(`${X} ${J} ${M(`${$.populated}/${$.active} slots`)} ${M("—")} ${Z}`),$.tier.name==="TROPHY")console.log(M(" Trophy. AI never has to guess."));else if($.empty>0){let Y=Object.entries($.slots).filter(([,V])=>V==="empty").map(([V])=>V),W=Y.slice(0,3).join(", "),U=Y.length>3?`, +${Y.length-3} more`:"",G=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${G} from Trophy: ${W}${U}`))}if(yC(Q),z)console.log(""),kC($);KW($.score)}function yC($){for(let Z of $)console.log(M(` ${Z}`))}function kC($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?T("●"):z==="slotignored"?M("—"):M("○");console.log(` ${Q} ${z==="slotignored"?M(`${Z}: slotignored`):Z}`)}}n();function y5($,Z={}){let z=$??u();if(!z)console.error(`Error: project.faf not found
227
+
228
+ Run 'faf init' to create one.`),process.exit(2);let Q=l(z);X2(Q,z);let X=s(z,()=>O0(Q));if(Z.json){let J=o(z),Y={faf_version:J.faf_version??"unknown",project:J.project?.name??"unknown",source:z,...X};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(X.unknown?`— ${C(h3(X))}`:`${T2(X.tier)} ${C(h3(X))}`);return}S0(X,z,Z.verbose,x5(Q,X))}import{existsSync as qP}from"fs";import{join as zU}from"path";var L6="3.0";import{join as FW}from"path";var qW=[{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:"anyDependency",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{join as vC}from"path";var b$={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 gC=b$.flutterDeps,hC=b$.mcpDeps,fC=b$.serverFrameworks,uC=b$.stateManagement,mC=b$.routing;function cC($){let Z=new Set,z=!1;for(let Q of $.split(`
229
+ `)){if(/^(dependencies|dev_dependencies|dependency_overrides):\s*$/.test(Q)){z=!0;continue}if(/^\S/.test(Q))z=!1;if(z){let X=Q.match(/^\s{2}([a-zA-Z0-9_]+):/);if(X)Z.add(X[1].toLowerCase())}}return Z}function k5($){let Z=c($,"pubspec.yaml");if(Z===null)return null;let z=cC(Z),Q=(_)=>z.has(_.toLowerCase()),X=gC.some(Q)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),J=hC.find(Q),Y=fC.find(([_])=>Q(_)),W=uC.find(([_])=>Q(_)),U=W?W[1]:"",G=mC.find(([_])=>Q(_)),V=G?G[1]:"",H=Q("flutter_test")?"flutter_test":Q("test")?"test":"",K=/^executables:\s*$/m.test(Z),q=(X0($,"bin")??[]).some((_)=>_.name.endsWith(".dart")),L=K||q,B,N="",I;if(X)if(N="Flutter",A($,vC("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))B="mobile",I="pubspec.yaml (Flutter app)";else B="library",I="pubspec.yaml (Flutter package)";else if(J)B="mcp",I=`pubspec.yaml + ${J} (Dart MCP server)`;else if(Y)B="backend",N=Y[1],I=`pubspec.yaml + ${Y[0]} (Dart backend)`;else if(L)B="cli",I=K?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else B="library",I="pubspec.yaml (Dart package)";return{appType:B,isFlutter:X,framework:N,stateManagement:U,routing:V,testing:H,found:I}}import{join as lC}from"path";var b5={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 dC=b5.mcpModules,iC=b5.serverFrameworks,nC=b5.cliFrameworks;function rC($){let Z=new Set,z=!1;for(let Q of $.split(`
230
+ `)){let X=Q.replace(/\/\/.*$/,"").trim();if(!X)continue;if(/^require\s*\(\s*$/.test(X)){z=!0;continue}if(z){if(X===")"){z=!1;continue}let Y=X.match(/^(\S+)/);if(Y)Z.add(Y[1].toLowerCase());continue}let J=X.match(/^require\s+(\S+)/);if(J&&J[1]!=="(")Z.add(J[1].toLowerCase())}return Z}function MW($,Z){let z=Z.toLowerCase();for(let Q of $)if(Q===z||Q.startsWith(`${z}/`))return!0;return!1}function BW($,Z){let z;for(let Q of Z){if(!MW($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function sC($,Z){let z;for(let Q of Z){if(!MW($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function oC($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function aC($){for(let{name:Z}of X0($,"cmd")??[]){let z=lC("cmd",Z),Q=D2($,z);if(Q?.isDirectory()){if((X0($,z)??[]).some((X)=>X.name.endsWith(".go")))return!0}else if(Q&&Z.endsWith(".go"))return!0}return!1}function tC($){let Z=c($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function v5($){let Z=c($,"go.mod");if(Z===null)return null;let z=oC(Z),Q=rC(Z),X=sC(Q,dC),J=BW(Q,iC),Y=BW(Q,nC),W=aC($),U=tC($),G,V="",H;if(X)G="mcp",H=`go.mod + ${X} (Go MCP server)`;else if(J)G="backend",V=J[1],H=`go.mod + ${J[0]} (Go backend)`;else if(Y)G="cli",V=Y[1],H=`go.mod + ${Y[0]} (Go CLI)`;else if(W)G="cli",H="go.mod + cmd/ (Go CLI layout)";else if(U&&!J)G="cli",H="go.mod + main.go package main (Go CLI)";else G="library",H="go.mod (Go module)";return{appType:G,modulePath:z,framework:V,found:H}}var d6={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 $_=d6.mcpPackages.map(($)=>$.toLowerCase()),Z_=d6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),z_=d6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),Q_=d6.grpcServerPackages.map(($)=>$.toLowerCase()),X_=d6.specializedSdks,LW=d6.baseSdk.toLowerCase();function J_($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),z=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),Q=(Z?.[1]||z?.[1]||"").trim(),X=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),J=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||J||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),G=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),V=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),H=/<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 q=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))q.add(L[1].toLowerCase());return{sdk:Q,outputType:X,targetFramework:W,isTestProject:U,useMaui:G,useWpf:V,useWindowsForms:H,packages:K,frameworkRefs:q}}function c3($,Z){let z=Z.toLowerCase();if($.has(z))return!0;for(let Q of $)if(Q===z||Q.startsWith(`${z}.`))return!0;return!1}function NW($,Z){let z;for(let[Q,X]of Z){if(!c3($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function Y_($){let Z;for(let z of $_){if(!c3($,z))continue;if(!Z||z.length>Z.length)Z=z}for(let z of $)if(z==="modelcontextprotocol"||z.startsWith("modelcontextprotocol.")){if(!Z||z.length>Z.length)Z=z}return Z}function W_($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of X_){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function g5($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function U_($,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 G_($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,W,U="",G,V=Y_(X),H=W_(Q),K=NW(X,z_),q=NW(X,Z_),L=Q_.some((N)=>c3(X,N)),B=J.has("microsoft.aspnetcore.app");if(V)W="mcp",U="MCP",G=`${Z} + ${V} (C# MCP server)`;else if($.isTestProject||H?.[1]==="test"||K)W="library",U=K?.[1]||(H?.[1]==="test"?H[2]:"Test"),G=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",G=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",G=`${Z} + ${U}`;else if(H?.[1]==="web")W="backend",U=L?"gRPC":H[2],G=`${Z} + Sdk=${H[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(H?.[1]==="worker")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Worker)`;else if(H?.[1]==="blazor-wasm")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Blazor WASM)`;else if(H?.[1]==="aspire")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Aspire)`;else if(H?.[1]==="razor-lib")W="library",U=H[2],G=`${Z} + Sdk=${H[0]} (Razor class library)`;else if(B&&g5(Y))W="backend",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!g5(Y))W="library",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(q&&(g5(Y)||!Y))W="cli",U=q[1],G=`${Z} + ${q[0]} (C# CLI)`;else if(g5(Y))W="cli",G=`${Z} + OutputType=Exe (C# console)`;else{W="library";let N=Q?` Sdk=${Q}`:"";if(G=`${Z}${N} (C# class library)`.replace(" Sdk=Microsoft.NET.Sdk",""),!Q||Q.toLowerCase()===LW||Q.toLowerCase().startsWith(`${LW}/`))G=`${Z} (C# class library)`}return{appType:W,projectName:z,targetFramework:$.targetFramework,sdk:Q||"Microsoft.NET.Sdk",framework:U,found:G}}function v$($){return(X0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function h5($){let Z=v$($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=c($,X);if(J===null)continue;let Y=J_(J),W=G_(Y,X),U=U_(W.appType,W.framework);if(!z||U<Q)z=W,Q=U}return z}import{join as i6}from"path";var A2={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 H_=A2.mcpArtifacts.map(($)=>$.toLowerCase()),K_=A2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),q_=A2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),B_=A2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),av=A2.androidPlugins.map(($)=>$.toLowerCase()),M_=A2.kmpPlugins.map(($)=>$.toLowerCase()),L_=A2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),N_=A2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),O_=A2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),D_=A2.libraryPlugins.map(($)=>$.toLowerCase()),I_=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function p3($){return I_.some((Z)=>A($,Z))}function T_($){let Z=new Map,z=new Map,Q="";for(let X of $.split(`
231
+ `)){let J=X.replace(/#.*$/,"").trim();if(!J)continue;let Y=J.match(/^\[([^\]]+)\]$/);if(Y){Q=Y[1].trim().toLowerCase();continue}let W=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(W&&(Q==="plugins"||Q.endsWith(".plugins"))){Z.set(W[1].replace(/-/g,".").toLowerCase(),W[2].toLowerCase()),Z.set(W[1].toLowerCase(),W[2].toLowerCase());continue}let U=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(U&&(Q==="libraries"||Q.endsWith(".libraries"))){let H=U[1].toLowerCase();z.set(H,U[2].toLowerCase()),z.set(H.replace(/-/g,"."),U[2].toLowerCase());continue}let G=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(G&&(Q==="libraries"||Q.endsWith(".libraries"))){let H=`${G[2]}:${G[3]}`.toLowerCase(),K=G[1].toLowerCase();z.set(K,H),z.set(K.replace(/-/g,"."),H);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let H=V[1].toLowerCase(),K=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let q=K.split(":")[0].toLowerCase();Z.set(H,q),Z.set(H.replace(/-/g,"."),q)}else if(Q==="libraries"||Q.endsWith(".libraries")){let q=K.split(":");if(q.length>=2){let L=`${q[0]}:${q[1]}`.toLowerCase();z.set(H,L),z.set(H.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:z}}function A_($){let Z=c($,i6("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return T_(Z)}function C_($){let Z=[];for(let z of $.matchAll(/include\s*\(\s*([^)]+)\)/g))for(let Q of z[1].split(",")){let X=Q.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let z of $.matchAll(/include\s+((?:['"][^'"]+['"]\s*,?\s*)+)/g))for(let Q of z[1].split(",")){let X=Q.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let z of $.matchAll(/project\s*\(\s*["']:([^"']+)["']\s*\)\s*\.projectDir\s*=\s*file\s*\(\s*["']([^"']+)["']\s*\)/g))Z.push(z[2].replace(/^\.\//,""));return[...new Set(Z)]}function __($,Z){let z=new Set;for(let Q of $.matchAll(/\bid\s*\(\s*["']([^"']+)["']\s*\)/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/\bid\s+['"]([^'"]+)['"]/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/plugins\s*\{([\s\S]*?)\}/g))for(let X of Q[1].split(/[\n;]/)){let J=X.replace(/\/\/.*$/,"").trim();if(!J||J.startsWith("id")||J.startsWith("kotlin")||J.startsWith("alias"))continue;let Y=J.match(/^`([a-zA-Z0-9.-]+)`$/)||J.match(/^([a-zA-Z][a-zA-Z0-9.-]*)$/);if(Y)z.add(Y[1].toLowerCase())}for(let Q of $.matchAll(/\bkotlin\s*\(\s*["']([^"']+)["']\s*\)/g)){let X=Q[1].toLowerCase();if(X==="jvm")z.add("org.jetbrains.kotlin.jvm");else if(X==="multiplatform")z.add("org.jetbrains.kotlin.multiplatform");else if(X==="android")z.add("org.jetbrains.kotlin.android");else z.add(`org.jetbrains.kotlin.${X}`)}for(let Q of $.matchAll(/libs\.plugins\.([A-Za-z0-9_.]+)/g)){let X=Q[1].toLowerCase(),J=Z.plugins.get(X)||Z.plugins.get(X.replace(/\./g,"-"))||Z.plugins.get(X.replace(/-/g,"."));if(J)z.add(J);else if(X.includes("spring")&&X.includes("boot"))z.add("org.springframework.boot")}for(let Q of $.matchAll(/apply\s+plugin\s*:\s*['"]([^'"]+)['"]/g))z.add(Q[1].toLowerCase());return z}function R_($,Z){let z=new Set;for(let Q of $.matchAll(/["']([A-Za-z0-9_.-]+:[A-Za-z0-9_.-]+)(?::[^"']+)?["']/g))z.add(Q[1].toLowerCase());for(let Q of $.matchAll(/libs\.([A-Za-z0-9_.]+)/g)){let X=Q[1].toLowerCase();if(X.startsWith("plugins."))continue;let J=[X,X.replace(/\./g,"-"),X.replace(/-/g,".")];for(let Y of J){let W=Z.libraries.get(Y);if(W){z.add(W.includes(":")?W.split(":").slice(0,2).join(":"):W);break}}}return z}function IW($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),z=new Set,Q=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(Q){let Y=Q[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=Q[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)z.add(`${Y}:${W}`.toLowerCase())}let X=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)X.add(`${W}:${U}`.toLowerCase())}let J=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))J.push(Y[1].trim());return{packaging:Z,parents:z,artifacts:X,modules:J}}function m2($,Z){let z=Z.toLowerCase();if($.has(z))return!0;for(let Q of $)if(Q===z||Q.endsWith(`.${z}`)||Q===z.replace(/^org\.gradle\./,""))return!0;return!1}function Y4($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=m2($,X);else if(Y=$.has(X)||[...$].some((W)=>W===X||W.startsWith(`${X}:`)||W.startsWith(`${X}.`)),!Y&&z==="artifact")Y=[...$].some((W)=>W===X||W.startsWith(`${X}`));if(!Y)continue;if(!Q||X.length>Q[0].length)Q=[X,J]}return Q}function F_($){let Z;for(let z of H_)for(let Q of $){if(Q===z||Q.startsWith(`${z}:`)||Q.startsWith(z.replace(/:mcp$/,":"))){if(!Z||z.length>Z.length)Z=z}if(Q.startsWith("io.modelcontextprotocol")||Q.includes("spring-ai-starter-mcp")||Q.includes("spring-ai-mcp")){if(!Z||Q.length>Z.length)Z=Q}}return Z}function TW($,Z){let z=new Set,Q=!1,X=!1,J=[i6(Z,"src"),i6(Z,"src","main")],Y=(W,U)=>{if(U>4)return;let G=X0($,W);if(!G)return;for(let{name:V}of G){if(V==="androidMain"||V==="commonMain"||V==="jvmMain"||V==="iosMain")z.add(V);let H=i6(W,V),K=D2($,H);if(!K)continue;if(K.isDirectory())Y(H,U+1);else if(V.endsWith(".kt")||V.endsWith(".kts"))Q=!0;else if(V.endsWith(".java"))X=!0}};for(let W of J)Y(W,0);return{kotlin:Q,java:X,hints:z}}function P_($){let Z=[],z=$.plugins,Q=$.artifacts,X=M_.some((E)=>m2(z,E))||$.sourceHints.has("commonMain"),J=m2(z,"com.android.application"),Y=m2(z,"com.android.library")||m2(z,"com.android.kotlin.multiplatform.library");if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let W=F_(Q),U=Y4(z,K_,"plugin"),G=Y4($.parents,q_,"parent"),V=Y4(Q,B_,"artifact"),H=Y4(z,N_,"plugin"),K=Y4(Q,O_,"artifact"),q=D_.some((E)=>m2(z,E)),L=$.packaging==="pom",B,N="",I;if(J)B="mobile",N=X?"Android+KMP":"Android",I=`${$.path||"root"} + com.android.application (${N})`;else if(W)B="mcp",N="MCP",Z.push("mcp"),I=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||G||V){B="backend",N=U?.[1]||G?.[1]||V?.[1]||"JVM";let E=U?.[0]||G?.[0]||V?.[0]||"web";I=`${$.path||"root"} + ${E} (JVM backend)`}else if(X&&!Y)B="library",N="Kotlin Multiplatform",I=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",N=X?"Android+KMP":"Android",I=`${$.path||"root"} + android library (${N})`;else if(K||$.hasApplicationPlugin&&($.hasMainClass||H)||H&&$.hasMainClass)B="cli",N=K?.[1]||"application",I=K?`${$.path||"root"} + ${K[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!q)B="cli",N="application",I=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",I=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let E=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(I=`${$.path||"root"} (${E} library)`,q)I=`${$.path||"root"} + java-library (JVM library)`}let _="Java";if($.kotlinSources&&$.javaSources)_="Java/Kotlin";else if($.kotlinSources||L_.some((E)=>m2(z,E))||X)_="Kotlin";let w=[...new Set(Z)];return{appType:B,framework:N,facets:w,found:I,buildTool:$.buildTool,mainLanguage:_}}function S_($,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 OW($,Z,z){let Q=i6(Z,"build.gradle.kts"),X=i6(Z,"build.gradle"),J=A($,Q)?Q:A($,X)?X:null;if(!J)return null;let Y=c($,J);if(!Y)return null;let W=__(Y,z),U=R_(Y,z),G=TW($,Z),V=/mainClass\s*[.=]/.test(Y)||/mainClassName\s*=/.test(Y)||/Main-Class/.test(Y),H=m2(W,"application")||m2(W,"org.gradle.application");return{path:Z||"build.gradle",plugins:W,artifacts:U,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:H,sourceHints:G.hints,kotlinSources:G.kotlin||J.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function DW($,Z){let z=c($,i6(Z,"pom.xml"));if(!z)return null;let{packaging:Q,parents:X,artifacts:J}=IW(z),Y=TW($,Z);return{path:Z?`${Z}/pom.xml`:"pom.xml",plugins:new Set,artifacts:J,packaging:Q,parents:X,hasMainClass:/<mainClass>/.test(z),hasApplicationPlugin:!1,sourceHints:Y.hints,kotlinSources:Y.kotlin,javaSources:Y.java,buildTool:"maven"}}function W4($){if(!p3($))return null;let Z=A_($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"])if(A($,G)){Q=c($,G);break}let X=Q?C_(Q):[],J=OW($,"",Z);if(J)z.push(J);for(let G of X){let V=OW($,G,Z);if(V)z.push(V)}let Y=DW($,"");if(Y){z.push(Y);let G=c($,"pom.xml");if(G){let{modules:V}=IW(G);for(let H of V){let K=DW($,H);if(K)z.push(K)}}}if(z.length===0&&Q)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(z.length===0)return null;let W=null,U=999;for(let G of z){let V=P_(G),H=S_(V.appType,V.facets);if(!W||H<U)W={appType:V.appType,framework:V.framework,buildTool:V.buildTool,mainLanguage:V.mainLanguage,facets:V.facets,found:V.found},U=H}if(W&&X.length>0&&!W.found.includes("multi-project"));return W}import{join as j_}from"path";var U4={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 w_=U4.mcpGems.map(($)=>$.toLowerCase()),x_=U4.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),AW=U4.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),y_=U4.railsLayoutFiles;function k_($){return A($,"Gemfile")||A($,"gems.rb")||b_($)}function b_($){return(X0($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function v_($){let Z=new Set;for(let z of $.split(`
232
+ `)){let Q=z.replace(/#.*$/,"").trim();if(!Q)continue;let X=Q.match(/^\s*gem\s+['"]([^'"]+)['"]/i)||Q.match(/^\s*gem\s+:([A-Za-z0-9_.-]+)/i);if(X)Z.add(X[1].toLowerCase())}return Z}function g_($){let Z=new Set,z=!1;for(let Q of $.split(`
233
+ `)){let X=Q.replace(/\r$/,"");if(/^\s*specs:\s*$/.test(X)){z=!0;continue}if(z){if(/^[A-Z]/.test(X)||X.startsWith("PLATFORMS")||X.startsWith("DEPENDENCIES")||X.startsWith("BUNDLED")||X.startsWith("RUBY VERSION")||X.startsWith("CHECKSUMS")){z=!1;continue}let J=X.match(/^\s{2,}([a-zA-Z0-9_.-]+)\s*\(/);if(J)Z.add(J[1].toLowerCase())}}return Z}function h_($){let Z=new Set;for(let z of $.split(`
234
+ `)){let X=z.replace(/#.*$/,"").match(/add_(?:runtime_|development_)?dependency\s*\(?\s*['"]([^'"]+)['"]/i);if(X)Z.add(X[1].toLowerCase())}return Z}function f_($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=c($,X);if(J){for(let Y of v_(J))Z.add(Y);z.push(X)}}let Q=c($,"Gemfile.lock")||c($,"gems.locked");if(Q){for(let X of g_(Q))Z.add(X);z.push("Gemfile.lock")}for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=c($,X);if(J){for(let Y of h_(J))Z.add(Y);z.push(X)}}return{gems:Z,sources:z}}function G4($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function l3($,Z){let z;for(let[Q,X]of Z){if(!G4($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function u_($){let Z;for(let z of w_)if(G4($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function CW($){for(let Z of y_)if(A($,Z))return Z;return}function m_($,Z){let z=l3(Z,AW);if(z)return{hit:!0,why:z[0]};for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=c($,X);if(J&&/executables\s*=/.test(J)&&!/executables\s*=\s*\[\s*\]/.test(J))return{hit:!0,why:`${X} executables`}}let Q=X0($,"bin");if(Q){let J=Q.map((Y)=>Y.name).filter((Y)=>{if(Y==="setup"||Y==="console"||Y==="rake")return!1;return D2($,j_("bin",Y))?.isFile()===!0}).filter((Y)=>Y!=="rails");if(J.length>0&&!G4(Z,"rails")&&!CW($))return{hit:!0,why:`bin/${J[0]}`}}return{hit:!1,why:""}}function f5($){if(!k_($))return null;let{gems:Z,sources:z}=f_($),Q=z[0]||"Gemfile",X=z.some((N)=>N==="Gemfile"||N==="gems.rb"||N.includes("lock"))?"bundler":"rubygems",J=u_(Z),Y=l3(Z,x_),W=CW($),U=G4(Z,"rails")||G4(Z,"railties"),G=m_($,Z),V=A($,"config.ru"),H=U||!!W,K=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!V)?Y:void 0,q,L="",B;if(J)q="mcp",L="MCP",B=`${Q} + gem ${J} (Ruby MCP)`;else if(H)if(q="backend",L="Rails",U&&W)B=`${Q} + rails + ${W} (Rails)`;else if(U)B=`${Q} + gem rails (Rails)`;else B=`${W} (Rails layout)`;else if(K)q="backend",L=K[1],B=`${Q} + gem ${K[0]} (Ruby backend)`;else if(G.hit)q="cli",L=l3(Z,AW)?.[1]||"",B=`${Q} + ${G.why} (Ruby CLI)`;else q="library",B=`${Q} (Ruby library)`;return{appType:q,framework:L,packageManager:X,found:B}}import{join as p_}from"path";var x2={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 l_=x2.mcpPackageUrls.map(($)=>$.toLowerCase()),d_=x2.mcpProducts.map(($)=>$.toLowerCase()),i_=x2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),n_=x2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),r_=x2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),s_=x2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),o_=x2.appProductTypes,a_=x2.cliProductTypes,t_=x2.vaporLayoutFiles;function e_($){return A($,"Package.swift")||d3($).length>0}function d3($){return(X0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&D2($,Z)?.isDirectory()===!0)}function $R($){let Z=ZR($),z=Z.toLowerCase(),Q=[],X=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,J;while((J=X.exec(Z))!==null)Q.push(J[1]);let Y=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((J=Y.exec(Z))!==null)Q.push(J[1]);let W=[],U=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((J=U.exec(Z))!==null)W.push(J[1]);let G=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((J=G.exec(Z))!==null)W.push(J[1]);let V=/\.library\s*\(/.test(z),H=/\.executable\s*\(/.test(z),K=/\.plugin\s*\(/.test(z)&&!V&&!H?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(z),q=/\.executabletarget\s*\(/.test(z),L=/\.target\s*\(/.test(z)&&!q?!0:(z.match(/\.target\s*\(/g)||[]).length>(z.match(/\.executabletarget\s*\(/g)||[]).length+(z.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:Q,productNames:W,hasLibraryProduct:V,hasExecutableProduct:H,hasPluginProduct:!!K,hasExecutableTarget:q,hasLibraryTarget:L}}function ZR($){let Z="",z=0;while(z<$.length){if($[z]==='"'||$[z]==="'"){let Q=$[z];Z+=Q,z++;while(z<$.length){if($[z]==="\\"&&z+1<$.length){Z+=$[z]+$[z+1],z+=2;continue}if(Z+=$[z],$[z]===Q){z++;break}z++}continue}if($[z]==="/"&&$[z+1]==="/"){z+=2;while(z<$.length&&$[z]!==`
235
+ `)z++;continue}if($[z]==="/"&&$[z+1]==="*"){z+=2;while(z<$.length&&!($[z]==="*"&&$[z+1]==="/"))z++;z+=2;continue}Z+=$[z],z++}return Z}function zR($,Z){let z=$.map((X)=>X.toLowerCase()),Q;for(let X of Z)for(let J of z)if(J.includes(X)&&(!Q||X.length>Q.length))Q=X;return Q}function _W($,Z){let z=$.map((X)=>X.toLowerCase()),Q;for(let[X,J]of Z)for(let Y of z)if(Y.includes(X)&&(!Q||X.length>Q[0].length))Q=[X,J];return Q}function RW($,Z){let z=$.map((X)=>X.toLowerCase()),Q;for(let[X,J]of Z)if(z.includes(X)&&(!Q||X.length>Q[0].length))Q=[X,J];return Q}function QR($){let Z=$.map((z)=>z.toLowerCase());return d_.some((z)=>Z.includes(z))}function XR($){let Z=!1,z=!1,Q;for(let X of d3($)){let J=c($,p_(X,"project.pbxproj"));if(!J)continue;for(let Y of o_)if(J.includes(Y))Z=!0,Q=Y;for(let Y of a_)if(J.includes(Y)){if(z=!0,!Q)Q=Y}}return{hasApplication:Z,hasTool:z,hit:Q}}function JR($){for(let Z of t_)if(A($,Z))return Z;return}function V4($){if(!e_($))return null;let Z=A($,"Package.swift"),z=d3($),Q=z.length>0,X=null;if(Z){let S=c($,"Package.swift");if(S)X=$R(S)}let J=Q?XR($):{hasApplication:!1,hasTool:!1},Y=JR($),W=X?.packageUrls??[],U=X?.productNames??[],G=zR(W,l_),V=QR(U),H=_W(W,i_),K=RW(U,n_),q=_W(W,r_),L=RW(U,s_),B=!!(G||V),N=!!(H||K||Y),I=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),_=!!(q||L),w=J.hasApplication,E=Z&&Q?"spm+xcode":Z?"spm":"xcode",x,j="",m;if(B)if(x="mcp",j="MCP",V)m="Package.swift + product MCP (Swift MCP)";else m=`Package.swift + ${G} (Swift MCP)`;else if(N)if(x="backend",j=K?.[1]||H?.[1]||(Y?"Vapor":""),K)m=`Package.swift + product ${K[1]} (Swift backend)`;else if(H)m=`Package.swift + ${H[1]} (Swift backend)`;else m=`${Y} (Swift backend layout)`;else if(w)x="app",j="",m=`${z[0]} + ${J.hit||"application"} (Swift app)`;else if(_||I&&!N&&!B)if(x="cli",j=L?.[1]||q?.[1]||"",L)m=`Package.swift + product ${L[1]} (Swift CLI)`;else if(q)m=`Package.swift + ${q[1]} (Swift CLI)`;else if(X?.hasExecutableProduct)m="Package.swift + .executable product (Swift CLI)";else m="Package.swift + .executableTarget (Swift CLI)";else if(J.hasTool&&!Z)x="cli",m=`${z[0]} + tool productType (Swift CLI)`;else if(Z)if(x="library",X?.hasLibraryProduct)m="Package.swift + .library product (Swift library)";else m="Package.swift (Swift library)";else x="library",m=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:x,framework:j,packageManager:E,found:m}}function YR($){let Z=c($,"Cargo.toml");if(Z===null)return null;let z=Z.match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}function WR($){let Z=c($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function UR($,Z){if(Z?.keywords?.some((Q)=>/^sdk(?:\s|-|$)|-sdk$/i.test(Q)))return'package.json keywords contains "sdk"';if(Z?.name&&/(?:^|[-_/])sdk(?:[-_/]|$)/i.test(Z.name))return`package.json name "${Z.name}" → sdk`;let z=YR($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function GR($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let z of Z){let Q=c($,z);if(Q===null)continue;try{let X=JSON.parse(Q);if(typeof X.manifest_version==="number")return`${z} manifest_version ${X.manifest_version} (browser extension)`}catch{}}return null}function VR($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=c($,"pyproject.toml");if(z!==null){let X=z.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let Q=c($,"requirements.txt");if(Q!==null){let X=Q.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function HR($,Z){let z=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let Q of z)if(Z.dependencies?.[Q]||Z.devDependencies?.[Q])return`${Q} dependency`}if(A($,"ios")&&A($,"android"))return"ios/ + android/ dirs";return null}function KR($,Z){let z=c($,"Cargo.toml");if(z!==null){if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(z))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(z))return"Cargo.toml wasm-bindgen/wasm-pack"}let Q=c($,"build.zig");if(Q!==null&&/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(Q))return"build.zig wasm target";if(Z?.keywords?.some((X)=>/^wasm(?:-|$)|webassembly/i.test(X)))return'package.json keywords contains "wasm"';return null}function qR($,Z){if(!A($,"index.html"))return null;if(Z?.dependencies||Z?.devDependencies){let z={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>z[X]))return null}return"index.html (vanilla, no frontend framework)"}function BR($,Z){if(Z?.name&&/specification|^@.*\/spec/i.test(Z.name))return`package name "${Z.name}" → documentation`;if(Z?.keywords?.some((z)=>/^(specification|format-spec|standard)$/i.test(z)))return'package keywords contains "specification"';if(Z?.bin)return null;if(Z?.files&&Z.files.length>0){let z=/^(dist|src|lib|build|bin)(\/|$)|\/(dist|src|lib|build|bin)(\/|$)|(\.|\/)(js|ts|tsx|jsx|mjs|cjs|py|rs|go)$/,Q=Z.files.some((J)=>z.test(J)),X=Z.files.some((J)=>/\.(md|MD)$|examples?\//.test(J)||J==="README.md"||J==="docs"||J==="docs/");if(!Q&&X)return"package.json files = docs/examples only (no source)"}return null}function MR($,Z,z){let Q=z.find((X)=>X.slug==="astro"||X.slug==="gatsby");if(Q)return`${Q.name} (static-site framework)`;if(Z?.keywords?.some((X)=>/^(website|marketing|landing|brochure|portfolio)$/i.test(X)))return'package keywords contains "website"/"marketing"/"landing"';return null}function LR($,Z){if(!Z)return null;let z={...Z.dependencies??{},...Z.devDependencies??{}},Q=["@clerk/nextjs","@clerk/clerk-react","next-auth","@auth/core","auth0","@auth0/nextjs-auth0"],X=["stripe","@stripe/stripe-js","lemonsqueezy"],J=Q.some((W)=>z[W]),Y=X.some((W)=>z[W]);if(J&&Y)return"auth + payment dependencies";return null}function NR($,Z,z){if(Z?.keywords?.some((J)=>/mcpaas/i.test(J)))return'package keywords contains "mcpaas"';if(Z?.name&&/mcpaas/i.test(Z.name))return`package name "${Z.name}" → mcpaas`;let Q=z.some((J)=>J.slug==="mcp"),X=z.some((J)=>J.category==="database");if(Q&&X&&Z?.dependencies&&Object.keys(Z.dependencies).length>10)return"MCP + database + complex deps (platform shape)";return null}function OR($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||A($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var DR=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"]),PW=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,IR=new Set(["frontend","backend","database","css","ui","state"]);function TR($){if(A($,"pyproject.toml")||A($,"manage.py")||A($,"setup.py")||u5($,"requirements*.txt"))return!0;if(A($,"go.mod"))return!0;if(A($,"Cargo.toml"))return!0;if(A($,"Gemfile"))return!0;if(A($,"pom.xml")||u5($,"build.gradle*"))return!0;if(v$($).length>0)return!0;let Z=Y2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function m5($){return E$($,()=>AR($))}function AR($){let Z=X0($)??[],z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||DR.has(Q.name))continue;let X=FW($,Q.name);if(!TR(X))continue;let J=p5(X);if(!J)continue;let Y=c5(X).filter((V)=>IR.has(V.category)),W=Y.find((V)=>V.category==="frontend"),U=Y.find((V)=>V.category==="backend"),G=W??U??Y[0]??null;z.push({name:Q.name,language:J,topFramework:G?.name??null,frontend:!!W,backend:!!U||PW.test(J),hasFramework:!!G,appRoot:A(X,"manage.py")||A(X,"config.ru")||A(X,"bin/rails")||A(X,"artisan")})}return z}function CR($,Z){if(Z?.workspaces||A($,"pnpm-workspace.yaml"))return null;let z=m5($),Q=new Set(z.map((X)=>X.language));if(z.length<2||Q.size<2)return null;if(!z.some((X)=>X.frontend)||!z.some((X)=>X.backend))return null;return`polyglot: ${z.map((X)=>`${X.name}/ (${X.language})`).join(", ")}`}function SW($){let Z=m5($);if(Z.length<2)return null;let z=(Y)=>(Y.appRoot?2:0)+(PW.test(Y.language)?2:0)+(Y.hasFramework?1:0)+(Y.frontend?0.5:0),Q=[...Z].sort((Y,W)=>z(W)-z(Y)),X=new Set,J=[];for(let Y of Q){if(X.has(Y.language))continue;X.add(Y.language);let W=Y.frontend?"frontend":Y.backend?"backend":"service";J.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${W})`:`${Y.language} (${W})`)}return J.join("; ")}function Y2($){let Z=c($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function u5($,Z){if(!Z.includes("*"))return A($,Z);let z=Z.split("/");if(z.length===1){let W=Z.split("*")[0];return(X0($)??[]).some((U)=>U.name.startsWith(W))}let Q=FW(...z.slice(0,-1)),X=z[z.length-1],J=X.split("*")[0],Y=X.split("*")[1]||"";return(X0($,Q)??[]).some((W)=>W.name.startsWith(J)&&W.name.endsWith(Y))}function _R($,Z,z){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"anyDependency":{let Q=$.key??"";return!!(Z?.dependencies?.[Q]||Z?.devDependencies?.[Q])}case"file":return u5(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!u5(z,$.pattern))return!1;let Q=c(z,$.pattern);return Q!==null&&Q.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function c5($){let Z=Y2($);return qW.map((z)=>{let X=z.signals.filter((J)=>_R(J,Z,$)).length/z.signals.length;return{name:z.name,slug:z.slug,category:z.category,confidence:X}}).filter((z)=>z.confidence>0).sort((z,Q)=>Q.confidence-z.confidence)}function p5($){let Z=Y2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(A($,"tsconfig.json"))return"TypeScript";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(v$($).length>0)return"C#";if(A($,"pyproject.toml")||A($,"setup.py"))return"Python";if(A($,"Gemfile"))return"Ruby";if(p3($)){let z=W4($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(A($,"Package.swift"))return"Swift";if(A($,"build.zig"))return"Zig";if(A($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function EW($){let Z=Y2($),z=c5($),Q=[],X=BR($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=UR($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=GR($);if(Y)return Q.push(Y),{type:"extension",found:Q};let W=NR($,Z,z);if(W)return Q.push(W),{type:"mcpaas",found:Q};let U=LR($,Z);if(U)return Q.push(U),{type:"saas",found:Q};let G=KR($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=k5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let H=v5($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let K=h5($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let q=W4($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let L=f5($);if(L)return Q.push(L.found),{type:L.appType,found:Q};let B=V4($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let N=HR($,Z);if(N)return Q.push(N),{type:"mobile",found:Q};if(z.some((f)=>f.slug==="mcp"))return Q.push("MCP SDK signal"),{type:"mcp",found:Q};if(Z?.bin)return Q.push("package.json bin"),{type:"cli",found:Q};if(WR($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(A($,"build.zig")){if(Q.push("build.zig"),A($,"src/main.zig"))return Q.push("src/main.zig"),{type:"cli",found:Q};if(A($,"src/root.zig"))return Q.push("src/root.zig"),{type:"library",found:Q}}let _=z.some((f)=>f.slug==="svelte"||f.slug==="sveltekit");if(Z?.private===!0&&(A($,"pnpm-workspace.yaml")||Z?.workspaces!==void 0)&&_)return Q.push("private workspace","Svelte"),{type:"framework",found:Q};if(_)return Q.push("Svelte/SvelteKit"),{type:"svelte",found:Q};let E=z.some((f)=>f.category==="frontend"),x=z.some((f)=>f.category==="backend");if(Z?.private&&(Z.workspaces||A($,"pnpm-workspace.yaml"))&&E&&x)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let j=OR($,Z);if(j)return Q.push(j),{type:"monorepo-root",found:Q};let m=MR($,Z,z);if(m)return Q.push(m),{type:"website",found:Q};if(z.some((f)=>f.slug==="nextjs"||f.slug==="nuxt"))return Q.push(z.find((f)=>f.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let i=z.some((f)=>f.category==="frontend"),T0=z.some((f)=>f.category==="backend");if(i&&T0)return Q.push("frontend framework","backend framework"),{type:"fullstack",found:Q};if(i)return Q.push("frontend framework"),{type:"frontend",found:Q};if(T0)return Q.push("backend framework"),{type:"backend",found:Q};let j0=VR($);if(j0)return Q.push(j0),{type:"data-science",found:Q};let Z0=qR($,Z);if(Z0)return Q.push(Z0),{type:"html",found:Q};let b=CR($,Z);if(b)return Q.push(b),{type:"fullstack",found:Q};if(Z?.main&&!Z?.bin)return Q.push("package.json main (no bin)"),{type:"library",found:Q};return Q.push(w$),{type:"library",found:Q}}function jW($){if(A($,"bunfig.toml"))return"Bun";if(A($,"deno.json")||A($,"deno.jsonc"))return"Deno";if(Y2($))return"Node.js";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(v$($).length>0)return".NET";if(A($,"pubspec.yaml"))return"Dart";return""}var RR=new Set(["npm","pnpm","yarn","bun"]);function FR($){let Z=Y2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return RR.has(z)?z:""}function PR($){if(A($,"pubspec.yaml"))return"pub";if(A($,"go.mod"))return"go modules";if(v$($).length>0)return"NuGet";if(A($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>A($,z))?"gradle":""}var SR=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function wW($){return PR($)||FR($)||(SR.find(([Z])=>A($,Z))?.[1]??"")}function xW($){if(A($,".github/workflows"))return"GitHub Actions";if(A($,".gitlab-ci.yml"))return"GitLab CI";if(A($,".circleci"))return"CircleCI";if(A($,"Jenkinsfile"))return"Jenkins";return null}function yW($){if(A($,"vercel.json"))return"Vercel";if(A($,"netlify.toml"))return"Netlify";if(A($,"wrangler.toml"))return"Cloudflare";if(A($,"fly.toml"))return"Fly.io";if(A($,"render.yaml"))return"Render";return null}var ER=["svelte.config.js","vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"];function jR($){for(let Q of ER){let X=c($,Q)?.match(/@sveltejs\/adapter-(\w+)/);if(X)return X[1]}let Z=Y2($);return Object.keys({...Z?.dependencies,...Z?.devDependencies}).map((Q)=>/^@sveltejs\/adapter-(\w+)$/.exec(Q)?.[1]).find(Boolean)??null}function kW($){let Z=jR($);if(Z)switch(Z){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 Z}return null}function i3($){let Z=$?.devDependencies?.vite??$?.dependencies?.vite,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?"Vite":`Vite ${z}`}function bW($){let Z=Y2($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return i3(Z);if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(A($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function l5($){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((z)=>A($,z))}function d5($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=A($,"bun.lock")||A($,"bun.lockb")?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(A($,"Cargo.toml")){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&wR($))z.lint="cargo clippy"}if(A($,"build.zig")){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(n3($,"build.zig")))z.test="zig build test"}if(A($,"go.mod")){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&xR($))z.test="pytest";return z}function n3($,Z){return c($,Z)??""}function wR($){if(A($,"clippy.toml")||A($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(n3($,"Cargo.toml"))}function xR($){if(A($,"pytest.ini")||A($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(n3($,Z)))}function vW($,Z,z,Q){let X=[];if(Q&&Q!=="Unknown")X.push(Q);let J=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of z)if(J.has(Y.category))X.push(Y.name);if(A($,"bunfig.toml"))X.push("Bun");else if(A($,"deno.json")||A($,"deno.jsonc"))X.push("Deno");if(X.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!X.some((U)=>U.toLowerCase().includes(W.toLowerCase())))X.push(W)}return X}function yR($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function gW($){return r3($).data}function r3($){let Z=Y2($),z=c5($),Q=EW($),X=Q.type,J=Q.found.some((r)=>r.startsWith("polyglot:")),Y=J&&SW($)||p5($),W=jW($),U=wW($),G=xW($),V=yW($),H=bW($),K=z.find((r)=>r.slug==="sveltekit")??z.find((r)=>r.category==="frontend"),q=z.find((r)=>r.category==="css"),L=z.find((r)=>r.category==="ui"),B=z.find((r)=>r.category==="state"),N=z.find((r)=>r.category==="backend"),I=z.find((r)=>r.category==="database"),_=(r)=>p6(X,r)??p6("library",r)===!0,w=X==="framework",E=z.some((r)=>r.slug==="svelte"||r.slug==="sveltekit"),x=w&&E?"svelte":w?null:null,j=X==="svelte"||x==="svelte",m=j?kW($):null,S=j&&z.some((r)=>r.slug==="sveltekit"),i={},T0=J0.filter((r)=>r.path.startsWith("stack."));for(let r of T0){let Y0=r.path.replace("stack.","");switch(Y0){case"frontend":i[Y0]=K?.name??"";break;case"css_framework":i[Y0]=q?.name??"";break;case"ui_library":i[Y0]=L?.name??"";break;case"state_management":i[Y0]=B?.name??(j&&yR(Z)>=5?"Runes":"");break;case"backend":i[Y0]=j?S?"SvelteKit":N?.name??"":N?.name??"";break;case"api_type":i[Y0]=S?"Server Routes":"";break;case"runtime":i[Y0]=W;break;case"database":i[Y0]=I?.name??"";break;case"connection":i[Y0]=I?.name??"";break;case"hosting":if(j&&m)i[Y0]=m;else i[Y0]=V??"";break;case"build":i[Y0]=S?i3(Z):H??"";break;case"cicd":i[Y0]=G??"";break;case"package_manager":i[Y0]=U;break;default:i[Y0]="";break}}let j0={};for(let r of T0){let Y0=r.path.replace("stack.","");j0[Y0]=_(r)?i[Y0]:"slotignored"}let Z0={},b=J0.filter((r)=>r.path.startsWith("monorepo."));for(let r of b){let Y0=r.path.replace("monorepo.","");if(!_(r))Z0[Y0]="slotignored";else Z0[Y0]=""}let f={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(w&&x)f.framework=x;let L0=vW($,Z,z,J?p5($):Y);if(J){for(let r of m5($))for(let Y0 of[r.language,r.topFramework])if(Y0&&!L0.includes(Y0))L0.push(Y0)}let B2=l5($),yQ=d5($,Z),A8={faf_version:L6,project:f,stack:j0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:Z0,_meta:{found:Q.found}};if(L0.length>0)A8.tech_stack=L0;if(B2.length>0)A8.key_files=B2;if(Object.keys(yQ).length>0)A8.commands=yQ;return{data:A8,facts:i}}var hW={MIN_LENGTH:8,MAX_LENGTH:280},kR=[/^(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 C2($){let Z=$.trim();if(Z.length<hW.MIN_LENGTH)return!1;if(Z.length>hW.MAX_LENGTH)return!1;if(kR.some((z)=>z.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
236
+ `).length>4)return!1;return!0}function bR($){let Z=$.split(`
237
237
  `),z=0;while(z<Z.length&&/^(#\s|$)/.test(Z[z].trim()))z++;while(z<Z.length){let Q=Z[z].trim();if(/^\[!\[/.test(Q)){z++;continue}if(/^!\[/.test(Q)){z++;continue}if(/^<img\s/i.test(Q)){z++;continue}if(Q===""){z++;continue}break}return Z.slice(z).join(`
238
- `)}function AR($){let z=TR($).split(`
239
- `),Q=[];for(let X of z){let J=X.trim();if(J===""){if(Q.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(J))break;if(/^\*\*[^*]+\*\*\s*$/.test(J)&&Q.length===0)continue;Q.push(J)}if(Q.length===0)return null;return Q.join(" ").trim()}function d6($,Z){let z=$.split(`
240
- `),Q=0;while(Q<z.length){let J=z[Q].trim().match(/^(#{1,6})\s+(.+)$/);if(J&&Z.test(J[2])){let Y=J[1].length,W=[];Q++;while(Q<z.length){let U=z[Q].trim(),G=U.match(/^(#{1,6})\s+/);if(G&&G[1].length<=Y)break;if(U===""){if(W.length>0)break;Q++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),Q++}if(W.length===0)return null;return W.join(" ").trim()}Q++}return null}function CR($){let Z=d6($,/^(use\s+cases?|goal)\b/i);if(Z&&C2(Z))return Z;let z=AR($);if(z&&C2(z))return z;return}function _R($){let Z=d6($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&C2(Z))return Z;return}function RR($){let Z=d6($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&C2(Z))return Z;return}function PR($){let Z=d6($,/^(why|motivation|problem|rationale)\b/i);if(Z&&C2(Z))return Z;return}function FR($){let Z=d6($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&C2(Z))return Z;return}function SR($){let Z=d6($,/^(status|history|timeline|since|launched)\b/i);if(Z&&C2(Z))return Z;return}function ER($){let Z=d6($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&C2(Z))return Z;return}function l3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let q of Z)if(A($,q)){z=q;break}if(!z)return{};let Q=m($,z);if(Q===null)return{};Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=CR(Q);if(J)X.project={goal:J};let Y={},W=_R(Q);if(W)Y.what=W;let U=RR(Q);if(U)Y.who=U;let G=PR(Q);if(G)Y.why=G;let V=FR(Q);if(V)Y.where=V;let H=SR(Q);if(H)Y.when=H;let K=ER(Q);if(K)Y.how=K;if(Object.keys(Y).length>0)X.human_context=Y;return X}function jR($,Z){let z=$.split(`
241
- `),Q=!1;for(let X of z){let J=X.trim();if(/^\[/.test(J)){Q=J==="[package]";continue}if(!Q)continue;let Y=J.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 d3($){let Z=m($,"Cargo.toml");if(Z===null)return{};let z=jR(Z,"description");if(z&&C2(z))return{project:{goal:z}};return{}}import{join as jW}from"path";var wR=[{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"}],xR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function yR($){let Z=[],z=(Q,X)=>{for(let J of X0($,Q)??[])if(J.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(J.name))Z.push(jW(Q,J.name));else if(J.isDirectory()&&X>0&&!J.name.startsWith(".")&&!xR.has(J.name))z(jW(Q,J.name),X-1)};return z(".",1),Z}function U4($){return[...$].join(" · ")}function i3($){let Z=yR($);if(Z.length===0)return{};let z={database:new Set,cache:new Set,search:new Set,storage:new Set,runtime:new Set};for(let X of Z){let J=m($,X);if(J===null)continue;for(let Y of J.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let W=Y[1].toLowerCase(),U=W.replace(/:[^/]*$/,"").split("/").pop()??W,G=W.replace(/:[^/]*$/,"");for(let{re:V,slot:H,label:K}of wR)if(V.test(U)||V.test(G))z[H].add(K)}}let Q={};if(z.database.size)Q.database=U4(z.database);if(z.cache.size)Q.cache=U4(z.cache);if(z.search.size)Q.search=U4(z.search);if(z.storage.size)Q.storage=U4(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${U4(z.runtime)})`;if(Object.keys(Q).length===0&&!z.runtime.size)return{stack:{hosting:"Docker Compose"}};return Q.hosting="Docker Compose",{stack:Q}}import{join as kR}from"path";var bR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),vR=[{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((z)=>z[1])}}];function n3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function gR($){let Z=[$];for(let z of X0($)??[])if(z.isDirectory()&&!z.name.startsWith(".")&&!bR.has(z.name))Z.push(kR($,z.name));return Z}function hR($){let Z=0;if(A($,"manage.py")||A($,"pyproject.toml")||A($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function r3($){return R$($,()=>fR($))}function fR($){let Z=[];for(let Q of gR($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of vR){let W=m(Q,Y.file);if(W===null)continue;let U=Y.targets(W);if(U.length===0)continue;let G={},V=n3(U,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),H=n3(U,[/^build$/i,/^compile$/i,/^build/i]),K=n3(U,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(V)G.test=`${J}${Y.runner} ${V}`;if(H)G.build=`${J}${Y.runner} ${H}`;if(K)G.lint=`${J}${Y.runner} ${K}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(X?10:hR(Q)),commands:G})}}let z=Z.sort((Q,X)=>X.score-Q.score)[0];return z?{commands:z.commands}:{}}var uR=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function s3($){for(let Z of uR)if(A($,Z))return{security:{secrets:".env",example:Z}};return{}}function mR($,Z){let z={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 Q of["project","human_context","stack","commands","security"])if(z[Q]&&Object.keys(z[Q]).length===0)delete z[Q];return z}function o3($){return[l3($),d3($),i3($),r3($),s3($)].reduce(mR,{})}import{join as cR,extname as pR,resolve as lR}from"path";var a3={"package.json":{frameworks:["Node.js","JavaScript","TypeScript"],slots:{packageManager:"npm/yarn/pnpm",mainLanguage:"JavaScript/TypeScript"},priority:35,intelligence:"ultra-high"},"README.md":{frameworks:[],slots:{},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"},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",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.mjs":{frameworks:["Next.js"],slots:{framework:"Next.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+",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.js":{frameworks:["Nuxt 2"],slots:{framework:"Nuxt 2",buildTool:"Nuxt",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.ts":{frameworks:["Nuxt 3"],slots:{framework:"Nuxt 3",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",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",server:"Node.js"},priority:30,intelligence:"high"},Dockerfile:{frameworks:["Docker"],slots:{},priority:30,intelligence:"high"},"docker-compose.yml":{frameworks:["Docker Compose"],slots:{hosting:"Docker"},priority:30,intelligence:"high"},"docker-compose.yaml":{frameworks:["Docker Compose"],slots:{hosting:"Docker"},priority:30,intelligence:"high"},"kubernetes.yml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes"},priority:30,intelligence:"high"},"k8s.yaml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes"},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:{},priority:25,intelligence:"medium"},"jest.config.ts":{frameworks:["Jest"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"vitest.config.ts":{frameworks:["Vitest"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"cypress.config.js":{frameworks:["Cypress"],slots:{},priority:25,intelligence:"medium"},"playwright.config.ts":{frameworks:["Playwright"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"karma.conf.js":{frameworks:["Karma"],slots:{},priority:20,intelligence:"medium"},"mocha.opts":{frameworks:["Mocha"],slots:{},priority:20,intelligence:"medium"},".rspec":{frameworks:["RSpec"],slots:{mainLanguage:"Ruby"},priority:25,intelligence:"medium"},"pytest.ini":{frameworks:["Pytest"],slots:{mainLanguage:"Python"},priority:25,intelligence:"medium"},"phpunit.xml":{frameworks:["PHPUnit"],slots:{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",build:"zig build"},priority:35,intelligence:"ultra-high"},"openapi.json":{frameworks:["OpenAPI"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"openapi.yaml":{frameworks:["OpenAPI"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"swagger.json":{frameworks:["Swagger"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"graphql.schema":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:30,intelligence:"high"},"schema.graphql":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},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",backend:"MLflow"},priority:30,intelligence:"high"},"dvc.yaml":{frameworks:["DVC","Data Version Control"],slots:{mainLanguage:"Python",cicd:"DVC Pipelines"},priority:30,intelligence:"high"},"dvc.lock":{frameworks:["DVC"],slots:{},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:{},priority:25,intelligence:"high"},"dependabot.yml":{frameworks:["Dependabot","GitHub"],slots:{},priority:25,intelligence:"high"},"renovate.json":{frameworks:["Renovate"],slots:{},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"},priority:30,intelligence:"high"},"values.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:25,intelligence:"high",confirmWith:["Chart.yaml"]},"pulumi.yaml":{frameworks:["Pulumi"],slots:{cicd:"Pulumi"},priority:30,intelligence:"high"},"Pulumi.yaml":{frameworks:["Pulumi"],slots:{cicd:"Pulumi"},priority:30,intelligence:"high"},"terragrunt.hcl":{frameworks:["Terragrunt","Terraform"],slots:{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:{},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:{},priority:25,intelligence:"high"},"CLAUDE.md":{frameworks:["Claude Code"],slots:{},priority:30,intelligence:"high",confirmWith:[".claude"]}};var dR=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),iR=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),nR={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"]},rR=[["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 sR($,Z){for(let[z,Q]of rR)if(z in $)return Q;return Z.length>0?"framework":"config"}function oR($,Z){try{let z=JSON.parse(m($,Z)??""),Q=["background","content_scripts","action","browser_action","permissions"].some((X)=>(X in z));if(typeof z.manifest_version==="number"&&Q)return"chrome";return"other"}catch{return"other"}}function aR($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return D2($,Z.name)?.isFile()===!0}function tR($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return D2($,Z.name)?.isDirectory()===!0}function eR($){let Z=[],z=lR($),Q=new Set,X=X0(z);if(!X)return Z;for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!tR(z,J):!aR(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let U=v5(z);if(U){let G={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="mobile"&&U.framework)G.framework=U.framework;if(U.targetFramework)G.runtime=U.targetFramework;let V=U.framework?[U.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}if(Y.endsWith(".xcodeproj")){let U=W4(z);if(U){let G={mainLanguage:"Swift",packageManager:U.packageManager==="spm"?"spm":"Xcode",buildTool:U.packageManager.includes("spm")?"swift build":"xcodebuild"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="app"&&U.framework)G.framework=U.framework;let V=U.framework?[U.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}let W=a3[Y];if(!W)continue;if(Y==="manifest.json"&&oR(z,Y)!=="chrome")continue;if(Y==="pubspec.yaml"){let U=x5(z);if(U){let G={mainLanguage:"Dart",packageManager:"pub"};if(U.isFlutter){if(G.framework="Flutter",U.stateManagement)G.stateManagement=U.stateManagement}else if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="mcp")G.apiType="MCP";Z.push({slots:G,priority:W.priority,frameworks:U.isFlutter?["Flutter","Dart"]:["Dart"],fileName:Y});continue}}if(Y==="go.mod"){let U=k5(z);if(U){let G={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";let V=U.framework?[U.framework,"Go"]:["Go"];Z.push({slots:G,priority:W.priority,frameworks:V,fileName:Y});continue}}if(Y==="Gemfile"||Y==="Gemfile.lock"||Y==="gems.rb"){let U=g5(z);if(U){let G={mainLanguage:"Ruby",packageManager:U.packageManager};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";let V=U.framework?[U.framework,"Ruby"]:["Ruby"];Z.push({slots:G,priority:W.priority??35,frameworks:V,fileName:Y});continue}}if(Y==="Package.swift"){let U=W4(z);if(U){let G={mainLanguage:"Swift",packageManager:U.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="app"&&U.framework)G.framework=U.framework;let V=U.framework?[U.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:W.priority??36,frameworks:V,fileName:Y});continue}}if(Y==="pom.xml"||Y==="build.gradle"||Y==="build.gradle.kts"||Y==="settings.gradle"||Y==="settings.gradle.kts"){if(Q.has(z))continue;Q.add(z);let U=X4(z);if(U){let G={mainLanguage:U.mainLanguage==="Java/Kotlin"?"Kotlin":U.mainLanguage,packageManager:U.buildTool==="maven"?"maven":"gradle",buildTool:U.buildTool};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="mobile")G.framework=U.framework||"Android";if(U.facets.includes("multiplatform"))G.framework=U.framework||"Kotlin Multiplatform";let V=U.framework?[U.framework,"JVM",U.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",U.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:G,priority:W.priority??35,frameworks:V,fileName:Y});continue}}Z.push({slots:W.slots||{},priority:W.priority,frameworks:W.frameworks,fileName:Y})}return Z}function $P($){let Z=[];for(let z of R$($,()=>wW($,2,{count:0}))){let Q=a3[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function ZP($){let Z=[...eR($),...$P($)],z={},Q={},X=new Set;for(let G of Z){G.frameworks.forEach((V)=>X.add(V));for(let[V,H]of Object.entries(G.slots))if(H&&!H.includes("/")&&(!(V in z)||G.priority>Q[V]))z[V]=H,Q[V]=G.priority}let J=new Map;for(let G of Z){if(!G.fileName)continue;if(!J.has(G.fileName))J.set(G.fileName,{fileName:G.fileName,category:sR(G.slots,G.frameworks),priority:G.priority})}let Y=[...J.values()].sort((G,V)=>V.priority-G.priority||G.fileName.localeCompare(V.fileName)),W=[];if(z.mainLanguage)W.push(z.mainLanguage.toLowerCase());if(z.framework)W.push(z.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:z,frameworks:[...X],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function t3($){let{slotFills:Z}=ZP($),z={};for(let[Q,X]of Object.entries(Z)){let J=nR[Q];if(!J||!X)continue;let[Y,W]=J;if(Y==="project")(z.project??={})[W]=X;else(z.stack??={})[W]=X}return z}function wW($,Z,z){let Q=new Set;if(Z<0||z.count>400)return Q;let X=X0($);if(!X)return Q;for(let J of X){if(z.count++>400)break;if(!J.isDirectory()){let Y=pR(J.name);if(iR.has(Y))Q.add(Y);continue}if(dR.has(J.name)||J.name.startsWith("."))continue;for(let Y of wW(cR($,J.name),Z-1,z))Q.add(Y)}return Q}var v0=($,Z,z)=>({value:$,source:Z,confidence:z});function zP($,Z={}){let z=Z.toolingRoot?null:QP($),Q=XP($),X={},J=(Y,W)=>{if(W)X[Y]=W};return J("what",WP(z,Q)),J("who",UP(Q)),J("why",GP(Q)),J("where",VP(z,Q)),J("when",HP(Q)),J("how",KP(z,Q)),X}function e3($,Z={}){let z=zP($,Z),Q={};return Object.keys(z).forEach((X)=>{let J=z[X];if(J)Q[X]=J.value}),Q}function QP($){let Z=m($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function XP($){let Z=m($,"README.md");if(Z===null)return"";return Z.replace(/<!--[\s\S]*?-->/g,"").split(`
238
+ `)}function vR($){let z=bR($).split(`
239
+ `),Q=[];for(let X of z){let J=X.trim();if(J===""){if(Q.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(J))break;if(/^\*\*[^*]+\*\*\s*$/.test(J)&&Q.length===0)continue;Q.push(J)}if(Q.length===0)return null;return Q.join(" ").trim()}function n6($,Z){let z=$.split(`
240
+ `),Q=0;while(Q<z.length){let J=z[Q].trim().match(/^(#{1,6})\s+(.+)$/);if(J&&Z.test(J[2])){let Y=J[1].length,W=[];Q++;while(Q<z.length){let U=z[Q].trim(),G=U.match(/^(#{1,6})\s+/);if(G&&G[1].length<=Y)break;if(U===""){if(W.length>0)break;Q++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),Q++}if(W.length===0)return null;return W.join(" ").trim()}Q++}return null}function gR($){let Z=n6($,/^(use\s+cases?|goal)\b/i);if(Z&&C2(Z))return Z;let z=vR($);if(z&&C2(z))return z;return}function hR($){let Z=n6($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&C2(Z))return Z;return}function fR($){let Z=n6($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&C2(Z))return Z;return}function uR($){let Z=n6($,/^(why|motivation|problem|rationale)\b/i);if(Z&&C2(Z))return Z;return}function mR($){let Z=n6($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&C2(Z))return Z;return}function cR($){let Z=n6($,/^(status|history|timeline|since|launched)\b/i);if(Z&&C2(Z))return Z;return}function pR($){let Z=n6($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&C2(Z))return Z;return}function s3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let q of Z)if(A($,q)){z=q;break}if(!z)return{};let Q=c($,z);if(Q===null)return{};Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=gR(Q);if(J)X.project={goal:J};let Y={},W=hR(Q);if(W)Y.what=W;let U=fR(Q);if(U)Y.who=U;let G=uR(Q);if(G)Y.why=G;let V=mR(Q);if(V)Y.where=V;let H=cR(Q);if(H)Y.when=H;let K=pR(Q);if(K)Y.how=K;if(Object.keys(Y).length>0)X.human_context=Y;return X}function lR($,Z){let z=$.split(`
241
+ `),Q=!1;for(let X of z){let J=X.trim();if(/^\[/.test(J)){Q=J==="[package]";continue}if(!Q)continue;let Y=J.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 o3($){let Z=c($,"Cargo.toml");if(Z===null)return{};let z=lR(Z,"description");if(z&&C2(z))return{project:{goal:z}};return{}}import{join as fW}from"path";var dR=[{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"}],iR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function nR($){let Z=[],z=(Q,X)=>{for(let J of X0($,Q)??[])if(J.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(J.name))Z.push(fW(Q,J.name));else if(J.isDirectory()&&X>0&&!J.name.startsWith(".")&&!iR.has(J.name))z(fW(Q,J.name),X-1)};return z(".",1),Z}function H4($){return[...$].join(" · ")}function a3($){let Z=nR($);if(Z.length===0)return{};let z={database:new Set,cache:new Set,search:new Set,storage:new Set,runtime:new Set};for(let X of Z){let J=c($,X);if(J===null)continue;for(let Y of J.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let W=Y[1].toLowerCase(),U=W.replace(/:[^/]*$/,"").split("/").pop()??W,G=W.replace(/:[^/]*$/,"");for(let{re:V,slot:H,label:K}of dR)if(V.test(U)||V.test(G))z[H].add(K)}}let Q={};if(z.database.size)Q.database=H4(z.database);if(z.cache.size)Q.cache=H4(z.cache);if(z.search.size)Q.search=H4(z.search);if(z.storage.size)Q.storage=H4(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${H4(z.runtime)})`;if(Object.keys(Q).length===0&&!z.runtime.size)return{stack:{hosting:"Docker Compose"}};return Q.hosting="Docker Compose",{stack:Q}}import{join as rR}from"path";var sR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),oR=[{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((z)=>z[1])}}];function t3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function aR($){let Z=[$];for(let z of X0($)??[])if(z.isDirectory()&&!z.name.startsWith(".")&&!sR.has(z.name))Z.push(rR($,z.name));return Z}function tR($){let Z=0;if(A($,"manage.py")||A($,"pyproject.toml")||A($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function e3($){return E$($,()=>eR($))}function eR($){let Z=[];for(let Q of aR($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of oR){let W=c(Q,Y.file);if(W===null)continue;let U=Y.targets(W);if(U.length===0)continue;let G={},V=t3(U,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),H=t3(U,[/^build$/i,/^compile$/i,/^build/i]),K=t3(U,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(V)G.test=`${J}${Y.runner} ${V}`;if(H)G.build=`${J}${Y.runner} ${H}`;if(K)G.lint=`${J}${Y.runner} ${K}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(X?10:tR(Q)),commands:G})}}let z=Z.sort((Q,X)=>X.score-Q.score)[0];return z?{commands:z.commands}:{}}var $F=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function $9($){for(let Z of $F)if(A($,Z))return{security:{secrets:".env",example:Z}};return{}}function ZF($,Z){let z={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 Q of["project","human_context","stack","commands","security"])if(z[Q]&&Object.keys(z[Q]).length===0)delete z[Q];return z}function Z9($){return[s3($),o3($),a3($),e3($),$9($)].reduce(ZF,{})}import{join as zF,extname as QF,resolve as XF}from"path";var z9={"package.json":{frameworks:["Node.js","JavaScript","TypeScript"],slots:{packageManager:"npm/yarn/pnpm",mainLanguage:"JavaScript/TypeScript"},priority:35,intelligence:"ultra-high"},"README.md":{frameworks:[],slots:{},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"},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",buildTool:"Next.js",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"next.config.mjs":{frameworks:["Next.js"],slots:{framework:"Next.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+",buildTool:"Next.js",mainLanguage:"TypeScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.js":{frameworks:["Nuxt 2"],slots:{framework:"Nuxt 2",buildTool:"Nuxt",mainLanguage:"JavaScript",server:"Node.js"},priority:30,intelligence:"high"},"nuxt.config.ts":{frameworks:["Nuxt 3"],slots:{framework:"Nuxt 3",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",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",server:"Node.js"},priority:30,intelligence:"high"},Dockerfile:{frameworks:["Docker"],slots:{},priority:30,intelligence:"high"},"docker-compose.yml":{frameworks:["Docker Compose"],slots:{hosting:"Docker"},priority:30,intelligence:"high"},"docker-compose.yaml":{frameworks:["Docker Compose"],slots:{hosting:"Docker"},priority:30,intelligence:"high"},"kubernetes.yml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes"},priority:30,intelligence:"high"},"k8s.yaml":{frameworks:["Kubernetes"],slots:{hosting:"Kubernetes"},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:{},priority:25,intelligence:"medium"},"jest.config.ts":{frameworks:["Jest"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"vitest.config.ts":{frameworks:["Vitest"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"cypress.config.js":{frameworks:["Cypress"],slots:{},priority:25,intelligence:"medium"},"playwright.config.ts":{frameworks:["Playwright"],slots:{mainLanguage:"TypeScript"},priority:25,intelligence:"medium"},"karma.conf.js":{frameworks:["Karma"],slots:{},priority:20,intelligence:"medium"},"mocha.opts":{frameworks:["Mocha"],slots:{},priority:20,intelligence:"medium"},".rspec":{frameworks:["RSpec"],slots:{mainLanguage:"Ruby"},priority:25,intelligence:"medium"},"pytest.ini":{frameworks:["Pytest"],slots:{mainLanguage:"Python"},priority:25,intelligence:"medium"},"phpunit.xml":{frameworks:["PHPUnit"],slots:{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",build:"zig build"},priority:35,intelligence:"ultra-high"},"openapi.json":{frameworks:["OpenAPI"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"openapi.yaml":{frameworks:["OpenAPI"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"swagger.json":{frameworks:["Swagger"],slots:{apiType:"REST API"},priority:30,intelligence:"high"},"graphql.schema":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},priority:30,intelligence:"high"},"schema.graphql":{frameworks:["GraphQL"],slots:{apiType:"GraphQL"},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",backend:"MLflow"},priority:30,intelligence:"high"},"dvc.yaml":{frameworks:["DVC","Data Version Control"],slots:{mainLanguage:"Python",cicd:"DVC Pipelines"},priority:30,intelligence:"high"},"dvc.lock":{frameworks:["DVC"],slots:{},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:{},priority:25,intelligence:"high"},"dependabot.yml":{frameworks:["Dependabot","GitHub"],slots:{},priority:25,intelligence:"high"},"renovate.json":{frameworks:["Renovate"],slots:{},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"},priority:30,intelligence:"high"},"values.yaml":{frameworks:["Helm","Kubernetes"],slots:{hosting:"Kubernetes"},priority:25,intelligence:"high",confirmWith:["Chart.yaml"]},"pulumi.yaml":{frameworks:["Pulumi"],slots:{cicd:"Pulumi"},priority:30,intelligence:"high"},"Pulumi.yaml":{frameworks:["Pulumi"],slots:{cicd:"Pulumi"},priority:30,intelligence:"high"},"terragrunt.hcl":{frameworks:["Terragrunt","Terraform"],slots:{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:{},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:{},priority:25,intelligence:"high"},"CLAUDE.md":{frameworks:["Claude Code"],slots:{},priority:30,intelligence:"high",confirmWith:[".claude"]}};var JF=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),YF=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),WF={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"]},UF=[["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 GF($,Z){for(let[z,Q]of UF)if(z in $)return Q;return Z.length>0?"framework":"config"}function VF($,Z){try{let z=JSON.parse(c($,Z)??""),Q=["background","content_scripts","action","browser_action","permissions"].some((X)=>(X in z));if(typeof z.manifest_version==="number"&&Q)return"chrome";return"other"}catch{return"other"}}function HF($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return D2($,Z.name)?.isFile()===!0}function KF($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return D2($,Z.name)?.isDirectory()===!0}function qF($){let Z=[],z=XF($),Q=new Set,X=X0(z);if(!X)return Z;for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!KF(z,J):!HF(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let U=h5(z);if(U){let G={mainLanguage:"C#",packageManager:"NuGet",buildTool:"dotnet"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="mobile"&&U.framework)G.framework=U.framework;if(U.targetFramework)G.runtime=U.targetFramework;let V=U.framework?[U.framework,"C#",".NET"]:["C#",".NET"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}if(Y.endsWith(".xcodeproj")){let U=V4(z);if(U){let G={mainLanguage:"Swift",packageManager:U.packageManager==="spm"?"spm":"Xcode",buildTool:U.packageManager.includes("spm")?"swift build":"xcodebuild"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="app"&&U.framework)G.framework=U.framework;let V=U.framework?[U.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:36,frameworks:V,fileName:Y})}continue}let W=z9[Y];if(!W)continue;if(Y==="manifest.json"&&VF(z,Y)!=="chrome")continue;if(Y==="pubspec.yaml"){let U=k5(z);if(U){let G={mainLanguage:"Dart",packageManager:"pub"};if(U.isFlutter){if(G.framework="Flutter",U.stateManagement)G.stateManagement=U.stateManagement}else if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="mcp")G.apiType="MCP";Z.push({slots:G,priority:W.priority,frameworks:U.isFlutter?["Flutter","Dart"]:["Dart"],fileName:Y});continue}}if(Y==="go.mod"){let U=v5(z);if(U){let G={mainLanguage:"Go",packageManager:"go modules",buildTool:"go build"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";let V=U.framework?[U.framework,"Go"]:["Go"];Z.push({slots:G,priority:W.priority,frameworks:V,fileName:Y});continue}}if(Y==="Gemfile"||Y==="Gemfile.lock"||Y==="gems.rb"){let U=f5(z);if(U){let G={mainLanguage:"Ruby",packageManager:U.packageManager};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";let V=U.framework?[U.framework,"Ruby"]:["Ruby"];Z.push({slots:G,priority:W.priority??35,frameworks:V,fileName:Y});continue}}if(Y==="Package.swift"){let U=V4(z);if(U){let G={mainLanguage:"Swift",packageManager:U.packageManager==="xcode"?"Xcode":"spm",buildTool:"swift build"};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="app"&&U.framework)G.framework=U.framework;let V=U.framework?[U.framework,"Swift"]:["Swift"];Z.push({slots:G,priority:W.priority??36,frameworks:V,fileName:Y});continue}}if(Y==="pom.xml"||Y==="build.gradle"||Y==="build.gradle.kts"||Y==="settings.gradle"||Y==="settings.gradle.kts"){if(Q.has(z))continue;Q.add(z);let U=W4(z);if(U){let G={mainLanguage:U.mainLanguage==="Java/Kotlin"?"Kotlin":U.mainLanguage,packageManager:U.buildTool==="maven"?"maven":"gradle",buildTool:U.buildTool};if(U.appType==="backend"&&U.framework)G.backend=U.framework;else if(U.appType==="cli"&&U.framework)G.framework=U.framework;else if(U.appType==="mcp")G.apiType="MCP";else if(U.appType==="mobile")G.framework=U.framework||"Android";if(U.facets.includes("multiplatform"))G.framework=U.framework||"Kotlin Multiplatform";let V=U.framework?[U.framework,"JVM",U.mainLanguage==="Kotlin"?"Kotlin":"Java"]:["JVM",U.mainLanguage==="Kotlin"?"Kotlin":"Java"];Z.push({slots:G,priority:W.priority??35,frameworks:V,fileName:Y});continue}}Z.push({slots:W.slots||{},priority:W.priority,frameworks:W.frameworks,fileName:Y})}return Z}function BF($){let Z=[];for(let z of E$($,()=>uW($,2,{count:0}))){let Q=z9[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function MF($){let Z=[...qF($),...BF($)],z={},Q={},X=new Set;for(let G of Z){G.frameworks.forEach((V)=>X.add(V));for(let[V,H]of Object.entries(G.slots))if(H&&!H.includes("/")&&(!(V in z)||G.priority>Q[V]))z[V]=H,Q[V]=G.priority}let J=new Map;for(let G of Z){if(!G.fileName)continue;if(!J.has(G.fileName))J.set(G.fileName,{fileName:G.fileName,category:GF(G.slots,G.frameworks),priority:G.priority})}let Y=[...J.values()].sort((G,V)=>V.priority-G.priority||G.fileName.localeCompare(V.fileName)),W=[];if(z.mainLanguage)W.push(z.mainLanguage.toLowerCase());if(z.framework)W.push(z.framework.toLowerCase());let U=W.length>0?W.join("-"):"unknown-stack";return{slotFills:z,frameworks:[...X],confirmedCount:Z.length,discoveredFormats:Y,stackSignature:U}}function Q9($){let{slotFills:Z}=MF($),z={};for(let[Q,X]of Object.entries(Z)){let J=WF[Q];if(!J||!X)continue;let[Y,W]=J;if(Y==="project")(z.project??={})[W]=X;else(z.stack??={})[W]=X}return z}function uW($,Z,z){let Q=new Set;if(Z<0||z.count>400)return Q;let X=X0($);if(!X)return Q;for(let J of X){if(z.count++>400)break;if(!J.isDirectory()){let Y=QF(J.name);if(YF.has(Y))Q.add(Y);continue}if(JF.has(J.name)||J.name.startsWith("."))continue;for(let Y of uW(zF($,J.name),Z-1,z))Q.add(Y)}return Q}var v0=($,Z,z)=>({value:$,source:Z,confidence:z});function LF($,Z={}){let z=Z.toolingRoot?null:NF($),Q=OF($),X={},J=(Y,W)=>{if(W)X[Y]=W};return J("what",TF(z,Q)),J("who",AF(Q)),J("why",CF(Q)),J("where",_F(z,Q)),J("when",RF(Q)),J("how",FF(z,Q)),X}function X9($,Z={}){let z=LF($,Z),Q={};return Object.keys(z).forEach((X)=>{let J=z[X];if(J)Q[X]=J.value}),Q}function NF($){let Z=c($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function OF($){let Z=c($,"README.md");if(Z===null)return"";return Z.replace(/<!--[\s\S]*?-->/g,"").split(`
242
242
  `).filter((z)=>!/^\s*\[!\[/.test(z)&&!/^\s*!\[/.test(z)).join(`
243
- `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function i6($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function JP($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function y$($,Z){let z=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),Q=$.match(z);if(!Q||!Q[2]||Q[2].trim().length<=20||JP(Q[2])>0.4)return null;return{body:i6(Q[2]),heading:Q[1].trim()}}function YP($){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 z=Z.split(/[·|]/).map((Q)=>Q.trim()).filter(Boolean);if(z.length>=3&&z.every((Q)=>Q.length<=24))return!0;return!1}function G4($,Z,z=30){for(let Q of Z){let X=$.match(Q);if(X&&X[1]&&X[1].trim().length>=z)return i6(X[1])}return null}function WP($,Z){if($?.description&&$.description.length>20)return v0(i6($.description),"package.json:description",0.95);let z=y$(Z,"Purpose|What|About|Overview|Description");if(z)return v0(z.body,`README:## ${z.heading}`,0.8);let Q=Z.split(/\n\s*\n/).map((J)=>J.replace(/\s+/g," ").trim()).find((J)=>J.length>30&&!J.startsWith("#")&&!YP(J));if(Q)return v0(i6(Q),"README:first-paragraph",0.5);let X=G4(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 X?v0(X,"README:problem-heuristic",0.6):null}function UP($){let Z=y$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=G4($,[/\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 z?v0(z,"README:audience-heuristic",0.6):null}function GP($){let Z=y$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=G4($,[/(?: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 z?v0(z,"README:mission-heuristic",0.6):null}function VP($,Z){let z=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(z)return v0(i6(z.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return v0(i6($.homepage),"package.json:homepage",0.9);let Q=G4(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return Q?v0(Q,"README:deploy-heuristic",0.6):null}function HP($){let Z=y$($,"Timeline|Status|Release|Roadmap");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=G4($,[/\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 z?v0(z,"README:since-heuristic",0.6):null}function KP($,Z){let z=$?.scripts?Object.keys($.scripts):[],Q=["start","dev","build"].filter((Y)=>z.includes(Y));if(Q.length)return v0(i6(Q.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let X=y$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(X)return v0(X.body,`README:## ${X.heading}`,0.8);let J=y$(Z,"Architecture|Approach|How it works|Methodology|How");return J?v0(J.body,`README:## ${J.heading}`,0.7):null}function k$($){let Z=SW($),z=o3($),Q={};if(z.stack)Q.stack=z.stack;if(z.commands)Q.commands=z.commands;if(z.security)Q.security=z.security;let X={};if(z.project)X.project=z.project;if(z.human_context)X.human_context=z.human_context;let J=M6(M6(Q,Z),X);TP(J);let W=(Z._meta?.found??[]).some((G)=>G.startsWith("polyglot:")),U=M6(J,t3($));return M6(U,{human_context:e3($,{toolingRoot:W})})}function yW($,Z){let z=IP(i1(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=p3($),J=Q,Y=M6(z,o3($)),W=M6(Y,J),U=M6(W,t3($)),G=MP(M6(U,{human_context:e3($)}),z),V=LP(qP(Z,z,J)?NP(xW(G,z),z,X):xW(G,z),z);return cY(uY(Z,V))}function qP($,Z,z){if(!G0(l0(Z,"project.type"))){let X=$4($)?.text;return X===void 0||!b3(X)}return!(z._meta?.found??[]).includes(F$)}function $9($){return $.canonical?[$.path,$.canonical]:[$.path]}function l0($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function n6($,Z,z){let[Q,X]=Z.split("."),J=$[Q];if(!$0(J))return;if(z===void 0?!(X in J):J[X]===z)return;let Y={...J};if(z===void 0)delete Y[X];else Y[X]=z;$[Q]=Y}var r6=($)=>typeof $==="string"&&$.trim()===r1;function BP($,Z){let z=Z.map((Q)=>l0($,Q));return z.some(r6)&&z.every((Q)=>G0(Q)||r6(Q))}function xW($,Z){let z={...$};for(let Q of J0){let X=$9(Q);if(!BP(Z,X))continue;for(let J of X){let Y=l0(Z,J);if(l0(z,J)!==Y)n6(z,J,Y)}}return z}function s6($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function MP($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!s6(Z,Q.canonical)||s6(Z,Q.path))continue;let X=l0(z,Q.path);n6(z,Q.path,void 0);let J=l0(z,Q.canonical);if(l5(X)&&G0(J))n6(z,Q.canonical,X)}return z}function LP($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!s6(Z,Q.canonical)||s6(Z,Q.path))continue;let X=l0(z,Q.canonical);if(l5(X)||r6(X))n6(z,Q.path,X)}return z}function NP($,Z,z={}){let Q=$.project,X=$0(Q)?Q.type:void 0,J={...$};for(let Y of J0){if(Y.category==="human"||Y.category==="project")continue;let W=m6(X,Y);if(W===null)return $;if(W)DP(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0);else OP(J,Y)}return J}function DP($,Z,z,Q){let X=$9(z);for(let Y of X)if(r6(l0($,Y))&&!r6(l0(Z,Y)))n6($,Y,s6(Z,Y)?l0(Z,Y):"");if(!l5(Q))return;let J=X.filter((Y)=>s6($,Y));if(J.some((Y)=>!G0(l0($,Y))))return;for(let Y of J.length>0?J:[z.path])n6($,Y,Q)}function OP($,Z){let z=$9(Z).filter((X)=>s6($,X)),Q=(X)=>!G0(l0($,X))&&!r6(l0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(G0(l0($,X)))n6($,X,r1)}function IP($){let Z=$.project;if(Z===null||Z===void 0||$0(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function TP($){let Z=$.project?.type??"library",z=u6[Z]||u6.library;for(let Q of J0){if(z.includes(Q.category))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function M6($,Z){return kW($,Z,"")}function AP($){let Z=H6.get($);return Z!==void 0&&Z.category!=="human"}function l5($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!G0($)&&!r6($)}function CP($,Z){return AP($)&&l5(Z)}function kW($,Z,z){let Q={...$};for(let[X,J]of Object.entries(Z)){let Y=Q[X],W=z?`${z}.${X}`:X;if(W==="_meta"&&Y!==void 0)continue;if(P$(Y)){if(CP(W,J))Q[X]=J;continue}if(G0(Y))Q[X]=J;else if($0(J)&&$0(Y))Q[X]=kW(Y,J,W)}return Q}import{existsSync as bW,lstatSync as _P}from"fs";import{join as RP,basename as PP}from"path";import{createHash as FP}from"crypto";var Y2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),R2=($)=>typeof $==="number"&&Number.isFinite($),_2=($)=>typeof $==="string",SP=/^v?\d+\.\d+\.\d+$/,EP=new Set(["birth","doubled","peak","current"]);function uW($){return Y2($)&&_2($.version)&&SP.test($.version)&&R2($.score)}var jP=($)=>R2($.birthDNA)?$.birthDNA:R2($.birthWeight)?$.birthWeight:null,wP=($)=>Y2($)&&R2($.birthDNA)&&_2($.born),vW=($)=>Y2($)&&_2($.born)&&R2($.birthDNA)&&R2($.lastScore)&&_2($.endedAt),xP=($)=>Array.isArray($)&&$.length>0&&$.every(uW),yP=($)=>Y2($)&&R2($.score)&&_2($.version),kP=($)=>Y2($)&&Array.isArray($.milestones)&&$.milestones.every(Y2);function gW($){return Y2($)&&wP($.birthCertificate)&&xP($.versions)&&yP($.current)&&kP($.growth)}function Z9($){try{return _P($),!0}catch{return!1}}var z9=($)=>`${JSON.stringify($,null,2)}
244
- `,bP=new Set(["version","score","lastSync"]),vP=new Set(["type","score","date","version","label","emoji"]),hW=($,Z)=>Object.keys($).every((z)=>Z.has(z)),Q9={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},mW=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),cW=($)=>hW($.current,bP)&&mW($).every((Z)=>hW(Z,vP)),gP=($)=>mW($).every((Z)=>Z.label===Q9[Z.type].label&&Z.emoji===Q9[Z.type].emoji);function hP($){return cW($)&&gP($)}var fP=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",uP=".faf-dna is not exactly as faf wrote it (hand formatting, key order, a repeated key or a number JSON cannot hold exactly): faf reads it and leaves it as it is.",mP=".faf-dna has a key of yours in an entry faf would replace (current, or the peak or current milestone): faf reads it and leaves it as it is.",cP=".faf-dna has a label or emoji of yours on a milestone faf would replace (the peak or current one): faf reads it and leaves it as it is.",pP=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function lP($){if(!Array.isArray($))return[];return $.filter((Z)=>Y2(Z)&&_2(Z.type)&&EP.has(Z.type)&&R2(Z.score))}var o6=($,Z="")=>_2($)?$:Z;function dP($,Z){if(!Array.isArray($))return[];return $.filter(uW).map((z)=>({version:z.version,timestamp:o6(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(_2):[],growth:R2(z.growth)?z.growth:z.score-Z}))}function iP($,Z,z,Q){return{version:o6($.version,Z?.version??"v1.0.0"),score:R2($.score)?$.score:Z?.score??z,lastSync:o6($.lastSync,Q)}}function fW($){if(!Y2($)||!Y2($.birthCertificate))return null;let Z=$.birthCertificate,z=jP(Z);if(z===null)return null;let Q=o6(Z.born),X=dP($.versions,z),J=iP(Y2($.current)?$.current:{},X[X.length-1],z,Q),Y=Y2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"||Z.birthWeightSource==="legacy"?"legacy":"init",projectDNA:o6(Z.projectDNA),certificate:o6(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:R2(Y.daysActive)?Y.daysActive:0,milestones:lP(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:o6($.lastModified,Q),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(vW)?{priorLineage:$.priorLineage.filter(vW)}:{}}}class m2{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=RP($,".faf-dna")}exists(){let $=bW(this.dnaPath);if(!$&&!Z9(this.dnaPath))this.sawNoFile=!0;return $}endingLineage(){let Z=this.dna??(()=>{let Q=this.read();return Q===null?null:fW(Q.raw)})();if(!Z)return[];let z=Z.birthCertificate;return[...Z.priorLineage??[],{born:z.born,birthDNA:z.birthDNA,certificate:z.certificate,projectDNA:z.projectDNA,lastScore:Z.current.score,endedAt:new Date().toISOString()}]}birth($){let Z=this.endingLineage();if(!Z9(this.dnaPath))this.sawNoFile=!0;let z=new Date().toISOString();return this.own=!0,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",...Z.length>0?{priorLineage:Z}:{}},this.save(),this.dna}isFafShape(){return this.load()!==null&&this.own}readOnlyReason(){return this.load(),this.own?null:this.reason}recordGrowth($,Z){if(!this.dna&&!this.load())return null;if(!this.own)return null;let z=this.dna;if($===z.current.score)return z;let Q=new Date().toISOString(),X=z.birthCertificate.birthDNA,J=$-X,Y=this.incrementVersion(z.versions[z.versions.length-1].version);return z.versions.push({version:Y,timestamp:Q,score:$,changes:Z,growth:J}),z.current={version:Y,score:$,lastSync:Q},z.growth.totalGrowth=J,z.growth.daysActive=this.daysSince(z.birthCertificate.born),this.updateMilestones($,Y,Q),this.save(),z}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,z=$.growth.milestones.find((J)=>J.type==="peak"),Q=$.current.score,X=`${Z}%`;if(z&&z.score!==Z){if(X+=` → ${z.score}%`,Q<z.score)X+=` ← ${Q}%`}else if(Q!==Z)X+=` → ${Q}%`;return X}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,born:_2($.birthCertificate.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",z=_2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(_2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!bW(this.dnaPath)){if(!Z9(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(gW(z)&&z9(z)===Z&&hP(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=fW(z),this.reason=!this.dna?pP:!gW(z)?fP:z9(z)!==Z?uP:cW(z)?cP:mP;return this.text=Z,this.dna}read(){let $;try{$=Q0(l(this.projectPath,".faf-dna"))}catch(Z){return this.reason=Z instanceof Error?Z.message:String(Z),null}try{return{text:$,raw:JSON.parse($)}}catch{return this.reason=".faf-dna is not JSON: faf leaves it as it is.",null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString();let $=z9(this.dna),Z=this.text??(this.sawNoFile?null:k0(l(this.projectPath,".faf-dna")));a(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return FP("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(),z=PP(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${z}-${Z}`}incrementVersion($){let[Z,z,Q]=$.replace("v","").split(".").map(Number);return`v${Z}.${z}.${Q+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,z){if(!this.dna)return;let Q=this.dna.growth.milestones,X=(U)=>Q.some((G)=>G.type===U),J=(U)=>Q.push({type:U,score:$,date:z,version:Z,...Q9[U]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))J("doubled");let Y=Q.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)Q.splice(Q.indexOf(Y),1);J("peak")}let W=Q.findIndex((U)=>U.type==="current");if(W>=0)Q.splice(W,1);J("current")}}i();i();import{statSync as pW}from"fs";import{homedir as nP}from"os";import{parse as rP,resolve as lW}from"path";function dW($,Z){try{let z=pW($,{bigint:!0}),Q=pW(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function sP($){let Z=lW($),z=lW(nP()),Q=rP(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if(dW(Z,z))return"home";if(dW(Z,Q))return"root";return null}function b$($=process.cwd(),Z="faf"){let z=sP($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${T("faf")}: ${Q} is not a project.`),console.error(""),console.error(` ${C("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)}import{statSync as oP}from"fs";import{dirname as aP,resolve as iW}from"path";function tP($,Z){if($.reason==="not-utf8"||$.reason==="changed"||$.reason==="not-yaml"||$.reason==="unplaceable")return"";if($.reason==="not-owned")return Z&&!$.message.includes("--force")?" Use --force to replace it.":"";return $.onWrite?" Nothing was written to it.":" Nothing was read from or written to it."}function v$($){return $ instanceof b||$ instanceof f2}function L6($,Z){return $ instanceof b?`faf: ${$.message}${tP($,Z)}`:`faf: ${$.message}`}function W2($){if($===void 0)return;let Z=aP(iW($)),z;try{z=oP(Z).isDirectory()?null:"is not a folder"}catch(Q){let X=Q?.code;if(X!=="ENOENT"&&X!=="ENOTDIR")throw Q;z="does not exist"}if(z!==null)throw new f2(iW($),`${Z} ${z} — nothing written`)}function X9($={}){b$(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:nW(Z,$.output):nW(Z,"project.faf");if(eP(z)&&!$.force)console.error(`project.faf already exists. Use ${C("--force")} to overwrite.`),process.exit(1);W2($.output);let Q=k$(Z);M0(z,Q,{replace:$.force===!0});let X=p(z),J=n(z,()=>D0(X)),Y=new m2(Z);if(!Y.exists()||$.force)Y.birth(J.score);if(console.log(`${T("created")} ${z}`),S0(J,z),console.log(M(` \uD83E\uDDEC Birth DNA ${J.score}% — your journey starts here (faf dna)`)),J.score<100)console.log(M(`
245
- run ${C("'faf go'")} to fill empty slots`))}i();function d5($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function rW(){let $=new m2(process.cwd());if(!$.load()){let W=$.readOnlyReason();console.error(W?`${C("×")} ${W}`:`${C("×")} No FAF DNA found. Run ${C("'faf init'")} to start your journey.`),process.exit(1)}let Z=$.getJourney(),z=$.getBirthDNADisplay(),Q=z.born.split("T")[0]||"unknown";console.log(),console.log(P0(C("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${T(C(Z))}`),console.log(),console.log(M(` Birth DNA ${z.birthDNA}% (born ${Q}) · current ${z.current}% · growth ${z.growth>=0?"+":""}${z.growth}%`));let X=$.readOnlyReason();if(X)console.log(M(` ${X} ${C("'faf init --force'")} starts a fresh lineage and keeps this one.`));let J=$.getLog();if(J.length>1){console.log(),console.log(M(" history:"));for(let W of J)console.log(M(` ${W}`))}let Y=$.load()?.priorLineage??[];if(Y.length>0){console.log(),console.log(M(` earlier ${Y.length===1?"life":"lives"}:`));for(let W of Y){let U=W.lastScore===W.birthDNA?`${W.birthDNA}%`:`${W.birthDNA}% → ${W.lastScore}%`;console.log(M(` ${U} born ${W.born.slice(0,10)}, reset ${W.endedAt.slice(0,10)} ${W.certificate}`))}}console.log()}import{existsSync as $F}from"fs";import{join as ZF}from"path";i();function i5(){b$(process.cwd(),"faf auto");let $=process.cwd(),Z=ZF($,"project.faf");if($F(Z)){let J=r(Z);n(Z,()=>F0(p(Z)));let Y=[],W=M0(Z,yW($,J),{onAliasKept:(U)=>Y.push(p0(U))});console.log(`${W?T("updated"):M("unchanged")} ${Z}`);for(let U of Y)console.log(M(` ${U}`))}else M0(Z,k$($)),console.log(`${T("created")} ${Z}`);let z=p(Z),Q=n(Z,()=>b0(F0(z))),X=new m2($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),d5(X);if(S0(Q,Z,!1,j5(z,Q,{outOfType:!1})),Q.score<100)console.log(M(`
246
- run ${C("'faf go'")} to reach ✪ Trophy`))}import{existsSync as GF}from"fs";import{join as VF}from"path";var g$="(terse — 3-4 words)",zF=[{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? ${g$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${g$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${g$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${g$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${g$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${g$}`,header:"How",type:"text",required:!0}],QF=[{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}],n5=[...zF,...QF],XF=new Map(n5.map(($)=>[$.path,$])),uh=Object.fromEntries(n5.map(($)=>[$.path,$]));function r5($){let Z=XF.get($);if(Z)return Z.question;let z=H6.get($)??J0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function Y9($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||G0(Z)}return!1}function JF($,Z){let z=$;for(let Q of Z.split("."))if(z&&typeof z==="object"&&Q in z)z=z[Q];else return;return z}function YF($){if($==="project.goal")return!0;return H6.get($)?.category==="human"}function WF($,Z=Y9){let z=[],Q=[];for(let X of n5){let J=JF($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(YF(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function UF($,Z,z=Y9){let Q=WF(Z,z),X;if($>=100||Q.human.length===0&&Q.sourceable.length===0)X="done";else if(Q.sourceable.length>0)X="can-source";else X="needs-human";let J=X==="needs-human"?J9(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function J9($){return $.human.map((Z)=>({path:Z,question:r5(Z)}))}function sW($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??Y9,X=[],J=0;for(let W=0;W<=z;W++){let U=$.read();if(!U)return{status:"no-faf",score:0,rounds:J,history:X,ask:[]};let G=$.score(U.yaml);X.push(G);let V=UF(G,U.data,Q);if(V.status==="done")return{status:"done",score:G,rounds:J,history:X,ask:[]};if(V.status==="needs-human")return{status:"needs-human",score:G,rounds:J,history:X,ask:V.ask};if(X.length>=2&&G<=X[X.length-2])return V.gaps.human.length?{status:"needs-human",score:G,rounds:J,history:X,ask:J9(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:J9(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}i();function oW($={}){let Z=process.cwd(),z=VF(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;HF(sW({read:()=>GF(z)?{data:r(z),yaml:p(z)}:{data:{},yaml:""},score:(J)=>J?n(z,()=>b0(F0(J))).score:0,runAuto:()=>i5()},{maxRounds:Q}))}function HF($){if($.history.length>1)console.log(M(`
243
+ `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function r6($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function DF($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function g$($,Z){let z=new RegExp(`##?\\s+(${Z})\\s*\\n+([\\s\\S]+?)(?:\\n\\n|\\n##?|$)`,"i"),Q=$.match(z);if(!Q||!Q[2]||Q[2].trim().length<=20||DF(Q[2])>0.4)return null;return{body:r6(Q[2]),heading:Q[1].trim()}}function IF($){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 z=Z.split(/[·|]/).map((Q)=>Q.trim()).filter(Boolean);if(z.length>=3&&z.every((Q)=>Q.length<=24))return!0;return!1}function K4($,Z,z=30){for(let Q of Z){let X=$.match(Q);if(X&&X[1]&&X[1].trim().length>=z)return r6(X[1])}return null}function TF($,Z){if($?.description&&$.description.length>20)return v0(r6($.description),"package.json:description",0.95);let z=g$(Z,"Purpose|What|About|Overview|Description");if(z)return v0(z.body,`README:## ${z.heading}`,0.8);let Q=Z.split(/\n\s*\n/).map((J)=>J.replace(/\s+/g," ").trim()).find((J)=>J.length>30&&!J.startsWith("#")&&!IF(J));if(Q)return v0(r6(Q),"README:first-paragraph",0.5);let X=K4(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 X?v0(X,"README:problem-heuristic",0.6):null}function AF($){let Z=g$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=K4($,[/\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 z?v0(z,"README:audience-heuristic",0.6):null}function CF($){let Z=g$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=K4($,[/(?: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 z?v0(z,"README:mission-heuristic",0.6):null}function _F($,Z){let z=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(z)return v0(r6(z.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return v0(r6($.homepage),"package.json:homepage",0.9);let Q=K4(Z,[/\b(?:deployed|hosted|available|published)\s+(?:on|at|via)\s+([^.\n]{3,80})/i],3);return Q?v0(Q,"README:deploy-heuristic",0.6):null}function RF($){let Z=g$($,"Timeline|Status|Release|Roadmap");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=K4($,[/\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 z?v0(z,"README:since-heuristic",0.6):null}function FF($,Z){let z=$?.scripts?Object.keys($.scripts):[],Q=["start","dev","build"].filter((Y)=>z.includes(Y));if(Q.length)return v0(r6(Q.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let X=g$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(X)return v0(X.body,`README:## ${X.heading}`,0.8);let J=g$(Z,"Architecture|Approach|How it works|Methodology|How");return J?v0(J.body,`README:## ${J.heading}`,0.7):null}function h$($){let Z=gW($),z=Z9($),Q={};if(z.stack)Q.stack=z.stack;if(z.commands)Q.commands=z.commands;if(z.security)Q.security=z.security;let X={};if(z.project)X.project=z.project;if(z.human_context)X.human_context=z.human_context;let J=N6(N6(Q,Z),X);bF(J);let W=(Z._meta?.found??[]).some((G)=>G.startsWith("polyglot:")),U=N6(J,Q9($));return N6(U,{human_context:X9($,{toolingRoot:W})})}function cW($,Z){let z=kF(s1(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=r3($),J=Q,Y=N6(z,Z9($)),W=N6(Y,J),U=N6(W,Q9($)),G=EF(N6(U,{human_context:X9($)}),z),V=jF(PF(Z,z,J)?wF(mW(G,z),z,X):mW(G,z),z);return aY(sY(Z,V))}function PF($,Z,z){if(!G0(l0(Z,"project.type"))){let X=Q4($)?.text;return X===void 0||!f3(X)}return!(z._meta?.found??[]).includes(w$)}function J9($){return $.canonical?[$.path,$.canonical]:[$.path]}function l0($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function s6($,Z,z){let[Q,X]=Z.split("."),J=$[Q];if(!$0(J))return;if(z===void 0?!(X in J):J[X]===z)return;let Y={...J};if(z===void 0)delete Y[X];else Y[X]=z;$[Q]=Y}var o6=($)=>typeof $==="string"&&$.trim()===a1;function SF($,Z){let z=Z.map((Q)=>l0($,Q));return z.some(o6)&&z.every((Q)=>G0(Q)||o6(Q))}function mW($,Z){let z={...$};for(let Q of J0){let X=J9(Q);if(!SF(Z,X))continue;for(let J of X){let Y=l0(Z,J);if(l0(z,J)!==Y)s6(z,J,Y)}}return z}function a6($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function EF($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!a6(Z,Q.canonical)||a6(Z,Q.path))continue;let X=l0(z,Q.path);s6(z,Q.path,void 0);let J=l0(z,Q.canonical);if(i5(X)&&G0(J))s6(z,Q.canonical,X)}return z}function jF($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!a6(Z,Q.canonical)||a6(Z,Q.path))continue;let X=l0(z,Q.canonical);if(i5(X)||o6(X))s6(z,Q.path,X)}return z}function wF($,Z,z={}){let Q=$.project,X=$0(Q)?Q.type:void 0,J={...$};for(let Y of J0){if(Y.category==="human"||Y.category==="project")continue;let W=p6(X,Y);if(W===null)return $;if(W)xF(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0);else yF(J,Y)}return J}function xF($,Z,z,Q){let X=J9(z);for(let Y of X)if(o6(l0($,Y))&&!o6(l0(Z,Y)))s6($,Y,a6(Z,Y)?l0(Z,Y):"");if(!i5(Q))return;let J=X.filter((Y)=>a6($,Y));if(J.some((Y)=>!G0(l0($,Y))))return;for(let Y of J.length>0?J:[z.path])s6($,Y,Q)}function yF($,Z){let z=J9(Z).filter((X)=>a6($,X)),Q=(X)=>!G0(l0($,X))&&!o6(l0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(G0(l0($,X)))s6($,X,a1)}function kF($){let Z=$.project;if(Z===null||Z===void 0||$0(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function bF($){let Z=$.project?.type??"library",z=c6[Z]||c6.library;for(let Q of J0){if(z.includes(Q.category))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function N6($,Z){return pW($,Z,"")}function vF($){let Z=q6.get($);return Z!==void 0&&Z.category!=="human"}function i5($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!G0($)&&!o6($)}function gF($,Z){return vF($)&&i5(Z)}function pW($,Z,z){let Q={...$};for(let[X,J]of Object.entries(Z)){let Y=Q[X],W=z?`${z}.${X}`:X;if(W==="_meta"&&Y!==void 0)continue;if(j$(Y)){if(gF(W,J))Q[X]=J;continue}if(G0(Y))Q[X]=J;else if($0(J)&&$0(Y))Q[X]=pW(Y,J,W)}return Q}import{existsSync as lW,lstatSync as hF}from"fs";import{join as fF,basename as uF}from"path";import{createHash as mF}from"crypto";var W2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),R2=($)=>typeof $==="number"&&Number.isFinite($),_2=($)=>typeof $==="string",cF=/^v?\d+\.\d+\.\d+$/,pF=new Set(["birth","doubled","peak","current"]);function sW($){return W2($)&&_2($.version)&&cF.test($.version)&&R2($.score)}var lF=($)=>R2($.birthDNA)?$.birthDNA:R2($.birthWeight)?$.birthWeight:null,dF=($)=>W2($)&&R2($.birthDNA)&&_2($.born),dW=($)=>W2($)&&_2($.born)&&R2($.birthDNA)&&R2($.lastScore)&&_2($.endedAt),iF=($)=>Array.isArray($)&&$.length>0&&$.every(sW),nF=($)=>W2($)&&R2($.score)&&_2($.version),rF=($)=>W2($)&&Array.isArray($.milestones)&&$.milestones.every(W2);function iW($){return W2($)&&dF($.birthCertificate)&&iF($.versions)&&nF($.current)&&rF($.growth)}function Y9($){try{return hF($),!0}catch{return!1}}var W9=($)=>`${JSON.stringify($,null,2)}
244
+ `,sF=new Set(["version","score","lastSync"]),oF=new Set(["type","score","date","version","label","emoji"]),nW=($,Z)=>Object.keys($).every((z)=>Z.has(z)),U9={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},oW=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),aW=($)=>nW($.current,sF)&&oW($).every((Z)=>nW(Z,oF)),aF=($)=>oW($).every((Z)=>Z.label===U9[Z.type].label&&Z.emoji===U9[Z.type].emoji);function tF($){return aW($)&&aF($)}var eF=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",$P=".faf-dna is not exactly as faf wrote it (hand formatting, key order, a repeated key or a number JSON cannot hold exactly): faf reads it and leaves it as it is.",ZP=".faf-dna has a key of yours in an entry faf would replace (current, or the peak or current milestone): faf reads it and leaves it as it is.",zP=".faf-dna has a label or emoji of yours on a milestone faf would replace (the peak or current one): faf reads it and leaves it as it is.",QP=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function XP($){if(!Array.isArray($))return[];return $.filter((Z)=>W2(Z)&&_2(Z.type)&&pF.has(Z.type)&&R2(Z.score))}var t6=($,Z="")=>_2($)?$:Z;function JP($,Z){if(!Array.isArray($))return[];return $.filter(sW).map((z)=>({version:z.version,timestamp:t6(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(_2):[],growth:R2(z.growth)?z.growth:z.score-Z}))}function YP($,Z,z,Q){return{version:t6($.version,Z?.version??"v1.0.0"),score:R2($.score)?$.score:Z?.score??z,lastSync:t6($.lastSync,Q)}}function rW($){if(!W2($)||!W2($.birthCertificate))return null;let Z=$.birthCertificate,z=lF(Z);if(z===null)return null;let Q=t6(Z.born),X=JP($.versions,z),J=YP(W2($.current)?$.current:{},X[X.length-1],z,Q),Y=W2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"||Z.birthWeightSource==="legacy"?"legacy":"init",projectDNA:t6(Z.projectDNA),certificate:t6(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:R2(Y.daysActive)?Y.daysActive:0,milestones:XP(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:t6($.lastModified,Q),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(dW)?{priorLineage:$.priorLineage.filter(dW)}:{}}}class c2{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=fF($,".faf-dna")}exists(){let $=lW(this.dnaPath);if(!$&&!Y9(this.dnaPath))this.sawNoFile=!0;return $}endingLineage(){let Z=this.dna??(()=>{let Q=this.read();return Q===null?null:rW(Q.raw)})();if(!Z)return[];let z=Z.birthCertificate;return[...Z.priorLineage??[],{born:z.born,birthDNA:z.birthDNA,certificate:z.certificate,projectDNA:z.projectDNA,lastScore:Z.current.score,endedAt:new Date().toISOString()}]}birth($){let Z=this.endingLineage();if(!Y9(this.dnaPath))this.sawNoFile=!0;let z=new Date().toISOString();return this.own=!0,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",...Z.length>0?{priorLineage:Z}:{}},this.save(),this.dna}isFafShape(){return this.load()!==null&&this.own}readOnlyReason(){return this.load(),this.own?null:this.reason}recordGrowth($,Z){if(!this.dna&&!this.load())return null;if(!this.own)return null;let z=this.dna;if($===z.current.score)return z;let Q=new Date().toISOString(),X=z.birthCertificate.birthDNA,J=$-X,Y=this.incrementVersion(z.versions[z.versions.length-1].version);return z.versions.push({version:Y,timestamp:Q,score:$,changes:Z,growth:J}),z.current={version:Y,score:$,lastSync:Q},z.growth.totalGrowth=J,z.growth.daysActive=this.daysSince(z.birthCertificate.born),this.updateMilestones($,Y,Q),this.save(),z}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,z=$.growth.milestones.find((J)=>J.type==="peak"),Q=$.current.score,X=`${Z}%`;if(z&&z.score!==Z){if(X+=` → ${z.score}%`,Q<z.score)X+=` ← ${Q}%`}else if(Q!==Z)X+=` → ${Q}%`;return X}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,born:_2($.birthCertificate.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",z=_2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(_2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!lW(this.dnaPath)){if(!Y9(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(iW(z)&&W9(z)===Z&&tF(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=rW(z),this.reason=!this.dna?QP:!iW(z)?eF:W9(z)!==Z?$P:aW(z)?zP:ZP;return this.text=Z,this.dna}read(){let $;try{$=Q0(d(this.projectPath,".faf-dna"))}catch(Z){return this.reason=Z instanceof Error?Z.message:String(Z),null}try{return{text:$,raw:JSON.parse($)}}catch{return this.reason=".faf-dna is not JSON: faf leaves it as it is.",null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString();let $=W9(this.dna),Z=this.text??(this.sawNoFile?null:k0(d(this.projectPath,".faf-dna")));a(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return mF("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(),z=uF(this.projectPath).replace(/[^A-Z0-9]/gi,"").toUpperCase().substring(0,8).padEnd(4,"X");return`FAF-${$}-${z}-${Z}`}incrementVersion($){let[Z,z,Q]=$.replace("v","").split(".").map(Number);return`v${Z}.${z}.${Q+1}`}daysSince($){return Math.floor((Date.now()-new Date($).getTime())/86400000)}updateMilestones($,Z,z){if(!this.dna)return;let Q=this.dna.growth.milestones,X=(U)=>Q.some((G)=>G.type===U),J=(U)=>Q.push({type:U,score:$,date:z,version:Z,...U9[U]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))J("doubled");let Y=Q.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)Q.splice(Q.indexOf(Y),1);J("peak")}let W=Q.findIndex((U)=>U.type==="current");if(W>=0)Q.splice(W,1);J("current")}}n();n();import{statSync as tW}from"fs";import{homedir as WP}from"os";import{parse as UP,resolve as eW}from"path";function $U($,Z){try{let z=tW($,{bigint:!0}),Q=tW(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function GP($){let Z=eW($),z=eW(WP()),Q=UP(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if($U(Z,z))return"home";if($U(Z,Q))return"root";return null}function f$($=process.cwd(),Z="faf"){let z=GP($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${T("faf")}: ${Q} is not a project.`),console.error(""),console.error(` ${C("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)}import{statSync as VP}from"fs";import{dirname as HP,resolve as ZU}from"path";function KP($,Z){if($.reason==="not-utf8"||$.reason==="changed"||$.reason==="not-yaml"||$.reason==="unplaceable")return"";if($.reason==="not-owned")return Z&&!$.message.includes("--force")?" Use --force to replace it.":"";return $.onWrite?" Nothing was written to it.":" Nothing was read from or written to it."}function u$($){return $ instanceof v||$ instanceof u2}function O6($,Z){return $ instanceof v?`faf: ${$.message}${KP($,Z)}`:`faf: ${$.message}`}function U2($){if($===void 0)return;let Z=HP(ZU($)),z;try{z=VP(Z).isDirectory()?null:"is not a folder"}catch(Q){let X=Q?.code;if(X!=="ENOENT"&&X!=="ENOTDIR")throw Q;z="does not exist"}if(z!==null)throw new u2(ZU($),`${Z} ${z} — nothing written`)}function G9($={}){f$(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:zU(Z,$.output):zU(Z,"project.faf");if(qP(z)&&!$.force)console.error(`project.faf already exists. Use ${C("--force")} to overwrite.`),process.exit(1);U2($.output);let Q=h$(Z);M0(z,Q,{replace:$.force===!0});let X=l(z),J=s(z,()=>O0(X)),Y=new c2(Z);if(!Y.exists()||$.force)Y.birth(J.score);if(console.log(`${T("created")} ${z}`),S0(J,z),console.log(M(` \uD83E\uDDEC Birth DNA ${J.score}% — your journey starts here (faf dna)`)),J.score<100)console.log(M(`
245
+ run ${C("'faf go'")} to fill empty slots`))}n();function n5($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function QU(){let $=new c2(process.cwd());if(!$.load()){let W=$.readOnlyReason();console.error(W?`${C("×")} ${W}`:`${C("×")} No FAF DNA found. Run ${C("'faf init'")} to start your journey.`),process.exit(1)}let Z=$.getJourney(),z=$.getBirthDNADisplay(),Q=z.born.split("T")[0]||"unknown";console.log(),console.log(F0(C("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${T(C(Z))}`),console.log(),console.log(M(` Birth DNA ${z.birthDNA}% (born ${Q}) · current ${z.current}% · growth ${z.growth>=0?"+":""}${z.growth}%`));let X=$.readOnlyReason();if(X)console.log(M(` ${X} ${C("'faf init --force'")} starts a fresh lineage and keeps this one.`));let J=$.getLog();if(J.length>1){console.log(),console.log(M(" history:"));for(let W of J)console.log(M(` ${W}`))}let Y=$.load()?.priorLineage??[];if(Y.length>0){console.log(),console.log(M(` earlier ${Y.length===1?"life":"lives"}:`));for(let W of Y){let U=W.lastScore===W.birthDNA?`${W.birthDNA}%`:`${W.birthDNA}% → ${W.lastScore}%`;console.log(M(` ${U} born ${W.born.slice(0,10)}, reset ${W.endedAt.slice(0,10)} ${W.certificate}`))}}console.log()}import{existsSync as BP}from"fs";import{join as MP}from"path";n();function r5(){f$(process.cwd(),"faf auto");let $=process.cwd(),Z=MP($,"project.faf");if(BP(Z)){let J=o(Z);s(Z,()=>P0(l(Z)));let Y=[],W=M0(Z,cW($,J),{onAliasKept:(U)=>Y.push(p0(U))});console.log(`${W?T("updated"):M("unchanged")} ${Z}`);for(let U of Y)console.log(M(` ${U}`))}else M0(Z,h$($)),console.log(`${T("created")} ${Z}`);let z=l(Z),Q=s(Z,()=>b0(P0(z))),X=new c2($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),n5(X);if(S0(Q,Z,!1,x5(z,Q,{outOfType:!1})),Q.score<100)console.log(M(`
246
+ run ${C("'faf go'")} to reach ✪ Trophy`))}import{existsSync as CP}from"fs";import{join as _P}from"path";var m$="(terse — 3-4 words)",LP=[{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? ${m$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${m$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${m$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${m$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${m$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${m$}`,header:"How",type:"text",required:!0}],NP=[{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}],s5=[...LP,...NP],OP=new Map(s5.map(($)=>[$.path,$])),Jf=Object.fromEntries(s5.map(($)=>[$.path,$]));function o5($){let Z=OP.get($);if(Z)return Z.question;let z=q6.get($)??J0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function H9($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||G0(Z)}return!1}function DP($,Z){let z=$;for(let Q of Z.split("."))if(z&&typeof z==="object"&&Q in z)z=z[Q];else return;return z}function IP($){if($==="project.goal")return!0;return q6.get($)?.category==="human"}function TP($,Z=H9){let z=[],Q=[];for(let X of s5){let J=DP($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(IP(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function AP($,Z,z=H9){let Q=TP(Z,z),X;if($>=100||Q.human.length===0&&Q.sourceable.length===0)X="done";else if(Q.sourceable.length>0)X="can-source";else X="needs-human";let J=X==="needs-human"?V9(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function V9($){return $.human.map((Z)=>({path:Z,question:o5(Z)}))}function XU($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??H9,X=[],J=0;for(let W=0;W<=z;W++){let U=$.read();if(!U)return{status:"no-faf",score:0,rounds:J,history:X,ask:[]};let G=$.score(U.yaml);X.push(G);let V=AP(G,U.data,Q);if(V.status==="done")return{status:"done",score:G,rounds:J,history:X,ask:[]};if(V.status==="needs-human")return{status:"needs-human",score:G,rounds:J,history:X,ask:V.ask};if(X.length>=2&&G<=X[X.length-2])return V.gaps.human.length?{status:"needs-human",score:G,rounds:J,history:X,ask:V9(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:V9(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}n();function JU($={}){let Z=process.cwd(),z=_P(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;RP(XU({read:()=>CP(z)?{data:o(z),yaml:l(z)}:{data:{},yaml:""},score:(J)=>J?s(z,()=>b0(P0(J))).score:0,runAuto:()=>r5()},{maxRounds:Q}))}function RP($){if($.history.length>1)console.log(M(`
247
247
  climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${T("done")} — ✪ 100% AI-readiness. The .faf is complete.`);break;case"needs-human":{let Z=$.ask.length;console.log(`${C("Sourced everything detection can.")} ${Z} question${Z===1?"":"s"} only you can answer:`);for(let z of $.ask)console.log(` ${M("•")} ${z.question}`);console.log(M(`
248
- Answer with ${C("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${C(`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(`${C(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${C("'faf loop'")} to continue, or raise ${M("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${C("'faf init'")} first.`);break}}import{existsSync as ZS}from"fs";import{join as OU,dirname as zS}from"path";import{existsSync as gF,statSync as Wf}from"fs";import{join as YU}from"path";import{dirname as zU,resolve as QU}from"path";var tW=100;var KF="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",qF=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${KF})(?=\\s|/?>|$)`,"i"),new RegExp(`^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*/?>|</[A-Za-z][A-Za-z0-9-]*\\s*>)\\s*$`,"i")],BF=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],MF=["","-->","?>",">","]]>"],LF=/[#`~*+_=<>0-9-]/,NF=/(\d{1,9})([.)])/y,DF=/#{1,6}(?:[ \t]+|$)/y,OF=/`{3,}(?!.*`)|~{3,}/y,IF=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,TF=/(?:=+|-+)[ \t]*$/y,AF=/[^ \t\f\v\r\n]/;function V4($,Z,z){return $.lastIndex=z,$.exec(Z)}var CF=($)=>$==="quote"||$==="list"||$==="item";function _F($){let Z=new Uint8Array($.length),z="*-_",Q=[0,0,0],X=[!0,!0,!0];for(let J=$.length-1;J>=0;J--){let Y=$[J],W=Y===" "||Y==="\t";for(let G=0;G<3;G++)if(Y==="*-_"[G])Q[G]++;else if(!W)X[G]=!1;let U="*-_".indexOf(Y);Z[J]=U>=0&&X[U]&&Q[U]>=3?1:0}return Z}var h$=($)=>$===" "||$==="\t";function RF($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var aW=($)=>$==="paragraph"||$==="code"||$==="html";function PF($){if($.kind==="list"||$.kind==="item")return{...$,list:{...$.list}};if($.kind==="code")return{...$,fence:$.fence&&{...$.fence}};return{...$}}class P2{containers;stack=[{kind:"document"}];ln="";offset=0;column=0;nextNonspace=0;nextNonspaceColumn=0;indent=0;indented=!1;blank=!1;allClosed=!0;matched=0;htmlStarted=!1;hiddenIn=null;scannedFrom=-1;breaks=null;deep=!1;limit=-1;overflow=-1;starts;constructor($=!0){this.containers=$;this.starts=[()=>this.startQuote(),()=>this.startHeading(),()=>this.startFence(),(Z)=>this.startHtml(Z),(Z)=>this.startSetext(Z),()=>this.startBreak(),(Z)=>this.startItem(Z),()=>this.startIndentedCode()]}clone(){let $=new P2(this.containers);return $.stack=this.stack.map(PF),$.deep=this.deep,$}overflowAt($,Z){let z=this.clone();return z.limit=Z,z.line($),z.overflow}get tooDeep(){return this.deep}line($){if(this.deep)return null;this.ln=$,this.offset=0,this.column=0,this.blank=!1,this.htmlStarted=!1,this.hiddenIn=null,this.scannedFrom=-1,this.breaks=null;let Z=this.continueContainers();if(Z<0)return this.hiddenIn;let z=this.openBlocks(Z);if(this.deep)return null;if(!this.allClosed&&!this.blank&&this.tip.kind==="paragraph")return null;return this.closeUnmatched(),this.addText(z),this.hiddenIn}closer(){if(this.stack.length!==2)return null;let $=this.stack[1];if($.kind==="code")return $.fence?$.fence.char.repeat($.fence.len):null;if($.kind!=="html"||$.type>5)return null;return $.type===1?`</${$.tag}>`:MF[$.type-1]}get tip(){return this.stack[this.stack.length-1]}continueContainers(){let $=this.stack.length-1,Z=0;while(Z<$){this.findNextNonspace();let z=this.continues(this.stack[Z+1],Z+1);if(z===2)return-1;if(z===1)break;Z++}return this.allClosed=Z===$,this.matched=Z,Z}openBlocks($){let Z=this.stack[$],z=Z.kind!=="paragraph"&&aW(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!LF.test(this.ln.charAt(Q)))break;let X=0;for(let J of this.starts)if(X=J(Z),X!==0)break;if(X===0)break;this.noteOverflow(Q,X),Z=this.tip,z=X===2}if(!z)this.advanceNextNonspace();return Z}noteOverflow($,Z){if(Z===1&&this.limit>=0&&this.overflow<0&&this.stack.length-1>this.limit)this.overflow=$}addText($){if($.kind==="code")this.hiddenIn=$.fence?"code fence":"indented code";else if($.kind==="html")this.addHtmlLine($);else if(!aW($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=BF[$.type-1].test(this.ln.slice(this.offset));if(!(this.htmlStarted&&$.type===2&&Z))this.hiddenIn=$.type===1?`<${$.tag}>`:$.type===2?"comment":"html";if(Z)this.stack.pop()}continues($,Z){switch($.kind){case"quote":return this.continueQuote();case"item":return this.continueItem($);case"code":return $.fence?this.continueFence($.fence,Z):this.continueIndentedCode();default:return this.continueOther($)}}continueOther($){if($.kind==="heading"||$.kind==="break")return 1;return($.kind==="paragraph"||$.kind==="html"&&$.type>=6)&&this.blank?1:0}continueQuote(){if(this.indented||this.ch!==">")return 1;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),h$(this.ln[this.offset]))this.advanceOffset(1,!0);return 0}continueItem($){let Z=$.list.markerOffset+$.list.padding;if(this.blank){if(!$.hasChild)return 1;this.advanceNextNonspace()}else if(this.indent>=Z)this.advanceOffset(Z,!0);else return 1;return 0}continueFence($,Z){let z=this.indent<=3&&this.ch===$.char?V4(IF,this.ln,this.nextNonspace):null;if(z&&z[0].length>=$.len)return this.stack.length=Z,this.hiddenIn="code fence",2;for(let Q=$.offset;Q>0&&h$(this.ln[this.offset]);Q--)this.advanceOffset(1,!0);return 0}continueIndentedCode(){if(this.indent>=4)this.advanceOffset(4,!0);else if(this.blank)this.advanceNextNonspace();else return 1;return 0}get ch(){return this.ln.charAt(this.nextNonspace)}breakAhead(){return this.breaks??=_F(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),h$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!V4(DF,this.ln,this.nextNonspace))return 0;return this.closeUnmatched(),this.addChild({kind:"heading"}),this.offset=this.ln.length,2}startFence(){let $=this.ch,Z=this.indented||$!=="`"&&$!=="~"?null:V4(OF,this.ln,this.nextNonspace);if(!Z)return 0;return this.closeUnmatched(),this.addChild({kind:"code",fence:{char:Z[0][0],len:Z[0].length,offset:this.indent}}),this.advanceNextNonspace(),this.advanceOffset(Z[0].length,!1),2}startHtml($){if(this.indented||this.ch!=="<")return 0;let Z=!this.allClosed&&!this.blank&&this.tip.kind==="paragraph",z=$.kind!=="paragraph"&&!Z,Q=this.ln.slice(this.nextNonspace);for(let X=1;X<=(z?7:6);X++){let J=qF[X-1].exec(Q);if(J)return this.closeUnmatched(),this.addChild({kind:"html",type:X,tag:X===1?J[1].toLowerCase():""}),this.htmlStarted=!0,2}return 0}startSetext($){let Z=this.ch;if(this.indented||$.kind!=="paragraph"||Z!=="="&&Z!=="-"||!V4(TF,this.ln,this.nextNonspace))return 0;return this.closeUnmatched(),this.stack[this.stack.length-1]={kind:"heading"},this.offset=this.ln.length,2}startBreak(){if(this.indented||!this.breakAhead())return 0;return this.closeUnmatched(),this.addChild({kind:"break"}),this.offset=this.ln.length,2}startItem($){if(!this.containers||this.indented&&$.kind!=="list")return 0;let Z=this.listMarker($);if(!Z)return 0;this.closeUnmatched();let z=this.tip;if(z.kind!=="list"||z.list.bullet!==Z.bullet||z.list.delimiter!==Z.delimiter)this.addChild({kind:"list",list:Z});return this.addChild({kind:"item",list:Z,hasChild:!1}),1}startIndentedCode(){if(!this.indented||this.tip.kind==="paragraph"||this.blank)return 0;return this.advanceOffset(4,!0),this.closeUnmatched(),this.addChild({kind:"code",fence:null}),2}listMarker($){if(this.indent>=4)return null;let Z=this.markerAt($);if(!Z)return null;let z=this.indent;return this.advanceNextNonspace(),this.advanceOffset(Z.width,!0),{...Z.kind,markerOffset:z,padding:this.paddingAfter(Z.width)}}markerAt($){let Z=$.kind==="paragraph",z=this.markerKind(Z);if(!z)return null;let Q=this.ln[this.nextNonspace+z.width];if(!(Q===void 0||h$(Q)))return null;if(Z&&!AF.test(this.ln.slice(this.nextNonspace+z.width)))return null;return z}markerKind($){let Z=this.ch;if(Z==="*"||Z==="+"||Z==="-")return{width:1,kind:{bullet:Z,delimiter:null}};let z=Z>="0"&&Z<="9"?V4(NF,this.ln,this.nextNonspace):null;if(!z||$&&Number(z[1])!==1)return null;return{width:z[0].length,kind:{bullet:null,delimiter:z[2]}}}paddingAfter($){let Z=this.column,z=this.offset;do this.advanceOffset(1,!0);while(this.column-Z<5&&h$(this.ln[this.offset]));let Q=this.column-Z;if(Q>=1&&Q<5&&this.ln[this.offset]!==void 0)return $+Q;if(this.column=Z,this.offset=z,h$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!RF(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),CF($.kind)&&this.stack.length-1>100)this.deep=!0}closeUnmatched(){if(!this.allClosed)this.stack.length=this.matched+1,this.allClosed=!0}findNextNonspace(){let $=this.ln,Z=this.offset,z=this.column;if(this.scannedFrom!==-1&&this.offset>=this.scannedFrom&&this.offset<=this.nextNonspace)Z=this.nextNonspace,z=this.nextNonspaceColumn;else{this.scannedFrom=this.offset;for(;Z<$.length;Z++)if($[Z]===" ")z++;else if($[Z]==="\t")z+=4-z%4;else break}this.blank=Z>=$.length,this.nextNonspace=Z,this.nextNonspaceColumn=z,this.indent=z-this.column,this.indented=this.indent>=4}advanceNextNonspace(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn}advanceOffset($,Z){let z=$;while(z>0&&this.offset<this.ln.length){if(this.ln[this.offset]!=="\t"){this.offset++,this.column++,z--;continue}let Q=4-this.column%4,X=Z&&Q>z;this.column+=X?z:Q,this.offset+=X?0:1,z-=Z?Math.min(Q,z):1}}}var c2="<!-- faf:start -->",p2="<!-- faf:end -->",eW="\uFEFF";function a6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var U2=($)=>$.replace(/\r?\n$|\r$/,""),XU=($)=>U2($).replace(/^\uFEFF/,"").trimEnd();function*W9($){let Z=0;for(let z of a6($)){let Q=U2(z),X=Z===0&&Q.charCodeAt(0)===65279?1:0;yield{offset:Z,from:Z+X,to:Z+Q.length,content:Q.slice(X)},Z+=z.length}}function FF($,Z,z,Q){let X=$.some((Y)=>Y.start!==-1)&&Q(Z.content),J=z(Z.content);for(let Y of $)if(Y.start!==-1&&X)Y.found={start:Y.start,end:Z.to};else if(J)Y.start=Z.from}function U9($,Z,z){let[Q,X]=[new P2(!0),new P2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of W9($)){let Y=[Q,X].map((U)=>U.reader.line(J.content));if(Q.reader.tooDeep)return null;let W=[Q,X].filter((U,G)=>Y[G]===null);if(W.length>0)FF(W,J,Z,z);if(Q.found||X.found)return Q.found&&X.found&&Q.found.start===X.found.start?Q.found:null}return null}var $U=($)=>(Z)=>Z===$;function K4($,Z=c2,z=p2){return U9($,$U(Z),$U(z))}function ZU($,Z){let z=[];for(let Q of[!0,!1]){let X=new P2(Q);for(let J of a6($))X.line(U2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var SF=16;function EF($){let Z=new P2(!0);return $.map((z)=>{let Q=Z.overflowAt(U2(z),SF),X=z;if(Q>=0){let J=/^\d{1,9}(?=[.)])/.exec(z.slice(Q)),Y=J?Q+J[0].length:Q;X=`${z.slice(0,Y)}\\${z.slice(Y)}`}return Z.line(U2(X)),X})}function jF($,Z,z){let X=EF(a6($).map((Y)=>{let W=XU(Y);return W===Z||W===z?` ${Y}`:Y})).join(""),J=ZU(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
249
- ${J[0]}`,W=ZU(Y,z);if(W.length>=J.length)break;X=Y,J=W}return X}function wF($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=a6(Q).map((J)=>U2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
248
+ Answer with ${C("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${C(`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(`${C(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${C("'faf loop'")} to continue, or raise ${M("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${C("'faf init'")} first.`);break}}import{existsSync as MS}from"fs";import{join as SU,dirname as LS}from"path";import{existsSync as aP,statSync as Ff}from"fs";import{join as MU}from"path";import{dirname as HU,resolve as KU}from"path";var WU=100;var FP="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",PP=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${FP})(?=\\s|/?>|$)`,"i"),new RegExp(`^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*/?>|</[A-Za-z][A-Za-z0-9-]*\\s*>)\\s*$`,"i")],SP=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],EP=["","-->","?>",">","]]>"],jP=/[#`~*+_=<>0-9-]/,wP=/(\d{1,9})([.)])/y,xP=/#{1,6}(?:[ \t]+|$)/y,yP=/`{3,}(?!.*`)|~{3,}/y,kP=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,bP=/(?:=+|-+)[ \t]*$/y,vP=/[^ \t\f\v\r\n]/;function q4($,Z,z){return $.lastIndex=z,$.exec(Z)}var gP=($)=>$==="quote"||$==="list"||$==="item";function hP($){let Z=new Uint8Array($.length),z="*-_",Q=[0,0,0],X=[!0,!0,!0];for(let J=$.length-1;J>=0;J--){let Y=$[J],W=Y===" "||Y==="\t";for(let G=0;G<3;G++)if(Y==="*-_"[G])Q[G]++;else if(!W)X[G]=!1;let U="*-_".indexOf(Y);Z[J]=U>=0&&X[U]&&Q[U]>=3?1:0}return Z}var c$=($)=>$===" "||$==="\t";function fP($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var YU=($)=>$==="paragraph"||$==="code"||$==="html";function uP($){if($.kind==="list"||$.kind==="item")return{...$,list:{...$.list}};if($.kind==="code")return{...$,fence:$.fence&&{...$.fence}};return{...$}}class F2{containers;stack=[{kind:"document"}];ln="";offset=0;column=0;nextNonspace=0;nextNonspaceColumn=0;indent=0;indented=!1;blank=!1;allClosed=!0;matched=0;htmlStarted=!1;hiddenIn=null;scannedFrom=-1;breaks=null;deep=!1;limit=-1;overflow=-1;starts;constructor($=!0){this.containers=$;this.starts=[()=>this.startQuote(),()=>this.startHeading(),()=>this.startFence(),(Z)=>this.startHtml(Z),(Z)=>this.startSetext(Z),()=>this.startBreak(),(Z)=>this.startItem(Z),()=>this.startIndentedCode()]}clone(){let $=new F2(this.containers);return $.stack=this.stack.map(uP),$.deep=this.deep,$}overflowAt($,Z){let z=this.clone();return z.limit=Z,z.line($),z.overflow}get tooDeep(){return this.deep}line($){if(this.deep)return null;this.ln=$,this.offset=0,this.column=0,this.blank=!1,this.htmlStarted=!1,this.hiddenIn=null,this.scannedFrom=-1,this.breaks=null;let Z=this.continueContainers();if(Z<0)return this.hiddenIn;let z=this.openBlocks(Z);if(this.deep)return null;if(!this.allClosed&&!this.blank&&this.tip.kind==="paragraph")return null;return this.closeUnmatched(),this.addText(z),this.hiddenIn}closer(){if(this.stack.length!==2)return null;let $=this.stack[1];if($.kind==="code")return $.fence?$.fence.char.repeat($.fence.len):null;if($.kind!=="html"||$.type>5)return null;return $.type===1?`</${$.tag}>`:EP[$.type-1]}get tip(){return this.stack[this.stack.length-1]}continueContainers(){let $=this.stack.length-1,Z=0;while(Z<$){this.findNextNonspace();let z=this.continues(this.stack[Z+1],Z+1);if(z===2)return-1;if(z===1)break;Z++}return this.allClosed=Z===$,this.matched=Z,Z}openBlocks($){let Z=this.stack[$],z=Z.kind!=="paragraph"&&YU(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!jP.test(this.ln.charAt(Q)))break;let X=0;for(let J of this.starts)if(X=J(Z),X!==0)break;if(X===0)break;this.noteOverflow(Q,X),Z=this.tip,z=X===2}if(!z)this.advanceNextNonspace();return Z}noteOverflow($,Z){if(Z===1&&this.limit>=0&&this.overflow<0&&this.stack.length-1>this.limit)this.overflow=$}addText($){if($.kind==="code")this.hiddenIn=$.fence?"code fence":"indented code";else if($.kind==="html")this.addHtmlLine($);else if(!YU($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=SP[$.type-1].test(this.ln.slice(this.offset));if(!(this.htmlStarted&&$.type===2&&Z))this.hiddenIn=$.type===1?`<${$.tag}>`:$.type===2?"comment":"html";if(Z)this.stack.pop()}continues($,Z){switch($.kind){case"quote":return this.continueQuote();case"item":return this.continueItem($);case"code":return $.fence?this.continueFence($.fence,Z):this.continueIndentedCode();default:return this.continueOther($)}}continueOther($){if($.kind==="heading"||$.kind==="break")return 1;return($.kind==="paragraph"||$.kind==="html"&&$.type>=6)&&this.blank?1:0}continueQuote(){if(this.indented||this.ch!==">")return 1;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),c$(this.ln[this.offset]))this.advanceOffset(1,!0);return 0}continueItem($){let Z=$.list.markerOffset+$.list.padding;if(this.blank){if(!$.hasChild)return 1;this.advanceNextNonspace()}else if(this.indent>=Z)this.advanceOffset(Z,!0);else return 1;return 0}continueFence($,Z){let z=this.indent<=3&&this.ch===$.char?q4(kP,this.ln,this.nextNonspace):null;if(z&&z[0].length>=$.len)return this.stack.length=Z,this.hiddenIn="code fence",2;for(let Q=$.offset;Q>0&&c$(this.ln[this.offset]);Q--)this.advanceOffset(1,!0);return 0}continueIndentedCode(){if(this.indent>=4)this.advanceOffset(4,!0);else if(this.blank)this.advanceNextNonspace();else return 1;return 0}get ch(){return this.ln.charAt(this.nextNonspace)}breakAhead(){return this.breaks??=hP(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),c$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!q4(xP,this.ln,this.nextNonspace))return 0;return this.closeUnmatched(),this.addChild({kind:"heading"}),this.offset=this.ln.length,2}startFence(){let $=this.ch,Z=this.indented||$!=="`"&&$!=="~"?null:q4(yP,this.ln,this.nextNonspace);if(!Z)return 0;return this.closeUnmatched(),this.addChild({kind:"code",fence:{char:Z[0][0],len:Z[0].length,offset:this.indent}}),this.advanceNextNonspace(),this.advanceOffset(Z[0].length,!1),2}startHtml($){if(this.indented||this.ch!=="<")return 0;let Z=!this.allClosed&&!this.blank&&this.tip.kind==="paragraph",z=$.kind!=="paragraph"&&!Z,Q=this.ln.slice(this.nextNonspace);for(let X=1;X<=(z?7:6);X++){let J=PP[X-1].exec(Q);if(J)return this.closeUnmatched(),this.addChild({kind:"html",type:X,tag:X===1?J[1].toLowerCase():""}),this.htmlStarted=!0,2}return 0}startSetext($){let Z=this.ch;if(this.indented||$.kind!=="paragraph"||Z!=="="&&Z!=="-"||!q4(bP,this.ln,this.nextNonspace))return 0;return this.closeUnmatched(),this.stack[this.stack.length-1]={kind:"heading"},this.offset=this.ln.length,2}startBreak(){if(this.indented||!this.breakAhead())return 0;return this.closeUnmatched(),this.addChild({kind:"break"}),this.offset=this.ln.length,2}startItem($){if(!this.containers||this.indented&&$.kind!=="list")return 0;let Z=this.listMarker($);if(!Z)return 0;this.closeUnmatched();let z=this.tip;if(z.kind!=="list"||z.list.bullet!==Z.bullet||z.list.delimiter!==Z.delimiter)this.addChild({kind:"list",list:Z});return this.addChild({kind:"item",list:Z,hasChild:!1}),1}startIndentedCode(){if(!this.indented||this.tip.kind==="paragraph"||this.blank)return 0;return this.advanceOffset(4,!0),this.closeUnmatched(),this.addChild({kind:"code",fence:null}),2}listMarker($){if(this.indent>=4)return null;let Z=this.markerAt($);if(!Z)return null;let z=this.indent;return this.advanceNextNonspace(),this.advanceOffset(Z.width,!0),{...Z.kind,markerOffset:z,padding:this.paddingAfter(Z.width)}}markerAt($){let Z=$.kind==="paragraph",z=this.markerKind(Z);if(!z)return null;let Q=this.ln[this.nextNonspace+z.width];if(!(Q===void 0||c$(Q)))return null;if(Z&&!vP.test(this.ln.slice(this.nextNonspace+z.width)))return null;return z}markerKind($){let Z=this.ch;if(Z==="*"||Z==="+"||Z==="-")return{width:1,kind:{bullet:Z,delimiter:null}};let z=Z>="0"&&Z<="9"?q4(wP,this.ln,this.nextNonspace):null;if(!z||$&&Number(z[1])!==1)return null;return{width:z[0].length,kind:{bullet:null,delimiter:z[2]}}}paddingAfter($){let Z=this.column,z=this.offset;do this.advanceOffset(1,!0);while(this.column-Z<5&&c$(this.ln[this.offset]));let Q=this.column-Z;if(Q>=1&&Q<5&&this.ln[this.offset]!==void 0)return $+Q;if(this.column=Z,this.offset=z,c$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!fP(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),gP($.kind)&&this.stack.length-1>100)this.deep=!0}closeUnmatched(){if(!this.allClosed)this.stack.length=this.matched+1,this.allClosed=!0}findNextNonspace(){let $=this.ln,Z=this.offset,z=this.column;if(this.scannedFrom!==-1&&this.offset>=this.scannedFrom&&this.offset<=this.nextNonspace)Z=this.nextNonspace,z=this.nextNonspaceColumn;else{this.scannedFrom=this.offset;for(;Z<$.length;Z++)if($[Z]===" ")z++;else if($[Z]==="\t")z+=4-z%4;else break}this.blank=Z>=$.length,this.nextNonspace=Z,this.nextNonspaceColumn=z,this.indent=z-this.column,this.indented=this.indent>=4}advanceNextNonspace(){this.offset=this.nextNonspace,this.column=this.nextNonspaceColumn}advanceOffset($,Z){let z=$;while(z>0&&this.offset<this.ln.length){if(this.ln[this.offset]!=="\t"){this.offset++,this.column++,z--;continue}let Q=4-this.column%4,X=Z&&Q>z;this.column+=X?z:Q,this.offset+=X?0:1,z-=Z?Math.min(Q,z):1}}}var p2="<!-- faf:start -->",l2="<!-- faf:end -->",UU="\uFEFF";function e6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var G2=($)=>$.replace(/\r?\n$|\r$/,""),qU=($)=>G2($).replace(/^\uFEFF/,"").trimEnd();function*K9($){let Z=0;for(let z of e6($)){let Q=G2(z),X=Z===0&&Q.charCodeAt(0)===65279?1:0;yield{offset:Z,from:Z+X,to:Z+Q.length,content:Q.slice(X)},Z+=z.length}}function mP($,Z,z,Q){let X=$.some((Y)=>Y.start!==-1)&&Q(Z.content),J=z(Z.content);for(let Y of $)if(Y.start!==-1&&X)Y.found={start:Y.start,end:Z.to};else if(J)Y.start=Z.from}function q9($,Z,z){let[Q,X]=[new F2(!0),new F2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of K9($)){let Y=[Q,X].map((U)=>U.reader.line(J.content));if(Q.reader.tooDeep)return null;let W=[Q,X].filter((U,G)=>Y[G]===null);if(W.length>0)mP(W,J,Z,z);if(Q.found||X.found)return Q.found&&X.found&&Q.found.start===X.found.start?Q.found:null}return null}var GU=($)=>(Z)=>Z===$;function M4($,Z=p2,z=l2){return q9($,GU(Z),GU(z))}function VU($,Z){let z=[];for(let Q of[!0,!1]){let X=new F2(Q);for(let J of e6($))X.line(G2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var cP=16;function pP($){let Z=new F2(!0);return $.map((z)=>{let Q=Z.overflowAt(G2(z),cP),X=z;if(Q>=0){let J=/^\d{1,9}(?=[.)])/.exec(z.slice(Q)),Y=J?Q+J[0].length:Q;X=`${z.slice(0,Y)}\\${z.slice(Y)}`}return Z.line(G2(X)),X})}function lP($,Z,z){let X=pP(e6($).map((Y)=>{let W=qU(Y);return W===Z||W===z?` ${Y}`:Y})).join(""),J=VU(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
249
+ ${J[0]}`,W=VU(Y,z);if(W.length>=J.length)break;X=Y,J=W}return X}function dP($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=e6(Q).map((J)=>G2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
250
250
  ${X}
251
- ${z}`}function H4($,Z,z,Q=c2,X=p2,J="the file"){let Y=(U)=>{let G=`${$}${U}${z}`,V=K4(G,Q,X);return V&&V.start===$.length&&V.end===$.length+U.length?G:null},W=Y(Z)??Y(wF(Z,Q,X));if(W===null)throw new b("unplaceable",J,`${J}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return W}function G9($,Z=c2,z=p2){return`${Z}
252
- ${jF($.trim(),Z,z)}
253
- ${z}`}function s5($,Z,z=c2,Q=p2,X){if($===null)return H4("",Z,`
254
- `,z,Q,X);let J=K4($,z,Q);if(J)return H4($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(eW)?eW:"";return H4(Y,Z,`
251
+ ${z}`}function B4($,Z,z,Q=p2,X=l2,J="the file"){let Y=(U)=>{let G=`${$}${U}${z}`,V=M4(G,Q,X);return V&&V.start===$.length&&V.end===$.length+U.length?G:null},W=Y(Z)??Y(dP(Z,Q,X));if(W===null)throw new v("unplaceable",J,`${J}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return W}function B9($,Z=p2,z=l2){return`${Z}
252
+ ${lP($.trim(),Z,z)}
253
+ ${z}`}function a5($,Z,z=p2,Q=l2,X){if($===null)return B4("",Z,`
254
+ `,z,Q,X);let J=M4($,z,Q);if(J)return B4($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(UU)?UU:"";return B4(Y,Z,`
255
255
 
256
- ${$.slice(Y.length)}`,z,Q,X)}function N6($){try{return Q0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function G2($,Z,z=c2,Q=p2,X={}){let J=G9(Z,z,Q),Y=QU($),W=X.root??zU(Y),U=l(W,Y),G=N6(U);a(U,s5(G,J,z,Q,Y),{root:W,expect:G})}var xF="<!-- faf:";function yF($){if($==="code fence")return"a code fence";if($==="indented code")return"an indented code block";if($==="comment")return"an HTML comment";return $==="html"?"an HTML block":`a ${$} block`}function kF($,Z){let z=[new P2(!0),new P2(!1)],Q=!1;for(let{content:X}of W9($)){if(Q){if(X===Z)return"too deep";continue}let[J,Y]=z.map((U)=>U.line(X));Q=z[0].tooDeep;let W=J??Y;if(X===Z&&(Q||W!==null))return Q?"too deep":W}return null}function bF($,Z,z){let Q=[new P2(!0),new P2(!1)];for(let{content:X}of W9($)){let J=Q.map((Y)=>Y.line(X));if(Q[0].tooDeep)return!1;if((X===Z||X===z)&&J.some((Y)=>Y===null))return!0}return!1}function V9($,Z,z=c2,Q=p2){if(Z===null||K4(Z,z,Q))return null;let X=XU(a6(Z)[0]??"");if(X.startsWith(xF)&&X!==z&&X!==Q)return`${$}: faf's block is now on top; the old faf text below it is left as you had it — delete it by hand if you no longer want it.`;let J=kF(Z,z);if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${tW} lists or quotes before an older faf block, so faf did not read that far — the older block is left as you had it; delete it by hand if you no longer want it.`;if(J!==null)return`${$}: faf's block is now on top; an older faf block below sits inside ${yF(J)} and is left as you had it — delete it by hand if you no longer want it.`;if(bF(Z,z,Q))return`${$}: faf's block is now on top; an older faf marker line below it has no matching pair, so the text there is left as you had it — delete it by hand if you no longer want it.`;return null}function o5($,Z,z=c2,Q=p2,X={}){try{let J=QU($);return V9(Z,N6(l(X.root??zU(J),J)),z,Q)}catch{return null}}var vF=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 H9($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return vF.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function V0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function h0($){let Z=H6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return H9(z)}var K9=y0.claude,hF="STATUS: SYNC ACTIVE";function WU($){let Z=YU($,K9);if(!gF(Z))return null;return Q0(l($,K9))}function UU($,Z){G2(YU($,K9),Z)}function l2($,Z={}){let z=String($.project?.name??"").trim(),Q=String($.project?.main_language??"").trim(),X=String($.project?.type??"").trim(),J=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[z,Q,X,J].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}
257
- ${U}`}function GU($){let Z=[],z=$.project?.name??"Project",Q=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(l2($)),Z.push(""),Z.push(`# CLAUDE.md — ${z}`),Z.push(""),X)Z.push("## What This Is"),Z.push(""),Z.push(X),Z.push("");let J=$.stack??{},Y=[];if(Q)Y.push(`**Language:** ${Q}`);for(let[G,V]of Object.entries(J))if(V&&V!=="slotignored"&&String(V).trim())Y.push(`**${h0(`stack.${G}`)}:** ${V}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let G of Y)Z.push(`- ${G}`);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(([,G])=>G&&String(G).trim()).map(([G,V])=>`- **${h0(`human_context.${G}`)}:** ${V}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${hF} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
258
- `)}function JU($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function a5($){let Z={project:{}},z=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(z)Z.project.name=JU(z[1].trim());if(!Z.project.name){let J=$.match(/\*\*Name:\*\*\s*(.+)/);if(J)Z.project.name=JU(J[1].trim())}let Q=$.match(/## What This Is\s*\n\s*\n(.+)/);if(Q)Z.project.goal=Q[1].trim();if(!Z.project.goal){let J=$.match(/\*\*What Building:\*\*\s*(.+)/);if(J)Z.project.goal=J[1].trim()}let X=$.match(/\*\*Language:\*\*\s*(.+)/);if(X)Z.project.main_language=X[1].trim();if(!Z.project.main_language){let J=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim()}return Z}import{existsSync as Mf,lstatSync as LU,readFileSync as e5,realpathSync as q9,statSync as fF}from"fs";import{homedir as uF}from"os";import{basename as mF,dirname as B9,join as d2,resolve as e6}from"path";function t6($){let Z=String($??"").trim(),z=Z.indexOf(" — ");if(z<=0)return{cmd:Z,note:null};let Q=Z.slice(0,z).trim(),X=Z.slice(z+3).trim();if(!Q||!X)return{cmd:Z,note:null};return{cmd:Q,note:X}}function D6($){return t6($).cmd}var VU=200,HU=200,KU=12,cF="# Project Context (from project.faf)",pF="*This section is managed by tri-sync.";function lF($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function dF($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=VU)return Z;return`${Z.slice(0,VU)}-${Math.abs(lF($)).toString(36)}`}function NU($){try{let Z=LU($);if(Z.isSymbolicLink()){let z=fF($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function qU($){try{return LU($).isFile()}catch{return!1}}function iF($){let Z=$;for(;;){if(NU(d2(Z,".git")))return Z;let z=B9(Z);if(z===Z)return null;Z=z}}function nF($){let Z;try{Z=e5(d2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=e6($,Z.slice(7).trim()),Q=d2(z,"commondir");if(!qU(Q))return $;let X=e6(z,e5(Q,"utf-8").trim());if(e6(B9(z))!==d2(X,"worktrees"))return $;let J=d2(z,"gitdir");if(!qU(J))return $;let Y=e5(J,"utf-8").trim();if(q9(e6(z,Y))!==d2(q9($),".git"))return $;if(mF(X)!==".git")return NU(d2(X,".git"))?$:X;return B9(X)}catch{return $}}function rF($){let Z=e6($);try{Z=q9.native(Z)}catch{}let z=iF(Z);return(z?nF(z):Z).normalize("NFC")}function sF($,Z={}){if(Z.memoryDir)return e6(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||d2(uF(),".claude");return d2(e6(z),"projects",dF(rF($)),"memory").normalize("NFC")}var oF=new Set(["target_user","core_problem","mission_purpose"]),aF=["who","what","why","where","when","how"];function tF($){let Z=$.project??{},z=[["Goal",Z.goal],["Language",Z.main_language],["Type",Z.type]],Q=$.human_context??{},X=Array.isArray($.key_files)?$.key_files:[];return["## Project context — from project.faf","",`- **Name:** ${V0(Z.name)?Z.name:"Project"}`,...z.filter(([,Y])=>V0(Y)).map(([Y,W])=>`- **${Y}:** ${W}`),...t5("Stack",Object.entries($.stack??{}).filter(([Y,W])=>!oF.has(Y)&&V0(W)).map(([Y,W])=>`- **${h0(`stack.${Y}`)}:** ${W}`)),...t5("Context",aF.filter((Y)=>V0(Q[Y])).map((Y)=>`- **${h0(`human_context.${Y}`)}:** ${Q[Y]}`)),...t5("Commands",Object.entries($.commands??{}).filter(([,Y])=>V0(Y)).slice(0,KU).map(([Y,W])=>`- ${Y}: \`${D6(W)}\``)),...t5("Key files",X.filter(V0).slice(0,KU).map((Y)=>`- ${Y}`)),"","*faf keeps this block in step with project.faf. Everything outside it is Claude's own and is kept as written.*"].join(`
259
- `)}function t5($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function eF($){return U9($,(Z)=>Z.trimEnd()===cF,(Z)=>Z.startsWith(pF))}function BU($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function $S($,Z,z){if($===null)return{text:s5(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=K4($),X=Q??eF($);if(X){let Y=$.slice(0,X.start),W=$.slice(X.end);return{text:H4(Y,Z,W,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:W}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:s5($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function MU($){return $>HU?[`MEMORY.md is ${$} lines. Claude Code loads the first ${HU}; lines after that are kept in the file but not loaded.`]:[]}function DU($,Z,z={}){let Q=sF($,z);w0(Q);let X=l(Q,y0.memory),J=N6(X),Y=$S(J,G9(tF(Z)),X);if(Y.text===J){let K=BU(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:K,warnings:MU(K)}}let W=a(X,Y.text,{root:Q,expect:J}),U=e5(W,"utf-8"),G=U===Y.text&&U.startsWith(Y.head)&&U.endsWith(Y.tail),V=BU(U),H=Y.action==="added"?V9(y0.memory,J):null;return{path:W,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...H?[H]:[],...MU(V)]}}i();function q4(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function M9($={}){let Z=process.cwd(),z=f(Z);if(!z)console.error(`Error: project.faf not found
256
+ ${$.slice(Y.length)}`,z,Q,X)}function D6($){try{return Q0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function V2($,Z,z=p2,Q=l2,X={}){let J=B9(Z,z,Q),Y=KU($),W=X.root??HU(Y),U=d(W,Y),G=D6(U);a(U,a5(G,J,z,Q,Y),{root:W,expect:G})}var iP="<!-- faf:";function nP($){if($==="code fence")return"a code fence";if($==="indented code")return"an indented code block";if($==="comment")return"an HTML comment";return $==="html"?"an HTML block":`a ${$} block`}function rP($,Z){let z=[new F2(!0),new F2(!1)],Q=!1;for(let{content:X}of K9($)){if(Q){if(X===Z)return"too deep";continue}let[J,Y]=z.map((U)=>U.line(X));Q=z[0].tooDeep;let W=J??Y;if(X===Z&&(Q||W!==null))return Q?"too deep":W}return null}function sP($,Z,z){let Q=[new F2(!0),new F2(!1)];for(let{content:X}of K9($)){let J=Q.map((Y)=>Y.line(X));if(Q[0].tooDeep)return!1;if((X===Z||X===z)&&J.some((Y)=>Y===null))return!0}return!1}function M9($,Z,z=p2,Q=l2){if(Z===null||M4(Z,z,Q))return null;let X=qU(e6(Z)[0]??"");if(X.startsWith(iP)&&X!==z&&X!==Q)return`${$}: faf's block is now on top; the old faf text below it is left as you had it — delete it by hand if you no longer want it.`;let J=rP(Z,z);if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${WU} lists or quotes before an older faf block, so faf did not read that far — the older block is left as you had it; delete it by hand if you no longer want it.`;if(J!==null)return`${$}: faf's block is now on top; an older faf block below sits inside ${nP(J)} and is left as you had it — delete it by hand if you no longer want it.`;if(sP(Z,z,Q))return`${$}: faf's block is now on top; an older faf marker line below it has no matching pair, so the text there is left as you had it — delete it by hand if you no longer want it.`;return null}function t5($,Z,z=p2,Q=l2,X={}){try{let J=KU($);return M9(Z,D6(d(X.root??HU(J),J)),z,Q)}catch{return null}}var oP=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 L9($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return oP.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function V0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function h0($){let Z=q6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return L9(z)}var N9=y0.claude,tP="STATUS: SYNC ACTIVE";function LU($){let Z=MU($,N9);if(!aP(Z))return null;return Q0(d($,N9))}function NU($,Z){V2(MU($,N9),Z)}function d2($,Z={}){let z=String($.project?.name??"").trim(),Q=String($.project?.main_language??"").trim(),X=String($.project?.type??"").trim(),J=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[z,Q,X,J].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}
257
+ ${U}`}function OU($){let Z=[],z=$.project?.name??"Project",Q=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(d2($)),Z.push(""),Z.push(`# CLAUDE.md — ${z}`),Z.push(""),X)Z.push("## What This Is"),Z.push(""),Z.push(X),Z.push("");let J=$.stack??{},Y=[];if(Q)Y.push(`**Language:** ${Q}`);for(let[G,V]of Object.entries(J))if(V&&V!=="slotignored"&&String(V).trim())Y.push(`**${h0(`stack.${G}`)}:** ${V}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let G of Y)Z.push(`- ${G}`);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(([,G])=>G&&String(G).trim()).map(([G,V])=>`- **${h0(`human_context.${G}`)}:** ${V}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${tP} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
258
+ `)}function BU($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function e5($){let Z={project:{}},z=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(z)Z.project.name=BU(z[1].trim());if(!Z.project.name){let J=$.match(/\*\*Name:\*\*\s*(.+)/);if(J)Z.project.name=BU(J[1].trim())}let Q=$.match(/## What This Is\s*\n\s*\n(.+)/);if(Q)Z.project.goal=Q[1].trim();if(!Z.project.goal){let J=$.match(/\*\*What Building:\*\*\s*(.+)/);if(J)Z.project.goal=J[1].trim()}let X=$.match(/\*\*Language:\*\*\s*(.+)/);if(X)Z.project.main_language=X[1].trim();if(!Z.project.main_language){let J=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim()}return Z}import{existsSync as kf,lstatSync as RU,readFileSync as ZZ,realpathSync as O9,statSync as eP}from"fs";import{homedir as $S}from"os";import{basename as ZS,dirname as D9,join as i2,resolve as Z$}from"path";function $$($){let Z=String($??"").trim(),z=Z.indexOf(" — ");if(z<=0)return{cmd:Z,note:null};let Q=Z.slice(0,z).trim(),X=Z.slice(z+3).trim();if(!Q||!X)return{cmd:Z,note:null};return{cmd:Q,note:X}}function I6($){return $$($).cmd}var DU=200,IU=200,TU=12,zS="# Project Context (from project.faf)",QS="*This section is managed by tri-sync.";function XS($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function JS($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=DU)return Z;return`${Z.slice(0,DU)}-${Math.abs(XS($)).toString(36)}`}function FU($){try{let Z=RU($);if(Z.isSymbolicLink()){let z=eP($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function AU($){try{return RU($).isFile()}catch{return!1}}function YS($){let Z=$;for(;;){if(FU(i2(Z,".git")))return Z;let z=D9(Z);if(z===Z)return null;Z=z}}function WS($){let Z;try{Z=ZZ(i2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=Z$($,Z.slice(7).trim()),Q=i2(z,"commondir");if(!AU(Q))return $;let X=Z$(z,ZZ(Q,"utf-8").trim());if(Z$(D9(z))!==i2(X,"worktrees"))return $;let J=i2(z,"gitdir");if(!AU(J))return $;let Y=ZZ(J,"utf-8").trim();if(O9(Z$(z,Y))!==i2(O9($),".git"))return $;if(ZS(X)!==".git")return FU(i2(X,".git"))?$:X;return D9(X)}catch{return $}}function US($){let Z=Z$($);try{Z=O9.native(Z)}catch{}let z=YS(Z);return(z?WS(z):Z).normalize("NFC")}function GS($,Z={}){if(Z.memoryDir)return Z$(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||i2($S(),".claude");return i2(Z$(z),"projects",JS(US($)),"memory").normalize("NFC")}var VS=new Set(["target_user","core_problem","mission_purpose"]),HS=["who","what","why","where","when","how"];function KS($){let Z=$.project??{},z=[["Goal",Z.goal],["Language",Z.main_language],["Type",Z.type]],Q=$.human_context??{},X=Array.isArray($.key_files)?$.key_files:[];return["## Project context — from project.faf","",`- **Name:** ${V0(Z.name)?Z.name:"Project"}`,...z.filter(([,Y])=>V0(Y)).map(([Y,W])=>`- **${Y}:** ${W}`),...$Z("Stack",Object.entries($.stack??{}).filter(([Y,W])=>!VS.has(Y)&&V0(W)).map(([Y,W])=>`- **${h0(`stack.${Y}`)}:** ${W}`)),...$Z("Context",HS.filter((Y)=>V0(Q[Y])).map((Y)=>`- **${h0(`human_context.${Y}`)}:** ${Q[Y]}`)),...$Z("Commands",Object.entries($.commands??{}).filter(([,Y])=>V0(Y)).slice(0,TU).map(([Y,W])=>`- ${Y}: \`${I6(W)}\``)),...$Z("Key files",X.filter(V0).slice(0,TU).map((Y)=>`- ${Y}`)),"","*faf keeps this block in step with project.faf. Everything outside it is Claude's own and is kept as written.*"].join(`
259
+ `)}function $Z($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function qS($){return q9($,(Z)=>Z.trimEnd()===zS,(Z)=>Z.startsWith(QS))}function CU($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function BS($,Z,z){if($===null)return{text:a5(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=M4($),X=Q??qS($);if(X){let Y=$.slice(0,X.start),W=$.slice(X.end);return{text:B4(Y,Z,W,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:W}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:a5($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function _U($){return $>IU?[`MEMORY.md is ${$} lines. Claude Code loads the first ${IU}; lines after that are kept in the file but not loaded.`]:[]}function PU($,Z,z={}){let Q=GS($,z);w0(Q);let X=d(Q,y0.memory),J=D6(X),Y=BS(J,B9(KS(Z)),X);if(Y.text===J){let K=CU(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:K,warnings:_U(K)}}let W=a(X,Y.text,{root:Q,expect:J}),U=ZZ(W,"utf-8"),G=U===Y.text&&U.startsWith(Y.head)&&U.endsWith(Y.tail),V=CU(U),H=Y.action==="added"?M9(y0.memory,J):null;return{path:W,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...H?[H]:[],..._U(V)]}}n();function L4(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function I9($={}){let Z=process.cwd(),z=u(Z);if(!z)console.error(`Error: project.faf not found
260
260
 
261
- Run 'faf init' to create one.`),process.exit(2);let Q=OU(Z,"CLAUDE.md"),X=$.direction??"auto";if(X==="auto")IU(z,Q,Z);else if(X==="push")TU(z,Z);else if(X==="pull")QS(z,Q);if(q4())AU(z,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),JS(z,Q,Z)}function IU($,Z,z){TU($,z)}function TU($,Z){let z=r($),Q=GU(z),X=o5(OU(Z,"CLAUDE.md"),"CLAUDE.md");if(UU(Z,Q),console.log(`${T("◆")} sync .faf → CLAUDE.md`),X)console.log(M(` ${X}`));let J=n($,()=>b0(F0(p($))));S0(J,$)}function QS($,Z){let z=r($),Q=n($,()=>b0(F0(p($))));if(Q.tier.name!=="TROPHY")console.error(`${C("×")} sync --pull blocked: requires ✪ Trophy (currently ${Q.score}%)`),console.error(M(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let X=WU(zS(Z));if(!X){console.error("CLAUDE.md not found.");return}let J=a5(X);if(J.project?.name)z.project={...z.project,name:J.project.name};if(J.project?.goal)z.project={...z.project,goal:J.project.goal};if(J.project?.main_language)z.project={...z.project,main_language:J.project.main_language};M0($,z,{onAliasKept:(W)=>console.log(M(` ${p0(W)}`))}),console.log(`${T("◆")} sync CLAUDE.md → .faf ${M("(Trophy-gated)")}`);let Y=n($,()=>b0(F0(p($))));S0(Y,$)}var XS={created:"created",updated:"block updated",migrated:"earlier tri-sync section replaced by the block",added:"block added on top; Claude's notes kept",unchanged:"unchanged"};function AU($,Z){try{let z=DU(Z,r($));console.log(`${T("◆")} sync .faf → MEMORY.md ${M(`${XS[z.action]} — ${z.path}`)}`);for(let Q of z.warnings)console.log(M(` ${Q}`))}catch(z){console.error(`${C("×")} sync .faf → MEMORY.md ${z instanceof Error?z.message:String(z)}`),process.exitCode=1}}function JS($,Z,z){let{watch:Q}=n0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(M("change detected...")),IU($,Z,z),q4())AU($,z)},200)};if(Q($,J),ZS(Z))Q(Z,J)}import{statSync as CU}from"fs";import{dirname as _U,resolve as B4}from"path";i();function L9($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var N9="FAFB header (a .fafb faf compiled)";function D9($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function O9($,Z){if(B4($)===B4(Z))return!0;try{let z=CU($),Q=CU(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function RU($,Z={}){let z=$??f();if(!z)console.error(`Error: project.faf not found
261
+ Run 'faf init' to create one.`),process.exit(2);let Q=SU(Z,"CLAUDE.md"),X=$.direction??"auto";if(X==="auto")EU(z,Q,Z);else if(X==="push")jU(z,Z);else if(X==="pull")NS(z,Q);if(L4())wU(z,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),DS(z,Q,Z)}function EU($,Z,z){jU($,z)}function jU($,Z){let z=o($),Q=OU(z),X=t5(SU(Z,"CLAUDE.md"),"CLAUDE.md");if(NU(Z,Q),console.log(`${T("◆")} sync .faf → CLAUDE.md`),X)console.log(M(` ${X}`));let J=s($,()=>b0(P0(l($))));S0(J,$)}function NS($,Z){let z=o($),Q=s($,()=>b0(P0(l($))));if(Q.tier.name!=="TROPHY")console.error(`${C("×")} sync --pull blocked: requires ✪ Trophy (currently ${Q.score}%)`),console.error(M(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let X=LU(LS(Z));if(!X){console.error("CLAUDE.md not found.");return}let J=e5(X);if(J.project?.name)z.project={...z.project,name:J.project.name};if(J.project?.goal)z.project={...z.project,goal:J.project.goal};if(J.project?.main_language)z.project={...z.project,main_language:J.project.main_language};M0($,z,{onAliasKept:(W)=>console.log(M(` ${p0(W)}`))}),console.log(`${T("◆")} sync CLAUDE.md → .faf ${M("(Trophy-gated)")}`);let Y=s($,()=>b0(P0(l($))));S0(Y,$)}var OS={created:"created",updated:"block updated",migrated:"earlier tri-sync section replaced by the block",added:"block added on top; Claude's notes kept",unchanged:"unchanged"};function wU($,Z){try{let z=PU(Z,o($));console.log(`${T("◆")} sync .faf → MEMORY.md ${M(`${OS[z.action]} — ${z.path}`)}`);for(let Q of z.warnings)console.log(M(` ${Q}`))}catch(z){console.error(`${C("×")} sync .faf → MEMORY.md ${z instanceof Error?z.message:String(z)}`),process.exitCode=1}}function DS($,Z,z){let{watch:Q}=n0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(M("change detected...")),EU($,Z,z),L4())wU($,z)},200)};if(Q($,J),MS(Z))Q(Z,J)}import{statSync as xU}from"fs";import{dirname as yU,resolve as N4}from"path";n();function T9($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var A9="FAFB header (a .fafb faf compiled)";function C9($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function _9($,Z){if(N4($)===N4(Z))return!0;try{let z=xU($),Q=xU(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function kU($,Z={}){let z=$??u();if(!z)console.error(`Error: project.faf not found
262
262
 
263
- Run 'faf init' to create one.`),process.exit(2);let Q=p(z);X2(Q,z);let X=n(z,()=>E5(Q)),J=Z.output??D9(z);if(O9(J,z))console.error(`faf: ${B4(J)} is the file being compiled — faf does not write the .fafb over its source, and left it unchanged. Name another output with --output.`),process.exit(1);W2(Z.output);let Y=Z.output?_U(B4(J)):_U(B4(z));w2(J,X,{root:Y,owns:L9,mark:N9,force:Z.force}),console.log(`${T("compiled")} ${J} ${M(`(${X.length} bytes)`)}`)}import{readFileSync as _S}from"fs";import{dirname as RS,resolve as bU}from"path";import{createHash as VS}from"crypto";import{resolve as HS}from"path";class f0 extends Error{constructor($){super($);this.name="JsonEditError"}}var YS=new Set([" ","\t",`
264
- `,"\r"]);class A9{s;i=0;constructor($){this.s=$}parse(){if(this.s.startsWith("\uFEFF"))this.i=1;let $=this.value();if(this.ws(),this.i!==this.s.length)this.fail("text after the end of the JSON value");return $}fail($){throw new f0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&YS.has(this.s[this.i]))this.i++}value(){this.ws();let $=this.s[this.i];if($==="{")return this.object();if($==="[")return this.array();if($==='"'){let Z=this.i;return this.string(),{kind:"string",start:Z,end:this.i,members:[],items:[]}}if($==="-"||$>="0"&&$<="9")return this.number();for(let Z of["true","false","null"])if(this.s.startsWith(Z,this.i)){let z=this.i;return this.i+=Z.length,{kind:"literal",start:z,end:this.i,members:[],items:[]}}return this.fail($===void 0?"unexpected end":`unexpected ${JSON.stringify($)}`)}object(){let $=this.i++,Z=[];if(this.ws(),this.s[this.i]==="}")return this.i++,{kind:"object",start:$,end:this.i,members:Z,items:[]};for(;;){if(this.ws(),this.s[this.i]!=='"')this.fail("expected a key");let z=this.i,Q=this.string(),X=this.i;if(this.ws(),this.s[this.i]!==":")this.fail('expected ":"');if(this.i++,Z.push({key:Q,keyStart:z,keyEnd:X,value:this.value()}),this.ws(),this.s[this.i]===","){this.i++;continue}if(this.s[this.i]==="}")return this.i++,{kind:"object",start:$,end:this.i,members:Z,items:[]};this.fail('expected "," or "}"')}}array(){let $=this.i++,Z=[];if(this.ws(),this.s[this.i]==="]")return this.i++,{kind:"array",start:$,end:this.i,members:[],items:Z};for(;;){if(Z.push(this.value()),this.ws(),this.s[this.i]===","){this.i++;continue}if(this.s[this.i]==="]")return this.i++,{kind:"array",start:$,end:this.i,members:[],items:Z};this.fail('expected "," or "]"')}}string(){let $=this.i++;for(;;){let Z=this.s[this.i];if(Z===void 0)this.fail("unterminated string");if(Z==='"')break;if(Z<" ")this.fail("control character in a string");if(Z==="\\"){let z=this.s[this.i+1];if(z==="u"){if(!/^[0-9a-fA-F]{4}$/.test(this.s.slice(this.i+2,this.i+6)))this.fail("bad \\u escape");this.i+=6;continue}if(!'"\\/bfnrt'.includes(z??"x"))this.fail("bad escape");this.i+=2;continue}this.i++}return this.i++,JSON.parse(this.s.slice($,this.i))}number(){let $=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(this.s.slice(this.i));if(!$)this.fail("bad number");let Z=this.i;return this.i+=$[0].length,{kind:"number",start:Z,end:this.i,members:[],items:[]}}}var I9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function T9($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>T9(z,Z[Q]));if(I9($)&&I9(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&T9($[Q],Z[Q]))}return!1}class C9{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
263
+ Run 'faf init' to create one.`),process.exit(2);let Q=l(z);X2(Q,z);let X=s(z,()=>w5(Q)),J=Z.output??C9(z);if(_9(J,z))console.error(`faf: ${N4(J)} is the file being compiled — faf does not write the .fafb over its source, and left it unchanged. Name another output with --output.`),process.exit(1);U2(Z.output);let Y=Z.output?yU(N4(J)):yU(N4(z));w2(J,X,{root:Y,owns:T9,mark:A9,force:Z.force}),console.log(`${T("compiled")} ${J} ${M(`(${X.length} bytes)`)}`)}import{readFileSync as hS}from"fs";import{dirname as fS,resolve as lU}from"path";import{createHash as _S}from"crypto";import{resolve as RS}from"path";class f0 extends Error{constructor($){super($);this.name="JsonEditError"}}var IS=new Set([" ","\t",`
264
+ `,"\r"]);class P9{s;i=0;constructor($){this.s=$}parse(){if(this.s.startsWith("\uFEFF"))this.i=1;let $=this.value();if(this.ws(),this.i!==this.s.length)this.fail("text after the end of the JSON value");return $}fail($){throw new f0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&IS.has(this.s[this.i]))this.i++}value(){this.ws();let $=this.s[this.i];if($==="{")return this.object();if($==="[")return this.array();if($==='"'){let Z=this.i;return this.string(),{kind:"string",start:Z,end:this.i,members:[],items:[]}}if($==="-"||$>="0"&&$<="9")return this.number();for(let Z of["true","false","null"])if(this.s.startsWith(Z,this.i)){let z=this.i;return this.i+=Z.length,{kind:"literal",start:z,end:this.i,members:[],items:[]}}return this.fail($===void 0?"unexpected end":`unexpected ${JSON.stringify($)}`)}object(){let $=this.i++,Z=[];if(this.ws(),this.s[this.i]==="}")return this.i++,{kind:"object",start:$,end:this.i,members:Z,items:[]};for(;;){if(this.ws(),this.s[this.i]!=='"')this.fail("expected a key");let z=this.i,Q=this.string(),X=this.i;if(this.ws(),this.s[this.i]!==":")this.fail('expected ":"');if(this.i++,Z.push({key:Q,keyStart:z,keyEnd:X,value:this.value()}),this.ws(),this.s[this.i]===","){this.i++;continue}if(this.s[this.i]==="}")return this.i++,{kind:"object",start:$,end:this.i,members:Z,items:[]};this.fail('expected "," or "}"')}}array(){let $=this.i++,Z=[];if(this.ws(),this.s[this.i]==="]")return this.i++,{kind:"array",start:$,end:this.i,members:[],items:Z};for(;;){if(Z.push(this.value()),this.ws(),this.s[this.i]===","){this.i++;continue}if(this.s[this.i]==="]")return this.i++,{kind:"array",start:$,end:this.i,members:[],items:Z};this.fail('expected "," or "]"')}}string(){let $=this.i++;for(;;){let Z=this.s[this.i];if(Z===void 0)this.fail("unterminated string");if(Z==='"')break;if(Z<" ")this.fail("control character in a string");if(Z==="\\"){let z=this.s[this.i+1];if(z==="u"){if(!/^[0-9a-fA-F]{4}$/.test(this.s.slice(this.i+2,this.i+6)))this.fail("bad \\u escape");this.i+=6;continue}if(!'"\\/bfnrt'.includes(z??"x"))this.fail("bad escape");this.i+=2;continue}this.i++}return this.i++,JSON.parse(this.s.slice($,this.i))}number(){let $=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(this.s.slice(this.i));if(!$)this.fail("bad number");let Z=this.i;return this.i+=$[0].length,{kind:"number",start:Z,end:this.i,members:[],items:[]}}}var R9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function F9($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>F9(z,Z[Q]));if(R9($)&&R9(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&F9($[Q],Z[Q]))}return!1}class S9{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
265
265
  `,$-1);return Z>=0&&/^[ \t]*$/.test(this.s.slice(Z+1,$))}indentOf($){return this.startsLine($)?this.s.slice(this.s.lastIndexOf(`
266
266
  `,$-1)+1,$):""}render($,Z,z){if(!z)return JSON.stringify($);return JSON.stringify($,null,this.style.unit).split(`
267
- `).join(this.style.eol+Z)}apply($,Z,z,Q){let X={};for(let[J,Y]of Object.entries(Z)){if(Y===void 0)continue;let W=z?`${z}.${J}`:J,U=$.members.filter((K)=>K.key===J);if(U.length>1)throw new f0(`the key "${W}" is there more than once`);let G=U[0];if(!G){if($.members.length===0)X[J]=Y;else this.insert($,J,Y,z);continue}let V=this.startsLine(G.keyStart);if(I9(Y)){if(G.value.kind!=="object")throw new f0(`"${W}" is not an object, so faf cannot add its keys to it`);this.apply(G.value,Y,W,V||this.s.slice(G.value.start,G.value.end).includes(`
268
- `));continue}let H=JSON.parse(this.s.slice(G.value.start,G.value.end));if(T9(H,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new f0(`"${W}" is ${G.value.kind==="object"?"an object":"an array"}, so faf will not replace it with a value`);this.edits.push({start:G.value.start,end:G.value.end,text:this.render(Y,this.indentOf(G.keyStart),V)})}if(Object.keys(X).length>0)this.fillEmpty($,X,Q)}fillEmpty($,Z,z){let Q=this.indentOf(this.lineLead($.start)),X=z?this.render(Z,Q,!0):JSON.stringify(Z);this.edits.push({start:$.start,end:$.end,text:X})}insert($,Z,z,Q){let X=$.members,J=X[X.length-1],W=(this.after[Q]?.[Z]??[]).map((H)=>X.find((K)=>K.key===H)).find((H)=>H!==void 0);if(this.startsLine(X[0].keyStart)){let H=W&&W!==J?X[X.indexOf(W)+1]:J,K=this.indentOf(H.keyStart),q=this.s.slice(H.keyEnd,H.value.start),L=this.s.lastIndexOf(`
267
+ `).join(this.style.eol+Z)}apply($,Z,z,Q){let X={};for(let[J,Y]of Object.entries(Z)){if(Y===void 0)continue;let W=z?`${z}.${J}`:J,U=$.members.filter((K)=>K.key===J);if(U.length>1)throw new f0(`the key "${W}" is there more than once`);let G=U[0];if(!G){if($.members.length===0)X[J]=Y;else this.insert($,J,Y,z);continue}let V=this.startsLine(G.keyStart);if(R9(Y)){if(G.value.kind!=="object")throw new f0(`"${W}" is not an object, so faf cannot add its keys to it`);this.apply(G.value,Y,W,V||this.s.slice(G.value.start,G.value.end).includes(`
268
+ `));continue}let H=JSON.parse(this.s.slice(G.value.start,G.value.end));if(F9(H,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new f0(`"${W}" is ${G.value.kind==="object"?"an object":"an array"}, so faf will not replace it with a value`);this.edits.push({start:G.value.start,end:G.value.end,text:this.render(Y,this.indentOf(G.keyStart),V)})}if(Object.keys(X).length>0)this.fillEmpty($,X,Q)}fillEmpty($,Z,z){let Q=this.indentOf(this.lineLead($.start)),X=z?this.render(Z,Q,!0):JSON.stringify(Z);this.edits.push({start:$.start,end:$.end,text:X})}insert($,Z,z,Q){let X=$.members,J=X[X.length-1],W=(this.after[Q]?.[Z]??[]).map((H)=>X.find((K)=>K.key===H)).find((H)=>H!==void 0);if(this.startsLine(X[0].keyStart)){let H=W&&W!==J?X[X.indexOf(W)+1]:J,K=this.indentOf(H.keyStart),q=this.s.slice(H.keyEnd,H.value.start),L=this.s.lastIndexOf(`
269
269
  `,H.keyStart-1),B=L>0&&this.s[L-1]==="\r"?L-1:L,N=`${this.style.eol}${K}${JSON.stringify(Z)}${q}${this.render(z,K,!0)},`;this.edits.push({start:B,end:B,text:N});return}let U=W??J,G=this.s.slice(U.keyEnd,U.value.start),V=X.length>1?this.s.slice(X[0].value.end,X[1].keyStart):", ";this.edits.push({start:U.value.end,end:U.value.end,text:`${V}${JSON.stringify(Z)}${G}${this.render(z,"",!1)}`})}append($,Z,z,Q){if(Z.length===0)return;if($.items.length===0){this.edits.push({start:$.start,end:$.end,text:this.render(Z,this.indentOf(z),Q)});return}let X=$.items[$.items.length-1];if(this.startsLine($.items[0].start)){let Y=this.indentOf($.items[0].start),W=Z.map((U)=>`,${this.style.eol}${Y}${this.render(U,Y,!0)}`).join("");this.edits.push({start:X.end,end:X.end,text:W});return}let J=$.items.length>1?this.s.slice($.items[0].end,$.items[1].start):", ";this.edits.push({start:X.end,end:X.end,text:Z.map((Y)=>`${J}${this.render(Y,"",!1)}`).join("")})}lineLead($){let Z=this.s.lastIndexOf(`
270
- `,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function PU($,Z){let z=$.includes(`\r
270
+ `,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function bU($,Z){let z=$.includes(`\r
271
271
  `)?`\r
272
272
  `:`
273
273
  `,Q=Z.members[0],X=Q?$.lastIndexOf(`
274
- `,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function f$($,Z,z={}){let Q=new A9($).parse();if(Q.kind!=="object")throw new f0("the JSON is not an object");let X=new C9($,PU($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
275
- `)),$Z($,X.edits)}function $Z($,Z){if(Z.length===0)return{text:$,changed:!1};let z=Z.map((X,J)=>({e:X,i:J})).sort((X,J)=>J.e.start-X.e.start||J.i-X.i),Q=$;for(let{e:X}of z)Q=Q.slice(0,X.start)+X.text+Q.slice(X.end);return{text:Q,changed:Q!==$}}function FU($){let Z=new A9($).parse();if(Z.kind!=="object")throw new f0("the JSON is not an object");return Z}function WS($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new f0(`the key "${Q}.${z}" is there more than once`);let J=X[0]?.value;return J?.kind==="string"?JSON.parse($.slice(J.start,J.end)):void 0}function SU($,Z,z,Q){let X=FU($),J=new C9($,PU($,X),{}),Y=$.slice(X.start,X.end).includes(`
276
- `),W=X.members.filter((H)=>H.key===Z);if(W.length>1)throw new f0(`the key "${Z}" is there more than once`);if(W.length===0)return J.apply(X,{[Z]:z},"",Y),$Z($,J.edits);let U=W[0],G=U.value;if(G.kind!=="array")throw new f0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let H of z){let K=H[Q.id],q=G.items.filter((N,I)=>N.kind==="object"&&WS($,N,Q.id,`${Z}[${I}]`)===K);if(q.length>1)throw new f0(`the ${Z} row ${JSON.stringify(K)} is there more than once`);if(q.length===0){V.push(H);continue}let L=q[0],B=Object.fromEntries(Q.update.map((N)=>[N,H[N]]));J.apply(L,B,`${Z}[${G.items.indexOf(L)}]`,$.slice(L.start,L.end).includes(`
277
- `))}return J.append(G,V,U.keyStart,Y),$Z($,J.edits)}function US($,Z){let z=$.lastIndexOf(`
278
- `,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function GS($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(US($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
279
- `,z.keyStart-1);return{start:X>0&&$[X-1]==="\r"?X-1:X,end:z.value.end+1,text:""}}if(Q>0)return{start:Z.members[Q-1].value.end,end:z.value.end,text:""};return{start:z.keyStart,end:Z.members[1].keyStart,text:""}}function EU($,Z){let z=[],Q=FU($);for(let X of Z){if(Q.kind!=="object")return{count:0,chain:z};let J=Q.members.filter((Y)=>Y.key===X);if(J.length!==1)return{count:J.length,chain:z};z.push({obj:Q,member:J[0]}),Q=J[0].value}return{count:1,chain:z}}function jU($,Z){let{count:z,chain:Q}=EU($,Z);if(z!==1)return{count:z};let X=Q[Q.length-1].member.value;return{count:z,value:JSON.parse($.slice(X.start,X.end))}}function _9($,Z,z={}){let{count:Q,chain:X}=EU($,Z);if(Q!==1||X.length===0)return null;let J=X[X.length-1];if(z.dropEmptyParent&&X.length>1&&J.obj.members.length===1)J=X[X.length-2];return $Z($,[GS($,J.obj,J.member)]).text}var xU="one.faf/render";function P9($){return`sha256:${VS("sha256").update($,"utf8").digest("hex")}`}var KS=/^sha256:[0-9a-f]{64}$/,qS=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,BS='<meta name="faf-render"',MS='<meta name="description" content="Visual render of project.faf.';function LS($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(MS));return Z.splice(z+1,0,`<meta name="faf-render" content="${P9($)}">
280
- `),Z.join("")}function yU($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),W=qS.exec(Y);if(W)z.push({at:J,hash:W[1]});else if(Y.startsWith(BS))Q=!0}),z.length===0&&!Q)return null;if(z.length!==1||Q)return"many";return Z.splice(z[0].at,1),{hash:z[0].hash,canonical:Z.join("")}}var R9=["_meta",xU];function NS($){return f$($,{_meta:{[xU]:P9($)}}).text}function DS($){try{return _9($,R9,{dropEmptyParent:!0})??$}catch{return $}}function OS($){let Z;try{Z=jU($,R9)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!KS.test(Z.value))return"many";let z=_9($,R9,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function kU($,Z){return $==="html"?LS(Z):NS(Z)}function IS($,Z){if($==="json")return DS(Z);let z=yU(Z);return z===null||z==="many"?Z:z.canonical}function wU($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?yU(z):OS(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===P9(Q.canonical)&&kU(Z,Q.canonical)===z?"match":"mismatch"}function TS($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
274
+ `,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function p$($,Z,z={}){let Q=new P9($).parse();if(Q.kind!=="object")throw new f0("the JSON is not an object");let X=new S9($,bU($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
275
+ `)),zZ($,X.edits)}function zZ($,Z){if(Z.length===0)return{text:$,changed:!1};let z=Z.map((X,J)=>({e:X,i:J})).sort((X,J)=>J.e.start-X.e.start||J.i-X.i),Q=$;for(let{e:X}of z)Q=Q.slice(0,X.start)+X.text+Q.slice(X.end);return{text:Q,changed:Q!==$}}function vU($){let Z=new P9($).parse();if(Z.kind!=="object")throw new f0("the JSON is not an object");return Z}function TS($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new f0(`the key "${Q}.${z}" is there more than once`);let J=X[0]?.value;return J?.kind==="string"?JSON.parse($.slice(J.start,J.end)):void 0}function gU($,Z,z,Q){let X=vU($),J=new S9($,bU($,X),{}),Y=$.slice(X.start,X.end).includes(`
276
+ `),W=X.members.filter((H)=>H.key===Z);if(W.length>1)throw new f0(`the key "${Z}" is there more than once`);if(W.length===0)return J.apply(X,{[Z]:z},"",Y),zZ($,J.edits);let U=W[0],G=U.value;if(G.kind!=="array")throw new f0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let H of z){let K=H[Q.id],q=G.items.filter((N,I)=>N.kind==="object"&&TS($,N,Q.id,`${Z}[${I}]`)===K);if(q.length>1)throw new f0(`the ${Z} row ${JSON.stringify(K)} is there more than once`);if(q.length===0){V.push(H);continue}let L=q[0],B=Object.fromEntries(Q.update.map((N)=>[N,H[N]]));J.apply(L,B,`${Z}[${G.items.indexOf(L)}]`,$.slice(L.start,L.end).includes(`
277
+ `))}return J.append(G,V,U.keyStart,Y),zZ($,J.edits)}function AS($,Z){let z=$.lastIndexOf(`
278
+ `,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function CS($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(AS($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
279
+ `,z.keyStart-1);return{start:X>0&&$[X-1]==="\r"?X-1:X,end:z.value.end+1,text:""}}if(Q>0)return{start:Z.members[Q-1].value.end,end:z.value.end,text:""};return{start:z.keyStart,end:Z.members[1].keyStart,text:""}}function hU($,Z){let z=[],Q=vU($);for(let X of Z){if(Q.kind!=="object")return{count:0,chain:z};let J=Q.members.filter((Y)=>Y.key===X);if(J.length!==1)return{count:J.length,chain:z};z.push({obj:Q,member:J[0]}),Q=J[0].value}return{count:1,chain:z}}function fU($,Z){let{count:z,chain:Q}=hU($,Z);if(z!==1)return{count:z};let X=Q[Q.length-1].member.value;return{count:z,value:JSON.parse($.slice(X.start,X.end))}}function E9($,Z,z={}){let{count:Q,chain:X}=hU($,Z);if(Q!==1||X.length===0)return null;let J=X[X.length-1];if(z.dropEmptyParent&&X.length>1&&J.obj.members.length===1)J=X[X.length-2];return zZ($,[CS($,J.obj,J.member)]).text}var mU="one.faf/render";function w9($){return`sha256:${_S("sha256").update($,"utf8").digest("hex")}`}var FS=/^sha256:[0-9a-f]{64}$/,PS=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,SS='<meta name="faf-render"',ES='<meta name="description" content="Visual render of project.faf.';function jS($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(ES));return Z.splice(z+1,0,`<meta name="faf-render" content="${w9($)}">
280
+ `),Z.join("")}function cU($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),W=PS.exec(Y);if(W)z.push({at:J,hash:W[1]});else if(Y.startsWith(SS))Q=!0}),z.length===0&&!Q)return null;if(z.length!==1||Q)return"many";return Z.splice(z[0].at,1),{hash:z[0].hash,canonical:Z.join("")}}var j9=["_meta",mU];function wS($){return p$($,{_meta:{[mU]:w9($)}}).text}function xS($){try{return E9($,j9,{dropEmptyParent:!0})??$}catch{return $}}function yS($){let Z;try{Z=fU($,j9)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!FS.test(Z.value))return"many";let z=E9($,j9,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function pU($,Z){return $==="html"?jS(Z):wS(Z)}function kS($,Z){if($==="json")return xS(Z);let z=cU(Z);return z===null||z==="many"?Z:z.canonical}function uU($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?cU(z):yS(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===w9(Q.canonical)&&pU(Z,Q.canonical)===z?"match":"mismatch"}function bS($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
281
281
  `)||/(?:^|[^\r])\n/.test(Z)||!Buffer.from(Z,"utf-8").equals($))return null;return Buffer.from(Z.replace(/\r\n/g,`
282
- `),"utf-8")}function AS($,Z,z){let Q=wU($,z);return Q!=="match"&&Z!==null&&wU(Z,z)==="match"?"match":Q}function V2($,Z,z){let Q=HS($),X=l(z.root,Q),J=IS(z.format,Z),Y=kU(z.format,J),W=k0(X);if(W===null)return a(X,Y,{root:z.root,expect:null}),{path:X,result:"created"};if(W.equals(Buffer.from(Y,"utf-8")))return{path:X,result:"unchanged"};let U=TS(W),G=U===null?Y:Y.replace(/\r?\n/g,`\r
283
- `);if(U!==null&&W.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!CS(Q,W,U,J,z))return{path:X,result:"unchanged"};return a(X,G,{root:z.root,expect:W}),{path:X,result:"updated"}}function CS($,Z,z,Q,X){let J=AS(Z,z,X.format);if(J==="match")return!0;if(J==="mismatch")throw new b("not-owned",$,`${$} was edited since faf wrote it — faf left it unchanged. Use --force to replace it.`,{onWrite:!0});if(!X.hasMark(Z))throw new b("not-owned",$,`${$} has no ${X.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});let Y=Buffer.from(Q,"utf-8");if(Z.equals(Y)||z!==null&&z.equals(Y))return!1;throw new b("not-owned",$,`${$} has no faf render hash (written before 7.13), so faf cannot tell whether it was edited — faf left it unchanged. Use --force once to replace it; after that faf recognises its own output.`,{onWrite:!0})}i();function vU($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array(_S($));if(String.fromCharCode(z[0],z[1],z[2],z[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let Q=n($,()=>aY(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(O9(Z.output,$))console.error(`faf: ${bU(Z.output)} is the file being decompiled — faf does not write the JSON over it, and left it unchanged. Name another output with --output.`),process.exit(1);W2(Z.output);let{result:J}=V2(Z.output,`${X}
284
- `,{root:RS(bU(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${T("decompiled")} ${Z.output}${J==="unchanged"?` ${M("(unchanged)")}`:""}`)}function gU($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let z=$;if(!z.faf_version)Z.push("Missing required field: faf_version");if(!z.project?.name)Z.push("Missing required field: project.name");if(z.app_type==="about")Z.push("about is not an app_type — declare about.represents (owner/repo) instead");if(z.about!==void 0){if(!$W(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!eY.test(z.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${z.about.represents})`);if(z.about.source_score!==void 0){let Q=z.about.source_score;if(typeof Q!=="number"||Q<0||Q>100)Z.push(`about.source_score must be a number 0-100 (got: ${Q})`)}}return{valid:Z.length===0,errors:Z}}i();function F9($,Z={}){let z=$??f();if(!z)console.error(`Error: project.faf not found
282
+ `),"utf-8")}function vS($,Z,z){let Q=uU($,z);return Q!=="match"&&Z!==null&&uU(Z,z)==="match"?"match":Q}function H2($,Z,z){let Q=RS($),X=d(z.root,Q),J=kS(z.format,Z),Y=pU(z.format,J),W=k0(X);if(W===null)return a(X,Y,{root:z.root,expect:null}),{path:X,result:"created"};if(W.equals(Buffer.from(Y,"utf-8")))return{path:X,result:"unchanged"};let U=bS(W),G=U===null?Y:Y.replace(/\r?\n/g,`\r
283
+ `);if(U!==null&&W.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!gS(Q,W,U,J,z))return{path:X,result:"unchanged"};return a(X,G,{root:z.root,expect:W}),{path:X,result:"updated"}}function gS($,Z,z,Q,X){let J=vS(Z,z,X.format);if(J==="match")return!0;if(J==="mismatch")throw new v("not-owned",$,`${$} was edited since faf wrote it — faf left it unchanged. Use --force to replace it.`,{onWrite:!0});if(!X.hasMark(Z))throw new v("not-owned",$,`${$} has no ${X.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});let Y=Buffer.from(Q,"utf-8");if(Z.equals(Y)||z!==null&&z.equals(Y))return!1;throw new v("not-owned",$,`${$} has no faf render hash (written before 7.13), so faf cannot tell whether it was edited — faf left it unchanged. Use --force once to replace it; after that faf recognises its own output.`,{onWrite:!0})}n();function dU($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array(hS($));if(String.fromCharCode(z[0],z[1],z[2],z[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let Q=s($,()=>YW(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(_9(Z.output,$))console.error(`faf: ${lU(Z.output)} is the file being decompiled — faf does not write the JSON over it, and left it unchanged. Name another output with --output.`),process.exit(1);U2(Z.output);let{result:J}=H2(Z.output,`${X}
284
+ `,{root:fS(lU(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${T("decompiled")} ${Z.output}${J==="unchanged"?` ${M("(unchanged)")}`:""}`)}function iU($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let z=$;if(!z.faf_version)Z.push("Missing required field: faf_version");if(!z.project?.name)Z.push("Missing required field: project.name");if(z.app_type==="about")Z.push("about is not an app_type — declare about.represents (owner/repo) instead");if(z.about!==void 0){if(!GW(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!UW.test(z.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${z.about.represents})`);if(z.about.source_score!==void 0){let Q=z.about.source_score;if(typeof Q!=="number"||Q<0||Q>100)Z.push(`about.source_score must be a number 0-100 (got: ${Q})`)}}return{valid:Z.length===0,errors:Z}}n();function x9($,Z={}){let z=$??u();if(!z)console.error(`Error: project.faf not found
285
285
 
286
- Run 'faf init' to create one.`),process.exit(2);let Q=X2(p(z),z),X=gU(Q);if(!X.valid){console.log(`${C("invalid")} ${z}`);for(let W of X.errors)console.log(` ${M("x")} ${W}`);process.exit(3)}let J=p(z);if(!oY(J))console.log(`${C("invalid yaml")} ${z}`),process.exit(3);console.log(`${T("valid")} ${z}`);let Y=n(z,()=>D0(J));if(S0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
287
- --strict requires 100%`)),process.exit(1)}import{join as OE,resolve as IE}from"path";import{join as PS}from"path";var s0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),hU=($)=>Array.isArray($)?$.join(", "):String($),FS=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),SS=new Set(["target_user","core_problem","mission_purpose"]);function ES($){let Z=[],z=(k="")=>Z.push(k),Q=$.ai_instructions,X=$.preferences,J=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??J?.key_files,G=s0($.project?.default_branch)?String($.project?.default_branch):"main",V=W?Object.entries(W).filter(([,k])=>s0(k)):[],H=V.filter(([k])=>/test/i.test(k)),K=V.filter(([k])=>/lint|check/i.test(k)&&!/test/i.test(k)),q=V.filter(([k])=>!/test|lint|check/i.test(k)),L=(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},B=[...q].sort((k,h)=>L(k[0])-L(h[0])||k[0].localeCompare(h[0])),N=[...H,...K],I=B.find(([k])=>/build/i.test(k)),_=H[0]?D6(H[0][1]):void 0,y=I?D6(I[1]):void 0;z(l2($)),z(),z(`# AGENTS.md — ${$.project?.name??"Project"}`),z();let E=[];if($.project?.main_language)E.push(String($.project.main_language));if(s0($.project?.type))E.push(`type: ${String($.project?.type)}`);if(s0($.project?.version))E.push(`v${String($.project?.version)}`);let w=$.project?.goal?String($.project.goal).trim():"";if(E.length)w+=(w?" — ":"")+E.join(" · ");if(w)z(w),z();if(z("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand-written content outside the managed block is preserved."),z(),B.length){z("## Setup & build"),z(),z("```bash");for(let[k,h]of B){let{cmd:L0,note:q2}=t6(h);z(`${L0} # ${q2??k}`)}z("```"),z()}if(N.length){z("## Run the tests"),z(),z("```bash");for(let[,k]of N){let{cmd:h,note:L0}=t6(k);z(L0?`${h} # ${L0}`:h)}z("```"),z()}if(U&&U.length){z("## Where things live"),z();let k=U.map((h)=>{let L0=String(h),q2=L0.indexOf(" — ");return q2>0?{path:L0.slice(0,q2),role:L0.slice(q2+3)}:{path:L0,role:""}});if(k.some((h)=>h.role)){z("| Path | Role |"),z("|------|------|");for(let h of k)z(`| \`${h.path}\` | ${h.role} |`)}else for(let h of k)z(`- \`${h.path}\``);z()}let j=new Map,u=(k)=>{if(!k)return;for(let[h,L0]of Object.entries(k)){if(FS.has(h)||!s0(L0))continue;let q2=H9(h);if(!j.has(q2))j.set(q2,hU(L0))}};u(Q?.working_style),u(X);let S=$.conventions??[];if(j.size||S.length){z("## Conventions"),z();for(let[k,h]of j)z(`- **${k}:** ${h}`);for(let k of S)if(s0(k))z(`- ${k}`);z()}let d=(Q?.warnings??[]).filter((k)=>s0(k)),T0=["read the tree"];if(_)T0.push(`run the tests (\`${_}\`)`);if(y)T0.push("build the project");for(let[,k]of K.slice(0,1))T0.push(`\`${D6(k)}\``);z("## Guardrails"),z();for(let k of d)z(`- ${k}`);z(`- **Always OK:** ${[...new Set(T0)].join(" · ")}.`),z("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),z(`- **Never:** force-push · push straight to \`${G}\` (branch and open a PR) · commit secrets.`),z();let j0=[];for(let[,k]of K)j0.push(`\`${D6(k)}\` exits 0`);for(let[,k]of H)j0.push(`\`${D6(k)}\` passes`);if(j0.push("changes committed with a conventional message"),z("## Definition of Done"),z(),z(`Done when: ${[...new Set(j0)].join(" · ")}.`),z(),z("## When stuck"),z(),z(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${G}\`.`),z(),Y&&(s0(Y.secrets)||(Y.never??[]).length)){if(z("## Security & secrets"),z(),s0(Y.secrets)){let k=s0(Y.example)?` (see \`${Y.example}\`)`:"";z(`- Secrets live in \`${Y.secrets}\`${k}. Never read or commit them.`)}for(let k of Y.never??[])if(s0(k))z(`- Never read or commit \`${k}\`.`);z()}if(z("## Commit & PR"),z(),X&&s0(X.commit_style))z(`- Commit style: ${hU(X.commit_style)}`);else z("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(z(`- Branch off \`${G}\` and open a PR — never commit to \`${G}\` directly.`),z("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),z(),$.stack){let k=[];for(let[h,L0]of Object.entries($.stack)){if(SS.has(h))continue;if(V0(L0))k.push(`- **${h0(`stack.${h}`)}:** ${L0.trim()}`)}if(k.length){z("## Stack"),z();for(let h of k)z(h);z()}}let Z0=$.generated;if(s0(Z0))z(`*Context authored: ${String(Z0)}*`);return Z.join(`
288
- `)}function fU($,Z){G2(PS($,y0.agents),ES(Z))}function jS($,Z){let z=[],Q=(U)=>A($,U),X=(U)=>m($,U)??"";if(Q("tsconfig.json")&&/"strict"\s*:\s*true/.test(X("tsconfig.json")))z.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")z.push("ESM modules (`type: module`)");let J=[],Y=Z?.devDependencies??{};if(Q(".eslintrc")||Q(".eslintrc.json")||Q(".eslintrc.cjs")||Q("eslint.config.js")||Q("eslint.config.mjs")||"eslint"in Y)J.push("ESLint");if(Q(".prettierrc")||Q(".prettierrc.json")||Q("prettier.config.js")||"prettier"in Y)J.push("Prettier");let W=Q("pyproject.toml")?X("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))J.push("black");if(/\[tool\.ruff\]/.test(W))J.push("ruff");if(/\[tool\.mypy\]/.test(W))J.push("mypy");if(Q("rustfmt.toml")||Q(".rustfmt.toml"))J.push("rustfmt");if(J.length)z.push(`Style enforced by ${J.join(" · ")} — obey the configs`);return z}function S9($,Z){let z={...Z},Q=null,X=m($,"package.json");if(X!==null)try{Q=JSON.parse(X)}catch{Q=null}let J=p5($,Q);if(Object.keys(J).length)z.commands={...J,...Z.commands??{}};let Y=Z.key_files??Z.instant_context?.key_files;if(!Y||Y.length===0){let W=c5($);if(W.length)z.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>A($,G));if(U){let G=[".env.example",".env.sample",".env.template"].find((V)=>A($,V));z.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=jS($,Q);if(W.length)z.conventions=W}return z}import{join as wS}from"path";function xS($){let Z=[];if(Z.push(l2($)),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[z,Q]of Object.entries($.stack))if(V0(Q))Z.push(`# ${h0(`stack.${z}`)}: ${Q.trim()}`)}return Z.push(""),Z.join(`
289
- `)}function uU($,Z){G2(wS($,y0.cursorrules),xS(Z),"# faf:start","# faf:end")}import{join as yS}from"path";var kS=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),bS=new Set(["target_user","core_problem","mission_purpose"]);function vS($){let Z=[],z=$.instant_context,Q=$.commands,X=$.key_files??z?.key_files,J=Q?Object.entries(Q).filter(([,K])=>kS(K)):[],Y=J.filter(([K])=>/test/i.test(K)),W=J.filter(([K])=>/lint|check/i.test(K)&&!/test/i.test(K)),U=J.filter(([K])=>!/test|lint|check/i.test(K)),G=(K)=>{let q=K.toLowerCase();if(/install|deps/.test(q))return 0;if(/^build$|build/.test(q)&&!/rebuild/.test(q))return 1;if(/^dev$|develop/.test(q))return 2;if(/^start$|run/.test(q))return 3;return 4},V=[...U].sort((K,q)=>G(K[0])-G(q[0])||K[0].localeCompare(q[0])),H=[...Y,...W];if(Z.push(l2($)),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(V.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[K,q]of V){let{cmd:L,note:B}=t6(q);Z.push(`${L} # ${B??K}`)}Z.push("```")}if(H.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,K]of H){let{cmd:q,note:L}=t6(K);Z.push(L?`${q} # ${L}`:q)}Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let K of X)Z.push(`- \`${K}\``)}if($.stack){let K=[];for(let[q,L]of Object.entries($.stack)){if(bS.has(q))continue;if(V0(L))K.push(`- ${h0(`stack.${q}`)}: ${L.trim()}`)}if(K.length){Z.push(""),Z.push("## Stack");for(let q of K)Z.push(q)}}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(`
290
- `)}function mU($,Z){G2(yS($,y0.gemini),vS(Z))}import{join as gS}from"path";var cU=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],hS=new Set([...cU.map(([$])=>$),"cicd"]);function fS($){let Z=[],z=$.project?.name??"Project";if(Z.push(l2($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${z}`),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(""),V0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let Q=$.stack??{},X=[];if(V0($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,V]of Object.entries(Q)){if(hS.has(G))continue;if(V0(V))X.push(`- **${h0(`stack.${G}`)}:** ${V.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let J=[];for(let[G,V]of cU){let H=Q[G];if(V0(H))J.push(`- ${V} \`${H.trim()}\`.`)}if(V0(Q.cicd))J.push(`- CI runs on ${Q.cicd.trim()}.`);if(J.length>0)Z.push("## Build & run","",...J,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,G])=>V0(G)).map(([G,V])=>`- **${h0(`human_context.${G}`)}:** ${V.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
291
- `)}function pU($,Z){w0($,".github"),G2(gS($,".github",y0.copilot),fS(Z),c2,p2,{root:$})}import{existsSync as uS}from"fs";import{join as mS}from"path";var cS="https://mcpaas.live/grok/mcp/v1",lU="mcp_servers.grok-faf-mcp";function pS($){return[`[${lU}]`,`url = "${cS}"`,""].join(`
292
- `)}function dU($,Z){let z=pS(Z);w0($,".grok");let Q=l($,mS(".grok","config.toml"));if(!uS(Q))return a(Q,`# grok-faf-mcp — wired by FAF from project.faf
286
+ Run 'faf init' to create one.`),process.exit(2);let Q=X2(l(z),z),X=iU(Q);if(!X.valid){console.log(`${C("invalid")} ${z}`);for(let W of X.errors)console.log(` ${M("x")} ${W}`);process.exit(3)}let J=l(z);if(!JW(J))console.log(`${C("invalid yaml")} ${z}`),process.exit(3);console.log(`${T("valid")} ${z}`);let Y=s(z,()=>O0(J));if(S0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
287
+ --strict requires 100%`)),process.exit(1)}import{join as mE,resolve as cE}from"path";import{join as uS}from"path";var s0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),nU=($)=>Array.isArray($)?$.join(", "):String($),mS=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),cS=new Set(["target_user","core_problem","mission_purpose"]);function pS($){let Z=[],z=(b="")=>Z.push(b),Q=$.ai_instructions,X=$.preferences,J=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??J?.key_files,G=s0($.project?.default_branch)?String($.project?.default_branch):"main",V=W?Object.entries(W).filter(([,b])=>s0(b)):[],H=V.filter(([b])=>/test/i.test(b)),K=V.filter(([b])=>/lint|check/i.test(b)&&!/test/i.test(b)),q=V.filter(([b])=>!/test|lint|check/i.test(b)),L=(b)=>{let f=b.toLowerCase();if(/install|deps/.test(f))return 0;if(/^build$|build/.test(f)&&!/rebuild/.test(f))return 1;if(/^dev$|develop/.test(f))return 2;if(/^start$|run/.test(f))return 3;return 4},B=[...q].sort((b,f)=>L(b[0])-L(f[0])||b[0].localeCompare(f[0])),N=[...H,...K],I=B.find(([b])=>/build/i.test(b)),_=H[0]?I6(H[0][1]):void 0,w=I?I6(I[1]):void 0;z(d2($)),z(),z(`# AGENTS.md — ${$.project?.name??"Project"}`),z();let E=[];if($.project?.main_language)E.push(String($.project.main_language));if(s0($.project?.type))E.push(`type: ${String($.project?.type)}`);if(s0($.project?.version))E.push(`v${String($.project?.version)}`);let x=$.project?.goal?String($.project.goal).trim():"";if(E.length)x+=(x?" — ":"")+E.join(" · ");if(x)z(x),z();if(z("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand-written content outside the managed block is preserved."),z(),B.length){z("## Setup & build"),z(),z("```bash");for(let[b,f]of B){let{cmd:L0,note:B2}=$$(f);z(`${L0} # ${B2??b}`)}z("```"),z()}if(N.length){z("## Run the tests"),z(),z("```bash");for(let[,b]of N){let{cmd:f,note:L0}=$$(b);z(L0?`${f} # ${L0}`:f)}z("```"),z()}if(U&&U.length){z("## Where things live"),z();let b=U.map((f)=>{let L0=String(f),B2=L0.indexOf(" — ");return B2>0?{path:L0.slice(0,B2),role:L0.slice(B2+3)}:{path:L0,role:""}});if(b.some((f)=>f.role)){z("| Path | Role |"),z("|------|------|");for(let f of b)z(`| \`${f.path}\` | ${f.role} |`)}else for(let f of b)z(`- \`${f.path}\``);z()}let j=new Map,m=(b)=>{if(!b)return;for(let[f,L0]of Object.entries(b)){if(mS.has(f)||!s0(L0))continue;let B2=L9(f);if(!j.has(B2))j.set(B2,nU(L0))}};m(Q?.working_style),m(X);let S=$.conventions??[];if(j.size||S.length){z("## Conventions"),z();for(let[b,f]of j)z(`- **${b}:** ${f}`);for(let b of S)if(s0(b))z(`- ${b}`);z()}let i=(Q?.warnings??[]).filter((b)=>s0(b)),T0=["read the tree"];if(_)T0.push(`run the tests (\`${_}\`)`);if(w)T0.push("build the project");for(let[,b]of K.slice(0,1))T0.push(`\`${I6(b)}\``);z("## Guardrails"),z();for(let b of i)z(`- ${b}`);z(`- **Always OK:** ${[...new Set(T0)].join(" · ")}.`),z("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),z(`- **Never:** force-push · push straight to \`${G}\` (branch and open a PR) · commit secrets.`),z();let j0=[];for(let[,b]of K)j0.push(`\`${I6(b)}\` exits 0`);for(let[,b]of H)j0.push(`\`${I6(b)}\` passes`);if(j0.push("changes committed with a conventional message"),z("## Definition of Done"),z(),z(`Done when: ${[...new Set(j0)].join(" · ")}.`),z(),z("## When stuck"),z(),z(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${G}\`.`),z(),Y&&(s0(Y.secrets)||(Y.never??[]).length)){if(z("## Security & secrets"),z(),s0(Y.secrets)){let b=s0(Y.example)?` (see \`${Y.example}\`)`:"";z(`- Secrets live in \`${Y.secrets}\`${b}. Never read or commit them.`)}for(let b of Y.never??[])if(s0(b))z(`- Never read or commit \`${b}\`.`);z()}if(z("## Commit & PR"),z(),X&&s0(X.commit_style))z(`- Commit style: ${nU(X.commit_style)}`);else z("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(z(`- Branch off \`${G}\` and open a PR — never commit to \`${G}\` directly.`),z("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),z(),$.stack){let b=[];for(let[f,L0]of Object.entries($.stack)){if(cS.has(f))continue;if(V0(L0))b.push(`- **${h0(`stack.${f}`)}:** ${L0.trim()}`)}if(b.length){z("## Stack"),z();for(let f of b)z(f);z()}}let Z0=$.generated;if(s0(Z0))z(`*Context authored: ${String(Z0)}*`);return Z.join(`
288
+ `)}function rU($,Z){V2(uS($,y0.agents),pS(Z))}function lS($,Z){let z=[],Q=(U)=>A($,U),X=(U)=>c($,U)??"";if(Q("tsconfig.json")&&/"strict"\s*:\s*true/.test(X("tsconfig.json")))z.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")z.push("ESM modules (`type: module`)");let J=[],Y=Z?.devDependencies??{};if(Q(".eslintrc")||Q(".eslintrc.json")||Q(".eslintrc.cjs")||Q("eslint.config.js")||Q("eslint.config.mjs")||"eslint"in Y)J.push("ESLint");if(Q(".prettierrc")||Q(".prettierrc.json")||Q("prettier.config.js")||"prettier"in Y)J.push("Prettier");let W=Q("pyproject.toml")?X("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))J.push("black");if(/\[tool\.ruff\]/.test(W))J.push("ruff");if(/\[tool\.mypy\]/.test(W))J.push("mypy");if(Q("rustfmt.toml")||Q(".rustfmt.toml"))J.push("rustfmt");if(J.length)z.push(`Style enforced by ${J.join(" · ")} — obey the configs`);return z}function y9($,Z){let z={...Z},Q=null,X=c($,"package.json");if(X!==null)try{Q=JSON.parse(X)}catch{Q=null}let J=d5($,Q);if(Object.keys(J).length)z.commands={...J,...Z.commands??{}};let Y=Z.key_files??Z.instant_context?.key_files;if(!Y||Y.length===0){let W=l5($);if(W.length)z.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>A($,G));if(U){let G=[".env.example",".env.sample",".env.template"].find((V)=>A($,V));z.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=lS($,Q);if(W.length)z.conventions=W}return z}import{join as dS}from"path";function iS($){let Z=[];if(Z.push(d2($)),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[z,Q]of Object.entries($.stack))if(V0(Q))Z.push(`# ${h0(`stack.${z}`)}: ${Q.trim()}`)}return Z.push(""),Z.join(`
289
+ `)}function sU($,Z){V2(dS($,y0.cursorrules),iS(Z),"# faf:start","# faf:end")}import{join as nS}from"path";var rS=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),sS=new Set(["target_user","core_problem","mission_purpose"]);function oS($){let Z=[],z=$.instant_context,Q=$.commands,X=$.key_files??z?.key_files,J=Q?Object.entries(Q).filter(([,K])=>rS(K)):[],Y=J.filter(([K])=>/test/i.test(K)),W=J.filter(([K])=>/lint|check/i.test(K)&&!/test/i.test(K)),U=J.filter(([K])=>!/test|lint|check/i.test(K)),G=(K)=>{let q=K.toLowerCase();if(/install|deps/.test(q))return 0;if(/^build$|build/.test(q)&&!/rebuild/.test(q))return 1;if(/^dev$|develop/.test(q))return 2;if(/^start$|run/.test(q))return 3;return 4},V=[...U].sort((K,q)=>G(K[0])-G(q[0])||K[0].localeCompare(q[0])),H=[...Y,...W];if(Z.push(d2($)),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(V.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[K,q]of V){let{cmd:L,note:B}=$$(q);Z.push(`${L} # ${B??K}`)}Z.push("```")}if(H.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,K]of H){let{cmd:q,note:L}=$$(K);Z.push(L?`${q} # ${L}`:q)}Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let K of X)Z.push(`- \`${K}\``)}if($.stack){let K=[];for(let[q,L]of Object.entries($.stack)){if(sS.has(q))continue;if(V0(L))K.push(`- ${h0(`stack.${q}`)}: ${L.trim()}`)}if(K.length){Z.push(""),Z.push("## Stack");for(let q of K)Z.push(q)}}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(`
290
+ `)}function oU($,Z){V2(nS($,y0.gemini),oS(Z))}import{join as aS}from"path";var aU=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],tS=new Set([...aU.map(([$])=>$),"cicd"]);function eS($){let Z=[],z=$.project?.name??"Project";if(Z.push(d2($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${z}`),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(""),V0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let Q=$.stack??{},X=[];if(V0($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,V]of Object.entries(Q)){if(tS.has(G))continue;if(V0(V))X.push(`- **${h0(`stack.${G}`)}:** ${V.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let J=[];for(let[G,V]of aU){let H=Q[G];if(V0(H))J.push(`- ${V} \`${H.trim()}\`.`)}if(V0(Q.cicd))J.push(`- CI runs on ${Q.cicd.trim()}.`);if(J.length>0)Z.push("## Build & run","",...J,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,G])=>V0(G)).map(([G,V])=>`- **${h0(`human_context.${G}`)}:** ${V.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
291
+ `)}function tU($,Z){w0($,".github"),V2(aS($,".github",y0.copilot),eS(Z),p2,l2,{root:$})}import{existsSync as $E}from"fs";import{join as ZE}from"path";var zE="https://mcpaas.live/grok/mcp/v1",eU="mcp_servers.grok-faf-mcp";function QE($){return[`[${eU}]`,`url = "${zE}"`,""].join(`
292
+ `)}function $G($,Z){let z=QE(Z);w0($,".grok");let Q=d($,ZE(".grok","config.toml"));if(!$E(Q))return a(Q,`# grok-faf-mcp — wired by FAF from project.faf
293
293
 
294
- `+z,{root:$,expect:null}),"created";let X=Q0(Q);if(X.includes(`[${lU}]`))return"unchanged";let J=X.endsWith(`
294
+ `+z,{root:$,expect:null}),"created";let X=Q0(Q);if(X.includes(`[${eU}]`))return"unchanged";let J=X.endsWith(`
295
295
 
296
296
  `)?"":X.endsWith(`
297
297
  `)?`
298
298
  `:`
299
299
 
300
- `;return a(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as lS}from"path";var dS=[{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 j9($){if(!V0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function E9($,Z){if(!$)return null;return j9($[Z])}function iS($){let Z=[],z=j9($.project?.name)??"Project",Q=j9($.project?.goal);if(Z.push(`# ${z}`),Z.push(""),Q)Z.push(`> ${Q}`),Z.push("");let X=$.human_context;for(let{key:Y,heading:W}of dS){let U=E9(X,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let J=E9($.project,"homepage")??E9($.project,"url");if(J&&/^(https?:)?\/\//i.test(J))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${J})`),Z.push("");return`${Z.join(`
300
+ `;return a(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as XE}from"path";var JE=[{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 b9($){if(!V0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function k9($,Z){if(!$)return null;return b9($[Z])}function YE($){let Z=[],z=b9($.project?.name)??"Project",Q=b9($.project?.goal);if(Z.push(`# ${z}`),Z.push(""),Q)Z.push(`> ${Q}`),Z.push("");let X=$.human_context;for(let{key:Y,heading:W}of JE){let U=k9(X,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let J=k9($.project,"homepage")??k9($.project,"url");if(J&&/^(https?:)?\/\//i.test(J))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${J})`),Z.push("");return`${Z.join(`
301
301
  `).trimEnd()}
302
- `}function iU($,Z){G2(lS($,y0.llms),iS(Z))}i();import{join as nS}from"path";import{deprecate as rS}from"node:util";var nU=Z4.orange,sS=Z4.cyan,oS=Z4.cyanDeep,aS="#FF9500",tS="#FF3B30",eS="#E6EDF3",$E="#6E7681",rU={TROPHY:{glyph:"✪",color:nU},GOLD:{glyph:"★",color:nU},SILVER:{glyph:"◆",color:sS},BRONZE:{glyph:"◇",color:oS},GREEN:{glyph:"●",color:eS},YELLOW:{glyph:"●",color:aS},RED:{glyph:"○",color:tS},WHITE:{glyph:"♡",color:$E}};function u$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var sU=["who","what","why","where","when","how"];function ZZ($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${u$(Z)}</div><div class="v">${u$(z)}</div></div>`).join(`
303
- `)}function oU($,Z,z="project.faf"){let Q=u$($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=rU[X]??rU.WHITE,Y=Z.inherited?Z.represents?`inherited from ${u$(Z.represents)}`:"inherited":`${Z.score}%`,W=X==="TROPHY"&&!Z.inherited,U=$.human_context??{},G=sU.map((B)=>[B,U[B]]),V=Object.entries(U).filter(([B])=>!sU.includes(B)),H=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],K=Object.entries($.stack??{}),q=K.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=K.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
302
+ `}function ZG($,Z){V2(XE($,y0.llms),YE(Z))}n();import{join as WE}from"path";import{deprecate as UE}from"node:util";var zG=X4.orange,GE=X4.cyan,VE=X4.cyanDeep,HE="#FF9500",KE="#FF3B30",qE="#E6EDF3",BE="#6E7681",QG={TROPHY:{glyph:"✪",color:zG},GOLD:{glyph:"★",color:zG},SILVER:{glyph:"◆",color:GE},BRONZE:{glyph:"◇",color:VE},GREEN:{glyph:"●",color:qE},YELLOW:{glyph:"●",color:HE},RED:{glyph:"○",color:KE},WHITE:{glyph:"♡",color:BE}};function l$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var XG=["who","what","why","where","when","how"];function QZ($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${l$(Z)}</div><div class="v">${l$(z)}</div></div>`).join(`
303
+ `)}function JG($,Z,z="project.faf"){let Q=l$($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=QG[X]??QG.WHITE,Y=Z.inherited?Z.represents?`inherited from ${l$(Z.represents)}`:"inherited":`${Z.score}%`,W=X==="TROPHY"&&!Z.inherited,U=$.human_context??{},G=XG.map((B)=>[B,U[B]]),V=Object.entries(U).filter(([B])=>!XG.includes(B)),H=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],K=Object.entries($.stack??{}),q=K.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=K.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
304
304
  <html lang="en">
305
305
  <head>
306
306
  <meta charset="UTF-8">
@@ -341,7 +341,7 @@ footer strong{color:#e6edf3}
341
341
  <div class="eyebrow">project.faf · visual render</div>
342
342
  <header>
343
343
  <h1>${Q}</h1>
344
- <span class="badge">${J.glyph} ${u$(X)}</span>
344
+ <span class="badge">${J.glyph} ${l$(X)}</span>
345
345
  <span class="score">${Y}</span>
346
346
  </header>
347
347
  <div class="meter"><span></span></div>
@@ -349,105 +349,108 @@ ${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots fill
349
349
 
350
350
  <section>
351
351
  <h2>The 6 W's</h2>
352
- ${ZZ(G)||'<p class="muted">No human_context yet.</p>'}
353
- ${V.length?ZZ(V):""}
352
+ ${QZ(G)||'<p class="muted">No human_context yet.</p>'}
353
+ ${V.length?QZ(V):""}
354
354
  </section>
355
355
 
356
356
  <section>
357
357
  <h2>Project</h2>
358
- ${ZZ(H)||'<p class="muted">—</p>'}
358
+ ${QZ(H)||'<p class="muted">—</p>'}
359
359
  </section>
360
360
 
361
361
  <section>
362
362
  <h2>Stack</h2>
363
- ${q.length?ZZ(q):'<p class="muted">No active stack slots.</p>'}
363
+ ${q.length?QZ(q):'<p class="muted">No active stack slots.</p>'}
364
364
  </section>
365
365
 
366
366
  <footer>
367
- Rendered on-demand from your current <strong>${u$(z)}</strong><br>
367
+ Rendered on-demand from your current <strong>${l$(z)}</strong><br>
368
368
  <strong>Humans like visuals. <span style="color:#00D4D4">We gave them one.</span></strong>
369
369
  </footer>
370
370
  </div>
371
371
  </body>
372
372
  </html>
373
- `}var ZE='<meta name="description" content="Visual render of project.faf.';function zE($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(ZE)&&Z.includes(" by faf"))}function zZ($,Z,z,Q="project.faf",X={}){V2(nS($,"project.html"),oU(Z,z,Q),{root:$,format:"html",hasMark:zE,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var eu=rS(oU,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as BE}from"path";import{deprecate as ME}from"node:util";var aU="JSONRPC",M4="1.0",L4=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],tU="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";var QE="1.0";function eU($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function m$($,Z={}){let z=eU($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:M4}];return[]}function XE($){let Z=new Set;for(let z of $.capabilities??[])if(z.cites_spec&&L4.includes(z.cites_spec))Z.add(z.cites_spec);return["text/plain",...Z]}function $G($,Z={}){let z=$.agent??{},Q=m$($,Z);if(Q.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let X=String(z.displayName??$.metadata?.persona??z.name??"").trim(),J=String(z.description??"").trim(),Y=String(z.version??"").trim();if(!X||!J||!Y)throw Error("A2A card needs agent.displayName|name, description, version in .fafa");let W=String(z.vendor??"").trim(),U=String(z.homepage??"").trim(),G=W&&U?{organization:W,url:U}:void 0,V=($.capabilities??[]).map((H)=>{let K=String(H.name??"").trim();if(!K)throw Error("A2A skill missing capabilities[].name");let q=Array.isArray(H.tags)?H.tags.map(String):[],L=H.cites_spec&&L4.includes(H.cites_spec)?[H.cites_spec,"text/plain"]:void 0;return{id:K,name:K,description:String(H.description??"").trim()||K,tags:q,...L?{inputModes:L}:{}}});return{name:X,description:J,supportedInterfaces:Q.map((H)=>({url:String(H.location),protocolBinding:aU,protocolVersion:String(H.version??M4)})),...G?{provider:G}:{},version:Y,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:XE($),defaultOutputModes:["text/plain","application/json"],skills:V}}var JE=/^[a-z0-9][a-z0-9._-]*$/,YE=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function s($){return String($??"").trim()}function QZ($){return Array.isArray($)?$.map(s).filter(Boolean):[]}function WE($){return s($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function UE($,Z,z){let Q=["display_name","description","version"].filter((X)=>!s($[X]));if(Q.length)throw Error(`Missing answer: ${Q.join(", ")}`);if(!JE.test(Z))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!YE.test(z))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function GE($,Z){return($.skills??[]).filter((z)=>s(z.name)).map((z)=>({name:s(z.name),type:s(z.type)||"tool",description:s(z.description)||s(z.name),tags:Z.length?Z:[s(z.name).toLowerCase()]}))}function VE($){return($.packages??[]).filter((Z)=>s(Z.registryType)&&s(Z.identifier)).map((Z)=>({registryType:s(Z.registryType),identifier:s(Z.identifier),...s(Z.version)?{version:s(Z.version)}:{}}))}function HE($,Z){let z=[...($.endpoints??[]).filter((Q)=>s(Q.url)).map((Q)=>({protocol:s(Q.protocol).toLowerCase(),transport:"http",location:s(Q.url)})),...Z.map((Q)=>({protocol:"mcp",transport:"stdio",location:Q.identifier}))];if(z.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return z}function KE($,Z,z,Q){let X={domain:Z},J=[["repository",s($.repository)],["icon",s($.icon)],["organizationUrl",s($.organization_url)]];for(let[W,U]of J)if(U)X[W]=U;if(z.length)X.keywords=z;let Y=QZ($.example_requests);if(Y.length)X.examples=Y;if(Q.length)X.packages=Q;return X}function ZG($){let Z=s($.handle).toLowerCase(),z=WE($.domain);UE($,Z,z);let Q=QZ($.tags),X=VE($),J={name:Z,displayName:s($.display_name),id:`urn:air:${z}:agent:${Z}`,...s($.organization)?{vendor:s($.organization)}:{},version:s($.version),description:s($.description),homepage:s($.homepage)||`https://${z}`,...s($.license)?{license:s($.license)}:{}};return{version:QE,agent:J,capabilities:GE($,Q),endpoints:HE($,X),metadata:{cards:KE($,z,Q,X)}}}function zG($){return g6($,{lineWidth:0})}function N4($){let Z=s($.agent?.id),z=/^urn:air:([^:]+):/.exec(Z);if(z)return z[1];let Q=s($.metadata?.cards?.domain);if(Q)return Q;try{return new URL(s($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function QG($){return qE($)}function qE($){let Z=s($.agent?.name).toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/^-+|-+$/g,"");if(!Z)throw Error("The .fafa needs agent.name (the short name).");return Z}function XG($){let Z=$.agent??{},z=s(Z.vendor)||s(Z.displayName)||s(Z.name);if(!z)return;let Q;try{Q=N4($)}catch{Q=void 0}return{displayName:z,...Q?{identifier:Q}:{}}}function JG($){let Z=$.metadata?.cards??{},z=QZ(Z.keywords),Q=QZ(Z.examples);return{...z.length?{tags:z}:{},...Q.length?{representativeQueries:Q}:{}}}var YG="application/vnd.faf+yaml",LE=tU,NE=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function UG($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&NE.test(Z))return Z;let z=$.project?.homepage??$.project?.website??$.project?.url,Q="local";if(z)try{Q=new URL(z).hostname.replace(/^www\./,"").split(".").reverse().join(".")}catch{}let X=Z.replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")||"project";return`${Q}/${X}`}function DE($){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 D4($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:YG,iana:`https://www.iana.org/assignments/media-types/${YG}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function XZ($,Z={}){let z={$schema:LE,name:UG($),version:String($.project?.version??"0.1.0"),description:DE($)},Q=w9($)??$.project?.name;if(Q&&Q.length<=100)z.title=Q;let X=$.project?.homepage??$.project?.website??$.project?.url;if(X)z.websiteUrl=X;if(Z.remoteUrl)z.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return z._meta={"one.faf/context":D4($,Z)},z}var c$="io.modelcontextprotocol.registry/publisher-provided",WG=4096;function GG($,Z={}){let z={"one.faf/context":D4($,Z)},Q=new TextEncoder().encode(JSON.stringify(z)).length;if(Q>WG)throw Error(`publisher-provided _meta is ${Q}B — exceeds the registry ${WG}B cap`);return{[c$]:z}}function VG($){return UG($)}function w9($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function HG($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var $$=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function O4($){let Z=HG($);return $$(Z)&&$$(Z._meta)&&$$(Z._meta["one.faf/context"])}function JZ($){let Z=HG($),z=$$(Z)&&$$(Z._meta)?Z._meta[c$]:void 0;return $$(z)&&$$(z["one.faf/context"])}function KG($,Z,z={},Q={}){let X=XZ(Z,z),J=BE($,"server-card");return V2(J,`${JSON.stringify(X,null,2)}
374
- `,{root:$,format:"json",hasMark:O4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function YZ($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return f$($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var Um=ME(XZ,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");i();function I4($,Z,z,Q){let X=o5(OE($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(M(` ${X}`))}function TE($){try{return $(),!0}catch(Z){if(!v$(Z))throw Z;return console.error(L6(Z,!0)),!1}}function Z$($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
373
+ `}var ME='<meta name="description" content="Visual render of project.faf.';function LE($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(ME)&&Z.includes(" by faf"))}function XZ($,Z,z,Q="project.faf",X={}){H2(WE($,"project.html"),JG(Z,z,Q),{root:$,format:"html",hasMark:LE,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var Om=UE(JG,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as vE}from"path";import{deprecate as gE}from"node:util";var n2="https://faf.one/ext/context/v1",z$="io.modelcontextprotocol.registry/publisher-provided";function r2($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:"application/vnd.faf+yaml",iana:"https://www.iana.org/assignments/media-types/application/vnd.faf+yaml",deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function O4($,Z={}){let z={"one.faf/context":r2($,Z)},Q=new TextEncoder().encode(JSON.stringify(z)).length;if(Q>4096)throw Error(`publisher-provided _meta is ${Q}B — exceeds the registry ${"4096"}B cap`);return{["io.modelcontextprotocol.registry/publisher-provided"]:z}}var YG="JSONRPC",h9="1.0",YZ=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],f9="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";var WG="1.0",v9={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function UG($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function Q$($,Z={}){let z=UG($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:h9}];return[]}function NE($){try{return`https://${D4($)}/.well-known/fafa`}catch{return}}function GG($,Z,z={}){let Q=r2(Z,z),X=$.agent??{},J={fafaSpecVersion:String($.version??WG),mediaTypes:[...YZ],provenance:{faf:Q.faf,mediaType:Q.mediaType},generated:Q.generated};if(X.id)J.agentId=X.id;let Y=NE($);if(Y)J.passport=Y;return{uri:n2,description:"FAF passport and project DNA as typed parts",required:!1,params:J}}function OE($){let Z=new Set;for(let z of $.capabilities??[])if(z.cites_spec&&YZ.includes(z.cites_spec))Z.add(z.cites_spec);return["text/plain",...Z]}function VG($,Z={}){let z=$.agent??{},Q=Q$($,Z);if(Q.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let X=String(z.displayName??$.metadata?.persona??z.name??"").trim(),J=String(z.description??"").trim(),Y=String(z.version??"").trim();if(!X||!J||!Y)throw Error("A2A card needs agent.displayName|name, description, version in .fafa");let W=String(z.vendor??"").trim(),U=String(z.homepage??"").trim(),G=W&&U?{organization:W,url:U}:void 0,V=($.capabilities??[]).map((H)=>{let K=String(H.name??"").trim();if(!K)throw Error("A2A skill missing capabilities[].name");let q=Array.isArray(H.tags)?H.tags.map(String):[],L=H.cites_spec&&YZ.includes(H.cites_spec)?[H.cites_spec,"text/plain"]:void 0;return{id:K,name:K,description:String(H.description??"").trim()||K,tags:q,...L?{inputModes:L}:{}}});return{name:X,description:J,supportedInterfaces:Q.map((H)=>({url:String(H.location),protocolBinding:YG,protocolVersion:String(H.version??h9)})),...G?{provider:G}:{},version:Y,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:OE($),defaultOutputModes:["text/plain","application/json"],skills:V}}var DE=/^[a-z0-9][a-z0-9._-]*$/,IE=/^(@[a-z0-9~][a-z0-9-._~]*\/)?[a-z0-9~][a-z0-9-._~]*$/,TE=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/,AE=/^[A-Za-z0-9][^\s]*$/,CE=["a2a","mcp"],_E=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function k($){return String($??"").trim()}function JZ($){return Array.isArray($)?$.map(k).filter(Boolean):[]}function RE($){return k($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function FE($,Z,z){let Q=["display_name","description","version"].filter((X)=>!k($[X]));if(Q.length)throw Error(`Missing answer: ${Q.join(", ")}`);if(!DE.test(Z))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!_E.test(z))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function PE($,Z){return($.skills??[]).filter((z)=>k(z.name)).map((z)=>({name:k(z.name),type:k(z.type)||"tool",description:k(z.description)||k(z.name),tags:Z.length?Z:[k(z.name).toLowerCase()]}))}function SE($){let Z=($.packages??[]).filter((z)=>k(z.registryType)&&k(z.identifier));for(let z of Z){let Q=k(z.registryType),X=k(z.identifier);if(Q==="npm"&&!IE.test(X))throw Error(`Package "${X}" is not an npm package name (e.g. weather-mcp or @acme/weather).`);if(Q==="pypi"&&!TE.test(X))throw Error(`Package "${X}" is not a PyPI package name (e.g. weather-mcp or weather_mcp).`);if(Q!=="npm"&&Q!=="pypi"&&!AE.test(X))throw Error(`Package "${X}" is not a ${Q} package identifier: it must start with a letter or digit and have no spaces.`)}return Z.map((z)=>({registryType:k(z.registryType),identifier:k(z.identifier),...k(z.version)?{version:k(z.version)}:{}}))}function EE($){if(!/^https?:\/\/[^\s/]+/i.test(k($.url)))throw Error(`Where it runs: "${k($.url)}" is not an http(s) URL (or give an npm package).`);if(!CE.includes(k($.protocol).toLowerCase()))throw Error(`Protocol "${k($.protocol)}": a2a or mcp.`)}function jE($,Z){let z=($.endpoints??[]).filter((X)=>k(X.url));z.forEach(EE);let Q=[...z.map((X)=>({protocol:k(X.protocol).toLowerCase(),transport:"http",location:k(X.url)})),...Z.map((X)=>({protocol:"mcp",transport:"stdio",location:X.identifier}))];if(Q.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return Q}function wE($,Z,z,Q){let X={domain:Z},J=[["repository",k($.repository)],["icon",k($.icon)],["organizationUrl",k($.organization_url)]];for(let[W,U]of J)if(U)X[W]=U;if(z.length)X.keywords=z;let Y=JZ($.example_requests);if(Y.length)X.examples=Y;if(Q.length)X.packages=Q;return X}function HG($){let Z=k($.handle).toLowerCase(),z=RE($.domain);FE($,Z,z);let Q=JZ($.tags),X=SE($),J={name:Z,displayName:k($.display_name),id:`urn:air:${z}:agent:${Z}`,...k($.organization)?{vendor:k($.organization)}:{},version:k($.version),description:k($.description),homepage:k($.homepage)||`https://${z}`,...k($.license)?{license:k($.license)}:{}};return{version:WG,agent:J,capabilities:PE($,Q),endpoints:jE($,X),metadata:{cards:wE($,z,Q,X)}}}function KG($){return f6($,{lineWidth:0})}function D4($){let Z=k($.agent?.id),z=/^urn:air:([^:]+):/.exec(Z);if(z)return z[1];let Q=k($.metadata?.cards?.domain);if(Q)return Q;try{return new URL(k($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function qG($){let Z=k($.agent?.name).toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/^-+|-+$/g,"");if(!Z)throw Error("The .fafa needs agent.name (the short name).");return Z}function BG($){return`${D4($).split(".").reverse().join(".")}/${qG($)}`}function g9($){let Z=$.replace(/\s+/g," ").trim();return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function d$($){return($.endpoints??[]).filter((Z)=>k(Z.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(k(Z.location))).map((Z)=>({type:"streamable-http",url:k(Z.location)}))}function xE($){if(!$)return;try{let Z=new URL($).hostname.replace(/^www\./,"");return{url:$,source:Z.split(".")[0]}}catch{return}}function yE($){let Z=$.agent??{},z=$.metadata?.cards??{},Q=k(Z.description),X=k(Z.version);if(!Q||!X)throw Error("An MCP card needs agent.description and agent.version in .fafa");let J={name:BG($),version:X,description:g9(Q)},Y=k(Z.displayName);if(Y)J.title=g9(Y);let W=k(Z.homepage);if(W)J.websiteUrl=W;let U=xE(k(z.repository));if(U)J.repository=U;if(k(z.icon))J.icons=[{src:k(z.icon)}];return J}function kE($){return($.metadata?.cards?.packages??[]).map((Z)=>({registryType:k(Z.registryType),identifier:k(Z.identifier),...k(Z.version)?{version:k(Z.version)}:{},transport:{type:"stdio"}}))}function I4($){return d$($).length>0||kE($).length>0}function MG($){let Z=k($.agent?.displayName);return{name:BG($),...Z?{title:g9(Z)}:{}}}function LG($,Z,z={}){let Q=d$($);if(Q.length===0)throw Error("A Server Card describes a remote MCP server: the .fafa has no mcp endpoint at an http(s) URL.");return{$schema:f9,...yE($),remotes:Q,...Z?{_meta:{"one.faf/context":r2(Z,z)}}:{}}}function bE($,Z,z){if(!Z.includes("a2a")||Q$($,z).length===0)return;return z.a2aCardUrl??`https://${D4($)}/.well-known/agent-card.json`}function NG($,Z,z={}){let Q=D4($),X=qG($),J=$.agent??{},Y=k(J.displayName)||k(J.name),W=k(J.description),U=k(J.version),G=z.now??new Date().toISOString(),V=(q,L,B)=>({identifier:`urn:air:${Q}:${q}:${X}`,displayName:Y,type:L,description:W,url:B,...U?{version:U}:{},updatedAt:G}),H=[],K=bE($,Z,z);if(K)H.push(V("a2a",v9.a2a,K));if(Z.includes("server_card")){let q=d$($)[0];if(q)H.push(V("mcp",v9.server_card,`${q.url.replace(/\/+$/,"")}/server-card`))}if(z.listFafa!==!1)H.push(V("agent",v9.fafa,`https://${Q}/.well-known/fafa`));return H}function OG($){let Z=$.agent??{},z=k(Z.vendor)||k(Z.displayName)||k(Z.name);if(!z)return;let Q;try{Q=D4($)}catch{Q=void 0}return{displayName:z,...Q?{identifier:Q}:{}}}function DG($){let Z=$.metadata?.cards??{},z=JZ(Z.keywords),Q=JZ(Z.examples);return{...z.length?{tags:z}:{},...Q.length?{representativeQueries:Q}:{}}}var hE=f9,fE=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function IG($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&fE.test(Z))return Z;let z=$.project?.homepage??$.project?.website??$.project?.url,Q="local";if(z)try{Q=new URL(z).hostname.replace(/^www\./,"").split(".").reverse().join(".")}catch{}let X=Z.replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")||"project";return`${Q}/${X}`}function uE($){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 WZ($,Z={}){let z={$schema:hE,name:IG($),version:String($.project?.version??"0.1.0"),description:uE($)},Q=u9($)??$.project?.name;if(Q&&Q.length<=100)z.title=Q;let X=$.project?.homepage??$.project?.website??$.project?.url;if(X)z.websiteUrl=X;if(Z.remoteUrl)z.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return z._meta={"one.faf/context":r2($,Z)},z}function TG($){return IG($)}function u9($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function AG($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var X$=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function T4($){let Z=AG($);return X$(Z)&&X$(Z._meta)&&X$(Z._meta["one.faf/context"])}function UZ($){let Z=AG($),z=X$(Z)&&X$(Z._meta)?Z._meta[z$]:void 0;return X$(z)&&X$(z["one.faf/context"])}function CG($,Z,z={},Q={}){let X=WZ(Z,z),J=vE($,"server-card");return H2(J,`${JSON.stringify(X,null,2)}
374
+ `,{root:$,format:"json",hasMark:T4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function GZ($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return p$($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var jm=gE(WZ,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");n();function A4($,Z,z,Q){let X=t5(mE($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(M(` ${X}`))}function pE($){try{return $(),!0}catch(Z){if(!u$(Z))throw Z;return console.error(O6(Z,!0)),!1}}function J$($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
375
375
 
376
- Run 'faf init' to create one.`),process.exit(2);let z=$.output?IE(process.cwd(),$.output):process.cwd();if($.output)w0(z);let Q=r(Z),X=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,J=0,Y=(U)=>{if(!TE(U))J++};if(X||$.agents)Y(()=>I4(z,"AGENTS.md",()=>fU(z,S9(z,Q))));if(X||$.cursor)Y(()=>I4(z,".cursorrules",()=>uU(z,Q),["# faf:start","# faf:end"]));if(X||$.gemini)Y(()=>I4(z,"GEMINI.md",()=>mU(z,S9(z,Q))));if(X||$.copilot)Y(()=>I4(z,".github/copilot-instructions.md",()=>pU(z,Q)));if($.grok)Y(()=>{let U=dU(z,Q);console.log(` .grok/config.toml (${U})`)});if($.llms)Y(()=>I4(z,"llms.txt",()=>iU(z,Q)));if(X||$.html)Y(()=>{let U=n(Z,()=>D0(p(Z)));zZ(z,Q,U,Z,{force:$.force}),console.log(" project.html")});let W=Q.app_type==="server-card"||Q.project?.type==="server-card";if($.card||X&&W)Y(()=>{let U=KG(z,Q,{},{force:$.force});console.log(` ${U.replace(`${z}/`,"")}`)});if(console.log(`${T("exported")} ${M(`from ${Z}`)}`),J>0)process.exit(1)}import{existsSync as xE,lstatSync as yE}from"fs";import{dirname as OG,resolve as v9}from"path";import{existsSync as qG}from"fs";import{basename as AE,dirname as T4,join as BG}from"path";import{deprecate as CE}from"node:util";var A4="https://faf.one/ext/context/v1",x9=["a2a","mcp","registry","catalog","ard"];function MG($){return r0(Q0(l(T4($),AE($))))}function LG($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=BG($,Q);if(qG(X))return X}let z=T4($);if(z!==$)for(let Q of Z){let X=BG(z,Q);if(qG(X))return X}return null}function _E($,Z,z){let Q=D4(Z,z),X=$.agent??{},J={fafaSpecVersion:String($.version??M4),mediaTypes:[...L4],provenance:{faf:Q.faf,mediaType:Q.mediaType},generated:Q.generated};if(X.id)J.agentId=X.id;let Y=RE($);if(Y)J.passport=Y;return J}function RE($){try{return`https://${N4($)}/.well-known/fafa`}catch{return}}function NG($,Z,z={}){if(m$($,z).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return $G($,{doorUrl:z.doorUrl,extensions:[{uri:A4,description:"FAF passport and project DNA as typed parts",required:!1,params:_E($,Z,z)}]})}var vm=CE(NG,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function PE($,Z){return Z.a2aCardUrl??`https://${N4($)}/.well-known/agent-card.json`}function FE($,Z,z={}){let Q=N4($),X=QG($),J=$.agent??{},Y=z.now??Z.generated??new Date().toISOString(),W=[];if(m$($,z).length>0)W.push({identifier:`urn:air:${Q}:a2a:${X}`,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:PE($,z),updatedAt:Y});return W.push({identifier:`urn:air:${Q}:agent:${X}`,displayName:String(J.displayName??J.name??".fafa"),type:"application/vnd.fafa+yaml",description:"FAF agent passport (.fafa).",url:`https://${Q}/.well-known/fafa`,updatedAt:Y}),W}var SE=["url","type","updatedAt"];function y9($,Z,z){if($===null){let J={specVersion:"1.0",...z?{host:z}:{},entries:Z};return{text:`${JSON.stringify(J,null,2)}
377
- `,changed:!0}}let Q=SU($,"entries",Z,{id:"identifier",update:SE});if(!z||EE(Q.text))return Q;let X=f$(Q.text,{host:z},{"":{host:["specVersion"]}});return{text:X.text,changed:Q.changed||X.changed}}function EE($){try{let Z=JSON.parse($);return Object.prototype.hasOwnProperty.call(Z,"host")}catch{return!0}}function WZ($){let Z=$.opts??{},z=new Set($.targets?.length?$.targets:x9),X={block:D4($.faf,Z)};if(z.has("mcp"))X.mcp=XZ($.faf,Z);if(z.has("registry")){let J=w9($.faf);X.registry={name:VG($.faf),...J?{title:J}:{},_meta:GG($.faf,Z)}}if(z.has("a2a")||z.has("catalog")||z.has("ard")){if(!$.fafa){if($.targets?.some((J)=>J==="a2a"||J==="catalog"||J==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(z.has("a2a")&&$.fafa)if(m$($.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 X.a2a=NG($.fafa,$.faf,Z);if((z.has("catalog")||z.has("ard"))&&$.fafa){let J=FE($.fafa,$.faf,Z);if(z.has("catalog"))X.catalog=J;if(z.has("ard")){let W=JG($.fafa);X.ard=J.map((U)=>({...U,...W}))}let Y=XG($.fafa);if(Y)X.catalogHost=Y}return jE(X),X}function jE($){let Z=JSON.stringify($.block),z=[];if($.mcp){let Q=$.mcp._meta;z.push(JSON.stringify(Q["one.faf/context"]))}if($.registry){let Q=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];z.push(JSON.stringify(Q["one.faf/context"]))}for(let Q of z)if(Q!==Z)throw Error("context block drifted across card targets — one projector, one block");if($.a2a){let Q=$.a2a.capabilities.extensions[0].params,X=$.block;if(Q.provenance?.faf!==X.faf||Q.provenance?.mediaType!==X.mediaType)throw Error("A2A extension provenance drifted from the context block — one context, every door")}}function k9($){let Z;try{Z=JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return!1}let Q=(typeof Z==="object"&&Z!==null?Z.capabilities:void 0)?.extensions;return Array.isArray(Q)&&Q.some((X)=>typeof X==="object"&&X!==null&&X.uri===A4)}function wE($){return O4($)||JZ($)||k9($)}function b9($,Z,z,Q={}){return w0(z??T4($),T4($)),V2($,`${JSON.stringify(Z,null,2)}
378
- `,{root:z??T4($),format:"json",hasMark:Q.owns??wE,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function DG($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!x9.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${x9.join(",")})`);return Z}i();function kE($){try{return yE($),!0}catch{return!1}}function bE($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[c$]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function IG($={}){let Z=$.faf?v9($.faf):f();if(!Z||!xE(Z))console.error(`Error: project.faf not found
376
+ Run 'faf init' to create one.`),process.exit(2);let z=$.output?cE(process.cwd(),$.output):process.cwd();if($.output)w0(z);let Q=o(Z),X=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,J=0,Y=(U)=>{if(!pE(U))J++};if(X||$.agents)Y(()=>A4(z,"AGENTS.md",()=>rU(z,y9(z,Q))));if(X||$.cursor)Y(()=>A4(z,".cursorrules",()=>sU(z,Q),["# faf:start","# faf:end"]));if(X||$.gemini)Y(()=>A4(z,"GEMINI.md",()=>oU(z,y9(z,Q))));if(X||$.copilot)Y(()=>A4(z,".github/copilot-instructions.md",()=>tU(z,Q)));if($.grok)Y(()=>{let U=$G(z,Q);console.log(` .grok/config.toml (${U})`)});if($.llms)Y(()=>A4(z,"llms.txt",()=>ZG(z,Q)));if(X||$.html)Y(()=>{let U=s(Z,()=>O0(l(Z)));XZ(z,Q,U,Z,{force:$.force}),console.log(" project.html")});let W=Q.app_type==="server-card"||Q.project?.type==="server-card";if($.card||X&&W)Y(()=>{let U=CG(z,Q,{},{force:$.force});console.log(` ${U.replace(`${z}/`,"")}`)});if(console.log(`${T("exported")} ${M(`from ${Z}`)}`),J>0)process.exit(1)}import{existsSync as aE,lstatSync as tE}from"fs";import{dirname as EG,resolve as d9}from"path";import{existsSync as _G}from"fs";import{basename as lE,dirname as C4,join as RG}from"path";import{deprecate as dE}from"node:util";var m9=["a2a","mcp","registry","catalog","ard"];function VZ($){return r0(Q0(d(C4($),lE($))))}function FG($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=RG($,Q);if(_G(X))return X}let z=C4($);if(z!==$)for(let Q of Z){let X=RG(z,Q);if(_G(X))return X}return null}function PG($,Z,z={}){if(Q$($,z).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return VG($,{doorUrl:z.doorUrl,extensions:Z?[GG($,Z,z)]:[]})}var Yc=dE(PG,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function iE($,Z={},z={}){return NG($,["a2a","server_card"],{now:z.now??Z.generated??new Date().toISOString(),a2aCardUrl:z.a2aCardUrl,doorUrl:z.doorUrl})}var nE=["url","type","updatedAt"];function c9($,Z,z){if($===null){let J={specVersion:"1.0",...z?{host:z}:{},entries:Z};return{text:`${JSON.stringify(J,null,2)}
377
+ `,changed:!0}}let Q=gU($,"entries",Z,{id:"identifier",update:nE});if(!z||rE(Q.text))return Q;let X=p$(Q.text,{host:z},{"":{host:["specVersion"]}});return{text:X.text,changed:Q.changed||X.changed}}function rE($){try{let Z=JSON.parse($);return Object.prototype.hasOwnProperty.call(Z,"host")}catch{return!0}}function _4($,Z={}){return[...Q$($,Z).length>0?["a2a"]:[],...d$($).length>0?["mcp"]:[],...I4($)?["registry"]:[],"catalog","ard"]}function HZ($){let Z=$.opts??{},z=$.faf,Q=$.fafa,X=z?m9:Q?_4(Q,Z):[],J=new Set($.targets?.length?$.targets:X),Y={};if(z)Y.block=r2(z,Z);if(J.has("mcp"))if(Q&&d$(Q).length>0)Y.mcp=LG(Q,z,Z);else if(z)Y.mcp=WZ(z,Z);else throw Error("A Server Card needs an MCP endpoint at an http(s) URL in the .fafa, or a project.faf.");if(J.has("registry"))if(Q&&I4(Q))Y.registry={...MG(Q),...z?{_meta:O4(z,Z)}:{}};else if(z){let W=u9(z);Y.registry={name:TG(z),...W?{title:W}:{},_meta:O4(z,Z)}}else throw Error("A registry entry needs a package or a remote MCP URL in the .fafa, or a project.faf.");if(J.has("a2a")||J.has("catalog")||J.has("ard")){if(!$.fafa){if($.targets?.some((W)=>W==="a2a"||W==="catalog"||W==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(J.has("a2a")&&$.fafa)if(Q$($.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 Y.a2a=PG($.fafa,z,Z);if((J.has("catalog")||J.has("ard"))&&$.fafa){let W=iE($.fafa,z,Z);if(J.has("catalog"))Y.catalog=W;if(J.has("ard")){let G=DG($.fafa);Y.ard=W.map((V)=>({...V,...G}))}let U=OG($.fafa);if(U)Y.catalogHost=U}return sE(Y),Y}function sE($){if(!$.block)return;let Z=JSON.stringify($.block),z=[];if($.mcp){let Q=$.mcp._meta;z.push(JSON.stringify(Q["one.faf/context"]))}if($.registry?._meta){let Q=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];z.push(JSON.stringify(Q["one.faf/context"]))}for(let Q of z)if(Q!==Z)throw Error("context block drifted across card targets — one projector, one block");if($.a2a){let Q=$.a2a.capabilities.extensions?.find((Y)=>Y.uri===n2);if(!Q)throw Error("A2A card has no FAF context extension, but a project.faf was given");let X=Q.params,J=$.block;if(X.provenance?.faf!==J.faf||X.provenance?.mediaType!==J.mediaType)throw Error("A2A extension provenance drifted from the context block — one context, every door")}}function p9($){let Z;try{Z=JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return!1}let Q=(typeof Z==="object"&&Z!==null?Z.capabilities:void 0)?.extensions;return Array.isArray(Q)&&Q.some((X)=>typeof X==="object"&&X!==null&&X.uri===n2)}function oE($){return T4($)||UZ($)||p9($)}function l9($,Z,z,Q={}){return w0(z??C4($),C4($)),H2($,`${JSON.stringify(Z,null,2)}
378
+ `,{root:z??C4($),format:"json",hasMark:Q.owns??oE,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function SG($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!m9.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${m9.join(",")})`);return Z}n();function eE($){try{return tE($),!0}catch{return!1}}function $j($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[z$]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function jG($={}){let Z=$.faf?d9($.faf):u();if(!Z||!aE(Z))console.error(`Error: project.faf not found
379
379
 
380
- Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=v9($.in??"./server.json"),X=$.in?OG(Q):process.cwd();if(!kE(Q))console.error(`Error: ${Q} not found.
380
+ Run 'faf init' to create one.`),process.exit(2);let z=o(Z),Q=d9($.in??"./server.json"),X=$.in?EG(Q):process.cwd();if(!eE(Q))console.error(`Error: ${Q} not found.
381
381
 
382
382
  'faf server-card' patches the identity into an existing registry server.json;
383
- it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=l(X,Q),Y=Q0(J),W=$.generated??bE(Y)??new Date().toISOString(),U=WZ({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),G=U.registry.name,V=U.registry.title,H;try{H=YZ(Y,{name:G,title:V,version:$.setVersion,meta:U.registry._meta})}catch(L){if(!(L instanceof f0))throw L;console.error(`faf: ${Q}: ${L.message} — faf cannot change only its identity keys, so it left the file unchanged.`),process.exit(1)}if($.check){process.stdout.write(H.text);return}let K=v9($.out??Q),q=V??"(none in project.faf — the file's own kept)";if(K===Q){if(H.changed)a(J,H.text,{root:X,expect:Y})}else W2(K),V2(K,H.text,{root:$.out?OG(K):process.cwd(),format:"json",hasMark:JZ,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${T("✓")} ${K} — name=${G} title=${q} ${M(H.changed||K!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as TG,lstatSync as vE}from"fs";import{dirname as AG,join as p$,resolve as g9}from"path";i();var CG=["catalog","ard"];function UZ($){try{return vE($),!0}catch{return!1}}var i2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0,gE=[{target:"registry",file:["server.json"],stamp:($)=>i2(i2(i2($._meta)?.[c$])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>i2(i2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=i2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(i2).find((Q)=>Q?.uri===A4):void 0;return i2(z?.params)?.generated}}];function hE($,Z){for(let{target:z,file:Q,stamp:X}of gE){let J=p$($,...Q);if(Z?.length&&!Z.includes(z)||!UZ(J))continue;try{let Y=i2(JSON.parse(Q0(l($,J)).replace(/^\uFEFF/,""))),W=Y?X(Y):void 0;if(typeof W==="string")return W}catch{}}return}function GZ($={}){let Z=$.dir?g9($.dir):process.cwd(),z;try{z=DG($.target)}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}let Q=$.fafa?g9($.fafa):LG(Z),X=Q&&TG(Q)?MG(Q):void 0,J=$.faf?g9($.faf):f(Z),Y=Boolean(J&&TG(J));if(!Y){let q=z??(X?CG:void 0);if(!X||!q||q.some((L)=>!CG.includes(L)))console.error(`Error: project.faf not found
383
+ it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=d(X,Q),Y=Q0(J),W=$.generated??$j(Y)??new Date().toISOString(),U=HZ({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),G=U.registry.name,V=U.registry.title,H;try{H=GZ(Y,{name:G,title:V,version:$.setVersion,meta:U.registry._meta})}catch(L){if(!(L instanceof f0))throw L;console.error(`faf: ${Q}: ${L.message} — faf cannot change only its identity keys, so it left the file unchanged.`),process.exit(1)}if($.check){process.stdout.write(H.text);return}let K=d9($.out??Q),q=V??"(none in project.faf — the file's own kept)";if(K===Q){if(H.changed)a(J,H.text,{root:X,expect:Y})}else U2(K),H2(K,H.text,{root:$.out?EG(K):process.cwd(),format:"json",hasMark:UZ,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${T("✓")} ${K} — name=${G} title=${q} ${M(H.changed||K!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as wG,lstatSync as Zj}from"fs";import{dirname as xG,join as i$,resolve as i9}from"path";n();function zj($){try{let Z=JSON.parse($).name;return typeof Z==="string"&&Z!==""?Z:null}catch{return null}}function KZ($){try{return Zj($),!0}catch{return!1}}var y2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0;function yG($){return(Array.isArray($.entries)?$.entries.map(y2):[]).find((z)=>z?.type==="application/vnd.fafa+yaml"&&/^urn:air:[^:]+:agent:/.test(String(z?.identifier)))?.updatedAt}var Qj=[{target:"registry",file:["server.json"],stamp:($)=>y2(y2(y2($._meta)?.[z$])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>y2(y2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=y2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(y2).find((Q)=>Q?.uri===n2):void 0;return y2(z?.params)?.generated}},{target:"catalog",file:[".well-known","ai-catalog.json"],stamp:yG},{target:"ard",file:[".well-known","ard.json"],stamp:yG}];function Xj($,Z){for(let{target:z,file:Q,stamp:X}of Qj){let J=i$($,...Q);if(Z?.length&&!Z.includes(z)||!KZ(J))continue;try{let Y=y2(JSON.parse(Q0(d($,J)).replace(/^\uFEFF/,""))),W=Y?X(Y):void 0;if(typeof W==="string")return W}catch{}}return}function qZ($={}){let Z=$.dir?i9($.dir):process.cwd(),z;try{z=SG($.target)}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}let Q=$.fafa?i9($.fafa):FG(Z),X=Q&&wG(Q)?VZ(Q):void 0,J=$.faf?i9($.faf):u(Z),Y=Boolean(J&&wG(J));if(!Y){if(!X)console.error(`Error: no agent.fafa or project.faf here
384
384
 
385
- Run 'faf init' to create one.${X?`
386
- With only an agent.fafa: faf cards --target catalog,ard`:""}`),process.exit(2);z=q}let W=Y?r(J):{},U;try{U=WZ({faf:W,fafa:X,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:hE(Z,z)??new Date().toISOString()}})}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(U,null,2)}
387
- `);return}let G=[],V=$.force===!0,H=0,K=(q,L,B="its own keys")=>{try{G.push({out:q,changed:L()})}catch(N){if(N instanceof f0)console.error(`faf: ${q}: ${N.message} — faf cannot change only ${B}, so it left the file unchanged.`);else if(v$(N))console.error(L6(N,!0));else throw N;H++}};if(U.a2a){let q=p$(Z,".well-known","agent-card.json");K(q,()=>b9(q,U.a2a,Z,{owns:k9,mark:`FAF context extension (${A4})`,force:V})!=="unchanged")}if(U.mcp){let q=p$(Z,"server-card");K(q,()=>b9(q,U.mcp,Z,{owns:O4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:V})!=="unchanged")}if(U.catalog){let q=p$(Z,".well-known","ai-catalog.json"),L=U.catalog;K(q,()=>{w0(Z,AG(q));let B=l(Z,q),N=UZ(q)?Q0(B):null,I=y9(N,L,U.catalogHost);if(I.changed)a(B,I.text,{root:Z,expect:N});return I.changed},"its own rows")}if(U.ard){let q=p$(Z,".well-known","ard.json"),L=U.ard;if(K(q,()=>{w0(Z,AG(q));let B=l(Z,q),N=UZ(q)?Q0(B):null,I=y9(N,L,U.catalogHost);if(I.changed)a(B,I.text,{root:Z,expect:N});return I.changed},"its own rows"),!L.some((B)=>B.representativeQueries?.length))console.error(`${M("note")} ${q}: no representativeQueries — registries build their search index from these, so the entries are a valid catalog but will not be found. Add 2-5 to the .fafa as metadata.cards.examples.`)}if(U.registry){let q=p$(Z,"server.json");if(UZ(q)){let L=U.registry;K(q,()=>{let B=l(Z,q),N=Q0(B),I=YZ(N,{name:L.name,title:L.title,meta:L._meta});if(I.changed)a(B,I.text,{root:Z,expect:N});return I.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${q} not found.
385
+ Cards start from an agent.fafa: faf card init
386
+ For project.faf: faf init`),process.exit(2);let q=_4(X,{doorUrl:$.doorUrl});if(z?.some((L)=>(L==="mcp"||L==="registry")&&!q.includes(L))){let L=`
387
+ With only an agent.fafa: faf cards --target ${q.join(",")}`;console.error(`Error: project.faf not found
388
388
 
389
- Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(G.length===0&&H===0){console.error(`${T("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog; server.json for registry")}`);return}for(let{out:q,changed:L}of G)console.error(`${T("✓")} ${q}${L?"":` ${M("(unchanged)")}`}`);if(!Y)console.error(M("better: add your project.faf (faf init): the A2A, MCP and registry cards come from it."));if(H>0)process.exit(1)}import{existsSync as fE,readFileSync as uE}from"fs";import{join as mE,resolve as _G}from"path";import{createInterface as cE}from"readline";i();var pE=["a2a","mcp"];function RG($){return $.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"")}function lE($){let Z=$.indexOf(":");if(Z<0)return{name:$.trim()};let z=$.slice(Z+1).trim();return{name:$.slice(0,Z).trim(),...z?{description:z}:{}}}function dE($){try{let Z=JSON.parse(uE(mE($,"package.json"),"utf-8")).version;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}catch{return}}function PG($,Z,z){if(/^https?:\/\//i.test(Z))$.endpoints=[{protocol:z,url:Z}];else $.packages=[{registryType:"npm",identifier:Z}]}function n2($){return($??"").trim()}function iE($){let Z=n2($.name),z={display_name:Z,handle:n2($.shortName)||RG(Z),domain:n2($.domain),description:n2($.description),version:n2($.setVersion),skills:($.skill??[]).map(lE).filter((Q)=>Q.name),example_requests:($.example??[]).map(n2).filter(Boolean)};if($.url)PG(z,n2($.url),n2($.protocol).toLowerCase()||"a2a");if($.package)z.packages=[{registryType:"npm",identifier:n2($.package)}];return z}function FG($){return async(Z,z)=>(await $(z?`${Z} ${M(`(${z})`)}: `:`${Z}: `)).trim()||z||""}async function SG($,Z,z,Q){let X=[];while(X.length<Q){let J=(await $(`${X.length?z:Z}: `)).trim();if(!J)break;X.push(J)}return X}async function nE($,Z){let z=FG(Z),Q=await z("Where it runs — a URL people call, or an npm package");if(!Q)return;let X="a2a";if(/^https?:\/\//i.test(Q)){let J=(await z("Protocol at that URL — a2a or mcp","a2a")).toLowerCase();X=pE.includes(J)?J:"a2a"}PG($,Q,X)}async function rE($){let Z=[];for(;;){let[z]=await SG($,Z.length?"Another thing it can do (Enter to finish)":"What it can do — one capability, e.g. Get forecast","",1);if(!z)break;let Q=(await $(` ${M("what it does")}: `)).trim();Z.push({name:z,...Q?{description:Q}:{}})}return Z}async function sE($,Z,z){let Q={...$},X=FG(Z);if(Q.display_name||=await X("Name — what people see, e.g. Weather Agent"),Q.handle||=await X("Short name — lowercase, no spaces",RG(Q.display_name)),Q.domain||=await X("Domain — where it is published, e.g. example.com"),Q.description||=await X("What it does — one sentence"),Q.version||=await X("Version",dE(z)??"0.1.0"),!Q.endpoints?.length&&!Q.packages?.length)await nE(Q,Z);if(!Q.skills?.length)Q.skills=await rE(Z);if(!Q.example_requests?.length)Q.example_requests=await SG(Z,"A question people ask it — search finds it by these (2-5)","Another (Enter to finish)",5);return Q}function oE($){if(!$.skills?.length)throw Error("Missing answer: what it can do (at least one capability)");return zG(ZG($))}function aE($){return Boolean($.name&&$.domain&&$.description&&$.setVersion&&($.url||$.package)&&$.skill?.length)}function tE($){if($)return{ask:$,close:()=>{}};if(!process.stdin.isTTY)return{close:()=>{}};let Z=cE({input:process.stdin,output:process.stdout});return{ask:(z)=>new Promise((Q)=>Z.question(z,Q)),close:()=>Z.close()}}async function EG($={},Z){let z=_G($.dir??process.cwd()),Q=_G(z,$.out??"agent.fafa");if(fE(Q)&&!$.force)console.error(`Error: ${Q} already exists — edit it, or use --force to replace it.`),process.exit(2);let X=aE($)?{close:()=>{}}:tE(Z);try{let J=iE($);if(X.ask){if(!Z)console.log(`${T("card init")} ${M("— seven answers, one agent.fafa")}
390
- `);J=await sE(J,X.ask,z)}let Y;try{Y=oE(J)}catch(W){console.error(`Error: ${W.message}`),process.exit(2)}if(a(Q,Y,{root:z}),console.log(`${T("✓")} ${Q}`),(J.example_requests??[]).length<2)console.error(`${M("note")} add 2-5 questions people ask it (metadata.cards.examples) — search finds it by these.`);if(X.ask){let W=(await X.ask(`Write your AI Catalog and ARD entries now? ${M("(Y/n)")} `)).trim().toLowerCase();if(W===""||W.startsWith("y")){GZ({dir:z,fafa:Q,target:"catalog,ard"});return}}if(console.log(M(" next: faf cards --target catalog,ard")),!f(z))console.log(M(" better: add your project.faf (faf init): the A2A, MCP and registry cards come from it."))}finally{X.close()}}import{join as eE}from"path";import $j from"open";i();function Zj($){if(process.env.CI)return!1;try{return $j($).catch(()=>{return}),!0}catch{return!1}}function jG($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
389
+ Run 'faf init' to create one.${L}`),process.exit(2)}}let W=Y?o(J):void 0,U;try{U=HZ({faf:W,fafa:X,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:Xj(Z,z)??new Date().toISOString()}})}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(U,null,2)}
390
+ `);return}let G=[],V=$.force===!0,H=0,K=(q,L,B="its own keys")=>{try{G.push({out:q,changed:L()})}catch(N){if(N instanceof f0)console.error(`faf: ${q}: ${N.message} — faf cannot change only ${B}, so it left the file unchanged.`);else if(u$(N))console.error(O6(N,!0));else throw N;H++}};if(U.a2a){let q=i$(Z,".well-known","agent-card.json");K(q,()=>l9(q,U.a2a,Z,{owns:p9,mark:`faf render hash or FAF context extension (${n2})`,force:V})!=="unchanged")}if(U.mcp){let q=i$(Z,"server-card");K(q,()=>l9(q,U.mcp,Z,{owns:T4,mark:'faf render hash or FAF context-block (`_meta["one.faf/context"]`)',force:V})!=="unchanged")}if(U.catalog){let q=i$(Z,".well-known","ai-catalog.json"),L=U.catalog;K(q,()=>{w0(Z,xG(q));let B=d(Z,q),N=KZ(q)?Q0(B):null,I=c9(N,L,U.catalogHost);if(I.changed)a(B,I.text,{root:Z,expect:N});return I.changed},"its own rows")}if(U.ard){let q=i$(Z,".well-known","ard.json"),L=U.ard;if(K(q,()=>{w0(Z,xG(q));let B=d(Z,q),N=KZ(q)?Q0(B):null,I=c9(N,L,U.catalogHost);if(I.changed)a(B,I.text,{root:Z,expect:N});return I.changed},"its own rows"),!L.some((B)=>B.representativeQueries?.length))console.error(`${M("note")} ${q}: no representativeQueries — registries build their search index from these, so the entries are a valid catalog but will not be found. Add 2-5 to the .fafa as metadata.cards.examples.`)}if(U.registry){let q=i$(Z,"server.json");if(KZ(q)){let L=U.registry;K(q,()=>{let B=d(Z,q),N=Q0(B),I=zj(N),_=X!==void 0&&I4(X);if(!V&&_&&I&&I!==L.name)throw new v("not-owned",B,`${q} is published as "${I}" and the .fafa gives "${L.name}" — faf left the name as it is, because a rename moves the next registry publish to another namespace. Use --force to rename it.`);let w=GZ(N,{name:L.name,title:L.title,meta:L._meta});if(w.changed)a(B,w.text,{root:Z,expect:N});return w.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${q} not found.
391
391
 
392
- Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=r(Z),X=n(Z,()=>D0(p(Z)));zZ(z,Q,X,Z,{force:$.force});let J=eE(z,"project.html"),Y=Zj(J);console.log(" project.html"),console.log(Y?`${T("opened")} ${M("in your browser")}`:`${T("rendered")} ${M(`file://${J}`)}`)}import{existsSync as zj}from"fs";import{join as h9,resolve as Qj}from"path";import{execFileSync as kG}from"child_process";function wG($){let Z=($??"").trim();if(!Z)throw Error("Please provide a GitHub URL.");if(/[\s;&|`$(){}<>\\^'"!*?[\]]/.test(Z))throw Error(`Refusing unsafe URL: ${JSON.stringify($)}`);let z=Z.replace(/\/+$/,"").replace(/\.git$/i,""),Q=z.match(/^(?:github\.com\/)?([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*)$/);if(Q)return`https://github.com/${Q[1]}/${Q[2]}.git`;if(/^https?:\/\/[A-Za-z0-9._\-/:@~%]+$/.test(z))return`${z}.git`;throw Error(`Not a recognized GitHub repo URL: ${JSON.stringify($)}`)}function xG($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function yG($,Z={}){let z=k$($);if(Z.repoUrl&&z.project&&!A2($)?.name&&z.project.name===$.split("/").pop())z.project.name=xG(Z.repoUrl);return z}i();function Xj($){let Z;try{Z=kG("git",["-C",$,"ls-files","-s","-z"],{stdio:["ignore","pipe","pipe"]}).toString()}catch{return 0}let z=0;for(let Q of Z.split("\x00")){if(!Q.startsWith("120000 "))continue;let X=Q.indexOf("\t");if(X<0)continue;let J=h9($,Q.slice(X+1)),Y=k0(J);if(Y===null)continue;try{if(N5(J,{root:$,expect:Y}))z++}catch{}}return z}function Jj($,Z,z){return["clone","-c","core.symlinks=false","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function Yj($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?Qj(Z,$.output):h9(Z,"project.faf");if(zj(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
393
- `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function bG($,Z={},z=process.cwd()){let Q;try{Q=wG($)}catch(W){console.error(`Error: ${W.message}
392
+ Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(G.length===0&&H===0){console.error(`${T("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog/ARD; server.json for registry")}`);return}for(let{out:q,changed:L}of G)console.error(`${T("✓")} ${q}${L?"":` ${M("(unchanged)")}`}`);if(!Y)console.error(M("BETTER: cards from your agent.fafa. BEST: add your project.faf (faf init) for FAF context on every card."));if(H>0)process.exit(1)}import{existsSync as kG,readFileSync as Jj}from"fs";import{join as vG,resolve as bG}from"path";import{createInterface as Yj}from"readline";n();var Wj=["a2a","mcp"],Uj={a2a:"A2A card",mcp:"MCP Server Card",registry:"registry server.json",catalog:"AI Catalog",ard:"ARD"};function gG($){return $.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"")}function Gj($){let Z=$.indexOf(":");if(Z<0)return{name:$.trim()};let z=$.slice(Z+1).trim();return{name:$.slice(0,Z).trim(),...z?{description:z}:{}}}function Vj($){try{let Z=JSON.parse(Jj(vG($,"package.json"),"utf-8")).version;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}catch{return}}function hG($,Z,z){if(Z.includes(":"))$.endpoints=[{protocol:z,url:Z}];else $.packages=[{registryType:"npm",identifier:Z}]}function s2($){return($??"").trim()}function Hj($){let Z=s2($.name),z={display_name:Z,handle:s2($.shortName)||gG(Z),domain:s2($.domain),description:s2($.description),version:s2($.setVersion),skills:($.skill??[]).map(Gj).filter((Q)=>Q.name),example_requests:($.example??[]).map(s2).filter(Boolean)};if($.url)hG(z,s2($.url),s2($.protocol).toLowerCase()||"a2a");if($.package)z.packages=[{registryType:"npm",identifier:s2($.package)}];return z}function fG($){return async(Z,z)=>(await $(z?`${Z} ${M(`(${z})`)}: `:`${Z}: `)).trim()||z||""}async function uG($,Z,z,Q){let X=[];while(X.length<Q){let J=(await $(`${X.length?z:Z}: `)).trim();if(!J)break;X.push(J)}return X}async function Kj($,Z){let z=fG(Z),Q=await z("Where it runs — a URL people call, or an npm package");if(!Q)return;let X="a2a";if(/^https?:\/\//i.test(Q)){let J=(await z("Protocol at that URL — a2a or mcp","a2a")).toLowerCase();X=Wj.includes(J)?J:"a2a"}hG($,Q,X)}async function qj($){let Z=[];for(;;){let[z]=await uG($,Z.length?"Another thing it can do (Enter to finish)":"What it can do — one capability, e.g. Get forecast","",1);if(!z)break;let Q=(await $(` ${M("what it does")}: `)).trim();Z.push({name:z,...Q?{description:Q}:{}})}return Z}async function Bj($,Z,z){let Q={...$},X=fG(Z);if(Q.display_name||=await X("Name — what people see, e.g. Weather Agent"),Q.handle||=await X("Short name — lowercase, no spaces",gG(Q.display_name)),Q.domain||=await X("Domain — where it is published, e.g. example.com"),Q.description||=await X("What it does — one sentence"),Q.version||=await X("Version",Vj(z)??"0.1.0"),!Q.endpoints?.length&&!Q.packages?.length)await Kj(Q,Z);if(!Q.skills?.length)Q.skills=await qj(Z);if(!Q.example_requests?.length)Q.example_requests=await uG(Z,"A question people ask it — search finds it by these (2-5)","Another (Enter to finish)",5);return Q}function Mj($){if(!$.skills?.length)throw Error("Missing answer: what it can do (at least one capability)");return KG(HG($))}function Lj($){return Boolean($.name&&$.domain&&$.description&&$.setVersion&&($.url||$.package)&&$.skill?.length)}function Nj($){if($)return{ask:$,close:()=>{}};if(!process.stdin.isTTY)return{close:()=>{}};let Z=Yj({input:process.stdin,output:process.stdout});return{ask:(z)=>new Promise((Q)=>Z.question(z,Q)),close:()=>Z.close()}}async function mG($={},Z){let z=bG($.dir??process.cwd()),Q=bG(z,$.out??"agent.fafa");if(kG(Q)&&!$.force)console.error(`Error: ${Q} already exists — edit it, or use --force to replace it.`),process.exit(2);let X=Lj($)?{close:()=>{}}:Nj(Z);try{let J=Hj($);if(X.ask){if(!Z)console.log(`${T("card init")} ${M("— seven answers, one agent.fafa")}
393
+ `);J=await Bj(J,X.ask,z)}let Y;try{Y=Mj(J)}catch(G){console.error(`Error: ${G.message}`),process.exit(2)}if(a(Q,Y,{root:z}),console.log(`${T("✓")} ${Q}`),(J.example_requests??[]).length<2)console.error(`${M("note")} add 2-5 questions people ask it (metadata.cards.examples) — search finds it by these.`);let W=_4(VZ(Q)).filter((G)=>G!=="registry"||kG(vG(z,"server.json"))),U=W.map((G)=>Uj[G]).join(", ");if(X.ask){let G=(await X.ask(`Write your ${U} now? ${M("(Y/n)")} `)).trim().toLowerCase();if(G===""||G.startsWith("y")){qZ({dir:z,fafa:Q,target:W.join(",")});return}}if(console.log(M(` next: faf cards --target ${W.join(",")}`)),!u(z))console.log(M(" BEST: add your project.faf (faf init) for FAF context on every card."))}finally{X.close()}}import{join as Oj}from"path";import Dj from"open";n();function Ij($){if(process.env.CI)return!1;try{return Dj($).catch(()=>{return}),!0}catch{return!1}}function cG($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
394
394
 
395
- Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=Yj(Z,z)}catch(W){console.error(`Error: ${W.message}`),process.exit(1);return}W2(X.outputPath===null?void 0:Z.output);let J=D5("faf-git-"),Y=h9(J,"repo");try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{kG("git",Jj(Q,Y,Z.ref),{stdio:"pipe"})}catch(V){let K=(V?.stderr?.toString()??"").trim().split(`
395
+ Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=o(Z),X=s(Z,()=>O0(l(Z)));XZ(z,Q,X,Z,{force:$.force});let J=Oj(z,"project.html"),Y=Ij(J);console.log(" project.html"),console.log(Y?`${T("opened")} ${M("in your browser")}`:`${T("rendered")} ${M(`file://${J}`)}`)}import{existsSync as Tj}from"fs";import{join as n9,resolve as Aj}from"path";import{execFileSync as iG}from"child_process";function pG($){let Z=($??"").trim();if(!Z)throw Error("Please provide a GitHub URL.");if(/[\s;&|`$(){}<>\\^'"!*?[\]]/.test(Z))throw Error(`Refusing unsafe URL: ${JSON.stringify($)}`);let z=Z.replace(/\/+$/,"").replace(/\.git$/i,""),Q=z.match(/^(?:github\.com\/)?([A-Za-z0-9][A-Za-z0-9._-]*)\/([A-Za-z0-9][A-Za-z0-9._-]*)$/);if(Q)return`https://github.com/${Q[1]}/${Q[2]}.git`;if(/^https?:\/\/[A-Za-z0-9._\-/:@~%]+$/.test(z))return`${z}.git`;throw Error(`Not a recognized GitHub repo URL: ${JSON.stringify($)}`)}function lG($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function dG($,Z={}){let z=h$($);if(Z.repoUrl&&z.project&&!Y2($)?.name&&z.project.name===$.split("/").pop())z.project.name=lG(Z.repoUrl);return z}n();function Cj($){let Z;try{Z=iG("git",["-C",$,"ls-files","-s","-z"],{stdio:["ignore","pipe","pipe"]}).toString()}catch{return 0}let z=0;for(let Q of Z.split("\x00")){if(!Q.startsWith("120000 "))continue;let X=Q.indexOf("\t");if(X<0)continue;let J=n9($,Q.slice(X+1)),Y=k0(J);if(Y===null)continue;try{if(D5(J,{root:$,expect:Y}))z++}catch{}}return z}function _j($,Z,z){return["clone","-c","core.symlinks=false","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function Rj($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?Aj(Z,$.output):n9(Z,"project.faf");if(Tj(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
396
+ `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function nG($,Z={},z=process.cwd()){let Q;try{Q=pG($)}catch(W){console.error(`Error: ${W.message}
397
+
398
+ Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=Rj(Z,z)}catch(W){console.error(`Error: ${W.message}`),process.exit(1);return}U2(X.outputPath===null?void 0:Z.output);let J=I5("faf-git-"),Y=n9(J,"repo");try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{iG("git",_j(Q,Y,Z.ref),{stdio:"pipe"})}catch(V){let K=(V?.stderr?.toString()??"").trim().split(`
396
399
  `).slice(-2).join(" ").trim()||"git clone failed",q=Z.ref?`
397
400
 
398
401
  (does the branch/tag '${Z.ref}' exist?)`:"";console.error(`Error: could not clone ${$}
399
402
 
400
- ${K}${q}`),process.exit(1)}Xj(Y);let W=yG(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(j3(W));return}M0(X.outputPath,W,{replace:Z.force===!0}),console.log(`${T("created")} ${X.outputPath}`);let U=p(X.outputPath),G=n(X.outputPath,()=>b0(F0(U)));S0(G,X.outputPath)}finally{O5(J)}}import{execFileSync as y2}from"child_process";import{readFileSync as Wj,existsSync as Uj}from"fs";import{dirname as Gj,resolve as Vj}from"path";var l$=($)=>String($).trim(),Hj="slotignored",vG=($)=>G0($)||typeof $==="string"&&$.trim().toLowerCase()===Hj;function Kj($,Z){let z=[],Q=0,X=0;for(let J of J0){let Y=n1($,J),W=n1(Z,J),U=!vG(Y),G=!vG(W);if(U)Q++;if(G)X++;let V=J.label??J.path.split(".").pop()??J.path,H={path:J.path,label:V,category:String(J.category)};if(!U&&G)z.push({...H,kind:"added",to:l$(W)});else if(U&&!G)z.push({...H,kind:"removed",from:l$(Y)});else if(U&&G&&l$(Y)!==l$(W))z.push({...H,kind:"changed",from:l$(Y),to:l$(W)})}return{changes:z,filledBase:Q,filledTarget:X}}function gG($){if(!$.trim())return 0;try{return D0($).score??0}catch{return 0}}function hG($){if(!$.trim())return{};try{return X2($)??{}}catch{return{}}}function KZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=Kj(hG($),hG(Z)),J=gG($),Y=gG(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var qj={added:"+",removed:"-",changed:"~"},fG=($)=>$>0?`+${$}`:`${$}`,VZ=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function mG($,Z,z){let Q=[],X=I2(q6($.scoreBase)),J=I2(q6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${fG($.scoreDelta)})`),Q.push(""),$.changes.length===0)Q.push(" (no slot changes)");else{let Y="";for(let W of $.changes){if(W.category!==Y)Q.push(` ${W.category}`),Y=W.category;let U=qj[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")Q.push(` ${U} ${G} ${VZ(W.from)} → ${VZ(W.to)}`);else if(W.kind==="added")Q.push(` ${U} ${G} ${VZ(W.to)} (added)`);else Q.push(` ${U} ${G} ${VZ(W.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${fG($.filledTarget-$.filledBase)})`),Q.join(`
401
- `)}function Bj($,Z){try{return y2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function C4($,Z){if(!Bj($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function d$($,Z,z){try{return y2("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function cG($){let Z=$[0]??"project.faf";try{if($.length<5){console.log(`${Z} — unmerged (resolve the conflict, then \`faf diff\`)`);return}let z=(J)=>J&&J!=="/dev/null"&&Uj(J)?Wj(J,"utf-8"):"",Q=(J,Y)=>{if(!J||J==="/dev/null")return"(absent)";if(!Y||/^0+$/.test(Y))return"(working tree)";return Y.slice(0,7)},X=KZ(z($[1]),z($[4]));console.log(mG(X,Q($[1],$[2]),Q($[4],$[5])))}catch(z){console.log(`${Z} — faf diff unavailable (${z instanceof Error?z.message:"error"})`)}}var HZ="*.faf diff=faf";function f9($){let[Z,...z]=$.trim().split(/\s+/);try{return y2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function pG($){try{return y2("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}catch{throw console.error("Error: not a git repository."),process.exit(2),Error("unreachable")}}var o0="faf-cli diff-driver";function lG($,Z,z){try{return y2("git",["config","--null",...Z],{cwd:$,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch(Q){if(Q.status===1)return"";let X=String(Q.stderr??"").trim().split(`
402
- `)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function u9($,Z=!1){return lG($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function Mj($){let z=lG($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
403
- `)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var dG=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function Lj($){let Z=l($,".gitattributes"),z=N6(Z),Q=z??"";if(Q.split(`
404
- `).some((Y)=>Y.trim()===HZ)){console.log(`• .gitattributes already opts in (${HZ})`);return}let X=Q.includes(`\r
403
+ ${K}${q}`),process.exit(1)}Cj(Y);let W=dG(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(k3(W));return}M0(X.outputPath,W,{replace:Z.force===!0}),console.log(`${T("created")} ${X.outputPath}`);let U=l(X.outputPath),G=s(X.outputPath,()=>b0(P0(U)));S0(G,X.outputPath)}finally{T5(J)}}import{execFileSync as k2}from"child_process";import{readFileSync as Fj,existsSync as Pj}from"fs";import{dirname as Sj,resolve as Ej}from"path";var n$=($)=>String($).trim(),jj="slotignored",rG=($)=>G0($)||typeof $==="string"&&$.trim().toLowerCase()===jj;function wj($,Z){let z=[],Q=0,X=0;for(let J of J0){let Y=o1($,J),W=o1(Z,J),U=!rG(Y),G=!rG(W);if(U)Q++;if(G)X++;let V=J.label??J.path.split(".").pop()??J.path,H={path:J.path,label:V,category:String(J.category)};if(!U&&G)z.push({...H,kind:"added",to:n$(W)});else if(U&&!G)z.push({...H,kind:"removed",from:n$(Y)});else if(U&&G&&n$(Y)!==n$(W))z.push({...H,kind:"changed",from:n$(Y),to:n$(W)})}return{changes:z,filledBase:Q,filledTarget:X}}function sG($){if(!$.trim())return 0;try{return O0($).score??0}catch{return 0}}function oG($){if(!$.trim())return{};try{return X2($)??{}}catch{return{}}}function LZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=wj(oG($),oG(Z)),J=sG($),Y=sG(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var xj={added:"+",removed:"-",changed:"~"},aG=($)=>$>0?`+${$}`:`${$}`,BZ=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function eG($,Z,z){let Q=[],X=T2(M6($.scoreBase)),J=T2(M6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${aG($.scoreDelta)})`),Q.push(""),$.changes.length===0)Q.push(" (no slot changes)");else{let Y="";for(let W of $.changes){if(W.category!==Y)Q.push(` ${W.category}`),Y=W.category;let U=xj[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")Q.push(` ${U} ${G} ${BZ(W.from)} → ${BZ(W.to)}`);else if(W.kind==="added")Q.push(` ${U} ${G} ${BZ(W.to)} (added)`);else Q.push(` ${U} ${G} ${BZ(W.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${aG($.filledTarget-$.filledBase)})`),Q.join(`
404
+ `)}function yj($,Z){try{return k2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function R4($,Z){if(!yj($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function r$($,Z,z){try{return k2("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function $V($){let Z=$[0]??"project.faf";try{if($.length<5){console.log(`${Z} — unmerged (resolve the conflict, then \`faf diff\`)`);return}let z=(J)=>J&&J!=="/dev/null"&&Pj(J)?Fj(J,"utf-8"):"",Q=(J,Y)=>{if(!J||J==="/dev/null")return"(absent)";if(!Y||/^0+$/.test(Y))return"(working tree)";return Y.slice(0,7)},X=LZ(z($[1]),z($[4]));console.log(eG(X,Q($[1],$[2]),Q($[4],$[5])))}catch(z){console.log(`${Z} — faf diff unavailable (${z instanceof Error?z.message:"error"})`)}}var MZ="*.faf diff=faf";function r9($){let[Z,...z]=$.trim().split(/\s+/);try{return k2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function ZV($){try{return k2("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}catch{throw console.error("Error: not a git repository."),process.exit(2),Error("unreachable")}}var o0="faf-cli diff-driver";function zV($,Z,z){try{return k2("git",["config","--null",...Z],{cwd:$,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch(Q){if(Q.status===1)return"";let X=String(Q.stderr??"").trim().split(`
405
+ `)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function s9($,Z=!1){return zV($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function kj($){let z=zV($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
406
+ `)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var QV=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function bj($){let Z=d($,".gitattributes"),z=D6(Z),Q=z??"";if(Q.split(`
407
+ `).some((Y)=>Y.trim()===MZ)){console.log(`• .gitattributes already opts in (${MZ})`);return}let X=Q.includes(`\r
405
408
  `)?`\r
406
409
  `:`
407
410
  `,J=`${Q}${Q&&!Q.endsWith(`
408
- `)?X:""}${HZ}${X}`;a(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${HZ}`)}function Nj($){let Z=pG($),z;try{z=u9($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===o0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${dG(z)}, not faf's driver (${o0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=Mj($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}if(X.length>0)return console.error(`faf: your git config already has ${X.join(", ")} — a diff driver setting of your own, so faf left your git config and .gitattributes unchanged.`),!1;if(Lj(Z),Q)console.log(`• git config already set (diff.faf.command = ${o0})`);else y2("git",["config","diff.faf.command",o0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${o0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!f9(o0))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.");return!0}var Dj='[diff "faf"]',Oj=` command = ${o0}`,iG=($)=>/\r(?!\n)/.test($),Ij=($)=>(/\\+$/.exec(U2($))?.[0].length??0)%2===1;function Tj($){if(iG($))return null;let Z=a6($),z=Z.map((V,H)=>H>0&&Ij(Z[H-1])),Q=Z.map((V,H)=>!z[H]&&U2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,H)=>{if(Q[H])J=U2(V)===Dj?H:-1;else if(J>=0&&!z[H]&&U2(V)===Oj)X.push({at:H,head:J})}),X.length!==1)return null;let{at:Y,head:W}=X[0],U=Y+1;while(U<Z.length&&!Q[U])U++;if(Z.slice(W+1,U).some((V,H)=>W+1+H!==Y&&U2(V).trim()!==""))return null;return Z.filter((V,H)=>H!==W&&H!==Y).join("")}function uG($,Z){try{return y2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function Aj($,Z,z){let Q=uG($,Z),X=uG($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
409
- ${o0}`,Y=Q.indexOf(J);if(Y<0||Q.lastIndexOf(J)!==Y)return!1;let W=[...Q.slice(0,Y),...Q.slice(Y+1)];return W.length===X.length&&W.every((U,G)=>U===X[G])}function Cj($){let Z=u9($,!0);if(Z.length!==1||Z[0]!==o0)return`diff.faf.command = ${o0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=Vj($,y2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=Gj(z);try{let X=l(Q,z,{allowGitConfig:!0}),J=Q0(X);if(iG(J))return`${X} has a carriage return (CR) that does not end a line, so faf and git could read its lines differently — faf left your git config unchanged.`;let Y=Tj(J);if(Y===null||!Aj($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${o0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return a(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof b||X instanceof f2)return X.message;throw X}}function _j($){pG($);let Z;try{Z=u9($)}catch(Q){return console.error(`faf: ${Q.message} — faf left your git config unchanged.`),!1}if(Z.length===0)return console.log("• diff.faf.command is not set — nothing to remove (the .gitattributes line, if any, is left for you to keep or delete)."),!0;if(Z.length!==1||Z[0]!==o0)return console.error(`faf: diff.faf.command is ${dG(Z)}, not faf's driver (${o0}) — faf left your git config unchanged.`),!1;let z;try{z=Cj($)}catch(Q){z=`${Q.message.split(`
410
- `)[0]} — faf left your git config unchanged.`}if(z!==null)return console.error(`faf: ${z}`),!1;return console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete)."),!0}function nG($,Z={},z=process.cwd()){if(Z.installDriver){if(!Nj(z))process.exit(1);return}if(Z.uninstallDriver){if(!_j(z))process.exit(1);return}let Q=f(z);if(!Q)console.error(`Error: project.faf not found
411
+ `)?X:""}${MZ}${X}`;a(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${MZ}`)}function vj($){let Z=ZV($),z;try{z=s9($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===o0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${QV(z)}, not faf's driver (${o0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=kj($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}if(X.length>0)return console.error(`faf: your git config already has ${X.join(", ")} — a diff driver setting of your own, so faf left your git config and .gitattributes unchanged.`),!1;if(bj(Z),Q)console.log(`• git config already set (diff.faf.command = ${o0})`);else k2("git",["config","diff.faf.command",o0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${o0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!r9(o0))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.");return!0}var gj='[diff "faf"]',hj=` command = ${o0}`,XV=($)=>/\r(?!\n)/.test($),fj=($)=>(/\\+$/.exec(G2($))?.[0].length??0)%2===1;function uj($){if(XV($))return null;let Z=e6($),z=Z.map((V,H)=>H>0&&fj(Z[H-1])),Q=Z.map((V,H)=>!z[H]&&G2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,H)=>{if(Q[H])J=G2(V)===gj?H:-1;else if(J>=0&&!z[H]&&G2(V)===hj)X.push({at:H,head:J})}),X.length!==1)return null;let{at:Y,head:W}=X[0],U=Y+1;while(U<Z.length&&!Q[U])U++;if(Z.slice(W+1,U).some((V,H)=>W+1+H!==Y&&G2(V).trim()!==""))return null;return Z.filter((V,H)=>H!==W&&H!==Y).join("")}function tG($,Z){try{return k2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function mj($,Z,z){let Q=tG($,Z),X=tG($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
412
+ ${o0}`,Y=Q.indexOf(J);if(Y<0||Q.lastIndexOf(J)!==Y)return!1;let W=[...Q.slice(0,Y),...Q.slice(Y+1)];return W.length===X.length&&W.every((U,G)=>U===X[G])}function cj($){let Z=s9($,!0);if(Z.length!==1||Z[0]!==o0)return`diff.faf.command = ${o0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=Ej($,k2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=Sj(z);try{let X=d(Q,z,{allowGitConfig:!0}),J=Q0(X);if(XV(J))return`${X} has a carriage return (CR) that does not end a line, so faf and git could read its lines differently — faf left your git config unchanged.`;let Y=uj(J);if(Y===null||!mj($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${o0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return a(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof v||X instanceof u2)return X.message;throw X}}function pj($){ZV($);let Z;try{Z=s9($)}catch(Q){return console.error(`faf: ${Q.message} — faf left your git config unchanged.`),!1}if(Z.length===0)return console.log("• diff.faf.command is not set — nothing to remove (the .gitattributes line, if any, is left for you to keep or delete)."),!0;if(Z.length!==1||Z[0]!==o0)return console.error(`faf: diff.faf.command is ${QV(Z)}, not faf's driver (${o0}) — faf left your git config unchanged.`),!1;let z;try{z=cj($)}catch(Q){z=`${Q.message.split(`
413
+ `)[0]} — faf left your git config unchanged.`}if(z!==null)return console.error(`faf: ${z}`),!1;return console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete)."),!0}function JV($,Z={},z=process.cwd()){if(Z.installDriver){if(!vj(z))process.exit(1);return}if(Z.uninstallDriver){if(!pj(z))process.exit(1);return}let Q=u(z);if(!Q)console.error(`Error: project.faf not found
411
414
 
412
- Run 'faf init' to create one.`),process.exit(2);let X;try{X=y2("git",["rev-parse","--show-toplevel"],{cwd:z,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 J=E$(Q,z),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=d$("HEAD",J,z),G=p(Q);else if($.includes("...")){let[H,K]=$.split("...");C4(H,z),C4(K,z);let q;try{q=y2("git",["merge-base",H,K],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${H}' and '${K}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=q.slice(0,7),W=K,U=d$(q,J,z),G=d$(K,J,z)}else if($.includes("..")){let[H,K]=$.split("..");C4(H,z),C4(K,z),Y=H,W=K,U=d$(H,J,z),G=d$(K,J,z)}else C4($,z),Y=$,W="(working tree)",U=d$($,J,z),G=p(Q);let V=KZ(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...V},null,2));else console.log(mG(V,Y,W))}import{execFileSync as m9}from"child_process";function Rj($){if(!$.trim())return 0;try{return D0($).score??0}catch{return 0}}var Pj=($)=>$>0?`+${$}`:`${$}`;function Fj($){let Z=$.map((z)=>({...z,score:Rj(z.raw)}));return Z.map((z,Q)=>{let X=Z[Q+1];return{hex:z.hex,date:z.date,subject:z.subject,score:z.score,delta:X?z.score-X.score:null,first:!X}})}function Sj($,Z="project.faf"){if($.length===0)return`${Z} — no history (no commits touch it yet)`;let z=[];z.push(`${Z} — score timeline (${$.length} commit${$.length===1?"":"s"})`),z.push("");for(let Q of $){let X=`${String(Q.score).padStart(3)}%`,J=Q.first?" new ":Q.delta===0?" ·":Pj(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${I2(q6(Q.score))} ${Q.subject}`)}return z.join(`
413
- `)}function Ej($,Z,z){try{return m9("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function rG($={},Z=process.cwd()){let z=f(Z);if(!z)console.error(`Error: project.faf not found
415
+ Run 'faf init' to create one.`),process.exit(2);let X;try{X=k2("git",["rev-parse","--show-toplevel"],{cwd:z,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 J=y$(Q,z),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=r$("HEAD",J,z),G=l(Q);else if($.includes("...")){let[H,K]=$.split("...");R4(H,z),R4(K,z);let q;try{q=k2("git",["merge-base",H,K],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${H}' and '${K}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=q.slice(0,7),W=K,U=r$(q,J,z),G=r$(K,J,z)}else if($.includes("..")){let[H,K]=$.split("..");R4(H,z),R4(K,z),Y=H,W=K,U=r$(H,J,z),G=r$(K,J,z)}else R4($,z),Y=$,W="(working tree)",U=r$($,J,z),G=l(Q);let V=LZ(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...V},null,2));else console.log(eG(V,Y,W))}import{execFileSync as o9}from"child_process";function lj($){if(!$.trim())return 0;try{return O0($).score??0}catch{return 0}}var dj=($)=>$>0?`+${$}`:`${$}`;function ij($){let Z=$.map((z)=>({...z,score:lj(z.raw)}));return Z.map((z,Q)=>{let X=Z[Q+1];return{hex:z.hex,date:z.date,subject:z.subject,score:z.score,delta:X?z.score-X.score:null,first:!X}})}function nj($,Z="project.faf"){if($.length===0)return`${Z} — no history (no commits touch it yet)`;let z=[];z.push(`${Z} — score timeline (${$.length} commit${$.length===1?"":"s"})`),z.push("");for(let Q of $){let X=`${String(Q.score).padStart(3)}%`,J=Q.first?" new ":Q.delta===0?" ·":dj(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${T2(M6(Q.score))} ${Q.subject}`)}return z.join(`
416
+ `)}function rj($,Z,z){try{return o9("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function YV($={},Z=process.cwd()){let z=u(Z);if(!z)console.error(`Error: project.faf not found
414
417
 
415
- Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=m9("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 X=E$(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=m9("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
416
- `).filter(Boolean).map((q)=>{let[L,B,N]=q.split("\x1F");return{hex:L,date:B,subject:N??""}}),U=J>0?Math.min(W.length,J+1):W.length,G=W.slice(0,U).map((q)=>({...q,raw:Ej(q.hex,X,Z)})),V=Fj(G),H=J>0?V.slice(0,J):V;if($.reverse)H=[...H].reverse();let K=W.length;if($.json)console.log(JSON.stringify({file:X,total:K,count:H.length,entries:H},null,2));else{let q=Sj(H,X.split("/").pop()??"project.faf");if(J>0&&K>H.length)q+=`
418
+ Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=o9("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 X=y$(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=o9("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
419
+ `).filter(Boolean).map((q)=>{let[L,B,N]=q.split("\x1F");return{hex:L,date:B,subject:N??""}}),U=J>0?Math.min(W.length,J+1):W.length,G=W.slice(0,U).map((q)=>({...q,raw:rj(q.hex,X,Z)})),V=ij(G),H=J>0?V.slice(0,J):V;if($.reverse)H=[...H].reverse();let K=W.length;if($.json)console.log(JSON.stringify({file:X,total:K,count:H.length,entries:H},null,2));else{let q=nj(H,X.split("/").pop()??"project.faf");if(J>0&&K>H.length)q+=`
417
420
 
418
- … showing ${H.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(q)}}import{execFileSync as _4}from"child_process";import{existsSync as p9,readFileSync as jj,realpathSync as sG,statSync as tG}from"fs";import{resolve as eG,dirname as l9,relative as wj,isAbsolute as xj,sep as yj}from"path";var d9="# >>> faf >>>",$V="# <<< faf <<<",c9=`#!/bin/sh
419
- `,oG="faf-cli hooks-run",kj=($)=>$>0?`+${$}`:`${$}`;function ZV($){return _4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function aG($,Z){try{return _4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function zV($,Z){try{return _4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function i9($){let Z=_4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return eG($,Z)}function bj($,Z){let z=_4("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=sG.native(eG($,z)),X=sG.native(Z),J=wj(Q,X);return{out:J===".."||J.startsWith(`..${yj}`)||xj(J),real:X}}function QV($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===d9)Z.push(Q);if(J===$V)z.push(Q+X.length);Q+=X.length}if(Z.length===0&&z.length===0)return null;if(Z.length!==1||z.length!==1||z[0]<=Z[0])return"broken";return{start:Z[0],end:z[0]}}function vj($,Z){if(!Z)return 493;let z=tG($).mode&511;return z|(z&292)>>2}function XV($){try{let Z=l(l9($),$,{allowGitHooks:!0});return{real:Z,text:N6(Z)}}catch(Z){if(Z instanceof b)return`${Z.message} faf left the hook as it is.`;throw Z}}function JV($,Z,z,Q){try{return a($,Z,{root:l9($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof b||X instanceof f2)return X.message;throw X}}var YV="has a faf marker line without its pair (or more than one faf block) — faf cannot tell its section from yours, so it left the hook as it is. Fix the marker lines by hand.";function WV($={},Z=process.cwd()){try{let z;try{z=ZV(Z)}catch{return}let Q=f(Z);if(!Q)return;let X=E$(Q,Z),J=aG(`:${X}`,Z);if(J===null)return;let Y=aG(`HEAD:${X}`,Z)??"",W=KZ(Y,J),U=`${W.scoreBase}% → ${W.scoreTarget}% (${kj(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(z){console.error(`faf hooks: skipped (${z instanceof Error?z.message:"error"})`)}}function gj($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[d9,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",$V,""].join(`
420
- `)}function hj($,Z={}){let z;try{z=ZV($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=zV("core.hooksPath",$);if(Q){let L=Z.runnerCmd??oG;return console.error(`Error: core.hooksPath is set (${Q}) — 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(` ${L}${Z.strict?" --strict":""}`),!1}let X=i9($),J=Z.runnerCmd??oG;if(!f9(J)){let L=J.trim().split(/\s+/)[0];if(Z.strict)return console.error(`Error: \`${L}\` 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(`⚠ \`${L}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=gj(J,!!Z.strict),W=l9(X);if(!p9(W))return console.error(`Error: ${W} does not exist — faf does not create folders inside .git. Create it (mkdir -p) and re-run.`),!1;let U=XV(X);if(typeof U==="string")return console.error(`Error: ${U}`),!1;let{real:G,text:V}=U,H=V===null?null:QV(V);if(H==="broken")return console.error(`Error: ${X} ${YV}`),!1;let K;if(V===null)K=`${c9}${Y}`;else if(H)K=V.slice(0,H.start)+Y+V.slice(H.end);else{let L=bj($,W);if(L.out)return console.error(`Error: ${X} is in a hooks folder outside this repo (${L.real}) and faf did not write it — faf left it as it is. Add \`${J}${Z.strict?" --strict":""}\` to it yourself.`),!1;if(V.trim()==="")K=`${c9}${Y}${V}`;else K=V.endsWith(`
421
+ … showing ${H.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(q)}}import{execFileSync as F4}from"child_process";import{existsSync as t9,readFileSync as sj,realpathSync as WV,statSync as VV}from"fs";import{resolve as HV,dirname as e9,relative as oj,isAbsolute as aj,sep as tj}from"path";var $z="# >>> faf >>>",KV="# <<< faf <<<",a9=`#!/bin/sh
422
+ `,UV="faf-cli hooks-run",ej=($)=>$>0?`+${$}`:`${$}`;function qV($){return F4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function GV($,Z){try{return F4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function BV($,Z){try{return F4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function Zz($){let Z=F4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return HV($,Z)}function $w($,Z){let z=F4("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=WV.native(HV($,z)),X=WV.native(Z),J=oj(Q,X);return{out:J===".."||J.startsWith(`..${tj}`)||aj(J),real:X}}function MV($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===$z)Z.push(Q);if(J===KV)z.push(Q+X.length);Q+=X.length}if(Z.length===0&&z.length===0)return null;if(Z.length!==1||z.length!==1||z[0]<=Z[0])return"broken";return{start:Z[0],end:z[0]}}function Zw($,Z){if(!Z)return 493;let z=VV($).mode&511;return z|(z&292)>>2}function LV($){try{let Z=d(e9($),$,{allowGitHooks:!0});return{real:Z,text:D6(Z)}}catch(Z){if(Z instanceof v)return`${Z.message} faf left the hook as it is.`;throw Z}}function NV($,Z,z,Q){try{return a($,Z,{root:e9($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof v||X instanceof u2)return X.message;throw X}}var OV="has a faf marker line without its pair (or more than one faf block) — faf cannot tell its section from yours, so it left the hook as it is. Fix the marker lines by hand.";function DV($={},Z=process.cwd()){try{let z;try{z=qV(Z)}catch{return}let Q=u(Z);if(!Q)return;let X=y$(Q,Z),J=GV(`:${X}`,Z);if(J===null)return;let Y=GV(`HEAD:${X}`,Z)??"",W=LZ(Y,J),U=`${W.scoreBase}% → ${W.scoreTarget}% (${ej(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(z){console.error(`faf hooks: skipped (${z instanceof Error?z.message:"error"})`)}}function zw($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[$z,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",KV,""].join(`
423
+ `)}function Qw($,Z={}){let z;try{z=qV($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=BV("core.hooksPath",$);if(Q){let L=Z.runnerCmd??UV;return console.error(`Error: core.hooksPath is set (${Q}) — 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(` ${L}${Z.strict?" --strict":""}`),!1}let X=Zz($),J=Z.runnerCmd??UV;if(!r9(J)){let L=J.trim().split(/\s+/)[0];if(Z.strict)return console.error(`Error: \`${L}\` 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(`⚠ \`${L}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=zw(J,!!Z.strict),W=e9(X);if(!t9(W))return console.error(`Error: ${W} does not exist — faf does not create folders inside .git. Create it (mkdir -p) and re-run.`),!1;let U=LV(X);if(typeof U==="string")return console.error(`Error: ${U}`),!1;let{real:G,text:V}=U,H=V===null?null:MV(V);if(H==="broken")return console.error(`Error: ${X} ${OV}`),!1;let K;if(V===null)K=`${a9}${Y}`;else if(H)K=V.slice(0,H.start)+Y+V.slice(H.end);else{let L=$w($,W);if(L.out)return console.error(`Error: ${X} is in a hooks folder outside this repo (${L.real}) and faf did not write it — faf left it as it is. Add \`${J}${Z.strict?" --strict":""}\` to it yourself.`),!1;if(V.trim()==="")K=`${a9}${Y}${V}`;else K=V.endsWith(`
421
424
  `)?`${V}
422
425
  ${Y}`:`${V}
423
426
 
424
- ${Y}`}let q=JV(X,K,V,vj(G,V!==null));if(q)return console.error(`Error: ${q}`),!1;return 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 fj($,Z){if($===c9&&Z.trim()==="")return"";return $.endsWith(`
427
+ ${Y}`}let q=NV(X,K,V,Zw(G,V!==null));if(q)return console.error(`Error: ${q}`),!1;return 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 Xw($,Z){if($===a9&&Z.trim()==="")return"";return $.endsWith(`
425
428
 
426
- `)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function uj($){let Z;try{Z=i9($)}catch{return console.error("Error: not a git repository."),!1}if(!p9(Z))return console.log("• no pre-commit hook to clean."),!0;let z=XV(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:QV(X);if(J==="broken")return console.error(`Error: ${Z} ${YV}`),!1;if(X===null||J===null)return console.log("• faf block not found in pre-commit — nothing to remove."),!0;let Y=X.slice(J.end),W=JV(Z,fj(X.slice(0,J.start),Y)+Y,X,tG(Q).mode&511);if(W)return console.error(`Error: ${W}`),!1;return console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function mj($){let Z;try{Z=i9($)}catch{console.error("Error: not a git repository.");return}let z=zV("core.hooksPath",$),Q=p9(Z)?jj(Z,"utf-8"):"",X=Q.includes(d9),J=/hooks-run --strict/.test(Q);if(console.log("faf pre-commit context guard"),console.log(` installed: ${X?`yes (${J?"strict":"warn"})`:"no"}`),z)console.log(` ⚠ core.hooksPath = ${z} (a hook manager owns hooks — faf won't install here)`);if(!X&&!z)console.log(" → `faf hooks --install` (add --strict to block on regression)")}function UV($={}){let Z=process.cwd();if($.install){if(!hj(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!uj(Z))process.exit(2);return}mj(Z)}i();function GV($={}){if($.version||Object.keys($).length===0)pj()}function pj(){let $=n9();console.log(`${T(C("faf"))} v${$.version}`),console.log(M(`kernel ${tY()} IANA application/vnd.faf+yaml`))}var R4=[{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"}];i();function VV(){console.log(`${T("formats")} ${M("— supported file types")}
427
- `);let $=new Map;for(let Z of R4){let z=$.get(Z.category)??[];z.push(Z),$.set(Z.category,z)}for(let[Z,z]of $){console.log(` ${C(Z)}`);for(let Q of z)console.log(` ${Q.name} ${M(Q.extensions.join(", "))}`);console.log()}console.log(M(` ${R4.length} formats across ${$.size} categories`))}i();function HV(){let $=0;try{$=qY("faf-git-")}catch{}if($>0)console.log(`${T("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function KV($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
429
+ `)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function Jw($){let Z;try{Z=Zz($)}catch{return console.error("Error: not a git repository."),!1}if(!t9(Z))return console.log("• no pre-commit hook to clean."),!0;let z=LV(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:MV(X);if(J==="broken")return console.error(`Error: ${Z} ${OV}`),!1;if(X===null||J===null)return console.log("• faf block not found in pre-commit — nothing to remove."),!0;let Y=X.slice(J.end),W=NV(Z,Xw(X.slice(0,J.start),Y)+Y,X,VV(Q).mode&511);if(W)return console.error(`Error: ${W}`),!1;return console.log("✅ faf pre-commit block removed (other hook content preserved)."),!0}function Yw($){let Z;try{Z=Zz($)}catch{console.error("Error: not a git repository.");return}let z=BV("core.hooksPath",$),Q=t9(Z)?sj(Z,"utf-8"):"",X=Q.includes($z),J=/hooks-run --strict/.test(Q);if(console.log("faf pre-commit context guard"),console.log(` installed: ${X?`yes (${J?"strict":"warn"})`:"no"}`),z)console.log(` ⚠ core.hooksPath = ${z} (a hook manager owns hooks — faf won't install here)`);if(!X&&!z)console.log(" → `faf hooks --install` (add --strict to block on regression)")}function IV($={}){let Z=process.cwd();if($.install){if(!Qw(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!Jw(Z))process.exit(2);return}Yw(Z)}n();function TV($={}){if($.version||Object.keys($).length===0)Uw()}function Uw(){let $=zz();console.log(`${T(C("faf"))} v${$.version}`),console.log(M(`kernel ${WW()} IANA application/vnd.faf+yaml`))}var P4=[{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"}];n();function AV(){console.log(`${T("formats")} ${M("— supported file types")}
430
+ `);let $=new Map;for(let Z of P4){let z=$.get(Z.category)??[];z.push(Z),$.set(Z.category,z)}for(let[Z,z]of $){console.log(` ${C(Z)}`);for(let Q of z)console.log(` ${Q.name} ${M(Q.extensions.join(", "))}`);console.log()}console.log(M(` ${P4.length} formats across ${$.size} categories`))}n();function CV(){let $=0;try{$=AY("faf-git-")}catch{}if($>0)console.log(`${T("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function _V($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
428
431
 
429
- Run 'faf init' to create one.`),process.exit(2);if($.json){let z=r(Z);console.log(JSON.stringify(z,null,2))}else{let z=p(Z);console.log(z)}}i();function qV(){let $=f();if(!$)console.error(`Error: project.faf not found
432
+ Run 'faf init' to create one.`),process.exit(2);if($.json){let z=o(Z);console.log(JSON.stringify(z,null,2))}else{let z=l(Z);console.log(z)}}n();function RV(){let $=u();if(!$)console.error(`Error: project.faf not found
430
433
 
431
- Run 'faf init' to create one.`),process.exit(2);let Z=r($),z=[];for(let Q of J0){let[X,J]=Q.path.split("."),W=Z[X]?.[J];if(G0(W)||W==="slotignored")continue;z.push(`${Q.path}: ${W}`)}if(z.length===0){console.log(M("no populated slots"));return}console.log(z.join(`
432
- `))}import{existsSync as lj,statSync as BV}from"fs";import{dirname as dj,join as ij}from"path";var nj=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],rj=1000;function MV($,Z=dj($)){let z=BV($).mtimeMs,Q=nj.map((X)=>{let J=ij(Z,X);if(!lj(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=BV(J).mtimeMs,W=Y-z,U;if(Math.abs(W)<rj)U="in-sync";else if(W>0)U="newer";else U="older";return{file:X,exists:!0,mtime_ms:Y,status:U,delta_ms:W}});return{source:$,source_mtime_ms:z,targets:Q,drifted:Q.filter((X)=>X.status==="newer"||X.status==="older").length,in_sync:Q.filter((X)=>X.status==="in-sync").length,missing:Q.filter((X)=>X.status==="missing").length}}i();function NV($={}){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
434
+ Run 'faf init' to create one.`),process.exit(2);let Z=o($),z=[];for(let Q of J0){let[X,J]=Q.path.split("."),W=Z[X]?.[J];if(G0(W)||W==="slotignored")continue;z.push(`${Q.path}: ${W}`)}if(z.length===0){console.log(M("no populated slots"));return}console.log(z.join(`
435
+ `))}import{existsSync as Gw,statSync as FV}from"fs";import{dirname as Vw,join as Hw}from"path";var Kw=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],qw=1000;function PV($,Z=Vw($)){let z=FV($).mtimeMs,Q=Kw.map((X)=>{let J=Hw(Z,X);if(!Gw(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=FV(J).mtimeMs,W=Y-z,U;if(Math.abs(W)<qw)U="in-sync";else if(W>0)U="newer";else U="older";return{file:X,exists:!0,mtime_ms:Y,status:U,delta_ms:W}});return{source:$,source_mtime_ms:z,targets:Q,drifted:Q.filter((X)=>X.status==="newer"||X.status==="older").length,in_sync:Q.filter((X)=>X.status==="in-sync").length,missing:Q.filter((X)=>X.status==="missing").length}}n();function EV($={}){let Z=u();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
433
436
 
434
- Run 'faf init' to create one.`);process.exit(2)}let z=MV(Z,process.cwd());if($.json){let Q=r(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}sj(z)}function sj($){console.log(`${T("drift")} ${M("— context file sync status")}
435
- `),console.log(` ${C(".faf")} ${M(LV($.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 z=M(LV(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${T("●")} ${Z.file} ${M("in sync")}`);else if(Z.status==="newer")console.log(` ${C("!")} ${Z.file} ${C("newer")} ${z}`);else console.log(` ${M("○")} ${Z.file} ${M("older")} ${z}`)}if($.drifted>0)console.log(M(`
436
- run ${C("'faf sync'")} to resolve drift`))}function LV($){let Z=Date.now()-$,z=Math.floor(Z/1000);if(z<60)return`${z}s ago`;let Q=Math.floor(z/60);if(Q<60)return`${Q}m ago`;let X=Math.floor(Q/60);if(X<24)return`${X}h ago`;return`${Math.floor(X/24)}d ago`}function r9($,Z){let z=Z.split("."),Q=$;for(let X of z){if(Q===null||Q===void 0||typeof Q!=="object")return;Q=Q[X]}return Q}function P4($,Z){let z=Z.split("."),Q=$;for(let X=0;X<z.length-1;X++){let J=Q[z[X]];if(J===null||J===void 0)return null;if(!$0(J))return{at:z.slice(0,X+1).join("."),value:J};Q=J}return null}function F4($,Z){return`cannot set ${$}: ${Z.at} is ${f6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function qZ($,Z,z){let Q=P4($,Z);if(Q)throw Error(F4(Z,Q));let X=Z.split("."),J=$;for(let Y=0;Y<X.length-1;Y++){if(J[X[Y]]===null||J[X[Y]]===void 0)J[X[Y]]={};J=J[X[Y]]}J[X[X.length-1]]=z}i();function DV($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
437
+ Run 'faf init' to create one.`);process.exit(2)}let z=PV(Z,process.cwd());if($.json){let Q=o(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}Bw(z)}function Bw($){console.log(`${T("drift")} ${M("— context file sync status")}
438
+ `),console.log(` ${C(".faf")} ${M(SV($.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 z=M(SV(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${T("●")} ${Z.file} ${M("in sync")}`);else if(Z.status==="newer")console.log(` ${C("!")} ${Z.file} ${C("newer")} ${z}`);else console.log(` ${M("○")} ${Z.file} ${M("older")} ${z}`)}if($.drifted>0)console.log(M(`
439
+ run ${C("'faf sync'")} to resolve drift`))}function SV($){let Z=Date.now()-$,z=Math.floor(Z/1000);if(z<60)return`${z}s ago`;let Q=Math.floor(z/60);if(Q<60)return`${Q}m ago`;let X=Math.floor(Q/60);if(X<24)return`${X}h ago`;return`${Math.floor(X/24)}d ago`}function Qz($,Z){let z=Z.split("."),Q=$;for(let X of z){if(Q===null||Q===void 0||typeof Q!=="object")return;Q=Q[X]}return Q}function S4($,Z){let z=Z.split("."),Q=$;for(let X=0;X<z.length-1;X++){let J=Q[z[X]];if(J===null||J===void 0)return null;if(!$0(J))return{at:z.slice(0,X+1).join("."),value:J};Q=J}return null}function E4($,Z){return`cannot set ${$}: ${Z.at} is ${m6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function NZ($,Z,z){let Q=S4($,Z);if(Q)throw Error(E4(Z,Q));let X=Z.split("."),J=$;for(let Y=0;Y<X.length-1;Y++){if(J[X[Y]]===null||J[X[Y]]===void 0)J[X[Y]]={};J=J[X[Y]]}J[X[X.length-1]]=z}n();function jV($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
437
440
 
438
- Example: faf edit project.name "My Project"`),process.exit(1);let z=f();if(!z)console.error(`Error: project.faf not found
441
+ Example: faf edit project.name "My Project"`),process.exit(1);let z=u();if(!z)console.error(`Error: project.faf not found
439
442
 
440
- Run 'faf init' to create one.`),process.exit(2);let Q=r(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=P4(Q,$);if(J)console.error(`Error: ${F4($,J)}`),process.exit(1);qZ(Q,$,Z);let Y=[];if(M0(z,Q,{onAliasKept:(W)=>Y.push(p0(W))}),Y.length>0){for(let W of Y)console.error(`Error: ${W}. Change the value its anchor holds, or replace the alias by hand.`);process.exit(1)}console.log(`${T("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as oj,lstatSync as aj}from"fs";import{join as o9}from"path";i();function tj($){try{return aj($),!0}catch{return!1}}function s9($,Z,z){if(!tj(o9($,Z)))return null;try{return Q0(l($,Z,{read:!0}))}catch(Q){if(!(Q instanceof b))throw Q;return console.error(L6(Q,!1)),z.push(Z),null}}function OV(){let $=process.cwd(),Z=[],z=[],Q={faf_version:B6,project:{}},X=s9($,"CLAUDE.md",z);if(X!==null){let G=a5(X);if(G.project?.name)Q.project.name=G.project.name;if(G.project?.goal)Q.project.goal=G.project.goal;if(G.project?.main_language)Q.project.main_language=G.project.main_language;Z.push("CLAUDE.md")}let J=s9($,"AGENTS.md",z);if(J!==null){if(!Q.project.name){let G=J.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("AGENTS.md")}let Y=s9($,"GEMINI.md",z);if(Y!==null){if(!Q.project.name){let G=Y.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("GEMINI.md")}let W=o9($,".cursorrules");if(oj(W))Z.push(".cursorrules");if(Z.length===0){if(z.length>0)console.error(`Nothing to recover from: ${z.join(", ")} ${z.length===1?"was":"were"} refused (above), and no other context file is there. Nothing was written.`),process.exit(1);console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2)}let U=f($);if(U){let G=r(U);if(!G.project)G.project={};if(Q.project.name&&!G.project.name)G.project.name=Q.project.name;if(Q.project.goal&&!G.project.goal)G.project.goal=Q.project.goal;if(Q.project.main_language&&!G.project.main_language)G.project.main_language=Q.project.main_language;M0(U,G,{onAliasKept:(V)=>console.log(M(` ${p0(V)}`))}),console.log(`${T("◆")} recover merged into ${U}`)}else{let G=o9($,"project.faf");M0(G,Q),console.log(`${T("◆")} recover created ${G}`)}console.log(M(` sources: ${Z.join(", ")}`))}i();var S4=B6;function IV($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
443
+ Run 'faf init' to create one.`),process.exit(2);let Q=o(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=S4(Q,$);if(J)console.error(`Error: ${E4($,J)}`),process.exit(1);NZ(Q,$,Z);let Y=[];if(M0(z,Q,{onAliasKept:(W)=>Y.push(p0(W))}),Y.length>0){for(let W of Y)console.error(`Error: ${W}. Change the value its anchor holds, or replace the alias by hand.`);process.exit(1)}console.log(`${T("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as Mw,lstatSync as Lw}from"fs";import{join as Jz}from"path";n();function Nw($){try{return Lw($),!0}catch{return!1}}function Xz($,Z,z){if(!Nw(Jz($,Z)))return null;try{return Q0(d($,Z,{read:!0}))}catch(Q){if(!(Q instanceof v))throw Q;return console.error(O6(Q,!1)),z.push(Z),null}}function wV(){let $=process.cwd(),Z=[],z=[],Q={faf_version:L6,project:{}},X=Xz($,"CLAUDE.md",z);if(X!==null){let G=e5(X);if(G.project?.name)Q.project.name=G.project.name;if(G.project?.goal)Q.project.goal=G.project.goal;if(G.project?.main_language)Q.project.main_language=G.project.main_language;Z.push("CLAUDE.md")}let J=Xz($,"AGENTS.md",z);if(J!==null){if(!Q.project.name){let G=J.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("AGENTS.md")}let Y=Xz($,"GEMINI.md",z);if(Y!==null){if(!Q.project.name){let G=Y.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("GEMINI.md")}let W=Jz($,".cursorrules");if(Mw(W))Z.push(".cursorrules");if(Z.length===0){if(z.length>0)console.error(`Nothing to recover from: ${z.join(", ")} ${z.length===1?"was":"were"} refused (above), and no other context file is there. Nothing was written.`),process.exit(1);console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2)}let U=u($);if(U){let G=o(U);if(!G.project)G.project={};if(Q.project.name&&!G.project.name)G.project.name=Q.project.name;if(Q.project.goal&&!G.project.goal)G.project.goal=Q.project.goal;if(Q.project.main_language&&!G.project.main_language)G.project.main_language=Q.project.main_language;M0(U,G,{onAliasKept:(V)=>console.log(M(` ${p0(V)}`))}),console.log(`${T("◆")} recover merged into ${U}`)}else{let G=Jz($,"project.faf");M0(G,Q),console.log(`${T("◆")} recover created ${G}`)}console.log(M(` sources: ${Z.join(", ")}`))}n();var j4=L6;function xV($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
441
444
 
442
- Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=z.faf_version??"unknown";if(Q===S4){console.log(`${T("◆")} migrate already at v${S4}`);return}if(z.faf_version=S4,!z.project)z.project={};if(!z.stack)z.stack={};if(!z.human_context)z.human_context={};if(!z.monorepo)z.monorepo={};if($.dryRun){console.log(`${T("◆")} migrate ${M("(dry run)")} v${Q} → v${S4}`),console.log(M(` would update ${Z}`));return}M0(Z,z,{onAliasKept:(X)=>console.log(M(` ${p0(X)}`))}),console.log(`${T("◆")} migrate v${Q} → v${S4}`),console.log(M(` updated ${Z}`))}i();function TV($){if($==="features")$w();else if($==="activate")Zw();else ej()}function ej(){let $=q4();if(console.log(`${T("pro")} ${M("— FAF Pro status")}
443
- `),console.log(` Status: ${$?P0(C("PRO")):C("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function $w(){console.log(`${T("pro")} ${M("— Pro features")}
444
- `);let $=[["tri-sync",".faf → CLAUDE.md + Claude Code's MEMORY.md (faf's block only)"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,z]of $)console.log(` ${T("◆")} ${C(Z)} ${M("—")} ${z}`);console.log("")}function Zw(){console.log(`${T("pro")} ${M("— activate")}
445
- `),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 zw}from"zlib";i();function AV($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
445
+ Run 'faf init' to create one.`),process.exit(2);let z=o(Z),Q=z.faf_version??"unknown";if(Q===j4){console.log(`${T("◆")} migrate already at v${j4}`);return}if(z.faf_version=j4,!z.project)z.project={};if(!z.stack)z.stack={};if(!z.human_context)z.human_context={};if(!z.monorepo)z.monorepo={};if($.dryRun){console.log(`${T("◆")} migrate ${M("(dry run)")} v${Q} → v${j4}`),console.log(M(` would update ${Z}`));return}M0(Z,z,{onAliasKept:(X)=>console.log(M(` ${p0(X)}`))}),console.log(`${T("◆")} migrate v${Q} → v${j4}`),console.log(M(` updated ${Z}`))}n();function yV($){if($==="features")Dw();else if($==="activate")Iw();else Ow()}function Ow(){let $=L4();if(console.log(`${T("pro")} ${M("— FAF Pro status")}
446
+ `),console.log(` Status: ${$?F0(C("PRO")):C("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function Dw(){console.log(`${T("pro")} ${M("— Pro features")}
447
+ `);let $=[["tri-sync",".faf → CLAUDE.md + Claude Code's MEMORY.md (faf's block only)"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,z]of $)console.log(` ${T("◆")} ${C(Z)} ${M("—")} ${z}`);console.log("")}function Iw(){console.log(`${T("pro")} ${M("— activate")}
448
+ `),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 Tw}from"zlib";n();function kV($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
446
449
 
447
- Run 'faf init' to create one.`),process.exit(2);let z=p(Z),X=zw(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${T("◆")} share ${M(Z)}
450
+ Run 'faf init' to create one.`),process.exit(2);let z=l(Z),X=Tw(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${T("◆")} share ${M(Z)}
448
451
  `),console.log(` ${J}`),$.copy)try{let{execSync:Y}=n0("child_process"),W=process.platform;if(W==="darwin")Y("pbcopy",{input:J});else if(W==="linux")Y("xclip -selection clipboard",{input:J});console.log(M(`
449
452
  copied to clipboard`))}catch{console.log(M(`
450
- copy failed — install xclip or pbcopy`))}}import{join as Qw}from"path";i();function CV(){let $=D5("faf-demo-");console.log(`${T("demo")} ${M("— FAF in action")}
453
+ copy failed — install xclip or pbcopy`))}}import{join as Aw}from"path";n();function bV(){let $=I5("faf-demo-");console.log(`${T("demo")} ${M("— FAF in action")}
451
454
  `);let Z=`faf_version: 2.5.0
452
455
  project:
453
456
  name: acme-app
@@ -486,18 +489,18 @@ human_context:
486
489
  where: Cloud (Vercel + AWS)
487
490
  when: "2026"
488
491
  how: Agile sprints with CI/CD
489
- `,z=Qw($,"project.faf");a(z,Z,{root:$,expect:null}),console.log(` ${C("1.")} Created sample project.faf`),console.log(M(` ${z}
490
- `)),console.log(` ${C("2.")} Scoring...`);let Q=n(z,()=>b0(F0(p(z))));console.log(""),S0(Q,"project.faf",!0),O5($),console.log(`
491
- ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}i();function _V($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let z=$.toLowerCase(),Q=!Z.slots&&!Z.formats,X=0;if(Q||Z.slots){let J=J0.filter((Y)=>Y.path.toLowerCase().includes(z)||Y.description.toLowerCase().includes(z)||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${T("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
492
- `);for(let Y of J)console.log(` ${C(`#${Y.index}`)} ${Y.path} ${M("—")} ${Y.description} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(Q||Z.formats){let J=R4.filter((Y)=>Y.name.toLowerCase().includes(z)||Y.extensions.some((W)=>W.toLowerCase().includes(z))||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${T("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
493
- `);for(let Y of J)console.log(` ${C(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(M(` No results for "${$}"`))}import{existsSync as Xw}from"fs";import{dirname as Jw,join as RV,resolve as Yw}from"path";i();function Ww($){try{let Z=JSON.parse(new TextDecoder().decode($));return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)&&typeof Z.taf_version==="string"}catch{return!1}}var Uw="Wolfe-Jam/faf-taf-git@v2.2.0";function PV($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){Kw(Z);return}qw(Z)}function Gw($){if(A($,"bun.lockb")||A($,"bun.lock"))return"bun";if(A($,"pnpm-lock.yaml"))return"pnpm";if(A($,"yarn.lock"))return"yarn";return"npm"}var Vw={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
492
+ `,z=Aw($,"project.faf");a(z,Z,{root:$,expect:null}),console.log(` ${C("1.")} Created sample project.faf`),console.log(M(` ${z}
493
+ `)),console.log(` ${C("2.")} Scoring...`);let Q=s(z,()=>b0(P0(l(z))));console.log(""),S0(Q,"project.faf",!0),T5($),console.log(`
494
+ ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}n();function vV($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let z=$.toLowerCase(),Q=!Z.slots&&!Z.formats,X=0;if(Q||Z.slots){let J=J0.filter((Y)=>Y.path.toLowerCase().includes(z)||Y.description.toLowerCase().includes(z)||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${T("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
495
+ `);for(let Y of J)console.log(` ${C(`#${Y.index}`)} ${Y.path} ${M("—")} ${Y.description} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(Q||Z.formats){let J=P4.filter((Y)=>Y.name.toLowerCase().includes(z)||Y.extensions.some((W)=>W.toLowerCase().includes(z))||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${T("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
496
+ `);for(let Y of J)console.log(` ${C(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(M(` No results for "${$}"`))}import{existsSync as Cw}from"fs";import{dirname as _w,join as gV,resolve as Rw}from"path";n();function Fw($){try{let Z=JSON.parse(new TextDecoder().decode($));return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)&&typeof Z.taf_version==="string"}catch{return!1}}var Pw="Wolfe-Jam/faf-taf-git@v2.2.0";function hV($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){ww(Z);return}xw(Z)}function Sw($){if(A($,"bun.lockb")||A($,"bun.lock"))return"bun";if(A($,"pnpm-lock.yaml"))return"pnpm";if(A($,"yarn.lock"))return"yarn";return"npm"}var Ew={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
494
497
  - uses: actions/setup-node@v4
495
498
  with:
496
499
  node-version: 20`,install:"pnpm install --frozen-lockfile",test:"pnpm test"},yarn:{setup:` - uses: actions/setup-node@v4
497
500
  with:
498
501
  node-version: 20`,install:"yarn install --frozen-lockfile",test:"yarn test"},npm:{setup:` - uses: actions/setup-node@v4
499
502
  with:
500
- node-version: 20`,install:"npm ci",test:"npm test"}};function Hw($){let Z=`name: TAF Receipts
503
+ node-version: 20`,install:"npm ci",test:"npm test"}};function jw($){let Z=`name: TAF Receipts
501
504
  `+`# Prints a Test Receipt (.taf) on every push — proof over time, cannot be gamed.
502
505
  `+`# Written by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/faf-taf-git
503
506
  on:
@@ -509,7 +512,7 @@ jobs:
509
512
  runs-on: ubuntu-latest
510
513
  steps:
511
514
  - uses: actions/checkout@v4
512
- `,z;if(A($,"package.json")){let X=Vw[Gw($)];z=`${X.setup}
515
+ `,z;if(A($,"package.json")){let X=Ew[Sw($)];z=`${X.setup}
513
516
  - run: ${X.install}
514
517
  - name: Run tests
515
518
  run: ${X.test} 2>&1 | tee test-output.txt
@@ -520,71 +523,71 @@ jobs:
520
523
  echo "TODO: your test command" 2>&1 | tee test-output.txt
521
524
  `;let Q=` - name: Print TAF receipt
522
525
  if: github.event_name == 'push'
523
- uses: ${Uw}
526
+ uses: ${Pw}
524
527
  with:
525
528
  test-output-file: test-output.txt
526
529
  auto-commit: 'true'
527
530
  commit-message: 'chore(taf): update .taf receipt [skip ci]'
528
531
  target-branch: taf-receipts
529
- `;return Z+z+Q}function Kw($){let Z=process.cwd(),z=Hw(Z),Q=RV(Z,".github","workflows","taf.yml");if($.write){if(Xw(Q)){console.error(`${C("×")} .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}w0(Z,RV(".github","workflows")),a(Q,z,{root:Z,expect:null}),console.log(`${T("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${T("TAF setup")} ${M("— Test Receipt Printer: proof over time, cannot be gamed")}
530
- `),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(z),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function qw($){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
532
+ `;return Z+z+Q}function ww($){let Z=process.cwd(),z=jw(Z),Q=gV(Z,".github","workflows","taf.yml");if($.write){if(Cw(Q)){console.error(`${C("×")} .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}w0(Z,gV(".github","workflows")),a(Q,z,{root:Z,expect:null}),console.log(`${T("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${T("TAF setup")} ${M("— Test Receipt Printer: proof over time, cannot be gamed")}
533
+ `),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(z),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function xw($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=u();if(!Z)console.error(`Error: project.faf not found
531
534
 
532
- Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=p(Z),X=n(Z,()=>D0(Q)),J={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:z.project?.name??"unknown",faf_version:z.faf_version??"unknown",score:X.score,tier:X.tier.name,populated:X.populated,active:X.active,total:X.total,slots:X.slots},Y=JSON.stringify(J,null,2);if($.output)W2($.output),V2($.output,Y,{root:Jw(Yw($.output)),format:"json",hasMark:Ww,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${T("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as Bw}from"readline";import{join as FV}from"path";i();var BZ=".faf-session.json";function a9($){if($===null)return null;let Z=new TextDecoder().decode($);try{let z=JSON.parse(Z);if((typeof z==="object"&&z!==null&&!Array.isArray(z)?Object.keys(z).sort().join(","):"")!=="fafPath,slotIndex"||typeof z.slotIndex!=="number"||typeof z.fafPath!=="string")return null;return JSON.stringify({slotIndex:z.slotIndex,fafPath:z.fafPath})===Z?{slotIndex:z.slotIndex,fafPath:z.fafPath}:null}catch{return null}}function SV($){try{return k0(l($,BZ))}catch(Z){if(!(Z instanceof b))throw Z;return console.error(M(` ${BZ}: ${Z.message}`)),null}}function Mw($,Z){try{return w2(FV($,BZ),JSON.stringify(Z),{root:$,owns:(z)=>a9(z)!==null,mark:"faf go session"}),!0}catch(z){return console.error(M(` session not saved: ${z instanceof Error?z.message:String(z)}`)),!1}}function Lw($){let Z=SV($);if(a9(Z)===null||Z===null)return;try{N5(FV($,BZ),{root:$,expect:Z})}catch(z){if(!(z instanceof b))throw z}}function Nw($,Z){let z=new Map;for(let X of Z){let J=P4($,X);if(J&&!z.has(J.at))z.set(J.at,F4(X,J))}if(z.size===0)return;console.error(`${C("×")} go project.faf has a section faf cannot write under — nothing was changed:`);for(let X of z.values())console.error(` ${X}`);let Q=$.project;if(Q!==null&&Q!==void 0&&typeof Q!=="object")console.error(M(" 'faf auto' moves a bare `project: <name>` to `project.name` for you."));process.exit(1)}function Dw($,Z){let z=P$(Z)?` ${M(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${C(`#${$.index}`)} ${r5($.path)} ${M(`(${$.path})`)}${z}: `}async function EV($={}){b$(process.cwd(),"faf go");let Z=f();if(!Z)console.error(`Error: project.faf not found
535
+ Run 'faf init' to create one.`),process.exit(2);let z=o(Z),Q=l(Z),X=s(Z,()=>O0(Q)),J={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:z.project?.name??"unknown",faf_version:z.faf_version??"unknown",score:X.score,tier:X.tier.name,populated:X.populated,active:X.active,total:X.total,slots:X.slots},Y=JSON.stringify(J,null,2);if($.output)U2($.output),H2($.output,Y,{root:_w(Rw($.output)),format:"json",hasMark:Fw,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${T("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as yw}from"readline";import{join as fV}from"path";n();var OZ=".faf-session.json";function Yz($){if($===null)return null;let Z=new TextDecoder().decode($);try{let z=JSON.parse(Z);if((typeof z==="object"&&z!==null&&!Array.isArray(z)?Object.keys(z).sort().join(","):"")!=="fafPath,slotIndex"||typeof z.slotIndex!=="number"||typeof z.fafPath!=="string")return null;return JSON.stringify({slotIndex:z.slotIndex,fafPath:z.fafPath})===Z?{slotIndex:z.slotIndex,fafPath:z.fafPath}:null}catch{return null}}function uV($){try{return k0(d($,OZ))}catch(Z){if(!(Z instanceof v))throw Z;return console.error(M(` ${OZ}: ${Z.message}`)),null}}function kw($,Z){try{return w2(fV($,OZ),JSON.stringify(Z),{root:$,owns:(z)=>Yz(z)!==null,mark:"faf go session"}),!0}catch(z){return console.error(M(` session not saved: ${z instanceof Error?z.message:String(z)}`)),!1}}function bw($){let Z=uV($);if(Yz(Z)===null||Z===null)return;try{D5(fV($,OZ),{root:$,expect:Z})}catch(z){if(!(z instanceof v))throw z}}function vw($,Z){let z=new Map;for(let X of Z){let J=S4($,X);if(J&&!z.has(J.at))z.set(J.at,E4(X,J))}if(z.size===0)return;console.error(`${C("×")} go project.faf has a section faf cannot write under — nothing was changed:`);for(let X of z.values())console.error(` ${X}`);let Q=$.project;if(Q!==null&&Q!==void 0&&typeof Q!=="object")console.error(M(" 'faf auto' moves a bare `project: <name>` to `project.name` for you."));process.exit(1)}function gw($,Z){let z=j$(Z)?` ${M(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${C(`#${$.index}`)} ${o5($.path)} ${M(`(${$.path})`)}${z}: `}async function mV($={}){f$(process.cwd(),"faf go");let Z=u();if(!Z)console.error(`Error: project.faf not found
533
536
 
534
- Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let L=a9(SV(z));if(L)Q=L.slotIndex,console.log(M(` resuming from slot #${Q+1}`))}let X=r(Z),J=n(Z,()=>b0(F0(p(Z)))),Y=J0.filter((L)=>{let B=r9(X,L.path);return G0(B)&&B!==r1});if(Nw(X,Y.map((L)=>L.path)),Y.length===0){console.log(`${T("◆")} go all slots populated — ✪ Trophy`),S0(J,Z);return}console.log(`${T("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.
535
- `));let U=Bw({input:process.stdin,output:process.stdout}),G=(L)=>new Promise((B)=>U.question(L,B)),V=0,H=!1,K=Y.slice(Q);for(let L=0;L<K.length;L++){let B=K[L],N=await G(Dw(B,r9(X,B.path)));if(N.toLowerCase()==="quit"){if(H=!0,Mw(z,{slotIndex:Q+L,fafPath:Z}))console.log(M(`
536
- session saved. Resume with: faf go --resume`));break}if(N.toLowerCase()==="skip"||N.trim()==="")continue;qZ(X,B.path,N.trim()),V++}if(U.close(),V>0)M0(Z,X,{onAliasKept:(L)=>console.log(M(` ${p0(L)}`))}),console.log(`
537
- ${T("◆")} go filled ${V} slot${V===1?"":"s"}`);let q=n(Z,()=>b0(F0(p(Z))));if(S0(q,Z),!H)Lw(z)}i();var Mx="faf ai enhance was retired in 7.13 — project.faf isn't enhanced: faf auto fills tech slots from repo facts, and you write the 6Ws (faf go).";async function EH($){if($==="analyze")await Nx();else if($==="enhance")console.error(Mx),process.exit(1);else console.log(`${T("ai")} ${M("— ask Claude for suggestions about project.faf")}
538
- `),console.log(` ${C("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function Lx(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
537
+ Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let L=Yz(uV(z));if(L)Q=L.slotIndex,console.log(M(` resuming from slot #${Q+1}`))}let X=o(Z),J=s(Z,()=>b0(P0(l(Z)))),Y=J0.filter((L)=>{let B=Qz(X,L.path);return G0(B)&&B!==a1});if(vw(X,Y.map((L)=>L.path)),Y.length===0){console.log(`${T("◆")} go all slots populated — ✪ Trophy`),S0(J,Z);return}console.log(`${T("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.
538
+ `));let U=yw({input:process.stdin,output:process.stdout}),G=(L)=>new Promise((B)=>U.question(L,B)),V=0,H=!1,K=Y.slice(Q);for(let L=0;L<K.length;L++){let B=K[L],N=await G(gw(B,Qz(X,B.path)));if(N.toLowerCase()==="quit"){if(H=!0,kw(z,{slotIndex:Q+L,fafPath:Z}))console.log(M(`
539
+ session saved. Resume with: faf go --resume`));break}if(N.toLowerCase()==="skip"||N.trim()==="")continue;NZ(X,B.path,N.trim()),V++}if(U.close(),V>0)M0(Z,X,{onAliasKept:(L)=>console.log(M(` ${p0(L)}`))}),console.log(`
540
+ ${T("◆")} go filled ${V} slot${V===1?"":"s"}`);let q=s(Z,()=>b0(P0(l(Z))));if(S0(q,Z),!H)bw(z)}n();var kx="faf ai enhance was retired in 7.13 — project.faf isn't enhanced: faf auto fills tech slots from repo facts, and you write the 6Ws (faf go).";async function mH($){if($==="analyze")await vx();else if($==="enhance")console.error(kx),process.exit(1);else console.log(`${T("ai")} ${M("— ask Claude for suggestions about project.faf")}
541
+ `),console.log(` ${C("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function bx(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
539
542
 
540
- export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (SH(),FH));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
543
+ export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (uH(),fH));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
541
544
 
542
- npm install @anthropic-ai/sdk`),process.exit(2)}}async function Nx(){let $=f();if(!$)console.error(`Error: project.faf not found
545
+ npm install @anthropic-ai/sdk`),process.exit(2)}}async function vx(){let $=u();if(!$)console.error(`Error: project.faf not found
543
546
 
544
- Run 'faf init' to create one.`),process.exit(2);let Z=p($);console.log(`${T("ai")} analyze ${M("getting suggestions...")}`);let Q=await(await Lx()).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.
547
+ Run 'faf init' to create one.`),process.exit(2);let Z=l($);console.log(`${T("ai")} analyze ${M("getting suggestions...")}`);let Q=await(await bx()).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.
545
548
 
546
549
  ${Z}
547
550
 
548
- Be concise. One line per suggestion.`}]});console.log(""),console.log(Q.content[0].text)}import{existsSync as KQ,readFileSync as qQ,readdirSync as Dx}from"fs";import{join as jH}from"path";i();function wH($,Z){if($==="import")Ox(Z);else if($==="export")Ix();else console.log(`${T("conductor")} ${M("— conductor integration")}
549
- `),console.log(` ${C("faf conductor import <path>")} ${M("— import conductor config into .faf")}`),console.log(` ${C("faf conductor export")} ${M("— author conductor config from .faf")}`)}function Ox($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!KQ($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:B6,project:{}};if(KQ($)&&$.endsWith(".json")){let X=JSON.parse(qQ($,"utf-8"));if(X.name)Z.project.name=X.name;if(X.description)Z.project.goal=X.description;if(X.language)Z.project.main_language=X.language}else if(KQ($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let X=r0(qQ($,"utf-8"));if(X.name)Z.project.name=X.name;if(X.description)Z.project.goal=X.description;if(X.language)Z.project.main_language=X.language}else try{let X=Dx($);for(let J of X){let Y=jH($,J);if(J.endsWith(".json"))try{let W=JSON.parse(qQ(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 z=process.cwd(),Q=f(z);if(Q){let X=r(Q);if(!X.project)X.project={};if(Z.project.name&&!X.project.name)X.project.name=Z.project.name;if(Z.project.goal&&!X.project.goal)X.project.goal=Z.project.goal;if(Z.project.main_language&&!X.project.main_language)X.project.main_language=Z.project.main_language;M0(Q,X,{onAliasKept:(J)=>console.log(M(` ${p0(J)}`))}),console.log(`${T("◆")} conductor import merged into ${Q}`)}else{let X=jH(z,"project.faf");M0(X,Z),console.log(`${T("◆")} conductor import created ${X}`)}}function Ix(){let $=f();if(!$)console.error(`Error: project.faf not found
551
+ Be concise. One line per suggestion.`}]});console.log(""),console.log(Q.content[0].text)}import{existsSync as TQ,readFileSync as AQ,readdirSync as gx}from"fs";import{join as cH}from"path";n();function pH($,Z){if($==="import")hx(Z);else if($==="export")fx();else console.log(`${T("conductor")} ${M("— conductor integration")}
552
+ `),console.log(` ${C("faf conductor import <path>")} ${M("— import conductor config into .faf")}`),console.log(` ${C("faf conductor export")} ${M("— author conductor config from .faf")}`)}function hx($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!TQ($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:L6,project:{}};if(TQ($)&&$.endsWith(".json")){let X=JSON.parse(AQ($,"utf-8"));if(X.name)Z.project.name=X.name;if(X.description)Z.project.goal=X.description;if(X.language)Z.project.main_language=X.language}else if(TQ($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let X=r0(AQ($,"utf-8"));if(X.name)Z.project.name=X.name;if(X.description)Z.project.goal=X.description;if(X.language)Z.project.main_language=X.language}else try{let X=gx($);for(let J of X){let Y=cH($,J);if(J.endsWith(".json"))try{let W=JSON.parse(AQ(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 z=process.cwd(),Q=u(z);if(Q){let X=o(Q);if(!X.project)X.project={};if(Z.project.name&&!X.project.name)X.project.name=Z.project.name;if(Z.project.goal&&!X.project.goal)X.project.goal=Z.project.goal;if(Z.project.main_language&&!X.project.main_language)X.project.main_language=Z.project.main_language;M0(Q,X,{onAliasKept:(J)=>console.log(M(` ${p0(J)}`))}),console.log(`${T("◆")} conductor import merged into ${Q}`)}else{let X=cH(z,"project.faf");M0(X,Z),console.log(`${T("◆")} conductor import created ${X}`)}}function fx(){let $=u();if(!$)console.error(`Error: project.faf not found
550
553
 
551
- Run 'faf init' to create one.`),process.exit(2);let Z=r($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}i();import{readdirSync as Tx,readFileSync as Ax,existsSync as Cx}from"fs";import{join as _x}from"path";var Rx=["BRAKE","ENGINE","AERO","TYRE","PIT"],Px=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function Fx($){let Z=$.match(Px);if(!Z)return null;return Z[1].toUpperCase()}function Sx($){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 Ex($,Z){let z=[];switch(Z){case"typescript":{let Q=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,X=[],J;while((J=Q.exec($))!==null)X.push({idx:J.index,type:J[1]==="describe"?"describe":"test",name:J[3]});let Y=[],W=0,U=null,G=0;for(let V=0;V<$.length;V++){while(G<X.length&&X[G].idx===V){let K=X[G];if(K.type==="describe")U=K.name;else{let q=Y.map((B)=>B.name),L=q.length>0?`${q.join(" > ")} > ${K.name}`:K.name;z.push(L)}G++}let H=$[V];if(H==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(H==="}"){W--;while(Y.length>0&&W<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let Q=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"python":{let Q=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"zig":{let Q=/\btest\s+"((?:\\.|[^"\\])+)"/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"go":{let Q=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}}return z}var jx=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function xH($,Z=[]){let z;try{z=Tx($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(jx.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=_x($,Q.name);if(Q.isDirectory())xH(X,Z);else if(Q.isFile())Z.push(X)}return Z}function wx($){let Z=[];if(!Cx($))return Z;let z=xH($);for(let Q of z){let X=Q.split("/").pop()??"",J=Sx(X);if(!J.ok||!J.lang)continue;let Y;try{Y=Ax(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=Ex(Y,J.lang),U=Q.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:J.lang,testName:G,tier:Fx(G)})}return Z}function xx($){let Z={BRAKE:0,ENGINE:0,AERO:0,TYRE:0,PIT:0},z={},Q=0,X=[],J=new Set;for(let Y of $)if(J.add(Y.file),z[Y.language]=(z[Y.language]??0)+1,Y.tier)Z[Y.tier]++;else if(Q++,X.length<5)X.push(`${Y.file}: ${Y.testName}`);return{totalTests:$.length,byTier:Z,untiered:Q,untieredExamples:X,filesScanned:J.size,byLanguage:z}}function yx($){if(console.log(`${T(C("faf wjttc"))} ${M("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${C(String($.filesScanned))}`),console.log(` Tests found: ${C(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(M(" no tests found"));return}console.log(M(" Tiers:"));for(let Z of Rx){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?P0("●"):Z==="ENGINE"?T("●"):Z==="AERO"?M("●"):Z==="TYRE"?T("◐"):M("○");console.log(` ${X} ${Z.padEnd(7)} ${C(String(z).padStart(4))} ${M(`(${Q}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${M("○")} ${"untiered".padEnd(7)} ${C(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,z]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${C(String(z))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(P0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function yH($={}){let Z=$.path??"tests",z=wx(Z),Q=xx(z);if($.json)console.log(JSON.stringify(Q,null,2));else yx(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as vH}from"crypto";import{readFileSync as kx,existsSync as bx}from"fs";import{join as vx,dirname as gx}from"path";i();var kH="faf-bench/1",hx={"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 fx($,Z){return hx[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var ux=[["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"]],N8=new Map;ux.forEach(($,Z)=>$.forEach((z)=>N8.set(z,Z)));var mx=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function BQ($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function bH($){return BQ($).split(" ").filter((Z)=>Z&&!mx.has(Z))}function cx($,Z){let z=BQ($),Q=BQ(Z);if(!z||!Q)return!1;if(z===Q)return!0;let X=N8.get(z);if(X!==void 0&&N8.get(Q)===X)return!0;let J=bH($);if(J.length===0)return!1;let Y=new Set(bH(Z));return J.every((W)=>{if(Y.has(W))return!0;let U=N8.get(W);return U!==void 0&&[...Y].some((G)=>N8.get(G)===U)})}function px($){let Z=D0($),z=r0($),Q=[],X={},J=0;for(let U of J0){if(Z.slots[U.path]!=="populated")continue;let G=n1(z,U);if(typeof G!=="string")continue;let V=G.trim();if(!V||N3.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:U.path,question:fx(U.path,U.description)}),X[J]=V}let Y=JSON.stringify({v:kH,q:Q.map((U)=>[U.path,U.question])}),W=vH("sha256").update(Y).digest("hex").slice(0,12);return{version:kH,qsetHash:W,questions:Q,answers:X}}function lx($,Z){let z=$.questions.map((X)=>{let J=Z[String(X.n)]??Z[X.path]??"";return{n:X.n,path:X.path,ok:typeof J==="string"&&J.trim()!==""&&cx($.answers[X.n],J)}}),Q=$.questions.filter((X)=>!z[X.n-1].ok);return{correct:z.filter((X)=>X.ok).length,total:$.questions.length,misses:Q,perQuestion:z}}var gH=".faf-bench.json";function hH($){let Z=new TextDecoder().decode($);try{let z=JSON.parse(Z);return typeof z==="object"&&z!==null&&typeof z.version==="string"&&typeof z.qsetHash==="string"&&z.protocol==="in-session"&&`${JSON.stringify(z,null,2)}
552
- `===Z}catch{return!1}}function dx($){let Z=k0(l($,gH));if(Z===null||!hH(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function ix($,Z,z){w2(vx($,gH),`${JSON.stringify(Z,null,2)}
553
- `,{root:$,owns:hH,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function MQ($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:vH("sha256").update(z).digest("hex")}}var pZ=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function nx($,Z){let{cold:z,faf:Q}=$;console.log(`
554
+ Run 'faf init' to create one.`),process.exit(2);let Z=o($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}n();import{readdirSync as ux,readFileSync as mx,existsSync as cx}from"fs";import{join as px}from"path";var lx=["BRAKE","ENGINE","AERO","TYRE","PIT"],dx=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function ix($){let Z=$.match(dx);if(!Z)return null;return Z[1].toUpperCase()}function nx($){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 rx($,Z){let z=[];switch(Z){case"typescript":{let Q=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,X=[],J;while((J=Q.exec($))!==null)X.push({idx:J.index,type:J[1]==="describe"?"describe":"test",name:J[3]});let Y=[],W=0,U=null,G=0;for(let V=0;V<$.length;V++){while(G<X.length&&X[G].idx===V){let K=X[G];if(K.type==="describe")U=K.name;else{let q=Y.map((B)=>B.name),L=q.length>0?`${q.join(" > ")} > ${K.name}`:K.name;z.push(L)}G++}let H=$[V];if(H==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(H==="}"){W--;while(Y.length>0&&W<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let Q=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"python":{let Q=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"zig":{let Q=/\btest\s+"((?:\\.|[^"\\])+)"/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"go":{let Q=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}}return z}var sx=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function lH($,Z=[]){let z;try{z=ux($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(sx.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=px($,Q.name);if(Q.isDirectory())lH(X,Z);else if(Q.isFile())Z.push(X)}return Z}function ox($){let Z=[];if(!cx($))return Z;let z=lH($);for(let Q of z){let X=Q.split("/").pop()??"",J=nx(X);if(!J.ok||!J.lang)continue;let Y;try{Y=mx(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=rx(Y,J.lang),U=Q.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:J.lang,testName:G,tier:ix(G)})}return Z}function ax($){let Z={BRAKE:0,ENGINE:0,AERO:0,TYRE:0,PIT:0},z={},Q=0,X=[],J=new Set;for(let Y of $)if(J.add(Y.file),z[Y.language]=(z[Y.language]??0)+1,Y.tier)Z[Y.tier]++;else if(Q++,X.length<5)X.push(`${Y.file}: ${Y.testName}`);return{totalTests:$.length,byTier:Z,untiered:Q,untieredExamples:X,filesScanned:J.size,byLanguage:z}}function tx($){if(console.log(`${T(C("faf wjttc"))} ${M("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${C(String($.filesScanned))}`),console.log(` Tests found: ${C(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(M(" no tests found"));return}console.log(M(" Tiers:"));for(let Z of lx){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?F0("●"):Z==="ENGINE"?T("●"):Z==="AERO"?M("●"):Z==="TYRE"?T("◐"):M("○");console.log(` ${X} ${Z.padEnd(7)} ${C(String(z).padStart(4))} ${M(`(${Q}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${M("○")} ${"untiered".padEnd(7)} ${C(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,z]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${C(String(z))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(F0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function dH($={}){let Z=$.path??"tests",z=ox(Z),Q=ax(z);if($.json)console.log(JSON.stringify(Q,null,2));else tx(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as rH}from"crypto";import{readFileSync as ex,existsSync as $y}from"fs";import{join as Zy,dirname as zy}from"path";n();var iH="faf-bench/1",Qy={"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 Xy($,Z){return Qy[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var Jy=[["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"]],D8=new Map;Jy.forEach(($,Z)=>$.forEach((z)=>D8.set(z,Z)));var Yy=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function CQ($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function nH($){return CQ($).split(" ").filter((Z)=>Z&&!Yy.has(Z))}function Wy($,Z){let z=CQ($),Q=CQ(Z);if(!z||!Q)return!1;if(z===Q)return!0;let X=D8.get(z);if(X!==void 0&&D8.get(Q)===X)return!0;let J=nH($);if(J.length===0)return!1;let Y=new Set(nH(Z));return J.every((W)=>{if(Y.has(W))return!0;let U=D8.get(W);return U!==void 0&&[...Y].some((G)=>D8.get(G)===U)})}function Uy($){let Z=O0($),z=r0($),Q=[],X={},J=0;for(let U of J0){if(Z.slots[U.path]!=="populated")continue;let G=o1(z,U);if(typeof G!=="string")continue;let V=G.trim();if(!V||T3.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:U.path,question:Xy(U.path,U.description)}),X[J]=V}let Y=JSON.stringify({v:iH,q:Q.map((U)=>[U.path,U.question])}),W=rH("sha256").update(Y).digest("hex").slice(0,12);return{version:iH,qsetHash:W,questions:Q,answers:X}}function Gy($,Z){let z=$.questions.map((X)=>{let J=Z[String(X.n)]??Z[X.path]??"";return{n:X.n,path:X.path,ok:typeof J==="string"&&J.trim()!==""&&Wy($.answers[X.n],J)}}),Q=$.questions.filter((X)=>!z[X.n-1].ok);return{correct:z.filter((X)=>X.ok).length,total:$.questions.length,misses:Q,perQuestion:z}}var sH=".faf-bench.json";function oH($){let Z=new TextDecoder().decode($);try{let z=JSON.parse(Z);return typeof z==="object"&&z!==null&&typeof z.version==="string"&&typeof z.qsetHash==="string"&&z.protocol==="in-session"&&`${JSON.stringify(z,null,2)}
555
+ `===Z}catch{return!1}}function Vy($){let Z=k0(d($,sH));if(Z===null||!oH(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function Hy($,Z,z){w2(Zy($,sH),`${JSON.stringify(Z,null,2)}
556
+ `,{root:$,owns:oH,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function _Q($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:rH("sha256").update(z).digest("hex")}}var nZ=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function Ky($,Z){let{cold:z,faf:Q}=$;console.log(`
554
557
  ${C(`faf bench — ${Z}`)}
555
- `),console.log(` ${M("without context")} ${T("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${C(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${pZ(z.tokens)} ${pZ(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
556
- ${M(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let J=MQ($,Z);console.log(`
557
- ${P0("✪ BENCH RECEIPT")}`),console.log(M(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${Q.model??z.model??"unreported"}`)),console.log(M(` cold ${z.score}/${z.total} · faf ${Q.score}/${Q.total} · sha256: ${J.hash.slice(0,16)}…`))}function rx($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
558
- ${C(`faf bench — ${Z}`)} ${P0("Trouble ahead, expensive trouble.")}
559
- `),console.log(` ${M("without context")}`),console.log(`answers ${z.score}/${z.total} ${M("— the AI is guessing at what you are building")}`),z.tokens!==void 0)console.log(`tokens ${pZ(z.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
558
+ `),console.log(` ${M("without context")} ${T("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${C(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${nZ(z.tokens)} ${nZ(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
559
+ ${M(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let J=_Q($,Z);console.log(`
560
+ ${F0("✪ BENCH RECEIPT")}`),console.log(M(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${Q.model??z.model??"unreported"}`)),console.log(M(` cold ${z.score}/${z.total} · faf ${Q.score}/${Q.total} · sha256: ${J.hash.slice(0,16)}…`))}function qy($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
561
+ ${C(`faf bench — ${Z}`)} ${F0("Trouble ahead, expensive trouble.")}
562
+ `),console.log(` ${M("without context")}`),console.log(`answers ${z.score}/${z.total} ${M("— the AI is guessing at what you are building")}`),z.tokens!==void 0)console.log(`tokens ${nZ(z.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
560
563
  ${Q} answer${Q===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(`
561
- ${T("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var sx="https://mcpaas.live/bench/submit";async function ox($,Z){try{let z=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});console.log(M(z.ok?` ✪ submitted to ${Z}`:` submit failed (${z.status})`))}catch{console.log(M(" submit skipped (endpoint unreachable)"))}}function fH($,Z,z={}){let Q=z.file??f();if(!Q)console.error(`Error: project.faf not found
564
+ ${T("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var By="https://mcpaas.live/bench/submit";async function My($,Z){try{let z=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});console.log(M(z.ok?` ✪ submitted to ${Z}`:` submit failed (${z.status})`))}catch{console.log(M(" submit skipped (endpoint unreachable)"))}}function aH($,Z,z={}){let Q=z.file??u();if(!Q)console.error(`Error: project.faf not found
562
565
 
563
- Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=p(Q);X2(X,Q);let J=n(Q,()=>px(X)),Y=gx(Q),W=r0(X)?.project?.name??Y.split("/").pop();if(J.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(z.json){console.log(JSON.stringify({version:J.version,qsetHash:J.qsetHash,questions:J.questions.map(({n:U,question:G})=>({n:U,question:G}))},null,2));return}console.log(`
566
+ Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=l(Q);X2(X,Q);let J=s(Q,()=>Uy(X)),Y=zy(Q),W=r0(X)?.project?.name??Y.split("/").pop();if(J.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(z.json){console.log(JSON.stringify({version:J.version,qsetHash:J.qsetHash,questions:J.questions.map(({n:U,question:G})=>({n:U,question:G}))},null,2));return}console.log(`
564
567
  ${C(`faf bench — ${J.questions.length} questions`)} ${M(`qset ${J.qsetHash}`)}
565
568
  `);for(let U of J.questions)console.log(` ${String(U.n).padStart(2)}. ${U.question}`);console.log(`
566
- ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!bx(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(kx(Z,"utf-8")),G=U.answers??U,V=lx(J,G),H={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:K,bytes:q}=dx(Y),L=K&&K.qsetHash===J.qsetHash?K:{version:J.version,qsetHash:J.qsetHash,protocol:"in-session"};if(z.cold)L.cold=H;else if(z.faf)L.faf=H;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(ix(Y,L,q),z.json){let B=MQ(L,W);console.log(JSON.stringify({...L,receipt:B.hash,perQuestion:V.perQuestion},null,2));return}if(L.cold&&L.faf)nx(L,W);if(z.submit&&L.cold&&L.faf){let{cold:B,faf:N}=L,I=MQ(L,W);ox({date:new Date().toISOString().slice(0,10),model:N.model??B.model??z.model??"unreported",repo:W,qset:L.qsetHash,cold:`${B.score}/${B.total}`,faf:`${N.score}/${N.total}`,sha256:I.hash.slice(0,16)},z.endpoint??sx)}else if(L.cold)rx(L,W);else console.log(`
567
- ${C(`faf bench — ${W}`)} ${T("with .faf")}: ${C(`${H.score}/${H.total}`)} ${M(`tokens ${pZ(H.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
569
+ ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!$y(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(ex(Z,"utf-8")),G=U.answers??U,V=Gy(J,G),H={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:K,bytes:q}=Vy(Y),L=K&&K.qsetHash===J.qsetHash?K:{version:J.version,qsetHash:J.qsetHash,protocol:"in-session"};if(z.cold)L.cold=H;else if(z.faf)L.faf=H;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(Hy(Y,L,q),z.json){let B=_Q(L,W);console.log(JSON.stringify({...L,receipt:B.hash,perQuestion:V.perQuestion},null,2));return}if(L.cold&&L.faf)Ky(L,W);if(z.submit&&L.cold&&L.faf){let{cold:B,faf:N}=L,I=_Q(L,W);My({date:new Date().toISOString().slice(0,10),model:N.model??B.model??z.model??"unreported",repo:W,qset:L.qsetHash,cold:`${B.score}/${B.total}`,faf:`${N.score}/${N.total}`,sha256:I.hash.slice(0,16)},z.endpoint??By)}else if(L.cold)qy(L,W);else console.log(`
570
+ ${C(`faf bench — ${W}`)} ${T("with .faf")}: ${C(`${H.score}/${H.total}`)} ${M(`tokens ${nZ(H.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
568
571
  ${C("faf bench — agent-native protocol")} ${M(`qset ${J.qsetHash} · ${J.questions.length} questions`)}
569
572
  `),console.log(`${C("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. ${T("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${T("faf bench grade cold.json --cold --tokens <used> --model <name>")}
570
573
  `),console.log(`${C("FAF phase")} ${M("(same questions, context first)")}`),console.log(' 4. Instruct: "Read project.faf, then answer the same questions." → faf.json'),console.log(` 5. ${T("faf bench grade faf.json --faf --tokens <used> --model <name>")}
571
- `),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 ${J.qsetHash}.`))}import{lstatSync as ax}from"fs";import{dirname as tx,resolve as ex}from"path";i();function $y($){try{return ax($),!0}catch{return!1}}function Zy($,Z,z,Q){let X=n(Q,()=>E5(Z));try{return w2($,X,{root:z,owns:L9,mark:N9}),{bytes:X.length,left:null}}catch(J){if(J instanceof b)return{bytes:null,left:J.message};throw J}}function zy({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${T("refresh")} ${M("— re-grounding on the live .faf")}
572
- `),!Z)console.log(` score unknown ${M("— about-repo with no about.source_score; the DNA journey is left as it is")}`);else if(z){let W=Q>0?"↑":"↓";console.log(` drift: ${M(`${X}%`)} ${W} ${C(`${$.score}%`)} ${M(`(${Q>0?"+":""}${Q})`)}`)}else if(X!==null&&X!==void 0)console.log(` no drift ${M(`— steady at ${$.score}%`)}`);else console.log(` baseline set ${M(`— ${$.score}%`)}`);if(J!==null)console.log(` .fafb re-compiled ${M(`(${J} bytes — fast tier current)`)}`);if(Y!==null)console.log(` .fafb left as it is ${M(`— ${Y}`)}`);if(Z)console.log(` re-grounded: ${I2($.tier)} ${C(`${$.score}%`)}`)}function uH($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
574
+ `),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 ${J.qsetHash}.`))}import{lstatSync as Ly}from"fs";import{dirname as Ny,resolve as Oy}from"path";n();function Dy($){try{return Ly($),!0}catch{return!1}}function Iy($,Z,z,Q){let X=s(Q,()=>w5(Z));try{return w2($,X,{root:z,owns:T9,mark:A9}),{bytes:X.length,left:null}}catch(J){if(J instanceof v)return{bytes:null,left:J.message};throw J}}function Ty({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${T("refresh")} ${M("— re-grounding on the live .faf")}
575
+ `),!Z)console.log(` score unknown ${M("— about-repo with no about.source_score; the DNA journey is left as it is")}`);else if(z){let W=Q>0?"↑":"↓";console.log(` drift: ${M(`${X}%`)} ${W} ${C(`${$.score}%`)} ${M(`(${Q>0?"+":""}${Q})`)}`)}else if(X!==null&&X!==void 0)console.log(` no drift ${M(`— steady at ${$.score}%`)}`);else console.log(` baseline set ${M(`— ${$.score}%`)}`);if(J!==null)console.log(` .fafb re-compiled ${M(`(${J} bytes — fast tier current)`)}`);if(Y!==null)console.log(` .fafb left as it is ${M(`— ${Y}`)}`);if(Z)console.log(` re-grounded: ${T2($.tier)} ${C(`${$.score}%`)}`)}function tH($={}){let Z=u();if(!Z)console.error(`Error: project.faf not found
573
576
 
574
- Run 'faf init' to create one.`),process.exit(2);let z=p(Z);X2(z,Z);let Q=n(Z,()=>D0(z)),X=new m2(process.cwd()),J=X.load()?X.getBirthDNADisplay():null,Y=J?J.current:null,W=!Q.unknown,U=W&&Y!==null&&Y!==void 0?Q.score-Y:0,G=W&&Y!==null&&Y!==void 0&&U!==0,V=D9(Z),H=null,K=null;if($y(V))({bytes:H,left:K}=Zy(V,z,tx(ex(Z)),Z));if($.json)console.log(JSON.stringify({reGrounded:W,score:Q.score,...W?{}:{unknown:!0},tier:Q.tier,baseline:Y,delta:U,drifted:G,fafb:H!==null&&H!==void 0?{reCompiled:!0,bytes:H}:{reCompiled:!1,...K!==null?{left:K}:{}},journey:X.getJourney()||null},null,2));else zy({result:Q,known:W,drifted:G,delta:U,prevScore:Y,fafbBytes:H,fafbLeft:K});if(!W)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),d5(X);else X.birth(Q.score)}i();import{existsSync as $K,lstatSync as Oy}from"fs";import{resolve as O8}from"path";var mH=["ephemeral","standard","high","critical"],V$=Object.fromEntries(mH.map(($,Z)=>[$,Z])),LQ=new Set(["user","feedback","project","reference"]),NQ=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),DQ=new Set(["facts","sessions","preferences","custom"]),OQ={low:"ephemeral",medium:"standard"};import{existsSync as Qy}from"fs";import{dirname as nH,resolve as rH}from"path";function N1(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function K0($){return $===null||$===void 0}function Xy($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if(K0($))return"empty";if(typeof $==="string")return`a string (${JSON.stringify($.length>40?`${$.slice(0,40)}…`:$)})`;return`a ${typeof $}`}var L1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function Jy($){let Z=rH($),z=l(nH(Z),Z,{read:!0});return{real:z,text:Q0(z)}}function cH($,Z,z,Q){let X=rH($),J=l(nH(X),X),Y=z!==void 0&&z.real===J;if(Y&&z.text===Z)return J;let W;try{W=k0(J)}catch{W=void 0}if(W&&W.equals(Buffer.from(Z,"utf-8")))return J;if(!Y&&!Q&&W)throw new b("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let U=Y?z.text:Q?W:null;return a($,Z,U===void 0?{}:{expect:U})}function D8($){if(K0($))return"standard";if(OQ[$])return OQ[$];if($ in V$)return $;return"standard"}var Yy=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function IQ($){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=$,z={};for(let[Q,X]of Object.entries(Z))if(!Yy.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:D8(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:z}}function M1($){if(K0($.id)&&K0($.type)&&$.tags.length===0&&$.links.length===0&&K0($.timestamp)&&K0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let z={text:$.text};if(!K0($.id))z.id=$.id;if(!K0($.type))z.type=$.type;if(z.priority=$.priority,$.tags.length)z.tags=$.tags;if($.links.length)z.links=$.links;if(!K0($.timestamp))z.timestamp=$.timestamp;if(!K0($.source))z.source=$.source;return Object.assign(z,$.extra),z}function pH($){let Z=$;return L1($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&L1(Z.extra)&&typeof Z.priority==="string"?Z:IQ($)}function Wy($){if(typeof $==="string"||L1($)&&"text"in $)return IQ($);return null}var lH=["profile","namepoint","created","last_etched","retention"];class u0{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;_version;_origin;_factAt=new WeakMap;_indexDerived=!0;_indexAtRecord=[];constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??N1(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(pH):[],this._byId=new Map,this._facts.forEach((z,Q)=>{if(!K0(z.id))this._byId.set(z.id,Q)}),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}:{},this._indexDerived=Z.index===void 0||B0(this._index,this.derivedIndex()),this._indexAtRecord=this._index.slice()}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(!Qy($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=Jy($);return u0.fromText(z,$,Z)}static fromText($,Z,z){let Q=A3($,Z).toJS();if(!L1(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${Xy(Q)}`);let X=new sH,J=X.pick("memory",Q.memory,$0)??{},Y=new u0(String(Q.namepoint??Z.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(Q.profile??"voice"),retention:String(Q.retention??"forever"),created:Q.created??null,...X.modelled(Q,J)});return(X.pick("memory.facts",J.facts,Array.isArray)??[]).forEach((W,U)=>{let G=Wy(W);if(G)Y.adopt(G,U)}),Y.last_etched=String(Q.last_etched??Y.created),Y._version=K0(Q.version)?void 0:String(Q.version),Y._origin={path:Z,real:z,text:$,base:Y.state(),residual:X.residual},Y.recordIndex(),Y}recordIndex(){this._indexDerived=this.indexIsDerived(),this._indexAtRecord=this._index.slice()}adopt($,Z){if(this._facts.push($),!K0($.id))this._byId.set($.id,this._facts.length-1);this._factAt.set($,Z)}static fromFile($){return u0.load($)}toDoc(){let $={facts:this._facts.map(M1),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[z,Q]of Object.entries(this._memoryExtra))if(!DQ.has(z))$[z]=structuredClone(Q);let Z={version:this._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[z,Q]of Object.entries(this._extra))if(!NQ.has(z))Z[z]=structuredClone(Q);return Z}toYaml(){return g6(this.toDoc(),{lineWidth:100})}derivedIndex($=80){return this._facts.map((Z)=>`${Z.id??"?"} — ${String(Z.text).slice(0,$)}`)}indexIsDerived($=80){return!this._origin?.residual.has("index")&&B0(this._index,this.derivedIndex($))}rebuildIndex($=80){return this._index=this.derivedIndex($),this._indexDerived=!0,this._indexAtRecord=this._index.slice(),this._index}save($,Z={}){let z=Z.reindex??(this._indexDerived&&B0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let U=this.toYaml(),G=cH($,U,void 0,Q);return this.settle($,U,new Map(this._facts.map((V,H)=>[V,H])),G),$}let J=new Map,{text:Y}=A5(X.text,(U)=>{J=this.applyTo(U,X,z)},$),W=cH($,Y,X.real===void 0?void 0:{real:X.real,text:X.text},Q);return this.settle($,Y,J,W),$}toFile($,Z={}){return this.save($,Z)}settle($,Z,z,Q){this._factAt=new WeakMap;for(let[X,J]of z)this._factAt.set(X,J);this._origin={path:$,real:Q,text:Z,base:this.state(),residual:this._origin?.residual??new Map},this.recordIndex()}state(){let $=new Map;for(let Z of this._facts){let z=this._factAt.get(Z);if(z!==void 0)$.set(z,structuredClone(M1(Z)))}return{top:Object.fromEntries(lH.map((Z)=>[Z,this[Z]])),index:this._index.slice(),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom),extra:structuredClone(this._extra),memoryExtra:structuredClone(this._memoryExtra),facts:$}}static refuse($,Z,z){throw Error(`${$.path}: ${Z} is ${$.residual.get(Z)} in the file, not the shape faf writes — `+`faf keeps it as it is and will not ${z}. Nothing written.`)}applyTo($,Z,z){let Q=Z.base,X=this.state(),J=Z.path;for(let Y of lH)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!B0(Q.index,X.index)){if(Z.residual.has("index")&&!z)u0.refuse(Z,"index","replace it");_5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of iH(Q.extra,X.extra))_5($,[Y],Q.extra[Y],X.extra[Y],J);return this.applyMemory($,Z,Q,X),this.applyFacts($,Z)}applyMemory($,Z,z,Q){let X=[["sessions",z.sessions,Q.sessions],["preferences",z.preferences,Q.preferences],["custom",z.custom,Q.custom],...iH(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,W]of X){if(B0(Y,W))continue;if(Z.residual.has("memory"))u0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))u0.refuse(Z,`memory.${J}`,"replace it");_5($,["memory",J],Y,W,Z.path)}}sortFacts($){let Z=[],z=[];for(let Q of this._facts){let X=this._factAt.get(Q);if(X===void 0){z.push(Q);continue}if(z.length>0||Z.length>0&&X<=Z[Z.length-1][1])throw Error(`${$.path}: the facts were reordered — faf keeps the order soul.fafm has. Nothing written.`);Z.push([Q,X])}return{kept:Z,added:z}}applyFacts($,Z){let{kept:z,added:Q}=this.sortFacts(Z),X=new Set(z.map(([,G])=>G)),J=[...Z.base.facts.keys()].filter((G)=>!X.has(G)).sort((G,V)=>V-G),Y=z.filter(([G,V])=>!B0(Z.base.facts.get(V),M1(G))),W=new Map(z);if(Q.length===0&&J.length===0&&Y.length===0)return W;for(let G of["memory","memory.facts"])if(Z.residual.has(G))u0.refuse(Z,G,"add facts to it");let U=gY($,["memory","facts"],Z.path);for(let[G,V]of Y)U.items[V]=Gy($,U.items[V],Z.base.facts.get(V),M1(G));for(let G of J)U.items.splice(G,1);for(let[G,V]of z)W.set(G,V-J.filter((H)=>H<V).length);for(let G of Q)W.set(G,U.items.length),U.items.push($.createNode(M1(G)));return W}add($){let Z=pH($);if(!K0(Z.id)&&this._byId.has(Z.id)){let z=this._byId.get(Z.id);if(z!==void 0){let Q=this._factAt.get(this._facts[z]);if(this._facts[z]=Z,Q!==void 0)this._factAt.set(Z,Q)}}else if(this._facts.push(Z),!K0(Z.id))this._byId.set(Z.id,this._facts.length-1);if(Z.timestamp&&Z.timestamp>(this.last_etched||""))this.last_etched=Z.timestamp;return Z}etch($,Z={}){let z=K0(Z.id)?null:this.getFact(Z.id);if(z)return this.add(Uy(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:D8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:N1(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=L1($)?{...$,...Z}:Z,Q=L1($)?$.query:$,X=V$[D8(z.minPriority??"ephemeral")]??0,J=typeof Q==="string"?Q.toLowerCase():"",Y=new Set(z.tags??[]),W=[];this._facts.forEach((G,V)=>{if(J&&!String(G.text??"").toLowerCase().includes(J))return;if(Y.size>0&&![...Y].some((H)=>(G.tags??[]).includes(H)))return;if(!K0(z.type)&&G.type!==z.type)return;if((V$[G.priority]??1)<X)return;W.push([V,G])}),W.sort((G,V)=>{let H=V$[G[1].priority]??1,K=V$[V[1].priority]??1;if(K!==H)return K-H;let q=G[1].timestamp??"",L=V[1].timestamp??"";if(L!==q)return L<q?-1:L>q?1:0;return V[0]-G[0]});let U=W.map(([,G])=>G);if(!K0(z.limit))return U.slice(0,z.limit);return U}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((z,Q)=>{if(!K0(z.id))this._byId.set(z.id,Q)}),!0}}function Uy($,Z,z){let Q=(X,J)=>K0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:K0(z.priority)?$.priority:D8(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:N1(),extra:{...$.extra}}}class sH{residual=new Map;pick($,Z,z){if(K0(Z))return;if(z(Z))return Z;this.residual.set($,f6(Z));return}modelled($,Z){return{index:(this.pick("index",$.index,Array.isArray)??[]).map(String),sessions:this.pick("memory.sessions",Z.sessions,Array.isArray)??[],preferences:structuredClone(this.pick("memory.preferences",Z.preferences,$0)??{}),custom:structuredClone(this.pick("memory.custom",Z.custom,$0)??{}),extra:dH($,NQ),memoryExtra:dH(Z,DQ)}}}function dH($,Z){let z={};for(let[Q,X]of Object.entries($))if(!Z.has(Q))z[Q]=structuredClone(X);return z}function iH($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function Gy($,Z,z,Q){if(!q0(Z))return e1($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return e1($,Z,X(z),X(Q))}import{readdirSync as Vy,readFileSync as Hy,statSync as oH,existsSync as Ky}from"fs";import{join as qy,basename as aH,resolve as By}from"path";var tH=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),My=/\[\[([^\]]+)\]\]/g;function Ly($){let Z=oH($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function Ny($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=r0(Z[1]);if(!z||typeof z!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:z,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function Dy($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!LQ.has(X))return null;let J=String(z.name).trim(),W=(z.description!==void 0&&z.description!==null&&String(z.description).trim()?String(z.description).trim():"")||J,U={};if(Q.originSessionId)U.provenance=[`session:${Q.originSessionId}`];let G=[...new Set([...Z.matchAll(My)].map((V)=>V[1]))].sort();return{text:W,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:Ly($),source:`claude-code memory: ${aH($)}`,extra:U}}function TQ($,Z={}){let z=By($);if(!Ky(z))throw Error(`Claude memory directory not found: ${z}`);if(!oH(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??tH,X=Z.namepoint??`@claude-code:${aH(z)}`,J=[],Y=Vy(z).filter((H)=>H.endsWith(".md")).sort();for(let H of Y){if(Q.has(H))continue;let K=qy(z,H),q;try{q=Hy(K,"utf-8")}catch{continue}let{fm:L,body:B}=Ny(q);if(!L)continue;let N=Dy(K,B,L);if(N)J.push(N)}let W=J.map((H)=>H.timestamp).filter(Boolean),U=W.length?W.reduce((H,K)=>H<K?H:K):N1(),G=W.length?W.reduce((H,K)=>H>K?H:K):U,V=new u0(X,{profile:"knowledge",facts:J,created:U});return V.last_etched=G,V.rebuildIndex(),V}function Iy($){try{return Oy($),!0}catch{return!1}}function AQ(){return O8(process.cwd(),"soul.fafm")}function CQ($){let Z=O8($??AQ());if(!$K(Z))console.error(`Error: soul file not found: ${Z}
577
+ Run 'faf init' to create one.`),process.exit(2);let z=l(Z);X2(z,Z);let Q=s(Z,()=>O0(z)),X=new c2(process.cwd()),J=X.load()?X.getBirthDNADisplay():null,Y=J?J.current:null,W=!Q.unknown,U=W&&Y!==null&&Y!==void 0?Q.score-Y:0,G=W&&Y!==null&&Y!==void 0&&U!==0,V=C9(Z),H=null,K=null;if(Dy(V))({bytes:H,left:K}=Iy(V,z,Ny(Oy(Z)),Z));if($.json)console.log(JSON.stringify({reGrounded:W,score:Q.score,...W?{}:{unknown:!0},tier:Q.tier,baseline:Y,delta:U,drifted:G,fafb:H!==null&&H!==void 0?{reCompiled:!0,bytes:H}:{reCompiled:!1,...K!==null?{left:K}:{}},journey:X.getJourney()||null},null,2));else Ty({result:Q,known:W,drifted:G,delta:U,prevScore:Y,fafbBytes:H,fafbLeft:K});if(!W)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),n5(X);else X.birth(Q.score)}n();import{existsSync as KK,lstatSync as hy}from"fs";import{resolve as T8}from"path";var eH=["ephemeral","standard","high","critical"],B$=Object.fromEntries(eH.map(($,Z)=>[$,Z])),RQ=new Set(["user","feedback","project","reference"]),FQ=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),PQ=new Set(["facts","sessions","preferences","custom"]),SQ={low:"ephemeral",medium:"standard"};import{existsSync as Ay}from"fs";import{dirname as JK,resolve as YK}from"path";function I1(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function K0($){return $===null||$===void 0}function Cy($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if(K0($))return"empty";if(typeof $==="string")return`a string (${JSON.stringify($.length>40?`${$.slice(0,40)}…`:$)})`;return`a ${typeof $}`}var D1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function _y($){let Z=YK($),z=d(JK(Z),Z,{read:!0});return{real:z,text:Q0(z)}}function $K($,Z,z,Q){let X=YK($),J=d(JK(X),X),Y=z!==void 0&&z.real===J;if(Y&&z.text===Z)return J;let W;try{W=k0(J)}catch{W=void 0}if(W&&W.equals(Buffer.from(Z,"utf-8")))return J;if(!Y&&!Q&&W)throw new v("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let U=Y?z.text:Q?W:null;return a($,Z,U===void 0?{}:{expect:U})}function I8($){if(K0($))return"standard";if(SQ[$])return SQ[$];if($ in B$)return $;return"standard"}var Ry=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function EQ($){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=$,z={};for(let[Q,X]of Object.entries(Z))if(!Ry.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:I8(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:z}}function O1($){if(K0($.id)&&K0($.type)&&$.tags.length===0&&$.links.length===0&&K0($.timestamp)&&K0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let z={text:$.text};if(!K0($.id))z.id=$.id;if(!K0($.type))z.type=$.type;if(z.priority=$.priority,$.tags.length)z.tags=$.tags;if($.links.length)z.links=$.links;if(!K0($.timestamp))z.timestamp=$.timestamp;if(!K0($.source))z.source=$.source;return Object.assign(z,$.extra),z}function ZK($){let Z=$;return D1($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&D1(Z.extra)&&typeof Z.priority==="string"?Z:EQ($)}function Fy($){if(typeof $==="string"||D1($)&&"text"in $)return EQ($);return null}var zK=["profile","namepoint","created","last_etched","retention"];class u0{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;_version;_origin;_factAt=new WeakMap;_indexDerived=!0;_indexAtRecord=[];constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??I1(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(ZK):[],this._byId=new Map,this._facts.forEach((z,Q)=>{if(!K0(z.id))this._byId.set(z.id,Q)}),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}:{},this._indexDerived=Z.index===void 0||B0(this._index,this.derivedIndex()),this._indexAtRecord=this._index.slice()}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(!Ay($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=_y($);return u0.fromText(z,$,Z)}static fromText($,Z,z){let Q=F3($,Z).toJS();if(!D1(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${Cy(Q)}`);let X=new WK,J=X.pick("memory",Q.memory,$0)??{},Y=new u0(String(Q.namepoint??Z.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(Q.profile??"voice"),retention:String(Q.retention??"forever"),created:Q.created??null,...X.modelled(Q,J)});return(X.pick("memory.facts",J.facts,Array.isArray)??[]).forEach((W,U)=>{let G=Fy(W);if(G)Y.adopt(G,U)}),Y.last_etched=String(Q.last_etched??Y.created),Y._version=K0(Q.version)?void 0:String(Q.version),Y._origin={path:Z,real:z,text:$,base:Y.state(),residual:X.residual},Y.recordIndex(),Y}recordIndex(){this._indexDerived=this.indexIsDerived(),this._indexAtRecord=this._index.slice()}adopt($,Z){if(this._facts.push($),!K0($.id))this._byId.set($.id,this._facts.length-1);this._factAt.set($,Z)}static fromFile($){return u0.load($)}toDoc(){let $={facts:this._facts.map(O1),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[z,Q]of Object.entries(this._memoryExtra))if(!PQ.has(z))$[z]=structuredClone(Q);let Z={version:this._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[z,Q]of Object.entries(this._extra))if(!FQ.has(z))Z[z]=structuredClone(Q);return Z}toYaml(){return f6(this.toDoc(),{lineWidth:100})}derivedIndex($=80){return this._facts.map((Z)=>`${Z.id??"?"} — ${String(Z.text).slice(0,$)}`)}indexIsDerived($=80){return!this._origin?.residual.has("index")&&B0(this._index,this.derivedIndex($))}rebuildIndex($=80){return this._index=this.derivedIndex($),this._indexDerived=!0,this._indexAtRecord=this._index.slice(),this._index}save($,Z={}){let z=Z.reindex??(this._indexDerived&&B0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let U=this.toYaml(),G=$K($,U,void 0,Q);return this.settle($,U,new Map(this._facts.map((V,H)=>[V,H])),G),$}let J=new Map,{text:Y}=_5(X.text,(U)=>{J=this.applyTo(U,X,z)},$),W=$K($,Y,X.real===void 0?void 0:{real:X.real,text:X.text},Q);return this.settle($,Y,J,W),$}toFile($,Z={}){return this.save($,Z)}settle($,Z,z,Q){this._factAt=new WeakMap;for(let[X,J]of z)this._factAt.set(X,J);this._origin={path:$,real:Q,text:Z,base:this.state(),residual:this._origin?.residual??new Map},this.recordIndex()}state(){let $=new Map;for(let Z of this._facts){let z=this._factAt.get(Z);if(z!==void 0)$.set(z,structuredClone(O1(Z)))}return{top:Object.fromEntries(zK.map((Z)=>[Z,this[Z]])),index:this._index.slice(),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom),extra:structuredClone(this._extra),memoryExtra:structuredClone(this._memoryExtra),facts:$}}static refuse($,Z,z){throw Error(`${$.path}: ${Z} is ${$.residual.get(Z)} in the file, not the shape faf writes — `+`faf keeps it as it is and will not ${z}. Nothing written.`)}applyTo($,Z,z){let Q=Z.base,X=this.state(),J=Z.path;for(let Y of zK)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!B0(Q.index,X.index)){if(Z.residual.has("index")&&!z)u0.refuse(Z,"index","replace it");F5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of XK(Q.extra,X.extra))F5($,[Y],Q.extra[Y],X.extra[Y],J);return this.applyMemory($,Z,Q,X),this.applyFacts($,Z)}applyMemory($,Z,z,Q){let X=[["sessions",z.sessions,Q.sessions],["preferences",z.preferences,Q.preferences],["custom",z.custom,Q.custom],...XK(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,W]of X){if(B0(Y,W))continue;if(Z.residual.has("memory"))u0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))u0.refuse(Z,`memory.${J}`,"replace it");F5($,["memory",J],Y,W,Z.path)}}sortFacts($){let Z=[],z=[];for(let Q of this._facts){let X=this._factAt.get(Q);if(X===void 0){z.push(Q);continue}if(z.length>0||Z.length>0&&X<=Z[Z.length-1][1])throw Error(`${$.path}: the facts were reordered — faf keeps the order soul.fafm has. Nothing written.`);Z.push([Q,X])}return{kept:Z,added:z}}applyFacts($,Z){let{kept:z,added:Q}=this.sortFacts(Z),X=new Set(z.map(([,G])=>G)),J=[...Z.base.facts.keys()].filter((G)=>!X.has(G)).sort((G,V)=>V-G),Y=z.filter(([G,V])=>!B0(Z.base.facts.get(V),O1(G))),W=new Map(z);if(Q.length===0&&J.length===0&&Y.length===0)return W;for(let G of["memory","memory.facts"])if(Z.residual.has(G))u0.refuse(Z,G,"add facts to it");let U=iY($,["memory","facts"],Z.path);for(let[G,V]of Y)U.items[V]=Sy($,U.items[V],Z.base.facts.get(V),O1(G));for(let G of J)U.items.splice(G,1);for(let[G,V]of z)W.set(G,V-J.filter((H)=>H<V).length);for(let G of Q)W.set(G,U.items.length),U.items.push($.createNode(O1(G)));return W}add($){let Z=ZK($);if(!K0(Z.id)&&this._byId.has(Z.id)){let z=this._byId.get(Z.id);if(z!==void 0){let Q=this._factAt.get(this._facts[z]);if(this._facts[z]=Z,Q!==void 0)this._factAt.set(Z,Q)}}else if(this._facts.push(Z),!K0(Z.id))this._byId.set(Z.id,this._facts.length-1);if(Z.timestamp&&Z.timestamp>(this.last_etched||""))this.last_etched=Z.timestamp;return Z}etch($,Z={}){let z=K0(Z.id)?null:this.getFact(Z.id);if(z)return this.add(Py(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:I8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:I1(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=D1($)?{...$,...Z}:Z,Q=D1($)?$.query:$,X=B$[I8(z.minPriority??"ephemeral")]??0,J=typeof Q==="string"?Q.toLowerCase():"",Y=new Set(z.tags??[]),W=[];this._facts.forEach((G,V)=>{if(J&&!String(G.text??"").toLowerCase().includes(J))return;if(Y.size>0&&![...Y].some((H)=>(G.tags??[]).includes(H)))return;if(!K0(z.type)&&G.type!==z.type)return;if((B$[G.priority]??1)<X)return;W.push([V,G])}),W.sort((G,V)=>{let H=B$[G[1].priority]??1,K=B$[V[1].priority]??1;if(K!==H)return K-H;let q=G[1].timestamp??"",L=V[1].timestamp??"";if(L!==q)return L<q?-1:L>q?1:0;return V[0]-G[0]});let U=W.map(([,G])=>G);if(!K0(z.limit))return U.slice(0,z.limit);return U}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((z,Q)=>{if(!K0(z.id))this._byId.set(z.id,Q)}),!0}}function Py($,Z,z){let Q=(X,J)=>K0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:K0(z.priority)?$.priority:I8(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:I1(),extra:{...$.extra}}}class WK{residual=new Map;pick($,Z,z){if(K0(Z))return;if(z(Z))return Z;this.residual.set($,m6(Z));return}modelled($,Z){return{index:(this.pick("index",$.index,Array.isArray)??[]).map(String),sessions:this.pick("memory.sessions",Z.sessions,Array.isArray)??[],preferences:structuredClone(this.pick("memory.preferences",Z.preferences,$0)??{}),custom:structuredClone(this.pick("memory.custom",Z.custom,$0)??{}),extra:QK($,FQ),memoryExtra:QK(Z,PQ)}}}function QK($,Z){let z={};for(let[Q,X]of Object.entries($))if(!Z.has(Q))z[Q]=structuredClone(X);return z}function XK($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function Sy($,Z,z,Q){if(!q0(Z))return z4($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return z4($,Z,X(z),X(Q))}import{readdirSync as Ey,readFileSync as jy,statSync as UK,existsSync as wy}from"fs";import{join as xy,basename as GK,resolve as yy}from"path";var VK=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),ky=/\[\[([^\]]+)\]\]/g;function by($){let Z=UK($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function vy($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=r0(Z[1]);if(!z||typeof z!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:z,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function gy($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!RQ.has(X))return null;let J=String(z.name).trim(),W=(z.description!==void 0&&z.description!==null&&String(z.description).trim()?String(z.description).trim():"")||J,U={};if(Q.originSessionId)U.provenance=[`session:${Q.originSessionId}`];let G=[...new Set([...Z.matchAll(ky)].map((V)=>V[1]))].sort();return{text:W,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:by($),source:`claude-code memory: ${GK($)}`,extra:U}}function jQ($,Z={}){let z=yy($);if(!wy(z))throw Error(`Claude memory directory not found: ${z}`);if(!UK(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??VK,X=Z.namepoint??`@claude-code:${GK(z)}`,J=[],Y=Ey(z).filter((H)=>H.endsWith(".md")).sort();for(let H of Y){if(Q.has(H))continue;let K=xy(z,H),q;try{q=jy(K,"utf-8")}catch{continue}let{fm:L,body:B}=vy(q);if(!L)continue;let N=gy(K,B,L);if(N)J.push(N)}let W=J.map((H)=>H.timestamp).filter(Boolean),U=W.length?W.reduce((H,K)=>H<K?H:K):I1(),G=W.length?W.reduce((H,K)=>H>K?H:K):U,V=new u0(X,{profile:"knowledge",facts:J,created:U});return V.last_etched=G,V.rebuildIndex(),V}function fy($){try{return hy($),!0}catch{return!1}}function wQ(){return T8(process.cwd(),"soul.fafm")}function xQ($){let Z=T8($??wQ());if(!KK(Z))console.error(`Error: soul file not found: ${Z}
575
578
 
576
- Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return u0.load(Z)}function Ty($,Z){if(!$)console.error(`Error: directory required
579
+ Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return u0.load(Z)}function uy($,Z){if(!$)console.error(`Error: directory required
577
580
 
578
- faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=O8($),Q=O8(Z.output??AQ());if(Iy(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${C("--force")} to overwrite.`),process.exit(1);try{let X=TQ(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${T("memory convert")} ${M("—")} ${X.facts.length} facts → ${Q}`),console.log(M(` namepoint ${X.namepoint} profile ${X.profile} index ${X.index.length}`))}catch(X){console.error(`Error: ${X instanceof Error?X.message:X}`),process.exit(1)}}function Ay($){let Z=CQ($.file);if($.json){console.log(JSON.stringify(Z.facts.map((z)=>({id:z.id,text:z.text,type:z.type,priority:z.priority,tags:z.tags})),null,2));return}console.log(`${T("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
579
- `);for(let z of Z.recall()){let Q=z.id?C(z.id):M("(no-id)"),X=[z.type,z.priority].filter(Boolean).join(" · ");if(console.log(` ${Q} ${z.text.slice(0,80)}`),X)console.log(M(` ${X}`))}}function Cy($,Z){let z=CQ(Z.file),Q=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,X=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,J=z.recall($??null,{tags:Q,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(X)?X:null});if(Z.json){console.log(JSON.stringify(J.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${T("memory recall")} ${M(`— ${J.length} hit(s)`)}${$?M(` for "${$}"`):""}
580
- `);for(let Y of J)console.log(` ${Y.id?C(Y.id):M("?")} ${Y.text}`)}function _y($,Z){if(!$)console.error(`Error: text required
581
+ faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=T8($),Q=T8(Z.output??wQ());if(fy(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${C("--force")} to overwrite.`),process.exit(1);try{let X=jQ(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${T("memory convert")} ${M("—")} ${X.facts.length} facts → ${Q}`),console.log(M(` namepoint ${X.namepoint} profile ${X.profile} index ${X.index.length}`))}catch(X){console.error(`Error: ${X instanceof Error?X.message:X}`),process.exit(1)}}function my($){let Z=xQ($.file);if($.json){console.log(JSON.stringify(Z.facts.map((z)=>({id:z.id,text:z.text,type:z.type,priority:z.priority,tags:z.tags})),null,2));return}console.log(`${T("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
582
+ `);for(let z of Z.recall()){let Q=z.id?C(z.id):M("(no-id)"),X=[z.type,z.priority].filter(Boolean).join(" · ");if(console.log(` ${Q} ${z.text.slice(0,80)}`),X)console.log(M(` ${X}`))}}function cy($,Z){let z=xQ(Z.file),Q=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,X=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,J=z.recall($??null,{tags:Q,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(X)?X:null});if(Z.json){console.log(JSON.stringify(J.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${T("memory recall")} ${M(`— ${J.length} hit(s)`)}${$?M(` for "${$}"`):""}
583
+ `);for(let Y of J)console.log(` ${Y.id?C(Y.id):M("?")} ${Y.text}`)}function py($,Z){if(!$)console.error(`Error: text required
581
584
 
582
- faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=O8(Z.file??AQ()),Q=$K(z)?u0.load(z):new u0(Z.namepoint??"@local",{profile:"knowledge"}),X=Q.indexIsDerived(),J=Q.etch($,{id:Z.id,type:Z.type,priority:Z.priority});Q.toFile(z,{reindex:X}),console.log(`${T("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${z}`)}function Ry($){let Z=CQ($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${T("memory show")} ${M(`— ${Z.namepoint}`)}
585
+ faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=T8(Z.file??wQ()),Q=KK(z)?u0.load(z):new u0(Z.namepoint??"@local",{profile:"knowledge"}),X=Q.indexIsDerived(),J=Q.etch($,{id:Z.id,type:Z.type,priority:Z.priority});Q.toFile(z,{reindex:X}),console.log(`${T("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${z}`)}function ly($){let Z=xQ($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${T("memory show")} ${M(`— ${Z.namepoint}`)}
583
586
  `),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(`
584
- ${C("index")}`);for(let z of Z.index.slice(0,20))console.log(M(` ${z}`));if(Z.index.length>20)console.log(M(` … +${Z.index.length-20} more`))}}function ZK($,Z,z={}){if(Z&&typeof Z==="object")z=Z,Z=void 0;switch($){case"convert":Ty(Z,z);break;case"ls":case"list":Ay(z);break;case"recall":Cy(Z,z);break;case"etch":_y(Z,z);break;case"show":Ry(z);break;case void 0:case"help":eH();break;default:console.error(`Unknown memory subcommand: ${$}`),eH(),process.exit(2)}}function eH(){console.log(`${T("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
587
+ ${C("index")}`);for(let z of Z.index.slice(0,20))console.log(M(` ${z}`));if(Z.index.length>20)console.log(M(` … +${Z.index.length-20} more`))}}function qK($,Z,z={}){if(Z&&typeof Z==="object")z=Z,Z=void 0;switch($){case"convert":uy(Z,z);break;case"ls":case"list":my(z);break;case"recall":cy(Z,z);break;case"etch":py(Z,z);break;case"show":ly(z);break;case void 0:case"help":HK();break;default:console.error(`Unknown memory subcommand: ${$}`),HK(),process.exit(2)}}function HK(){console.log(`${T("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
585
588
  `),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
586
- `),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json · --force")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:QK}=n9(),g=new pQ;g.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(QK,"-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(($)=>X9($));g.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>rW());g.command("auto").description("Fill every tech slot from the repo, then score").action(()=>i5());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(($)=>oW($));g.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>EV($));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)=>w5($,Z));g.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key; grade saves .faf-bench.json)").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 (mcpaas.live; --endpoint to change)").option("--endpoint <url>","Override the submit endpoint").action(($,Z,z)=>fH($,Z,z));g.command("show").description("Render project.faf → project.html and open it").option("--force","Replace a project.html faf cannot prove it rendered (edited since, or not faf's)").action(($)=>jG($));g.command("sync").description(".faf → CLAUDE.md — writes faf's block only; Pro also updates Claude Code's MEMORY.md (--direction pull: Trophy-gated backfill into .faf)").option("--watch","Watch for changes").option("--direction <dir>","auto|push write CLAUDE.md from .faf; pull backfills .faf at ✪ Trophy","auto").action(($)=>M9($));g.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").option("--force","Replace an output file that is not a .fafb faf compiled").action(($,Z)=>RU($,Z));g.command("decompile <file>").description("Decompile .fafb to JSON (prints; --output writes a file)").option("--output <path>","Output path").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a faf decompile)").action(($,Z)=>vU($,Z));g.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref) — shallow-clones to a temp dir, writes ./project.faf (--stdout to print)").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)=>bG($,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)=>nG($,Z));g.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>cG($??[]));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(($)=>rG($));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(($)=>UV($));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(($)=>WV($));g.command("export").description("Write agent files from .faf — bare: AGENTS.md, .cursorrules, GEMINI.md, Copilot instructions, project.html").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 (opt-in; never on --all)").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 (./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").option("--force","Replace a project.html or Server Card faf cannot prove it wrote (edited since, or not faf's)").action(($)=>Z$($));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)").option("--force","With --out: replace a file faf cannot prove it wrote (edited since, or no faf identity)").action(($)=>IG($));g.command("cards").description("Write the cards your files allow: an agent.fafa alone → AI Catalog + ARD; with project.faf → A2A, MCP and registry too (--check prints, writes nothing)").option("--target <list>","Comma list: a2a,mcp,registry,catalog,ard (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").option("--force","Replace a card file faf cannot prove it wrote (edited since, or not faf's)").action(($)=>GZ($));var zK=($,Z=[])=>[...Z,$],Py=g.command("card").description("One card at a time");Py.command("init").description("Write an agent.fafa from seven answers: name, short name, domain, what it does, version, where it runs, what it can do").option("--name <name>",'Name people see, e.g. "Weather Agent"').option("--short-name <handle>","Short name, lowercase (default: from --name)").option("--domain <domain>","Domain it is published under, e.g. example.com").option("--description <text>","What it does, one sentence").option("--set-version <version>","Its version. NOTE: not --version, which is the global CLI-version flag").option("--url <url>","Where it runs: a URL people call").option("--protocol <protocol>","Protocol at --url: a2a or mcp (default: a2a)").option("--package <name>","Where it runs: an npm package people install").option("--skill <skill>",'What it can do, "Name: description" (repeatable)',zK).option("--example <question>","A question people ask it; search finds it by these (repeatable, 2-5)",zK).option("--dir <path>","Working directory (default: cwd)").option("--out <path>","Output path (default: ./agent.fafa)").option("--force","Replace an existing agent.fafa").action(($)=>EG($));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)=>F9($,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(($)=>GV($));g.command("formats").description("Show supported formats").action(()=>VV());g.command("clear").description("Delete faf's cached clones (faf-git-* temp dirs)").action(()=>HV());g.command("convert").description("Print .faf as YAML or JSON (writes nothing)").option("--json","Output as JSON").action(($)=>KV($));g.command("context").description("Author context output").action(()=>qV());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(($)=>uH($));g.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>NV($));g.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>DV($,Z));g.command("recover").description("Recover .faf from context files").action(()=>OV());g.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>IV($));g.command("pro [subcommand]").description("Pro features & licensing (activate opens faf.one/pro)").action(($)=>TV($));g.command("share").description("Print a faf.one share link for .faf (built locally — nothing is sent)").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>AV($));g.command("demo").description("Demo walkthrough").action(()=>CV());g.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>_V($,Z));g.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` prints the CI receipt workflow (--write creates it); bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a TAF snapshot)").action(($,Z)=>PV($,Z));g.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze) — sends it to the Anthropic API, writes nothing").action(($)=>EH($));g.command("conductor [subcommand] [path]").description("Conductor config — import <path> merges into .faf; export prints it").action(($,Z)=>wH($,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(($)=>yH($));g.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show (etch and convert write soul.fafm)").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").option("--force","Overwrite an existing soul.fafm (convert)").action(($,Z,z)=>ZK($,Z,z));g.command("bi-sync",{hidden:!0}).action(()=>M9());g.command("status",{hidden:!0}).action(()=>w5(void 0,{status:!0}));g.command("agents",{hidden:!0}).action(()=>Z$({agents:!0}));g.command("cursor",{hidden:!0}).action(()=>Z$({cursor:!0}));g.command("gemini",{hidden:!0}).action(()=>Z$({gemini:!0}));g.command("grok",{hidden:!0}).action(()=>Z$({grok:!0}));g.command("llms",{hidden:!0}).action(()=>Z$({llms:!0}));g.command("validate [file]",{hidden:!0}).action(($)=>F9($));g.command("yolo",{hidden:!0}).action(()=>X9({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z}=await Promise.resolve().then(() => (i(),sY)),Q=process.cwd().replace(process.env.HOME??"","~"),X="\x1B[38;2;150;150;150m",J="\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"} ${z($("faf"))} ${Z(`v${QK}`)}`);let G="\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(`${G}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${Q}`)}`),console.log("");try{await w5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("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."',"","What touches what:"," read-only score check dna context drift log convert search share, diff (no --install-driver)"," sends data ai analyze (Anthropic API) · bench --submit (mcpaas.live)"," every command https://docs.faf.one/side-effects",""].join(`
587
- `)),g.parseAsync(process.argv).catch(($)=>{if(!v$($))throw $;console.error(L6($,Fy())),process.exit(1)});function Fy(){let $=process.argv[2];return g.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
589
+ `),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json · --force")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:MK}=zz(),h=new tQ;h.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(MK,"-v, --version");h.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(($)=>G9($));h.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>QU());h.command("auto").description("Fill every tech slot from the repo, then score").action(()=>r5());h.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(($)=>JU($));h.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>mV($));h.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)=>y5($,Z));h.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key; grade saves .faf-bench.json)").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 (mcpaas.live; --endpoint to change)").option("--endpoint <url>","Override the submit endpoint").action(($,Z,z)=>aH($,Z,z));h.command("show").description("Render project.faf → project.html and open it").option("--force","Replace a project.html faf cannot prove it rendered (edited since, or not faf's)").action(($)=>cG($));h.command("sync").description(".faf → CLAUDE.md — writes faf's block only; Pro also updates Claude Code's MEMORY.md (--direction pull: Trophy-gated backfill into .faf)").option("--watch","Watch for changes").option("--direction <dir>","auto|push write CLAUDE.md from .faf; pull backfills .faf at ✪ Trophy","auto").action(($)=>I9($));h.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").option("--force","Replace an output file that is not a .fafb faf compiled").action(($,Z)=>kU($,Z));h.command("decompile <file>").description("Decompile .fafb to JSON (prints; --output writes a file)").option("--output <path>","Output path").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a faf decompile)").action(($,Z)=>dU($,Z));h.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref) — shallow-clones to a temp dir, writes ./project.faf (--stdout to print)").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)=>nG($,Z));h.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)=>JV($,Z));h.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>$V($??[]));h.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(($)=>YV($));h.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(($)=>IV($));h.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(($)=>DV($));h.command("export").description("Write agent files from .faf — bare: AGENTS.md, .cursorrules, GEMINI.md, Copilot instructions, project.html").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 (opt-in; never on --all)").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 (./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").option("--force","Replace a project.html or Server Card faf cannot prove it wrote (edited since, or not faf's)").action(($)=>J$($));h.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)").option("--force","With --out: replace a file faf cannot prove it wrote (edited since, or no faf identity)").action(($)=>jG($));h.command("cards").description("Write the cards your files allow. BETTER: an agent.fafa → A2A card, MCP Server Card, registry, AI Catalog, ARD (as its endpoints allow). BEST: + project.faf → the same cards with FAF context (--check prints, writes nothing)").option("--target <list>","Comma list: a2a,mcp,registry,catalog,ard (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").option("--force","Replace a card file faf cannot prove it wrote (edited since, or not faf's)").action(($)=>qZ($));var BK=($,Z=[])=>[...Z,$],dy=h.command("card").description("One card at a time");dy.command("init").description("Write an agent.fafa from seven answers: name, short name, domain, what it does, version, where it runs, what it can do").option("--name <name>",'Name people see, e.g. "Weather Agent"').option("--short-name <handle>","Short name, lowercase (default: from --name)").option("--domain <domain>","Domain it is published under, e.g. example.com").option("--description <text>","What it does, one sentence").option("--set-version <version>","Its version. NOTE: not --version, which is the global CLI-version flag").option("--url <url>","Where it runs: a URL people call").option("--protocol <protocol>","Protocol at --url: a2a or mcp (default: a2a)").option("--package <name>","Where it runs: an npm package people install").option("--skill <skill>",'What it can do, "Name: description" (repeatable)',BK).option("--example <question>","A question people ask it; search finds it by these (repeatable, 2-5)",BK).option("--dir <path>","Working directory (default: cwd)").option("--out <path>","Output path (default: ./agent.fafa)").option("--force","Replace an existing agent.fafa").action(($)=>mG($));h.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)=>x9($,Z));h.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(($)=>TV($));h.command("formats").description("Show supported formats").action(()=>AV());h.command("clear").description("Delete faf's cached clones (faf-git-* temp dirs)").action(()=>CV());h.command("convert").description("Print .faf as YAML or JSON (writes nothing)").option("--json","Output as JSON").action(($)=>_V($));h.command("context").description("Author context output").action(()=>RV());h.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(($)=>tH($));h.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>EV($));h.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>jV($,Z));h.command("recover").description("Recover .faf from context files").action(()=>wV());h.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>xV($));h.command("pro [subcommand]").description("Pro features & licensing (activate opens faf.one/pro)").action(($)=>yV($));h.command("share").description("Print a faf.one share link for .faf (built locally — nothing is sent)").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>kV($));h.command("demo").description("Demo walkthrough").action(()=>bV());h.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>vV($,Z));h.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` prints the CI receipt workflow (--write creates it); bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a TAF snapshot)").action(($,Z)=>hV($,Z));h.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze) — sends it to the Anthropic API, writes nothing").action(($)=>mH($));h.command("conductor [subcommand] [path]").description("Conductor config — import <path> merges into .faf; export prints it").action(($,Z)=>pH($,Z));h.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(($)=>dH($));h.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show (etch and convert write soul.fafm)").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").option("--force","Overwrite an existing soul.fafm (convert)").action(($,Z,z)=>qK($,Z,z));h.command("bi-sync",{hidden:!0}).action(()=>I9());h.command("status",{hidden:!0}).action(()=>y5(void 0,{status:!0}));h.command("agents",{hidden:!0}).action(()=>J$({agents:!0}));h.command("cursor",{hidden:!0}).action(()=>J$({cursor:!0}));h.command("gemini",{hidden:!0}).action(()=>J$({gemini:!0}));h.command("grok",{hidden:!0}).action(()=>J$({grok:!0}));h.command("llms",{hidden:!0}).action(()=>J$({llms:!0}));h.command("validate [file]",{hidden:!0}).action(($)=>x9($));h.command("yolo",{hidden:!0}).action(()=>G9({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z}=await Promise.resolve().then(() => (n(),XW)),Q=process.cwd().replace(process.env.HOME??"","~"),X="\x1B[38;2;150;150;150m",J="\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"} ${z($("faf"))} ${Z(`v${MK}`)}`);let G="\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(`${G}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${Q}`)}`),console.log("");try{await y5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else h.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."',"","What touches what:"," read-only score check dna context drift log convert search share, diff (no --install-driver)"," sends data ai analyze (Anthropic API) · bench --submit (mcpaas.live)"," every command https://docs.faf.one/side-effects",""].join(`
590
+ `)),h.parseAsync(process.argv).catch(($)=>{if(!u$($))throw $;console.error(O6($,iy())),process.exit(1)});function iy(){let $=process.argv[2];return h.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
588
591
 
589
- //# debugId=E6E61CDABA8A3E2F64756E2164756E21
592
+ //# debugId=C60E587E6E05D42664756E2164756E21
590
593
  //# sourceMappingURL=cli.js.map