faf-cli 8.8.0 → 8.9.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,64 +1,64 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as YK}from"node:module";var oq=Object.create;var{getPrototypeOf:aq,defineProperty:X7,getOwnPropertyNames:tq}=Object;var eq=Object.prototype.hasOwnProperty;function $K($){return this[$]}var ZK,zK,QK=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?ZK??=new WeakMap:zK??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?oq(aq($)):{};let Y=Z||!$||!$.__esModule?X7(z,"default",{value:$,enumerable:!0}):z;for(let W of tq($))if(!eq.call(Y,W))X7(Y,W,{get:$K.bind($,W),enumerable:!0});if(Q)X.set($,Y);return Y};var P=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var XK=($)=>$;function JK($,Z){this[$]=XK.bind(null,Z)}var eQ=($,Z)=>{for(var z in Z)X7($,z,{get:Z[z],enumerable:!0,configurable:!0,set:JK.bind(Z,z)})};var g=($,Z)=>()=>($&&(Z=$($=0)),Z);var n0=YK(import.meta.url);var A1=P((WK)=>{class J7 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 $X extends J7{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}WK.CommanderError=J7;WK.InvalidArgumentError=$X});var F4=P((qK)=>{var{InvalidArgumentError:VK}=A1();class ZX{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 VK(`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 HK($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}qK.Argument=ZX;qK.humanReadableArgName=HK});var Y7=P((LK)=>{var{humanReadableArgName:MK}=F4();class zX{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)=>MK(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 q=V.map((K)=>{return X(Z.styleOptionTerm(Z.optionTerm(K)),Z.styleOptionDescription(Z.optionDescription(K)))});J=J.concat(this.formatItemList(H,q,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 q=V.map((K)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(K)),Z.styleSubcommandDescription(Z.subcommandDescription(K)))});J=J.concat(this.formatItemList(H,q,Z))}),J.join(`
3
- `)}displayWidth($){return QX($).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 KK}from"node:module";var QK=Object.create;var{getPrototypeOf:XK,defineProperty:Y7,getOwnPropertyNames:JK}=Object;var YK=Object.prototype.hasOwnProperty;function WK($){return this[$]}var UK,GK,VK=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?UK??=new WeakMap:GK??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?QK(XK($)):{};let Y=Z||!$||!$.__esModule?Y7(z,"default",{value:$,enumerable:!0}):z;for(let W of JK($))if(!YK.call(Y,W))Y7(Y,W,{get:WK.bind($,W),enumerable:!0});if(Q)X.set($,Y);return Y};var P=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var HK=($)=>$;function qK($,Z){this[$]=HK.bind(null,Z)}var zX=($,Z)=>{for(var z in Z)Y7($,z,{get:Z[z],enumerable:!0,configurable:!0,set:qK.bind(Z,z)})};var g=($,Z)=>()=>($&&(Z=$($=0)),Z);var c0=KK(import.meta.url);var A1=P((BK)=>{class W7 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 QX extends W7{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}BK.CommanderError=W7;BK.InvalidArgumentError=QX});var j8=P((OK)=>{var{InvalidArgumentError:NK}=A1();class XX{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 NK(`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 DK($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}OK.Argument=XX;OK.humanReadableArgName=DK});var U7=P((CK)=>{var{humanReadableArgName:AK}=j8();class JX{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)=>AK(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 q=V.map((K)=>{return X(Z.styleOptionTerm(Z.optionTerm(K)),Z.styleOptionDescription(Z.optionDescription(K)))});J=J.concat(this.formatItemList(H,q,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 q=V.map((K)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(K)),Z.styleSubcommandDescription(Z.subcommandDescription(K)))});J=J.concat(this.formatItemList(H,q,Z))}),J.join(`
3
+ `)}displayWidth($){return YX($).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 QX($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}LK.Help=zX;LK.stripColor=QX});var W7=P((TK)=>{var{InvalidArgumentError:OK}=A1();class JX{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=IK($);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 OK(`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 XX(this.name().replace(/^no-/,""));return XX(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class YX{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 XX($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function IK($){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 YX($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}CK.Help=JX;CK.stripColor=YX});var G7=P((SK)=>{var{InvalidArgumentError:PK}=A1();class UX{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=FK($);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 PK(`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 WX(this.name().replace(/^no-/,""));return WX(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class GX{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 WX($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function FK($){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}}TK.Option=JX;TK.DualOptions=YX});var WX=P((PK)=>{function _K($,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 RK($,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=_K($,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}}SK.Option=UX;SK.DualOptions=GX});var VX=P((yK)=>{function wK($,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 xK($,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=wK($,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""}PK.suggestSimilar=RK});var HX=P((kK)=>{var SK=n0("node:events").EventEmitter,U7=n0("node:child_process"),g2=n0("node:path"),S4=n0("node:fs"),$0=n0("node:process"),{Argument:jK,humanReadableArgName:EK}=F4(),{CommanderError:G7}=A1(),{Help:wK,stripColor:xK}=Y7(),{Option:UX,DualOptions:yK}=W7(),{suggestSimilar:GX}=WX();class H7 extends SK{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)=>$0.stdout.write(Z),writeErr:(Z)=>$0.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>$0.stdout.isTTY?$0.stdout.columns:void 0,getErrHelpWidth:()=>$0.stderr.isTTY?$0.stderr.columns:void 0,getOutHasColors:()=>V7()??($0.stdout.isTTY&&$0.stdout.hasColors?.()),getErrHasColors:()=>V7()??($0.stderr.isTTY&&$0.stderr.hasColors?.()),stripColor:(Z)=>xK(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 H7($)}createHelp(){return Object.assign(new wK,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 jK($,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 G7($,Z,z));$0.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 UX($,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 UX)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($0.versions?.electron)Z.from="electron";let Q=$0.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=$0.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if($0.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(S4.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""}yK.suggestSimilar=xK});var BX=P((mK)=>{var bK=c0("node:events").EventEmitter,V7=c0("node:child_process"),g2=c0("node:path"),E8=c0("node:fs"),$0=c0("node:process"),{Argument:vK,humanReadableArgName:gK}=j8(),{CommanderError:H7}=A1(),{Help:hK,stripColor:fK}=U7(),{Option:HX,DualOptions:uK}=G7(),{suggestSimilar:qX}=VX();class K7 extends bK{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)=>$0.stdout.write(Z),writeErr:(Z)=>$0.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>$0.stdout.isTTY?$0.stdout.columns:void 0,getErrHelpWidth:()=>$0.stderr.isTTY?$0.stderr.columns:void 0,getOutHasColors:()=>q7()??($0.stdout.isTTY&&$0.stdout.hasColors?.()),getErrHasColors:()=>q7()??($0.stderr.isTTY&&$0.stderr.hasColors?.()),stripColor:(Z)=>fK(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 K7($)}createHelp(){return Object.assign(new hK,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 vK($,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 H7($,Z,z));$0.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 HX($,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 HX)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($0.versions?.electron)Z.from="electron";let Q=$0.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=$0.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if($0.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(E8.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=g2.resolve(G,V);if(S4.existsSync(H))return H;if(Q.includes(g2.extname(V)))return;let q=Q.find((K)=>S4.existsSync(`${H}${K}`));if(q)return`${H}${q}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=S4.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=g2.resolve(g2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=g2.basename(this._scriptPath,g2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(g2.extname(J));let W;if($0.platform!=="win32")if(z)Z.unshift(J),Z=VX($0.execArgv).concat(Z),W=U7.spawn($0.argv[0],Z,{stdio:"inherit"});else W=U7.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=VX($0.execArgv).concat(Z),W=U7.spawn($0.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{$0.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)$0.exit(G);else U(new G7(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)$0.exit(1);else{let V=new G7(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=g2.resolve(G,V);if(E8.existsSync(H))return H;if(Q.includes(g2.extname(V)))return;let q=Q.find((K)=>E8.existsSync(`${H}${K}`));if(q)return`${H}${q}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=E8.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=g2.resolve(g2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=g2.basename(this._scriptPath,g2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(g2.extname(J));let W;if($0.platform!=="win32")if(z)Z.unshift(J),Z=KX($0.execArgv).concat(Z),W=V7.spawn($0.argv[0],Z,{stdio:"inherit"});else W=V7.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=KX($0.execArgv).concat(Z),W=V7.spawn($0.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{$0.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)$0.exit(G);else U(new H7(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)$0.exit(1);else{let V=new H7(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 $0.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,$0.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new yK(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=GX($,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=GX($,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 EK(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=g2.basename($,g2.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($0.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 $0.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,$0.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new uK(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=qX($,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=qX($,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 gK(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=g2.basename($,g2.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($0.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 VX($){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 V7(){if($0.env.NO_COLOR||$0.env.FORCE_COLOR==="0"||$0.env.FORCE_COLOR==="false")return!1;if($0.env.FORCE_COLOR||$0.env.CLICOLOR_FORCE!==void 0)return!0;return}kK.Command=H7;kK.useColor=V7});var MX=P((fK)=>{var{Argument:qX}=F4(),{Command:q7}=HX(),{CommanderError:gK,InvalidArgumentError:KX}=A1(),{Help:hK}=Y7(),{Option:BX}=W7();fK.program=new q7;fK.createCommand=($)=>new q7($);fK.createOption=($,Z)=>new BX($,Z);fK.createArgument=($,Z)=>new qX($,Z);fK.Command=q7;fK.Option=BX;fK.Argument=qX;fK.Help=hK;fK.CommanderError=gK;fK.InvalidArgumentError=KX;fK.InvalidOptionArgumentError=KX});var t=P((XB)=>{var K7=Symbol.for("yaml.alias"),DX=Symbol.for("yaml.document"),j4=Symbol.for("yaml.map"),OX=Symbol.for("yaml.pair"),B7=Symbol.for("yaml.scalar"),E4=Symbol.for("yaml.seq"),h2=Symbol.for("yaml.node.type"),aK=($)=>!!$&&typeof $==="object"&&$[h2]===K7,tK=($)=>!!$&&typeof $==="object"&&$[h2]===DX,eK=($)=>!!$&&typeof $==="object"&&$[h2]===j4,$B=($)=>!!$&&typeof $==="object"&&$[h2]===OX,IX=($)=>!!$&&typeof $==="object"&&$[h2]===B7,ZB=($)=>!!$&&typeof $==="object"&&$[h2]===E4;function TX($){if($&&typeof $==="object")switch($[h2]){case j4:case E4:return!0}return!1}function zB($){if($&&typeof $==="object")switch($[h2]){case K7:case j4:case B7:case E4:return!0}return!1}var QB=($)=>(IX($)||TX($))&&!!$.anchor;XB.ALIAS=K7;XB.DOC=DX;XB.MAP=j4;XB.NODE_TYPE=h2;XB.PAIR=OX;XB.SCALAR=B7;XB.SEQ=E4;XB.hasAnchor=QB;XB.isAlias=aK;XB.isCollection=TX;XB.isDocument=tK;XB.isMap=eK;XB.isNode=zB;XB.isPair=$B;XB.isScalar=IX;XB.isSeq=ZB});var C1=P((TB)=>{var T0=t(),p0=Symbol("break visit"),AX=Symbol("skip children"),j2=Symbol("remove node");function w4($,Z){let z=CX(Z);if(T0.isDocument($)){if(B$(null,$.contents,z,Object.freeze([$]))===j2)$.contents=null}else B$(null,$,z,Object.freeze([]))}w4.BREAK=p0;w4.SKIP=AX;w4.REMOVE=j2;function B$($,Z,z,Q){let X=_X($,Z,z,Q);if(T0.isNode(X)||T0.isPair(X))return RX($,Q,X),B$($,X,z,Q);if(typeof X!=="symbol"){if(T0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=B$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===p0)return p0;else if(Y===j2)Z.items.splice(J,1),J-=1}}else if(T0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=B$("key",Z.key,z,Q);if(J===p0)return p0;else if(J===j2)Z.key=null;let Y=B$("value",Z.value,z,Q);if(Y===p0)return p0;else if(Y===j2)Z.value=null}}return X}async function x4($,Z){let z=CX(Z);if(T0.isDocument($)){if(await M$(null,$.contents,z,Object.freeze([$]))===j2)$.contents=null}else await M$(null,$,z,Object.freeze([]))}x4.BREAK=p0;x4.SKIP=AX;x4.REMOVE=j2;async function M$($,Z,z,Q){let X=await _X($,Z,z,Q);if(T0.isNode(X)||T0.isPair(X))return RX($,Q,X),M$($,X,z,Q);if(typeof X!=="symbol"){if(T0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=await M$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===p0)return p0;else if(Y===j2)Z.items.splice(J,1),J-=1}}else if(T0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await M$("key",Z.key,z,Q);if(J===p0)return p0;else if(J===j2)Z.key=null;let Y=await M$("value",Z.value,z,Q);if(Y===p0)return p0;else if(Y===j2)Z.value=null}}return X}function CX($){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 _X($,Z,z,Q){if(typeof z==="function")return z($,Z,Q);if(T0.isMap(Z))return z.Map?.($,Z,Q);if(T0.isSeq(Z))return z.Seq?.($,Z,Q);if(T0.isPair(Z))return z.Pair?.($,Z,Q);if(T0.isScalar(Z))return z.Scalar?.($,Z,Q);if(T0.isAlias(Z))return z.Alias?.($,Z,Q);return}function RX($,Z,z){let Q=Z[Z.length-1];if(T0.isCollection(Q))Q.items[$]=z;else if(T0.isPair(Q))if($==="key")Q.key=z;else Q.value=z;else if(T0.isDocument(Q))Q.contents=z;else{let X=T0.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}TB.visit=w4;TB.visitAsync=x4});var M7=P((FB)=>{var PX=t(),_B=C1(),RB={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},PB=($)=>$.replace(/[!,[\]{}]/g,(Z)=>RB[Z]);class Q2{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Q2.defaultYaml,$),this.tags=Object.assign({},Q2.defaultTags,Z)}clone(){let $=new Q2(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new Q2(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Q2.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Q2.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:Q2.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Q2.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+PB($.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&&PX.isNode($.contents)){let X={};_B.visit($.contents,(J,Y)=>{if(PX.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
- `)}}Q2.defaultYaml={explicit:!1,version:"1.2"};Q2.defaultTags={"!!":"tag:yaml.org,2002:"};FB.Directives=Q2});var y4=P((xB)=>{var FX=t(),jB=C1();function EB($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function SX($){let Z=new Set;return jB.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function jX($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function wB($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=SX($));let Y=jX(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(FX.isScalar(Y.node)||FX.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}}xB.anchorIsValid=EB;xB.anchorNames=SX;xB.createNodeAnchors=wB;xB.findNewAnchor=jX});var L7=P((gB)=>{function _1($,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=_1($,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=_1($,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=_1($,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=_1($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}gB.applyReviver=_1});var z6=P((uB)=>{var fB=t();function EX($,Z,z){if(Array.isArray($))return $.map((Q,X)=>EX(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!fB.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 $}uB.toJS=EX});var k4=P((lB)=>{var cB=L7(),wX=t(),pB=z6();class xX{constructor($){Object.defineProperty(this,wX.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(!wX.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=pB.toJS(this,"",J);if(typeof Q==="function")for(let{count:W,res:U}of J.anchors.values())Q(U,W);return typeof X==="function"?cB.applyReviver(X,{"":Y},"",Y):Y}}lB.NodeBase=xX});var R1=P((oB)=>{var iB=y4(),nB=C1(),L$=t(),rB=k4(),sB=z6();class yX extends rB.NodeBase{constructor($){super(L$.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=[],nB.visit($,{Node:(X,J)=>{if(L$.isAlias(J)||L$.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)sB.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=b4(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(iB.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 b4($,Z,z){if(L$.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(L$.isCollection(Z)){let Q=0;for(let X of Z.items){let J=b4($,X,z);if(J>Q)Q=J}return Q}else if(L$.isPair(Z)){let Q=b4($,Z.key,z),X=b4($,Z.value,z);return Math.max(Q,X)}return 1}oB.Alias=yX});var L0=P((zM)=>{var tB=t(),eB=k4(),$M=z6(),ZM=($)=>!$||typeof $!=="function"&&typeof $!=="object";class w6 extends eB.NodeBase{constructor($){super(tB.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:$M.toJS(this.value,$,Z)}toString(){return String(this.value)}}w6.BLOCK_FOLDED="BLOCK_FOLDED";w6.BLOCK_LITERAL="BLOCK_LITERAL";w6.PLAIN="PLAIN";w6.QUOTE_DOUBLE="QUOTE_DOUBLE";w6.QUOTE_SINGLE="QUOTE_SINGLE";zM.Scalar=w6;zM.isScalarValue=ZM});var P1=P((GM)=>{var JM=R1(),x6=t(),kX=L0(),YM="tag:yaml.org,2002:";function WM($,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 UM($,Z,z){if(x6.isDocument($))$=$.contents;if(x6.isNode($))return $;if(x6.isPair($)){let H=z.schema[x6.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 JM.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=YM+Z.slice(2);let G=WM($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new kX.Scalar($);if(U)U.node=H;return H}G=$ instanceof Map?Y[x6.MAP]:(Symbol.iterator in Object($))?Y[x6.SEQ]:Y[x6.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 kX.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(U)U.node=V;return V}GM.createNode=UM});var v4=P((KM)=>{var HM=P1(),E2=t(),qM=k4();function N7($,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 HM.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var bX=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class vX extends qM.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(bX($))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,N7(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,N7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}KM.Collection=vX;KM.collectionFromPath=N7;KM.isEmptyPath=bX});var F1=P((OM)=>{var NM=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function D7($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var DM=($,Z,z)=>$.endsWith(`
29
- `)?D7(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 KX($){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 q7(){if($0.env.NO_COLOR||$0.env.FORCE_COLOR==="0"||$0.env.FORCE_COLOR==="false")return!1;if($0.env.FORCE_COLOR||$0.env.CLICOLOR_FORCE!==void 0)return!0;return}mK.Command=K7;mK.useColor=q7});var DX=P((iK)=>{var{Argument:MX}=j8(),{Command:B7}=BX(),{CommanderError:lK,InvalidArgumentError:LX}=A1(),{Help:dK}=U7(),{Option:NX}=G7();iK.program=new B7;iK.createCommand=($)=>new B7($);iK.createOption=($,Z)=>new NX($,Z);iK.createArgument=($,Z)=>new MX($,Z);iK.Command=B7;iK.Option=NX;iK.Argument=MX;iK.Help=dK;iK.CommanderError=lK;iK.InvalidArgumentError=LX;iK.InvalidOptionArgumentError=LX});var t=P((HB)=>{var L7=Symbol.for("yaml.alias"),TX=Symbol.for("yaml.document"),w8=Symbol.for("yaml.map"),AX=Symbol.for("yaml.pair"),N7=Symbol.for("yaml.scalar"),x8=Symbol.for("yaml.seq"),h2=Symbol.for("yaml.node.type"),XB=($)=>!!$&&typeof $==="object"&&$[h2]===L7,JB=($)=>!!$&&typeof $==="object"&&$[h2]===TX,YB=($)=>!!$&&typeof $==="object"&&$[h2]===w8,WB=($)=>!!$&&typeof $==="object"&&$[h2]===AX,CX=($)=>!!$&&typeof $==="object"&&$[h2]===N7,UB=($)=>!!$&&typeof $==="object"&&$[h2]===x8;function _X($){if($&&typeof $==="object")switch($[h2]){case w8:case x8:return!0}return!1}function GB($){if($&&typeof $==="object")switch($[h2]){case L7:case w8:case N7:case x8:return!0}return!1}var VB=($)=>(CX($)||_X($))&&!!$.anchor;HB.ALIAS=L7;HB.DOC=TX;HB.MAP=w8;HB.NODE_TYPE=h2;HB.PAIR=AX;HB.SCALAR=N7;HB.SEQ=x8;HB.hasAnchor=VB;HB.isAlias=XB;HB.isCollection=_X;HB.isDocument=JB;HB.isMap=YB;HB.isNode=GB;HB.isPair=WB;HB.isScalar=CX;HB.isSeq=UB});var C1=P((SB)=>{var T0=t(),p0=Symbol("break visit"),RX=Symbol("skip children"),j2=Symbol("remove node");function y8($,Z){let z=PX(Z);if(T0.isDocument($)){if(B$(null,$.contents,z,Object.freeze([$]))===j2)$.contents=null}else B$(null,$,z,Object.freeze([]))}y8.BREAK=p0;y8.SKIP=RX;y8.REMOVE=j2;function B$($,Z,z,Q){let X=FX($,Z,z,Q);if(T0.isNode(X)||T0.isPair(X))return SX($,Q,X),B$($,X,z,Q);if(typeof X!=="symbol"){if(T0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=B$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===p0)return p0;else if(Y===j2)Z.items.splice(J,1),J-=1}}else if(T0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=B$("key",Z.key,z,Q);if(J===p0)return p0;else if(J===j2)Z.key=null;let Y=B$("value",Z.value,z,Q);if(Y===p0)return p0;else if(Y===j2)Z.value=null}}return X}async function k8($,Z){let z=PX(Z);if(T0.isDocument($)){if(await M$(null,$.contents,z,Object.freeze([$]))===j2)$.contents=null}else await M$(null,$,z,Object.freeze([]))}k8.BREAK=p0;k8.SKIP=RX;k8.REMOVE=j2;async function M$($,Z,z,Q){let X=await FX($,Z,z,Q);if(T0.isNode(X)||T0.isPair(X))return SX($,Q,X),M$($,X,z,Q);if(typeof X!=="symbol"){if(T0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=await M$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===p0)return p0;else if(Y===j2)Z.items.splice(J,1),J-=1}}else if(T0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await M$("key",Z.key,z,Q);if(J===p0)return p0;else if(J===j2)Z.key=null;let Y=await M$("value",Z.value,z,Q);if(Y===p0)return p0;else if(Y===j2)Z.value=null}}return X}function PX($){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 FX($,Z,z,Q){if(typeof z==="function")return z($,Z,Q);if(T0.isMap(Z))return z.Map?.($,Z,Q);if(T0.isSeq(Z))return z.Seq?.($,Z,Q);if(T0.isPair(Z))return z.Pair?.($,Z,Q);if(T0.isScalar(Z))return z.Scalar?.($,Z,Q);if(T0.isAlias(Z))return z.Alias?.($,Z,Q);return}function SX($,Z,z){let Q=Z[Z.length-1];if(T0.isCollection(Q))Q.items[$]=z;else if(T0.isPair(Q))if($==="key")Q.key=z;else Q.value=z;else if(T0.isDocument(Q))Q.contents=z;else{let X=T0.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}SB.visit=y8;SB.visitAsync=k8});var D7=P((kB)=>{var jX=t(),wB=C1(),xB={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},yB=($)=>$.replace(/[!,[\]{}]/g,(Z)=>xB[Z]);class Q2{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Q2.defaultYaml,$),this.tags=Object.assign({},Q2.defaultTags,Z)}clone(){let $=new Q2(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new Q2(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Q2.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Q2.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:Q2.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Q2.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+yB($.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&&jX.isNode($.contents)){let X={};wB.visit($.contents,(J,Y)=>{if(jX.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
+ `)}}Q2.defaultYaml={explicit:!1,version:"1.2"};Q2.defaultTags={"!!":"tag:yaml.org,2002:"};kB.Directives=Q2});var b8=P((fB)=>{var EX=t(),vB=C1();function gB($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function wX($){let Z=new Set;return vB.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function xX($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function hB($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=wX($));let Y=xX(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(EX.isScalar(Y.node)||EX.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}}fB.anchorIsValid=gB;fB.anchorNames=wX;fB.createNodeAnchors=hB;fB.findNewAnchor=xX});var O7=P((lB)=>{function _1($,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=_1($,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=_1($,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=_1($,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=_1($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}lB.applyReviver=_1});var Z6=P((nB)=>{var iB=t();function yX($,Z,z){if(Array.isArray($))return $.map((Q,X)=>yX(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!iB.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 $}nB.toJS=yX});var v8=P((aB)=>{var sB=O7(),kX=t(),oB=Z6();class bX{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=oB.toJS(this,"",J);if(typeof Q==="function")for(let{count:W,res:U}of J.anchors.values())Q(U,W);return typeof X==="function"?sB.applyReviver(X,{"":Y},"",Y):Y}}aB.NodeBase=bX});var R1=P((QM)=>{var eB=b8(),$M=C1(),L$=t(),ZM=v8(),zM=Z6();class vX extends ZM.NodeBase{constructor($){super(L$.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=[],$M.visit($,{Node:(X,J)=>{if(L$.isAlias(J)||L$.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)zM.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=g8(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(eB.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 g8($,Z,z){if(L$.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(L$.isCollection(Z)){let Q=0;for(let X of Z.items){let J=g8($,X,z);if(J>Q)Q=J}return Q}else if(L$.isPair(Z)){let Q=g8($,Z.key,z),X=g8($,Z.value,z);return Math.max(Q,X)}return 1}QM.Alias=vX});var L0=P((GM)=>{var JM=t(),YM=v8(),WM=Z6(),UM=($)=>!$||typeof $!=="function"&&typeof $!=="object";class w6 extends YM.NodeBase{constructor($){super(JM.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:WM.toJS(this.value,$,Z)}toString(){return String(this.value)}}w6.BLOCK_FOLDED="BLOCK_FOLDED";w6.BLOCK_LITERAL="BLOCK_LITERAL";w6.PLAIN="PLAIN";w6.QUOTE_DOUBLE="QUOTE_DOUBLE";w6.QUOTE_SINGLE="QUOTE_SINGLE";GM.Scalar=w6;GM.isScalarValue=UM});var P1=P((LM)=>{var qM=R1(),x6=t(),gX=L0(),KM="tag:yaml.org,2002:";function BM($,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 MM($,Z,z){if(x6.isDocument($))$=$.contents;if(x6.isNode($))return $;if(x6.isPair($)){let H=z.schema[x6.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 qM.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=KM+Z.slice(2);let G=BM($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new gX.Scalar($);if(U)U.node=H;return H}G=$ instanceof Map?Y[x6.MAP]:(Symbol.iterator in Object($))?Y[x6.SEQ]:Y[x6.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 gX.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(U)U.node=V;return V}LM.createNode=MM});var h8=P((IM)=>{var DM=P1(),E2=t(),OM=v8();function I7($,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 DM.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var hX=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class fX extends OM.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(hX($))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,I7(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,I7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}IM.Collection=fX;IM.collectionFromPath=I7;IM.isEmptyPath=hX});var F1=P((PM)=>{var _M=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function T7($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var RM=($,Z,z)=>$.endsWith(`
29
+ `)?T7(z,Z):z.includes(`
30
30
  `)?`
31
- `+D7(z,Z):($.endsWith(" ")?"":" ")+z;OM.indentComment=D7;OM.lineComment=DM;OM.stringifyComment=NM});var hX=P((_M)=>{function CM($,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 q=void 0,K=void 0,M=!1,B=-1,N=-1,O=-1;if(z==="block"){if(B=gX($,B,Z.length),B!==-1)H=B+U}for(let x;x=$[B+=1];){if(z==="quoted"&&x==="\\"){switch(N=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}O=B}if(x===`
32
- `){if(z==="block")B=gX($,B,Z.length);H=B+Z.length+U,q=void 0}else{if(x===" "&&K&&K!==" "&&K!==`
31
+ `+T7(z,Z):($.endsWith(" ")?"":" ")+z;PM.indentComment=T7;PM.lineComment=RM;PM.stringifyComment=_M});var mX=P((wM)=>{function EM($,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 q=void 0,K=void 0,L=!1,B=-1,N=-1,O=-1;if(z==="block"){if(B=uX($,B,Z.length),B!==-1)H=B+U}for(let x;x=$[B+=1];){if(z==="quoted"&&x==="\\"){switch(N=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}O=B}if(x===`
32
+ `){if(z==="block")B=uX($,B,Z.length);H=B+Z.length+U,q=void 0}else{if(x===" "&&K&&K!==" "&&K!==`
33
33
  `&&K!=="\t"){let S=$[B+1];if(S&&S!==" "&&S!==`
34
- `&&S!=="\t")q=B}if(B>=H)if(q)G.push(q),H=q+U,q=void 0;else if(z==="quoted"){while(K===" "||K==="\t")K=x,x=$[B+=1],M=!0;let S=B>O+1?B-2:N-1;if(V[S])return $;G.push(S),V[S]=!0,H=S+U,q=void 0}else M=!0}K=x}if(M&&W)W();if(G.length===0)return $;if(Y)Y();let _=$.slice(0,G[0]);for(let x=0;x<G.length;++x){let S=G[x],y=G[x+1]||$.length;if(S===0)_=`
34
+ `&&S!=="\t")q=B}if(B>=H)if(q)G.push(q),H=q+U,q=void 0;else if(z==="quoted"){while(K===" "||K==="\t")K=x,x=$[B+=1],L=!0;let S=B>O+1?B-2:N-1;if(V[S])return $;G.push(S),V[S]=!0,H=S+U,q=void 0}else L=!0}K=x}if(L&&W)W();if(G.length===0)return $;if(Y)Y();let _=$.slice(0,G[0]);for(let x=0;x<G.length;++x){let S=G[x],y=G[x+1]||$.length;if(S===0)_=`
35
35
  ${Z}${$.slice(0,y)}`;else{if(z==="quoted"&&V[S])_+=`${$[S]}\\`;_+=`
36
- ${Z}${$.slice(S+1,y)}`}}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}_M.FOLD_BLOCK="block";_M.FOLD_FLOW="flow";_M.FOLD_QUOTED="quoted";_M.foldFlowLines=CM});var j1=P((xM)=>{var L2=L0(),Q6=hX(),h4=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),f4=($)=>/^(%|---|\.\.\.)/m.test($);function jM($,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 S1($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(f4($)?" ":""),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)+`
36
+ ${Z}${$.slice(S+1,y)}`}}return _}function uX($,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}wM.FOLD_BLOCK="block";wM.FOLD_FLOW="flow";wM.FOLD_QUOTED="quoted";wM.foldFlowLines=EM});var j1=P((fM)=>{var L2=L0(),z6=mX(),u8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),m8=($)=>/^(%|---|\.\.\.)/m.test($);function vM($,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 S1($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(m8($)?" ":""),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:Q6.foldFlowLines(Y,J,Q6.FOLD_QUOTED,h4(Z,!1))}function O7($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
- `)||/[ \t]\n|\n[ \t]/.test($))return S1($,Z);let z=Z.indent||(f4($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
- ${z}`)+"'";return Z.implicitKey?Q:Q6.foldFlowLines(Q,z,Q6.FOLD_FLOW,h4(Z,!1))}function N$($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=S1;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=O7;else if(J&&!X)Q=S1;else Q=z?O7:S1}return Q($,Z)}var I7;try{I7=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:z6.foldFlowLines(Y,J,z6.FOLD_QUOTED,u8(Z,!1))}function A7($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
+ `)||/[ \t]\n|\n[ \t]/.test($))return S1($,Z);let z=Z.indent||(m8($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
+ ${z}`)+"'";return Z.implicitKey?Q:z6.foldFlowLines(Q,z,z6.FOLD_FLOW,u8(Z,!1))}function N$($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=S1;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=A7;else if(J&&!X)Q=S1;else Q=z?A7:S1}return Q($,Z)}var C7;try{C7=new RegExp(`(^|(?<!
44
44
  ))
45
45
  +(?!
46
- |$)`,"g")}catch{I7=/\n+(?!\n|$)/g}function g4({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:W,lineWidth:U}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return N$(z,Q);let G=Q.indent||(Q.forceBlockIndent||f4(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===L2.Scalar.BLOCK_FOLDED?!1:Z===L2.Scalar.BLOCK_LITERAL?!0:!jM(z,U,G.length);if(!z)return V?`|
46
+ |$)`,"g")}catch{C7=/\n+(?!\n|$)/g}function f8({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:W,lineWidth:U}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return N$(z,Q);let G=Q.indent||(Q.forceBlockIndent||m8(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===L2.Scalar.BLOCK_FOLDED?!1:Z===L2.Scalar.BLOCK_LITERAL?!0:!vM(z,U,G.length);if(!z)return V?`|
47
47
  `:`>
48
48
  `;let H,q;for(q=z.length;q>0;--q){let y=z[q-1];if(y!==`
49
- `&&y!=="\t"&&y!==" ")break}let K=z.substring(q),M=K.indexOf(`
50
- `);if(M===-1)H="-";else if(z===K||M!==K.length-1){if(H="+",J)J()}else H="";if(K){if(z=z.slice(0,-K.length),K[K.length-1]===`
51
- `)K=K.slice(0,-1);K=K.replace(I7,`$&${G}`)}let B=!1,N,O=-1;for(N=0;N<z.length;++N){let y=z[N];if(y===" ")B=!0;else if(y===`
49
+ `&&y!=="\t"&&y!==" ")break}let K=z.substring(q),L=K.indexOf(`
50
+ `);if(L===-1)H="-";else if(z===K||L!==K.length-1){if(H="+",J)J()}else H="";if(K){if(z=z.slice(0,-K.length),K[K.length-1]===`
51
+ `)K=K.slice(0,-1);K=K.replace(C7,`$&${G}`)}let B=!1,N,O=-1;for(N=0;N<z.length;++N){let y=z[N];if(y===" ")B=!0;else if(y===`
52
52
  `)O=N;else break}let _=z.substring(0,O<N?O+1:N);if(_)z=z.substring(_.length),_=_.replace(/\n+/g,`$&${G}`);let S=(B?G?"2":"1":"")+H;if($){if(S+=" "+W($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let y=z.replace(/\n+/g,`
53
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),E=!1,u=h4(Q,!0);if(Y!=="folded"&&Z!==L2.Scalar.BLOCK_FOLDED)u.onOverflow=()=>{E=!0};let j=Q6.foldFlowLines(`${_}${y}${K}`,G,Q6.FOLD_BLOCK,u);if(!E)return`>${S}
53
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),E=!1,u=u8(Q,!0);if(Y!=="folded"&&Z!==L2.Scalar.BLOCK_FOLDED)u.onOverflow=()=>{E=!0};let j=z6.foldFlowLines(`${_}${y}${K}`,G,z6.FOLD_BLOCK,u);if(!E)return`>${S}
54
54
  ${G}${j}`}return z=z.replace(/\n+/g,`$&${G}`),`|${S}
55
- ${G}${_}${z}${K}`}function EM($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:V}=Z;if(W&&J.includes(`
55
+ ${G}${_}${z}${K}`}function gM($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:V}=Z;if(W&&J.includes(`
56
56
  `)||V&&/[[\]{},]/.test(J))return N$(J,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(J))return W||V||!J.includes(`
57
- `)?N$(J,Z):g4($,Z,z,Q);if(!W&&!V&&X!==L2.Scalar.PLAIN&&J.includes(`
58
- `))return g4($,Z,z,Q);if(f4(J)){if(U==="")return Z.forceBlockIndent=!0,g4($,Z,z,Q);else if(W&&U===G)return N$(J,Z)}let H=J.replace(/\n+/g,`$&
59
- ${U}`);if(Y){let q=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(H),{compat:K,tags:M}=Z.doc.schema;if(M.some(q)||K?.some(q))return N$(J,Z)}return W?H:Q6.foldFlowLines(H,U,Q6.FOLD_FLOW,h4(Z,!1))}function wM($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==L2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=L2.Scalar.QUOTE_DOUBLE}let U=(V)=>{switch(V){case L2.Scalar.BLOCK_FOLDED:case L2.Scalar.BLOCK_LITERAL:return X||J?N$(Y.value,Z):g4(Y,Z,z,Q);case L2.Scalar.QUOTE_DOUBLE:return S1(Y.value,Z);case L2.Scalar.QUOTE_SINGLE:return O7(Y.value,Z);case L2.Scalar.PLAIN:return EM(Y,Z,z,Q);default:return null}},G=U(W);if(G===null){let{defaultKeyType:V,defaultStringType:H}=Z.options,q=X&&V||H;if(G=U(q),G===null)throw Error(`Unsupported default string type ${q}`)}return G}xM.stringifyString=wM});var E1=P((mM)=>{var kM=y4(),X6=t(),bM=F1(),vM=j1();function gM($,Z){let z=Object.assign({blockQuote:!0,commentString:bM.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 hM($,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 fM($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=(X6.isScalar($)||X6.isCollection($))&&$.anchor;if(J&&kM.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 uM($,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=hM(Z.doc.schema.tags,J));let Y=fM(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)?vM.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}`}mM.createStringifyContext=gM;mM.stringify=uM});var mX=P((dM)=>{var f2=t(),fX=L0(),uX=E1(),w1=F1();function lM({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:V,simpleKeys:H}}=z,q=f2.isNode($)&&$.comment||null;if(H){if(q)throw Error("With simple keys, key nodes cannot have comments");if(f2.isCollection($)||!f2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let K=!H&&(!$||q&&Z==null&&!z.inFlow||f2.isCollection($)||(f2.isScalar($)?$.type===fX.Scalar.BLOCK_FOLDED||$.type===fX.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!K&&(H||!J),indent:W+U});let M=!1,B=!1,N=uX.stringify($,z,()=>M=!0,()=>B=!0);if(!K&&!z.inFlow&&N.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");K=!0}if(z.inFlow){if(J||Z==null){if(M&&Q)Q();return N===""?"?":K?`? ${N}`:N}}else if(J&&!H||Z==null&&K){if(N=`? ${N}`,q&&!M)N+=w1.lineComment(N,z.indent,G(q));else if(B&&X)X();return N}if(M)q=null;if(K){if(q)N+=w1.lineComment(N,z.indent,G(q));N=`? ${N}
61
- ${W}:`}else if(N=`${N}:`,q)N+=w1.lineComment(N,z.indent,G(q));let O,_,x;if(f2.isNode(Z))O=!!Z.spaceBefore,_=Z.commentBefore,x=Z.comment;else if(O=!1,_=null,x=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!K&&!q&&f2.isScalar(Z))z.indentAtStart=N.length+1;if(B=!1,!V&&U.length>=2&&!z.inFlow&&!K&&f2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let S=!1,y=uX.stringify(Z,z,()=>S=!0,()=>B=!0),E=" ";if(q||O||_){if(E=O?`
57
+ `)?N$(J,Z):f8($,Z,z,Q);if(!W&&!V&&X!==L2.Scalar.PLAIN&&J.includes(`
58
+ `))return f8($,Z,z,Q);if(m8(J)){if(U==="")return Z.forceBlockIndent=!0,f8($,Z,z,Q);else if(W&&U===G)return N$(J,Z)}let H=J.replace(/\n+/g,`$&
59
+ ${U}`);if(Y){let q=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(H),{compat:K,tags:L}=Z.doc.schema;if(L.some(q)||K?.some(q))return N$(J,Z)}return W?H:z6.foldFlowLines(H,U,z6.FOLD_FLOW,u8(Z,!1))}function hM($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==L2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=L2.Scalar.QUOTE_DOUBLE}let U=(V)=>{switch(V){case L2.Scalar.BLOCK_FOLDED:case L2.Scalar.BLOCK_LITERAL:return X||J?N$(Y.value,Z):f8(Y,Z,z,Q);case L2.Scalar.QUOTE_DOUBLE:return S1(Y.value,Z);case L2.Scalar.QUOTE_SINGLE:return A7(Y.value,Z);case L2.Scalar.PLAIN:return gM(Y,Z,z,Q);default:return null}},G=U(W);if(G===null){let{defaultKeyType:V,defaultStringType:H}=Z.options,q=X&&V||H;if(G=U(q),G===null)throw Error(`Unsupported default string type ${q}`)}return G}fM.stringifyString=hM});var E1=P((rM)=>{var mM=b8(),Q6=t(),cM=F1(),pM=j1();function lM($,Z){let z=Object.assign({blockQuote:!0,commentString:cM.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 dM($,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(Q6.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 iM($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=(Q6.isScalar($)||Q6.isCollection($))&&$.anchor;if(J&&mM.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 nM($,Z,z,Q){if(Q6.isPair($))return $.toString(Z,z,Q);if(Q6.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=Q6.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>X=U});X??(X=dM(Z.doc.schema.tags,J));let Y=iM(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):Q6.isScalar(J)?pM.stringifyString(J,Z,z,Q):J.toString(Z,z,Q);if(!Y)return W;return Q6.isScalar(J)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
+ ${Z.indent}${W}`}rM.createStringifyContext=lM;rM.stringify=nM});var lX=P((tM)=>{var f2=t(),cX=L0(),pX=E1(),w1=F1();function aM({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:V,simpleKeys:H}}=z,q=f2.isNode($)&&$.comment||null;if(H){if(q)throw Error("With simple keys, key nodes cannot have comments");if(f2.isCollection($)||!f2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let K=!H&&(!$||q&&Z==null&&!z.inFlow||f2.isCollection($)||(f2.isScalar($)?$.type===cX.Scalar.BLOCK_FOLDED||$.type===cX.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!K&&(H||!J),indent:W+U});let L=!1,B=!1,N=pX.stringify($,z,()=>L=!0,()=>B=!0);if(!K&&!z.inFlow&&N.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");K=!0}if(z.inFlow){if(J||Z==null){if(L&&Q)Q();return N===""?"?":K?`? ${N}`:N}}else if(J&&!H||Z==null&&K){if(N=`? ${N}`,q&&!L)N+=w1.lineComment(N,z.indent,G(q));else if(B&&X)X();return N}if(L)q=null;if(K){if(q)N+=w1.lineComment(N,z.indent,G(q));N=`? ${N}
61
+ ${W}:`}else if(N=`${N}:`,q)N+=w1.lineComment(N,z.indent,G(q));let O,_,x;if(f2.isNode(Z))O=!!Z.spaceBefore,_=Z.commentBefore,x=Z.comment;else if(O=!1,_=null,x=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!K&&!q&&f2.isScalar(Z))z.indentAtStart=N.length+1;if(B=!1,!V&&U.length>=2&&!z.inFlow&&!K&&f2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let S=!1,y=pX.stringify(Z,z,()=>S=!0,()=>B=!0),E=" ";if(q||O||_){if(E=O?`
62
62
  `:"",_){let u=G(_);E+=`
63
63
  ${w1.indentComment(u,z.indent)}`}if(y===""&&!z.inFlow){if(E===`
64
64
  `&&x)E=`
@@ -67,34 +67,34 @@ ${w1.indentComment(u,z.indent)}`}if(y===""&&!z.inFlow){if(E===`
67
67
  ${z.indent}`}else if(!K&&f2.isCollection(Z)){let u=y[0],j=y.indexOf(`
68
68
  `),d=j!==-1,I0=z.inFlow??Z.flow??Z.items.length===0;if(d||!I0){let S0=!1;if(d&&(u==="&"||u==="!")){let z0=y.indexOf(" ");if(u==="&"&&z0!==-1&&z0<j&&y[z0+1]==="!")z0=y.indexOf(" ",z0+1);if(z0===-1||j<z0)S0=!0}if(!S0)E=`
69
69
  ${z.indent}`}}else if(y===""||y[0]===`
70
- `)E="";if(N+=E+y,z.inFlow){if(S&&Q)Q()}else if(x&&!S)N+=w1.lineComment(N,z.indent,G(x));else if(B&&X)X();return N}dM.stringifyPair=lM});var T7=P((sM)=>{var cX=n0("process");function nM($,...Z){if($==="debug")console.log(...Z)}function rM($,Z){if($==="debug"||$==="warn")if(typeof cX.emitWarning==="function")cX.emitWarning(Z);else console.warn(Z)}sM.debug=nM;sM.warn=rM});var p4=P((eM)=>{var c4=t(),pX=L0(),u4="<<",m4={identify:($)=>$===u4||typeof $==="symbol"&&$.description===u4,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new pX.Scalar(Symbol(u4)),{addToJSMap:lX}),stringify:()=>u4},tM=($,Z)=>(m4.identify(Z)||c4.isScalar(Z)&&(!Z.type||Z.type===pX.Scalar.PLAIN)&&m4.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===m4.tag&&z.default);function lX($,Z,z){let Q=dX($,z);if(c4.isSeq(Q))for(let X of Q.items)A7($,Z,X);else if(Array.isArray(Q))for(let X of Q)A7($,Z,X);else A7($,Z,Q)}function A7($,Z,z){let Q=dX($,z);if(!c4.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 dX($,Z){return $&&c4.isAlias(Z)?Z.resolve($.doc,$):Z}eM.addMergeToJSMap=lX;eM.isMergeKey=tM;eM.merge=m4});var _7=P((WL)=>{var QL=T7(),iX=p4(),XL=E1(),nX=t(),C7=z6();function JL($,Z,{key:z,value:Q}){if(nX.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(iX.isMergeKey($,z))iX.addMergeToJSMap($,Z,Q);else{let X=C7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,C7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=YL(z,X,$),Y=C7.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 YL($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(nX.isNode($)&&z?.doc){let Q=XL.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)+'..."';QL.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)}WL.addPairToJSMap=JL});var J6=P((qL)=>{var rX=P1(),GL=mX(),VL=_7(),l4=t();function HL($,Z,z){let Q=rX.createNode($,void 0,z),X=rX.createNode(Z,void 0,z);return new d4(Q,X)}class d4{constructor($,Z=null){Object.defineProperty(this,l4.NODE_TYPE,{value:l4.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(l4.isNode(Z))Z=Z.clone($);if(l4.isNode(z))z=z.clone($);return new d4(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return VL.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?GL.stringifyPair(this,$,Z,z):JSON.stringify(this)}}qL.Pair=d4;qL.createPair=HL});var R7=P((DL)=>{var y6=t(),sX=E1(),i4=F1();function ML($,Z,z){return(Z.inFlow??$.flow?NL:LL)($,Z,z)}function LL({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,q=[];for(let M=0;M<Z.length;++M){let B=Z[M],N=null;if(y6.isNode(B)){if(!H&&B.spaceBefore)q.push("");if(n4(z,q,B.commentBefore,H),B.comment)N=B.comment}else if(y6.isPair(B)){let _=y6.isNode(B.key)?B.key:null;if(_){if(!H&&_.spaceBefore)q.push("");n4(z,q,_.commentBefore,H)}}H=!1;let O=sX.stringify(B,V,()=>N=null,()=>H=!0);if(N)O+=i4.lineComment(O,J,G(N));if(H&&N)H=!1;q.push(Q+O)}let K;if(q.length===0)K=X.start+X.end;else{K=q[0];for(let M=1;M<q.length;++M){let B=q[M];K+=B?`
70
+ `)E="";if(N+=E+y,z.inFlow){if(S&&Q)Q()}else if(x&&!S)N+=w1.lineComment(N,z.indent,G(x));else if(B&&X)X();return N}tM.stringifyPair=aM});var _7=P((zL)=>{var dX=c0("process");function $L($,...Z){if($==="debug")console.log(...Z)}function ZL($,Z){if($==="debug"||$==="warn")if(typeof dX.emitWarning==="function")dX.emitWarning(Z);else console.warn(Z)}zL.debug=$L;zL.warn=ZL});var d8=P((YL)=>{var l8=t(),iX=L0(),c8="<<",p8={identify:($)=>$===c8||typeof $==="symbol"&&$.description===c8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new iX.Scalar(Symbol(c8)),{addToJSMap:nX}),stringify:()=>c8},JL=($,Z)=>(p8.identify(Z)||l8.isScalar(Z)&&(!Z.type||Z.type===iX.Scalar.PLAIN)&&p8.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===p8.tag&&z.default);function nX($,Z,z){let Q=rX($,z);if(l8.isSeq(Q))for(let X of Q.items)R7($,Z,X);else if(Array.isArray(Q))for(let X of Q)R7($,Z,X);else R7($,Z,Q)}function R7($,Z,z){let Q=rX($,z);if(!l8.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 rX($,Z){return $&&l8.isAlias(Z)?Z.resolve($.doc,$):Z}YL.addMergeToJSMap=nX;YL.isMergeKey=JL;YL.merge=p8});var F7=P((BL)=>{var VL=_7(),sX=d8(),HL=E1(),oX=t(),P7=Z6();function qL($,Z,{key:z,value:Q}){if(oX.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(sX.isMergeKey($,z))sX.addMergeToJSMap($,Z,Q);else{let X=P7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,P7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=KL(z,X,$),Y=P7.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 KL($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(oX.isNode($)&&z?.doc){let Q=HL.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)+'..."';VL.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)}BL.addPairToJSMap=qL});var X6=P((OL)=>{var aX=P1(),LL=lX(),NL=F7(),i8=t();function DL($,Z,z){let Q=aX.createNode($,void 0,z),X=aX.createNode(Z,void 0,z);return new n8(Q,X)}class n8{constructor($,Z=null){Object.defineProperty(this,i8.NODE_TYPE,{value:i8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(i8.isNode(Z))Z=Z.clone($);if(i8.isNode(z))z=z.clone($);return new n8(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return NL.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?LL.stringifyPair(this,$,Z,z):JSON.stringify(this)}}OL.Pair=n8;OL.createPair=DL});var S7=P((RL)=>{var y6=t(),tX=E1(),r8=F1();function AL($,Z,z){return(Z.inFlow??$.flow?_L:CL)($,Z,z)}function CL({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,q=[];for(let L=0;L<Z.length;++L){let B=Z[L],N=null;if(y6.isNode(B)){if(!H&&B.spaceBefore)q.push("");if(s8(z,q,B.commentBefore,H),B.comment)N=B.comment}else if(y6.isPair(B)){let _=y6.isNode(B.key)?B.key:null;if(_){if(!H&&_.spaceBefore)q.push("");s8(z,q,_.commentBefore,H)}}H=!1;let O=tX.stringify(B,V,()=>N=null,()=>H=!0);if(N)O+=r8.lineComment(O,J,G(N));if(H&&N)H=!1;q.push(Q+O)}let K;if(q.length===0)K=X.start+X.end;else{K=q[0];for(let L=1;L<q.length;++L){let B=q[L];K+=B?`
71
71
  ${U}${B}`:`
72
72
  `}}if($){if(K+=`
73
- `+i4.indentComment(G($),U),W)W()}else if(H&&Y)Y();return K}function NL({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 M=0;M<$.length;++M){let B=$[M],N=null;if(y6.isNode(B)){if(B.spaceBefore)H.push("");if(n4(Z,H,B.commentBefore,!1),B.comment)N=B.comment}else if(y6.isPair(B)){let _=y6.isNode(B.key)?B.key:null;if(_){if(_.spaceBefore)H.push("");if(n4(Z,H,_.commentBefore,!1),_.comment)G=!0}let x=y6.isNode(B.value)?B.value:null;if(x){if(x.comment)N=x.comment;if(x.commentBefore)G=!0}else if(B.value==null&&_?.comment)N=_.comment}if(N)G=!0;let O=sX.stringify(B,U,()=>N=null);if(G||(G=H.length>V||O.includes(`
74
- `)),M<$.length-1)O+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=H.reduce((_,x)=>_+x.length+2,2)+(O.length+2)>Z.options.lineWidth);if(G)O+=","}if(N)O+=i4.lineComment(O,Q,W(N));H.push(O),V=H.length}let{start:q,end:K}=z;if(H.length===0)return q+K;else{if(!G){let M=H.reduce((B,N)=>B+N.length+2,2);G=Z.options.lineWidth>0&&M>Z.options.lineWidth}if(G){let M=q;for(let B of H)M+=B?`
73
+ `+r8.indentComment(G($),U),W)W()}else if(H&&Y)Y();return K}function _L({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(y6.isNode(B)){if(B.spaceBefore)H.push("");if(s8(Z,H,B.commentBefore,!1),B.comment)N=B.comment}else if(y6.isPair(B)){let _=y6.isNode(B.key)?B.key:null;if(_){if(_.spaceBefore)H.push("");if(s8(Z,H,_.commentBefore,!1),_.comment)G=!0}let x=y6.isNode(B.value)?B.value:null;if(x){if(x.comment)N=x.comment;if(x.commentBefore)G=!0}else if(B.value==null&&_?.comment)N=_.comment}if(N)G=!0;let O=tX.stringify(B,U,()=>N=null);if(G||(G=H.length>V||O.includes(`
74
+ `)),L<$.length-1)O+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=H.reduce((_,x)=>_+x.length+2,2)+(O.length+2)>Z.options.lineWidth);if(G)O+=","}if(N)O+=r8.lineComment(O,Q,W(N));H.push(O),V=H.length}let{start:q,end:K}=z;if(H.length===0)return q+K;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=q;for(let B of H)L+=B?`
75
75
  ${J}${X}${B}`:`
76
- `;return`${M}
77
- ${X}${K}`}else return`${q}${Y}${H.join(" ")}${Y}${K}`}}function n4({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=i4.indentComment(Z(Q),$);z.push(J.trimStart())}}DL.stringifyCollection=ML});var W6=P((_L)=>{var IL=R7(),TL=_7(),AL=v4(),Y6=t(),r4=J6(),CL=L0();function x1($,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 oX extends AL.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(r4.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 r4.Pair($,$?.value);else z=new r4.Pair($.key,$.value);let Q=x1(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if(Y6.isScalar(Q.value)&&CL.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=x1(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=x1(this.items,$)?.value;return(!Z&&Y6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!x1(this.items,$)}set($,Z){this.add(new r4.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)TL.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 IL.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}_L.YAMLMap=oX;_L.findPair=x1});var D$=P((jL)=>{var FL=t(),aX=W6(),SL={collection:"map",default:!0,nodeClass:aX.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!FL.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>aX.YAMLMap.from($,Z,z)};jL.map=SL});var U6=P((vL)=>{var wL=P1(),xL=R7(),yL=v4(),o4=t(),kL=L0(),bL=z6();class tX extends yL.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(o4.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=s4($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=s4($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&o4.isScalar(Q)?Q.value:Q}has($){let Z=s4($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=s4($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(o4.isScalar(Q)&&kL.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(bL.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return xL.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(wL.createNode(Y,void 0,z))}}return X}}function s4($){let Z=o4.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}vL.YAMLSeq=tX});var O$=P((uL)=>{var hL=t(),eX=U6(),fL={collection:"seq",default:!0,nodeClass:eX.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!hL.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>eX.YAMLSeq.from($,Z,z)};uL.seq=fL});var y1=P((lL)=>{var cL=j1(),pL={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),cL.stringifyString($,Z,z,Q)}};lL.string=pL});var a4=P((iL)=>{var $J=L0(),ZJ={identify:($)=>$==null,createNode:()=>new $J.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new $J.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&ZJ.test.test($)?$:Z.options.nullStr};iL.nullTag=ZJ});var P7=P((sL)=>{var rL=L0(),zJ={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new rL.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&zJ.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};sL.boolTag=zJ});var I$=P((tL)=>{function aL({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}tL.stringifyNumber=aL});var S7=P((XN)=>{var $N=L0(),F7=I$(),ZN={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:F7.stringifyNumber},zN={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():F7.stringifyNumber($)}},QN={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new $N.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:F7.stringifyNumber};XN.float=QN;XN.floatExp=zN;XN.floatNaN=ZN});var E7=P((HN)=>{var QJ=I$(),t4=($)=>typeof $==="bigint"||Number.isInteger($),j7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function XJ($,Z,z){let{value:Q}=$;if(t4(Q)&&Q>=0)return z+Q.toString(Z);return QJ.stringifyNumber($)}var UN={identify:($)=>t4($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>j7($,2,8,z),stringify:($)=>XJ($,8,"0o")},GN={identify:t4,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>j7($,0,10,z),stringify:QJ.stringifyNumber},VN={identify:($)=>t4($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>j7($,2,16,z),stringify:($)=>XJ($,16,"0x")};HN.int=GN;HN.intHex=VN;HN.intOct=UN});var JJ=P((TN)=>{var MN=D$(),LN=a4(),NN=O$(),DN=y1(),ON=P7(),w7=S7(),x7=E7(),IN=[MN.map,NN.seq,DN.string,LN.nullTag,ON.boolTag,x7.intOct,x7.int,x7.intHex,w7.floatNaN,w7.floatExp,w7.float];TN.schema=IN});var WJ=P((jN)=>{var CN=L0(),_N=D$(),RN=O$();function YJ($){return typeof $==="bigint"||Number.isInteger($)}var e4=({value:$})=>JSON.stringify($),PN=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:e4},{identify:($)=>$==null,createNode:()=>new CN.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:e4},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:e4},{identify:YJ,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>YJ($)?$.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:e4}],FN={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},SN=[_N.map,RN.seq].concat(PN,FN);jN.schema=SN});var k7=P((yN)=>{var k1=n0("buffer"),y7=L0(),wN=j1(),xN={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof k1.Buffer==="function")return k1.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 k1.Buffer==="function")W=Y instanceof k1.Buffer?Y.toString("base64"):k1.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=y7.Scalar.BLOCK_LITERAL),Z!==y7.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,q=0;H<G;++H,q+=U)V[H]=W.substr(q,U);W=V.join(Z===y7.Scalar.BLOCK_LITERAL?`
78
- `:" ")}return wN.stringifyString({comment:$,type:Z,value:W},Q,X,J)}};yN.binary=xN});var Z5=P((hN)=>{var $5=t(),b7=J6(),bN=L0(),vN=U6();function UJ($,Z){if($5.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if($5.isPair(Q))continue;else if($5.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new b7.Pair(new bN.Scalar(null));if(Q.commentBefore)X.key.commentBefore=X.key.commentBefore?`${Q.commentBefore}
76
+ `;return`${L}
77
+ ${X}${K}`}else return`${q}${Y}${H.join(" ")}${Y}${K}`}}function s8({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=r8.indentComment(Z(Q),$);z.push(J.trimStart())}}RL.stringifyCollection=AL});var Y6=P((wL)=>{var FL=S7(),SL=F7(),jL=h8(),J6=t(),o8=X6(),EL=L0();function x1($,Z){let z=J6.isScalar(Z)?Z.value:Z;for(let Q of $)if(J6.isPair(Q)){if(Q.key===Z||Q.key===z)return Q;if(J6.isScalar(Q.key)&&Q.key.value===z)return Q}return}class eX extends jL.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(J6.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(o8.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(J6.isPair($))z=$;else if(!$||typeof $!=="object"||!("key"in $))z=new o8.Pair($,$?.value);else z=new o8.Pair($.key,$.value);let Q=x1(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if(J6.isScalar(Q.value)&&EL.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=x1(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=x1(this.items,$)?.value;return(!Z&&J6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!x1(this.items,$)}set($,Z){this.add(new o8.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)SL.addPairToJSMap(Z,Q,X);return Q}toString($,Z,z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!J6.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 FL.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}wL.YAMLMap=eX;wL.findPair=x1});var D$=P((vL)=>{var kL=t(),$J=Y6(),bL={collection:"map",default:!0,nodeClass:$J.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!kL.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>$J.YAMLMap.from($,Z,z)};vL.map=bL});var W6=P((pL)=>{var hL=P1(),fL=S7(),uL=h8(),t8=t(),mL=L0(),cL=Z6();class ZJ extends uL.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(t8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=a8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=a8($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&t8.isScalar(Q)?Q.value:Q}has($){let Z=a8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=a8($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(t8.isScalar(Q)&&mL.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(cL.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return fL.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(hL.createNode(Y,void 0,z))}}return X}}function a8($){let Z=t8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}pL.YAMLSeq=ZJ});var O$=P((nL)=>{var dL=t(),zJ=W6(),iL={collection:"seq",default:!0,nodeClass:zJ.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!dL.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>zJ.YAMLSeq.from($,Z,z)};nL.seq=iL});var y1=P((aL)=>{var sL=j1(),oL={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),sL.stringifyString($,Z,z,Q)}};aL.string=oL});var e8=P((eL)=>{var QJ=L0(),XJ={identify:($)=>$==null,createNode:()=>new QJ.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new QJ.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&XJ.test.test($)?$:Z.options.nullStr};eL.nullTag=XJ});var j7=P((zN)=>{var ZN=L0(),JJ={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new ZN.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&JJ.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};zN.boolTag=JJ});var I$=P((JN)=>{function XN({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}JN.stringifyNumber=XN});var w7=P((HN)=>{var WN=L0(),E7=I$(),UN={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:E7.stringifyNumber},GN={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():E7.stringifyNumber($)}},VN={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new WN.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:E7.stringifyNumber};HN.float=VN;HN.floatExp=GN;HN.floatNaN=UN});var y7=P((DN)=>{var YJ=I$(),$5=($)=>typeof $==="bigint"||Number.isInteger($),x7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function WJ($,Z,z){let{value:Q}=$;if($5(Q)&&Q>=0)return z+Q.toString(Z);return YJ.stringifyNumber($)}var MN={identify:($)=>$5($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>x7($,2,8,z),stringify:($)=>WJ($,8,"0o")},LN={identify:$5,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>x7($,0,10,z),stringify:YJ.stringifyNumber},NN={identify:($)=>$5($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>x7($,2,16,z),stringify:($)=>WJ($,16,"0x")};DN.int=LN;DN.intHex=NN;DN.intOct=MN});var UJ=P((SN)=>{var AN=D$(),CN=e8(),_N=O$(),RN=y1(),PN=j7(),k7=w7(),b7=y7(),FN=[AN.map,_N.seq,RN.string,CN.nullTag,PN.boolTag,b7.intOct,b7.int,b7.intHex,k7.floatNaN,k7.floatExp,k7.float];SN.schema=FN});var VJ=P((vN)=>{var EN=L0(),wN=D$(),xN=O$();function GJ($){return typeof $==="bigint"||Number.isInteger($)}var Z5=({value:$})=>JSON.stringify($),yN=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:Z5},{identify:($)=>$==null,createNode:()=>new EN.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Z5},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:Z5},{identify:GJ,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>GJ($)?$.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:Z5}],kN={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},bN=[wN.map,xN.seq].concat(yN,kN);vN.schema=bN});var g7=P((uN)=>{var k1=c0("buffer"),v7=L0(),hN=j1(),fN={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof k1.Buffer==="function")return k1.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 k1.Buffer==="function")W=Y instanceof k1.Buffer?Y.toString("base64"):k1.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=v7.Scalar.BLOCK_LITERAL),Z!==v7.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,q=0;H<G;++H,q+=U)V[H]=W.substr(q,U);W=V.join(Z===v7.Scalar.BLOCK_LITERAL?`
78
+ `:" ")}return hN.stringifyString({comment:$,type:Z,value:W},Q,X,J)}};uN.binary=fN});var Q5=P((dN)=>{var z5=t(),h7=X6(),cN=L0(),pN=W6();function HJ($,Z){if(z5.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if(z5.isPair(Q))continue;else if(z5.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new h7.Pair(new cN.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]=$5.isPair(Q)?Q:new b7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function GJ($,Z,z){let{replacer:Q}=z,X=new vN.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(b7.createPair(W,U,z))}return X}var gN={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:UJ,createNode:GJ};hN.createPairs=GJ;hN.pairs=gN;hN.resolvePairs=UJ});var g7=P((lN)=>{var VJ=t(),v7=z6(),b1=W6(),cN=U6(),HJ=Z5();class k6 extends cN.YAMLSeq{constructor(){super();this.add=b1.YAMLMap.prototype.add.bind(this),this.delete=b1.YAMLMap.prototype.delete.bind(this),this.get=b1.YAMLMap.prototype.get.bind(this),this.has=b1.YAMLMap.prototype.has.bind(this),this.set=b1.YAMLMap.prototype.set.bind(this),this.tag=k6.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(VJ.isPair(Q))X=v7.toJS(Q.key,"",Z),J=v7.toJS(Q.value,X,Z);else X=v7.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=HJ.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}k6.tag="tag:yaml.org,2002:omap";var pN={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:k6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=HJ.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(VJ.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 k6,z)},createNode:($,Z,z)=>k6.from($,Z,z)};lN.YAMLOMap=k6;lN.omap=pN});var LJ=P((nN)=>{var qJ=L0();function KJ({value:$,source:Z},z){if(Z&&($?BJ:MJ).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var BJ={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new qJ.Scalar(!0),stringify:KJ},MJ={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new qJ.Scalar(!1),stringify:KJ};nN.falseTag=MJ;nN.trueTag=BJ});var NJ=P(($D)=>{var oN=L0(),h7=I$(),aN={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:h7.stringifyNumber},tN={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():h7.stringifyNumber($)}},eN={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new oN.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:h7.stringifyNumber};$D.float=eN;$D.floatExp=tN;$D.floatNaN=aN});var OJ=P((UD)=>{var DJ=I$(),v1=($)=>typeof $==="bigint"||Number.isInteger($);function z5($,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 f7($,Z,z){let{value:Q}=$;if(v1(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return DJ.stringifyNumber($)}var XD={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>z5($,2,2,z),stringify:($)=>f7($,2,"0b")},JD={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>z5($,1,8,z),stringify:($)=>f7($,8,"0")},YD={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>z5($,0,10,z),stringify:DJ.stringifyNumber},WD={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>z5($,2,16,z),stringify:($)=>f7($,16,"0x")};UD.int=YD;UD.intBin=XD;UD.intHex=WD;UD.intOct=JD});var u7=P((BD)=>{var J5=t(),Q5=J6(),X5=W6();class b6 extends X5.YAMLMap{constructor($){super($);this.tag=b6.tag}add($){let Z;if(J5.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new Q5.Pair($.key,null);else Z=new Q5.Pair($,null);if(!X5.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=X5.findPair(this.items,$);return!Z&&J5.isPair(z)?J5.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=X5.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new Q5.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(Q5.createPair(J,null,z))}return X}}b6.tag="tag:yaml.org,2002:set";var KD={collection:"map",identify:($)=>$ instanceof Set,nodeClass:b6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>b6.from($,Z,z),resolve($,Z){if(J5.isMap($))if($.hasAllNullValues(!0))return Object.assign(new b6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};BD.YAMLSet=b6;BD.set=KD});var c7=P((ID)=>{var ND=I$();function m7($,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 IJ($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return ND.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 DD={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})=>m7($,z),stringify:IJ},OD={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:($)=>m7($,!1),stringify:IJ},TJ={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(TJ.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=m7(V,!1);if(Math.abs(H)<30)H*=60;G-=60000*H}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ID.floatTime=OD;ID.intTime=DD;ID.timestamp=TJ});var CJ=P((kD)=>{var _D=D$(),RD=a4(),PD=O$(),FD=y1(),SD=k7(),AJ=LJ(),p7=NJ(),Y5=OJ(),jD=p4(),ED=g7(),wD=Z5(),xD=u7(),l7=c7(),yD=[_D.map,PD.seq,FD.string,RD.nullTag,AJ.trueTag,AJ.falseTag,Y5.intBin,Y5.intOct,Y5.int,Y5.intHex,p7.floatNaN,p7.floatExp,p7.float,SD.binary,jD.merge,ED.omap,wD.pairs,xD.set,l7.intTime,l7.floatTime,l7.timestamp];kD.schema=yD});var yJ=P((pD)=>{var FJ=D$(),vD=a4(),SJ=O$(),gD=y1(),hD=P7(),d7=S7(),i7=E7(),fD=JJ(),uD=WJ(),jJ=k7(),g1=p4(),EJ=g7(),wJ=Z5(),_J=CJ(),xJ=u7(),W5=c7(),RJ=new Map([["core",fD.schema],["failsafe",[FJ.map,SJ.seq,gD.string]],["json",uD.schema],["yaml11",_J.schema],["yaml-1.1",_J.schema]]),PJ={binary:jJ.binary,bool:hD.boolTag,float:d7.float,floatExp:d7.floatExp,floatNaN:d7.floatNaN,floatTime:W5.floatTime,int:i7.int,intHex:i7.intHex,intOct:i7.intOct,intTime:W5.intTime,map:FJ.map,merge:g1.merge,null:vD.nullTag,omap:EJ.omap,pairs:wJ.pairs,seq:SJ.seq,set:xJ.set,timestamp:W5.timestamp},mD={"tag:yaml.org,2002:binary":jJ.binary,"tag:yaml.org,2002:merge":g1.merge,"tag:yaml.org,2002:omap":EJ.omap,"tag:yaml.org,2002:pairs":wJ.pairs,"tag:yaml.org,2002:set":xJ.set,"tag:yaml.org,2002:timestamp":W5.timestamp};function cD($,Z,z){let Q=RJ.get(Z);if(Q&&!$)return z&&!Q.includes(g1.merge)?Q.concat(g1.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(RJ.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(g1.merge);return X.reduce((J,Y)=>{let W=typeof Y==="string"?PJ[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(PJ).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},[])}pD.coreKnownTags=mD;pD.getTags=cD});var s7=P((oD)=>{var n7=t(),iD=D$(),nD=O$(),rD=y1(),U5=yJ(),sD=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class r7{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?U5.getTags($,"compat"):$?U5.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?U5.coreKnownTags:{},this.tags=U5.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,n7.MAP,{value:iD.map}),Object.defineProperty(this,n7.SCALAR,{value:rD.string}),Object.defineProperty(this,n7.SEQ,{value:nD.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?sD:null}clone(){let $=Object.create(r7.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}oD.Schema=r7});var kJ=P(($O)=>{var tD=t(),o7=E1(),h1=F1();function eD($,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=o7.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let U=J($.commentBefore);z.unshift(h1.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(tD.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(h1.indentComment(V,""))}X.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=o7.stringify($.contents,X,()=>W=null,U);if(W)G+=h1.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(o7.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let U=J($.comment);if(U.includes(`
80
+ ${J.comment}`:Q.comment}Q=X}$.items[z]=z5.isPair(Q)?Q:new h7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function qJ($,Z,z){let{replacer:Q}=z,X=new pN.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(h7.createPair(W,U,z))}return X}var lN={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:HJ,createNode:qJ};dN.createPairs=qJ;dN.pairs=lN;dN.resolvePairs=HJ});var u7=P((aN)=>{var KJ=t(),f7=Z6(),b1=Y6(),sN=W6(),BJ=Q5();class k6 extends sN.YAMLSeq{constructor(){super();this.add=b1.YAMLMap.prototype.add.bind(this),this.delete=b1.YAMLMap.prototype.delete.bind(this),this.get=b1.YAMLMap.prototype.get.bind(this),this.has=b1.YAMLMap.prototype.has.bind(this),this.set=b1.YAMLMap.prototype.set.bind(this),this.tag=k6.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(KJ.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=BJ.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}k6.tag="tag:yaml.org,2002:omap";var oN={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:k6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=BJ.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(KJ.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 k6,z)},createNode:($,Z,z)=>k6.from($,Z,z)};aN.YAMLOMap=k6;aN.omap=oN});var OJ=P(($D)=>{var MJ=L0();function LJ({value:$,source:Z},z){if(Z&&($?NJ:DJ).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var NJ={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new MJ.Scalar(!0),stringify:LJ},DJ={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new MJ.Scalar(!1),stringify:LJ};$D.falseTag=DJ;$D.trueTag=NJ});var IJ=P((WD)=>{var QD=L0(),m7=I$(),XD={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:m7.stringifyNumber},JD={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():m7.stringifyNumber($)}},YD={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new QD.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:m7.stringifyNumber};WD.float=YD;WD.floatExp=JD;WD.floatNaN=XD});var AJ=P((MD)=>{var TJ=I$(),v1=($)=>typeof $==="bigint"||Number.isInteger($);function X5($,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 c7($,Z,z){let{value:Q}=$;if(v1(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return TJ.stringifyNumber($)}var HD={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>X5($,2,2,z),stringify:($)=>c7($,2,"0b")},qD={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>X5($,1,8,z),stringify:($)=>c7($,8,"0")},KD={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>X5($,0,10,z),stringify:TJ.stringifyNumber},BD={identify:v1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>X5($,2,16,z),stringify:($)=>c7($,16,"0x")};MD.int=KD;MD.intBin=HD;MD.intHex=BD;MD.intOct=qD});var p7=P((TD)=>{var W5=t(),J5=X6(),Y5=Y6();class b6 extends Y5.YAMLMap{constructor($){super($);this.tag=b6.tag}add($){let Z;if(W5.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new J5.Pair($.key,null);else Z=new J5.Pair($,null);if(!Y5.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=Y5.findPair(this.items,$);return!Z&&W5.isPair(z)?W5.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=Y5.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new J5.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(J5.createPair(J,null,z))}return X}}b6.tag="tag:yaml.org,2002:set";var ID={collection:"map",identify:($)=>$ instanceof Set,nodeClass:b6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>b6.from($,Z,z),resolve($,Z){if(W5.isMap($))if($.hasAllNullValues(!0))return Object.assign(new b6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};TD.YAMLSet=b6;TD.set=ID});var d7=P((FD)=>{var _D=I$();function l7($,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 CJ($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return _D.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 RD={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})=>l7($,z),stringify:CJ},PD={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:($)=>l7($,!1),stringify:CJ},_J={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(_J.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=l7(V,!1);if(Math.abs(H)<30)H*=60;G-=60000*H}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};FD.floatTime=PD;FD.intTime=RD;FD.timestamp=_J});var PJ=P((mD)=>{var wD=D$(),xD=e8(),yD=O$(),kD=y1(),bD=g7(),RJ=OJ(),i7=IJ(),U5=AJ(),vD=d8(),gD=u7(),hD=Q5(),fD=p7(),n7=d7(),uD=[wD.map,yD.seq,kD.string,xD.nullTag,RJ.trueTag,RJ.falseTag,U5.intBin,U5.intOct,U5.int,U5.intHex,i7.floatNaN,i7.floatExp,i7.float,bD.binary,vD.merge,gD.omap,hD.pairs,fD.set,n7.intTime,n7.floatTime,n7.timestamp];mD.schema=uD});var vJ=P((oD)=>{var EJ=D$(),pD=e8(),wJ=O$(),lD=y1(),dD=j7(),r7=w7(),s7=y7(),iD=UJ(),nD=VJ(),xJ=g7(),g1=d8(),yJ=u7(),kJ=Q5(),FJ=PJ(),bJ=p7(),G5=d7(),SJ=new Map([["core",iD.schema],["failsafe",[EJ.map,wJ.seq,lD.string]],["json",nD.schema],["yaml11",FJ.schema],["yaml-1.1",FJ.schema]]),jJ={binary:xJ.binary,bool:dD.boolTag,float:r7.float,floatExp:r7.floatExp,floatNaN:r7.floatNaN,floatTime:G5.floatTime,int:s7.int,intHex:s7.intHex,intOct:s7.intOct,intTime:G5.intTime,map:EJ.map,merge:g1.merge,null:pD.nullTag,omap:yJ.omap,pairs:kJ.pairs,seq:wJ.seq,set:bJ.set,timestamp:G5.timestamp},rD={"tag:yaml.org,2002:binary":xJ.binary,"tag:yaml.org,2002:merge":g1.merge,"tag:yaml.org,2002:omap":yJ.omap,"tag:yaml.org,2002:pairs":kJ.pairs,"tag:yaml.org,2002:set":bJ.set,"tag:yaml.org,2002:timestamp":G5.timestamp};function sD($,Z,z){let Q=SJ.get(Z);if(Q&&!$)return z&&!Q.includes(g1.merge)?Q.concat(g1.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(SJ.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(g1.merge);return X.reduce((J,Y)=>{let W=typeof Y==="string"?jJ[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(jJ).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},[])}oD.coreKnownTags=rD;oD.getTags=sD});var t7=P((QO)=>{var o7=t(),eD=D$(),$O=O$(),ZO=y1(),V5=vJ(),zO=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class a7{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?V5.getTags($,"compat"):$?V5.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?V5.coreKnownTags:{},this.tags=V5.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,o7.MAP,{value:eD.map}),Object.defineProperty(this,o7.SCALAR,{value:ZO.string}),Object.defineProperty(this,o7.SEQ,{value:$O.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?zO:null}clone(){let $=Object.create(a7.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}QO.Schema=a7});var gJ=P((WO)=>{var JO=t(),e7=E1(),h1=F1();function YO($,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=e7.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let U=J($.commentBefore);z.unshift(h1.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(JO.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(h1.indentComment(V,""))}X.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=e7.stringify($.contents,X,()=>W=null,U);if(W)G+=h1.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(e7.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let U=J($.comment);if(U.includes(`
81
81
  `))z.push("..."),z.push(h1.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(h1.indentComment(J(U),""))}}return z.join(`
82
82
  `)+`
83
- `}$O.stringifyDocument=eD});var f1=P((GO)=>{var zO=R1(),T$=v4(),X2=t(),QO=J6(),XO=z6(),JO=s7(),YO=kJ(),a7=y4(),WO=L7(),UO=P1(),t7=M7();class e7{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,X2.NODE_TYPE,{value:X2.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 t7.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(e7.prototype,{[X2.NODE_TYPE]:{value:X2.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=X2.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(A$(this.contents))this.contents.add($)}addIn($,Z){if(A$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=a7.anchorNames(this);$.anchor=!Z||z.has(Z)?a7.findNewAnchor(Z||"a",z):Z}return new zO.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let B=(O)=>typeof O==="number"||O instanceof String||O 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:q}=a7.createNodeAnchors(this,J||"a"),K={aliasDuplicateObjects:X??!0,keepUndefined:W??!1,onAnchor:V,onTagObj:U,replacer:Q,schema:this.schema,sourceObjects:q},M=UO.createNode($,G,K);if(Y&&X2.isCollection(M))M.flow=!0;return H(),M}createPair($,Z,z={}){let Q=this.createNode($,null,z),X=this.createNode(Z,null,z);return new QO.Pair(Q,X)}delete($){return A$(this.contents)?this.contents.delete($):!1}deleteIn($){if(T$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return A$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return X2.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(T$.isEmptyPath($))return!Z&&X2.isScalar(this.contents)?this.contents.value:this.contents;return X2.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return X2.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(T$.isEmptyPath($))return this.contents!==void 0;return X2.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=T$.collectionFromPath(this.schema,[$],Z);else if(A$(this.contents))this.contents.set($,Z)}setIn($,Z){if(T$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=T$.collectionFromPath(this.schema,Array.from($),Z);else if(A$(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 t7.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 t7.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 JO.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=XO.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"?WO.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 YO.stringifyDocument(this,$)}}function A$($){if(X2.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}GO.Document=e7});var u1=P((qO)=>{class G5 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class bJ extends G5{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class vJ extends G5{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var HO=($,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
+ `}WO.stringifyDocument=YO});var f1=P((LO)=>{var GO=R1(),T$=h8(),X2=t(),VO=X6(),HO=Z6(),qO=t7(),KO=gJ(),$9=b8(),BO=O7(),MO=P1(),Z9=D7();class z9{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,X2.NODE_TYPE,{value:X2.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 Z9.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(z9.prototype,{[X2.NODE_TYPE]:{value:X2.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=X2.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(A$(this.contents))this.contents.add($)}addIn($,Z){if(A$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=$9.anchorNames(this);$.anchor=!Z||z.has(Z)?$9.findNewAnchor(Z||"a",z):Z}return new GO.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let B=(O)=>typeof O==="number"||O instanceof String||O 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:q}=$9.createNodeAnchors(this,J||"a"),K={aliasDuplicateObjects:X??!0,keepUndefined:W??!1,onAnchor:V,onTagObj:U,replacer:Q,schema:this.schema,sourceObjects:q},L=MO.createNode($,G,K);if(Y&&X2.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 VO.Pair(Q,X)}delete($){return A$(this.contents)?this.contents.delete($):!1}deleteIn($){if(T$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return A$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return X2.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(T$.isEmptyPath($))return!Z&&X2.isScalar(this.contents)?this.contents.value:this.contents;return X2.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return X2.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(T$.isEmptyPath($))return this.contents!==void 0;return X2.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=T$.collectionFromPath(this.schema,[$],Z);else if(A$(this.contents))this.contents.set($,Z)}setIn($,Z){if(T$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=T$.collectionFromPath(this.schema,Array.from($),Z);else if(A$(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 Z9.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 Z9.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 qO.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=HO.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"?BO.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 KO.stringifyDocument(this,$)}}function A$($){if(X2.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}LO.Document=z9});var u1=P((OO)=>{class H5 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class hJ extends H5{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class fJ extends H5{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var DO=($,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
- `}};qO.YAMLError=G5;qO.YAMLParseError=bJ;qO.YAMLWarning=vJ;qO.prettifyError=HO});var m1=P((DO)=>{function NO($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,V=W,H="",q="",K=!1,M=!1,B=null,N=null,O=null,_=null,x=null,S=null,y=null;for(let j of $){if(M){if(j.type!=="space"&&j.type!=="newline"&&j.type!=="comma")J(j.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");M=!1}if(B){if(G&&j.type!=="comment"&&j.type!=="newline")J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(j.type){case"space":if(!Z&&(z!=="doc-start"||Q?.type!=="flow-collection")&&j.source.includes("\t"))B=j;V=!0;break;case"comment":{if(!V)J(j,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=j.source.substring(1)||" ";if(!H)H=d;else H+=q+d;q="",G=!1;break}case"newline":if(G){if(H)H+=j.source;else if(!S||z!=="seq-item-ind")U=!0}else q+=j.source;if(G=!0,K=!0,N||O)_=j;V=!0;break;case"anchor":if(N)J(j,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(j.source.endsWith(":"))J(j.offset+j.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);N=j,y??(y=j.offset),G=!1,V=!1,M=!0;break;case"tag":{if(O)J(j,"MULTIPLE_TAGS","A node can have at most one tag");O=j,y??(y=j.offset),G=!1,V=!1,M=!0;break}case z:if(N||O)J(j,"BAD_PROP_ORDER",`Anchors and tags must be after the ${j.source} indicator`);if(S)J(j,"UNEXPECTED_TOKEN",`Unexpected ${j.source} in ${Z??"collection"}`);S=j,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(x)J(j,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);x=j,G=!1,V=!1;break}default:J(j,"UNEXPECTED_TOKEN",`Unexpected ${j.type} token`),G=!1,V=!1}}let E=$[$.length-1],u=E?E.offset+E.source.length:X;if(M&&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:x,found:S,spaceBefore:U,comment:H,hasNewline:K,anchor:N,tag:O,newlineAfterProp:_,end:u,start:y??u}}DO.resolveProps=NO});var V5=P((IO)=>{function $9($){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($9(Z.key)||$9(Z.value))return!0}return!1;default:return!0}}IO.containsNewline=$9});var Z9=P((_O)=>{var AO=V5();function CO($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&AO.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}_O.flowIndentCheck=CO});var z9=P((FO)=>{var gJ=t();function PO($,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))}FO.mapIncludes=PO});var cJ=P((yO)=>{var hJ=J6(),jO=W6(),fJ=m1(),EO=V5(),uJ=Z9(),wO=z9(),mJ="All mapping items must start at the same column";function xO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??jO.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:q,sep:K,value:M}=V,B=fJ.resolveProps(H,{indicator:"explicit-key-ind",next:q??K?.[0],offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0}),N=!B.found;if(N){if(q){if(q.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 q&&q.indent!==Q.indent)X(U,"BAD_INDENT",mJ)}if(!B.anchor&&!B.tag&&!K){if(G=B.end,B.comment)if(W.comment)W.comment+=`
90
- `+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||EO.containsNewline(q))X(q??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",mJ);z.atKey=!0;let O=B.end,_=q?$(z,q,B,X):Z(z,O,H,null,B,X);if(z.schema.compat)uJ.flowIndentCheck(Q.indent,q,X);if(z.atKey=!1,wO.mapIncludes(z,W.items,_))X(O,"DUPLICATE_KEY","Map keys must be unique");let x=fJ.resolveProps(K??[],{indicator:"map-value-ind",next:M,offset:_.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!q||q.type==="block-scalar"});if(U=x.end,x.found){if(N){if(M?.type==="block-map"&&!x.hasNewline)X(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&B.start<x.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 S=M?$(z,M,x,X):Z(z,U,K,null,x,X);if(z.schema.compat)uJ.flowIndentCheck(Q.indent,M,X);U=S.range[2];let y=new hJ.Pair(_,S);if(z.options.keepSourceTokens)y.srcToken=V;W.items.push(y)}else{if(N)X(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(x.comment)if(_.comment)_.comment+=`
91
- `+x.comment;else _.comment=x.comment;let S=new hJ.Pair(_);if(z.options.keepSourceTokens)S.srcToken=V;W.items.push(S)}}if(G&&G<U)X(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[Q.offset,U,G??U],W}yO.resolveBlockMap=xO});var pJ=P((fO)=>{var bO=U6(),vO=m1(),gO=Z9();function hO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??bO.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 q=vO.resolveProps(V,{indicator:"seq-item-ind",next:H,offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!q.found)if(q.anchor||q.tag||H)if(H?.type==="block-seq")X(q.end,"BAD_INDENT","All sequence items must start at the same column");else X(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=q.end,q.comment)W.comment=q.comment;continue}let K=H?$(z,H,q,X):Z(z,q.end,V,null,q,X);if(z.schema.compat)gO.flowIndentCheck(Q.indent,H,X);U=K.range[2],W.items.push(K)}return W.range=[Q.offset,U,G??U],W}fO.resolveBlockSeq=hO});var C$=P((cO)=>{function mO($,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}}cO.resolveEnd=mO});var iJ=P((aO)=>{var lO=t(),dO=J6(),lJ=W6(),iO=U6(),nO=C$(),dJ=m1(),rO=V5(),sO=z9(),Q9="Block collections are not allowed within flow collections",X9=($)=>$&&($.type==="block-map"||$.type==="block-seq");function oO({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:iO.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 O=Q.items[N],{start:_,key:x,sep:S,value:y}=O,E=dJ.resolveProps(_,{flow:W,indicator:"explicit-key-ind",next:x??S?.[0],offset:H,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!S&&!y){if(N===0&&E.comma)X(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(N<Q.items.length-1)X(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(E.comment)if(G.comment)G.comment+=`
92
- `+E.comment;else G.comment=E.comment;H=E.end;continue}if(!Y&&z.options.strict&&rO.containsNewline(x))X(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(N===0){if(E.comma)X(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!E.comma)X(E.start,"MISSING_CHAR",`Missing , between ${W} items`);if(E.comment){let u="";$:for(let j of _)switch(j.type){case"comma":case"space":break;case"comment":u=j.source.substring(1);break $;default:break $}if(u){let j=G.items[G.items.length-1];if(lO.isPair(j))j=j.value??j.key;if(j.comment)j.comment+=`
93
- `+u;else j.comment=u;E.comment=E.comment.substring(u.length+1)}}}if(!Y&&!S&&!E.found){let u=y?$(z,y,E,X):Z(z,E.end,S,null,E,X);if(G.items.push(u),H=u.range[2],X9(y))X(u.range,"BLOCK_IN_FLOW",Q9)}else{z.atKey=!0;let u=E.end,j=x?$(z,x,E,X):Z(z,u,_,null,E,X);if(X9(x))X(j.range,"BLOCK_IN_FLOW",Q9);z.atKey=!1;let d=dJ.resolveProps(S??[],{flow:W,indicator:"map-value-ind",next:y,offset:j.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(d.found){if(!Y&&!E.found&&z.options.strict){if(S)for(let z0 of S){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(E.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(y)if("source"in y&&y.source?.[0]===":")X(y,"MISSING_CHAR",`Missing space after : in ${W}`);else X(d.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let I0=y?$(z,y,d,X):d.found?Z(z,d.end,S,null,d,X):null;if(I0){if(X9(y))X(I0.range,"BLOCK_IN_FLOW",Q9)}else if(d.comment)if(j.comment)j.comment+=`
94
- `+d.comment;else j.comment=d.comment;let S0=new dO.Pair(j,I0);if(z.options.keepSourceTokens)S0.srcToken=O;if(Y){let z0=G;if(sO.mapIncludes(z,z0.items,j))X(u,"DUPLICATE_KEY","Map keys must be unique");z0.items.push(S0)}else{let z0=new lJ.YAMLMap(z.schema);z0.flow=!0,z0.items.push(S0);let b=(I0??j).range;z0.range=[j.range[0],b[1],b[2]],G.items.push(z0)}H=I0?I0.range[2]:d.end}}let q=Y?"}":"]",[K,...M]=Q.end,B=H;if(K?.source===q)B=K.offset+K.source.length;else{let N=W[0].toUpperCase()+W.substring(1),O=V?`${N} must end with a ${q}`:`${N} in block collection must be sufficiently indented and end with a ${q}`;if(X(H,V?"MISSING_CHAR":"BAD_INDENT",O),K&&K.source.length!==1)M.unshift(K)}if(M.length>0){let N=nO.resolveEnd(M,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}aO.resolveFlowCollection=oO});var nJ=P((WI)=>{var eO=t(),$I=L0(),ZI=W6(),zI=U6(),QI=cJ(),XI=pJ(),JI=iJ();function J9($,Z,z,Q,X,J){let Y=z.type==="block-map"?QI.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?XI.resolveBlockSeq($,Z,z,Q,J):JI.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 YI($,Z,z,Q,X){let J=Q.tag,Y=!J?null:Z.directives.tagName(J.source,(q)=>X(J,"TAG_RESOLVE_FAILED",q));if(z.type==="block-seq"){let{anchor:q,newlineAfterProp:K}=Q,M=q&&J?q.offset>J.offset?q:J:q??J;if(M&&(!K||K.offset<M.offset))X(M,"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===ZI.YAMLMap.tagName&&W==="map"||Y===zI.YAMLSeq.tagName&&W==="seq")return J9($,Z,z,X,Y);let U=Z.schema.tags.find((q)=>q.tag===Y&&q.collection===W);if(!U){let q=Z.schema.knownTags[Y];if(q?.collection===W)Z.schema.tags.push(Object.assign({},q,{default:!1})),U=q;else{if(q)X(J,"BAD_COLLECTION_TYPE",`${q.tag} used for ${W} collection, but expects ${q.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return J9($,Z,z,X,Y)}}let G=J9($,Z,z,X,Y,U),V=U.resolve?.(G,(q)=>X(J,"TAG_RESOLVE_FAILED",q),Z.options)??G,H=eO.isNode(V)?V:new $I.Scalar(V);if(H.range=G.range,H.tag=Y,U?.format)H.format=U.format;return H}WI.composeCollection=YI});var W9=P((qI)=>{var Y9=L0();function GI($,Z,z){let Q=Z.offset,X=VI(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?Y9.Scalar.BLOCK_FOLDED:Y9.Scalar.BLOCK_LITERAL,Y=Z.source?HI(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
+ `}};OO.YAMLError=H5;OO.YAMLParseError=hJ;OO.YAMLWarning=fJ;OO.prettifyError=DO});var m1=P((RO)=>{function _O($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,V=W,H="",q="",K=!1,L=!1,B=null,N=null,O=null,_=null,x=null,S=null,y=null;for(let j of $){if(L){if(j.type!=="space"&&j.type!=="newline"&&j.type!=="comma")J(j.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(G&&j.type!=="comment"&&j.type!=="newline")J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(j.type){case"space":if(!Z&&(z!=="doc-start"||Q?.type!=="flow-collection")&&j.source.includes("\t"))B=j;V=!0;break;case"comment":{if(!V)J(j,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=j.source.substring(1)||" ";if(!H)H=d;else H+=q+d;q="",G=!1;break}case"newline":if(G){if(H)H+=j.source;else if(!S||z!=="seq-item-ind")U=!0}else q+=j.source;if(G=!0,K=!0,N||O)_=j;V=!0;break;case"anchor":if(N)J(j,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(j.source.endsWith(":"))J(j.offset+j.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);N=j,y??(y=j.offset),G=!1,V=!1,L=!0;break;case"tag":{if(O)J(j,"MULTIPLE_TAGS","A node can have at most one tag");O=j,y??(y=j.offset),G=!1,V=!1,L=!0;break}case z:if(N||O)J(j,"BAD_PROP_ORDER",`Anchors and tags must be after the ${j.source} indicator`);if(S)J(j,"UNEXPECTED_TOKEN",`Unexpected ${j.source} in ${Z??"collection"}`);S=j,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(x)J(j,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);x=j,G=!1,V=!1;break}default:J(j,"UNEXPECTED_TOKEN",`Unexpected ${j.type} token`),G=!1,V=!1}}let E=$[$.length-1],u=E?E.offset+E.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:x,found:S,spaceBefore:U,comment:H,hasNewline:K,anchor:N,tag:O,newlineAfterProp:_,end:u,start:y??u}}RO.resolveProps=_O});var q5=P((FO)=>{function Q9($){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(Q9(Z.key)||Q9(Z.value))return!0}return!1;default:return!0}}FO.containsNewline=Q9});var X9=P((wO)=>{var jO=q5();function EO($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&jO.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}wO.flowIndentCheck=EO});var J9=P((kO)=>{var uJ=t();function yO($,Z,z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(J,Y)=>J===Y||uJ.isScalar(J)&&uJ.isScalar(Y)&&J.value===Y.value;return Z.some((J)=>X(J.key,z))}kO.mapIncludes=yO});var dJ=P((uO)=>{var mJ=X6(),vO=Y6(),cJ=m1(),gO=q5(),pJ=X9(),hO=J9(),lJ="All mapping items must start at the same column";function fO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??vO.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:q,sep:K,value:L}=V,B=cJ.resolveProps(H,{indicator:"explicit-key-ind",next:q??K?.[0],offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0}),N=!B.found;if(N){if(q){if(q.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 q&&q.indent!==Q.indent)X(U,"BAD_INDENT",lJ)}if(!B.anchor&&!B.tag&&!K){if(G=B.end,B.comment)if(W.comment)W.comment+=`
90
+ `+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||gO.containsNewline(q))X(q??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",lJ);z.atKey=!0;let O=B.end,_=q?$(z,q,B,X):Z(z,O,H,null,B,X);if(z.schema.compat)pJ.flowIndentCheck(Q.indent,q,X);if(z.atKey=!1,hO.mapIncludes(z,W.items,_))X(O,"DUPLICATE_KEY","Map keys must be unique");let x=cJ.resolveProps(K??[],{indicator:"map-value-ind",next:L,offset:_.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!q||q.type==="block-scalar"});if(U=x.end,x.found){if(N){if(L?.type==="block-map"&&!x.hasNewline)X(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&B.start<x.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 S=L?$(z,L,x,X):Z(z,U,K,null,x,X);if(z.schema.compat)pJ.flowIndentCheck(Q.indent,L,X);U=S.range[2];let y=new mJ.Pair(_,S);if(z.options.keepSourceTokens)y.srcToken=V;W.items.push(y)}else{if(N)X(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(x.comment)if(_.comment)_.comment+=`
91
+ `+x.comment;else _.comment=x.comment;let S=new mJ.Pair(_);if(z.options.keepSourceTokens)S.srcToken=V;W.items.push(S)}}if(G&&G<U)X(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[Q.offset,U,G??U],W}uO.resolveBlockMap=fO});var iJ=P((iO)=>{var cO=W6(),pO=m1(),lO=X9();function dO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??cO.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 q=pO.resolveProps(V,{indicator:"seq-item-ind",next:H,offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!q.found)if(q.anchor||q.tag||H)if(H?.type==="block-seq")X(q.end,"BAD_INDENT","All sequence items must start at the same column");else X(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=q.end,q.comment)W.comment=q.comment;continue}let K=H?$(z,H,q,X):Z(z,q.end,V,null,q,X);if(z.schema.compat)lO.flowIndentCheck(Q.indent,H,X);U=K.range[2],W.items.push(K)}return W.range=[Q.offset,U,G??U],W}iO.resolveBlockSeq=dO});var C$=P((sO)=>{function rO($,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}}sO.resolveEnd=rO});var sJ=P((XI)=>{var aO=t(),tO=X6(),nJ=Y6(),eO=W6(),$I=C$(),rJ=m1(),ZI=q5(),zI=J9(),Y9="Block collections are not allowed within flow collections",W9=($)=>$&&($.type==="block-map"||$.type==="block-seq");function QI({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let Y=Q.start.source==="{",W=Y?"flow map":"flow sequence",G=new(J?.nodeClass??(Y?nJ.YAMLMap:eO.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 O=Q.items[N],{start:_,key:x,sep:S,value:y}=O,E=rJ.resolveProps(_,{flow:W,indicator:"explicit-key-ind",next:x??S?.[0],offset:H,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!S&&!y){if(N===0&&E.comma)X(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(N<Q.items.length-1)X(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(E.comment)if(G.comment)G.comment+=`
92
+ `+E.comment;else G.comment=E.comment;H=E.end;continue}if(!Y&&z.options.strict&&ZI.containsNewline(x))X(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(N===0){if(E.comma)X(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!E.comma)X(E.start,"MISSING_CHAR",`Missing , between ${W} items`);if(E.comment){let u="";$:for(let j of _)switch(j.type){case"comma":case"space":break;case"comment":u=j.source.substring(1);break $;default:break $}if(u){let j=G.items[G.items.length-1];if(aO.isPair(j))j=j.value??j.key;if(j.comment)j.comment+=`
93
+ `+u;else j.comment=u;E.comment=E.comment.substring(u.length+1)}}}if(!Y&&!S&&!E.found){let u=y?$(z,y,E,X):Z(z,E.end,S,null,E,X);if(G.items.push(u),H=u.range[2],W9(y))X(u.range,"BLOCK_IN_FLOW",Y9)}else{z.atKey=!0;let u=E.end,j=x?$(z,x,E,X):Z(z,u,_,null,E,X);if(W9(x))X(j.range,"BLOCK_IN_FLOW",Y9);z.atKey=!1;let d=rJ.resolveProps(S??[],{flow:W,indicator:"map-value-ind",next:y,offset:j.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(d.found){if(!Y&&!E.found&&z.options.strict){if(S)for(let z0 of S){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(E.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(y)if("source"in y&&y.source?.[0]===":")X(y,"MISSING_CHAR",`Missing space after : in ${W}`);else X(d.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let I0=y?$(z,y,d,X):d.found?Z(z,d.end,S,null,d,X):null;if(I0){if(W9(y))X(I0.range,"BLOCK_IN_FLOW",Y9)}else if(d.comment)if(j.comment)j.comment+=`
94
+ `+d.comment;else j.comment=d.comment;let S0=new tO.Pair(j,I0);if(z.options.keepSourceTokens)S0.srcToken=O;if(Y){let z0=G;if(zI.mapIncludes(z,z0.items,j))X(u,"DUPLICATE_KEY","Map keys must be unique");z0.items.push(S0)}else{let z0=new nJ.YAMLMap(z.schema);z0.flow=!0,z0.items.push(S0);let b=(I0??j).range;z0.range=[j.range[0],b[1],b[2]],G.items.push(z0)}H=I0?I0.range[2]:d.end}}let q=Y?"}":"]",[K,...L]=Q.end,B=H;if(K?.source===q)B=K.offset+K.source.length;else{let N=W[0].toUpperCase()+W.substring(1),O=V?`${N} must end with a ${q}`:`${N} in block collection must be sufficiently indented and end with a ${q}`;if(X(H,V?"MISSING_CHAR":"BAD_INDENT",O),K&&K.source.length!==1)L.unshift(K)}if(L.length>0){let N=$I.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}XI.resolveFlowCollection=QI});var oJ=P((BI)=>{var YI=t(),WI=L0(),UI=Y6(),GI=W6(),VI=dJ(),HI=iJ(),qI=sJ();function U9($,Z,z,Q,X,J){let Y=z.type==="block-map"?VI.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?HI.resolveBlockSeq($,Z,z,Q,J):qI.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 KI($,Z,z,Q,X){let J=Q.tag,Y=!J?null:Z.directives.tagName(J.source,(q)=>X(J,"TAG_RESOLVE_FAILED",q));if(z.type==="block-seq"){let{anchor:q,newlineAfterProp:K}=Q,L=q&&J?q.offset>J.offset?q:J:q??J;if(L&&(!K||K.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===UI.YAMLMap.tagName&&W==="map"||Y===GI.YAMLSeq.tagName&&W==="seq")return U9($,Z,z,X,Y);let U=Z.schema.tags.find((q)=>q.tag===Y&&q.collection===W);if(!U){let q=Z.schema.knownTags[Y];if(q?.collection===W)Z.schema.tags.push(Object.assign({},q,{default:!1})),U=q;else{if(q)X(J,"BAD_COLLECTION_TYPE",`${q.tag} used for ${W} collection, but expects ${q.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return U9($,Z,z,X,Y)}}let G=U9($,Z,z,X,Y,U),V=U.resolve?.(G,(q)=>X(J,"TAG_RESOLVE_FAILED",q),Z.options)??G,H=YI.isNode(V)?V:new WI.Scalar(V);if(H.range=G.range,H.tag=Y,U?.format)H.format=U.format;return H}BI.composeCollection=KI});var V9=P((OI)=>{var G9=L0();function LI($,Z,z){let Q=Z.offset,X=NI(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?G9.Scalar.BLOCK_FOLDED:G9.Scalar.BLOCK_LITERAL,Y=Z.source?DI(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,O]=Y[B];if(O===""||O==="\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+O.length+1}for(let B=Y.length-1;B>=W;--B)if(Y[B][0].length>U)W=B+1;let H="",q="",K=!1;for(let B=0;B<V;++B)H+=Y[B][0].slice(U)+`
97
- `;for(let B=V;B<W;++B){let[N,O]=Y[B];G+=N.length+O.length+1;let _=O[O.length-1]==="\r";if(_)O=O.slice(0,-1);if(O&&N.length<U){let S=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-O.length-(_?2:1),"BAD_INDENT",S),N=""}if(J===Y9.Scalar.BLOCK_LITERAL)H+=q+N.slice(U)+O,q=`
97
+ `;for(let B=V;B<W;++B){let[N,O]=Y[B];G+=N.length+O.length+1;let _=O[O.length-1]==="\r";if(_)O=O.slice(0,-1);if(O&&N.length<U){let S=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-O.length-(_?2:1),"BAD_INDENT",S),N=""}if(J===G9.Scalar.BLOCK_LITERAL)H+=q+N.slice(U)+O,q=`
98
98
  `;else if(N.length>U||O[0]==="\t"){if(q===" ")q=`
99
99
  `;else if(!K&&q===`
100
100
  `)q=`
@@ -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 M=Q+X.length+Z.source.length;return{value:H,type:J,comment:X.comment,range:[Q,M,M]}}function VI({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 q=1;q<X.length;++q){let K=X[q];if(!W&&(K==="-"||K==="+"))W=K;else{let M=Number(K);if(!Y&&M)Y=M;else if(U===-1)U=$+q}}if(U!==-1)Q(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",H=X.length;for(let q=1;q<Z.length;++q){let K=Z[q];switch(K.type){case"space":G=!0;case"newline":H+=K.source.length;break;case"comment":if(z&&!G)Q(K,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=K.source.length,V=K.source.substring(1);break;case"error":Q(K,"UNEXPECTED_TOKEN",K.message),H+=K.source.length;break;default:{let M=`Unexpected token in block scalar header: ${K.type}`;Q(K,"UNEXPECTED_TOKEN",M);let B=K.source;if(B&&typeof B==="string")H+=B.length}}}return{mode:J,indent:Y,chomp:W,comment:V,length:H}}function HI($){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}qI.resolveBlockScalar=GI});var G9=P((AI)=>{var U9=L0(),BI=C$();function MI($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,W,U,G=(q,K,M)=>z(Q+q,K,M);switch(X){case"scalar":W=U9.Scalar.PLAIN,U=LI(J,G);break;case"single-quoted-scalar":W=U9.Scalar.QUOTE_SINGLE,U=NI(J,G);break;case"double-quoted-scalar":W=U9.Scalar.QUOTE_DOUBLE,U=DI(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=BI.resolveEnd(Y,V,Z,z);return{value:U,type:W,comment:H.comment,range:[Q,V,H.offset]}}function LI($,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 rJ($)}function NI($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return rJ($.slice(1,-1)).replace(/''/g,"'")}function rJ($){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 NI({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 q=1;q<X.length;++q){let K=X[q];if(!W&&(K==="-"||K==="+"))W=K;else{let L=Number(K);if(!Y&&L)Y=L;else if(U===-1)U=$+q}}if(U!==-1)Q(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",H=X.length;for(let q=1;q<Z.length;++q){let K=Z[q];switch(K.type){case"space":G=!0;case"newline":H+=K.source.length;break;case"comment":if(z&&!G)Q(K,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=K.source.length,V=K.source.substring(1);break;case"error":Q(K,"UNEXPECTED_TOKEN",K.message),H+=K.source.length;break;default:{let L=`Unexpected token in block scalar header: ${K.type}`;Q(K,"UNEXPECTED_TOKEN",L);let B=K.source;if(B&&typeof B==="string")H+=B.length}}}return{mode:J,indent:Y,chomp:W,comment:V,length:H}}function DI($){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}OI.resolveBlockScalar=LI});var q9=P((jI)=>{var H9=L0(),TI=C$();function AI($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,W,U,G=(q,K,L)=>z(Q+q,K,L);switch(X){case"scalar":W=H9.Scalar.PLAIN,U=CI(J,G);break;case"single-quoted-scalar":W=H9.Scalar.QUOTE_SINGLE,U=_I(J,G);break;case"double-quoted-scalar":W=H9.Scalar.QUOTE_DOUBLE,U=RI(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=TI.resolveEnd(Y,V,Z,z);return{value:U,type:W,comment:H.comment,range:[Q,V,H.offset]}}function CI($,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 aJ($)}function _I($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return aJ($.slice(1,-1)).replace(/''/g,"'")}function aJ($){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 DI($,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 RI($,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}=OI($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=II[J];if(Y)z+=Y;else if(J===`
116
+ `){let{fold:J,offset:Y}=PI($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=FI[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+=TI($,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+=SI($,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 OI($,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 PI($,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 II={"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 TI($,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}}AI.resolveFlowScalar=MI});var oJ=P((jI)=>{var v6=t(),sJ=L0(),_I=W9(),RI=G9();function PI($,Z,z,Q){let{value:X,type:J,comment:Y,range:W}=Z.type==="block-scalar"?_I.resolveBlockScalar($,Z,Q):RI.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[v6.SCALAR];else if(U)G=FI($.schema,X,U,z,Q);else if(Z.type==="scalar")G=SI($,X,Z,Q);else G=$.schema[v6.SCALAR];let V;try{let H=G.resolve(X,(q)=>Q(z??Z,"TAG_RESOLVE_FAILED",q),$.options);V=v6.isScalar(H)?H:new sJ.Scalar(H)}catch(H){let q=H instanceof Error?H.message:String(H);Q(z??Z,"TAG_RESOLVE_FAILED",q),V=new sJ.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 FI($,Z,z,Q,X){if(z==="!")return $[v6.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"),$[v6.SCALAR]}function SI({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[v6.SCALAR];if(z.compat){let W=z.compat.find((U)=>U.default&&U.test?.test(Q))??z[v6.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}jI.composeScalar=PI});var aJ=P((xI)=>{function wI($,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 $}xI.emptyScalarPosition=wI});var $Y=P((mI)=>{var kI=R1(),bI=t(),vI=nJ(),tJ=oJ(),gI=C$(),hI=aJ(),fI={composeNode:eJ,composeEmptyNode:V9};function eJ($,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=uI($,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=tJ.composeScalar($,Z,U,Q),W)G.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=vI.composeCollection(fI,$,Z,z,Q),W)G.anchor=W.source.substring(1)}catch(H){let q=H instanceof Error?H.message:String(H);Q(Z,"RESOURCE_EXHAUSTION",q)}break;default:{let H=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",H),V=!1}}if(G??(G=V9($,Z.offset,void 0,null,z,Q)),W&&G.anchor==="")Q(W,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!bI.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 V9($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:W,end:U},G){let V={type:"scalar",offset:hI.emptyScalarPosition(Z,z,Q),indent:-1,source:""},H=tJ.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 uI({options:$},{offset:Z,source:z,end:Q},X){let J=new kI.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=gI.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,W.offset],W.comment)J.comment=W.comment;return J}mI.composeEmptyNode=V9;mI.composeNode=eJ});var zY=P((rI)=>{var lI=f1(),ZY=$Y(),dI=C$(),iI=m1();function nI($,Z,{offset:z,start:Q,value:X,end:J},Y){let W=Object.assign({_directives:Z},$),U=new lI.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},V=iI.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?ZY.composeNode(G,X,V,Y):ZY.composeEmptyNode(G,V.end,Q,null,V,Y);let H=U.contents.range[2],q=dI.resolveEnd(J,H,!1,Y);if(q.comment)U.comment=q.comment;return U.range=[z,H,q.offset],U}rI.composeDoc=nI});var H9=P((ZT)=>{var oI=n0("process"),aI=M7(),tI=f1(),c1=u1(),QY=t(),eI=zY(),$T=C$();function p1($){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 XY($){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 FI={"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 SI($,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}}jI.resolveFlowScalar=AI});var eJ=P((vI)=>{var v6=t(),tJ=L0(),wI=V9(),xI=q9();function yI($,Z,z,Q){let{value:X,type:J,comment:Y,range:W}=Z.type==="block-scalar"?wI.resolveBlockScalar($,Z,Q):xI.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[v6.SCALAR];else if(U)G=kI($.schema,X,U,z,Q);else if(Z.type==="scalar")G=bI($,X,Z,Q);else G=$.schema[v6.SCALAR];let V;try{let H=G.resolve(X,(q)=>Q(z??Z,"TAG_RESOLVE_FAILED",q),$.options);V=v6.isScalar(H)?H:new tJ.Scalar(H)}catch(H){let q=H instanceof Error?H.message:String(H);Q(z??Z,"TAG_RESOLVE_FAILED",q),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 kI($,Z,z,Q,X){if(z==="!")return $[v6.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"),$[v6.SCALAR]}function bI({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[v6.SCALAR];if(z.compat){let W=z.compat.find((U)=>U.default&&U.test?.test(Q))??z[v6.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}vI.composeScalar=yI});var $Y=P((fI)=>{function hI($,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 $}fI.emptyScalarPosition=hI});var QY=P((rI)=>{var mI=R1(),cI=t(),pI=oJ(),ZY=eJ(),lI=C$(),dI=$Y(),iI={composeNode:zY,composeEmptyNode:K9};function zY($,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=nI($,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=ZY.composeScalar($,Z,U,Q),W)G.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=pI.composeCollection(iI,$,Z,z,Q),W)G.anchor=W.source.substring(1)}catch(H){let q=H instanceof Error?H.message:String(H);Q(Z,"RESOURCE_EXHAUSTION",q)}break;default:{let H=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",H),V=!1}}if(G??(G=K9($,Z.offset,void 0,null,z,Q)),W&&G.anchor==="")Q(W,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!cI.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 K9($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:W,end:U},G){let V={type:"scalar",offset:dI.emptyScalarPosition(Z,z,Q),indent:-1,source:""},H=ZY.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 nI({options:$},{offset:Z,source:z,end:Q},X){let J=new mI.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=lI.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,W.offset],W.comment)J.comment=W.comment;return J}rI.composeEmptyNode=K9;rI.composeNode=zY});var JY=P((ZT)=>{var aI=f1(),XY=QY(),tI=C$(),eI=m1();function $T($,Z,{offset:z,start:Q,value:X,end:J},Y){let W=Object.assign({_directives:Z},$),U=new aI.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},V=eI.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?XY.composeNode(G,X,V,Y):XY.composeEmptyNode(G,V.end,Q,null,V,Y);let H=U.contents.range[2],q=tI.resolveEnd(J,H,!1,Y);if(q.comment)U.comment=q.comment;return U.range=[z,H,q.offset],U}ZT.composeDoc=$T});var B9=P((UT)=>{var QT=c0("process"),XT=D7(),JT=f1(),c1=u1(),YY=t(),YT=JY(),WT=C$();function p1($){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 WY($){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 JY{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=p1(Z);if(X)this.warnings.push(new c1.YAMLWarning(J,z,Q));else this.errors.push(new c1.YAMLParseError(J,z,Q))},this.directives=new aI.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=XY(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(QY.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(QY.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 UY{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=p1(Z);if(X)this.warnings.push(new c1.YAMLWarning(J,z,Q));else this.errors.push(new c1.YAMLParseError(J,z,Q))},this.directives=new XT.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=WY(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(YY.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(YY.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:XY(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(oI.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=p1($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=eI.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 c1.YAMLParseError(p1($),"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 c1.YAMLParseError(p1($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=$T.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 c1.YAMLParseError(p1($),"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 tI.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}}}ZT.Composer=JY});var UY=P((VT)=>{var QT=W9(),XT=G9(),JT=u1(),YY=j1();function YT($,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 JT.YAMLParseError([W,W+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return XT.resolveFlowScalar($,Z,Q);case"block-scalar":return QT.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function WT($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,W=YY.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:WY(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(QT.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=p1($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=YT.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 c1.YAMLParseError(p1($),"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 c1.YAMLParseError(p1($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=WT.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 c1.YAMLParseError(p1($),"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 JT.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}}}UT.Composer=UY});var HY=P((NT)=>{var VT=V9(),HT=q9(),qT=u1(),GY=j1();function KT($,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 qT.YAMLParseError([W,W+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return HT.resolveFlowScalar($,Z,Q);case"block-scalar":return VT.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function BT($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,W=GY.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
- `,q=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!WY(q,U))q.push({type:"newline",offset:-1,indent:Q,source:`
136
- `});return{type:"block-scalar",offset:J,indent:Q,props:q,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 UT($,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=YY.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">":GT($,U);break;case'"':q9($,U,"double-quoted-scalar");break;case"'":q9($,U,"single-quoted-scalar");break;default:q9($,U,"scalar")}}function GT($,Z){let z=Z.indexOf(`
135
+ `,q=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!VY(q,U))q.push({type:"newline",offset:-1,indent:Q,source:`
136
+ `});return{type:"block-scalar",offset:J,indent:Q,props:q,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 MT($,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=GY.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">":LT($,U);break;case'"':M9($,U,"double-quoted-scalar");break;case"'":M9($,U,"single-quoted-scalar");break;default:M9($,U,"scalar")}}function LT($,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(!WY(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 WY($,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 q9($,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})}}}VT.createScalarToken=WT;VT.resolveAsScalar=YT;VT.setScalarValue=UT});var GY=P((MT)=>{var BT=($)=>("type"in $)?q5($):H5($);function q5($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=q5(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=H5(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=H5(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=H5($);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 H5({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=q5(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=q5(Q);return X}MT.stringify=BT});var qY=P((DT)=>{var K9=Symbol("break visit"),NT=Symbol("skip children"),VY=Symbol("remove item");function g6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};HY(Object.freeze([]),$,Z)}g6.BREAK=K9;g6.SKIP=NT;g6.REMOVE=VY;g6.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};g6.parentCollection=($,Z)=>{let z=g6.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 HY($,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=HY(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof W==="number")Y=W-1;else if(W===K9)return K9;else if(W===VY)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}DT.visit=g6});var K5=P((PT)=>{var B9=UY(),IT=GY(),TT=qY(),M9="\uFEFF",L9="\x02",N9="\x18",D9="\x1F",AT=($)=>!!$&&("items"in $),CT=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function _T($){switch($){case M9:return"<BOM>";case L9:return"<DOC>";case N9:return"<FLOW_END>";case D9:return"<SCALAR>";default:return JSON.stringify($)}}function RT($){switch($){case M9:return"byte-order-mark";case L9:return"doc-mode";case N9:return"flow-error-end";case D9: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(!VY(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 VY($,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 M9($,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})}}}NT.createScalarToken=BT;NT.resolveAsScalar=KT;NT.setScalarValue=MT});var qY=P((AT)=>{var TT=($)=>("type"in $)?B5($):K5($);function B5($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=B5(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=K5(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=K5(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=K5($);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 K5({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=B5(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=B5(Q);return X}AT.stringify=TT});var MY=P((RT)=>{var L9=Symbol("break visit"),_T=Symbol("skip children"),KY=Symbol("remove item");function g6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};BY(Object.freeze([]),$,Z)}g6.BREAK=L9;g6.SKIP=_T;g6.REMOVE=KY;g6.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};g6.parentCollection=($,Z)=>{let z=g6.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 BY($,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=BY(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof W==="number")Y=W-1;else if(W===L9)return L9;else if(W===KY)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}RT.visit=g6});var M5=P((yT)=>{var N9=HY(),FT=qY(),ST=MY(),D9="\uFEFF",O9="\x02",I9="\x18",T9="\x1F",jT=($)=>!!$&&("items"in $),ET=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function wT($){switch($){case D9:return"<BOM>";case O9:return"<DOC>";case I9:return"<FLOW_END>";case T9:return"<SCALAR>";default:return JSON.stringify($)}}function xT($){switch($){case D9:return"byte-order-mark";case O9:return"doc-mode";case I9:return"flow-error-end";case T9: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}PT.createScalarToken=B9.createScalarToken;PT.resolveAsScalar=B9.resolveAsScalar;PT.setScalarValue=B9.setScalarValue;PT.stringify=IT.stringify;PT.visit=TT.visit;PT.BOM=M9;PT.DOCUMENT=L9;PT.FLOW_END=N9;PT.SCALAR=D9;PT.isCollection=AT;PT.isScalar=CT;PT.prettyToken=_T;PT.tokenType=RT});var I9=P((cT)=>{var l1=K5();function N2($){switch($){case void 0:case" ":case`
143
- `:case"\r":case"\t":return!0;default:return!1}}var KY=new Set("0123456789ABCDEFabcdef"),uT=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),B5=new Set(",[]{}"),mT=new Set(` ,[]{}
144
- \r `),O9=($)=>!$||mT.has($);class BY{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}yT.createScalarToken=N9.createScalarToken;yT.resolveAsScalar=N9.resolveAsScalar;yT.setScalarValue=N9.setScalarValue;yT.stringify=FT.stringify;yT.visit=ST.visit;yT.BOM=D9;yT.DOCUMENT=O9;yT.FLOW_END=I9;yT.SCALAR=T9;yT.isCollection=jT;yT.isScalar=ET;yT.prettyToken=wT;yT.tokenType=xT});var C9=P((sT)=>{var l1=M5();function N2($){switch($){case void 0:case" ":case`
143
+ `:case"\r":case"\t":return!0;default:return!1}}var LY=new Set("0123456789ABCDEFabcdef"),nT=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),L5=new Set(",[]{}"),rT=new Set(` ,[]{}
144
+ \r `),A9=($)=>!$||rT.has($);class NY{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
148
  `||z>=this.indentNext||!Z&&!this.atEnd?$+z:-1}if(Z==="-"||Z==="."){let z=this.buffer.substr($,3);if((z==="---"||z==="...")&&N2(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]===l1.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 l1.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==="...")&&N2(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&&!N2(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(($==="-"||$==="?"||$===":")&&N2(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(O9),"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("..."))&&N2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield l1.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(O9),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||N2(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(`
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]===l1.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 l1.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==="...")&&N2(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&&!N2(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(($==="-"||$==="?"||$===":")&&N2(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(A9),"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("..."))&&N2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield l1.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(A9),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||N2(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
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)=>N2(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 l1.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(N2(X)||$&&B5.has(X))break;Z=z}else if(N2(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 l1.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(N2(X)||$&&L5.has(X))break;Z=z}else if(N2(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==="#"||$&&B5.has(X))break;if(Q===`
159
- `){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&B5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield l1.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(O9),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(N2(z)||Z&&B5.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(!N2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(uT.has(Z))Z=this.buffer[++$];else if(Z==="%"&&KY.has(this.buffer[$+1])&&KY.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==="#"||$&&L5.has(X))break;if(Q===`
159
+ `){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&L5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield l1.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(A9),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(N2(z)||Z&&L5.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(!N2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(nT.has(Z))Z=this.buffer[++$];else if(Z==="%"&&LY.has(this.buffer[$+1])&&LY.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)}}cT.Lexer=BY});var T9=P((lT)=>{class MY{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}}}}lT.LineCounter=MY});var A9=P((rT)=>{var iT=n0("process"),LY=K5(),nT=I9();function G6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function NY($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function OY($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function M5($){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 _$($){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 L5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function DY($){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,OY(Z.value))if(Z.value.end)L5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else L5(Z.start,Z.sep);delete Z.sep}}}class IY{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 nT.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=$,iT.env.LOG_TOKENS)console.log("|",LY.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=LY.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")DY(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&&NY(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(NY($.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=M5(this.peek(2)),z=_$(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)}}sT.Lexer=NY});var _9=P((aT)=>{class DY{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}}}}aT.LineCounter=DY});var R9=P((ZA)=>{var eT=c0("process"),OY=M5(),$A=C9();function U6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function IY($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function AY($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function N5($){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 _$($){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 D5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function TY($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!U6(Z.start,"explicit-key-ind")&&!U6(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,AY(Z.value))if(Z.value.end)D5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else D5(Z.start,Z.sep);delete Z.sep}}}class CY{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 $A.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=$,eT.env.LOG_TOKENS)console.log("|",OY.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=OY.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")TY(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&&IY(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(IY($.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=N5(this.peek(2)),z=_$(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)){L5(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=_$(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(OY(Z.key)&&!G6(Z.sep,"newline")){let J=_$(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)){L5(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=M5(z),X=_$(Q);DY($);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)){D5(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(U6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=_$(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(U6(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(AY(Z.key)&&!U6(Z.sep,"newline")){let J=_$(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(U6(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&&!U6(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)){D5(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||U6(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=N5(z),X=_$(Q);TY($);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=M5($),z=_$(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=M5($),z=_$(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()}}}rT.Parser=IY});var RY=P((QA)=>{var TY=H9(),oT=f1(),d1=u1(),aT=T7(),tT=t(),eT=T9(),AY=A9();function CY($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new eT.LineCounter||null,prettyErrors:Z}}function $A($,Z={}){let{lineCounter:z,prettyErrors:Q}=CY(Z),X=new AY.Parser(z?.addNewLine),J=new TY.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let W of Y)W.errors.forEach(d1.prettifyError($,z)),W.warnings.forEach(d1.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function _Y($,Z={}){let{lineCounter:z,prettyErrors:Q}=CY(Z),X=new AY.Parser(z?.addNewLine),J=new TY.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 d1.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(d1.prettifyError($,z)),Y.warnings.forEach(d1.prettifyError($,z));return Y}function ZA($,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=_Y($,z);if(!X)return null;if(X.warnings.forEach((J)=>aT.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 zA($,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(tT.isDocument($)&&!Q)return $.toString(z);return new oT.Document($,Q,z).toString(z)}QA.parse=ZA;QA.parseAllDocuments=$A;QA.parseDocument=_Y;QA.stringify=zA});var CW={};eQ(CW,{plainOnStderr:()=>n9,orange:()=>R0,italic:()=>tC,fafCyanDeep:()=>v5,fafCyan:()=>A,dim:()=>L,colorOn:()=>i9,bold:()=>C,FAF_HEX:()=>J8});function i9($=process.stdout){let Z=process.env.FORCE_COLOR;if(Z!==void 0)return Z!=="0"&&Z!=="false";if(process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!=="")return!1;return Boolean($.isTTY)}function n9($){return i9(process.stderr)?$:$.replace(aC,"")}var aC,b5=($,Z)=>i9()?`\x1B[${$}m${Z}\x1B[0m`:Z,r9=($)=>(Z)=>b5($,Z),C,L,tC,J8,A=($)=>b5("38;2;0;212;212",$),v5=($)=>b5("38;2;14;140;140",$),R0=($)=>b5("38;5;208",$);var l=g(()=>{aC=new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`,"g");C=r9("1"),L=r9("2"),tC=r9("3"),J8={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var Dz=P((Sd,Xx)=>{Xx.exports={name:"faf-cli",version:"8.8.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.9",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 o2=()=>{};var Rz=function(){let{crypto:$}=globalThis;if($?.randomUUID)return Rz=$.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 b8=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var k,D0,w0,A6,o$,a$,t$,e$,$1,Z1,z1,Q1,X1;var d0=g(()=>{k=class k extends Error{};D0=class D0 extends k{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 A6({message:z,cause:b8(Z)});let X=Z,J=X?.error?.type;if($===400)return new a$($,X,z,Q,J);if($===401)return new t$($,X,z,Q,J);if($===403)return new e$($,X,z,Q,J);if($===404)return new $1($,X,z,Q,J);if($===409)return new Z1($,X,z,Q,J);if($===422)return new z1($,X,z,Q,J);if($===429)return new Q1($,X,z,Q,J);if($>=500)return new X1($,X,z,Q,J);return new D0($,X,z,Q,J)}};w0=class w0 extends D0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};A6=class A6 extends D0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};o$=class o$ extends A6{constructor({message:$}={}){super({message:$??"Request timed out."})}};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{};X1=class X1 extends D0{}});function jZ($){if(typeof $!=="object")return{};return $??{}}function Sz($){if(!$)return!0;for(let Z in $)return!1;return!0}function _H($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var Sy,CH=($)=>{return Sy.test($)},Pz=($)=>(Pz=Array.isArray,Pz($)),Fz,RH=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new k(`${$} must be an integer`);if(Z<0)throw new k(`${$} must be a positive integer`);return Z},EZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var J$=g(()=>{d0();Sy=/^[a-z][a-z0-9+.-]*:/i,Fz=Pz});var PH=($)=>new Promise((Z)=>setTimeout(Z,$));var C6="0.91.1";function jy(){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 wy(){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 EH=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},Ey=()=>{let $=jy();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":C6,"X-Stainless-OS":SH(Deno.build.os),"X-Stainless-Arch":FH(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":C6,"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":C6,"X-Stainless-OS":SH(globalThis.process.platform??"unknown"),"X-Stainless-Arch":FH(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=wy();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":C6,"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":C6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},FH=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},SH=($)=>{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"},jH,wH=()=>{return jH??(jH=Ey())};var jz=()=>{};function xH(){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 Ez(...$){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 wZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return Ez({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 v8($){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 yH($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var kH=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function bH($){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 k(`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 vH=g(()=>{d0()});function fH($){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 g8($){let Z;return(gH??(Z=new globalThis.TextEncoder,gH=Z.encode.bind(Z)))($)}function wz($){let Z;return(hH??(Z=new globalThis.TextDecoder,hH=Z.decode.bind(Z)))($)}var gH,hH;class _6{constructor(){e0.set(this,void 0),$2.set(this,void 0),F(this,e0,new Uint8Array,"f"),F(this,$2,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?g8($):$;F(this,e0,fH([D(this,e0,"f"),Z]),"f");let z=[],Q;while((Q=ky(D(this,e0,"f"),D(this,$2,"f")))!=null){if(Q.carriage&&D(this,$2,"f")==null){F(this,$2,Q.index,"f");continue}if(D(this,$2,"f")!=null&&(Q.index!==D(this,$2,"f")+1||Q.carriage)){z.push(wz(D(this,e0,"f").subarray(0,D(this,$2,"f")-1))),F(this,e0,D(this,e0,"f").subarray(D(this,$2,"f")),"f"),F(this,$2,null,"f");continue}let X=D(this,$2,"f")!==null?Q.preceding-1:Q.preceding,J=wz(D(this,e0,"f").subarray(0,X));z.push(J),F(this,e0,D(this,e0,"f").subarray(Q.index),"f"),F(this,$2,null,"f")}return z}flush(){if(!D(this,e0,"f").length)return[];return this.decode(`
166
- `)}}function ky($,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 uH($){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 e0,$2;var xz=g(()=>{o2();e0=new WeakMap,$2=new WeakMap;_6.NEWLINE_CHARS=new Set([`
167
- `,"\r"]);_6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function h8(){}function xZ($,Z,z){if(!Z||yZ[$]>yZ[z])return h8;else return Z[$].bind(Z)}function F0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return by;let Q=mH.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:xZ("error",Z,z),warn:xZ("warn",Z,z),info:xZ("info",Z,z),debug:xZ("debug",Z,z)};return mH.set(Z,[z,X]),X}var yZ,yz=($,Z,z)=>{if(!$)return;if(_H(yZ,$))return $;F0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(yZ))}`);return},by,mH,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 kZ=g(()=>{J$();yZ={off:0,error:200,warn:300,info:400,debug:500};by={error:h8,warn:h8,info:h8,debug:h8},mH=new WeakMap});async function*vy($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}let z=new cH,Q=new _6,X=v8($.body);for await(let J of gy(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*gy($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?g8(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=uH(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class cH{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]=hy($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function hy($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var f8,Z2;var kz=g(()=>{o2();d0();xz();J$();kZ();d0();Z2=class Z2{constructor($,Z,z){this.iterator=$,f8.set(this,void 0),this.controller=Z,F(this,f8,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?F0(z):console;async function*J(){if(Q)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of vy($,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=EZ(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 Z2(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new _6,W=v8($);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 k("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 Z2(J,Z,z)}[(f8=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 Z2(()=>Q($),this.controller,D(this,f8,"f")),new Z2(()=>Q(Z),this.controller,D(this,f8,"f"))]}toReadableStream(){let $=this,Z;return Ez({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=g8(JSON.stringify(Q)+`
169
- `);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function bZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(F0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return Z2.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 q=await z.json();return bz(q,z)}return await z.text()})();return F0($).debug(`[${Q}] response parsed`,t2({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function bz($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var vz=g(()=>{kz();kZ()});var u8,R6;var vZ=g(()=>{o2();vz();R6=class R6 extends Promise{constructor($,Z,z=bZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,u8.set(this,void 0),F(this,u8,$,"f")}_thenUnwrap($){return new R6(D(this,u8,"f"),this.responsePromise,async(Z,z)=>bz($(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,u8,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};u8=new WeakMap});var gZ,gz,m8,S2,Q0;var q0=g(()=>{o2();d0();vz();vZ();J$();gz=class gz{constructor($,Z,z,Q){gZ.set(this,void 0),F(this,gZ,$,"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 k("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await D(this,gZ,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(gZ=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};m8=class m8 extends R6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await bZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};S2=class S2 extends gz{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:{...jZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...jZ(this.options.query),after_id:$}}}};Q0=class Q0 extends gz{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:{...jZ(this.options.query),page:$}}}}});function Y$($,Z,z){return fz(),new File($,Z??"unknown_file",z)}function c8($,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 uy($){let Z=typeof $==="function"?$:$.fetch,z=pH.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 pH.set(Z,Q),Q}var fz=()=>{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`.":""))}},uz=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",J1=async($,Z,z=!0)=>{return{...$,body:await my($.body,Z,z)}},pH,my=async($,Z,z=!0)=>{if(!await uy(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},cy=($)=>$ 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,Y$([await z.blob()],c8(z,Q),X))}else if(uz(z))$.append(Z,Y$([await new Response(wZ(z)).blob()],c8(z,Q)));else if(cy(z))$.append(Z,Y$([z],c8(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 Y1=g(()=>{pH=new WeakMap});async function p8($,Z,z){if(fz(),$=await $,Z||(Z=c8($,!0)),py($)){if($ instanceof File&&Z==null&&z==null)return $;return Y$([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(ly($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),Y$(await mz(X),Z,z)}let Q=await mz($);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 Y$(Q,Z,z)}async function mz($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(lH($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(uz($))for await(let z of $)Z.push(...await mz(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${dy($)}`)}return Z}function dy($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var lH=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",py=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&lH($),ly=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var dH=g(()=>{Y1();Y1()});var cz=g(()=>{dH()});var iH=()=>{};class c{constructor($){this._client=$}}function*ny($){if(!$)return;if(nH 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(Fz($))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=Fz(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 nH,T=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of ny(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{[nH]:!0,values:Z,nulls:z}};var W0=g(()=>{J$();nH=Symbol.for("brand.privateNullableHeaders")});function sH($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var rH,ry=($=sH)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,H,q)=>{if(/[?#]/.test(H))X=!0;let K=Q[q],M=(X?encodeURIComponent:$)(""+K);if(q!==Q.length&&(K==null||typeof K==="object"&&K.toString===Object.getPrototypeOf(Object.getPrototypeOf(K.hasOwnProperty??rH)??rH)?.toString))M=K+"",J.push({start:V.length+H.length,length:M.length,error:`Value of type ${Object.prototype.toString.call(K).slice(8,-1)} is not a valid path parameter`});return V+H+(q===Q.length?"":M)},""),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((q,K)=>{let M=" ".repeat(K.start-V),B="^".repeat(K.length);return V=K.start+K.length,q+M+B},"");throw new k(`Path parameters result in path with invalid segments:
165
+ `,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=N5($),z=_$(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=N5($),z=_$(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()}}}ZA.Parser=CY});var SY=P((VA)=>{var _Y=B9(),QA=f1(),d1=u1(),XA=_7(),JA=t(),YA=_9(),RY=R9();function PY($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new YA.LineCounter||null,prettyErrors:Z}}function WA($,Z={}){let{lineCounter:z,prettyErrors:Q}=PY(Z),X=new RY.Parser(z?.addNewLine),J=new _Y.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let W of Y)W.errors.forEach(d1.prettifyError($,z)),W.warnings.forEach(d1.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function FY($,Z={}){let{lineCounter:z,prettyErrors:Q}=PY(Z),X=new RY.Parser(z?.addNewLine),J=new _Y.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 d1.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(d1.prettifyError($,z)),Y.warnings.forEach(d1.prettifyError($,z));return Y}function UA($,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=FY($,z);if(!X)return null;if(X.warnings.forEach((J)=>XA.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 GA($,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(JA.isDocument($)&&!Q)return $.toString(z);return new QA.Document($,Q,z).toString(z)}VA.parse=UA;VA.parseAllDocuments=WA;VA.parseDocument=FY;VA.stringify=GA});var PW={};zX(PW,{plainOnStderr:()=>o9,orange:()=>R0,italic:()=>J_,fafCyanDeep:()=>h5,fafCyan:()=>A,dim:()=>M,colorOn:()=>s9,bold:()=>C,FAF_HEX:()=>J4});function s9($=process.stdout){let Z=process.env.FORCE_COLOR;if(Z!==void 0)return Z!=="0"&&Z!=="false";if(process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!=="")return!1;return Boolean($.isTTY)}function o9($){return s9(process.stderr)?$:$.replace(X_,"")}var X_,g5=($,Z)=>s9()?`\x1B[${$}m${Z}\x1B[0m`:Z,a9=($)=>(Z)=>g5($,Z),C,M,J_,J4,A=($)=>g5("38;2;0;212;212",$),h5=($)=>g5("38;2;14;140;140",$),R0=($)=>g5("38;5;208",$);var l=g(()=>{X_=new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`,"g");C=a9("1"),M=a9("2"),J_=a9("3"),J4={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var Iz=P((id,Dx)=>{Dx.exports={name:"faf-cli",version:"8.9.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 && node scripts/strip-sources-content.mjs",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"},devDependencies:{"@anthropic-ai/sdk":"^0.91.1","@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.9",picomatch:"^4.0.5","@typescript-eslint/typescript-estree":{minimatch:"^11.0.1"}},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 s2=()=>{};var Sz=function(){let{crypto:$}=globalThis;if($?.randomUUID)return Sz=$.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 o2($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var g4=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var k,D0,w0,A6,o$,a$,t$,e$,$1,Z1,z1,Q1,X1;var i0=g(()=>{k=class k extends Error{};D0=class D0 extends k{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 A6({message:z,cause:g4(Z)});let X=Z,J=X?.error?.type;if($===400)return new a$($,X,z,Q,J);if($===401)return new t$($,X,z,Q,J);if($===403)return new e$($,X,z,Q,J);if($===404)return new $1($,X,z,Q,J);if($===409)return new Z1($,X,z,Q,J);if($===422)return new z1($,X,z,Q,J);if($===429)return new Q1($,X,z,Q,J);if($>=500)return new X1($,X,z,Q,J);return new D0($,X,z,Q,J)}};w0=class w0 extends D0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};A6=class A6 extends D0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};o$=class o$ extends A6{constructor({message:$}={}){super({message:$??"Request timed out."})}};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{};X1=class X1 extends D0{}});function wZ($){if(typeof $!=="object")return{};return $??{}}function wz($){if(!$)return!0;for(let Z in $)return!1;return!0}function wH($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var py,EH=($)=>{return py.test($)},jz=($)=>(jz=Array.isArray,jz($)),Ez,xH=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new k(`${$} must be an integer`);if(Z<0)throw new k(`${$} must be a positive integer`);return Z},xZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var J$=g(()=>{i0();py=/^[a-z][a-z0-9+.-]*:/i,Ez=jz});var yH=($)=>new Promise((Z)=>setTimeout(Z,$));var C6="0.91.1";function ly(){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 iy(){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 gH=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},dy=()=>{let $=ly();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":C6,"X-Stainless-OS":bH(Deno.build.os),"X-Stainless-Arch":kH(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":C6,"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":C6,"X-Stainless-OS":bH(globalThis.process.platform??"unknown"),"X-Stainless-Arch":kH(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=iy();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":C6,"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":C6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},kH=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},bH=($)=>{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"},vH,hH=()=>{return vH??(vH=dy())};var xz=()=>{};function fH(){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 yz(...$){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 yZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return yz({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 h4($){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 uH($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var mH=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function cH($){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 k(`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 pH=g(()=>{i0()});function iH($){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 f4($){let Z;return(lH??(Z=new globalThis.TextEncoder,lH=Z.encode.bind(Z)))($)}function kz($){let Z;return(dH??(Z=new globalThis.TextDecoder,dH=Z.decode.bind(Z)))($)}var lH,dH;class _6{constructor(){e0.set(this,void 0),$2.set(this,void 0),F(this,e0,new Uint8Array,"f"),F(this,$2,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?f4($):$;F(this,e0,iH([D(this,e0,"f"),Z]),"f");let z=[],Q;while((Q=sy(D(this,e0,"f"),D(this,$2,"f")))!=null){if(Q.carriage&&D(this,$2,"f")==null){F(this,$2,Q.index,"f");continue}if(D(this,$2,"f")!=null&&(Q.index!==D(this,$2,"f")+1||Q.carriage)){z.push(kz(D(this,e0,"f").subarray(0,D(this,$2,"f")-1))),F(this,e0,D(this,e0,"f").subarray(D(this,$2,"f")),"f"),F(this,$2,null,"f");continue}let X=D(this,$2,"f")!==null?Q.preceding-1:Q.preceding,J=kz(D(this,e0,"f").subarray(0,X));z.push(J),F(this,e0,D(this,e0,"f").subarray(Q.index),"f"),F(this,$2,null,"f")}return z}flush(){if(!D(this,e0,"f").length)return[];return this.decode(`
166
+ `)}}function sy($,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 nH($){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 e0,$2;var bz=g(()=>{s2();e0=new WeakMap,$2=new WeakMap;_6.NEWLINE_CHARS=new Set([`
167
+ `,"\r"]);_6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function u4(){}function kZ($,Z,z){if(!Z||bZ[$]>bZ[z])return u4;else return Z[$].bind(Z)}function F0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return oy;let Q=rH.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:kZ("error",Z,z),warn:kZ("warn",Z,z),info:kZ("info",Z,z),debug:kZ("debug",Z,z)};return rH.set(Z,[z,X]),X}var bZ,vz=($,Z,z)=>{if(!$)return;if(wH(bZ,$))return $;F0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(bZ))}`);return},oy,rH,a2=($)=>{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 vZ=g(()=>{J$();bZ={off:0,error:200,warn:300,info:400,debug:500};oy={error:u4,warn:u4,info:u4,debug:u4},rH=new WeakMap});async function*ay($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}let z=new sH,Q=new _6,X=h4($.body);for await(let J of ty(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*ty($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?f4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=nH(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class sH{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]=ey($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function ey($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var m4,Z2;var gz=g(()=>{s2();i0();bz();J$();vZ();i0();Z2=class Z2{constructor($,Z,z){this.iterator=$,m4.set(this,void 0),this.controller=Z,F(this,m4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?F0(z):console;async function*J(){if(Q)throw new k("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of ay($,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=xZ(W.data)??W.data,G=U?.error?.type;throw new D0(void 0,U,void 0,$.headers,G)}}Y=!0}catch(W){if(o2(W))return;throw W}finally{if(!Y)Z.abort()}}return new Z2(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new _6,W=h4($);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 k("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(o2(W))return;throw W}finally{if(!Y)Z.abort()}}return new Z2(J,Z,z)}[(m4=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 Z2(()=>Q($),this.controller,D(this,m4,"f")),new Z2(()=>Q(Z),this.controller,D(this,m4,"f"))]}toReadableStream(){let $=this,Z;return yz({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=f4(JSON.stringify(Q)+`
169
+ `);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function gZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(F0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return Z2.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 q=await z.json();return hz(q,z)}return await z.text()})();return F0($).debug(`[${Q}] response parsed`,a2({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function hz($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var fz=g(()=>{gz();vZ()});var c4,R6;var hZ=g(()=>{s2();fz();R6=class R6 extends Promise{constructor($,Z,z=gZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,c4.set(this,void 0),F(this,c4,$,"f")}_thenUnwrap($){return new R6(D(this,c4,"f"),this.responsePromise,async(Z,z)=>hz($(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,c4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};c4=new WeakMap});var fZ,uz,p4,S2,Q0;var q0=g(()=>{s2();i0();fz();hZ();J$();uz=class uz{constructor($,Z,z,Q){fZ.set(this,void 0),F(this,fZ,$,"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 k("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await D(this,fZ,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(fZ=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};p4=class p4 extends R6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await gZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};S2=class S2 extends uz{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:{...wZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...wZ(this.options.query),after_id:$}}}};Q0=class Q0 extends uz{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:{...wZ(this.options.query),page:$}}}}});function Y$($,Z,z){return cz(),new File($,Z??"unknown_file",z)}function l4($,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 Zk($){let Z=typeof $==="function"?$:$.fetch,z=oH.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 oH.set(Z,Q),Q}var cz=()=>{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`.":""))}},pz=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",J1=async($,Z,z=!0)=>{return{...$,body:await zk($.body,Z,z)}},oH,zk=async($,Z,z=!0)=>{if(!await Zk(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])=>mz(Q,X,J,z))),Q},Qk=($)=>$ instanceof Blob&&("name"in $),mz=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,Y$([await z.blob()],l4(z,Q),X))}else if(pz(z))$.append(Z,Y$([await new Response(yZ(z)).blob()],l4(z,Q)));else if(Qk(z))$.append(Z,Y$([z],l4(z,Q),{type:z.type}));else if(Array.isArray(z))await Promise.all(z.map((X)=>mz($,Z+"[]",X,Q)));else if(typeof z==="object")await Promise.all(Object.entries(z).map(([X,J])=>mz($,`${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 Y1=g(()=>{oH=new WeakMap});async function d4($,Z,z){if(cz(),$=await $,Z||(Z=l4($,!0)),Xk($)){if($ instanceof File&&Z==null&&z==null)return $;return Y$([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(Jk($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),Y$(await lz(X),Z,z)}let Q=await lz($);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 Y$(Q,Z,z)}async function lz($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(aH($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(pz($))for await(let z of $)Z.push(...await lz(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${Yk($)}`)}return Z}function Yk($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var aH=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",Xk=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&aH($),Jk=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var tH=g(()=>{Y1();Y1()});var dz=g(()=>{tH()});var eH=()=>{};class c{constructor($){this._client=$}}function*Uk($){if(!$)return;if($q 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(Ez($))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=Ez(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 $q,T=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of Uk(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{[$q]:!0,values:Z,nulls:z}};var W0=g(()=>{J$();$q=Symbol.for("brand.privateNullableHeaders")});function zq($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Zq,Gk=($=zq)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,H,q)=>{if(/[?#]/.test(H))X=!0;let K=Q[q],L=(X?encodeURIComponent:$)(""+K);if(q!==Q.length&&(K==null||typeof K==="object"&&K.toString===Object.getPrototypeOf(Object.getPrototypeOf(K.hasOwnProperty??Zq)??Zq)?.toString))L=K+"",J.push({start:V.length+H.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(K).slice(8,-1)} is not a valid path parameter`});return V+H+(q===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((q,K)=>{let L=" ".repeat(K.start-V),B="^".repeat(K.length);return V=K.start+K.length,q+L+B},"");throw new k(`Path parameters result in path with invalid segments:
170
170
  ${J.map((q)=>q.error).join(`
171
171
  `)}
172
172
  ${Y}
173
- ${H}`)}return Y},R;var O0=g(()=>{d0();rH=Object.freeze(Object.create(null)),R=ry(sH)});var l8;var pz=g(()=>{q0();W0();O0();l8=class l8 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function hZ($){return typeof $==="object"&&$!==null&&d8 in $}function lz($,Z){let z=new Set;if($){for(let Q of $)if(hZ(Q))z.add(Q[d8])}if(Z)for(let Q of Z){if(hZ(Q))z.add(Q[d8]);if(Array.isArray(Q.content)){for(let X of Q.content)if(hZ(X))z.add(X[d8])}}return Array.from(z)}function fZ($,Z){let z=lz($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function oH($){if(hZ($))return{"x-stainless-helper":$[d8]};return{}}var d8;var i8=g(()=>{d8=Symbol("anthropic.sdk.stainlessHelper")});var n8;var dz=g(()=>{q0();W0();i8();Y1();O0();n8=class n8 extends c{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",S2,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"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:T([{"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",J1({body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},oH(Q.file),Z?.headers])},this._client))}}});var r8;var iz=g(()=>{q0();W0();O0();r8=class r8 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}?beta=true`,{...z,headers:T([{...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",S2,{query:Q,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var s8;var nz=g(()=>{q0();W0();O0();s8=class s8 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var o8;var rz=g(()=>{q0();W0();O0();o8=class o8 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/agents/${$}/versions?beta=true`,Q0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var W1;var sz=g(()=>{rz();rz();q0();W0();O0();W1=class W1 extends c{constructor(){super(...arguments);this.versions=new o8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};W1.Versions=o8});var a8;var oz=g(()=>{q0();W0();O0();a8=class a8 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:T([{"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:T([{"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:T([{"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`,Q0,{query:X,...z,headers:T([{"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:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var t8;var az=g(()=>{q0();W0();O0();t8=class t8 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:T([{"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`,Q0,{query:X,...z,headers:T([{"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:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var W$;var tz=g(()=>{oz();oz();az();az();q0();W0();O0();W$=class W$ extends c{constructor(){super(...arguments);this.memories=new a8(this._client),this.memoryVersions=new t8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};W$.Memories=a8;W$.MemoryVersions=t8});var U1=g(()=>{d0()});var uZ;var ez=g(()=>{uZ={"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 aH($){return $?.output_format??$?.output_config?.format}function $Q($,Z,z){let Q=aH(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 ZQ($,Z,z)}function ZQ($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=Xk(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 Xk($,Z){let z=aH($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new k(`Failed to parse structured output: ${Q}`)}}var zQ=g(()=>{d0()});var Jk=($)=>{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},G1=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),G1($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),G1($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),G1($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),G1($);break;case"delimiter":return $=$.slice(0,$.length-1),G1($);break}return $},Yk=($)=>{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 $},Wk=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},mZ=($)=>JSON.parse(Wk(Yk(G1(Jk($)))));var QQ=()=>{};var XQ=g(()=>{kz()});function Zq($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function zq($){}var K2,P6,V1,e8,cZ,$4,Z4,pZ,z4,e2,Q4,lZ,dZ,U$,iZ,nZ,X4,JQ,tH,rZ,YQ,WQ,UQ,eH,$q="__json_buf",J4;var Qq=g(()=>{o2();QQ();U1();XQ();zQ();J4=class J4{constructor($,Z){K2.add(this),this.messages=[],this.receivedMessages=[],P6.set(this,void 0),V1.set(this,null),this.controller=new AbortController,e8.set(this,void 0),cZ.set(this,()=>{}),$4.set(this,()=>{}),Z4.set(this,void 0),pZ.set(this,()=>{}),z4.set(this,()=>{}),e2.set(this,{}),Q4.set(this,!1),lZ.set(this,!1),dZ.set(this,!1),U$.set(this,!1),iZ.set(this,void 0),nZ.set(this,void 0),X4.set(this,void 0),rZ.set(this,(z)=>{if(F(this,lZ,!0,"f"),a2(z))z=new w0;if(z instanceof w0)return F(this,dZ,!0,"f"),this._emit("abort",z);if(z instanceof k)return this._emit("error",z);if(z instanceof Error){let Q=new k(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new k(String(z)))}),F(this,e8,new Promise((z,Q)=>{F(this,cZ,z,"f"),F(this,$4,Q,"f")}),"f"),F(this,Z4,new Promise((z,Q)=>{F(this,pZ,z,"f"),F(this,z4,Q,"f")}),"f"),D(this,e8,"f").catch(()=>{}),D(this,Z4,"f").catch(()=>{}),F(this,V1,$,"f"),F(this,X4,Z?.logger??console,"f")}get response(){return D(this,iZ,"f")}get request_id(){return D(this,nZ,"f")}async withResponse(){F(this,U$,!0,"f");let $=await D(this,e8,"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 J4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new J4(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return F(X,V1,{...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,rZ,"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",YQ).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",WQ).call(this,W);if(Y.controller.signal?.aborted)throw new w0;D(this,K2,"m",UQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;F(this,iZ,$,"f"),F(this,nZ,$?.headers.get("request-id"),"f"),D(this,cZ,"f").call(this,$),this._emit("connect")}get ended(){return D(this,Q4,"f")}get errored(){return D(this,lZ,"f")}get aborted(){return D(this,dZ,"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,Z4,"f")}get currentMessage(){return D(this,P6,"f")}async finalMessage(){return await this.done(),D(this,K2,"m",JQ).call(this)}async finalText(){return await this.done(),D(this,K2,"m",tH).call(this)}_emit($,...Z){if(D(this,Q4,"f"))return;if($==="end")F(this,Q4,!0,"f"),D(this,pZ,"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,$4,"f").call(this,Q),D(this,z4,"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,$4,"f").call(this,Q),D(this,z4,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",D(this,K2,"m",JQ).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",YQ).call(this),this._connected(null);let X=Z2.fromReadableStream($,this.controller);for await(let J of X)D(this,K2,"m",WQ).call(this,J);if(X.controller.signal?.aborted)throw new w0;D(this,K2,"m",UQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(P6=new WeakMap,V1=new WeakMap,e8=new WeakMap,cZ=new WeakMap,$4=new WeakMap,Z4=new WeakMap,pZ=new WeakMap,z4=new WeakMap,e2=new WeakMap,Q4=new WeakMap,lZ=new WeakMap,dZ=new WeakMap,U$=new WeakMap,iZ=new WeakMap,nZ=new WeakMap,X4=new WeakMap,rZ=new WeakMap,K2=new WeakSet,JQ=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},tH=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},YQ=function(){if(this.ended)return;F(this,P6,void 0,"f")},WQ=function(Z){if(this.ended)return;let z=D(this,K2,"m",eH).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(Zq(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:zq(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage($Q(z,D(this,V1,"f"),{logger:D(this,X4,"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}},UQ=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=D(this,P6,"f");if(!Z)throw new k("request ended without sending any chunks");return F(this,P6,void 0,"f"),$Q(Z,D(this,V1,"f"),{logger:D(this,X4,"f")})},eH=function(Z){let z=D(this,P6,"f");if(Z.type==="message_start"){if(z)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new k(`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&&Zq(Q)){let X=Q[$q]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,$q,{value:X,enumerable:!1,writable:!0}),X)try{J.input=mZ(X)}catch(Y){let W=new k(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);D(this,rZ,"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:zq(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 Z2(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var H1;var sZ=g(()=>{H1=class H1 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 Xq=1e5,Jq=`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 O0=g(()=>{i0();Zq=Object.freeze(Object.create(null)),R=Gk(zq)});var i4;var iz=g(()=>{q0();W0();O0();i4=class i4 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function uZ($){return typeof $==="object"&&$!==null&&n4 in $}function nz($,Z){let z=new Set;if($){for(let Q of $)if(uZ(Q))z.add(Q[n4])}if(Z)for(let Q of Z){if(uZ(Q))z.add(Q[n4]);if(Array.isArray(Q.content)){for(let X of Q.content)if(uZ(X))z.add(X[n4])}}return Array.from(z)}function mZ($,Z){let z=nz($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function Qq($){if(uZ($))return{"x-stainless-helper":$[n4]};return{}}var n4;var r4=g(()=>{n4=Symbol("anthropic.sdk.stainlessHelper")});var s4;var rz=g(()=>{q0();W0();r4();Y1();O0();s4=class s4 extends c{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",S2,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"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:T([{"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",J1({body:Q,...Z,headers:T([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Qq(Q.file),Z?.headers])},this._client))}}});var o4;var sz=g(()=>{q0();W0();O0();o4=class o4 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}?beta=true`,{...z,headers:T([{...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",S2,{query:Q,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var a4;var oz=g(()=>{q0();W0();O0();a4=class a4 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var t4;var az=g(()=>{q0();W0();O0();t4=class t4 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/agents/${$}/versions?beta=true`,Q0,{query:X,...z,headers:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var W1;var tz=g(()=>{az();az();q0();W0();O0();W1=class W1 extends c{constructor(){super(...arguments);this.versions=new t4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};W1.Versions=t4});var e4;var ez=g(()=>{q0();W0();O0();e4=class e4 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:T([{"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:T([{"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:T([{"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`,Q0,{query:X,...z,headers:T([{"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:T([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var $8;var $Q=g(()=>{q0();W0();O0();$8=class $8 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:T([{"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`,Q0,{query:X,...z,headers:T([{"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:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var W$;var ZQ=g(()=>{ez();ez();$Q();$Q();q0();W0();O0();W$=class W$ extends c{constructor(){super(...arguments);this.memories=new e4(this._client),this.memoryVersions=new $8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};W$.Memories=e4;W$.MemoryVersions=$8});var U1=g(()=>{i0()});var cZ;var zQ=g(()=>{cZ={"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 Xq($){return $?.output_format??$?.output_config?.format}function QQ($,Z,z){let Q=Xq(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 XQ($,Z,z)}function XQ($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=Ok(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 Ok($,Z){let z=Xq($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new k(`Failed to parse structured output: ${Q}`)}}var JQ=g(()=>{i0()});var Ik=($)=>{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},G1=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),G1($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),G1($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),G1($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),G1($);break;case"delimiter":return $=$.slice(0,$.length-1),G1($);break}return $},Tk=($)=>{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 $},Ak=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},pZ=($)=>JSON.parse(Ak(Tk(G1(Ik($)))));var YQ=()=>{};var WQ=g(()=>{gz()});function Uq($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function Gq($){}var K2,P6,V1,Z8,lZ,z8,Q8,dZ,X8,t2,J8,iZ,nZ,U$,rZ,sZ,Y8,UQ,Jq,oZ,GQ,VQ,HQ,Yq,Wq="__json_buf",W8;var Vq=g(()=>{s2();YQ();U1();WQ();JQ();W8=class W8{constructor($,Z){K2.add(this),this.messages=[],this.receivedMessages=[],P6.set(this,void 0),V1.set(this,null),this.controller=new AbortController,Z8.set(this,void 0),lZ.set(this,()=>{}),z8.set(this,()=>{}),Q8.set(this,void 0),dZ.set(this,()=>{}),X8.set(this,()=>{}),t2.set(this,{}),J8.set(this,!1),iZ.set(this,!1),nZ.set(this,!1),U$.set(this,!1),rZ.set(this,void 0),sZ.set(this,void 0),Y8.set(this,void 0),oZ.set(this,(z)=>{if(F(this,iZ,!0,"f"),o2(z))z=new w0;if(z instanceof w0)return F(this,nZ,!0,"f"),this._emit("abort",z);if(z instanceof k)return this._emit("error",z);if(z instanceof Error){let Q=new k(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new k(String(z)))}),F(this,Z8,new Promise((z,Q)=>{F(this,lZ,z,"f"),F(this,z8,Q,"f")}),"f"),F(this,Q8,new Promise((z,Q)=>{F(this,dZ,z,"f"),F(this,X8,Q,"f")}),"f"),D(this,Z8,"f").catch(()=>{}),D(this,Q8,"f").catch(()=>{}),F(this,V1,$,"f"),F(this,Y8,Z?.logger??console,"f")}get response(){return D(this,rZ,"f")}get request_id(){return D(this,sZ,"f")}async withResponse(){F(this,U$,!0,"f");let $=await D(this,Z8,"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 W8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new W8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return F(X,V1,{...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,oZ,"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",GQ).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",VQ).call(this,W);if(Y.controller.signal?.aborted)throw new w0;D(this,K2,"m",HQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;F(this,rZ,$,"f"),F(this,sZ,$?.headers.get("request-id"),"f"),D(this,lZ,"f").call(this,$),this._emit("connect")}get ended(){return D(this,J8,"f")}get errored(){return D(this,iZ,"f")}get aborted(){return D(this,nZ,"f")}abort(){this.controller.abort()}on($,Z){return(D(this,t2,"f")[$]||(D(this,t2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=D(this,t2,"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,t2,"f")[$]||(D(this,t2,"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,Q8,"f")}get currentMessage(){return D(this,P6,"f")}async finalMessage(){return await this.done(),D(this,K2,"m",UQ).call(this)}async finalText(){return await this.done(),D(this,K2,"m",Jq).call(this)}_emit($,...Z){if(D(this,J8,"f"))return;if($==="end")F(this,J8,!0,"f"),D(this,dZ,"f").call(this);let z=D(this,t2,"f")[$];if(z)D(this,t2,"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,z8,"f").call(this,Q),D(this,X8,"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,z8,"f").call(this,Q),D(this,X8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",D(this,K2,"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{D(this,K2,"m",GQ).call(this),this._connected(null);let X=Z2.fromReadableStream($,this.controller);for await(let J of X)D(this,K2,"m",VQ).call(this,J);if(X.controller.signal?.aborted)throw new w0;D(this,K2,"m",HQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(P6=new WeakMap,V1=new WeakMap,Z8=new WeakMap,lZ=new WeakMap,z8=new WeakMap,Q8=new WeakMap,dZ=new WeakMap,X8=new WeakMap,t2=new WeakMap,J8=new WeakMap,iZ=new WeakMap,nZ=new WeakMap,U$=new WeakMap,rZ=new WeakMap,sZ=new WeakMap,Y8=new WeakMap,oZ=new WeakMap,K2=new WeakSet,UQ=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Jq=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},GQ=function(){if(this.ended)return;F(this,P6,void 0,"f")},VQ=function(Z){if(this.ended)return;let z=D(this,K2,"m",Yq).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(Uq(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:Gq(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(QQ(z,D(this,V1,"f"),{logger:D(this,Y8,"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}},HQ=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=D(this,P6,"f");if(!Z)throw new k("request ended without sending any chunks");return F(this,P6,void 0,"f"),QQ(Z,D(this,V1,"f"),{logger:D(this,Y8,"f")})},Yq=function(Z){let z=D(this,P6,"f");if(Z.type==="message_start"){if(z)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new k(`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&&Uq(Q)){let X=Q[Wq]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,Wq,{value:X,enumerable:!1,writable:!0}),X)try{J.input=pZ(X)}catch(Y){let W=new k(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);D(this,oZ,"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:Gq(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 Z2(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var H1;var aZ=g(()=>{H1=class H1 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 Hq=1e5,qq=`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,116 +192,117 @@ 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 Wq(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function Uk($,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 H1?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var Y4,q1,G$,_0,i0,z2,$6,F6,W4,Yq,GQ,U4;var VQ=g(()=>{o2();sZ();d0();W0();i8();U4=class U4{constructor($,Z,z){Y4.add(this),this.client=$,q1.set(this,!1),G$.set(this,!1),_0.set(this,void 0),i0.set(this,void 0),z2.set(this,void 0),$6.set(this,void 0),F6.set(this,void 0),W4.set(this,0),F(this,_0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...lz(Z.tools,Z.messages)].join(", ");if(F(this,i0,{...z,headers:T([{"x-stainless-helper":X},z?.headers])},"f"),F(this,F6,Wq(),"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*[(q1=new WeakMap,G$=new WeakMap,_0=new WeakMap,i0=new WeakMap,z2=new WeakMap,$6=new WeakMap,F6=new WeakMap,W4=new WeakMap,Y4=new WeakSet,Yq=async function(){let Z=D(this,_0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(D(this,z2,"f")!==void 0)try{let U=await D(this,z2,"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??Xq;if(z<Q)return!1;let X=Z.model??D(this,_0,"f").params.model,J=Z.summaryPrompt??Jq,Y=D(this,_0,"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,_0,"f").params.max_tokens},{signal:D(this,i0,"f").signal,headers:T([D(this,i0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new k("Expected text response for compaction");return D(this,_0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(D(this,q1,"f"))throw new k("Cannot iterate over a consumed stream");F(this,q1,!0,"f"),F(this,G$,!0,"f"),F(this,$6,void 0,"f");try{while(!0){let Z;try{if(D(this,_0,"f").params.max_iterations&&D(this,W4,"f")>=D(this,_0,"f").params.max_iterations)break;F(this,G$,!1,"f"),F(this,$6,void 0,"f"),F(this,W4,($=D(this,W4,"f"),$++,$),"f"),F(this,z2,void 0,"f");let{max_iterations:z,compactionControl:Q,...X}=D(this,_0,"f").params;if(X.stream)Z=this.client.beta.messages.stream({...X},D(this,i0,"f")),F(this,z2,Z.finalMessage(),"f"),D(this,z2,"f").catch(()=>{}),yield Z;else F(this,z2,this.client.beta.messages.create({...X,stream:!1},D(this,i0,"f")),"f"),yield D(this,z2,"f");if(!await D(this,Y4,"m",Yq).call(this)){if(!D(this,G$,"f")){let{role:W,content:U}=await D(this,z2,"f");D(this,_0,"f").params.messages.push({role:W,content:U})}let Y=await D(this,Y4,"m",GQ).call(this,D(this,_0,"f").params.messages.at(-1));if(Y)D(this,_0,"f").params.messages.push(Y);else if(!D(this,G$,"f"))break}}finally{if(Z)Z.abort()}}if(!D(this,z2,"f"))throw new k("ToolRunner concluded without a message from the server");D(this,F6,"f").resolve(await D(this,z2,"f"))}catch(Z){throw F(this,q1,!1,"f"),D(this,F6,"f").promise.catch(()=>{}),D(this,F6,"f").reject(Z),F(this,F6,Wq(),"f"),Z}}setMessagesParams($){if(typeof $==="function")D(this,_0,"f").params=$(D(this,_0,"f").params);else D(this,_0,"f").params=$;F(this,G$,!0,"f"),F(this,$6,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,z2,"f")??this.params.messages.at(-1);if(!Z)return null;return D(this,Y4,"m",GQ).call(this,Z,$)}done(){return D(this,F6,"f").promise}async runUntilDone(){if(!D(this,q1,"f"))for await(let $ of this);return this.done()}get params(){return D(this,_0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};GQ=async function(Z,z=D(this,i0,"f").signal){if(D(this,$6,"f")!==void 0)return D(this,$6,"f");return F(this,$6,Uk(D(this,_0,"f").params,Z,{...D(this,i0,"f"),signal:z}),"f"),D(this,$6,"f")}});var K1;var HQ=g(()=>{d0();xz();K1=class K1{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new _6;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 k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}return new K1(v8($.body),Z)}}});var G4;var qQ=g(()=>{q0();W0();HQ();U1();O0();G4=class G4 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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",S2,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"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 k(`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:T([{"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 Gq($){if(!$.output_format)return $;if($.output_config?.format)throw new k("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...z}=$;return{...z,output_config:{...$.output_config,format:Z}}}var Uq,Vk,S6;var KQ=g(()=>{U1();ez();W0();i8();zQ();Qq();VQ();sZ();qQ();qQ();VQ();sZ();Uq={"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"},Vk=["claude-mythos-preview","claude-opus-4-6"];S6=class S6 extends c{constructor(){super(...arguments);this.batches=new G4(this._client)}create($,Z){let z=Gq($),{betas:Q,...X}=z;if(X.model in Uq)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${Uq[X.model]}
196
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Vk.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=uZ[X.model]??void 0;J=this._client.calculateNonstreamingTimeout(X.max_tokens,W)}let Y=fZ(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:T([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:T([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>ZQ(z,$,{logger:this._client.logger??console}))}stream($,Z){return J4.createMessage(this,$,Z)}countTokens($,Z){let z=Gq($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:T([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new U4(this._client,$,Z)}};S6.Batches=G4;S6.BetaToolRunner=U4;S6.ToolError=H1});var V4;var BQ=g(()=>{q0();W0();O0();V4=class V4 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/events?beta=true`,Q0,{query:X,...z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var H4;var MQ=g(()=>{q0();W0();O0();H4=class H4 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:T([{"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:T([{"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`,Q0,{query:X,...z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var V$;var LQ=g(()=>{BQ();BQ();MQ();MQ();q0();W0();O0();V$=class V$ extends c{constructor(){super(...arguments);this.events=new V4(this._client),this.resources=new H4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};V$.Events=V4;V$.Resources=H4});var q4;var NQ=g(()=>{q0();W0();Y1();O0();q4=class q4 extends c{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(R`/v1/skills/${$}/versions?beta=true`,J1({body:X,...z,headers:T([{"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:T([{"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`,Q0,{query:X,...z,headers:T([{"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:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var B1;var DQ=g(()=>{NQ();NQ();q0();W0();Y1();O0();B1=class B1 extends c{constructor(){super(...arguments);this.versions=new q4(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",J1({body:Q,...Z,headers:T([{"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:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",Q0,{query:Q,...Z,headers:T([{"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:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};B1.Versions=q4});var K4;var OQ=g(()=>{q0();W0();O0();K4=class K4 extends c{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:T([{"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:T([{"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:T([{"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`,Q0,{query:X,...z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var M1;var IQ=g(()=>{OQ();OQ();q0();W0();O0();M1=class M1 extends c{constructor(){super(...arguments);this.credentials=new K4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};M1.Credentials=K4});var h0;var TQ=g(()=>{pz();pz();dz();dz();iz();iz();nz();nz();sz();sz();tz();tz();KQ();KQ();LQ();LQ();DQ();DQ();IQ();IQ();h0=class h0 extends c{constructor(){super(...arguments);this.models=new r8(this._client),this.messages=new S6(this._client),this.agents=new W1(this._client),this.environments=new l8(this._client),this.sessions=new V$(this._client),this.vaults=new M1(this._client),this.memoryStores=new W$(this._client),this.files=new n8(this._client),this.skills=new B1(this._client),this.userProfiles=new s8(this._client)}};h0.Models=r8;h0.Messages=S6;h0.Agents=W1;h0.Environments=l8;h0.Sessions=V$;h0.Vaults=M1;h0.MemoryStores=W$;h0.Files=n8;h0.Skills=B1;h0.UserProfiles=s8});var L1;var AQ=g(()=>{W0();L1=class L1 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function Vq($){return $?.output_config?.format}function CQ($,Z,z){let Q=Vq(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 _Q($,Z,z)}function _Q($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=Ok(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 Ok($,Z){let z=Vq($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new k(`Failed to parse structured output: ${Q}`)}}var RQ=g(()=>{d0()});function Bq($){return $.type==="tool_use"||$.type==="server_tool_use"}function Mq($){}var B2,j6,N1,B4,oZ,M4,L4,aZ,N4,Z6,D4,tZ,eZ,H$,$7,Z7,O4,PQ,Hq,FQ,SQ,jQ,EQ,qq,Kq="__json_buf",I4;var Lq=g(()=>{o2();U1();XQ();QQ();RQ();I4=class I4{constructor($,Z){B2.add(this),this.messages=[],this.receivedMessages=[],j6.set(this,void 0),N1.set(this,null),this.controller=new AbortController,B4.set(this,void 0),oZ.set(this,()=>{}),M4.set(this,()=>{}),L4.set(this,void 0),aZ.set(this,()=>{}),N4.set(this,()=>{}),Z6.set(this,{}),D4.set(this,!1),tZ.set(this,!1),eZ.set(this,!1),H$.set(this,!1),$7.set(this,void 0),Z7.set(this,void 0),O4.set(this,void 0),FQ.set(this,(z)=>{if(F(this,tZ,!0,"f"),a2(z))z=new w0;if(z instanceof w0)return F(this,eZ,!0,"f"),this._emit("abort",z);if(z instanceof k)return this._emit("error",z);if(z instanceof Error){let Q=new k(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new k(String(z)))}),F(this,B4,new Promise((z,Q)=>{F(this,oZ,z,"f"),F(this,M4,Q,"f")}),"f"),F(this,L4,new Promise((z,Q)=>{F(this,aZ,z,"f"),F(this,N4,Q,"f")}),"f"),D(this,B4,"f").catch(()=>{}),D(this,L4,"f").catch(()=>{}),F(this,N1,$,"f"),F(this,O4,Z?.logger??console,"f")}get response(){return D(this,$7,"f")}get request_id(){return D(this,Z7,"f")}async withResponse(){F(this,H$,!0,"f");let $=await D(this,B4,"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 I4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new I4(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return F(X,N1,{...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,FQ,"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,B2,"m",SQ).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,B2,"m",jQ).call(this,W);if(Y.controller.signal?.aborted)throw new w0;D(this,B2,"m",EQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;F(this,$7,$,"f"),F(this,Z7,$?.headers.get("request-id"),"f"),D(this,oZ,"f").call(this,$),this._emit("connect")}get ended(){return D(this,D4,"f")}get errored(){return D(this,tZ,"f")}get aborted(){return D(this,eZ,"f")}abort(){this.controller.abort()}on($,Z){return(D(this,Z6,"f")[$]||(D(this,Z6,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=D(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(D(this,Z6,"f")[$]||(D(this,Z6,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(F(this,H$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){F(this,H$,!0,"f"),await D(this,L4,"f")}get currentMessage(){return D(this,j6,"f")}async finalMessage(){return await this.done(),D(this,B2,"m",PQ).call(this)}async finalText(){return await this.done(),D(this,B2,"m",Hq).call(this)}_emit($,...Z){if(D(this,D4,"f"))return;if($==="end")F(this,D4,!0,"f"),D(this,aZ,"f").call(this);let z=D(this,Z6,"f")[$];if(z)D(this,Z6,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!D(this,H$,"f")&&!z?.length)Promise.reject(Q);D(this,M4,"f").call(this,Q),D(this,N4,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!D(this,H$,"f")&&!z?.length)Promise.reject(Q);D(this,M4,"f").call(this,Q),D(this,N4,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",D(this,B2,"m",PQ).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,B2,"m",SQ).call(this),this._connected(null);let X=Z2.fromReadableStream($,this.controller);for await(let J of X)D(this,B2,"m",jQ).call(this,J);if(X.controller.signal?.aborted)throw new w0;D(this,B2,"m",EQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(j6=new WeakMap,N1=new WeakMap,B4=new WeakMap,oZ=new WeakMap,M4=new WeakMap,L4=new WeakMap,aZ=new WeakMap,N4=new WeakMap,Z6=new WeakMap,D4=new WeakMap,tZ=new WeakMap,eZ=new WeakMap,H$=new WeakMap,$7=new WeakMap,Z7=new WeakMap,O4=new WeakMap,FQ=new WeakMap,B2=new WeakSet,PQ=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Hq=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},SQ=function(){if(this.ended)return;F(this,j6,void 0,"f")},jQ=function(Z){if(this.ended)return;let z=D(this,B2,"m",qq).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(Bq(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:Mq(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(CQ(z,D(this,N1,"f"),{logger:D(this,O4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{F(this,j6,z,"f");break}case"content_block_start":case"message_delta":break}},EQ=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=D(this,j6,"f");if(!Z)throw new k("request ended without sending any chunks");return F(this,j6,void 0,"f"),CQ(Z,D(this,N1,"f"),{logger:D(this,O4,"f")})},qq=function(Z){let z=D(this,j6,"f");if(Z.type==="message_start"){if(z)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new k(`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&&Bq(Q)){let X=Q[Kq]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,Kq,{value:X,enumerable:!1,writable:!0}),X)J.input=mZ(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:Mq(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 Z2(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var T4;var wQ=g(()=>{q0();W0();HQ();U1();O0();T4=class T4 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",S2,{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 k(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:T([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>K1.fromResponse(X.response,X.controller))}}});var q$,Nq,Tk;var xQ=g(()=>{W0();i8();Lq();RQ();wQ();wQ();ez();q$=class q$ extends c{constructor(){super(...arguments);this.batches=new T4(this._client)}create($,Z){if($.model in Nq)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${Nq[$.model]}
197
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Tk.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=uZ[$.model]??void 0;z=this._client.calculateNonstreamingTimeout($.max_tokens,X)}let Q=fZ($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:T([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>_Q(z,$,{logger:this._client.logger??console}))}stream($,Z){return I4.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};Nq={"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"},Tk=["claude-mythos-preview","claude-opus-4-6"];q$.Batches=T4});var D1;var yQ=g(()=>{q0();W0();O0();D1=class D1 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}`,{...z,headers:T([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",S2,{query:Q,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var Dq=g(()=>{TQ();AQ();xQ();yQ();iH()});var A4=($)=>{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 V0{constructor({baseURL:$=A4("ANTHROPIC_BASE_URL"),apiKey:Z=A4("ANTHROPIC_API_KEY")??null,authToken:z=A4("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){kQ.add(this),z7.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&EH())throw new k(`It looks like you're running in a browser-like environment.
195
+ Wrap your summary in <summary></summary> tags.`;function Bq(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function Ck($,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 H1?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var U8,q1,G$,_0,n0,z2,e2,F6,G8,Kq,qQ,V8;var KQ=g(()=>{s2();aZ();i0();W0();r4();V8=class V8{constructor($,Z,z){U8.add(this),this.client=$,q1.set(this,!1),G$.set(this,!1),_0.set(this,void 0),n0.set(this,void 0),z2.set(this,void 0),e2.set(this,void 0),F6.set(this,void 0),G8.set(this,0),F(this,_0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...nz(Z.tools,Z.messages)].join(", ");if(F(this,n0,{...z,headers:T([{"x-stainless-helper":X},z?.headers])},"f"),F(this,F6,Bq(),"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*[(q1=new WeakMap,G$=new WeakMap,_0=new WeakMap,n0=new WeakMap,z2=new WeakMap,e2=new WeakMap,F6=new WeakMap,G8=new WeakMap,U8=new WeakSet,Kq=async function(){let Z=D(this,_0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(D(this,z2,"f")!==void 0)try{let U=await D(this,z2,"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??Hq;if(z<Q)return!1;let X=Z.model??D(this,_0,"f").params.model,J=Z.summaryPrompt??qq,Y=D(this,_0,"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,_0,"f").params.max_tokens},{signal:D(this,n0,"f").signal,headers:T([D(this,n0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new k("Expected text response for compaction");return D(this,_0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(D(this,q1,"f"))throw new k("Cannot iterate over a consumed stream");F(this,q1,!0,"f"),F(this,G$,!0,"f"),F(this,e2,void 0,"f");try{while(!0){let Z;try{if(D(this,_0,"f").params.max_iterations&&D(this,G8,"f")>=D(this,_0,"f").params.max_iterations)break;F(this,G$,!1,"f"),F(this,e2,void 0,"f"),F(this,G8,($=D(this,G8,"f"),$++,$),"f"),F(this,z2,void 0,"f");let{max_iterations:z,compactionControl:Q,...X}=D(this,_0,"f").params;if(X.stream)Z=this.client.beta.messages.stream({...X},D(this,n0,"f")),F(this,z2,Z.finalMessage(),"f"),D(this,z2,"f").catch(()=>{}),yield Z;else F(this,z2,this.client.beta.messages.create({...X,stream:!1},D(this,n0,"f")),"f"),yield D(this,z2,"f");if(!await D(this,U8,"m",Kq).call(this)){if(!D(this,G$,"f")){let{role:W,content:U}=await D(this,z2,"f");D(this,_0,"f").params.messages.push({role:W,content:U})}let Y=await D(this,U8,"m",qQ).call(this,D(this,_0,"f").params.messages.at(-1));if(Y)D(this,_0,"f").params.messages.push(Y);else if(!D(this,G$,"f"))break}}finally{if(Z)Z.abort()}}if(!D(this,z2,"f"))throw new k("ToolRunner concluded without a message from the server");D(this,F6,"f").resolve(await D(this,z2,"f"))}catch(Z){throw F(this,q1,!1,"f"),D(this,F6,"f").promise.catch(()=>{}),D(this,F6,"f").reject(Z),F(this,F6,Bq(),"f"),Z}}setMessagesParams($){if(typeof $==="function")D(this,_0,"f").params=$(D(this,_0,"f").params);else D(this,_0,"f").params=$;F(this,G$,!0,"f"),F(this,e2,void 0,"f")}setRequestOptions($){if(typeof $==="function")F(this,n0,$(D(this,n0,"f")),"f");else F(this,n0,{...D(this,n0,"f"),...$},"f")}async generateToolResponse($=D(this,n0,"f").signal){let Z=await D(this,z2,"f")??this.params.messages.at(-1);if(!Z)return null;return D(this,U8,"m",qQ).call(this,Z,$)}done(){return D(this,F6,"f").promise}async runUntilDone(){if(!D(this,q1,"f"))for await(let $ of this);return this.done()}get params(){return D(this,_0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};qQ=async function(Z,z=D(this,n0,"f").signal){if(D(this,e2,"f")!==void 0)return D(this,e2,"f");return F(this,e2,Ck(D(this,_0,"f").params,Z,{...D(this,n0,"f"),signal:z}),"f"),D(this,e2,"f")}});var K1;var BQ=g(()=>{i0();bz();K1=class K1{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new _6;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 k("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new k("Attempted to iterate over a response with no body")}return new K1(h4($.body),Z)}}});var H8;var MQ=g(()=>{q0();W0();BQ();U1();O0();H8=class H8 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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",S2,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"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 k(`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:T([{"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 Lq($){if(!$.output_format)return $;if($.output_config?.format)throw new k("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...z}=$;return{...z,output_config:{...$.output_config,format:Z}}}var Mq,Rk,S6;var LQ=g(()=>{U1();zQ();W0();r4();JQ();Vq();KQ();aZ();MQ();MQ();KQ();aZ();Mq={"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"},Rk=["claude-mythos-preview","claude-opus-4-6"];S6=class S6 extends c{constructor(){super(...arguments);this.batches=new H8(this._client)}create($,Z){let z=Lq($),{betas:Q,...X}=z;if(X.model in Mq)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${Mq[X.model]}
196
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Rk.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=cZ[X.model]??void 0;J=this._client.calculateNonstreamingTimeout(X.max_tokens,W)}let Y=mZ(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:T([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:T([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>XQ(z,$,{logger:this._client.logger??console}))}stream($,Z){return W8.createMessage(this,$,Z)}countTokens($,Z){let z=Lq($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:T([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new V8(this._client,$,Z)}};S6.Batches=H8;S6.BetaToolRunner=V8;S6.ToolError=H1});var q8;var NQ=g(()=>{q0();W0();O0();q8=class q8 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/events?beta=true`,Q0,{query:X,...z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var K8;var DQ=g(()=>{q0();W0();O0();K8=class K8 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:T([{"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:T([{"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`,Q0,{query:X,...z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var V$;var OQ=g(()=>{NQ();NQ();DQ();DQ();q0();W0();O0();V$=class V$ extends c{constructor(){super(...arguments);this.events=new q8(this._client),this.resources=new K8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};V$.Events=q8;V$.Resources=K8});var B8;var IQ=g(()=>{q0();W0();Y1();O0();B8=class B8 extends c{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(R`/v1/skills/${$}/versions?beta=true`,J1({body:X,...z,headers:T([{"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:T([{"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`,Q0,{query:X,...z,headers:T([{"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:T([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var B1;var TQ=g(()=>{IQ();IQ();q0();W0();Y1();O0();B1=class B1 extends c{constructor(){super(...arguments);this.versions=new B8(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",J1({body:Q,...Z,headers:T([{"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:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",Q0,{query:Q,...Z,headers:T([{"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:T([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};B1.Versions=B8});var M8;var AQ=g(()=>{q0();W0();O0();M8=class M8 extends c{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:T([{"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:T([{"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:T([{"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`,Q0,{query:X,...z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var M1;var CQ=g(()=>{AQ();AQ();q0();W0();O0();M1=class M1 extends c{constructor(){super(...arguments);this.credentials=new M8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:T([{"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:T([{"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:T([{"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",Q0,{query:Q,...Z,headers:T([{"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:T([{"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:T([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};M1.Credentials=M8});var g0;var _Q=g(()=>{iz();iz();rz();rz();sz();sz();oz();oz();tz();tz();ZQ();ZQ();LQ();LQ();OQ();OQ();TQ();TQ();CQ();CQ();g0=class g0 extends c{constructor(){super(...arguments);this.models=new o4(this._client),this.messages=new S6(this._client),this.agents=new W1(this._client),this.environments=new i4(this._client),this.sessions=new V$(this._client),this.vaults=new M1(this._client),this.memoryStores=new W$(this._client),this.files=new s4(this._client),this.skills=new B1(this._client),this.userProfiles=new a4(this._client)}};g0.Models=o4;g0.Messages=S6;g0.Agents=W1;g0.Environments=i4;g0.Sessions=V$;g0.Vaults=M1;g0.MemoryStores=W$;g0.Files=s4;g0.Skills=B1;g0.UserProfiles=a4});var L1;var RQ=g(()=>{W0();L1=class L1 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function Nq($){return $?.output_config?.format}function PQ($,Z,z){let Q=Nq(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 FQ($,Z,z)}function FQ($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=kk(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 kk($,Z){let z=Nq($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new k(`Failed to parse structured output: ${Q}`)}}var SQ=g(()=>{i0()});function Tq($){return $.type==="tool_use"||$.type==="server_tool_use"}function Aq($){}var B2,j6,N1,L8,tZ,N8,D8,eZ,O8,$6,I8,$7,Z7,H$,z7,Q7,T8,jQ,Dq,EQ,wQ,xQ,yQ,Oq,Iq="__json_buf",A8;var Cq=g(()=>{s2();U1();WQ();YQ();SQ();A8=class A8{constructor($,Z){B2.add(this),this.messages=[],this.receivedMessages=[],j6.set(this,void 0),N1.set(this,null),this.controller=new AbortController,L8.set(this,void 0),tZ.set(this,()=>{}),N8.set(this,()=>{}),D8.set(this,void 0),eZ.set(this,()=>{}),O8.set(this,()=>{}),$6.set(this,{}),I8.set(this,!1),$7.set(this,!1),Z7.set(this,!1),H$.set(this,!1),z7.set(this,void 0),Q7.set(this,void 0),T8.set(this,void 0),EQ.set(this,(z)=>{if(F(this,$7,!0,"f"),o2(z))z=new w0;if(z instanceof w0)return F(this,Z7,!0,"f"),this._emit("abort",z);if(z instanceof k)return this._emit("error",z);if(z instanceof Error){let Q=new k(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new k(String(z)))}),F(this,L8,new Promise((z,Q)=>{F(this,tZ,z,"f"),F(this,N8,Q,"f")}),"f"),F(this,D8,new Promise((z,Q)=>{F(this,eZ,z,"f"),F(this,O8,Q,"f")}),"f"),D(this,L8,"f").catch(()=>{}),D(this,D8,"f").catch(()=>{}),F(this,N1,$,"f"),F(this,T8,Z?.logger??console,"f")}get response(){return D(this,z7,"f")}get request_id(){return D(this,Q7,"f")}async withResponse(){F(this,H$,!0,"f");let $=await D(this,L8,"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 A8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new A8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return F(X,N1,{...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,EQ,"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,B2,"m",wQ).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,B2,"m",xQ).call(this,W);if(Y.controller.signal?.aborted)throw new w0;D(this,B2,"m",yQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;F(this,z7,$,"f"),F(this,Q7,$?.headers.get("request-id"),"f"),D(this,tZ,"f").call(this,$),this._emit("connect")}get ended(){return D(this,I8,"f")}get errored(){return D(this,$7,"f")}get aborted(){return D(this,Z7,"f")}abort(){this.controller.abort()}on($,Z){return(D(this,$6,"f")[$]||(D(this,$6,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=D(this,$6,"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,$6,"f")[$]||(D(this,$6,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(F(this,H$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){F(this,H$,!0,"f"),await D(this,D8,"f")}get currentMessage(){return D(this,j6,"f")}async finalMessage(){return await this.done(),D(this,B2,"m",jQ).call(this)}async finalText(){return await this.done(),D(this,B2,"m",Dq).call(this)}_emit($,...Z){if(D(this,I8,"f"))return;if($==="end")F(this,I8,!0,"f"),D(this,eZ,"f").call(this);let z=D(this,$6,"f")[$];if(z)D(this,$6,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!D(this,H$,"f")&&!z?.length)Promise.reject(Q);D(this,N8,"f").call(this,Q),D(this,O8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!D(this,H$,"f")&&!z?.length)Promise.reject(Q);D(this,N8,"f").call(this,Q),D(this,O8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",D(this,B2,"m",jQ).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,B2,"m",wQ).call(this),this._connected(null);let X=Z2.fromReadableStream($,this.controller);for await(let J of X)D(this,B2,"m",xQ).call(this,J);if(X.controller.signal?.aborted)throw new w0;D(this,B2,"m",yQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(j6=new WeakMap,N1=new WeakMap,L8=new WeakMap,tZ=new WeakMap,N8=new WeakMap,D8=new WeakMap,eZ=new WeakMap,O8=new WeakMap,$6=new WeakMap,I8=new WeakMap,$7=new WeakMap,Z7=new WeakMap,H$=new WeakMap,z7=new WeakMap,Q7=new WeakMap,T8=new WeakMap,EQ=new WeakMap,B2=new WeakSet,jQ=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Dq=function(){if(this.receivedMessages.length===0)throw new k("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new k("stream ended without producing a content block with type=text");return Z.join(" ")},wQ=function(){if(this.ended)return;F(this,j6,void 0,"f")},xQ=function(Z){if(this.ended)return;let z=D(this,B2,"m",Oq).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(Tq(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:Aq(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(PQ(z,D(this,N1,"f"),{logger:D(this,T8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{F(this,j6,z,"f");break}case"content_block_start":case"message_delta":break}},yQ=function(){if(this.ended)throw new k("stream has ended, this shouldn't happen");let Z=D(this,j6,"f");if(!Z)throw new k("request ended without sending any chunks");return F(this,j6,void 0,"f"),PQ(Z,D(this,N1,"f"),{logger:D(this,T8,"f")})},Oq=function(Z){let z=D(this,j6,"f");if(Z.type==="message_start"){if(z)throw new k(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new k(`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&&Tq(Q)){let X=Q[Iq]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,Iq,{value:X,enumerable:!1,writable:!0}),X)J.input=pZ(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:Aq(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 Z2(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var C8;var kQ=g(()=>{q0();W0();BQ();U1();O0();C8=class C8 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",S2,{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 k(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:T([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>K1.fromResponse(X.response,X.controller))}}});var q$,_q,vk;var bQ=g(()=>{W0();r4();Cq();SQ();kQ();kQ();zQ();q$=class q$ extends c{constructor(){super(...arguments);this.batches=new C8(this._client)}create($,Z){if($.model in _q)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${_q[$.model]}
197
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(vk.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=cZ[$.model]??void 0;z=this._client.calculateNonstreamingTimeout($.max_tokens,X)}let Q=mZ($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:T([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>FQ(z,$,{logger:this._client.logger??console}))}stream($,Z){return A8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};_q={"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"},vk=["claude-mythos-preview","claude-opus-4-6"];q$.Batches=C8});var D1;var vQ=g(()=>{q0();W0();O0();D1=class D1 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}`,{...z,headers:T([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",S2,{query:Q,...Z,headers:T([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var Rq=g(()=>{_Q();RQ();bQ();vQ();eH()});var _8=($)=>{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 V0{constructor({baseURL:$=_8("ANTHROPIC_BASE_URL"),apiKey:Z=_8("ANTHROPIC_API_KEY")??null,authToken:z=_8("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){gQ.add(this),X7.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&gH())throw new k(`It looks like you're running in a browser-like environment.
198
198
 
199
199
  This is disabled by default, as it risks exposing your secret API credentials to attackers.
200
200
  If you understand the risks and have appropriate mitigations in place,
201
201
  you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
202
202
 
203
203
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
204
- `);this.baseURL=X.baseURL,this.timeout=X.timeout??bQ.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=yz(X.logLevel,"ClientOptions.logLevel",this)??yz(A4("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??xH(),F(this,z7,kH,"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 T([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return T([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return T([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return bH($)}getUserAgent(){return`${this.constructor.name}/JS ${C6}`}defaultIdempotencyKey(){return`stainless-node-retry-${Rz()}`}makeStatusError($,Z,z,Q){return D0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!D(this,kQ,"m",Oq).call(this)&&z||this.baseURL,X=CH($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!Sz(J)||!Sz(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 k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options: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 R6(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(F0(this).debug(`[${U}] sending request`,t2({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new w0;let H=new AbortController,q=await this.fetchWithTimeout(Y,J,W,H).catch(b8),K=Date.now();if(q instanceof globalThis.Error){let N=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new w0;let O=a2(q)||/timed? ?out/i.test(String(q)+("cause"in q?String(q.cause):""));if(Z)return F0(this).info(`[${U}] connection ${O?"timed out":"failed"} - ${N}`),F0(this).debug(`[${U}] connection ${O?"timed out":"failed"} (${N})`,t2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:q.message})),this.retryRequest(Q,Z,z??U);if(F0(this).info(`[${U}] connection ${O?"timed out":"failed"} - error; no more retries left`),F0(this).debug(`[${U}] connection ${O?"timed out":"failed"} (error; no more retries left)`,t2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:q.message})),O)throw new o$;throw new A6({cause:q})}let M=[...q.headers.entries()].filter(([N])=>N==="request-id").map(([N,O])=>", "+N+": "+JSON.stringify(O)).join(""),B=`[${U}${G}${M}] ${J.method} ${Y} ${q.ok?"succeeded":"failed"} with status ${q.status} in ${K-V}ms`;if(!q.ok){let N=await this.shouldRetry(q);if(Z&&N){let E=`retrying, ${Z} attempts remaining`;return await yH(q.body),F0(this).info(`${B} - ${E}`),F0(this).debug(`[${U}] response error (${E})`,t2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,durationMs:K-V})),this.retryRequest(Q,Z,z??U,q.headers)}let O=N?"error; no more retries left":"error; not retryable";F0(this).info(`${B} - ${O}`);let _=await q.text().catch((E)=>b8(E).message),x=EZ(_),S=x?void 0:_;throw F0(this).debug(`[${U}] response error (${O})`,t2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,message:S,durationMs:Date.now()-V})),this.makeStatusError(q.status,x,S,q.headers)}return F0(this).info(B),F0(this).debug(`[${U}] response start`,t2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,durationMs:K-V})),{response:q,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 m8(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 PH(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 k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let z={...$},{method:Q,path:X,query:J,defaultBaseURL:Y}=z,W=this.buildURL(X,J,Y);if("timeout"in z)RH("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=T([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...wH(),...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=T([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:wZ($)};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,z7,"f").call(this,{body:$,headers:z})}}var kQ,bQ,z7,Oq,vQ="\\n\\nHuman:",gQ="\\n\\nAssistant:",E6;var hQ=g(()=>{o2();J$();jz();vH();d0();q0();cz();Dq();vZ();AQ();yQ();TQ();xQ();jz();W0();kZ();J$();bQ=V0,z7=new WeakMap,kQ=new WeakSet,Oq=function(){return this.baseURL!=="https://api.anthropic.com"};V0.Anthropic=bQ;V0.HUMAN_PROMPT=vQ;V0.AI_PROMPT=gQ;V0.DEFAULT_TIMEOUT=600000;V0.AnthropicError=k;V0.APIError=D0;V0.APIConnectionError=A6;V0.APIConnectionTimeoutError=o$;V0.APIUserAbortError=w0;V0.NotFoundError=$1;V0.ConflictError=Z1;V0.RateLimitError=Q1;V0.BadRequestError=a$;V0.AuthenticationError=t$;V0.InternalServerError=X1;V0.PermissionDeniedError=e$;V0.UnprocessableEntityError=z1;V0.toFile=p8;E6=class E6 extends V0{constructor(){super(...arguments);this.completions=new L1(this),this.messages=new q$(this),this.models=new D1(this),this.beta=new h0(this)}};E6.Completions=L1;E6.Messages=q$;E6.Models=D1;E6.Beta=h0});var Iq={};eQ(Iq,{toFile:()=>p8,default:()=>E6,UnprocessableEntityError:()=>z1,RateLimitError:()=>Q1,PermissionDeniedError:()=>e$,PagePromise:()=>m8,NotFoundError:()=>$1,InternalServerError:()=>X1,HUMAN_PROMPT:()=>vQ,ConflictError:()=>Z1,BaseAnthropic:()=>V0,BadRequestError:()=>a$,AuthenticationError:()=>t$,AnthropicError:()=>k,Anthropic:()=>E6,APIUserAbortError:()=>w0,APIPromise:()=>R6,APIError:()=>D0,APIConnectionTimeoutError:()=>o$,APIConnectionError:()=>A6,AI_PROMPT:()=>gQ});var Tq=g(()=>{hQ();cz();vZ();hQ();q0();d0()});var LX=QK(MX(),1),{program:ib,createCommand:nb,createArgument:rb,createOption:sb,CommanderError:ob,InvalidArgumentError:ab,InvalidOptionArgumentError:tb,Command:NX,Argument:eb,Option:$v,Help:Zv}=LX.default;import{lstatSync as TW}from"fs";import{join as DW,dirname as y5,basename as lC,resolve as w$}from"path";import{execFileSync as dC}from"child_process";var UA=H9(),GA=f1(),VA=s7(),C9=u1(),HA=R1(),V6=t(),qA=J6(),KA=L0(),BA=W6(),MA=U6(),Ig=K5(),LA=I9(),NA=T9(),DA=A9(),N5=RY(),PY=C1();var OA=UA.Composer,D5=GA.Document,IA=VA.Schema,TA=C9.YAMLError,O5=C9.YAMLParseError,AA=C9.YAMLWarning,CA=HA.Alias,u2=V6.isAlias,h6=V6.isCollection,_A=V6.isDocument,B0=V6.isMap,D2=V6.isNode,RA=V6.isPair,A0=V6.isScalar,m2=V6.isSeq,PA=qA.Pair,FA=KA.Scalar,R$=BA.YAMLMap,i1=MA.YAMLSeq;var SA=LA.Lexer,jA=NA.LineCounter,EA=DA.Parser,f0=N5.parse,wA=N5.parseAllDocuments,f6=N5.parseDocument,u6=N5.stringify,xA=PY.visit,yA=PY.visitAsync;import{accessSync as FY,closeSync as T5,constants as SY,existsSync as kA,fchmodSync as jY,fchownSync as bA,fsyncSync as EY,lstatSync as r1,mkdirSync as wY,mkdtempSync as vA,openSync as S9,readdirSync as xY,readFileSync as A5,readlinkSync as gA,realpathSync as hA,renameSync as fA,rmSync as yY,statSync as P$,unlinkSync as kY,writeFileSync as bY}from"fs";import{randomBytes as uA}from"crypto";import{tmpdir as vY}from"os";import{basename as H6,dirname as m6,isAbsolute as gY,join as w2,relative as j9,resolve as J2,sep as I5}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 x0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),mA=new Set(Object.values(x0).map(($)=>$.toLowerCase())),cA=($,Z)=>$.toLowerCase()===Z.toLowerCase(),_9=($)=>mA.has($.toLowerCase());function F$($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var pA=/\.fafm?$/i,lA=/^[a-z][a-z0-9-]*$/,O2=($)=>hA.native($),q6=($)=>$?.code;function s1($,Z){let z=j9($,Z);return z===""||z!==".."&&!z.startsWith(`..${I5}`)&&!gY(z)}function hY($){try{return gA($)}catch{return"?"}}function dA($,Z,z,Q){let X;try{X=O2(z)}catch(J){let Y=q6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new v("dangling",Z,`${Z} is a link to ${hY(z)}, which does not exist. faf does not create files through a link — refused.`);throw J}if(!s1($,X))throw new v("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(F$(X)&&!(Q.inGit&&m6(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 iA(Z,X,Q.read),X}function iA($,Z,z){let Q=H6($),X=H6(Z),J=_9(Q)&&_9(X);if(z&&!pA.test(X)&&!J){let Y=_9(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&&!cA(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 nA($,Z,z,Q){if(H6(J2($))!=="hooks"||!lA.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 rA($,Z,z){if(H6($)!=="config"||z!==Z)throw new v("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function i($,Z,z={}){let Q=O2(J2($)),X=J2($,Z),J=O2(m6(X));if(!s1(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)nA($,X,Q,J);if(W)rA(X,Q,J);let U=w2(J,H6(X));if(F$(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=r1(U)}catch(V){if(q6(V)==="ENOENT")return U;throw V}if(G.isSymbolicLink())return dA(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 sA=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function oA($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return sA.decode($)}catch{}throw new v("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function U0($){return oA(A5($),$)}function y0($){try{return A5($)}catch(Z){if(q6(Z)==="ENOENT")return null;throw Z}}function n1($,Z){let z=J2(w2($,Z));if(!kA(z))return null;let Q,X;try{Q=O2(aA($)),X=O2(z)}catch{return null}if(!s1(Q,X)||F$(j9(Q,X)))return null;return X}var P9=[];function aA($){let Z=J2($);return P9.find((z)=>Z===z||Z.startsWith(z.endsWith(I5)?z:z+I5))??Z}function S$($,Z){P9.push(J2($));try{return Z()}finally{P9.pop()}}function I($,Z){return n1($,Z)!==null}function h($,Z){let z=n1($,Z);if(z===null)return null;try{return P$(z).isFile()?A5(z,"utf-8"):null}catch{return null}}function I2($,Z){let z=n1($,Z);if(z===null)return null;try{return P$(z)}catch{return null}}function X0($,Z="."){let z=n1($,Z);if(z===null)return null;let Q;try{Q=xY(z,{withFileTypes:!0})}catch{return null}return Q.filter((X)=>!X.isSymbolicLink()||n1($,w2(Z,X.name))!==null)}function tA($){try{let Z=P$($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(q6(Z)==="ENOENT")return;throw Z}}class c2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var R9=($)=>new v("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function E9($,Z,z){if(Z!==void 0){let X=y0($),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 R9($)}if(!z)return;let Q;try{Q=P$($)}catch(X){if(q6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw R9($);try{FY($,SY.W_OK)}catch{throw R9($)}}function eA($,Z){if(process.platform!=="win32")try{bA($,Z.uid,Z.gid)}catch{}jY($,Z.mode)}function $C($){if(process.platform==="win32")return;try{let Z=S9($,"r");try{EY(Z)}finally{T5(Z)}}catch{}}function ZC($,Z,z,Q){if($.fd=S9($.path,"wx",Q??z?.mode??438),$.created=!0,bY($.fd,Z),z)eA($.fd,z);if(Q!==void 0)jY($.fd,Q);EY($.fd),T5($.fd),$.fd=void 0}function zC($){if($.fd!==void 0)try{T5($.fd)}catch{}if($.created)try{kY($.path)}catch{}}function QC($,Z,z){let Q=m6($),X={path:w2(Q,`.${H6($).slice(0,100)}.${process.pid}.${uA(6).toString("hex")}.faf-tmp`),created:!1},J=tA($);try{if(J)FY($,SY.W_OK);ZC(X,Z,J,z.mode),E9($,z.expect,J),fA(X.path,$)}catch(Y){if(zC(X),Y instanceof v)throw Y;let W=q6(Y)??(Y instanceof Error?Y.message:String(Y));throw new c2($,`${$}: not written${J?"; original kept":""} (${W})`,{cause:Y})}$C(Q)}function XC($){return $ instanceof v&&!$.onWrite?new v($.reason,$.path,$.message,{onWrite:!0}):$}function o($,Z,z={}){let Q=J2($),X;try{X=i(z.root??m6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw XC(J)}return QC(X,Z,z),X}function x2($,Z,z){let Q=J2($),X=z.root??m6(Q),J=i(X,Q),Y=y0(J);if(z.expect!==void 0)E9(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 o(J,Z,{root:X,expect:Y})}function j0($,Z=$){let z=J2($);wY(z,{recursive:!0});let Q=O2(z),X=J2(z,Z),J=j9(z,X);if(J===".."||J.startsWith(`..${I5}`)||gY(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=w2(Y,W);if(F$(U))throw new v("git",X,`${X} runs through ${U}, inside .git/ — refused.`,{onWrite:!0});Y=JC(Q,X,U)}return Y}function JC($,Z,z){let Q;try{Q=r1(z)}catch(J){if(q6(J)!=="ENOENT")throw J;return wY(z),z}let X=z;if(Q.isSymbolicLink()){try{X=O2(z)}catch{throw new v("dangling",Z,`${z} is a link to ${hY(z)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!s1($,X))throw new v("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(F$(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 C5($,Z){let z=J2($),Q=O2(J2(Z.root??m6(z))),X=O2(m6(z));if(!s1(Q,X))throw new v("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=w2(X,H6(z));if(F$(J))throw new v("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=r1(J)}catch(W){if(q6(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 E9(J,Z.expect,void 0),kY(J),!0}var F9=new Set,fY=".faf-temp",uY="faf made this temp folder; `faf clear` removes it.\n";function _5($){let Z=O2(vA(w2(vY(),$)));F9.add(Z);let z=S9(w2(Z,fY),"wx",420);try{bY(z,uY)}finally{T5(z)}return Z}function R5($){if(!F9.has($))throw Error(`${$} is not a temp folder faf made — not removed`);yY($,{recursive:!0,force:!0}),F9.delete($)}function YC($){let Z=w2($,fY);try{if(!r1(Z).isFile())return!1;return A5(Z,"utf-8")===uY}catch{return!1}}var WC=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function mY($){let Z=vY(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${WC($)}[A-Za-z0-9]{6}$`),X=0;for(let J of xY(Z)){if(!Q.test(J))continue;let Y=w2(Z,J);try{let W=r1(Y);if(!W.isDirectory()||z!==void 0&&W.uid!==z||!YC(Y))continue;yY(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function Z0($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function c6($){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 o1($,Z){if($===null||$===void 0)return{};if(!Z0($))throw new v("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${c6($)}. `+"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"}],K6=new Map(J0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),cY=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),jg=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function a1($,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 Eg=J0.filter(($)=>$.index<=21);var w9=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]);var t1="slotignored";function j$($){return typeof $==="string"&&$.trim()!==""&&G0($)}function G0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return w9.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var E$="no classifying signals — fallback",UC=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]),P5={skills:new Set(["stack.frontend"]),"skills-plugin":new Set(["stack.frontend","stack.runtime"])};function l6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(p6,$))return null;if(P5[$]?.has(Z.path))return!0;if(!p6[$].includes(Z.category))return!1;return!($==="framework"&&UC.has(Z.path))}var p6={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],skills:["project","human"],cli:["project","human","universal"],"skills-plugin":["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 rY=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function pY($){return typeof $==="object"&&$.collection===void 0}function GC($,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||!rY.has(Q.tag))return;let X;try{X=Q.resolve(z,()=>{return},{})}catch{return}return Object.is(A0(X)?X.value:X,$.value)?z:void 0}function VC($){let Z=$.filter(pY);return $.map((z)=>{if(!pY(z)||!rY.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,W)=>GC(X,Z)??Q(X,J,Y,W)}})}var F5={keepSourceTokens:!0,customTags:VC};function HC($,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 qC($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=HC(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function v9($,Z){let z=f6($,F5);if(z.errors.length>0){let Q=z.errors[0].message.split(`
204
+ `);this.baseURL=X.baseURL,this.timeout=X.timeout??hQ.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=vz(X.logLevel,"ClientOptions.logLevel",this)??vz(_8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??fH(),F(this,X7,mH,"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 T([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return T([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return T([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return cH($)}getUserAgent(){return`${this.constructor.name}/JS ${C6}`}defaultIdempotencyKey(){return`stainless-node-retry-${Sz()}`}makeStatusError($,Z,z,Q){return D0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!D(this,gQ,"m",Pq).call(this)&&z||this.baseURL,X=EH($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!wz(J)||!wz(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 k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options: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 R6(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(F0(this).debug(`[${U}] sending request`,a2({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new w0;let H=new AbortController,q=await this.fetchWithTimeout(Y,J,W,H).catch(g4),K=Date.now();if(q instanceof globalThis.Error){let N=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new w0;let O=o2(q)||/timed? ?out/i.test(String(q)+("cause"in q?String(q.cause):""));if(Z)return F0(this).info(`[${U}] connection ${O?"timed out":"failed"} - ${N}`),F0(this).debug(`[${U}] connection ${O?"timed out":"failed"} (${N})`,a2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:q.message})),this.retryRequest(Q,Z,z??U);if(F0(this).info(`[${U}] connection ${O?"timed out":"failed"} - error; no more retries left`),F0(this).debug(`[${U}] connection ${O?"timed out":"failed"} (error; no more retries left)`,a2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:q.message})),O)throw new o$;throw new A6({cause:q})}let L=[...q.headers.entries()].filter(([N])=>N==="request-id").map(([N,O])=>", "+N+": "+JSON.stringify(O)).join(""),B=`[${U}${G}${L}] ${J.method} ${Y} ${q.ok?"succeeded":"failed"} with status ${q.status} in ${K-V}ms`;if(!q.ok){let N=await this.shouldRetry(q);if(Z&&N){let E=`retrying, ${Z} attempts remaining`;return await uH(q.body),F0(this).info(`${B} - ${E}`),F0(this).debug(`[${U}] response error (${E})`,a2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,durationMs:K-V})),this.retryRequest(Q,Z,z??U,q.headers)}let O=N?"error; no more retries left":"error; not retryable";F0(this).info(`${B} - ${O}`);let _=await q.text().catch((E)=>g4(E).message),x=xZ(_),S=x?void 0:_;throw F0(this).debug(`[${U}] response error (${O})`,a2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,message:S,durationMs:Date.now()-V})),this.makeStatusError(q.status,x,S,q.headers)}return F0(this).info(B),F0(this).debug(`[${U}] response start`,a2({retryOfRequestLogID:z,url:q.url,status:q.status,headers:q.headers,durationMs:K-V})),{response:q,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 p4(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 yH(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 k("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let z={...$},{method:Q,path:X,query:J,defaultBaseURL:Y}=z,W=this.buildURL(X,J,Y);if("timeout"in z)xH("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=T([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...hH(),...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=T([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:yZ($)};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,X7,"f").call(this,{body:$,headers:z})}}var gQ,hQ,X7,Pq,fQ="\\n\\nHuman:",uQ="\\n\\nAssistant:",E6;var mQ=g(()=>{s2();J$();xz();pH();i0();q0();dz();Rq();hZ();RQ();vQ();_Q();bQ();xz();W0();vZ();J$();hQ=V0,X7=new WeakMap,gQ=new WeakSet,Pq=function(){return this.baseURL!=="https://api.anthropic.com"};V0.Anthropic=hQ;V0.HUMAN_PROMPT=fQ;V0.AI_PROMPT=uQ;V0.DEFAULT_TIMEOUT=600000;V0.AnthropicError=k;V0.APIError=D0;V0.APIConnectionError=A6;V0.APIConnectionTimeoutError=o$;V0.APIUserAbortError=w0;V0.NotFoundError=$1;V0.ConflictError=Z1;V0.RateLimitError=Q1;V0.BadRequestError=a$;V0.AuthenticationError=t$;V0.InternalServerError=X1;V0.PermissionDeniedError=e$;V0.UnprocessableEntityError=z1;V0.toFile=d4;E6=class E6 extends V0{constructor(){super(...arguments);this.completions=new L1(this),this.messages=new q$(this),this.models=new D1(this),this.beta=new g0(this)}};E6.Completions=L1;E6.Messages=q$;E6.Models=D1;E6.Beta=g0});var Fq={};zX(Fq,{toFile:()=>d4,default:()=>E6,UnprocessableEntityError:()=>z1,RateLimitError:()=>Q1,PermissionDeniedError:()=>e$,PagePromise:()=>p4,NotFoundError:()=>$1,InternalServerError:()=>X1,HUMAN_PROMPT:()=>fQ,ConflictError:()=>Z1,BaseAnthropic:()=>V0,BadRequestError:()=>a$,AuthenticationError:()=>t$,AnthropicError:()=>k,Anthropic:()=>E6,APIUserAbortError:()=>w0,APIPromise:()=>R6,APIError:()=>D0,APIConnectionTimeoutError:()=>o$,APIConnectionError:()=>A6,AI_PROMPT:()=>uQ});var Sq=g(()=>{mQ();dz();hZ();mQ();q0();i0()});var OX=VK(DX(),1),{program:Gv,createCommand:Vv,createArgument:Hv,createOption:qv,CommanderError:Kv,InvalidArgumentError:Bv,InvalidOptionArgumentError:Mv,Command:IX,Argument:Lv,Option:M7,Help:Nv}=OX.default;import{lstatSync as _W}from"fs";import{join as TW,dirname as b5,basename as aC,resolve as w$}from"path";import{execFileSync as tC}from"child_process";var MA=B9(),LA=f1(),NA=t7(),P9=u1(),DA=R1(),G6=t(),OA=X6(),IA=L0(),TA=Y6(),AA=W6(),vg=M5(),CA=C9(),_A=_9(),RA=R9(),O5=SY(),jY=C1();var PA=MA.Composer,I5=LA.Document,FA=NA.Schema,SA=P9.YAMLError,T5=P9.YAMLParseError,jA=P9.YAMLWarning,EA=DA.Alias,u2=G6.isAlias,h6=G6.isCollection,wA=G6.isDocument,B0=G6.isMap,D2=G6.isNode,xA=G6.isPair,A0=G6.isScalar,m2=G6.isSeq,yA=OA.Pair,kA=IA.Scalar,R$=TA.YAMLMap,i1=AA.YAMLSeq;var bA=CA.Lexer,vA=_A.LineCounter,gA=RA.Parser,h0=O5.parse,hA=O5.parseAllDocuments,f6=O5.parseDocument,u6=O5.stringify,fA=jY.visit,uA=jY.visitAsync;import{accessSync as EY,closeSync as C5,constants as wY,existsSync as mA,fchmodSync as xY,fchownSync as cA,fsyncSync as yY,lstatSync as r1,mkdirSync as kY,mkdtempSync as pA,openSync as w9,readdirSync as bY,readFileSync as _5,readlinkSync as lA,realpathSync as dA,renameSync as iA,rmSync as vY,statSync as P$,unlinkSync as gY,writeFileSync as hY}from"fs";import{randomBytes as nA}from"crypto";import{tmpdir as fY}from"os";import{basename as V6,dirname as m6,isAbsolute as uY,join as w2,relative as x9,resolve as J2,sep as A5}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 x0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),rA=new Set(Object.values(x0).map(($)=>$.toLowerCase())),sA=($,Z)=>$.toLowerCase()===Z.toLowerCase(),F9=($)=>rA.has($.toLowerCase());function F$($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var oA=/\.fafm?$/i,aA=/^[a-z][a-z0-9-]*$/,O2=($)=>dA.native($),H6=($)=>$?.code;function s1($,Z){let z=x9($,Z);return z===""||z!==".."&&!z.startsWith(`..${A5}`)&&!uY(z)}function mY($){try{return lA($)}catch{return"?"}}function tA($,Z,z,Q){let X;try{X=O2(z)}catch(J){let Y=H6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new v("dangling",Z,`${Z} is a link to ${mY(z)}, which does not exist. faf does not create files through a link — refused.`);throw J}if(!s1($,X))throw new v("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(F$(X)&&!(Q.inGit&&m6(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 eA(Z,X,Q.read),X}function eA($,Z,z){let Q=V6($),X=V6(Z),J=F9(Q)&&F9(X);if(z&&!oA.test(X)&&!J){let Y=F9(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&&!sA(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 $C($,Z,z,Q){if(V6(J2($))!=="hooks"||!aA.test(V6(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 ZC($,Z,z){if(V6($)!=="config"||z!==Z)throw new v("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function i($,Z,z={}){let Q=O2(J2($)),X=J2($,Z),J=O2(m6(X));if(!s1(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)$C($,X,Q,J);if(W)ZC(X,Q,J);let U=w2(J,V6(X));if(F$(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=r1(U)}catch(V){if(H6(V)==="ENOENT")return U;throw V}if(G.isSymbolicLink())return tA(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 zC=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function QC($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return zC.decode($)}catch{}throw new v("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function U0($){return QC(_5($),$)}function l0($){try{return _5($)}catch(Z){if(H6(Z)==="ENOENT")return null;throw Z}}function n1($,Z){let z=J2(w2($,Z));if(!mA(z))return null;let Q,X;try{Q=O2(XC($)),X=O2(z)}catch{return null}if(!s1(Q,X)||F$(x9(Q,X)))return null;return X}var j9=[];function XC($){let Z=J2($);return j9.find((z)=>Z===z||Z.startsWith(z.endsWith(A5)?z:z+A5))??Z}function S$($,Z){j9.push(J2($));try{return Z()}finally{j9.pop()}}function I($,Z){return n1($,Z)!==null}function h($,Z){let z=n1($,Z);if(z===null)return null;try{return P$(z).isFile()?_5(z,"utf-8"):null}catch{return null}}function I2($,Z){let z=n1($,Z);if(z===null)return null;try{return P$(z)}catch{return null}}function X0($,Z="."){let z=n1($,Z);if(z===null)return null;let Q;try{Q=bY(z,{withFileTypes:!0})}catch{return null}return Q.filter((X)=>!X.isSymbolicLink()||n1($,w2(Z,X.name))!==null)}function JC($){try{let Z=P$($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(H6(Z)==="ENOENT")return;throw Z}}class c2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var S9=($)=>new v("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function y9($,Z,z){if(Z!==void 0){let X=l0($),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 S9($)}if(!z)return;let Q;try{Q=P$($)}catch(X){if(H6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw S9($);try{EY($,wY.W_OK)}catch{throw S9($)}}function YC($,Z){if(process.platform!=="win32")try{cA($,Z.uid,Z.gid)}catch{}xY($,Z.mode)}function WC($){if(process.platform==="win32")return;try{let Z=w9($,"r");try{yY(Z)}finally{C5(Z)}}catch{}}function UC($,Z,z,Q){if($.fd=w9($.path,"wx",Q??z?.mode??438),$.created=!0,hY($.fd,Z),z)YC($.fd,z);if(Q!==void 0)xY($.fd,Q);yY($.fd),C5($.fd),$.fd=void 0}function GC($){if($.fd!==void 0)try{C5($.fd)}catch{}if($.created)try{gY($.path)}catch{}}function VC($,Z,z){let Q=m6($),X={path:w2(Q,`.${V6($).slice(0,100)}.${process.pid}.${nA(6).toString("hex")}.faf-tmp`),created:!1},J=JC($);try{if(J)EY($,wY.W_OK);UC(X,Z,J,z.mode),y9($,z.expect,J),iA(X.path,$)}catch(Y){if(GC(X),Y instanceof v)throw Y;let W=H6(Y)??(Y instanceof Error?Y.message:String(Y));throw new c2($,`${$}: not written${J?"; original kept":""} (${W})`,{cause:Y})}WC(Q)}function HC($){return $ instanceof v&&!$.onWrite?new v($.reason,$.path,$.message,{onWrite:!0}):$}function o($,Z,z={}){let Q=J2($),X;try{X=i(z.root??m6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw HC(J)}return VC(X,Z,z),X}function x2($,Z,z){let Q=J2($),X=z.root??m6(Q),J=i(X,Q),Y=l0(J);if(z.expect!==void 0)y9(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 o(J,Z,{root:X,expect:Y})}function j0($,Z=$){let z=J2($);kY(z,{recursive:!0});let Q=O2(z),X=J2(z,Z),J=x9(z,X);if(J===".."||J.startsWith(`..${A5}`)||uY(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=w2(Y,W);if(F$(U))throw new v("git",X,`${X} runs through ${U}, inside .git/ — refused.`,{onWrite:!0});Y=qC(Q,X,U)}return Y}function qC($,Z,z){let Q;try{Q=r1(z)}catch(J){if(H6(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 ${mY(z)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!s1($,X))throw new v("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(F$(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 R5($,Z){let z=J2($),Q=O2(J2(Z.root??m6(z))),X=O2(m6(z));if(!s1(Q,X))throw new v("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=w2(X,V6(z));if(F$(J))throw new v("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=r1(J)}catch(W){if(H6(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 y9(J,Z.expect,void 0),gY(J),!0}var E9=new Set,cY=".faf-temp",pY="faf made this temp folder; `faf clear` removes it.\n";function P5($){let Z=O2(pA(w2(fY(),$)));E9.add(Z);let z=w9(w2(Z,cY),"wx",420);try{hY(z,pY)}finally{C5(z)}return Z}function F5($){if(!E9.has($))throw Error(`${$} is not a temp folder faf made — not removed`);vY($,{recursive:!0,force:!0}),E9.delete($)}function KC($){let Z=w2($,cY);try{if(!r1(Z).isFile())return!1;return _5(Z,"utf-8")===pY}catch{return!1}}var BC=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function lY($){let Z=fY(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${BC($)}[A-Za-z0-9]{6}$`),X=0;for(let J of bY(Z)){if(!Q.test(J))continue;let Y=w2(Z,J);try{let W=r1(Y);if(!W.isDirectory()||z!==void 0&&W.uid!==z||!KC(Y))continue;vY(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function Z0($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function c6($){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 o1($,Z){if($===null||$===void 0)return{};if(!Z0($))throw new v("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${c6($)}. `+"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,$]])),dY=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),dg=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function a1($,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 ig=J0.filter(($)=>$.index<=21);var k9=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]);var t1="slotignored";function j$($){return typeof $==="string"&&$.trim()!==""&&G0($)}function G0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return k9.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var E$="no classifying signals — fallback",MC=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]),S5={skills:new Set(["stack.frontend"]),"skills-plugin":new Set(["stack.frontend","stack.runtime"])};function l6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(p6,$))return null;if(S5[$]?.has(Z.path))return!0;if(!p6[$].includes(Z.category))return!1;return!($==="framework"&&MC.has(Z.path))}var p6={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],skills:["project","human"],cli:["project","human","universal"],"skills-plugin":["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 aY=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function iY($){return typeof $==="object"&&$.collection===void 0}function LC($,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||!aY.has(Q.tag))return;let X;try{X=Q.resolve(z,()=>{return},{})}catch{return}return Object.is(A0(X)?X.value:X,$.value)?z:void 0}function NC($){let Z=$.filter(iY);return $.map((z)=>{if(!iY(z)||!aY.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,W)=>LC(X,Z)??Q(X,J,Y,W)}})}var j5={keepSourceTokens:!0,customTags:NC};function DC($,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 OC($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=DC(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function f9($,Z){let z=f6($,j5);if(z.errors.length>0){let Q=z.errors[0].message.split(`
206
206
  `)[0];throw Error(`${Z}: not valid YAML (${Q}) — faf left it unchanged.`,{cause:z.errors[0]})}return z}function d6($,Z,z,Q){$.edits.push({start:Z,end:z,text:Q,seq:$.edits.length})}function e1($,Z){return $.lastIndexOf(`
207
- `,Z-1)+1}function sY($,Z){if(Z>0&&$[Z-1]===`
207
+ `,Z-1)+1}function tY($,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 T2($){return $!==null&&$!==void 0}function l0($){let Z=D2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function oY($,Z){let z=l0($),Q=l0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function aY($){if(A0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return h6($)&&!$.flow}function S5($,Z){return $.anchor===Z.anchor&&$.tag===Z.tag&&$.comment===Z.comment&&$.commentBefore===Z.commentBefore&&!!$.spaceBefore===!!Z.spaceBefore}function tY($,Z){return Object.is($.value,Z.value)&&$.type===Z.type&&$.format===Z.format&&$.minFractionDigits===Z.minFractionDigits&&S5($,Z)}function eY($,Z,z,Q){let X=new D5(void 0,F5);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 nY($,Z){let z=Z;if($[z-1]===`
210
+ `){if(z--,$[z-1]==="\r")z--}return z}function T2($){return $!==null&&$!==void 0}function d0($){let Z=D2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function eY($,Z){let z=d0($),Q=d0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function $W($){if(A0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return h6($)&&!$.flow}function E5($,Z){return $.anchor===Z.anchor&&$.tag===Z.tag&&$.comment===Z.comment&&$.commentBefore===Z.commentBefore&&!!$.spaceBefore===!!Z.spaceBefore}function ZW($,Z){return Object.is($.value,Z.value)&&$.type===Z.type&&$.format===Z.format&&$.minFractionDigits===Z.minFractionDigits&&E5($,Z)}function zW($,Z,z,Q){let X=new I5(void 0,j5);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 y9($,Z,z){return eY($,(Q)=>{let X=new R$;return X.items.push(Q.createPair("k",Z)),X},2,z)}function KC($,Z,z){let Q=eY($,()=>{let X=new i1;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 BC($){if(!D2($)||!T2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function MC($,Z){if(!D2($)||!D2(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 LC($,Z){let z=l0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function NC($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function dY($,Z,z,Q,X=!1){let J=l0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,W=D2(z)?z.comment:void 0,U=!T2(Y)||Y===W,G=U?BC(z):z,V=X?G:MC(Z,G),H=Q.kind==="value"?y9($,V,Q.col):KC($,V,Q.col);return H?{range:J,keepTail:U,newComment:W,piece:H}:null}function DC($,Z,z,Q){if(!Q)return lY($,sY($,z[2]));return aY(Z)?lY($,z[1]):z[1]}function $8($,Z,z,Q,X){let J=dY($,Z,z,Q);if(!J)return!1;let Y=DC($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!aY(Z)||Q.kind==="item"))return OC($,J,Y,Q,X),!0;let W=J.keepTail?Z.comment:J.newComment;if(X!==void 0||T2(W))return!1;let U=Q.kind==="value"?dY($,Z,z,Q,!0):J;return U!==null&&IC($,U.range[0],Y,U.piece,Q)}function OC($,Z,z,Q,X){let[J,Y]=Z.range,U=J===Y&&Q.kind==="value"?NC($.src,J,Z.piece.text):Z.piece.text;d6($,J,z,U+(X===void 0?"":` #${X}`))}function IC($,Z,z,Q,X){if(X.kind==="item")return d6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=LC($.src,X.key);if(J<0)return!1;return d6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function TC($,Z){return S5({...$,comment:void 0},{...Z,comment:void 0})}function AC($,Z){if(T2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
213
- `)?void 0:Z.comment}function CC($,Z,z,Q){if(tY(Z,z))return!0;if(!TC(Z,z))return!1;let X=AC(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return $8($,Z,z,Q,X)}function _C($,Z,z,Q){if(!S5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return y9($,Z,0).text===y9($,z,0).text||$8($,Z,z,Q);if(z.items.length===0)return $8($,Z,z,Q);return B0(Z)?SC($,Z,z):EC($,Z,z)}function g9($,Z,z,Q){if(!oY(Z,z))return $8($,Z,z,Q);if(A0(Z))return CC($,Z,z,Q);if(u2(Z))return u2(z)&&Z.source===z.source&&S5(Z,z)||$8($,Z,z,Q);if(!h6(Z)||!h6(z))return!1;return _C($,Z,z,Q)}function $W($,Z){return Z-e1($,Z)}function h9($,Z,z){let Q=$.slice(e1($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function k9($){return D2($)&&(T2($.commentBefore)||!!$.spaceBefore)}function f9($,Z,z){let Q=l0(Z)??l0(z);return Q?sY($.src,Q[2]):-1}function ZW($,Z,z){let Q=new D5(void 0,F5);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 RC($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
215
- `);d6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function zW($,Z,z,Q,X,J){let Y=z;if(Y<0){let W=l0(Z);if(!W||k9(Z)||!h9($.src,W[0],J))return!1;Y=e1($.src,W[0])}return RC($,Y,ZW($,Q,X)),!0}function PC($,Z,z){let Q=e1($,z),X=Z,J=T2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let W=e1($,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 QW($,Z,z,Q){let X=l0(Z);if(!X||!h9($.src,X[0],Q))return!1;let J=f9($,z,Z);if(J<0)return!1;return d6($,PC($.src,Z,X[0]),J,""),!0}function XW($,Z){let z=new Map,Q=(X)=>{let J=l0(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&&oY(Z($[Y]),Z(X))?Y:-1}}function FC($,Z){return A0($)&&A0(Z)?tY($,Z):$===Z}function SC($,Z,z){let Q=Z.items[0]?.key,X=l0(Q);if(!X)return!1;let J=$W($.src,X[0]),Y=new Set,W=(H,q)=>{if(H.length===0)return!0;let K=new R$;K.items.push(...H);let M=q<0?-1:f9($,Z.items[q].value,Z.items[q].key);return zW($,Q,M,K,J,!1)},U=XW(Z.items,(H)=>H.key),G=-1,V=[];for(let H of z.items){let q=U(H);if(q<0){V.push(H);continue}if(q<=G||!W(V,G)||!FC(Z.items[q].key,H.key))return!1;if(V=[],!g9($,Z.items[q].value,H.value,{kind:"value",key:Z.items[q].key,col:J}))return!1;Y.add(q),G=q}if(!W(V,G))return!1;return Z.items.every((H,q)=>Y.has(q)||jC($,Z,q))}function jC($,Z,z){let Q=Z.items[z],X=l0(Q.key);if(!X)return!1;if(h9($.src,X[0],!1))return QW($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=l0(J?.key);if(z!==0||!Y||k9(Q.key)||k9(J.key))return!1;return d6($,X[0],Y[0],""),!0}function EC($,Z,z){let Q=l0(Z);if(!Q||Z.items.length===0)return!1;let X=$W($.src,Q[0]),J=new Set,Y=(V,H)=>{if(V.length===0)return!0;let q=new i1;q.items.push(...V);let K=H<0?-1:f9($,Z.items[H]);return zW($,Z.items[0],K,q,X,!0)},W=XW(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=[],!g9($,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)||QW($,V,V,!0))}function wC($,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 xC($,Z,z){if(!B0(z)&&!m2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
216
- `)?$.eol:"",X=Z.commentBefore?$.eol:"";return d6($,$.src.length,$.src.length,Q+X+ZW($,z,0)),!0}function yC($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!T2(Q))return!T2(X)||xC($,Z,X);return T2(X)&&g9($,Q,X,{kind:"root"})}function kC($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!yC(J,Z,z))return null;return wC($,J.edits)}var iY=($)=>$.replace(/^[ \t]*\n/gm,"");function bC($,Z,z,Q){let X=f6($,F5);if(X.errors.length>0||!M0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||iY(J)===iY(z)}function j5($,Z,z="YAML"){let{text:Q,changed:X}=vC($,Z,z);return{text:Q,changed:X}}function vC($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=v9(X,z),Y=gC(J);Z(Y);let W={text:$,changed:!1,spliced:!1};if(M0(Y.toJS(),J.toJS()))return W;let U={lineWidth:0,...qC(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 v9($,Z,z){return zW($,(Q)=>{let X=new R$;return X.items.push(Q.createPair("k",Z)),X},2,z)}function IC($,Z,z){let Q=zW($,()=>{let X=new i1;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 TC($){if(!D2($)||!T2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function AC($,Z){if(!D2($)||!D2(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 CC($,Z){let z=d0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function _C($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function rY($,Z,z,Q,X=!1){let J=d0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,W=D2(z)?z.comment:void 0,U=!T2(Y)||Y===W,G=U?TC(z):z,V=X?G:AC(Z,G),H=Q.kind==="value"?v9($,V,Q.col):IC($,V,Q.col);return H?{range:J,keepTail:U,newComment:W,piece:H}:null}function RC($,Z,z,Q){if(!Q)return nY($,tY($,z[2]));return $W(Z)?nY($,z[1]):z[1]}function $4($,Z,z,Q,X){let J=rY($,Z,z,Q);if(!J)return!1;let Y=RC($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!$W(Z)||Q.kind==="item"))return PC($,J,Y,Q,X),!0;let W=J.keepTail?Z.comment:J.newComment;if(X!==void 0||T2(W))return!1;let U=Q.kind==="value"?rY($,Z,z,Q,!0):J;return U!==null&&FC($,U.range[0],Y,U.piece,Q)}function PC($,Z,z,Q,X){let[J,Y]=Z.range,U=J===Y&&Q.kind==="value"?_C($.src,J,Z.piece.text):Z.piece.text;d6($,J,z,U+(X===void 0?"":` #${X}`))}function FC($,Z,z,Q,X){if(X.kind==="item")return d6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=CC($.src,X.key);if(J<0)return!1;return d6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function SC($,Z){return E5({...$,comment:void 0},{...Z,comment:void 0})}function jC($,Z){if(T2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
213
+ `)?void 0:Z.comment}function EC($,Z,z,Q){if(ZW(Z,z))return!0;if(!SC(Z,z))return!1;let X=jC(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return $4($,Z,z,Q,X)}function wC($,Z,z,Q){if(!E5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return v9($,Z,0).text===v9($,z,0).text||$4($,Z,z,Q);if(z.items.length===0)return $4($,Z,z,Q);return B0(Z)?bC($,Z,z):gC($,Z,z)}function u9($,Z,z,Q){if(!eY(Z,z))return $4($,Z,z,Q);if(A0(Z))return EC($,Z,z,Q);if(u2(Z))return u2(z)&&Z.source===z.source&&E5(Z,z)||$4($,Z,z,Q);if(!h6(Z)||!h6(z))return!1;return wC($,Z,z,Q)}function QW($,Z){return Z-e1($,Z)}function m9($,Z,z){let Q=$.slice(e1($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function g9($){return D2($)&&(T2($.commentBefore)||!!$.spaceBefore)}function c9($,Z,z){let Q=d0(Z)??d0(z);return Q?tY($.src,Q[2]):-1}function XW($,Z,z){let Q=new I5(void 0,j5);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 xC($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
215
+ `);d6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function JW($,Z,z,Q,X,J){let Y=z;if(Y<0){let W=d0(Z);if(!W||g9(Z)||!m9($.src,W[0],J))return!1;Y=e1($.src,W[0])}return xC($,Y,XW($,Q,X)),!0}function yC($,Z,z){let Q=e1($,z),X=Z,J=T2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let W=e1($,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 YW($,Z,z,Q){let X=d0(Z);if(!X||!m9($.src,X[0],Q))return!1;let J=c9($,z,Z);if(J<0)return!1;return d6($,yC($.src,Z,X[0]),J,""),!0}function WW($,Z){let z=new Map,Q=(X)=>{let J=d0(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&&eY(Z($[Y]),Z(X))?Y:-1}}function kC($,Z){return A0($)&&A0(Z)?ZW($,Z):$===Z}function bC($,Z,z){let Q=Z.items[0]?.key,X=d0(Q);if(!X)return!1;let J=QW($.src,X[0]),Y=new Set,W=(H,q)=>{if(H.length===0)return!0;let K=new R$;K.items.push(...H);let L=q<0?-1:c9($,Z.items[q].value,Z.items[q].key);return JW($,Q,L,K,J,!1)},U=WW(Z.items,(H)=>H.key),G=-1,V=[];for(let H of z.items){let q=U(H);if(q<0){V.push(H);continue}if(q<=G||!W(V,G)||!kC(Z.items[q].key,H.key))return!1;if(V=[],!u9($,Z.items[q].value,H.value,{kind:"value",key:Z.items[q].key,col:J}))return!1;Y.add(q),G=q}if(!W(V,G))return!1;return Z.items.every((H,q)=>Y.has(q)||vC($,Z,q))}function vC($,Z,z){let Q=Z.items[z],X=d0(Q.key);if(!X)return!1;if(m9($.src,X[0],!1))return YW($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=d0(J?.key);if(z!==0||!Y||g9(Q.key)||g9(J.key))return!1;return d6($,X[0],Y[0],""),!0}function gC($,Z,z){let Q=d0(Z);if(!Q||Z.items.length===0)return!1;let X=QW($.src,Q[0]),J=new Set,Y=(V,H)=>{if(V.length===0)return!0;let q=new i1;q.items.push(...V);let K=H<0?-1:c9($,Z.items[H]);return JW($,Z.items[0],K,q,X,!0)},W=WW(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=[],!u9($,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)||YW($,V,V,!0))}function hC($,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 fC($,Z,z){if(!B0(z)&&!m2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
216
+ `)?$.eol:"",X=Z.commentBefore?$.eol:"";return d6($,$.src.length,$.src.length,Q+X+XW($,z,0)),!0}function uC($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!T2(Q))return!T2(X)||fC($,Z,X);return T2(X)&&u9($,Q,X,{kind:"root"})}function mC($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!uC(J,Z,z))return null;return hC($,J.edits)}var sY=($)=>$.replace(/^[ \t]*\n/gm,"");function cC($,Z,z,Q){let X=f6($,j5);if(X.errors.length>0||!M0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||sY(J)===sY(z)}function w5($,Z,z="YAML"){let{text:Q,changed:X}=pC($,Z,z);return{text:Q,changed:X}}function pC($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=f9(X,z),Y=lC(J);Z(Y);let W={text:$,changed:!1,spliced:!1};if(M0(Y.toJS(),J.toJS()))return W;let U={lineWidth:0,...OC(X)},G=Y.toString(U);if(G===J.toString(U))return W;let V=X.includes(`\r
217
217
  `)?`\r
218
218
  `:`
219
- `,H=kC(X,J,Y,V,{...U,verifyAliasOrder:!1}),q=H!==null&&bC(H,Y,G,U),K=q&&H!==null?H:G.replace(/\r?\n/g,V);return{text:Q+K,changed:Q+K!==$,spliced:q}}function gC($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function M0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>M0(z,Z[Q]));if(Z0($)&&Z0(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&M0($[Q],Z[Q]))}return!1}function z8($){let Z=A0($.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)=>z8(z)===Z)}function JW($,Z){return D2(Z)?Z.toJS($):Z}function hC($,Z,z,Q){return Q.keepAliases===!0&&u2(Z)||M0(JW($,Z),z)}function E5($,Z,z,Q={}){if(hC($,Z,z,Q))return Z;if(Z0(z)&&B0(Z))return uC($,Z,z,Q),Z;if(Array.isArray(z)&&m2(Z))return pC($,Z,z,Q),Z;if(!Z0(z)&&!Array.isArray(z)&&A0(Z))return Z.value=z,Z;return fC(Z,$.createNode(z))}function fC($,Z){if(!A0($)&&!u2($))return Z;let z=$,Q=Z;if(h6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=x9(Q.commentBefore,z.commentBefore,z.comment),Z;if(h6(Z))Z.flow=!0;return Q.comment=x9(Q.comment??z.comment),Q.commentBefore=x9(Q.commentBefore??z.commentBefore),Z}function x9(...$){let Z=$.filter(T2);return Z.length>0?Z.join(`
220
- `):void 0}function uC($,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=E5($,Y.value,J,Q);else Z.items.push($.createPair(X,J))}if(!Q.prune)return;Z.items=Z.items.filter((X)=>{let J=z8(X);return J===void 0||z[J]!==void 0})}function u9($,Z,z,Q){let X=Z0(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)&&M0(X[J],Y))continue;else if(Z0(Y)&&Z0(X[J])&&B0(W.value))u9($,W.value,X[J],Y);else W.value=E5($,W.value,Y,{keepAliases:!0})}}function Z8($,Z,z){if(u2($))z.push({path:[...Z],node:$});else if(B0($))for(let Q of $.items){let X=z8(Q);if(X!==void 0)Z8(Q.value,[...Z,X],z)}else if(m2($))$.items.forEach((Q,X)=>Z8(Q,[...Z,X],z))}function nY($,Z){let z=$;for(let Q of Z)if(Array.isArray(z)&&typeof Q==="number")z=z[Q];else if(Z0(z)&&typeof Q==="string")z=z[Q];else return;return z}function YW($,Z,z){let Q=[];return Z8($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=nY(Z,X);return Y!==void 0&&!M0(nY(z,X),Y)&&!M0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function WW($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=mC(z,Z[X]);let Q=Z[Z.length-1];if(B0(z)&&typeof Q==="string"){let X=B6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(m2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>l0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function mC($,Z){if(B0($)&&typeof Z==="string")return B6($,Z)?.value;if(m2($)&&typeof Z==="number")return $.items[Z];return}function UW($,Z){let z=[];Z8($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=WW(Z,X);if(!Y||u2(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 b9($,Z,z,Q){if(!D2($)||u2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(B0($))for(let J of $.items){let Y=z8(J);if(Y!==void 0)b9(J.value,[...Z,Y],z,Q)}else if(m2($))$.items.forEach((J,Y)=>b9(J,[...Z,Y],z,Q))}function GW($,Z){let z=[];Z8($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];b9($.contents,[],Q,X);let J=[];for(let{path:Y,node:W}of X){let U=WW(Z,Y);if(!U)continue;let G=W.anchor;if(D2(U.node)&&U.node.anchor===G&&M0(W.toJS($),U.node.toJS(Z))||!U.put(W.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function cC($,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]=M0($[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(M0($[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 pC($,Z,z,Q){let X=Z.items,J=X.map((G)=>JW($,G)),Y=[],W=0,U=0;for(let[G,V]of[...cC(J,z),[X.length,z.length]]){for(;W<G&&U<V;W++,U++)Y.push(E5($,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 Q8($,Z,z,Q){if(M0(z,Q))return Z;if(!Z0(z)||!Z0(Q)||!B0(Z))return E5($,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=z8(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(!M0(z[J],Y))W.value=Q8($,W.value,z[J],Y)}return Z}function VW($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new R$,Q=$.contents;if(!B0(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&&B0(Y.value)){X=Y.value;continue}if(Y&&!KW(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let W=new R$;if(Y)Y.value=qW(Y.value,W);else X.items.push($.createPair(J,W));X=W}return X}function w5($,Z,z,Q,X){if(M0(z,Q))return;let J=VW($,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=Q8($,W.value,z,Q)}function HW($,Z,z){let Q=VW($,Z.slice(0,-1),z),X=Z[Z.length-1],J=B6(Q,X);if(J&&m2(J.value))return J.value;if(J&&!KW(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new i1;if(J)J.value=qW(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function qW($,Z){if(!A0($))return Z;let z=[$.commentBefore,$.comment].filter(T2);if(z.length>0)Z.commentBefore=z.join(`
221
- `);return Z}function KW($){if($===null||$===void 0)return!0;return A0($)&&($.value===null||$.value===void 0)}var m9=new WeakMap;function X8($){return typeof $==="object"&&$!==null?m9.get($):void 0}function x5($,Z){m9.set($,Z)}function BW($,Z){let z=X8($);if(z)m9.set(Z,z);return Z}var MW=new WeakSet;function LW($){return MW.add($),$}function NW($){return typeof $==="object"&&$!==null&&MW.has($)}function k5($){let Z=w$($);return i(y5(Z),Z,{read:!0})}function c9($){return $ instanceof ReferenceError&&/Excessive alias count/.test($.message)}function p9($){if($ instanceof O5||c9($))return $;let Z=$?.cause;return Z instanceof O5||c9(Z)?Z:null}function l9($,Z){let z=c9(Z)?"its aliases expand too far":Z.message.split(`
219
+ `,H=mC(X,J,Y,V,{...U,verifyAliasOrder:!1}),q=H!==null&&cC(H,Y,G,U),K=q&&H!==null?H:G.replace(/\r?\n/g,V);return{text:Q+K,changed:Q+K!==$,spliced:q}}function lC($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function M0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>M0(z,Z[Q]));if(Z0($)&&Z0(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&M0($[Q],Z[Q]))}return!1}function z4($){let Z=A0($.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)=>z4(z)===Z)}function UW($,Z){return D2(Z)?Z.toJS($):Z}function dC($,Z,z,Q){return Q.keepAliases===!0&&u2(Z)||M0(UW($,Z),z)}function x5($,Z,z,Q={}){if(dC($,Z,z,Q))return Z;if(Z0(z)&&B0(Z))return nC($,Z,z,Q),Z;if(Array.isArray(z)&&m2(Z))return oC($,Z,z,Q),Z;if(!Z0(z)&&!Array.isArray(z)&&A0(Z))return Z.value=z,Z;return iC(Z,$.createNode(z))}function iC($,Z){if(!A0($)&&!u2($))return Z;let z=$,Q=Z;if(h6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=b9(Q.commentBefore,z.commentBefore,z.comment),Z;if(h6(Z))Z.flow=!0;return Q.comment=b9(Q.comment??z.comment),Q.commentBefore=b9(Q.commentBefore??z.commentBefore),Z}function b9(...$){let Z=$.filter(T2);return Z.length>0?Z.join(`
220
+ `):void 0}function nC($,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=x5($,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 p9($,Z,z,Q){let X=Z0(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)&&M0(X[J],Y))continue;else if(Z0(Y)&&Z0(X[J])&&B0(W.value))p9($,W.value,X[J],Y);else W.value=x5($,W.value,Y,{keepAliases:!0})}}function Z4($,Z,z){if(u2($))z.push({path:[...Z],node:$});else if(B0($))for(let Q of $.items){let X=z4(Q);if(X!==void 0)Z4(Q.value,[...Z,X],z)}else if(m2($))$.items.forEach((Q,X)=>Z4(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(Z0(z)&&typeof Q==="string")z=z[Q];else return;return z}function GW($,Z,z){let Q=[];return Z4($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=oY(Z,X);return Y!==void 0&&!M0(oY(z,X),Y)&&!M0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function VW($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=rC(z,Z[X]);let Q=Z[Z.length-1];if(B0(z)&&typeof Q==="string"){let X=K6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(m2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>d0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function rC($,Z){if(B0($)&&typeof Z==="string")return K6($,Z)?.value;if(m2($)&&typeof Z==="number")return $.items[Z];return}function HW($,Z){let z=[];Z4($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=VW(Z,X);if(!Y||u2(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 h9($,Z,z,Q){if(!D2($)||u2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(B0($))for(let J of $.items){let Y=z4(J);if(Y!==void 0)h9(J.value,[...Z,Y],z,Q)}else if(m2($))$.items.forEach((J,Y)=>h9(J,[...Z,Y],z,Q))}function qW($,Z){let z=[];Z4($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];h9($.contents,[],Q,X);let J=[];for(let{path:Y,node:W}of X){let U=VW(Z,Y);if(!U)continue;let G=W.anchor;if(D2(U.node)&&U.node.anchor===G&&M0(W.toJS($),U.node.toJS(Z))||!U.put(W.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function sC($,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]=M0($[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(M0($[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 oC($,Z,z,Q){let X=Z.items,J=X.map((G)=>UW($,G)),Y=[],W=0,U=0;for(let[G,V]of[...sC(J,z),[X.length,z.length]]){for(;W<G&&U<V;W++,U++)Y.push(x5($,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 Q4($,Z,z,Q){if(M0(z,Q))return Z;if(!Z0(z)||!Z0(Q)||!B0(Z))return x5($,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=K6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(!M0(z[J],Y))W.value=Q4($,W.value,z[J],Y)}return Z}function KW($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new R$,Q=$.contents;if(!B0(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&&B0(Y.value)){X=Y.value;continue}if(Y&&!LW(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let W=new R$;if(Y)Y.value=MW(Y.value,W);else X.items.push($.createPair(J,W));X=W}return X}function y5($,Z,z,Q,X){if(M0(z,Q))return;let J=KW($,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=Q4($,W.value,z,Q)}function BW($,Z,z){let Q=KW($,Z.slice(0,-1),z),X=Z[Z.length-1],J=K6(Q,X);if(J&&m2(J.value))return J.value;if(J&&!LW(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new i1;if(J)J.value=MW(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function MW($,Z){if(!A0($))return Z;let z=[$.commentBefore,$.comment].filter(T2);if(z.length>0)Z.commentBefore=z.join(`
221
+ `);return Z}function LW($){if($===null||$===void 0)return!0;return A0($)&&($.value===null||$.value===void 0)}var l9=new WeakMap;function X4($){return typeof $==="object"&&$!==null?l9.get($):void 0}function k5($,Z){l9.set($,Z)}function NW($,Z){let z=X4($);if(z)l9.set(Z,z);return Z}var DW=new WeakSet;function OW($){return DW.add($),$}function IW($){return typeof $==="object"&&$!==null&&DW.has($)}function v5($){let Z=w$($);return i(b5(Z),Z,{read:!0})}function d9($){return $ instanceof ReferenceError&&/Excessive alias count/.test($.message)}function i9($){if($ instanceof T5||d9($))return $;let Z=$?.cause;return Z instanceof T5||d9(Z)?Z:null}function n9($,Z){let z=d9(Z)?"its aliases expand too far":Z.message.split(`
222
222
  `)[0].replace(/ at line \d+, column \d+:?\s*$/,"").replace(/:\s*$/,""),Q=Z.linePos?.[0]?.line,X=w$($);return new v("not-yaml",X,`${X} is not valid YAML (${z}${Q===void 0?"":`, line ${Q}`}) — faf left it unchanged`,{cause:Z})}function a($,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=w$($);throw new v("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function e($){let Z=k5($),z=U0(Z),Q;try{Q=f0(z)}catch(J){let Y=p9(J);if(Y)throw l9($,Y);throw J}let X=o1(Q,$);return x5(X,{real:Z,text:z}),X}function d9($){let Z=$._meta,z={...$};delete z._meta;let Q=u6(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 iC($,Z,z,Q,X=!1){let J=k5($),Y=U0(J),W=[],U;try{U=j5(Y,(G)=>{AW(G,$);let V=G.clone();if(Z(G),W=UW(V,G),X)W=[...W,...GW(V,G)];if(Q)W=[...W,...Q(G,V.toJS()).filter((H)=>!W.some((q)=>q.path===H.path))]},$)}catch(G){let V=p9(G);if(V)throw l9($,V);throw G}if(!U.changed)return{written:!1,text:Y,keptAliases:W};return o($,U.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:U.text,keptAliases:W}}function y2($){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 OW($){try{return TW($),!0}catch{return!1}}function nC($){let Z=$.getIn(["project","type"],!0);return A0(Z)?Z.value:Z}function AW($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!B0(z))throw new v("not-yaml",w$(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${c6($.toJS())}. faf left it unchanged — fix it by hand.`)}function rC($,Z,z){AW($,z);let Q=$.contents,X=B0(Q)&&Q.items.some((V)=>A0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,W=nC($),U=B0(Q)?$.toJS():{},G=B0(Q)?Q:$.createNode({});if($.contents=G,u9($,G,U,X?{...Z}:Y),!X)oC($,J?.found,W)}function sC($,Z){let z=$.contents;if(B0(z)&&z.items.some((J)=>A0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function oC($,Z,z){if(!Z||Z.length===0||!G0(z))return;let Q=$.getIn(["project","type"],!0);if(A0(Q)&&!G0(Q.value)&&(Q.comment===null||Q.comment===void 0))Q.comment=` found: ${Z.join(" + ")}`}function k0($,Z,z={}){if(!z.replace&&OW($)){let W=iC($,(U)=>rC(U,Z,$),X8(Z),(U,G)=>YW(U,sC(U,Z),G),NW(Z));x5(Z,{real:k5($),text:W.text});for(let U of W.keptAliases??[])z.onAliasKept?.(U);return W.written}let Q=w$($),X=d9(Z),J=OW($)?y0(i(y5(Q),Q)):null,Y=o($,X,{expect:J});return x5(Z,{real:Y,text:X}),!0}function p($){return U0(k5($))}function Y2($,Z){let z;try{z=f0($)}catch(Q){let X=p9(Q);if(Z!==void 0&&X)throw l9(Z,X);throw Q}return Z===void 0?z:o1(z,Z)}function IW($,Z){let z;try{z=TW(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return i($,w$(Z),{read:!0}),!0}function m($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=DW($,Q);if(IW($,X))return X}let z=y5($);if(z!==$)for(let Q of Z){let X=DW(z,Q);if(IW(z,X))return X}return null}function x$($,Z=process.cwd()){return dC("git",["-C",y5($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+lC($)}l();var y$=[{name:"TROPHY",indicator:`${R0("✪")} ${R0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${R0(C("★"))} ${R0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${A("◆")} ${A("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${v5("◇")} ${v5("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${C("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${L("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${L("○")} RED`,threshold:1},{name:"WHITE",indicator:`${L("♡")}`,threshold:0}];function A2($){return $.indicator}function M6($){for(let Z of y$)if($>=Z.threshold)return Z;return y$[y$.length-1]}var s9=null;function Y8(){if(s9)return s9;try{let $=n0("faf-scoring-kernel");return s9=$,$}catch{throw Error(`faf-scoring-kernel not installed.
223
+ `)[0].trim(),X=w$($);throw new v("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function e($){let Z=v5($),z=U0(Z),Q;try{Q=h0(z)}catch(J){let Y=i9(J);if(Y)throw n9($,Y);throw J}let X=o1(Q,$);return k5(X,{real:Z,text:z}),X}function r9($){let Z=$._meta,z={...$};delete z._meta;let Q=u6(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 eC($,Z,z,Q,X=!1){let J=v5($),Y=U0(J),W=[],U;try{U=w5(Y,(G)=>{RW(G,$);let V=G.clone();if(Z(G),W=HW(V,G),X)W=[...W,...qW(V,G)];if(Q)W=[...W,...Q(G,V.toJS()).filter((H)=>!W.some((q)=>q.path===H.path))]},$)}catch(G){let V=i9(G);if(V)throw n9($,V);throw G}if(!U.changed)return{written:!1,text:Y,keptAliases:W};return o($,U.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:U.text,keptAliases:W}}function y2($){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 AW($){try{return _W($),!0}catch{return!1}}function $_($){let Z=$.getIn(["project","type"],!0);return A0(Z)?Z.value:Z}function RW($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!B0(z))throw new v("not-yaml",w$(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${c6($.toJS())}. faf left it unchanged — fix it by hand.`)}function Z_($,Z,z){RW($,z);let Q=$.contents,X=B0(Q)&&Q.items.some((V)=>A0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,W=$_($),U=B0(Q)?$.toJS():{},G=B0(Q)?Q:$.createNode({});if($.contents=G,p9($,G,U,X?{...Z}:Y),!X)Q_($,J?.found,W)}function z_($,Z){let z=$.contents;if(B0(z)&&z.items.some((J)=>A0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function Q_($,Z,z){if(!Z||Z.length===0||!G0(z))return;let Q=$.getIn(["project","type"],!0);if(A0(Q)&&!G0(Q.value)&&(Q.comment===null||Q.comment===void 0))Q.comment=` found: ${Z.join(" + ")}`}function y0($,Z,z={}){if(!z.replace&&AW($)){let W=eC($,(U)=>Z_(U,Z,$),X4(Z),(U,G)=>GW(U,z_(U,Z),G),IW(Z));k5(Z,{real:v5($),text:W.text});for(let U of W.keptAliases??[])z.onAliasKept?.(U);return W.written}let Q=w$($),X=r9(Z),J=AW($)?l0(i(b5(Q),Q)):null,Y=o($,X,{expect:J});return k5(Z,{real:Y,text:X}),!0}function p($){return U0(v5($))}function Y2($,Z){let z;try{z=h0($)}catch(Q){let X=i9(Q);if(Z!==void 0&&X)throw n9(Z,X);throw Q}return Z===void 0?z:o1(z,Z)}function CW($,Z){let z;try{z=_W(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return i($,w$(Z),{read:!0}),!0}function m($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=TW($,Q);if(CW($,X))return X}let z=b5($);if(z!==$)for(let Q of Z){let X=TW(z,Q);if(CW(z,X))return X}return null}function x$($,Z=process.cwd()){return tC("git",["-C",b5($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+aC($)}l();var y$=[{name:"TROPHY",indicator:`${R0("✪")} ${R0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${R0(C("★"))} ${R0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${A("◆")} ${A("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${h5("◇")} ${h5("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 A2($){return $.indicator}function B6($){for(let Z of y$)if($>=Z.threshold)return Z;return y$[y$.length-1]}var t9=null;function Y4(){if(t9)return t9;try{let $=c0("faf-scoring-kernel");return t9=$,$}catch{throw Error(`faf-scoring-kernel not installed.
224
224
 
225
225
  Run: npm install faf-scoring-kernel
226
- `)}}var o9=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function eC($){let Z={};for(let[z,Q]of Object.entries($.slots??{}))Z[cY.get(z)??z]=Q;return{...$,slots:Z}}function P0($){return eC(JSON.parse(Y8().score_faf(o9($))))}function _W($){return Y8().validate_faf(o9($))}function g5($){return Y8().compile_fafb(o9($))}function RW($){return JSON.parse(Y8().decompile_fafb($))}function PW(){return Y8().sdk_version()}var FW=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function SW($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function jW($){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 a9($){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 N0($){let Z=jW($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?M6(z):y$[y$.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 $_($,Z){let[z,Q]=Z.split("."),X=$[z];return Z0(X)?X[Q]:void 0}function t9($){try{let Z=f6($,{logLevel:"error"}).getIn(["project","type"],!0);return A0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(E$)}catch{return!1}}function Z_($,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 z_($){try{let Z=f6($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return Z0(z)?z:null}catch{return null}}function h5($,Z,z={}){let Q=z_($);if(Q===null)return[];let X=Z0(Q.project)&&!t9($)?Q.project.type:void 0,J=[];for(let Y of J0){let W=$_(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!j$(W))continue;let U=p6.library.includes(Y.category),G=Z_(Y.path,String(W).trim(),l6(X,Y),U,z.outOfType!==!1);if(G!==null)J.push(G)}return J}l();l();import{existsSync as Q_,readFileSync as X_}from"fs";import{join as EW}from"path";import{homedir as J_}from"os";var Y_=95,W_=30,U_=3,e9=EW(J_(),".config","faf"),$3=EW(e9,"star-nudge"),G_="github.com/Wolfe-Jam/faf-cli";function V_($){if($.score<Y_)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??U_))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??W_)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function H_(){try{if(!Q_($3))return{shown:0,lastShownMs:null};let $=X_($3,"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 q_($){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 K_($,Z){try{j0(e9),x2($3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:e9,owns:q_,mark:"faf star-nudge state"})}catch{}}function wW($){let Z=Date.now(),z=H_();if(!V_({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(` ${R0("★")} ${L("Enjoying faf-cli? A star helps others find it:")} ${G_}`),K_(z.shown,Z)}function E0($,Z,z=!1,Q=[]){if($.unknown){let Y=$.represents?`about-repo for ${$.represents}`:"about-repo";console.log(`${L("—")} ${C("unknown")} ${L(`${Y} — no about.source_score`)} ${L("—")} ${Z}`);return}let X=A2($.tier),J=C(`${$.score}%`);if(console.log(`${X} ${J} ${L(`${$.populated}/${$.active} slots`)} ${L("—")} ${Z}`),$.tier.name==="TROPHY")console.log(L(" 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(L(` ${$.empty} ${G} from Trophy: ${W}${U}`))}if(B_(Q),z)console.log(""),M_($);wW($.score)}function B_($){for(let Z of $)console.log(L(` ${Z}`))}function M_($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?A("●"):z==="slotignored"?L("—"):L("○");console.log(` ${Q} ${z==="slotignored"?L(`${Z}: slotignored`):Z}`)}}l();function f5($,Z={}){let z=$??m();if(!z)console.error(`Error: project.faf not found
227
-
228
- Run 'faf init' to create one.`),process.exit(2);let Q=p(z);Y2(Q,z);let X=a(z,()=>N0(Q));if(Z.json){let J=e(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(a9(X))}`:`${A2(X.tier)} ${C(a9(X))}`);return}E0(X,z,Z.verbose,h5(Q,X))}import{existsSync as RU}from"fs";import{join as C3}from"path";var k$="3.0";import{join as dW}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:"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 N_}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 D_=b$.flutterDeps,O_=b$.mcpDeps,I_=b$.serverFrameworks,T_=b$.stateManagement,A_=b$.routing;function C_($){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 u5($){let Z=h($,"pubspec.yaml");if(Z===null)return null;let z=C_(Z),Q=(_)=>z.has(_.toLowerCase()),X=D_.some(Q)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),J=O_.find(Q),Y=I_.find(([_])=>Q(_)),W=T_.find(([_])=>Q(_)),U=W?W[1]:"",G=A_.find(([_])=>Q(_)),V=G?G[1]:"",H=Q("flutter_test")?"flutter_test":Q("test")?"test":"",q=/^executables:\s*$/m.test(Z),K=(X0($,"bin")??[]).some((_)=>_.name.endsWith(".dart")),M=q||K,B,N="",O;if(X)if(N="Flutter",I($,N_("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))B="mobile",O="pubspec.yaml (Flutter app)";else B="library",O="pubspec.yaml (Flutter package)";else if(J)B="mcp",O=`pubspec.yaml + ${J} (Dart MCP server)`;else if(Y)B="backend",N=Y[1],O=`pubspec.yaml + ${Y[0]} (Dart backend)`;else if(M)B="cli",O=q?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else B="library",O="pubspec.yaml (Dart package)";return{appType:B,isFlutter:X,framework:N,stateManagement:U,routing:V,testing:H,found:O}}import{join as R_}from"path";var m5={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 P_=m5.mcpModules,F_=m5.serverFrameworks,S_=m5.cliFrameworks;function j_($){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 kW($,Z){let z=Z.toLowerCase();for(let Q of $)if(Q===z||Q.startsWith(`${z}/`))return!0;return!1}function yW($,Z){let z;for(let Q of Z){if(!kW($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function E_($,Z){let z;for(let Q of Z){if(!kW($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function w_($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function x_($){for(let{name:Z}of X0($,"cmd")??[]){let z=R_("cmd",Z),Q=I2($,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 y_($){let Z=h($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function c5($){let Z=h($,"go.mod");if(Z===null)return null;let z=w_(Z),Q=j_(Z),X=E_(Q,P_),J=yW(Q,F_),Y=yW(Q,S_),W=x_($),U=y_($),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 i6={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 b_=i6.mcpPackages.map(($)=>$.toLowerCase()),v_=i6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),g_=i6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),h_=i6.grpcServerPackages.map(($)=>$.toLowerCase()),f_=i6.specializedSdks,bW=i6.baseSdk.toLowerCase();function u_($){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($),q=new Set;for(let M of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))q.add(M[1].toLowerCase());for(let M of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))q.add(M[1].toLowerCase());let K=new Set;for(let M of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(M[1].toLowerCase());return{sdk:Q,outputType:X,targetFramework:W,isTestProject:U,useMaui:G,useWpf:V,useWindowsForms:H,packages:q,frameworkRefs:K}}function Z3($,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 vW($,Z){let z;for(let[Q,X]of Z){if(!Z3($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function m_($){let Z;for(let z of b_){if(!Z3($,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 c_($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of f_){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function p5($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function p_($,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 l_($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,W,U="",G,V=m_(X),H=c_(Q),q=vW(X,g_),K=vW(X,v_),M=h_.some((N)=>Z3(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"||q)W="library",U=q?.[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=M?"gRPC":H[2],G=`${Z} + Sdk=${H[0]}${M?" + 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&&p5(Y))W="backend",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!p5(Y))W="library",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(K&&(p5(Y)||!Y))W="cli",U=K[1],G=`${Z} + ${K[0]} (C# CLI)`;else if(p5(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()===bW||Q.toLowerCase().startsWith(`${bW}/`))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 l5($){let Z=v$($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=h($,X);if(J===null)continue;let Y=u_(J),W=l_(Y,X),U=p_(W.appType,W.framework);if(!z||U<Q)z=W,Q=U}return z}import{join as n6}from"path";var C2={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 i_=C2.mcpArtifacts.map(($)=>$.toLowerCase()),n_=C2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),r_=C2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),s_=C2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),mh=C2.androidPlugins.map(($)=>$.toLowerCase()),o_=C2.kmpPlugins.map(($)=>$.toLowerCase()),a_=C2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),t_=C2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),e_=C2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),$R=C2.libraryPlugins.map(($)=>$.toLowerCase()),ZR=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function z3($){return ZR.some((Z)=>I($,Z))}function zR($){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(),q=G[1].toLowerCase();z.set(q,H),z.set(q.replace(/-/g,"."),H);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let H=V[1].toLowerCase(),q=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let K=q.split(":")[0].toLowerCase();Z.set(H,K),Z.set(H.replace(/-/g,"."),K)}else if(Q==="libraries"||Q.endsWith(".libraries")){let K=q.split(":");if(K.length>=2){let M=`${K[0]}:${K[1]}`.toLowerCase();z.set(H,M),z.set(H.replace(/-/g,"."),M)}}}}return{plugins:Z,libraries:z}}function QR($){let Z=h($,n6("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return zR(Z)}function XR($){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 JR($,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 YR($,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 fW($){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 p2($,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 W8($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=p2($,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 WR($){let Z;for(let z of i_)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 uW($,Z){let z=new Set,Q=!1,X=!1,J=[n6(Z,"src"),n6(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=n6(W,V),q=I2($,H);if(!q)continue;if(q.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 UR($){let Z=[],z=$.plugins,Q=$.artifacts,X=o_.some((S)=>p2(z,S))||$.sourceHints.has("commonMain"),J=p2(z,"com.android.application"),Y=p2(z,"com.android.library")||p2(z,"com.android.kotlin.multiplatform.library");if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let W=WR(Q),U=W8(z,n_,"plugin"),G=W8($.parents,r_,"parent"),V=W8(Q,s_,"artifact"),H=W8(z,t_,"plugin"),q=W8(Q,e_,"artifact"),K=$R.some((S)=>p2(z,S)),M=$.packaging==="pom",B,N="",O;if(J)B="mobile",N=X?"Android+KMP":"Android",O=`${$.path||"root"} + com.android.application (${N})`;else if(W)B="mcp",N="MCP",Z.push("mcp"),O=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||G||V){B="backend",N=U?.[1]||G?.[1]||V?.[1]||"JVM";let S=U?.[0]||G?.[0]||V?.[0]||"web";O=`${$.path||"root"} + ${S} (JVM backend)`}else if(X&&!Y)B="library",N="Kotlin Multiplatform",O=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",N=X?"Android+KMP":"Android",O=`${$.path||"root"} + android library (${N})`;else if(q||$.hasApplicationPlugin&&($.hasMainClass||H)||H&&$.hasMainClass)B="cli",N=q?.[1]||"application",O=q?`${$.path||"root"} + ${q[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!K)B="cli",N="application",O=`${$.path||"root"} + application plugin (JVM CLI)`;else if(M)B="library",O=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let S=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(O=`${$.path||"root"} (${S} library)`,K)O=`${$.path||"root"} + java-library (JVM library)`}let _="Java";if($.kotlinSources&&$.javaSources)_="Java/Kotlin";else if($.kotlinSources||a_.some((S)=>p2(z,S))||X)_="Kotlin";let x=[...new Set(Z)];return{appType:B,framework:N,facets:x,found:O,buildTool:$.buildTool,mainLanguage:_}}function GR($,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=n6(Z,"build.gradle.kts"),X=n6(Z,"build.gradle"),J=I($,Q)?Q:I($,X)?X:null;if(!J)return null;let Y=h($,J);if(!Y)return null;let W=JR(Y,z),U=YR(Y,z),G=uW($,Z),V=/mainClass\s*[.=]/.test(Y)||/mainClassName\s*=/.test(Y)||/Main-Class/.test(Y),H=p2(W,"application")||p2(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 hW($,Z){let z=h($,n6(Z,"pom.xml"));if(!z)return null;let{packaging:Q,parents:X,artifacts:J}=fW(z),Y=uW($,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 U8($){if(!z3($))return null;let Z=QR($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"])if(I($,G)){Q=h($,G);break}let X=Q?XR(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=hW($,"");if(Y){z.push(Y);let G=h($,"pom.xml");if(G){let{modules:V}=fW(G);for(let H of V){let q=hW($,H);if(q)z.push(q)}}}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=UR(G),H=GR(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 HR}from"path";var G8={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 qR=G8.mcpGems.map(($)=>$.toLowerCase()),KR=G8.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),mW=G8.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),BR=G8.railsLayoutFiles;function MR($){return I($,"Gemfile")||I($,"gems.rb")||LR($)}function LR($){return(X0($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function NR($){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 DR($){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 OR($){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 IR($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=h($,X);if(J){for(let Y of NR(J))Z.add(Y);z.push(X)}}let Q=h($,"Gemfile.lock")||h($,"gems.locked");if(Q){for(let X of DR(Q))Z.add(X);z.push("Gemfile.lock")}for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=h($,X);if(J){for(let Y of OR(J))Z.add(Y);z.push(X)}}return{gems:Z,sources:z}}function V8($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function Q3($,Z){let z;for(let[Q,X]of Z){if(!V8($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function TR($){let Z;for(let z of qR)if(V8($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function cW($){for(let Z of BR)if(I($,Z))return Z;return}function AR($,Z){let z=Q3(Z,mW);if(z)return{hit:!0,why:z[0]};for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=h($,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 I2($,HR("bin",Y))?.isFile()===!0}).filter((Y)=>Y!=="rails");if(J.length>0&&!V8(Z,"rails")&&!cW($))return{hit:!0,why:`bin/${J[0]}`}}return{hit:!1,why:""}}function d5($){if(!MR($))return null;let{gems:Z,sources:z}=IR($),Q=z[0]||"Gemfile",X=z.some((N)=>N==="Gemfile"||N==="gems.rb"||N.includes("lock"))?"bundler":"rubygems",J=TR(Z),Y=Q3(Z,KR),W=cW($),U=V8(Z,"rails")||V8(Z,"railties"),G=AR($,Z),V=I($,"config.ru"),H=U||!!W,q=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!V)?Y:void 0,K,M="",B;if(J)K="mcp",M="MCP",B=`${Q} + gem ${J} (Ruby MCP)`;else if(H)if(K="backend",M="Rails",U&&W)B=`${Q} + rails + ${W} (Rails)`;else if(U)B=`${Q} + gem rails (Rails)`;else B=`${W} (Rails layout)`;else if(q)K="backend",M=q[1],B=`${Q} + gem ${q[0]} (Ruby backend)`;else if(G.hit)K="cli",M=Q3(Z,mW)?.[1]||"",B=`${Q} + ${G.why} (Ruby CLI)`;else K="library",B=`${Q} (Ruby library)`;return{appType:K,framework:M,packageManager:X,found:B}}import{join as _R}from"path";var k2={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 RR=k2.mcpPackageUrls.map(($)=>$.toLowerCase()),PR=k2.mcpProducts.map(($)=>$.toLowerCase()),FR=k2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),SR=k2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),jR=k2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),ER=k2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),wR=k2.appProductTypes,xR=k2.cliProductTypes,yR=k2.vaporLayoutFiles;function kR($){return I($,"Package.swift")||X3($).length>0}function X3($){return(X0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&I2($,Z)?.isDirectory()===!0)}function bR($){let Z=vR($),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),q=/\.plugin\s*\(/.test(z)&&!V&&!H?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(z),K=/\.executabletarget\s*\(/.test(z),M=/\.target\s*\(/.test(z)&&!K?!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:!!q,hasExecutableTarget:K,hasLibraryTarget:M}}function vR($){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 gR($,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 pW($,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 hR($){let Z=$.map((z)=>z.toLowerCase());return PR.some((z)=>Z.includes(z))}function fR($){let Z=!1,z=!1,Q;for(let X of X3($)){let J=h($,_R(X,"project.pbxproj"));if(!J)continue;for(let Y of wR)if(J.includes(Y))Z=!0,Q=Y;for(let Y of xR)if(J.includes(Y)){if(z=!0,!Q)Q=Y}}return{hasApplication:Z,hasTool:z,hit:Q}}function uR($){for(let Z of yR)if(I($,Z))return Z;return}function H8($){if(!kR($))return null;let Z=I($,"Package.swift"),z=X3($),Q=z.length>0,X=null;if(Z){let j=h($,"Package.swift");if(j)X=bR(j)}let J=Q?fR($):{hasApplication:!1,hasTool:!1},Y=uR($),W=X?.packageUrls??[],U=X?.productNames??[],G=gR(W,RR),V=hR(U),H=pW(W,FR),q=lW(U,SR),K=pW(W,jR),M=lW(U,ER),B=!!(G||V),N=!!(H||q||Y),O=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),_=!!(K||M),x=J.hasApplication,S=Z&&Q?"spm+xcode":Z?"spm":"xcode",y,E="",u;if(B)if(y="mcp",E="MCP",V)u="Package.swift + product MCP (Swift MCP)";else u=`Package.swift + ${G} (Swift MCP)`;else if(N)if(y="backend",E=q?.[1]||H?.[1]||(Y?"Vapor":""),q)u=`Package.swift + product ${q[1]} (Swift backend)`;else if(H)u=`Package.swift + ${H[1]} (Swift backend)`;else u=`${Y} (Swift backend layout)`;else if(x)y="app",E="",u=`${z[0]} + ${J.hit||"application"} (Swift app)`;else if(_||O&&!N&&!B)if(y="cli",E=M?.[1]||K?.[1]||"",M)u=`Package.swift + product ${M[1]} (Swift CLI)`;else if(K)u=`Package.swift + ${K[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)y="cli",u=`${z[0]} + tool productType (Swift CLI)`;else if(Z)if(y="library",X?.hasLibraryProduct)u="Package.swift + .library product (Swift library)";else u="Package.swift (Swift library)";else y="library",u=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:y,framework:E,packageManager:S,found:u}}function mR($){let Z=h($,"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 cR($){let Z=h($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function pR($,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=mR($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function lR($){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=h($,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 dR($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=h($,"pyproject.toml");if(z!==null){let X=z.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let Q=h($,"requirements.txt");if(Q!==null){let X=Q.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function iR($,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(I($,"ios")&&I($,"android"))return"ios/ + android/ dirs";return null}function nR($,Z){let z=h($,"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=h($,"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 rR($,Z){if(!I($,"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 sR($,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 oR($,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 aR($,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 tR($,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 eR($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||I($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var $P=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"]),iW=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,ZP=new Set(["frontend","backend","database","css","ui","state"]);function zP($){if(I($,"pyproject.toml")||I($,"manage.py")||I($,"setup.py")||i5($,"requirements*.txt"))return!0;if(I($,"go.mod"))return!0;if(I($,"Cargo.toml"))return!0;if(I($,"Gemfile"))return!0;if(I($,"pom.xml")||i5($,"build.gradle*"))return!0;if(v$($).length>0)return!0;let Z=W2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function n5($){return S$($,()=>QP($))}function QP($){let Z=X0($)??[],z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||$P.has(Q.name))continue;let X=dW($,Q.name);if(!zP(X))continue;let J=s5(X);if(!J)continue;let Y=r5(X).filter((V)=>ZP.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||iW.test(J),hasFramework:!!G,appRoot:I(X,"manage.py")||I(X,"config.ru")||I(X,"bin/rails")||I(X,"artisan")})}return z}function XP($,Z){if(Z?.workspaces||I($,"pnpm-workspace.yaml"))return null;let z=n5($),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 nW($){let Z=n5($);if(Z.length<2)return null;let z=(Y)=>(Y.appRoot?2:0)+(iW.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 W2($){let Z=h($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function i5($,Z){if(!Z.includes("*"))return I($,Z);let z=Z.split("/");if(z.length===1){let W=Z.split("*")[0];return(X0($)??[]).some((U)=>U.name.startsWith(W))}let Q=dW(...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 JP($,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 i5(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!i5(z,$.pattern))return!1;let Q=h(z,$.pattern);return Q!==null&&Q.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function r5($){let Z=W2($);return xW.map((z)=>{let X=z.signals.filter((J)=>JP(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 s5($){let Z=W2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(I($,"tsconfig.json"))return"TypeScript";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(v$($).length>0)return"C#";if(I($,"pyproject.toml")||I($,"setup.py"))return"Python";if(I($,"Gemfile"))return"Ruby";if(z3($)){let z=U8($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(I($,"Package.swift"))return"Swift";if(I($,"build.zig"))return"Zig";if(I($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function rW($){let Z=[];if(I($,"SKILL.md"))Z.push("SKILL.md");for(let z of["skills",""])for(let Q of X0($,z||".")??[]){if(!Q.isDirectory()||Q.name.startsWith(".")||Q.name==="node_modules")continue;if(z===""&&Q.name==="skills")continue;let X=z?`${z}/${Q.name}/SKILL.md`:`${Q.name}/SKILL.md`;if(I($,X))Z.push(X)}return Z}function YP($){let Z=rW($);if(Z.length===0)return null;let z=[Z.length===1?Z[0]:`${Z.length} SKILL.md folders`];if(I($,".claude-plugin/plugin.json"))return z.push(".claude-plugin/plugin.json"),{type:"skills-plugin",found:z};return{type:"skills",found:z}}function sW($){if(rW($).length===0)return"";return I($,".claude-plugin/plugin.json")?"Claude Code plugin":"Agent Skills"}function oW($){let Z=W2($),z=r5($),Q=[],X=sR($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=pR($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=lR($);if(Y)return Q.push(Y),{type:"extension",found:Q};let W=tR($,Z,z);if(W)return Q.push(W),{type:"mcpaas",found:Q};let U=aR($,Z);if(U)return Q.push(U),{type:"saas",found:Q};let G=nR($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=u5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let H=c5($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let q=l5($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let K=U8($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let M=d5($);if(M)return Q.push(M.found),{type:M.appType,found:Q};let B=H8($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let N=iR($,Z);if(N)return Q.push(N),{type:"mobile",found:Q};if(z.some((r)=>r.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(cR($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(I($,"build.zig")){if(Q.push("build.zig"),I($,"src/main.zig"))return Q.push("src/main.zig"),{type:"cli",found:Q};if(I($,"src/root.zig"))return Q.push("src/root.zig"),{type:"library",found:Q}}let _=z.some((r)=>r.slug==="svelte"||r.slug==="sveltekit");if(Z?.private===!0&&(I($,"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 S=z.some((r)=>r.category==="frontend"),y=z.some((r)=>r.category==="backend");if(Z?.private&&(Z.workspaces||I($,"pnpm-workspace.yaml"))&&S&&y)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let E=eR($,Z);if(E)return Q.push(E),{type:"monorepo-root",found:Q};let u=oR($,Z,z);if(u)return Q.push(u),{type:"website",found:Q};if(z.some((r)=>r.slug==="nextjs"||r.slug==="nuxt"))return Q.push(z.find((r)=>r.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let d=z.some((r)=>r.category==="frontend"),I0=z.some((r)=>r.category==="backend");if(d&&I0)return Q.push("frontend framework","backend framework"),{type:"fullstack",found:Q};if(d)return Q.push("frontend framework"),{type:"frontend",found:Q};if(I0)return Q.push("backend framework"),{type:"backend",found:Q};let S0=dR($);if(S0)return Q.push(S0),{type:"data-science",found:Q};let z0=rR($,Z);if(z0)return Q.push(z0),{type:"html",found:Q};let b=XP($,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};let n=YP($);if(n)return Q.push(...n.found),{type:n.type,found:Q};return Q.push(E$),{type:"library",found:Q}}function aW($){if(I($,"bunfig.toml"))return"Bun";if(I($,"deno.json")||I($,"deno.jsonc"))return"Deno";if(W2($))return"Node.js";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(v$($).length>0)return".NET";if(I($,"pubspec.yaml"))return"Dart";return""}var WP=new Set(["npm","pnpm","yarn","bun"]);function UP($){let Z=W2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return WP.has(z)?z:""}function GP($){if(I($,"pubspec.yaml"))return"pub";if(I($,"go.mod"))return"go modules";if(v$($).length>0)return"NuGet";if(I($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>I($,z))?"gradle":""}var VP=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function tW($){return GP($)||UP($)||(VP.find(([Z])=>I($,Z))?.[1]??"")}function eW($){if(I($,".github/workflows"))return"GitHub Actions";if(I($,".gitlab-ci.yml"))return"GitLab CI";if(I($,".circleci"))return"CircleCI";if(I($,"Jenkinsfile"))return"Jenkins";return null}function $U($){if(I($,"vercel.json"))return"Vercel";if(I($,"netlify.toml"))return"Netlify";if(I($,"wrangler.toml"))return"Cloudflare";if(I($,"fly.toml"))return"Fly.io";if(I($,"render.yaml"))return"Render";return null}var HP=["svelte.config.js","vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"];function qP($){for(let Q of HP){let X=h($,Q)?.match(/@sveltejs\/adapter-(\w+)/);if(X)return X[1]}let Z=W2($);return Object.keys({...Z?.dependencies,...Z?.devDependencies}).map((Q)=>/^@sveltejs\/adapter-(\w+)$/.exec(Q)?.[1]).find(Boolean)??null}function ZU($){let Z=qP($);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 J3($){let Z=$?.devDependencies?.vite??$?.dependencies?.vite,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?"Vite":`Vite ${z}`}function zU($){let Z=W2($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return J3(Z);if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(I($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function o5($){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)=>I($,z))}function a5($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=I($,"bun.lock")||I($,"bun.lockb")?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(I($,"Cargo.toml")){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&KP($))z.lint="cargo clippy"}if(I($,"build.zig")){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(Y3($,"build.zig")))z.test="zig build test"}if(I($,"go.mod")){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&BP($))z.test="pytest";return z}function Y3($,Z){return h($,Z)??""}function KP($){if(I($,"clippy.toml")||I($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(Y3($,"Cargo.toml"))}function BP($){if(I($,"pytest.ini")||I($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(Y3($,Z)))}function QU($,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(I($,"bunfig.toml"))X.push("Bun");else if(I($,"deno.json")||I($,"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 MP($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function XU($){return W3($).data}function W3($){let Z=W2($),z=r5($),Q=oW($),X=Q.type,J=Q.found.some((s)=>s.startsWith("polyglot:")),Y=J&&nW($)||s5($),W=aW($),U=tW($),G=eW($),V=$U($),H=zU($),q=z.find((s)=>s.slug==="sveltekit")??z.find((s)=>s.category==="frontend"),K=z.find((s)=>s.category==="css"),M=z.find((s)=>s.category==="ui"),B=z.find((s)=>s.category==="state"),N=z.find((s)=>s.category==="backend"),O=z.find((s)=>s.category==="database"),_=(s)=>l6(X,s)??l6("library",s)===!0,x=X==="framework",S=z.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),y=x&&S?"svelte":x?null:null,E=X==="svelte"||y==="svelte",u=E?ZU($):null,j=E&&z.some((s)=>s.slug==="sveltekit"),d={},I0=J0.filter((s)=>s.path.startsWith("stack."));for(let s of I0){let Y0=s.path.replace("stack.","");switch(Y0){case"frontend":d[Y0]=q?.name??sW($);break;case"css_framework":d[Y0]=K?.name??"";break;case"ui_library":d[Y0]=M?.name??"";break;case"state_management":d[Y0]=B?.name??(E&&MP(Z)>=5?"Runes":"");break;case"backend":d[Y0]=E?j?"SvelteKit":N?.name??"":N?.name??"";break;case"api_type":d[Y0]=j?"Server Routes":"";break;case"runtime":d[Y0]=W;break;case"database":d[Y0]=O?.name??"";break;case"connection":d[Y0]=O?.name??"";break;case"hosting":if(E&&u)d[Y0]=u;else d[Y0]=V??"";break;case"build":d[Y0]=j?J3(Z):H??"";break;case"cicd":d[Y0]=G??"";break;case"package_manager":d[Y0]=U;break;default:d[Y0]="";break}}let S0={};for(let s of I0){let Y0=s.path.replace("stack.","");S0[Y0]=_(s)?d[Y0]:"slotignored"}let z0={},b=J0.filter((s)=>s.path.startsWith("monorepo."));for(let s of b){let Y0=s.path.replace("monorepo.","");if(!_(s))z0[Y0]="slotignored";else z0[Y0]=""}let n={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(x&&y)n.framework=y;let r=QU($,Z,z,J?s5($):Y);if(J){for(let s of n5($))for(let Y0 of[s.language,s.topFramework])if(Y0&&!r.includes(Y0))r.push(Y0)}let M2=o5($),tQ=a5($,Z),P4={faf_version:k$,project:n,stack:S0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:z0,_meta:{found:Q.found}};if(r.length>0)P4.tech_stack=r;if(M2.length>0)P4.key_files=M2;if(Object.keys(tQ).length>0)P4.commands=tQ;return{data:P4,facts:d}}var JU={MIN_LENGTH:8,MAX_LENGTH:280},LP=[/^(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 _2($){let Z=$.trim();if(Z.length<JU.MIN_LENGTH)return!1;if(Z.length>JU.MAX_LENGTH)return!1;if(LP.some((z)=>z.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
236
- `).length>4)return!1;return!0}function NP($){let Z=$.split(`
226
+ `)}}var e9=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function Y_($){let Z={};for(let[z,Q]of Object.entries($.slots??{}))Z[dY.get(z)??z]=Q;return{...$,slots:Z}}function P0($){return Y_(JSON.parse(Y4().score_faf(e9($))))}function FW($){return Y4().validate_faf(e9($))}function f5($){return Y4().compile_fafb(e9($))}function SW($){return JSON.parse(Y4().decompile_fafb($))}function jW(){return Y4().sdk_version()}var EW=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function wW($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function xW($){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 $3($){return $.unknown?"unknown (—)":`${$.score}%`}function k0($){return{score:$.score,tier:B6($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function N0($){let Z=xW($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?B6(z):y$[y$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents,...z<0?{unknown:!0}:{}}}return k0(P0($))}function W_($,Z){let[z,Q]=Z.split("."),X=$[z];return Z0(X)?X[Q]:void 0}function Z3($){try{let Z=f6($,{logLevel:"error"}).getIn(["project","type"],!0);return A0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(E$)}catch{return!1}}function U_($,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 G_($){try{let Z=f6($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return Z0(z)?z:null}catch{return null}}function u5($,Z,z={}){let Q=G_($);if(Q===null)return[];let X=Z0(Q.project)&&!Z3($)?Q.project.type:void 0,J=[];for(let Y of J0){let W=W_(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!j$(W))continue;let U=p6.library.includes(Y.category),G=U_(Y.path,String(W).trim(),l6(X,Y),U,z.outOfType!==!1);if(G!==null)J.push(G)}return J}l();l();import{existsSync as V_,readFileSync as H_}from"fs";import{join as yW}from"path";import{homedir as q_}from"os";var K_=95,B_=30,M_=3,z3=yW(q_(),".config","faf"),Q3=yW(z3,"star-nudge"),L_="github.com/Wolfe-Jam/faf-cli";function N_($){if($.score<K_)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??M_))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??B_)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function D_(){try{if(!V_(Q3))return{shown:0,lastShownMs:null};let $=H_(Q3,"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 O_($){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 I_($,Z){try{j0(z3),x2(Q3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:z3,owns:O_,mark:"faf star-nudge state"})}catch{}}function kW($){let Z=Date.now(),z=D_();if(!N_({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(` ${R0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${L_}`),I_(z.shown,Z)}function E0($,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=A2($.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(T_(Q),z)console.log(""),A_($);kW($.score)}function T_($){for(let Z of $)console.log(M(` ${Z}`))}function A_($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?A("●"):z==="slotignored"?M("—"):M("○");console.log(` ${Q} ${z==="slotignored"?M(`${Z}: slotignored`):Z}`)}}l();function m5($,Z={}){let z=$??m();if(!z)console.error(`Error: project.faf not found
227
+
228
+ Run 'faf init' to create one.`),process.exit(2);let Q=p(z);Y2(Q,z);let X=a(z,()=>N0(Q));if(Z.json){let J=e(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($3(X))}`:`${A2(X.tier)} ${C($3(X))}`);return}E0(X,z,Z.verbose,u5(Q,X))}import{existsSync as xU}from"fs";import{dirname as GS,join as R3,resolve as VS}from"path";var k$="3.0";import{join as rW}from"path";var bW=[{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 __}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 R_=b$.flutterDeps,P_=b$.mcpDeps,F_=b$.serverFrameworks,S_=b$.stateManagement,j_=b$.routing;function E_($){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 c5($){let Z=h($,"pubspec.yaml");if(Z===null)return null;let z=E_(Z),Q=(_)=>z.has(_.toLowerCase()),X=R_.some(Q)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),J=P_.find(Q),Y=F_.find(([_])=>Q(_)),W=S_.find(([_])=>Q(_)),U=W?W[1]:"",G=j_.find(([_])=>Q(_)),V=G?G[1]:"",H=Q("flutter_test")?"flutter_test":Q("test")?"test":"",q=/^executables:\s*$/m.test(Z),K=(X0($,"bin")??[]).some((_)=>_.name.endsWith(".dart")),L=q||K,B,N="",O;if(X)if(N="Flutter",I($,__("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))B="mobile",O="pubspec.yaml (Flutter app)";else B="library",O="pubspec.yaml (Flutter package)";else if(J)B="mcp",O=`pubspec.yaml + ${J} (Dart MCP server)`;else if(Y)B="backend",N=Y[1],O=`pubspec.yaml + ${Y[0]} (Dart backend)`;else if(L)B="cli",O=q?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else B="library",O="pubspec.yaml (Dart package)";return{appType:B,isFlutter:X,framework:N,stateManagement:U,routing:V,testing:H,found:O}}import{join as x_}from"path";var p5={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 y_=p5.mcpModules,k_=p5.serverFrameworks,b_=p5.cliFrameworks;function v_($){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 gW($,Z){let z=Z.toLowerCase();for(let Q of $)if(Q===z||Q.startsWith(`${z}/`))return!0;return!1}function vW($,Z){let z;for(let Q of Z){if(!gW($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function g_($,Z){let z;for(let Q of Z){if(!gW($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function h_($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function f_($){for(let{name:Z}of X0($,"cmd")??[]){let z=x_("cmd",Z),Q=I2($,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 u_($){let Z=h($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function l5($){let Z=h($,"go.mod");if(Z===null)return null;let z=h_(Z),Q=v_(Z),X=g_(Q,y_),J=vW(Q,k_),Y=vW(Q,b_),W=f_($),U=u_($),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 i6={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 c_=i6.mcpPackages.map(($)=>$.toLowerCase()),p_=i6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),l_=i6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),d_=i6.grpcServerPackages.map(($)=>$.toLowerCase()),i_=i6.specializedSdks,hW=i6.baseSdk.toLowerCase();function n_($){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($),q=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))q.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))q.add(L[1].toLowerCase());let K=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());return{sdk:Q,outputType:X,targetFramework:W,isTestProject:U,useMaui:G,useWpf:V,useWindowsForms:H,packages:q,frameworkRefs:K}}function X3($,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 fW($,Z){let z;for(let[Q,X]of Z){if(!X3($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function r_($){let Z;for(let z of c_){if(!X3($,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 s_($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of i_){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function d5($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function o_($,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 a_($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,W,U="",G,V=r_(X),H=s_(Q),q=fW(X,l_),K=fW(X,p_),L=d_.some((N)=>X3(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"||q)W="library",U=q?.[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&&d5(Y))W="backend",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!d5(Y))W="library",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(K&&(d5(Y)||!Y))W="cli",U=K[1],G=`${Z} + ${K[0]} (C# CLI)`;else if(d5(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()===hW||Q.toLowerCase().startsWith(`${hW}/`))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 i5($){let Z=v$($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=h($,X);if(J===null)continue;let Y=n_(J),W=a_(Y,X),U=o_(W.appType,W.framework);if(!z||U<Q)z=W,Q=U}return z}import{join as n6}from"path";var C2={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 e_=C2.mcpArtifacts.map(($)=>$.toLowerCase()),$R=C2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),ZR=C2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),zR=C2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),QR=C2.androidPlugins.map(($)=>$.toLowerCase()),XR=C2.kmpPlugins.map(($)=>$.toLowerCase()),JR=C2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),YR=C2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),WR=C2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),UR=C2.libraryPlugins.map(($)=>$.toLowerCase()),GR=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function J3($){return GR.some((Z)=>I($,Z))}function VR($){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(),q=G[1].toLowerCase();z.set(q,H),z.set(q.replace(/-/g,"."),H);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let H=V[1].toLowerCase(),q=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let K=q.split(":")[0].toLowerCase();Z.set(H,K),Z.set(H.replace(/-/g,"."),K)}else if(Q==="libraries"||Q.endsWith(".libraries")){let K=q.split(":");if(K.length>=2){let L=`${K[0]}:${K[1]}`.toLowerCase();z.set(H,L),z.set(H.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:z}}function HR($){let Z=h($,n6("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return VR(Z)}function qR($){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 KR($,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 BR($,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 cW($){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 M6($,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 W4($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=M6($,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 MR($){let Z;for(let z of e_)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 pW($,Z){let z=new Set,Q=!1,X=!1,J=[n6(Z,"src"),n6(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=n6(W,V),q=I2($,H);if(!q)continue;if(q.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 LR($){let Z=[],z=$.plugins,Q=$.artifacts,X=XR.some((S)=>M6(z,S))||$.sourceHints.has("commonMain"),J=M6(z,"com.android.application"),Y=!J&&QR.some((S)=>M6(z,S));if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let W=MR(Q),U=W4(z,$R,"plugin"),G=W4($.parents,ZR,"parent"),V=W4(Q,zR,"artifact"),H=W4(z,YR,"plugin"),q=W4(Q,WR,"artifact"),K=UR.some((S)=>M6(z,S)),L=$.packaging==="pom",B,N="",O;if(J)B="mobile",N=X?"Android+KMP":"Android",O=`${$.path||"root"} + com.android.application (${N})`;else if(W)B="mcp",N="MCP",Z.push("mcp"),O=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||G||V){B="backend",N=U?.[1]||G?.[1]||V?.[1]||"JVM";let S=U?.[0]||G?.[0]||V?.[0]||"web";O=`${$.path||"root"} + ${S} (JVM backend)`}else if(X&&!Y)B="library",N="Kotlin Multiplatform",O=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",N=X?"Android+KMP":"Android",O=`${$.path||"root"} + android library (${N})`;else if(q||$.hasApplicationPlugin&&($.hasMainClass||H)||H&&$.hasMainClass)B="cli",N=q?.[1]||"application",O=q?`${$.path||"root"} + ${q[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!K)B="cli",N="application",O=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",O=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let S=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(O=`${$.path||"root"} (${S} library)`,K)O=`${$.path||"root"} + java-library (JVM library)`}let _="Java";if($.kotlinSources&&$.javaSources)_="Java/Kotlin";else if($.kotlinSources||JR.some((S)=>M6(z,S))||X)_="Kotlin";let x=[...new Set(Z)];return{appType:B,framework:N,facets:x,found:O,buildTool:$.buildTool,mainLanguage:_}}function NR($,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 uW($,Z,z){let Q=n6(Z,"build.gradle.kts"),X=n6(Z,"build.gradle"),J=I($,Q)?Q:I($,X)?X:null;if(!J)return null;let Y=h($,J);if(!Y)return null;let W=KR(Y,z),U=BR(Y,z),G=pW($,Z),V=/mainClass\s*[.=]/.test(Y)||/mainClassName\s*=/.test(Y)||/Main-Class/.test(Y),H=M6(W,"application")||M6(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 mW($,Z){let z=h($,n6(Z,"pom.xml"));if(!z)return null;let{packaging:Q,parents:X,artifacts:J}=cW(z),Y=pW($,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 U4($){if(!J3($))return null;let Z=HR($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"])if(I($,G)){Q=h($,G);break}let X=Q?qR(Q):[],J=uW($,"",Z);if(J)z.push(J);for(let G of X){let V=uW($,G,Z);if(V)z.push(V)}let Y=mW($,"");if(Y){z.push(Y);let G=h($,"pom.xml");if(G){let{modules:V}=cW(G);for(let H of V){let q=mW($,H);if(q)z.push(q)}}}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=LR(G),H=NR(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 OR}from"path";var G4={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 IR=G4.mcpGems.map(($)=>$.toLowerCase()),TR=G4.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),lW=G4.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),AR=G4.railsLayoutFiles;function CR($){return I($,"Gemfile")||I($,"gems.rb")||_R($)}function _R($){return(X0($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function RR($){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 PR($){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 FR($){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 SR($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=h($,X);if(J){for(let Y of RR(J))Z.add(Y);z.push(X)}}let Q=h($,"Gemfile.lock")||h($,"gems.locked");if(Q){for(let X of PR(Q))Z.add(X);z.push("Gemfile.lock")}for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=h($,X);if(J){for(let Y of FR(J))Z.add(Y);z.push(X)}}return{gems:Z,sources:z}}function V4($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function Y3($,Z){let z;for(let[Q,X]of Z){if(!V4($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function jR($){let Z;for(let z of IR)if(V4($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function dW($){for(let Z of AR)if(I($,Z))return Z;return}function ER($,Z){let z=Y3(Z,lW);if(z)return{hit:!0,why:z[0]};for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=h($,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 I2($,OR("bin",Y))?.isFile()===!0}).filter((Y)=>Y!=="rails");if(J.length>0&&!V4(Z,"rails")&&!dW($))return{hit:!0,why:`bin/${J[0]}`}}return{hit:!1,why:""}}function n5($){if(!CR($))return null;let{gems:Z,sources:z}=SR($),Q=z[0]||"Gemfile",X=z.some((N)=>N==="Gemfile"||N==="gems.rb"||N.includes("lock"))?"bundler":"rubygems",J=jR(Z),Y=Y3(Z,TR),W=dW($),U=V4(Z,"rails")||V4(Z,"railties"),G=ER($,Z),V=I($,"config.ru"),H=U||!!W,q=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!V)?Y:void 0,K,L="",B;if(J)K="mcp",L="MCP",B=`${Q} + gem ${J} (Ruby MCP)`;else if(H)if(K="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(q)K="backend",L=q[1],B=`${Q} + gem ${q[0]} (Ruby backend)`;else if(G.hit)K="cli",L=Y3(Z,lW)?.[1]||"",B=`${Q} + ${G.why} (Ruby CLI)`;else K="library",B=`${Q} (Ruby library)`;return{appType:K,framework:L,packageManager:X,found:B}}import{join as xR}from"path";var k2={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 yR=k2.mcpPackageUrls.map(($)=>$.toLowerCase()),kR=k2.mcpProducts.map(($)=>$.toLowerCase()),bR=k2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),vR=k2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),gR=k2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),hR=k2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),fR=k2.appProductTypes,uR=k2.cliProductTypes,mR=k2.vaporLayoutFiles;function cR($){return I($,"Package.swift")||W3($).length>0}function W3($){return(X0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&I2($,Z)?.isDirectory()===!0)}function pR($){let Z=lR($),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),q=/\.plugin\s*\(/.test(z)&&!V&&!H?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(z),K=/\.executabletarget\s*\(/.test(z),L=/\.target\s*\(/.test(z)&&!K?!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:!!q,hasExecutableTarget:K,hasLibraryTarget:L}}function lR($){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 dR($,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 iW($,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 nW($,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 iR($){let Z=$.map((z)=>z.toLowerCase());return kR.some((z)=>Z.includes(z))}function nR($){let Z=!1,z=!1,Q;for(let X of W3($)){let J=h($,xR(X,"project.pbxproj"));if(!J)continue;for(let Y of fR)if(J.includes(Y))Z=!0,Q=Y;for(let Y of uR)if(J.includes(Y)){if(z=!0,!Q)Q=Y}}return{hasApplication:Z,hasTool:z,hit:Q}}function rR($){for(let Z of mR)if(I($,Z))return Z;return}function H4($){if(!cR($))return null;let Z=I($,"Package.swift"),z=W3($),Q=z.length>0,X=null;if(Z){let j=h($,"Package.swift");if(j)X=pR(j)}let J=Q?nR($):{hasApplication:!1,hasTool:!1},Y=rR($),W=X?.packageUrls??[],U=X?.productNames??[],G=dR(W,yR),V=iR(U),H=iW(W,bR),q=nW(U,vR),K=iW(W,gR),L=nW(U,hR),B=!!(G||V),N=!!(H||q||Y),O=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),_=!!(K||L),x=J.hasApplication,S=Z&&Q?"spm+xcode":Z?"spm":"xcode",y,E="",u;if(B)if(y="mcp",E="MCP",V)u="Package.swift + product MCP (Swift MCP)";else u=`Package.swift + ${G} (Swift MCP)`;else if(N)if(y="backend",E=q?.[1]||H?.[1]||(Y?"Vapor":""),q)u=`Package.swift + product ${q[1]} (Swift backend)`;else if(H)u=`Package.swift + ${H[1]} (Swift backend)`;else u=`${Y} (Swift backend layout)`;else if(x)y="app",E="",u=`${z[0]} + ${J.hit||"application"} (Swift app)`;else if(_||O&&!N&&!B)if(y="cli",E=L?.[1]||K?.[1]||"",L)u=`Package.swift + product ${L[1]} (Swift CLI)`;else if(K)u=`Package.swift + ${K[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)y="cli",u=`${z[0]} + tool productType (Swift CLI)`;else if(Z)if(y="library",X?.hasLibraryProduct)u="Package.swift + .library product (Swift library)";else u="Package.swift (Swift library)";else y="library",u=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:y,framework:E,packageManager:S,found:u}}function sR($){let Z=h($,"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 oR($){let Z=h($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function aR($,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=sR($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function tR($){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=h($,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 eR($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=h($,"pyproject.toml");if(z!==null){let X=z.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let Q=h($,"requirements.txt");if(Q!==null){let X=Q.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function $P($,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(I($,"ios")&&I($,"android"))return"ios/ + android/ dirs";return null}function ZP($,Z){let z=h($,"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=h($,"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 zP($,Z){if(!I($,"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 QP($,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 XP($,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 JP($,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 YP($,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 WP($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||I($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var UP=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"]),sW=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,GP=new Set(["frontend","backend","database","css","ui","state"]);function VP($){if(I($,"pyproject.toml")||I($,"manage.py")||I($,"setup.py")||r5($,"requirements*.txt"))return!0;if(I($,"go.mod"))return!0;if(I($,"Cargo.toml"))return!0;if(I($,"Gemfile"))return!0;if(I($,"pom.xml")||r5($,"build.gradle*"))return!0;if(v$($).length>0)return!0;let Z=W2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function s5($){return S$($,()=>HP($))}function HP($){let Z=X0($)??[],z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||UP.has(Q.name))continue;let X=rW($,Q.name);if(!VP(X))continue;let J=a5(X);if(!J)continue;let Y=o5(X).filter((V)=>GP.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||sW.test(J),hasFramework:!!G,appRoot:I(X,"manage.py")||I(X,"config.ru")||I(X,"bin/rails")||I(X,"artisan")})}return z}function qP($,Z){if(Z?.workspaces||I($,"pnpm-workspace.yaml"))return null;let z=s5($),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=s5($);if(Z.length<2)return null;let z=(Y)=>(Y.appRoot?2:0)+(sW.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 W2($){let Z=h($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function r5($,Z){if(!Z.includes("*"))return I($,Z);let z=Z.split("/");if(z.length===1){let W=Z.split("*")[0];return(X0($)??[]).some((U)=>U.name.startsWith(W))}let Q=rW(...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 KP($,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 r5(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!r5(z,$.pattern))return!1;let Q=h(z,$.pattern);return Q!==null&&Q.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function o5($){let Z=W2($);return bW.map((z)=>{let X=z.signals.filter((J)=>KP(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 a5($){let Z=W2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(I($,"tsconfig.json"))return"TypeScript";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(v$($).length>0)return"C#";if(I($,"pyproject.toml")||I($,"setup.py"))return"Python";if(I($,"Gemfile"))return"Ruby";if(J3($)){let z=U4($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(I($,"Package.swift"))return"Swift";if(I($,"build.zig"))return"Zig";if(I($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function aW($){let Z=[];if(I($,"SKILL.md"))Z.push("SKILL.md");for(let z of["skills",""])for(let Q of X0($,z||".")??[]){if(!Q.isDirectory()||Q.name.startsWith(".")||Q.name==="node_modules")continue;if(z===""&&Q.name==="skills")continue;let X=z?`${z}/${Q.name}/SKILL.md`:`${Q.name}/SKILL.md`;if(I($,X))Z.push(X)}return Z}function BP($){let Z=aW($);if(Z.length===0)return null;let z=[Z.length===1?Z[0]:`${Z.length} SKILL.md folders`];if(I($,".claude-plugin/plugin.json"))return z.push(".claude-plugin/plugin.json"),{type:"skills-plugin",found:z};return{type:"skills",found:z}}function tW($){if(aW($).length===0)return"";return I($,".claude-plugin/plugin.json")?"Claude Code plugin":"Agent Skills"}function eW($){let Z=W2($),z=o5($),Q=[],X=QP($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=aR($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=tR($);if(Y)return Q.push(Y),{type:"extension",found:Q};let W=YP($,Z,z);if(W)return Q.push(W),{type:"mcpaas",found:Q};let U=JP($,Z);if(U)return Q.push(U),{type:"saas",found:Q};let G=ZP($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=c5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let H=l5($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let q=i5($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let K=U4($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let L=n5($);if(L)return Q.push(L.found),{type:L.appType,found:Q};let B=H4($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let N=$P($,Z);if(N)return Q.push(N),{type:"mobile",found:Q};if(z.some((r)=>r.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(oR($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(I($,"build.zig")){if(Q.push("build.zig"),I($,"src/main.zig"))return Q.push("src/main.zig"),{type:"cli",found:Q};if(I($,"src/root.zig"))return Q.push("src/root.zig"),{type:"library",found:Q}}let _=z.some((r)=>r.slug==="svelte"||r.slug==="sveltekit");if(Z?.private===!0&&(I($,"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 S=z.some((r)=>r.category==="frontend"),y=z.some((r)=>r.category==="backend");if(Z?.private&&(Z.workspaces||I($,"pnpm-workspace.yaml"))&&S&&y)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let E=WP($,Z);if(E)return Q.push(E),{type:"monorepo-root",found:Q};let u=XP($,Z,z);if(u)return Q.push(u),{type:"website",found:Q};if(z.some((r)=>r.slug==="nextjs"||r.slug==="nuxt"))return Q.push(z.find((r)=>r.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let d=z.some((r)=>r.category==="frontend"),I0=z.some((r)=>r.category==="backend");if(d&&I0)return Q.push("frontend framework","backend framework"),{type:"fullstack",found:Q};if(d)return Q.push("frontend framework"),{type:"frontend",found:Q};if(I0)return Q.push("backend framework"),{type:"backend",found:Q};let S0=eR($);if(S0)return Q.push(S0),{type:"data-science",found:Q};let z0=zP($,Z);if(z0)return Q.push(z0),{type:"html",found:Q};let b=qP($,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};let n=BP($);if(n)return Q.push(...n.found),{type:n.type,found:Q};return Q.push(E$),{type:"library",found:Q}}function $U($){if(I($,"bunfig.toml"))return"Bun";if(I($,"deno.json")||I($,"deno.jsonc"))return"Deno";if(W2($))return"Node.js";if(I($,"Cargo.toml"))return"Rust";if(I($,"go.mod"))return"Go";if(v$($).length>0)return".NET";if(I($,"pubspec.yaml"))return"Dart";return""}var MP=new Set(["npm","pnpm","yarn","bun"]);function LP($){let Z=W2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return MP.has(z)?z:""}function NP($){if(I($,"pubspec.yaml"))return"pub";if(I($,"go.mod"))return"go modules";if(v$($).length>0)return"NuGet";if(I($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>I($,z))?"gradle":""}var DP=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function ZU($){return NP($)||LP($)||(DP.find(([Z])=>I($,Z))?.[1]??"")}function zU($){if(I($,".github/workflows"))return"GitHub Actions";if(I($,".gitlab-ci.yml"))return"GitLab CI";if(I($,".circleci"))return"CircleCI";if(I($,"Jenkinsfile"))return"Jenkins";return null}function QU($){if(I($,"vercel.json"))return"Vercel";if(I($,"netlify.toml"))return"Netlify";if(I($,"wrangler.toml"))return"Cloudflare";if(I($,"fly.toml"))return"Fly.io";if(I($,"render.yaml"))return"Render";return null}var OP=["svelte.config.js","vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"];function IP($){for(let Q of OP){let X=h($,Q)?.match(/@sveltejs\/adapter-(\w+)/);if(X)return X[1]}let Z=W2($);return Object.keys({...Z?.dependencies,...Z?.devDependencies}).map((Q)=>/^@sveltejs\/adapter-(\w+)$/.exec(Q)?.[1]).find(Boolean)??null}function XU($){let Z=IP($);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 U3($){let Z=$?.devDependencies?.vite??$?.dependencies?.vite,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?"Vite":`Vite ${z}`}function JU($){let Z=W2($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return U3(Z);if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(I($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function t5($){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)=>I($,z))}function e5($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=I($,"bun.lock")||I($,"bun.lockb")?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(I($,"Cargo.toml")){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&TP($))z.lint="cargo clippy"}if(I($,"build.zig")){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(G3($,"build.zig")))z.test="zig build test"}if(I($,"go.mod")){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&AP($))z.test="pytest";return z}function G3($,Z){return h($,Z)??""}function TP($){if(I($,"clippy.toml")||I($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(G3($,"Cargo.toml"))}function AP($){if(I($,"pytest.ini")||I($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(G3($,Z)))}function YU($,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(I($,"bunfig.toml"))X.push("Bun");else if(I($,"deno.json")||I($,"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 CP($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function WU($){return V3($).data}function V3($){let Z=W2($),z=o5($),Q=eW($),X=Q.type,J=Q.found.some((s)=>s.startsWith("polyglot:")),Y=J&&oW($)||a5($),W=$U($),U=ZU($),G=zU($),V=QU($),H=JU($),q=z.find((s)=>s.slug==="sveltekit")??z.find((s)=>s.category==="frontend"),K=z.find((s)=>s.category==="css"),L=z.find((s)=>s.category==="ui"),B=z.find((s)=>s.category==="state"),N=z.find((s)=>s.category==="backend"),O=z.find((s)=>s.category==="database"),_=(s)=>l6(X,s)??l6("library",s)===!0,x=X==="framework",S=z.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),y=x&&S?"svelte":x?null:null,E=X==="svelte"||y==="svelte",u=E?XU($):null,j=E&&z.some((s)=>s.slug==="sveltekit"),d={},I0=J0.filter((s)=>s.path.startsWith("stack."));for(let s of I0){let Y0=s.path.replace("stack.","");switch(Y0){case"frontend":d[Y0]=q?.name??tW($);break;case"css_framework":d[Y0]=K?.name??"";break;case"ui_library":d[Y0]=L?.name??"";break;case"state_management":d[Y0]=B?.name??(E&&CP(Z)>=5?"Runes":"");break;case"backend":d[Y0]=E?j?"SvelteKit":N?.name??"":N?.name??"";break;case"api_type":d[Y0]=j?"Server Routes":"";break;case"runtime":d[Y0]=W;break;case"database":d[Y0]=O?.name??"";break;case"connection":d[Y0]=O?.name??"";break;case"hosting":if(E&&u)d[Y0]=u;else d[Y0]=V??"";break;case"build":d[Y0]=j?U3(Z):H??"";break;case"cicd":d[Y0]=G??"";break;case"package_manager":d[Y0]=U;break;default:d[Y0]="";break}}let S0={};for(let s of I0){let Y0=s.path.replace("stack.","");S0[Y0]=_(s)?d[Y0]:"slotignored"}let z0={},b=J0.filter((s)=>s.path.startsWith("monorepo."));for(let s of b){let Y0=s.path.replace("monorepo.","");if(!_(s))z0[Y0]="slotignored";else z0[Y0]=""}let n={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(x&&y)n.framework=y;let r=YU($,Z,z,J?a5($):Y);if(J){for(let s of s5($))for(let Y0 of[s.language,s.topFramework])if(Y0&&!r.includes(Y0))r.push(Y0)}let M2=t5($),ZX=e5($,Z),S8={faf_version:k$,project:n,stack:S0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:z0,_meta:{found:Q.found}};if(r.length>0)S8.tech_stack=r;if(M2.length>0)S8.key_files=M2;if(Object.keys(ZX).length>0)S8.commands=ZX;return{data:S8,facts:d}}var UU={MIN_LENGTH:8,MAX_LENGTH:280},_P=[/^(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 _2($){let Z=$.trim();if(Z.length<UU.MIN_LENGTH)return!1;if(Z.length>UU.MAX_LENGTH)return!1;if(_P.some((z)=>z.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
236
+ `).length>4)return!1;return!0}function RP($){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 DP($){let z=NP($).split(`
238
+ `)}function PP($){let z=RP($).split(`
239
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 r6($,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 OP($){let Z=r6($,/^(use\s+cases?|goal)\b/i);if(Z&&_2(Z))return Z;let z=DP($);if(z&&_2(z))return z;return}function IP($){let Z=r6($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&_2(Z))return Z;return}function TP($){let Z=r6($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&_2(Z))return Z;return}function AP($){let Z=r6($,/^(why|motivation|problem|rationale)\b/i);if(Z&&_2(Z))return Z;return}function CP($){let Z=r6($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&_2(Z))return Z;return}function _P($){let Z=r6($,/^(status|history|timeline|since|launched)\b/i);if(Z&&_2(Z))return Z;return}function RP($){let Z=r6($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&_2(Z))return Z;return}function U3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let K of Z)if(I($,K)){z=K;break}if(!z)return{};let Q=h($,z);if(Q===null)return{};Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=OP(Q);if(J)X.project={goal:J};let Y={},W=IP(Q);if(W)Y.what=W;let U=TP(Q);if(U)Y.who=U;let G=AP(Q);if(G)Y.why=G;let V=CP(Q);if(V)Y.where=V;let H=_P(Q);if(H)Y.when=H;let q=RP(Q);if(q)Y.how=q;if(Object.keys(Y).length>0)X.human_context=Y;return X}function PP($,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 G3($){let Z=h($,"Cargo.toml");if(Z===null)return{};let z=PP(Z,"description");if(z&&_2(z))return{project:{goal:z}};return{}}import{join as YU}from"path";var FP=[{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"}],SP=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function jP($){let Z=[],z=(Q,X)=>{for(let J of X0($,Q)??[])if(J.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(J.name))Z.push(YU(Q,J.name));else if(J.isDirectory()&&X>0&&!J.name.startsWith(".")&&!SP.has(J.name))z(YU(Q,J.name),X-1)};return z(".",1),Z}function q8($){return[...$].join(" · ")}function V3($){let Z=jP($);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=h($,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:q}of FP)if(V.test(U)||V.test(G))z[H].add(q)}}let Q={};if(z.database.size)Q.database=q8(z.database);if(z.cache.size)Q.cache=q8(z.cache);if(z.search.size)Q.search=q8(z.search);if(z.storage.size)Q.storage=q8(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${q8(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 EP}from"path";var wP=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),xP=[{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 H3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function yP($){let Z=[$];for(let z of X0($)??[])if(z.isDirectory()&&!z.name.startsWith(".")&&!wP.has(z.name))Z.push(EP($,z.name));return Z}function kP($){let Z=0;if(I($,"manage.py")||I($,"pyproject.toml")||I($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function q3($){return S$($,()=>bP($))}function bP($){let Z=[];for(let Q of yP($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of xP){let W=h(Q,Y.file);if(W===null)continue;let U=Y.targets(W);if(U.length===0)continue;let G={},V=H3(U,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),H=H3(U,[/^build$/i,/^compile$/i,/^build/i]),q=H3(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(q)G.lint=`${J}${Y.runner} ${q}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(X?10:kP(Q)),commands:G})}}let z=Z.sort((Q,X)=>X.score-Q.score)[0];return z?{commands:z.commands}:{}}var vP=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function K3($){for(let Z of vP)if(I($,Z))return{security:{secrets:".env",example:Z}};return{}}function gP($,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 B3($){return[U3($),G3($),V3($),q3($),K3($)].reduce(gP,{})}import{join as hP,extname as fP,resolve as uP}from"path";var M3={"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 mP=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),cP=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),pP={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"]},lP=[["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 dP($,Z){for(let[z,Q]of lP)if(z in $)return Q;return Z.length>0?"framework":"config"}function iP($,Z){try{let z=JSON.parse(h($,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 nP($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return I2($,Z.name)?.isFile()===!0}function rP($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return I2($,Z.name)?.isDirectory()===!0}function sP($){let Z=[],z=uP($),Q=new Set,X=X0(z);if(!X)return Z;for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!rP(z,J):!nP(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let U=l5(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=H8(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=M3[Y];if(!W)continue;if(Y==="manifest.json"&&iP(z,Y)!=="chrome")continue;if(Y==="pubspec.yaml"){let U=u5(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=c5(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=d5(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=H8(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=U8(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 oP($){let Z=[];for(let z of S$($,()=>WU($,2,{count:0}))){let Q=M3[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function aP($){let Z=[...sP($),...oP($)],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:dP(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 L3($){let{slotFills:Z}=aP($),z={};for(let[Q,X]of Object.entries(Z)){let J=pP[Q];if(!J||!X)continue;let[Y,W]=J;if(Y==="project")(z.project??={})[W]=X;else(z.stack??={})[W]=X}return z}function WU($,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=fP(J.name);if(cP.has(Y))Q.add(Y);continue}if(mP.has(J.name)||J.name.startsWith("."))continue;for(let Y of WU(hP($,J.name),Z-1,z))Q.add(Y)}return Q}var v0=($,Z,z)=>({value:$,source:Z,confidence:z});function tP($,Z={}){let z=Z.toolingRoot?null:eP($),Q=$F($),X={},J=(Y,W)=>{if(W)X[Y]=W};return J("what",QF(z,Q)),J("who",XF(Q)),J("why",JF(Q)),J("where",YF(z,Q)),J("when",WF(Q)),J("how",UF(z,Q)),X}function N3($,Z={}){let z=tP($,Z),Q={};return Object.keys(z).forEach((X)=>{let J=z[X];if(J)Q[X]=J.value}),Q}function eP($){let Z=h($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function $F($){let Z=h($,"README.md");if(Z===null)return"";return Z.replace(/<!--[\s\S]*?-->/g,"").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 FP($){let Z=r6($,/^(use\s+cases?|goal)\b/i);if(Z&&_2(Z))return Z;let z=PP($);if(z&&_2(z))return z;return}function SP($){let Z=r6($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&_2(Z))return Z;return}function jP($){let Z=r6($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&_2(Z))return Z;return}function EP($){let Z=r6($,/^(why|motivation|problem|rationale)\b/i);if(Z&&_2(Z))return Z;return}function wP($){let Z=r6($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&_2(Z))return Z;return}function xP($){let Z=r6($,/^(status|history|timeline|since|launched)\b/i);if(Z&&_2(Z))return Z;return}function yP($){let Z=r6($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&_2(Z))return Z;return}function H3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let K of Z)if(I($,K)){z=K;break}if(!z)return{};let Q=h($,z);if(Q===null)return{};Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=FP(Q);if(J)X.project={goal:J};let Y={},W=SP(Q);if(W)Y.what=W;let U=jP(Q);if(U)Y.who=U;let G=EP(Q);if(G)Y.why=G;let V=wP(Q);if(V)Y.where=V;let H=xP(Q);if(H)Y.when=H;let q=yP(Q);if(q)Y.how=q;if(Object.keys(Y).length>0)X.human_context=Y;return X}function kP($,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 q3($){let Z=h($,"Cargo.toml");if(Z===null)return{};let z=kP(Z,"description");if(z&&_2(z))return{project:{goal:z}};return{}}import{join as GU}from"path";var bP=[{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"}],vP=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function gP($){let Z=[],z=(Q,X)=>{for(let J of X0($,Q)??[])if(J.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(J.name))Z.push(GU(Q,J.name));else if(J.isDirectory()&&X>0&&!J.name.startsWith(".")&&!vP.has(J.name))z(GU(Q,J.name),X-1)};return z(".",1),Z}function q4($){return[...$].join(" · ")}function K3($){let Z=gP($);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=h($,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:q}of bP)if(V.test(U)||V.test(G))z[H].add(q)}}let Q={};if(z.database.size)Q.database=q4(z.database);if(z.cache.size)Q.cache=q4(z.cache);if(z.search.size)Q.search=q4(z.search);if(z.storage.size)Q.storage=q4(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${q4(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 hP}from"path";var fP=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),uP=[{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 B3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function mP($){let Z=[$];for(let z of X0($)??[])if(z.isDirectory()&&!z.name.startsWith(".")&&!fP.has(z.name))Z.push(hP($,z.name));return Z}function cP($){let Z=0;if(I($,"manage.py")||I($,"pyproject.toml")||I($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function M3($){return S$($,()=>pP($))}function pP($){let Z=[];for(let Q of mP($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of uP){let W=h(Q,Y.file);if(W===null)continue;let U=Y.targets(W);if(U.length===0)continue;let G={},V=B3(U,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),H=B3(U,[/^build$/i,/^compile$/i,/^build/i]),q=B3(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(q)G.lint=`${J}${Y.runner} ${q}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(X?10:cP(Q)),commands:G})}}let z=Z.sort((Q,X)=>X.score-Q.score)[0];return z?{commands:z.commands}:{}}var lP=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function L3($){for(let Z of lP)if(I($,Z))return{security:{secrets:".env",example:Z}};return{}}function dP($,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 N3($){return[H3($),q3($),K3($),M3($),L3($)].reduce(dP,{})}import{join as iP,extname as nP,resolve as rP}from"path";var D3={"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 sP=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),oP=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),aP={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"]},tP=[["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 eP($,Z){for(let[z,Q]of tP)if(z in $)return Q;return Z.length>0?"framework":"config"}function $F($,Z){try{let z=JSON.parse(h($,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 ZF($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return I2($,Z.name)?.isFile()===!0}function zF($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return I2($,Z.name)?.isDirectory()===!0}function QF($){let Z=[],z=rP($),Q=new Set,X=X0(z);if(!X)return Z;for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!zF(z,J):!ZF(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let U=i5(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=H4(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=D3[Y];if(!W)continue;if(Y==="manifest.json"&&$F(z,Y)!=="chrome")continue;if(Y==="pubspec.yaml"){let U=c5(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=l5(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=n5(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=H4(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=U4(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 XF($){let Z=[];for(let z of S$($,()=>VU($,2,{count:0}))){let Q=D3[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function JF($){let Z=[...QF($),...XF($)],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:eP(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 O3($){let{slotFills:Z}=JF($),z={};for(let[Q,X]of Object.entries(Z)){let J=aP[Q];if(!J||!X)continue;let[Y,W]=J;if(Y==="project")(z.project??={})[W]=X;else(z.stack??={})[W]=X}return z}function VU($,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=nP(J.name);if(oP.has(Y))Q.add(Y);continue}if(sP.has(J.name)||J.name.startsWith("."))continue;for(let Y of VU(iP($,J.name),Z-1,z))Q.add(Y)}return Q}var b0=($,Z,z)=>({value:$,source:Z,confidence:z});function YF($,Z={}){let z=Z.toolingRoot?null:WF($),Q=UF($),X={},J=(Y,W)=>{if(W)X[Y]=W};return J("what",HF(z,Q)),J("who",qF(Q)),J("why",KF(Q)),J("where",BF(z,Q)),J("when",MF(Q)),J("how",LF(z,Q)),X}function I3($,Z={}){let z=YF($,Z),Q={};return Object.keys(z).forEach((X)=>{let J=z[X];if(J)Q[X]=J.value}),Q}function WF($){let Z=h($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function UF($){let Z=h($,"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 s6($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function ZF($){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||ZF(Q[2])>0.4)return null;return{body:s6(Q[2]),heading:Q[1].trim()}}function zF($){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 K8($,Z,z=30){for(let Q of Z){let X=$.match(Q);if(X&&X[1]&&X[1].trim().length>=z)return s6(X[1])}return null}function QF($,Z){if($?.description&&$.description.length>20)return v0(s6($.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("#")&&!zF(J));if(Q)return v0(s6(Q),"README:first-paragraph",0.5);let X=K8(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 XF($){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=K8($,[/\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 JF($){let Z=g$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=K8($,[/(?: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 YF($,Z){let z=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(z)return v0(s6(z.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return v0(s6($.homepage),"package.json:homepage",0.9);let Q=K8(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 WF($){let Z=g$($,"Timeline|Status|Release|Roadmap");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=K8($,[/\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 UF($,Z){let z=$?.scripts?Object.keys($.scripts):[],Q=["start","dev","build"].filter((Y)=>z.includes(Y));if(Q.length)return v0(s6(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=XU($),z=B3($),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=L6(L6(Q,Z),X);NF(J);let W=(Z._meta?.found??[]).some((G)=>G.startsWith("polyglot:")),U=L6(J,L3($));return L6(U,{human_context:N3($,{toolingRoot:W})})}function GU($,Z){let z=LF(o1(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=W3($),J=Q,Y=L6(z,B3($)),W=L6(Y,J),U=L6(W,L3($)),G=HF(L6(U,{human_context:N3($)}),z),V=qF(GF(Z,z,J)?KF(UU(G,z),z,X):UU(G,z),z);return LW(BW(Z,V))}function GF($,Z,z){if(!G0(g0(Z,"project.type"))){let X=X8($)?.text;return X===void 0||!t9(X)}return!(z._meta?.found??[]).includes(E$)}function D3($){return $.canonical?[$.path,$.canonical]:[$.path]}function g0($,Z){let[z,Q]=Z.split("."),X=$[z];return Z0(X)?X[Q]:void 0}function N6($,Z,z){let[Q,X]=Z.split("."),J=$[Q];if(!Z0(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 D6=($)=>typeof $==="string"&&$.trim()===t1;function VF($,Z){let z=Z.map((Q)=>g0($,Q));return z.some(D6)&&z.every((Q)=>G0(Q)||D6(Q))}function UU($,Z){let z={...$};for(let Q of J0){let X=D3(Q);if(!VF(Z,X))continue;for(let J of X){let Y=g0(Z,J);if(g0(z,J)!==Y)N6(z,J,Y)}}return z}function o6($,Z){let[z,Q]=Z.split("."),X=$[z];return Z0(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function HF($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!o6(Z,Q.canonical)||o6(Z,Q.path))continue;let X=g0(z,Q.path);N6(z,Q.path,void 0);let J=g0(z,Q.canonical);if(t5(X)&&G0(J))N6(z,Q.canonical,X)}return z}function qF($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!o6(Z,Q.canonical)||o6(Z,Q.path))continue;let X=g0(z,Q.canonical);if(t5(X)||D6(X))N6(z,Q.path,X)}return z}function KF($,Z,z={}){let Q=$.project,X=Z0(Q)?Q.type:void 0,J={...$};for(let Y of J0){if(Y.category==="human"||Y.category==="project")continue;let W=l6(X,Y);if(W===null)return $;if(W){let U=typeof X==="string"&&P5[X]?.has(Y.path)===!0;BF(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0,U)}else MF(J,Y)}return J}function BF($,Z,z,Q,X=!1){let J=D3(z),Y=(U)=>!G0(g0($,U))&&!D6(g0($,U));for(let U of J){if(!D6(g0($,U)))continue;if(X)N6($,U,J.some(Y)?void 0:"");else if(!D6(g0(Z,U)))N6($,U,o6(Z,U)?g0(Z,U):"")}if(!t5(Q))return;let W=J.filter((U)=>o6($,U));if(W.some((U)=>!G0(g0($,U))))return;for(let U of W.length>0?W:[z.path])N6($,U,Q)}function MF($,Z){let z=D3(Z).filter((X)=>o6($,X)),Q=(X)=>!G0(g0($,X))&&!D6(g0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(G0(g0($,X)))N6($,X,t1)}function LF($){let Z=$.project;if(Z===null||Z===void 0||Z0(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function NF($){let Z=$.project?.type??"library",z=p6[Z]||p6.library;for(let Q of J0){if(z.includes(Q.category)||P5[Z]?.has(Q.path))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function L6($,Z){return VU($,Z,"")}function DF($){let Z=K6.get($);return Z!==void 0&&Z.category!=="human"}function t5($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!G0($)&&!D6($)}function OF($,Z){return DF($)&&t5(Z)}function VU($,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(OF(W,J))Q[X]=J;continue}if(G0(Y))Q[X]=J;else if(Z0(J)&&Z0(Y))Q[X]=VU(Y,J,W)}return Q}import{existsSync as HU,lstatSync as IF}from"fs";import{join as TF,basename as AF}from"path";import{createHash as CF}from"crypto";var U2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),P2=($)=>typeof $==="number"&&Number.isFinite($),R2=($)=>typeof $==="string",_F=/^v?\d+\.\d+\.\d+$/,RF=new Set(["birth","doubled","peak","current"]);function LU($){return U2($)&&R2($.version)&&_F.test($.version)&&P2($.score)}var PF=($)=>P2($.birthDNA)?$.birthDNA:P2($.birthWeight)?$.birthWeight:null,FF=($)=>U2($)&&P2($.birthDNA)&&R2($.born),qU=($)=>U2($)&&R2($.born)&&P2($.birthDNA)&&P2($.lastScore)&&R2($.endedAt),SF=($)=>Array.isArray($)&&$.length>0&&$.every(LU),jF=($)=>U2($)&&P2($.score)&&R2($.version),EF=($)=>U2($)&&Array.isArray($.milestones)&&$.milestones.every(U2);function KU($){return U2($)&&FF($.birthCertificate)&&SF($.versions)&&jF($.current)&&EF($.growth)}function O3($){try{return IF($),!0}catch{return!1}}var I3=($)=>`${JSON.stringify($,null,2)}
244
- `,wF=new Set(["version","score","lastSync"]),xF=new Set(["type","score","date","version","label","emoji"]),BU=($,Z)=>Object.keys($).every((z)=>Z.has(z)),T3={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},NU=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),DU=($)=>BU($.current,wF)&&NU($).every((Z)=>BU(Z,xF)),yF=($)=>NU($).every((Z)=>Z.label===T3[Z.type].label&&Z.emoji===T3[Z.type].emoji);function kF($){return DU($)&&yF($)}var bF=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",vF=".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.",gF=".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.",hF=".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.",fF=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function uF($){if(!Array.isArray($))return[];return $.filter((Z)=>U2(Z)&&R2(Z.type)&&RF.has(Z.type)&&P2(Z.score))}var a6=($,Z="")=>R2($)?$:Z;function mF($,Z){if(!Array.isArray($))return[];return $.filter(LU).map((z)=>({version:z.version,timestamp:a6(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(R2):[],growth:P2(z.growth)?z.growth:z.score-Z}))}function cF($,Z,z,Q){return{version:a6($.version,Z?.version??"v1.0.0"),score:P2($.score)?$.score:Z?.score??z,lastSync:a6($.lastSync,Q)}}function MU($){if(!U2($)||!U2($.birthCertificate))return null;let Z=$.birthCertificate,z=PF(Z);if(z===null)return null;let Q=a6(Z.born),X=mF($.versions,z),J=cF(U2($.current)?$.current:{},X[X.length-1],z,Q),Y=U2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"||Z.birthWeightSource==="legacy"?"legacy":"init",projectDNA:a6(Z.projectDNA),certificate:a6(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:P2(Y.daysActive)?Y.daysActive:0,milestones:uF(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:a6($.lastModified,Q),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(qU)?{priorLineage:$.priorLineage.filter(qU)}:{}}}class s0{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=TF($,".faf-dna")}exists(){let $=HU(this.dnaPath);if(!$&&!O3(this.dnaPath))this.sawNoFile=!0;return $}endingLineage(){let Z=this.dna??(()=>{let Q=this.read();return Q===null?null:MU(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(!O3(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:R2($.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=R2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(R2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!HU(this.dnaPath)){if(!O3(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(KU(z)&&I3(z)===Z&&kF(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=MU(z),this.reason=!this.dna?fF:!KU(z)?bF:I3(z)!==Z?vF:DU(z)?hF:gF;return this.text=Z,this.dna}read(){let $;try{$=U0(i(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 $=I3(this.dna),Z=this.text??(this.sawNoFile?null:y0(i(this.projectPath,".faf-dna")));o(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return CF("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=AF(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,...T3[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")}}import{spawnSync as IU}from"child_process";import{readFileSync as pF}from"fs";import{isAbsolute as lF,join as OU}from"path";function A3($){let Z=IU("git",["check-ignore","-v","--",".faf-dna"],{cwd:$,encoding:"utf-8"});if(Z.status!==0||typeof Z.stdout!=="string")return null;let z=/^(.*):(\d+):(.*)\t/.exec(Z.stdout);if(!z)return null;let[,Q,X,J]=z;if(J.startsWith("!"))return null;if(dF($,Q,Number(X)))return null;return`${Q}:${X}: ${J}`}function dF($,Z,z){if(z<2)return!1;let Q=IU("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}),X=lF(Z)?[Z]:[OU($,Z),...Q.status===0?[OU(Q.stdout.trim(),Z)]:[]];for(let J of X)try{return(pF(J,"utf-8").split(/\r?\n/)[z-2]??"").trim().startsWith("#")}catch{}return!1}function e5($){let Z=A3($);if(!Z)return null;return`.faf-dna is gitignored (${Z}): a fresh clone loses the birth certificate. Commit it, or put the reason in a # comment above that line.`}l();l();import{statSync as TU}from"fs";import{homedir as iF}from"os";import{parse as nF,resolve as AU}from"path";function CU($,Z){try{let z=TU($,{bigint:!0}),Q=TU(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function rF($){let Z=AU($),z=AU(iF()),Q=nF(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if(CU(Z,z))return"home";if(CU(Z,Q))return"root";return null}function f$($=process.cwd(),Z="faf"){let z=rF($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${A("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(L(" cd /path/to/your-project")),console.error(L(` ${Z}`)),console.error(""),console.error(L(" Home will never be a git repo for this. project.faf belongs with the code.")),process.exit(1)}import{statSync as sF}from"fs";import{dirname as oF,resolve as _U}from"path";function aF($,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 c2}function m$($,Z){return $ instanceof v?`faf: ${$.message}${aF($,Z)}`:`faf: ${$.message}`}function G2($){if($===void 0)return;let Z=oF(_U($)),z;try{z=sF(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 c2(_U($),`${Z} ${z} — nothing written`)}function _3($={}){f$(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:C3(Z,$.output):C3(Z,"project.faf");if($.new&&$.force)console.error(`Pick one: ${C("--new")} keeps .faf-dna, ${C("--force")} starts a new birth.`),process.exit(1);let Q=$.force===!0||$.new===!0;if(RU(z)&&!Q)console.error(`project.faf already exists. Use ${C("--new")} for a fresh one; .faf-dna is kept as it is.`),process.exit(1);G2($.output);let X=h$(Z);k0(z,X,{replace:Q});let J=p(z),Y=a(z,()=>N0(J)),W=new s0(Z),U=!W.exists()||$.force===!0;if(U)W.birth(Y.score);console.log(`${A("created")} ${z}`),E0(Y,z),console.log(L(U?` \uD83E\uDDEC Birth DNA ${Y.score}% — your journey starts here (faf dna)`:" \uD83E\uDDEC .faf-dna kept as it is — your birth certificate (faf dna)"));let G=e5(Z);if(G)console.error(`faf: ${G}`);if(Y.score<100)console.log(L(`
245
- run ${C("'faf go'")} to fill empty slots`));tF(Z,Y.score<100)}function tF($,Z){if(eF($))return;console.log(L(`${Z?"":`
246
- `} next: ${C("'faf card init'")} — your repo's business card`))}function eF($){return[["agent.fafa"],[".fafa"],[".well-known","fafa"]].some((Z)=>RU(C3($,...Z)))}l();function O6($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function $S($,Z){let z=Z.birthCertificate,Q=Z.growth.milestones.find((X)=>X.type==="peak");return{born:z.born,birth_dna:z.birthDNA,certificate:z.certificate,current:Z.current.score,version:Z.current.version,growth:Z.current.score-z.birthDNA,peak:Q?Q.score:Math.max(z.birthDNA,...Z.versions.map((X)=>X.score)),journey:$.getJourney(),versions:Z.versions.map((X)=>({version:X.version,score:X.score,timestamp:X.timestamp,changes:Array.isArray(X.changes)?X.changes:[]})),prior_lives:(Z.priorLineage??[]).map((X)=>({born:X.born,birth_dna:X.birthDNA,last_score:X.lastScore,ended_at:X.endedAt,certificate:X.certificate})),gitignored:A3(process.cwd())!==null,faf_written:$.readOnlyReason()===null,note:$.readOnlyReason()}}function PU($={}){let Z=new s0(process.cwd()),z=Z.load();if(!z){let V=Z.readOnlyReason();console.error(V?`${C("×")} ${V}`:`${C("×")} No FAF DNA found. Run ${C("'faf init'")} to start your journey.`),process.exit(1)}if($.json){console.log(JSON.stringify($S(Z,z),null,2));return}let Q=Z.getJourney(),X=Z.getBirthDNADisplay(),J=X.born.split("T")[0]||"unknown";console.log(),console.log(R0(C("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${A(C(Q))}`),console.log(),console.log(L(` Birth DNA ${X.birthDNA}% (born ${J}) · current ${X.current}% · growth ${X.growth>=0?"+":""}${X.growth}%`));let Y=Z.readOnlyReason();if(Y)console.log(L(` ${Y} Your birth certificate is protected: faf never changes it.`));let W=e5(process.cwd());if(W)console.log(L(` ⚠ ${W}`));let U=Z.getLog();if(U.length>1){console.log(),console.log(L(" history:"));for(let V of U)console.log(L(` ${V}`))}let G=Z.load()?.priorLineage??[];if(G.length>0){console.log(),console.log(L(` earlier ${G.length===1?"life":"lives"}:`));for(let V of G){let H=V.lastScore===V.birthDNA?`${V.birthDNA}%`:`${V.birthDNA}% → ${V.lastScore}%`;console.log(L(` ${H} born ${V.born.slice(0,10)}, reset ${V.endedAt.slice(0,10)} ${V.certificate}`))}}console.log()}import{existsSync as ZS}from"fs";import{join as zS}from"path";l();function $Z(){f$(process.cwd(),"faf auto");let $=process.cwd(),Z=zS($,"project.faf");if(ZS(Z)){let J=e(Z);a(Z,()=>P0(p(Z)));let Y=[],W=k0(Z,GU($,J),{onAliasKept:(U)=>Y.push(y2(U))});console.log(`${W?A("updated"):L("unchanged")} ${Z}`);for(let U of Y)console.log(L(` ${U}`))}else k0(Z,h$($)),console.log(`${A("created")} ${Z}`);let z=p(Z),Q=a(Z,()=>b0(P0(z))),X=new s0($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),O6(X);if(E0(Q,Z,!1,h5(z,Q,{outOfType:!1})),Q.score<100)console.log(L(`
247
- run ${C("'faf go'")} to reach ✪ Trophy`))}import{existsSync as VS}from"fs";import{join as HS}from"path";var c$="(terse — 3-4 words)",QS=[{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? ${c$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${c$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${c$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${c$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${c$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${c$}`,header:"How",type:"text",required:!0}],XS=[{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}],ZZ=[...QS,...XS],JS=new Map(ZZ.map(($)=>[$.path,$])),zm=Object.fromEntries(ZZ.map(($)=>[$.path,$]));function zZ($){let Z=JS.get($);if(Z)return Z.question;let z=K6.get($)??J0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function P3($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||G0(Z)}return!1}function YS($,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 WS($){if($==="project.goal")return!0;return K6.get($)?.category==="human"}function US($,Z=P3){let z=[],Q=[];for(let X of ZZ){let J=YS($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(WS(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function GS($,Z,z=P3){let Q=US(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"?R3(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function R3($){return $.human.map((Z)=>({path:Z,question:zZ(Z)}))}function FU($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??P3,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=GS(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:R3(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:R3(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}l();function SU($={}){let Z=process.cwd(),z=HS(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;qS(FU({read:()=>VS(z)?{data:e(z),yaml:p(z)}:{data:{},yaml:""},score:(J)=>J?a(z,()=>b0(P0(J))).score:0,runAuto:()=>$Z()},{maxRounds:Q}))}function qS($){if($.history.length>1)console.log(L(`
248
- climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${A("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(` ${L("•")} ${z.question}`);console.log(L(`
249
- 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 ${L("--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 Qj}from"fs";import{join as rU}from"path";import{join as hS}from"path";import{dirname as kU,resolve as bU}from"path";var EU=100;var KS="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",BS=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${KS})(?=\\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")],MS=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],LS=["","-->","?>",">","]]>"],NS=/[#`~*+_=<>0-9-]/,DS=/(\d{1,9})([.)])/y,OS=/#{1,6}(?:[ \t]+|$)/y,IS=/`{3,}(?!.*`)|~{3,}/y,TS=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,AS=/(?:=+|-+)[ \t]*$/y,CS=/[^ \t\f\v\r\n]/;function B8($,Z,z){return $.lastIndex=z,$.exec(Z)}var _S=($)=>$==="quote"||$==="list"||$==="item";function RS($){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 p$=($)=>$===" "||$==="\t";function PS($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var jU=($)=>$==="paragraph"||$==="code"||$==="html";function FS($){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(FS),$.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}>`:LS[$.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"&&jU(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!NS.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(!jU($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=MS[$.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),p$(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?B8(TS,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&&p$(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??=RS(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),p$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!B8(OS,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:B8(IS,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=BS[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!=="-"||!B8(AS,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||p$(Q)))return null;if(Z&&!CS.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"?B8(DS,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&&p$(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,p$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!PS(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),_S($.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 l2="<!-- faf:start -->",d2="<!-- faf:end -->",wU="\uFEFF";function t6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var V2=($)=>$.replace(/\r?\n$|\r$/,""),vU=($)=>V2($).replace(/^\uFEFF/,"").trimEnd();function*F3($){let Z=0;for(let z of t6($)){let Q=V2(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 SS($,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 S3($,Z,z){let[Q,X]=[new F2(!0),new F2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of F3($)){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)SS(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 xU=($)=>(Z)=>Z===$;function L8($,Z=l2,z=d2){return S3($,xU(Z),xU(z))}function yU($,Z){let z=[];for(let Q of[!0,!1]){let X=new F2(Q);for(let J of t6($))X.line(V2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var jS=16;function ES($){let Z=new F2(!0);return $.map((z)=>{let Q=Z.overflowAt(V2(z),jS),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(V2(X)),X})}function wS($,Z,z){let X=ES(t6($).map((Y)=>{let W=vU(Y);return W===Z||W===z?` ${Y}`:Y})).join(""),J=yU(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
250
- ${J[0]}`,W=yU(Y,z);if(W.length>=J.length)break;X=Y,J=W}return X}function xS($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=t6(Q).map((J)=>V2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
243
+ `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function s6($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function GF($){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||GF(Q[2])>0.4)return null;return{body:s6(Q[2]),heading:Q[1].trim()}}function VF($){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 s6(X[1])}return null}function HF($,Z){if($?.description&&$.description.length>20)return b0(s6($.description),"package.json:description",0.95);let z=g$(Z,"Purpose|What|About|Overview|Description");if(z)return b0(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("#")&&!VF(J));if(Q)return b0(s6(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?b0(X,"README:problem-heuristic",0.6):null}function qF($){let Z=g$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return b0(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?b0(z,"README:audience-heuristic",0.6):null}function KF($){let Z=g$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return b0(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?b0(z,"README:mission-heuristic",0.6):null}function BF($,Z){let z=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(z)return b0(s6(z.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return b0(s6($.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?b0(Q,"README:deploy-heuristic",0.6):null}function MF($){let Z=g$($,"Timeline|Status|Release|Roadmap");if(Z)return b0(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?b0(z,"README:since-heuristic",0.6):null}function LF($,Z){let z=$?.scripts?Object.keys($.scripts):[],Q=["start","dev","build"].filter((Y)=>z.includes(Y));if(Q.length)return b0(s6(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 b0(X.body,`README:## ${X.heading}`,0.8);let J=g$(Z,"Architecture|Approach|How it works|Methodology|How");return J?b0(J.body,`README:## ${J.heading}`,0.7):null}function h$($){let Z=WU($),z=N3($),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=L6(L6(Q,Z),X);RF(J);let W=(Z._meta?.found??[]).some((G)=>G.startsWith("polyglot:")),U=L6(J,O3($));return L6(U,{human_context:I3($,{toolingRoot:W})})}function qU($,Z){let z=_F(o1(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=V3($),J=Q,Y=L6(z,N3($)),W=L6(Y,J),U=L6(W,O3($)),G=OF(L6(U,{human_context:I3($)}),z),V=IF(NF(Z,z,J)?TF(HU(G,z),z,X):HU(G,z),z);return OW(NW(Z,V))}function NF($,Z,z){if(!G0(v0(Z,"project.type"))){let X=X4($)?.text;return X===void 0||!Z3(X)}return!(z._meta?.found??[]).includes(E$)}function T3($){return $.canonical?[$.path,$.canonical]:[$.path]}function v0($,Z){let[z,Q]=Z.split("."),X=$[z];return Z0(X)?X[Q]:void 0}function N6($,Z,z){let[Q,X]=Z.split("."),J=$[Q];if(!Z0(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 D6=($)=>typeof $==="string"&&$.trim()===t1;function DF($,Z){let z=Z.map((Q)=>v0($,Q));return z.some(D6)&&z.every((Q)=>G0(Q)||D6(Q))}function HU($,Z){let z={...$};for(let Q of J0){let X=T3(Q);if(!DF(Z,X))continue;for(let J of X){let Y=v0(Z,J);if(v0(z,J)!==Y)N6(z,J,Y)}}return z}function o6($,Z){let[z,Q]=Z.split("."),X=$[z];return Z0(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function OF($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!o6(Z,Q.canonical)||o6(Z,Q.path))continue;let X=v0(z,Q.path);N6(z,Q.path,void 0);let J=v0(z,Q.canonical);if($Z(X)&&G0(J))N6(z,Q.canonical,X)}return z}function IF($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!o6(Z,Q.canonical)||o6(Z,Q.path))continue;let X=v0(z,Q.canonical);if($Z(X)||D6(X))N6(z,Q.path,X)}return z}function TF($,Z,z={}){let Q=$.project,X=Z0(Q)?Q.type:void 0,J={...$};for(let Y of J0){if(Y.category==="human"||Y.category==="project")continue;let W=l6(X,Y);if(W===null)return $;if(W){let U=typeof X==="string"&&S5[X]?.has(Y.path)===!0;AF(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0,U)}else CF(J,Y)}return J}function AF($,Z,z,Q,X=!1){let J=T3(z),Y=(U)=>!G0(v0($,U))&&!D6(v0($,U));for(let U of J){if(!D6(v0($,U)))continue;if(X)N6($,U,J.some(Y)?void 0:"");else if(!D6(v0(Z,U)))N6($,U,o6(Z,U)?v0(Z,U):"")}if(!$Z(Q))return;let W=J.filter((U)=>o6($,U));if(W.some((U)=>!G0(v0($,U))))return;for(let U of W.length>0?W:[z.path])N6($,U,Q)}function CF($,Z){let z=T3(Z).filter((X)=>o6($,X)),Q=(X)=>!G0(v0($,X))&&!D6(v0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(G0(v0($,X)))N6($,X,t1)}function _F($){let Z=$.project;if(Z===null||Z===void 0||Z0(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function RF($){let Z=$.project?.type??"library",z=p6[Z]||p6.library;for(let Q of J0){if(z.includes(Q.category)||S5[Z]?.has(Q.path))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function L6($,Z){return KU($,Z,"")}function PF($){let Z=q6.get($);return Z!==void 0&&Z.category!=="human"}function $Z($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!G0($)&&!D6($)}function FF($,Z){return PF($)&&$Z(Z)}function KU($,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(FF(W,J))Q[X]=J;continue}if(G0(Y))Q[X]=J;else if(Z0(J)&&Z0(Y))Q[X]=KU(Y,J,W)}return Q}import{existsSync as BU,lstatSync as SF}from"fs";import{join as jF,basename as EF}from"path";import{createHash as wF}from"crypto";var U2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),P2=($)=>typeof $==="number"&&Number.isFinite($),R2=($)=>typeof $==="string",xF=/^v?\d+\.\d+\.\d+$/,yF=new Set(["birth","doubled","peak","current"]);function DU($){return U2($)&&R2($.version)&&xF.test($.version)&&P2($.score)}var kF=($)=>P2($.birthDNA)?$.birthDNA:P2($.birthWeight)?$.birthWeight:null,bF=($)=>U2($)&&P2($.birthDNA)&&R2($.born),MU=($)=>U2($)&&R2($.born)&&P2($.birthDNA)&&P2($.lastScore)&&R2($.endedAt),vF=($)=>Array.isArray($)&&$.length>0&&$.every(DU),gF=($)=>U2($)&&P2($.score)&&R2($.version),hF=($)=>U2($)&&Array.isArray($.milestones)&&$.milestones.every(U2);function LU($){return U2($)&&bF($.birthCertificate)&&vF($.versions)&&gF($.current)&&hF($.growth)}function fF($){try{return SF($),!0}catch{return!1}}var A3=($)=>`${JSON.stringify($,null,2)}
244
+ `,uF=new Set(["version","score","lastSync"]),mF=new Set(["type","score","date","version","label","emoji"]),NU=($,Z)=>Object.keys($).every((z)=>Z.has(z)),C3={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},OU=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),IU=($)=>NU($.current,uF)&&OU($).every((Z)=>NU(Z,mF)),cF=($)=>OU($).every((Z)=>Z.label===C3[Z.type].label&&Z.emoji===C3[Z.type].emoji);function pF($){return IU($)&&cF($)}var lF=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",dF=".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.",iF=".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.",nF=".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.",rF=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function sF($){if(!Array.isArray($))return[];return $.filter((Z)=>U2(Z)&&R2(Z.type)&&yF.has(Z.type)&&P2(Z.score))}var a6=($,Z="")=>R2($)?$:Z;function oF($,Z){if(!Array.isArray($))return[];return $.filter(DU).map((z)=>({version:z.version,timestamp:a6(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(R2):[],growth:P2(z.growth)?z.growth:z.score-Z}))}function aF($,Z,z,Q){return{version:a6($.version,Z?.version??"v1.0.0"),score:P2($.score)?$.score:Z?.score??z,lastSync:a6($.lastSync,Q)}}function TU($){if(!U2($)||!U2($.birthCertificate))return null;let Z=$.birthCertificate,z=kF(Z);if(z===null)return null;let Q=a6(Z.born),X=oF($.versions,z),J=aF(U2($.current)?$.current:{},X[X.length-1],z,Q),Y=U2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"||Z.birthWeightSource==="legacy"?"legacy":"init",projectDNA:a6(Z.projectDNA),certificate:a6(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:P2(Y.daysActive)?Y.daysActive:0,milestones:sF(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:a6($.lastModified,Q),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(MU)?{priorLineage:$.priorLineage.filter(MU)}:{}}}function AU($){try{return TU(JSON.parse($))?.birthCertificate??null}catch{return null}}class s0{projectPath;dnaPath;dna=null;own=!1;text;reason=null;constructor($){this.projectPath=$,this.dnaPath=jF($,".faf-dna")}exists(){return BU(this.dnaPath)}birth($){if(i(this.projectPath,".faf-dna"),fF(this.dnaPath))throw new v("exists",this.dnaPath,`${this.dnaPath} is already there: a birth certificate is written once and never replaced — not written; original kept`);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"},this.text=void 0,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:R2($.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=R2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(R2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!BU(this.dnaPath))return null;let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(LU(z)&&A3(z)===Z&&pF(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=TU(z),this.reason=!this.dna?rF:!LU(z)?lF:A3(z)!==Z?dF:IU(z)?nF:iF;return this.text=Z,this.dna}read(){let $;try{$=U0(i(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 $=A3(this.dna),Z=this.text??null;o(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$}generateProjectDNA(){return wF("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=EF(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,...C3[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")}}import{spawnSync as _U}from"child_process";import{readFileSync as tF}from"fs";import{isAbsolute as eF,join as CU}from"path";function _3($){let Z=_U("git",["check-ignore","-v","--",".faf-dna"],{cwd:$,encoding:"utf-8"});if(Z.status!==0||typeof Z.stdout!=="string")return null;let z=/^(.*):(\d+):(.*)\t/.exec(Z.stdout);if(!z)return null;let[,Q,X,J]=z;if(J.startsWith("!"))return null;if($S($,Q,Number(X)))return null;return`${Q}:${X}: ${J}`}function $S($,Z,z){if(z<2)return!1;let Q=_U("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}),X=eF(Z)?[Z]:[CU($,Z),...Q.status===0?[CU(Q.stdout.trim(),Z)]:[]];for(let J of X)try{return(tF(J,"utf-8").split(/\r?\n/)[z-2]??"").trim().startsWith("#")}catch{}return!1}function ZZ($){let Z=_3($);if(!Z)return null;return`.faf-dna is gitignored (${Z}): a fresh clone loses the birth certificate. Commit it, or put the reason in a # comment above that line.`}import{spawnSync as ZS}from"child_process";var zS=["certificate","born","birthDNA","projectDNA"];function B4($,Z){let z=ZS("git",Z,{cwd:$,encoding:"utf-8"});return{ok:z.status===0&&typeof z.stdout==="string",out:typeof z.stdout==="string"?z.stdout:""}}function RU($){let Z=B4($,["rev-parse","--is-inside-work-tree"]);return Z.ok&&Z.out.trim()==="true"}function PU($){let Z=B4($,["log","--diff-filter=A","--reverse","--format=%h%x09%cs","--",".faf-dna"]),z=Z.ok?Z.out.split(`
245
+ `)[0]:"";if(!z)return null;let[Q,X]=z.split("\t");return{commit:Q,date:X??""}}function zZ($){if(!RU($))return null;if(B4($,["check-ignore","-q","--",".faf-dna"]).ok)return null;if(PU($))return null;return'The birth certificate is not committed yet. Commit it to make it permanent: git add .faf-dna && git commit -m "faf: birth certificate"'}function FU($,Z){if(!RU($))return{state:"cannot",why:"this is not a git repository, so there is no birth commit to check against."};if(B4($,["rev-parse","--is-shallow-repository"]).out.trim()==="true")return{state:"cannot",why:"this is a shallow clone, so the commit that first added .faf-dna may be missing. Fetch the full history (git fetch --unshallow) and run it again."};let z=PU($);if(!z)return{state:"cannot",why:Z?'.faf-dna is not committed yet. Commit it to make it permanent: git add .faf-dna && git commit -m "faf: birth certificate"':"there is no .faf-dna, and no commit ever added one."};let Q=B4($,["show",`${z.commit}:./.faf-dna`]),X=Q.ok?AU(Q.out):null;if(!X)return{state:"cannot",why:`the .faf-dna in ${z.commit} has no birth certificate faf can read.`};if(!Z)return{state:"changed",...z,fields:[".faf-dna is missing"]};let J=zS.filter((Y)=>X[Y]!==Z[Y]);return J.length===0?{state:"same",...z}:{state:"changed",...z,fields:[...J]}}l();l();import{statSync as SU}from"fs";import{homedir as QS}from"os";import{parse as XS,resolve as jU}from"path";function EU($,Z){try{let z=SU($,{bigint:!0}),Q=SU(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function JS($){let Z=jU($),z=jU(QS()),Q=XS(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if(EU(Z,z))return"home";if(EU(Z,Q))return"root";return null}function f$($=process.cwd(),Z="faf"){let z=JS($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${A("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 YS}from"fs";import{dirname as WS,resolve as wU}from"path";function US($,Z){if($.reason==="not-utf8"||$.reason==="changed"||$.reason==="exists"||$.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 c2}function m$($,Z){return $ instanceof v?`faf: ${$.message}${US($,Z)}`:`faf: ${$.message}`}function G2($){if($===void 0)return;let Z=WS(wU($)),z;try{z=YS(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 c2(wU($),`${Z} ${z} — nothing written`)}function P3($={}){f$(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:R3(Z,$.output):R3(Z,"project.faf"),Q=$.force===!0||$.new===!0;if(xU(z)&&!Q)console.error(`project.faf already exists. Use ${C("--new")} for a fresh one; .faf-dna is kept as it is.`),process.exit(1);G2($.output);let X=h$(Z);y0(z,X,{replace:Q});let J=p(z),Y=a(z,()=>N0(J)),W=GS(VS(z)),U=new s0(W),G=!U.exists();if(G)U.birth(Y.score);if(console.log(`${A("created")} ${z}`),E0(Y,z),console.log(M(G?` \uD83E\uDDEC Birth DNA ${Y.score}% — your journey starts here (faf dna)`:" \uD83E\uDDEC .faf-dna kept as it is — your birth certificate (faf dna)")),HS(W,G,$.force===!0),Y.score<100)console.log(M(`
246
+ run ${C("'faf go'")} to fill empty slots`));qS(Z,Y.score<100)}function HS($,Z,z){if(!Z&&z)console.error(`faf: ${C("--force")} no longer starts a new birth: the birth certificate is written once. project.faf was replaced, as ${C("--new")} does.`);let Q=ZZ($);if(Q)console.error(`faf: ${Q}`);let X=Z?zZ($):null;if(X)console.log(M(` ${X}`))}function qS($,Z){if(KS($))return;console.log(M(`${Z?"":`
247
+ `} next: ${C("'faf card init'")} — your repo's business card`))}function KS($){return[["agent.fafa"],[".fafa"],[".well-known","fafa"]].some((Z)=>xU(R3($,...Z)))}l();function O6($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function BS($,Z){let z=FU(process.cwd(),$.load()?.birthCertificate??null);if(Z)console.log(JSON.stringify(z,null,2));else if(z.state==="same")console.log(`${A("✓")} Birth certificate matches the commit that first added .faf-dna (${z.commit}, ${z.date}).`);else if(z.state==="changed")console.error(`${C("×")} The birth certificate differs from the commit that first added .faf-dna (${z.commit}, ${z.date}): ${z.fields.join(", ")}. The original: git show ${z.commit}:.faf-dna`);else console.error(`faf: cannot verify: ${z.why}`);process.exit(z.state==="same"?0:z.state==="changed"?1:2)}function MS($,Z){let z=Z.birthCertificate,Q=Z.growth.milestones.find((X)=>X.type==="peak");return{born:z.born,birth_dna:z.birthDNA,certificate:z.certificate,current:Z.current.score,version:Z.current.version,growth:Z.current.score-z.birthDNA,peak:Q?Q.score:Math.max(z.birthDNA,...Z.versions.map((X)=>X.score)),journey:$.getJourney(),versions:Z.versions.map((X)=>({version:X.version,score:X.score,timestamp:X.timestamp,changes:Array.isArray(X.changes)?X.changes:[]})),prior_lives:(Z.priorLineage??[]).map((X)=>({born:X.born,birth_dna:X.birthDNA,last_score:X.lastScore,ended_at:X.endedAt,certificate:X.certificate})),gitignored:_3(process.cwd())!==null,faf_written:$.readOnlyReason()===null,note:$.readOnlyReason()}}function yU($={}){let Z=new s0(process.cwd());if($.verify){BS(Z,$.json===!0);return}let z=Z.load();if(!z){let H=Z.readOnlyReason();console.error(H?`${C("×")} ${H}`:`${C("×")} No FAF DNA found. Run ${C("'faf init'")} to start your journey.`),process.exit(1)}if($.json){console.log(JSON.stringify(MS(Z,z),null,2));return}let Q=Z.getJourney(),X=Z.getBirthDNADisplay(),J=X.born.split("T")[0]||"unknown";console.log(),console.log(R0(C("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${A(C(Q))}`),console.log(),console.log(M(` Birth DNA ${X.birthDNA}% (born ${J}) · current ${X.current}% · growth ${X.growth>=0?"+":""}${X.growth}%`));let Y=Z.readOnlyReason();if(Y)console.log(M(` ${Y} Your birth certificate is protected: faf never changes it.`));let W=ZZ(process.cwd());if(W)console.log(M(` ⚠ ${W}`));let U=zZ(process.cwd());if(U)console.log(M(` ⚠ ${U}`));let G=Z.getLog();if(G.length>1){console.log(),console.log(M(" history:"));for(let H of G)console.log(M(` ${H}`))}let V=Z.load()?.priorLineage??[];if(V.length>0){console.log(),console.log(M(` earlier ${V.length===1?"life":"lives"}:`));for(let H of V){let q=H.lastScore===H.birthDNA?`${H.birthDNA}%`:`${H.birthDNA}% → ${H.lastScore}%`;console.log(M(` ${q} born ${H.born.slice(0,10)}, reset ${H.endedAt.slice(0,10)} ${H.certificate}`))}}console.log()}import{existsSync as LS}from"fs";import{join as NS}from"path";l();function QZ(){f$(process.cwd(),"faf auto");let $=process.cwd(),Z=NS($,"project.faf");if(LS(Z)){let J=e(Z);a(Z,()=>P0(p(Z)));let Y=[],W=y0(Z,qU($,J),{onAliasKept:(U)=>Y.push(y2(U))});console.log(`${W?A("updated"):M("unchanged")} ${Z}`);for(let U of Y)console.log(M(` ${U}`))}else y0(Z,h$($)),console.log(`${A("created")} ${Z}`);let z=p(Z),Q=a(Z,()=>k0(P0(z))),X=new s0($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),O6(X);if(E0(Q,Z,!1,u5(z,Q,{outOfType:!1})),Q.score<100)console.log(M(`
248
+ run ${C("'faf go'")} to reach ✪ Trophy`))}import{existsSync as RS}from"fs";import{join as PS}from"path";var c$="(terse — 3-4 words)",DS=[{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? ${c$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${c$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${c$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${c$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${c$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${c$}`,header:"How",type:"text",required:!0}],OS=[{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}],XZ=[...DS,...OS],IS=new Map(XZ.map(($)=>[$.path,$])),Tm=Object.fromEntries(XZ.map(($)=>[$.path,$]));function JZ($){let Z=IS.get($);if(Z)return Z.question;let z=q6.get($)??J0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function S3($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||G0(Z)}return!1}function TS($,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 AS($){if($==="project.goal")return!0;return q6.get($)?.category==="human"}function CS($,Z=S3){let z=[],Q=[];for(let X of XZ){let J=TS($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(AS(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function _S($,Z,z=S3){let Q=CS(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"?F3(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function F3($){return $.human.map((Z)=>({path:Z,question:JZ(Z)}))}function kU($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??S3,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=_S(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:F3(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:F3(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}l();function bU($={}){let Z=process.cwd(),z=PS(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;FS(kU({read:()=>RS(z)?{data:e(z),yaml:p(z)}:{data:{},yaml:""},score:(J)=>J?a(z,()=>k0(P0(J))).score:0,runAuto:()=>QZ()},{maxRounds:Q}))}function FS($){if($.history.length>1)console.log(M(`
249
+ climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${A("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(`
250
+ 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 Dj}from"fs";import{join as ZG}from"path";import{join as eS}from"path";import{dirname as mU,resolve as cU}from"path";var gU=100;var SS="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",jS=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${SS})(?=\\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")],ES=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],wS=["","-->","?>",">","]]>"],xS=/[#`~*+_=<>0-9-]/,yS=/(\d{1,9})([.)])/y,kS=/#{1,6}(?:[ \t]+|$)/y,bS=/`{3,}(?!.*`)|~{3,}/y,vS=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,gS=/(?:=+|-+)[ \t]*$/y,hS=/[^ \t\f\v\r\n]/;function M4($,Z,z){return $.lastIndex=z,$.exec(Z)}var fS=($)=>$==="quote"||$==="list"||$==="item";function uS($){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 p$=($)=>$===" "||$==="\t";function mS($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var vU=($)=>$==="paragraph"||$==="code"||$==="html";function cS($){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(cS),$.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}>`:wS[$.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"&&vU(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!xS.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(!vU($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=ES[$.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),p$(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?M4(vS,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&&p$(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??=uS(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),p$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!M4(kS,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:M4(bS,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=jS[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!=="-"||!M4(gS,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||p$(Q)))return null;if(Z&&!hS.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"?M4(yS,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&&p$(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,p$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!mS(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),fS($.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 -->",hU="\uFEFF";function t6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var V2=($)=>$.replace(/\r?\n$|\r$/,""),pU=($)=>V2($).replace(/^\uFEFF/,"").trimEnd();function*j3($){let Z=0;for(let z of t6($)){let Q=V2(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 pS($,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 E3($,Z,z){let[Q,X]=[new F2(!0),new F2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of j3($)){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)pS(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 fU=($)=>(Z)=>Z===$;function N4($,Z=p2,z=l2){return E3($,fU(Z),fU(z))}function uU($,Z){let z=[];for(let Q of[!0,!1]){let X=new F2(Q);for(let J of t6($))X.line(V2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var lS=16;function dS($){let Z=new F2(!0);return $.map((z)=>{let Q=Z.overflowAt(V2(z),lS),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(V2(X)),X})}function iS($,Z,z){let X=dS(t6($).map((Y)=>{let W=pU(Y);return W===Z||W===z?` ${Y}`:Y})).join(""),J=uU(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
251
+ ${J[0]}`,W=uU(Y,z);if(W.length>=J.length)break;X=Y,J=W}return X}function nS($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=t6(Q).map((J)=>V2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
251
252
  ${X}
252
- ${z}`}function M8($,Z,z,Q=l2,X=d2,J="the file"){let Y=(U)=>{let G=`${$}${U}${z}`,V=L8(G,Q,X);return V&&V.start===$.length&&V.end===$.length+U.length?G:null},W=Y(Z)??Y(xS(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 j3($,Z=l2,z=d2){return`${Z}
253
- ${wS($.trim(),Z,z)}
254
- ${z}`}function QZ($,Z,z=l2,Q=d2,X){if($===null)return M8("",Z,`
255
- `,z,Q,X);let J=L8($,z,Q);if(J)return M8($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(wU)?wU:"";return M8(Y,Z,`
253
+ ${z}`}function L4($,Z,z,Q=p2,X=l2,J="the file"){let Y=(U)=>{let G=`${$}${U}${z}`,V=N4(G,Q,X);return V&&V.start===$.length&&V.end===$.length+U.length?G:null},W=Y(Z)??Y(nS(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 w3($,Z=p2,z=l2){return`${Z}
254
+ ${iS($.trim(),Z,z)}
255
+ ${z}`}function YZ($,Z,z=p2,Q=l2,X){if($===null)return L4("",Z,`
256
+ `,z,Q,X);let J=N4($,z,Q);if(J)return L4($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(hU)?hU:"";return L4(Y,Z,`
256
257
 
257
- ${$.slice(Y.length)}`,z,Q,X)}function I6($){try{return U0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function H2($,Z,z=l2,Q=d2,X={}){let J=j3(Z,z,Q),Y=bU($),W=X.root??kU(Y),U=i(W,Y),G=I6(U);o(U,QZ(G,J,z,Q,Y),{root:W,expect:G})}var yS="<!-- faf:";function kS($){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 bS($,Z){let z=[new F2(!0),new F2(!1)],Q=!1;for(let{content:X}of F3($)){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 vS($,Z,z){let Q=[new F2(!0),new F2(!1)];for(let{content:X}of F3($)){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 E3($,Z,z=l2,Q=d2){if(Z===null||L8(Z,z,Q))return null;let X=vU(t6(Z)[0]??"");if(X.startsWith(yS)&&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=bS(Z,z);if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${EU} 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 ${kS(J)} and is left as you had it — delete it by hand if you no longer want it.`;if(vS(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 XZ($,Z,z=l2,Q=d2,X={}){try{let J=bU($);return E3(Z,I6(i(X.root??kU(J),J)),z,Q)}catch{return null}}var gS=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 w3($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return gS.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function H0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function u0($){let Z=K6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return w3(z)}var fS=x0.claude,uS="STATUS: SYNC ACTIVE";function gU($,Z){H2(hS($,fS),Z)}function i2($,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}
258
- ${U}`}function hU($){let Z=[],z=$.project?.name??"Project",Q=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(i2($)),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(`**${u0(`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])=>`- **${u0(`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(`*${uS} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
259
- `)}import{existsSync as jm,lstatSync as dU,readFileSync as YZ,realpathSync as x3,statSync as mS}from"fs";import{homedir as cS}from"os";import{basename as pS,dirname as y3,join as n2,resolve as $$}from"path";function e6($){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 T6($){return e6($).cmd}var fU=200,uU=200,mU=12,lS="# Project Context (from project.faf)",dS="*This section is managed by tri-sync.";function iS($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function nS($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=fU)return Z;return`${Z.slice(0,fU)}-${Math.abs(iS($)).toString(36)}`}function iU($){try{let Z=dU($);if(Z.isSymbolicLink()){let z=mS($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function cU($){try{return dU($).isFile()}catch{return!1}}function rS($){let Z=$;for(;;){if(iU(n2(Z,".git")))return Z;let z=y3(Z);if(z===Z)return null;Z=z}}function sS($){let Z;try{Z=YZ(n2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=$$($,Z.slice(7).trim()),Q=n2(z,"commondir");if(!cU(Q))return $;let X=$$(z,YZ(Q,"utf-8").trim());if($$(y3(z))!==n2(X,"worktrees"))return $;let J=n2(z,"gitdir");if(!cU(J))return $;let Y=YZ(J,"utf-8").trim();if(x3($$(z,Y))!==n2(x3($),".git"))return $;if(pS(X)!==".git")return iU(n2(X,".git"))?$:X;return y3(X)}catch{return $}}function oS($){let Z=$$($);try{Z=x3.native(Z)}catch{}let z=rS(Z);return(z?sS(z):Z).normalize("NFC")}function aS($,Z={}){if(Z.memoryDir)return $$(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||n2(cS(),".claude");return n2($$(z),"projects",nS(oS($)),"memory").normalize("NFC")}var tS=new Set(["target_user","core_problem","mission_purpose"]),eS=["who","what","why","where","when","how"];function $j($){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:** ${H0(Z.name)?Z.name:"Project"}`,...z.filter(([,Y])=>H0(Y)).map(([Y,W])=>`- **${Y}:** ${W}`),...JZ("Stack",Object.entries($.stack??{}).filter(([Y,W])=>!tS.has(Y)&&H0(W)).map(([Y,W])=>`- **${u0(`stack.${Y}`)}:** ${W}`)),...JZ("Context",eS.filter((Y)=>H0(Q[Y])).map((Y)=>`- **${u0(`human_context.${Y}`)}:** ${Q[Y]}`)),...JZ("Commands",Object.entries($.commands??{}).filter(([,Y])=>H0(Y)).slice(0,mU).map(([Y,W])=>`- ${Y}: \`${T6(W)}\``)),...JZ("Key files",X.filter(H0).slice(0,mU).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(`
260
- `)}function JZ($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function Zj($){return S3($,(Z)=>Z.trimEnd()===lS,(Z)=>Z.startsWith(dS))}function pU($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function zj($,Z,z){if($===null)return{text:QZ(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=L8($),X=Q??Zj($);if(X){let Y=$.slice(0,X.start),W=$.slice(X.end);return{text:M8(Y,Z,W,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:W}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:QZ($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function lU($){return $>uU?[`MEMORY.md is ${$} lines. Claude Code loads the first ${uU}; lines after that are kept in the file but not loaded.`]:[]}function nU($,Z,z={}){let Q=aS($,z);j0(Q);let X=i(Q,x0.memory),J=I6(X),Y=zj(J,j3($j(Z)),X);if(Y.text===J){let q=pU(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:q,warnings:lU(q)}}let W=o(X,Y.text,{root:Q,expect:J}),U=YZ(W,"utf-8"),G=U===Y.text&&U.startsWith(Y.head)&&U.endsWith(Y.tail),V=pU(U),H=Y.action==="added"?E3(x0.memory,J):null;return{path:W,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...H?[H]:[],...lU(V)]}}l();function N8(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function sU($={}){let Z=process.cwd(),z=m(Z);if(!z)console.error(`Error: project.faf not found
258
+ ${$.slice(Y.length)}`,z,Q,X)}function I6($){try{return U0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function H2($,Z,z=p2,Q=l2,X={}){let J=w3(Z,z,Q),Y=cU($),W=X.root??mU(Y),U=i(W,Y),G=I6(U);o(U,YZ(G,J,z,Q,Y),{root:W,expect:G})}var rS="<!-- faf:";function sS($){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 oS($,Z){let z=[new F2(!0),new F2(!1)],Q=!1;for(let{content:X}of j3($)){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 aS($,Z,z){let Q=[new F2(!0),new F2(!1)];for(let{content:X}of j3($)){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 x3($,Z,z=p2,Q=l2){if(Z===null||N4(Z,z,Q))return null;let X=pU(t6(Z)[0]??"");if(X.startsWith(rS)&&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=oS(Z,z);if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${gU} 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 ${sS(J)} and is left as you had it — delete it by hand if you no longer want it.`;if(aS(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 WZ($,Z,z=p2,Q=l2,X={}){try{let J=cU($);return x3(Z,I6(i(X.root??mU(J),J)),z,Q)}catch{return null}}var tS=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 y3($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return tS.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function H0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function f0($){let Z=q6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return y3(z)}var $j=x0.claude,Zj="STATUS: SYNC ACTIVE";function lU($,Z){H2(eS($,$j),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}
259
+ ${U}`}function dU($){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(`**${f0(`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])=>`- **${f0(`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(`*${Zj} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
260
+ `)}import{existsSync as rm,lstatSync as tU,readFileSync as GZ,realpathSync as k3,statSync as zj}from"fs";import{homedir as Qj}from"os";import{basename as Xj,dirname as b3,join as i2,resolve as $$}from"path";function e6($){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 T6($){return e6($).cmd}var iU=200,nU=200,rU=12,Jj="# Project Context (from project.faf)",Yj="*This section is managed by tri-sync.";function Wj($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function Uj($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=iU)return Z;return`${Z.slice(0,iU)}-${Math.abs(Wj($)).toString(36)}`}function eU($){try{let Z=tU($);if(Z.isSymbolicLink()){let z=zj($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function sU($){try{return tU($).isFile()}catch{return!1}}function Gj($){let Z=$;for(;;){if(eU(i2(Z,".git")))return Z;let z=b3(Z);if(z===Z)return null;Z=z}}function Vj($){let Z;try{Z=GZ(i2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=$$($,Z.slice(7).trim()),Q=i2(z,"commondir");if(!sU(Q))return $;let X=$$(z,GZ(Q,"utf-8").trim());if($$(b3(z))!==i2(X,"worktrees"))return $;let J=i2(z,"gitdir");if(!sU(J))return $;let Y=GZ(J,"utf-8").trim();if(k3($$(z,Y))!==i2(k3($),".git"))return $;if(Xj(X)!==".git")return eU(i2(X,".git"))?$:X;return b3(X)}catch{return $}}function Hj($){let Z=$$($);try{Z=k3.native(Z)}catch{}let z=Gj(Z);return(z?Vj(z):Z).normalize("NFC")}function qj($,Z={}){if(Z.memoryDir)return $$(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||i2(Qj(),".claude");return i2($$(z),"projects",Uj(Hj($)),"memory").normalize("NFC")}var Kj=new Set(["target_user","core_problem","mission_purpose"]),Bj=["who","what","why","where","when","how"];function Mj($){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:** ${H0(Z.name)?Z.name:"Project"}`,...z.filter(([,Y])=>H0(Y)).map(([Y,W])=>`- **${Y}:** ${W}`),...UZ("Stack",Object.entries($.stack??{}).filter(([Y,W])=>!Kj.has(Y)&&H0(W)).map(([Y,W])=>`- **${f0(`stack.${Y}`)}:** ${W}`)),...UZ("Context",Bj.filter((Y)=>H0(Q[Y])).map((Y)=>`- **${f0(`human_context.${Y}`)}:** ${Q[Y]}`)),...UZ("Commands",Object.entries($.commands??{}).filter(([,Y])=>H0(Y)).slice(0,rU).map(([Y,W])=>`- ${Y}: \`${T6(W)}\``)),...UZ("Key files",X.filter(H0).slice(0,rU).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(`
261
+ `)}function UZ($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function Lj($){return E3($,(Z)=>Z.trimEnd()===Jj,(Z)=>Z.startsWith(Yj))}function oU($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function Nj($,Z,z){if($===null)return{text:YZ(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=N4($),X=Q??Lj($);if(X){let Y=$.slice(0,X.start),W=$.slice(X.end);return{text:L4(Y,Z,W,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:W}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:YZ($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function aU($){return $>nU?[`MEMORY.md is ${$} lines. Claude Code loads the first ${nU}; lines after that are kept in the file but not loaded.`]:[]}function $G($,Z,z={}){let Q=qj($,z);j0(Q);let X=i(Q,x0.memory),J=I6(X),Y=Nj(J,w3(Mj(Z)),X);if(Y.text===J){let q=oU(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:q,warnings:aU(q)}}let W=o(X,Y.text,{root:Q,expect:J}),U=GZ(W,"utf-8"),G=U===Y.text&&U.startsWith(Y.head)&&U.endsWith(Y.tail),V=oU(U),H=Y.action==="added"?x3(x0.memory,J):null;return{path:W,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...H?[H]:[],...aU(V)]}}l();function D4(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function zG($={}){let Z=process.cwd(),z=m(Z);if(!z)console.error(`Error: project.faf not found
261
262
 
262
- Run 'faf init' to create one.`),process.exit(2);let Q=rU(Z,"CLAUDE.md");if(oU(z,Z),N8())aU(z,Z);if($.watch)console.log(L("watching for changes... (Ctrl+C to stop)")),Jj(z,Q,Z)}function oU($,Z){let z=e($),Q=hU(z),X=XZ(rU(Z,"CLAUDE.md"),"CLAUDE.md");if(gU(Z,Q),console.log(`${A("◆")} sync .faf → CLAUDE.md`),X)console.log(L(` ${X}`));let J=a($,()=>b0(P0(p($))));E0(J,$)}var Xj={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=nU(Z,e($));console.log(`${A("◆")} sync .faf → MEMORY.md ${L(`${Xj[z.action]} — ${z.path}`)}`);for(let Q of z.warnings)console.log(L(` ${Q}`))}catch(z){console.error(`${C("×")} sync .faf → MEMORY.md ${z instanceof Error?z.message:String(z)}`),process.exitCode=1}}function Jj($,Z,z){let{watch:Q}=n0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(L("change detected...")),oU($,z),N8())aU($,z)},200)};if(Q($,J),Qj(Z))Q(Z,J)}import{statSync as tU}from"fs";import{dirname as eU,resolve as D8}from"path";l();function k3($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var b3="FAFB header (a .fafb faf compiled)";function v3($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function g3($,Z){if(D8($)===D8(Z))return!0;try{let z=tU($),Q=tU(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function $G($,Z={}){let z=$??m();if(!z)console.error(`Error: project.faf not found
263
+ Run 'faf init' to create one.`),process.exit(2);let Q=ZG(Z,"CLAUDE.md");if(QG(z,Z),D4())XG(z,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),Ij(z,Q,Z)}function QG($,Z){let z=e($),Q=dU(z),X=WZ(ZG(Z,"CLAUDE.md"),"CLAUDE.md");if(lU(Z,Q),console.log(`${A("◆")} sync .faf → CLAUDE.md`),X)console.log(M(` ${X}`));let J=a($,()=>k0(P0(p($))));E0(J,$)}var Oj={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 XG($,Z){try{let z=$G(Z,e($));console.log(`${A("◆")} sync .faf → MEMORY.md ${M(`${Oj[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 Ij($,Z,z){let{watch:Q}=c0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(M("change detected...")),QG($,z),D4())XG($,z)},200)};if(Q($,J),Dj(Z))Q(Z,J)}import{statSync as JG}from"fs";import{dirname as YG,resolve as O4}from"path";l();function v3($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var g3="FAFB header (a .fafb faf compiled)";function h3($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function f3($,Z){if(O4($)===O4(Z))return!0;try{let z=JG($),Q=JG(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function WG($,Z={}){let z=$??m();if(!z)console.error(`Error: project.faf not found
263
264
 
264
- Run 'faf init' to create one.`),process.exit(2);let Q=p(z);Y2(Q,z);let X=a(z,()=>g5(Q)),J=Z.output??v3(z);if(g3(J,z))console.error(`faf: ${D8(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);G2(Z.output);let Y=Z.output?eU(D8(J)):eU(D8(z));x2(J,X,{root:Y,owns:k3,mark:b3,force:Z.force}),console.log(`${A("compiled")} ${J} ${L(`(${X.length} bytes)`)}`)}import{readFileSync as _j}from"fs";import{dirname as Rj,resolve as VG}from"path";import{createHash as Vj}from"crypto";import{resolve as Hj}from"path";class m0 extends Error{constructor($){super($);this.name="JsonEditError"}}var Yj=new Set([" ","\t",`
265
- `,"\r"]);class u3{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 m0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&Yj.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 h3=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function f3($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>f3(z,Z[Q]));if(h3($)&&h3(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&f3($[Q],Z[Q]))}return!1}class m3{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
265
+ Run 'faf init' to create one.`),process.exit(2);let Q=p(z);Y2(Q,z);let X=a(z,()=>f5(Q)),J=Z.output??h3(z);if(f3(J,z))console.error(`faf: ${O4(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);G2(Z.output);let Y=Z.output?YG(O4(J)):YG(O4(z));x2(J,X,{root:Y,owns:v3,mark:g3,force:Z.force}),console.log(`${A("compiled")} ${J} ${M(`(${X.length} bytes)`)}`)}import{readFileSync as fj}from"fs";import{dirname as uj,resolve as NG}from"path";import{createHash as Rj}from"crypto";import{resolve as Pj}from"path";class u0 extends Error{constructor($){super($);this.name="JsonEditError"}}var Tj=new Set([" ","\t",`
266
+ `,"\r"]);class c3{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 u0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&Tj.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 u3=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function m3($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>m3(z,Z[Q]));if(u3($)&&u3(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&m3($[Q],Z[Q]))}return!1}class p3{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
266
267
  `,$-1);return Z>=0&&/^[ \t]*$/.test(this.s.slice(Z+1,$))}indentOf($){return this.startsLine($)?this.s.slice(this.s.lastIndexOf(`
267
268
  `,$-1)+1,$):""}render($,Z,z){if(!z)return JSON.stringify($);return JSON.stringify($,null,this.style.unit).split(`
268
- `).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((q)=>q.key===J);if(U.length>1)throw new m0(`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(h3(Y)){if(G.value.kind!=="object")throw new m0(`"${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(`
269
- `));continue}let H=JSON.parse(this.s.slice(G.value.start,G.value.end));if(f3(H,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new m0(`"${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((q)=>q.key===H)).find((H)=>H!==void 0);if(this.startsLine(X[0].keyStart)){let H=W&&W!==J?X[X.indexOf(W)+1]:J,q=this.indentOf(H.keyStart),K=this.s.slice(H.keyEnd,H.value.start),M=this.s.lastIndexOf(`
270
- `,H.keyStart-1),B=M>0&&this.s[M-1]==="\r"?M-1:M,N=`${this.style.eol}${q}${JSON.stringify(Z)}${K}${this.render(z,q,!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(`
271
- `,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function ZG($,Z){let z=$.includes(`\r
269
+ `).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((q)=>q.key===J);if(U.length>1)throw new u0(`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(u3(Y)){if(G.value.kind!=="object")throw new u0(`"${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(`
270
+ `));continue}let H=JSON.parse(this.s.slice(G.value.start,G.value.end));if(m3(H,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new u0(`"${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((q)=>q.key===H)).find((H)=>H!==void 0);if(this.startsLine(X[0].keyStart)){let H=W&&W!==J?X[X.indexOf(W)+1]:J,q=this.indentOf(H.keyStart),K=this.s.slice(H.keyEnd,H.value.start),L=this.s.lastIndexOf(`
271
+ `,H.keyStart-1),B=L>0&&this.s[L-1]==="\r"?L-1:L,N=`${this.style.eol}${q}${JSON.stringify(Z)}${K}${this.render(z,q,!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(`
272
+ `,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function UG($,Z){let z=$.includes(`\r
272
273
  `)?`\r
273
274
  `:`
274
275
  `,Q=Z.members[0],X=Q?$.lastIndexOf(`
275
- `,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function l$($,Z,z={}){let Q=new u3($).parse();if(Q.kind!=="object")throw new m0("the JSON is not an object");let X=new m3($,ZG($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
276
- `)),WZ($,X.edits)}function WZ($,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 zG($){let Z=new u3($).parse();if(Z.kind!=="object")throw new m0("the JSON is not an object");return Z}function Wj($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new m0(`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 QG($,Z,z,Q){let X=zG($),J=new m3($,ZG($,X),{}),Y=$.slice(X.start,X.end).includes(`
277
- `),W=X.members.filter((H)=>H.key===Z);if(W.length>1)throw new m0(`the key "${Z}" is there more than once`);if(W.length===0)return J.apply(X,{[Z]:z},"",Y),WZ($,J.edits);let U=W[0],G=U.value;if(G.kind!=="array")throw new m0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let H of z){let q=H[Q.id],K=G.items.filter((N,O)=>N.kind==="object"&&Wj($,N,Q.id,`${Z}[${O}]`)===q);if(K.length>1)throw new m0(`the ${Z} row ${JSON.stringify(q)} is there more than once`);if(K.length===0){V.push(H);continue}let M=K[0],B=Object.fromEntries(Q.update.map((N)=>[N,H[N]]));J.apply(M,B,`${Z}[${G.items.indexOf(M)}]`,$.slice(M.start,M.end).includes(`
278
- `))}return J.append(G,V,U.keyStart,Y),WZ($,J.edits)}function Uj($,Z){let z=$.lastIndexOf(`
279
- `,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function Gj($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(Uj($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
280
- `,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 XG($,Z){let z=[],Q=zG($);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 JG($,Z){let{count:z,chain:Q}=XG($,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 c3($,Z,z={}){let{count:Q,chain:X}=XG($,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 WZ($,[Gj($,J.obj,J.member)]).text}var WG="one.faf/render";function l3($){return`sha256:${Vj("sha256").update($,"utf8").digest("hex")}`}var qj=/^sha256:[0-9a-f]{64}$/,Kj=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,Bj='<meta name="faf-render"',Mj='<meta name="description" content="Visual render of project.faf.';function Lj($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(Mj));return Z.splice(z+1,0,`<meta name="faf-render" content="${l3($)}">
281
- `),Z.join("")}function UG($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),W=Kj.exec(Y);if(W)z.push({at:J,hash:W[1]});else if(Y.startsWith(Bj))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 p3=["_meta",WG];function Nj($){return l$($,{_meta:{[WG]:l3($)}}).text}function Dj($){try{return c3($,p3,{dropEmptyParent:!0})??$}catch{return $}}function Oj($){let Z;try{Z=JG($,p3)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!qj.test(Z.value))return"many";let z=c3($,p3,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function GG($,Z){return $==="html"?Lj(Z):Nj(Z)}function Ij($,Z){if($==="json")return Dj(Z);let z=UG(Z);return z===null||z==="many"?Z:z.canonical}function YG($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?UG(z):Oj(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===l3(Q.canonical)&&GG(Z,Q.canonical)===z?"match":"mismatch"}function Tj($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
276
+ `,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function l$($,Z,z={}){let Q=new c3($).parse();if(Q.kind!=="object")throw new u0("the JSON is not an object");let X=new p3($,UG($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
277
+ `)),VZ($,X.edits)}function VZ($,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 GG($){let Z=new c3($).parse();if(Z.kind!=="object")throw new u0("the JSON is not an object");return Z}function Aj($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new u0(`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 VG($,Z,z,Q){let X=GG($),J=new p3($,UG($,X),{}),Y=$.slice(X.start,X.end).includes(`
278
+ `),W=X.members.filter((H)=>H.key===Z);if(W.length>1)throw new u0(`the key "${Z}" is there more than once`);if(W.length===0)return J.apply(X,{[Z]:z},"",Y),VZ($,J.edits);let U=W[0],G=U.value;if(G.kind!=="array")throw new u0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let H of z){let q=H[Q.id],K=G.items.filter((N,O)=>N.kind==="object"&&Aj($,N,Q.id,`${Z}[${O}]`)===q);if(K.length>1)throw new u0(`the ${Z} row ${JSON.stringify(q)} is there more than once`);if(K.length===0){V.push(H);continue}let L=K[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(`
279
+ `))}return J.append(G,V,U.keyStart,Y),VZ($,J.edits)}function Cj($,Z){let z=$.lastIndexOf(`
280
+ `,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function _j($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(Cj($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
281
+ `,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 HG($,Z){let z=[],Q=GG($);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 qG($,Z){let{count:z,chain:Q}=HG($,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 l3($,Z,z={}){let{count:Q,chain:X}=HG($,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 VZ($,[_j($,J.obj,J.member)]).text}var BG="one.faf/render";function i3($){return`sha256:${Rj("sha256").update($,"utf8").digest("hex")}`}var Fj=/^sha256:[0-9a-f]{64}$/,Sj=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,jj='<meta name="faf-render"',Ej='<meta name="description" content="Visual render of project.faf.';function wj($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(Ej));return Z.splice(z+1,0,`<meta name="faf-render" content="${i3($)}">
282
+ `),Z.join("")}function MG($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),W=Sj.exec(Y);if(W)z.push({at:J,hash:W[1]});else if(Y.startsWith(jj))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 d3=["_meta",BG];function xj($){return l$($,{_meta:{[BG]:i3($)}}).text}function yj($){try{return l3($,d3,{dropEmptyParent:!0})??$}catch{return $}}function kj($){let Z;try{Z=qG($,d3)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!Fj.test(Z.value))return"many";let z=l3($,d3,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function LG($,Z){return $==="html"?wj(Z):xj(Z)}function bj($,Z){if($==="json")return yj(Z);let z=MG(Z);return z===null||z==="many"?Z:z.canonical}function KG($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?MG(z):kj(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===i3(Q.canonical)&&LG(Z,Q.canonical)===z?"match":"mismatch"}function vj($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
282
283
  `)||/(?:^|[^\r])\n/.test(Z)||!Buffer.from(Z,"utf-8").equals($))return null;return Buffer.from(Z.replace(/\r\n/g,`
283
- `),"utf-8")}function Aj($,Z,z){let Q=YG($,z);return Q!=="match"&&Z!==null&&YG(Z,z)==="match"?"match":Q}function q2($,Z,z){let Q=Hj($),X=i(z.root,Q),J=Ij(z.format,Z),Y=GG(z.format,J),W=y0(X);if(W===null)return o(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=Tj(W),G=U===null?Y:Y.replace(/\r?\n/g,`\r
284
- `);if(U!==null&&W.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!Cj(Q,W,U,J,z))return{path:X,result:"unchanged"};return o(X,G,{root:z.root,expect:W}),{path:X,result:"updated"}}function Cj($,Z,z,Q,X){let J=Aj(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})}l();function HG($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array(_j($));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=a($,()=>RW(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(g3(Z.output,$))console.error(`faf: ${VG(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);G2(Z.output);let{result:J}=q2(Z.output,`${X}
285
- `,{root:Rj(VG(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${A("decompiled")} ${Z.output}${J==="unchanged"?` ${L("(unchanged)")}`:""}`)}import{existsSync as Pj}from"fs";import{dirname as Fj,resolve as Sj}from"path";function qG($){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(!SW(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!FW.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}}l();function d3($,Z={}){let z=$??m();if(!z)console.error(`Error: project.faf not found
284
+ `),"utf-8")}function gj($,Z,z){let Q=KG($,z);return Q!=="match"&&Z!==null&&KG(Z,z)==="match"?"match":Q}function q2($,Z,z){let Q=Pj($),X=i(z.root,Q),J=bj(z.format,Z),Y=LG(z.format,J),W=l0(X);if(W===null)return o(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=vj(W),G=U===null?Y:Y.replace(/\r?\n/g,`\r
285
+ `);if(U!==null&&W.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!hj(Q,W,U,J,z))return{path:X,result:"unchanged"};return o(X,G,{root:z.root,expect:W}),{path:X,result:"updated"}}function hj($,Z,z,Q,X){let J=gj(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})}l();function DG($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array(fj($));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=a($,()=>SW(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(f3(Z.output,$))console.error(`faf: ${NG(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);G2(Z.output);let{result:J}=q2(Z.output,`${X}
286
+ `,{root:uj(NG(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${A("decompiled")} ${Z.output}${J==="unchanged"?` ${M("(unchanged)")}`:""}`)}import{existsSync as mj}from"fs";import{dirname as cj,resolve as pj}from"path";function OG($){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(!wW(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!EW.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}}l();function n3($,Z={}){let z=$??m();if(!z)console.error(`Error: project.faf not found
286
287
 
287
- Run 'faf init' to create one.`),process.exit(2);let Q=Y2(p(z),z),X=qG(Q);if(!X.valid){console.log(`${C("invalid")} ${z}`);for(let W of X.errors)console.log(` ${L("x")} ${W}`);process.exit(3)}let J=p(z);if(!_W(J))console.log(`${C("invalid yaml")} ${z}`),process.exit(3);console.log(`${A("valid")} ${z}`),jj(Ej(Q,Fj(z)));let Y=a(z,()=>N0(J));if(E0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(L(`
288
- --strict requires 100%`)),process.exit(1)}function jj($){for(let Z of $.missing)console.log(` ${C("!")} key_files: ${Z} ${C("not found")}`);for(let Z of $.skipped)console.log(` ${L("○")} key_files: ${Z} ${L("not checked (pattern)")}`)}function Ej($,Z){let z=$.instant_context,Q=$.key_files??z?.key_files,X={missing:[],skipped:[]};if(!Array.isArray(Q))return X;for(let J of Q){if(typeof J!=="string")continue;let Y=J.indexOf(" — "),W=(Y>0?J.slice(0,Y):J).trim();if(!W)continue;if(/[*?[\]{}]/.test(W))X.skipped.push(W);else if(!Pj(Sj(Z,W)))X.missing.push(W)}return X}import{join as kE,resolve as bE}from"path";import{join as wj}from"path";var o0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),KG=($)=>Array.isArray($)?$.join(", "):String($),xj=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),yj=new Set(["target_user","core_problem","mission_purpose"]);function kj($){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=o0($.project?.default_branch)?String($.project?.default_branch):"main",V=W?Object.entries(W).filter(([,b])=>o0(b)):[],H=V.filter(([b])=>/test/i.test(b)),q=V.filter(([b])=>/lint|check/i.test(b)&&!/test/i.test(b)),K=V.filter(([b])=>!/test|lint|check/i.test(b)),M=(b)=>{let n=b.toLowerCase();if(/install|deps/.test(n))return 0;if(/^build$|build/.test(n)&&!/rebuild/.test(n))return 1;if(/^dev$|develop/.test(n))return 2;if(/^start$|run/.test(n))return 3;return 4},B=[...K].sort((b,n)=>M(b[0])-M(n[0])||b[0].localeCompare(n[0])),N=[...H,...q],O=B.find(([b])=>/build/i.test(b)),_=H[0]?T6(H[0][1]):void 0,x=O?T6(O[1]):void 0;z(i2($)),z(),z(`# AGENTS.md — ${$.project?.name??"Project"}`),z();let S=[];if($.project?.main_language)S.push(String($.project.main_language));if(o0($.project?.type))S.push(`type: ${String($.project?.type)}`);if(o0($.project?.version))S.push(`v${String($.project?.version)}`);let y=$.project?.goal?String($.project.goal).trim():"";if(S.length)y+=(y?" — ":"")+S.join(" · ");if(y)z(y),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,n]of B){let{cmd:r,note:M2}=e6(n);z(`${r} # ${M2??b}`)}z("```"),z()}if(N.length){z("## Run the tests"),z(),z("```bash");for(let[,b]of N){let{cmd:n,note:r}=e6(b);z(r?`${n} # ${r}`:n)}z("```"),z()}if(U&&U.length){z("## Where things live"),z();let b=U.map((n)=>{let r=String(n),M2=r.indexOf(" — ");return M2>0?{path:r.slice(0,M2),role:r.slice(M2+3)}:{path:r,role:""}});if(b.some((n)=>n.role)){z("| Path | Role |"),z("|------|------|");for(let n of b)z(`| \`${n.path}\` | ${n.role} |`)}else for(let n of b)z(`- \`${n.path}\``);z()}let E=new Map,u=(b)=>{if(!b)return;for(let[n,r]of Object.entries(b)){if(xj.has(n)||!o0(r))continue;let M2=w3(n);if(!E.has(M2))E.set(M2,KG(r))}};u(Q?.working_style),u(X);let j=$.conventions??[];if(E.size||j.length){z("## Conventions"),z();for(let[b,n]of E)z(`- **${b}:** ${n}`);for(let b of j)if(o0(b))z(`- ${b}`);z()}let d=(Q?.warnings??[]).filter((b)=>o0(b)),I0=["read the tree"];if(_)I0.push(`run the tests (\`${_}\`)`);if(x)I0.push("build the project");for(let[,b]of q.slice(0,1))I0.push(`\`${T6(b)}\``);z("## Guardrails"),z();for(let b of d)z(`- ${b}`);z(`- **Always OK:** ${[...new Set(I0)].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 S0=[];for(let[,b]of q)S0.push(`\`${T6(b)}\` exits 0`);for(let[,b]of H)S0.push(`\`${T6(b)}\` passes`);if(S0.push("changes committed with a conventional message"),z("## Definition of Done"),z(),z(`Done when: ${[...new Set(S0)].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&&(o0(Y.secrets)||(Y.never??[]).length)){if(z("## Security & secrets"),z(),o0(Y.secrets)){let b=o0(Y.example)?` (see \`${Y.example}\`)`:"";z(`- Secrets live in \`${Y.secrets}\`${b}. Never read or commit them.`)}for(let b of Y.never??[])if(o0(b))z(`- Never read or commit \`${b}\`.`);z()}if(z("## Commit & PR"),z(),X&&o0(X.commit_style))z(`- Commit style: ${KG(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[n,r]of Object.entries($.stack)){if(yj.has(n))continue;if(H0(r))b.push(`- **${u0(`stack.${n}`)}:** ${r.trim()}`)}if(b.length){z("## Stack"),z();for(let n of b)z(n);z()}}let z0=$.generated;if(o0(z0))z(`*Context authored: ${String(z0)}*`);return Z.join(`
289
- `)}function BG($,Z){H2(wj($,x0.agents),kj(Z))}function bj($,Z){let z=[],Q=(U)=>I($,U),X=(U)=>h($,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 i3($,Z){let z={...Z},Q=null,X=h($,"package.json");if(X!==null)try{Q=JSON.parse(X)}catch{Q=null}let J=a5($,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=o5($);if(W.length)z.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>I($,G));if(U){let G=[".env.example",".env.sample",".env.template"].find((V)=>I($,V));z.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=bj($,Q);if(W.length)z.conventions=W}return z}import{join as vj}from"path";function gj($){let Z=[];if(Z.push(i2($)),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(H0(Q))Z.push(`# ${u0(`stack.${z}`)}: ${Q.trim()}`)}return Z.push(""),Z.join(`
290
- `)}function MG($,Z){H2(vj($,x0.cursorrules),gj(Z),"# faf:start","# faf:end")}import{join as hj}from"path";var fj=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),uj=new Set(["target_user","core_problem","mission_purpose"]);function mj($){let Z=[],z=$.instant_context,Q=$.commands,X=$.key_files??z?.key_files,J=Q?Object.entries(Q).filter(([,q])=>fj(q)):[],Y=J.filter(([q])=>/test/i.test(q)),W=J.filter(([q])=>/lint|check/i.test(q)&&!/test/i.test(q)),U=J.filter(([q])=>!/test|lint|check/i.test(q)),G=(q)=>{let K=q.toLowerCase();if(/install|deps/.test(K))return 0;if(/^build$|build/.test(K)&&!/rebuild/.test(K))return 1;if(/^dev$|develop/.test(K))return 2;if(/^start$|run/.test(K))return 3;return 4},V=[...U].sort((q,K)=>G(q[0])-G(K[0])||q[0].localeCompare(K[0])),H=[...Y,...W];if(Z.push(i2($)),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[q,K]of V){let{cmd:M,note:B}=e6(K);Z.push(`${M} # ${B??q}`)}Z.push("```")}if(H.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,q]of H){let{cmd:K,note:M}=e6(q);Z.push(M?`${K} # ${M}`:K)}Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let q of X)Z.push(`- \`${q}\``)}if($.stack){let q=[];for(let[K,M]of Object.entries($.stack)){if(uj.has(K))continue;if(H0(M))q.push(`- ${u0(`stack.${K}`)}: ${M.trim()}`)}if(q.length){Z.push(""),Z.push("## Stack");for(let K of q)Z.push(K)}}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(`
291
- `)}function LG($,Z){H2(hj($,x0.gemini),mj(Z))}import{join as cj}from"path";var NG=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],pj=new Set([...NG.map(([$])=>$),"cicd"]);function lj($){let Z=[],z=$.project?.name??"Project";if(Z.push(i2($)),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(""),H0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let Q=$.stack??{},X=[];if(H0($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,V]of Object.entries(Q)){if(pj.has(G))continue;if(H0(V))X.push(`- **${u0(`stack.${G}`)}:** ${V.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let J=[];for(let[G,V]of NG){let H=Q[G];if(H0(H))J.push(`- ${V} \`${H.trim()}\`.`)}if(H0(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])=>H0(G)).map(([G,V])=>`- **${u0(`human_context.${G}`)}:** ${V.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
292
- `)}function DG($,Z){j0($,".github"),H2(cj($,".github",x0.copilot),lj(Z),l2,d2,{root:$})}import{existsSync as dj}from"fs";import{join as ij}from"path";var nj="https://mcpaas.live/grok/mcp/v1",OG="mcp_servers.grok-faf-mcp";function rj($){return[`[${OG}]`,`url = "${nj}"`,""].join(`
293
- `)}function IG($,Z){let z=rj(Z);j0($,".grok");let Q=i($,ij(".grok","config.toml"));if(!dj(Q))return o(Q,`# grok-faf-mcp — wired by FAF from project.faf
288
+ Run 'faf init' to create one.`),process.exit(2);let Q=Y2(p(z),z),X=OG(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(!FW(J))console.log(`${C("invalid yaml")} ${z}`),process.exit(3);console.log(`${A("valid")} ${z}`),lj(dj(Q,cj(z)));let Y=a(z,()=>N0(J));if(E0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
289
+ --strict requires 100%`)),process.exit(1)}function lj($){for(let Z of $.missing)console.log(` ${C("!")} key_files: ${Z} ${C("not found")}`);for(let Z of $.skipped)console.log(` ${M("○")} key_files: ${Z} ${M("not checked (pattern)")}`)}function dj($,Z){let z=$.instant_context,Q=$.key_files??z?.key_files,X={missing:[],skipped:[]};if(!Array.isArray(Q))return X;for(let J of Q){if(typeof J!=="string")continue;let Y=J.indexOf(" — "),W=(Y>0?J.slice(0,Y):J).trim();if(!W)continue;if(/[*?[\]{}]/.test(W))X.skipped.push(W);else if(!mj(pj(Z,W)))X.missing.push(W)}return X}import{join as sE,resolve as oE}from"path";import{join as ij}from"path";var o0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),IG=($)=>Array.isArray($)?$.join(", "):String($),nj=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),rj=new Set(["target_user","core_problem","mission_purpose"]);function sj($){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=o0($.project?.default_branch)?String($.project?.default_branch):"main",V=W?Object.entries(W).filter(([,b])=>o0(b)):[],H=V.filter(([b])=>/test/i.test(b)),q=V.filter(([b])=>/lint|check/i.test(b)&&!/test/i.test(b)),K=V.filter(([b])=>!/test|lint|check/i.test(b)),L=(b)=>{let n=b.toLowerCase();if(/install|deps/.test(n))return 0;if(/^build$|build/.test(n)&&!/rebuild/.test(n))return 1;if(/^dev$|develop/.test(n))return 2;if(/^start$|run/.test(n))return 3;return 4},B=[...K].sort((b,n)=>L(b[0])-L(n[0])||b[0].localeCompare(n[0])),N=[...H,...q],O=B.find(([b])=>/build/i.test(b)),_=H[0]?T6(H[0][1]):void 0,x=O?T6(O[1]):void 0;z(d2($)),z(),z(`# AGENTS.md — ${$.project?.name??"Project"}`),z();let S=[];if($.project?.main_language)S.push(String($.project.main_language));if(o0($.project?.type))S.push(`type: ${String($.project?.type)}`);if(o0($.project?.version))S.push(`v${String($.project?.version)}`);let y=$.project?.goal?String($.project.goal).trim():"";if(S.length)y+=(y?" — ":"")+S.join(" · ");if(y)z(y),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,n]of B){let{cmd:r,note:M2}=e6(n);z(`${r} # ${M2??b}`)}z("```"),z()}if(N.length){z("## Run the tests"),z(),z("```bash");for(let[,b]of N){let{cmd:n,note:r}=e6(b);z(r?`${n} # ${r}`:n)}z("```"),z()}if(U&&U.length){z("## Where things live"),z();let b=U.map((n)=>{let r=String(n),M2=r.indexOf(" — ");return M2>0?{path:r.slice(0,M2),role:r.slice(M2+3)}:{path:r,role:""}});if(b.some((n)=>n.role)){z("| Path | Role |"),z("|------|------|");for(let n of b)z(`| \`${n.path}\` | ${n.role} |`)}else for(let n of b)z(`- \`${n.path}\``);z()}let E=new Map,u=(b)=>{if(!b)return;for(let[n,r]of Object.entries(b)){if(nj.has(n)||!o0(r))continue;let M2=y3(n);if(!E.has(M2))E.set(M2,IG(r))}};u(Q?.working_style),u(X);let j=$.conventions??[];if(E.size||j.length){z("## Conventions"),z();for(let[b,n]of E)z(`- **${b}:** ${n}`);for(let b of j)if(o0(b))z(`- ${b}`);z()}let d=(Q?.warnings??[]).filter((b)=>o0(b)),I0=["read the tree"];if(_)I0.push(`run the tests (\`${_}\`)`);if(x)I0.push("build the project");for(let[,b]of q.slice(0,1))I0.push(`\`${T6(b)}\``);z("## Guardrails"),z();for(let b of d)z(`- ${b}`);z(`- **Always OK:** ${[...new Set(I0)].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 S0=[];for(let[,b]of q)S0.push(`\`${T6(b)}\` exits 0`);for(let[,b]of H)S0.push(`\`${T6(b)}\` passes`);if(S0.push("changes committed with a conventional message"),z("## Definition of Done"),z(),z(`Done when: ${[...new Set(S0)].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&&(o0(Y.secrets)||(Y.never??[]).length)){if(z("## Security & secrets"),z(),o0(Y.secrets)){let b=o0(Y.example)?` (see \`${Y.example}\`)`:"";z(`- Secrets live in \`${Y.secrets}\`${b}. Never read or commit them.`)}for(let b of Y.never??[])if(o0(b))z(`- Never read or commit \`${b}\`.`);z()}if(z("## Commit & PR"),z(),X&&o0(X.commit_style))z(`- Commit style: ${IG(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[n,r]of Object.entries($.stack)){if(rj.has(n))continue;if(H0(r))b.push(`- **${f0(`stack.${n}`)}:** ${r.trim()}`)}if(b.length){z("## Stack"),z();for(let n of b)z(n);z()}}let z0=$.generated;if(o0(z0))z(`*Context authored: ${String(z0)}*`);return Z.join(`
290
+ `)}function TG($,Z){H2(ij($,x0.agents),sj(Z))}function oj($,Z){let z=[],Q=(U)=>I($,U),X=(U)=>h($,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 r3($,Z){let z={...Z},Q=null,X=h($,"package.json");if(X!==null)try{Q=JSON.parse(X)}catch{Q=null}let J=e5($,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=t5($);if(W.length)z.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>I($,G));if(U){let G=[".env.example",".env.sample",".env.template"].find((V)=>I($,V));z.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=oj($,Q);if(W.length)z.conventions=W}return z}import{join as aj}from"path";function tj($){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(H0(Q))Z.push(`# ${f0(`stack.${z}`)}: ${Q.trim()}`)}return Z.push(""),Z.join(`
291
+ `)}function AG($,Z){H2(aj($,x0.cursorrules),tj(Z),"# faf:start","# faf:end")}import{join as ej}from"path";var $E=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),ZE=new Set(["target_user","core_problem","mission_purpose"]);function zE($){let Z=[],z=$.instant_context,Q=$.commands,X=$.key_files??z?.key_files,J=Q?Object.entries(Q).filter(([,q])=>$E(q)):[],Y=J.filter(([q])=>/test/i.test(q)),W=J.filter(([q])=>/lint|check/i.test(q)&&!/test/i.test(q)),U=J.filter(([q])=>!/test|lint|check/i.test(q)),G=(q)=>{let K=q.toLowerCase();if(/install|deps/.test(K))return 0;if(/^build$|build/.test(K)&&!/rebuild/.test(K))return 1;if(/^dev$|develop/.test(K))return 2;if(/^start$|run/.test(K))return 3;return 4},V=[...U].sort((q,K)=>G(q[0])-G(K[0])||q[0].localeCompare(K[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[q,K]of V){let{cmd:L,note:B}=e6(K);Z.push(`${L} # ${B??q}`)}Z.push("```")}if(H.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,q]of H){let{cmd:K,note:L}=e6(q);Z.push(L?`${K} # ${L}`:K)}Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let q of X)Z.push(`- \`${q}\``)}if($.stack){let q=[];for(let[K,L]of Object.entries($.stack)){if(ZE.has(K))continue;if(H0(L))q.push(`- ${f0(`stack.${K}`)}: ${L.trim()}`)}if(q.length){Z.push(""),Z.push("## Stack");for(let K of q)Z.push(K)}}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(`
292
+ `)}function CG($,Z){H2(ej($,x0.gemini),zE(Z))}import{join as QE}from"path";var _G=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],XE=new Set([..._G.map(([$])=>$),"cicd"]);function JE($){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(""),H0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let Q=$.stack??{},X=[];if(H0($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,V]of Object.entries(Q)){if(XE.has(G))continue;if(H0(V))X.push(`- **${f0(`stack.${G}`)}:** ${V.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let J=[];for(let[G,V]of _G){let H=Q[G];if(H0(H))J.push(`- ${V} \`${H.trim()}\`.`)}if(H0(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])=>H0(G)).map(([G,V])=>`- **${f0(`human_context.${G}`)}:** ${V.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
293
+ `)}function RG($,Z){j0($,".github"),H2(QE($,".github",x0.copilot),JE(Z),p2,l2,{root:$})}import{existsSync as YE}from"fs";import{join as WE}from"path";var UE="https://mcpaas.live/grok/mcp/v1",PG="mcp_servers.grok-faf-mcp";function GE($){return[`[${PG}]`,`url = "${UE}"`,""].join(`
294
+ `)}function FG($,Z){let z=GE(Z);j0($,".grok");let Q=i($,WE(".grok","config.toml"));if(!YE(Q))return o(Q,`# grok-faf-mcp — wired by FAF from project.faf
294
295
 
295
- `+z,{root:$,expect:null}),"created";let X=U0(Q);if(X.includes(`[${OG}]`))return"unchanged";let J=X.endsWith(`
296
+ `+z,{root:$,expect:null}),"created";let X=U0(Q);if(X.includes(`[${PG}]`))return"unchanged";let J=X.endsWith(`
296
297
 
297
298
  `)?"":X.endsWith(`
298
299
  `)?`
299
300
  `:`
300
301
 
301
- `;return o(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as sj}from"path";var oj=[{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 r3($){if(!H0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function n3($,Z){if(!$)return null;return r3($[Z])}function aj($){let Z=[],z=r3($.project?.name)??"Project",Q=r3($.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 oj){let U=n3(X,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let J=n3($.project,"homepage")??n3($.project,"url");if(J&&/^(https?:)?\/\//i.test(J))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${J})`),Z.push("");return`${Z.join(`
302
+ `;return o(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as VE}from"path";var HE=[{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 o3($){if(!H0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function s3($,Z){if(!$)return null;return o3($[Z])}function qE($){let Z=[],z=o3($.project?.name)??"Project",Q=o3($.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 HE){let U=s3(X,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let J=s3($.project,"homepage")??s3($.project,"url");if(J&&/^(https?:)?\/\//i.test(J))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${J})`),Z.push("");return`${Z.join(`
302
303
  `).trimEnd()}
303
- `}function TG($,Z){H2(sj($,x0.llms),aj(Z))}l();import{join as tj}from"path";import{deprecate as ej}from"node:util";var AG=J8.orange,$E=J8.cyan,ZE=J8.cyanDeep,zE="#FF9500",QE="#FF3B30",XE="#E6EDF3",JE="#6E7681",CG={TROPHY:{glyph:"✪",color:AG},GOLD:{glyph:"★",color:AG},SILVER:{glyph:"◆",color:$E},BRONZE:{glyph:"◇",color:ZE},GREEN:{glyph:"●",color:XE},YELLOW:{glyph:"●",color:zE},RED:{glyph:"○",color:QE},WHITE:{glyph:"♡",color:JE}};function d$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var _G=["who","what","why","where","when","how"];function UZ($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${d$(Z)}</div><div class="v">${d$(z)}</div></div>`).join(`
304
- `)}function RG($,Z,z="project.faf"){let Q=d$($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=CG[X]??CG.WHITE,Y=Z.inherited?Z.represents?`inherited from ${d$(Z.represents)}`:"inherited":`${Z.score}%`,W=X==="TROPHY"&&!Z.inherited,U=$.human_context??{},G=_G.map((B)=>[B,U[B]]),V=Object.entries(U).filter(([B])=>!_G.includes(B)),H=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],q=Object.entries($.stack??{}),K=q.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),M=q.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
304
+ `}function SG($,Z){H2(VE($,x0.llms),qE(Z))}l();import{join as KE}from"path";import{deprecate as BE}from"node:util";var jG=J4.orange,ME=J4.cyan,LE=J4.cyanDeep,NE="#FF9500",DE="#FF3B30",OE="#E6EDF3",IE="#6E7681",EG={TROPHY:{glyph:"✪",color:jG},GOLD:{glyph:"★",color:jG},SILVER:{glyph:"◆",color:ME},BRONZE:{glyph:"◇",color:LE},GREEN:{glyph:"●",color:OE},YELLOW:{glyph:"●",color:NE},RED:{glyph:"○",color:DE},WHITE:{glyph:"♡",color:IE}};function d$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var wG=["who","what","why","where","when","how"];function HZ($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${d$(Z)}</div><div class="v">${d$(z)}</div></div>`).join(`
305
+ `)}function xG($,Z,z="project.faf"){let Q=d$($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=EG[X]??EG.WHITE,Y=Z.inherited?Z.represents?`inherited from ${d$(Z.represents)}`:"inherited":`${Z.score}%`,W=X==="TROPHY"&&!Z.inherited,U=$.human_context??{},G=wG.map((B)=>[B,U[B]]),V=Object.entries(U).filter(([B])=>!wG.includes(B)),H=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],q=Object.entries($.stack??{}),K=q.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=q.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
305
306
  <html lang="en">
306
307
  <head>
307
308
  <meta charset="UTF-8">
@@ -346,22 +347,22 @@ footer strong{color:#e6edf3}
346
347
  <span class="score">${Y}</span>
347
348
  </header>
348
349
  <div class="meter"><span></span></div>
349
- ${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots filled.</span> <span class="awd-win">100% Trophy ✪ Awarded</span></p>':`<p class="muted statline">${Z.populated}/${Z.active} slots populated · ${Z.total} total${M?` · ${M} slotignored`:""}</p>`}
350
+ ${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots filled.</span> <span class="awd-win">100% Trophy ✪ Awarded</span></p>':`<p class="muted statline">${Z.populated}/${Z.active} slots populated · ${Z.total} total${L?` · ${L} slotignored`:""}</p>`}
350
351
 
351
352
  <section>
352
353
  <h2>The 6 W's</h2>
353
- ${UZ(G)||'<p class="muted">No human_context yet.</p>'}
354
- ${V.length?UZ(V):""}
354
+ ${HZ(G)||'<p class="muted">No human_context yet.</p>'}
355
+ ${V.length?HZ(V):""}
355
356
  </section>
356
357
 
357
358
  <section>
358
359
  <h2>Project</h2>
359
- ${UZ(H)||'<p class="muted">—</p>'}
360
+ ${HZ(H)||'<p class="muted">—</p>'}
360
361
  </section>
361
362
 
362
363
  <section>
363
364
  <h2>Stack</h2>
364
- ${K.length?UZ(K):'<p class="muted">No active stack slots.</p>'}
365
+ ${K.length?HZ(K):'<p class="muted">No active stack slots.</p>'}
365
366
  </section>
366
367
 
367
368
  <footer>
@@ -371,87 +372,87 @@ Rendered on-demand from your current <strong>${d$(z)}</strong><br>
371
372
  </div>
372
373
  </body>
373
374
  </html>
374
- `}var YE='<meta name="description" content="Visual render of project.faf.';function WE($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(YE)&&Z.includes(" by faf"))}function GZ($,Z,z,Q="project.faf",X={}){q2(tj($,"project.html"),RG(Z,z,Q),{root:$,format:"html",hasMark:WE,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var Bp=ej(RG,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as jE}from"path";import{deprecate as EE}from"node:util";var r2="https://faf.one/ext/context/v1",Z$="io.modelcontextprotocol.registry/publisher-provided";function s2($,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 O8($,Z={}){let z={"one.faf/context":s2($,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 PG="JSONRPC",a3="1.0",HZ=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],t3="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";var FG="1.0",s3={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function SG($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function z$($,Z={}){let z=SG($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:a3}];return[]}function UE($){try{return`https://${I8($)}/.well-known/fafa`}catch{return}}function jG($,Z,z={}){let Q=s2(Z,z),X=$.agent??{},J={fafaSpecVersion:String($.version??FG),mediaTypes:[...HZ],provenance:{faf:Q.faf,mediaType:Q.mediaType},generated:Q.generated};if(X.id)J.agentId=X.id;let Y=UE($);if(Y)J.passport=Y;return{uri:r2,description:"FAF passport and project DNA as typed parts",required:!1,params:J}}function GE($){let Z=new Set;for(let z of $.capabilities??[])if(z.cites_spec&&HZ.includes(z.cites_spec))Z.add(z.cites_spec);return["text/plain",...Z]}function EG($,Z={}){let z=$.agent??{},Q=z$($,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 q=String(H.name??"").trim();if(!q)throw Error("A2A skill missing capabilities[].name");let K=Array.isArray(H.tags)?H.tags.map(String):[],M=H.cites_spec&&HZ.includes(H.cites_spec)?[H.cites_spec,"text/plain"]:void 0;return{id:q,name:q,description:String(H.description??"").trim()||q,tags:K,...M?{inputModes:M}:{}}});return{name:X,description:J,supportedInterfaces:Q.map((H)=>({url:String(H.location),protocolBinding:PG,protocolVersion:String(H.version??a3)})),...G?{provider:G}:{},version:Y,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:GE($),defaultOutputModes:["text/plain","application/json"],skills:V}}var qZ=["mcp","cli","library"],VE=/^[a-z0-9][a-z0-9._-]*$/,HE=/^(@[a-z0-9~][a-z0-9-._~]*\/)?[a-z0-9~][a-z0-9-._~]*$/,qE=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/,KE=/^[A-Za-z0-9][^\s]*$/,BE=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,ME=["a2a","mcp"],LE=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function w($){return String($??"").trim()}function VZ($){return Array.isArray($)?$.map(w).filter(Boolean):[]}function NE($){return w($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function DE($,Z,z){let Q=["display_name","description","version"].filter((X)=>!w($[X]));if(Q.length)throw Error(`Missing answer: ${Q.join(", ")}`);if(!VE.test(Z))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!LE.test(z))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function OE($,Z){return($.skills??[]).filter((z)=>w(z.name)).map((z)=>({name:w(z.name),type:w(z.type)||"tool",description:w(z.description)||w(z.name),tags:Z.length?Z:[w(z.name).toLowerCase()]}))}function IE($){let Z=($.packages??[]).filter((z)=>w(z.registryType)&&w(z.identifier));for(let z of Z){let Q=w(z.registryType),X=w(z.identifier);if(Q==="npm"&&!HE.test(X))throw Error(`Package "${X}" is not an npm package name (e.g. weather-mcp or @acme/weather).`);if(Q==="pypi"&&!qE.test(X))throw Error(`Package "${X}" is not a PyPI package name (e.g. weather-mcp or weather_mcp).`);if(Q==="cargo"&&!BE.test(X))throw Error(`Package "${X}" is not a crate name (e.g. weather-mcp or weather_mcp).`);if(Q!=="npm"&&Q!=="pypi"&&Q!=="cargo"&&!KE.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:w(z.registryType),identifier:w(z.identifier),...w(z.version)?{version:w(z.version)}:{}}))}function wG($){if(/\s/.test($))return!1;try{let Z=new URL($);return(Z.protocol==="http:"||Z.protocol==="https:")&&Z.hostname!==""}catch{return!1}}function TE($){if(!wG(w($.url)))throw Error(`Where it runs: "${w($.url)}" is not an http(s) URL (or give an npm package).`);if(!ME.includes(w($.protocol).toLowerCase()))throw Error(`Protocol "${w($.protocol)}": a2a or mcp.`)}function AE($){let Z=w($.package_kind).toLowerCase()||"mcp";if(!qZ.includes(Z))throw Error(`Kind "${w($.package_kind)}" is not one faf knows: mcp, cli or library.`);return Z}function CE($,Z){let z=($.endpoints??[]).filter((J)=>w(J.url));z.forEach(TE);let Q=AE($),X=[...z.map((J)=>({protocol:w(J.protocol).toLowerCase(),transport:"http",location:w(J.url)})),...Z.map((J)=>({protocol:Q,transport:"stdio",location:J.identifier}))];if(X.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return X}function _E($,Z,z,Q){let X={domain:Z},J=[["repository",w($.repository)],["icon",w($.icon)],["organizationUrl",w($.organization_url)]];for(let[W,U]of J)if(U)X[W]=U;if(z.length)X.keywords=z;let Y=VZ($.example_requests);if(Y.length)X.examples=Y;if(Q.length)X.packages=Q;return X}function xG($){let Z=w($.handle).toLowerCase(),z=NE($.domain);DE($,Z,z);let Q=VZ($.tags),X=IE($),J=w($.homepage);if(J&&!wG(J))throw Error(`Homepage: "${J}" is not an http(s) URL.`);let Y={name:Z,displayName:w($.display_name),id:`urn:air:${z}:agent:${Z}`,...w($.organization)?{vendor:w($.organization)}:{},version:w($.version),description:w($.description),homepage:J||`https://${z}`,...w($.license)?{license:w($.license)}:{}};return{version:FG,agent:Y,capabilities:OE($,Q),endpoints:CE($,X),metadata:{cards:_E($,z,Q,X)}}}function yG($){return u6($,{lineWidth:0})}function I8($){let Z=w($.agent?.id),z=/^urn:air:([^:]+):/.exec(Z);if(z)return z[1];let Q=w($.metadata?.cards?.domain);if(Q)return Q;try{return new URL(w($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function kG($){let Z=w($.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`${I8($).split(".").reverse().join(".")}/${kG($)}`}function o3($){let Z=$.replace(/\s+/g," ").trim();return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function i$($){return($.endpoints??[]).filter((Z)=>w(Z.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(w(Z.location))).map((Z)=>({type:"streamable-http",url:w(Z.location)}))}function RE($){if(!$)return;try{let Z=new URL($).hostname.replace(/^www\./,"");return{url:$,source:Z.split(".")[0]}}catch{return}}function PE($){let Z=$.agent??{},z=$.metadata?.cards??{},Q=w(Z.description),X=w(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:o3(Q)},Y=w(Z.displayName);if(Y)J.title=o3(Y);let W=w(Z.homepage);if(W)J.websiteUrl=W;let U=RE(w(z.repository));if(U)J.repository=U;if(w(z.icon))J.icons=[{src:w(z.icon)}];return J}function FE($){return($.metadata?.cards?.packages??[]).map((Z)=>({registryType:w(Z.registryType),identifier:w(Z.identifier),...w(Z.version)?{version:w(Z.version)}:{},transport:{type:"stdio"}}))}function e3($){return($.endpoints??[]).some((Z)=>w(Z.protocol).toLowerCase()==="mcp")}function T8($){return e3($)&&(i$($).length>0||FE($).length>0)}function vG($){let Z=w($.agent?.displayName);return{name:bG($),...Z?{title:o3(Z)}:{}}}function gG($,Z,z={}){let Q=i$($);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:t3,...PE($),remotes:Q,...Z?{_meta:{"one.faf/context":s2(Z,z)}}:{}}}function SE($,Z,z){if(!Z.includes("a2a")||z$($,z).length===0)return;return z.a2aCardUrl??`https://${I8($)}/.well-known/agent-card.json`}function hG($,Z,z={}){let Q=I8($),X=kG($),J=$.agent??{},Y=w(J.displayName)||w(J.name),W=w(J.description),U=w(J.version),G=z.now??new Date().toISOString(),V=(K,M,B)=>({identifier:`urn:air:${Q}:${K}:${X}`,displayName:Y,type:M,description:W,url:B,...U?{version:U}:{},updatedAt:G}),H=[],q=SE($,Z,z);if(q)H.push(V("a2a",s3.a2a,q));if(Z.includes("server_card")){let K=i$($)[0];if(K)H.push(V("mcp",s3.server_card,`${K.url.replace(/\/+$/,"")}/server-card`))}if(z.listFafa!==!1)H.push(V("agent",s3.fafa,`https://${Q}/.well-known/fafa`));return H}function fG($){let Z=$.agent??{},z=w(Z.vendor)||w(Z.displayName)||w(Z.name);if(!z)return;let Q;try{Q=I8($)}catch{Q=void 0}return{displayName:z,...Q?{identifier:Q}:{}}}function uG($){let Z=$.metadata?.cards??{},z=VZ(Z.keywords),Q=VZ(Z.examples);return{...z.length?{tags:z}:{},...Q.length?{representativeQueries:Q}:{}}}var wE=t3,xE=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function mG($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&xE.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 yE($){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 KZ($,Z={}){let z={$schema:wE,name:mG($),version:String($.project?.version??"0.1.0"),description:yE($)},Q=$z($)??$.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":s2($,Z)},z}function cG($){return mG($)}function $z($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function pG($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var Q$=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function A8($){let Z=pG($);return Q$(Z)&&Q$(Z._meta)&&Q$(Z._meta["one.faf/context"])}function BZ($){let Z=pG($),z=Q$(Z)&&Q$(Z._meta)?Z._meta[Z$]:void 0;return Q$(z)&&Q$(z["one.faf/context"])}function lG($,Z,z={},Q={}){let X=KZ(Z,z),J=jE($,"server-card");return q2(J,`${JSON.stringify(X,null,2)}
375
- `,{root:$,format:"json",hasMark:A8,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function MZ($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return l$($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var Pp=EE(KZ,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");l();function C8($,Z,z,Q){let X=XZ(kE($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(L(` ${X}`))}function vE($){try{return $(),!0}catch(Z){if(!u$(Z))throw Z;return console.error(m$(Z,!0)),!1}}function X$($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
375
+ `}var TE='<meta name="description" content="Visual render of project.faf.';function AE($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(TE)&&Z.includes(" by faf"))}function qZ($,Z,z,Q="project.faf",X={}){q2(KE($,"project.html"),xG(Z,z,Q),{root:$,format:"html",hasMark:AE,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var yp=BE(xG,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as lE}from"path";import{deprecate as dE}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 I4($,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",e3="1.0",BZ=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],$z="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";var kG="1.0",a3={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function bG($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function z$($,Z={}){let z=bG($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:e3}];return[]}function CE($){try{return`https://${T4($)}/.well-known/fafa`}catch{return}}function vG($,Z,z={}){let Q=r2(Z,z),X=$.agent??{},J={fafaSpecVersion:String($.version??kG),mediaTypes:[...BZ],provenance:{faf:Q.faf,mediaType:Q.mediaType},generated:Q.generated};if(X.id)J.agentId=X.id;let Y=CE($);if(Y)J.passport=Y;return{uri:n2,description:"FAF passport and project DNA as typed parts",required:!1,params:J}}function _E($){let Z=new Set;for(let z of $.capabilities??[])if(z.cites_spec&&BZ.includes(z.cites_spec))Z.add(z.cites_spec);return["text/plain",...Z]}function gG($,Z={}){let z=$.agent??{},Q=z$($,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 q=String(H.name??"").trim();if(!q)throw Error("A2A skill missing capabilities[].name");let K=Array.isArray(H.tags)?H.tags.map(String):[],L=H.cites_spec&&BZ.includes(H.cites_spec)?[H.cites_spec,"text/plain"]:void 0;return{id:q,name:q,description:String(H.description??"").trim()||q,tags:K,...L?{inputModes:L}:{}}});return{name:X,description:J,supportedInterfaces:Q.map((H)=>({url:String(H.location),protocolBinding:yG,protocolVersion:String(H.version??e3)})),...G?{provider:G}:{},version:Y,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:_E($),defaultOutputModes:["text/plain","application/json"],skills:V}}var MZ=["mcp","cli","library"],RE=/^[a-z0-9][a-z0-9._-]*$/,PE=/^(@[a-z0-9~][a-z0-9-._~]*\/)?[a-z0-9~][a-z0-9-._~]*$/,FE=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/,SE=/^[A-Za-z0-9][^\s]*$/,jE=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,EE=["a2a","mcp"],wE=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function w($){return String($??"").trim()}function KZ($){return Array.isArray($)?$.map(w).filter(Boolean):[]}function xE($){return w($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function yE($,Z,z){let Q=["display_name","description","version"].filter((X)=>!w($[X]));if(Q.length)throw Error(`Missing answer: ${Q.join(", ")}`);if(!RE.test(Z))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!wE.test(z))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function kE($,Z){return($.skills??[]).filter((z)=>w(z.name)).map((z)=>({name:w(z.name),type:w(z.type)||"tool",description:w(z.description)||w(z.name),tags:Z.length?Z:[w(z.name).toLowerCase()]}))}function bE($){let Z=($.packages??[]).filter((z)=>w(z.registryType)&&w(z.identifier));for(let z of Z){let Q=w(z.registryType),X=w(z.identifier);if(Q==="npm"&&!PE.test(X))throw Error(`Package "${X}" is not an npm package name (e.g. weather-mcp or @acme/weather).`);if(Q==="pypi"&&!FE.test(X))throw Error(`Package "${X}" is not a PyPI package name (e.g. weather-mcp or weather_mcp).`);if(Q==="cargo"&&!jE.test(X))throw Error(`Package "${X}" is not a crate name (e.g. weather-mcp or weather_mcp).`);if(Q!=="npm"&&Q!=="pypi"&&Q!=="cargo"&&!SE.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:w(z.registryType),identifier:w(z.identifier),...w(z.version)?{version:w(z.version)}:{}}))}function hG($){if(/\s/.test($))return!1;try{let Z=new URL($);return(Z.protocol==="http:"||Z.protocol==="https:")&&Z.hostname!==""}catch{return!1}}function vE($){if(!hG(w($.url)))throw Error(`Where it runs: "${w($.url)}" is not an http(s) URL (or give an npm package).`);if(!EE.includes(w($.protocol).toLowerCase()))throw Error(`Protocol "${w($.protocol)}": a2a or mcp.`)}function gE($){let Z=w($.package_kind).toLowerCase()||"mcp";if(!MZ.includes(Z))throw Error(`Kind "${w($.package_kind)}" is not one faf knows: mcp, cli or library.`);return Z}function hE($,Z){let z=($.endpoints??[]).filter((J)=>w(J.url));z.forEach(vE);let Q=gE($),X=[...z.map((J)=>({protocol:w(J.protocol).toLowerCase(),transport:"http",location:w(J.url)})),...Z.map((J)=>({protocol:Q,transport:"stdio",location:J.identifier}))];if(X.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return X}function fE($,Z,z,Q){let X={domain:Z},J=[["repository",w($.repository)],["icon",w($.icon)],["organizationUrl",w($.organization_url)]];for(let[W,U]of J)if(U)X[W]=U;if(z.length)X.keywords=z;let Y=KZ($.example_requests);if(Y.length)X.examples=Y;if(Q.length)X.packages=Q;return X}function fG($){let Z=w($.handle).toLowerCase(),z=xE($.domain);yE($,Z,z);let Q=KZ($.tags),X=bE($),J=w($.homepage);if(J&&!hG(J))throw Error(`Homepage: "${J}" is not an http(s) URL.`);let Y={name:Z,displayName:w($.display_name),id:`urn:air:${z}:agent:${Z}`,...w($.organization)?{vendor:w($.organization)}:{},version:w($.version),description:w($.description),homepage:J||`https://${z}`,...w($.license)?{license:w($.license)}:{}};return{version:kG,agent:Y,capabilities:kE($,Q),endpoints:hE($,X),metadata:{cards:fE($,z,Q,X)}}}function uG($){return u6($,{lineWidth:0})}function T4($){let Z=w($.agent?.id),z=/^urn:air:([^:]+):/.exec(Z);if(z)return z[1];let Q=w($.metadata?.cards?.domain);if(Q)return Q;try{return new URL(w($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function mG($){let Z=w($.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 cG($){return`${T4($).split(".").reverse().join(".")}/${mG($)}`}function t3($){let Z=$.replace(/\s+/g," ").trim();return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function i$($){return($.endpoints??[]).filter((Z)=>w(Z.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(w(Z.location))).map((Z)=>({type:"streamable-http",url:w(Z.location)}))}function uE($){if(!$)return;try{let Z=new URL($).hostname.replace(/^www\./,"");return{url:$,source:Z.split(".")[0]}}catch{return}}function mE($){let Z=$.agent??{},z=$.metadata?.cards??{},Q=w(Z.description),X=w(Z.version);if(!Q||!X)throw Error("An MCP card needs agent.description and agent.version in .fafa");let J={name:cG($),version:X,description:t3(Q)},Y=w(Z.displayName);if(Y)J.title=t3(Y);let W=w(Z.homepage);if(W)J.websiteUrl=W;let U=uE(w(z.repository));if(U)J.repository=U;if(w(z.icon))J.icons=[{src:w(z.icon)}];return J}function cE($){return($.metadata?.cards?.packages??[]).map((Z)=>({registryType:w(Z.registryType),identifier:w(Z.identifier),...w(Z.version)?{version:w(Z.version)}:{},transport:{type:"stdio"}}))}function Zz($){return($.endpoints??[]).some((Z)=>w(Z.protocol).toLowerCase()==="mcp")}function A4($){return Zz($)&&(i$($).length>0||cE($).length>0)}function pG($){let Z=w($.agent?.displayName);return{name:cG($),...Z?{title:t3(Z)}:{}}}function lG($,Z,z={}){let Q=i$($);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:$z,...mE($),remotes:Q,...Z?{_meta:{"one.faf/context":r2(Z,z)}}:{}}}function pE($,Z,z){if(!Z.includes("a2a")||z$($,z).length===0)return;return z.a2aCardUrl??`https://${T4($)}/.well-known/agent-card.json`}function dG($,Z,z={}){let Q=T4($),X=mG($),J=$.agent??{},Y=w(J.displayName)||w(J.name),W=w(J.description),U=w(J.version),G=z.now??new Date().toISOString(),V=(K,L,B)=>({identifier:`urn:air:${Q}:${K}:${X}`,displayName:Y,type:L,description:W,url:B,...U?{version:U}:{},updatedAt:G}),H=[],q=pE($,Z,z);if(q)H.push(V("a2a",a3.a2a,q));if(Z.includes("server_card")){let K=i$($)[0];if(K)H.push(V("mcp",a3.server_card,`${K.url.replace(/\/+$/,"")}/server-card`))}if(z.listFafa!==!1)H.push(V("agent",a3.fafa,`https://${Q}/.well-known/fafa`));return H}function iG($){let Z=$.agent??{},z=w(Z.vendor)||w(Z.displayName)||w(Z.name);if(!z)return;let Q;try{Q=T4($)}catch{Q=void 0}return{displayName:z,...Q?{identifier:Q}:{}}}function nG($){let Z=$.metadata?.cards??{},z=KZ(Z.keywords),Q=KZ(Z.examples);return{...z.length?{tags:z}:{},...Q.length?{representativeQueries:Q}:{}}}var iE=$z,nE=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function rG($){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 rE($){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 LZ($,Z={}){let z={$schema:iE,name:rG($),version:String($.project?.version??"0.1.0"),description:rE($)},Q=zz($)??$.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 sG($){return rG($)}function zz($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function oG($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var Q$=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function C4($){let Z=oG($);return Q$(Z)&&Q$(Z._meta)&&Q$(Z._meta["one.faf/context"])}function NZ($){let Z=oG($),z=Q$(Z)&&Q$(Z._meta)?Z._meta[Z$]:void 0;return Q$(z)&&Q$(z["one.faf/context"])}function aG($,Z,z={},Q={}){let X=LZ(Z,z),J=lE($,"server-card");return q2(J,`${JSON.stringify(X,null,2)}
376
+ `,{root:$,format:"json",hasMark:C4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function DZ($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return l$($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var dp=dE(LZ,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");l();function _4($,Z,z,Q){let X=WZ(sE($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(M(` ${X}`))}function aE($){try{return $(),!0}catch(Z){if(!u$(Z))throw Z;return console.error(m$(Z,!0)),!1}}function X$($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
376
377
 
377
- Run 'faf init' to create one.`),process.exit(2);let z=$.output?bE(process.cwd(),$.output):process.cwd();if($.output)j0(z);let Q=e(Z),X=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,J=0,Y=(U)=>{if(!vE(U))J++};if(X||$.agents)Y(()=>C8(z,"AGENTS.md",()=>BG(z,i3(z,Q))));if(X||$.cursor)Y(()=>C8(z,".cursorrules",()=>MG(z,Q),["# faf:start","# faf:end"]));if(X||$.gemini)Y(()=>C8(z,"GEMINI.md",()=>LG(z,i3(z,Q))));if(X||$.copilot)Y(()=>C8(z,".github/copilot-instructions.md",()=>DG(z,Q)));if($.grok)Y(()=>{let U=IG(z,Q);console.log(` .grok/config.toml (${U})`)});if($.llms)Y(()=>C8(z,"llms.txt",()=>TG(z,Q)));if(X||$.html)Y(()=>{let U=a(Z,()=>N0(p(Z)));GZ(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=lG(z,Q,{},{force:$.force});console.log(` ${U.replace(`${z}/`,"")}`)});if(console.log(`${A("exported")} ${L(`from ${Z}`)}`),J>0)process.exit(1)}import{existsSync as iE,lstatSync as nE}from"fs";import{dirname as aG,resolve as Wz}from"path";import{existsSync as dG}from"fs";import{basename as gE,dirname as _8,join as iG}from"path";import{deprecate as hE}from"node:util";var Zz=["a2a","mcp","registry","catalog","ard"];function LZ($){return f0(U0(i(_8($),gE($))))}function nG($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=iG($,Q);if(dG(X))return X}let z=_8($);if(z!==$)for(let Q of Z){let X=iG(z,Q);if(dG(X))return X}return null}function rG($,Z,z={}){if(z$($,z).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return EG($,{doorUrl:z.doorUrl,extensions:Z?[jG($,Z,z)]:[]})}var zl=hE(rG,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function fE($,Z={},z={}){return hG($,["a2a","server_card"],{now:z.now??Z.generated??new Date().toISOString(),a2aCardUrl:z.a2aCardUrl,doorUrl:z.doorUrl})}var uE=["url","type","updatedAt"];function mE($,Z,z){let Q=[];try{let X=JSON.parse($.replace(/^\uFEFF/,"")).entries;Q=Array.isArray(X)?X:[]}catch{return Z}return Z.map((X)=>{let J=Q.find((W)=>W&&typeof W==="object"&&W.identifier===X.identifier);if(!J)return X;let Y=J.url===X.url&&J.type===X.type;return{...X,updatedAt:Y?J.updatedAt??X.updatedAt:z}})}function zz($,Z,z,Q=new Date().toISOString()){if($===null){let Y={specVersion:"1.0",...z?{host:z}:{},entries:Z};return{text:`${JSON.stringify(Y,null,2)}
378
- `,changed:!0}}let X=QG($,"entries",mE($,Z,Q),{id:"identifier",update:uE});if(!z||cE(X.text))return X;let J=l$(X.text,{host:z},{"":{host:["specVersion"]}});return{text:J.text,changed:X.changed||J.changed}}function cE($){try{let Z=JSON.parse($);return Object.prototype.hasOwnProperty.call(Z,"host")}catch{return!0}}var NZ="no mcp endpoint in agent.fafa";function Qz($){return $!==void 0&&!e3($)}var sG="project.faf type is not an MCP server";function pE($){let Z=$.project?.type??$.app_type;return typeof Z==="string"&&Z.trim()!==""?Z.trim():void 0}function Xz($,Z){if($===void 0||Z!==void 0)return!1;let z=pE($);return z!==void 0&&!/^mcp/i.test(z)}function R8($,Z={}){return[...z$($,Z).length>0?["a2a"]:[],...i$($).length>0?["mcp"]:[],...T8($)?["registry"]:[],"catalog","ard"]}function DZ($){let Z=$.opts??{},z=$.faf,Q=$.fafa,X=Qz(Q),J=$.targets?.filter((V)=>V==="mcp"||V==="registry")??[];if(X&&J.length)throw Error(`${J.join(", ")}: ${NZ} — these cards describe an MCP server.`);let Y=Xz(z,Q),W=(z?Zz:Q?R8(Q,Z):[]).filter((V)=>!(X||Y)||V!=="mcp"&&V!=="registry"),U=new Set($.targets?.length?$.targets:W),G={};if(z)G.block=s2(z,Z);if(U.has("mcp"))if(Q&&i$(Q).length>0)G.mcp=gG(Q,z,Z);else if(z)G.mcp=KZ(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(U.has("registry"))if(Q&&T8(Q))G.registry={...vG(Q),...z?{_meta:O8(z,Z)}:{}};else if(z){let V=$z(z);G.registry={name:cG(z),...V?{title:V}:{},_meta:O8(z,Z)}}else throw Error("A registry entry needs a package or a remote MCP URL in the .fafa, or a project.faf.");if(U.has("a2a")||U.has("catalog")||U.has("ard")){if(!$.fafa){if($.targets?.some((V)=>V==="a2a"||V==="catalog"||V==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(U.has("a2a")&&$.fafa)if(z$($.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 G.a2a=rG($.fafa,z,Z);if((U.has("catalog")||U.has("ard"))&&$.fafa){let V=fE($.fafa,z,Z);if(U.has("catalog"))G.catalog=V;if(U.has("ard")){let q=uG($.fafa);G.ard=V.map((K)=>({...K,...q}))}let H=fG($.fafa);if(H)G.catalogHost=H}return lE(G),G}function lE($){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===r2);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 Jz($){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===r2)}function dE($){return A8($)||BZ($)||Jz($)}function Yz($,Z,z,Q={}){return j0(z??_8($),_8($)),q2($,`${JSON.stringify(Z,null,2)}
379
- `,{root:z??_8($),format:"json",hasMark:Q.owns??dE,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function oG($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!Zz.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${Zz.join(",")})`);return Z}l();function rE($){try{return nE($),!0}catch{return!1}}function sE($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[Z$]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function tG($={}){let Z=$.faf?Wz($.faf):m();if(!Z||!iE(Z))console.error(`Error: project.faf not found
378
+ Run 'faf init' to create one.`),process.exit(2);let z=$.output?oE(process.cwd(),$.output):process.cwd();if($.output)j0(z);let Q=e(Z),X=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,J=0,Y=(U)=>{if(!aE(U))J++};if(X||$.agents)Y(()=>_4(z,"AGENTS.md",()=>TG(z,r3(z,Q))));if(X||$.cursor)Y(()=>_4(z,".cursorrules",()=>AG(z,Q),["# faf:start","# faf:end"]));if(X||$.gemini)Y(()=>_4(z,"GEMINI.md",()=>CG(z,r3(z,Q))));if(X||$.copilot)Y(()=>_4(z,".github/copilot-instructions.md",()=>RG(z,Q)));if($.grok)Y(()=>{let U=FG(z,Q);console.log(` .grok/config.toml (${U})`)});if($.llms)Y(()=>_4(z,"llms.txt",()=>SG(z,Q)));if(X||$.html)Y(()=>{let U=a(Z,()=>N0(p(Z)));qZ(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=aG(z,Q,{},{force:$.force});console.log(` ${U.replace(`${z}/`,"")}`)});if(console.log(`${A("exported")} ${M(`from ${Z}`)}`),J>0)process.exit(1)}import{existsSync as Ww,lstatSync as Uw}from"fs";import{dirname as XV,resolve as Gz}from"path";import{existsSync as tG}from"fs";import{basename as tE,dirname as R4,join as eG}from"path";import{deprecate as eE}from"node:util";var Qz=["a2a","mcp","registry","catalog","ard"];function OZ($){return h0(U0(i(R4($),tE($))))}function $V($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=eG($,Q);if(tG(X))return X}let z=R4($);if(z!==$)for(let Q of Z){let X=eG(z,Q);if(tG(X))return X}return null}function ZV($,Z,z={}){if(z$($,z).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return gG($,{doorUrl:z.doorUrl,extensions:Z?[vG($,Z,z)]:[]})}var Tl=eE(ZV,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function $w($,Z={},z={}){return dG($,["a2a","server_card"],{now:z.now??Z.generated??new Date().toISOString(),a2aCardUrl:z.a2aCardUrl,doorUrl:z.doorUrl})}var Zw=["url","type","updatedAt"];function zw($,Z,z){let Q=[];try{let X=JSON.parse($.replace(/^\uFEFF/,"")).entries;Q=Array.isArray(X)?X:[]}catch{return Z}return Z.map((X)=>{let J=Q.find((W)=>W&&typeof W==="object"&&W.identifier===X.identifier);if(!J)return X;let Y=J.url===X.url&&J.type===X.type;return{...X,updatedAt:Y?J.updatedAt??X.updatedAt:z}})}function Xz($,Z,z,Q=new Date().toISOString()){if($===null){let Y={specVersion:"1.0",...z?{host:z}:{},entries:Z};return{text:`${JSON.stringify(Y,null,2)}
379
+ `,changed:!0}}let X=VG($,"entries",zw($,Z,Q),{id:"identifier",update:Zw});if(!z||Qw(X.text))return X;let J=l$(X.text,{host:z},{"":{host:["specVersion"]}});return{text:J.text,changed:X.changed||J.changed}}function Qw($){try{let Z=JSON.parse($);return Object.prototype.hasOwnProperty.call(Z,"host")}catch{return!0}}var IZ="no mcp endpoint in agent.fafa";function Jz($){return $!==void 0&&!Zz($)}var zV="project.faf type is not an MCP server";function Xw($){let Z=$.project?.type??$.app_type;return typeof Z==="string"&&Z.trim()!==""?Z.trim():void 0}function Yz($,Z){if($===void 0||Z!==void 0)return!1;let z=Xw($);return z!==void 0&&!/^mcp/i.test(z)}function P4($,Z={}){return[...z$($,Z).length>0?["a2a"]:[],...i$($).length>0?["mcp"]:[],...A4($)?["registry"]:[],"catalog","ard"]}function TZ($){let Z=$.opts??{},z=$.faf,Q=$.fafa,X=Jz(Q),J=$.targets?.filter((V)=>V==="mcp"||V==="registry")??[];if(X&&J.length)throw Error(`${J.join(", ")}: ${IZ} — these cards describe an MCP server.`);let Y=Yz(z,Q),W=(z?Qz:Q?P4(Q,Z):[]).filter((V)=>!(X||Y)||V!=="mcp"&&V!=="registry"),U=new Set($.targets?.length?$.targets:W),G={};if(z)G.block=r2(z,Z);if(U.has("mcp"))if(Q&&i$(Q).length>0)G.mcp=lG(Q,z,Z);else if(z)G.mcp=LZ(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(U.has("registry"))if(Q&&A4(Q))G.registry={...pG(Q),...z?{_meta:I4(z,Z)}:{}};else if(z){let V=zz(z);G.registry={name:sG(z),...V?{title:V}:{},_meta:I4(z,Z)}}else throw Error("A registry entry needs a package or a remote MCP URL in the .fafa, or a project.faf.");if(U.has("a2a")||U.has("catalog")||U.has("ard")){if(!$.fafa){if($.targets?.some((V)=>V==="a2a"||V==="catalog"||V==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(U.has("a2a")&&$.fafa)if(z$($.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 G.a2a=ZV($.fafa,z,Z);if((U.has("catalog")||U.has("ard"))&&$.fafa){let V=$w($.fafa,z,Z);if(U.has("catalog"))G.catalog=V;if(U.has("ard")){let q=nG($.fafa);G.ard=V.map((K)=>({...K,...q}))}let H=iG($.fafa);if(H)G.catalogHost=H}return Jw(G),G}function Jw($){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 Wz($){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 Yw($){return C4($)||NZ($)||Wz($)}function Uz($,Z,z,Q={}){return j0(z??R4($),R4($)),q2($,`${JSON.stringify(Z,null,2)}
380
+ `,{root:z??R4($),format:"json",hasMark:Q.owns??Yw,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function QV($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!Qz.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${Qz.join(",")})`);return Z}l();function Gw($){try{return Uw($),!0}catch{return!1}}function Vw($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[Z$]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function JV($={}){let Z=$.faf?Gz($.faf):m();if(!Z||!Ww(Z))console.error(`Error: project.faf not found
380
381
 
381
- Run 'faf init' to create one.`),process.exit(2);let z=e(Z),Q=Wz($.in??"./server.json"),X=$.in?aG(Q):process.cwd();if(!rE(Q))console.error(`Error: ${Q} not found.
382
+ Run 'faf init' to create one.`),process.exit(2);let z=e(Z),Q=Gz($.in??"./server.json"),X=$.in?XV(Q):process.cwd();if(!Gw(Q))console.error(`Error: ${Q} not found.
382
383
 
383
384
  'faf server-card' patches the identity into an existing registry server.json;
384
- it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=i(X,Q),Y=U0(J),W=$.generated??sE(Y)??new Date().toISOString(),U=DZ({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),G=U.registry.name,V=U.registry.title,H;try{H=MZ(Y,{name:G,title:V,version:$.setVersion,meta:U.registry._meta})}catch(M){if(!(M instanceof m0))throw M;console.error(`faf: ${Q}: ${M.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 q=Wz($.out??Q),K=V??"(none in project.faf — the file's own kept)";if(q===Q){if(H.changed)o(J,H.text,{root:X,expect:Y})}else G2(q),q2(q,H.text,{root:$.out?aG(q):process.cwd(),format:"json",hasMark:BZ,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${A("✓")} ${q} — name=${G} title=${K} ${L(H.changed||q!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as eG,lstatSync as oE}from"fs";import{dirname as $V,join as n$,resolve as Uz}from"path";l();function aE($){try{let Z=JSON.parse($).name;return typeof Z==="string"&&Z!==""?Z:null}catch{return null}}function OZ($){try{return oE($),!0}catch{return!1}}var b2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0;function ZV($){return(Array.isArray($.entries)?$.entries.map(b2):[]).find((z)=>z?.type==="application/vnd.fafa+yaml"&&/^urn:air:[^:]+:agent:/.test(String(z?.identifier)))?.updatedAt}var tE=[{target:"registry",file:["server.json"],stamp:($)=>b2(b2(b2($._meta)?.[Z$])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>b2(b2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=b2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(b2).find((Q)=>Q?.uri===r2):void 0;return b2(z?.params)?.generated}},{target:"catalog",file:[".well-known","ai-catalog.json"],stamp:ZV},{target:"ard",file:[".well-known","ard.json"],stamp:ZV}];function eE($,Z){for(let{target:z,file:Q,stamp:X}of tE){let J=n$($,...Q);if(Z?.length&&!Z.includes(z)||!OZ(J))continue;try{let Y=b2(JSON.parse(U0(i($,J)).replace(/^\uFEFF/,""))),W=Y?X(Y):void 0;if(typeof W==="string")return W}catch{}}return}function $w($,Z,z){let Q=Z?.filter((J)=>J==="mcp"||J==="registry")??[];if(Q.length)console.error(`Error: --target ${Q.join(",")}: ${NZ} — these cards describe an MCP server.`),process.exit(2);let X=Boolean($.metadata?.cards?.packages?.length);if(!Z?.length&&(z||X))console.error(L(`skipped MCP Server Card and registry server.json: ${NZ}`))}function IZ($={}){let Z=$.dir?Uz($.dir):process.cwd(),z;try{z=oG($.target)}catch(M){console.error(`Error: ${M.message}`),process.exit(2)}let Q=$.fafa?Uz($.fafa):nG(Z),X=Q&&eG(Q)?LZ(Q):void 0,J=$.faf?Uz($.faf):m(Z),Y=Boolean(J&&eG(J));if(X&&Qz(X))$w(X,z,Y);if(!Y){if(!X)console.error(`Error: no agent.fafa or project.faf here
385
+ it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=i(X,Q),Y=U0(J),W=$.generated??Vw(Y)??new Date().toISOString(),U=TZ({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),G=U.registry.name,V=U.registry.title,H;try{H=DZ(Y,{name:G,title:V,version:$.setVersion,meta:U.registry._meta})}catch(L){if(!(L instanceof u0))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 q=Gz($.out??Q),K=V??"(none in project.faf — the file's own kept)";if(q===Q){if(H.changed)o(J,H.text,{root:X,expect:Y})}else G2(q),q2(q,H.text,{root:$.out?XV(q):process.cwd(),format:"json",hasMark:NZ,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${A("✓")} ${q} — name=${G} title=${K} ${M(H.changed||q!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as YV,lstatSync as Hw}from"fs";import{dirname as WV,join as n$,resolve as Vz}from"path";l();function qw($){try{let Z=JSON.parse($).name;return typeof Z==="string"&&Z!==""?Z:null}catch{return null}}function AZ($){try{return Hw($),!0}catch{return!1}}var b2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0;function UV($){return(Array.isArray($.entries)?$.entries.map(b2):[]).find((z)=>z?.type==="application/vnd.fafa+yaml"&&/^urn:air:[^:]+:agent:/.test(String(z?.identifier)))?.updatedAt}var Kw=[{target:"registry",file:["server.json"],stamp:($)=>b2(b2(b2($._meta)?.[Z$])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>b2(b2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=b2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(b2).find((Q)=>Q?.uri===n2):void 0;return b2(z?.params)?.generated}},{target:"catalog",file:[".well-known","ai-catalog.json"],stamp:UV},{target:"ard",file:[".well-known","ard.json"],stamp:UV}];function Bw($,Z){for(let{target:z,file:Q,stamp:X}of Kw){let J=n$($,...Q);if(Z?.length&&!Z.includes(z)||!AZ(J))continue;try{let Y=b2(JSON.parse(U0(i($,J)).replace(/^\uFEFF/,""))),W=Y?X(Y):void 0;if(typeof W==="string")return W}catch{}}return}function Mw($,Z,z){let Q=Z?.filter((J)=>J==="mcp"||J==="registry")??[];if(Q.length)console.error(`Error: --target ${Q.join(",")}: ${IZ} — these cards describe an MCP server.`),process.exit(2);let X=Boolean($.metadata?.cards?.packages?.length);if(!Z?.length&&(z||X))console.error(M(`skipped MCP Server Card and registry server.json: ${IZ}`))}function CZ($={}){let Z=$.dir?Vz($.dir):process.cwd(),z;try{z=QV($.target)}catch(L){console.error(`Error: ${L.message}`),process.exit(2)}let Q=$.fafa?Vz($.fafa):$V(Z),X=Q&&YV(Q)?OZ(Q):void 0,J=$.faf?Vz($.faf):m(Z),Y=Boolean(J&&YV(J));if(X&&Jz(X))Mw(X,z,Y);if(!Y){if(!X)console.error(`Error: no agent.fafa or project.faf here
385
386
 
386
387
  Cards start from an agent.fafa: faf card init
387
- For project.faf: faf init`),process.exit(2);let M=R8(X,{doorUrl:$.doorUrl});if(z?.some((B)=>(B==="mcp"||B==="registry")&&!M.includes(B))){let B=`
388
- With only an agent.fafa: faf cards --target ${M.join(",")}`;console.error(`Error: project.faf not found
388
+ For project.faf: faf init`),process.exit(2);let L=P4(X,{doorUrl:$.doorUrl});if(z?.some((B)=>(B==="mcp"||B==="registry")&&!L.includes(B))){let B=`
389
+ With only an agent.fafa: faf cards --target ${L.join(",")}`;console.error(`Error: project.faf not found
389
390
 
390
- Run 'faf init' to create one.${B}`),process.exit(2)}}let W=Y?e(J):void 0,U=!z?.length&&Xz(W,X);if(U)console.error(L(`skipped MCP Server Card and registry server.json: ${sG}`)),console.error(L(" for its business card: faf card init · an MCP server after all: faf cards --target mcp"));let G;try{G=DZ({faf:W,fafa:X,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:eE(Z,z)??new Date().toISOString()}})}catch(M){console.error(`Error: ${M.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(G,null,2)}
391
- `);return}let V=[],H=$.force===!0,q=0,K=(M,B,N="its own keys")=>{try{V.push({out:M,changed:B()})}catch(O){if(O instanceof m0)console.error(`faf: ${M}: ${O.message} — faf cannot change only ${N}, so it left the file unchanged.`);else if(u$(O))console.error(m$(O,!0));else throw O;q++}};if(G.a2a){let M=n$(Z,".well-known","agent-card.json");K(M,()=>Yz(M,G.a2a,Z,{owns:Jz,mark:`faf render hash or FAF context extension (${r2})`,force:H})!=="unchanged")}if(G.mcp){let M=n$(Z,"server-card");K(M,()=>Yz(M,G.mcp,Z,{owns:A8,mark:'faf render hash or FAF context-block (`_meta["one.faf/context"]`)',force:H})!=="unchanged")}if(G.catalog){let M=n$(Z,".well-known","ai-catalog.json"),B=G.catalog;K(M,()=>{j0(Z,$V(M));let N=i(Z,M),O=OZ(M)?U0(N):null,_=zz(O,B,G.catalogHost);if(_.changed)o(N,_.text,{root:Z,expect:O});return _.changed},"its own rows")}if(G.ard){let M=n$(Z,".well-known","ard.json"),B=G.ard;if(K(M,()=>{j0(Z,$V(M));let N=i(Z,M),O=OZ(M)?U0(N):null,_=zz(O,B,G.catalogHost);if(_.changed)o(N,_.text,{root:Z,expect:O});return _.changed},"its own rows"),!B.some((N)=>N.representativeQueries?.length))console.error(`${L("note")} ${M}: 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(G.registry){let M=n$(Z,"server.json");if(OZ(M)){let B=G.registry;K(M,()=>{let N=i(Z,M),O=U0(N),_=aE(O),x=X!==void 0&&T8(X);if(!H&&x&&_&&_!==B.name)throw new v("not-owned",N,`${M} is published as "${_}" and the .fafa gives "${B.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 S=MZ(O,{name:B.name,title:B.title,meta:B._meta});if(S.changed)o(N,S.text,{root:Z,expect:O});return S.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${M} not found.
391
+ Run 'faf init' to create one.${B}`),process.exit(2)}}let W=Y?e(J):void 0,U=!z?.length&&Yz(W,X);if(U)console.error(M(`skipped MCP Server Card and registry server.json: ${zV}`)),console.error(M(" for its business card: faf card init · an MCP server after all: faf cards --target mcp"));let G;try{G=TZ({faf:W,fafa:X,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:Bw(Z,z)??new Date().toISOString()}})}catch(L){console.error(`Error: ${L.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(G,null,2)}
392
+ `);return}let V=[],H=$.force===!0,q=0,K=(L,B,N="its own keys")=>{try{V.push({out:L,changed:B()})}catch(O){if(O instanceof u0)console.error(`faf: ${L}: ${O.message} — faf cannot change only ${N}, so it left the file unchanged.`);else if(u$(O))console.error(m$(O,!0));else throw O;q++}};if(G.a2a){let L=n$(Z,".well-known","agent-card.json");K(L,()=>Uz(L,G.a2a,Z,{owns:Wz,mark:`faf render hash or FAF context extension (${n2})`,force:H})!=="unchanged")}if(G.mcp){let L=n$(Z,"server-card");K(L,()=>Uz(L,G.mcp,Z,{owns:C4,mark:'faf render hash or FAF context-block (`_meta["one.faf/context"]`)',force:H})!=="unchanged")}if(G.catalog){let L=n$(Z,".well-known","ai-catalog.json"),B=G.catalog;K(L,()=>{j0(Z,WV(L));let N=i(Z,L),O=AZ(L)?U0(N):null,_=Xz(O,B,G.catalogHost);if(_.changed)o(N,_.text,{root:Z,expect:O});return _.changed},"its own rows")}if(G.ard){let L=n$(Z,".well-known","ard.json"),B=G.ard;if(K(L,()=>{j0(Z,WV(L));let N=i(Z,L),O=AZ(L)?U0(N):null,_=Xz(O,B,G.catalogHost);if(_.changed)o(N,_.text,{root:Z,expect:O});return _.changed},"its own rows"),!B.some((N)=>N.representativeQueries?.length))console.error(`${M("note")} ${L}: 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(G.registry){let L=n$(Z,"server.json");if(AZ(L)){let B=G.registry;K(L,()=>{let N=i(Z,L),O=U0(N),_=qw(O),x=X!==void 0&&A4(X);if(!H&&x&&_&&_!==B.name)throw new v("not-owned",N,`${L} is published as "${_}" and the .fafa gives "${B.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 S=DZ(O,{name:B.name,title:B.title,meta:B._meta});if(S.changed)o(N,S.text,{root:Z,expect:O});return S.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${L} not found.
392
393
 
393
- Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(V.length===0&&q===0){if(U)return;console.error(`${A("faf cards")} ${L("nothing to write — need .fafa for A2A/catalog/ARD; server.json for registry")}`);return}for(let{out:M,changed:B}of V)console.error(`${A("✓")} ${M}${B?"":` ${L("(unchanged)")}`}`);if(!Y)console.error(L("BETTER: cards from your agent.fafa. BEST: add your project.faf (faf init) for FAF context on every card."));if(q>0)process.exit(1)}import{existsSync as zV,readFileSync as Zw}from"fs";import{join as XV,resolve as QV}from"path";import{createInterface as zw}from"readline";l();var Qw=["a2a","mcp"],Xw={a2a:"A2A card",mcp:"MCP Server Card",registry:"registry server.json",catalog:"AI Catalog",ard:"ARD"};function JV($){return $.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"")}function Jw($){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 Yw($){try{let Z=JSON.parse(Zw(XV($,"package.json"),"utf-8")).version;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}catch{return}}var YV={npm:"npm",pypi:"pypi",crates:"cargo"},Ww=new RegExp(`^(${Object.keys(YV).join("|")}):`,"i");function WV($){let Z=$.indexOf(":");if(Z<0)return{registryType:"npm",identifier:$.trim()};let z=$.slice(0,Z).trim().toLowerCase(),Q=YV[z];if(!Q)throw Error(`Package "${$}": registry "${z}" is not one faf knows — npm:<name> (the default), pypi:<name> or crates:<name>.`);return{registryType:Q,identifier:$.slice(Z+1).trim()}}function UV($,Z,z){if(Z.includes(":")&&!Ww.test(Z))$.endpoints=[{protocol:z,url:Z}];else $.packages=[WV(Z)]}function a0($){return($??"").trim()}function Uw($){let Z=a0($.name),z={display_name:Z,handle:a0($.shortName)||JV(Z),domain:a0($.domain),description:a0($.description),version:a0($.setVersion),skills:($.skill??[]).map(Jw).filter((Q)=>Q.name),example_requests:($.example??[]).map(a0).filter(Boolean)};if(a0($.homepage))z.homepage=a0($.homepage);if($.url)UV(z,a0($.url),a0($.protocol).toLowerCase()||"a2a");if($.package)z.packages=[WV(a0($.package))];if(a0($.kind)){if(!$.package)throw Error("--kind says what a --package is: give --package too.");z.package_kind=a0($.kind).toLowerCase()}return z}function GV($){return async(Z,z)=>(await $(z?`${Z} ${L(`(${z})`)}: `:`${Z}: `)).trim()||z||""}async function VV($,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 Gw($,Z){let z=GV(Z),Q=await z("Where it runs — a URL people call, or a package (npm name, pypi:name or crates:name)");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=Qw.includes(J)?J:"a2a"}if(UV($,Q,X),$.packages?.length&&!$.package_kind)for(;;){let J=(await z(`What it is — ${qZ.join(", ")}`,"mcp")).toLowerCase();if(qZ.includes(J)){$.package_kind=J;break}}}async function Vw($){let Z=[];for(;;){let[z]=await VV($,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 $(` ${L("what it does")}: `)).trim();Z.push({name:z,...Q?{description:Q}:{}})}return Z}async function Hw($,Z,z){let Q={...$},X=GV(Z);if(Q.display_name||=await X("Name — what people see, e.g. Weather Agent"),Q.handle||=await X("Short name — lowercase, no spaces",JV(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",Yw(z)??"0.1.0"),!Q.endpoints?.length&&!Q.packages?.length)await Gw(Q,Z);if(!Q.skills?.length)Q.skills=await Vw(Z);if(!Q.example_requests?.length)Q.example_requests=await VV(Z,"A question people ask it — search finds it by these (2-5)","Another (Enter to finish)",5);return Q}function qw($){if(!$.skills?.length)throw Error("Missing answer: what it can do (at least one capability)");return yG(xG($))}function Kw($){return Boolean($.name&&$.domain&&$.description&&$.setVersion&&($.url||$.package)&&$.skill?.length)}function Bw($){if($)return{ask:$,close:()=>{}};if(!process.stdin.isTTY)return{close:()=>{}};let Z=zw({input:process.stdin,output:process.stdout});return{ask:(z)=>new Promise((Q)=>Z.question(z,Q)),close:()=>Z.close()}}async function HV($={},Z){let z=QV($.dir??process.cwd()),Q=QV(z,$.out??"agent.fafa");if(zV(Q)&&!$.force)console.error(`Error: ${Q} already exists — edit it, or use --force to replace it.`),process.exit(2);let X;try{X=Uw($)}catch(Y){console.error(`Error: ${Y.message}`),process.exit(2)}let J=Kw($)?{close:()=>{}}:Bw(Z);try{if(J.ask){if(!Z)console.log(`${A("card init")} ${L("— seven answers, one agent.fafa")}
394
- `);X=await Hw(X,J.ask,z)}let Y;try{Y=qw(X)}catch(G){console.error(`Error: ${G.message}`),process.exit(2)}if(o(Q,Y,{root:z}),console.log(`${A("✓")} ${Q}`),(X.example_requests??[]).length<2)console.error(`${L("note")} add 2-5 questions people ask it (metadata.cards.examples) — search finds it by these.`);let W=R8(LZ(Q)).filter((G)=>G!=="registry"||zV(XV(z,"server.json"))),U=W.map((G)=>Xw[G]).join(", ");if(J.ask){let G=(await J.ask(`Write your ${U} now? ${L("(Y/n)")} `)).trim().toLowerCase();if(G===""||G.startsWith("y")){IZ({dir:z,fafa:Q,target:W.join(",")});return}}if(console.log(L(` next: faf cards --target ${W.join(",")}`)),!m(z))console.log(L(" BEST: add your project.faf (faf init) for FAF context on every card."))}finally{J.close()}}import{join as Mw}from"path";import Lw from"open";l();function Nw($){if(process.env.CI)return!1;try{return Lw($).catch(()=>{return}),!0}catch{return!1}}function qV($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
394
+ Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(V.length===0&&q===0){if(U)return;console.error(`${A("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog/ARD; server.json for registry")}`);return}for(let{out:L,changed:B}of V)console.error(`${A("✓")} ${L}${B?"":` ${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(q>0)process.exit(1)}import{existsSync as GV,readFileSync as Lw}from"fs";import{join as HV,resolve as VV}from"path";import{createInterface as Nw}from"readline";l();var Dw=["a2a","mcp"],Ow={a2a:"A2A card",mcp:"MCP Server Card",registry:"registry server.json",catalog:"AI Catalog",ard:"ARD"};function qV($){return $.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"")}function Iw($){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 Tw($){try{let Z=JSON.parse(Lw(HV($,"package.json"),"utf-8")).version;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}catch{return}}var KV={npm:"npm",pypi:"pypi",crates:"cargo"},Aw=new RegExp(`^(${Object.keys(KV).join("|")}):`,"i");function BV($){let Z=$.indexOf(":");if(Z<0)return{registryType:"npm",identifier:$.trim()};let z=$.slice(0,Z).trim().toLowerCase(),Q=KV[z];if(!Q)throw Error(`Package "${$}": registry "${z}" is not one faf knows — npm:<name> (the default), pypi:<name> or crates:<name>.`);return{registryType:Q,identifier:$.slice(Z+1).trim()}}function MV($,Z,z){if(Z.includes(":")&&!Aw.test(Z))$.endpoints=[{protocol:z,url:Z}];else $.packages=[BV(Z)]}function a0($){return($??"").trim()}function Cw($){let Z=a0($.name),z={display_name:Z,handle:a0($.shortName)||qV(Z),domain:a0($.domain),description:a0($.description),version:a0($.setVersion),skills:($.skill??[]).map(Iw).filter((Q)=>Q.name),example_requests:($.example??[]).map(a0).filter(Boolean)};if(a0($.homepage))z.homepage=a0($.homepage);if($.url)MV(z,a0($.url),a0($.protocol).toLowerCase()||"a2a");if($.package)z.packages=[BV(a0($.package))];if(a0($.kind)){if(!$.package)throw Error("--kind says what a --package is: give --package too.");z.package_kind=a0($.kind).toLowerCase()}return z}function LV($){return async(Z,z)=>(await $(z?`${Z} ${M(`(${z})`)}: `:`${Z}: `)).trim()||z||""}async function NV($,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 _w($,Z){let z=LV(Z),Q=await z("Where it runs — a URL people call, or a package (npm name, pypi:name or crates:name)");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=Dw.includes(J)?J:"a2a"}if(MV($,Q,X),$.packages?.length&&!$.package_kind)for(;;){let J=(await z(`What it is — ${MZ.join(", ")}`,"mcp")).toLowerCase();if(MZ.includes(J)){$.package_kind=J;break}}}async function Rw($){let Z=[];for(;;){let[z]=await NV($,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 Pw($,Z,z){let Q={...$},X=LV(Z);if(Q.display_name||=await X("Name — what people see, e.g. Weather Agent"),Q.handle||=await X("Short name — lowercase, no spaces",qV(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",Tw(z)??"0.1.0"),!Q.endpoints?.length&&!Q.packages?.length)await _w(Q,Z);if(!Q.skills?.length)Q.skills=await Rw(Z);if(!Q.example_requests?.length)Q.example_requests=await NV(Z,"A question people ask it — search finds it by these (2-5)","Another (Enter to finish)",5);return Q}function Fw($){if(!$.skills?.length)throw Error("Missing answer: what it can do (at least one capability)");return uG(fG($))}function Sw($){return Boolean($.name&&$.domain&&$.description&&$.setVersion&&($.url||$.package)&&$.skill?.length)}function jw($){if($)return{ask:$,close:()=>{}};if(!process.stdin.isTTY)return{close:()=>{}};let Z=Nw({input:process.stdin,output:process.stdout});return{ask:(z)=>new Promise((Q)=>Z.question(z,Q)),close:()=>Z.close()}}async function DV($={},Z){let z=VV($.dir??process.cwd()),Q=VV(z,$.out??"agent.fafa");if(GV(Q)&&!$.force)console.error(`Error: ${Q} already exists — edit it, or use --force to replace it.`),process.exit(2);let X;try{X=Cw($)}catch(Y){console.error(`Error: ${Y.message}`),process.exit(2)}let J=Sw($)?{close:()=>{}}:jw(Z);try{if(J.ask){if(!Z)console.log(`${A("card init")} ${M("— seven answers, one agent.fafa")}
395
+ `);X=await Pw(X,J.ask,z)}let Y;try{Y=Fw(X)}catch(G){console.error(`Error: ${G.message}`),process.exit(2)}if(o(Q,Y,{root:z,...$.force?{}:{expect:null}}),console.log(`${A("✓")} ${Q}`),(X.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=P4(OZ(Q)).filter((G)=>G!=="registry"||GV(HV(z,"server.json"))),U=W.map((G)=>Ow[G]).join(", ");if(J.ask){let G=(await J.ask(`Write your ${U} now? ${M("(Y/n)")} `)).trim().toLowerCase();if(G===""||G.startsWith("y")){CZ({dir:z,fafa:Q,target:W.join(",")});return}}if(console.log(M(` next: faf cards --target ${W.join(",")}`)),!m(z))console.log(M(" BEST: add your project.faf (faf init) for FAF context on every card."))}finally{J.close()}}import{join as Ew}from"path";l();function ww($){if(process.env.CI)return!1;try{return import("open").then(({default:Z})=>Z($)).catch(()=>{return}),!0}catch{return!1}}function OV($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
395
396
 
396
- Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=e(Z),X=a(Z,()=>N0(p(Z)));GZ(z,Q,X,Z,{force:$.force});let J=Mw(z,"project.html"),Y=Nw(J);console.log(" project.html"),console.log(Y?`${A("opened")} ${L("in your browser")}`:`${A("rendered")} ${L(`file://${J}`)}`)}import{existsSync as Dw}from"fs";import{join as Gz,resolve as Ow}from"path";import{execFileSync as LV}from"child_process";function KV($){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 BV($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function MV($,Z={}){let z=h$($);if(Z.repoUrl&&z.project&&!W2($)?.name&&z.project.name===$.split("/").pop())z.project.name=BV(Z.repoUrl);return z}l();function Iw($){let Z;try{Z=LV("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=Gz($,Q.slice(X+1)),Y=y0(J);if(Y===null)continue;try{if(C5(J,{root:$,expect:Y}))z++}catch{}}return z}function Tw($,Z,z){return["clone","-c","core.symlinks=false","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function Aw($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?Ow(Z,$.output):Gz(Z,"project.faf");if(Dw(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
397
- `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function NV($,Z={},z=process.cwd()){let Q;try{Q=KV($)}catch(W){console.error(`Error: ${W.message}
397
+ Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=e(Z),X=a(Z,()=>N0(p(Z)));qZ(z,Q,X,Z,{force:$.force});let J=Ew(z,"project.html"),Y=ww(J);console.log(" project.html"),console.log(Y?`${A("opened")} ${M("in your browser")}`:`${A("rendered")} ${M(`file://${J}`)}`)}import{existsSync as xw}from"fs";import{join as Hz,resolve as yw}from"path";import{execFileSync as CV}from"child_process";function IV($){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 TV($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function AV($,Z={}){let z=h$($);if(Z.repoUrl&&z.project&&!W2($)?.name&&z.project.name===$.split("/").pop())z.project.name=TV(Z.repoUrl);return z}l();function kw($){let Z;try{Z=CV("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=Hz($,Q.slice(X+1)),Y=l0(J);if(Y===null)continue;try{if(R5(J,{root:$,expect:Y}))z++}catch{}}return z}function bw($,Z,z){return["clone","-c","core.symlinks=false","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function vw($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?yw(Z,$.output):Hz(Z,"project.faf");if(xw(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
398
+ `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function _V($,Z={},z=process.cwd()){let Q;try{Q=IV($)}catch(W){console.error(`Error: ${W.message}
398
399
 
399
- Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=Aw(Z,z)}catch(W){console.error(`Error: ${W.message}`),process.exit(1);return}G2(X.outputPath===null?void 0:Z.output);let J=_5("faf-git-"),Y=Gz(J,"repo");try{console.error(L(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{LV("git",Tw(Q,Y,Z.ref),{stdio:"pipe"})}catch(V){let q=(V?.stderr?.toString()??"").trim().split(`
400
+ Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=vw(Z,z)}catch(W){console.error(`Error: ${W.message}`),process.exit(1);return}G2(X.outputPath===null?void 0:Z.output);let J=P5("faf-git-"),Y=Hz(J,"repo");try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{CV("git",bw(Q,Y,Z.ref),{stdio:"pipe"})}catch(V){let q=(V?.stderr?.toString()??"").trim().split(`
400
401
  `).slice(-2).join(" ").trim()||"git clone failed",K=Z.ref?`
401
402
 
402
403
  (does the branch/tag '${Z.ref}' exist?)`:"";console.error(`Error: could not clone ${$}
403
404
 
404
- ${q}${K}`),process.exit(1)}Iw(Y);let W=MV(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(d9(W));return}k0(X.outputPath,W,{replace:Z.force===!0}),console.log(`${A("created")} ${X.outputPath}`);let U=p(X.outputPath),G=a(X.outputPath,()=>b0(P0(U)));E0(G,X.outputPath)}finally{R5(J)}}import{execFileSync as v2}from"child_process";import{readFileSync as Cw,existsSync as _w}from"fs";import{dirname as Rw,resolve as Pw}from"path";var r$=($)=>String($).trim(),Fw="slotignored",DV=($)=>G0($)||typeof $==="string"&&$.trim().toLowerCase()===Fw;function Sw($,Z){let z=[],Q=0,X=0;for(let J of J0){let Y=a1($,J),W=a1(Z,J),U=!DV(Y),G=!DV(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:r$(W)});else if(U&&!G)z.push({...H,kind:"removed",from:r$(Y)});else if(U&&G&&r$(Y)!==r$(W))z.push({...H,kind:"changed",from:r$(Y),to:r$(W)})}return{changes:z,filledBase:Q,filledTarget:X}}function OV($){if(!$.trim())return 0;try{return N0($).score??0}catch{return 0}}function IV($){if(!$.trim())return{};try{return Y2($)??{}}catch{return{}}}function CZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=Sw(IV($),IV(Z)),J=OV($),Y=OV(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var jw={added:"+",removed:"-",changed:"~"},TV=($)=>$>0?`+${$}`:`${$}`,TZ=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function CV($,Z,z){let Q=[],X=A2(M6($.scoreBase)),J=A2(M6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${TV($.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=jw[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")Q.push(` ${U} ${G} ${TZ(W.from)} → ${TZ(W.to)}`);else if(W.kind==="added")Q.push(` ${U} ${G} ${TZ(W.to)} (added)`);else Q.push(` ${U} ${G} ${TZ(W.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${TV($.filledTarget-$.filledBase)})`),Q.join(`
405
- `)}function Ew($,Z){try{return v2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function P8($,Z){if(!Ew($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function s$($,Z,z){try{return v2("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"&&_w(J)?Cw(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=CZ(z($[1]),z($[4]));console.log(CV(X,Q($[1],$[2]),Q($[4],$[5])))}catch(z){console.log(`${Z} — faf diff unavailable (${z instanceof Error?z.message:"error"})`)}}var AZ="*.faf diff=faf";function Vz($){let[Z,...z]=$.trim().split(/\s+/);try{return v2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function RV($){try{return v2("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 t0="faf-cli diff-driver";function PV($,Z,z){try{return v2("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(`
406
- `)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function Hz($,Z=!1){return PV($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function ww($){let z=PV($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
407
- `)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var FV=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function xw($){let Z=i($,".gitattributes"),z=I6(Z),Q=z??"";if(Q.split(`
408
- `).some((Y)=>Y.trim()===AZ)){console.log(`• .gitattributes already opts in (${AZ})`);return}let X=Q.includes(`\r
405
+ ${q}${K}`),process.exit(1)}kw(Y);let W=AV(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(r9(W));return}y0(X.outputPath,W,{replace:Z.force===!0}),console.log(`${A("created")} ${X.outputPath}`);let U=p(X.outputPath),G=a(X.outputPath,()=>k0(P0(U)));E0(G,X.outputPath)}finally{F5(J)}}import{execFileSync as v2}from"child_process";import{readFileSync as gw,existsSync as hw}from"fs";import{dirname as fw,resolve as uw}from"path";var r$=($)=>String($).trim(),mw="slotignored",RV=($)=>G0($)||typeof $==="string"&&$.trim().toLowerCase()===mw;function cw($,Z){let z=[],Q=0,X=0;for(let J of J0){let Y=a1($,J),W=a1(Z,J),U=!RV(Y),G=!RV(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:r$(W)});else if(U&&!G)z.push({...H,kind:"removed",from:r$(Y)});else if(U&&G&&r$(Y)!==r$(W))z.push({...H,kind:"changed",from:r$(Y),to:r$(W)})}return{changes:z,filledBase:Q,filledTarget:X}}function PV($){if(!$.trim())return 0;try{return N0($).score??0}catch{return 0}}function FV($){if(!$.trim())return{};try{return Y2($)??{}}catch{return{}}}function PZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=cw(FV($),FV(Z)),J=PV($),Y=PV(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var pw={added:"+",removed:"-",changed:"~"},SV=($)=>$>0?`+${$}`:`${$}`,_Z=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function EV($,Z,z){let Q=[],X=A2(B6($.scoreBase)),J=A2(B6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${SV($.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=pw[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")Q.push(` ${U} ${G} ${_Z(W.from)} → ${_Z(W.to)}`);else if(W.kind==="added")Q.push(` ${U} ${G} ${_Z(W.to)} (added)`);else Q.push(` ${U} ${G} ${_Z(W.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${SV($.filledTarget-$.filledBase)})`),Q.join(`
406
+ `)}function lw($,Z){try{return v2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function F4($,Z){if(!lw($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function s$($,Z,z){try{return v2("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function wV($){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"&&hw(J)?gw(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=PZ(z($[1]),z($[4]));console.log(EV(X,Q($[1],$[2]),Q($[4],$[5])))}catch(z){console.log(`${Z} — faf diff unavailable (${z instanceof Error?z.message:"error"})`)}}var RZ="*.faf diff=faf";function qz($){let[Z,...z]=$.trim().split(/\s+/);try{return v2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function xV($){try{return v2("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 t0="faf-cli diff-driver";function yV($,Z,z){try{return v2("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(`
407
+ `)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function Kz($,Z=!1){return yV($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function dw($){let z=yV($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
408
+ `)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var kV=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function iw($){let Z=i($,".gitattributes"),z=I6(Z),Q=z??"";if(Q.split(`
409
+ `).some((Y)=>Y.trim()===RZ)){console.log(`• .gitattributes already opts in (${RZ})`);return}let X=Q.includes(`\r
409
410
  `)?`\r
410
411
  `:`
411
412
  `,J=`${Q}${Q&&!Q.endsWith(`
412
- `)?X:""}${AZ}${X}`;o(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${AZ}`)}function yw($){let Z=RV($),z;try{z=Hz($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===t0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${FV(z)}, not faf's driver (${t0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=ww($)}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(xw(Z),Q)console.log(`• git config already set (diff.faf.command = ${t0})`);else v2("git",["config","diff.faf.command",t0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${t0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!Vz(t0))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 kw='[diff "faf"]',bw=` command = ${t0}`,SV=($)=>/\r(?!\n)/.test($),vw=($)=>(/\\+$/.exec(V2($))?.[0].length??0)%2===1;function gw($){if(SV($))return null;let Z=t6($),z=Z.map((V,H)=>H>0&&vw(Z[H-1])),Q=Z.map((V,H)=>!z[H]&&V2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,H)=>{if(Q[H])J=V2(V)===kw?H:-1;else if(J>=0&&!z[H]&&V2(V)===bw)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&&V2(V).trim()!==""))return null;return Z.filter((V,H)=>H!==W&&H!==Y).join("")}function AV($,Z){try{return v2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function hw($,Z,z){let Q=AV($,Z),X=AV($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
413
- ${t0}`,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 fw($){let Z=Hz($,!0);if(Z.length!==1||Z[0]!==t0)return`diff.faf.command = ${t0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=Pw($,v2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=Rw(z);try{let X=i(Q,z,{allowGitConfig:!0}),J=U0(X);if(SV(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=gw(J);if(Y===null||!hw($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${t0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return o(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof v||X instanceof c2)return X.message;throw X}}function uw($){RV($);let Z;try{Z=Hz($)}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]!==t0)return console.error(`faf: diff.faf.command is ${FV(Z)}, not faf's driver (${t0}) — faf left your git config unchanged.`),!1;let z;try{z=fw($)}catch(Q){z=`${Q.message.split(`
414
- `)[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(!yw(z))process.exit(1);return}if(Z.uninstallDriver){if(!uw(z))process.exit(1);return}let Q=m(z);if(!Q)console.error(`Error: project.faf not found
413
+ `)?X:""}${RZ}${X}`;o(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${RZ}`)}function nw($){let Z=xV($),z;try{z=Kz($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===t0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${kV(z)}, not faf's driver (${t0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=dw($)}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(iw(Z),Q)console.log(`• git config already set (diff.faf.command = ${t0})`);else v2("git",["config","diff.faf.command",t0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${t0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!qz(t0))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 rw='[diff "faf"]',sw=` command = ${t0}`,bV=($)=>/\r(?!\n)/.test($),ow=($)=>(/\\+$/.exec(V2($))?.[0].length??0)%2===1;function aw($){if(bV($))return null;let Z=t6($),z=Z.map((V,H)=>H>0&&ow(Z[H-1])),Q=Z.map((V,H)=>!z[H]&&V2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,H)=>{if(Q[H])J=V2(V)===rw?H:-1;else if(J>=0&&!z[H]&&V2(V)===sw)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&&V2(V).trim()!==""))return null;return Z.filter((V,H)=>H!==W&&H!==Y).join("")}function jV($,Z){try{return v2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function tw($,Z,z){let Q=jV($,Z),X=jV($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
414
+ ${t0}`,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 ew($){let Z=Kz($,!0);if(Z.length!==1||Z[0]!==t0)return`diff.faf.command = ${t0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=uw($,v2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=fw(z);try{let X=i(Q,z,{allowGitConfig:!0}),J=U0(X);if(bV(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=aw(J);if(Y===null||!tw($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${t0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return o(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof v||X instanceof c2)return X.message;throw X}}function $x($){xV($);let Z;try{Z=Kz($)}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]!==t0)return console.error(`faf: diff.faf.command is ${kV(Z)}, not faf's driver (${t0}) — faf left your git config unchanged.`),!1;let z;try{z=ew($)}catch(Q){z=`${Q.message.split(`
415
+ `)[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 vV($,Z={},z=process.cwd()){if(Z.installDriver){if(!nw(z))process.exit(1);return}if(Z.uninstallDriver){if(!$x(z))process.exit(1);return}let Q=m(z);if(!Q)console.error(`Error: project.faf not found
415
416
 
416
- Run 'faf init' to create one.`),process.exit(2);let X;try{X=v2("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=x$(Q,z),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=s$("HEAD",J,z),G=p(Q);else if($.includes("...")){let[H,q]=$.split("...");P8(H,z),P8(q,z);let K;try{K=v2("git",["merge-base",H,q],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${H}' and '${q}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=K.slice(0,7),W=q,U=s$(K,J,z),G=s$(q,J,z)}else if($.includes("..")){let[H,q]=$.split("..");P8(H,z),P8(q,z),Y=H,W=q,U=s$(H,J,z),G=s$(q,J,z)}else P8($,z),Y=$,W="(working tree)",U=s$($,J,z),G=p(Q);let V=CZ(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...V},null,2));else console.log(CV(V,Y,W))}import{execFileSync as qz}from"child_process";function mw($){if(!$.trim())return 0;try{return N0($).score??0}catch{return 0}}var cw=($)=>$>0?`+${$}`:`${$}`;function pw($){let Z=$.map((z)=>({...z,score:mw(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 lw($,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?" ·":cw(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${A2(M6(Q.score))} ${Q.subject}`)}return z.join(`
417
- `)}function dw($,Z,z){try{return qz("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function EV($={},Z=process.cwd()){let z=m(Z);if(!z)console.error(`Error: project.faf not found
417
+ Run 'faf init' to create one.`),process.exit(2);let X;try{X=v2("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=x$(Q,z),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=s$("HEAD",J,z),G=p(Q);else if($.includes("...")){let[H,q]=$.split("...");F4(H,z),F4(q,z);let K;try{K=v2("git",["merge-base",H,q],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${H}' and '${q}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=K.slice(0,7),W=q,U=s$(K,J,z),G=s$(q,J,z)}else if($.includes("..")){let[H,q]=$.split("..");F4(H,z),F4(q,z),Y=H,W=q,U=s$(H,J,z),G=s$(q,J,z)}else F4($,z),Y=$,W="(working tree)",U=s$($,J,z),G=p(Q);let V=PZ(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...V},null,2));else console.log(EV(V,Y,W))}import{execFileSync as Bz}from"child_process";function Zx($){if(!$.trim())return 0;try{return N0($).score??0}catch{return 0}}var zx=($)=>$>0?`+${$}`:`${$}`;function Qx($){let Z=$.map((z)=>({...z,score:Zx(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 Xx($,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?" ·":zx(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${A2(B6(Q.score))} ${Q.subject}`)}return z.join(`
418
+ `)}function Jx($,Z,z){try{return Bz("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function gV($={},Z=process.cwd()){let z=m(Z);if(!z)console.error(`Error: project.faf not found
418
419
 
419
- Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=qz("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=x$(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=qz("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
420
- `).filter(Boolean).map((K)=>{let[M,B,N]=K.split("\x1F");return{hex:M,date:B,subject:N??""}}),U=J>0?Math.min(W.length,J+1):W.length,G=W.slice(0,U).map((K)=>({...K,raw:dw(K.hex,X,Z)})),V=pw(G),H=J>0?V.slice(0,J):V;if($.reverse)H=[...H].reverse();let q=W.length;if($.json)console.log(JSON.stringify({file:X,total:q,count:H.length,entries:H},null,2));else{let K=lw(H,X.split("/").pop()??"project.faf");if(J>0&&q>H.length)K+=`
420
+ Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=Bz("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=x$(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=Bz("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
421
+ `).filter(Boolean).map((K)=>{let[L,B,N]=K.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((K)=>({...K,raw:Jx(K.hex,X,Z)})),V=Qx(G),H=J>0?V.slice(0,J):V;if($.reverse)H=[...H].reverse();let q=W.length;if($.json)console.log(JSON.stringify({file:X,total:q,count:H.length,entries:H},null,2));else{let K=Xx(H,X.split("/").pop()??"project.faf");if(J>0&&q>H.length)K+=`
421
422
 
422
- … showing ${H.length} of ${q} commits — \`faf log --all\` for the full timeline.`;console.log(K)}}import{execFileSync as F8}from"child_process";import{existsSync as Bz,readFileSync as iw,realpathSync as wV,statSync as kV}from"fs";import{resolve as bV,dirname as Mz,relative as nw,isAbsolute as rw,sep as sw}from"path";var Lz="# >>> faf >>>",vV="# <<< faf <<<",Kz=`#!/bin/sh
423
- `,xV="faf-cli hooks-run",ow=($)=>$>0?`+${$}`:`${$}`;function gV($){return F8("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function yV($,Z){try{return F8("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function hV($,Z){try{return F8("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function Nz($){let Z=F8("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return bV($,Z)}function aw($,Z){let z=F8("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=wV.native(bV($,z)),X=wV.native(Z),J=nw(Q,X);return{out:J===".."||J.startsWith(`..${sw}`)||rw(J),real:X}}function fV($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===Lz)Z.push(Q);if(J===vV)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 tw($,Z){if(!Z)return 493;let z=kV($).mode&511;return z|(z&292)>>2}function uV($){try{let Z=i(Mz($),$,{allowGitHooks:!0});return{real:Z,text:I6(Z)}}catch(Z){if(Z instanceof v)return`${Z.message} faf left the hook as it is.`;throw Z}}function mV($,Z,z,Q){try{return o($,Z,{root:Mz($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof v||X instanceof c2)return X.message;throw X}}var cV="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 pV($={},Z=process.cwd()){try{let z;try{z=gV(Z)}catch{return}let Q=m(Z);if(!Q)return;let X=x$(Q,Z),J=yV(`:${X}`,Z);if(J===null)return;let Y=yV(`HEAD:${X}`,Z)??"",W=CZ(Y,J),U=`${W.scoreBase}% → ${W.scoreTarget}% (${ow(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 ew($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[Lz,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",vV,""].join(`
424
- `)}function $x($,Z={}){let z;try{z=gV($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=hV("core.hooksPath",$);if(Q){let M=Z.runnerCmd??xV;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(` ${M}${Z.strict?" --strict":""}`),!1}let X=Nz($),J=Z.runnerCmd??xV;if(!Vz(J)){let M=J.trim().split(/\s+/)[0];if(Z.strict)return console.error(`Error: \`${M}\` 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(`⚠ \`${M}\` on PATH doesn't support \`hooks-run\` yet (needs faf-cli ≥ 7.0) — the hook no-ops until you upgrade.`)}let Y=ew(J,!!Z.strict),W=Mz(X);if(!Bz(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=uV(X);if(typeof U==="string")return console.error(`Error: ${U}`),!1;let{real:G,text:V}=U,H=V===null?null:fV(V);if(H==="broken")return console.error(`Error: ${X} ${cV}`),!1;let q;if(V===null)q=`${Kz}${Y}`;else if(H)q=V.slice(0,H.start)+Y+V.slice(H.end);else{let M=aw($,W);if(M.out)return console.error(`Error: ${X} is in a hooks folder outside this repo (${M.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()==="")q=`${Kz}${Y}${V}`;else q=V.endsWith(`
423
+ … showing ${H.length} of ${q} commits — \`faf log --all\` for the full timeline.`;console.log(K)}}import{execFileSync as S4}from"child_process";import{existsSync as Lz,readFileSync as Yx,realpathSync as hV,statSync as mV}from"fs";import{resolve as cV,dirname as Nz,relative as Wx,isAbsolute as Ux,sep as Gx}from"path";var Dz="# >>> faf >>>",pV="# <<< faf <<<",Mz=`#!/bin/sh
424
+ `,fV="faf-cli hooks-run",Vx=($)=>$>0?`+${$}`:`${$}`;function lV($){return S4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function uV($,Z){try{return S4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function dV($,Z){try{return S4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function Oz($){let Z=S4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return cV($,Z)}function Hx($,Z){let z=S4("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=hV.native(cV($,z)),X=hV.native(Z),J=Wx(Q,X);return{out:J===".."||J.startsWith(`..${Gx}`)||Ux(J),real:X}}function iV($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===Dz)Z.push(Q);if(J===pV)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 qx($,Z){if(!Z)return 493;let z=mV($).mode&511;return z|(z&292)>>2}function nV($){try{let Z=i(Nz($),$,{allowGitHooks:!0});return{real:Z,text:I6(Z)}}catch(Z){if(Z instanceof v)return`${Z.message} faf left the hook as it is.`;throw Z}}function rV($,Z,z,Q){try{return o($,Z,{root:Nz($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof v||X instanceof c2)return X.message;throw X}}var sV="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 oV($={},Z=process.cwd()){try{let z;try{z=lV(Z)}catch{return}let Q=m(Z);if(!Q)return;let X=x$(Q,Z),J=uV(`:${X}`,Z);if(J===null)return;let Y=uV(`HEAD:${X}`,Z)??"",W=PZ(Y,J),U=`${W.scoreBase}% → ${W.scoreTarget}% (${Vx(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 Kx($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[Dz,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",pV,""].join(`
425
+ `)}function Bx($,Z={}){let z;try{z=lV($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=dV("core.hooksPath",$);if(Q){let L=Z.runnerCmd??fV;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=Oz($),J=Z.runnerCmd??fV;if(!qz(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=Kx(J,!!Z.strict),W=Nz(X);if(!Lz(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=nV(X);if(typeof U==="string")return console.error(`Error: ${U}`),!1;let{real:G,text:V}=U,H=V===null?null:iV(V);if(H==="broken")return console.error(`Error: ${X} ${sV}`),!1;let q;if(V===null)q=`${Mz}${Y}`;else if(H)q=V.slice(0,H.start)+Y+V.slice(H.end);else{let L=Hx($,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()==="")q=`${Mz}${Y}${V}`;else q=V.endsWith(`
425
426
  `)?`${V}
426
427
  ${Y}`:`${V}
427
428
 
428
- ${Y}`}let K=mV(X,q,V,tw(G,V!==null));if(K)return console.error(`Error: ${K}`),!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 Zx($,Z){if($===Kz&&Z.trim()==="")return"";return $.endsWith(`
429
+ ${Y}`}let K=rV(X,q,V,qx(G,V!==null));if(K)return console.error(`Error: ${K}`),!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 Mx($,Z){if($===Mz&&Z.trim()==="")return"";return $.endsWith(`
429
430
 
430
- `)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function zx($){let Z;try{Z=Nz($)}catch{return console.error("Error: not a git repository."),!1}if(!Bz(Z))return console.log("• no pre-commit hook to clean."),!0;let z=uV(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:fV(X);if(J==="broken")return console.error(`Error: ${Z} ${cV}`),!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=mV(Z,Zx(X.slice(0,J.start),Y)+Y,X,kV(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 Qx($){let Z;try{Z=Nz($)}catch{console.error("Error: not a git repository.");return}let z=hV("core.hooksPath",$),Q=Bz(Z)?iw(Z,"utf-8"):"",X=Q.includes(Lz),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 lV($={}){let Z=process.cwd();if($.install){if(!$x(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!zx(Z))process.exit(2);return}Qx(Z)}l();function dV($={}){if($.version||Object.keys($).length===0)Jx()}function Jx(){let $=Dz();console.log(`${A(C("faf"))} v${$.version}`),console.log(L(`kernel ${PW()} IANA application/vnd.faf+yaml`))}var S8=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"systems"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"},{name:"FAFm",extensions:[".fafm"],category:"faf"}];l();function iV(){console.log(`${A("formats")} ${L("— supported file types")}
431
- `);let $=new Map;for(let Z of S8){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} ${L(Q.extensions.join(", "))}`);console.log()}console.log(L(` ${S8.length} formats across ${$.size} categories`))}l();function nV(){let $=0;try{$=mY("faf-git-")}catch{}if($>0)console.log(`${A("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(L("nothing to clear"))}function rV($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
431
+ `)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function Lx($){let Z;try{Z=Oz($)}catch{return console.error("Error: not a git repository."),!1}if(!Lz(Z))return console.log("• no pre-commit hook to clean."),!0;let z=nV(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:iV(X);if(J==="broken")return console.error(`Error: ${Z} ${sV}`),!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=rV(Z,Mx(X.slice(0,J.start),Y)+Y,X,mV(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 Nx($){let Z;try{Z=Oz($)}catch{console.error("Error: not a git repository.");return}let z=dV("core.hooksPath",$),Q=Lz(Z)?Yx(Z,"utf-8"):"",X=Q.includes(Dz),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 aV($={}){let Z=process.cwd();if($.install){if(!Bx(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!Lx(Z))process.exit(2);return}Nx(Z)}l();function tV($={}){Ox()}function Ox(){let $=Iz();console.log(`${A(C("faf"))} v${$.version}`),console.log(M(`kernel ${jW()} IANA application/vnd.faf+yaml`))}var j4=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"systems"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"},{name:"FAFm",extensions:[".fafm"],category:"faf"}];l();function eV(){console.log(`${A("formats")} ${M("— supported file types")}
432
+ `);let $=new Map;for(let Z of j4){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(` ${j4.length} formats across ${$.size} categories`))}l();function $H(){let $=0;try{$=lY("faf-git-")}catch{}if($>0)console.log(`${A("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function ZH($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
432
433
 
433
- Run 'faf init' to create one.`),process.exit(2);if($.json){let z=e(Z);console.log(JSON.stringify(z,null,2))}else{let z=p(Z);console.log(z)}}l();function sV(){let $=m();if(!$)console.error(`Error: project.faf not found
434
+ Run 'faf init' to create one.`),process.exit(2);if($.json){let z=e(Z);console.log(JSON.stringify(z,null,2))}else{let z=p(Z);console.log(z)}}l();function zH(){let $=m();if(!$)console.error(`Error: project.faf not found
434
435
 
435
- Run 'faf init' to create one.`),process.exit(2);let Z=e($),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(L("no populated slots"));return}console.log(z.join(`
436
- `))}import{existsSync as Yx,statSync as oV}from"fs";import{dirname as Wx,join as Ux}from"path";var Gx=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],Vx=1000;function aV($,Z=Wx($)){let z=oV($).mtimeMs,Q=Gx.map((X)=>{let J=Ux(Z,X);if(!Yx(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=oV(J).mtimeMs,W=Y-z,U;if(Math.abs(W)<Vx)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}}l();function eV($={}){let Z=m();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
436
+ Run 'faf init' to create one.`),process.exit(2);let Z=e($),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(`
437
+ `))}import{existsSync as Ix,statSync as QH}from"fs";import{dirname as Tx,join as Ax}from"path";var Cx=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],_x=1000;function XH($,Z=Tx($)){let z=QH($).mtimeMs,Q=Cx.map((X)=>{let J=Ax(Z,X);if(!Ix(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=QH(J).mtimeMs,W=Y-z,U;if(Math.abs(W)<_x)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}}l();function YH($={}){let Z=m();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
437
438
 
438
- Run 'faf init' to create one.`);process.exit(2)}let z=aV(Z,process.cwd());if($.json){let Q=e(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}Hx(z)}function Hx($){console.log(`${A("drift")} ${L("— context file sync status")}
439
- `),console.log(` ${C(".faf")} ${L(tV($.source_mtime_ms))}`);for(let Z of $.targets){if(Z.status==="missing"||Z.mtime_ms===null){console.log(` ${L("○")} ${Z.file} ${L("missing")}`);continue}let z=L(tV(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${A("●")} ${Z.file} ${L("in sync")}`);else if(Z.status==="newer")console.log(` ${C("!")} ${Z.file} ${C("newer")} ${z}`);else console.log(` ${L("○")} ${Z.file} ${L("older")} ${z}`)}if($.drifted>0)console.log(L(`
440
- run ${C("'faf sync'")} to resolve drift`))}function tV($){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`}import{dirname as qx}from"path";function Oz($,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 j8($,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(!Z0(J))return{at:z.slice(0,X+1).join("."),value:J};Q=J}return null}function E8($,Z){return`cannot set ${$}: ${Z.at} is ${c6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function _Z($,Z,z){let Q=j8($,Z);if(Q)throw Error(E8(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}l();function $H($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
439
+ Run 'faf init' to create one.`);process.exit(2)}let z=XH(Z,process.cwd());if($.json){let Q=e(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}Rx(z)}function Rx($){console.log(`${A("drift")} ${M("— context file sync status")}
440
+ `),console.log(` ${C(".faf")} ${M(JH($.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(JH(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${A("●")} ${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(`
441
+ run ${C("'faf sync'")} to resolve drift`))}function JH($){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`}import{dirname as Px}from"path";function Tz($,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 E4($,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(!Z0(J))return{at:z.slice(0,X+1).join("."),value:J};Q=J}return null}function w4($,Z){return`cannot set ${$}: ${Z.at} is ${c6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function FZ($,Z,z){let Q=E4($,Z);if(Q)throw Error(w4(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}l();function WH($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
441
442
 
442
443
  Example: faf edit project.name "My Project"`),process.exit(1);let z=m();if(!z)console.error(`Error: project.faf not found
443
444
 
444
- Run 'faf init' to create one.`),process.exit(2);let Q=e(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=j8(Q,$);if(J)console.error(`Error: ${E8($,J)}`),process.exit(1);_Z(Q,$,Z);let Y=[];if(k0(z,Q,{onAliasKept:(W)=>Y.push(y2(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(`${A("updated")} ${$} ${L("→")} ${Z}`),Kx(z,$)}function Kx($,Z){let z=new s0(qx($));if(!z.exists())return;let Q;try{Q=b0(P0(p($))).score}catch{return}z.recordGrowth(Q,[`faf edit ${Z}`]),O6(z)}l();var w8=k$;function ZH($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
445
+ Run 'faf init' to create one.`),process.exit(2);let Q=e(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=E4(Q,$);if(J)console.error(`Error: ${w4($,J)}`),process.exit(1);FZ(Q,$,Z);let Y=[];if(y0(z,Q,{onAliasKept:(W)=>Y.push(y2(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(`${A("updated")} ${$} ${M("→")} ${Z}`),Fx(z,$)}function Fx($,Z){let z=new s0(Px($));if(!z.exists())return;let Q;try{Q=k0(P0(p($))).score}catch{return}z.recordGrowth(Q,[`faf edit ${Z}`]),O6(z)}l();var x4=k$;function UH($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
445
446
 
446
- Run 'faf init' to create one.`),process.exit(2);let z=e(Z),Q=z.faf_version??"unknown";if(Q===w8){console.log(`${A("◆")} migrate already at v${w8}`);return}if(z.faf_version=w8,!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(`${A("◆")} migrate ${L("(dry run)")} v${Q} → v${w8}`),console.log(L(` would update ${Z}`));return}k0(Z,z,{onAliasKept:(X)=>console.log(L(` ${y2(X)}`))}),console.log(`${A("◆")} migrate v${Q} → v${w8}`),console.log(L(` updated ${Z}`))}l();function zH($){if($==="features")Mx();else if($==="activate")Lx();else Bx()}function Bx(){let $=N8();if(console.log(`${A("pro")} ${L("— FAF Pro status")}
447
- `),console.log(` Status: ${$?R0(C("PRO")):C("Free")}`),console.log(""),!$)console.log(L(" Upgrade: faf pro activate"))}function Mx(){console.log(`${A("pro")} ${L("— Pro features")}
448
- `);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(` ${A("◆")} ${C(Z)} ${L("—")} ${z}`);console.log("")}function Lx(){console.log(`${A("pro")} ${L("— activate")}
449
- `),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(L(" export FAF_PRO=1")),console.log(""),console.log(L(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as Nx}from"zlib";l();function QH($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
447
+ Run 'faf init' to create one.`),process.exit(2);let z=e(Z),Q=z.faf_version??"unknown";if(Q===x4){console.log(`${A("◆")} migrate already at v${x4}`);return}if(z.faf_version=x4,!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(`${A("◆")} migrate ${M("(dry run)")} v${Q} → v${x4}`),console.log(M(` would update ${Z}`));return}y0(Z,z,{onAliasKept:(X)=>console.log(M(` ${y2(X)}`))}),console.log(`${A("◆")} migrate v${Q} → v${x4}`),console.log(M(` updated ${Z}`))}l();function GH($){if($==="features")jx();else if($==="activate")Ex();else Sx()}function Sx(){let $=D4();if(console.log(`${A("pro")} ${M("— FAF Pro status")}
448
+ `),console.log(` Status: ${$?R0(C("PRO")):C("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function jx(){console.log(`${A("pro")} ${M("— Pro features")}
449
+ `);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(` ${A("◆")} ${C(Z)} ${M("—")} ${z}`);console.log("")}function Ex(){console.log(`${A("pro")} ${M("— activate")}
450
+ `),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 wx}from"zlib";l();function VH($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
450
451
 
451
- Run 'faf init' to create one.`),process.exit(2);let z=p(Z),X=Nx(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${A("◆")} share ${L(Z)}
452
- `),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(L(`
453
- copied to clipboard`))}catch{console.log(L(`
454
- copy failed — install xclip or pbcopy`))}}import{join as Dx}from"path";l();function XH(){let $=_5("faf-demo-");console.log(`${A("demo")} ${L("— FAF in action")}
452
+ Run 'faf init' to create one.`),process.exit(2);let z=p(Z),X=wx(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${A("◆")} share ${M(Z)}
453
+ `),console.log(` ${J}`),$.copy)try{let{execSync:Y}=c0("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(`
454
+ copied to clipboard`))}catch{console.log(M(`
455
+ copy failed — install xclip or pbcopy`))}}import{join as xx}from"path";l();function HH(){let $=P5("faf-demo-");console.log(`${A("demo")} ${M("— FAF in action")}
455
456
  `);let Z=`faf_version: 2.5.0
456
457
  project:
457
458
  name: acme-app
@@ -490,20 +491,20 @@ human_context:
490
491
  where: Cloud (Vercel + AWS)
491
492
  when: "2026"
492
493
  how: Agile sprints with CI/CD
493
- `,z=Dx($,"project.faf");o(z,Z,{root:$,expect:null}),console.log(` ${C("1.")} Created sample project.faf`),console.log(L(` ${z}
494
- `)),console.log(` ${C("2.")} Scoring...`);let Q=a(z,()=>b0(P0(p(z))));console.log(""),E0(Q,"project.faf",!0),R5($),console.log(`
495
- ${L(' Demo complete. Run "faf init" in your project to get started.')}`)}l();function JH($,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(`${A("slots")} ${L(`— ${J.length} match${J.length===1?"":"es"}`)}
496
- `);for(let Y of J)console.log(` ${C(`#${Y.index}`)} ${Y.path} ${L("—")} ${Y.description} ${L(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(Q||Z.formats){let J=S8.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(`${A("formats")} ${L(`— ${J.length} match${J.length===1?"":"es"}`)}
497
- `);for(let Y of J)console.log(` ${C(Y.name)} ${L(Y.extensions.join(", "))} ${L(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(L(` No results for "${$}"`))}import{spawnSync as xx}from"child_process";import{existsSync as yx,readdirSync as Cz,readFileSync as qH}from"fs";import{dirname as kx,join as k8,resolve as bx}from"path";l();import{spawnSync as YH}from"child_process";import{readFileSync as Ox,statSync as Ix}from"fs";import{join as Tx}from"path";l();var RZ=($)=>typeof $==="number"&&Number.isFinite($)?$:null,PZ=($)=>typeof $==="string"&&$!==""?$:null;function Ax($){if(typeof $!=="object"||$===null)return null;let Z=$,z=Z.timestamp instanceof Date?Z.timestamp.toISOString():PZ(Z.timestamp);if(!z)return null;let Q=typeof Z.tests==="object"&&Z.tests!==null?Z.tests:{};return{timestamp:z,result:PZ(Z.result)??"UNKNOWN",passed:RZ(Q.passed),failed:RZ(Q.failed),skipped:RZ(Q.skipped),total:RZ(Q.total),trigger:PZ(Z.trigger)}}var Cx=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,WH=($)=>Date.parse(Cx.test($)?`${$.replace(" ","T")}Z`:$);function _x($){let Z=f0($),Q=(Array.isArray(Z?.test_history)?Z.test_history:[]).map(Ax).filter((J)=>J!==null),X=(J)=>WH(J.timestamp);return Q.sort((J,Y)=>(Number.isNaN(X(Y))?-1/0:X(Y))-(Number.isNaN(X(J))?-1/0:X(J))||Y.timestamp.localeCompare(J.timestamp)),{project:PZ(Z?.project),receipts:Q}}function Rx($,Z){let z=Z?[Z]:["origin/taf-receipts","taf-receipts"];for(let X of z){let J=YH("git",["show","--end-of-options",`${X}:.taf`],{cwd:$,encoding:"utf-8",maxBuffer:67108864,env:{...process.env,GIT_NO_LAZY_FETCH:"1"}});if(J.status===0&&typeof J.stdout==="string")return{text:J.stdout,source:X}}let Q=Tx($,".taf");if(!Z&&Ix(Q,{throwIfNoEntry:!1})?.isFile())return{text:Ox(Q,"utf-8"),source:".taf"};return null}function Px($,Z){for(let z of Z?[Z]:["origin/taf-receipts","taf-receipts"]){let Q=YH("git",["ls-tree","--name-only","--end-of-options",z,"--",".taf"],{cwd:$,encoding:"utf-8",env:{...process.env,GIT_NO_LAZY_FETCH:"1"}});if(Q.status===0&&Q.stdout.trim()===".taf")return z}return null}var Fx=($)=>{let Z=WH($);if(/^\d{4}-\d{2}-\d{2}$/.test($)||Number.isNaN(Z))return $;return new Date(Z).toISOString().replace("T"," ").slice(0,16)},Sx=($)=>{if($.passed===null||$.total===null)return"—";let Z=[$.failed?`${$.failed} failed`:"",$.skipped?`${$.skipped} skipped`:""].filter(Boolean).join(", ");return`${$.passed}/${$.total}${Z?` ${Z}`:""}`};function jx($){let Z=$===void 0?10:Number($);if(!Number.isInteger(Z)||Z<1)console.error(`${C("×")} --limit takes a whole number, 1 or more.`),process.exit(1);return Z}function Ex($,Z){if(Z?.startsWith("-"))console.error(`${C("×")} --ref takes a git ref, not an option: ${Z}`),process.exit(1);let z=Rx($,Z);if(!z){let Q=Px($,Z);if(Q)console.error(`${C("×")} ${Q} is here, its .taf is not (a partial clone). Get it once: git show ${Q}:.taf > /dev/null`),process.exit(1);let X=Z?`${Z}:.taf`:"origin/taf-receipts, taf-receipts or ./.taf";console.error(`${C("×")} No receipts found (looked in ${X}). Fetch them: git fetch origin taf-receipts`),process.exit(1)}try{return{source:z.source,..._x(z.text)}}catch(Q){console.error(`${C("×")} ${z.source}: the .taf is not YAML faf can read (${Q.message.split(`
498
- `)[0]})`),process.exit(1)}}function wx($,Z,z,Q){let X=Z?` — ${Z}`:"";if(console.log(`${A("TAF receipts")}${X} ${L(`· ${z} on ${$} · times in UTC`)}`),Q.length===0){console.log(L(" no receipts yet"));return}for(let Y of Q)console.log(` ${Fx(Y.timestamp)} ${Y.result.padEnd(8)} ${Sx(Y)}`);let J=new Map;for(let Y of Q)J.set(Y.result,(J.get(Y.result)??0)+1);if(console.log(L(` last ${Q.length}: ${[...J].map(([Y,W])=>`${W} ${Y}`).join(" · ")}`)),$.startsWith("origin/"))console.log(L(" as of your last fetch (git fetch origin taf-receipts)"))}function UH($={}){let Z=jx($.limit),{source:z,project:Q,receipts:X}=Ex(process.cwd(),$.ref),J=X.slice(0,Z);if($.json){console.log(JSON.stringify({source:z,project:Q,total:X.length,receipts:J},null,2));return}wx(z,Q,X.length,J)}function vx($){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 gx="Wolfe-Jam/faf-taf-git@v2.4.6";function KH($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;let z=$??"";if($===""||!Object.hasOwn(GH,z))console.error(`${C("×")} Unknown: faf taf ${z}. Use ${C("faf taf setup")} or ${C("faf taf receipts")}.`),process.exit(1);fx(z,Z),GH[z](Z)}var hx={setup:["write"],receipts:["limit","json","ref"],"":["output","force"]},GH={setup:($)=>Dy($),receipts:($)=>UH($),"":($)=>Oy($)};function fx($,Z){let z=Object.keys(Z).filter((X)=>Z[X]!==void 0&&!hx[$].includes(X));if(z.length===0)return;let Q=z.map((X)=>`--${X}`).join(", ");console.error(L(`note: ${Q} ${z.length===1?"does":"do"} nothing with faf taf${$?` ${$}`:""} (ignored)`))}function ux($){if(I($,"bun.lockb")||I($,"bun.lock"))return"bun";if(I($,"pnpm-lock.yaml"))return"pnpm";if(I($,"yarn.lock"))return"yarn";return"npm"}function mx($){try{let Z=JSON.parse(qH(k8($,"package.json"),"utf-8"));return Z&&typeof Z==="object"&&!Array.isArray(Z)?Z:{}}catch{return{}}}var Iz=($,Z)=>new RegExp(`(^|[\\s;&|(])${Z}(?![\\w-])`).test($),cx=/^\s*(?:npm run|pnpm(?: run)?|yarn(?: run)?|bun run)\s+([\w:.-]+)\s*$/;function BH($){let Z=$.test;for(let z=0;z<3&&typeof Z==="string";z++){let Q=cx.exec(Z)?.[1];if(!Q)break;if(Z=$[Q],typeof Z!=="string")return null}return typeof Z==="string"?Z:void 0}function VH($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=BH(z);if(Q===null){let X={...$.devDependencies,...$.dependencies};return"jest"in X||"vitest"in X}if(Q===void 0)return!1;return Iz(Q,"jest")||Iz(Q,"vitest")||Z==="bun"&&Iz(Q,"bun test")}function px($){let Z=$.packageManager,z=$.devEngines?.packageManager;return typeof Z==="string"&&Z.startsWith("pnpm@")||z?.name==="pnpm"&&typeof z.version==="string"&&z.version!==""?" - uses: pnpm/action-setup@v6":` - uses: pnpm/action-setup@v6
494
+ `,z=xx($,"project.faf");o(z,Z,{root:$,expect:null}),console.log(` ${C("1.")} Created sample project.faf`),console.log(M(` ${z}
495
+ `)),console.log(` ${C("2.")} Scoring...`);let Q=a(z,()=>k0(P0(p(z))));console.log(""),E0(Q,"project.faf",!0),F5($),console.log(`
496
+ ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}l();function qH($,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(`${A("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
497
+ `);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=j4.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(`${A("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
498
+ `);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{spawnSync as nx}from"child_process";import{existsSync as rx,readdirSync as Pz,readFileSync as OH}from"fs";import{dirname as sx,join as v4,resolve as ox}from"path";l();import{spawnSync as KH}from"child_process";import{readFileSync as yx,statSync as kx}from"fs";import{join as bx}from"path";l();var SZ=($)=>typeof $==="number"&&Number.isFinite($)?$:null,y4=($)=>typeof $==="string"&&$!==""?$:null,Az=($)=>Array.isArray($)?$.filter((Z)=>typeof Z==="string"):[];function vx($){if(typeof $!=="object"||$===null)return;let Z=$;return{names:Az(Z.names),truncated:Z.truncated===!0,hash:y4(Z.hash),newly_skipped:Az(Z.newly_skipped),no_longer_skipped:Az(Z.no_longer_skipped)}}function gx($){if(typeof $!=="object"||$===null)return null;let Z=$,z=Z.timestamp instanceof Date?Z.timestamp.toISOString():y4(Z.timestamp);if(!z)return null;let Q=typeof Z.tests==="object"&&Z.tests!==null?Z.tests:{};return{timestamp:z,result:y4(Z.result)??"UNKNOWN",passed:SZ(Q.passed),failed:SZ(Q.failed),skipped:SZ(Q.skipped),total:SZ(Q.total),trigger:y4(Z.trigger),skipped_tests:vx(Z.skipped_tests)}}var hx=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,BH=($)=>Date.parse(hx.test($)?`${$.replace(" ","T")}Z`:$);function fx($){let Z=h0($),Q=(Array.isArray(Z?.test_history)?Z.test_history:[]).map(gx).filter((J)=>J!==null),X=(J)=>BH(J.timestamp);return Q.sort((J,Y)=>(Number.isNaN(X(Y))?-1/0:X(Y))-(Number.isNaN(X(J))?-1/0:X(J))||Y.timestamp.localeCompare(J.timestamp)),{project:y4(Z?.project),receipts:Q}}function ux($,Z){let z=Z?[Z]:["origin/taf-receipts","taf-receipts"];for(let X of z){let J=KH("git",["show","--end-of-options",`${X}:.taf`],{cwd:$,encoding:"utf-8",maxBuffer:67108864,env:{...process.env,GIT_NO_LAZY_FETCH:"1"}});if(J.status===0&&typeof J.stdout==="string")return{text:J.stdout,source:X}}let Q=bx($,".taf");if(!Z&&kx(Q,{throwIfNoEntry:!1})?.isFile())return{text:yx(Q,"utf-8"),source:".taf"};return null}function mx($,Z){for(let z of Z?[Z]:["origin/taf-receipts","taf-receipts"]){let Q=KH("git",["ls-tree","--name-only","--end-of-options",z,"--",".taf"],{cwd:$,encoding:"utf-8",env:{...process.env,GIT_NO_LAZY_FETCH:"1"}});if(Q.status===0&&Q.stdout.trim()===".taf")return z}return null}var cx=($)=>{let Z=BH($);if(/^\d{4}-\d{2}-\d{2}$/.test($)||Number.isNaN(Z))return $;return new Date(Z).toISOString().replace("T"," ").slice(0,16)},px=($)=>{if($.passed===null||$.total===null)return"—";let Z=$.skipped_tests?.newly_skipped.length??0,z=[$.failed?`${$.failed} failed`:"",$.skipped?`${$.skipped} skipped`:"",Z?`+${Z} newly skipped`:""].filter(Boolean).join(", ");return`${$.passed}/${$.total}${z?` ${z}`:""}`};function lx($){let Z=$===void 0?10:Number($);if(!Number.isInteger(Z)||Z<1)console.error(`${C("×")} --limit takes a whole number, 1 or more.`),process.exit(1);return Z}function dx($,Z){if(Z?.startsWith("-"))console.error(`${C("×")} --ref takes a git ref, not an option: ${Z}`),process.exit(1);let z=ux($,Z);if(!z){let Q=mx($,Z);if(Q)console.error(`${C("×")} ${Q} is here, its .taf is not (a partial clone). Get it once: git show ${Q}:.taf > /dev/null`),process.exit(1);let X=Z?`${Z}:.taf`:"origin/taf-receipts, taf-receipts or ./.taf";console.error(`${C("×")} No receipts found (looked in ${X}). Fetch them: git fetch origin taf-receipts`),process.exit(1)}try{return{source:z.source,...fx(z.text)}}catch(Q){console.error(`${C("×")} ${z.source}: the .taf is not YAML faf can read (${Q.message.split(`
499
+ `)[0]})`),process.exit(1)}}function ix($,Z,z,Q){let X=Z?` — ${Z}`:"";if(console.log(`${A("TAF receipts")}${X} ${M(`· ${z} on ${$} · times in UTC`)}`),Q.length===0){console.log(M(" no receipts yet"));return}for(let Y of Q)console.log(` ${cx(Y.timestamp)} ${Y.result.padEnd(8)} ${px(Y)}`);let J=new Map;for(let Y of Q)J.set(Y.result,(J.get(Y.result)??0)+1);if(console.log(M(` last ${Q.length}: ${[...J].map(([Y,W])=>`${W} ${Y}`).join(" · ")}`)),$.startsWith("origin/"))console.log(M(" as of your last fetch (git fetch origin taf-receipts)"))}function MH($={}){let Z=lx($.limit),{source:z,project:Q,receipts:X}=dx(process.cwd(),$.ref),J=X.slice(0,Z);if($.json){console.log(JSON.stringify({source:z,project:Q,total:X.length,receipts:J},null,2));return}ix(z,Q,X.length,J)}function ax($){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 tx="Wolfe-Jam/faf-taf-git@v2.5.0";function IH($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;let z=$??"";if($===""||!Object.hasOwn(LH,z))console.error(`${C("×")} Unknown: faf taf ${z}. Use ${C("faf taf setup")} or ${C("faf taf receipts")}.`),process.exit(1);$y(z,Z),LH[z](Z)}var ex={setup:["write"],receipts:["limit","json","ref"],"":["output","force"]},LH={setup:($)=>yy($),receipts:($)=>MH($),"":($)=>ky($)};function $y($,Z){let z=Object.keys(Z).filter((X)=>Z[X]!==void 0&&!ex[$].includes(X));if(z.length===0)return;let Q=z.map((X)=>`--${X}`).join(", ");console.error(M(`note: ${Q} ${z.length===1?"does":"do"} nothing with faf taf${$?` ${$}`:""} (ignored)`))}function Zy($){if(I($,"bun.lockb")||I($,"bun.lock"))return"bun";if(I($,"pnpm-lock.yaml"))return"pnpm";if(I($,"yarn.lock"))return"yarn";return"npm"}function zy($){try{let Z=JSON.parse(OH(v4($,"package.json"),"utf-8"));return Z&&typeof Z==="object"&&!Array.isArray(Z)?Z:{}}catch{return{}}}var Cz=($,Z)=>new RegExp(`(^|[\\s;&|(])${Z}(?![\\w-])`).test($),Qy=/^\s*(?:npm run|pnpm(?: run)?|yarn(?: run)?|bun run)\s+([\w:.-]+)\s*$/;function TH($){let Z=$.test;for(let z=0;z<3&&typeof Z==="string";z++){let Q=Qy.exec(Z)?.[1];if(!Q)break;if(Z=$[Q],typeof Z!=="string")return null}return typeof Z==="string"?Z:void 0}function NH($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=TH(z);if(Q===null){let X={...$.devDependencies,...$.dependencies};return"jest"in X||"vitest"in X}if(Q===void 0)return!1;return Cz(Q,"jest")||Cz(Q,"vitest")||Z==="bun"&&Cz(Q,"bun test")}function Xy($){let Z=$.packageManager,z=$.devEngines?.packageManager;return typeof Z==="string"&&Z.startsWith("pnpm@")||z?.name==="pnpm"&&typeof z.version==="string"&&z.version!==""?" - uses: pnpm/action-setup@v6":` - uses: pnpm/action-setup@v6
499
500
  with:
500
- version: 10`}var MH={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: actions/setup-node@v7
501
+ version: 10`}var AH={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: actions/setup-node@v7
501
502
  with:
502
503
  node-version: '24.x'`,install:"pnpm install --frozen-lockfile",test:"pnpm test"},yarn:{setup:` - uses: actions/setup-node@v7
503
504
  with:
504
505
  node-version: '24.x'`,install:"yarn install --frozen-lockfile",test:"yarn test"},npm:{setup:` - uses: actions/setup-node@v7
505
506
  with:
506
- node-version: '24.x'`,install:"npm ci",test:"npm test"}},lx=["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"],LH=/\.(?:sln|slnx|csproj|fsproj)$/i;function dx($){let Z;try{Z=Cz($)}catch{return!1}return Z.some((z)=>LH.test(z)&&I($,z))}function ix($){if(I($,"go.mod"))return"go";if(I($,"Cargo.toml"))return"rust";if(I($,"pom.xml"))return"maven";if(lx.some((Z)=>I($,Z)))return"gradle";if(dx($))return"dotnet";if(["pyproject.toml","setup.py","setup.cfg","requirements.txt","pytest.ini"].some((Z)=>I($,Z)))return"python";return null}var nx=["test","tests","dev"],Tz=String.raw`["']?([\w.-]+)["']?`;function FZ($,Z){let z=Z.split(".").map((Y)=>Y.replace(/-/g,"\\-")).join(String.raw`\s*\.\s*`),Q=new RegExp(String.raw`^\[\s*${z}\s*\][ \t]*(?:#[^\r\n]*)?\r?$`,"m").exec($);if(!Q)return null;let X=$.slice(Q.index+Q[0].length),J=X.search(/^[ \t]*\[/m);return J===-1?X:X.slice(0,J)}var Az=($)=>{let Z=new Set($);return nx.find((z)=>Z.has(z))??null},NH=($)=>[...$.matchAll(new RegExp(String.raw`^\s*${Tz}\s*=`,"gm"))].map((Z)=>Z[1]);function rx($){let Z=FZ($,"project.optional-dependencies");if(Z!==null)return Az(NH(Z));let z=FZ($,"project")??"",X=[...(/^\s*optional-dependencies\s*=\s*\{([^}\r\n]*)\}/m.exec(z)?.[1]??"").matchAll(new RegExp(String.raw`(?:^|,)\s*${Tz}\s*=`,"g"))].map((Y)=>Y[1]),J=[...z.matchAll(new RegExp(String.raw`^\s*optional-dependencies\s*\.\s*${Tz}\s*=`,"gm"))].map((Y)=>Y[1]);return Az([...X,...J])}function sx($){if(!I($,"pyproject.toml"))return{extra:null,group:null};let Z;try{Z=qH(k8($,"pyproject.toml"),"utf-8")}catch{return{extra:null,group:null}}let z=FZ(Z,"dependency-groups");return{extra:rx(Z),group:z===null?null:Az(NH(z))}}function ox($){let{extra:Z,group:z}=sx($),Q=["poetry.lock","uv.lock","pdm.lock"].find((Y)=>I($,Y)),X=Q?` # ${Q} found: install your dev dependencies with that tool here, before pytest.
507
+ node-version: '24.x'`,install:"npm ci",test:"npm test"}},Jy=["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"],CH=/\.(?:sln|slnx|csproj|fsproj)$/i;function Yy($){let Z;try{Z=Pz($)}catch{return!1}return Z.some((z)=>CH.test(z)&&I($,z))}function Wy($){if(I($,"go.mod"))return"go";if(I($,"Cargo.toml"))return"rust";if(I($,"pom.xml"))return"maven";if(Jy.some((Z)=>I($,Z)))return"gradle";if(Yy($))return"dotnet";if(["pyproject.toml","setup.py","setup.cfg","requirements.txt","pytest.ini"].some((Z)=>I($,Z)))return"python";return null}var Uy=["test","tests","dev"],_z=String.raw`["']?([\w.-]+)["']?`;function jZ($,Z){let z=Z.split(".").map((Y)=>Y.replace(/-/g,"\\-")).join(String.raw`\s*\.\s*`),Q=new RegExp(String.raw`^\[\s*${z}\s*\][ \t]*(?:#[^\r\n]*)?\r?$`,"m").exec($);if(!Q)return null;let X=$.slice(Q.index+Q[0].length),J=X.search(/^[ \t]*\[/m);return J===-1?X:X.slice(0,J)}var Rz=($)=>{let Z=new Set($);return Uy.find((z)=>Z.has(z))??null},_H=($)=>[...$.matchAll(new RegExp(String.raw`^\s*${_z}\s*=`,"gm"))].map((Z)=>Z[1]);function Gy($){let Z=jZ($,"project.optional-dependencies");if(Z!==null)return Rz(_H(Z));let z=jZ($,"project")??"",X=[...(/^\s*optional-dependencies\s*=\s*\{([^}\r\n]*)\}/m.exec(z)?.[1]??"").matchAll(new RegExp(String.raw`(?:^|,)\s*${_z}\s*=`,"g"))].map((Y)=>Y[1]),J=[...z.matchAll(new RegExp(String.raw`^\s*optional-dependencies\s*\.\s*${_z}\s*=`,"gm"))].map((Y)=>Y[1]);return Rz([...X,...J])}function Vy($){if(!I($,"pyproject.toml"))return{extra:null,group:null};let Z;try{Z=OH(v4($,"pyproject.toml"),"utf-8")}catch{return{extra:null,group:null}}let z=jZ(Z,"dependency-groups");return{extra:Gy(Z),group:z===null?null:Rz(_H(z))}}function Hy($){let{extra:Z,group:z}=Vy($),Q=["poetry.lock","uv.lock","pdm.lock"].find((Y)=>I($,Y)),X=Q?` # ${Q} found: install your dev dependencies with that tool here, before pytest.
507
508
  `:"",J=z?`
508
509
  pip install --group ${z}`:"";return` - uses: actions/setup-python@v7
509
510
  with:
@@ -511,25 +512,25 @@ ${L(' Demo complete. Run "faf init" in your project to get started.')}`)}l();fu
511
512
  ${X} - run: |
512
513
  python -m pip install --upgrade pip pytest
513
514
  if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
514
- if [ -f pyproject.toml ] || [ -f setup.py ]; then pip install -e ${Z?`".[${Z}]"`:"."}; fi${J}`}var ax="cargo-nextest@0.9.151",x8=".config/nextest.toml",tx=($)=>{let Z=FZ($,"profile.ci.junit");return Z!==null&&/^\s*path\s*=/m.test(Z)};function ex($){let Z=h($,x8),z=Z!==null&&!tx(Z)?` # ${x8} has no [profile.ci.junit]: add one with path = "junit.xml", or there is no report to read.
515
+ if [ -f pyproject.toml ] || [ -f setup.py ]; then pip install -e ${Z?`".[${Z}]"`:"."}; fi${J}`}var qy="cargo-nextest@0.9.151",k4=".config/nextest.toml",Ky=($)=>{let Z=jZ($,"profile.ci.junit");return Z!==null&&/^\s*path\s*=/m.test(Z)};function By($){let Z=h($,k4),z=Z!==null&&!Ky(Z)?` # ${k4} has no [profile.ci.junit]: add one with path = "junit.xml", or there is no report to read.
515
516
  `:"";return` - uses: dtolnay/rust-toolchain@stable
516
517
  - uses: taiki-e/install-action@v2
517
518
  with:
518
- tool: ${ax}
519
+ tool: ${qy}
519
520
  ${z} - name: Configure the nextest JUnit report
520
- # Only when the repo has no ${x8}: yours is never overwritten.
521
+ # Only when the repo has no ${k4}: yours is never overwritten.
521
522
  run: |
522
- if [ ! -e ${x8} ]; then
523
+ if [ ! -e ${k4} ]; then
523
524
  mkdir -p .config
524
- printf '[profile.ci.junit]\\npath = "junit.xml"\\n' > ${x8}
525
- fi`}var DH=($)=>` - uses: actions/setup-java@v6
525
+ printf '[profile.ci.junit]\\npath = "junit.xml"\\n' > ${k4}
526
+ fi`}var RH=($)=>` - uses: actions/setup-java@v6
526
527
  with:
527
528
  distribution: temurin
528
529
  java-version: '21' # your project's Java version${$?`
529
- cache: ${$}`:""}`,$y=($)=>/<modules\s*>/.test(h($,"pom.xml")??""),Zy=($)=>["settings.gradle","settings.gradle.kts"].some((Z)=>/^\s*include\b/m.test(h($,Z)??"")),HH=($,Z)=>Z?`find . -path '*/${$}/TEST-*.xml' -exec cat {} + > report.xml`:`cat ${$}/TEST-*.xml > report.xml`,zy="9.8.2";function Qy($){let Z=I($,"gradlew");return`${DH()}
530
+ cache: ${$}`:""}`,My=($)=>/<modules\s*>/.test(h($,"pom.xml")??""),Ly=($)=>["settings.gradle","settings.gradle.kts"].some((Z)=>/^\s*include\b/m.test(h($,Z)??"")),DH=($,Z)=>Z?`find . -path '*/${$}/TEST-*.xml' -exec cat {} + > report.xml`:`cat ${$}/TEST-*.xml > report.xml`,Ny="9.8.2";function Dy($){let Z=I($,"gradlew");return`${RH()}
530
531
  - uses: gradle/actions/setup-gradle@v6${Z?"":`
531
532
  with:
532
- gradle-version: '${zy}' # no gradlew in the repo`}`}var Xy="8.1.0";function OH($,Z="",z=0){if(z>6)return[];let Q;try{Q=Cz(k8($,Z),{withFileTypes:!0})}catch{return[]}let X=[];for(let J of Q){let Y=Z?`${Z}/${J.name}`:J.name;if(J.isDirectory()){if(!/^(?:\.|bin$|obj$|node_modules$)/.test(J.name))X.push(...OH($,Y,z+1))}else if(/\.(?:csproj|fsproj)$|^Directory\.Build\.props$/i.test(J.name))X.push(Y)}return X}function Jy($){let Z=new Set;for(let z of OH($)){let Q=h($,z)??"";for(let X of Q.matchAll(/<TargetFrameworks?>([^<]*)<\/TargetFrameworks?>/g))for(let J of X[1].split(";")){let Y=/^\s*net(\d+\.\d+)/.exec(J)?.[1];if(Y)Z.add(`${Y}.x`)}}return[...Z].sort((z,Q)=>parseFloat(z)-parseFloat(Q))}function Yy($){let Z=Jy($),z=I($,"global.json"),Q=[];if(Z.length===1)Q.push(`dotnet-version: '${Z[0]}'`);if(Z.length>1)Q.push(`dotnet-version: |
533
+ gradle-version: '${Ny}' # no gradlew in the repo`}`}var Oy="8.1.0";function PH($,Z="",z=0){if(z>6)return[];let Q;try{Q=Pz(v4($,Z),{withFileTypes:!0})}catch{return[]}let X=[];for(let J of Q){let Y=Z?`${Z}/${J.name}`:J.name;if(J.isDirectory()){if(!/^(?:\.|bin$|obj$|node_modules$)/.test(J.name))X.push(...PH($,Y,z+1))}else if(/\.(?:csproj|fsproj)$|^Directory\.Build\.props$/i.test(J.name))X.push(Y)}return X}function Iy($){let Z=new Set;for(let z of PH($)){let Q=h($,z)??"";for(let X of Q.matchAll(/<TargetFrameworks?>([^<]*)<\/TargetFrameworks?>/g))for(let J of X[1].split(";")){let Y=/^\s*net(\d+\.\d+)/.exec(J)?.[1];if(Y)Z.add(`${Y}.x`)}}return[...Z].sort((z,Q)=>parseFloat(z)-parseFloat(Q))}function Ty($){let Z=Iy($),z=I($,"global.json"),Q=[];if(Z.length===1)Q.push(`dotnet-version: '${Z[0]}'`);if(Z.length>1)Q.push(`dotnet-version: |
533
534
  ${Z.map((X)=>` ${X}`).join(`
534
535
  `)}`);if(z)Q.push("global-json-file: global.json");if(!Q.length)Q.push("dotnet-version: '10.0.x' # your SDK version (or add a global.json)");return` - uses: actions/setup-dotnet@v6
535
536
  with:
@@ -539,36 +540,36 @@ ${Z.map((X)=>` ${X}`).join(`
539
540
  # In CI only: your project files are not changed in the repo.
540
541
  run: |
541
542
  grep -rlE --include='*.csproj' --include='*.fsproj' 'Microsoft\\.NET\\.Test\\.Sdk|<IsTestProject>[[:space:]]*true' . | while read -r p; do
542
- grep -q 'JunitXml.TestLogger' "$p" || dotnet add "$p" package JunitXml.TestLogger --version ${Xy}
543
- done`}function Wy($){let Z;try{Z=Cz($)}catch{return""}let z=Z.filter((X)=>LH.test(X)&&I($,X)).sort();if(z.length<=1)return"";let Q=z.find((X)=>/\.slnx?$/i.test(X))??z[0];return/^[\w.+-]+$/.test(Q)?` ${Q}`:` '${Q.replace(/'/g,"'\\''")}'`}var Uy={python:{setup:ox,test:()=>"pytest --junitxml=report.xml",report:"report.xml"},go:{setup:()=>` - uses: actions/setup-go@v7
543
+ grep -q 'JunitXml.TestLogger' "$p" || dotnet add "$p" package JunitXml.TestLogger --version ${Oy}
544
+ done`}function Ay($){let Z;try{Z=Pz($)}catch{return""}let z=Z.filter((X)=>CH.test(X)&&I($,X)).sort();if(z.length<=1)return"";let Q=z.find((X)=>/\.slnx?$/i.test(X))??z[0];return/^[\w.+-]+$/.test(Q)?` ${Q}`:` '${Q.replace(/'/g,"'\\''")}'`}var Cy={python:{setup:Hy,test:()=>"pytest --junitxml=report.xml",report:"report.xml"},go:{setup:()=>` - uses: actions/setup-go@v7
544
545
  with:
545
546
  go-version-file: go.mod
546
- - run: GOTOOLCHAIN=auto go install gotest.tools/gotestsum@v1.13.0`,test:()=>"gotestsum --junitfile report.xml -- ./...",report:"report.xml"},rust:{setup:ex,test:()=>"cargo nextest run --profile ci --workspace --no-fail-fast",report:"target/nextest/ci/junit.xml"},maven:{setup:()=>DH("maven"),test:($)=>`${I($,"mvnw")?"./mvnw":"mvn"} -B --fail-at-end test`,join:($)=>HH("target/surefire-reports",$y($)),report:"report.xml"},gradle:{setup:Qy,test:($)=>`${I($,"gradlew")?"./gradlew":"gradle"} test --continue`,join:($)=>HH("build/test-results/test",Zy($)),report:"report.xml"},dotnet:{setup:Yy,test:($)=>`dotnet test${Wy($)} --logger "junit;LogFilePath=$GITHUB_WORKSPACE/junit-reports/{assembly}.{framework}.xml"`,join:()=>"cat junit-reports/*.xml > report.xml",report:"report.xml"}},Gy=($)=>` - name: Join the reports into one file
547
+ - run: GOTOOLCHAIN=auto go install gotest.tools/gotestsum@v1.13.0`,test:()=>"gotestsum --junitfile report.xml -- ./...",report:"report.xml"},rust:{setup:By,test:()=>"cargo nextest run --profile ci --workspace --no-fail-fast",report:"target/nextest/ci/junit.xml"},maven:{setup:()=>RH("maven"),test:($)=>`${I($,"mvnw")?"./mvnw":"mvn"} -B --fail-at-end test`,join:($)=>DH("target/surefire-reports",My($)),report:"report.xml"},gradle:{setup:Dy,test:($)=>`${I($,"gradlew")?"./gradlew":"gradle"} test --continue`,join:($)=>DH("build/test-results/test",Ly($)),report:"report.xml"},dotnet:{setup:Ty,test:($)=>`dotnet test${Ay($)} --logger "junit;LogFilePath=$GITHUB_WORKSPACE/junit-reports/{assembly}.{framework}.xml"`,join:()=>"cat junit-reports/*.xml > report.xml",report:"report.xml"}},_y=($)=>` - name: Join the reports into one file
547
548
  # One file per test class or assembly; one alone can read PASSED for a run that failed.
548
549
  run: ${$}
549
- `,y8=($)=>` - name: Run tests
550
+ `,b4=($)=>` - name: Run tests
550
551
  id: tests
551
552
  continue-on-error: true # keep going, so a failed run still gets a receipt
552
553
  run: |
553
554
  set -o pipefail
554
555
  ${$}
555
- `,Vy=/^\s*node\s+--test(?![\w-])[^;&|]*$/,Hy=/^\s*mocha(?![\w-])[^;&|]*$/,qy=/--(?:test-)?reporter\b/;function Ky($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=BH(z);if(typeof Q!=="string"||qy.test(Q))return null;let X=MH[Z].test;if(Vy.test(Q))return`NODE_OPTIONS="--test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=report.xml" ${X}`;if(typeof z.test==="string"&&Hy.test(z.test))return`${X}${Z==="npm"?" --":""} --reporter xunit --reporter-option output=report.xml`;return null}function By($){let Z=ux($),z=mx($),Q=MH[Z],X=Z==="pnpm"?`${px(z)}
556
- ${Q.setup}`:Q.setup,J=VH(z,Z)?null:Ky(z,Z);if(J)return{body:`${X}
556
+ `,Ry=/^\s*node\s+--test(?![\w-])[^;&|]*$/,Py=/^\s*mocha(?![\w-])[^;&|]*$/,Fy=/--(?:test-)?reporter\b/;function Sy($,Z){let z=$.scripts&&typeof $.scripts==="object"?$.scripts:{},Q=TH(z);if(typeof Q!=="string"||Fy.test(Q))return null;let X=AH[Z].test;if(Ry.test(Q))return`NODE_OPTIONS="--test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=report.xml" ${X}`;if(typeof z.test==="string"&&Py.test(z.test))return`${X}${Z==="npm"?" --":""} --reporter xunit --reporter-option output=report.xml`;return null}function jy($){let Z=Zy($),z=zy($),Q=AH[Z],X=Z==="pnpm"?`${Xy(z)}
557
+ ${Q.setup}`:Q.setup,J=NH(z,Z)?null:Sy(z,Z);if(J)return{body:`${X}
557
558
  - run: ${Q.install}
558
559
  # Your test command, with a JUnit report added (faf-taf-git reads it).
559
560
  ${J.includes("xunit")?` # mocha writes only the report: failure details are in report.xml.
560
- `:""}${y8(J)}`,report:"report.xml"};let Y=VH(z,Z)?y8(`${Q.test} 2>&1 | tee test-output.txt`):` # TODO: faf-taf-git reads Jest, Vitest and Bun output, or JUnit XML
561
+ `:""}${b4(J)}`,report:"report.xml"};let Y=NH(z,Z)?b4(`${Q.test} 2>&1 | tee test-output.txt`):` # TODO: faf-taf-git reads Jest, Vitest and Bun output, or JUnit XML
561
562
  # (node --test: --test-reporter=junit; mocha: --reporter xunit).
562
563
  # Run your tests so they write one of those, and point test-output-file at it.
563
- ${y8(`echo "TODO: your test command" 2>&1 | tee test-output.txt # e.g. ${Q.test} 2>&1 | tee test-output.txt`)}`;return{body:`${X}
564
+ ${b4(`echo "TODO: your test command" 2>&1 | tee test-output.txt # e.g. ${Q.test} 2>&1 | tee test-output.txt`)}`;return{body:`${X}
564
565
  - run: ${Q.install}
565
- ${Y}`,report:"test-output.txt"}}function My($){let Z=(J)=>{let Y=xx("git",J,{cwd:$,encoding:"utf-8"});return Y.status===0?Y.stdout.trim():""},z=Z(["symbolic-ref","--short","refs/remotes/origin/HEAD"]).replace(/^origin\//,"");if(z)return{name:z};for(let J of["main","master"])if(Z(["rev-parse","--verify","--quiet",`refs/remotes/origin/${J}`]))return{name:J};let Q=Z(["for-each-ref","--format=%(refname:lstrip=3)","refs/remotes/origin/"]).split(`
566
- `).filter((J)=>J&&J!=="HEAD");if(Q.length===1)return{name:Q[0]};let X=Z(["branch","--show-current"]);if(X)return{name:X,guess:"origin/HEAD is not set, so this is the current branch"};return{name:"main",guess:"no branch found"}}var Ly=($)=>/^[\w./-]+$/.test($)?$:`'${$.replace(/[*?+[\]!]/g,"\\$&")}'`;function Ny($,Z){let z=`name: TAF Receipts
566
+ ${Y}`,report:"test-output.txt"}}function Ey($){let Z=(J)=>{let Y=nx("git",J,{cwd:$,encoding:"utf-8"});return Y.status===0?Y.stdout.trim():""},z=Z(["symbolic-ref","--short","refs/remotes/origin/HEAD"]).replace(/^origin\//,"");if(z)return{name:z};for(let J of["main","master"])if(Z(["rev-parse","--verify","--quiet",`refs/remotes/origin/${J}`]))return{name:J};let Q=Z(["for-each-ref","--format=%(refname:lstrip=3)","refs/remotes/origin/"]).split(`
567
+ `).filter((J)=>J&&J!=="HEAD");if(Q.length===1)return{name:Q[0]};let X=Z(["branch","--show-current"]);if(X)return{name:X,guess:"origin/HEAD is not set, so this is the current branch"};return{name:"main",guess:"no branch found"}}var wy=($)=>/^[\w./-]+$/.test($)?$:`'${$.replace(/[*?+[\]!]/g,"\\$&")}'`;function xy($,Z){let z=`name: TAF Receipts
567
568
  # Prints a Test Receipt (.taf) for every run on ${Z}: proof over time.
568
569
  # Written by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/faf-taf-git
569
570
  on:
570
571
  push:
571
- branches: [${Ly(Z)}]
572
+ branches: [${wy(Z)}]
572
573
  pull_request:
573
574
  workflow_dispatch:
574
575
 
@@ -579,77 +580,78 @@ jobs:
579
580
  contents: write # lets the action save receipts
580
581
  steps:
581
582
  - uses: actions/checkout@v7
582
- `,Q,X="test-output.txt",J=I($,"package.json")?null:ix($);if(I($,"package.json"))({body:Q,report:X}=By($));else if(J){let W=Uy[J];X=W.report,Q=`${W.setup($)}
583
- ${y8(W.test($))}${W.join?Gy(W.join($)):""}`}else Q=` # TODO: set up your toolchain, then run your tests writing output to test-output.txt
584
- ${y8('echo "TODO: your test command" 2>&1 | tee test-output.txt # or any runner that writes JUnit XML')}`;let Y=` - name: Print the receipt
583
+ `,Q,X="test-output.txt",J=I($,"package.json")?null:Wy($);if(I($,"package.json"))({body:Q,report:X}=jy($));else if(J){let W=Cy[J];X=W.report,Q=`${W.setup($)}
584
+ ${b4(W.test($))}${W.join?_y(W.join($)):""}`}else Q=` # TODO: set up your toolchain, then run your tests writing output to test-output.txt
585
+ ${b4('echo "TODO: your test command" 2>&1 | tee test-output.txt # or any runner that writes JUnit XML')}`;let Y=` - name: Print the receipt
585
586
  if: github.ref == 'refs/heads/${Z}' && github.event_name != 'pull_request'
586
- uses: ${gx}
587
+ uses: ${tx}
587
588
  with:
588
589
  test-output-file: ${X}
589
590
  target-branch: taf-receipts
590
591
  - name: Fail the job if the tests failed
591
592
  if: steps.tests.outcome == 'failure'
592
593
  run: exit 1
593
- `;return z+Q+Y}function Dy($){let Z=process.cwd(),z=My(Z),Q=!/['\n\r]/.test(z.name),X=Q?z.name:"main",J=Ny(Z,X),Y=Q?z.guess:`"${z.name}" can't go in the workflow`,W=Y?L(` Records ${X} (${Y}). Check \`branches:\` before you commit.`):"",U=k8(Z,".github","workflows","taf.yml");if($.write){if(yx(U)){console.error(`${C("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(L(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run.")),process.exitCode=1;return}if(j0(Z,k8(".github","workflows")),o(U,J,{root:Z,expect:null}),console.log(`${A("◆")} taf wrote .github/workflows/taf.yml`),console.log(L(" commit + push → your first Test Receipt prints to the taf-receipts branch.")),W)console.log(W);return}if(console.log(`${A("TAF setup")} ${L("— Test Receipt Printer: proof over time")}
594
- `),console.log(L("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(J),W)console.log(`${W}
595
- `);console.log(L(`Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run on ${X}, red runs included.`))}function Oy($){console.error(L("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer; `faf taf receipts` shows the receipts.)"));let Z=m();if(!Z)console.error(`Error: project.faf not found
594
+ `;return z+Q+Y}function yy($){let Z=process.cwd(),z=Ey(Z),Q=!/['\n\r]/.test(z.name),X=Q?z.name:"main",J=xy(Z,X),Y=Q?z.guess:`"${z.name}" can't go in the workflow`,W=Y?M(` Records ${X} (${Y}). Check \`branches:\` before you commit.`):"",U=v4(Z,".github","workflows","taf.yml");if($.write){if(rx(U)){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.")),process.exitCode=1;return}if(j0(Z,v4(".github","workflows")),o(U,J,{root:Z,expect:null}),console.log(`${A("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch.")),W)console.log(W);return}if(console.log(`${A("TAF setup")} ${M("— Test Receipt Printer: proof over time")}
595
+ `),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(J),W)console.log(`${W}
596
+ `);console.log(M(`Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run on ${X}, red runs included.`))}function ky($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer; `faf taf receipts` shows the receipts.)"));let Z=m();if(!Z)console.error(`Error: project.faf not found
596
597
 
597
- Run 'faf init' to create one.`),process.exit(2);let z=e(Z),Q=p(Z),X=a(Z,()=>N0(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)G2($.output),q2($.output,Y,{root:kx(bx($.output)),format:"json",hasMark:vx,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${A("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as Iy}from"readline";import{dirname as Ty,join as IH}from"path";l();var SZ=".faf-session.json";function _z($){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 TH($){try{return y0(i($,SZ))}catch(Z){if(!(Z instanceof v))throw Z;return console.error(L(` ${SZ}: ${Z.message}`)),null}}function Ay($,Z){try{return x2(IH($,SZ),JSON.stringify(Z),{root:$,owns:(z)=>_z(z)!==null,mark:"faf go session"}),!0}catch(z){return console.error(L(` session not saved: ${z instanceof Error?z.message:String(z)}`)),!1}}function Cy($){let Z=TH($);if(_z(Z)===null||Z===null)return;try{C5(IH($,SZ),{root:$,expect:Z})}catch(z){if(!(z instanceof v))throw z}}function _y($,Z){let z=new Map;for(let X of Z){let J=j8($,X);if(J&&!z.has(J.at))z.set(J.at,E8(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(L(" 'faf auto' moves a bare `project: <name>` to `project.name` for you."));process.exit(1)}function Ry($,Z){let z=j$(Z)?` ${L(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${C(`#${$.index}`)} ${zZ($.path)} ${L(`(${$.path})`)}${z}: `}async function AH($={}){f$(process.cwd(),"faf go");let Z=m();if(!Z)console.error(`Error: project.faf not found
598
+ Run 'faf init' to create one.`),process.exit(2);let z=e(Z),Q=p(Z),X=a(Z,()=>N0(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)G2($.output),q2($.output,Y,{root:sx(ox($.output)),format:"json",hasMark:ax,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${A("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as by}from"readline";import{dirname as vy,join as FH}from"path";l();var EZ=".faf-session.json";function Fz($){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 SH($){try{return l0(i($,EZ))}catch(Z){if(!(Z instanceof v))throw Z;return console.error(M(` ${EZ}: ${Z.message}`)),null}}function gy($,Z){try{return x2(FH($,EZ),JSON.stringify(Z),{root:$,owns:(z)=>Fz(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 hy($){let Z=SH($);if(Fz(Z)===null||Z===null)return;try{R5(FH($,EZ),{root:$,expect:Z})}catch(z){if(!(z instanceof v))throw z}}function fy($,Z){let z=new Map;for(let X of Z){let J=E4($,X);if(J&&!z.has(J.at))z.set(J.at,w4(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 uy($,Z){let z=j$(Z)?` ${M(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${C(`#${$.index}`)} ${JZ($.path)} ${M(`(${$.path})`)}${z}: `}async function jH($={}){f$(process.cwd(),"faf go");let Z=m();if(!Z)console.error(`Error: project.faf not found
598
599
 
599
- Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let M=_z(TH(z));if(M)Q=M.slotIndex,console.log(L(` resuming from slot #${Q+1}`))}let X=e(Z),J=a(Z,()=>b0(P0(p(Z)))),Y=J0.filter((M)=>{let B=Oz(X,M.path);return G0(B)&&B!==t1});if(_y(X,Y.map((M)=>M.path)),Y.length===0){console.log(`${A("◆")} go all slots populated — ✪ Trophy`),E0(J,Z);return}console.log(`${A("go")} ${L("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(L(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
600
- `));let U=Iy({input:process.stdin,output:process.stdout}),G=(M)=>new Promise((B)=>U.question(M,B)),V=0,H=!1,q=Y.slice(Q);for(let M=0;M<q.length;M++){let B=q[M],N=await G(Ry(B,Oz(X,B.path)));if(N.toLowerCase()==="quit"){if(H=!0,Ay(z,{slotIndex:Q+M,fafPath:Z}))console.log(L(`
601
- session saved. Resume with: faf go --resume`));break}if(N.toLowerCase()==="skip"||N.trim()==="")continue;_Z(X,B.path,N.trim()),V++}if(U.close(),V>0)k0(Z,X,{onAliasKept:(M)=>console.log(L(` ${y2(M)}`))}),console.log(`
602
- ${A("◆")} go filled ${V} slot${V===1?"":"s"}`);let K=a(Z,()=>b0(P0(p(Z))));if(E0(K,Z),V>0)Py(Z,K.score,V);if(!H)Cy(z)}function Py($,Z,z){let Q=new s0(Ty($));if(!Q.exists())return;Q.recordGrowth(Z,[`faf go — filled ${z} slot${z===1?"":"s"}`]),O6(Q)}l();var Ck="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 Aq($){if($==="analyze")await Rk();else if($==="enhance")console.error(Ck),process.exit(1);else console.log(`${A("ai")} ${L("— ask Claude for suggestions about project.faf")}
603
- `),console.log(` ${C("faf ai analyze")} ${L("— get improvement suggestions")}`),console.log(""),console.log(L(" Requires ANTHROPIC_API_KEY environment variable."))}async function _k(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
600
+ Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let L=Fz(SH(z));if(L)Q=L.slotIndex,console.log(M(` resuming from slot #${Q+1}`))}let X=e(Z),J=a(Z,()=>k0(P0(p(Z)))),Y=J0.filter((L)=>{let B=Tz(X,L.path);return G0(B)&&B!==t1});if(fy(X,Y.map((L)=>L.path)),Y.length===0){console.log(`${A("◆")} go all slots populated — ✪ Trophy`),E0(J,Z);return}console.log(`${A("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.
601
+ `));let U=by({input:process.stdin,output:process.stdout}),G=(L)=>new Promise((B)=>U.question(L,B)),V=0,H=!1,q=Y.slice(Q);for(let L=0;L<q.length;L++){let B=q[L],N=await G(uy(B,Tz(X,B.path)));if(N.toLowerCase()==="quit"){if(H=!0,gy(z,{slotIndex:Q+L,fafPath:Z}))console.log(M(`
602
+ session saved. Resume with: faf go --resume`));break}if(N.toLowerCase()==="skip"||N.trim()==="")continue;FZ(X,B.path,N.trim()),V++}if(U.close(),V>0)y0(Z,X,{onAliasKept:(L)=>console.log(M(` ${y2(L)}`))}),console.log(`
603
+ ${A("◆")} go filled ${V} slot${V===1?"":"s"}`);let K=a(Z,()=>k0(P0(p(Z))));if(E0(K,Z),V>0)my(Z,K.score,V);if(!H)hy(z)}function my($,Z,z){let Q=new s0(vy($));if(!Q.exists())return;Q.recordGrowth(Z,[`faf go — filled ${z} slot${z===1?"":"s"}`]),O6(Q)}l();var hk="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 jq($){if($==="analyze")await uk();else if($==="enhance")console.error(hk),process.exit(1);else console.log(`${A("ai")} ${M("— ask Claude for suggestions about project.faf")}
604
+ `),console.log(` ${C("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function fk(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
604
605
 
605
- export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (Tq(),Iq));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
606
+ export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (Sq(),Fq));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
606
607
 
607
- npm install @anthropic-ai/sdk`),process.exit(2)}}async function Rk(){let $=m();if(!$)console.error(`Error: project.faf not found
608
+ npm install @anthropic-ai/sdk`),process.exit(2)}}async function uk(){let $=m();if(!$)console.error(`Error: project.faf not found
608
609
 
609
- Run 'faf init' to create one.`),process.exit(2);let Z=p($);console.log(`${A("ai")} analyze ${L("getting suggestions...")}`);let Q=await(await _k()).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.
610
+ Run 'faf init' to create one.`),process.exit(2);let Z=p($);console.log(`${A("ai")} analyze ${M("getting suggestions...")}`);let z=await fk(),Q;try{Q=await z.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.
610
611
 
611
612
  ${Z}
612
613
 
613
- Be concise. One line per suggestion.`}]});console.log(""),console.log(Q.content[0].text)}import{existsSync as fQ,readFileSync as uQ,readdirSync as Pk}from"fs";import{join as Cq}from"path";l();function _q($,Z){if($==="import")Fk(Z);else if($==="export")Sk();else console.log(`${A("conductor")} ${L("— conductor integration")}
614
- `),console.log(` ${C("faf conductor import <path>")} ${L("— import conductor config into .faf")}`),console.log(` ${C("faf conductor export")} ${L("— author conductor config from .faf")}`)}function Fk($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!fQ($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:k$,project:{}};if(fQ($)&&$.endsWith(".json")){let X=JSON.parse(uQ($,"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(fQ($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let X=f0(uQ($,"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=Pk($);for(let J of X){let Y=Cq($,J);if(J.endsWith(".json"))try{let W=JSON.parse(uQ(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=m(z);if(Q){let X=e(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;k0(Q,X,{onAliasKept:(J)=>console.log(L(` ${y2(J)}`))}),console.log(`${A("◆")} conductor import merged into ${Q}`)}else{let X=Cq(z,"project.faf");k0(X,Z),console.log(`${A("◆")} conductor import created ${X}`)}}function Sk(){let $=m();if(!$)console.error(`Error: project.faf not found
614
+ Be concise. One line per suggestion.`}]})}catch(X){console.error(`Error: the Anthropic API call failed (${X instanceof Error?X.message:String(X)}). Nothing was written.`),process.exit(1)}console.log(""),console.log(Q.content[0].text)}import{existsSync as cQ,readFileSync as pQ,readdirSync as mk}from"fs";import{join as Eq}from"path";l();function wq($,Z){if($==="import")ck(Z);else if($==="export")pk();else console.log(`${A("conductor")} ${M("— conductor integration")}
615
+ `),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 ck($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!cQ($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:k$,project:{}};if(cQ($)&&$.endsWith(".json")){let X=JSON.parse(pQ($,"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(cQ($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let X=h0(pQ($,"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=mk($);for(let J of X){let Y=Eq($,J);if(J.endsWith(".json"))try{let W=JSON.parse(pQ(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=m(z);if(Q){let X=e(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;y0(Q,X,{onAliasKept:(J)=>console.log(M(` ${y2(J)}`))}),console.log(`${A("◆")} conductor import merged into ${Q}`)}else{let X=Eq(z,"project.faf");y0(X,Z),console.log(`${A("◆")} conductor import created ${X}`)}}function pk(){let $=m();if(!$)console.error(`Error: project.faf not found
615
616
 
616
- Run 'faf init' to create one.`),process.exit(2);let Z=e($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}l();import{readdirSync as jk,readFileSync as Ek,existsSync as wk}from"fs";import{join as xk}from"path";var yk=["BRAKE","ENGINE","AERO","TYRE","PIT"],kk=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function bk($){let Z=$.match(kk);if(!Z)return null;return Z[1].toUpperCase()}function vk($){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 gk($,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 q=X[G];if(q.type==="describe")U=q.name;else{let K=Y.map((B)=>B.name),M=K.length>0?`${K.join(" > ")} > ${q.name}`:q.name;z.push(M)}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 hk=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function Rq($,Z=[]){let z;try{z=jk($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(hk.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=xk($,Q.name);if(Q.isDirectory())Rq(X,Z);else if(Q.isFile())Z.push(X)}return Z}function fk($){let Z=[];if(!wk($))return Z;let z=Rq($);for(let Q of z){let X=Q.split("/").pop()??"",J=vk(X);if(!J.ok||!J.lang)continue;let Y;try{Y=Ek(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=gk(Y,J.lang),U=Q.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:J.lang,testName:G,tier:bk(G)})}return Z}function uk($){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 mk($){if(console.log(`${A(C("faf wjttc"))} ${L("— 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(L(" no tests found"));return}console.log(L(" Tiers:"));for(let Z of yk){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?R0("●"):Z==="ENGINE"?A("●"):Z==="AERO"?L("●"):Z==="TYRE"?A("◐"):L("○");console.log(` ${X} ${Z.padEnd(7)} ${C(String(z).padStart(4))} ${L(`(${Q}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${L("○")} ${"untiered".padEnd(7)} ${C(String($.untiered).padStart(4))} ${L(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(L(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${L("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(L(" Languages:"));for(let[Z,z]of Object.entries($.byLanguage))console.log(` ${L("·")} ${Z.padEnd(12)} ${C(String(z))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(R0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function Pq($={}){let Z=$.path??"tests",z=fk(Z),Q=uk(z);if($.json)console.log(JSON.stringify(Q,null,2));else mk(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as jq}from"crypto";import{readFileSync as ck,existsSync as pk}from"fs";import{join as lk,dirname as dk}from"path";l();var Fq="faf-bench/1",ik={"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 nk($,Z){return ik[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var rk=[["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"]],C4=new Map;rk.forEach(($,Z)=>$.forEach((z)=>C4.set(z,Z)));var sk=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function mQ($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function Sq($){return mQ($).split(" ").filter((Z)=>Z&&!sk.has(Z))}function ok($,Z){let z=mQ($),Q=mQ(Z);if(!z||!Q)return!1;if(z===Q)return!0;let X=C4.get(z);if(X!==void 0&&C4.get(Q)===X)return!0;let J=Sq($);if(J.length===0)return!1;let Y=new Set(Sq(Z));return J.every((W)=>{if(Y.has(W))return!0;let U=C4.get(W);return U!==void 0&&[...Y].some((G)=>C4.get(G)===U)})}function ak($){let Z=N0($),z=f0($),Q=[],X={},J=0;for(let U of J0){if(Z.slots[U.path]!=="populated")continue;let G=a1(z,U);if(typeof G!=="string")continue;let V=G.trim();if(!V||w9.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:U.path,question:nk(U.path,U.description)}),X[J]=V}let Y=JSON.stringify({v:Fq,q:Q.map((U)=>[U.path,U.question])}),W=jq("sha256").update(Y).digest("hex").slice(0,12);return{version:Fq,qsetHash:W,questions:Q,answers:X}}function tk($,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()!==""&&ok($.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 Eq=".faf-bench.json";function wq($){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)}
617
- `===Z}catch{return!1}}function ek($){let Z=y0(i($,Eq));if(Z===null||!wq(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function $b($,Z,z){x2(lk($,Eq),`${JSON.stringify(Z,null,2)}
618
- `,{root:$,owns:wq,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function cQ($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:jq("sha256").update(z).digest("hex")}}var Q7=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function Zb($,Z){let{cold:z,faf:Q}=$;console.log(`
617
+ Run 'faf init' to create one.`),process.exit(2);let Z=e($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}l();import{readdirSync as lk,readFileSync as dk,existsSync as ik}from"fs";import{join as nk}from"path";var rk=["BRAKE","ENGINE","AERO","TYRE","PIT"],sk=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function ok($){let Z=$.match(sk);if(!Z)return null;return Z[1].toUpperCase()}function ak($){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 tk($,Z,z){let Q=Z;for(let X=0;X<4;X++){while(Q<$.length&&/\s/.test($[Q]))Q++;let J=$[Q];if(J==="'"||J==='"'||J==="`"){let W=Q+1;while(W<$.length&&$[W]!==J){if($[W]==="\\")W++;else if(J!=="`"&&$[W]===`
618
+ `)return null;W++}return W<$.length?{name:$.slice(Q+1,W),end:W}:null}if(!z)return null;let Y=ek($,Q-1);if(Y<0)return null;Q=Y+1;while(Q<$.length&&/\s/.test($[Q]))Q++;if($[Q]!=="(")return null;Q++}return null}function ek($,Z){let z=0;for(let Q=Z;Q<$.length;Q++){let X=$[Q];if(X==="'"||X==='"'||X==="`"){for(Q++;Q<$.length&&$[Q]!==X;Q++)if($[Q]==="\\")Q++}else if(X==="(")z++;else if(X===")"&&--z===0)return Q}return-1}function $b($,Z){let z=[];switch(Z){case"typescript":{let Q=[],X=/\b(describe|test|it)((?:\.[A-Za-z]+)*)\s*\(/g,J;while((J=X.exec($))!==null){let V=tk($,J.index+J[0].length,J[2]!=="");if(V)Q.push({idx:V.end,type:J[1]==="describe"?"describe":"test",name:V.name})}let Y=[],W=0,U=null,G=0;for(let V=0;V<$.length;V++){while(G<Q.length&&Q[G].idx===V){let q=Q[G];if(q.type==="describe")U=q.name;else{let K=Y.map((B)=>B.name),L=K.length>0?`${K.join(" > ")} > ${q.name}`:q.name;z.push(L)}G++}let H=$[V];if(H==="{"){if(W++,U!==null&&/(?:=>|\))\s*$/.test($.slice(Math.max(0,V-40),V)))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 Zb=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage","fixtures","__fixtures__"]);function xq($,Z=[]){let z;try{z=lk($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(Zb.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=nk($,Q.name);if(Q.isDirectory())xq(X,Z);else if(Q.isFile())Z.push(X)}return Z}function zb($){let Z=[];if(!ik($))return Z;let z=xq($);for(let Q of z){let X=Q.split("/").pop()??"",J=ak(X);if(!J.ok||!J.lang)continue;let Y;try{Y=dk(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=$b(Y,J.lang),U=Q.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:J.lang,testName:G,tier:ok(G)})}return Z}function Qb($){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 Xb($){if(console.log(`${A(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 rk){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?R0("●"):Z==="ENGINE"?A("●"):Z==="AERO"?M("●"):Z==="TYRE"?A("◐"):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(R0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function yq($={}){let Z=$.path??"tests",z=zb(Z),Q=Qb(z);if($.json)console.log(JSON.stringify(Q,null,2));else Xb(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as vq}from"crypto";import{readFileSync as Jb,existsSync as Yb}from"fs";import{join as Wb,dirname as Ub}from"path";l();var kq="faf-bench/1",Gb={"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 Vb($,Z){return Gb[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var Hb=[["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"]],R8=new Map;Hb.forEach(($,Z)=>$.forEach((z)=>R8.set(z,Z)));var qb=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function lQ($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function bq($){return lQ($).split(" ").filter((Z)=>Z&&!qb.has(Z))}function Kb($,Z){let z=lQ($),Q=lQ(Z);if(!z||!Q)return!1;if(z===Q)return!0;let X=R8.get(z);if(X!==void 0&&R8.get(Q)===X)return!0;let J=bq($);if(J.length===0)return!1;let Y=new Set(bq(Z));return J.every((W)=>{if(Y.has(W))return!0;let U=R8.get(W);return U!==void 0&&[...Y].some((G)=>R8.get(G)===U)})}function Bb($){let Z=N0($),z=h0($),Q=[],X={},J=0;for(let U of J0){if(Z.slots[U.path]!=="populated")continue;let G=a1(z,U);if(typeof G!=="string")continue;let V=G.trim();if(!V||k9.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:U.path,question:Vb(U.path,U.description)}),X[J]=V}let Y=JSON.stringify({v:kq,q:Q.map((U)=>[U.path,U.question])}),W=vq("sha256").update(Y).digest("hex").slice(0,12);return{version:kq,qsetHash:W,questions:Q,answers:X}}function Mb($,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()!==""&&Kb($.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 gq=".faf-bench.json";function hq($){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)}
619
+ `===Z}catch{return!1}}function Lb($){let Z=l0(i($,gq));if(Z===null||!hq(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function Nb($,Z,z){x2(Wb($,gq),`${JSON.stringify(Z,null,2)}
620
+ `,{root:$,owns:hq,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function dQ($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:vq("sha256").update(z).digest("hex")}}var J7=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function Db($,Z){let{cold:z,faf:Q}=$;console.log(`
619
621
  ${C(`faf bench — ${Z}`)}
620
- `),console.log(` ${L("without context")} ${A("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${C(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${Q7(z.tokens)} ${Q7(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
621
- ${L(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(L("Structured context closes the gap."));let J=cQ($,Z);console.log(`
622
- ${R0("✪ BENCH RECEIPT")}`),console.log(L(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${Q.model??z.model??"unreported"}`)),console.log(L(` cold ${z.score}/${z.total} · faf ${Q.score}/${Q.total} · sha256: ${J.hash.slice(0,16)}…`))}function zb($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
622
+ `),console.log(` ${M("without context")} ${A("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${C(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${J7(z.tokens)} ${J7(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
623
+ ${M(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let J=dQ($,Z);console.log(`
624
+ ${R0("✪ 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 Ob($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
623
625
  ${C(`faf bench — ${Z}`)} ${R0("Trouble ahead, expensive trouble.")}
624
- `),console.log(` ${L("without context")}`),console.log(`answers ${z.score}/${z.total} ${L("— the AI is guessing at what you are building")}`),z.tokens!==void 0)console.log(`tokens ${Q7(z.tokens)} ${L("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
626
+ `),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 ${J7(z.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
625
627
  ${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(`
626
- ${A("→ faf init && faf bench")} ${L("(close the gap, get the receipt)")}`)}var Qb="https://mcpaas.live/bench/submit";async function Xb($,Z){try{let z=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});console.log(L(z.ok?` ✪ submitted to ${Z}`:` submit failed (${z.status})`))}catch{console.log(L(" submit skipped (endpoint unreachable)"))}}function xq($,Z,z={}){let Q=z.file??m();if(!Q)console.error(`Error: project.faf not found
628
+ ${A("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var Ib="https://mcpaas.live/bench/submit";async function Tb($,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 fq($,Z,z={}){let Q=z.file??m();if(!Q)console.error(`Error: project.faf not found
627
629
 
628
- Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=p(Q);Y2(X,Q);let J=a(Q,()=>ak(X)),Y=dk(Q),W=f0(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(`
629
- ${C(`faf bench — ${J.questions.length} questions`)} ${L(`qset ${J.qsetHash}`)}
630
+ Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=p(Q);Y2(X,Q);let J=a(Q,()=>Bb(X)),Y=Ub(Q),W=h0(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(`
631
+ ${C(`faf bench — ${J.questions.length} questions`)} ${M(`qset ${J.qsetHash}`)}
630
632
  `);for(let U of J.questions)console.log(` ${String(U.n).padStart(2)}. ${U.question}`);console.log(`
631
- ${L('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!pk(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(ck(Z,"utf-8")),G=U.answers??U,V=tk(J,G),H={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:q,bytes:K}=ek(Y),M=q&&q.qsetHash===J.qsetHash?q:{version:J.version,qsetHash:J.qsetHash,protocol:"in-session"};if(z.cold)M.cold=H;else if(z.faf)M.faf=H;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if($b(Y,M,K),z.json){let B=cQ(M,W);console.log(JSON.stringify({...M,receipt:B.hash,perQuestion:V.perQuestion},null,2));return}if(M.cold&&M.faf)Zb(M,W);if(z.submit&&M.cold&&M.faf){let{cold:B,faf:N}=M,O=cQ(M,W);Xb({date:new Date().toISOString().slice(0,10),model:N.model??B.model??z.model??"unreported",repo:W,qset:M.qsetHash,cold:`${B.score}/${B.total}`,faf:`${N.score}/${N.total}`,sha256:O.hash.slice(0,16)},z.endpoint??Qb)}else if(M.cold)zb(M,W);else console.log(`
632
- ${C(`faf bench — ${W}`)} ${A("with .faf")}: ${C(`${H.score}/${H.total}`)} ${L(`tokens ${Q7(H.tokens)}`)}`),console.log(L("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
633
- ${C("faf bench — agent-native protocol")} ${L(`qset ${J.qsetHash} · ${J.questions.length} questions`)}
634
- `),console.log(`${C("COLD phase")} ${L("(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. ${A("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${A("faf bench grade cold.json --cold --tokens <used> --model <name>")}
635
- `),console.log(`${C("FAF phase")} ${L("(same questions, context first)")}`),console.log(' 4. Instruct: "Read project.faf, then answer the same questions." → faf.json'),console.log(` 5. ${A("faf bench grade faf.json --faf --tokens <used> --model <name>")}
636
- `),console.log(L("Grading is mechanical against your own project.faf — the .faf IS the answer key.")),console.log(L(`Receipts carry protocol: in-session (honor-system cold). qset ${J.qsetHash}.`))}import{lstatSync as Jb}from"fs";import{dirname as Yb,resolve as Wb}from"path";l();function Ub($){try{return Jb($),!0}catch{return!1}}function Gb($,Z,z,Q){let X=a(Q,()=>g5(Z));try{return x2($,X,{root:z,owns:k3,mark:b3}),{bytes:X.length,left:null}}catch(J){if(J instanceof v)return{bytes:null,left:J.message};throw J}}function Vb({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${A("refresh")} ${L("— re-grounding on the live .faf")}
637
- `),!Z)console.log(` score unknown ${L("— 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: ${L(`${X}%`)} ${W} ${C(`${$.score}%`)} ${L(`(${Q>0?"+":""}${Q})`)}`)}else if(X!==null&&X!==void 0)console.log(` no drift ${L(`— steady at ${$.score}%`)}`);else console.log(` baseline set ${L(`— ${$.score}%`)}`);if(J!==null)console.log(` .fafb re-compiled ${L(`(${J} bytes — fast tier current)`)}`);if(Y!==null)console.log(` .fafb left as it is ${L(`— ${Y}`)}`);if(Z)console.log(` re-grounded: ${A2($.tier)} ${C(`${$.score}%`)}`)}function yq($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
633
+ ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!Yb(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(Jb(Z,"utf-8")),G=U.answers??U,V=Mb(J,G),H={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:q,bytes:K}=Lb(Y),L=q&&q.qsetHash===J.qsetHash?q:{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(Nb(Y,L,K),z.json){let B=dQ(L,W);console.log(JSON.stringify({...L,receipt:B.hash,perQuestion:V.perQuestion},null,2));return}if(L.cold&&L.faf)Db(L,W);if(z.submit&&L.cold&&L.faf){let{cold:B,faf:N}=L,O=dQ(L,W);Tb({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:O.hash.slice(0,16)},z.endpoint??Ib)}else if(L.cold)Ob(L,W);else console.log(`
634
+ ${C(`faf bench — ${W}`)} ${A("with .faf")}: ${C(`${H.score}/${H.total}`)} ${M(`tokens ${J7(H.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
635
+ ${C("faf bench — agent-native protocol")} ${M(`qset ${J.qsetHash} · ${J.questions.length} questions`)}
636
+ `),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. ${A("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${A("faf bench grade cold.json --cold --tokens <used> --model <name>")}
637
+ `),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. ${A("faf bench grade faf.json --faf --tokens <used> --model <name>")}
638
+ `),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 Ab}from"fs";import{dirname as Cb,resolve as _b}from"path";l();function Rb($){try{return Ab($),!0}catch{return!1}}function Pb($,Z,z,Q){let X=a(Q,()=>f5(Z));try{return x2($,X,{root:z,owns:v3,mark:g3}),{bytes:X.length,left:null}}catch(J){if(J instanceof v)return{bytes:null,left:J.message};throw J}}function Fb({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${A("refresh")} ${M("— re-grounding on the live .faf")}
639
+ `),!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: ${A2($.tier)} ${C(`${$.score}%`)}`)}function uq($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
638
640
 
639
- Run 'faf init' to create one.`),process.exit(2);let z=p(Z);Y2(z,Z);let Q=a(Z,()=>N0(z)),X=new s0(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=v3(Z),H=null,q=null;if(Ub(V))({bytes:H,left:q}=Gb(V,z,Yb(Wb(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,...q!==null?{left:q}:{}},journey:X.getJourney()||null},null,2));else Vb({result:Q,known:W,drifted:G,delta:U,prevScore:Y,fafbBytes:H,fafbLeft:q});if(!W)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),O6(X);else X.birth(Q.score)}l();import{existsSync as nq,lstatSync as Fb}from"fs";import{resolve as R4}from"path";var kq=["ephemeral","standard","high","critical"],K$=Object.fromEntries(kq.map(($,Z)=>[$,Z])),pQ=new Set(["user","feedback","project","reference"]),lQ=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),dQ=new Set(["facts","sessions","preferences","custom"]),iQ={low:"ephemeral",medium:"standard"};import{existsSync as Hb}from"fs";import{dirname as uq,resolve as mq}from"path";function T1(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function K0($){return $===null||$===void 0}function qb($){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 I1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function Kb($){let Z=mq($),z=i(uq(Z),Z,{read:!0});return{real:z,text:U0(z)}}function bq($,Z,z,Q){let X=mq($),J=i(uq(X),X),Y=z!==void 0&&z.real===J;if(Y&&z.text===Z)return J;let W;try{W=y0(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 o($,Z,U===void 0?{}:{expect:U})}function _4($){if(K0($))return"standard";if(iQ[$])return iQ[$];if($ in K$)return $;return"standard"}var Bb=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function nQ($){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(!Bb.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:_4(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 vq($){let Z=$;return I1($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&I1(Z.extra)&&typeof Z.priority==="string"?Z:nQ($)}function Mb($){if(typeof $==="string"||I1($)&&"text"in $)return nQ($);return null}var gq=["profile","namepoint","created","last_etched","retention"];class c0{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??T1(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(vq):[],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||M0(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(!Hb($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=Kb($);return c0.fromText(z,$,Z)}static fromText($,Z,z){let Q=v9($,Z).toJS();if(!I1(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${qb(Q)}`);let X=new cq,J=X.pick("memory",Q.memory,Z0)??{},Y=new c0(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=Mb(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 c0.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(!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(!lQ.has(z))Z[z]=structuredClone(Q);return Z}toYaml(){return u6(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")&&M0(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&&M0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let U=this.toYaml(),G=bq($,U,void 0,Q);return this.settle($,U,new Map(this._facts.map((V,H)=>[V,H])),G),$}let J=new Map,{text:Y}=j5(X.text,(U)=>{J=this.applyTo(U,X,z)},$),W=bq($,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(gq.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 gq)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!M0(Q.index,X.index)){if(Z.residual.has("index")&&!z)c0.refuse(Z,"index","replace it");w5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of fq(Q.extra,X.extra))w5($,[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],...fq(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,W]of X){if(M0(Y,W))continue;if(Z.residual.has("memory"))c0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))c0.refuse(Z,`memory.${J}`,"replace it");w5($,["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])=>!M0(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))c0.refuse(Z,G,"add facts to it");let U=HW($,["memory","facts"],Z.path);for(let[G,V]of Y)U.items[V]=Nb($,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=vq($);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(Lb(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:_4(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:T1(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=I1($)?{...$,...Z}:Z,Q=I1($)?$.query:$,X=K$[_4(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((K$[G.priority]??1)<X)return;W.push([V,G])}),W.sort((G,V)=>{let H=K$[G[1].priority]??1,q=K$[V[1].priority]??1;if(q!==H)return q-H;let K=G[1].timestamp??"",M=V[1].timestamp??"";if(M!==K)return M<K?-1:M>K?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 Lb($,Z,z){let Q=(X,J)=>K0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:K0(z.priority)?$.priority:_4(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:T1(),extra:{...$.extra}}}class cq{residual=new Map;pick($,Z,z){if(K0(Z))return;if(z(Z))return Z;this.residual.set($,c6(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,Z0)??{}),custom:structuredClone(this.pick("memory.custom",Z.custom,Z0)??{}),extra:hq($,lQ),memoryExtra:hq(Z,dQ)}}}function hq($,Z){let z={};for(let[Q,X]of Object.entries($))if(!Z.has(Q))z[Q]=structuredClone(X);return z}function fq($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function Nb($,Z,z,Q){if(!B0(Z))return Q8($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return Q8($,Z,X(z),X(Q))}import{readdirSync as Db,readFileSync as Ob,statSync as pq,existsSync as Ib}from"fs";import{join as Tb,basename as lq,resolve as Ab}from"path";var dq=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),Cb=/\[\[([^\]]+)\]\]/g;function _b($){let Z=pq($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function Rb($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=f0(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 Pb($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!pQ.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(Cb)].map((V)=>V[1]))].sort();return{text:W,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:_b($),source:`claude-code memory: ${lq($)}`,extra:U}}function rQ($,Z={}){let z=Ab($);if(!Ib(z))throw Error(`Claude memory directory not found: ${z}`);if(!pq(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??dq,X=Z.namepoint??`@claude-code:${lq(z)}`,J=[],Y=Db(z).filter((H)=>H.endsWith(".md")).sort();for(let H of Y){if(Q.has(H))continue;let q=Tb(z,H),K;try{K=Ob(q,"utf-8")}catch{continue}let{fm:M,body:B}=Rb(K);if(!M)continue;let N=Pb(q,B,M);if(N)J.push(N)}let W=J.map((H)=>H.timestamp).filter(Boolean),U=W.length?W.reduce((H,q)=>H<q?H:q):T1(),G=W.length?W.reduce((H,q)=>H>q?H:q):U,V=new c0(X,{profile:"knowledge",facts:J,created:U});return V.last_etched=G,V.rebuildIndex(),V}function Sb($){try{return Fb($),!0}catch{return!1}}function sQ(){return R4(process.cwd(),"soul.fafm")}function oQ($){let Z=R4($??sQ());if(!nq(Z))console.error(`Error: soul file not found: ${Z}
641
+ Run 'faf init' to create one.`),process.exit(2);let z=p(Z);Y2(z,Z);let Q=a(Z,()=>N0(z)),X=new s0(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=h3(Z),H=null,q=null;if(Rb(V))({bytes:H,left:q}=Pb(V,z,Cb(_b(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,...q!==null?{left:q}:{}},journey:X.getJourney()||null},null,2));else Fb({result:Q,known:W,drifted:G,delta:U,prevScore:Y,fafbBytes:H,fafbLeft:q});if(!W)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),O6(X);else X.birth(Q.score)}l();import{existsSync as $K,lstatSync as lb}from"fs";import{resolve as F8}from"path";var mq=["ephemeral","standard","high","critical"],K$=Object.fromEntries(mq.map(($,Z)=>[$,Z])),iQ=new Set(["user","feedback","project","reference"]),nQ=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),rQ=new Set(["facts","sessions","preferences","custom"]),sQ={low:"ephemeral",medium:"standard"};import{existsSync as Sb}from"fs";import{dirname as nq,resolve as rq}from"path";function T1(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function K0($){return $===null||$===void 0}function jb($){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 I1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function Eb($){let Z=rq($),z=i(nq(Z),Z,{read:!0});return{real:z,text:U0(z)}}function cq($,Z,z,Q){let X=rq($),J=i(nq(X),X),Y=z!==void 0&&z.real===J;if(Y&&z.text===Z)return J;let W;try{W=l0(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 o($,Z,U===void 0?{}:{expect:U})}function P8($){if(K0($))return"standard";if(sQ[$])return sQ[$];if($ in K$)return $;return"standard"}var wb=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function oQ($){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(!wb.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:P8(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 pq($){let Z=$;return I1($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&I1(Z.extra)&&typeof Z.priority==="string"?Z:oQ($)}function xb($){if(typeof $==="string"||I1($)&&"text"in $)return oQ($);return null}var lq=["profile","namepoint","created","last_etched","retention"];class m0{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??T1(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(pq):[],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||M0(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(!Sb($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=Eb($);return m0.fromText(z,$,Z)}static fromText($,Z,z){let Q=f9($,Z).toJS();if(!I1(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${jb(Q)}`);let X=new sq,J=X.pick("memory",Q.memory,Z0)??{},Y=new m0(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=xb(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 m0.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(!rQ.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 u6(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")&&M0(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&&M0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let U=this.toYaml(),G=cq($,U,void 0,Q);return this.settle($,U,new Map(this._facts.map((V,H)=>[V,H])),G),$}let J=new Map,{text:Y}=w5(X.text,(U)=>{J=this.applyTo(U,X,z)},$),W=cq($,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(lq.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 lq)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!M0(Q.index,X.index)){if(Z.residual.has("index")&&!z)m0.refuse(Z,"index","replace it");y5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of iq(Q.extra,X.extra))y5($,[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],...iq(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,W]of X){if(M0(Y,W))continue;if(Z.residual.has("memory"))m0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))m0.refuse(Z,`memory.${J}`,"replace it");y5($,["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])=>!M0(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))m0.refuse(Z,G,"add facts to it");let U=BW($,["memory","facts"],Z.path);for(let[G,V]of Y)U.items[V]=kb($,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=pq($);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(yb(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:P8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:T1(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=I1($)?{...$,...Z}:Z,Q=I1($)?$.query:$,X=K$[P8(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((K$[G.priority]??1)<X)return;W.push([V,G])}),W.sort((G,V)=>{let H=K$[G[1].priority]??1,q=K$[V[1].priority]??1;if(q!==H)return q-H;let K=G[1].timestamp??"",L=V[1].timestamp??"";if(L!==K)return L<K?-1:L>K?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 yb($,Z,z){let Q=(X,J)=>K0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:K0(z.priority)?$.priority:P8(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:T1(),extra:{...$.extra}}}class sq{residual=new Map;pick($,Z,z){if(K0(Z))return;if(z(Z))return Z;this.residual.set($,c6(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,Z0)??{}),custom:structuredClone(this.pick("memory.custom",Z.custom,Z0)??{}),extra:dq($,nQ),memoryExtra:dq(Z,rQ)}}}function dq($,Z){let z={};for(let[Q,X]of Object.entries($))if(!Z.has(Q))z[Q]=structuredClone(X);return z}function iq($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function kb($,Z,z,Q){if(!B0(Z))return Q4($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return Q4($,Z,X(z),X(Q))}import{readdirSync as bb,readFileSync as vb,statSync as oq,existsSync as gb}from"fs";import{join as hb,basename as aq,resolve as fb}from"path";var tq=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),ub=/\[\[([^\]]+)\]\]/g;function mb($){let Z=oq($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function cb($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=h0(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 pb($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!iQ.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(ub)].map((V)=>V[1]))].sort();return{text:W,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:mb($),source:`claude-code memory: ${aq($)}`,extra:U}}function aQ($,Z={}){let z=fb($);if(!gb(z))throw Error(`Claude memory directory not found: ${z}`);if(!oq(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??tq,X=Z.namepoint??`@claude-code:${aq(z)}`,J=[],Y=bb(z).filter((H)=>H.endsWith(".md")).sort();for(let H of Y){if(Q.has(H))continue;let q=hb(z,H),K;try{K=vb(q,"utf-8")}catch{continue}let{fm:L,body:B}=cb(K);if(!L)continue;let N=pb(q,B,L);if(N)J.push(N)}let W=J.map((H)=>H.timestamp).filter(Boolean),U=W.length?W.reduce((H,q)=>H<q?H:q):T1(),G=W.length?W.reduce((H,q)=>H>q?H:q):U,V=new m0(X,{profile:"knowledge",facts:J,created:U});return V.last_etched=G,V.rebuildIndex(),V}function db($){try{return lb($),!0}catch{return!1}}function tQ(){return F8(process.cwd(),"soul.fafm")}function eQ($){let Z=F8($??tQ());if(!$K(Z))console.error(`Error: soul file not found: ${Z}
640
642
 
641
- Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return c0.load(Z)}function jb($,Z){if(!$)console.error(`Error: directory required
643
+ Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return m0.load(Z)}function ib($,Z){if(!$)console.error(`Error: directory required
642
644
 
643
- faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=R4($),Q=R4(Z.output??sQ());if(Sb(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${C("--force")} to overwrite.`),process.exit(1);try{let X=rQ(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${A("memory convert")} ${L("—")} ${X.facts.length} facts → ${Q}`),console.log(L(` 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 Eb($){let Z=oQ($.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(`${A("memory ls")} ${L(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
644
- `);for(let z of Z.recall()){let Q=z.id?C(z.id):L("(no-id)"),X=[z.type,z.priority].filter(Boolean).join(" · ");if(console.log(` ${Q} ${z.text.slice(0,80)}`),X)console.log(L(` ${X}`))}}function wb($,Z){let z=oQ(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(`${A("memory recall")} ${L(`— ${J.length} hit(s)`)}${$?L(` for "${$}"`):""}
645
- `);for(let Y of J)console.log(` ${Y.id?C(Y.id):L("?")} ${Y.text}`)}function xb($,Z){if(!$)console.error(`Error: text required
645
+ faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=F8($),Q=F8(Z.output??tQ());if(db(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${C("--force")} to overwrite.`),process.exit(1);try{let X=aQ(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${A("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 nb($){let Z=eQ($.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(`${A("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
646
+ `);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 rb($,Z){let z=eQ(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(`${A("memory recall")} ${M(`— ${J.length} hit(s)`)}${$?M(` for "${$}"`):""}
647
+ `);for(let Y of J)console.log(` ${Y.id?C(Y.id):M("?")} ${Y.text}`)}function sb($,Z){if(!$)console.error(`Error: text required
646
648
 
647
- faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=R4(Z.file??sQ()),Q=nq(z)?c0.load(z):new c0(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(`${A("memory etch")} ${L("—")} ${J.id??"(no-id)"} → ${z}`)}function yb($){let Z=oQ($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${A("memory show")} ${L(`— ${Z.namepoint}`)}
649
+ faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=F8(Z.file??tQ()),Q=$K(z)?m0.load(z):new m0(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(`${A("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${z}`)}function ob($){let Z=eQ($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${A("memory show")} ${M(`— ${Z.namepoint}`)}
648
650
  `),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(`
649
- ${C("index")}`);for(let z of Z.index.slice(0,20))console.log(L(` ${z}`));if(Z.index.length>20)console.log(L(` … +${Z.index.length-20} more`))}}function rq($,Z,z={}){if(Z&&typeof Z==="object")z=Z,Z=void 0;switch($){case"convert":jb(Z,z);break;case"ls":case"list":Eb(z);break;case"recall":wb(Z,z);break;case"etch":xb(Z,z);break;case"show":yb(z);break;case void 0:case"help":iq();break;default:console.error(`Unknown memory subcommand: ${$}`),iq(),process.exit(2)}}function iq(){console.log(`${A("faf memory")} ${L("— .fafm soul ops (knowledge profile)")}
651
+ ${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":ib(Z,z);break;case"ls":case"list":nb(z);break;case"recall":rb(Z,z);break;case"etch":sb(Z,z);break;case"show":ob(z);break;case void 0:case"help":eq();break;default:console.error(`Unknown memory subcommand: ${$}`),eq(),process.exit(2)}}function eq(){console.log(`${A("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
650
652
  `),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
651
- `),console.log(L(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json · --force")),console.log(L(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}l();var{version:aQ}=Dz(),kb=console.error.bind(console);console.error=(...$)=>kb(...$.map((Z)=>typeof Z==="string"?n9(Z):Z));var f=new NX;f.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(aQ,"-v, --version");f.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--new","Replace project.faf with a fresh one; .faf-dna is kept as it is").option("--force","Start over: replace project.faf and start a new birth in .faf-dna").option("--output <path>","Output path").action(($)=>_3($));f.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").option("--json","Output the lineage as JSON").action(($)=>PU($));f.command("auto").description("Fill every tech slot from the repo, then score").action(()=>$Z());f.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(($)=>SU($));f.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>AH($));f.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)=>f5($,Z));f.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)=>xq($,Z,z));f.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(($)=>qV($));f.command("sync").description(".faf → CLAUDE.md — one way; writes faf's block only; Pro also updates Claude Code's MEMORY.md").option("--watch","Watch for changes").action(($)=>sU($));f.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)=>$G($,Z));f.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)=>HG($,Z));f.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)=>NV($,Z));f.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));f.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>_V($??[]));f.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(($)=>EV($));f.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(($)=>lV($));f.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(($)=>{pV($);let Z=()=>process.exit(0);setTimeout(Z,2000).unref(),process.stdout.write("",()=>process.stderr.write("",Z))});f.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(($)=>X$($));f.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(($)=>tG($));f.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. An agent.fafa with no mcp endpoint gets no MCP Server Card or registry server.json; nor does a project.faf alone whose type is not mcp, unless asked for with --target (--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(($)=>IZ($));var sq=($,Z=[])=>[...Z,$],bb=f.command("card").description("One card at a time");bb.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 live endpoint people call over http(s). For something people install (a CLI, a library, a stdio MCP server), use --package").option("--protocol <protocol>","Protocol at --url: a2a or mcp (default: a2a)").option("--package <name>","Where it runs: a package people install. A bare name is npm; or npm:<name>, pypi:<name>, crates:<name>").option("--kind <kind>","What --package is: mcp (an MCP server, the default), cli or library. Only mcp gets MCP cards").option("--homepage <url>","Its homepage, an http(s) URL (default: https://<domain>)").option("--skill <skill>",'What it can do, "Name: description" (repeatable)',sq).option("--example <question>","A question people ask it; search finds it by these (repeatable, 2-5)",sq).option("--dir <path>","Working directory (default: cwd)").option("--out <path>","Output path (default: ./agent.fafa)").option("--force","Replace an existing agent.fafa").action(($)=>HV($));f.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)=>d3($,Z));f.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(($)=>dV($));f.command("formats").description("Show supported formats").action(()=>iV());f.command("clear").description("Delete faf's cached clones (faf-git-* temp dirs)").action(()=>nV());f.command("convert").description("Print .faf as YAML or JSON (writes nothing)").option("--json","Output as JSON").action(($)=>rV($));f.command("context").description("Author context output").action(()=>sV());f.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(($)=>yq($));f.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>eV($));f.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>$H($,Z));f.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>ZH($));f.command("pro [subcommand]").description("Pro features & licensing (activate opens faf.one/pro)").action(($)=>zH($));f.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(($)=>QH($));f.command("demo").description("Demo walkthrough").action(()=>XH());f.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>JH($,Z));f.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` prints the CI receipt workflow (--write creates it); `faf taf receipts` shows them; bare snapshot deprecated → faf score --json").option("--limit <n>","taf receipts: how many to show (default 10)").option("--json","taf receipts: output as JSON").option("--ref <ref>","taf receipts: git ref to read .taf from (default origin/taf-receipts)").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)=>KH($,Z));f.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze) — sends it to the Anthropic API, writes nothing").action(($)=>Aq($));f.command("conductor [subcommand] [path]").description("Conductor config — import <path> merges into .faf; export prints it").action(($,Z)=>_q($,Z));f.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(($)=>Pq($));f.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)=>rq($,Z,z));f.command("status",{hidden:!0}).action(()=>f5(void 0,{status:!0}));f.command("agents",{hidden:!0}).action(()=>X$({agents:!0}));f.command("cursor",{hidden:!0}).action(()=>X$({cursor:!0}));f.command("gemini",{hidden:!0}).action(()=>X$({gemini:!0}));f.command("grok",{hidden:!0}).action(()=>X$({grok:!0}));f.command("llms",{hidden:!0}).action(()=>X$({llms:!0}));f.command("validate [file]",{hidden:!0}).action(($)=>d3($));f.command("yolo",{hidden:!0}).action(()=>_3({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z,colorOn:Q}=await Promise.resolve().then(() => (l(),CW)),X=process.cwd().replace(process.env.HOME??"","~");if(!Q())console.log(`${z($("faf"))} ${Z(`v${aQ}`)} ${Z("Nelly Never Forgets")}`);else{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${aQ}`)}`);let V="\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(`${V}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`)}console.log(`${Z(` ${X}`)}`),console.log("");try{await f5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else f.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(`
652
- `)),f.parseAsync(process.argv).catch(($)=>{if(!u$($))throw $;console.error(m$($,vb())),process.exit(1)});function vb(){let $=process.argv[2];return f.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
653
+ `),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"))}l();var{version:$X}=Iz(),ab=console.error.bind(console);console.error=(...$)=>ab(...$.map((Z)=>typeof Z==="string"?o9(Z):Z));var f=new IX;f.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version($X,"-v, --version");f.command("init").description("Create .faf from your project").addOption(new M7("--yolo").hideHelp()).addOption(new M7("--quick").hideHelp()).option("--new","Replace project.faf with a fresh one; .faf-dna is kept as it is").option("--force","Same as --new: replace project.faf; .faf-dna is kept (a birth certificate is written once)").option("--output <path>","Output path").action(($)=>P3($));f.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").option("--json","Output the lineage as JSON").option("--verify","Check the birth certificate against the commit that first added .faf-dna (exit 0 same, 1 changed, 2 cannot check)").action(($)=>yU($));f.command("auto").description("Fill every tech slot from the repo, then score").action(()=>QZ());f.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(($)=>bU($));f.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>jH($));f.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)=>m5($,Z));f.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)=>fq($,Z,z));f.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(($)=>OV($));f.command("sync").description(".faf → CLAUDE.md — one way; writes faf's block only; Pro also updates Claude Code's MEMORY.md").option("--watch","Watch for changes").action(($)=>zG($));f.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)=>WG($,Z));f.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)=>DG($,Z));f.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)=>_V($,Z));f.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)=>vV($,Z));f.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>wV($??[]));f.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(($)=>gV($));f.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(($)=>aV($));f.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(($)=>{oV($);let Z=()=>process.exit(0);setTimeout(Z,2000).unref(),process.stdout.write("",()=>process.stderr.write("",Z))});f.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(($)=>X$($));f.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(($)=>JV($));f.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. An agent.fafa with no mcp endpoint gets no MCP Server Card or registry server.json; nor does a project.faf alone whose type is not mcp, unless asked for with --target (--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(($)=>CZ($));var zK=($,Z=[])=>[...Z,$],tb=f.command("card").description("One card at a time");tb.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 live endpoint people call over http(s). For something people install (a CLI, a library, a stdio MCP server), use --package").option("--protocol <protocol>","Protocol at --url: a2a or mcp (default: a2a)").option("--package <name>","Where it runs: a package people install. A bare name is npm; or npm:<name>, pypi:<name>, crates:<name>").option("--kind <kind>","What --package is: mcp (an MCP server, the default), cli or library. Only mcp gets MCP cards").option("--homepage <url>","Its homepage, an http(s) URL (default: https://<domain>)").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(($)=>DV($));f.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--verbose","Show slot breakdown").action(($,Z)=>n3($,Z));f.command("info").description("Show version and system info").option("--version","Show version").action(($)=>tV($));f.command("formats").description("Show supported formats").action(()=>eV());f.command("clear").description("Delete faf's cached clones (faf-git-* temp dirs)").action(()=>$H());f.command("convert").description("Print .faf as YAML or JSON (writes nothing)").option("--json","Output as JSON").action(($)=>ZH($));f.command("context").description("Author context output").action(()=>zH());f.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(($)=>uq($));f.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>YH($));f.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>WH($,Z));f.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>UH($));f.command("pro [subcommand]").description("Pro features & licensing (activate opens faf.one/pro)").action(($)=>GH($));f.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(($)=>VH($));f.command("demo").description("Demo walkthrough").action(()=>HH());f.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>qH($,Z));f.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` prints the CI receipt workflow (--write creates it); `faf taf receipts` shows them; bare snapshot deprecated → faf score --json").option("--limit <n>","taf receipts: how many to show (default 10)").option("--json","taf receipts: output as JSON").option("--ref <ref>","taf receipts: git ref to read .taf from (default origin/taf-receipts)").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)=>IH($,Z));f.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze) — sends it to the Anthropic API, writes nothing").action(($)=>jq($));f.command("conductor [subcommand] [path]").description("Conductor config — import <path> merges into .faf; export prints it").action(($,Z)=>wq($,Z));f.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(($)=>yq($));f.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));f.command("status",{hidden:!0}).action(()=>m5(void 0,{status:!0}));f.command("agents",{hidden:!0}).action(()=>X$({agents:!0}));f.command("cursor",{hidden:!0}).action(()=>X$({cursor:!0}));f.command("gemini",{hidden:!0}).action(()=>X$({gemini:!0}));f.command("grok",{hidden:!0}).action(()=>X$({grok:!0}));f.command("llms",{hidden:!0}).action(()=>X$({llms:!0}));f.command("validate [file]",{hidden:!0}).action(($)=>n3($));f.command("yolo",{hidden:!0}).action(()=>P3());if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z,colorOn:Q}=await Promise.resolve().then(() => (l(),PW)),X=process.cwd().replace(process.env.HOME??"","~");if(!Q())console.log(`${z($("faf"))} ${Z(`v${$X}`)} ${Z("Nelly Never Forgets")}`);else{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${$X}`)}`);let V="\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(`${V}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`)}console.log(`${Z(` ${X}`)}`),console.log("");try{await m5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else f.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(`
654
+ `)),f.parseAsync(process.argv).catch(($)=>{if(!u$($))throw $;console.error(m$($,eb())),process.exit(1)});function eb(){let $=process.argv[2];return f.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
653
655
 
654
- //# debugId=C674346C2E78467364756E2164756E21
656
+ //# debugId=DFA88E288F9BC47F64756E2164756E21
655
657
  //# sourceMappingURL=cli.js.map