faf-cli 8.0.1 → 8.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,176 +1,176 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as QH}from"node:module";var nq=Object.create;var{getPrototypeOf:rq,defineProperty:mZ,getOwnPropertyNames:sq}=Object;var oq=Object.prototype.hasOwnProperty;function aq($){return this[$]}var tq,eq,$H=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?tq??=new WeakMap:eq??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?nq(rq($)):{};let Y=Z||!$||!$.__esModule?mZ(z,"default",{value:$,enumerable:!0}):z;for(let W of sq($))if(!oq.call(Y,W))mZ(Y,W,{get:aq.bind($,W),enumerable:!0});if(Q)X.set($,Y);return Y};var F=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var ZH=($)=>$;function zH($,Z){this[$]=ZH.bind(null,Z)}var AQ=($,Z)=>{for(var z in Z)mZ($,z,{get:Z[z],enumerable:!0,configurable:!0,set:zH.bind(Z,z)})};var v=($,Z)=>()=>($&&(Z=$($=0)),Z);var i0=QH(import.meta.url);var N1=F((XH)=>{class cZ 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 CQ extends cZ{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}XH.CommanderError=cZ;XH.InvalidArgumentError=CQ});var I8=F((GH)=>{var{InvalidArgumentError:WH}=N1();class _Q{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 WH(`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 UH($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}GH.Argument=_Q;GH.humanReadableArgName=UH});var pZ=F((KH)=>{var{humanReadableArgName:HH}=I8();class RQ{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)=>HH(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,q){return Z.formatItem(V,z,q,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,q)=>{let H=V.map((K)=>{return X(Z.styleOptionTerm(Z.optionTerm(K)),Z.styleOptionDescription(Z.optionDescription(K)))});J=J.concat(this.formatItemList(q,H,Z))}),Z.showGlobalOptions){let V=Z.visibleGlobalOptions($).map((q)=>{return X(Z.styleOptionTerm(Z.optionTerm(q)),Z.styleOptionDescription(Z.optionDescription(q)))});J=J.concat(this.formatItemList("Global Options:",V,Z))}return this.groupItems($.commands,Z.visibleCommands($),(V)=>V.helpGroup()||"Commands:").forEach((V,q)=>{let H=V.map((K)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(K)),Z.styleSubcommandDescription(Z.subcommandDescription(K)))});J=J.concat(this.formatItemList(q,H,Z))}),J.join(`
3
- `)}displayWidth($){return FQ($).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 NK}from"node:module";var WK=Object.create;var{getPrototypeOf:UK,defineProperty:iZ,getOwnPropertyNames:GK}=Object;var VK=Object.prototype.hasOwnProperty;function HK($){return this[$]}var KK,qK,BK=($,Z,z)=>{var Q=$!=null&&typeof $==="object";if(Q){var X=Z?KK??=new WeakMap:qK??=new WeakMap,J=X.get($);if(J)return J}z=$!=null?WK(UK($)):{};let Y=Z||!$||!$.__esModule?iZ(z,"default",{value:$,enumerable:!0}):z;for(let W of GK($))if(!VK.call(Y,W))iZ(Y,W,{get:HK.bind($,W),enumerable:!0});if(Q)X.set($,Y);return Y};var F=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var MK=($)=>$;function LK($,Z){this[$]=MK.bind(null,Z)}var jQ=($,Z)=>{for(var z in Z)iZ($,z,{get:Z[z],enumerable:!0,configurable:!0,set:LK.bind(Z,z)})};var v=($,Z)=>()=>($&&(Z=$($=0)),Z);var n0=NK(import.meta.url);var D1=F((OK)=>{class nZ 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 wQ extends nZ{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}OK.CommanderError=nZ;OK.InvalidArgumentError=wQ});var A8=F((CK)=>{var{InvalidArgumentError:TK}=D1();class xQ{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 TK(`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 AK($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}CK.Argument=xQ;CK.humanReadableArgName=AK});var rZ=F((PK)=>{var{humanReadableArgName:FK}=A8();class yQ{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)=>FK(z)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(Q))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((z,Q)=>{return Math.max(z,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(Q))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let z="";for(let Q=$.parent;Q;Q=Q.parent)z=Q.name()+" "+z;return z+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)Z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)Z.push(`env: ${$.envVar}`);if(Z.length>0){let z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((z)=>JSON.stringify(z)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let z=`(${Z.join(", ")})`;if($.description)return`${$.description} ${z}`;return z}return $.description}formatItemList($,Z,z){if(Z.length===0)return[];return[z.styleTitle($),...Z,""]}groupItems($,Z,z){let Q=new Map;return $.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[])}),Z.forEach((X)=>{let J=z(X);if(!Q.has(J))Q.set(J,[]);Q.get(J).push(X)}),Q}formatHelp($,Z){let z=Z.padWidth($,Z),Q=Z.helpWidth??80;function X(V,H){return Z.formatItem(V,z,H,Z)}let J=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)J=J.concat([Z.boxWrap(Z.styleCommandDescription(Y),Q),""]);let W=Z.visibleArguments($).map((V)=>{return X(Z.styleArgumentTerm(Z.argumentTerm(V)),Z.styleArgumentDescription(Z.argumentDescription(V)))});if(J=J.concat(this.formatItemList("Arguments:",W,Z)),this.groupItems($.options,Z.visibleOptions($),(V)=>V.helpGroupHeading??"Options:").forEach((V,H)=>{let K=V.map((q)=>{return X(Z.styleOptionTerm(Z.optionTerm(q)),Z.styleOptionDescription(Z.optionDescription(q)))});J=J.concat(this.formatItemList(H,K,Z))}),Z.showGlobalOptions){let V=Z.visibleGlobalOptions($).map((H)=>{return X(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});J=J.concat(this.formatItemList("Global Options:",V,Z))}return this.groupItems($.commands,Z.visibleCommands($),(V)=>V.helpGroup()||"Commands:").forEach((V,H)=>{let K=V.map((q)=>{return X(Z.styleSubcommandTerm(Z.subcommandTerm(q)),Z.styleSubcommandDescription(Z.subcommandDescription(q)))});J=J.concat(this.formatItemList(H,K,Z))}),J.join(`
3
+ `)}displayWidth($){return kQ($).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
- ${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 q=G.trimStart();W=[q],U=this.displayWidth(q)}),X.push(W.join(""))}),X.join(`
6
- `)}}function FQ($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}KH.Help=RQ;KH.stripColor=FQ});var lZ=F((OH)=>{var{InvalidArgumentError:LH}=N1();class SQ{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=NH($);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 LH(`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 PQ(this.name().replace(/^no-/,""));return PQ(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class EQ{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 PQ($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function NH($){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}
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 kQ($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}PK.Help=yQ;PK.stripColor=kQ});var sZ=F((xK)=>{var{InvalidArgumentError:jK}=D1();class vQ{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let z=wK($);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 jK(`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 bQ(this.name().replace(/^no-/,""));return bQ(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class gQ{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 bQ($){return $.split("-").reduce((Z,z)=>{return Z+z[0].toUpperCase()+z.slice(1)})}function wK($){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}}OH.Option=SQ;OH.DualOptions=EQ});var jQ=F((CH)=>{function TH($,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 AH($,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=TH($,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}}xK.Option=vQ;xK.DualOptions=gQ});var hQ=F((gK)=>{function bK($,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 vK($,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=bK($,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""}CH.suggestSimilar=AH});var kQ=F((wH)=>{var RH=i0("node:events").EventEmitter,dZ=i0("node:child_process"),y2=i0("node:path"),T8=i0("node:fs"),t=i0("node:process"),{Argument:FH,humanReadableArgName:PH}=I8(),{CommanderError:iZ}=N1(),{Help:SH,stripColor:EH}=pZ(),{Option:wQ,DualOptions:jH}=lZ(),{suggestSimilar:xQ}=jQ();class rZ extends RH{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)=>t.stdout.write(Z),writeErr:(Z)=>t.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>t.stdout.isTTY?t.stdout.columns:void 0,getErrHelpWidth:()=>t.stderr.isTTY?t.stderr.columns:void 0,getOutHasColors:()=>nZ()??(t.stdout.isTTY&&t.stdout.hasColors?.()),getErrHasColors:()=>nZ()??(t.stderr.isTTY&&t.stderr.hasColors?.()),stripColor:(Z)=>EH(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 rZ($)}createHelp(){return Object.assign(new SH,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 FH($,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 iZ($,Z,z));t.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 wQ($,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 wQ)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(t.versions?.electron)Z.from="electron";let Q=t.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=t.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if(t.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(T8.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""}gK.suggestSimilar=vK});var cQ=F((dK)=>{var fK=n0("node:events").EventEmitter,oZ=n0("node:child_process"),b2=n0("node:path"),C8=n0("node:fs"),e=n0("node:process"),{Argument:uK,humanReadableArgName:mK}=A8(),{CommanderError:aZ}=D1(),{Help:cK,stripColor:pK}=rZ(),{Option:fQ,DualOptions:lK}=sZ(),{suggestSimilar:uQ}=hQ();class eZ extends fK{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(Z)=>e.stdout.write(Z),writeErr:(Z)=>e.stderr.write(Z),outputError:(Z,z)=>z(Z),getOutHelpWidth:()=>e.stdout.isTTY?e.stdout.columns:void 0,getErrHelpWidth:()=>e.stderr.isTTY?e.stderr.columns:void 0,getOutHasColors:()=>tZ()??(e.stdout.isTTY&&e.stdout.hasColors?.()),getErrHasColors:()=>tZ()??(e.stderr.isTTY&&e.stderr.hasColors?.()),stripColor:(Z)=>pK(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 eZ($)}createHelp(){return Object.assign(new cK,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 uK($,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 aZ($,Z,z));e.exit($)}action($){let Z=(z)=>{let Q=this.registeredArguments.length,X=z.slice(0,Q);if(this._storeOptionsAsProperties)X[Q]=this;else X[Q]=this.opts();return X.push(this),$.apply(this,X)};return this._actionHandler=Z,this}createOption($,Z){return new fQ($,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 fQ)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let J=this.createOption(Z,z);if(J.makeOptionMandatory(!!$.mandatory),typeof Q==="function")J.default(X).argParser(Q);else if(Q instanceof RegExp){let Y=Q;Q=(W,U)=>{let G=Y.exec(W);return G?G[0]:U},J.default(X).argParser(Q)}else J.default(Q);return this.addOption(J)}option($,Z,z,Q){return this._optionEx({},$,Z,z,Q)}requiredOption($,Z,z,Q){return this._optionEx({mandatory:!0},$,Z,z,Q)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,Z){return this.setOptionValueWithSource($,Z,void 0)}setOptionValueWithSource($,Z,z){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=z,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((z)=>{if(z.getOptionValueSource($)!==void 0)Z=z.getOptionValueSource($)}),Z}_prepareUserArgs($,Z){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(Z=Z||{},$===void 0&&Z.from===void 0){if(e.versions?.electron)Z.from="electron";let Q=e.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=e.argv;this.rawArgs=$.slice();let z;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],z=$.slice(2);break;case"electron":if(e.defaultApp)this._scriptPath=$[1],z=$.slice(2);else z=$.slice(1);break;case"user":z=$.slice(0);break;case"eval":z=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${Z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",z}parse($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return this._parseCommand([],z),this}async parseAsync($,Z){this._prepareForParse();let z=this._prepareUserArgs($,Z);return await this._parseCommand([],z),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,Z,z){if(C8.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 q=y2.resolve(G,V);if(T8.existsSync(q))return q;if(Q.includes(y2.extname(V)))return;let H=Q.find((K)=>T8.existsSync(`${q}${K}`));if(H)return`${q}${H}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=T8.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=y2.resolve(y2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=y2.basename(this._scriptPath,y2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(y2.extname(J));let W;if(t.platform!=="win32")if(z)Z.unshift(J),Z=yQ(t.execArgv).concat(Z),W=dZ.spawn(t.argv[0],Z,{stdio:"inherit"});else W=dZ.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=yQ(t.execArgv).concat(Z),W=dZ.spawn(t.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{t.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)t.exit(G);else U(new iZ(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)t.exit(1);else{let V=new iZ(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((q)=>q.short).some((q)=>/^-\d$/.test(q)))},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 q=$[U++];if(q===void 0)this.optionMissingArgument(V);this.emit(`option:${V.name()}`,q)}else if(V.optional){let q=null;if(U<$.length&&(!X($[U])||J($[U])))q=$[U++];this.emit(`option:${V.name()}`,q)}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("="),q=this._findOption(G.slice(0,V));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,G.slice(V+1));continue}}if(Q===Z&&X(G)&&!(this.commands.length===0&&J(G)))Q=z;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&z.length===0){if(this._findCommand(G)){Z.push(G),z.push(...$.slice(U));break}else if(this._getHelpCommand()&&G===this._getHelpCommand().name()){Z.push(G,...$.slice(U));break}else if(this._defaultCommandName){z.push(G,...$.slice(U));break}}if(this._passThroughOptions){Q.push(G,...$.slice(U));break}Q.push(G)}return{operands:Z,unknown:z}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let z=0;z<Z;z++){let Q=this.options[z].attributeName();$[Q]=Q===this._versionOptionName?this._version:this[Q]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
21
+ - ${Q}`;throw Error(X)}_executeSubCommand($,Z){Z=Z.slice();let z=!1,Q=[".js",".ts",".tsx",".mjs",".cjs"];function X(G,V){let H=b2.resolve(G,V);if(C8.existsSync(H))return H;if(Q.includes(b2.extname(V)))return;let K=Q.find((q)=>C8.existsSync(`${H}${q}`));if(K)return`${H}${K}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let G;try{G=C8.realpathSync(this._scriptPath)}catch{G=this._scriptPath}Y=b2.resolve(b2.dirname(G),Y)}if(Y){let G=X(Y,J);if(!G&&!$._executableFile&&this._scriptPath){let V=b2.basename(this._scriptPath,b2.extname(this._scriptPath));if(V!==this._name)G=X(Y,`${V}-${$._name}`)}J=G||J}z=Q.includes(b2.extname(J));let W;if(e.platform!=="win32")if(z)Z.unshift(J),Z=mQ(e.execArgv).concat(Z),W=oZ.spawn(e.argv[0],Z,{stdio:"inherit"});else W=oZ.spawn(J,Z,{stdio:"inherit"});else this._checkForMissingExecutable(J,Y,$._name),Z.unshift(J),Z=mQ(e.execArgv).concat(Z),W=oZ.spawn(e.execPath,Z,{stdio:"inherit"});if(!W.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((V)=>{e.on(V,()=>{if(W.killed===!1&&W.exitCode===null)W.kill(V)})});let U=this._exitCallback;W.on("close",(G)=>{if(G=G??1,!U)e.exit(G);else U(new aZ(G,"commander.executeSubCommandAsync","(close)"))}),W.on("error",(G)=>{if(G.code==="ENOENT")this._checkForMissingExecutable(J,Y,$._name);else if(G.code==="EACCES")throw Error(`'${J}' not executable`);if(!U)e.exit(1);else{let V=new aZ(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 t.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,t.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new jH(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=xQ($,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=xQ($,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 PH(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=y2.basename($,y2.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(t.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let z=["beforeAll","before","after","afterAll"];if(!z.includes($))throw Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0});let z=Z||{},Q=z.exitCode||1,X=z.code||"commander.error";this._exit(Q,X,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in e.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,e.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new lK(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=uQ($,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=uQ($,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 mK(z)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=b2.basename($,b2.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),z=this._getOutputContext($);Z.prepareContext({error:z.error,helpWidth:z.helpWidth,outputHasColors:z.hasColors});let Q=Z.formatHelp(this,Z);if(z.hasColors)return Q;return this._outputConfiguration.stripColor(Q)}_getOutputContext($){$=$||{};let Z=!!$.error,z,Q,X;if(Z)z=(Y)=>this._outputConfiguration.writeErr(Y),Q=this._outputConfiguration.getErrHasColors(),X=this._outputConfiguration.getErrHelpWidth();else z=(Y)=>this._outputConfiguration.writeOut(Y),Q=this._outputConfiguration.getOutHasColors(),X=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!Q)Y=this._outputConfiguration.stripColor(Y);return z(Y)},hasColors:Q,helpWidth:X}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let z=this._getOutputContext($),Q={error:z.error,write:z.write,command:this};this._getCommandAndAncestors().reverse().forEach((J)=>J.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let X=this.helpInformation({error:z.error});if(Z){if(X=Z(X),typeof X!=="string"&&!Buffer.isBuffer(X))throw Error("outputHelp callback must return a string or a Buffer")}if(z.write(X),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((J)=>J.emit("afterAllHelp",Q))}helpOption($,Z){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",Z??"display help for command"),$||Z)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let Z=Number(e.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let z=["beforeAll","before","after","afterAll"];if(!z.includes($))throw Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${z.join("', '")}'`);let Q=`${$}Help`;return this.on(Q,(X)=>{let J;if(typeof Z==="function")J=Z({error:X.error,command:X.command});else J=Z;if(J)X.write(`${J}
27
- `)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((Q)=>Z.is(Q)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function yQ($){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 nZ(){if(t.env.NO_COLOR||t.env.FORCE_COLOR==="0"||t.env.FORCE_COLOR==="false")return!1;if(t.env.FORCE_COLOR||t.env.CLICOLOR_FORCE!==void 0)return!0;return}wH.Command=rZ;wH.useColor=nZ});var hQ=F((vH)=>{var{Argument:bQ}=I8(),{Command:sZ}=kQ(),{CommanderError:kH,InvalidArgumentError:vQ}=N1(),{Help:bH}=pZ(),{Option:gQ}=lZ();vH.program=new sZ;vH.createCommand=($)=>new sZ($);vH.createOption=($,Z)=>new gQ($,Z);vH.createArgument=($,Z)=>new bQ($,Z);vH.Command=sZ;vH.Option=gQ;vH.Argument=bQ;vH.Help=bH;vH.CommanderError=kH;vH.InvalidArgumentError=vQ;vH.InvalidOptionArgumentError=vQ});var o=F((ZK)=>{var oZ=Symbol.for("yaml.alias"),mQ=Symbol.for("yaml.document"),A8=Symbol.for("yaml.map"),cQ=Symbol.for("yaml.pair"),aZ=Symbol.for("yaml.scalar"),C8=Symbol.for("yaml.seq"),k2=Symbol.for("yaml.node.type"),rH=($)=>!!$&&typeof $==="object"&&$[k2]===oZ,sH=($)=>!!$&&typeof $==="object"&&$[k2]===mQ,oH=($)=>!!$&&typeof $==="object"&&$[k2]===A8,aH=($)=>!!$&&typeof $==="object"&&$[k2]===cQ,pQ=($)=>!!$&&typeof $==="object"&&$[k2]===aZ,tH=($)=>!!$&&typeof $==="object"&&$[k2]===C8;function lQ($){if($&&typeof $==="object")switch($[k2]){case A8:case C8:return!0}return!1}function eH($){if($&&typeof $==="object")switch($[k2]){case oZ:case A8:case aZ:case C8:return!0}return!1}var $K=($)=>(pQ($)||lQ($))&&!!$.anchor;ZK.ALIAS=oZ;ZK.DOC=mQ;ZK.MAP=A8;ZK.NODE_TYPE=k2;ZK.PAIR=cQ;ZK.SCALAR=aZ;ZK.SEQ=C8;ZK.hasAnchor=$K;ZK.isAlias=rH;ZK.isCollection=lQ;ZK.isDocument=sH;ZK.isMap=oH;ZK.isNode=eH;ZK.isPair=aH;ZK.isScalar=pQ;ZK.isSeq=tH});var O1=F((OK)=>{var T0=o(),u0=Symbol("break visit"),dQ=Symbol("skip children"),P2=Symbol("remove node");function _8($,Z){let z=iQ(Z);if(T0.isDocument($)){if(G$(null,$.contents,z,Object.freeze([$]))===P2)$.contents=null}else G$(null,$,z,Object.freeze([]))}_8.BREAK=u0;_8.SKIP=dQ;_8.REMOVE=P2;function G$($,Z,z,Q){let X=nQ($,Z,z,Q);if(T0.isNode(X)||T0.isPair(X))return rQ($,Q,X),G$($,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=G$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===u0)return u0;else if(Y===P2)Z.items.splice(J,1),J-=1}}else if(T0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=G$("key",Z.key,z,Q);if(J===u0)return u0;else if(J===P2)Z.key=null;let Y=G$("value",Z.value,z,Q);if(Y===u0)return u0;else if(Y===P2)Z.value=null}}return X}async function R8($,Z){let z=iQ(Z);if(T0.isDocument($)){if(await V$(null,$.contents,z,Object.freeze([$]))===P2)$.contents=null}else await V$(null,$,z,Object.freeze([]))}R8.BREAK=u0;R8.SKIP=dQ;R8.REMOVE=P2;async function V$($,Z,z,Q){let X=await nQ($,Z,z,Q);if(T0.isNode(X)||T0.isPair(X))return rQ($,Q,X),V$($,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 V$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===u0)return u0;else if(Y===P2)Z.items.splice(J,1),J-=1}}else if(T0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await V$("key",Z.key,z,Q);if(J===u0)return u0;else if(J===P2)Z.key=null;let Y=await V$("value",Z.value,z,Q);if(Y===u0)return u0;else if(Y===P2)Z.value=null}}return X}function iQ($){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 nQ($,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 rQ($,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`)}}OK.visit=_8;OK.visitAsync=R8});var tZ=F((_K)=>{var sQ=o(),TK=O1(),AK={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},CK=($)=>$.replace(/[!,[\]{}]/g,(Z)=>AK[Z]);class $2{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},$2.defaultYaml,$),this.tags=Object.assign({},$2.defaultTags,Z)}clone(){let $=new $2(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new $2(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:$2.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},$2.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:$2.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},$2.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+CK($.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&&sQ.isNode($.contents)){let X={};TK.visit($.contents,(J,Y)=>{if(sQ.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
- `)}}$2.defaultYaml={explicit:!1,version:"1.2"};$2.defaultTags={"!!":"tag:yaml.org,2002:"};_K.Directives=$2});var F8=F((EK)=>{var oQ=o(),FK=O1();function PK($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function aQ($){let Z=new Set;return FK.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function tQ($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function SK($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=aQ($));let Y=tQ(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(oQ.isScalar(Y.node)||oQ.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}}EK.anchorIsValid=PK;EK.anchorNames=aQ;EK.createNodeAnchors=SK;EK.findNewAnchor=tQ});var eZ=F((kK)=>{function D1($,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=D1($,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=D1($,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=D1($,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=D1($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}kK.applyReviver=D1});var t2=F((gK)=>{var vK=o();function eQ($,Z,z){if(Array.isArray($))return $.map((Q,X)=>eQ(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!vK.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 $}gK.toJS=eQ});var P8=F((mK)=>{var fK=eZ(),$X=o(),uK=t2();class ZX{constructor($){Object.defineProperty(this,$X.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(!$X.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=uK.toJS(this,"",J);if(typeof Q==="function")for(let{count:W,res:U}of J.anchors.values())Q(U,W);return typeof X==="function"?fK.applyReviver(X,{"":Y},"",Y):Y}}mK.NodeBase=ZX});var I1=F((nK)=>{var pK=F8(),lK=O1(),q$=o(),dK=P8(),iK=t2();class zX extends dK.NodeBase{constructor($){super(q$.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,Z){if(Z?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let z;if(Z?.aliasResolveCache)z=Z.aliasResolveCache;else if(z=[],lK.visit($,{Node:(X,J)=>{if(q$.isAlias(J)||q$.hasAnchor(J))z.push(J)}}),Z)Z.aliasResolveCache=z;let Q=void 0;for(let X of z){if(X===this)break;if(X.anchor===this.source)Q=X}return Q}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:z,doc:Q,maxAliasCount:X}=Z,J=this.resolve(Q,Z);if(!J){let W=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(W)}let Y=z.get(J);if(!Y)iK.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=S8(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(pK.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 S8($,Z,z){if(q$.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(q$.isCollection(Z)){let Q=0;for(let X of Z.items){let J=S8($,X,z);if(J>Q)Q=J}return Q}else if(q$.isPair(Z)){let Q=S8($,Z.key,z),X=S8($,Z.value,z);return Math.max(Q,X)}return 1}nK.Alias=zX});var L0=F((eK)=>{var sK=o(),oK=P8(),aK=t2(),tK=($)=>!$||typeof $!=="function"&&typeof $!=="object";class P6 extends oK.NodeBase{constructor($){super(sK.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:aK.toJS(this.value,$,Z)}toString(){return String(this.value)}}P6.BLOCK_FOLDED="BLOCK_FOLDED";P6.BLOCK_LITERAL="BLOCK_LITERAL";P6.PLAIN="PLAIN";P6.QUOTE_DOUBLE="QUOTE_DOUBLE";P6.QUOTE_SINGLE="QUOTE_SINGLE";eK.Scalar=P6;eK.isScalarValue=tK});var T1=F((YB)=>{var zB=I1(),S6=o(),QX=L0(),QB="tag:yaml.org,2002:";function XB($,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 JB($,Z,z){if(S6.isDocument($))$=$.contents;if(S6.isNode($))return $;if(S6.isPair($)){let q=z.schema[S6.MAP].createNode?.(z.schema,null,z);return q.items.push($),q}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 zB.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=QB+Z.slice(2);let G=XB($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let q=new QX.Scalar($);if(U)U.node=q;return q}G=$ instanceof Map?Y[S6.MAP]:(Symbol.iterator in Object($))?Y[S6.SEQ]:Y[S6.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 QX.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(U)U.node=V;return V}YB.createNode=JB});var E8=F((VB)=>{var UB=T1(),S2=o(),GB=P8();function $7($,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 UB.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var XX=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class JX extends GB.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)=>S2.isNode(z)||S2.isPair(z)?z.clone($):z),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(XX($))this.add(Z);else{let[z,...Q]=$,X=this.get(z,!0);if(S2.isCollection(X))X.addIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,$7(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(S2.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&&S2.isScalar(X)?X.value:X;else return S2.isCollection(X)?X.getIn(Q,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!S2.isPair(Z))return!1;let z=Z.value;return z==null||$&&S2.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 S2.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(S2.isCollection(X))X.setIn(Q,Z);else if(X===void 0&&this.schema)this.set(z,$7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}VB.Collection=JX;VB.collectionFromPath=$7;VB.isEmptyPath=XX});var A1=F((LB)=>{var BB=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function Z7($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var MB=($,Z,z)=>$.endsWith(`
29
- `)?Z7(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 mQ($){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 tZ(){if(e.env.NO_COLOR||e.env.FORCE_COLOR==="0"||e.env.FORCE_COLOR==="false")return!1;if(e.env.FORCE_COLOR||e.env.CLICOLOR_FORCE!==void 0)return!0;return}dK.Command=eZ;dK.useColor=tZ});var iQ=F((oK)=>{var{Argument:pQ}=A8(),{Command:$7}=cQ(),{CommanderError:rK,InvalidArgumentError:lQ}=D1(),{Help:sK}=rZ(),{Option:dQ}=sZ();oK.program=new $7;oK.createCommand=($)=>new $7($);oK.createOption=($,Z)=>new dQ($,Z);oK.createArgument=($,Z)=>new pQ($,Z);oK.Command=$7;oK.Option=dQ;oK.Argument=pQ;oK.Help=sK;oK.CommanderError=rK;oK.InvalidArgumentError=lQ;oK.InvalidOptionArgumentError=lQ});var t=F((Mq)=>{var Z7=Symbol.for("yaml.alias"),sQ=Symbol.for("yaml.document"),_8=Symbol.for("yaml.map"),oQ=Symbol.for("yaml.pair"),z7=Symbol.for("yaml.scalar"),R8=Symbol.for("yaml.seq"),v2=Symbol.for("yaml.node.type"),Uq=($)=>!!$&&typeof $==="object"&&$[v2]===Z7,Gq=($)=>!!$&&typeof $==="object"&&$[v2]===sQ,Vq=($)=>!!$&&typeof $==="object"&&$[v2]===_8,Hq=($)=>!!$&&typeof $==="object"&&$[v2]===oQ,aQ=($)=>!!$&&typeof $==="object"&&$[v2]===z7,Kq=($)=>!!$&&typeof $==="object"&&$[v2]===R8;function tQ($){if($&&typeof $==="object")switch($[v2]){case _8:case R8:return!0}return!1}function qq($){if($&&typeof $==="object")switch($[v2]){case Z7:case _8:case z7:case R8:return!0}return!1}var Bq=($)=>(aQ($)||tQ($))&&!!$.anchor;Mq.ALIAS=Z7;Mq.DOC=sQ;Mq.MAP=_8;Mq.NODE_TYPE=v2;Mq.PAIR=oQ;Mq.SCALAR=z7;Mq.SEQ=R8;Mq.hasAnchor=Bq;Mq.isAlias=Uq;Mq.isCollection=tQ;Mq.isDocument=Gq;Mq.isMap=Vq;Mq.isNode=qq;Mq.isPair=Hq;Mq.isScalar=aQ;Mq.isSeq=Kq});var I1=F((xq)=>{var A0=t(),m0=Symbol("break visit"),eQ=Symbol("skip children"),S2=Symbol("remove node");function F8($,Z){let z=$X(Z);if(A0.isDocument($)){if(K$(null,$.contents,z,Object.freeze([$]))===S2)$.contents=null}else K$(null,$,z,Object.freeze([]))}F8.BREAK=m0;F8.SKIP=eQ;F8.REMOVE=S2;function K$($,Z,z,Q){let X=ZX($,Z,z,Q);if(A0.isNode(X)||A0.isPair(X))return zX($,Q,X),K$($,X,z,Q);if(typeof X!=="symbol"){if(A0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=K$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===m0)return m0;else if(Y===S2)Z.items.splice(J,1),J-=1}}else if(A0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=K$("key",Z.key,z,Q);if(J===m0)return m0;else if(J===S2)Z.key=null;let Y=K$("value",Z.value,z,Q);if(Y===m0)return m0;else if(Y===S2)Z.value=null}}return X}async function P8($,Z){let z=$X(Z);if(A0.isDocument($)){if(await q$(null,$.contents,z,Object.freeze([$]))===S2)$.contents=null}else await q$(null,$,z,Object.freeze([]))}P8.BREAK=m0;P8.SKIP=eQ;P8.REMOVE=S2;async function q$($,Z,z,Q){let X=await ZX($,Z,z,Q);if(A0.isNode(X)||A0.isPair(X))return zX($,Q,X),q$($,X,z,Q);if(typeof X!=="symbol"){if(A0.isCollection(Z)){Q=Object.freeze(Q.concat(Z));for(let J=0;J<Z.items.length;++J){let Y=await q$(J,Z.items[J],z,Q);if(typeof Y==="number")J=Y-1;else if(Y===m0)return m0;else if(Y===S2)Z.items.splice(J,1),J-=1}}else if(A0.isPair(Z)){Q=Object.freeze(Q.concat(Z));let J=await q$("key",Z.key,z,Q);if(J===m0)return m0;else if(J===S2)Z.key=null;let Y=await q$("value",Z.value,z,Q);if(Y===m0)return m0;else if(Y===S2)Z.value=null}}return X}function $X($){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 ZX($,Z,z,Q){if(typeof z==="function")return z($,Z,Q);if(A0.isMap(Z))return z.Map?.($,Z,Q);if(A0.isSeq(Z))return z.Seq?.($,Z,Q);if(A0.isPair(Z))return z.Pair?.($,Z,Q);if(A0.isScalar(Z))return z.Scalar?.($,Z,Q);if(A0.isAlias(Z))return z.Alias?.($,Z,Q);return}function zX($,Z,z){let Q=Z[Z.length-1];if(A0.isCollection(Q))Q.items[$]=z;else if(A0.isPair(Q))if($==="key")Q.key=z;else Q.value=z;else if(A0.isDocument(Q))Q.contents=z;else{let X=A0.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}xq.visit=F8;xq.visitAsync=P8});var Q7=F((hq)=>{var QX=t(),bq=I1(),vq={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},gq=($)=>$.replace(/[!,[\]{}]/g,(Z)=>vq[Z]);class Z2{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Z2.defaultYaml,$),this.tags=Object.assign({},Z2.defaultTags,Z)}clone(){let $=new Z2(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new Z2(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Z2.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Z2.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:Z2.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Z2.defaultTags),this.atNextDocument=!1;let z=$.trim().split(/[ \t]+/),Q=z.shift();switch(Q){case"%TAG":{if(z.length!==2){if(Z(0,"%TAG directive should contain exactly two parts"),z.length<2)return!1}let[X,J]=z;return this.tags[X]=J,!0}case"%YAML":{if(this.yaml.explicit=!0,z.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[X]=z;if(X==="1.1"||X==="1.2")return this.yaml.version=X,!0;else{let J=/^\d+\.\d+$/.test(X);return Z(6,`Unsupported YAML version ${X}`,J),!1}}default:return Z(0,`Unknown directive ${Q}`,!0),!1}}tagName($,Z){if($==="!")return"!";if($[0]!=="!")return Z(`Not a valid tag: ${$}`),null;if($[1]==="<"){let J=$.slice(2,-1);if(J==="!"||J==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return J}let[,z,Q]=$.match(/^(.*!)([^!]*)$/s);if(!Q)Z(`The ${$} tag has no suffix`);let X=this.tags[z];if(X)try{return X+decodeURIComponent(Q)}catch(J){return Z(String(J)),null}if(z==="!")return $;return Z(`Could not resolve tag: ${$}`),null}tagString($){for(let[Z,z]of Object.entries(this.tags))if($.startsWith(z))return Z+gq($.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&&QX.isNode($.contents)){let X={};bq.visit($.contents,(J,Y)=>{if(QX.isNode(Y)&&Y.tag)X[Y.tag]=!0}),Q=Object.keys(X)}else Q=[];for(let[X,J]of z){if(X==="!!"&&J==="tag:yaml.org,2002:")continue;if(!$||Q.some((Y)=>Y.startsWith(J)))Z.push(`%TAG ${X} ${J}`)}return Z.join(`
28
+ `)}}Z2.defaultYaml={explicit:!1,version:"1.2"};Z2.defaultTags={"!!":"tag:yaml.org,2002:"};hq.Directives=Z2});var S8=F((pq)=>{var XX=t(),uq=I1();function mq($){if(/[\x00-\x19\s,[\]{}]/.test($)){let z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(z)}return!0}function JX($){let Z=new Set;return uq.visit($,{Value(z,Q){if(Q.anchor)Z.add(Q.anchor)}}),Z}function YX($,Z){for(let z=1;;++z){let Q=`${$}${z}`;if(!Z.has(Q))return Q}}function cq($,Z){let z=[],Q=new Map,X=null;return{onAnchor:(J)=>{z.push(J),X??(X=JX($));let Y=YX(Z,X);return X.add(Y),Y},setAnchors:()=>{for(let J of z){let Y=Q.get(J);if(typeof Y==="object"&&Y.anchor&&(XX.isScalar(Y.node)||XX.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}}pq.anchorIsValid=mq;pq.anchorNames=JX;pq.createNodeAnchors=cq;pq.findNewAnchor=YX});var X7=F((rq)=>{function T1($,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=T1($,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=T1($,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=T1($,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=T1($,Q,X,J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}return $.call(Z,z,Q)}rq.applyReviver=T1});var $6=F((aq)=>{var oq=t();function WX($,Z,z){if(Array.isArray($))return $.map((Q,X)=>WX(Q,String(X),z));if($&&typeof $.toJSON==="function"){if(!z||!oq.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 $}aq.toJS=WX});var E8=F((ZB)=>{var eq=X7(),UX=t(),$B=$6();class GX{constructor($){Object.defineProperty(this,UX.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(!UX.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=$B.toJS(this,"",J);if(typeof Q==="function")for(let{count:W,res:U}of J.anchors.values())Q(U,W);return typeof X==="function"?eq.applyReviver(X,{"":Y},"",Y):Y}}ZB.NodeBase=GX});var A1=F((WB)=>{var QB=S8(),XB=I1(),B$=t(),JB=E8(),YB=$6();class VX extends JB.NodeBase{constructor($){super(B$.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=[],XB.visit($,{Node:(X,J)=>{if(B$.isAlias(J)||B$.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)YB.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=j8(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(QB.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 j8($,Z,z){if(B$.isAlias(Z)){let Q=Z.resolve($),X=z&&Q&&z.get(Q);return X?X.count*X.aliasCount:0}else if(B$.isCollection(Z)){let Q=0;for(let X of Z.items){let J=j8($,X,z);if(J>Q)Q=J}return Q}else if(B$.isPair(Z)){let Q=j8($,Z.key,z),X=j8($,Z.value,z);return Math.max(Q,X)}return 1}WB.Alias=VX});var N0=F((qB)=>{var GB=t(),VB=E8(),HB=$6(),KB=($)=>!$||typeof $!=="function"&&typeof $!=="object";class S6 extends VB.NodeBase{constructor($){super(GB.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:HB.toJS(this.value,$,Z)}toString(){return String(this.value)}}S6.BLOCK_FOLDED="BLOCK_FOLDED";S6.BLOCK_LITERAL="BLOCK_LITERAL";S6.PLAIN="PLAIN";S6.QUOTE_DOUBLE="QUOTE_DOUBLE";S6.QUOTE_SINGLE="QUOTE_SINGLE";qB.Scalar=S6;qB.isScalarValue=KB});var C1=F((IB)=>{var LB=A1(),E6=t(),HX=N0(),NB="tag:yaml.org,2002:";function OB($,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 DB($,Z,z){if(E6.isDocument($))$=$.contents;if(E6.isNode($))return $;if(E6.isPair($)){let H=z.schema[E6.MAP].createNode?.(z.schema,null,z);return H.items.push($),H}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:Q,onAnchor:X,onTagObj:J,schema:Y,sourceObjects:W}=z,U=void 0;if(Q&&$&&typeof $==="object")if(U=W.get($),U)return U.anchor??(U.anchor=X($)),new LB.Alias(U.anchor);else U={anchor:null,node:null},W.set($,U);if(Z?.startsWith("!!"))Z=NB+Z.slice(2);let G=OB($,Z,Y.tags);if(!G){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new HX.Scalar($);if(U)U.node=H;return H}G=$ instanceof Map?Y[E6.MAP]:(Symbol.iterator in Object($))?Y[E6.SEQ]:Y[E6.MAP]}if(J)J(G),delete z.onTagObj;let V=G?.createNode?G.createNode(z.schema,$,z):typeof G?.nodeClass?.from==="function"?G.nodeClass.from(z.schema,$,z):new HX.Scalar($);if(Z)V.tag=Z;else if(!G.default)V.tag=G.tag;if(U)U.node=V;return V}IB.createNode=DB});var w8=F((_B)=>{var AB=C1(),E2=t(),CB=E8();function J7($,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 AB.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var KX=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class qX extends CB.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(KX($))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,J7(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,J7(this.schema,Q,Z));else throw Error(`Expected YAML collection at ${z}. Remaining path: ${Q}`)}}}_B.Collection=qX;_B.collectionFromPath=J7;_B.isEmptyPath=KX});var _1=F((jB)=>{var SB=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function Y7($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var EB=($,Z,z)=>$.endsWith(`
29
+ `)?Y7(z,Z):z.includes(`
30
30
  `)?`
31
- `+Z7(z,Z):($.endsWith(" ")?"":" ")+z;LB.indentComment=Z7;LB.lineComment=MB;LB.stringifyComment=BB});var WX=F((TB)=>{function IB($,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={},q=X-Z.length;if(typeof Q==="number")if(Q>X-Math.max(2,J))G.push(0);else q=X-Q;let H=void 0,K=void 0,L=!1,B=-1,N=-1,T=-1;if(z==="block"){if(B=YX($,B,Z.length),B!==-1)q=B+U}for(let y;y=$[B+=1];){if(z==="quoted"&&y==="\\"){switch(N=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}T=B}if(y===`
32
- `){if(z==="block")B=YX($,B,Z.length);q=B+Z.length+U,H=void 0}else{if(y===" "&&K&&K!==" "&&K!==`
33
- `&&K!=="\t"){let E=$[B+1];if(E&&E!==" "&&E!==`
34
- `&&E!=="\t")H=B}if(B>=q)if(H)G.push(H),q=H+U,H=void 0;else if(z==="quoted"){while(K===" "||K==="\t")K=y,y=$[B+=1],L=!0;let E=B>T+1?B-2:N-1;if(V[E])return $;G.push(E),V[E]=!0,q=E+U,H=void 0}else L=!0}K=y}if(L&&W)W();if(G.length===0)return $;if(Y)Y();let _=$.slice(0,G[0]);for(let y=0;y<G.length;++y){let E=G[y],w=G[y+1]||$.length;if(E===0)_=`
31
+ `+Y7(z,Z):($.endsWith(" ")?"":" ")+z;jB.indentComment=Y7;jB.lineComment=EB;jB.stringifyComment=SB});var MX=F((bB)=>{function kB($,Z,z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:J=20,onFold:Y,onOverflow:W}={}){if(!X||X<0)return $;if(X<J)J=0;let U=Math.max(1+J,1+X-Z.length);if($.length<=U)return $;let G=[],V={},H=X-Z.length;if(typeof Q==="number")if(Q>X-Math.max(2,J))G.push(0);else H=X-Q;let K=void 0,q=void 0,L=!1,B=-1,N=-1,I=-1;if(z==="block"){if(B=BX($,B,Z.length),B!==-1)H=B+U}for(let y;y=$[B+=1];){if(z==="quoted"&&y==="\\"){switch(N=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}I=B}if(y===`
32
+ `){if(z==="block")B=BX($,B,Z.length);H=B+Z.length+U,K=void 0}else{if(y===" "&&q&&q!==" "&&q!==`
33
+ `&&q!=="\t"){let E=$[B+1];if(E&&E!==" "&&E!==`
34
+ `&&E!=="\t")K=B}if(B>=H)if(K)G.push(K),H=K+U,K=void 0;else if(z==="quoted"){while(q===" "||q==="\t")q=y,y=$[B+=1],L=!0;let E=B>I+1?B-2:N-1;if(V[E])return $;G.push(E),V[E]=!0,H=E+U,K=void 0}else L=!0}q=y}if(L&&W)W();if(G.length===0)return $;if(Y)Y();let _=$.slice(0,G[0]);for(let y=0;y<G.length;++y){let E=G[y],w=G[y+1]||$.length;if(E===0)_=`
35
35
  ${Z}${$.slice(0,w)}`;else{if(z==="quoted"&&V[E])_+=`${$[E]}\\`;_+=`
36
- ${Z}${$.slice(E+1,w)}`}}return _}function YX($,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}TB.FOLD_BLOCK="block";TB.FOLD_FLOW="flow";TB.FOLD_QUOTED="quoted";TB.foldFlowLines=IB});var _1=F((EB)=>{var K2=L0(),e2=WX(),w8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),x8=($)=>/^(%|---|\.\.\.)/m.test($);function FB($,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 C1($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(x8($)?" ":""),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(E+1,w)}`}}return _}function BX($,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}bB.FOLD_BLOCK="block";bB.FOLD_FLOW="flow";bB.FOLD_QUOTED="quoted";bB.foldFlowLines=kB});var F1=F((pB)=>{var M2=N0(),Z6=MX(),y8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),k8=($)=>/^(%|---|\.\.\.)/m.test($);function uB($,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 R1($,Z){let z=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return z;let{implicitKey:Q}=Z,X=Z.options.doubleQuotedMinMultiLineLength,J=Z.indent||(k8($)?" ":""),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:e2.foldFlowLines(Y,J,e2.FOLD_QUOTED,w8(Z,!1))}function z7($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
- `)||/[ \t]\n|\n[ \t]/.test($))return C1($,Z);let z=Z.indent||(x8($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
- ${z}`)+"'";return Z.implicitKey?Q:e2.foldFlowLines(Q,z,e2.FOLD_FLOW,w8(Z,!1))}function H$($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=C1;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=z7;else if(J&&!X)Q=C1;else Q=z?z7:C1}return Q($,Z)}var Q7;try{Q7=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,y8(Z,!1))}function W7($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
42
+ `)||/[ \t]\n|\n[ \t]/.test($))return R1($,Z);let z=Z.indent||(k8($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
43
+ ${z}`)+"'";return Z.implicitKey?Q:Z6.foldFlowLines(Q,z,Z6.FOLD_FLOW,y8(Z,!1))}function M$($,Z){let{singleQuote:z}=Z.options,Q;if(z===!1)Q=R1;else{let X=$.includes('"'),J=$.includes("'");if(X&&!J)Q=W7;else if(J&&!X)Q=R1;else Q=z?W7:R1}return Q($,Z)}var U7;try{U7=new RegExp(`(^|(?<!
44
44
  ))
45
45
  +(?!
46
- |$)`,"g")}catch{Q7=/\n+(?!\n|$)/g}function j8({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:W,lineWidth:U}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return H$(z,Q);let G=Q.indent||(Q.forceBlockIndent||x8(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===K2.Scalar.BLOCK_FOLDED?!1:Z===K2.Scalar.BLOCK_LITERAL?!0:!FB(z,U,G.length);if(!z)return V?`|
46
+ |$)`,"g")}catch{U7=/\n+(?!\n|$)/g}function x8({comment:$,type:Z,value:z},Q,X,J){let{blockQuote:Y,commentString:W,lineWidth:U}=Q.options;if(!Y||/\n[\t ]+$/.test(z))return M$(z,Q);let G=Q.indent||(Q.forceBlockIndent||k8(z)?" ":""),V=Y==="literal"?!0:Y==="folded"||Z===M2.Scalar.BLOCK_FOLDED?!1:Z===M2.Scalar.BLOCK_LITERAL?!0:!uB(z,U,G.length);if(!z)return V?`|
47
47
  `:`>
48
- `;let q,H;for(H=z.length;H>0;--H){let w=z[H-1];if(w!==`
49
- `&&w!=="\t"&&w!==" ")break}let K=z.substring(H),L=K.indexOf(`
50
- `);if(L===-1)q="-";else if(z===K||L!==K.length-1){if(q="+",J)J()}else q="";if(K){if(z=z.slice(0,-K.length),K[K.length-1]===`
51
- `)K=K.slice(0,-1);K=K.replace(Q7,`$&${G}`)}let B=!1,N,T=-1;for(N=0;N<z.length;++N){let w=z[N];if(w===" ")B=!0;else if(w===`
52
- `)T=N;else break}let _=z.substring(0,T<N?T+1:N);if(_)z=z.substring(_.length),_=_.replace(/\n+/g,`$&${G}`);let E=(B?G?"2":"1":"")+q;if($){if(E+=" "+W($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let w=z.replace(/\n+/g,`
53
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),j=!1,f=w8(Q,!0);if(Y!=="folded"&&Z!==K2.Scalar.BLOCK_FOLDED)f.onOverflow=()=>{j=!0};let S=e2.foldFlowLines(`${_}${w}${K}`,G,e2.FOLD_BLOCK,f);if(!j)return`>${E}
48
+ `;let H,K;for(K=z.length;K>0;--K){let w=z[K-1];if(w!==`
49
+ `&&w!=="\t"&&w!==" ")break}let q=z.substring(K),L=q.indexOf(`
50
+ `);if(L===-1)H="-";else if(z===q||L!==q.length-1){if(H="+",J)J()}else H="";if(q){if(z=z.slice(0,-q.length),q[q.length-1]===`
51
+ `)q=q.slice(0,-1);q=q.replace(U7,`$&${G}`)}let B=!1,N,I=-1;for(N=0;N<z.length;++N){let w=z[N];if(w===" ")B=!0;else if(w===`
52
+ `)I=N;else break}let _=z.substring(0,I<N?I+1:N);if(_)z=z.substring(_.length),_=_.replace(/\n+/g,`$&${G}`);let E=(B?G?"2":"1":"")+H;if($){if(E+=" "+W($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let w=z.replace(/\n+/g,`
53
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${G}`),j=!1,u=y8(Q,!0);if(Y!=="folded"&&Z!==M2.Scalar.BLOCK_FOLDED)u.onOverflow=()=>{j=!0};let S=Z6.foldFlowLines(`${_}${w}${q}`,G,Z6.FOLD_BLOCK,u);if(!j)return`>${E}
54
54
  ${G}${S}`}return z=z.replace(/\n+/g,`$&${G}`),`|${E}
55
- ${G}${_}${z}${K}`}function PB($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:V}=Z;if(W&&J.includes(`
56
- `)||V&&/[[\]{},]/.test(J))return H$(J,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(J))return W||V||!J.includes(`
57
- `)?H$(J,Z):j8($,Z,z,Q);if(!W&&!V&&X!==K2.Scalar.PLAIN&&J.includes(`
58
- `))return j8($,Z,z,Q);if(x8(J)){if(U==="")return Z.forceBlockIndent=!0,j8($,Z,z,Q);else if(W&&U===G)return H$(J,Z)}let q=J.replace(/\n+/g,`$&
59
- ${U}`);if(Y){let H=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(q),{compat:K,tags:L}=Z.doc.schema;if(L.some(H)||K?.some(H))return H$(J,Z)}return W?q:e2.foldFlowLines(q,U,e2.FOLD_FLOW,w8(Z,!1))}function SB($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==K2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=K2.Scalar.QUOTE_DOUBLE}let U=(V)=>{switch(V){case K2.Scalar.BLOCK_FOLDED:case K2.Scalar.BLOCK_LITERAL:return X||J?H$(Y.value,Z):j8(Y,Z,z,Q);case K2.Scalar.QUOTE_DOUBLE:return C1(Y.value,Z);case K2.Scalar.QUOTE_SINGLE:return z7(Y.value,Z);case K2.Scalar.PLAIN:return PB(Y,Z,z,Q);default:return null}},G=U(W);if(G===null){let{defaultKeyType:V,defaultStringType:q}=Z.options,H=X&&V||q;if(G=U(H),G===null)throw Error(`Unsupported default string type ${H}`)}return G}EB.stringifyString=SB});var R1=F((hB)=>{var wB=F8(),$6=o(),xB=A1(),yB=_1();function kB($,Z){let z=Object.assign({blockQuote:!0,commentString:xB.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 bB($,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($6.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 vB($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=($6.isScalar($)||$6.isCollection($))&&$.anchor;if(J&&wB.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 gB($,Z,z,Q){if($6.isPair($))return $.toString(Z,z,Q);if($6.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=$6.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>X=U});X??(X=bB(Z.doc.schema.tags,J));let Y=vB(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):$6.isScalar(J)?yB.stringifyString(J,Z,z,Q):J.toString(Z,z,Q);if(!Y)return W;return $6.isScalar(J)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
- ${Z.indent}${W}`}hB.createStringifyContext=kB;hB.stringify=gB});var VX=F((cB)=>{var b2=o(),UX=L0(),GX=R1(),F1=A1();function mB({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:V,simpleKeys:q}}=z,H=b2.isNode($)&&$.comment||null;if(q){if(H)throw Error("With simple keys, key nodes cannot have comments");if(b2.isCollection($)||!b2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let K=!q&&(!$||H&&Z==null&&!z.inFlow||b2.isCollection($)||(b2.isScalar($)?$.type===UX.Scalar.BLOCK_FOLDED||$.type===UX.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!K&&(q||!J),indent:W+U});let L=!1,B=!1,N=GX.stringify($,z,()=>L=!0,()=>B=!0);if(!K&&!z.inFlow&&N.length>1024){if(q)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&&!q||Z==null&&K){if(N=`? ${N}`,H&&!L)N+=F1.lineComment(N,z.indent,G(H));else if(B&&X)X();return N}if(L)H=null;if(K){if(H)N+=F1.lineComment(N,z.indent,G(H));N=`? ${N}
61
- ${W}:`}else if(N=`${N}:`,H)N+=F1.lineComment(N,z.indent,G(H));let T,_,y;if(b2.isNode(Z))T=!!Z.spaceBefore,_=Z.commentBefore,y=Z.comment;else if(T=!1,_=null,y=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!K&&!H&&b2.isScalar(Z))z.indentAtStart=N.length+1;if(B=!1,!V&&U.length>=2&&!z.inFlow&&!K&&b2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let E=!1,w=GX.stringify(Z,z,()=>E=!0,()=>B=!0),j=" ";if(H||T||_){if(j=T?`
62
- `:"",_){let f=G(_);j+=`
63
- ${F1.indentComment(f,z.indent)}`}if(w===""&&!z.inFlow){if(j===`
55
+ ${G}${_}${z}${q}`}function mB($,Z,z,Q){let{type:X,value:J}=$,{actualString:Y,implicitKey:W,indent:U,indentStep:G,inFlow:V}=Z;if(W&&J.includes(`
56
+ `)||V&&/[[\]{},]/.test(J))return M$(J,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(J))return W||V||!J.includes(`
57
+ `)?M$(J,Z):x8($,Z,z,Q);if(!W&&!V&&X!==M2.Scalar.PLAIN&&J.includes(`
58
+ `))return x8($,Z,z,Q);if(k8(J)){if(U==="")return Z.forceBlockIndent=!0,x8($,Z,z,Q);else if(W&&U===G)return M$(J,Z)}let H=J.replace(/\n+/g,`$&
59
+ ${U}`);if(Y){let K=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(H),{compat:q,tags:L}=Z.doc.schema;if(L.some(K)||q?.some(K))return M$(J,Z)}return W?H:Z6.foldFlowLines(H,U,Z6.FOLD_FLOW,y8(Z,!1))}function cB($,Z,z,Q){let{implicitKey:X,inFlow:J}=Z,Y=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:W}=$;if(W!==M2.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Y.value))W=M2.Scalar.QUOTE_DOUBLE}let U=(V)=>{switch(V){case M2.Scalar.BLOCK_FOLDED:case M2.Scalar.BLOCK_LITERAL:return X||J?M$(Y.value,Z):x8(Y,Z,z,Q);case M2.Scalar.QUOTE_DOUBLE:return R1(Y.value,Z);case M2.Scalar.QUOTE_SINGLE:return W7(Y.value,Z);case M2.Scalar.PLAIN:return mB(Y,Z,z,Q);default:return null}},G=U(W);if(G===null){let{defaultKeyType:V,defaultStringType:H}=Z.options,K=X&&V||H;if(G=U(K),G===null)throw Error(`Unsupported default string type ${K}`)}return G}pB.stringifyString=cB});var P1=F((tB)=>{var dB=S8(),z6=t(),iB=_1(),nB=F1();function rB($,Z){let z=Object.assign({blockQuote:!0,commentString:iB.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 sB($,Z){if(Z.tag){let X=$.filter((J)=>J.tag===Z.tag);if(X.length>0)return X.find((J)=>J.format===Z.format)??X[0]}let z=void 0,Q;if(z6.isScalar(Z)){Q=Z.value;let X=$.filter((J)=>J.identify?.(Q));if(X.length>1){let J=X.filter((Y)=>Y.test);if(J.length>0)X=J}z=X.find((J)=>J.format===Z.format)??X.find((J)=>!J.format)}else Q=Z,z=$.find((X)=>X.nodeClass&&Q instanceof X.nodeClass);if(!z){let X=Q?.constructor?.name??(Q===null?"null":typeof Q);throw Error(`Tag not resolved for ${X} value`)}return z}function oB($,Z,{anchors:z,doc:Q}){if(!Q.directives)return"";let X=[],J=(z6.isScalar($)||z6.isCollection($))&&$.anchor;if(J&&dB.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 aB($,Z,z,Q){if(z6.isPair($))return $.toString(Z,z,Q);if(z6.isAlias($)){if(Z.doc.directives)return $.toString(Z);if(Z.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(Z.resolvedAliases)Z.resolvedAliases.add($);else Z.resolvedAliases=new Set([$]);$=$.resolve(Z.doc)}}let X=void 0,J=z6.isNode($)?$:Z.doc.createNode($,{onTagObj:(U)=>X=U});X??(X=sB(Z.doc.schema.tags,J));let Y=oB(J,X,Z);if(Y.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Y.length+1;let W=typeof X.stringify==="function"?X.stringify(J,Z,z,Q):z6.isScalar(J)?nB.stringifyString(J,Z,z,Q):J.toString(Z,z,Q);if(!Y)return W;return z6.isScalar(J)||W[0]==="{"||W[0]==="["?`${Y} ${W}`:`${Y}
60
+ ${Z.indent}${W}`}tB.createStringifyContext=rB;tB.stringify=aB});var OX=F((zM)=>{var g2=t(),LX=N0(),NX=P1(),S1=_1();function ZM({key:$,value:Z},z,Q,X){let{allNullValues:J,doc:Y,indent:W,indentStep:U,options:{commentString:G,indentSeq:V,simpleKeys:H}}=z,K=g2.isNode($)&&$.comment||null;if(H){if(K)throw Error("With simple keys, key nodes cannot have comments");if(g2.isCollection($)||!g2.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let q=!H&&(!$||K&&Z==null&&!z.inFlow||g2.isCollection($)||(g2.isScalar($)?$.type===LX.Scalar.BLOCK_FOLDED||$.type===LX.Scalar.BLOCK_LITERAL:typeof $==="object"));z=Object.assign({},z,{allNullValues:!1,implicitKey:!q&&(H||!J),indent:W+U});let L=!1,B=!1,N=NX.stringify($,z,()=>L=!0,()=>B=!0);if(!q&&!z.inFlow&&N.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");q=!0}if(z.inFlow){if(J||Z==null){if(L&&Q)Q();return N===""?"?":q?`? ${N}`:N}}else if(J&&!H||Z==null&&q){if(N=`? ${N}`,K&&!L)N+=S1.lineComment(N,z.indent,G(K));else if(B&&X)X();return N}if(L)K=null;if(q){if(K)N+=S1.lineComment(N,z.indent,G(K));N=`? ${N}
61
+ ${W}:`}else if(N=`${N}:`,K)N+=S1.lineComment(N,z.indent,G(K));let I,_,y;if(g2.isNode(Z))I=!!Z.spaceBefore,_=Z.commentBefore,y=Z.comment;else if(I=!1,_=null,y=null,Z&&typeof Z==="object")Z=Y.createNode(Z);if(z.implicitKey=!1,!q&&!K&&g2.isScalar(Z))z.indentAtStart=N.length+1;if(B=!1,!V&&U.length>=2&&!z.inFlow&&!q&&g2.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)z.indent=z.indent.substring(2);let E=!1,w=NX.stringify(Z,z,()=>E=!0,()=>B=!0),j=" ";if(K||I||_){if(j=I?`
62
+ `:"",_){let u=G(_);j+=`
63
+ ${S1.indentComment(u,z.indent)}`}if(w===""&&!z.inFlow){if(j===`
64
64
  `&&y)j=`
65
65
 
66
66
  `}else j+=`
67
- ${z.indent}`}else if(!K&&b2.isCollection(Z)){let f=w[0],S=w.indexOf(`
68
- `),d=S!==-1,I0=z.inFlow??Z.flow??Z.items.length===0;if(d||!I0){let E0=!1;if(d&&(f==="&"||f==="!")){let $0=w.indexOf(" ");if(f==="&"&&$0!==-1&&$0<S&&w[$0+1]==="!")$0=w.indexOf(" ",$0+1);if($0===-1||S<$0)E0=!0}if(!E0)j=`
67
+ ${z.indent}`}else if(!q&&g2.isCollection(Z)){let u=w[0],S=w.indexOf(`
68
+ `),d=S!==-1,T0=z.inFlow??Z.flow??Z.items.length===0;if(d||!T0){let j0=!1;if(d&&(u==="&"||u==="!")){let Z0=w.indexOf(" ");if(u==="&"&&Z0!==-1&&Z0<S&&w[Z0+1]==="!")Z0=w.indexOf(" ",Z0+1);if(Z0===-1||S<Z0)j0=!0}if(!j0)j=`
69
69
  ${z.indent}`}}else if(w===""||w[0]===`
70
- `)j="";if(N+=j+w,z.inFlow){if(E&&Q)Q()}else if(y&&!E)N+=F1.lineComment(N,z.indent,G(y));else if(B&&X)X();return N}cB.stringifyPair=mB});var X7=F((iB)=>{var qX=i0("process");function lB($,...Z){if($==="debug")console.log(...Z)}function dB($,Z){if($==="debug"||$==="warn")if(typeof qX.emitWarning==="function")qX.emitWarning(Z);else console.warn(Z)}iB.debug=lB;iB.warn=dB});var v8=F((oB)=>{var b8=o(),HX=L0(),y8="<<",k8={identify:($)=>$===y8||typeof $==="symbol"&&$.description===y8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new HX.Scalar(Symbol(y8)),{addToJSMap:KX}),stringify:()=>y8},sB=($,Z)=>(k8.identify(Z)||b8.isScalar(Z)&&(!Z.type||Z.type===HX.Scalar.PLAIN)&&k8.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===k8.tag&&z.default);function KX($,Z,z){let Q=BX($,z);if(b8.isSeq(Q))for(let X of Q.items)J7($,Z,X);else if(Array.isArray(Q))for(let X of Q)J7($,Z,X);else J7($,Z,Q)}function J7($,Z,z){let Q=BX($,z);if(!b8.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 BX($,Z){return $&&b8.isAlias(Z)?Z.resolve($.doc,$):Z}oB.addMergeToJSMap=KX;oB.isMergeKey=sB;oB.merge=k8});var W7=F((XM)=>{var $M=X7(),MX=v8(),ZM=R1(),LX=o(),Y7=t2();function zM($,Z,{key:z,value:Q}){if(LX.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(MX.isMergeKey($,z))MX.addMergeToJSMap($,Z,Q);else{let X=Y7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,Y7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=QM(z,X,$),Y=Y7.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 QM($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(LX.isNode($)&&z?.doc){let Q=ZM.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)+'..."';$M.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)}XM.addPairToJSMap=zM});var Z6=F((GM)=>{var NX=T1(),YM=VX(),WM=W7(),g8=o();function UM($,Z,z){let Q=NX.createNode($,void 0,z),X=NX.createNode(Z,void 0,z);return new h8(Q,X)}class h8{constructor($,Z=null){Object.defineProperty(this,g8.NODE_TYPE,{value:g8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(g8.isNode(Z))Z=Z.clone($);if(g8.isNode(z))z=z.clone($);return new h8(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return WM.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?YM.stringifyPair(this,$,Z,z):JSON.stringify(this)}}GM.Pair=h8;GM.createPair=UM});var U7=F((MM)=>{var E6=o(),OX=R1(),f8=A1();function HM($,Z,z){return(Z.inFlow??$.flow?BM:KM)($,Z,z)}function KM({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}),q=!1,H=[];for(let L=0;L<Z.length;++L){let B=Z[L],N=null;if(E6.isNode(B)){if(!q&&B.spaceBefore)H.push("");if(u8(z,H,B.commentBefore,q),B.comment)N=B.comment}else if(E6.isPair(B)){let _=E6.isNode(B.key)?B.key:null;if(_){if(!q&&_.spaceBefore)H.push("");u8(z,H,_.commentBefore,q)}}q=!1;let T=OX.stringify(B,V,()=>N=null,()=>q=!0);if(N)T+=f8.lineComment(T,J,G(N));if(q&&N)q=!1;H.push(Q+T)}let K;if(H.length===0)K=X.start+X.end;else{K=H[0];for(let L=1;L<H.length;++L){let B=H[L];K+=B?`
70
+ `)j="";if(N+=j+w,z.inFlow){if(E&&Q)Q()}else if(y&&!E)N+=S1.lineComment(N,z.indent,G(y));else if(B&&X)X();return N}zM.stringifyPair=ZM});var G7=F((YM)=>{var DX=n0("process");function XM($,...Z){if($==="debug")console.log(...Z)}function JM($,Z){if($==="debug"||$==="warn")if(typeof DX.emitWarning==="function")DX.emitWarning(Z);else console.warn(Z)}YM.debug=XM;YM.warn=JM});var h8=F((VM)=>{var g8=t(),IX=N0(),b8="<<",v8={identify:($)=>$===b8||typeof $==="symbol"&&$.description===b8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new IX.Scalar(Symbol(b8)),{addToJSMap:TX}),stringify:()=>b8},GM=($,Z)=>(v8.identify(Z)||g8.isScalar(Z)&&(!Z.type||Z.type===IX.Scalar.PLAIN)&&v8.identify(Z.value))&&$?.doc.schema.tags.some((z)=>z.tag===v8.tag&&z.default);function TX($,Z,z){let Q=AX($,z);if(g8.isSeq(Q))for(let X of Q.items)V7($,Z,X);else if(Array.isArray(Q))for(let X of Q)V7($,Z,X);else V7($,Z,Q)}function V7($,Z,z){let Q=AX($,z);if(!g8.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 AX($,Z){return $&&g8.isAlias(Z)?Z.resolve($.doc,$):Z}VM.addMergeToJSMap=TX;VM.isMergeKey=GM;VM.merge=v8});var K7=F((OM)=>{var BM=G7(),CX=h8(),MM=P1(),_X=t(),H7=$6();function LM($,Z,{key:z,value:Q}){if(_X.isNode(z)&&z.addToJSMap)z.addToJSMap($,Z,Q);else if(CX.isMergeKey($,z))CX.addMergeToJSMap($,Z,Q);else{let X=H7.toJS(z,"",$);if(Z instanceof Map)Z.set(X,H7.toJS(Q,X,$));else if(Z instanceof Set)Z.add(X);else{let J=NM(z,X,$),Y=H7.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 NM($,Z,z){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(_X.isNode($)&&z?.doc){let Q=MM.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)+'..."';BM.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)}OM.addPairToJSMap=LM});var Q6=F((CM)=>{var RX=C1(),IM=OX(),TM=K7(),f8=t();function AM($,Z,z){let Q=RX.createNode($,void 0,z),X=RX.createNode(Z,void 0,z);return new u8(Q,X)}class u8{constructor($,Z=null){Object.defineProperty(this,f8.NODE_TYPE,{value:f8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:z}=this;if(f8.isNode(Z))Z=Z.clone($);if(f8.isNode(z))z=z.clone($);return new u8(Z,z)}toJSON($,Z){let z=Z?.mapAsMap?new Map:{};return TM.addPairToJSMap(Z,z,this)}toString($,Z,z){return $?.doc?IM.stringifyPair(this,$,Z,z):JSON.stringify(this)}}CM.Pair=u8;CM.createPair=AM});var q7=F((EM)=>{var j6=t(),FX=P1(),m8=_1();function FM($,Z,z){return(Z.inFlow??$.flow?SM:PM)($,Z,z)}function PM({comment:$,items:Z},z,{blockItemPrefix:Q,flowChars:X,itemIndent:J,onChompKeep:Y,onComment:W}){let{indent:U,options:{commentString:G}}=z,V=Object.assign({},z,{indent:J,type:null}),H=!1,K=[];for(let L=0;L<Z.length;++L){let B=Z[L],N=null;if(j6.isNode(B)){if(!H&&B.spaceBefore)K.push("");if(c8(z,K,B.commentBefore,H),B.comment)N=B.comment}else if(j6.isPair(B)){let _=j6.isNode(B.key)?B.key:null;if(_){if(!H&&_.spaceBefore)K.push("");c8(z,K,_.commentBefore,H)}}H=!1;let I=FX.stringify(B,V,()=>N=null,()=>H=!0);if(N)I+=m8.lineComment(I,J,G(N));if(H&&N)H=!1;K.push(Q+I)}let q;if(K.length===0)q=X.start+X.end;else{q=K[0];for(let L=1;L<K.length;++L){let B=K[L];q+=B?`
71
71
  ${U}${B}`:`
72
- `}}if($){if(K+=`
73
- `+f8.indentComment(G($),U),W)W()}else if(q&&Y)Y();return K}function BM({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,q=[];for(let L=0;L<$.length;++L){let B=$[L],N=null;if(E6.isNode(B)){if(B.spaceBefore)q.push("");if(u8(Z,q,B.commentBefore,!1),B.comment)N=B.comment}else if(E6.isPair(B)){let _=E6.isNode(B.key)?B.key:null;if(_){if(_.spaceBefore)q.push("");if(u8(Z,q,_.commentBefore,!1),_.comment)G=!0}let y=E6.isNode(B.value)?B.value:null;if(y){if(y.comment)N=y.comment;if(y.commentBefore)G=!0}else if(B.value==null&&_?.comment)N=_.comment}if(N)G=!0;let T=OX.stringify(B,U,()=>N=null);if(G||(G=q.length>V||T.includes(`
74
- `)),L<$.length-1)T+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=q.reduce((_,y)=>_+y.length+2,2)+(T.length+2)>Z.options.lineWidth);if(G)T+=","}if(N)T+=f8.lineComment(T,Q,W(N));q.push(T),V=q.length}let{start:H,end:K}=z;if(q.length===0)return H+K;else{if(!G){let L=q.reduce((B,N)=>B+N.length+2,2);G=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(G){let L=H;for(let B of q)L+=B?`
72
+ `}}if($){if(q+=`
73
+ `+m8.indentComment(G($),U),W)W()}else if(H&&Y)Y();return q}function SM({items:$},Z,{flowChars:z,itemIndent:Q}){let{indent:X,indentStep:J,flowCollectionPadding:Y,options:{commentString:W}}=Z;Q+=J;let U=Object.assign({},Z,{indent:Q,inFlow:!0,type:null}),G=!1,V=0,H=[];for(let L=0;L<$.length;++L){let B=$[L],N=null;if(j6.isNode(B)){if(B.spaceBefore)H.push("");if(c8(Z,H,B.commentBefore,!1),B.comment)N=B.comment}else if(j6.isPair(B)){let _=j6.isNode(B.key)?B.key:null;if(_){if(_.spaceBefore)H.push("");if(c8(Z,H,_.commentBefore,!1),_.comment)G=!0}let y=j6.isNode(B.value)?B.value:null;if(y){if(y.comment)N=y.comment;if(y.commentBefore)G=!0}else if(B.value==null&&_?.comment)N=_.comment}if(N)G=!0;let I=FX.stringify(B,U,()=>N=null);if(G||(G=H.length>V||I.includes(`
74
+ `)),L<$.length-1)I+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)G||(G=H.reduce((_,y)=>_+y.length+2,2)+(I.length+2)>Z.options.lineWidth);if(G)I+=","}if(N)I+=m8.lineComment(I,Q,W(N));H.push(I),V=H.length}let{start:K,end:q}=z;if(H.length===0)return K+q;else{if(!G){let L=H.reduce((B,N)=>B+N.length+2,2);G=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(G){let L=K;for(let B of H)L+=B?`
75
75
  ${J}${X}${B}`:`
76
76
  `;return`${L}
77
- ${X}${K}`}else return`${H}${Y}${q.join(" ")}${Y}${K}`}}function u8({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=f8.indentComment(Z(Q),$);z.push(J.trimStart())}}MM.stringifyCollection=HM});var Q6=F((TM)=>{var NM=U7(),OM=W7(),DM=E8(),z6=o(),m8=Z6(),IM=L0();function P1($,Z){let z=z6.isScalar(Z)?Z.value:Z;for(let Q of $)if(z6.isPair(Q)){if(Q.key===Z||Q.key===z)return Q;if(z6.isScalar(Q.key)&&Q.key.value===z)return Q}return}class DX extends DM.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(z6.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(m8.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(z6.isPair($))z=$;else if(!$||typeof $!=="object"||!("key"in $))z=new m8.Pair($,$?.value);else z=new m8.Pair($.key,$.value);let Q=P1(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if(z6.isScalar(Q.value)&&IM.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=P1(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=P1(this.items,$)?.value;return(!Z&&z6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!P1(this.items,$)}set($,Z){this.add(new m8.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)OM.addPairToJSMap(Z,Q,X);return Q}toString($,Z,z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!z6.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 NM.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}TM.YAMLMap=DX;TM.findPair=P1});var K$=F((FM)=>{var _M=o(),IX=Q6(),RM={collection:"map",default:!0,nodeClass:IX.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!_M.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>IX.YAMLMap.from($,Z,z)};FM.map=RM});var X6=F((yM)=>{var SM=T1(),EM=U7(),jM=E8(),p8=o(),wM=L0(),xM=t2();class TX extends jM.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(p8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=c8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=c8($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&p8.isScalar(Q)?Q.value:Q}has($){let Z=c8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=c8($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(p8.isScalar(Q)&&wM.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(xM.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return EM.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(SM.createNode(Y,void 0,z))}}return X}}function c8($){let Z=p8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}yM.YAMLSeq=TX});var B$=F((gM)=>{var bM=o(),AX=X6(),vM={collection:"seq",default:!0,nodeClass:AX.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!bM.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>AX.YAMLSeq.from($,Z,z)};gM.seq=vM});var S1=F((mM)=>{var fM=_1(),uM={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),fM.stringifyString($,Z,z,Q)}};mM.string=uM});var l8=F((pM)=>{var CX=L0(),_X={identify:($)=>$==null,createNode:()=>new CX.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new CX.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&_X.test.test($)?$:Z.options.nullStr};pM.nullTag=_X});var G7=F((iM)=>{var dM=L0(),RX={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new dM.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&RX.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};iM.boolTag=RX});var M$=F((sM)=>{function rM({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}sM.stringifyNumber=rM});var q7=F((ZL)=>{var aM=L0(),V7=M$(),tM={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:V7.stringifyNumber},eM={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():V7.stringifyNumber($)}},$L={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new aM.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:V7.stringifyNumber};ZL.float=$L;ZL.floatExp=eM;ZL.floatNaN=tM});var K7=F((UL)=>{var FX=M$(),d8=($)=>typeof $==="bigint"||Number.isInteger($),H7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function PX($,Z,z){let{value:Q}=$;if(d8(Q)&&Q>=0)return z+Q.toString(Z);return FX.stringifyNumber($)}var JL={identify:($)=>d8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>H7($,2,8,z),stringify:($)=>PX($,8,"0o")},YL={identify:d8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>H7($,0,10,z),stringify:FX.stringifyNumber},WL={identify:($)=>d8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>H7($,2,16,z),stringify:($)=>PX($,16,"0x")};UL.int=YL;UL.intHex=WL;UL.intOct=JL});var SX=F((OL)=>{var HL=K$(),KL=l8(),BL=B$(),ML=S1(),LL=G7(),B7=q7(),M7=K7(),NL=[HL.map,BL.seq,ML.string,KL.nullTag,LL.boolTag,M7.intOct,M7.int,M7.intHex,B7.floatNaN,B7.floatExp,B7.float];OL.schema=NL});var jX=F((FL)=>{var IL=L0(),TL=K$(),AL=B$();function EX($){return typeof $==="bigint"||Number.isInteger($)}var i8=({value:$})=>JSON.stringify($),CL=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:i8},{identify:($)=>$==null,createNode:()=>new IL.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:i8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:i8},{identify:EX,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>EX($)?$.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:i8}],_L={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},RL=[TL.map,AL.seq].concat(CL,_L);FL.schema=RL});var N7=F((jL)=>{var E1=i0("buffer"),L7=L0(),SL=_1(),EL={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof E1.Buffer==="function")return E1.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 E1.Buffer==="function")W=Y instanceof E1.Buffer?Y.toString("base64"):E1.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=L7.Scalar.BLOCK_LITERAL),Z!==L7.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 q=0,H=0;q<G;++q,H+=U)V[q]=W.substr(H,U);W=V.join(Z===L7.Scalar.BLOCK_LITERAL?`
78
- `:" ")}return SL.stringifyString({comment:$,type:Z,value:W},Q,X,J)}};jL.binary=EL});var r8=F((bL)=>{var n8=o(),O7=Z6(),xL=L0(),yL=X6();function wX($,Z){if(n8.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if(n8.isPair(Q))continue;else if(n8.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new O7.Pair(new xL.Scalar(null));if(Q.commentBefore)X.key.commentBefore=X.key.commentBefore?`${Q.commentBefore}
77
+ ${X}${q}`}else return`${K}${Y}${H.join(" ")}${Y}${q}`}}function c8({indent:$,options:{commentString:Z}},z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let J=m8.indentComment(Z(Q),$);z.push(J.trimStart())}}EM.stringifyCollection=FM});var J6=F((bM)=>{var wM=q7(),xM=K7(),yM=w8(),X6=t(),p8=Q6(),kM=N0();function E1($,Z){let z=X6.isScalar(Z)?Z.value:Z;for(let Q of $)if(X6.isPair(Q)){if(Q.key===Z||Q.key===z)return Q;if(X6.isScalar(Q.key)&&Q.key.value===z)return Q}return}class PX extends yM.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(X6.MAP,$);this.items=[]}static from($,Z,z){let{keepUndefined:Q,replacer:X}=z,J=new this($),Y=(W,U)=>{if(typeof X==="function")U=X.call(Z,W,U);else if(Array.isArray(X)&&!X.includes(W))return;if(U!==void 0||Q)J.items.push(p8.createPair(W,U,z))};if(Z instanceof Map)for(let[W,U]of Z)Y(W,U);else if(Z&&typeof Z==="object")for(let W of Object.keys(Z))Y(W,Z[W]);if(typeof $.sortMapEntries==="function")J.items.sort($.sortMapEntries);return J}add($,Z){let z;if(X6.isPair($))z=$;else if(!$||typeof $!=="object"||!("key"in $))z=new p8.Pair($,$?.value);else z=new p8.Pair($.key,$.value);let Q=E1(this.items,z.key),X=this.schema?.sortMapEntries;if(Q){if(!Z)throw Error(`Key ${z.key} already set`);if(X6.isScalar(Q.value)&&kM.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=E1(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let Q=E1(this.items,$)?.value;return(!Z&&X6.isScalar(Q)?Q.value:Q)??void 0}has($){return!!E1(this.items,$)}set($,Z){this.add(new p8.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)xM.addPairToJSMap(Z,Q,X);return Q}toString($,Z,z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!X6.isPair(Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(Q)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return wM.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:z,onComment:Z})}}bM.YAMLMap=PX;bM.findPair=E1});var L$=F((uM)=>{var hM=t(),SX=J6(),fM={collection:"map",default:!0,nodeClass:SX.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!hM.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,z)=>SX.YAMLMap.from($,Z,z)};uM.map=fM});var Y6=F((nM)=>{var cM=C1(),pM=q7(),lM=w8(),d8=t(),dM=N0(),iM=$6();class EX extends lM.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(d8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=l8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let z=l8($);if(typeof z!=="number")return;let Q=this.items[z];return!Z&&d8.isScalar(Q)?Q.value:Q}has($){let Z=l8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let z=l8($);if(typeof z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[z];if(d8.isScalar(Q)&&dM.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(iM.toJS(X,String(Q++),Z));return z}toString($,Z,z){if(!$)return JSON.stringify(this);return pM.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(cM.createNode(Y,void 0,z))}}return X}}function l8($){let Z=d8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}nM.YAMLSeq=EX});var N$=F((aM)=>{var sM=t(),jX=Y6(),oM={collection:"seq",default:!0,nodeClass:jX.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!sM.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,z)=>jX.YAMLSeq.from($,Z,z)};aM.seq=oM});var j1=F((ZL)=>{var eM=F1(),$L={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,z,Q){return Z=Object.assign({actualString:!0},Z),eM.stringifyString($,Z,z,Q)}};ZL.string=$L});var i8=F((QL)=>{var wX=N0(),xX={identify:($)=>$==null,createNode:()=>new wX.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new wX.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&xX.test.test($)?$:Z.options.nullStr};QL.nullTag=xX});var B7=F((YL)=>{var JL=N0(),yX={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new JL.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},z){if($&&yX.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(Z===Q)return $}return Z?z.options.trueStr:z.options.falseStr}};YL.boolTag=yX});var O$=F((GL)=>{function UL({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}GL.stringifyNumber=UL});var L7=F((ML)=>{var HL=N0(),M7=O$(),KL={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},qL={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():M7.stringifyNumber($)}},BL={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new HL.Scalar(parseFloat($)),z=$.indexOf(".");if(z!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-z-1;return Z},stringify:M7.stringifyNumber};ML.float=BL;ML.floatExp=qL;ML.floatNaN=KL});var O7=F((AL)=>{var kX=O$(),n8=($)=>typeof $==="bigint"||Number.isInteger($),N7=($,Z,z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(Z),z);function bX($,Z,z){let{value:Q}=$;if(n8(Q)&&Q>=0)return z+Q.toString(Z);return kX.stringifyNumber($)}var DL={identify:($)=>n8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,z)=>N7($,2,8,z),stringify:($)=>bX($,8,"0o")},IL={identify:n8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,z)=>N7($,0,10,z),stringify:kX.stringifyNumber},TL={identify:($)=>n8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,z)=>N7($,2,16,z),stringify:($)=>bX($,16,"0x")};AL.int=IL;AL.intHex=TL;AL.intOct=DL});var vX=F((xL)=>{var FL=L$(),PL=i8(),SL=N$(),EL=j1(),jL=B7(),D7=L7(),I7=O7(),wL=[FL.map,SL.seq,EL.string,PL.nullTag,jL.boolTag,I7.intOct,I7.int,I7.intHex,D7.floatNaN,D7.floatExp,D7.float];xL.schema=wL});var hX=F((uL)=>{var kL=N0(),bL=L$(),vL=N$();function gX($){return typeof $==="bigint"||Number.isInteger($)}var r8=({value:$})=>JSON.stringify($),gL=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:r8},{identify:($)=>$==null,createNode:()=>new kL.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:r8},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:r8},{identify:gX,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($,10),stringify:({value:$})=>gX($)?$.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:r8}],hL={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},fL=[bL.map,vL.seq].concat(gL,hL);uL.schema=fL});var A7=F((lL)=>{var w1=n0("buffer"),T7=N0(),cL=F1(),pL={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof w1.Buffer==="function")return w1.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 w1.Buffer==="function")W=Y instanceof w1.Buffer?Y.toString("base64"):w1.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=T7.Scalar.BLOCK_LITERAL),Z!==T7.Scalar.QUOTE_DOUBLE){let U=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),G=Math.ceil(W.length/U),V=Array(G);for(let H=0,K=0;H<G;++H,K+=U)V[H]=W.substr(K,U);W=V.join(Z===T7.Scalar.BLOCK_LITERAL?`
78
+ `:" ")}return cL.stringifyString({comment:$,type:Z,value:W},Q,X,J)}};lL.binary=pL});var o8=F((sL)=>{var s8=t(),C7=Q6(),iL=N0(),nL=Y6();function fX($,Z){if(s8.isSeq($))for(let z=0;z<$.items.length;++z){let Q=$.items[z];if(s8.isPair(Q))continue;else if(s8.isMap(Q)){if(Q.items.length>1)Z("Each pair must have its own sequence indicator");let X=Q.items[0]||new C7.Pair(new iL.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]=n8.isPair(Q)?Q:new O7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function xX($,Z,z){let{replacer:Q}=z,X=new yL.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(O7.createPair(W,U,z))}return X}var kL={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:wX,createNode:xX};bL.createPairs=xX;bL.pairs=kL;bL.resolvePairs=wX});var I7=F((mL)=>{var yX=o(),D7=t2(),j1=Q6(),fL=X6(),kX=r8();class j6 extends fL.YAMLSeq{constructor(){super();this.add=j1.YAMLMap.prototype.add.bind(this),this.delete=j1.YAMLMap.prototype.delete.bind(this),this.get=j1.YAMLMap.prototype.get.bind(this),this.has=j1.YAMLMap.prototype.has.bind(this),this.set=j1.YAMLMap.prototype.set.bind(this),this.tag=j6.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(yX.isPair(Q))X=D7.toJS(Q.key,"",Z),J=D7.toJS(Q.value,X,Z);else X=D7.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=kX.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}j6.tag="tag:yaml.org,2002:omap";var uL={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:j6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=kX.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(yX.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 j6,z)},createNode:($,Z,z)=>j6.from($,Z,z)};mL.YAMLOMap=j6;mL.omap=uL});var fX=F((lL)=>{var bX=L0();function vX({value:$,source:Z},z){if(Z&&($?gX:hX).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var gX={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new bX.Scalar(!0),stringify:vX},hX={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new bX.Scalar(!1),stringify:vX};lL.falseTag=hX;lL.trueTag=gX});var uX=F((aL)=>{var nL=L0(),T7=M$(),rL={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:T7.stringifyNumber},sL={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():T7.stringifyNumber($)}},oL={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new nL.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:T7.stringifyNumber};aL.float=oL;aL.floatExp=sL;aL.floatNaN=rL});var cX=F((JN)=>{var mX=M$(),w1=($)=>typeof $==="bigint"||Number.isInteger($);function s8($,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 A7($,Z,z){let{value:Q}=$;if(w1(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return mX.stringifyNumber($)}var ZN={identify:w1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>s8($,2,2,z),stringify:($)=>A7($,2,"0b")},zN={identify:w1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>s8($,1,8,z),stringify:($)=>A7($,8,"0")},QN={identify:w1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>s8($,0,10,z),stringify:mX.stringifyNumber},XN={identify:w1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>s8($,2,16,z),stringify:($)=>A7($,16,"0x")};JN.int=QN;JN.intBin=ZN;JN.intHex=XN;JN.intOct=zN});var C7=F((qN)=>{var t8=o(),o8=Z6(),a8=Q6();class w6 extends a8.YAMLMap{constructor($){super($);this.tag=w6.tag}add($){let Z;if(t8.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new o8.Pair($.key,null);else Z=new o8.Pair($,null);if(!a8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=a8.findPair(this.items,$);return!Z&&t8.isPair(z)?t8.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=a8.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new o8.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(o8.createPair(J,null,z))}return X}}w6.tag="tag:yaml.org,2002:set";var VN={collection:"map",identify:($)=>$ instanceof Set,nodeClass:w6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>w6.from($,Z,z),resolve($,Z){if(t8.isMap($))if($.hasAllNullValues(!0))return Object.assign(new w6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};qN.YAMLSet=w6;qN.set=VN});var R7=F((NN)=>{var BN=M$();function _7($,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 pX($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return BN.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 MN={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})=>_7($,z),stringify:pX},LN={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:($)=>_7($,!1),stringify:pX},lX={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(lX.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 q=_7(V,!1);if(Math.abs(q)<30)q*=60;G-=60000*q}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};NN.floatTime=LN;NN.intTime=MN;NN.timestamp=lX});var iX=F((wN)=>{var TN=K$(),AN=l8(),CN=B$(),_N=S1(),RN=N7(),dX=fX(),F7=uX(),e8=cX(),FN=v8(),PN=I7(),SN=r8(),EN=C7(),P7=R7(),jN=[TN.map,CN.seq,_N.string,AN.nullTag,dX.trueTag,dX.falseTag,e8.intBin,e8.intOct,e8.int,e8.intHex,F7.floatNaN,F7.floatExp,F7.float,RN.binary,FN.merge,PN.omap,SN.pairs,EN.set,P7.intTime,P7.floatTime,P7.timestamp];wN.schema=jN});var zJ=F((uN)=>{var oX=K$(),yN=l8(),aX=B$(),kN=S1(),bN=G7(),S7=q7(),E7=K7(),vN=SX(),gN=jX(),tX=N7(),x1=v8(),eX=I7(),$J=r8(),nX=iX(),ZJ=C7(),$5=R7(),rX=new Map([["core",vN.schema],["failsafe",[oX.map,aX.seq,kN.string]],["json",gN.schema],["yaml11",nX.schema],["yaml-1.1",nX.schema]]),sX={binary:tX.binary,bool:bN.boolTag,float:S7.float,floatExp:S7.floatExp,floatNaN:S7.floatNaN,floatTime:$5.floatTime,int:E7.int,intHex:E7.intHex,intOct:E7.intOct,intTime:$5.intTime,map:oX.map,merge:x1.merge,null:yN.nullTag,omap:eX.omap,pairs:$J.pairs,seq:aX.seq,set:ZJ.set,timestamp:$5.timestamp},hN={"tag:yaml.org,2002:binary":tX.binary,"tag:yaml.org,2002:merge":x1.merge,"tag:yaml.org,2002:omap":eX.omap,"tag:yaml.org,2002:pairs":$J.pairs,"tag:yaml.org,2002:set":ZJ.set,"tag:yaml.org,2002:timestamp":$5.timestamp};function fN($,Z,z){let Q=rX.get(Z);if(Q&&!$)return z&&!Q.includes(x1.merge)?Q.concat(x1.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(rX.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(x1.merge);return X.reduce((J,Y)=>{let W=typeof Y==="string"?sX[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(sX).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},[])}uN.coreKnownTags=hN;uN.getTags=fN});var x7=F((nN)=>{var j7=o(),pN=K$(),lN=B$(),dN=S1(),Z5=zJ(),iN=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class w7{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?Z5.getTags($,"compat"):$?Z5.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?Z5.coreKnownTags:{},this.tags=Z5.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,j7.MAP,{value:pN.map}),Object.defineProperty(this,j7.SCALAR,{value:dN.string}),Object.defineProperty(this,j7.SEQ,{value:lN.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?iN:null}clone(){let $=Object.create(w7.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}nN.Schema=w7});var QJ=F((aN)=>{var sN=o(),y7=R1(),y1=A1();function oN($,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=y7.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let U=J($.commentBefore);z.unshift(y1.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(sN.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(y1.indentComment(V,""))}X.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=y7.stringify($.contents,X,()=>W=null,U);if(W)G+=y1.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(y7.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let U=J($.comment);if(U.includes(`
81
- `))z.push("..."),z.push(y1.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(y1.indentComment(J(U),""))}}return z.join(`
80
+ ${J.comment}`:Q.comment}Q=X}$.items[z]=s8.isPair(Q)?Q:new C7.Pair(Q)}else Z("Expected a sequence for this tag");return $}function uX($,Z,z){let{replacer:Q}=z,X=new nL.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(C7.createPair(W,U,z))}return X}var rL={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:fX,createNode:uX};sL.createPairs=uX;sL.pairs=rL;sL.resolvePairs=fX});var R7=F((ZN)=>{var mX=t(),_7=$6(),x1=J6(),eL=Y6(),cX=o8();class w6 extends eL.YAMLSeq{constructor(){super();this.add=x1.YAMLMap.prototype.add.bind(this),this.delete=x1.YAMLMap.prototype.delete.bind(this),this.get=x1.YAMLMap.prototype.get.bind(this),this.has=x1.YAMLMap.prototype.has.bind(this),this.set=x1.YAMLMap.prototype.set.bind(this),this.tag=w6.tag}toJSON($,Z){if(!Z)return super.toJSON($);let z=new Map;if(Z?.onCreate)Z.onCreate(z);for(let Q of this.items){let X,J;if(mX.isPair(Q))X=_7.toJS(Q.key,"",Z),J=_7.toJS(Q.value,X,Z);else X=_7.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=cX.createPairs($,Z,z),X=new this;return X.items=Q.items,X}}w6.tag="tag:yaml.org,2002:omap";var $N={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:w6,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let z=cX.resolvePairs($,Z),Q=[];for(let{key:X}of z.items)if(mX.isScalar(X))if(Q.includes(X.value))Z(`Ordered maps must not include duplicate keys: ${X.value}`);else Q.push(X.value);return Object.assign(new w6,z)},createNode:($,Z,z)=>w6.from($,Z,z)};ZN.YAMLOMap=w6;ZN.omap=$N});var nX=F((XN)=>{var pX=N0();function lX({value:$,source:Z},z){if(Z&&($?dX:iX).test.test(Z))return Z;return $?z.options.trueStr:z.options.falseStr}var dX={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new pX.Scalar(!0),stringify:lX},iX={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new pX.Scalar(!1),stringify:lX};XN.falseTag=iX;XN.trueTag=dX});var rX=F((HN)=>{var WN=N0(),F7=O$(),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:F7.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($.replace(/_/g,"")),stringify($){let Z=Number($.value);return isFinite(Z)?Z.toExponential():F7.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($.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:F7.stringifyNumber};HN.float=VN;HN.floatExp=GN;HN.floatNaN=UN});var oX=F((DN)=>{var sX=O$(),y1=($)=>typeof $==="bigint"||Number.isInteger($);function a8($,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 P7($,Z,z){let{value:Q}=$;if(y1(Q)){let X=Q.toString(Z);return Q<0?"-"+z+X.substr(1):z+X}return sX.stringifyNumber($)}var MN={identify:y1,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,z)=>a8($,2,2,z),stringify:($)=>P7($,2,"0b")},LN={identify:y1,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,z)=>a8($,1,8,z),stringify:($)=>P7($,8,"0")},NN={identify:y1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,z)=>a8($,0,10,z),stringify:sX.stringifyNumber},ON={identify:y1,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,z)=>a8($,2,16,z),stringify:($)=>P7($,16,"0x")};DN.int=NN;DN.intBin=MN;DN.intHex=ON;DN.intOct=LN});var S7=F((RN)=>{var $5=t(),t8=Q6(),e8=J6();class x6 extends e8.YAMLMap{constructor($){super($);this.tag=x6.tag}add($){let Z;if($5.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new t8.Pair($.key,null);else Z=new t8.Pair($,null);if(!e8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let z=e8.findPair(this.items,$);return!Z&&$5.isPair(z)?$5.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=e8.findPair(this.items,$);if(z&&!Z)this.items.splice(this.items.indexOf(z),1);else if(!z&&Z)this.items.push(new t8.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(t8.createPair(J,null,z))}return X}}x6.tag="tag:yaml.org,2002:set";var _N={collection:"map",identify:($)=>$ instanceof Set,nodeClass:x6,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,z)=>x6.from($,Z,z),resolve($,Z){if($5.isMap($))if($.hasAllNullValues(!0))return Object.assign(new x6,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};RN.YAMLSet=x6;RN.set=_N});var j7=F((wN)=>{var SN=O$();function E7($,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 aX($){let{value:Z}=$,z=(Y)=>Y;if(typeof Z==="bigint")z=(Y)=>BigInt(Y);else if(isNaN(Z)||!isFinite(Z))return SN.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 EN={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})=>E7($,z),stringify:aX},jN={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:($)=>E7($,!1),stringify:aX},tX={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(tX.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=E7(V,!1);if(Math.abs(H)<30)H*=60;G-=60000*H}return new Date(G)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};wN.floatTime=jN;wN.intTime=EN;wN.timestamp=tX});var $J=F((dN)=>{var bN=L$(),vN=i8(),gN=N$(),hN=j1(),fN=A7(),eX=nX(),w7=rX(),Z5=oX(),uN=h8(),mN=R7(),cN=o8(),pN=S7(),x7=j7(),lN=[bN.map,gN.seq,hN.string,vN.nullTag,eX.trueTag,eX.falseTag,Z5.intBin,Z5.intOct,Z5.int,Z5.intHex,w7.floatNaN,w7.floatExp,w7.float,fN.binary,uN.merge,mN.omap,cN.pairs,pN.set,x7.intTime,x7.floatTime,x7.timestamp];dN.schema=lN});var VJ=F(($O)=>{var XJ=L$(),nN=i8(),JJ=N$(),rN=j1(),sN=B7(),y7=L7(),k7=O7(),oN=vX(),aN=hX(),YJ=A7(),k1=h8(),WJ=R7(),UJ=o8(),ZJ=$J(),GJ=S7(),z5=j7(),zJ=new Map([["core",oN.schema],["failsafe",[XJ.map,JJ.seq,rN.string]],["json",aN.schema],["yaml11",ZJ.schema],["yaml-1.1",ZJ.schema]]),QJ={binary:YJ.binary,bool:sN.boolTag,float:y7.float,floatExp:y7.floatExp,floatNaN:y7.floatNaN,floatTime:z5.floatTime,int:k7.int,intHex:k7.intHex,intOct:k7.intOct,intTime:z5.intTime,map:XJ.map,merge:k1.merge,null:nN.nullTag,omap:WJ.omap,pairs:UJ.pairs,seq:JJ.seq,set:GJ.set,timestamp:z5.timestamp},tN={"tag:yaml.org,2002:binary":YJ.binary,"tag:yaml.org,2002:merge":k1.merge,"tag:yaml.org,2002:omap":WJ.omap,"tag:yaml.org,2002:pairs":UJ.pairs,"tag:yaml.org,2002:set":GJ.set,"tag:yaml.org,2002:timestamp":z5.timestamp};function eN($,Z,z){let Q=zJ.get(Z);if(Q&&!$)return z&&!Q.includes(k1.merge)?Q.concat(k1.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let J=Array.from(zJ.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(k1.merge);return X.reduce((J,Y)=>{let W=typeof Y==="string"?QJ[Y]:Y;if(!W){let U=JSON.stringify(Y),G=Object.keys(QJ).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},[])}$O.coreKnownTags=tN;$O.getTags=eN});var g7=F((WO)=>{var b7=t(),QO=L$(),XO=N$(),JO=j1(),Q5=VJ(),YO=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class v7{constructor({compat:$,customTags:Z,merge:z,resolveKnownTags:Q,schema:X,sortMapEntries:J,toStringDefaults:Y}){this.compat=Array.isArray($)?Q5.getTags($,"compat"):$?Q5.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?Q5.coreKnownTags:{},this.tags=Q5.getTags(Z,this.name,z),this.toStringOptions=Y??null,Object.defineProperty(this,b7.MAP,{value:QO.map}),Object.defineProperty(this,b7.SCALAR,{value:JO.string}),Object.defineProperty(this,b7.SEQ,{value:XO.seq}),this.sortMapEntries=typeof J==="function"?J:J===!0?YO:null}clone(){let $=Object.create(v7.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}WO.Schema=v7});var HJ=F((HO)=>{var GO=t(),h7=P1(),b1=_1();function VO($,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=h7.createStringifyContext($,Z),{commentString:J}=X.options;if($.commentBefore){if(z.length!==1)z.unshift("");let U=J($.commentBefore);z.unshift(b1.indentComment(U,""))}let Y=!1,W=null;if($.contents){if(GO.isNode($.contents)){if($.contents.spaceBefore&&Q)z.push("");if($.contents.commentBefore){let V=J($.contents.commentBefore);z.push(b1.indentComment(V,""))}X.forceBlockIndent=!!$.comment,W=$.contents.comment}let U=W?void 0:()=>Y=!0,G=h7.stringify($.contents,X,()=>W=null,U);if(W)G+=b1.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(h7.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let U=J($.comment);if(U.includes(`
81
+ `))z.push("..."),z.push(b1.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(b1.indentComment(J(U),""))}}return z.join(`
82
82
  `)+`
83
- `}aN.stringifyDocument=oN});var k1=F((YO)=>{var eN=I1(),L$=E8(),Z2=o(),$O=Z6(),ZO=t2(),zO=x7(),QO=QJ(),k7=F8(),XO=eZ(),JO=T1(),b7=tZ();class v7{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Z2.NODE_TYPE,{value:Z2.DOC});let Q=null;if(typeof Z==="function"||Array.isArray(Z))Q=Z;else if(z===void 0&&Z)z=Z,Z=void 0;let X=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},z);this.options=X;let{version:J}=X;if(z?._directives){if(this.directives=z._directives.atDocument(),this.directives.yaml.explicit)J=this.directives.yaml.version}else this.directives=new b7.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(v7.prototype,{[Z2.NODE_TYPE]:{value:Z2.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=Z2.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(N$(this.contents))this.contents.add($)}addIn($,Z){if(N$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=k7.anchorNames(this);$.anchor=!Z||z.has(Z)?k7.findNewAnchor(Z||"a",z):Z}return new eN.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let B=(T)=>typeof T==="number"||T instanceof String||T 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:q,sourceObjects:H}=k7.createNodeAnchors(this,J||"a"),K={aliasDuplicateObjects:X??!0,keepUndefined:W??!1,onAnchor:V,onTagObj:U,replacer:Q,schema:this.schema,sourceObjects:H},L=JO.createNode($,G,K);if(Y&&Z2.isCollection(L))L.flow=!0;return q(),L}createPair($,Z,z={}){let Q=this.createNode($,null,z),X=this.createNode(Z,null,z);return new $O.Pair(Q,X)}delete($){return N$(this.contents)?this.contents.delete($):!1}deleteIn($){if(L$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return N$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return Z2.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(L$.isEmptyPath($))return!Z&&Z2.isScalar(this.contents)?this.contents.value:this.contents;return Z2.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return Z2.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(L$.isEmptyPath($))return this.contents!==void 0;return Z2.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=L$.collectionFromPath(this.schema,[$],Z);else if(N$(this.contents))this.contents.set($,Z)}setIn($,Z){if(L$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=L$.collectionFromPath(this.schema,Array.from($),Z);else if(N$(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 b7.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 b7.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 zO.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=ZO.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"?XO.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 QO.stringifyDocument(this,$)}}function N$($){if(Z2.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}YO.Document=v7});var b1=F((GO)=>{class z5 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class XJ extends z5{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class JJ extends z5{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var UO=($,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
+ `}HO.stringifyDocument=VO});var v1=F((IO)=>{var qO=A1(),D$=w8(),z2=t(),BO=Q6(),MO=$6(),LO=g7(),NO=HJ(),f7=S8(),OO=X7(),DO=C1(),u7=Q7();class m7{constructor($,Z,z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,z2.NODE_TYPE,{value:z2.DOC});let Q=null;if(typeof Z==="function"||Array.isArray(Z))Q=Z;else if(z===void 0&&Z)z=Z,Z=void 0;let X=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},z);this.options=X;let{version:J}=X;if(z?._directives){if(this.directives=z._directives.atDocument(),this.directives.yaml.explicit)J=this.directives.yaml.version}else this.directives=new u7.Directives({version:J});this.setSchema(J,z),this.contents=$===void 0?null:this.createNode($,Q,z)}clone(){let $=Object.create(m7.prototype,{[z2.NODE_TYPE]:{value:z2.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=z2.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(I$(this.contents))this.contents.add($)}addIn($,Z){if(I$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let z=f7.anchorNames(this);$.anchor=!Z||z.has(Z)?f7.findNewAnchor(Z||"a",z):Z}return new qO.Alias($.anchor)}createNode($,Z,z){let Q=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),Q=Z;else if(Array.isArray(Z)){let B=(I)=>typeof I==="number"||I instanceof String||I instanceof Number,N=Z.filter(B).map(String);if(N.length>0)Z=Z.concat(N);Q=Z}else if(z===void 0&&Z)z=Z,Z=void 0;let{aliasDuplicateObjects:X,anchorPrefix:J,flow:Y,keepUndefined:W,onTagObj:U,tag:G}=z??{},{onAnchor:V,setAnchors:H,sourceObjects:K}=f7.createNodeAnchors(this,J||"a"),q={aliasDuplicateObjects:X??!0,keepUndefined:W??!1,onAnchor:V,onTagObj:U,replacer:Q,schema:this.schema,sourceObjects:K},L=DO.createNode($,G,q);if(Y&&z2.isCollection(L))L.flow=!0;return H(),L}createPair($,Z,z={}){let Q=this.createNode($,null,z),X=this.createNode(Z,null,z);return new BO.Pair(Q,X)}delete($){return I$(this.contents)?this.contents.delete($):!1}deleteIn($){if(D$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return I$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return z2.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(D$.isEmptyPath($))return!Z&&z2.isScalar(this.contents)?this.contents.value:this.contents;return z2.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return z2.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(D$.isEmptyPath($))return this.contents!==void 0;return z2.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=D$.collectionFromPath(this.schema,[$],Z);else if(I$(this.contents))this.contents.set($,Z)}setIn($,Z){if(D$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=D$.collectionFromPath(this.schema,Array.from($),Z);else if(I$(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 u7.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 u7.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 LO.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=MO.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"?OO.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 NO.stringifyDocument(this,$)}}function I$($){if(z2.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}IO.Document=m7});var g1=F((CO)=>{class X5 extends Error{constructor($,Z,z,Q){super();this.name=$,this.code=z,this.message=Q,this.pos=Z}}class KJ extends X5{constructor($,Z,z){super("YAMLParseError",$,Z,z)}}class qJ extends X5{constructor($,Z,z){super("YAMLWarning",$,Z,z)}}var AO=($,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
- `}};GO.YAMLError=z5;GO.YAMLParseError=XJ;GO.YAMLWarning=JJ;GO.prettifyError=UO});var v1=F((MO)=>{function BO($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,V=W,q="",H="",K=!1,L=!1,B=null,N=null,T=null,_=null,y=null,E=null,w=null;for(let S of $){if(L){if(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma")J(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(G&&S.type!=="comment"&&S.type!=="newline")J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(S.type){case"space":if(!Z&&(z!=="doc-start"||Q?.type!=="flow-collection")&&S.source.includes("\t"))B=S;V=!0;break;case"comment":{if(!V)J(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=S.source.substring(1)||" ";if(!q)q=d;else q+=H+d;H="",G=!1;break}case"newline":if(G){if(q)q+=S.source;else if(!E||z!=="seq-item-ind")U=!0}else H+=S.source;if(G=!0,K=!0,N||T)_=S;V=!0;break;case"anchor":if(N)J(S,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(S.source.endsWith(":"))J(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);N=S,w??(w=S.offset),G=!1,V=!1,L=!0;break;case"tag":{if(T)J(S,"MULTIPLE_TAGS","A node can have at most one tag");T=S,w??(w=S.offset),G=!1,V=!1,L=!0;break}case z:if(N||T)J(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`);if(E)J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${Z??"collection"}`);E=S,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(y)J(S,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);y=S,G=!1,V=!1;break}default:J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),G=!1,V=!1}}let j=$[$.length-1],f=j?j.offset+j.source.length:X;if(L&&Q&&Q.type!=="space"&&Q.type!=="newline"&&Q.type!=="comma"&&(Q.type!=="scalar"||Q.source!==""))J(Q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(G&&B.indent<=Y||Q?.type==="block-map"||Q?.type==="block-seq"))J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:y,found:E,spaceBefore:U,comment:q,hasNewline:K,anchor:N,tag:T,newlineAfterProp:_,end:f,start:w??f}}MO.resolveProps=BO});var Q5=F((NO)=>{function g7($){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(g7(Z.key)||g7(Z.value))return!0}return!1;default:return!0}}NO.containsNewline=g7});var h7=F((TO)=>{var DO=Q5();function IO($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&DO.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}TO.flowIndentCheck=IO});var f7=F((_O)=>{var YJ=o();function CO($,Z,z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(J,Y)=>J===Y||YJ.isScalar(J)&&YJ.isScalar(Y)&&J.value===Y.value;return Z.some((J)=>X(J.key,z))}_O.mapIncludes=CO});var qJ=F((jO)=>{var WJ=Z6(),FO=Q6(),UJ=v1(),PO=Q5(),GJ=h7(),SO=f7(),VJ="All mapping items must start at the same column";function EO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??FO.YAMLMap)(z.schema);if(z.atRoot)z.atRoot=!1;let U=Q.offset,G=null;for(let V of Q.items){let{start:q,key:H,sep:K,value:L}=V,B=UJ.resolveProps(q,{indicator:"explicit-key-ind",next:H??K?.[0],offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0}),N=!B.found;if(N){if(H){if(H.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 H&&H.indent!==Q.indent)X(U,"BAD_INDENT",VJ)}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||PO.containsNewline(H))X(H??q[q.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",VJ);z.atKey=!0;let T=B.end,_=H?$(z,H,B,X):Z(z,T,q,null,B,X);if(z.schema.compat)GJ.flowIndentCheck(Q.indent,H,X);if(z.atKey=!1,SO.mapIncludes(z,W.items,_))X(T,"DUPLICATE_KEY","Map keys must be unique");let y=UJ.resolveProps(K??[],{indicator:"map-value-ind",next:L,offset:_.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!H||H.type==="block-scalar"});if(U=y.end,y.found){if(N){if(L?.type==="block-map"&&!y.hasNewline)X(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&B.start<y.found.offset-1024)X(_.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let E=L?$(z,L,y,X):Z(z,U,K,null,y,X);if(z.schema.compat)GJ.flowIndentCheck(Q.indent,L,X);U=E.range[2];let w=new WJ.Pair(_,E);if(z.options.keepSourceTokens)w.srcToken=V;W.items.push(w)}else{if(N)X(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(y.comment)if(_.comment)_.comment+=`
91
- `+y.comment;else _.comment=y.comment;let E=new WJ.Pair(_);if(z.options.keepSourceTokens)E.srcToken=V;W.items.push(E)}}if(G&&G<U)X(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[Q.offset,U,G??U],W}jO.resolveBlockMap=EO});var HJ=F((vO)=>{var xO=X6(),yO=v1(),kO=h7();function bO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??xO.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:q}of Q.items){let H=yO.resolveProps(V,{indicator:"seq-item-ind",next:q,offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!H.found)if(H.anchor||H.tag||q)if(q?.type==="block-seq")X(H.end,"BAD_INDENT","All sequence items must start at the same column");else X(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=H.end,H.comment)W.comment=H.comment;continue}let K=q?$(z,q,H,X):Z(z,H.end,V,null,H,X);if(z.schema.compat)kO.flowIndentCheck(Q.indent,q,X);U=K.range[2],W.items.push(K)}return W.range=[Q.offset,U,G??U],W}vO.resolveBlockSeq=bO});var O$=F((fO)=>{function hO($,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}}fO.resolveEnd=hO});var MJ=F((rO)=>{var mO=o(),cO=Z6(),KJ=Q6(),pO=X6(),lO=O$(),BJ=v1(),dO=Q5(),iO=f7(),u7="Block collections are not allowed within flow collections",m7=($)=>$&&($.type==="block-map"||$.type==="block-seq");function nO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let Y=Q.start.source==="{",W=Y?"flow map":"flow sequence",G=new(J?.nodeClass??(Y?KJ.YAMLMap:pO.YAMLSeq))(z.schema);G.flow=!0;let V=z.atRoot;if(V)z.atRoot=!1;if(z.atKey)z.atKey=!1;let q=Q.offset+Q.start.source.length;for(let N=0;N<Q.items.length;++N){let T=Q.items[N],{start:_,key:y,sep:E,value:w}=T,j=BJ.resolveProps(_,{flow:W,indicator:"explicit-key-ind",next:y??E?.[0],offset:q,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!j.found){if(!j.anchor&&!j.tag&&!E&&!w){if(N===0&&j.comma)X(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(N<Q.items.length-1)X(j.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(j.comment)if(G.comment)G.comment+=`
92
- `+j.comment;else G.comment=j.comment;q=j.end;continue}if(!Y&&z.options.strict&&dO.containsNewline(y))X(y,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(N===0){if(j.comma)X(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!j.comma)X(j.start,"MISSING_CHAR",`Missing , between ${W} items`);if(j.comment){let f="";$:for(let S of _)switch(S.type){case"comma":case"space":break;case"comment":f=S.source.substring(1);break $;default:break $}if(f){let S=G.items[G.items.length-1];if(mO.isPair(S))S=S.value??S.key;if(S.comment)S.comment+=`
93
- `+f;else S.comment=f;j.comment=j.comment.substring(f.length+1)}}}if(!Y&&!E&&!j.found){let f=w?$(z,w,j,X):Z(z,j.end,E,null,j,X);if(G.items.push(f),q=f.range[2],m7(w))X(f.range,"BLOCK_IN_FLOW",u7)}else{z.atKey=!0;let f=j.end,S=y?$(z,y,j,X):Z(z,f,_,null,j,X);if(m7(y))X(S.range,"BLOCK_IN_FLOW",u7);z.atKey=!1;let d=BJ.resolveProps(E??[],{flow:W,indicator:"map-value-ind",next:w,offset:S.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(d.found){if(!Y&&!j.found&&z.options.strict){if(E)for(let $0 of E){if($0===d.found)break;if($0.type==="newline"){X($0,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(j.start<d.found.offset-1024)X(d.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(w)if("source"in w&&w.source?.[0]===":")X(w,"MISSING_CHAR",`Missing space after : in ${W}`);else X(d.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let I0=w?$(z,w,d,X):d.found?Z(z,d.end,E,null,d,X):null;if(I0){if(m7(w))X(I0.range,"BLOCK_IN_FLOW",u7)}else if(d.comment)if(S.comment)S.comment+=`
94
- `+d.comment;else S.comment=d.comment;let E0=new cO.Pair(S,I0);if(z.options.keepSourceTokens)E0.srcToken=T;if(Y){let $0=G;if(iO.mapIncludes(z,$0.items,S))X(f,"DUPLICATE_KEY","Map keys must be unique");$0.items.push(E0)}else{let $0=new KJ.YAMLMap(z.schema);$0.flow=!0,$0.items.push(E0);let k=(I0??S).range;$0.range=[S.range[0],k[1],k[2]],G.items.push($0)}q=I0?I0.range[2]:d.end}}let H=Y?"}":"]",[K,...L]=Q.end,B=q;if(K?.source===H)B=K.offset+K.source.length;else{let N=W[0].toUpperCase()+W.substring(1),T=V?`${N} must end with a ${H}`:`${N} in block collection must be sufficiently indented and end with a ${H}`;if(X(q,V?"MISSING_CHAR":"BAD_INDENT",T),K&&K.source.length!==1)L.unshift(K)}if(L.length>0){let N=lO.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}rO.resolveFlowCollection=nO});var LJ=F((XD)=>{var oO=o(),aO=L0(),tO=Q6(),eO=X6(),$D=qJ(),ZD=HJ(),zD=MJ();function c7($,Z,z,Q,X,J){let Y=z.type==="block-map"?$D.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?ZD.resolveBlockSeq($,Z,z,Q,J):zD.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 QD($,Z,z,Q,X){let J=Q.tag,Y=!J?null:Z.directives.tagName(J.source,(H)=>X(J,"TAG_RESOLVE_FAILED",H));if(z.type==="block-seq"){let{anchor:H,newlineAfterProp:K}=Q,L=H&&J?H.offset>J.offset?H:J:H??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===tO.YAMLMap.tagName&&W==="map"||Y===eO.YAMLSeq.tagName&&W==="seq")return c7($,Z,z,X,Y);let U=Z.schema.tags.find((H)=>H.tag===Y&&H.collection===W);if(!U){let H=Z.schema.knownTags[Y];if(H?.collection===W)Z.schema.tags.push(Object.assign({},H,{default:!1})),U=H;else{if(H)X(J,"BAD_COLLECTION_TYPE",`${H.tag} used for ${W} collection, but expects ${H.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return c7($,Z,z,X,Y)}}let G=c7($,Z,z,X,Y,U),V=U.resolve?.(G,(H)=>X(J,"TAG_RESOLVE_FAILED",H),Z.options)??G,q=oO.isNode(V)?V:new aO.Scalar(V);if(q.range=G.range,q.tag=Y,U?.format)q.format=U.format;return q}XD.composeCollection=QD});var l7=F((GD)=>{var p7=L0();function YD($,Z,z){let Q=Z.offset,X=WD(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?p7.Scalar.BLOCK_FOLDED:p7.Scalar.BLOCK_LITERAL,Y=Z.source?UD(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
- `.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,T]=Y[B];if(T===""||T==="\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+T.length+1}for(let B=Y.length-1;B>=W;--B)if(Y[B][0].length>U)W=B+1;let q="",H="",K=!1;for(let B=0;B<V;++B)q+=Y[B][0].slice(U)+`
97
- `;for(let B=V;B<W;++B){let[N,T]=Y[B];G+=N.length+T.length+1;let _=T[T.length-1]==="\r";if(_)T=T.slice(0,-1);if(T&&N.length<U){let E=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-T.length-(_?2:1),"BAD_INDENT",E),N=""}if(J===p7.Scalar.BLOCK_LITERAL)q+=H+N.slice(U)+T,H=`
98
- `;else if(N.length>U||T[0]==="\t"){if(H===" ")H=`
99
- `;else if(!K&&H===`
100
- `)H=`
101
-
102
- `;q+=H+N.slice(U)+T,H=`
103
- `,K=!0}else if(T==="")if(H===`
104
- `)q+=`
105
- `;else H=`
106
- `;else q+=H+T,H=" ",K=!1}switch(X.chomp){case"-":break;case"+":for(let B=W;B<Y.length;++B)q+=`
107
- `+Y[B][0].slice(U);if(q[q.length-1]!==`
108
- `)q+=`
109
- `;break;default:q+=`
110
- `}let L=Q+X.length+Z.source.length;return{value:q,type:J,comment:X.comment,range:[Q,L,L]}}function WD({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 H=1;H<X.length;++H){let K=X[H];if(!W&&(K==="-"||K==="+"))W=K;else{let L=Number(K);if(!Y&&L)Y=L;else if(U===-1)U=$+H}}if(U!==-1)Q(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",q=X.length;for(let H=1;H<Z.length;++H){let K=Z[H];switch(K.type){case"space":G=!0;case"newline":q+=K.source.length;break;case"comment":if(z&&!G)Q(K,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");q+=K.source.length,V=K.source.substring(1);break;case"error":Q(K,"UNEXPECTED_TOKEN",K.message),q+=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")q+=B.length}}}return{mode:J,indent:Y,chomp:W,comment:V,length:q}}function UD($){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}GD.resolveBlockScalar=YD});var i7=F((DD)=>{var d7=L0(),qD=O$();function HD($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,W,U,G=(H,K,L)=>z(Q+H,K,L);switch(X){case"scalar":W=d7.Scalar.PLAIN,U=KD(J,G);break;case"single-quoted-scalar":W=d7.Scalar.QUOTE_SINGLE,U=BD(J,G);break;case"double-quoted-scalar":W=d7.Scalar.QUOTE_DOUBLE,U=MD(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,q=qD.resolveEnd(Y,V,Z,z);return{value:U,type:W,comment:q.comment,range:[Q,V,q.offset]}}function KD($,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 NJ($)}function BD($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return NJ($.slice(1,-1)).replace(/''/g,"'")}function NJ($){let Z,z;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
88
+ `}};CO.YAMLError=X5;CO.YAMLParseError=KJ;CO.YAMLWarning=qJ;CO.prettifyError=AO});var h1=F((EO)=>{function SO($,{flow:Z,indicator:z,next:Q,offset:X,onError:J,parentIndent:Y,startOnNewline:W}){let U=!1,G=W,V=W,H="",K="",q=!1,L=!1,B=null,N=null,I=null,_=null,y=null,E=null,w=null;for(let S of $){if(L){if(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma")J(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(B){if(G&&S.type!=="comment"&&S.type!=="newline")J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(S.type){case"space":if(!Z&&(z!=="doc-start"||Q?.type!=="flow-collection")&&S.source.includes("\t"))B=S;V=!0;break;case"comment":{if(!V)J(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=S.source.substring(1)||" ";if(!H)H=d;else H+=K+d;K="",G=!1;break}case"newline":if(G){if(H)H+=S.source;else if(!E||z!=="seq-item-ind")U=!0}else K+=S.source;if(G=!0,q=!0,N||I)_=S;V=!0;break;case"anchor":if(N)J(S,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(S.source.endsWith(":"))J(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);N=S,w??(w=S.offset),G=!1,V=!1,L=!0;break;case"tag":{if(I)J(S,"MULTIPLE_TAGS","A node can have at most one tag");I=S,w??(w=S.offset),G=!1,V=!1,L=!0;break}case z:if(N||I)J(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`);if(E)J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${Z??"collection"}`);E=S,G=z==="seq-item-ind"||z==="explicit-key-ind",V=!1;break;case"comma":if(Z){if(y)J(S,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);y=S,G=!1,V=!1;break}default:J(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),G=!1,V=!1}}let j=$[$.length-1],u=j?j.offset+j.source.length:X;if(L&&Q&&Q.type!=="space"&&Q.type!=="newline"&&Q.type!=="comma"&&(Q.type!=="scalar"||Q.source!==""))J(Q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(G&&B.indent<=Y||Q?.type==="block-map"||Q?.type==="block-seq"))J(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:y,found:E,spaceBefore:U,comment:H,hasNewline:q,anchor:N,tag:I,newlineAfterProp:_,end:u,start:w??u}}EO.resolveProps=SO});var J5=F((wO)=>{function c7($){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(c7(Z.key)||c7(Z.value))return!0}return!1;default:return!0}}wO.containsNewline=c7});var p7=F((bO)=>{var yO=J5();function kO($,Z,z){if(Z?.type==="flow-collection"){let Q=Z.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&yO.containsNewline(Z))z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}bO.flowIndentCheck=kO});var l7=F((hO)=>{var BJ=t();function gO($,Z,z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(J,Y)=>J===Y||BJ.isScalar(J)&&BJ.isScalar(Y)&&J.value===Y.value;return Z.some((J)=>X(J.key,z))}hO.mapIncludes=gO});var DJ=F((lO)=>{var MJ=Q6(),uO=J6(),LJ=h1(),mO=J5(),NJ=p7(),cO=l7(),OJ="All mapping items must start at the same column";function pO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??uO.YAMLMap)(z.schema);if(z.atRoot)z.atRoot=!1;let U=Q.offset,G=null;for(let V of Q.items){let{start:H,key:K,sep:q,value:L}=V,B=LJ.resolveProps(H,{indicator:"explicit-key-ind",next:K??q?.[0],offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0}),N=!B.found;if(N){if(K){if(K.type==="block-seq")X(U,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in K&&K.indent!==Q.indent)X(U,"BAD_INDENT",OJ)}if(!B.anchor&&!B.tag&&!q){if(G=B.end,B.comment)if(W.comment)W.comment+=`
90
+ `+B.comment;else W.comment=B.comment;continue}if(B.newlineAfterProp||mO.containsNewline(K))X(K??H[H.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==Q.indent)X(U,"BAD_INDENT",OJ);z.atKey=!0;let I=B.end,_=K?$(z,K,B,X):Z(z,I,H,null,B,X);if(z.schema.compat)NJ.flowIndentCheck(Q.indent,K,X);if(z.atKey=!1,cO.mapIncludes(z,W.items,_))X(I,"DUPLICATE_KEY","Map keys must be unique");let y=LJ.resolveProps(q??[],{indicator:"map-value-ind",next:L,offset:_.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!K||K.type==="block-scalar"});if(U=y.end,y.found){if(N){if(L?.type==="block-map"&&!y.hasNewline)X(U,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(z.options.strict&&B.start<y.found.offset-1024)X(_.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let E=L?$(z,L,y,X):Z(z,U,q,null,y,X);if(z.schema.compat)NJ.flowIndentCheck(Q.indent,L,X);U=E.range[2];let w=new MJ.Pair(_,E);if(z.options.keepSourceTokens)w.srcToken=V;W.items.push(w)}else{if(N)X(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(y.comment)if(_.comment)_.comment+=`
91
+ `+y.comment;else _.comment=y.comment;let E=new MJ.Pair(_);if(z.options.keepSourceTokens)E.srcToken=V;W.items.push(E)}}if(G&&G<U)X(G,"IMPOSSIBLE","Map comment with trailing content");return W.range=[Q.offset,U,G??U],W}lO.resolveBlockMap=pO});var IJ=F((oO)=>{var iO=Y6(),nO=h1(),rO=p7();function sO({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let W=new(J?.nodeClass??iO.YAMLSeq)(z.schema);if(z.atRoot)z.atRoot=!1;if(z.atKey)z.atKey=!1;let U=Q.offset,G=null;for(let{start:V,value:H}of Q.items){let K=nO.resolveProps(V,{indicator:"seq-item-ind",next:H,offset:U,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!K.found)if(K.anchor||K.tag||H)if(H?.type==="block-seq")X(K.end,"BAD_INDENT","All sequence items must start at the same column");else X(U,"MISSING_CHAR","Sequence item without - indicator");else{if(G=K.end,K.comment)W.comment=K.comment;continue}let q=H?$(z,H,K,X):Z(z,K.end,V,null,K,X);if(z.schema.compat)rO.flowIndentCheck(Q.indent,H,X);U=q.range[2],W.items.push(q)}return W.range=[Q.offset,U,G??U],W}oO.resolveBlockSeq=sO});var T$=F((eO)=>{function tO($,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}}eO.resolveEnd=tO});var CJ=F((UD)=>{var ZD=t(),zD=Q6(),TJ=J6(),QD=Y6(),XD=T$(),AJ=h1(),JD=J5(),YD=l7(),d7="Block collections are not allowed within flow collections",i7=($)=>$&&($.type==="block-map"||$.type==="block-seq");function WD({composeNode:$,composeEmptyNode:Z},z,Q,X,J){let Y=Q.start.source==="{",W=Y?"flow map":"flow sequence",G=new(J?.nodeClass??(Y?TJ.YAMLMap:QD.YAMLSeq))(z.schema);G.flow=!0;let V=z.atRoot;if(V)z.atRoot=!1;if(z.atKey)z.atKey=!1;let H=Q.offset+Q.start.source.length;for(let N=0;N<Q.items.length;++N){let I=Q.items[N],{start:_,key:y,sep:E,value:w}=I,j=AJ.resolveProps(_,{flow:W,indicator:"explicit-key-ind",next:y??E?.[0],offset:H,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!j.found){if(!j.anchor&&!j.tag&&!E&&!w){if(N===0&&j.comma)X(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`);else if(N<Q.items.length-1)X(j.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${W}`);if(j.comment)if(G.comment)G.comment+=`
92
+ `+j.comment;else G.comment=j.comment;H=j.end;continue}if(!Y&&z.options.strict&&JD.containsNewline(y))X(y,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(N===0){if(j.comma)X(j.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${W}`)}else{if(!j.comma)X(j.start,"MISSING_CHAR",`Missing , between ${W} items`);if(j.comment){let u="";$:for(let S of _)switch(S.type){case"comma":case"space":break;case"comment":u=S.source.substring(1);break $;default:break $}if(u){let S=G.items[G.items.length-1];if(ZD.isPair(S))S=S.value??S.key;if(S.comment)S.comment+=`
93
+ `+u;else S.comment=u;j.comment=j.comment.substring(u.length+1)}}}if(!Y&&!E&&!j.found){let u=w?$(z,w,j,X):Z(z,j.end,E,null,j,X);if(G.items.push(u),H=u.range[2],i7(w))X(u.range,"BLOCK_IN_FLOW",d7)}else{z.atKey=!0;let u=j.end,S=y?$(z,y,j,X):Z(z,u,_,null,j,X);if(i7(y))X(S.range,"BLOCK_IN_FLOW",d7);z.atKey=!1;let d=AJ.resolveProps(E??[],{flow:W,indicator:"map-value-ind",next:w,offset:S.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(d.found){if(!Y&&!j.found&&z.options.strict){if(E)for(let Z0 of E){if(Z0===d.found)break;if(Z0.type==="newline"){X(Z0,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(j.start<d.found.offset-1024)X(d.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(w)if("source"in w&&w.source?.[0]===":")X(w,"MISSING_CHAR",`Missing space after : in ${W}`);else X(d.start,"MISSING_CHAR",`Missing , or : between ${W} items`);let T0=w?$(z,w,d,X):d.found?Z(z,d.end,E,null,d,X):null;if(T0){if(i7(w))X(T0.range,"BLOCK_IN_FLOW",d7)}else if(d.comment)if(S.comment)S.comment+=`
94
+ `+d.comment;else S.comment=d.comment;let j0=new zD.Pair(S,T0);if(z.options.keepSourceTokens)j0.srcToken=I;if(Y){let Z0=G;if(YD.mapIncludes(z,Z0.items,S))X(u,"DUPLICATE_KEY","Map keys must be unique");Z0.items.push(j0)}else{let Z0=new TJ.YAMLMap(z.schema);Z0.flow=!0,Z0.items.push(j0);let k=(T0??S).range;Z0.range=[S.range[0],k[1],k[2]],G.items.push(Z0)}H=T0?T0.range[2]:d.end}}let K=Y?"}":"]",[q,...L]=Q.end,B=H;if(q?.source===K)B=q.offset+q.source.length;else{let N=W[0].toUpperCase()+W.substring(1),I=V?`${N} must end with a ${K}`:`${N} in block collection must be sufficiently indented and end with a ${K}`;if(X(H,V?"MISSING_CHAR":"BAD_INDENT",I),q&&q.source.length!==1)L.unshift(q)}if(L.length>0){let N=XD.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}UD.resolveFlowCollection=WD});var _J=F((OD)=>{var VD=t(),HD=N0(),KD=J6(),qD=Y6(),BD=DJ(),MD=IJ(),LD=CJ();function n7($,Z,z,Q,X,J){let Y=z.type==="block-map"?BD.resolveBlockMap($,Z,z,Q,J):z.type==="block-seq"?MD.resolveBlockSeq($,Z,z,Q,J):LD.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 ND($,Z,z,Q,X){let J=Q.tag,Y=!J?null:Z.directives.tagName(J.source,(K)=>X(J,"TAG_RESOLVE_FAILED",K));if(z.type==="block-seq"){let{anchor:K,newlineAfterProp:q}=Q,L=K&&J?K.offset>J.offset?K:J:K??J;if(L&&(!q||q.offset<L.offset))X(L,"MISSING_CHAR","Missing newline after block sequence props")}let W=z.type==="block-map"?"map":z.type==="block-seq"?"seq":z.start.source==="{"?"map":"seq";if(!J||!Y||Y==="!"||Y===KD.YAMLMap.tagName&&W==="map"||Y===qD.YAMLSeq.tagName&&W==="seq")return n7($,Z,z,X,Y);let U=Z.schema.tags.find((K)=>K.tag===Y&&K.collection===W);if(!U){let K=Z.schema.knownTags[Y];if(K?.collection===W)Z.schema.tags.push(Object.assign({},K,{default:!1})),U=K;else{if(K)X(J,"BAD_COLLECTION_TYPE",`${K.tag} used for ${W} collection, but expects ${K.collection??"scalar"}`,!0);else X(J,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Y}`,!0);return n7($,Z,z,X,Y)}}let G=n7($,Z,z,X,Y,U),V=U.resolve?.(G,(K)=>X(J,"TAG_RESOLVE_FAILED",K),Z.options)??G,H=VD.isNode(V)?V:new HD.Scalar(V);if(H.range=G.range,H.tag=Y,U?.format)H.format=U.format;return H}OD.composeCollection=ND});var s7=F((CD)=>{var r7=N0();function ID($,Z,z){let Q=Z.offset,X=TD(Z,$.options.strict,z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let J=X.mode===">"?r7.Scalar.BLOCK_FOLDED:r7.Scalar.BLOCK_LITERAL,Y=Z.source?AD(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
+ `.repeat(Math.max(1,Y.length-1)):"",N=Q+X.length;if(Z.source)N+=Z.source.length;return{value:B,type:J,comment:X.comment,range:[Q,N,N]}}let U=Z.indent+X.indent,G=Z.offset+X.length,V=0;for(let B=0;B<W;++B){let[N,I]=Y[B];if(I===""||I==="\r"){if(X.indent===0&&N.length>U)U=N.length}else{if(N.length<U)z(G+N.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)U=N.length;if(V=B,U===0&&!$.atRoot)z(G,"BAD_INDENT","Block scalar values in collections must be indented");break}G+=N.length+I.length+1}for(let B=Y.length-1;B>=W;--B)if(Y[B][0].length>U)W=B+1;let H="",K="",q=!1;for(let B=0;B<V;++B)H+=Y[B][0].slice(U)+`
97
+ `;for(let B=V;B<W;++B){let[N,I]=Y[B];G+=N.length+I.length+1;let _=I[I.length-1]==="\r";if(_)I=I.slice(0,-1);if(I&&N.length<U){let E=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;z(G-I.length-(_?2:1),"BAD_INDENT",E),N=""}if(J===r7.Scalar.BLOCK_LITERAL)H+=K+N.slice(U)+I,K=`
98
+ `;else if(N.length>U||I[0]==="\t"){if(K===" ")K=`
99
+ `;else if(!q&&K===`
100
+ `)K=`
101
+
102
+ `;H+=K+N.slice(U)+I,K=`
103
+ `,q=!0}else if(I==="")if(K===`
104
+ `)H+=`
105
+ `;else K=`
106
+ `;else H+=K+I,K=" ",q=!1}switch(X.chomp){case"-":break;case"+":for(let B=W;B<Y.length;++B)H+=`
107
+ `+Y[B][0].slice(U);if(H[H.length-1]!==`
108
+ `)H+=`
109
+ `;break;default:H+=`
110
+ `}let L=Q+X.length+Z.source.length;return{value:H,type:J,comment:X.comment,range:[Q,L,L]}}function TD({offset:$,props:Z},z,Q){if(Z[0].type!=="block-scalar-header")return Q(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:X}=Z[0],J=X[0],Y=0,W="",U=-1;for(let K=1;K<X.length;++K){let q=X[K];if(!W&&(q==="-"||q==="+"))W=q;else{let L=Number(q);if(!Y&&L)Y=L;else if(U===-1)U=$+K}}if(U!==-1)Q(U,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let G=!1,V="",H=X.length;for(let K=1;K<Z.length;++K){let q=Z[K];switch(q.type){case"space":G=!0;case"newline":H+=q.source.length;break;case"comment":if(z&&!G)Q(q,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=q.source.length,V=q.source.substring(1);break;case"error":Q(q,"UNEXPECTED_TOKEN",q.message),H+=q.source.length;break;default:{let L=`Unexpected token in block scalar header: ${q.type}`;Q(q,"UNEXPECTED_TOKEN",L);let B=q.source;if(B&&typeof B==="string")H+=B.length}}}return{mode:J,indent:Y,chomp:W,comment:V,length:H}}function AD($){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}CD.resolveBlockScalar=ID});var a7=F((yD)=>{var o7=N0(),RD=T$();function FD($,Z,z){let{offset:Q,type:X,source:J,end:Y}=$,W,U,G=(K,q,L)=>z(Q+K,q,L);switch(X){case"scalar":W=o7.Scalar.PLAIN,U=PD(J,G);break;case"single-quoted-scalar":W=o7.Scalar.QUOTE_SINGLE,U=SD(J,G);break;case"double-quoted-scalar":W=o7.Scalar.QUOTE_DOUBLE,U=ED(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=RD.resolveEnd(Y,V,Z,z);return{value:U,type:W,comment:H.comment,range:[Q,V,H.offset]}}function PD($,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 SD($,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?
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 MD($,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 ED($,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}=LD($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=ND[J];if(Y)z+=Y;else if(J===`
116
+ `){let{fold:J,offset:Y}=jD($,Q);z+=J,Q=Y}else if(X==="\\"){let J=$[++Q],Y=wD[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+=OD($,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+=xD($,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 LD($,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 jD($,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 ND={"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 OD($,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}}DD.resolveFlowScalar=HD});var DJ=F((FD)=>{var x6=o(),OJ=L0(),TD=l7(),AD=i7();function CD($,Z,z,Q){let{value:X,type:J,comment:Y,range:W}=Z.type==="block-scalar"?TD.resolveBlockScalar($,Z,Q):AD.resolveFlowScalar(Z,$.options.strict,Q),U=z?$.directives.tagName(z.source,(q)=>Q(z,"TAG_RESOLVE_FAILED",q)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[x6.SCALAR];else if(U)G=_D($.schema,X,U,z,Q);else if(Z.type==="scalar")G=RD($,X,Z,Q);else G=$.schema[x6.SCALAR];let V;try{let q=G.resolve(X,(H)=>Q(z??Z,"TAG_RESOLVE_FAILED",H),$.options);V=x6.isScalar(q)?q:new OJ.Scalar(q)}catch(q){let H=q instanceof Error?q.message:String(q);Q(z??Z,"TAG_RESOLVE_FAILED",H),V=new OJ.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 _D($,Z,z,Q,X){if(z==="!")return $[x6.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"),$[x6.SCALAR]}function RD({atKey:$,directives:Z,schema:z},Q,X,J){let Y=z.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(Q))||z[x6.SCALAR];if(z.compat){let W=z.compat.find((U)=>U.default&&U.test?.test(Q))??z[x6.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}FD.composeScalar=CD});var IJ=F((ED)=>{function SD($,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 $}ED.emptyScalarPosition=SD});var CJ=F((hD)=>{var wD=I1(),xD=o(),yD=LJ(),TJ=DJ(),kD=O$(),bD=IJ(),vD={composeNode:AJ,composeEmptyNode:n7};function AJ($,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=gD($,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=yD.composeCollection(vD,$,Z,z,Q),W)G.anchor=W.source.substring(1)}catch(q){let H=q instanceof Error?q.message:String(q);Q(Z,"RESOURCE_EXHAUSTION",H)}break;default:{let q=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",q),V=!1}}if(G??(G=n7($,Z.offset,void 0,null,z,Q)),W&&G.anchor==="")Q(W,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!xD.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 n7($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:W,end:U},G){let V={type:"scalar",offset:bD.emptyScalarPosition(Z,z,Q),indent:-1,source:""},q=TJ.composeScalar($,V,W,G);if(Y){if(q.anchor=Y.source.substring(1),q.anchor==="")G(Y,"BAD_ALIAS","Anchor cannot be an empty string")}if(X)q.spaceBefore=!0;if(J)q.comment=J,q.range[2]=U;return q}function gD({options:$},{offset:Z,source:z,end:Q},X){let J=new wD.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=kD.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,W.offset],W.comment)J.comment=W.comment;return J}hD.composeEmptyNode=n7;hD.composeNode=AJ});var RJ=F((dD)=>{var mD=k1(),_J=CJ(),cD=O$(),pD=v1();function lD($,Z,{offset:z,start:Q,value:X,end:J},Y){let W=Object.assign({_directives:Z},$),U=new mD.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},V=pD.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?_J.composeNode(G,X,V,Y):_J.composeEmptyNode(G,V.end,Q,null,V,Y);let q=U.contents.range[2],H=cD.resolveEnd(J,q,!1,Y);if(H.comment)U.comment=H.comment;return U.range=[z,q,H.offset],U}dD.composeDoc=lD});var r7=F((tD)=>{var nD=i0("process"),rD=tZ(),sD=k1(),g1=b1(),FJ=o(),oD=RJ(),aD=O$();function h1($){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 PJ($){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 wD={"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 xD($,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}}yD.resolveFlowScalar=FD});var PJ=F((uD)=>{var y6=t(),FJ=N0(),bD=s7(),vD=a7();function gD($,Z,z,Q){let{value:X,type:J,comment:Y,range:W}=Z.type==="block-scalar"?bD.resolveBlockScalar($,Z,Q):vD.resolveFlowScalar(Z,$.options.strict,Q),U=z?$.directives.tagName(z.source,(H)=>Q(z,"TAG_RESOLVE_FAILED",H)):null,G;if($.options.stringKeys&&$.atKey)G=$.schema[y6.SCALAR];else if(U)G=hD($.schema,X,U,z,Q);else if(Z.type==="scalar")G=fD($,X,Z,Q);else G=$.schema[y6.SCALAR];let V;try{let H=G.resolve(X,(K)=>Q(z??Z,"TAG_RESOLVE_FAILED",K),$.options);V=y6.isScalar(H)?H:new FJ.Scalar(H)}catch(H){let K=H instanceof Error?H.message:String(H);Q(z??Z,"TAG_RESOLVE_FAILED",K),V=new FJ.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 hD($,Z,z,Q,X){if(z==="!")return $[y6.SCALAR];let J=[];for(let W of $.tags)if(!W.collection&&W.tag===z)if(W.default&&W.test)J.push(W);else return W;for(let W of J)if(W.test?.test(Z))return W;let Y=$.knownTags[z];if(Y&&!Y.collection)return $.tags.push(Object.assign({},Y,{default:!1,test:void 0})),Y;return X(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${z}`,z!=="tag:yaml.org,2002:str"),$[y6.SCALAR]}function fD({atKey:$,directives:Z,schema:z},Q,X,J){let Y=z.tags.find((W)=>(W.default===!0||$&&W.default==="key")&&W.test?.test(Q))||z[y6.SCALAR];if(z.compat){let W=z.compat.find((U)=>U.default&&U.test?.test(Q))??z[y6.SCALAR];if(Y.tag!==W.tag){let U=Z.tagString(Y.tag),G=Z.tagString(W.tag),V=`Value may be parsed as either ${U} or ${G}`;J(X,"TAG_RESOLVE_FAILED",V,!0)}}return Y}uD.composeScalar=gD});var SJ=F((pD)=>{function cD($,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 $}pD.emptyScalarPosition=cD});var wJ=F((tD)=>{var dD=A1(),iD=t(),nD=_J(),EJ=PJ(),rD=T$(),sD=SJ(),oD={composeNode:jJ,composeEmptyNode:t7};function jJ($,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=aD($,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=EJ.composeScalar($,Z,U,Q),W)G.anchor=W.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(G=nD.composeCollection(oD,$,Z,z,Q),W)G.anchor=W.source.substring(1)}catch(H){let K=H instanceof Error?H.message:String(H);Q(Z,"RESOURCE_EXHAUSTION",K)}break;default:{let H=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;Q(Z,"UNEXPECTED_TOKEN",H),V=!1}}if(G??(G=t7($,Z.offset,void 0,null,z,Q)),W&&G.anchor==="")Q(W,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!iD.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 t7($,Z,z,Q,{spaceBefore:X,comment:J,anchor:Y,tag:W,end:U},G){let V={type:"scalar",offset:sD.emptyScalarPosition(Z,z,Q),indent:-1,source:""},H=EJ.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 aD({options:$},{offset:Z,source:z,end:Q},X){let J=new dD.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=rD.resolveEnd(Q,Y,$.strict,X);if(J.range=[Z,Y,W.offset],W.comment)J.comment=W.comment;return J}tD.composeEmptyNode=t7;tD.composeNode=jJ});var yJ=F((JI)=>{var ZI=v1(),xJ=wJ(),zI=T$(),QI=h1();function XI($,Z,{offset:z,start:Q,value:X,end:J},Y){let W=Object.assign({_directives:Z},$),U=new ZI.Document(void 0,W),G={atKey:!1,atRoot:!0,directives:U.directives,options:U.options,schema:U.schema},V=QI.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?xJ.composeNode(G,X,V,Y):xJ.composeEmptyNode(G,V.end,Q,null,V,Y);let H=U.contents.range[2],K=zI.resolveEnd(J,H,!1,Y);if(K.comment)U.comment=K.comment;return U.range=[z,H,K.offset],U}JI.composeDoc=XI});var e7=F((KI)=>{var WI=n0("process"),UI=Q7(),GI=v1(),f1=g1(),kJ=t(),VI=yJ(),HI=T$();function u1($){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 bJ($){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 SJ{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=h1(Z);if(X)this.warnings.push(new g1.YAMLWarning(J,z,Q));else this.errors.push(new g1.YAMLParseError(J,z,Q))},this.directives=new rD.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=PJ(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(FJ.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(FJ.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 vJ{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,z,Q,X)=>{let J=u1(Z);if(X)this.warnings.push(new f1.YAMLWarning(J,z,Q));else this.errors.push(new f1.YAMLParseError(J,z,Q))},this.directives=new UI.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:z,afterEmptyLine:Q}=bJ(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(kJ.isCollection(X)&&!X.flow&&X.items.length>0){let J=X.items[0];if(kJ.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:PJ(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(nD.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=h1($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=oD.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 g1.YAMLParseError(h1($),"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 g1.YAMLParseError(h1($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=aD.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 g1.YAMLParseError(h1($),"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 sD.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}}}tD.Composer=SJ});var wJ=F((WI)=>{var $I=l7(),ZI=i7(),zI=b1(),EJ=_1();function QI($,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 zI.YAMLParseError([W,W+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return ZI.resolveFlowScalar($,Z,Q);case"block-scalar":return $I.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function XI($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,W=EJ.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:bJ(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(WI.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,z,Q)=>{let X=u1($);X[0]+=Z,this.onError(X,"BAD_DIRECTIVE",z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=VI.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 f1.YAMLParseError(u1($),"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 f1.YAMLParseError(u1($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=HI.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 f1.YAMLParseError(u1($),"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 GI.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}}}KI.Composer=vJ});var fJ=F((TI)=>{var BI=s7(),MI=a7(),LI=g1(),gJ=F1();function NI($,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 LI.YAMLParseError([W,W+1],J,Y)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return MI.resolveFlowScalar($,Z,Q);case"block-scalar":return BI.resolveBlockScalar({options:{strict:Z}},$,Q)}}return null}function OI($,Z){let{implicitKey:z=!1,indent:Q,inFlow:X=!1,offset:J=-1,type:Y="PLAIN"}=Z,W=gJ.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
- `),V=W.substring(0,G),q=W.substring(G+1)+`
135
- `,H=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!jJ(H,U))H.push({type:"newline",offset:-1,indent:Q,source:`
136
- `});return{type:"block-scalar",offset:J,indent:Q,props:H,source:q}}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 JI($,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=EJ.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">":YI($,U);break;case'"':s7($,U,"double-quoted-scalar");break;case"'":s7($,U,"single-quoted-scalar");break;default:s7($,U,"scalar")}}function YI($,Z){let z=Z.indexOf(`
134
+ `),V=W.substring(0,G),H=W.substring(G+1)+`
135
+ `,K=[{type:"block-scalar-header",offset:J,indent:Q,source:V}];if(!hJ(K,U))K.push({type:"newline",offset:-1,indent:Q,source:`
136
+ `});return{type:"block-scalar",offset:J,indent:Q,props:K,source:H}}case'"':return{type:"double-quoted-scalar",offset:J,indent:Q,source:W,end:U};case"'":return{type:"single-quoted-scalar",offset:J,indent:Q,source:W,end:U};default:return{type:"scalar",offset:J,indent:Q,source:W,end:U}}}function DI($,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=gJ.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">":II($,U);break;case'"':$3($,U,"double-quoted-scalar");break;case"'":$3($,U,"single-quoted-scalar");break;default:$3($,U,"scalar")}}function II($,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(!jJ(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 jJ($,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 s7($,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})}}}WI.createScalarToken=XI;WI.resolveAsScalar=QI;WI.setScalarValue=JI});var xJ=F((HI)=>{var qI=($)=>("type"in $)?J5($):X5($);function J5($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=J5(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=X5(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=X5(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=X5($);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 X5({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=J5(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=J5(Q);return X}HI.stringify=qI});var bJ=F((MI)=>{var o7=Symbol("break visit"),BI=Symbol("skip children"),yJ=Symbol("remove item");function y6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};kJ(Object.freeze([]),$,Z)}y6.BREAK=o7;y6.SKIP=BI;y6.REMOVE=yJ;y6.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};y6.parentCollection=($,Z)=>{let z=y6.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 kJ($,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=kJ(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof W==="number")Y=W-1;else if(W===o7)return o7;else if(W===yJ)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}MI.visit=y6});var Y5=F((CI)=>{var a7=wJ(),NI=xJ(),OI=bJ(),t7="\uFEFF",e7="\x02",$3="\x18",Z3="\x1F",DI=($)=>!!$&&("items"in $),II=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function TI($){switch($){case t7:return"<BOM>";case e7:return"<DOC>";case $3:return"<FLOW_END>";case Z3:return"<SCALAR>";default:return JSON.stringify($)}}function AI($){switch($){case t7:return"byte-order-mark";case e7:return"doc-mode";case $3:return"flow-error-end";case Z3: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(!hJ(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 hJ($,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 $3($,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})}}}TI.createScalarToken=OI;TI.resolveAsScalar=NI;TI.setScalarValue=DI});var uJ=F((FI)=>{var RI=($)=>("type"in $)?W5($):Y5($);function W5($){switch($.type){case"block-scalar":{let Z="";for(let z of $.props)Z+=W5(z);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let z of $.items)Z+=Y5(z);return Z}case"flow-collection":{let Z=$.start.source;for(let z of $.items)Z+=Y5(z);for(let z of $.end)Z+=z.source;return Z}case"document":{let Z=Y5($);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 Y5({start:$,key:Z,sep:z,value:Q}){let X="";for(let J of $)X+=J.source;if(Z)X+=W5(Z);if(z)for(let J of z)X+=J.source;if(Q)X+=W5(Q);return X}FI.stringify=RI});var pJ=F((EI)=>{var Z3=Symbol("break visit"),SI=Symbol("skip children"),mJ=Symbol("remove item");function k6($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};cJ(Object.freeze([]),$,Z)}k6.BREAK=Z3;k6.SKIP=SI;k6.REMOVE=mJ;k6.itemAtPath=($,Z)=>{let z=$;for(let[Q,X]of Z){let J=z?.[Q];if(J&&"items"in J)z=J.items[X];else return}return z};k6.parentCollection=($,Z)=>{let z=k6.itemAtPath($,Z.slice(0,-1)),Q=Z[Z.length-1][0],X=z?.[Q];if(X&&"items"in X)return X;throw Error("Parent collection not found")};function cJ($,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=cJ(Object.freeze($.concat([[X,Y]])),J.items[Y],z);if(typeof W==="number")Y=W-1;else if(W===Z3)return Z3;else if(W===mJ)J.items.splice(Y,1),Y-=1}if(typeof Q==="function"&&X==="key")Q=Q(Z,$)}}return typeof Q==="function"?Q(Z,$):Q}EI.visit=k6});var U5=F((gI)=>{var z3=fJ(),wI=uJ(),xI=pJ(),Q3="\uFEFF",X3="\x02",J3="\x18",Y3="\x1F",yI=($)=>!!$&&("items"in $),kI=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function bI($){switch($){case Q3:return"<BOM>";case X3:return"<DOC>";case J3:return"<FLOW_END>";case Y3:return"<SCALAR>";default:return JSON.stringify($)}}function vI($){switch($){case Q3:return"byte-order-mark";case X3:return"doc-mode";case J3:return"flow-error-end";case Y3: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}CI.createScalarToken=a7.createScalarToken;CI.resolveAsScalar=a7.resolveAsScalar;CI.setScalarValue=a7.setScalarValue;CI.stringify=NI.stringify;CI.visit=OI.visit;CI.BOM=t7;CI.DOCUMENT=e7;CI.FLOW_END=$3;CI.SCALAR=Z3;CI.isCollection=DI;CI.isScalar=II;CI.prettyToken=TI;CI.tokenType=AI});var Q3=F((fI)=>{var f1=Y5();function B2($){switch($){case void 0:case" ":case`
143
- `:case"\r":case"\t":return!0;default:return!1}}var vJ=new Set("0123456789ABCDEFabcdef"),gI=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),W5=new Set(",[]{}"),hI=new Set(` ,[]{}
144
- \r `),z3=($)=>!$||hI.has($);class gJ{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}gI.createScalarToken=z3.createScalarToken;gI.resolveAsScalar=z3.resolveAsScalar;gI.setScalarValue=z3.setScalarValue;gI.stringify=wI.stringify;gI.visit=xI.visit;gI.BOM=Q3;gI.DOCUMENT=X3;gI.FLOW_END=J3;gI.SCALAR=Y3;gI.isCollection=yI;gI.isScalar=kI;gI.prettyToken=bI;gI.tokenType=vI});var U3=F((eI)=>{var m1=U5();function L2($){switch($){case void 0:case" ":case`
143
+ `:case"\r":case"\t":return!0;default:return!1}}var lJ=new Set("0123456789ABCDEFabcdef"),aI=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),G5=new Set(",[]{}"),tI=new Set(` ,[]{}
144
+ \r `),W3=($)=>!$||tI.has($);class dJ{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex($,Z=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!Z;let z=this.next??"stream";while(z&&(Z||this.hasChars(1)))z=yield*this.parseNext(z)}atLineEnd(){let $=this.pos,Z=this.buffer[$];while(Z===" "||Z==="\t")Z=this.buffer[++$];if(!Z||Z==="#"||Z===`
145
145
  `)return!0;if(Z==="\r")return this.buffer[$+1]===`
146
146
  `;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let Z=this.buffer[$];if(this.indentNext>0){let z=0;while(Z===" ")Z=this.buffer[++z+$];if(Z==="\r"){let Q=this.buffer[z+$+1];if(Q===`
147
147
  `||!Q&&!this.atEnd)return $+z+1}return Z===`
148
- `||z>=this.indentNext||!Z&&!this.atEnd?$+z:-1}if(Z==="-"||Z==="."){let z=this.buffer.substr($,3);if((z==="---"||z==="...")&&B2(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]===f1.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 f1.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==="...")&&B2(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&&!B2(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(($==="-"||$==="?"||$===":")&&B2(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(z3),"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("..."))&&B2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield f1.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(z3),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||B2(J)||J===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let X=0;while(this.buffer[Z-1-X]==="\\")X+=1;if(X%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let z=this.buffer.substring(0,Z),Q=z.indexOf(`
148
+ `||z>=this.indentNext||!Z&&!this.atEnd?$+z:-1}if(Z==="-"||Z==="."){let z=this.buffer.substr($,3);if((z==="---"||z==="...")&&L2(this.buffer[$+3]))return-1}return $}getLine(){let $=this.lineEndPos;if(typeof $!=="number"||$!==-1&&$<this.pos)$=this.buffer.indexOf(`
149
+ `,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===m1.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 m1.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let Z=this.peek(3);if((Z==="---"||Z==="...")&&L2(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,Z==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!L2(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,Z]=this.peek(2);if(!Z&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&L2(Z)){let z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=z,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let Z=yield*this.pushIndicators();switch($[Z]){case"#":yield*this.pushCount($.length-Z);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(W3),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return Z+=yield*this.parseBlockScalarHeader(),Z+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-Z),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,Z,z=-1;do{if($=yield*this.pushNewline(),$>0)Z=yield*this.pushSpaces(!1),this.indentValue=z=Z;else Z=0;Z+=yield*this.pushSpaces(!0)}while($+Z>0);let Q=this.getLine();if(Q===null)return this.setNext("flow");if(z!==-1&&z<this.indentNext&&Q[0]!=="#"||z===0&&(Q.startsWith("---")||Q.startsWith("..."))&&L2(Q[3])){if(!(z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield m1.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(W3),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let J=this.charAt(1);if(this.flowKey||L2(J)||J===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let X=0;while(this.buffer[Z-1-X]==="\\")X+=1;if(X%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let z=this.buffer.substring(0,Z),Q=z.indexOf(`
150
150
  `,this.pos);if(Q!==-1){while(Q!==-1){let X=this.continueScalar(Q+1);if(X===-1)break;Q=z.indexOf(`
151
- `,X)}if(Q!==-1)Z=Q-(z[Q-1]==="\r"?2:1)}if(Z===-1){if(!this.atEnd)return this.setNext("quoted-scalar");Z=this.buffer.length}return yield*this.pushToIndex(Z+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let Z=this.buffer[++$];if(Z==="+")this.blockScalarKeep=!0;else if(Z>"0"&&Z<="9")this.blockScalarIndent=Number(Z)-1;else if(Z!=="-")break}return yield*this.pushUntil((Z)=>B2(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,z;$:for(let X=this.pos;z=this.buffer[X];++X)switch(z){case" ":Z+=1;break;case`
151
+ `,X)}if(Q!==-1)Z=Q-(z[Q-1]==="\r"?2:1)}if(Z===-1){if(!this.atEnd)return this.setNext("quoted-scalar");Z=this.buffer.length}return yield*this.pushToIndex(Z+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let Z=this.buffer[++$];if(Z==="+")this.blockScalarKeep=!0;else if(Z>"0"&&Z<="9")this.blockScalarIndent=Number(Z)-1;else if(Z!=="-")break}return yield*this.pushUntil((Z)=>L2(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,z;$:for(let X=this.pos;z=this.buffer[X];++X)switch(z){case" ":Z+=1;break;case`
152
152
  `:$=X,Z=0;break;case"\r":{let J=this.buffer[X+1];if(!J&&!this.atEnd)return this.setNext("block-scalar");if(J===`
153
153
  `)break}default:break $}if(!z&&!this.atEnd)return this.setNext("block-scalar");if(Z>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=Z;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let X=this.continueScalar($+1);if(X===-1)break;$=this.buffer.indexOf(`
154
154
  `,X)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let Q=$+1;z=this.buffer[Q];while(z===" ")z=this.buffer[++Q];if(z==="\t"){while(z==="\t"||z===" "||z==="\r"||z===`
155
155
  `)z=this.buffer[++Q];$=Q-1}else if(!this.blockScalarKeep)do{let X=$-1,J=this.buffer[X];if(J==="\r")J=this.buffer[--X];let Y=X;while(J===" ")J=this.buffer[--X];if(J===`
156
- `&&X>=this.pos&&X+1+Z>Y)$=X;else break}while(!0);return yield f1.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(B2(X)||$&&W5.has(X))break;Z=z}else if(B2(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 m1.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,Z=this.pos-1,z=this.pos-1,Q;while(Q=this.buffer[++z])if(Q===":"){let X=this.buffer[z+1];if(L2(X)||$&&G5.has(X))break;Z=z}else if(L2(Q)){let X=this.buffer[z+1];if(Q==="\r")if(X===`
157
157
  `)z+=1,Q=`
158
- `,X=this.buffer[z+1];else Z=z;if(X==="#"||$&&W5.has(X))break;if(Q===`
159
- `){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&W5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield f1.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(z3),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(B2(z)||Z&&W5.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(!B2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(gI.has(Z))Z=this.buffer[++$];else if(Z==="%"&&vJ.has(this.buffer[$+1])&&vJ.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==="#"||$&&G5.has(X))break;if(Q===`
159
+ `){let J=this.continueScalar(z+1);if(J===-1)break;z=Math.max(z,J-2)}}else{if($&&G5.has(Q))break;Z=z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield m1.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(W3),$+=yield*this.pushSpaces(!0);continue $;case"-":case"?":case":":{let Z=this.flowLevel>0,z=this.charAt(1);if(L2(z)||Z&&G5.has(z)){if(!Z)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;$+=yield*this.pushCount(1),$+=yield*this.pushSpaces(!0);continue $}}}break $}return $}*pushTag(){if(this.charAt(1)==="<"){let $=this.pos+2,Z=this.buffer[$];while(!L2(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(aI.has(Z))Z=this.buffer[++$];else if(Z==="%"&&lJ.has(this.buffer[$+1])&&lJ.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)}}fI.Lexer=gJ});var X3=F((mI)=>{class hJ{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}}}}mI.LineCounter=hJ});var J3=F((dI)=>{var pI=i0("process"),fJ=Y5(),lI=Q3();function J6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function uJ($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function cJ($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function U5($){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 D$($){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 G5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function mJ($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!J6(Z.start,"explicit-key-ind")&&!J6(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,cJ(Z.value))if(Z.value.end)G5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else G5(Z.start,Z.sep);delete Z.sep}}}class pJ{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 lI.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=$,pI.env.LOG_TOKENS)console.log("|",fJ.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=fJ.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")mJ(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&&uJ(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(uJ($.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=U5(this.peek(2)),z=D$(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)}}eI.Lexer=dJ});var G3=F((ZT)=>{class iJ{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}}}}ZT.LineCounter=iJ});var V3=F((JT)=>{var QT=n0("process"),nJ=U5(),XT=U3();function W6($,Z){for(let z=0;z<$.length;++z)if($[z].type===Z)return!0;return!1}function rJ($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function oJ($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function V5($){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 A$($){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 H5($,Z){if(Z.length<1e5)Array.prototype.push.apply($,Z);else for(let z=0;z<Z.length;++z)$.push(Z[z])}function sJ($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!W6(Z.start,"explicit-key-ind")&&!W6(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,oJ(Z.value))if(Z.value.end)H5(Z.value.end,Z.sep);else Z.value.end=Z.sep;else H5(Z.start,Z.sep);delete Z.sep}}}class aJ{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 XT.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=$,QT.env.LOG_TOKENS)console.log("|",nJ.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=nJ.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")sJ(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&&rJ(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(rJ($.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=V5(this.peek(2)),z=A$(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)){G5(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(J6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=D$(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(J6(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(cJ(Z.key)&&!J6(Z.sep,"newline")){let J=D$(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(J6(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&&!J6(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)){G5(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||J6(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=U5(z),X=D$(Q);mJ($);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)){H5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let z=!this.onKeyLine&&this.indent===$.indent,Q=z&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&Z.sep&&!Z.value){let J=[];for(let Y=0;Y<Z.sep.length;++Y){let W=Z.sep[Y];switch(W.type){case"newline":J.push(Y);break;case"space":break;case"comment":if(W.indent>$.indent)J.length=0;break;default:J.length=0}}if(J.length>=2)X=Z.sep.splice(J[1])}switch(this.type){case"anchor":case"tag":if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(Q||Z.value)X.push(this.sourceToken),$.items.push({start:X,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(W6(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let J=A$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(W6(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]});else if(oJ(Z.key)&&!W6(Z.sep,"newline")){let J=A$(Z.start),Y=Z.key,W=Z.sep;W.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:Y,sep:W}]})}else if(X.length>0)Z.sep=Z.sep.concat(X,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||Q)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(W6(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Z.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let J=this.flowScalar(this.type);if(Q||Z.value)$.items.push({start:X,key:J,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(J);else Object.assign(Z,{key:J,sep:[]}),this.onKeyLine=!0;return}default:{let J=this.startBlockValue($);if(J){if(J.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!W6(Z.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(z)$.items.push({start:X});this.stack.push(J);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let z="end"in Z.value?Z.value.end:void 0;if((Array.isArray(z)?z[z.length-1]:void 0)?.type==="comment")z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){H5(Q,Z.start),Q.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||W6(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let z=this.startBlockValue($);if(z){this.stack.push(z);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let z;do yield*this.pop(),z=this.peek(1);while(z?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:Q,sep:[]});else if(Z.sep)this.stack.push(Q);else Object.assign(Z,{key:Q,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let z=this.startBlockValue($);if(z)this.stack.push(z);else yield*this.pop(),yield*this.step()}else{let z=this.peek(2);if(z.type==="block-map"&&(this.type==="map-value-ind"&&z.indent===$.indent||this.type==="newline"&&!z.items[z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&z.type!=="flow-collection"){let Q=V5(z),X=A$(Q);sJ($);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=U5($),z=D$(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=U5($),z=D$(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()}}}dI.Parser=pJ});var rJ=F(($T)=>{var lJ=r7(),nI=k1(),u1=b1(),rI=X7(),sI=o(),oI=X3(),dJ=J3();function iJ($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new oI.LineCounter||null,prettyErrors:Z}}function aI($,Z={}){let{lineCounter:z,prettyErrors:Q}=iJ(Z),X=new dJ.Parser(z?.addNewLine),J=new lJ.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let W of Y)W.errors.forEach(u1.prettifyError($,z)),W.warnings.forEach(u1.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function nJ($,Z={}){let{lineCounter:z,prettyErrors:Q}=iJ(Z),X=new dJ.Parser(z?.addNewLine),J=new lJ.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 u1.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(u1.prettifyError($,z)),Y.warnings.forEach(u1.prettifyError($,z));return Y}function tI($,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=nJ($,z);if(!X)return null;if(X.warnings.forEach((J)=>rI.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 eI($,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(sI.isDocument($)&&!Q)return $.toString(z);return new nI.Document($,Q,z).toString(z)}$T.parse=tI;$T.parseAllDocuments=aI;$T.parseDocument=nJ;$T.stringify=eI});var iY={};AQ(iY,{orange:()=>R0,italic:()=>rA,fafCyanDeep:()=>P5,fafCyan:()=>I,dim:()=>M,bold:()=>C,FAF_HEX:()=>$4});var S3=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,C,M,rA,$4,I=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,P5=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,R0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var i=v(()=>{C=S3("1"),M=S3("2"),rA=S3("3"),$4={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var l9=F((Mc,Uj)=>{Uj.exports={name:"faf-cli",version:"8.0.1",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./pack":{types:"./dist/interop/pack.d.ts",default:"./dist/pack.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/interop/pack.ts --outdir dist --target=browser --minify --sourcemap=linked && tsc -p tsconfig.build.json",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint 'src/**/*.ts'",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^3.0.0",open:"^11.0.0",yaml:"^2.9.0"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.5",picomatch:"^4.0.5"},engines:{node:">=22.0.0"},publishConfig:{access:"public"}}});function P($,Z,z,Q,X){if(Q==="m")throw TypeError("Private method is not writable");if(Q==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!X:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return Q==="a"?X.call($,z):X?X.value=z:Z.set($,z),z}function O($,Z,z,Q){if(z==="a"&&!Q)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!Q:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return z==="m"?Q:z==="a"?Q.call($):Q?Q.value:Z.get($)}var i2=()=>{};var s9=function(){let{crypto:$}=globalThis;if($?.randomUUID)return s9=$.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 n2($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var S4=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var x,O0,w0,O6,d$,i$,n$,r$,s$,o$,a$,t$,e$;var l0=v(()=>{x=class x extends Error{};O0=class O0 extends x{constructor($,Z,z,Q,X){super(`${O0.makeMessage($,Z,z)}`);this.status=$,this.headers=Q,this.requestID=Q?.get("request-id"),this.error=Z,this.type=X??null}static makeMessage($,Z,z){let Q=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):z;if($&&Q)return`${$} ${Q}`;if($)return`${$} status code (no body)`;if(Q)return Q;return"(no status code or body)"}static generate($,Z,z,Q){if(!$||!Q)return new O6({message:z,cause:S4(Z)});let X=Z,J=X?.error?.type;if($===400)return new i$($,X,z,Q,J);if($===401)return new n$($,X,z,Q,J);if($===403)return new r$($,X,z,Q,J);if($===404)return new s$($,X,z,Q,J);if($===409)return new o$($,X,z,Q,J);if($===422)return new a$($,X,z,Q,J);if($===429)return new t$($,X,z,Q,J);if($>=500)return new e$($,X,z,Q,J);return new O0($,X,z,Q,J)}};w0=class w0 extends O0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};O6=class O6 extends O0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};d$=class d$ extends O6{constructor({message:$}={}){super({message:$??"Request timed out."})}};i$=class i$ extends O0{};n$=class n$ extends O0{};r$=class r$ extends O0{};s$=class s$ extends O0{};o$=class o$ extends O0{};a$=class a$ extends O0{};t$=class t$ extends O0{};e$=class e$ extends O0{}});function HZ($){if(typeof $!=="object")return{};return $??{}}function t9($){if(!$)return!0;for(let Z in $)return!1;return!0}function TV($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var uj,IV=($)=>{return uj.test($)},o9=($)=>(o9=Array.isArray,o9($)),a9,AV=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new x(`${$} must be an integer`);if(Z<0)throw new x(`${$} must be a positive integer`);return Z},KZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var $$=v(()=>{l0();uj=/^[a-z][a-z0-9+.-]*:/i,a9=o9});var CV=($)=>new Promise((Z)=>setTimeout(Z,$));var D6="0.91.1";function mj(){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 pj(){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 PV=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},cj=()=>{let $=mj();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":D6,"X-Stainless-OS":RV(Deno.build.os),"X-Stainless-Arch":_V(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":D6,"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":D6,"X-Stainless-OS":RV(globalThis.process.platform??"unknown"),"X-Stainless-Arch":_V(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=pj();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":D6,"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":D6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},_V=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},RV=($)=>{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"},FV,SV=()=>{return FV??(FV=cj())};var e9=()=>{};function EV(){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 $z(...$){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 BZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return $z({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 E4($){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 jV($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var wV=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function xV($){return Object.entries($).filter(([Z,z])=>typeof z<"u").map(([Z,z])=>{if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(z)}`;if(z===null)return`${encodeURIComponent(Z)}=`;throw new x(`Cannot stringify type ${typeof z}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var yV=v(()=>{l0()});function vV($){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 j4($){let Z;return(kV??(Z=new globalThis.TextEncoder,kV=Z.encode.bind(Z)))($)}function Zz($){let Z;return(bV??(Z=new globalThis.TextDecoder,bV=Z.decode.bind(Z)))($)}var kV,bV;class I6{constructor(){o0.set(this,void 0),a0.set(this,void 0),P(this,o0,new Uint8Array,"f"),P(this,a0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?j4($):$;P(this,o0,vV([O(this,o0,"f"),Z]),"f");let z=[],Q;while((Q=ij(O(this,o0,"f"),O(this,a0,"f")))!=null){if(Q.carriage&&O(this,a0,"f")==null){P(this,a0,Q.index,"f");continue}if(O(this,a0,"f")!=null&&(Q.index!==O(this,a0,"f")+1||Q.carriage)){z.push(Zz(O(this,o0,"f").subarray(0,O(this,a0,"f")-1))),P(this,o0,O(this,o0,"f").subarray(O(this,a0,"f")),"f"),P(this,a0,null,"f");continue}let X=O(this,a0,"f")!==null?Q.preceding-1:Q.preceding,J=Zz(O(this,o0,"f").subarray(0,X));z.push(J),P(this,o0,O(this,o0,"f").subarray(Q.index),"f"),P(this,a0,null,"f")}return z}flush(){if(!O(this,o0,"f").length)return[];return this.decode(`
166
- `)}}function ij($,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 gV($){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 o0,a0;var zz=v(()=>{i2();o0=new WeakMap,a0=new WeakMap;I6.NEWLINE_CHARS=new Set([`
167
- `,"\r"]);I6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function w4(){}function MZ($,Z,z){if(!Z||LZ[$]>LZ[z])return w4;else return Z[$].bind(Z)}function S0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return nj;let Q=hV.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:MZ("error",Z,z),warn:MZ("warn",Z,z),info:MZ("info",Z,z),debug:MZ("debug",Z,z)};return hV.set(Z,[z,X]),X}var LZ,Qz=($,Z,z)=>{if(!$)return;if(TV(LZ,$))return $;S0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(LZ))}`);return},nj,hV,r2=($)=>{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 NZ=v(()=>{$$();LZ={off:0,error:200,warn:300,info:400,debug:500};nj={error:w4,warn:w4,info:w4,debug:w4},hV=new WeakMap});async function*rj($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new x("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new x("Attempted to iterate over a response with no body")}let z=new fV,Q=new I6,X=E4($.body);for await(let J of sj(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*sj($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?j4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=gV(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class fV{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]=oj($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function oj($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var x4,t0;var Xz=v(()=>{i2();l0();zz();$$();NZ();l0();t0=class t0{constructor($,Z,z){this.iterator=$,x4.set(this,void 0),this.controller=Z,P(this,x4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?S0(z):console;async function*J(){if(Q)throw new x("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of rj($,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=KZ(W.data)??W.data,G=U?.error?.type;throw new O0(void 0,U,void 0,$.headers,G)}}Y=!0}catch(W){if(n2(W))return;throw W}finally{if(!Y)Z.abort()}}return new t0(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new I6,W=E4($);for await(let U of W)for(let G of Y.decode(U))yield G;for(let U of Y.flush())yield U}async function*J(){if(Q)throw new x("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of X()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(n2(W))return;throw W}finally{if(!Y)Z.abort()}}return new t0(J,Z,z)}[(x4=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 t0(()=>Q($),this.controller,O(this,x4,"f")),new t0(()=>Q(Z),this.controller,O(this,x4,"f"))]}toReadableStream(){let $=this,Z;return $z({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=j4(JSON.stringify(Q)+`
169
- `);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function OZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(S0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return t0.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 H=await z.json();return Jz(H,z)}return await z.text()})();return S0($).debug(`[${Q}] response parsed`,r2({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function Jz($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var Yz=v(()=>{Xz();NZ()});var y4,T6;var DZ=v(()=>{i2();Yz();T6=class T6 extends Promise{constructor($,Z,z=OZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,y4.set(this,void 0),P(this,y4,$,"f")}_thenUnwrap($){return new T6(O(this,y4,"f"),this.responsePromise,async(Z,z)=>Jz($(await this.parseResponse(Z,z),z),z.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,Z]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:Z,request_id:Z.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(O(this,y4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};y4=new WeakMap});var IZ,Wz,k4,F2,Z0;var V0=v(()=>{i2();l0();Yz();DZ();$$();Wz=class Wz{constructor($,Z,z,Q){IZ.set(this,void 0),P(this,IZ,$,"f"),this.options=Q,this.response=Z,this.body=z}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new x("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await O(this,IZ,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(IZ=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};k4=class k4 extends T6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await OZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};F2=class F2 extends Wz{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:{...HZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...HZ(this.options.query),after_id:$}}}};Z0=class Z0 extends Wz{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:{...HZ(this.options.query),page:$}}}}});function Z$($,Z,z){return Gz(),new File($,Z??"unknown_file",z)}function b4($,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 tj($){let Z=typeof $==="function"?$:$.fetch,z=uV.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 uV.set(Z,Q),Q}var Gz=()=>{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`.":""))}},Vz=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",$1=async($,Z,z=!0)=>{return{...$,body:await ej($.body,Z,z)}},uV,ej=async($,Z,z=!0)=>{if(!await tj(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])=>Uz(Q,X,J,z))),Q},$w=($)=>$ instanceof Blob&&("name"in $),Uz=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,Z$([await z.blob()],b4(z,Q),X))}else if(Vz(z))$.append(Z,Z$([await new Response(BZ(z)).blob()],b4(z,Q)));else if($w(z))$.append(Z,Z$([z],b4(z,Q),{type:z.type}));else if(Array.isArray(z))await Promise.all(z.map((X)=>Uz($,Z+"[]",X,Q)));else if(typeof z==="object")await Promise.all(Object.entries(z).map(([X,J])=>Uz($,`${Z}[${X}]`,J,Q)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${z} instead`)};var Z1=v(()=>{uV=new WeakMap});async function v4($,Z,z){if(Gz(),$=await $,Z||(Z=b4($,!0)),Zw($)){if($ instanceof File&&Z==null&&z==null)return $;return Z$([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(zw($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),Z$(await qz(X),Z,z)}let Q=await qz($);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 Z$(Q,Z,z)}async function qz($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(mV($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(Vz($))for await(let z of $)Z.push(...await qz(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${Qw($)}`)}return Z}function Qw($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var mV=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",Zw=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&mV($),zw=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var cV=v(()=>{Z1();Z1()});var Hz=v(()=>{cV()});var pV=()=>{};class c{constructor($){this._client=$}}function*Jw($){if(!$)return;if(lV 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(a9($))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=a9(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 lV,D=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of Jw(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{[lV]:!0,values:Z,nulls:z}};var Y0=v(()=>{$$();lV=Symbol.for("brand.privateNullableHeaders")});function iV($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var dV,Yw=($=iV)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,q,H)=>{if(/[?#]/.test(q))X=!0;let K=Q[H],L=(X?encodeURIComponent:$)(""+K);if(H!==Q.length&&(K==null||typeof K==="object"&&K.toString===Object.getPrototypeOf(Object.getPrototypeOf(K.hasOwnProperty??dV)??dV)?.toString))L=K+"",J.push({start:V.length+q.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(K).slice(8,-1)} is not a valid path parameter`});return V+q+(H===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,q)=>V.start-q.start),J.length>0){let V=0,q=J.reduce((H,K)=>{let L=" ".repeat(K.start-V),B="^".repeat(K.length);return V=K.start+K.length,H+L+B},"");throw new x(`Path parameters result in path with invalid segments:
170
- ${J.map((H)=>H.error).join(`
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=V5($),z=A$(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=V5($),z=A$(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()}}}JT.Parser=aJ});var zY=F((BT)=>{var tJ=e7(),WT=v1(),c1=g1(),UT=G7(),GT=t(),VT=G3(),eJ=V3();function $Y($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new VT.LineCounter||null,prettyErrors:Z}}function HT($,Z={}){let{lineCounter:z,prettyErrors:Q}=$Y(Z),X=new eJ.Parser(z?.addNewLine),J=new tJ.Composer(Z),Y=Array.from(J.compose(X.parse($)));if(Q&&z)for(let W of Y)W.errors.forEach(c1.prettifyError($,z)),W.warnings.forEach(c1.prettifyError($,z));if(Y.length>0)return Y;return Object.assign([],{empty:!0},J.streamInfo())}function ZY($,Z={}){let{lineCounter:z,prettyErrors:Q}=$Y(Z),X=new eJ.Parser(z?.addNewLine),J=new tJ.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 c1.YAMLParseError(W.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&z)Y.errors.forEach(c1.prettifyError($,z)),Y.warnings.forEach(c1.prettifyError($,z));return Y}function KT($,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=ZY($,z);if(!X)return null;if(X.warnings.forEach((J)=>UT.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 qT($,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(GT.isDocument($)&&!Q)return $.toString(z);return new WT.Document($,Q,z).toString(z)}BT.parse=KT;BT.parseAllDocuments=HT;BT.parseDocument=ZY;BT.stringify=qT});var $W={};jQ($W,{orange:()=>F0,italic:()=>UC,fafCyanDeep:()=>E5,fafCyan:()=>T,dim:()=>M,bold:()=>C,FAF_HEX:()=>z4});var y3=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,C,M,UC,z4,T=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,E5=($)=>`\x1B[38;2;14;140;140m${$}\x1B[0m`,F0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var i=v(()=>{C=y3("1"),M=y3("2"),UC=y3("3"),z4={cyan:"#00D4D4",cyanDeep:"#0E8C8C",orange:"#FF6B35"}});var t9=F((Kp,rj)=>{rj.exports={name:"faf-cli",version:"8.1.1",description:"Persistent AI context + memory — .faf and .fafm, IANA-registered. Anthropic-merged.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",types:"./dist/index.d.ts",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./pack":{types:"./dist/interop/pack.d.ts",default:"./dist/pack.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",clean:"rm -rf dist",build:"bun run clean && bun build src/cli.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/index.ts --outdir dist --target=node --minify --sourcemap=linked --external faf-scoring-kernel --external open && bun build src/interop/pack.ts --outdir dist --target=browser --minify --sourcemap=linked && tsc -p tsconfig.build.json",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --bytecode --minify --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test --timeout=120000","test:watch":"bun test --watch --timeout=120000",lint:"eslint 'src/**/*.ts'",format:"prettier --write 'src/**/*.ts'","check:no-hardcode":"! grep -rEln '/(Users|home/runner|private/var)/' dist/ || (echo '❌ Hardcoded build-machine path leaked into dist — see grep output above. Externalize the offending dep in the build script.'; exit 1)","check:engines":"node scripts/check-engines.mjs",prepublishOnly:"bun run check:engines && bun run build && bun run check:no-hardcode"},keywords:["faf","ai-context","project-dna","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational","agents-md","context-engineering","codex","windsurf","fafm","ai-memory","agents"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.3","faf-scoring-kernel":"^3.0.0",open:"^11.0.0",yaml:"^2.9.0"},optionalDependencies:{"@anthropic-ai/sdk":"^0.91.1"},devDependencies:{"@faf/specification":"github:Wolfe-Jam/faf","@types/bun":"^1.3.14","@types/node":"^22.20.1","@typescript-eslint/eslint-plugin":"^8.66.0","@typescript-eslint/parser":"^8.66.0",ajv:"^8.20.0",eslint:"^9.39.5",prettier:"^3.9.6",typescript:"^5.9.3","typescript-eslint":"^8.66.0"},overrides:{"brace-expansion":"^1.1.18","fast-uri":"^3.1.5",picomatch:"^4.0.5"},engines:{node:">=22.0.0"},publishConfig:{access:"public"}}});function P($,Z,z,Q,X){if(Q==="m")throw TypeError("Private method is not writable");if(Q==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!X:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return Q==="a"?X.call($,z):X?X.value=z:Z.set($,z),z}function O($,Z,z,Q){if(z==="a"&&!Q)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!Q:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return z==="m"?Q:z==="a"?Q.call($):Q?Q.value:Z.get($)}var r2=()=>{};var Qz=function(){let{crypto:$}=globalThis;if($?.randomUUID)return Qz=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),z=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(Q)=>(+Q^z()&15>>+Q/4).toString(16))};function s2($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var j4=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var x,D0,x0,D6,n$,r$,s$,o$,a$,t$,e$,$1,Z1;var d0=v(()=>{x=class x extends Error{};D0=class D0 extends x{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 D6({message:z,cause:j4(Z)});let X=Z,J=X?.error?.type;if($===400)return new r$($,X,z,Q,J);if($===401)return new s$($,X,z,Q,J);if($===403)return new o$($,X,z,Q,J);if($===404)return new a$($,X,z,Q,J);if($===409)return new t$($,X,z,Q,J);if($===422)return new e$($,X,z,Q,J);if($===429)return new $1($,X,z,Q,J);if($>=500)return new Z1($,X,z,Q,J);return new D0($,X,z,Q,J)}};x0=class x0 extends D0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};D6=class D6 extends D0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};n$=class n$ extends D6{constructor({message:$}={}){super({message:$??"Request timed out."})}};r$=class r$ extends D0{};s$=class s$ extends D0{};o$=class o$ extends D0{};a$=class a$ extends D0{};t$=class t$ extends D0{};e$=class e$ extends D0{};$1=class $1 extends D0{};Z1=class Z1 extends D0{}});function NZ($){if(typeof $!=="object")return{};return $??{}}function Yz($){if(!$)return!0;for(let Z in $)return!1;return!0}function kV($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var Fw,yV=($)=>{return Fw.test($)},Xz=($)=>(Xz=Array.isArray,Xz($)),Jz,bV=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new x(`${$} must be an integer`);if(Z<0)throw new x(`${$} must be a positive integer`);return Z},OZ=($)=>{try{return JSON.parse($)}catch(Z){return}};var Q$=v(()=>{d0();Fw=/^[a-z][a-z0-9+.-]*:/i,Jz=Xz});var vV=($)=>new Promise((Z)=>setTimeout(Z,$));var I6="0.91.1";function Pw(){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 Ew(){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 uV=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},Sw=()=>{let $=Pw();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I6,"X-Stainless-OS":hV(Deno.build.os),"X-Stainless-Arch":gV(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I6,"X-Stainless-OS":hV(globalThis.process.platform??"unknown"),"X-Stainless-Arch":gV(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=Ew();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},gV=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},hV=($)=>{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"},fV,mV=()=>{return fV??(fV=Sw())};var Wz=()=>{};function cV(){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 Uz(...$){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 DZ($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return Uz({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 w4($){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 pV($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),z=Z.cancel();Z.releaseLock(),await z}var lV=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function dV($){return Object.entries($).filter(([Z,z])=>typeof z<"u").map(([Z,z])=>{if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(z)}`;if(z===null)return`${encodeURIComponent(Z)}=`;throw new x(`Cannot stringify type ${typeof z}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}var iV=v(()=>{d0()});function sV($){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 x4($){let Z;return(nV??(Z=new globalThis.TextEncoder,nV=Z.encode.bind(Z)))($)}function Gz($){let Z;return(rV??(Z=new globalThis.TextDecoder,rV=Z.decode.bind(Z)))($)}var nV,rV;class T6{constructor(){a0.set(this,void 0),t0.set(this,void 0),P(this,a0,new Uint8Array,"f"),P(this,t0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?x4($):$;P(this,a0,sV([O(this,a0,"f"),Z]),"f");let z=[],Q;while((Q=xw(O(this,a0,"f"),O(this,t0,"f")))!=null){if(Q.carriage&&O(this,t0,"f")==null){P(this,t0,Q.index,"f");continue}if(O(this,t0,"f")!=null&&(Q.index!==O(this,t0,"f")+1||Q.carriage)){z.push(Gz(O(this,a0,"f").subarray(0,O(this,t0,"f")-1))),P(this,a0,O(this,a0,"f").subarray(O(this,t0,"f")),"f"),P(this,t0,null,"f");continue}let X=O(this,t0,"f")!==null?Q.preceding-1:Q.preceding,J=Gz(O(this,a0,"f").subarray(0,X));z.push(J),P(this,a0,O(this,a0,"f").subarray(Q.index),"f"),P(this,t0,null,"f")}return z}flush(){if(!O(this,a0,"f").length)return[];return this.decode(`
166
+ `)}}function xw($,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 oV($){for(let Q=0;Q<$.length-1;Q++){if($[Q]===10&&$[Q+1]===10)return Q+2;if($[Q]===13&&$[Q+1]===13)return Q+2;if($[Q]===13&&$[Q+1]===10&&Q+3<$.length&&$[Q+2]===13&&$[Q+3]===10)return Q+4}return-1}var a0,t0;var Vz=v(()=>{r2();a0=new WeakMap,t0=new WeakMap;T6.NEWLINE_CHARS=new Set([`
167
+ `,"\r"]);T6.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function y4(){}function IZ($,Z,z){if(!Z||TZ[$]>TZ[z])return y4;else return Z[$].bind(Z)}function E0($){let Z=$.logger,z=$.logLevel??"off";if(!Z)return yw;let Q=aV.get(Z);if(Q&&Q[0]===z)return Q[1];let X={error:IZ("error",Z,z),warn:IZ("warn",Z,z),info:IZ("info",Z,z),debug:IZ("debug",Z,z)};return aV.set(Z,[z,X]),X}var TZ,Hz=($,Z,z)=>{if(!$)return;if(kV(TZ,$))return $;E0(z).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(TZ))}`);return},yw,aV,o2=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,z])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":z]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var AZ=v(()=>{Q$();TZ={off:0,error:200,warn:300,info:400,debug:500};yw={error:y4,warn:y4,info:y4,debug:y4},aV=new WeakMap});async function*kw($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new x("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new x("Attempted to iterate over a response with no body")}let z=new tV,Q=new T6,X=w4($.body);for await(let J of bw(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*bw($){let Z=new Uint8Array;for await(let z of $){if(z==null)continue;let Q=z instanceof ArrayBuffer?new Uint8Array(z):typeof z==="string"?x4(z):z,X=new Uint8Array(Z.length+Q.length);X.set(Z),X.set(Q,Z.length),Z=X;let J;while((J=oV(Z))!==-1)yield Z.slice(0,J),Z=Z.slice(J)}if(Z.length>0)yield Z}class tV{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]=vw($,":");if(Q.startsWith(" "))Q=Q.substring(1);if(Z==="event")this.event=Q;else if(Z==="data")this.data.push(Q);return null}}function vw($,Z){let z=$.indexOf(Z);if(z!==-1)return[$.substring(0,z),Z,$.substring(z+Z.length)];return[$,"",""]}var k4,e0;var Kz=v(()=>{r2();d0();Vz();Q$();AZ();d0();e0=class e0{constructor($,Z,z){this.iterator=$,k4.set(this,void 0),this.controller=Z,P(this,k4,z,"f")}static fromSSEResponse($,Z,z){let Q=!1,X=z?E0(z):console;async function*J(){if(Q)throw new x("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of kw($,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=OZ(W.data)??W.data,G=U?.error?.type;throw new D0(void 0,U,void 0,$.headers,G)}}Y=!0}catch(W){if(s2(W))return;throw W}finally{if(!Y)Z.abort()}}return new e0(J,Z,z)}static fromReadableStream($,Z,z){let Q=!1;async function*X(){let Y=new T6,W=w4($);for await(let U of W)for(let G of Y.decode(U))yield G;for(let U of Y.flush())yield U}async function*J(){if(Q)throw new x("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Q=!0;let Y=!1;try{for await(let W of X()){if(Y)continue;if(W)yield JSON.parse(W)}Y=!0}catch(W){if(s2(W))return;throw W}finally{if(!Y)Z.abort()}}return new e0(J,Z,z)}[(k4=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],z=this.iterator(),Q=(X)=>{return{next:()=>{if(X.length===0){let J=z.next();$.push(J),Z.push(J)}return X.shift()}}};return[new e0(()=>Q($),this.controller,O(this,k4,"f")),new e0(()=>Q(Z),this.controller,O(this,k4,"f"))]}toReadableStream(){let $=this,Z;return Uz({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:Q,done:X}=await Z.next();if(X)return z.close();let J=x4(JSON.stringify(Q)+`
169
+ `);z.enqueue(J)}catch(Q){z.error(Q)}},async cancel(){await Z.return?.()}})}}});async function CZ($,Z){let{response:z,requestLogID:Q,retryOfRequestLogID:X,startTime:J}=Z,Y=await(async()=>{if(Z.options.stream){if(E0($).debug("response",z.status,z.url,z.headers,z.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(z,Z.controller);return e0.fromSSEResponse(z,Z.controller)}if(z.status===204)return null;if(Z.options.__binaryResponse)return z;let U=z.headers.get("content-type")?.split(";")[0]?.trim();if(U?.includes("application/json")||U?.endsWith("+json")){if(z.headers.get("content-length")==="0")return;let K=await z.json();return qz(K,z)}return await z.text()})();return E0($).debug(`[${Q}] response parsed`,o2({retryOfRequestLogID:X,url:z.url,status:z.status,body:Y,durationMs:Date.now()-J})),Y}function qz($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var Bz=v(()=>{Kz();AZ()});var b4,A6;var _Z=v(()=>{r2();Bz();A6=class A6 extends Promise{constructor($,Z,z=CZ){super((Q)=>{Q(null)});this.responsePromise=Z,this.parseResponse=z,b4.set(this,void 0),P(this,b4,$,"f")}_thenUnwrap($){return new A6(O(this,b4,"f"),this.responsePromise,async(Z,z)=>qz($(await this.parseResponse(Z,z),z),z.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,Z]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:Z,request_id:Z.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(($)=>this.parseResponse(O(this,b4,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};b4=new WeakMap});var RZ,Mz,v4,P2,z0;var H0=v(()=>{r2();d0();Bz();_Z();Q$();Mz=class Mz{constructor($,Z,z,Q){RZ.set(this,void 0),P(this,RZ,$,"f"),this.options=Q,this.response=Z,this.body=z}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new x("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await O(this,RZ,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(RZ=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};v4=class v4 extends A6{constructor($,Z,z){super($,Z,async(Q,X)=>new z(Q,X.response,await CZ(Q,X),X.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};P2=class P2 extends Mz{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:{...NZ(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...NZ(this.options.query),after_id:$}}}};z0=class z0 extends Mz{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:{...NZ(this.options.query),page:$}}}}});function X$($,Z,z){return Nz(),new File($,Z??"unknown_file",z)}function g4($,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 hw($){let Z=typeof $==="function"?$:$.fetch,z=eV.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 eV.set(Z,Q),Q}var Nz=()=>{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`.":""))}},Oz=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",z1=async($,Z,z=!0)=>{return{...$,body:await fw($.body,Z,z)}},eV,fw=async($,Z,z=!0)=>{if(!await hw(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])=>Lz(Q,X,J,z))),Q},uw=($)=>$ instanceof Blob&&("name"in $),Lz=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,X$([await z.blob()],g4(z,Q),X))}else if(Oz(z))$.append(Z,X$([await new Response(DZ(z)).blob()],g4(z,Q)));else if(uw(z))$.append(Z,X$([z],g4(z,Q),{type:z.type}));else if(Array.isArray(z))await Promise.all(z.map((X)=>Lz($,Z+"[]",X,Q)));else if(typeof z==="object")await Promise.all(Object.entries(z).map(([X,J])=>Lz($,`${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 Q1=v(()=>{eV=new WeakMap});async function h4($,Z,z){if(Nz(),$=await $,Z||(Z=g4($,!0)),mw($)){if($ instanceof File&&Z==null&&z==null)return $;return X$([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...z})}if(cw($)){let X=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),X$(await Dz(X),Z,z)}let Q=await Dz($);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 X$(Q,Z,z)}async function Dz($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if($H($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(Oz($))for await(let z of $)Z.push(...await Dz(z));else{let z=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${z?`; constructor: ${z}`:""}${pw($)}`)}return Z}function pw($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((z)=>`"${z}"`).join(", ")}]`}var $H=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",mw=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&$H($),cw=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var ZH=v(()=>{Q1();Q1()});var Iz=v(()=>{ZH()});var zH=()=>{};class c{constructor($){this._client=$}}function*dw($){if(!$)return;if(QH 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(Jz($))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=Jz(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 QH,D=($)=>{let Z=new Headers,z=new Set;for(let Q of $){let X=new Set;for(let[J,Y]of dw(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{[QH]:!0,values:Z,nulls:z}};var W0=v(()=>{Q$();QH=Symbol.for("brand.privateNullableHeaders")});function JH($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var XH,iw=($=JH)=>function(z,...Q){if(z.length===1)return z[0];let X=!1,J=[],Y=z.reduce((V,H,K)=>{if(/[?#]/.test(H))X=!0;let q=Q[K],L=(X?encodeURIComponent:$)(""+q);if(K!==Q.length&&(q==null||typeof q==="object"&&q.toString===Object.getPrototypeOf(Object.getPrototypeOf(q.hasOwnProperty??XH)??XH)?.toString))L=q+"",J.push({start:V.length+H.length,length:L.length,error:`Value of type ${Object.prototype.toString.call(q).slice(8,-1)} is not a valid path parameter`});return V+H+(K===Q.length?"":L)},""),W=Y.split(/[?#]/,1)[0],U=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,G;while((G=U.exec(W))!==null)J.push({start:G.index,length:G[0].length,error:`Value "${G[0]}" can't be safely passed as a path parameter`});if(J.sort((V,H)=>V.start-H.start),J.length>0){let V=0,H=J.reduce((K,q)=>{let L=" ".repeat(q.start-V),B="^".repeat(q.length);return V=q.start+q.length,K+L+B},"");throw new x(`Path parameters result in path with invalid segments:
170
+ ${J.map((K)=>K.error).join(`
171
171
  `)}
172
172
  ${Y}
173
- ${q}`)}return Y},R;var D0=v(()=>{l0();dV=Object.freeze(Object.create(null)),R=Yw(iV)});var g4;var Kz=v(()=>{V0();Y0();D0();g4=class g4 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/environments/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/environments/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/environments?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/environments/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/environments/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function TZ($){return typeof $==="object"&&$!==null&&h4 in $}function Bz($,Z){let z=new Set;if($){for(let Q of $)if(TZ(Q))z.add(Q[h4])}if(Z)for(let Q of Z){if(TZ(Q))z.add(Q[h4]);if(Array.isArray(Q.content)){for(let X of Q.content)if(TZ(X))z.add(X[h4])}}return Array.from(z)}function AZ($,Z){let z=Bz($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function nV($){if(TZ($))return{"x-stainless-helper":$[h4]};return{}}var h4;var f4=v(()=>{h4=Symbol("anthropic.sdk.stainlessHelper")});var u4;var Mz=v(()=>{V0();Y0();f4();Z1();D0();u4=class u4 extends c{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",F2,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/files/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}download($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/files/${$}/content?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},z?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/files/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}upload($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/files?beta=true",$1({body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},nV(Q.file),Z?.headers])},this._client))}}});var m4;var Lz=v(()=>{V0();Y0();D0();m4=class m4 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}?beta=true`,{...z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models?beta=true",F2,{query:Q,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var c4;var Nz=v(()=>{V0();Y0();D0();c4=class c4 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/user_profiles/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/user_profiles/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var p4;var Oz=v(()=>{V0();Y0();D0();p4=class p4 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/agents/${$}/versions?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var z1;var Dz=v(()=>{Oz();Oz();V0();Y0();D0();z1=class z1 extends c{constructor(){super(...arguments);this.versions=new p4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.get(R`/v1/agents/${$}?beta=true`,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/agents/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/agents?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/agents/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};z1.Versions=p4});var l4;var Iz=v(()=>{V0();Y0();D0();l4=class l4 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:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{memory_store_id:Q,view:X,betas:J,...Y}=Z;return this._client.post(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{view:X},body:Y,...z,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memories?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{memory_store_id:Q,expected_content_sha256:X,betas:J}=Z;return this._client.delete(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{expected_content_sha256:X},...z,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var d4;var Tz=v(()=>{V0();Y0();D0();d4=class d4 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:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memory_versions?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}redact($,Z,z){let{memory_store_id:Q,betas:X}=Z;return this._client.post(R`/v1/memory_stores/${Q}/memory_versions/${$}/redact?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var z$;var Az=v(()=>{Iz();Iz();Tz();Tz();V0();Y0();D0();z$=class z$ extends c{constructor(){super(...arguments);this.memories=new l4(this._client),this.memoryVersions=new d4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/memory_stores/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/memory_stores/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/memory_stores/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/memory_stores/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};z$.Memories=l4;z$.MemoryVersions=d4});var Q1=v(()=>{l0()});var CZ;var Cz=v(()=>{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 rV($){return $?.output_format??$?.output_config?.format}function _z($,Z,z){let Q=rV(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 Rz($,Z,z)}function Rz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=Lw(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 Lw($,Z){let z=rV($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new x(`Failed to parse structured output: ${Q}`)}}var Fz=v(()=>{l0()});var Nw=($)=>{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},X1=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),X1($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),X1($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),X1($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),X1($);break;case"delimiter":return $=$.slice(0,$.length-1),X1($);break}return $},Ow=($)=>{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 $},Dw=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},_Z=($)=>JSON.parse(Dw(Ow(X1(Nw($)))));var Pz=()=>{};var Sz=v(()=>{Xz()});function tV($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function eV($){}var V2,A6,J1,i4,RZ,n4,r4,FZ,s4,s2,o4,PZ,SZ,Q$,EZ,jZ,a4,Ez,sV,wZ,jz,wz,xz,oV,aV="__json_buf",t4;var $q=v(()=>{i2();Pz();Q1();Sz();Fz();t4=class t4{constructor($,Z){V2.add(this),this.messages=[],this.receivedMessages=[],A6.set(this,void 0),J1.set(this,null),this.controller=new AbortController,i4.set(this,void 0),RZ.set(this,()=>{}),n4.set(this,()=>{}),r4.set(this,void 0),FZ.set(this,()=>{}),s4.set(this,()=>{}),s2.set(this,{}),o4.set(this,!1),PZ.set(this,!1),SZ.set(this,!1),Q$.set(this,!1),EZ.set(this,void 0),jZ.set(this,void 0),a4.set(this,void 0),wZ.set(this,(z)=>{if(P(this,PZ,!0,"f"),n2(z))z=new w0;if(z instanceof w0)return P(this,SZ,!0,"f"),this._emit("abort",z);if(z instanceof x)return this._emit("error",z);if(z instanceof Error){let Q=new x(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new x(String(z)))}),P(this,i4,new Promise((z,Q)=>{P(this,RZ,z,"f"),P(this,n4,Q,"f")}),"f"),P(this,r4,new Promise((z,Q)=>{P(this,FZ,z,"f"),P(this,s4,Q,"f")}),"f"),O(this,i4,"f").catch(()=>{}),O(this,r4,"f").catch(()=>{}),P(this,J1,$,"f"),P(this,a4,Z?.logger??console,"f")}get response(){return O(this,EZ,"f")}get request_id(){return O(this,jZ,"f")}async withResponse(){P(this,Q$,!0,"f");let $=await O(this,i4,"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 t4(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new t4(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return P(X,J1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},O(this,wZ,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{O(this,V2,"m",jz).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)O(this,V2,"m",wz).call(this,W);if(Y.controller.signal?.aborted)throw new w0;O(this,V2,"m",xz).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;P(this,EZ,$,"f"),P(this,jZ,$?.headers.get("request-id"),"f"),O(this,RZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,o4,"f")}get errored(){return O(this,PZ,"f")}get aborted(){return O(this,SZ,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,s2,"f")[$]||(O(this,s2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,s2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(O(this,s2,"f")[$]||(O(this,s2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(P(this,Q$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){P(this,Q$,!0,"f"),await O(this,r4,"f")}get currentMessage(){return O(this,A6,"f")}async finalMessage(){return await this.done(),O(this,V2,"m",Ez).call(this)}async finalText(){return await this.done(),O(this,V2,"m",sV).call(this)}_emit($,...Z){if(O(this,o4,"f"))return;if($==="end")P(this,o4,!0,"f"),O(this,FZ,"f").call(this);let z=O(this,s2,"f")[$];if(z)O(this,s2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,Q$,"f")&&!z?.length)Promise.reject(Q);O(this,n4,"f").call(this,Q),O(this,s4,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,Q$,"f")&&!z?.length)Promise.reject(Q);O(this,n4,"f").call(this,Q),O(this,s4,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,V2,"m",Ez).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,Q;if(z){if(z.aborted)this.controller.abort();Q=this.controller.abort.bind(this.controller),z.addEventListener("abort",Q)}try{O(this,V2,"m",jz).call(this),this._connected(null);let X=t0.fromReadableStream($,this.controller);for await(let J of X)O(this,V2,"m",wz).call(this,J);if(X.controller.signal?.aborted)throw new w0;O(this,V2,"m",xz).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(A6=new WeakMap,J1=new WeakMap,i4=new WeakMap,RZ=new WeakMap,n4=new WeakMap,r4=new WeakMap,FZ=new WeakMap,s4=new WeakMap,s2=new WeakMap,o4=new WeakMap,PZ=new WeakMap,SZ=new WeakMap,Q$=new WeakMap,EZ=new WeakMap,jZ=new WeakMap,a4=new WeakMap,wZ=new WeakMap,V2=new WeakSet,Ez=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},sV=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new x("stream ended without producing a content block with type=text");return Z.join(" ")},jz=function(){if(this.ended)return;P(this,A6,void 0,"f")},wz=function(Z){if(this.ended)return;let z=O(this,V2,"m",oV).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(tV(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:eV(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(_z(z,O(this,J1,"f"),{logger:O(this,a4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{P(this,A6,z,"f");break}case"content_block_start":case"message_delta":break}},xz=function(){if(this.ended)throw new x("stream has ended, this shouldn't happen");let Z=O(this,A6,"f");if(!Z)throw new x("request ended without sending any chunks");return P(this,A6,void 0,"f"),_z(Z,O(this,J1,"f"),{logger:O(this,a4,"f")})},oV=function(Z){let z=O(this,A6,"f");if(Z.type==="message_start"){if(z)throw new x(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new x(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.container=Z.delta.container,z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,z.context_management=Z.context_management,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)z.usage.iterations=Z.usage.iterations;return z;case"content_block_start":return z.content.push(Z.content_block),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&tV(Q)){let X=Q[aV]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,aV,{value:X,enumerable:!1,writable:!0}),X)try{J.input=_Z(X)}catch(Y){let W=new x(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);O(this,wZ,"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:eV(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 t0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var Y1;var xZ=v(()=>{Y1=class Y1 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 Zq=1e5,zq=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
173
+ ${H}`)}return Y},R;var I0=v(()=>{d0();XH=Object.freeze(Object.create(null)),R=iw(JH)});var f4;var Tz=v(()=>{H0();W0();I0();f4=class f4 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/environments?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/environments/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/environments/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/environments?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/environments/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/environments/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});function FZ($){return typeof $==="object"&&$!==null&&u4 in $}function Az($,Z){let z=new Set;if($){for(let Q of $)if(FZ(Q))z.add(Q[u4])}if(Z)for(let Q of Z){if(FZ(Q))z.add(Q[u4]);if(Array.isArray(Q.content)){for(let X of Q.content)if(FZ(X))z.add(X[u4])}}return Array.from(z)}function PZ($,Z){let z=Az($,Z);if(z.length===0)return{};return{"x-stainless-helper":z.join(", ")}}function YH($){if(FZ($))return{"x-stainless-helper":$[u4]};return{}}var u4;var m4=v(()=>{u4=Symbol("anthropic.sdk.stainlessHelper")});var c4;var Cz=v(()=>{H0();W0();m4();Q1();I0();c4=class c4 extends c{list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/files?beta=true",P2,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/files/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}download($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/files/${$}/content?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},z?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/files/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"files-api-2025-04-14"].toString()},z?.headers])})}upload($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/files?beta=true",z1({body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},YH(Q.file),Z?.headers])},this._client))}}});var p4;var _z=v(()=>{H0();W0();I0();p4=class p4 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}?beta=true`,{...z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models?beta=true",P2,{query:Q,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var l4;var Rz=v(()=>{H0();W0();I0();l4=class l4 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/user_profiles?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/user_profiles/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/user_profiles/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/user_profiles?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"user-profiles-2026-03-24"].toString()},Z?.headers])})}createEnrollmentURL($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/user_profiles/${$}/enrollment_url?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"user-profiles-2026-03-24"].toString()},z?.headers])})}}});var d4;var Fz=v(()=>{H0();W0();I0();d4=class d4 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/agents/${$}/versions?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var X1;var Pz=v(()=>{Fz();Fz();H0();W0();I0();X1=class X1 extends c{constructor(){super(...arguments);this.versions=new d4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/agents?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.get(R`/v1/agents/${$}?beta=true`,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/agents/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/agents?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/agents/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};X1.Versions=d4});var i4;var Sz=v(()=>{H0();W0();I0();i4=class i4 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:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{memory_store_id:Q,betas:X,...J}=Z;return this._client.get(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{memory_store_id:Q,view:X,betas:J,...Y}=Z;return this._client.post(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{view:X},body:Y,...z,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memories?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{memory_store_id:Q,expected_content_sha256:X,betas:J}=Z;return this._client.delete(R`/v1/memory_stores/${Q}/memories/${$}?beta=true`,{query:{expected_content_sha256:X},...z,headers:D([{"anthropic-beta":[...J??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var n4;var Ez=v(()=>{H0();W0();I0();n4=class n4 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:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/memory_stores/${$}/memory_versions?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}redact($,Z,z){let{memory_store_id:Q,betas:X}=Z;return this._client.post(R`/v1/memory_stores/${Q}/memory_versions/${$}/redact?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var J$;var jz=v(()=>{Sz();Sz();Ez();Ez();H0();W0();I0();J$=class J$ extends c{constructor(){super(...arguments);this.memories=new i4(this._client),this.memoryVersions=new n4(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/memory_stores?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/memory_stores/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/memory_stores/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/memory_stores?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/memory_stores/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/memory_stores/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};J$.Memories=i4;J$.MemoryVersions=n4});var J1=v(()=>{d0()});var SZ;var wz=v(()=>{SZ={"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 WH($){return $?.output_format??$?.output_config?.format}function xz($,Z,z){let Q=WH(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 yz($,Z,z)}function yz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=zx(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 zx($,Z){let z=WH($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new x(`Failed to parse structured output: ${Q}`)}}var kz=v(()=>{d0()});var Qx=($)=>{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},Y1=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),Y1($);break;case"number":let z=Z.value[Z.value.length-1];if(z==="."||z==="-")return $=$.slice(0,$.length-1),Y1($);case"string":let Q=$[$.length-2];if(Q?.type==="delimiter")return $=$.slice(0,$.length-1),Y1($);else if(Q?.type==="brace"&&Q.value==="{")return $=$.slice(0,$.length-1),Y1($);break;case"delimiter":return $=$.slice(0,$.length-1),Y1($);break}return $},Xx=($)=>{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 $},Jx=($)=>{let Z="";return $.map((z)=>{switch(z.type){case"string":Z+='"'+z.value+'"';break;default:Z+=z.value;break}}),Z},EZ=($)=>JSON.parse(Jx(Xx(Y1(Qx($)))));var bz=()=>{};var vz=v(()=>{Kz()});function HH($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function KH($){}var K2,C6,W1,r4,jZ,s4,o4,wZ,a4,a2,t4,xZ,yZ,Y$,kZ,bZ,e4,gz,UH,vZ,hz,fz,uz,GH,VH="__json_buf",$8;var qH=v(()=>{r2();bz();J1();vz();kz();$8=class $8{constructor($,Z){K2.add(this),this.messages=[],this.receivedMessages=[],C6.set(this,void 0),W1.set(this,null),this.controller=new AbortController,r4.set(this,void 0),jZ.set(this,()=>{}),s4.set(this,()=>{}),o4.set(this,void 0),wZ.set(this,()=>{}),a4.set(this,()=>{}),a2.set(this,{}),t4.set(this,!1),xZ.set(this,!1),yZ.set(this,!1),Y$.set(this,!1),kZ.set(this,void 0),bZ.set(this,void 0),e4.set(this,void 0),vZ.set(this,(z)=>{if(P(this,xZ,!0,"f"),s2(z))z=new x0;if(z instanceof x0)return P(this,yZ,!0,"f"),this._emit("abort",z);if(z instanceof x)return this._emit("error",z);if(z instanceof Error){let Q=new x(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new x(String(z)))}),P(this,r4,new Promise((z,Q)=>{P(this,jZ,z,"f"),P(this,s4,Q,"f")}),"f"),P(this,o4,new Promise((z,Q)=>{P(this,wZ,z,"f"),P(this,a4,Q,"f")}),"f"),O(this,r4,"f").catch(()=>{}),O(this,o4,"f").catch(()=>{}),P(this,W1,$,"f"),P(this,e4,Z?.logger??console,"f")}get response(){return O(this,kZ,"f")}get request_id(){return O(this,bZ,"f")}async withResponse(){P(this,Y$,!0,"f");let $=await O(this,r4,"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 $8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new $8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return P(X,W1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},O(this,vZ,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{O(this,K2,"m",hz).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)O(this,K2,"m",fz).call(this,W);if(Y.controller.signal?.aborted)throw new x0;O(this,K2,"m",uz).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;P(this,kZ,$,"f"),P(this,bZ,$?.headers.get("request-id"),"f"),O(this,jZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,t4,"f")}get errored(){return O(this,xZ,"f")}get aborted(){return O(this,yZ,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,a2,"f")[$]||(O(this,a2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,a2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(O(this,a2,"f")[$]||(O(this,a2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(P(this,Y$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){P(this,Y$,!0,"f"),await O(this,o4,"f")}get currentMessage(){return O(this,C6,"f")}async finalMessage(){return await this.done(),O(this,K2,"m",gz).call(this)}async finalText(){return await this.done(),O(this,K2,"m",UH).call(this)}_emit($,...Z){if(O(this,t4,"f"))return;if($==="end")P(this,t4,!0,"f"),O(this,wZ,"f").call(this);let z=O(this,a2,"f")[$];if(z)O(this,a2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,Y$,"f")&&!z?.length)Promise.reject(Q);O(this,s4,"f").call(this,Q),O(this,a4,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,Y$,"f")&&!z?.length)Promise.reject(Q);O(this,s4,"f").call(this,Q),O(this,a4,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,K2,"m",gz).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,Q;if(z){if(z.aborted)this.controller.abort();Q=this.controller.abort.bind(this.controller),z.addEventListener("abort",Q)}try{O(this,K2,"m",hz).call(this),this._connected(null);let X=e0.fromReadableStream($,this.controller);for await(let J of X)O(this,K2,"m",fz).call(this,J);if(X.controller.signal?.aborted)throw new x0;O(this,K2,"m",uz).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(C6=new WeakMap,W1=new WeakMap,r4=new WeakMap,jZ=new WeakMap,s4=new WeakMap,o4=new WeakMap,wZ=new WeakMap,a4=new WeakMap,a2=new WeakMap,t4=new WeakMap,xZ=new WeakMap,yZ=new WeakMap,Y$=new WeakMap,kZ=new WeakMap,bZ=new WeakMap,e4=new WeakMap,vZ=new WeakMap,K2=new WeakSet,gz=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},UH=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new x("stream ended without producing a content block with type=text");return Z.join(" ")},hz=function(){if(this.ended)return;P(this,C6,void 0,"f")},fz=function(Z){if(this.ended)return;let z=O(this,K2,"m",GH).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(HH(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:KH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(xz(z,O(this,W1,"f"),{logger:O(this,e4,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{P(this,C6,z,"f");break}case"content_block_start":case"message_delta":break}},uz=function(){if(this.ended)throw new x("stream has ended, this shouldn't happen");let Z=O(this,C6,"f");if(!Z)throw new x("request ended without sending any chunks");return P(this,C6,void 0,"f"),xz(Z,O(this,W1,"f"),{logger:O(this,e4,"f")})},GH=function(Z){let z=O(this,C6,"f");if(Z.type==="message_start"){if(z)throw new x(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new x(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.container=Z.delta.container,z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,z.context_management=Z.context_management,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)z.usage.iterations=Z.usage.iterations;return z;case"content_block_start":return z.content.push(Z.content_block),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&HH(Q)){let X=Q[VH]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,VH,{value:X,enumerable:!1,writable:!0}),X)try{J.input=EZ(X)}catch(Y){let W=new x(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Y}. JSON: ${X}`);O(this,vZ,"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:KH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new e0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var U1;var gZ=v(()=>{U1=class U1 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 BH=1e5,MH=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
174
174
  1. Task Overview
175
175
  The user's core request and success criteria
176
176
  Any clarifications or constraints they specified
@@ -192,115 +192,115 @@ User preferences or style requirements
192
192
  Domain-specific details that aren't obvious
193
193
  Any promises made to the user
194
194
  Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
195
- Wrap your summary in <summary></summary> tags.`;function Xq(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function Iw($,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 Y1?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var e4,W1,X$,_0,d0,e0,o2,C6,$8,Qq,yz,Z8;var kz=v(()=>{i2();xZ();l0();Y0();f4();Z8=class Z8{constructor($,Z,z){e4.add(this),this.client=$,W1.set(this,!1),X$.set(this,!1),_0.set(this,void 0),d0.set(this,void 0),e0.set(this,void 0),o2.set(this,void 0),C6.set(this,void 0),$8.set(this,0),P(this,_0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...Bz(Z.tools,Z.messages)].join(", ");if(P(this,d0,{...z,headers:D([{"x-stainless-helper":X},z?.headers])},"f"),P(this,C6,Xq(),"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*[(W1=new WeakMap,X$=new WeakMap,_0=new WeakMap,d0=new WeakMap,e0=new WeakMap,o2=new WeakMap,C6=new WeakMap,$8=new WeakMap,e4=new WeakSet,Qq=async function(){let Z=O(this,_0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(O(this,e0,"f")!==void 0)try{let U=await O(this,e0,"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??Zq;if(z<Q)return!1;let X=Z.model??O(this,_0,"f").params.model,J=Z.summaryPrompt??zq,Y=O(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:O(this,_0,"f").params.max_tokens},{signal:O(this,d0,"f").signal,headers:D([O(this,d0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new x("Expected text response for compaction");return O(this,_0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(O(this,W1,"f"))throw new x("Cannot iterate over a consumed stream");P(this,W1,!0,"f"),P(this,X$,!0,"f"),P(this,o2,void 0,"f");try{while(!0){let Z;try{if(O(this,_0,"f").params.max_iterations&&O(this,$8,"f")>=O(this,_0,"f").params.max_iterations)break;P(this,X$,!1,"f"),P(this,o2,void 0,"f"),P(this,$8,($=O(this,$8,"f"),$++,$),"f"),P(this,e0,void 0,"f");let{max_iterations:z,compactionControl:Q,...X}=O(this,_0,"f").params;if(X.stream)Z=this.client.beta.messages.stream({...X},O(this,d0,"f")),P(this,e0,Z.finalMessage(),"f"),O(this,e0,"f").catch(()=>{}),yield Z;else P(this,e0,this.client.beta.messages.create({...X,stream:!1},O(this,d0,"f")),"f"),yield O(this,e0,"f");if(!await O(this,e4,"m",Qq).call(this)){if(!O(this,X$,"f")){let{role:W,content:U}=await O(this,e0,"f");O(this,_0,"f").params.messages.push({role:W,content:U})}let Y=await O(this,e4,"m",yz).call(this,O(this,_0,"f").params.messages.at(-1));if(Y)O(this,_0,"f").params.messages.push(Y);else if(!O(this,X$,"f"))break}}finally{if(Z)Z.abort()}}if(!O(this,e0,"f"))throw new x("ToolRunner concluded without a message from the server");O(this,C6,"f").resolve(await O(this,e0,"f"))}catch(Z){throw P(this,W1,!1,"f"),O(this,C6,"f").promise.catch(()=>{}),O(this,C6,"f").reject(Z),P(this,C6,Xq(),"f"),Z}}setMessagesParams($){if(typeof $==="function")O(this,_0,"f").params=$(O(this,_0,"f").params);else O(this,_0,"f").params=$;P(this,X$,!0,"f"),P(this,o2,void 0,"f")}setRequestOptions($){if(typeof $==="function")P(this,d0,$(O(this,d0,"f")),"f");else P(this,d0,{...O(this,d0,"f"),...$},"f")}async generateToolResponse($=O(this,d0,"f").signal){let Z=await O(this,e0,"f")??this.params.messages.at(-1);if(!Z)return null;return O(this,e4,"m",yz).call(this,Z,$)}done(){return O(this,C6,"f").promise}async runUntilDone(){if(!O(this,W1,"f"))for await(let $ of this);return this.done()}get params(){return O(this,_0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};yz=async function(Z,z=O(this,d0,"f").signal){if(O(this,o2,"f")!==void 0)return O(this,o2,"f");return P(this,o2,Iw(O(this,_0,"f").params,Z,{...O(this,d0,"f"),signal:z}),"f"),O(this,o2,"f")}});var U1;var bz=v(()=>{l0();zz();U1=class U1{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new I6;for await(let Z of this.iterator)for(let z of $.decode(Z))yield JSON.parse(z);for(let Z of $.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new x("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new x("Attempted to iterate over a response with no body")}return new U1(E4($.body),Z)}}});var z8;var vz=v(()=>{V0();Y0();bz();Q1();D0();z8=class z8 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/messages/batches/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",F2,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/messages/batches/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}cancel($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/messages/batches/${$}/cancel?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}async results($,Z={},z){let Q=await this.retrieve($);if(!Q.results_url)throw new x(`No batch \`results_url\`; Has it finished processing? ${Q.processing_status} - ${Q.id}`);let{betas:X}=Z??{};return this._client.get(Q.results_url,{...z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((J,Y)=>U1.fromResponse(Y.response,Y.controller))}}});function Yq($){if(!$.output_format)return $;if($.output_config?.format)throw new x("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...z}=$;return{...z,output_config:{...$.output_config,format:Z}}}var Jq,Aw,_6;var gz=v(()=>{Q1();Cz();Y0();f4();Fz();$q();kz();xZ();vz();vz();kz();xZ();Jq={"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"},Aw=["claude-mythos-preview","claude-opus-4-6"];_6=class _6 extends c{constructor(){super(...arguments);this.batches=new z8(this._client)}create($,Z){let z=Yq($),{betas:Q,...X}=z;if(X.model in Jq)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${Jq[X.model]}
196
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Aw.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=AZ(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:D([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>Rz(z,$,{logger:this._client.logger??console}))}stream($,Z){return t4.createMessage(this,$,Z)}countTokens($,Z){let z=Yq($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:D([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new Z8(this._client,$,Z)}};_6.Batches=z8;_6.BetaToolRunner=Z8;_6.ToolError=Y1});var Q8;var hz=v(()=>{V0();Y0();D0();Q8=class Q8 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/events?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}send($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}/events?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}stream($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/sessions/${$}/events/stream?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var X8;var fz=v(()=>{V0();Y0();D0();X8=class X8 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:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{session_id:Q,betas:X,...J}=Z;return this._client.post(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/resources?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.delete(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}add($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}/resources?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var J$;var uz=v(()=>{hz();hz();fz();fz();V0();Y0();D0();J$=class J$ extends c{constructor(){super(...arguments);this.events=new Q8(this._client),this.resources=new X8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/sessions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/sessions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/sessions/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};J$.Events=Q8;J$.Resources=X8});var J8;var mz=v(()=>{V0();Y0();Z1();D0();J8=class J8 extends c{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(R`/v1/skills/${$}/versions?beta=true`,$1({body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])},this._client))}retrieve($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.get(R`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/skills/${$}/versions?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}delete($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.delete(R`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var G1;var cz=v(()=>{mz();mz();V0();Y0();Z1();D0();G1=class G1 extends c{constructor(){super(...arguments);this.versions=new J8(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",$1({body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/skills/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/skills/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};G1.Versions=J8});var Y8;var pz=v(()=>{V0();Y0();D0();Y8=class Y8 extends c{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.get(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{vault_id:Q,betas:X,...J}=Z;return this._client.post(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/vaults/${$}/credentials?beta=true`,Z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.delete(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.post(R`/v1/vaults/${Q}/credentials/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var V1;var lz=v(()=>{pz();pz();V0();Y0();D0();V1=class V1 extends c{constructor(){super(...arguments);this.credentials=new Y8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/vaults/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",Z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/vaults/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/vaults/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};V1.Credentials=Y8});var v0;var dz=v(()=>{Kz();Kz();Mz();Mz();Lz();Lz();Nz();Nz();Dz();Dz();Az();Az();gz();gz();uz();uz();cz();cz();lz();lz();v0=class v0 extends c{constructor(){super(...arguments);this.models=new m4(this._client),this.messages=new _6(this._client),this.agents=new z1(this._client),this.environments=new g4(this._client),this.sessions=new J$(this._client),this.vaults=new V1(this._client),this.memoryStores=new z$(this._client),this.files=new u4(this._client),this.skills=new G1(this._client),this.userProfiles=new c4(this._client)}};v0.Models=m4;v0.Messages=_6;v0.Agents=z1;v0.Environments=g4;v0.Sessions=J$;v0.Vaults=V1;v0.MemoryStores=z$;v0.Files=u4;v0.Skills=G1;v0.UserProfiles=c4});var q1;var iz=v(()=>{Y0();q1=class q1 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function Wq($){return $?.output_config?.format}function nz($,Z,z){let Q=Wq(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 rz($,Z,z)}function rz($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=ww(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 ww($,Z){let z=Wq($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new x(`Failed to parse structured output: ${Q}`)}}var sz=v(()=>{l0()});function qq($){return $.type==="tool_use"||$.type==="server_tool_use"}function Hq($){}var q2,R6,H1,W8,yZ,U8,G8,kZ,V8,a2,q8,bZ,vZ,Y$,gZ,hZ,H8,oz,Uq,az,tz,ez,$Q,Gq,Vq="__json_buf",K8;var Kq=v(()=>{i2();Q1();Sz();Pz();sz();K8=class K8{constructor($,Z){q2.add(this),this.messages=[],this.receivedMessages=[],R6.set(this,void 0),H1.set(this,null),this.controller=new AbortController,W8.set(this,void 0),yZ.set(this,()=>{}),U8.set(this,()=>{}),G8.set(this,void 0),kZ.set(this,()=>{}),V8.set(this,()=>{}),a2.set(this,{}),q8.set(this,!1),bZ.set(this,!1),vZ.set(this,!1),Y$.set(this,!1),gZ.set(this,void 0),hZ.set(this,void 0),H8.set(this,void 0),az.set(this,(z)=>{if(P(this,bZ,!0,"f"),n2(z))z=new w0;if(z instanceof w0)return P(this,vZ,!0,"f"),this._emit("abort",z);if(z instanceof x)return this._emit("error",z);if(z instanceof Error){let Q=new x(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new x(String(z)))}),P(this,W8,new Promise((z,Q)=>{P(this,yZ,z,"f"),P(this,U8,Q,"f")}),"f"),P(this,G8,new Promise((z,Q)=>{P(this,kZ,z,"f"),P(this,V8,Q,"f")}),"f"),O(this,W8,"f").catch(()=>{}),O(this,G8,"f").catch(()=>{}),P(this,H1,$,"f"),P(this,H8,Z?.logger??console,"f")}get response(){return O(this,gZ,"f")}get request_id(){return O(this,hZ,"f")}async withResponse(){P(this,Y$,!0,"f");let $=await O(this,W8,"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 K8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new K8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return P(X,H1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},O(this,az,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{O(this,q2,"m",tz).call(this);let{response:J,data:Y}=await $.create({...Z,stream:!0},{...z,signal:this.controller.signal}).withResponse();this._connected(J);for await(let W of Y)O(this,q2,"m",ez).call(this,W);if(Y.controller.signal?.aborted)throw new w0;O(this,q2,"m",$Q).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;P(this,gZ,$,"f"),P(this,hZ,$?.headers.get("request-id"),"f"),O(this,yZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,q8,"f")}get errored(){return O(this,bZ,"f")}get aborted(){return O(this,vZ,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,a2,"f")[$]||(O(this,a2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,a2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(O(this,a2,"f")[$]||(O(this,a2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(P(this,Y$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){P(this,Y$,!0,"f"),await O(this,G8,"f")}get currentMessage(){return O(this,R6,"f")}async finalMessage(){return await this.done(),O(this,q2,"m",oz).call(this)}async finalText(){return await this.done(),O(this,q2,"m",Uq).call(this)}_emit($,...Z){if(O(this,q8,"f"))return;if($==="end")P(this,q8,!0,"f"),O(this,kZ,"f").call(this);let z=O(this,a2,"f")[$];if(z)O(this,a2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,Y$,"f")&&!z?.length)Promise.reject(Q);O(this,U8,"f").call(this,Q),O(this,V8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,Y$,"f")&&!z?.length)Promise.reject(Q);O(this,U8,"f").call(this,Q),O(this,V8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,q2,"m",oz).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,Q;if(z){if(z.aborted)this.controller.abort();Q=this.controller.abort.bind(this.controller),z.addEventListener("abort",Q)}try{O(this,q2,"m",tz).call(this),this._connected(null);let X=t0.fromReadableStream($,this.controller);for await(let J of X)O(this,q2,"m",ez).call(this,J);if(X.controller.signal?.aborted)throw new w0;O(this,q2,"m",$Q).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(R6=new WeakMap,H1=new WeakMap,W8=new WeakMap,yZ=new WeakMap,U8=new WeakMap,G8=new WeakMap,kZ=new WeakMap,V8=new WeakMap,a2=new WeakMap,q8=new WeakMap,bZ=new WeakMap,vZ=new WeakMap,Y$=new WeakMap,gZ=new WeakMap,hZ=new WeakMap,H8=new WeakMap,az=new WeakMap,q2=new WeakSet,oz=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Uq=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new x("stream ended without producing a content block with type=text");return Z.join(" ")},tz=function(){if(this.ended)return;P(this,R6,void 0,"f")},ez=function(Z){if(this.ended)return;let z=O(this,q2,"m",Gq).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(qq(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:Hq(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(nz(z,O(this,H1,"f"),{logger:O(this,H8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{P(this,R6,z,"f");break}case"content_block_start":case"message_delta":break}},$Q=function(){if(this.ended)throw new x("stream has ended, this shouldn't happen");let Z=O(this,R6,"f");if(!Z)throw new x("request ended without sending any chunks");return P(this,R6,void 0,"f"),nz(Z,O(this,H1,"f"),{logger:O(this,H8,"f")})},Gq=function(Z){let z=O(this,R6,"f");if(Z.type==="message_start"){if(z)throw new x(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new x(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;return z;case"content_block_start":return z.content.push({...Z.content_block}),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&qq(Q)){let X=Q[Vq]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,Vq,{value:X,enumerable:!1,writable:!0}),X)J.input=_Z(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:Hq(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 t0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var B8;var ZQ=v(()=>{V0();Y0();bz();Q1();D0();B8=class B8 extends c{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(R`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",F2,{query:$,...Z})}delete($,Z){return this._client.delete(R`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(R`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let z=await this.retrieve($);if(!z.results_url)throw new x(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:D([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>U1.fromResponse(X.response,X.controller))}}});var W$,Bq,yw;var zQ=v(()=>{Y0();f4();Kq();sz();ZQ();ZQ();Cz();W$=class W$ extends c{constructor(){super(...arguments);this.batches=new B8(this._client)}create($,Z){if($.model in Bq)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${Bq[$.model]}
197
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(yw.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=AZ($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:D([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>rz(z,$,{logger:this._client.logger??console}))}stream($,Z){return K8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};Bq={"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"},yw=["claude-mythos-preview","claude-opus-4-6"];W$.Batches=B8});var K1;var QQ=v(()=>{V0();Y0();D0();K1=class K1 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}`,{...z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",F2,{query:Q,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var Mq=v(()=>{dz();iz();zQ();QQ();pV()});var M8=($)=>{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 W0{constructor({baseURL:$=M8("ANTHROPIC_BASE_URL"),apiKey:Z=M8("ANTHROPIC_API_KEY")??null,authToken:z=M8("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){XQ.add(this),fZ.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&PV())throw new x(`It looks like you're running in a browser-like environment.
195
+ Wrap your summary in <summary></summary> tags.`;function NH(){let $,Z;return{promise:new Promise((Q,X)=>{$=Q,Z=X}),resolve:$,reject:Z}}async function Yx($,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 U1?W.content:`Error: ${W instanceof Error?W.message:String(W)}`,is_error:!0}}}))}}var Z8,G1,W$,R0,i0,$2,t2,_6,z8,LH,mz,Q8;var cz=v(()=>{r2();gZ();d0();W0();m4();Q8=class Q8{constructor($,Z,z){Z8.add(this),this.client=$,G1.set(this,!1),W$.set(this,!1),R0.set(this,void 0),i0.set(this,void 0),$2.set(this,void 0),t2.set(this,void 0),_6.set(this,void 0),z8.set(this,0),P(this,R0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let X=["BetaToolRunner",...Az(Z.tools,Z.messages)].join(", ");if(P(this,i0,{...z,headers:D([{"x-stainless-helper":X},z?.headers])},"f"),P(this,_6,NH(),"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*[(G1=new WeakMap,W$=new WeakMap,R0=new WeakMap,i0=new WeakMap,$2=new WeakMap,t2=new WeakMap,_6=new WeakMap,z8=new WeakMap,Z8=new WeakSet,LH=async function(){let Z=O(this,R0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let z=0;if(O(this,$2,"f")!==void 0)try{let U=await O(this,$2,"f");z=U.usage.input_tokens+(U.usage.cache_creation_input_tokens??0)+(U.usage.cache_read_input_tokens??0)+U.usage.output_tokens}catch{return!1}let Q=Z.contextTokenThreshold??BH;if(z<Q)return!1;let X=Z.model??O(this,R0,"f").params.model,J=Z.summaryPrompt??MH,Y=O(this,R0,"f").params.messages;if(Y[Y.length-1].role==="assistant"){let U=Y[Y.length-1];if(Array.isArray(U.content)){let G=U.content.filter((V)=>V.type!=="tool_use");if(G.length===0)Y.pop();else U.content=G}}let W=await this.client.beta.messages.create({model:X,messages:[...Y,{role:"user",content:[{type:"text",text:J}]}],max_tokens:O(this,R0,"f").params.max_tokens},{signal:O(this,i0,"f").signal,headers:D([O(this,i0,"f").headers,{"x-stainless-helper":"compaction"}])});if(W.content[0]?.type!=="text")throw new x("Expected text response for compaction");return O(this,R0,"f").params.messages=[{role:"user",content:W.content}],!0},Symbol.asyncIterator)](){var $;if(O(this,G1,"f"))throw new x("Cannot iterate over a consumed stream");P(this,G1,!0,"f"),P(this,W$,!0,"f"),P(this,t2,void 0,"f");try{while(!0){let Z;try{if(O(this,R0,"f").params.max_iterations&&O(this,z8,"f")>=O(this,R0,"f").params.max_iterations)break;P(this,W$,!1,"f"),P(this,t2,void 0,"f"),P(this,z8,($=O(this,z8,"f"),$++,$),"f"),P(this,$2,void 0,"f");let{max_iterations:z,compactionControl:Q,...X}=O(this,R0,"f").params;if(X.stream)Z=this.client.beta.messages.stream({...X},O(this,i0,"f")),P(this,$2,Z.finalMessage(),"f"),O(this,$2,"f").catch(()=>{}),yield Z;else P(this,$2,this.client.beta.messages.create({...X,stream:!1},O(this,i0,"f")),"f"),yield O(this,$2,"f");if(!await O(this,Z8,"m",LH).call(this)){if(!O(this,W$,"f")){let{role:W,content:U}=await O(this,$2,"f");O(this,R0,"f").params.messages.push({role:W,content:U})}let Y=await O(this,Z8,"m",mz).call(this,O(this,R0,"f").params.messages.at(-1));if(Y)O(this,R0,"f").params.messages.push(Y);else if(!O(this,W$,"f"))break}}finally{if(Z)Z.abort()}}if(!O(this,$2,"f"))throw new x("ToolRunner concluded without a message from the server");O(this,_6,"f").resolve(await O(this,$2,"f"))}catch(Z){throw P(this,G1,!1,"f"),O(this,_6,"f").promise.catch(()=>{}),O(this,_6,"f").reject(Z),P(this,_6,NH(),"f"),Z}}setMessagesParams($){if(typeof $==="function")O(this,R0,"f").params=$(O(this,R0,"f").params);else O(this,R0,"f").params=$;P(this,W$,!0,"f"),P(this,t2,void 0,"f")}setRequestOptions($){if(typeof $==="function")P(this,i0,$(O(this,i0,"f")),"f");else P(this,i0,{...O(this,i0,"f"),...$},"f")}async generateToolResponse($=O(this,i0,"f").signal){let Z=await O(this,$2,"f")??this.params.messages.at(-1);if(!Z)return null;return O(this,Z8,"m",mz).call(this,Z,$)}done(){return O(this,_6,"f").promise}async runUntilDone(){if(!O(this,G1,"f"))for await(let $ of this);return this.done()}get params(){return O(this,R0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};mz=async function(Z,z=O(this,i0,"f").signal){if(O(this,t2,"f")!==void 0)return O(this,t2,"f");return P(this,t2,Yx(O(this,R0,"f").params,Z,{...O(this,i0,"f"),signal:z}),"f"),O(this,t2,"f")}});var V1;var pz=v(()=>{d0();Vz();V1=class V1{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new T6;for await(let Z of this.iterator)for(let z of $.decode(Z))yield JSON.parse(z);for(let Z of $.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new x("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new x("Attempted to iterate over a response with no body")}return new V1(w4($.body),Z)}}});var X8;var lz=v(()=>{H0();W0();pz();J1();I0();X8=class X8 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/messages/batches/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",P2,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/messages/batches/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}cancel($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/messages/batches/${$}/cancel?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"message-batches-2024-09-24"].toString()},z?.headers])})}async results($,Z={},z){let Q=await this.retrieve($);if(!Q.results_url)throw new x(`No batch \`results_url\`; Has it finished processing? ${Q.processing_status} - ${Q.id}`);let{betas:X}=Z??{};return this._client.get(Q.results_url,{...z,headers:D([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((J,Y)=>V1.fromResponse(Y.response,Y.controller))}}});function DH($){if(!$.output_format)return $;if($.output_config?.format)throw new x("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...z}=$;return{...z,output_config:{...$.output_config,format:Z}}}var OH,Ux,R6;var dz=v(()=>{J1();wz();W0();m4();kz();qH();cz();gZ();lz();lz();cz();gZ();OH={"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"},Ux=["claude-mythos-preview","claude-opus-4-6"];R6=class R6 extends c{constructor(){super(...arguments);this.batches=new X8(this._client)}create($,Z){let z=DH($),{betas:Q,...X}=z;if(X.model in OH)console.warn(`The model '${X.model}' is deprecated and will reach end-of-life on ${OH[X.model]}
196
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Ux.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=SZ[X.model]??void 0;J=this._client.calculateNonstreamingTimeout(X.max_tokens,W)}let Y=PZ(X.tools,X.messages);return this._client.post("/v1/messages?beta=true",{body:X,timeout:J??600000,...Z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},Y,Z?.headers]),stream:z.stream??!1})}parse($,Z){return Z={...Z,headers:D([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((z)=>yz(z,$,{logger:this._client.logger??console}))}stream($,Z){return $8.createMessage(this,$,Z)}countTokens($,Z){let z=DH($),{betas:Q,...X}=z;return this._client.post("/v1/messages/count_tokens?beta=true",{body:X,...Z,headers:D([{"anthropic-beta":[...Q??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new Q8(this._client,$,Z)}};R6.Batches=X8;R6.BetaToolRunner=Q8;R6.ToolError=U1});var J8;var iz=v(()=>{H0();W0();I0();J8=class J8 extends c{list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/events?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}send($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}/events?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}stream($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/sessions/${$}/events/stream?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers]),stream:!0})}}});var Y8;var nz=v(()=>{H0();W0();I0();Y8=class Y8 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:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{session_id:Q,betas:X,...J}=Z;return this._client.post(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/sessions/${$}/resources?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{session_id:Q,betas:X}=Z;return this._client.delete(R`/v1/sessions/${Q}/resources/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}add($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}/resources?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var U$;var rz=v(()=>{iz();iz();nz();nz();H0();W0();I0();U$=class U$ extends c{constructor(){super(...arguments);this.events=new J8(this._client),this.resources=new Y8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/sessions?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/sessions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/sessions/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/sessions?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/sessions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/sessions/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};U$.Events=J8;U$.Resources=Y8});var W8;var sz=v(()=>{H0();W0();Q1();I0();W8=class W8 extends c{create($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.post(R`/v1/skills/${$}/versions?beta=true`,z1({body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])},this._client))}retrieve($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.get(R`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/skills/${$}/versions?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}delete($,Z,z){let{skill_id:Q,betas:X}=Z;return this._client.delete(R`/v1/skills/${Q}/versions/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},z?.headers])})}}});var H1;var oz=v(()=>{sz();sz();H0();W0();Q1();I0();H1=class H1 extends c{constructor(){super(...arguments);this.versions=new W8(this._client)}create($={},Z){let{betas:z,...Q}=$??{};return this._client.post("/v1/skills?beta=true",z1({body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/skills/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/skills?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/skills/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"skills-2025-10-02"].toString()},z?.headers])})}};H1.Versions=W8});var U8;var az=v(()=>{H0();W0();I0();U8=class U8 extends c{create($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}/credentials?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}retrieve($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.get(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{vault_id:Q,betas:X,...J}=Z;return this._client.post(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{body:J,...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($,Z={},z){let{betas:Q,...X}=Z??{};return this._client.getAPIList(R`/v1/vaults/${$}/credentials?beta=true`,z0,{query:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}delete($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.delete(R`/v1/vaults/${Q}/credentials/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z,z){let{vault_id:Q,betas:X}=Z;return this._client.post(R`/v1/vaults/${Q}/credentials/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...X??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}}});var K1;var tz=v(()=>{az();az();H0();W0();I0();K1=class K1 extends c{constructor(){super(...arguments);this.credentials=new U8(this._client)}create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/vaults?beta=true",{body:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/vaults/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}update($,Z,z){let{betas:Q,...X}=Z;return this._client.post(R`/v1/vaults/${$}?beta=true`,{body:X,...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/vaults?beta=true",z0,{query:Q,...Z,headers:D([{"anthropic-beta":[...z??[],"managed-agents-2026-04-01"].toString()},Z?.headers])})}delete($,Z={},z){let{betas:Q}=Z??{};return this._client.delete(R`/v1/vaults/${$}?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}archive($,Z={},z){let{betas:Q}=Z??{};return this._client.post(R`/v1/vaults/${$}/archive?beta=true`,{...z,headers:D([{"anthropic-beta":[...Q??[],"managed-agents-2026-04-01"].toString()},z?.headers])})}};K1.Credentials=U8});var g0;var ez=v(()=>{Tz();Tz();Cz();Cz();_z();_z();Rz();Rz();Pz();Pz();jz();jz();dz();dz();rz();rz();oz();oz();tz();tz();g0=class g0 extends c{constructor(){super(...arguments);this.models=new p4(this._client),this.messages=new R6(this._client),this.agents=new X1(this._client),this.environments=new f4(this._client),this.sessions=new U$(this._client),this.vaults=new K1(this._client),this.memoryStores=new J$(this._client),this.files=new c4(this._client),this.skills=new H1(this._client),this.userProfiles=new l4(this._client)}};g0.Models=p4;g0.Messages=R6;g0.Agents=X1;g0.Environments=f4;g0.Sessions=U$;g0.Vaults=K1;g0.MemoryStores=J$;g0.Files=c4;g0.Skills=H1;g0.UserProfiles=l4});var q1;var $Q=v(()=>{W0();q1=class q1 extends c{create($,Z){let{betas:z,...Q}=$;return this._client.post("/v1/complete",{body:Q,timeout:this._client._options.timeout??600000,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function IH($){return $?.output_config?.format}function ZQ($,Z,z){let Q=IH(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 zQ($,Z,z)}function zQ($,Z,z){let Q=null,X=$.content.map((J)=>{if(J.type==="text"){let Y=Nx(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 Nx($,Z){let z=IH($);if(z?.type!=="json_schema")return null;try{if("parse"in z)return z.parse(Z);return JSON.parse(Z)}catch(Q){throw new x(`Failed to parse structured output: ${Q}`)}}var QQ=v(()=>{d0()});function _H($){return $.type==="tool_use"||$.type==="server_tool_use"}function RH($){}var q2,F6,B1,G8,hZ,V8,H8,fZ,K8,e2,q8,uZ,mZ,G$,cZ,pZ,B8,XQ,TH,JQ,YQ,WQ,UQ,AH,CH="__json_buf",M8;var FH=v(()=>{r2();J1();vz();bz();QQ();M8=class M8{constructor($,Z){q2.add(this),this.messages=[],this.receivedMessages=[],F6.set(this,void 0),B1.set(this,null),this.controller=new AbortController,G8.set(this,void 0),hZ.set(this,()=>{}),V8.set(this,()=>{}),H8.set(this,void 0),fZ.set(this,()=>{}),K8.set(this,()=>{}),e2.set(this,{}),q8.set(this,!1),uZ.set(this,!1),mZ.set(this,!1),G$.set(this,!1),cZ.set(this,void 0),pZ.set(this,void 0),B8.set(this,void 0),JQ.set(this,(z)=>{if(P(this,uZ,!0,"f"),s2(z))z=new x0;if(z instanceof x0)return P(this,mZ,!0,"f"),this._emit("abort",z);if(z instanceof x)return this._emit("error",z);if(z instanceof Error){let Q=new x(z.message);return Q.cause=z,this._emit("error",Q)}return this._emit("error",new x(String(z)))}),P(this,G8,new Promise((z,Q)=>{P(this,hZ,z,"f"),P(this,V8,Q,"f")}),"f"),P(this,H8,new Promise((z,Q)=>{P(this,fZ,z,"f"),P(this,K8,Q,"f")}),"f"),O(this,G8,"f").catch(()=>{}),O(this,H8,"f").catch(()=>{}),P(this,B1,$,"f"),P(this,B8,Z?.logger??console,"f")}get response(){return O(this,cZ,"f")}get request_id(){return O(this,pZ,"f")}async withResponse(){P(this,G$,!0,"f");let $=await O(this,G8,"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 M8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,z,{logger:Q}={}){let X=new M8(Z,{logger:Q});for(let J of Z.messages)X._addMessageParam(J);return P(X,B1,{...Z,stream:!0},"f"),X._run(()=>X._createMessage($,{...Z,stream:!0},{...z,headers:{...z?.headers,"X-Stainless-Helper-Method":"stream"}})),X}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},O(this,JQ,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,z){let Q=z?.signal,X;if(Q){if(Q.aborted)this.controller.abort();X=this.controller.abort.bind(this.controller),Q.addEventListener("abort",X)}try{O(this,q2,"m",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)O(this,q2,"m",WQ).call(this,W);if(Y.controller.signal?.aborted)throw new x0;O(this,q2,"m",UQ).call(this)}finally{if(Q&&X)Q.removeEventListener("abort",X)}}_connected($){if(this.ended)return;P(this,cZ,$,"f"),P(this,pZ,$?.headers.get("request-id"),"f"),O(this,hZ,"f").call(this,$),this._emit("connect")}get ended(){return O(this,q8,"f")}get errored(){return O(this,uZ,"f")}get aborted(){return O(this,mZ,"f")}abort(){this.controller.abort()}on($,Z){return(O(this,e2,"f")[$]||(O(this,e2,"f")[$]=[])).push({listener:Z}),this}off($,Z){let z=O(this,e2,"f")[$];if(!z)return this;let Q=z.findIndex((X)=>X.listener===Z);if(Q>=0)z.splice(Q,1);return this}once($,Z){return(O(this,e2,"f")[$]||(O(this,e2,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,z)=>{if(P(this,G$,!0,"f"),$!=="error")this.once("error",z);this.once($,Z)})}async done(){P(this,G$,!0,"f"),await O(this,H8,"f")}get currentMessage(){return O(this,F6,"f")}async finalMessage(){return await this.done(),O(this,q2,"m",XQ).call(this)}async finalText(){return await this.done(),O(this,q2,"m",TH).call(this)}_emit($,...Z){if(O(this,q8,"f"))return;if($==="end")P(this,q8,!0,"f"),O(this,fZ,"f").call(this);let z=O(this,e2,"f")[$];if(z)O(this,e2,"f")[$]=z.filter((Q)=>!Q.once),z.forEach(({listener:Q})=>Q(...Z));if($==="abort"){let Q=Z[0];if(!O(this,G$,"f")&&!z?.length)Promise.reject(Q);O(this,V8,"f").call(this,Q),O(this,K8,"f").call(this,Q),this._emit("end");return}if($==="error"){let Q=Z[0];if(!O(this,G$,"f")&&!z?.length)Promise.reject(Q);O(this,V8,"f").call(this,Q),O(this,K8,"f").call(this,Q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",O(this,q2,"m",XQ).call(this))}async _fromReadableStream($,Z){let z=Z?.signal,Q;if(z){if(z.aborted)this.controller.abort();Q=this.controller.abort.bind(this.controller),z.addEventListener("abort",Q)}try{O(this,q2,"m",YQ).call(this),this._connected(null);let X=e0.fromReadableStream($,this.controller);for await(let J of X)O(this,q2,"m",WQ).call(this,J);if(X.controller.signal?.aborted)throw new x0;O(this,q2,"m",UQ).call(this)}finally{if(z&&Q)z.removeEventListener("abort",Q)}}[(F6=new WeakMap,B1=new WeakMap,G8=new WeakMap,hZ=new WeakMap,V8=new WeakMap,H8=new WeakMap,fZ=new WeakMap,K8=new WeakMap,e2=new WeakMap,q8=new WeakMap,uZ=new WeakMap,mZ=new WeakMap,G$=new WeakMap,cZ=new WeakMap,pZ=new WeakMap,B8=new WeakMap,JQ=new WeakMap,q2=new WeakSet,XQ=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},TH=function(){if(this.receivedMessages.length===0)throw new x("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((z)=>z.type==="text").map((z)=>z.text);if(Z.length===0)throw new x("stream ended without producing a content block with type=text");return Z.join(" ")},YQ=function(){if(this.ended)return;P(this,F6,void 0,"f")},WQ=function(Z){if(this.ended)return;let z=O(this,q2,"m",AH).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(_H(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:RH(Z.delta)}break}case"message_stop":{this._addMessageParam(z),this._addMessage(ZQ(z,O(this,B1,"f"),{logger:O(this,B8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",z.content.at(-1));break}case"message_start":{P(this,F6,z,"f");break}case"content_block_start":case"message_delta":break}},UQ=function(){if(this.ended)throw new x("stream has ended, this shouldn't happen");let Z=O(this,F6,"f");if(!Z)throw new x("request ended without sending any chunks");return P(this,F6,void 0,"f"),ZQ(Z,O(this,B1,"f"),{logger:O(this,B8,"f")})},AH=function(Z){let z=O(this,F6,"f");if(Z.type==="message_start"){if(z)throw new x(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!z)throw new x(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return z;case"message_delta":if(z.stop_reason=Z.delta.stop_reason,z.stop_sequence=Z.delta.stop_sequence,z.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)z.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)z.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)z.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)z.usage.server_tool_use=Z.usage.server_tool_use;return z;case"content_block_start":return z.content.push({...Z.content_block}),z;case"content_block_delta":{let Q=z.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,text:(Q.text||"")+Z.delta.text};break}case"citations_delta":{if(Q?.type==="text")z.content[Z.index]={...Q,citations:[...Q.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(Q&&_H(Q)){let X=Q[CH]||"";X+=Z.delta.partial_json;let J={...Q};if(Object.defineProperty(J,CH,{value:X,enumerable:!1,writable:!0}),X)J.input=EZ(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:RH(Z.delta)}return z}case"content_block_stop":return z}},Symbol.asyncIterator)](){let $=[],Z=[],z=!1;return this.on("streamEvent",(Q)=>{let X=Z.shift();if(X)X.resolve(Q);else $.push(Q)}),this.on("end",()=>{z=!0;for(let Q of Z)Q.resolve(void 0);Z.length=0}),this.on("abort",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),this.on("error",(Q)=>{z=!0;for(let X of Z)X.reject(Q);Z.length=0}),{next:async()=>{if(!$.length){if(z)return{value:void 0,done:!0};return new Promise((X,J)=>Z.push({resolve:X,reject:J})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new e0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var L8;var GQ=v(()=>{H0();W0();pz();J1();I0();L8=class L8 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",P2,{query:$,...Z})}delete($,Z){return this._client.delete(R`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(R`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let z=await this.retrieve($);if(!z.results_url)throw new x(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);return this._client.get(z.results_url,{...Z,headers:D([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((Q,X)=>V1.fromResponse(X.response,X.controller))}}});var V$,PH,Dx;var VQ=v(()=>{W0();m4();FH();QQ();GQ();GQ();wz();V$=class V$ extends c{constructor(){super(...arguments);this.batches=new L8(this._client)}create($,Z){if($.model in PH)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${PH[$.model]}
197
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Dx.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=SZ[$.model]??void 0;z=this._client.calculateNonstreamingTimeout($.max_tokens,X)}let Q=PZ($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:z??600000,...Z,headers:D([Q,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((z)=>zQ(z,$,{logger:this._client.logger??console}))}stream($,Z){return M8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};PH={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","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"},Dx=["claude-mythos-preview","claude-opus-4-6"];V$.Batches=L8});var M1;var HQ=v(()=>{H0();W0();I0();M1=class M1 extends c{retrieve($,Z={},z){let{betas:Q}=Z??{};return this._client.get(R`/v1/models/${$}`,{...z,headers:D([{...Q?.toString()!=null?{"anthropic-beta":Q?.toString()}:void 0},z?.headers])})}list($={},Z){let{betas:z,...Q}=$??{};return this._client.getAPIList("/v1/models",P2,{query:Q,...Z,headers:D([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Z?.headers])})}}});var SH=v(()=>{ez();$Q();VQ();HQ();zH()});var N8=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim()||void 0;return};class U0{constructor({baseURL:$=N8("ANTHROPIC_BASE_URL"),apiKey:Z=N8("ANTHROPIC_API_KEY")??null,authToken:z=N8("ANTHROPIC_AUTH_TOKEN")??null,...Q}={}){KQ.add(this),lZ.set(this,void 0);let X={apiKey:Z,authToken:z,...Q,baseURL:$||"https://api.anthropic.com"};if(!X.dangerouslyAllowBrowser&&uV())throw new x(`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??JQ.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=Qz(X.logLevel,"ClientOptions.logLevel",this)??Qz(M8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??EV(),P(this,fZ,wV,"f"),this._options=X,this.apiKey=typeof Z==="string"?Z:null,this.authToken=z}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return D([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return D([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return D([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return xV($)}getUserAgent(){return`${this.constructor.name}/JS ${D6}`}defaultIdempotencyKey(){return`stainless-node-retry-${s9()}`}makeStatusError($,Z,z,Q){return O0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!O(this,XQ,"m",Lq).call(this)&&z||this.baseURL,X=IV($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!t9(J)||!t9(Y))Z={...Y,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))X.search=this.stringifyQuery(Z);return X.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new x("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:z}){}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,z){return this.request(Promise.resolve(z).then((Q)=>{return{method:$,path:Z,...Q}}))}request($,Z=null){return new T6(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(S0(this).debug(`[${U}] sending request`,r2({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new w0;let q=new AbortController,H=await this.fetchWithTimeout(Y,J,W,q).catch(S4),K=Date.now();if(H instanceof globalThis.Error){let N=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new w0;let T=n2(H)||/timed? ?out/i.test(String(H)+("cause"in H?String(H.cause):""));if(Z)return S0(this).info(`[${U}] connection ${T?"timed out":"failed"} - ${N}`),S0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (${N})`,r2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:H.message})),this.retryRequest(Q,Z,z??U);if(S0(this).info(`[${U}] connection ${T?"timed out":"failed"} - error; no more retries left`),S0(this).debug(`[${U}] connection ${T?"timed out":"failed"} (error; no more retries left)`,r2({retryOfRequestLogID:z,url:Y,durationMs:K-V,message:H.message})),T)throw new d$;throw new O6({cause:H})}let L=[...H.headers.entries()].filter(([N])=>N==="request-id").map(([N,T])=>", "+N+": "+JSON.stringify(T)).join(""),B=`[${U}${G}${L}] ${J.method} ${Y} ${H.ok?"succeeded":"failed"} with status ${H.status} in ${K-V}ms`;if(!H.ok){let N=await this.shouldRetry(H);if(Z&&N){let j=`retrying, ${Z} attempts remaining`;return await jV(H.body),S0(this).info(`${B} - ${j}`),S0(this).debug(`[${U}] response error (${j})`,r2({retryOfRequestLogID:z,url:H.url,status:H.status,headers:H.headers,durationMs:K-V})),this.retryRequest(Q,Z,z??U,H.headers)}let T=N?"error; no more retries left":"error; not retryable";S0(this).info(`${B} - ${T}`);let _=await H.text().catch((j)=>S4(j).message),y=KZ(_),E=y?void 0:_;throw S0(this).debug(`[${U}] response error (${T})`,r2({retryOfRequestLogID:z,url:H.url,status:H.status,headers:H.headers,message:E,durationMs:Date.now()-V})),this.makeStatusError(H.status,y,E,H.headers)}return S0(this).info(B),S0(this).debug(`[${U}] response start`,r2({retryOfRequestLogID:z,url:H.url,status:H.status,headers:H.headers,durationMs:K-V})),{response:H,options:Q,controller:q,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 k4(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 CV(X),this.makeRequest($,Z-1,z)}calculateDefaultRetryTimeoutMillis($,Z){let X=Z-$,J=Math.min(0.5*Math.pow(2,X),8),Y=1-Math.random()*0.25;return J*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new x("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let z={...$},{method:Q,path:X,query:J,defaultBaseURL:Y}=z,W=this.buildURL(X,J,Y);if("timeout"in z)AV("timeout",z.timeout);z.timeout=z.timeout??this.timeout;let{bodyHeaders:U,body:G}=this.buildBody({options:z}),V=await this.buildHeaders({options:$,method:Q,bodyHeaders:U,retryCount:Z});return{req:{method:Q,headers:V,...z.signal&&{signal:z.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...z.fetchOptions??{}},url:W,timeout:z.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:z,retryCount:Q}){let X={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let J=D([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...SV(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,z,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let z=D([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&z.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:BZ($)};else if(typeof $==="object"&&z.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return O(this,fZ,"f").call(this,{body:$,headers:z})}}var XQ,JQ,fZ,Lq,YQ="\\n\\nHuman:",WQ="\\n\\nAssistant:",F6;var UQ=v(()=>{i2();$$();e9();yV();l0();V0();Hz();Mq();DZ();iz();QQ();dz();zQ();e9();Y0();NZ();$$();JQ=W0,fZ=new WeakMap,XQ=new WeakSet,Lq=function(){return this.baseURL!=="https://api.anthropic.com"};W0.Anthropic=JQ;W0.HUMAN_PROMPT=YQ;W0.AI_PROMPT=WQ;W0.DEFAULT_TIMEOUT=600000;W0.AnthropicError=x;W0.APIError=O0;W0.APIConnectionError=O6;W0.APIConnectionTimeoutError=d$;W0.APIUserAbortError=w0;W0.NotFoundError=s$;W0.ConflictError=o$;W0.RateLimitError=t$;W0.BadRequestError=i$;W0.AuthenticationError=n$;W0.InternalServerError=e$;W0.PermissionDeniedError=r$;W0.UnprocessableEntityError=a$;W0.toFile=v4;F6=class F6 extends W0{constructor(){super(...arguments);this.completions=new q1(this),this.messages=new W$(this),this.models=new K1(this),this.beta=new v0(this)}};F6.Completions=q1;F6.Messages=W$;F6.Models=K1;F6.Beta=v0});var Nq={};AQ(Nq,{toFile:()=>v4,default:()=>F6,UnprocessableEntityError:()=>a$,RateLimitError:()=>t$,PermissionDeniedError:()=>r$,PagePromise:()=>k4,NotFoundError:()=>s$,InternalServerError:()=>e$,HUMAN_PROMPT:()=>YQ,ConflictError:()=>o$,BaseAnthropic:()=>W0,BadRequestError:()=>i$,AuthenticationError:()=>n$,AnthropicError:()=>x,Anthropic:()=>F6,APIUserAbortError:()=>w0,APIPromise:()=>T6,APIError:()=>O0,APIConnectionTimeoutError:()=>d$,APIConnectionError:()=>O6,AI_PROMPT:()=>WQ});var Oq=v(()=>{UQ();Hz();DZ();UQ();V0();l0()});var fQ=$H(hQ(),1),{program:zy,createCommand:Qy,createArgument:Xy,createOption:Jy,CommanderError:Yy,InvalidArgumentError:Wy,InvalidOptionArgumentError:Uy,Command:uQ,Argument:Gy,Option:Vy,Help:qy}=fQ.default;import{lstatSync as lY}from"fs";import{join as mY,dirname as R5,basename as mA,resolve as P$}from"path";import{execFileSync as cA}from"child_process";var JT=r7(),YT=k1(),WT=x7(),Y3=b1(),UT=I1(),Y6=o(),GT=Z6(),VT=L0(),qT=Q6(),HT=X6(),jk=Y5(),KT=Q3(),BT=X3(),MT=J3(),V5=rJ(),sJ=O1();var LT=JT.Composer,q5=YT.Document,NT=WT.Schema,OT=Y3.YAMLError,H5=Y3.YAMLParseError,DT=Y3.YAMLWarning,IT=UT.Alias,v2=Y6.isAlias,k6=Y6.isCollection,TT=Y6.isDocument,H0=Y6.isMap,M2=Y6.isNode,AT=Y6.isPair,A0=Y6.isScalar,g2=Y6.isSeq,CT=GT.Pair,_T=VT.Scalar,I$=qT.YAMLMap,m1=HT.YAMLSeq;var RT=KT.Lexer,FT=BT.LineCounter,PT=MT.Parser,n0=V5.parse,ST=V5.parseAllDocuments,b6=V5.parseDocument,T$=V5.stringify,ET=sJ.visit,jT=sJ.visitAsync;import{accessSync as oJ,closeSync as B5,constants as aJ,existsSync as wT,fchmodSync as tJ,fchownSync as xT,fsyncSync as eJ,lstatSync as p1,mkdirSync as $Y,mkdtempSync as yT,openSync as q3,readdirSync as ZY,readFileSync as M5,readlinkSync as kT,realpathSync as bT,renameSync as vT,rmSync as zY,statSync as A$,unlinkSync as QY,writeFileSync as XY}from"fs";import{randomBytes as gT}from"crypto";import{tmpdir as JY}from"os";import{basename as W6,dirname as v6,isAbsolute as YY,join as E2,relative as H3,resolve as z2,sep as K5}from"path";class b extends Error{reason;path;onWrite;constructor($,Z,z,Q={}){super(z,Q.cause===void 0?void 0:{cause:Q.cause});this.name="SafePathError",this.reason=$,this.path=Z,this.onWrite=Q.onWrite===!0}}var x0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),hT=new Set(Object.values(x0).map(($)=>$.toLowerCase())),fT=($,Z)=>$.toLowerCase()===Z.toLowerCase(),W3=($)=>hT.has($.toLowerCase());function C$($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var uT=/\.fafm?$/i,mT=/^[a-z][a-z0-9-]*$/,L2=($)=>bT.native($),U6=($)=>$?.code;function l1($,Z){let z=H3($,Z);return z===""||z!==".."&&!z.startsWith(`..${K5}`)&&!YY(z)}function WY($){try{return kT($)}catch{return"?"}}function cT($,Z,z,Q){let X;try{X=L2(z)}catch(J){let Y=U6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new b("dangling",Z,`${Z} is a link to ${WY(z)}, which does not exist. faf does not create files through a link — refused.`);throw J}if(!l1($,X))throw new b("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(C$(X)&&!(Q.inGit&&v6(X)===$))throw new b("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!A$(X).isFile())throw new b("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return pT(Z,X,Q.read),X}function pT($,Z,z){let Q=W6($),X=W6(Z),J=W3(Q)&&W3(X);if(z&&!uT.test(X)&&!J){let Y=W3(Q)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new b("not-faf",$,`${$} is a link to ${Z}, which is not ${Y} — refused.`)}if(!z&&!fT(Q,X)&&!J)throw new b("other-file",$,`${$} is a link to ${Z}, a file with another name — refused (faf follows a link only to a file of the same name, or from one AI context file to another).`)}function lT($,Z,z,Q){if(W6(z2($))!=="hooks"||!mT.test(W6(Z)))throw new b("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(Q!==z)throw new b("git",Z,`${Z} is not directly in the hooks folder ${z} — refused.`)}function dT($,Z,z){if(W6($)!=="config"||z!==Z)throw new b("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function l($,Z,z={}){let Q=L2(z2($)),X=z2($,Z),J=L2(v6(X));if(!l1(Q,J))throw new b("outside",X,`${X} is in ${J}, outside ${Q} — refused.`);let Y=z.allowGitHooks===!0,W=z.allowGitConfig===!0;if(Y)lT($,X,Q,J);if(W)dT(X,Q,J);let U=E2(J,W6(X));if(C$(U)&&!Y&&!W)throw new b("git",X,U===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${U}, inside .git/ — refused.`);let G;try{G=p1(U)}catch(V){if(U6(V)==="ENOENT")return U;throw V}if(G.isSymbolicLink())return cT(Q,X,U,{read:z.read===!0,inGit:Y||W});if(!G.isFile())throw new b("not-a-file",X,`${X} is not a regular file — refused.`);return L2(U)}var iT=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function nT($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return iT.decode($)}catch{}throw new b("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function z0($){return nT(M5($),$)}function y0($){try{return M5($)}catch(Z){if(U6(Z)==="ENOENT")return null;throw Z}}function c1($,Z){let z=z2(E2($,Z));if(!wT(z))return null;let Q,X;try{Q=L2(rT($)),X=L2(z)}catch{return null}if(!l1(Q,X)||C$(H3(Q,X)))return null;return X}var G3=[];function rT($){let Z=z2($);return G3.find((z)=>Z===z||Z.startsWith(z.endsWith(K5)?z:z+K5))??Z}function _$($,Z){G3.push(z2($));try{return Z()}finally{G3.pop()}}function A($,Z){return c1($,Z)!==null}function u($,Z){let z=c1($,Z);if(z===null)return null;try{return A$(z).isFile()?M5(z,"utf-8"):null}catch{return null}}function N2($,Z){let z=c1($,Z);if(z===null)return null;try{return A$(z)}catch{return null}}function Q0($,Z="."){let z=c1($,Z);if(z===null)return null;let Q;try{Q=ZY(z,{withFileTypes:!0})}catch{return null}return Q.filter((X)=>!X.isSymbolicLink()||c1($,E2(Z,X.name))!==null)}function sT($){try{let Z=A$($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(U6(Z)==="ENOENT")return;throw Z}}class h2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var U3=($)=>new b("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function K3($,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 U3($)}if(!z)return;let Q;try{Q=A$($)}catch(X){if(U6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw U3($);try{oJ($,aJ.W_OK)}catch{throw U3($)}}function oT($,Z){if(process.platform!=="win32")try{xT($,Z.uid,Z.gid)}catch{}tJ($,Z.mode)}function aT($){if(process.platform==="win32")return;try{let Z=q3($,"r");try{eJ(Z)}finally{B5(Z)}}catch{}}function tT($,Z,z,Q){if($.fd=q3($.path,"wx",Q??z?.mode??438),$.created=!0,XY($.fd,Z),z)oT($.fd,z);if(Q!==void 0)tJ($.fd,Q);eJ($.fd),B5($.fd),$.fd=void 0}function eT($){if($.fd!==void 0)try{B5($.fd)}catch{}if($.created)try{QY($.path)}catch{}}function $A($,Z,z){let Q=v6($),X={path:E2(Q,`.${W6($).slice(0,100)}.${process.pid}.${gT(6).toString("hex")}.faf-tmp`),created:!1},J=sT($);try{if(J)oJ($,aJ.W_OK);tT(X,Z,J,z.mode),K3($,z.expect,J),vT(X.path,$)}catch(Y){if(eT(X),Y instanceof b)throw Y;let W=U6(Y)??(Y instanceof Error?Y.message:String(Y));throw new h2($,`${$}: not written${J?"; original kept":""} (${W})`,{cause:Y})}aT(Q)}function ZA($){return $ instanceof b&&!$.onWrite?new b($.reason,$.path,$.message,{onWrite:!0}):$}function a($,Z,z={}){let Q=z2($),X;try{X=l(z.root??v6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw ZA(J)}return $A(X,Z,z),X}function j2($,Z,z){let Q=z2($),X=z.root??v6(Q),J=l(X,Q),Y=y0(J);if(z.expect!==void 0)K3(J,z.expect,void 0);if(Y!==null&&z.force!==!0&&!z.owns(Y))throw new b("not-owned",Q,`${Q} has no ${z.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return a(J,Z,{root:X,expect:Y})}function j0($,Z=$){let z=z2($);$Y(z,{recursive:!0});let Q=L2(z),X=z2(z,Z),J=H3(z,X);if(J===".."||J.startsWith(`..${K5}`)||YY(J))throw new b("outside",X,`${X} is outside ${Q} — refused.`,{onWrite:!0});let Y=Q;for(let W of J.split(/[\\/]/).filter(Boolean)){let U=E2(Y,W);if(C$(U))throw new b("git",X,`${X} runs through ${U}, inside .git/ — refused.`,{onWrite:!0});Y=zA(Q,X,U)}return Y}function zA($,Z,z){let Q;try{Q=p1(z)}catch(J){if(U6(J)!=="ENOENT")throw J;return $Y(z),z}let X=z;if(Q.isSymbolicLink()){try{X=L2(z)}catch{throw new b("dangling",Z,`${z} is a link to ${WY(z)}, which does not exist. faf does not create folders through a link — refused.`,{onWrite:!0})}if(!l1($,X))throw new b("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(C$(X))throw new b("git",Z,`${z} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!A$(X).isDirectory())throw new b("not-a-file",Z,`${z} is not a folder — refused.`,{onWrite:!0});return X}function L5($,Z){let z=z2($),Q=L2(z2(Z.root??v6(z))),X=L2(v6(z));if(!l1(Q,X))throw new b("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=E2(X,W6(z));if(C$(J))throw new b("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=p1(J)}catch(W){if(U6(W)==="ENOENT")return!1;throw W}if(!Y.isFile())throw new b("not-a-file",z,`${z} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return K3(J,Z.expect,void 0),QY(J),!0}var V3=new Set,UY=".faf-temp",GY="faf made this temp folder; `faf clear` removes it.\n";function N5($){let Z=L2(yT(E2(JY(),$)));V3.add(Z);let z=q3(E2(Z,UY),"wx",420);try{XY(z,GY)}finally{B5(z)}return Z}function O5($){if(!V3.has($))throw Error(`${$} is not a temp folder faf made — not removed`);zY($,{recursive:!0,force:!0}),V3.delete($)}function QA($){let Z=E2($,UY);try{if(!p1(Z).isFile())return!1;return M5(Z,"utf-8")===GY}catch{return!1}}var XA=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function VY($){let Z=JY(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${XA($)}[A-Za-z0-9]{6}$`),X=0;for(let J of ZY(Z)){if(!Q.test(J))continue;let Y=E2(Z,J);try{let W=p1(Y);if(!W.isDirectory()||z!==void 0&&W.uid!==z||!QA(Y))continue;zY(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function e($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function g6($){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 d1($,Z){if($===null||$===void 0)return{};if(!e($))throw new b("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${g6($)}. `+"faf left it unchanged — fix it by hand.");return $}var X0=[{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"}],G6=new Map(X0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),qY=new Map(X0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),fk=new Map(X0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function i1($,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 uk=X0.filter(($)=>$.index<=21);var B3=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]);var n1="slotignored";function R$($){return typeof $==="string"&&$.trim()!==""&&U0($)}function U0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return B3.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var F$="no classifying signals — fallback",JA=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]);function f6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(h6,$))return null;if(!h6[$].includes(Z.category))return!1;return!($==="framework"&&JA.has(Z.path))}var h6={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var NY=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function HY($){return typeof $==="object"&&$.collection===void 0}function YA($,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||!NY.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 WA($){let Z=$.filter(HY);return $.map((z)=>{if(!HY(z)||!NY.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,W)=>YA(X,Z)??Q(X,J,Y,W)}})}var D5={keepSourceTokens:!0,customTags:WA};function UA($,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 GA($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=UA(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function D3($,Z){let z=b6($,D5);if(z.errors.length>0){let Q=z.errors[0].message.split(`
206
- `)[0];throw Error(`${Z}: not valid YAML (${Q}) — faf left it unchanged.`,{cause:z.errors[0]})}return z}function u6($,Z,z,Q){$.edits.push({start:Z,end:z,text:Q,seq:$.edits.length})}function r1($,Z){return $.lastIndexOf(`
207
- `,Z-1)+1}function OY($,Z){if(Z>0&&$[Z-1]===`
204
+ `);this.baseURL=X.baseURL,this.timeout=X.timeout??qQ.DEFAULT_TIMEOUT,this.logger=X.logger??console;let J="warn";this.logLevel=J,this.logLevel=Hz(X.logLevel,"ClientOptions.logLevel",this)??Hz(N8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??J,this.fetchOptions=X.fetchOptions,this.maxRetries=X.maxRetries??2,this.fetch=X.fetch??cV(),P(this,lZ,lV,"f"),this._options=X,this.apiKey=typeof Z==="string"?Z:null,this.authToken=z}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders($){return D([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return D([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return D([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery($){return dV($)}getUserAgent(){return`${this.constructor.name}/JS ${I6}`}defaultIdempotencyKey(){return`stainless-node-retry-${Qz()}`}makeStatusError($,Z,z,Q){return D0.generate($,Z,z,Q)}buildURL($,Z,z){let Q=!O(this,KQ,"m",EH).call(this)&&z||this.baseURL,X=yV($)?new URL($):new URL(Q+(Q.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),J=this.defaultQuery(),Y=Object.fromEntries(X.searchParams);if(!Yz(J)||!Yz(Y))Z={...Y,...J,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))X.search=this.stringifyQuery(Z);return X.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new x("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:z}){}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,z){return this.request(Promise.resolve(z).then((Q)=>{return{method:$,path:Z,...Q}}))}request($,Z=null){return new A6(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,z){let Q=await $,X=Q.maxRetries??this.maxRetries;if(Z==null)Z=X;await this.prepareOptions(Q);let{req:J,url:Y,timeout:W}=await this.buildRequest(Q,{retryCount:X-Z});await this.prepareRequest(J,{url:Y,options:Q});let U="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),G=z===void 0?"":`, retryOf: ${z}`,V=Date.now();if(E0(this).debug(`[${U}] sending request`,o2({retryOfRequestLogID:z,method:Q.method,url:Y,options:Q,headers:J.headers})),Q.signal?.aborted)throw new x0;let H=new AbortController,K=await this.fetchWithTimeout(Y,J,W,H).catch(j4),q=Date.now();if(K instanceof globalThis.Error){let N=`retrying, ${Z} attempts remaining`;if(Q.signal?.aborted)throw new x0;let I=s2(K)||/timed? ?out/i.test(String(K)+("cause"in K?String(K.cause):""));if(Z)return E0(this).info(`[${U}] connection ${I?"timed out":"failed"} - ${N}`),E0(this).debug(`[${U}] connection ${I?"timed out":"failed"} (${N})`,o2({retryOfRequestLogID:z,url:Y,durationMs:q-V,message:K.message})),this.retryRequest(Q,Z,z??U);if(E0(this).info(`[${U}] connection ${I?"timed out":"failed"} - error; no more retries left`),E0(this).debug(`[${U}] connection ${I?"timed out":"failed"} (error; no more retries left)`,o2({retryOfRequestLogID:z,url:Y,durationMs:q-V,message:K.message})),I)throw new n$;throw new D6({cause:K})}let L=[...K.headers.entries()].filter(([N])=>N==="request-id").map(([N,I])=>", "+N+": "+JSON.stringify(I)).join(""),B=`[${U}${G}${L}] ${J.method} ${Y} ${K.ok?"succeeded":"failed"} with status ${K.status} in ${q-V}ms`;if(!K.ok){let N=await this.shouldRetry(K);if(Z&&N){let j=`retrying, ${Z} attempts remaining`;return await pV(K.body),E0(this).info(`${B} - ${j}`),E0(this).debug(`[${U}] response error (${j})`,o2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:q-V})),this.retryRequest(Q,Z,z??U,K.headers)}let I=N?"error; no more retries left":"error; not retryable";E0(this).info(`${B} - ${I}`);let _=await K.text().catch((j)=>j4(j).message),y=OZ(_),E=y?void 0:_;throw E0(this).debug(`[${U}] response error (${I})`,o2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,message:E,durationMs:Date.now()-V})),this.makeStatusError(K.status,y,E,K.headers)}return E0(this).info(B),E0(this).debug(`[${U}] response start`,o2({retryOfRequestLogID:z,url:K.url,status:K.status,headers:K.headers,durationMs:q-V})),{response:K,options:Q,controller:H,requestLogID:U,retryOfRequestLogID:z,startTime:V}}getAPIList($,Z,z){return this.requestAPIList(Z,z&&"then"in z?z.then((Q)=>({method:"get",path:$,...Q})):{method:"get",path:$,...z})}requestAPIList($,Z){let z=this.makeRequest(Z,null,void 0);return new v4(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 vV(X),this.makeRequest($,Z-1,z)}calculateDefaultRetryTimeoutMillis($,Z){let X=Z-$,J=Math.min(0.5*Math.pow(2,X),8),Y=1-Math.random()*0.25;return J*Y*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new x("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let z={...$},{method:Q,path:X,query:J,defaultBaseURL:Y}=z,W=this.buildURL(X,J,Y);if("timeout"in z)bV("timeout",z.timeout);z.timeout=z.timeout??this.timeout;let{bodyHeaders:U,body:G}=this.buildBody({options:z}),V=await this.buildHeaders({options:$,method:Q,bodyHeaders:U,retryCount:Z});return{req:{method:Q,headers:V,...z.signal&&{signal:z.signal},...globalThis.ReadableStream&&G instanceof globalThis.ReadableStream&&{duplex:"half"},...G&&{body:G},...this.fetchOptions??{},...z.fetchOptions??{}},url:W,timeout:z.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:z,retryCount:Q}){let X={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=$.idempotencyKey}let J=D([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(Q),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...mV(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,z,$.headers]);return this.validateHeaders(J),J.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let z=D([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&z.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:DZ($)};else if(typeof $==="object"&&z.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery($)};else return O(this,lZ,"f").call(this,{body:$,headers:z})}}var KQ,qQ,lZ,EH,BQ="\\n\\nHuman:",MQ="\\n\\nAssistant:",P6;var LQ=v(()=>{r2();Q$();Wz();iV();d0();H0();Iz();SH();_Z();$Q();HQ();ez();VQ();Wz();W0();AZ();Q$();qQ=U0,lZ=new WeakMap,KQ=new WeakSet,EH=function(){return this.baseURL!=="https://api.anthropic.com"};U0.Anthropic=qQ;U0.HUMAN_PROMPT=BQ;U0.AI_PROMPT=MQ;U0.DEFAULT_TIMEOUT=600000;U0.AnthropicError=x;U0.APIError=D0;U0.APIConnectionError=D6;U0.APIConnectionTimeoutError=n$;U0.APIUserAbortError=x0;U0.NotFoundError=a$;U0.ConflictError=t$;U0.RateLimitError=$1;U0.BadRequestError=r$;U0.AuthenticationError=s$;U0.InternalServerError=Z1;U0.PermissionDeniedError=o$;U0.UnprocessableEntityError=e$;U0.toFile=h4;P6=class P6 extends U0{constructor(){super(...arguments);this.completions=new q1(this),this.messages=new V$(this),this.models=new M1(this),this.beta=new g0(this)}};P6.Completions=q1;P6.Messages=V$;P6.Models=M1;P6.Beta=g0});var jH={};jQ(jH,{toFile:()=>h4,default:()=>P6,UnprocessableEntityError:()=>e$,RateLimitError:()=>$1,PermissionDeniedError:()=>o$,PagePromise:()=>v4,NotFoundError:()=>a$,InternalServerError:()=>Z1,HUMAN_PROMPT:()=>BQ,ConflictError:()=>t$,BaseAnthropic:()=>U0,BadRequestError:()=>r$,AuthenticationError:()=>s$,AnthropicError:()=>x,Anthropic:()=>P6,APIUserAbortError:()=>x0,APIPromise:()=>A6,APIError:()=>D0,APIConnectionTimeoutError:()=>n$,APIConnectionError:()=>D6,AI_PROMPT:()=>MQ});var wH=v(()=>{LQ();Iz();_Z();LQ();H0();d0()});var nQ=BK(iQ(),1),{program:py,createCommand:ly,createArgument:dy,createOption:iy,CommanderError:ny,InvalidArgumentError:ry,InvalidOptionArgumentError:sy,Command:rQ,Argument:oy,Option:ay,Help:ty}=nQ.default;import{lstatSync as tY}from"fs";import{join as sY,dirname as P5,basename as ZC,resolve as E$}from"path";import{execFileSync as zC}from"child_process";var DT=e7(),IT=v1(),TT=g7(),H3=g1(),AT=A1(),U6=t(),CT=Q6(),_T=N0(),RT=J6(),FT=Y6(),Nb=U5(),PT=U3(),ST=G3(),ET=V3(),K5=zY(),QY=I1();var jT=DT.Composer,q5=IT.Document,wT=TT.Schema,xT=H3.YAMLError,B5=H3.YAMLParseError,yT=H3.YAMLWarning,kT=AT.Alias,h2=U6.isAlias,b6=U6.isCollection,bT=U6.isDocument,q0=U6.isMap,N2=U6.isNode,vT=U6.isPair,C0=U6.isScalar,f2=U6.isSeq,gT=CT.Pair,hT=_T.Scalar,C$=RT.YAMLMap,p1=FT.YAMLSeq;var fT=PT.Lexer,uT=ST.LineCounter,mT=ET.Parser,r0=K5.parse,cT=K5.parseAllDocuments,v6=K5.parseDocument,g6=K5.stringify,pT=QY.visit,lT=QY.visitAsync;import{accessSync as XY,closeSync as L5,constants as JY,existsSync as dT,fchmodSync as YY,fchownSync as iT,fsyncSync as WY,lstatSync as d1,mkdirSync as UY,mkdtempSync as nT,openSync as L3,readdirSync as GY,readFileSync as N5,readlinkSync as rT,realpathSync as sT,renameSync as oT,rmSync as VY,statSync as _$,unlinkSync as HY,writeFileSync as KY}from"fs";import{randomBytes as aT}from"crypto";import{tmpdir as qY}from"os";import{basename as G6,dirname as h6,isAbsolute as BY,join as j2,relative as N3,resolve as Q2,sep as M5}from"path";class b extends Error{reason;path;onWrite;constructor($,Z,z,Q={}){super(z,Q.cause===void 0?void 0:{cause:Q.cause});this.name="SafePathError",this.reason=$,this.path=Z,this.onWrite=Q.onWrite===!0}}var y0=Object.freeze({claude:"CLAUDE.md",agents:"AGENTS.md",gemini:"GEMINI.md",cursorrules:".cursorrules",copilot:"copilot-instructions.md",memory:"MEMORY.md",llms:"llms.txt"}),tT=new Set(Object.values(y0).map(($)=>$.toLowerCase())),eT=($,Z)=>$.toLowerCase()===Z.toLowerCase(),K3=($)=>tT.has($.toLowerCase());function R$($){return $.split(/[\\/]/).some((Z)=>Z.toLowerCase()===".git")}var $A=/\.fafm?$/i,ZA=/^[a-z][a-z0-9-]*$/,O2=($)=>sT.native($),V6=($)=>$?.code;function i1($,Z){let z=N3($,Z);return z===""||z!==".."&&!z.startsWith(`..${M5}`)&&!BY(z)}function MY($){try{return rT($)}catch{return"?"}}function zA($,Z,z,Q){let X;try{X=O2(z)}catch(J){let Y=V6(J);if(Y==="ENOENT"||Y==="ELOOP"||Y==="ENOTDIR")throw new b("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(!i1($,X))throw new b("outside",Z,`${Z} is a link to ${X}, outside ${$} — refused.`);if(R$(X)&&!(Q.inGit&&h6(X)===$))throw new b("git",Z,`${Z} is a link to ${X}, inside .git/ — refused.`);if(!_$(X).isFile())throw new b("not-a-file",Z,`${Z} is a link to ${X}, which is not a regular file — refused.`);return QA(Z,X,Q.read),X}function QA($,Z,z){let Q=G6($),X=G6(Z),J=K3(Q)&&K3(X);if(z&&!$A.test(X)&&!J){let Y=K3(Q)?"a .faf or .fafm file, nor another AI context file":"a .faf or .fafm file";throw new b("not-faf",$,`${$} is a link to ${Z}, which is not ${Y} — refused.`)}if(!z&&!eT(Q,X)&&!J)throw new b("other-file",$,`${$} is a link to ${Z}, a file with another name — refused (faf follows a link only to a file of the same name, or from one AI context file to another).`)}function XA($,Z,z,Q){if(G6(Q2($))!=="hooks"||!ZA.test(G6(Z)))throw new b("git",Z,`${Z} is not a git hook in a hooks folder — refused.`);if(Q!==z)throw new b("git",Z,`${Z} is not directly in the hooks folder ${z} — refused.`)}function JA($,Z,z){if(G6($)!=="config"||z!==Z)throw new b("git",$,`${$} is not the git config file directly in ${Z} — refused.`)}function l($,Z,z={}){let Q=O2(Q2($)),X=Q2($,Z),J=O2(h6(X));if(!i1(Q,J))throw new b("outside",X,`${X} is in ${J}, outside ${Q} — refused.`);let Y=z.allowGitHooks===!0,W=z.allowGitConfig===!0;if(Y)XA($,X,Q,J);if(W)JA(X,Q,J);let U=j2(J,G6(X));if(R$(U)&&!Y&&!W)throw new b("git",X,U===X?`${X} is inside .git/ — refused.`:`${X} resolves to ${U}, inside .git/ — refused.`);let G;try{G=d1(U)}catch(V){if(V6(V)==="ENOENT")return U;throw V}if(G.isSymbolicLink())return zA(Q,X,U,{read:z.read===!0,inGit:Y||W});if(!G.isFile())throw new b("not-a-file",X,`${X} is not a regular file — refused.`);return O2(U)}var YA=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});function WA($,Z){if(!($.length>=2&&($[0]===255&&$[1]===254||$[0]===254&&$[1]===255)))try{return YA.decode($)}catch{}throw new b("not-utf8",Z,`${Z} is not UTF-8 — faf left it unchanged`)}function Q0($){return WA(N5($),$)}function k0($){try{return N5($)}catch(Z){if(V6(Z)==="ENOENT")return null;throw Z}}function l1($,Z){let z=Q2(j2($,Z));if(!dT(z))return null;let Q,X;try{Q=O2(UA($)),X=O2(z)}catch{return null}if(!i1(Q,X)||R$(N3(Q,X)))return null;return X}var B3=[];function UA($){let Z=Q2($);return B3.find((z)=>Z===z||Z.startsWith(z.endsWith(M5)?z:z+M5))??Z}function F$($,Z){B3.push(Q2($));try{return Z()}finally{B3.pop()}}function A($,Z){return l1($,Z)!==null}function m($,Z){let z=l1($,Z);if(z===null)return null;try{return _$(z).isFile()?N5(z,"utf-8"):null}catch{return null}}function D2($,Z){let z=l1($,Z);if(z===null)return null;try{return _$(z)}catch{return null}}function X0($,Z="."){let z=l1($,Z);if(z===null)return null;let Q;try{Q=GY(z,{withFileTypes:!0})}catch{return null}return Q.filter((X)=>!X.isSymbolicLink()||l1($,j2(Z,X.name))!==null)}function GA($){try{let Z=_$($);return{mode:Z.mode&511,perm:Z.mode&4095,uid:Z.uid,gid:Z.gid}}catch(Z){if(V6(Z)==="ENOENT")return;throw Z}}class u2 extends Error{path;constructor($,Z,z={}){super(Z,{cause:z.cause});this.path=$}}var q3=($)=>new b("changed",$,`${$} changed on disk while faf was writing — not written; original kept`,{onWrite:!0});function O3($,Z,z){if(Z!==void 0){let X=k0($),J=Z===null?null:typeof Z==="string"?Buffer.from(Z,"utf-8"):Buffer.from(Z);if(!(X===null||J===null?X===J:X.equals(J)))throw q3($)}if(!z)return;let Q;try{Q=_$($)}catch(X){if(V6(X)==="ENOENT")return;throw X}if((Q.mode&4095)!==z.perm)throw q3($);try{XY($,JY.W_OK)}catch{throw q3($)}}function VA($,Z){if(process.platform!=="win32")try{iT($,Z.uid,Z.gid)}catch{}YY($,Z.mode)}function HA($){if(process.platform==="win32")return;try{let Z=L3($,"r");try{WY(Z)}finally{L5(Z)}}catch{}}function KA($,Z,z,Q){if($.fd=L3($.path,"wx",Q??z?.mode??438),$.created=!0,KY($.fd,Z),z)VA($.fd,z);if(Q!==void 0)YY($.fd,Q);WY($.fd),L5($.fd),$.fd=void 0}function qA($){if($.fd!==void 0)try{L5($.fd)}catch{}if($.created)try{HY($.path)}catch{}}function BA($,Z,z){let Q=h6($),X={path:j2(Q,`.${G6($).slice(0,100)}.${process.pid}.${aT(6).toString("hex")}.faf-tmp`),created:!1},J=GA($);try{if(J)XY($,JY.W_OK);KA(X,Z,J,z.mode),O3($,z.expect,J),oT(X.path,$)}catch(Y){if(qA(X),Y instanceof b)throw Y;let W=V6(Y)??(Y instanceof Error?Y.message:String(Y));throw new u2($,`${$}: not written${J?"; original kept":""} (${W})`,{cause:Y})}HA(Q)}function MA($){return $ instanceof b&&!$.onWrite?new b($.reason,$.path,$.message,{onWrite:!0}):$}function a($,Z,z={}){let Q=Q2($),X;try{X=l(z.root??h6(Q),Q,{allowGitHooks:z.allowGitHooks,allowGitConfig:z.allowGitConfig})}catch(J){throw MA(J)}return BA(X,Z,z),X}function w2($,Z,z){let Q=Q2($),X=z.root??h6(Q),J=l(X,Q),Y=k0(J);if(z.expect!==void 0)O3(J,z.expect,void 0);if(Y!==null&&z.force!==!0&&!z.owns(Y))throw new b("not-owned",Q,`${Q} has no ${z.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});return a(J,Z,{root:X,expect:Y})}function w0($,Z=$){let z=Q2($);UY(z,{recursive:!0});let Q=O2(z),X=Q2(z,Z),J=N3(z,X);if(J===".."||J.startsWith(`..${M5}`)||BY(J))throw new b("outside",X,`${X} is outside ${Q} — refused.`,{onWrite:!0});let Y=Q;for(let W of J.split(/[\\/]/).filter(Boolean)){let U=j2(Y,W);if(R$(U))throw new b("git",X,`${X} runs through ${U}, inside .git/ — refused.`,{onWrite:!0});Y=LA(Q,X,U)}return Y}function LA($,Z,z){let Q;try{Q=d1(z)}catch(J){if(V6(J)!=="ENOENT")throw J;return UY(z),z}let X=z;if(Q.isSymbolicLink()){try{X=O2(z)}catch{throw new b("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(!i1($,X))throw new b("outside",Z,`${z} is a link to ${X}, outside ${$} — refused.`,{onWrite:!0});if(R$(X))throw new b("git",Z,`${z} is a link to ${X}, inside .git/ — refused.`,{onWrite:!0})}if(!_$(X).isDirectory())throw new b("not-a-file",Z,`${z} is not a folder — refused.`,{onWrite:!0});return X}function O5($,Z){let z=Q2($),Q=O2(Q2(Z.root??h6(z))),X=O2(h6(z));if(!i1(Q,X))throw new b("outside",z,`${z} is in ${X}, outside ${Q} — refused.`,{onWrite:!0});let J=j2(X,G6(z));if(R$(J))throw new b("git",z,`${z} is inside .git/ — refused.`,{onWrite:!0});let Y;try{Y=d1(J)}catch(W){if(V6(W)==="ENOENT")return!1;throw W}if(!Y.isFile())throw new b("not-a-file",z,`${z} is not a regular file faf wrote — left as it is.`,{onWrite:!0});return O3(J,Z.expect,void 0),HY(J),!0}var M3=new Set,LY=".faf-temp",NY="faf made this temp folder; `faf clear` removes it.\n";function D5($){let Z=O2(nT(j2(qY(),$)));M3.add(Z);let z=L3(j2(Z,LY),"wx",420);try{KY(z,NY)}finally{L5(z)}return Z}function I5($){if(!M3.has($))throw Error(`${$} is not a temp folder faf made — not removed`);VY($,{recursive:!0,force:!0}),M3.delete($)}function NA($){let Z=j2($,LY);try{if(!d1(Z).isFile())return!1;return N5(Z,"utf-8")===NY}catch{return!1}}var OA=($)=>$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function OY($){let Z=qY(),z=typeof process.getuid==="function"?process.getuid():void 0,Q=new RegExp(`^${OA($)}[A-Za-z0-9]{6}$`),X=0;for(let J of GY(Z)){if(!Q.test(J))continue;let Y=j2(Z,J);try{let W=d1(Y);if(!W.isDirectory()||z!==void 0&&W.uid!==z||!NA(Y))continue;VY(Y,{recursive:!0,force:!0}),X++}catch{}}return X}function $0($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function f6($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if($===null||$===void 0)return"empty";if(typeof $==="string"){let Z=$.length>40?`${$.slice(0,40)}…`:$;return`a string (${JSON.stringify(Z)})`}if(typeof $==="object")return"a mapping";return`a ${typeof $} (${String($)})`}function n1($,Z){if($===null||$===void 0)return{};if(!$0($))throw new b("not-yaml",Z,`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${f6($)}. `+"faf left it unchanged — fix it by hand.");return $}var J0=[{index:1,path:"project.name",label:"Name",description:"Project name",category:"project"},{index:2,path:"project.goal",label:"Goal",description:"Goal (use case)",category:"project"},{index:3,path:"project.main_language",label:"Language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",label:"Who",description:"Who is this for?",category:"human"},{index:5,path:"human_context.what",label:"What",description:"What are they building",category:"human"},{index:6,path:"human_context.why",label:"Why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",label:"Where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",label:"When",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",label:"How",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",canonical:"stack.framework",label:"Framework",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",canonical:"stack.css",label:"CSS",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",label:"UI Library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",canonical:"stack.state",label:"State",description:"State management",category:"frontend"},{index:14,path:"stack.backend",label:"Backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",canonical:"stack.api",label:"API",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",label:"Runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",canonical:"stack.db",label:"Database",description:"Database",category:"backend"},{index:18,path:"stack.connection",label:"Connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",label:"Hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",label:"Build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",label:"CI/CD",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",label:"Monorepo",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",canonical:"stack.pkg_manager",label:"Package Manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",label:"Workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",label:"Packages",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",label:"Build Orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",label:"Admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",label:"Cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",label:"Search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",label:"Storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",label:"Versioning",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",label:"Shared Configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",label:"Remote Cache",description:"Remote build cache",category:"enterprise_ops"}],H6=new Map(J0.flatMap(($)=>$.canonical?[[$.path,$],[$.canonical,$]]:[[$.path,$]])),DY=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.canonical,$.path])),Fb=new Map(J0.filter(($)=>$.canonical).map(($)=>[$.path,$.canonical]));function r1($,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 Pb=J0.filter(($)=>$.index<=21);var D3=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","tbd","todo","n/a","not applicable"]);var s1="slotignored";function P$($){return typeof $==="string"&&$.trim()!==""&&G0($)}function G0($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return D3.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var S$="no classifying signals — fallback",DA=new Set(["stack.css_framework","stack.ui_library","stack.database","stack.connection","stack.hosting"]);function m6($,Z){if(typeof $!=="string"||!Object.prototype.hasOwnProperty.call(u6,$))return null;if(!u6[$].includes(Z.category))return!1;return!($==="framework"&&DA.has(Z.path))}var u6={documentation:["project","human"],intent:["project","human"],encyclopedia:["project","human"],cli:["project","human","universal"],library:["project","human","universal"],sdk:["project","human","universal"],wasm:["project","human","universal"],html:["project","human","universal"],"server-card":["project","human","universal"],frontend:["project","frontend","human","universal"],website:["project","frontend","human","universal"],mobile:["project","frontend","human","universal"],app:["project","frontend","human","universal"],extension:["project","frontend","human","universal"],mcp:["project","backend","human","universal"],backend:["project","backend","universal","human"],"data-science":["project","backend","human","universal"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],"monorepo-root":["project","human","enterprise_infra","enterprise_app","enterprise_ops"],mcpaas:["project","backend","universal","human","enterprise_app","enterprise_ops"],saas:["project","frontend","backend","universal","human","enterprise_app"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};var RY=new Set(["tag:yaml.org,2002:int","tag:yaml.org,2002:float"]);function IY($){return typeof $==="object"&&$.collection===void 0}function IA($,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(C0(X)?X.value:X,$.value)?z:void 0}function TA($){let Z=$.filter(IY);return $.map((z)=>{if(!IY(z)||!RY.has(z.tag)||!z.stringify)return z;let Q=z.stringify;return{...z,stringify:(X,J,Y,W)=>IA(X,Z)??Q(X,J,Y,W)}})}var T5={keepSourceTokens:!0,customTags:TA};function AA($,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 CA($){let Z=$.split(/\r?\n/),z,Q;for(let X=0;X+1<Z.length;X++){let J=AA(Z[X],Z[X+1]);z??=J.indent,Q??=J.indentSeq}return{indent:z??2,indentSeq:Q??!0}}function _3($,Z){let z=v6($,T5);if(z.errors.length>0){let Q=z.errors[0].message.split(`
206
+ `)[0];throw Error(`${Z}: not valid YAML (${Q}) — faf left it unchanged.`,{cause:z.errors[0]})}return z}function c6($,Z,z,Q){$.edits.push({start:Z,end:z,text:Q,seq:$.edits.length})}function o1($,Z){return $.lastIndexOf(`
207
+ `,Z-1)+1}function FY($,Z){if(Z>0&&$[Z-1]===`
208
208
  `)return Z;let z=$.indexOf(`
209
- `,Z);return z<0?$.length:z+1}function KY($,Z){let z=Z;if($[z-1]===`
210
- `){if(z--,$[z-1]==="\r")z--}return z}function O2($){return $!==null&&$!==void 0}function m0($){let Z=M2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function DY($,Z){let z=m0($),Q=m0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function IY($){if(A0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return k6($)&&!$.flow}function I5($,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&&I5($,Z)}function AY($,Z,z,Q){let X=new q5(void 0,D5);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 TY($,Z){let z=Z;if($[z-1]===`
210
+ `){if(z--,$[z-1]==="\r")z--}return z}function I2($){return $!==null&&$!==void 0}function c0($){let Z=N2($)?$.range:void 0;return Z?[Z[0],Z[1],Z[2]]:void 0}function PY($,Z){let z=c0($),Q=c0(Z);return!!z&&!!Q&&z[0]===Q[0]&&z[1]===Q[1]&&z[2]===Q[2]&&$.constructor===Z.constructor}function SY($){if(C0($))return $.type==="BLOCK_LITERAL"||$.type==="BLOCK_FOLDED";return b6($)&&!$.flow}function A5($,Z){return $.anchor===Z.anchor&&$.tag===Z.tag&&$.comment===Z.comment&&$.commentBefore===Z.commentBefore&&!!$.spaceBefore===!!Z.spaceBefore}function EY($,Z){return Object.is($.value,Z.value)&&$.type===Z.type&&$.format===Z.format&&$.minFractionDigits===Z.minFractionDigits&&A5($,Z)}function jY($,Z,z,Q){let X=new q5(void 0,T5);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 L3($,Z,z){return AY($,(Q)=>{let X=new I$;return X.items.push(Q.createPair("k",Z)),X},2,z)}function VA($,Z,z){let Q=AY($,()=>{let X=new m1;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 qA($){if(!M2($)||!O2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function HA($,Z){if(!M2($)||!M2(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 KA($,Z){let z=m0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function BA($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function BY($,Z,z,Q,X=!1){let J=m0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,W=M2(z)?z.comment:void 0,U=!O2(Y)||Y===W,G=U?qA(z):z,V=X?G:HA(Z,G),q=Q.kind==="value"?L3($,V,Q.col):VA($,V,Q.col);return q?{range:J,keepTail:U,newComment:W,piece:q}:null}function MA($,Z,z,Q){if(!Q)return KY($,OY($,z[2]));return IY(Z)?KY($,z[1]):z[1]}function s1($,Z,z,Q,X){let J=BY($,Z,z,Q);if(!J)return!1;let Y=MA($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!IY(Z)||Q.kind==="item"))return LA($,J,Y,Q,X),!0;let W=J.keepTail?Z.comment:J.newComment;if(X!==void 0||O2(W))return!1;let U=Q.kind==="value"?BY($,Z,z,Q,!0):J;return U!==null&&NA($,U.range[0],Y,U.piece,Q)}function LA($,Z,z,Q,X){let[J,Y]=Z.range,U=J===Y&&Q.kind==="value"?BA($.src,J,Z.piece.text):Z.piece.text;u6($,J,z,U+(X===void 0?"":` #${X}`))}function NA($,Z,z,Q,X){if(X.kind==="item")return u6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=KA($.src,X.key);if(J<0)return!1;return u6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function OA($,Z){return I5({...$,comment:void 0},{...Z,comment:void 0})}function DA($,Z){if(O2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
213
- `)?void 0:Z.comment}function IA($,Z,z,Q){if(TY(Z,z))return!0;if(!OA(Z,z))return!1;let X=DA(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return s1($,Z,z,Q,X)}function TA($,Z,z,Q){if(!I5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return L3($,Z,0).text===L3($,z,0).text||s1($,Z,z,Q);if(z.items.length===0)return s1($,Z,z,Q);return H0(Z)?RA($,Z,z):PA($,Z,z)}function I3($,Z,z,Q){if(!DY(Z,z))return s1($,Z,z,Q);if(A0(Z))return IA($,Z,z,Q);if(v2(Z))return v2(z)&&Z.source===z.source&&I5(Z,z)||s1($,Z,z,Q);if(!k6(Z)||!k6(z))return!1;return TA($,Z,z,Q)}function CY($,Z){return Z-r1($,Z)}function T3($,Z,z){let Q=$.slice(r1($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function N3($){return M2($)&&(O2($.commentBefore)||!!$.spaceBefore)}function A3($,Z,z){let Q=m0(Z)??m0(z);return Q?OY($.src,Q[2]):-1}function _Y($,Z,z){let Q=new q5(void 0,D5);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 AA($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
215
- `);u6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function RY($,Z,z,Q,X,J){let Y=z;if(Y<0){let W=m0(Z);if(!W||N3(Z)||!T3($.src,W[0],J))return!1;Y=r1($.src,W[0])}return AA($,Y,_Y($,Q,X)),!0}function CA($,Z,z){let Q=r1($,z),X=Z,J=O2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let W=r1($,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 FY($,Z,z,Q){let X=m0(Z);if(!X||!T3($.src,X[0],Q))return!1;let J=A3($,z,Z);if(J<0)return!1;return u6($,CA($.src,Z,X[0]),J,""),!0}function PY($,Z){let z=new Map,Q=(X)=>{let J=m0(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&&DY(Z($[Y]),Z(X))?Y:-1}}function _A($,Z){return A0($)&&A0(Z)?TY($,Z):$===Z}function RA($,Z,z){let Q=Z.items[0]?.key,X=m0(Q);if(!X)return!1;let J=CY($.src,X[0]),Y=new Set,W=(q,H)=>{if(q.length===0)return!0;let K=new I$;K.items.push(...q);let L=H<0?-1:A3($,Z.items[H].value,Z.items[H].key);return RY($,Q,L,K,J,!1)},U=PY(Z.items,(q)=>q.key),G=-1,V=[];for(let q of z.items){let H=U(q);if(H<0){V.push(q);continue}if(H<=G||!W(V,G)||!_A(Z.items[H].key,q.key))return!1;if(V=[],!I3($,Z.items[H].value,q.value,{kind:"value",key:Z.items[H].key,col:J}))return!1;Y.add(H),G=H}if(!W(V,G))return!1;return Z.items.every((q,H)=>Y.has(H)||FA($,Z,H))}function FA($,Z,z){let Q=Z.items[z],X=m0(Q.key);if(!X)return!1;if(T3($.src,X[0],!1))return FY($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=m0(J?.key);if(z!==0||!Y||N3(Q.key)||N3(J.key))return!1;return u6($,X[0],Y[0],""),!0}function PA($,Z,z){let Q=m0(Z);if(!Q||Z.items.length===0)return!1;let X=CY($.src,Q[0]),J=new Set,Y=(V,q)=>{if(V.length===0)return!0;let H=new m1;H.items.push(...V);let K=q<0?-1:A3($,Z.items[q]);return RY($,Z.items[0],K,H,X,!0)},W=PY(Z.items,(V)=>V),U=-1,G=[];for(let V of z.items){let q=W(V);if(q<0){G.push(V);continue}if(q<=U||!Y(G,U))return!1;if(G=[],!I3($,Z.items[q],V,{kind:"item",col:X}))return!1;J.add(q),U=q}if(!Y(G,U))return!1;return Z.items.every((V,q)=>J.has(q)||FY($,V,V,!0))}function SA($,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 EA($,Z,z){if(!H0(z)&&!g2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
216
- `)?$.eol:"",X=Z.commentBefore?$.eol:"";return u6($,$.src.length,$.src.length,Q+X+_Y($,z,0)),!0}function jA($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!O2(Q))return!O2(X)||EA($,Z,X);return O2(X)&&I3($,Q,X,{kind:"root"})}function wA($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!jA(J,Z,z))return null;return SA($,J.edits)}var MY=($)=>$.replace(/^[ \t]*\n/gm,"");function xA($,Z,z,Q){let X=b6($,D5);if(X.errors.length>0||!K0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||MY(J)===MY(z)}function T5($,Z,z="YAML"){let{text:Q,changed:X}=yA($,Z,z);return{text:Q,changed:X}}function yA($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=D3(X,z),Y=kA(J);Z(Y);let W={text:$,changed:!1,spliced:!1};if(K0(Y.toJS(),J.toJS()))return W;let U={lineWidth:0,...GA(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 T3($,Z,z){return jY($,(Q)=>{let X=new C$;return X.items.push(Q.createPair("k",Z)),X},2,z)}function _A($,Z,z){let Q=jY($,()=>{let X=new p1;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 RA($){if(!N2($)||!I2($.comment))return $;let Z=$.clone();return Z.comment=void 0,Z}function FA($,Z){if(!N2($)||!N2(Z))return Z;let z=$,Q=Z;if(!z.anchor&&!z.tag||z.anchor!==Q.anchor||z.tag!==Q.tag)return Z;let X=Z.clone();return X.anchor=void 0,X.tag=void 0,X}function PA($,Z){let z=c0(Z);if(!z)return-1;let Q=z[2];while($[Q]===" "||$[Q]==="\t")Q++;return $[Q]===":"?Q+1:-1}function SA($,Z,z){let Q=$[Z-1]===" "||$[Z-1]==="\t"?"":" ",X=$[Z]==="#"?" ":"";return`${Q}${z}${X}`}function AY($,Z,z,Q,X=!1){let J=c0(Z);if(!J||Q.kind==="root")return null;let Y=Z.comment,W=N2(z)?z.comment:void 0,U=!I2(Y)||Y===W,G=U?RA(z):z,V=X?G:FA(Z,G),H=Q.kind==="value"?T3($,V,Q.col):_A($,V,Q.col);return H?{range:J,keepTail:U,newComment:W,piece:H}:null}function EA($,Z,z,Q){if(!Q)return TY($,FY($,z[2]));return SY(Z)?TY($,z[1]):z[1]}function a1($,Z,z,Q,X){let J=AY($,Z,z,Q);if(!J)return!1;let Y=EA($.src,Z,J.range,J.keepTail);if(J.piece.inline&&(!SY(Z)||Q.kind==="item"))return jA($,J,Y,Q,X),!0;let W=J.keepTail?Z.comment:J.newComment;if(X!==void 0||I2(W))return!1;let U=Q.kind==="value"?AY($,Z,z,Q,!0):J;return U!==null&&wA($,U.range[0],Y,U.piece,Q)}function jA($,Z,z,Q,X){let[J,Y]=Z.range,U=J===Y&&Q.kind==="value"?SA($.src,J,Z.piece.text):Z.piece.text;c6($,J,z,U+(X===void 0?"":` #${X}`))}function wA($,Z,z,Q,X){if(X.kind==="item")return c6($,Z,z,Q.text),!0;if(X.kind!=="value")return!1;let J=PA($.src,X.key);if(J<0)return!1;return c6($,J,z,Q.inline?` ${Q.text}`:Q.text),!0}function xA($,Z){return A5({...$,comment:void 0},{...Z,comment:void 0})}function yA($,Z){if(I2($.comment)||typeof Z.comment!=="string")return;return Z.comment.includes(`
213
+ `)?void 0:Z.comment}function kA($,Z,z,Q){if(EY(Z,z))return!0;if(!xA(Z,z))return!1;let X=yA(Z,z);if(Z.comment!==z.comment&&X===void 0)return!1;return a1($,Z,z,Q,X)}function bA($,Z,z,Q){if(!A5(Z,z)||!!Z.flow!==!!z.flow)return!1;if(Z.flow)return T3($,Z,0).text===T3($,z,0).text||a1($,Z,z,Q);if(z.items.length===0)return a1($,Z,z,Q);return q0(Z)?fA($,Z,z):mA($,Z,z)}function R3($,Z,z,Q){if(!PY(Z,z))return a1($,Z,z,Q);if(C0(Z))return kA($,Z,z,Q);if(h2(Z))return h2(z)&&Z.source===z.source&&A5(Z,z)||a1($,Z,z,Q);if(!b6(Z)||!b6(z))return!1;return bA($,Z,z,Q)}function wY($,Z){return Z-o1($,Z)}function F3($,Z,z){let Q=$.slice(o1($,Z),Z);return z?/^ *- +$/.test(Q)||/^ *$/.test(Q):/^ *$/.test(Q)}function A3($){return N2($)&&(I2($.commentBefore)||!!$.spaceBefore)}function P3($,Z,z){let Q=c0(Z)??c0(z);return Q?FY($.src,Q[2]):-1}function xY($,Z,z){let Q=new q5(void 0,T5);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 vA($,Z,z){let Q=Z===$.src.length&&Z>0&&!$.src.endsWith(`
215
+ `);c6($,Z,Z,Q?$.eol+z.slice(0,-$.eol.length):z)}function yY($,Z,z,Q,X,J){let Y=z;if(Y<0){let W=c0(Z);if(!W||A3(Z)||!F3($.src,W[0],J))return!1;Y=o1($.src,W[0])}return vA($,Y,xY($,Q,X)),!0}function gA($,Z,z){let Q=o1($,z),X=Z,J=I2(X.commentBefore),Y=!!X.spaceBefore;while(Q>0){let W=o1($,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 kY($,Z,z,Q){let X=c0(Z);if(!X||!F3($.src,X[0],Q))return!1;let J=P3($,z,Z);if(J<0)return!1;return c6($,gA($.src,Z,X[0]),J,""),!0}function bY($,Z){let z=new Map,Q=(X)=>{let J=c0(X);return J?J.join(":"):void 0};return $.forEach((X,J)=>{let Y=Q(Z(X));if(Y!==void 0&&!z.has(Y))z.set(Y,J)}),(X)=>{let J=Q(Z(X)),Y=J===void 0?void 0:z.get(J);return Y!==void 0&&PY(Z($[Y]),Z(X))?Y:-1}}function hA($,Z){return C0($)&&C0(Z)?EY($,Z):$===Z}function fA($,Z,z){let Q=Z.items[0]?.key,X=c0(Q);if(!X)return!1;let J=wY($.src,X[0]),Y=new Set,W=(H,K)=>{if(H.length===0)return!0;let q=new C$;q.items.push(...H);let L=K<0?-1:P3($,Z.items[K].value,Z.items[K].key);return yY($,Q,L,q,J,!1)},U=bY(Z.items,(H)=>H.key),G=-1,V=[];for(let H of z.items){let K=U(H);if(K<0){V.push(H);continue}if(K<=G||!W(V,G)||!hA(Z.items[K].key,H.key))return!1;if(V=[],!R3($,Z.items[K].value,H.value,{kind:"value",key:Z.items[K].key,col:J}))return!1;Y.add(K),G=K}if(!W(V,G))return!1;return Z.items.every((H,K)=>Y.has(K)||uA($,Z,K))}function uA($,Z,z){let Q=Z.items[z],X=c0(Q.key);if(!X)return!1;if(F3($.src,X[0],!1))return kY($,Q.key,Q.value,!1);let J=Z.items[z+1],Y=c0(J?.key);if(z!==0||!Y||A3(Q.key)||A3(J.key))return!1;return c6($,X[0],Y[0],""),!0}function mA($,Z,z){let Q=c0(Z);if(!Q||Z.items.length===0)return!1;let X=wY($.src,Q[0]),J=new Set,Y=(V,H)=>{if(V.length===0)return!0;let K=new p1;K.items.push(...V);let q=H<0?-1:P3($,Z.items[H]);return yY($,Z.items[0],q,K,X,!0)},W=bY(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=[],!R3($,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)||kY($,V,V,!0))}function cA($,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 pA($,Z,z){if(!q0(z)&&!f2(z))return!1;let Q=$.src.length>0&&!$.src.endsWith(`
216
+ `)?$.eol:"",X=Z.commentBefore?$.eol:"";return c6($,$.src.length,$.src.length,Q+X+xY($,z,0)),!0}function lA($,Z,z){if(Z.commentBefore!==z.commentBefore||Z.comment!==z.comment)return!1;let Q=Z.contents,X=z.contents;if(!I2(Q))return!I2(X)||pA($,Z,X);return I2(X)&&R3($,Q,X,{kind:"root"})}function dA($,Z,z,Q,X){let J={src:$,eol:Q,edits:[],piece:X};if(!lA(J,Z,z))return null;return cA($,J.edits)}var CY=($)=>$.replace(/^[ \t]*\n/gm,"");function iA($,Z,z,Q){let X=v6($,T5);if(X.errors.length>0||!B0(X.toJS(),Z.toJS()))return!1;let J=X.toString(Q);return J===z||CY(J)===CY(z)}function C5($,Z,z="YAML"){let{text:Q,changed:X}=nA($,Z,z);return{text:Q,changed:X}}function nA($,Z,z="YAML"){let Q=$.startsWith("\uFEFF")?"\uFEFF":"",X=$.slice(Q.length),J=_3(X,z),Y=rA(J);Z(Y);let W={text:$,changed:!1,spliced:!1};if(B0(Y.toJS(),J.toJS()))return W;let U={lineWidth:0,...CA(X)},G=Y.toString(U);if(G===J.toString(U))return W;let V=X.includes(`\r
217
217
  `)?`\r
218
218
  `:`
219
- `,q=wA(X,J,Y,V,{...U,verifyAliasOrder:!1}),H=q!==null&&xA(q,Y,G,U),K=H&&q!==null?q:G.replace(/\r?\n/g,V);return{text:Q+K,changed:Q+K!==$,spliced:H}}function kA($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function K0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>K0(z,Z[Q]));if(e($)&&e(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&K0($[Q],Z[Q]))}return!1}function a1($){let Z=A0($.key)?$.key.value:$.key;return typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean"?String(Z):void 0}function V6($,Z){return $.items.find((z)=>a1(z)===Z)}function SY($,Z){return M2(Z)?Z.toJS($):Z}function bA($,Z,z,Q){return Q.keepAliases===!0&&v2(Z)||K0(SY($,Z),z)}function A5($,Z,z,Q={}){if(bA($,Z,z,Q))return Z;if(e(z)&&H0(Z))return gA($,Z,z,Q),Z;if(Array.isArray(z)&&g2(Z))return uA($,Z,z,Q),Z;if(!e(z)&&!Array.isArray(z)&&A0(Z))return Z.value=z,Z;return vA(Z,$.createNode(z))}function vA($,Z){if(!A0($)&&!v2($))return Z;let z=$,Q=Z;if(k6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=M3(Q.commentBefore,z.commentBefore,z.comment),Z;if(k6(Z))Z.flow=!0;return Q.comment=M3(Q.comment??z.comment),Q.commentBefore=M3(Q.commentBefore??z.commentBefore),Z}function M3(...$){let Z=$.filter(O2);return Z.length>0?Z.join(`
220
- `):void 0}function gA($,Z,z,Q={}){for(let[X,J]of Object.entries(z)){if(J===void 0)continue;let Y=V6(Z,X);if(Y)Y.value=A5($,Y.value,J,Q);else Z.items.push($.createPair(X,J))}if(!Q.prune)return;Z.items=Z.items.filter((X)=>{let J=a1(X);return J===void 0||z[J]!==void 0})}function C3($,Z,z,Q){let X=e(z)?z:{};for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=V6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(Object.prototype.hasOwnProperty.call(X,J)&&K0(X[J],Y))continue;else if(e(Y)&&e(X[J])&&H0(W.value))C3($,W.value,X[J],Y);else W.value=A5($,W.value,Y,{keepAliases:!0})}}function o1($,Z,z){if(v2($))z.push({path:[...Z],node:$});else if(H0($))for(let Q of $.items){let X=a1(Q);if(X!==void 0)o1(Q.value,[...Z,X],z)}else if(g2($))$.items.forEach((Q,X)=>o1(Q,[...Z,X],z))}function LY($,Z){let z=$;for(let Q of Z)if(Array.isArray(z)&&typeof Q==="number")z=z[Q];else if(e(z)&&typeof Q==="string")z=z[Q];else return;return z}function EY($,Z,z){let Q=[];return o1($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=LY(Z,X);return Y!==void 0&&!K0(LY(z,X),Y)&&!K0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function jY($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=hA(z,Z[X]);let Q=Z[Z.length-1];if(H0(z)&&typeof Q==="string"){let X=V6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(g2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>m0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function hA($,Z){if(H0($)&&typeof Z==="string")return V6($,Z)?.value;if(g2($)&&typeof Z==="number")return $.items[Z];return}function wY($,Z){let z=[];o1($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=jY(Z,X);if(!Y||v2(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 O3($,Z,z,Q){if(!M2($)||v2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(H0($))for(let J of $.items){let Y=a1(J);if(Y!==void 0)O3(J.value,[...Z,Y],z,Q)}else if(g2($))$.items.forEach((J,Y)=>O3(J,[...Z,Y],z,Q))}function xY($,Z){let z=[];o1($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];O3($.contents,[],Q,X);let J=[];for(let{path:Y,node:W}of X){let U=jY(Z,Y);if(!U)continue;let G=W.anchor;if(M2(U.node)&&U.node.anchor===G&&K0(W.toJS($),U.node.toJS(Z))||!U.put(W.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function fA($,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]=K0($[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(K0($[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 uA($,Z,z,Q){let X=Z.items,J=X.map((G)=>SY($,G)),Y=[],W=0,U=0;for(let[G,V]of[...fA(J,z),[X.length,z.length]]){for(;W<G&&U<V;W++,U++)Y.push(A5($,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 t1($,Z,z,Q){if(K0(z,Q))return Z;if(!e(z)||!e(Q)||!H0(Z))return A5($,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=a1(J);return Y===void 0||!X.has(Y)});for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=V6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(!K0(z[J],Y))W.value=t1($,W.value,z[J],Y)}return Z}function yY($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new I$,Q=$.contents;if(!H0(Q))throw Error(`${z}: the document is not a mapping — faf left it unchanged.`);let X=Q;for(let J of Z){let Y=V6(X,J);if(Y&&H0(Y.value)){X=Y.value;continue}if(Y&&!vY(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let W=new I$;if(Y)Y.value=bY(Y.value,W);else X.items.push($.createPair(J,W));X=W}return X}function C5($,Z,z,Q,X){if(K0(z,Q))return;let J=yY($,Z.slice(0,-1),X),Y=Z[Z.length-1],W=V6(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=t1($,W.value,z,Q)}function kY($,Z,z){let Q=yY($,Z.slice(0,-1),z),X=Z[Z.length-1],J=V6(Q,X);if(J&&g2(J.value))return J.value;if(J&&!vY(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new m1;if(J)J.value=bY(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function bY($,Z){if(!A0($))return Z;let z=[$.commentBefore,$.comment].filter(O2);if(z.length>0)Z.commentBefore=z.join(`
221
- `);return Z}function vY($){if($===null||$===void 0)return!0;return A0($)&&($.value===null||$.value===void 0)}var _3=new WeakMap;function e1($){return typeof $==="object"&&$!==null?_3.get($):void 0}function _5($,Z){_3.set($,Z)}function gY($,Z){let z=e1($);if(z)_3.set(Z,z);return Z}var hY=new WeakSet;function fY($){return hY.add($),$}function uY($){return typeof $==="object"&&$!==null&&hY.has($)}function F5($){let Z=P$($);return l(R5(Z),Z,{read:!0})}function R3($){if($ instanceof H5)return $;let Z=$?.cause;return Z instanceof H5?Z:null}function F3($,Z){let z=Z.message.split(`
222
- `)[0].replace(/ at line \d+, column \d+:?\s*$/,"").replace(/:\s*$/,""),Q=Z.linePos?.[0]?.line,X=P$($);return new b("not-yaml",X,`${X} is not valid YAML (${z}${Q===void 0?"":`, line ${Q}`}) — faf left it unchanged`,{cause:Z})}function n($,Z){try{return Z()}catch(z){if(z instanceof b)throw z;let Q=(z instanceof Error?z.message:String(z)).split(`
223
- `)[0].trim(),X=P$($);throw new b("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function r($){let Z=F5($),z=z0(Z),Q;try{Q=n0(z)}catch(J){let Y=R3(J);if(Y)throw F3($,Y);throw J}let X=d1(Q,$);return _5(X,{real:Z,text:z}),X}function P3($){let Z=$._meta,z={...$};delete z._meta;let Q=T$(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 pA($,Z,z,Q,X=!1){let J=F5($),Y=z0(J),W=[],U;try{U=T5(Y,(G)=>{dY(G,$);let V=G.clone();if(Z(G),W=wY(V,G),X)W=[...W,...xY(V,G)];if(Q)W=[...W,...Q(G,V.toJS()).filter((q)=>!W.some((H)=>H.path===q.path))]},$)}catch(G){let V=R3(G);if(V)throw F3($,V);throw G}if(!U.changed)return{written:!1,text:Y,keptAliases:W};return a($,U.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:U.text,keptAliases:W}}function c0($){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 cY($){try{return lY($),!0}catch{return!1}}function lA($){let Z=$.getIn(["project","type"],!0);return A0(Z)?Z.value:Z}function dY($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!H0(z))throw new b("not-yaml",P$(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${g6($.toJS())}. faf left it unchanged — fix it by hand.`)}function dA($,Z,z){dY($,z);let Q=$.contents,X=H0(Q)&&Q.items.some((V)=>A0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,W=lA($),U=H0(Q)?$.toJS():{},G=H0(Q)?Q:$.createNode({});if($.contents=G,C3($,G,U,X?{...Z}:Y),!X)nA($,J?.found,W)}function iA($,Z){let z=$.contents;if(H0(z)&&z.items.some((J)=>A0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function nA($,Z,z){if(!Z||Z.length===0||!U0(z))return;let Q=$.getIn(["project","type"],!0);if(A0(Q)&&!U0(Q.value)&&(Q.comment===null||Q.comment===void 0))Q.comment=` found: ${Z.join(" + ")}`}function B0($,Z,z={}){if(!z.replace&&cY($)){let W=pA($,(U)=>dA(U,Z,$),e1(Z),(U,G)=>EY(U,iA(U,Z),G),uY(Z));_5(Z,{real:F5($),text:W.text});for(let U of W.keptAliases??[])z.onAliasKept?.(U);return W.written}let Q=P$($),X=P3(Z),J=cY($)?y0(l(R5(Q),Q)):null,Y=a($,X,{expect:J});return _5(Z,{real:Y,text:X}),!0}function p($){return z0(F5($))}function Q2($,Z){let z;try{z=n0($)}catch(Q){let X=R3(Q);if(Z!==void 0&&X)throw F3(Z,X);throw Q}return Z===void 0?z:d1(z,Z)}function pY($,Z){let z;try{z=lY(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return l($,P$(Z),{read:!0}),!0}function m($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=mY($,Q);if(pY($,X))return X}let z=R5($);if(z!==$)for(let Q of Z){let X=mY(z,Q);if(pY(z,X))return X}return null}function S$($,Z=process.cwd()){return cA("git",["-C",R5($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+mA($)}i();var E$=[{name:"TROPHY",indicator:`${R0("✪")} ${R0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${R0(C("★"))} ${R0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${I("◆")} ${I("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${P5("◇")} ${P5("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 D2($){return $.indicator}function q6($){for(let Z of E$)if($>=Z.threshold)return Z;return E$[E$.length-1]}var E3=null;function Z4(){if(E3)return E3;try{let $=i0("faf-scoring-kernel");return E3=$,$}catch{throw Error(`faf-scoring-kernel not installed.
219
+ `,H=dA(X,J,Y,V,{...U,verifyAliasOrder:!1}),K=H!==null&&iA(H,Y,G,U),q=K&&H!==null?H:G.replace(/\r?\n/g,V);return{text:Q+q,changed:Q+q!==$,spliced:K}}function rA($){let Z=$.clone();if($.directives&&Z.directives)Z.directives.docEnd=$.directives.docEnd;return Z}function B0($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>B0(z,Z[Q]));if($0($)&&$0(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&B0($[Q],Z[Q]))}return!1}function e1($){let Z=C0($.key)?$.key.value:$.key;return typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean"?String(Z):void 0}function K6($,Z){return $.items.find((z)=>e1(z)===Z)}function vY($,Z){return N2(Z)?Z.toJS($):Z}function sA($,Z,z,Q){return Q.keepAliases===!0&&h2(Z)||B0(vY($,Z),z)}function _5($,Z,z,Q={}){if(sA($,Z,z,Q))return Z;if($0(z)&&q0(Z))return aA($,Z,z,Q),Z;if(Array.isArray(z)&&f2(Z))return $C($,Z,z,Q),Z;if(!$0(z)&&!Array.isArray(z)&&C0(Z))return Z.value=z,Z;return oA(Z,$.createNode(z))}function oA($,Z){if(!C0($)&&!h2($))return Z;let z=$,Q=Z;if(b6(Z)&&Z.items.length>0&&!Z.flow)return Q.commentBefore=I3(Q.commentBefore,z.commentBefore,z.comment),Z;if(b6(Z))Z.flow=!0;return Q.comment=I3(Q.comment??z.comment),Q.commentBefore=I3(Q.commentBefore??z.commentBefore),Z}function I3(...$){let Z=$.filter(I2);return Z.length>0?Z.join(`
220
+ `):void 0}function aA($,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=_5($,Y.value,J,Q);else Z.items.push($.createPair(X,J))}if(!Q.prune)return;Z.items=Z.items.filter((X)=>{let J=e1(X);return J===void 0||z[J]!==void 0})}function S3($,Z,z,Q){let X=$0(z)?z:{};for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=K6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(Object.prototype.hasOwnProperty.call(X,J)&&B0(X[J],Y))continue;else if($0(Y)&&$0(X[J])&&q0(W.value))S3($,W.value,X[J],Y);else W.value=_5($,W.value,Y,{keepAliases:!0})}}function t1($,Z,z){if(h2($))z.push({path:[...Z],node:$});else if(q0($))for(let Q of $.items){let X=e1(Q);if(X!==void 0)t1(Q.value,[...Z,X],z)}else if(f2($))$.items.forEach((Q,X)=>t1(Q,[...Z,X],z))}function _Y($,Z){let z=$;for(let Q of Z)if(Array.isArray(z)&&typeof Q==="number")z=z[Q];else if($0(z)&&typeof Q==="string")z=z[Q];else return;return z}function gY($,Z,z){let Q=[];return t1($.contents,[],Q),Q.filter(({path:X,node:J})=>{let Y=_Y(Z,X);return Y!==void 0&&!B0(_Y(z,X),Y)&&!B0(J.toJS($),Y)}).map(({path:X,node:J})=>({path:X.join("."),alias:`*${J.source}`}))}function hY($,Z){let z=$.contents;for(let X=0;X<Z.length-1&&z!==void 0;X++)z=tA(z,Z[X]);let Q=Z[Z.length-1];if(q0(z)&&typeof Q==="string"){let X=K6(z,Q);return X?{node:X.value,put:(J)=>(X.value=J,!0)}:null}if(f2(z)&&typeof Q==="number"&&Q<z.items.length){let X=z,J=X.items[Q];return{node:J,put:(Y)=>c0(J)===void 0?(X.items[Q]=Y,!0):!1}}return null}function tA($,Z){if(q0($)&&typeof Z==="string")return K6($,Z)?.value;if(f2($)&&typeof Z==="number")return $.items[Z];return}function fY($,Z){let z=[];t1($.contents,[],z);let Q=[];for(let{path:X,node:J}of z){let Y=hY(Z,X);if(!Y||h2(Y.node)&&Y.node.source===J.source)continue;if(!Y.put(J.clone()))continue;Q.push({path:X.join("."),alias:`*${J.source}`})}return Q}function C3($,Z,z,Q){if(!N2($)||h2($))return;let X=$.anchor;if(X&&z.has(X))Q.push({path:[...Z],node:$});if(q0($))for(let J of $.items){let Y=e1(J);if(Y!==void 0)C3(J.value,[...Z,Y],z,Q)}else if(f2($))$.items.forEach((J,Y)=>C3(J,[...Z,Y],z,Q))}function uY($,Z){let z=[];t1($.contents,[],z);let Q=new Set(z.map((Y)=>Y.node.source));if(Q.size===0)return[];let X=[];C3($.contents,[],Q,X);let J=[];for(let{path:Y,node:W}of X){let U=hY(Z,Y);if(!U)continue;let G=W.anchor;if(N2(U.node)&&U.node.anchor===G&&B0(W.toJS($),U.node.toJS(Z))||!U.put(W.clone()))continue;J.push({path:Y.join("."),alias:`&${G}`,kind:"anchor"})}return J}function eA($,Z){let z=$.length,Q=Z.length,X=Array.from({length:z+1},()=>Array(Q+1).fill(0));for(let Y=z-1;Y>=0;Y--)for(let W=Q-1;W>=0;W--)X[Y][W]=B0($[Y],Z[W])?X[Y+1][W+1]+1:Math.max(X[Y+1][W],X[Y][W+1]);let J=[];for(let Y=0,W=0;Y<z&&W<Q;)if(B0($[Y],Z[W]))J.push([Y,W]),Y++,W++;else if(X[Y+1][W]>=X[Y][W+1])Y++;else W++;return J}function $C($,Z,z,Q){let X=Z.items,J=X.map((G)=>vY($,G)),Y=[],W=0,U=0;for(let[G,V]of[...eA(J,z),[X.length,z.length]]){for(;W<G&&U<V;W++,U++)Y.push(_5($,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 $4($,Z,z,Q){if(B0(z,Q))return Z;if(!$0(z)||!$0(Q)||!q0(Z))return _5($,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=e1(J);return Y===void 0||!X.has(Y)});for(let[J,Y]of Object.entries(Q)){if(Y===void 0)continue;let W=K6(Z,J);if(!W)Z.items.push($.createPair(J,Y));else if(!B0(z[J],Y))W.value=$4($,W.value,z[J],Y)}return Z}function mY($,Z,z){let Q=$.contents;if(Q===null||Q===void 0)$.contents=new C$,Q=$.contents;if(!q0(Q))throw Error(`${z}: the document is not a mapping — faf left it unchanged.`);let X=Q;for(let J of Z){let Y=K6(X,J);if(Y&&q0(Y.value)){X=Y.value;continue}if(Y&&!lY(Y.value))throw Error(`${z}: ${J} is not a mapping — faf left it unchanged.`);let W=new C$;if(Y)Y.value=pY(Y.value,W);else X.items.push($.createPair(J,W));X=W}return X}function R5($,Z,z,Q,X){if(B0(z,Q))return;let J=mY($,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=$4($,W.value,z,Q)}function cY($,Z,z){let Q=mY($,Z.slice(0,-1),z),X=Z[Z.length-1],J=K6(Q,X);if(J&&f2(J.value))return J.value;if(J&&!lY(J.value))throw Error(`${z}: ${Z.join(".")} is not a list — faf left it unchanged.`);let Y=new p1;if(J)J.value=pY(J.value,Y);else Q.items.push($.createPair(X,Y));return Y}function pY($,Z){if(!C0($))return Z;let z=[$.commentBefore,$.comment].filter(I2);if(z.length>0)Z.commentBefore=z.join(`
221
+ `);return Z}function lY($){if($===null||$===void 0)return!0;return C0($)&&($.value===null||$.value===void 0)}var E3=new WeakMap;function Z4($){return typeof $==="object"&&$!==null?E3.get($):void 0}function F5($,Z){E3.set($,Z)}function dY($,Z){let z=Z4($);if(z)E3.set(Z,z);return Z}var iY=new WeakSet;function nY($){return iY.add($),$}function rY($){return typeof $==="object"&&$!==null&&iY.has($)}function S5($){let Z=E$($);return l(P5(Z),Z,{read:!0})}function j3($){if($ instanceof B5)return $;let Z=$?.cause;return Z instanceof B5?Z:null}function w3($,Z){let z=Z.message.split(`
222
+ `)[0].replace(/ at line \d+, column \d+:?\s*$/,"").replace(/:\s*$/,""),Q=Z.linePos?.[0]?.line,X=E$($);return new b("not-yaml",X,`${X} is not valid YAML (${z}${Q===void 0?"":`, line ${Q}`}) — faf left it unchanged`,{cause:Z})}function r($,Z){try{return Z()}catch(z){if(z instanceof b)throw z;let Q=(z instanceof Error?z.message:String(z)).split(`
223
+ `)[0].trim(),X=E$($);throw new b("not-yaml",X,`${X}: faf's scoring kernel could not read it (${Q}) — faf left it unchanged`,{cause:z})}}function s($){let Z=S5($),z=Q0(Z),Q;try{Q=r0(z)}catch(J){let Y=j3(J);if(Y)throw w3($,Y);throw J}let X=n1(Q,$);return F5(X,{real:Z,text:z}),X}function x3($){let Z=$._meta,z={...$};delete z._meta;let Q=g6(z,{lineWidth:0});if(Z?.found&&Z.found.length>0){let X=Z.found.join(" + ");Q=Q.replace(/^(\s+type:\s+\S+)(\s*)$/m,(J,Y,W)=>{if(W.includes("#"))return J;return`${Y} # found: ${X}`})}return Q}function QC($,Z,z,Q,X=!1){let J=S5($),Y=Q0(J),W=[],U;try{U=C5(Y,(G)=>{eY(G,$);let V=G.clone();if(Z(G),W=fY(V,G),X)W=[...W,...uY(V,G)];if(Q)W=[...W,...Q(G,V.toJS()).filter((H)=>!W.some((K)=>K.path===H.path))]},$)}catch(G){let V=j3(G);if(V)throw w3($,V);throw G}if(!U.changed)return{written:!1,text:Y,keptAliases:W};return a($,U.text,{expect:z&&z.real===J?z.text:Y}),{written:!0,text:U.text,keptAliases:W}}function p0($){if($.kind==="anchor")return`${$.path} holds an anchor (${$.alias}) that an alias reads — faf left it as written`;return`${$.path} is an alias (${$.alias}) — faf left it as written`}function oY($){try{return tY($),!0}catch{return!1}}function XC($){let Z=$.getIn(["project","type"],!0);return C0(Z)?Z.value:Z}function eY($,Z){let z=$.contents;if(z!==null&&z!==void 0&&!q0(z))throw new b("not-yaml",E$(Z),`${Z}: a .faf must be a YAML mapping (key: value pairs), but this one is ${f6($.toJS())}. faf left it unchanged — fix it by hand.`)}function JC($,Z,z){eY($,z);let Q=$.contents,X=q0(Q)&&Q.items.some((V)=>C0(V.key)&&V.key.value==="_meta"),{_meta:J,...Y}=Z,W=XC($),U=q0(Q)?$.toJS():{},G=q0(Q)?Q:$.createNode({});if($.contents=G,S3($,G,U,X?{...Z}:Y),!X)WC($,J?.found,W)}function YC($,Z){let z=$.contents;if(q0(z)&&z.items.some((J)=>C0(J.key)&&J.key.value==="_meta"))return Z;let{_meta:Q,...X}=Z;return X}function WC($,Z,z){if(!Z||Z.length===0||!G0(z))return;let Q=$.getIn(["project","type"],!0);if(C0(Q)&&!G0(Q.value)&&(Q.comment===null||Q.comment===void 0))Q.comment=` found: ${Z.join(" + ")}`}function M0($,Z,z={}){if(!z.replace&&oY($)){let W=QC($,(U)=>JC(U,Z,$),Z4(Z),(U,G)=>gY(U,YC(U,Z),G),rY(Z));F5(Z,{real:S5($),text:W.text});for(let U of W.keptAliases??[])z.onAliasKept?.(U);return W.written}let Q=E$($),X=x3(Z),J=oY($)?k0(l(P5(Q),Q)):null,Y=a($,X,{expect:J});return F5(Z,{real:Y,text:X}),!0}function p($){return Q0(S5($))}function X2($,Z){let z;try{z=r0($)}catch(Q){let X=j3(Q);if(Z!==void 0&&X)throw w3(Z,X);throw Q}return Z===void 0?z:n1(z,Z)}function aY($,Z){let z;try{z=tY(Z)}catch{return!1}if(!z.isSymbolicLink()&&!z.isFile())return!1;return l($,E$(Z),{read:!0}),!0}function f($=process.cwd()){let Z=["project.faf",".faf"];for(let Q of Z){let X=sY($,Q);if(aY($,X))return X}let z=P5($);if(z!==$)for(let Q of Z){let X=sY(z,Q);if(aY(z,X))return X}return null}function j$($,Z=process.cwd()){return zC("git",["-C",P5($),"rev-parse","--show-prefix"],{cwd:Z,encoding:"utf-8"}).trim()+ZC($)}i();var w$=[{name:"TROPHY",indicator:`${F0("✪")} ${F0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${F0(C("★"))} ${F0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${T("◆")} ${T("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${E5("◇")} ${E5("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${C("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${M("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${M("○")} RED`,threshold:1},{name:"WHITE",indicator:`${M("♡")}`,threshold:0}];function T2($){return $.indicator}function q6($){for(let Z of w$)if($>=Z.threshold)return Z;return w$[w$.length-1]}var k3=null;function Q4(){if(k3)return k3;try{let $=n0("faf-scoring-kernel");return k3=$,$}catch{throw Error(`faf-scoring-kernel not installed.
224
224
 
225
225
  Run: npm install faf-scoring-kernel
226
- `)}}var j3=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function sA($){let Z={};for(let[z,Q]of Object.entries($.slots??{}))Z[qY.get(z)??z]=Q;return{...$,slots:Z}}function F0($){return sA(JSON.parse(Z4().score_faf(j3($))))}function nY($){return Z4().validate_faf(j3($))}function S5($){return Z4().compile_fafb(j3($))}function rY($){return JSON.parse(Z4().decompile_fafb($))}function sY(){return Z4().sdk_version()}var oY=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function aY($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function tY($){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 w3($){return $.unknown?"unknown (—)":`${$.score}%`}function k0($){return{score:$.score,tier:q6($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function N0($){let Z=tY($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?q6(z):E$[E$.length-1],populated:0,empty:0,ignored:0,active:0,total:0,slots:{},inherited:!0,represents:Z.represents,...z<0?{unknown:!0}:{}}}return k0(F0($))}function oA($,Z){let[z,Q]=Z.split("."),X=$[z];return e(X)?X[Q]:void 0}function x3($){try{let Z=b6($,{logLevel:"error"}).getIn(["project","type"],!0);return A0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(F$)}catch{return!1}}function aA($,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 tA($){try{let Z=b6($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return e(z)?z:null}catch{return null}}function E5($,Z,z={}){let Q=tA($);if(Q===null)return[];let X=e(Q.project)&&!x3($)?Q.project.type:void 0,J=[];for(let Y of X0){let W=oA(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!R$(W))continue;let U=h6.library.includes(Y.category),G=aA(Y.path,String(W).trim(),f6(X,Y),U,z.outOfType!==!1);if(G!==null)J.push(G)}return J}i();i();import{existsSync as eA,readFileSync as $C}from"fs";import{join as eY}from"path";import{homedir as ZC}from"os";var zC=95,QC=30,XC=3,y3=eY(ZC(),".config","faf"),k3=eY(y3,"star-nudge"),JC="github.com/Wolfe-Jam/faf-cli";function YC($){if($.score<zC)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??XC))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??QC)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function WC(){try{if(!eA(k3))return{shown:0,lastShownMs:null};let $=$C(k3,"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 UC($){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 GC($,Z){try{j0(y3),j2(k3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:y3,owns:UC,mark:"faf star-nudge state"})}catch{}}function $W($){let Z=Date.now(),z=WC();if(!YC({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:")} ${JC}`),GC(z.shown,Z)}function P0($,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=D2($.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(VC(Q),z)console.log(""),qC($);$W($.score)}function VC($){for(let Z of $)console.log(M(` ${Z}`))}function qC($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?I("●"):z==="slotignored"?M("—"):M("○");console.log(` ${Q} ${z==="slotignored"?M(`${Z}: slotignored`):Z}`)}}i();function j5($,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);Q2(Q,z);let X=n(z,()=>N0(Q));if(Z.json){let J=r(z),Y={faf_version:J.faf_version??"unknown",project:J.project?.name??"unknown",source:z,...X};console.log(JSON.stringify(Y,null,2));return}if(Z.status){console.log(X.unknown?`— ${C(w3(X))}`:`${D2(X.tier)} ${C(w3(X))}`);return}P0(X,z,Z.verbose,E5(Q,X))}import{existsSync as cF}from"fs";import{join as lW}from"path";var H6="3.0";import{join as BW}from"path";var ZW=[{name:"Next.js",slug:"nextjs",category:"frontend",signals:[{type:"dependency",key:"next"},{type:"file",pattern:"next.config.*"}]},{name:"React",slug:"react",category:"frontend",signals:[{type:"dependency",key:"react"}]},{name:"SvelteKit",slug:"sveltekit",category:"frontend",signals:[{type:"dependency",key:"@sveltejs/kit"},{type:"file",pattern:"svelte.config.*"}]},{name:"Svelte",slug:"svelte",category:"frontend",signals:[{type:"dependency",key:"svelte"},{type:"devDependency",key:"svelte"}]},{name:"Vue.js",slug:"vue",category:"frontend",signals:[{type:"dependency",key:"vue"}]},{name:"Nuxt",slug:"nuxt",category:"frontend",signals:[{type:"dependency",key:"nuxt"},{type:"file",pattern:"nuxt.config.*"}]},{name:"Angular",slug:"angular",category:"frontend",signals:[{type:"dependency",key:"@angular/core"},{type:"file",pattern:"angular.json"}]},{name:"Astro",slug:"astro",category:"frontend",signals:[{type:"dependency",key:"astro"},{type:"file",pattern:"astro.config.*"}]},{name:"Solid",slug:"solid",category:"frontend",signals:[{type:"dependency",key:"solid-js"}]},{name:"Remix",slug:"remix",category:"frontend",signals:[{type:"dependency",key:"@remix-run/react"}]},{name:"Gatsby",slug:"gatsby",category:"frontend",signals:[{type:"dependency",key:"gatsby"},{type:"file",pattern:"gatsby-config.*"}]},{name:"Qwik",slug:"qwik",category:"frontend",signals:[{type:"dependency",key:"@builder.io/qwik"}]},{name:"Vercel (SvelteKit)",slug:"adapter-vercel",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-vercel"},{type:"devDependency",key:"@sveltejs/adapter-vercel"}]},{name:"Node (SvelteKit)",slug:"adapter-node",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-node"},{type:"devDependency",key:"@sveltejs/adapter-node"}]},{name:"Static (SvelteKit)",slug:"adapter-static",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-static"},{type:"devDependency",key:"@sveltejs/adapter-static"}]},{name:"Cloudflare (SvelteKit)",slug:"adapter-cloudflare",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-cloudflare"},{type:"devDependency",key:"@sveltejs/adapter-cloudflare"}]},{name:"Netlify (SvelteKit)",slug:"adapter-netlify",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-netlify"},{type:"devDependency",key:"@sveltejs/adapter-netlify"}]},{name:"Tailwind CSS",slug:"tailwind",category:"css",signals:[{type:"dependency",key:"tailwindcss"},{type:"devDependency",key:"tailwindcss"},{type:"file",pattern:"tailwind.config.*"}]},{name:"Bootstrap",slug:"bootstrap",category:"css",signals:[{type:"dependency",key:"bootstrap"}]},{name:"Styled Components",slug:"styled-components",category:"css",signals:[{type:"dependency",key:"styled-components"}]},{name:"shadcn/ui",slug:"shadcn",category:"ui",signals:[{type:"file",pattern:"components.json"},{type:"dependency",key:"@radix-ui/react-dialog"}]},{name:"Material UI",slug:"mui",category:"ui",signals:[{type:"dependency",key:"@mui/material"}]},{name:"Chakra UI",slug:"chakra",category:"ui",signals:[{type:"dependency",key:"@chakra-ui/react"}]},{name:"Ant Design",slug:"antd",category:"ui",signals:[{type:"dependency",key:"antd"}]},{name:"Redux",slug:"redux",category:"state",signals:[{type:"dependency",key:"@reduxjs/toolkit"}]},{name:"Zustand",slug:"zustand",category:"state",signals:[{type:"dependency",key:"zustand"}]},{name:"Jotai",slug:"jotai",category:"state",signals:[{type:"dependency",key:"jotai"}]},{name:"Pinia",slug:"pinia",category:"state",signals:[{type:"dependency",key:"pinia"}]},{name:"Express",slug:"express",category:"backend",signals:[{type:"dependency",key:"express"}]},{name:"Fastify",slug:"fastify",category:"backend",signals:[{type:"dependency",key:"fastify"}]},{name:"Hono",slug:"hono",category:"backend",signals:[{type:"dependency",key:"hono"}]},{name:"Elysia",slug:"elysia",category:"backend",signals:[{type:"dependency",key:"elysia"}]},{name:"NestJS",slug:"nestjs",category:"backend",signals:[{type:"dependency",key:"@nestjs/core"}]},{name:"Koa",slug:"koa",category:"backend",signals:[{type:"dependency",key:"koa"}]},{name:"Django",slug:"django",category:"backend",signals:[{type:"file",pattern:"manage.py"},{type:"file",pattern:"settings.py"}]},{name:"Flask",slug:"flask",category:"backend",signals:[{type:"content",pattern:"app.py",key:"flask"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"content",pattern:"main.py",key:"fastapi"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"content",pattern:"Gemfile",key:"rails"},{type:"content",pattern:"Gemfile.lock",key:"rails ("},{type:"file",pattern:"config/application.rb"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"content",pattern:"pom.xml",key:"spring-boot"},{type:"content",pattern:"build.gradle",key:"springframework.boot"},{type:"content",pattern:"build.gradle.kts",key:"springframework.boot"},{type:"content",pattern:"gradle/libs.versions.toml",key:"springframework.boot"}]},{name:"Vapor",slug:"vapor",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"vapor/vapor"},{type:"content",pattern:"Package.swift",key:'product(name: "Vapor"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Vapor'"},{type:"file",pattern:"Sources/App/configure.swift"}]},{name:"Hummingbird",slug:"hummingbird",category:"backend",signals:[{type:"content",pattern:"Package.swift",key:"hummingbird-project/hummingbird"},{type:"content",pattern:"Package.swift",key:'product(name: "Hummingbird"'},{type:"content",pattern:"Package.swift",key:"product(name: 'Hummingbird'"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK",slug:"mcp",category:"ai",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}];import{join as KC}from"path";var j$={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 BC=j$.flutterDeps,MC=j$.mcpDeps,LC=j$.serverFrameworks,NC=j$.stateManagement,OC=j$.routing;function DC($){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 w5($){let Z=u($,"pubspec.yaml");if(Z===null)return null;let z=DC(Z),Q=(_)=>z.has(_.toLowerCase()),X=BC.some(Q)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),J=MC.find(Q),Y=LC.find(([_])=>Q(_)),W=NC.find(([_])=>Q(_)),U=W?W[1]:"",G=OC.find(([_])=>Q(_)),V=G?G[1]:"",q=Q("flutter_test")?"flutter_test":Q("test")?"test":"",H=/^executables:\s*$/m.test(Z),K=(Q0($,"bin")??[]).some((_)=>_.name.endsWith(".dart")),L=H||K,B,N="",T;if(X)if(N="Flutter",A($,KC("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))B="mobile",T="pubspec.yaml (Flutter app)";else B="library",T="pubspec.yaml (Flutter package)";else if(J)B="mcp",T=`pubspec.yaml + ${J} (Dart MCP server)`;else if(Y)B="backend",N=Y[1],T=`pubspec.yaml + ${Y[0]} (Dart backend)`;else if(L)B="cli",T=H?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else B="library",T="pubspec.yaml (Dart package)";return{appType:B,isFlutter:X,framework:N,stateManagement:U,routing:V,testing:q,found:T}}import{join as TC}from"path";var x5={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 AC=x5.mcpModules,CC=x5.serverFrameworks,_C=x5.cliFrameworks;function RC($){let Z=new Set,z=!1;for(let Q of $.split(`
230
- `)){let X=Q.replace(/\/\/.*$/,"").trim();if(!X)continue;if(/^require\s*\(\s*$/.test(X)){z=!0;continue}if(z){if(X===")"){z=!1;continue}let Y=X.match(/^(\S+)/);if(Y)Z.add(Y[1].toLowerCase());continue}let J=X.match(/^require\s+(\S+)/);if(J&&J[1]!=="(")Z.add(J[1].toLowerCase())}return Z}function QW($,Z){let z=Z.toLowerCase();for(let Q of $)if(Q===z||Q.startsWith(`${z}/`))return!0;return!1}function zW($,Z){let z;for(let Q of Z){if(!QW($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function FC($,Z){let z;for(let Q of Z){if(!QW($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function PC($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function SC($){for(let{name:Z}of Q0($,"cmd")??[]){let z=TC("cmd",Z),Q=N2($,z);if(Q?.isDirectory()){if((Q0($,z)??[]).some((X)=>X.name.endsWith(".go")))return!0}else if(Q&&Z.endsWith(".go"))return!0}return!1}function EC($){let Z=u($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function y5($){let Z=u($,"go.mod");if(Z===null)return null;let z=PC(Z),Q=RC(Z),X=FC(Q,AC),J=zW(Q,CC),Y=zW(Q,_C),W=SC($),U=EC($),G,V="",q;if(X)G="mcp",q=`go.mod + ${X} (Go MCP server)`;else if(J)G="backend",V=J[1],q=`go.mod + ${J[0]} (Go backend)`;else if(Y)G="cli",V=Y[1],q=`go.mod + ${Y[0]} (Go CLI)`;else if(W)G="cli",q="go.mod + cmd/ (Go CLI layout)";else if(U&&!J)G="cli",q="go.mod + main.go package main (Go CLI)";else G="library",q="go.mod (Go module)";return{appType:G,modulePath:z,framework:V,found:q}}var m6={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 wC=m6.mcpPackages.map(($)=>$.toLowerCase()),xC=m6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),yC=m6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),kC=m6.grpcServerPackages.map(($)=>$.toLowerCase()),bC=m6.specializedSdks,XW=m6.baseSdk.toLowerCase();function vC($){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($),q=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),H=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))H.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))H.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:q,packages:H,frameworkRefs:K}}function b3($,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 JW($,Z){let z;for(let[Q,X]of Z){if(!b3($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function gC($){let Z;for(let z of wC){if(!b3($,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 hC($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of bC){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function k5($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function fC($,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 uC($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,W,U="",G,V=gC(X),q=hC(Q),H=JW(X,yC),K=JW(X,xC),L=kC.some((N)=>b3(X,N)),B=J.has("microsoft.aspnetcore.app");if(V)W="mcp",U="MCP",G=`${Z} + ${V} (C# MCP server)`;else if($.isTestProject||q?.[1]==="test"||H)W="library",U=H?.[1]||(q?.[1]==="test"?q[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(q?.[1]==="web")W="backend",U=L?"gRPC":q[2],G=`${Z} + Sdk=${q[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(q?.[1]==="worker")W="backend",U=q[2],G=`${Z} + Sdk=${q[0]} (Worker)`;else if(q?.[1]==="blazor-wasm")W="backend",U=q[2],G=`${Z} + Sdk=${q[0]} (Blazor WASM)`;else if(q?.[1]==="aspire")W="backend",U=q[2],G=`${Z} + Sdk=${q[0]} (Aspire)`;else if(q?.[1]==="razor-lib")W="library",U=q[2],G=`${Z} + Sdk=${q[0]} (Razor class library)`;else if(B&&k5(Y))W="backend",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!k5(Y))W="library",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(K&&(k5(Y)||!Y))W="cli",U=K[1],G=`${Z} + ${K[0]} (C# CLI)`;else if(k5(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()===XW||Q.toLowerCase().startsWith(`${XW}/`))G=`${Z} (C# class library)`}return{appType:W,projectName:z,targetFramework:$.targetFramework,sdk:Q||"Microsoft.NET.Sdk",framework:U,found:G}}function w$($){return(Q0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function b5($){let Z=w$($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=u($,X);if(J===null)continue;let Y=vC(J),W=uC(Y,X),U=fC(W.appType,W.framework);if(!z||U<Q)z=W,Q=U}return z}import{join as c6}from"path";var I2={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 cC=I2.mcpArtifacts.map(($)=>$.toLowerCase()),pC=I2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),lC=I2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),dC=I2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),ab=I2.androidPlugins.map(($)=>$.toLowerCase()),iC=I2.kmpPlugins.map(($)=>$.toLowerCase()),nC=I2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),rC=I2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),sC=I2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),oC=I2.libraryPlugins.map(($)=>$.toLowerCase()),aC=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function v3($){return aC.some((Z)=>A($,Z))}function tC($){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 q=U[1].toLowerCase();z.set(q,U[2].toLowerCase()),z.set(q.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 q=`${G[2]}:${G[3]}`.toLowerCase(),H=G[1].toLowerCase();z.set(H,q),z.set(H.replace(/-/g,"."),q);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let q=V[1].toLowerCase(),H=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let K=H.split(":")[0].toLowerCase();Z.set(q,K),Z.set(q.replace(/-/g,"."),K)}else if(Q==="libraries"||Q.endsWith(".libraries")){let K=H.split(":");if(K.length>=2){let L=`${K[0]}:${K[1]}`.toLowerCase();z.set(q,L),z.set(q.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:z}}function eC($){let Z=u($,c6("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return tC(Z)}function $_($){let Z=[];for(let z of $.matchAll(/include\s*\(\s*([^)]+)\)/g))for(let Q of z[1].split(",")){let X=Q.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let z of $.matchAll(/include\s+((?:['"][^'"]+['"]\s*,?\s*)+)/g))for(let Q of z[1].split(",")){let X=Q.replace(/['":\s]/g,"").replace(/^:/,"");if(X)Z.push(X.replace(/:/g,"/"))}for(let z of $.matchAll(/project\s*\(\s*["']:([^"']+)["']\s*\)\s*\.projectDir\s*=\s*file\s*\(\s*["']([^"']+)["']\s*\)/g))Z.push(z[2].replace(/^\.\//,""));return[...new Set(Z)]}function Z_($,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 z_($,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 UW($){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 f2($,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 z4($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=f2($,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 Q_($){let Z;for(let z of cC)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 GW($,Z){let z=new Set,Q=!1,X=!1,J=[c6(Z,"src"),c6(Z,"src","main")],Y=(W,U)=>{if(U>4)return;let G=Q0($,W);if(!G)return;for(let{name:V}of G){if(V==="androidMain"||V==="commonMain"||V==="jvmMain"||V==="iosMain")z.add(V);let q=c6(W,V),H=N2($,q);if(!H)continue;if(H.isDirectory())Y(q,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 X_($){let Z=[],z=$.plugins,Q=$.artifacts,X=iC.some((E)=>f2(z,E))||$.sourceHints.has("commonMain"),J=f2(z,"com.android.application"),Y=f2(z,"com.android.library")||f2(z,"com.android.kotlin.multiplatform.library");if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let W=Q_(Q),U=z4(z,pC,"plugin"),G=z4($.parents,lC,"parent"),V=z4(Q,dC,"artifact"),q=z4(z,rC,"plugin"),H=z4(Q,sC,"artifact"),K=oC.some((E)=>f2(z,E)),L=$.packaging==="pom",B,N="",T;if(J)B="mobile",N=X?"Android+KMP":"Android",T=`${$.path||"root"} + com.android.application (${N})`;else if(W)B="mcp",N="MCP",Z.push("mcp"),T=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||G||V){B="backend",N=U?.[1]||G?.[1]||V?.[1]||"JVM";let E=U?.[0]||G?.[0]||V?.[0]||"web";T=`${$.path||"root"} + ${E} (JVM backend)`}else if(X&&!Y)B="library",N="Kotlin Multiplatform",T=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",N=X?"Android+KMP":"Android",T=`${$.path||"root"} + android library (${N})`;else if(H||$.hasApplicationPlugin&&($.hasMainClass||q)||q&&$.hasMainClass)B="cli",N=H?.[1]||"application",T=H?`${$.path||"root"} + ${H[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!K)B="cli",N="application",T=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",T=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let E=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(T=`${$.path||"root"} (${E} library)`,K)T=`${$.path||"root"} + java-library (JVM library)`}let _="Java";if($.kotlinSources&&$.javaSources)_="Java/Kotlin";else if($.kotlinSources||nC.some((E)=>f2(z,E))||X)_="Kotlin";let y=[...new Set(Z)];return{appType:B,framework:N,facets:y,found:T,buildTool:$.buildTool,mainLanguage:_}}function J_($,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 YW($,Z,z){let Q=c6(Z,"build.gradle.kts"),X=c6(Z,"build.gradle"),J=A($,Q)?Q:A($,X)?X:null;if(!J)return null;let Y=u($,J);if(!Y)return null;let W=Z_(Y,z),U=z_(Y,z),G=GW($,Z),V=/mainClass\s*[.=]/.test(Y)||/mainClassName\s*=/.test(Y)||/Main-Class/.test(Y),q=f2(W,"application")||f2(W,"org.gradle.application");return{path:Z||"build.gradle",plugins:W,artifacts:U,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:q,sourceHints:G.hints,kotlinSources:G.kotlin||J.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function WW($,Z){let z=u($,c6(Z,"pom.xml"));if(!z)return null;let{packaging:Q,parents:X,artifacts:J}=UW(z),Y=GW($,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 Q4($){if(!v3($))return null;let Z=eC($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"])if(A($,G)){Q=u($,G);break}let X=Q?$_(Q):[],J=YW($,"",Z);if(J)z.push(J);for(let G of X){let V=YW($,G,Z);if(V)z.push(V)}let Y=WW($,"");if(Y){z.push(Y);let G=u($,"pom.xml");if(G){let{modules:V}=UW(G);for(let q of V){let H=WW($,q);if(H)z.push(H)}}}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=X_(G),q=J_(V.appType,V.facets);if(!W||q<U)W={appType:V.appType,framework:V.framework,buildTool:V.buildTool,mainLanguage:V.mainLanguage,facets:V.facets,found:V.found},U=q}if(W&&X.length>0&&!W.found.includes("multi-project"));return W}import{join as W_}from"path";var X4={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 U_=X4.mcpGems.map(($)=>$.toLowerCase()),G_=X4.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),VW=X4.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),V_=X4.railsLayoutFiles;function q_($){return A($,"Gemfile")||A($,"gems.rb")||H_($)}function H_($){return(Q0($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function K_($){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 B_($){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 M_($){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 L_($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=u($,X);if(J){for(let Y of K_(J))Z.add(Y);z.push(X)}}let Q=u($,"Gemfile.lock")||u($,"gems.locked");if(Q){for(let X of B_(Q))Z.add(X);z.push("Gemfile.lock")}for(let{name:X}of Q0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=u($,X);if(J){for(let Y of M_(J))Z.add(Y);z.push(X)}}return{gems:Z,sources:z}}function J4($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function g3($,Z){let z;for(let[Q,X]of Z){if(!J4($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function N_($){let Z;for(let z of U_)if(J4($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function qW($){for(let Z of V_)if(A($,Z))return Z;return}function O_($,Z){let z=g3(Z,VW);if(z)return{hit:!0,why:z[0]};for(let{name:X}of Q0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=u($,X);if(J&&/executables\s*=/.test(J)&&!/executables\s*=\s*\[\s*\]/.test(J))return{hit:!0,why:`${X} executables`}}let Q=Q0($,"bin");if(Q){let J=Q.map((Y)=>Y.name).filter((Y)=>{if(Y==="setup"||Y==="console"||Y==="rake")return!1;return N2($,W_("bin",Y))?.isFile()===!0}).filter((Y)=>Y!=="rails");if(J.length>0&&!J4(Z,"rails")&&!qW($))return{hit:!0,why:`bin/${J[0]}`}}return{hit:!1,why:""}}function v5($){if(!q_($))return null;let{gems:Z,sources:z}=L_($),Q=z[0]||"Gemfile",X=z.some((N)=>N==="Gemfile"||N==="gems.rb"||N.includes("lock"))?"bundler":"rubygems",J=N_(Z),Y=g3(Z,G_),W=qW($),U=J4(Z,"rails")||J4(Z,"railties"),G=O_($,Z),V=A($,"config.ru"),q=U||!!W,H=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(q)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(H)K="backend",L=H[1],B=`${Q} + gem ${H[0]} (Ruby backend)`;else if(G.hit)K="cli",L=g3(Z,VW)?.[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 I_}from"path";var w2={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 T_=w2.mcpPackageUrls.map(($)=>$.toLowerCase()),A_=w2.mcpProducts.map(($)=>$.toLowerCase()),C_=w2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),__=w2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),R_=w2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),F_=w2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),P_=w2.appProductTypes,S_=w2.cliProductTypes,E_=w2.vaporLayoutFiles;function j_($){return A($,"Package.swift")||h3($).length>0}function h3($){return(Q0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&N2($,Z)?.isDirectory()===!0)}function w_($){let Z=x_($),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),q=/\.executable\s*\(/.test(z),H=/\.plugin\s*\(/.test(z)&&!V&&!q?!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:q,hasPluginProduct:!!H,hasExecutableTarget:K,hasLibraryTarget:L}}function x_($){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 y_($,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 HW($,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 KW($,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 k_($){let Z=$.map((z)=>z.toLowerCase());return A_.some((z)=>Z.includes(z))}function b_($){let Z=!1,z=!1,Q;for(let X of h3($)){let J=u($,I_(X,"project.pbxproj"));if(!J)continue;for(let Y of P_)if(J.includes(Y))Z=!0,Q=Y;for(let Y of S_)if(J.includes(Y)){if(z=!0,!Q)Q=Y}}return{hasApplication:Z,hasTool:z,hit:Q}}function v_($){for(let Z of E_)if(A($,Z))return Z;return}function Y4($){if(!j_($))return null;let Z=A($,"Package.swift"),z=h3($),Q=z.length>0,X=null;if(Z){let S=u($,"Package.swift");if(S)X=w_(S)}let J=Q?b_($):{hasApplication:!1,hasTool:!1},Y=v_($),W=X?.packageUrls??[],U=X?.productNames??[],G=y_(W,T_),V=k_(U),q=HW(W,C_),H=KW(U,__),K=HW(W,R_),L=KW(U,F_),B=!!(G||V),N=!!(q||H||Y),T=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),_=!!(K||L),y=J.hasApplication,E=Z&&Q?"spm+xcode":Z?"spm":"xcode",w,j="",f;if(B)if(w="mcp",j="MCP",V)f="Package.swift + product MCP (Swift MCP)";else f=`Package.swift + ${G} (Swift MCP)`;else if(N)if(w="backend",j=H?.[1]||q?.[1]||(Y?"Vapor":""),H)f=`Package.swift + product ${H[1]} (Swift backend)`;else if(q)f=`Package.swift + ${q[1]} (Swift backend)`;else f=`${Y} (Swift backend layout)`;else if(y)w="app",j="",f=`${z[0]} + ${J.hit||"application"} (Swift app)`;else if(_||T&&!N&&!B)if(w="cli",j=L?.[1]||K?.[1]||"",L)f=`Package.swift + product ${L[1]} (Swift CLI)`;else if(K)f=`Package.swift + ${K[1]} (Swift CLI)`;else if(X?.hasExecutableProduct)f="Package.swift + .executable product (Swift CLI)";else f="Package.swift + .executableTarget (Swift CLI)";else if(J.hasTool&&!Z)w="cli",f=`${z[0]} + tool productType (Swift CLI)`;else if(Z)if(w="library",X?.hasLibraryProduct)f="Package.swift + .library product (Swift library)";else f="Package.swift (Swift library)";else w="library",f=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:w,framework:j,packageManager:E,found:f}}function g_($){let Z=u($,"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 h_($){let Z=u($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function f_($,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=g_($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function u_($){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=u($,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 m_($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=u($,"pyproject.toml");if(z!==null){let X=z.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let Q=u($,"requirements.txt");if(Q!==null){let X=Q.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function c_($,Z){let z=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let Q of z)if(Z.dependencies?.[Q]||Z.devDependencies?.[Q])return`${Q} dependency`}if(A($,"ios")&&A($,"android"))return"ios/ + android/ dirs";return null}function p_($,Z){let z=u($,"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=u($,"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 l_($,Z){if(!A($,"index.html"))return null;if(Z?.dependencies||Z?.devDependencies){let z={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>z[X]))return null}return"index.html (vanilla, no frontend framework)"}function d_($,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 i_($,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 n_($,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 r_($,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 s_($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||A($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var o_=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"]),MW=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,a_=new Set(["frontend","backend","database","css","ui","state"]);function t_($){if(A($,"pyproject.toml")||A($,"manage.py")||A($,"setup.py")||g5($,"requirements*.txt"))return!0;if(A($,"go.mod"))return!0;if(A($,"Cargo.toml"))return!0;if(A($,"Gemfile"))return!0;if(A($,"pom.xml")||g5($,"build.gradle*"))return!0;if(w$($).length>0)return!0;let Z=T2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function h5($){return _$($,()=>e_($))}function e_($){let Z=Q0($)??[],z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||o_.has(Q.name))continue;let X=BW($,Q.name);if(!t_(X))continue;let J=u5(X);if(!J)continue;let Y=f5(X).filter((V)=>a_.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||MW.test(J),hasFramework:!!G,appRoot:A(X,"manage.py")||A(X,"config.ru")||A(X,"bin/rails")||A(X,"artisan")})}return z}function $R($,Z){if(Z?.workspaces||A($,"pnpm-workspace.yaml"))return null;let z=h5($),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 LW($){let Z=h5($);if(Z.length<2)return null;let z=(Y)=>(Y.appRoot?2:0)+(MW.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 T2($){let Z=u($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function g5($,Z){if(!Z.includes("*"))return A($,Z);let z=Z.split("/");if(z.length===1){let W=Z.split("*")[0];return(Q0($)??[]).some((U)=>U.name.startsWith(W))}let Q=BW(...z.slice(0,-1)),X=z[z.length-1],J=X.split("*")[0],Y=X.split("*")[1]||"";return(Q0($,Q)??[]).some((W)=>W.name.startsWith(J)&&W.name.endsWith(Y))}function ZR($,Z,z){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return g5(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!g5(z,$.pattern))return!1;let Q=u(z,$.pattern);return Q!==null&&Q.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function f5($){let Z=T2($);return ZW.map((z)=>{let X=z.signals.filter((J)=>ZR(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 u5($){let Z=T2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(A($,"tsconfig.json"))return"TypeScript";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(w$($).length>0)return"C#";if(A($,"pyproject.toml")||A($,"setup.py"))return"Python";if(A($,"Gemfile"))return"Ruby";if(v3($)){let z=Q4($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(A($,"Package.swift"))return"Swift";if(A($,"build.zig"))return"Zig";if(A($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function NW($){let Z=T2($),z=f5($),Q=[],X=d_($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=f_($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=u_($);if(Y)return Q.push(Y),{type:"extension",found:Q};let W=r_($,Z,z);if(W)return Q.push(W),{type:"mcpaas",found:Q};let U=n_($,Z);if(U)return Q.push(U),{type:"saas",found:Q};let G=p_($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=w5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let q=y5($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let H=b5($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let K=Q4($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let L=v5($);if(L)return Q.push(L.found),{type:L.appType,found:Q};let B=Y4($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let N=c_($,Z);if(N)return Q.push(N),{type:"mobile",found:Q};if(z.some((g)=>g.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(h_($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(A($,"build.zig")){if(Q.push("build.zig"),A($,"src/main.zig"))return Q.push("src/main.zig"),{type:"cli",found:Q};if(A($,"src/root.zig"))return Q.push("src/root.zig"),{type:"library",found:Q}}let _=z.some((g)=>g.slug==="svelte"||g.slug==="sveltekit");if(Z?.private===!0&&(A($,"pnpm-workspace.yaml")||Z?.workspaces!==void 0)&&_)return Q.push("private workspace","Svelte"),{type:"framework",found:Q};if(_)return Q.push("Svelte/SvelteKit"),{type:"svelte",found:Q};let E=z.some((g)=>g.category==="frontend"),w=z.some((g)=>g.category==="backend");if(Z?.private&&(Z.workspaces||A($,"pnpm-workspace.yaml"))&&E&&w)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let j=s_($,Z);if(j)return Q.push(j),{type:"monorepo-root",found:Q};let f=i_($,Z,z);if(f)return Q.push(f),{type:"website",found:Q};if(z.some((g)=>g.slug==="nextjs"||g.slug==="nuxt"))return Q.push(z.find((g)=>g.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let d=z.some((g)=>g.category==="frontend"),I0=z.some((g)=>g.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 E0=m_($);if(E0)return Q.push(E0),{type:"data-science",found:Q};let $0=l_($,Z);if($0)return Q.push($0),{type:"html",found:Q};let k=$R($,Z);if(k)return Q.push(k),{type:"fullstack",found:Q};if(Z?.main&&!Z?.bin)return Q.push("package.json main (no bin)"),{type:"library",found:Q};return Q.push(F$),{type:"library",found:Q}}function OW($){if(A($,"bunfig.toml"))return"Bun";if(A($,"deno.json")||A($,"deno.jsonc"))return"Deno";if(T2($))return"Node.js";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(w$($).length>0)return".NET";if(A($,"pubspec.yaml"))return"Dart";return""}var zR=new Set(["npm","pnpm","yarn","bun"]);function QR($){let Z=T2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return zR.has(z)?z:""}function XR($){if(A($,"pubspec.yaml"))return"pub";if(A($,"go.mod"))return"go modules";if(w$($).length>0)return"NuGet";if(A($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>A($,z))?"gradle":""}var JR=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function DW($){return XR($)||QR($)||(JR.find(([Z])=>A($,Z))?.[1]??"")}function IW($){if(A($,".github/workflows"))return"GitHub Actions";if(A($,".gitlab-ci.yml"))return"GitLab CI";if(A($,".circleci"))return"CircleCI";if(A($,"Jenkinsfile"))return"Jenkins";return null}function TW($){if(A($,"vercel.json"))return"Vercel";if(A($,"netlify.toml"))return"Netlify";if(A($,"wrangler.toml"))return"Cloudflare";if(A($,"fly.toml"))return"Fly.io";if(A($,"render.yaml"))return"Render";return null}function AW($){let Z=u($,"svelte.config.js");if(Z===null)return null;let z=Z.match(/@sveltejs\/adapter-(\w+)/);if(z){let Q=z[1];switch(Q){case"vercel":return"Vercel";case"node":return"Node";case"static":return"Static";case"cloudflare":return"Cloudflare";case"netlify":return"Netlify";case"auto":return"Auto";default:return Q}}return null}function CW($){let Z=T2($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return"Vite";if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(A($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function m5($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((z)=>A($,z))}function c5($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=A($,"bun.lock")||A($,"bun.lockb")?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(A($,"Cargo.toml")){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&YR($))z.lint="cargo clippy"}if(A($,"build.zig")){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(f3($,"build.zig")))z.test="zig build test"}if(A($,"go.mod")){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&WR($))z.test="pytest";return z}function f3($,Z){return u($,Z)??""}function YR($){if(A($,"clippy.toml")||A($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(f3($,"Cargo.toml"))}function WR($){if(A($,"pytest.ini")||A($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(f3($,Z)))}function _W($,Z,z,Q){let X=[];if(Q&&Q!=="Unknown")X.push(Q);let J=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of z)if(J.has(Y.category))X.push(Y.name);if(A($,"bunfig.toml"))X.push("Bun");else if(A($,"deno.json")||A($,"deno.jsonc"))X.push("Deno");if(X.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!X.some((U)=>U.toLowerCase().includes(W.toLowerCase())))X.push(W)}return X}function UR($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function RW($){return u3($).data}function u3($){let Z=T2($),z=f5($),Q=NW($),X=Q.type,J=Q.found.some((s)=>s.startsWith("polyglot:")),Y=J&&LW($)||u5($),W=OW($),U=DW($),G=IW($),V=TW($),q=CW($),H=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"),T=z.find((s)=>s.category==="database"),_=(s)=>f6(X,s)??f6("library",s)===!0,y=X==="framework",E=z.some((s)=>s.slug==="svelte"||s.slug==="sveltekit"),w=y&&E?"svelte":y?null:null,j=X==="svelte"||w==="svelte",f=j?AW($):null,S=j&&z.some((s)=>s.slug==="sveltekit"),d={},I0=X0.filter((s)=>s.path.startsWith("stack."));for(let s of I0){let J0=s.path.replace("stack.","");switch(J0){case"frontend":d[J0]=H?.name??"";break;case"css_framework":d[J0]=K?.name??"";break;case"ui_library":d[J0]=L?.name??"";break;case"state_management":d[J0]=B?.name??(j&&UR(Z)>=5?"Runes":"");break;case"backend":d[J0]=j?S?"SvelteKit":N?.name??"":N?.name??"";break;case"api_type":d[J0]=S?"Server Routes":"";break;case"runtime":d[J0]=W;break;case"database":d[J0]=T?.name??"";break;case"connection":d[J0]=T?.name??"";break;case"hosting":if(j&&f)d[J0]=f;else d[J0]=V??"";break;case"build":d[J0]=S?"Vite":q??"";break;case"cicd":d[J0]=G??"";break;case"package_manager":d[J0]=U;break;default:d[J0]="";break}}let E0={};for(let s of I0){let J0=s.path.replace("stack.","");E0[J0]=_(s)?d[J0]:"slotignored"}let $0={},k=X0.filter((s)=>s.path.startsWith("monorepo."));for(let s of k){let J0=s.path.replace("monorepo.","");if(!_(s))$0[J0]="slotignored";else $0[J0]=""}let g={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(y&&w)g.framework=w;let M0=_W($,Z,z,J?u5($):Y);if(J){for(let s of h5($))for(let J0 of[s.language,s.topFramework])if(J0&&!M0.includes(J0))M0.push(J0)}let H2=m5($),TQ=c5($,Z),D8={faf_version:H6,project:g,stack:E0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:$0,_meta:{found:Q.found}};if(M0.length>0)D8.tech_stack=M0;if(H2.length>0)D8.key_files=H2;if(Object.keys(TQ).length>0)D8.commands=TQ;return{data:D8,facts:d}}var FW={MIN_LENGTH:8,MAX_LENGTH:280},GR=[/^(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 A2($){let Z=$.trim();if(Z.length<FW.MIN_LENGTH)return!1;if(Z.length>FW.MAX_LENGTH)return!1;if(GR.some((z)=>z.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
236
- `).length>4)return!1;return!0}function VR($){let Z=$.split(`
226
+ `)}}var b3=($)=>$.startsWith("\uFEFF")?$.slice(1):$;function GC($){let Z={};for(let[z,Q]of Object.entries($.slots??{}))Z[DY.get(z)??z]=Q;return{...$,slots:Z}}function P0($){return GC(JSON.parse(Q4().score_faf(b3($))))}function ZW($){return Q4().validate_faf(b3($))}function j5($){return Q4().compile_fafb(b3($))}function zW($){return JSON.parse(Q4().decompile_fafb($))}function QW(){return Q4().sdk_version()}var XW=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;function JW($){let Z=$?.about?.represents;return typeof Z==="string"&&Z.length>0}function YW($){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 v3($){return $.unknown?"unknown (—)":`${$.score}%`}function b0($){return{score:$.score,tier:q6($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}function O0($){let Z=YW($);if(Z){let z=Z.sourceScore;return{score:z,tier:z>=0?q6(z):w$[w$.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 VC($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function g3($){try{let Z=v6($,{logLevel:"error"}).getIn(["project","type"],!0);return C0(Z)&&typeof Z.comment==="string"&&Z.comment.includes(S$)}catch{return!1}}function HC($,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 KC($){try{let Z=v6($,{logLevel:"error"});if(Z.errors.length>0)return null;let z=Z.toJS();return $0(z)?z:null}catch{return null}}function w5($,Z,z={}){let Q=KC($);if(Q===null)return[];let X=$0(Q.project)&&!g3($)?Q.project.type:void 0,J=[];for(let Y of J0){let W=VC(Q,Y.path);if(Z.slots[Y.path]!=="empty"||!P$(W))continue;let U=u6.library.includes(Y.category),G=HC(Y.path,String(W).trim(),m6(X,Y),U,z.outOfType!==!1);if(G!==null)J.push(G)}return J}i();i();import{existsSync as qC,readFileSync as BC}from"fs";import{join as WW}from"path";import{homedir as MC}from"os";var LC=95,NC=30,OC=3,h3=WW(MC(),".config","faf"),f3=WW(h3,"star-nudge"),DC="github.com/Wolfe-Jam/faf-cli";function IC($){if($.score<LC)return!1;if(!$.isTTY)return!1;if($.isCI||$.optedOut)return!1;if($.shownCount>=($.maxShows??OC))return!1;if($.lastShownMs!==null&&$.lastShownMs!==void 0){let Z=($.throttleDays??NC)*86400000;if($.nowMs-$.lastShownMs<Z)return!1}return!0}function TC(){try{if(!qC(f3))return{shown:0,lastShownMs:null};let $=BC(f3,"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 AC($){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 CC($,Z){try{w0(h3),w2(f3,JSON.stringify({shown:$+1,last:new Date(Z).toISOString()}),{root:h3,owns:AC,mark:"faf star-nudge state"})}catch{}}function UW($){let Z=Date.now(),z=TC();if(!IC({score:$,isTTY:Boolean(process.stdout.isTTY),isCI:Boolean(process.env.CI),optedOut:Boolean(process.env.FAF_NO_NUDGE),shownCount:z.shown,lastShownMs:z.lastShownMs,nowMs:Z}))return;console.log(""),console.log(` ${F0("★")} ${M("Enjoying faf-cli? A star helps others find it:")} ${DC}`),CC(z.shown,Z)}function S0($,Z,z=!1,Q=[]){if($.unknown){let Y=$.represents?`about-repo for ${$.represents}`:"about-repo";console.log(`${M("—")} ${C("unknown")} ${M(`${Y} — no about.source_score`)} ${M("—")} ${Z}`);return}let X=T2($.tier),J=C(`${$.score}%`);if(console.log(`${X} ${J} ${M(`${$.populated}/${$.active} slots`)} ${M("—")} ${Z}`),$.tier.name==="TROPHY")console.log(M(" Trophy. AI never has to guess."));else if($.empty>0){let Y=Object.entries($.slots).filter(([,V])=>V==="empty").map(([V])=>V),W=Y.slice(0,3).join(", "),U=Y.length>3?`, +${Y.length-3} more`:"",G=$.empty===1?"slot":"slots";console.log(M(` ${$.empty} ${G} from Trophy: ${W}${U}`))}if(_C(Q),z)console.log(""),RC($);UW($.score)}function _C($){for(let Z of $)console.log(M(` ${Z}`))}function RC($){for(let[Z,z]of Object.entries($.slots)){let Q=z==="populated"?T("●"):z==="slotignored"?M("—"):M("○");console.log(` ${Q} ${z==="slotignored"?M(`${Z}: slotignored`):Z}`)}}i();function x5($,Z={}){let z=$??f();if(!z)console.error(`Error: project.faf not found
227
+
228
+ Run 'faf init' to create one.`),process.exit(2);let Q=p(z);X2(Q,z);let X=r(z,()=>O0(Q));if(Z.json){let J=s(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(v3(X))}`:`${T2(X.tier)} ${C(v3(X))}`);return}S0(X,z,Z.verbose,w5(Q,X))}import{existsSync as XP}from"fs";import{join as tW}from"path";var B6="3.0";import{join as AW}from"path";var GW=[{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 PC}from"path";var x$={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 SC=x$.flutterDeps,EC=x$.mcpDeps,jC=x$.serverFrameworks,wC=x$.stateManagement,xC=x$.routing;function yC($){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 y5($){let Z=m($,"pubspec.yaml");if(Z===null)return null;let z=yC(Z),Q=(_)=>z.has(_.toLowerCase()),X=SC.some(Q)||/^flutter:\s*$/m.test(Z)||/\bsdk:\s*flutter\b/.test(Z),J=EC.find(Q),Y=jC.find(([_])=>Q(_)),W=wC.find(([_])=>Q(_)),U=W?W[1]:"",G=xC.find(([_])=>Q(_)),V=G?G[1]:"",H=Q("flutter_test")?"flutter_test":Q("test")?"test":"",K=/^executables:\s*$/m.test(Z),q=(X0($,"bin")??[]).some((_)=>_.name.endsWith(".dart")),L=K||q,B,N="",I;if(X)if(N="Flutter",A($,PC("lib","main.dart"))||/^publish_to:\s*['"]?none\b/m.test(Z))B="mobile",I="pubspec.yaml (Flutter app)";else B="library",I="pubspec.yaml (Flutter package)";else if(J)B="mcp",I=`pubspec.yaml + ${J} (Dart MCP server)`;else if(Y)B="backend",N=Y[1],I=`pubspec.yaml + ${Y[0]} (Dart backend)`;else if(L)B="cli",I=K?"pubspec.yaml executables: (Dart CLI)":"pubspec.yaml + bin/*.dart (Dart CLI)";else B="library",I="pubspec.yaml (Dart package)";return{appType:B,isFlutter:X,framework:N,stateManagement:U,routing:V,testing:H,found:I}}import{join as bC}from"path";var k5={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 vC=k5.mcpModules,gC=k5.serverFrameworks,hC=k5.cliFrameworks;function fC($){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 HW($,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(!HW($,Q[0]))continue;if(!z||Q[0].length>z[0].length)z=Q}return z}function uC($,Z){let z;for(let Q of Z){if(!HW($,Q))continue;if(!z||Q.length>z.length)z=Q}return z}function mC($){let Z=$.match(/^module\s+(\S+)/m);return Z?Z[1]:""}function cC($){for(let{name:Z}of X0($,"cmd")??[]){let z=bC("cmd",Z),Q=D2($,z);if(Q?.isDirectory()){if((X0($,z)??[]).some((X)=>X.name.endsWith(".go")))return!0}else if(Q&&Z.endsWith(".go"))return!0}return!1}function pC($){let Z=m($,"main.go");return Z!==null&&/^package\s+main\b/m.test(Z)}function b5($){let Z=m($,"go.mod");if(Z===null)return null;let z=mC(Z),Q=fC(Z),X=uC(Q,vC),J=VW(Q,gC),Y=VW(Q,hC),W=cC($),U=pC($),G,V="",H;if(X)G="mcp",H=`go.mod + ${X} (Go MCP server)`;else if(J)G="backend",V=J[1],H=`go.mod + ${J[0]} (Go backend)`;else if(Y)G="cli",V=Y[1],H=`go.mod + ${Y[0]} (Go CLI)`;else if(W)G="cli",H="go.mod + cmd/ (Go CLI layout)";else if(U&&!J)G="cli",H="go.mod + main.go package main (Go CLI)";else G="library",H="go.mod (Go module)";return{appType:G,modulePath:z,framework:V,found:H}}var p6={version:1,_doc:"SINGLE SOURCE of C# /.NET detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster C# by editing THIS file. Logic stays in csharp.ts. Content-aware: .csproj alone ≠ type — Sdk first, then props/packages. Kill line: .csproj alone ≠ type. 2026-08-01 initial.",mcpPackages:["ModelContextProtocol","ModelContextProtocol.AspNetCore","ModelContextProtocol.Core","ModelContextProtocol.Extensions.Tasks","ModelContextProtocol.Extensions.Apps"],cliPackages:[["System.CommandLine","System.CommandLine"],["Spectre.Console.Cli","Spectre.Console"],["Spectre.Console","Spectre.Console"],["McMaster.Extensions.CommandLineUtils","McMaster"]],testPackages:[["Microsoft.NET.Test.Sdk","VSTest"],["xunit.v3","xUnit"],["xunit","xUnit"],["NUnit","NUnit"],["MSTest.TestFramework","MSTest"],["MSTest","MSTest"]],grpcServerPackages:["Grpc.AspNetCore"],specializedSdks:[["Microsoft.NET.Sdk.Web","web","ASP.NET Core"],["Microsoft.NET.Sdk.Worker","worker","Worker"],["Microsoft.NET.Sdk.BlazorWebAssembly","blazor-wasm","Blazor WebAssembly"],["Microsoft.NET.Sdk.Razor","razor-lib","Razor Class Library"],["MSTest.Sdk","test","MSTest"],["Aspire.AppHost.Sdk","aspire","Aspire AppHost"]],baseSdk:"Microsoft.NET.Sdk"};var dC=p6.mcpPackages.map(($)=>$.toLowerCase()),iC=p6.cliPackages.map(([$,Z])=>[$.toLowerCase(),Z]),nC=p6.testPackages.map(([$,Z])=>[$.toLowerCase(),Z]),rC=p6.grpcServerPackages.map(($)=>$.toLowerCase()),sC=p6.specializedSdks,KW=p6.baseSdk.toLowerCase();function oC($){let Z=$.match(/<Project\b[^>]*\bSdk\s*=\s*"([^"/]+)(?:\/[^"]*)?"/i),z=$.match(/<Sdk\b[^>]*\bName\s*=\s*"([^"]+)"/i),Q=(Z?.[1]||z?.[1]||"").trim(),X=($.match(/<OutputType>\s*([^<]+?)\s*<\/OutputType>/i)?.[1]||"").trim(),J=$.match(/<TargetFramework>\s*([^<]+?)\s*<\/TargetFramework>/i)?.[1],W=($.match(/<TargetFrameworks>\s*([^<]+?)\s*<\/TargetFrameworks>/i)?.[1]||J||"").trim(),U=/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test($),G=/<UseMaui>\s*true\s*<\/UseMaui>/i.test($),V=/<UseWPF>\s*true\s*<\/UseWPF>/i.test($),H=/<UseWindowsForms>\s*true\s*<\/UseWindowsForms>/i.test($),K=new Set;for(let L of $.matchAll(/<PackageReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());for(let L of $.matchAll(/<PackageReference\s+Include\s*=\s*"([^"]+)"/gi))K.add(L[1].toLowerCase());let q=new Set;for(let L of $.matchAll(/<FrameworkReference\b[^>]*\bInclude\s*=\s*"([^"]+)"/gi))q.add(L[1].toLowerCase());return{sdk:Q,outputType:X,targetFramework:W,isTestProject:U,useMaui:G,useWpf:V,useWindowsForms:H,packages:K,frameworkRefs:q}}function u3($,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 qW($,Z){let z;for(let[Q,X]of Z){if(!u3($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function aC($){let Z;for(let z of dC){if(!u3($,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 tC($){let Z=$.toLowerCase();if(!Z)return;let z;for(let Q of sC){let X=Q[0].toLowerCase();if(Z===X||Z.startsWith(`${X}/`)){if(!z||X.length>z[0].length)z=Q}}return z}function v5($){let Z=$.toLowerCase();return Z==="exe"||Z==="winexe"}function eC($,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 $_($,Z){let z=Z.replace(/\.csproj$/i,""),{sdk:Q,packages:X,frameworkRefs:J,outputType:Y}=$,W,U="",G,V=aC(X),H=tC(Q),K=qW(X,nC),q=qW(X,iC),L=rC.some((N)=>u3(X,N)),B=J.has("microsoft.aspnetcore.app");if(V)W="mcp",U="MCP",G=`${Z} + ${V} (C# MCP server)`;else if($.isTestProject||H?.[1]==="test"||K)W="library",U=K?.[1]||(H?.[1]==="test"?H[2]:"Test"),G=`${Z} + test (${U})`;else if($.useMaui)W="mobile",U="MAUI",G=`${Z} + UseMaui (MAUI)`;else if($.useWpf||$.useWindowsForms)W="backend",U=$.useWpf&&$.useWindowsForms?"WPF+WinForms":$.useWpf?"WPF":"Windows Forms",G=`${Z} + ${U}`;else if(H?.[1]==="web")W="backend",U=L?"gRPC":H[2],G=`${Z} + Sdk=${H[0]}${L?" + Grpc.AspNetCore":""} (ASP.NET Core)`;else if(H?.[1]==="worker")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Worker)`;else if(H?.[1]==="blazor-wasm")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Blazor WASM)`;else if(H?.[1]==="aspire")W="backend",U=H[2],G=`${Z} + Sdk=${H[0]} (Aspire)`;else if(H?.[1]==="razor-lib")W="library",U=H[2],G=`${Z} + Sdk=${H[0]} (Razor class library)`;else if(B&&v5(Y))W="backend",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (host)`;else if(B&&!v5(Y))W="library",U="ASP.NET Core",G=`${Z} + FrameworkReference Microsoft.AspNetCore.App (web library)`;else if(q&&(v5(Y)||!Y))W="cli",U=q[1],G=`${Z} + ${q[0]} (C# CLI)`;else if(v5(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()===KW||Q.toLowerCase().startsWith(`${KW}/`))G=`${Z} (C# class library)`}return{appType:W,projectName:z,targetFramework:$.targetFramework,sdk:Q||"Microsoft.NET.Sdk",framework:U,found:G}}function y$($){return(X0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.toLowerCase().endsWith(".csproj")).sort()}function g5($){let Z=y$($);if(Z.length===0)return null;let z=null,Q=999;for(let X of Z){let J=m($,X);if(J===null)continue;let Y=oC(J),W=$_(Y,X),U=eC(W.appType,W.framework);if(!z||U<Q)z=W,Q=U}return z}import{join as l6}from"path";var A2={version:1,_doc:"SINGLE SOURCE of JVM (Java/Kotlin) detection KNOWLEDGE (Truth-is-faf-cli). faf-cli imports this; SDKs/MCPs compose it. Bolster JVM by editing THIS file. Logic stays in jvm.ts. Kill line: pom / gradle alone ≠ type. Content-aware: plugins · parents · packaging · deps · version catalogs. One brand JVM — Android/KMP are facets, not a second Kotlin Edition. 2026-08-03 initial (post-intel).",mcpArtifacts:["io.modelcontextprotocol.sdk:mcp","io.modelcontextprotocol.sdk:mcp-core","io.modelcontextprotocol.sdk:mcp-spring-webflux","io.modelcontextprotocol.sdk:mcp-spring-webmvc","org.springframework.ai:spring-ai-starter-mcp-server","org.springframework.ai:spring-ai-starter-mcp-server-webmvc","org.springframework.ai:spring-ai-starter-mcp-server-webflux","org.springframework.ai:spring-ai-starter-mcp-client","org.springframework.ai:spring-ai-mcp-server-spring-boot-starter","org.springframework.ai:spring-ai-mcp-client-spring-boot-starter","io.modelcontextprotocol:kotlin-sdk","io.modelcontextprotocol.kotlin:mcp"],webPlugins:[["org.springframework.boot","Spring Boot"],["io.quarkus","Quarkus"],["io.quarkus.gradle.plugin","Quarkus"],["io.micronaut.application","Micronaut"],["io.micronaut.library","Micronaut"]],webParents:[["org.springframework.boot:spring-boot-starter-parent","Spring Boot"],["io.quarkus.platform:quarkus-bom","Quarkus"],["io.micronaut.platform:micronaut-parent","Micronaut"]],webArtifacts:[["org.springframework.boot:spring-boot-starter-web","Spring Boot"],["org.springframework.boot:spring-boot-starter-webflux","Spring Boot"],["org.springframework.boot:spring-boot-starter","Spring Boot"],["io.quarkus:quarkus-core","Quarkus"],["io.micronaut:micronaut-http-server-netty","Micronaut"],["io.ktor:ktor-server-core","Ktor"],["io.ktor:ktor-server-netty","Ktor"],["io.ktor:ktor-server-cio","Ktor"]],androidPlugins:["com.android.application","com.android.library","com.android.kotlin.multiplatform.library"],kmpPlugins:["org.jetbrains.kotlin.multiplatform","kotlin-multiplatform"],jvmKotlinPlugins:["org.jetbrains.kotlin.jvm","kotlin-jvm","org.jetbrains.kotlin.android","kotlin-android"],cliPlugins:[["org.gradle.application","application"],["application","application"]],cliArtifacts:[["info.picocli:picocli","Picocli"],["com.github.ajalt.clikt:clikt","Clikt"],["com.github.ajalt.clikt:clikt-jvm","Clikt"]],libraryPlugins:["java-library","org.gradle.java-library"]};var z_=A2.mcpArtifacts.map(($)=>$.toLowerCase()),Q_=A2.webPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),X_=A2.webParents.map(([$,Z])=>[$.toLowerCase(),Z]),J_=A2.webArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),hv=A2.androidPlugins.map(($)=>$.toLowerCase()),Y_=A2.kmpPlugins.map(($)=>$.toLowerCase()),W_=A2.jvmKotlinPlugins.map(($)=>$.toLowerCase()),U_=A2.cliPlugins.map(([$,Z])=>[$.toLowerCase(),Z]),G_=A2.cliArtifacts.map(([$,Z])=>[$.toLowerCase(),Z]),V_=A2.libraryPlugins.map(($)=>$.toLowerCase()),H_=["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"];function m3($){return H_.some((Z)=>A($,Z))}function K_($){let Z=new Map,z=new Map,Q="";for(let X of $.split(`
231
+ `)){let J=X.replace(/#.*$/,"").trim();if(!J)continue;let Y=J.match(/^\[([^\]]+)\]$/);if(Y){Q=Y[1].trim().toLowerCase();continue}let W=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bid\s*=\s*"([^"]+)"/);if(W&&(Q==="plugins"||Q.endsWith(".plugins"))){Z.set(W[1].replace(/-/g,".").toLowerCase(),W[2].toLowerCase()),Z.set(W[1].toLowerCase(),W[2].toLowerCase());continue}let U=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bmodule\s*=\s*"([^"]+)"/);if(U&&(Q==="libraries"||Q.endsWith(".libraries"))){let H=U[1].toLowerCase();z.set(H,U[2].toLowerCase()),z.set(H.replace(/-/g,"."),U[2].toLowerCase());continue}let G=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*\{[^}]*\bgroup\s*=\s*"([^"]+)"[^}]*\bname\s*=\s*"([^"]+)"/);if(G&&(Q==="libraries"||Q.endsWith(".libraries"))){let H=`${G[2]}:${G[3]}`.toLowerCase(),K=G[1].toLowerCase();z.set(K,H),z.set(K.replace(/-/g,"."),H);continue}let V=J.match(/^([A-Za-z0-9_.-]+)\s*=\s*"([^"]+)"/);if(V){let H=V[1].toLowerCase(),K=V[2];if(Q==="plugins"||Q.endsWith(".plugins")){let q=K.split(":")[0].toLowerCase();Z.set(H,q),Z.set(H.replace(/-/g,"."),q)}else if(Q==="libraries"||Q.endsWith(".libraries")){let q=K.split(":");if(q.length>=2){let L=`${q[0]}:${q[1]}`.toLowerCase();z.set(H,L),z.set(H.replace(/-/g,"."),L)}}}}return{plugins:Z,libraries:z}}function q_($){let Z=m($,l6("gradle","libs.versions.toml"));if(!Z)return{plugins:new Map,libraries:new Map};return K_(Z)}function B_($){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 M_($,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 L_($,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 LW($){let Z=($.match(/<packaging>\s*([^<]+?)\s*<\/packaging>/i)?.[1]||"jar").trim().toLowerCase(),z=new Set,Q=$.match(/<parent>([\s\S]*?)<\/parent>/i);if(Q){let Y=Q[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),W=Q[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(Y&&W)z.add(`${Y}:${W}`.toLowerCase())}let X=new Set;for(let Y of $.matchAll(/<dependency>([\s\S]*?)<\/dependency>/gi)){let W=Y[1].match(/<groupId>\s*([^<]+?)\s*<\/groupId>/i)?.[1]?.trim(),U=Y[1].match(/<artifactId>\s*([^<]+?)\s*<\/artifactId>/i)?.[1]?.trim();if(W&&U)X.add(`${W}:${U}`.toLowerCase())}let J=[];for(let Y of $.matchAll(/<module>\s*([^<]+?)\s*<\/module>/gi))J.push(Y[1].trim());return{packaging:Z,parents:z,artifacts:X,modules:J}}function m2($,Z){let z=Z.toLowerCase();if($.has(z))return!0;for(let Q of $)if(Q===z||Q.endsWith(`.${z}`)||Q===z.replace(/^org\.gradle\./,""))return!0;return!1}function X4($,Z,z){let Q;for(let[X,J]of Z){let Y=!1;if(z==="plugin")Y=m2($,X);else if(Y=$.has(X)||[...$].some((W)=>W===X||W.startsWith(`${X}:`)||W.startsWith(`${X}.`)),!Y&&z==="artifact")Y=[...$].some((W)=>W===X||W.startsWith(`${X}`));if(!Y)continue;if(!Q||X.length>Q[0].length)Q=[X,J]}return Q}function N_($){let Z;for(let z of z_)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 NW($,Z){let z=new Set,Q=!1,X=!1,J=[l6(Z,"src"),l6(Z,"src","main")],Y=(W,U)=>{if(U>4)return;let G=X0($,W);if(!G)return;for(let{name:V}of G){if(V==="androidMain"||V==="commonMain"||V==="jvmMain"||V==="iosMain")z.add(V);let H=l6(W,V),K=D2($,H);if(!K)continue;if(K.isDirectory())Y(H,U+1);else if(V.endsWith(".kt")||V.endsWith(".kts"))Q=!0;else if(V.endsWith(".java"))X=!0}};for(let W of J)Y(W,0);return{kotlin:Q,java:X,hints:z}}function O_($){let Z=[],z=$.plugins,Q=$.artifacts,X=Y_.some((E)=>m2(z,E))||$.sourceHints.has("commonMain"),J=m2(z,"com.android.application"),Y=m2(z,"com.android.library")||m2(z,"com.android.kotlin.multiplatform.library");if(J||Y)Z.push("android");if(X)Z.push("multiplatform");let W=N_(Q),U=X4(z,Q_,"plugin"),G=X4($.parents,X_,"parent"),V=X4(Q,J_,"artifact"),H=X4(z,U_,"plugin"),K=X4(Q,G_,"artifact"),q=V_.some((E)=>m2(z,E)),L=$.packaging==="pom",B,N="",I;if(J)B="mobile",N=X?"Android+KMP":"Android",I=`${$.path||"root"} + com.android.application (${N})`;else if(W)B="mcp",N="MCP",Z.push("mcp"),I=`${$.path||"root"} + ${W} (JVM MCP server)`;else if(U||G||V){B="backend",N=U?.[1]||G?.[1]||V?.[1]||"JVM";let E=U?.[0]||G?.[0]||V?.[0]||"web";I=`${$.path||"root"} + ${E} (JVM backend)`}else if(X&&!Y)B="library",N="Kotlin Multiplatform",I=`${$.path||"root"} + kotlin multiplatform (KMP library)`;else if(Y)B="library",N=X?"Android+KMP":"Android",I=`${$.path||"root"} + android library (${N})`;else if(K||$.hasApplicationPlugin&&($.hasMainClass||H)||H&&$.hasMainClass)B="cli",N=K?.[1]||"application",I=K?`${$.path||"root"} + ${K[0]} (JVM CLI)`:`${$.path||"root"} + application plugin (JVM CLI)`;else if($.hasApplicationPlugin&&!q)B="cli",N="application",I=`${$.path||"root"} + application plugin (JVM CLI)`;else if(L)B="library",I=`${$.path||"root"} + packaging=pom (Maven aggregator/BOM)`;else{B="library";let E=$.kotlinSources&&!$.javaSources?"Kotlin":"JVM";if(I=`${$.path||"root"} (${E} library)`,q)I=`${$.path||"root"} + java-library (JVM library)`}let _="Java";if($.kotlinSources&&$.javaSources)_="Java/Kotlin";else if($.kotlinSources||W_.some((E)=>m2(z,E))||X)_="Kotlin";let y=[...new Set(Z)];return{appType:B,framework:N,facets:y,found:I,buildTool:$.buildTool,mainLanguage:_}}function D_($,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 BW($,Z,z){let Q=l6(Z,"build.gradle.kts"),X=l6(Z,"build.gradle"),J=A($,Q)?Q:A($,X)?X:null;if(!J)return null;let Y=m($,J);if(!Y)return null;let W=M_(Y,z),U=L_(Y,z),G=NW($,Z),V=/mainClass\s*[.=]/.test(Y)||/mainClassName\s*=/.test(Y)||/Main-Class/.test(Y),H=m2(W,"application")||m2(W,"org.gradle.application");return{path:Z||"build.gradle",plugins:W,artifacts:U,packaging:"jar",parents:new Set,hasMainClass:V,hasApplicationPlugin:H,sourceHints:G.hints,kotlinSources:G.kotlin||J.endsWith(".kts"),javaSources:G.java,buildTool:"gradle"}}function MW($,Z){let z=m($,l6(Z,"pom.xml"));if(!z)return null;let{packaging:Q,parents:X,artifacts:J}=LW(z),Y=NW($,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 J4($){if(!m3($))return null;let Z=q_($),z=[],Q=null;for(let G of["settings.gradle.kts","settings.gradle"])if(A($,G)){Q=m($,G);break}let X=Q?B_(Q):[],J=BW($,"",Z);if(J)z.push(J);for(let G of X){let V=BW($,G,Z);if(V)z.push(V)}let Y=MW($,"");if(Y){z.push(Y);let G=m($,"pom.xml");if(G){let{modules:V}=LW(G);for(let H of V){let K=MW($,H);if(K)z.push(K)}}}if(z.length===0&&Q)return{appType:"library",framework:"",buildTool:"gradle",mainLanguage:"Java/Kotlin",facets:[],found:"settings.gradle (Gradle multi-project root)"};if(z.length===0)return null;let W=null,U=999;for(let G of z){let V=O_(G),H=D_(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 T_}from"path";var Y4={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 A_=Y4.mcpGems.map(($)=>$.toLowerCase()),C_=Y4.webGems.map(([$,Z])=>[$.toLowerCase(),Z]),OW=Y4.cliGems.map(([$,Z])=>[$.toLowerCase(),Z]),__=Y4.railsLayoutFiles;function R_($){return A($,"Gemfile")||A($,"gems.rb")||F_($)}function F_($){return(X0($)??[]).some((Z)=>Z.name.endsWith(".gemspec"))}function P_($){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 S_($){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 E_($){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 j_($){let Z=new Set,z=[];for(let X of["Gemfile","gems.rb"]){let J=m($,X);if(J){for(let Y of P_(J))Z.add(Y);z.push(X)}}let Q=m($,"Gemfile.lock")||m($,"gems.locked");if(Q){for(let X of S_(Q))Z.add(X);z.push("Gemfile.lock")}for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=m($,X);if(J){for(let Y of E_(J))Z.add(Y);z.push(X)}}return{gems:Z,sources:z}}function W4($,Z){let z=Z.toLowerCase();if($.has(z))return!0;return!1}function c3($,Z){let z;for(let[Q,X]of Z){if(!W4($,Q))continue;if(!z||Q.length>z[0].length)z=[Q,X]}return z}function w_($){let Z;for(let z of A_)if(W4($,z)&&(!Z||z.length>Z.length))Z=z;return Z}function DW($){for(let Z of __)if(A($,Z))return Z;return}function x_($,Z){let z=c3(Z,OW);if(z)return{hit:!0,why:z[0]};for(let{name:X}of X0($)??[]){if(!X.endsWith(".gemspec"))continue;let J=m($,X);if(J&&/executables\s*=/.test(J)&&!/executables\s*=\s*\[\s*\]/.test(J))return{hit:!0,why:`${X} executables`}}let Q=X0($,"bin");if(Q){let J=Q.map((Y)=>Y.name).filter((Y)=>{if(Y==="setup"||Y==="console"||Y==="rake")return!1;return D2($,T_("bin",Y))?.isFile()===!0}).filter((Y)=>Y!=="rails");if(J.length>0&&!W4(Z,"rails")&&!DW($))return{hit:!0,why:`bin/${J[0]}`}}return{hit:!1,why:""}}function h5($){if(!R_($))return null;let{gems:Z,sources:z}=j_($),Q=z[0]||"Gemfile",X=z.some((N)=>N==="Gemfile"||N==="gems.rb"||N.includes("lock"))?"bundler":"rubygems",J=w_(Z),Y=c3(Z,C_),W=DW($),U=W4(Z,"rails")||W4(Z,"railties"),G=x_($,Z),V=A($,"config.ru"),H=U||!!W,K=Y&&Y[1]!=="Rails"&&!(Y[0]==="rack"&&!V)?Y:void 0,q,L="",B;if(J)q="mcp",L="MCP",B=`${Q} + gem ${J} (Ruby MCP)`;else if(H)if(q="backend",L="Rails",U&&W)B=`${Q} + rails + ${W} (Rails)`;else if(U)B=`${Q} + gem rails (Rails)`;else B=`${W} (Rails layout)`;else if(K)q="backend",L=K[1],B=`${Q} + gem ${K[0]} (Ruby backend)`;else if(G.hit)q="cli",L=c3(Z,OW)?.[1]||"",B=`${Q} + ${G.why} (Ruby CLI)`;else q="library",B=`${Q} (Ruby library)`;return{appType:q,framework:L,packageManager:X,found:B}}import{join as k_}from"path";var x2={version:1,_doc:"SINGLE SOURCE of Swift detection KNOWLEDGE (Truth-is-faf-cli). Kill line: Package.swift alone ≠ app. Static parse of products + package URLs + product names + light xcodeproj productType. Never execute Package.swift / swift build. 2026-08-03 post-intel swift-edition.",mcpPackageUrls:["modelcontextprotocol/swift-sdk","github.com/modelcontextprotocol/swift-sdk"],mcpProducts:["MCP"],serverPackageUrls:[["vapor/vapor","Vapor"],["github.com/vapor/vapor","Vapor"],["hummingbird-project/hummingbird","Hummingbird"],["github.com/hummingbird-project/hummingbird","Hummingbird"]],serverProducts:[["Vapor","Vapor"],["Hummingbird","Hummingbird"]],cliPackageUrls:[["apple/swift-argument-parser","ArgumentParser"],["github.com/apple/swift-argument-parser","ArgumentParser"]],cliProducts:[["ArgumentParser","ArgumentParser"]],appProductTypes:["com.apple.product-type.application"],cliProductTypes:["com.apple.product-type.tool"],vaporLayoutFiles:["Sources/App/configure.swift","Sources/App/routes.swift","Sources/App/entrypoint.swift"]};var b_=x2.mcpPackageUrls.map(($)=>$.toLowerCase()),v_=x2.mcpProducts.map(($)=>$.toLowerCase()),g_=x2.serverPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),h_=x2.serverProducts.map(([$,Z])=>[$.toLowerCase(),Z]),f_=x2.cliPackageUrls.map(([$,Z])=>[$.toLowerCase(),Z]),u_=x2.cliProducts.map(([$,Z])=>[$.toLowerCase(),Z]),m_=x2.appProductTypes,c_=x2.cliProductTypes,p_=x2.vaporLayoutFiles;function l_($){return A($,"Package.swift")||p3($).length>0}function p3($){return(X0($)??[]).map((Z)=>Z.name).filter((Z)=>Z.endsWith(".xcodeproj")&&D2($,Z)?.isDirectory()===!0)}function d_($){let Z=i_($),z=Z.toLowerCase(),Q=[],X=/\.package\s*\(\s*url\s*:\s*"([^"]+)"/gi,J;while((J=X.exec(Z))!==null)Q.push(J[1]);let Y=/\.package\s*\(\s*url\s*:\s*'([^']+)'/gi;while((J=Y.exec(Z))!==null)Q.push(J[1]);let W=[],U=/\.product\s*\(\s*name\s*:\s*"([^"]+)"/gi;while((J=U.exec(Z))!==null)W.push(J[1]);let G=/\.product\s*\(\s*name\s*:\s*'([^']+)'/gi;while((J=G.exec(Z))!==null)W.push(J[1]);let V=/\.library\s*\(/.test(z),H=/\.executable\s*\(/.test(z),K=/\.plugin\s*\(/.test(z)&&!V&&!H?!0:/\bproducts\s*:\s*\[[\s\S]*?\.plugin\s*\(/.test(z),q=/\.executabletarget\s*\(/.test(z),L=/\.target\s*\(/.test(z)&&!q?!0:(z.match(/\.target\s*\(/g)||[]).length>(z.match(/\.executabletarget\s*\(/g)||[]).length+(z.match(/\.testtarget\s*\(/g)||[]).length;return{packageUrls:Q,productNames:W,hasLibraryProduct:V,hasExecutableProduct:H,hasPluginProduct:!!K,hasExecutableTarget:q,hasLibraryTarget:L}}function i_($){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 n_($,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 TW($,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 r_($){let Z=$.map((z)=>z.toLowerCase());return v_.some((z)=>Z.includes(z))}function s_($){let Z=!1,z=!1,Q;for(let X of p3($)){let J=m($,k_(X,"project.pbxproj"));if(!J)continue;for(let Y of m_)if(J.includes(Y))Z=!0,Q=Y;for(let Y of c_)if(J.includes(Y)){if(z=!0,!Q)Q=Y}}return{hasApplication:Z,hasTool:z,hit:Q}}function o_($){for(let Z of p_)if(A($,Z))return Z;return}function U4($){if(!l_($))return null;let Z=A($,"Package.swift"),z=p3($),Q=z.length>0,X=null;if(Z){let S=m($,"Package.swift");if(S)X=d_(S)}let J=Q?s_($):{hasApplication:!1,hasTool:!1},Y=o_($),W=X?.packageUrls??[],U=X?.productNames??[],G=n_(W,b_),V=r_(U),H=IW(W,g_),K=TW(U,h_),q=IW(W,f_),L=TW(U,u_),B=!!(G||V),N=!!(H||K||Y),I=!!(X?.hasExecutableProduct||X?.hasExecutableTarget),_=!!(q||L),y=J.hasApplication,E=Z&&Q?"spm+xcode":Z?"spm":"xcode",w,j="",u;if(B)if(w="mcp",j="MCP",V)u="Package.swift + product MCP (Swift MCP)";else u=`Package.swift + ${G} (Swift MCP)`;else if(N)if(w="backend",j=K?.[1]||H?.[1]||(Y?"Vapor":""),K)u=`Package.swift + product ${K[1]} (Swift backend)`;else if(H)u=`Package.swift + ${H[1]} (Swift backend)`;else u=`${Y} (Swift backend layout)`;else if(y)w="app",j="",u=`${z[0]} + ${J.hit||"application"} (Swift app)`;else if(_||I&&!N&&!B)if(w="cli",j=L?.[1]||q?.[1]||"",L)u=`Package.swift + product ${L[1]} (Swift CLI)`;else if(q)u=`Package.swift + ${q[1]} (Swift CLI)`;else if(X?.hasExecutableProduct)u="Package.swift + .executable product (Swift CLI)";else u="Package.swift + .executableTarget (Swift CLI)";else if(J.hasTool&&!Z)w="cli",u=`${z[0]} + tool productType (Swift CLI)`;else if(Z)if(w="library",X?.hasLibraryProduct)u="Package.swift + .library product (Swift library)";else u="Package.swift (Swift library)";else w="library",u=`${z[0]||"xcodeproj"} (Swift — no classifying productType)`;return{appType:w,framework:j,packageManager:E,found:u}}function a_($){let Z=m($,"Cargo.toml");if(Z===null)return null;let z=Z.match(/^\s*\[package\][\s\S]*?^\s*name\s*=\s*"([^"]+)"/m);return z?z[1]:null}function t_($){let Z=m($,"Cargo.toml");return Z!==null&&/^\s*\[\[bin\]\]/m.test(Z)}function e_($,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=a_($);if(z&&/(?:^|[-_])sdk(?:[-_]|$)/i.test(z))return`Cargo.toml name "${z}" → sdk`;return null}function $R($){let Z=["manifest.json","public/manifest.json","src/manifest.json","app/manifest.json","extension/manifest.json","dist/manifest.json"];for(let z of Z){let Q=m($,z);if(Q===null)continue;try{let X=JSON.parse(Q);if(typeof X.manifest_version==="number")return`${z} manifest_version ${X.manifest_version} (browser extension)`}catch{}}return null}function ZR($){let Z=/(numpy|pandas|jupyter|scikit-learn|sklearn|pytorch|tensorflow|matplotlib|scipy)/i,z=m($,"pyproject.toml");if(z!==null){let X=z.match(Z);if(X)return`pyproject.toml depends on ${X[1]}`}let Q=m($,"requirements.txt");if(Q!==null){let X=Q.match(Z);if(X)return`requirements.txt contains ${X[1]}`}return null}function zR($,Z){let z=["react-native","expo","@capacitor/core","@ionic/core"];if(Z){for(let Q of z)if(Z.dependencies?.[Q]||Z.devDependencies?.[Q])return`${Q} dependency`}if(A($,"ios")&&A($,"android"))return"ios/ + android/ dirs";return null}function QR($,Z){let z=m($,"Cargo.toml");if(z!==null){if(/crate-type\s*=\s*\[[^\]]*"cdylib"/.test(z))return'Cargo.toml crate-type = ["cdylib"]';if(/wasm-bindgen|wasm-pack/i.test(z))return"Cargo.toml wasm-bindgen/wasm-pack"}let Q=m($,"build.zig");if(Q!==null&&/\.wasm\b|wasm32|setOutputFormat\(\.wasm/i.test(Q))return"build.zig wasm target";if(Z?.keywords?.some((X)=>/^wasm(?:-|$)|webassembly/i.test(X)))return'package.json keywords contains "wasm"';return null}function XR($,Z){if(!A($,"index.html"))return null;if(Z?.dependencies||Z?.devDependencies){let z={...Z.dependencies??{},...Z.devDependencies??{}};if(["react","vue","svelte","@sveltejs/kit","next","nuxt","astro","gatsby","solid-js","qwik"].some((X)=>z[X]))return null}return"index.html (vanilla, no frontend framework)"}function JR($,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 YR($,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 WR($,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 UR($,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 GR($,Z){if(!Z?.private)return null;if(!(!!Z.workspaces||A($,"pnpm-workspace.yaml")))return null;return"private workspace + multi-package"}var VR=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"]),CW=/^(Python|Go|Rust|Ruby|Java|Kotlin)$/,HR=new Set(["frontend","backend","database","css","ui","state"]);function KR($){if(A($,"pyproject.toml")||A($,"manage.py")||A($,"setup.py")||f5($,"requirements*.txt"))return!0;if(A($,"go.mod"))return!0;if(A($,"Cargo.toml"))return!0;if(A($,"Gemfile"))return!0;if(A($,"pom.xml")||f5($,"build.gradle*"))return!0;if(y$($).length>0)return!0;let Z=Y2($);if(Z&&Object.keys(Z.dependencies??{}).length>0)return!0;return!1}function u5($){return F$($,()=>qR($))}function qR($){let Z=X0($)??[],z=[];for(let Q of Z){if(!Q.isDirectory()||Q.name.startsWith(".")||VR.has(Q.name))continue;let X=AW($,Q.name);if(!KR(X))continue;let J=c5(X);if(!J)continue;let Y=m5(X).filter((V)=>HR.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||CW.test(J),hasFramework:!!G,appRoot:A(X,"manage.py")||A(X,"config.ru")||A(X,"bin/rails")||A(X,"artisan")})}return z}function BR($,Z){if(Z?.workspaces||A($,"pnpm-workspace.yaml"))return null;let z=u5($),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 _W($){let Z=u5($);if(Z.length<2)return null;let z=(Y)=>(Y.appRoot?2:0)+(CW.test(Y.language)?2:0)+(Y.hasFramework?1:0)+(Y.frontend?0.5:0),Q=[...Z].sort((Y,W)=>z(W)-z(Y)),X=new Set,J=[];for(let Y of Q){if(X.has(Y.language))continue;X.add(Y.language);let W=Y.frontend?"frontend":Y.backend?"backend":"service";J.push(Y.topFramework?`${Y.language} (${Y.topFramework} · ${W})`:`${Y.language} (${W})`)}return J.join("; ")}function Y2($){let Z=m($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function f5($,Z){if(!Z.includes("*"))return A($,Z);let z=Z.split("/");if(z.length===1){let W=Z.split("*")[0];return(X0($)??[]).some((U)=>U.name.startsWith(W))}let Q=AW(...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 MR($,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 f5(z,$.pattern);case"content":{if(!$.pattern||!$.key)return!1;if(!f5(z,$.pattern))return!1;let Q=m(z,$.pattern);return Q!==null&&Q.toLowerCase().includes($.key.toLowerCase())}default:return!1}}function m5($){let Z=Y2($);return GW.map((z)=>{let X=z.signals.filter((J)=>MR(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 c5($){let Z=Y2($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(A($,"tsconfig.json"))return"TypeScript";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(y$($).length>0)return"C#";if(A($,"pyproject.toml")||A($,"setup.py"))return"Python";if(A($,"Gemfile"))return"Ruby";if(m3($)){let z=J4($);if(z)return z.mainLanguage==="Java/Kotlin"?"Kotlin":z.mainLanguage;return"Java"}if(A($,"Package.swift"))return"Swift";if(A($,"build.zig"))return"Zig";if(A($,"pubspec.yaml"))return"Dart";if(Z)return"JavaScript";return""}function RW($){let Z=Y2($),z=m5($),Q=[],X=JR($,Z);if(X)return Q.push(X),{type:"documentation",found:Q};let J=e_($,Z);if(J)return Q.push(J),{type:"sdk",found:Q};let Y=$R($);if(Y)return Q.push(Y),{type:"extension",found:Q};let W=UR($,Z,z);if(W)return Q.push(W),{type:"mcpaas",found:Q};let U=WR($,Z);if(U)return Q.push(U),{type:"saas",found:Q};let G=QR($,Z);if(G)return Q.push(G),{type:"wasm",found:Q};let V=y5($);if(V)return Q.push(V.found),{type:V.appType,found:Q};let H=b5($);if(H)return Q.push(H.found),{type:H.appType,found:Q};let K=g5($);if(K)return Q.push(K.found),{type:K.appType,found:Q};let q=J4($);if(q)return Q.push(q.found),{type:q.appType,found:Q};let L=h5($);if(L)return Q.push(L.found),{type:L.appType,found:Q};let B=U4($);if(B)return Q.push(B.found),{type:B.appType,found:Q};let N=zR($,Z);if(N)return Q.push(N),{type:"mobile",found:Q};if(z.some((h)=>h.slug==="mcp"))return Q.push("MCP SDK signal"),{type:"mcp",found:Q};if(Z?.bin)return Q.push("package.json bin"),{type:"cli",found:Q};if(t_($))return Q.push("Cargo.toml [[bin]]"),{type:"cli",found:Q};if(A($,"build.zig")){if(Q.push("build.zig"),A($,"src/main.zig"))return Q.push("src/main.zig"),{type:"cli",found:Q};if(A($,"src/root.zig"))return Q.push("src/root.zig"),{type:"library",found:Q}}let _=z.some((h)=>h.slug==="svelte"||h.slug==="sveltekit");if(Z?.private===!0&&(A($,"pnpm-workspace.yaml")||Z?.workspaces!==void 0)&&_)return Q.push("private workspace","Svelte"),{type:"framework",found:Q};if(_)return Q.push("Svelte/SvelteKit"),{type:"svelte",found:Q};let E=z.some((h)=>h.category==="frontend"),w=z.some((h)=>h.category==="backend");if(Z?.private&&(Z.workspaces||A($,"pnpm-workspace.yaml"))&&E&&w)return Q.push("private workspace + frontend + backend frameworks"),{type:"enterprise",found:Q};let j=GR($,Z);if(j)return Q.push(j),{type:"monorepo-root",found:Q};let u=YR($,Z,z);if(u)return Q.push(u),{type:"website",found:Q};if(z.some((h)=>h.slug==="nextjs"||h.slug==="nuxt"))return Q.push(z.find((h)=>h.slug==="nextjs")?"Next.js":"Nuxt"),{type:"fullstack",found:Q};let d=z.some((h)=>h.category==="frontend"),T0=z.some((h)=>h.category==="backend");if(d&&T0)return Q.push("frontend framework","backend framework"),{type:"fullstack",found:Q};if(d)return Q.push("frontend framework"),{type:"frontend",found:Q};if(T0)return Q.push("backend framework"),{type:"backend",found:Q};let j0=ZR($);if(j0)return Q.push(j0),{type:"data-science",found:Q};let Z0=XR($,Z);if(Z0)return Q.push(Z0),{type:"html",found:Q};let k=BR($,Z);if(k)return Q.push(k),{type:"fullstack",found:Q};if(Z?.main&&!Z?.bin)return Q.push("package.json main (no bin)"),{type:"library",found:Q};return Q.push(S$),{type:"library",found:Q}}function FW($){if(A($,"bunfig.toml"))return"Bun";if(A($,"deno.json")||A($,"deno.jsonc"))return"Deno";if(Y2($))return"Node.js";if(A($,"Cargo.toml"))return"Rust";if(A($,"go.mod"))return"Go";if(y$($).length>0)return".NET";if(A($,"pubspec.yaml"))return"Dart";return""}var LR=new Set(["npm","pnpm","yarn","bun"]);function NR($){let Z=Y2($)?.packageManager;if(typeof Z!=="string")return"";let z=/^([a-z]+)@/i.exec(Z.trim())?.[1]?.toLowerCase()??"";return LR.has(z)?z:""}function OR($){if(A($,"pubspec.yaml"))return"pub";if(A($,"go.mod"))return"go modules";if(y$($).length>0)return"NuGet";if(A($,"pom.xml"))return"maven";return["build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts"].some((z)=>A($,z))?"gradle":""}var DR=[["bun.lockb","bun"],["bun.lock","bun"],["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"]];function PW($){return OR($)||NR($)||(DR.find(([Z])=>A($,Z))?.[1]??"")}function SW($){if(A($,".github/workflows"))return"GitHub Actions";if(A($,".gitlab-ci.yml"))return"GitLab CI";if(A($,".circleci"))return"CircleCI";if(A($,"Jenkinsfile"))return"Jenkins";return null}function EW($){if(A($,"vercel.json"))return"Vercel";if(A($,"netlify.toml"))return"Netlify";if(A($,"wrangler.toml"))return"Cloudflare";if(A($,"fly.toml"))return"Fly.io";if(A($,"render.yaml"))return"Render";return null}var IR=["svelte.config.js","vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"];function TR($){for(let Q of IR){let X=m($,Q)?.match(/@sveltejs\/adapter-(\w+)/);if(X)return X[1]}let Z=Y2($);return Object.keys({...Z?.dependencies,...Z?.devDependencies}).map((Q)=>/^@sveltejs\/adapter-(\w+)$/.exec(Q)?.[1]).find(Boolean)??null}function jW($){let Z=TR($);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 l3($){let Z=$?.devDependencies?.vite??$?.dependencies?.vite,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?"Vite":`Vite ${z}`}function wW($){let Z=Y2($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return l3(Z);if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(A($,"tsconfig.json")&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function p5($){return["package.json","Cargo.toml","pyproject.toml","go.mod","build.zig","build.zig.zon","src/index.ts","src/index.js","src/main.ts","src/cli.ts","src/main.rs","src/lib.rs","src/main.zig","src/root.zig","src/__init__.py","main.py","__main__.py","main.go","cmd/main.go","README.md","SPECIFICATION.md","BINARY-FORMAT.md","tsconfig.json","wrangler.toml","vercel.json"].filter((z)=>A($,z))}function l5($,Z){let z={};if(Z?.scripts){for(let Q of["build","test","lint","dev","start"])if(Z.scripts[Q]){let X=A($,"bun.lock")||A($,"bun.lockb")?"bun run":"npm run";z[Q]=`${X} ${Q}`}}if(A($,"Cargo.toml")){if(!z.build)z.build="cargo build --release";if(!z.test)z.test="cargo test";if(!z.lint&&AR($))z.lint="cargo clippy"}if(A($,"build.zig")){if(!z.build)z.build="zig build";if(!z.test&&/\.step\(\s*"test"/.test(d3($,"build.zig")))z.test="zig build test"}if(A($,"go.mod")){if(!z.build)z.build="go build ./...";if(!z.test)z.test="go test ./..."}if(!z.test&&CR($))z.test="pytest";return z}function d3($,Z){return m($,Z)??""}function AR($){if(A($,"clippy.toml")||A($,".clippy.toml"))return!0;return/^\s*\[(workspace\.)?lints\.clippy\]/m.test(d3($,"Cargo.toml"))}function CR($){if(A($,"pytest.ini")||A($,"conftest.py"))return!0;return["pyproject.toml","setup.cfg","tox.ini"].some((Z)=>/\bpytest\b/.test(d3($,Z)))}function xW($,Z,z,Q){let X=[];if(Q&&Q!=="Unknown")X.push(Q);let J=new Set(["frontend","backend","database","build","css","state","monorepo"]);for(let Y of z)if(J.has(Y.category))X.push(Y.name);if(A($,"bunfig.toml"))X.push("Bun");else if(A($,"deno.json")||A($,"deno.jsonc"))X.push("Deno");if(X.length<3&&Z?.dependencies){let Y=Object.keys(Z.dependencies).slice(0,5);for(let W of Y)if(!X.some((U)=>U.toLowerCase().includes(W.toLowerCase())))X.push(W)}return X}function _R($){let Z=$?.dependencies?.svelte??$?.devDependencies?.svelte,z=typeof Z==="string"?/\d+/.exec(Z)?.[0]:void 0;return z===void 0?NaN:Number(z)}function yW($){return i3($).data}function i3($){let Z=Y2($),z=m5($),Q=RW($),X=Q.type,J=Q.found.some((n)=>n.startsWith("polyglot:")),Y=J&&_W($)||c5($),W=FW($),U=PW($),G=SW($),V=EW($),H=wW($),K=z.find((n)=>n.slug==="sveltekit")??z.find((n)=>n.category==="frontend"),q=z.find((n)=>n.category==="css"),L=z.find((n)=>n.category==="ui"),B=z.find((n)=>n.category==="state"),N=z.find((n)=>n.category==="backend"),I=z.find((n)=>n.category==="database"),_=(n)=>m6(X,n)??m6("library",n)===!0,y=X==="framework",E=z.some((n)=>n.slug==="svelte"||n.slug==="sveltekit"),w=y&&E?"svelte":y?null:null,j=X==="svelte"||w==="svelte",u=j?jW($):null,S=j&&z.some((n)=>n.slug==="sveltekit"),d={},T0=J0.filter((n)=>n.path.startsWith("stack."));for(let n of T0){let Y0=n.path.replace("stack.","");switch(Y0){case"frontend":d[Y0]=K?.name??"";break;case"css_framework":d[Y0]=q?.name??"";break;case"ui_library":d[Y0]=L?.name??"";break;case"state_management":d[Y0]=B?.name??(j&&_R(Z)>=5?"Runes":"");break;case"backend":d[Y0]=j?S?"SvelteKit":N?.name??"":N?.name??"";break;case"api_type":d[Y0]=S?"Server Routes":"";break;case"runtime":d[Y0]=W;break;case"database":d[Y0]=I?.name??"";break;case"connection":d[Y0]=I?.name??"";break;case"hosting":if(j&&u)d[Y0]=u;else d[Y0]=V??"";break;case"build":d[Y0]=S?l3(Z):H??"";break;case"cicd":d[Y0]=G??"";break;case"package_manager":d[Y0]=U;break;default:d[Y0]="";break}}let j0={};for(let n of T0){let Y0=n.path.replace("stack.","");j0[Y0]=_(n)?d[Y0]:"slotignored"}let Z0={},k=J0.filter((n)=>n.path.startsWith("monorepo."));for(let n of k){let Y0=n.path.replace("monorepo.","");if(!_(n))Z0[Y0]="slotignored";else Z0[Y0]=""}let h={name:Z?.name??$.split("/").pop()??"project",goal:J?"":Z?.description??"",main_language:Y,type:X};if(y&&w)h.framework=w;let L0=xW($,Z,z,J?c5($):Y);if(J){for(let n of u5($))for(let Y0 of[n.language,n.topFramework])if(Y0&&!L0.includes(Y0))L0.push(Y0)}let B2=p5($),EQ=l5($,Z),T8={faf_version:B6,project:h,stack:j0,human_context:{who:"",what:J?"":Z?.description??"",why:"",where:"",when:"",how:""},monorepo:Z0,_meta:{found:Q.found}};if(L0.length>0)T8.tech_stack=L0;if(B2.length>0)T8.key_files=B2;if(Object.keys(EQ).length>0)T8.commands=EQ;return{data:T8,facts:d}}var kW={MIN_LENGTH:8,MAX_LENGTH:280},RR=[/^(see|see\s+the?)\s+readme/i,/^(tbd|todo|fixme|coming\s+soon)\b/i,/^(software|application|app|project|tool|library|framework)\.?$/i,/^(for\s+users|for\s+developers)\.?$/i,/^(description|goal|name|title)\.?$/i,/^lorem\s+ipsum/i,/^example(\s+\w+)?\.?$/i];function C2($){let Z=$.trim();if(Z.length<kW.MIN_LENGTH)return!1;if(Z.length>kW.MAX_LENGTH)return!1;if(RR.some((z)=>z.test(Z)))return!1;if(/^[\s|\-*+]/.test(Z))return!1;if(Z.split(`
236
+ `).length>4)return!1;return!0}function FR($){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 qR($){let z=VR($).split(`
239
- `),Q=[];for(let X of z){let J=X.trim();if(J===""){if(Q.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(J))break;if(/^\*\*[^*]+\*\*\s*$/.test(J)&&Q.length===0)continue;Q.push(J)}if(Q.length===0)return null;return Q.join(" ").trim()}function p6($,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 HR($){let Z=p6($,/^(use\s+cases?|goal)\b/i);if(Z&&A2(Z))return Z;let z=qR($);if(z&&A2(z))return z;return}function KR($){let Z=p6($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&A2(Z))return Z;return}function BR($){let Z=p6($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&A2(Z))return Z;return}function MR($){let Z=p6($,/^(why|motivation|problem|rationale)\b/i);if(Z&&A2(Z))return Z;return}function LR($){let Z=p6($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&A2(Z))return Z;return}function NR($){let Z=p6($,/^(status|history|timeline|since|launched)\b/i);if(Z&&A2(Z))return Z;return}function OR($){let Z=p6($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&A2(Z))return Z;return}function m3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let K of Z)if(A($,K)){z=K;break}if(!z)return{};let Q=u($,z);if(Q===null)return{};Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=HR(Q);if(J)X.project={goal:J};let Y={},W=KR(Q);if(W)Y.what=W;let U=BR(Q);if(U)Y.who=U;let G=MR(Q);if(G)Y.why=G;let V=LR(Q);if(V)Y.where=V;let q=NR(Q);if(q)Y.when=q;let H=OR(Q);if(H)Y.how=H;if(Object.keys(Y).length>0)X.human_context=Y;return X}function DR($,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 c3($){let Z=u($,"Cargo.toml");if(Z===null)return{};let z=DR(Z,"description");if(z&&A2(z))return{project:{goal:z}};return{}}import{join as PW}from"path";var IR=[{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"}],TR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function AR($){let Z=[],z=(Q,X)=>{for(let J of Q0($,Q)??[])if(J.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(J.name))Z.push(PW(Q,J.name));else if(J.isDirectory()&&X>0&&!J.name.startsWith(".")&&!TR.has(J.name))z(PW(Q,J.name),X-1)};return z(".",1),Z}function W4($){return[...$].join(" · ")}function p3($){let Z=AR($);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=u($,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:q,label:H}of IR)if(V.test(U)||V.test(G))z[q].add(H)}}let Q={};if(z.database.size)Q.database=W4(z.database);if(z.cache.size)Q.cache=W4(z.cache);if(z.search.size)Q.search=W4(z.search);if(z.storage.size)Q.storage=W4(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${W4(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 CR}from"path";var _R=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),RR=[{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 l3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function FR($){let Z=[$];for(let z of Q0($)??[])if(z.isDirectory()&&!z.name.startsWith(".")&&!_R.has(z.name))Z.push(CR($,z.name));return Z}function PR($){let Z=0;if(A($,"manage.py")||A($,"pyproject.toml")||A($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function d3($){return _$($,()=>SR($))}function SR($){let Z=[];for(let Q of FR($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of RR){let W=u(Q,Y.file);if(W===null)continue;let U=Y.targets(W);if(U.length===0)continue;let G={},V=l3(U,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),q=l3(U,[/^build$/i,/^compile$/i,/^build/i]),H=l3(U,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(V)G.test=`${J}${Y.runner} ${V}`;if(q)G.build=`${J}${Y.runner} ${q}`;if(H)G.lint=`${J}${Y.runner} ${H}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(X?10:PR(Q)),commands:G})}}let z=Z.sort((Q,X)=>X.score-Q.score)[0];return z?{commands:z.commands}:{}}var ER=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function i3($){for(let Z of ER)if(A($,Z))return{security:{secrets:".env",example:Z}};return{}}function jR($,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[m3($),c3($),p3($),d3($),i3($)].reduce(jR,{})}import{join as wR,extname as xR,resolve as yR}from"path";var r3={"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 kR=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),bR=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),vR={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"]},gR=[["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 hR($,Z){for(let[z,Q]of gR)if(z in $)return Q;return Z.length>0?"framework":"config"}function fR($,Z){try{let z=JSON.parse(u($,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 uR($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return N2($,Z.name)?.isFile()===!0}function mR($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return N2($,Z.name)?.isDirectory()===!0}function cR($){let Z=[],z=yR($),Q=new Set,X=Q0(z);if(!X)return Z;for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!mR(z,J):!uR(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let U=b5(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=Y4(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=r3[Y];if(!W)continue;if(Y==="manifest.json"&&fR(z,Y)!=="chrome")continue;if(Y==="pubspec.yaml"){let U=w5(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=y5(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=v5(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=Y4(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=Q4(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 pR($){let Z=[];for(let z of _$($,()=>SW($,2,{count:0}))){let Q=r3[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function lR($){let Z=[...cR($),...pR($)],z={},Q={},X=new Set;for(let G of Z){G.frameworks.forEach((V)=>X.add(V));for(let[V,q]of Object.entries(G.slots))if(q&&!q.includes("/")&&(!(V in z)||G.priority>Q[V]))z[V]=q,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:hR(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 s3($){let{slotFills:Z}=lR($),z={};for(let[Q,X]of Object.entries(Z)){let J=vR[Q];if(!J||!X)continue;let[Y,W]=J;if(Y==="project")(z.project??={})[W]=X;else(z.stack??={})[W]=X}return z}function SW($,Z,z){let Q=new Set;if(Z<0||z.count>400)return Q;let X=Q0($);if(!X)return Q;for(let J of X){if(z.count++>400)break;if(!J.isDirectory()){let Y=xR(J.name);if(bR.has(Y))Q.add(Y);continue}if(kR.has(J.name)||J.name.startsWith("."))continue;for(let Y of SW(wR($,J.name),Z-1,z))Q.add(Y)}return Q}var b0=($,Z,z)=>({value:$,source:Z,confidence:z});function dR($,Z={}){let z=Z.toolingRoot?null:iR($),Q=nR($),X={},J=(Y,W)=>{if(W)X[Y]=W};return J("what",oR(z,Q)),J("who",aR(Q)),J("why",tR(Q)),J("where",eR(z,Q)),J("when",$F(Q)),J("how",ZF(z,Q)),X}function o3($,Z={}){let z=dR($,Z),Q={};return Object.keys(z).forEach((X)=>{let J=z[X];if(J)Q[X]=J.value}),Q}function iR($){let Z=u($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function nR($){let Z=u($,"README.md");if(Z===null)return"";return Z.replace(/<!--[\s\S]*?-->/g,"").split(`
238
+ `)}function PR($){let z=FR($).split(`
239
+ `),Q=[];for(let X of z){let J=X.trim();if(J===""){if(Q.length>0)break;continue}if(/^(#|>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(J))break;if(/^\*\*[^*]+\*\*\s*$/.test(J)&&Q.length===0)continue;Q.push(J)}if(Q.length===0)return null;return Q.join(" ").trim()}function d6($,Z){let z=$.split(`
240
+ `),Q=0;while(Q<z.length){let J=z[Q].trim().match(/^(#{1,6})\s+(.+)$/);if(J&&Z.test(J[2])){let Y=J[1].length,W=[];Q++;while(Q<z.length){let U=z[Q].trim(),G=U.match(/^(#{1,6})\s+/);if(G&&G[1].length<=Y)break;if(U===""){if(W.length>0)break;Q++;continue}if(/^(>|```|---|\||\s*[-*+]\s|\d+\.\s)/.test(U))break;W.push(U),Q++}if(W.length===0)return null;return W.join(" ").trim()}Q++}return null}function SR($){let Z=d6($,/^(use\s+cases?|goal)\b/i);if(Z&&C2(Z))return Z;let z=PR($);if(z&&C2(z))return z;return}function ER($){let Z=d6($,/^(about|description|overview|what(\s+is\s+this)?)\b/i);if(Z&&C2(Z))return Z;return}function jR($){let Z=d6($,/^(audience|users?|for\s+whom|who(\s+is\s+this\s+for)?)\b/i);if(Z&&C2(Z))return Z;return}function wR($){let Z=d6($,/^(why|motivation|problem|rationale)\b/i);if(Z&&C2(Z))return Z;return}function xR($){let Z=d6($,/^(deployment|where(\s+it\s+runs)?|hosting)\b/i);if(Z&&C2(Z))return Z;return}function yR($){let Z=d6($,/^(status|history|timeline|since|launched)\b/i);if(Z&&C2(Z))return Z;return}function kR($){let Z=d6($,/^(architecture|how(\s+it\s+works)?|approach|design)\b/i);if(Z&&C2(Z))return Z;return}function n3($){let Z=["README.md","README.MD","Readme.md","readme.md"],z=null;for(let q of Z)if(A($,q)){z=q;break}if(!z)return{};let Q=m($,z);if(Q===null)return{};Q=Q.replace(/<!--[\s\S]*?-->/g,"");let X={},J=SR(Q);if(J)X.project={goal:J};let Y={},W=ER(Q);if(W)Y.what=W;let U=jR(Q);if(U)Y.who=U;let G=wR(Q);if(G)Y.why=G;let V=xR(Q);if(V)Y.where=V;let H=yR(Q);if(H)Y.when=H;let K=kR(Q);if(K)Y.how=K;if(Object.keys(Y).length>0)X.human_context=Y;return X}function bR($,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 r3($){let Z=m($,"Cargo.toml");if(Z===null)return{};let z=bR(Z,"description");if(z&&C2(z))return{project:{goal:z}};return{}}import{join as bW}from"path";var vR=[{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"}],gR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","tests","test"]);function hR($){let Z=[],z=(Q,X)=>{for(let J of X0($,Q)??[])if(J.isFile()&&/^(docker-)?compose.*\.ya?ml$/i.test(J.name))Z.push(bW(Q,J.name));else if(J.isDirectory()&&X>0&&!J.name.startsWith(".")&&!gR.has(J.name))z(bW(Q,J.name),X-1)};return z(".",1),Z}function G4($){return[...$].join(" · ")}function s3($){let Z=hR($);if(Z.length===0)return{};let z={database:new Set,cache:new Set,search:new Set,storage:new Set,runtime:new Set};for(let X of Z){let J=m($,X);if(J===null)continue;for(let Y of J.matchAll(/^\s*image:\s*["']?([^\s"'#]+)/gm)){let W=Y[1].toLowerCase(),U=W.replace(/:[^/]*$/,"").split("/").pop()??W,G=W.replace(/:[^/]*$/,"");for(let{re:V,slot:H,label:K}of vR)if(V.test(U)||V.test(G))z[H].add(K)}}let Q={};if(z.database.size)Q.database=G4(z.database);if(z.cache.size)Q.cache=G4(z.cache);if(z.search.size)Q.search=G4(z.search);if(z.storage.size)Q.storage=G4(z.storage);if(z.runtime.size)Q.runtime=`Docker Compose (${G4(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 fR}from"path";var uR=new Set(["node_modules",".git","dist","build","vendor","target","e2e","docs","scripts"]),mR=[{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 o3($,Z){for(let z of Z){let Q=$.find((X)=>z.test(X));if(Q)return Q}return null}function cR($){let Z=[$];for(let z of X0($)??[])if(z.isDirectory()&&!z.name.startsWith(".")&&!uR.has(z.name))Z.push(fR($,z.name));return Z}function pR($){let Z=0;if(A($,"manage.py")||A($,"pyproject.toml")||A($,"Gemfile"))Z+=3;if(/(?:^|\/)(backend|api|server|core|app)$/.test($))Z+=2;return Z}function a3($){return F$($,()=>lR($))}function lR($){let Z=[];for(let Q of cR($)){let X=Q===$,J=X?"":`cd ${Q.slice($.length+1)} && `;for(let Y of mR){let W=m(Q,Y.file);if(W===null)continue;let U=Y.targets(W);if(U.length===0)continue;let G={},V=o3(U,[/^test$/i,/^tests$/i,/test-all/i,/^test-unit/i,/^test/i]),H=o3(U,[/^build$/i,/^compile$/i,/^build/i]),K=o3(U,[/^check-all$/i,/^check$/i,/^lint$/i,/^lint/i,/^fmt$/i,/^format$/i]);if(V)G.test=`${J}${Y.runner} ${V}`;if(H)G.build=`${J}${Y.runner} ${H}`;if(K)G.lint=`${J}${Y.runner} ${K}`;if(Object.keys(G).length===0)continue;Z.push({score:Object.keys(G).length+(X?10:pR(Q)),commands:G})}}let z=Z.sort((Q,X)=>X.score-Q.score)[0];return z?{commands:z.commands}:{}}var dR=[".env.example",".env.sample",".env.template",".env.dist","env.example",".env.local.example"];function t3($){for(let Z of dR)if(A($,Z))return{security:{secrets:".env",example:Z}};return{}}function iR($,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 e3($){return[n3($),r3($),s3($),a3($),t3($)].reduce(iR,{})}import{join as nR,extname as rR,resolve as sR}from"path";var $9={"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 oR=new Set(["node_modules",".git","dist","build","venv",".venv","__pycache__","target","coverage",".next",".svelte-kit","vendor"]),aR=new Set([".py",".ts",".tsx",".js",".jsx",".svelte",".vue",".rb",".go",".rs",".php",".java",".kt",".swift"]),tR={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"]},eR=[["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 $F($,Z){for(let[z,Q]of eR)if(z in $)return Q;return Z.length>0?"framework":"config"}function ZF($,Z){try{let z=JSON.parse(m($,Z)??""),Q=["background","content_scripts","action","browser_action","permissions"].some((X)=>(X in z));if(typeof z.manifest_version==="number"&&Q)return"chrome";return"other"}catch{return"other"}}function zF($,Z){if(Z.isFile())return!0;if(!Z.isSymbolicLink())return!1;return D2($,Z.name)?.isFile()===!0}function QF($,Z){if(Z.isDirectory())return!0;if(!Z.isSymbolicLink())return!1;return D2($,Z.name)?.isDirectory()===!0}function XF($){let Z=[],z=sR($),Q=new Set,X=X0(z);if(!X)return Z;for(let J of X){let Y=J.name;if(Y.endsWith(".xcodeproj")?!QF(z,J):!zF(z,J))continue;if(Y.toLowerCase().endsWith(".csproj")){let U=g5(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=U4(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=$9[Y];if(!W)continue;if(Y==="manifest.json"&&ZF(z,Y)!=="chrome")continue;if(Y==="pubspec.yaml"){let U=y5(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=b5(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=h5(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=U4(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=J4(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 JF($){let Z=[];for(let z of F$($,()=>vW($,2,{count:0}))){let Q=$9[`*${z}`],X=Q?.slots?.mainLanguage;if(X)Z.push({slots:{mainLanguage:X},priority:Q.priority,frameworks:Q.frameworks})}return Z}function YF($){let Z=[...XF($),...JF($)],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:$F(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 Z9($){let{slotFills:Z}=YF($),z={};for(let[Q,X]of Object.entries(Z)){let J=tR[Q];if(!J||!X)continue;let[Y,W]=J;if(Y==="project")(z.project??={})[W]=X;else(z.stack??={})[W]=X}return z}function vW($,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=rR(J.name);if(aR.has(Y))Q.add(Y);continue}if(oR.has(J.name)||J.name.startsWith("."))continue;for(let Y of vW(nR($,J.name),Z-1,z))Q.add(Y)}return Q}var v0=($,Z,z)=>({value:$,source:Z,confidence:z});function WF($,Z={}){let z=Z.toolingRoot?null:UF($),Q=GF($),X={},J=(Y,W)=>{if(W)X[Y]=W};return J("what",KF(z,Q)),J("who",qF(Q)),J("why",BF(Q)),J("where",MF(z,Q)),J("when",LF(Q)),J("how",NF(z,Q)),X}function z9($,Z={}){let z=WF($,Z),Q={};return Object.keys(z).forEach((X)=>{let J=z[X];if(J)Q[X]=J.value}),Q}function UF($){let Z=m($,"package.json");if(Z===null)return null;try{return JSON.parse(Z)}catch{return null}}function GF($){let Z=m($,"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 l6($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function rR($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function x$($,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||rR(Q[2])>0.4)return null;return{body:l6(Q[2]),heading:Q[1].trim()}}function sR($){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 U4($,Z,z=30){for(let Q of Z){let X=$.match(Q);if(X&&X[1]&&X[1].trim().length>=z)return l6(X[1])}return null}function oR($,Z){if($?.description&&$.description.length>20)return b0(l6($.description),"package.json:description",0.95);let z=x$(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("#")&&!sR(J));if(Q)return b0(l6(Q),"README:first-paragraph",0.5);let X=U4(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 aR($){let Z=x$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return b0(Z.body,`README:## ${Z.heading}`,0.8);let z=U4($,[/\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 tR($){let Z=x$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return b0(Z.body,`README:## ${Z.heading}`,0.8);let z=U4($,[/(?: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 eR($,Z){let z=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(z)return b0(l6(z.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return b0(l6($.homepage),"package.json:homepage",0.9);let Q=U4(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 $F($){let Z=x$($,"Timeline|Status|Release|Roadmap");if(Z)return b0(Z.body,`README:## ${Z.heading}`,0.8);let z=U4($,[/\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 ZF($,Z){let z=$?.scripts?Object.keys($.scripts):[],Q=["start","dev","build"].filter((Y)=>z.includes(Y));if(Q.length)return b0(l6(Q.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let X=x$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(X)return b0(X.body,`README:## ${X.heading}`,0.8);let J=x$(Z,"Architecture|Approach|How it works|Methodology|How");return J?b0(J.body,`README:## ${J.heading}`,0.7):null}function y$($){let Z=RW($),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=K6(K6(Q,Z),X);VF(J);let W=(Z._meta?.found??[]).some((G)=>G.startsWith("polyglot:")),U=K6(J,s3($));return K6(U,{human_context:o3($,{toolingRoot:W})})}function jW($,Z){let z=GF(d1(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=u3($),J=Q,Y=K6(z,n3($)),W=K6(Y,J),U=K6(W,s3($)),G=XF(K6(U,{human_context:o3($)}),z),V=JF(zF(Z,z,J)?YF(EW(G,z),z,X):EW(G,z),z);return fY(gY(Z,V))}function zF($,Z,z){if(!U0(p0(Z,"project.type"))){let X=e1($)?.text;return X===void 0||!x3(X)}return!(z._meta?.found??[]).includes(F$)}function a3($){return $.canonical?[$.path,$.canonical]:[$.path]}function p0($,Z){let[z,Q]=Z.split("."),X=$[z];return e(X)?X[Q]:void 0}function d6($,Z,z){let[Q,X]=Z.split("."),J=$[Q];if(!e(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 i6=($)=>typeof $==="string"&&$.trim()===n1;function QF($,Z){let z=Z.map((Q)=>p0($,Q));return z.some(i6)&&z.every((Q)=>U0(Q)||i6(Q))}function EW($,Z){let z={...$};for(let Q of X0){let X=a3(Q);if(!QF(Z,X))continue;for(let J of X){let Y=p0(Z,J);if(p0(z,J)!==Y)d6(z,J,Y)}}return z}function n6($,Z){let[z,Q]=Z.split("."),X=$[z];return e(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function XF($,Z){let z={...$};for(let Q of X0){if(!Q.canonical||!n6(Z,Q.canonical)||n6(Z,Q.path))continue;let X=p0(z,Q.path);d6(z,Q.path,void 0);let J=p0(z,Q.canonical);if(p5(X)&&U0(J))d6(z,Q.canonical,X)}return z}function JF($,Z){let z={...$};for(let Q of X0){if(!Q.canonical||!n6(Z,Q.canonical)||n6(Z,Q.path))continue;let X=p0(z,Q.canonical);if(p5(X)||i6(X))d6(z,Q.path,X)}return z}function YF($,Z,z={}){let Q=$.project,X=e(Q)?Q.type:void 0,J={...$};for(let Y of X0){if(Y.category==="human"||Y.category==="project")continue;let W=f6(X,Y);if(W===null)return $;if(W)WF(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0);else UF(J,Y)}return J}function WF($,Z,z,Q){let X=a3(z);for(let Y of X)if(i6(p0($,Y))&&!i6(p0(Z,Y)))d6($,Y,n6(Z,Y)?p0(Z,Y):"");if(!p5(Q))return;let J=X.filter((Y)=>n6($,Y));if(J.some((Y)=>!U0(p0($,Y))))return;for(let Y of J.length>0?J:[z.path])d6($,Y,Q)}function UF($,Z){let z=a3(Z).filter((X)=>n6($,X)),Q=(X)=>!U0(p0($,X))&&!i6(p0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(U0(p0($,X)))d6($,X,n1)}function GF($){let Z=$.project;if(Z===null||Z===void 0||e(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function VF($){let Z=$.project?.type??"library",z=h6[Z]||h6.library;for(let Q of X0){if(z.includes(Q.category))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function K6($,Z){return wW($,Z,"")}function qF($){let Z=G6.get($);return Z!==void 0&&Z.category!=="human"}function p5($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!U0($)&&!i6($)}function HF($,Z){return qF($)&&p5(Z)}function wW($,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(R$(Y)){if(HF(W,J))Q[X]=J;continue}if(U0(Y))Q[X]=J;else if(e(J)&&e(Y))Q[X]=wW(Y,J,W)}return Q}import{existsSync as xW,lstatSync as KF}from"fs";import{join as BF,basename as MF}from"path";import{createHash as LF}from"crypto";var J2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),_2=($)=>typeof $==="number"&&Number.isFinite($),C2=($)=>typeof $==="string",NF=/^v?\d+\.\d+\.\d+$/,OF=new Set(["birth","doubled","peak","current"]);function gW($){return J2($)&&C2($.version)&&NF.test($.version)&&_2($.score)}var DF=($)=>_2($.birthDNA)?$.birthDNA:_2($.birthWeight)?$.birthWeight:null,IF=($)=>J2($)&&_2($.birthDNA)&&C2($.born),yW=($)=>J2($)&&C2($.born)&&_2($.birthDNA)&&_2($.lastScore)&&C2($.endedAt),TF=($)=>Array.isArray($)&&$.length>0&&$.every(gW),AF=($)=>J2($)&&_2($.score)&&C2($.version),CF=($)=>J2($)&&Array.isArray($.milestones)&&$.milestones.every(J2);function kW($){return J2($)&&IF($.birthCertificate)&&TF($.versions)&&AF($.current)&&CF($.growth)}function t3($){try{return KF($),!0}catch{return!1}}var e3=($)=>`${JSON.stringify($,null,2)}
244
- `,_F=new Set(["version","score","lastSync"]),RF=new Set(["type","score","date","version","label","emoji"]),bW=($,Z)=>Object.keys($).every((z)=>Z.has(z)),$9={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},hW=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),fW=($)=>bW($.current,_F)&&hW($).every((Z)=>bW(Z,RF)),FF=($)=>hW($).every((Z)=>Z.label===$9[Z.type].label&&Z.emoji===$9[Z.type].emoji);function PF($){return fW($)&&FF($)}var SF=".faf-dna is not in faf's shape: faf reads it and leaves it as it is.",EF=".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.",jF=".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.",wF=".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.",xF=".faf-dna has no birth certificate faf can read: faf leaves it as it is.";function yF($){if(!Array.isArray($))return[];return $.filter((Z)=>J2(Z)&&C2(Z.type)&&OF.has(Z.type)&&_2(Z.score))}var r6=($,Z="")=>C2($)?$:Z;function kF($,Z){if(!Array.isArray($))return[];return $.filter(gW).map((z)=>({version:z.version,timestamp:r6(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(C2):[],growth:_2(z.growth)?z.growth:z.score-Z}))}function bF($,Z,z,Q){return{version:r6($.version,Z?.version??"v1.0.0"),score:_2($.score)?$.score:Z?.score??z,lastSync:r6($.lastSync,Q)}}function vW($){if(!J2($)||!J2($.birthCertificate))return null;let Z=$.birthCertificate,z=DF(Z);if(z===null)return null;let Q=r6(Z.born),X=kF($.versions,z),J=bF(J2($.current)?$.current:{},X[X.length-1],z,Q),Y=J2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"||Z.birthWeightSource==="legacy"?"legacy":"init",projectDNA:r6(Z.projectDNA),certificate:r6(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:_2(Y.daysActive)?Y.daysActive:0,milestones:yF(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:r6($.lastModified,Q),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(yW)?{priorLineage:$.priorLineage.filter(yW)}:{}}}class u2{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=BF($,".faf-dna")}exists(){let $=xW(this.dnaPath);if(!$&&!t3(this.dnaPath))this.sawNoFile=!0;return $}endingLineage(){let Z=this.dna??(()=>{let Q=this.read();return Q===null?null:vW(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(!t3(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:C2($.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=C2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(C2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!xW(this.dnaPath)){if(!t3(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(kW(z)&&e3(z)===Z&&PF(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=vW(z),this.reason=!this.dna?xF:!kW(z)?SF:e3(z)!==Z?EF:fW(z)?wF:jF;return this.text=Z,this.dna}read(){let $;try{$=z0(l(this.projectPath,".faf-dna"))}catch(Z){return this.reason=Z instanceof Error?Z.message:String(Z),null}try{return{text:$,raw:JSON.parse($)}}catch{return this.reason=".faf-dna is not JSON: faf leaves it as it is.",null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString();let $=e3(this.dna),Z=this.text??(this.sawNoFile?null:y0(l(this.projectPath,".faf-dna")));a(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return LF("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=MF(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,...$9[U]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))J("doubled");let Y=Q.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)Q.splice(Q.indexOf(Y),1);J("peak")}let W=Q.findIndex((U)=>U.type==="current");if(W>=0)Q.splice(W,1);J("current")}}i();i();import{statSync as uW}from"fs";import{homedir as vF}from"os";import{parse as gF,resolve as mW}from"path";function cW($,Z){try{let z=uW($,{bigint:!0}),Q=uW(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function hF($){let Z=mW($),z=mW(vF()),Q=gF(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if(cW(Z,z))return"home";if(cW(Z,Q))return"root";return null}function k$($=process.cwd(),Z="faf"){let z=hF($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${I("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 fF}from"fs";import{dirname as uF,resolve as pW}from"path";function mF($,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 b$($){return $ instanceof b||$ instanceof h2}function B6($,Z){return $ instanceof b?`faf: ${$.message}${mF($,Z)}`:`faf: ${$.message}`}function Y2($){if($===void 0)return;let Z=uF(pW($)),z;try{z=fF(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 h2(pW($),`${Z} ${z} — nothing written`)}function Z9($={}){k$(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:lW(Z,$.output):lW(Z,"project.faf");if(cF(z)&&!$.force)console.error(`project.faf already exists. Use ${C("--force")} to overwrite.`),process.exit(1);Y2($.output);let Q=y$(Z);B0(z,Q,{replace:$.force===!0});let X=p(z),J=n(z,()=>N0(X)),Y=new u2(Z);if(!Y.exists()||$.force)Y.birth(J.score);if(console.log(`${I("created")} ${z}`),P0(J,z),console.log(M(` \uD83E\uDDEC Birth DNA ${J.score}% — your journey starts here (faf dna)`)),J.score<100)console.log(M(`
245
- run ${C("'faf go'")} to fill empty slots`))}i();function l5($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function dW(){let $=new u2(process.cwd());if(!$.load()){let W=$.readOnlyReason();console.error(W?`${C("×")} ${W}`:`${C("×")} No FAF DNA found. Run ${C("'faf init'")} to start your journey.`),process.exit(1)}let Z=$.getJourney(),z=$.getBirthDNADisplay(),Q=z.born.split("T")[0]||"unknown";console.log(),console.log(R0(C("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${I(C(Z))}`),console.log(),console.log(M(` Birth DNA ${z.birthDNA}% (born ${Q}) · current ${z.current}% · growth ${z.growth>=0?"+":""}${z.growth}%`));let X=$.readOnlyReason();if(X)console.log(M(` ${X} ${C("'faf init --force'")} starts a fresh lineage and keeps this one.`));let J=$.getLog();if(J.length>1){console.log(),console.log(M(" history:"));for(let W of J)console.log(M(` ${W}`))}let Y=$.load()?.priorLineage??[];if(Y.length>0){console.log(),console.log(M(` earlier ${Y.length===1?"life":"lives"}:`));for(let W of Y){let U=W.lastScore===W.birthDNA?`${W.birthDNA}%`:`${W.birthDNA}% → ${W.lastScore}%`;console.log(M(` ${U} born ${W.born.slice(0,10)}, reset ${W.endedAt.slice(0,10)} ${W.certificate}`))}}console.log()}import{existsSync as pF}from"fs";import{join as lF}from"path";i();function d5(){k$(process.cwd(),"faf auto");let $=process.cwd(),Z=lF($,"project.faf");if(pF(Z)){let J=r(Z);n(Z,()=>F0(p(Z)));let Y=[],W=B0(Z,jW($,J),{onAliasKept:(U)=>Y.push(c0(U))});console.log(`${W?I("updated"):M("unchanged")} ${Z}`);for(let U of Y)console.log(M(` ${U}`))}else B0(Z,y$($)),console.log(`${I("created")} ${Z}`);let z=p(Z),Q=n(Z,()=>k0(F0(z))),X=new u2($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),l5(X);if(P0(Q,Z,!1,E5(z,Q,{outOfType:!1})),Q.score<100)console.log(M(`
246
- run ${C("'faf go'")} to reach ✪ Trophy`))}import{existsSync as tF}from"fs";import{join as eF}from"path";var v$="(terse — 3-4 words)",dF=[{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? ${v$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${v$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${v$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${v$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${v$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${v$}`,header:"How",type:"text",required:!0}],iF=[{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}],i5=[...dF,...iF],nF=new Map(i5.map(($)=>[$.path,$])),Jh=Object.fromEntries(i5.map(($)=>[$.path,$]));function n5($){let Z=nF.get($);if(Z)return Z.question;let z=G6.get($)??X0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function Q9($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||U0(Z)}return!1}function rF($,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 sF($){if($==="project.goal")return!0;return G6.get($)?.category==="human"}function oF($,Z=Q9){let z=[],Q=[];for(let X of i5){let J=rF($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(sF(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function aF($,Z,z=Q9){let Q=oF(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"?z9(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function z9($){return $.human.map((Z)=>({path:Z,question:n5(Z)}))}function iW($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??Q9,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=aF(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:z9(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:z9(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}i();function nW($={}){let Z=process.cwd(),z=eF(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;$P(iW({read:()=>tF(z)?{data:r(z),yaml:p(z)}:{data:{},yaml:""},score:(J)=>J?n(z,()=>k0(F0(J))).score:0,runAuto:()=>d5()},{maxRounds:Q}))}function $P($){if($.history.length>1)console.log(M(`
247
- climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${I("done")} — ✪ 100% AI-readiness. The .faf is complete.`);break;case"needs-human":{let Z=$.ask.length;console.log(`${C("Sourced everything detection can.")} ${Z} question${Z===1?"":"s"} only you can answer:`);for(let z of $.ask)console.log(` ${M("•")} ${z.question}`);console.log(M(`
248
- Answer with ${C("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${C(`Stopped at ${$.score}%.`)} The remaining gaps need evidence detection couldn't find, and there's nothing only you can answer. Add the missing manifests/README, then re-run.`);break;case"capped":console.log(`${C(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${C("'faf loop'")} to continue, or raise ${M("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${C("'faf init'")} first.`);break}}import{existsSync as lP}from"fs";import{join as LU,dirname as dP}from"path";import{existsSync as FP,statSync as Fh}from"fs";import{join as QU}from"path";import{dirname as eW,resolve as $U}from"path";var sW=100;var ZP="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",zP=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${ZP})(?=\\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")],QP=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],XP=["","-->","?>",">","]]>"],JP=/[#`~*+_=<>0-9-]/,YP=/(\d{1,9})([.)])/y,WP=/#{1,6}(?:[ \t]+|$)/y,UP=/`{3,}(?!.*`)|~{3,}/y,GP=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,VP=/(?:=+|-+)[ \t]*$/y,qP=/[^ \t\f\v\r\n]/;function G4($,Z,z){return $.lastIndex=z,$.exec(Z)}var HP=($)=>$==="quote"||$==="list"||$==="item";function KP($){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 g$=($)=>$===" "||$==="\t";function BP($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var rW=($)=>$==="paragraph"||$==="code"||$==="html";function MP($){if($.kind==="list"||$.kind==="item")return{...$,list:{...$.list}};if($.kind==="code")return{...$,fence:$.fence&&{...$.fence}};return{...$}}class R2{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 R2(this.containers);return $.stack=this.stack.map(MP),$.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}>`:XP[$.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"&&rW(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!JP.test(this.ln.charAt(Q)))break;let X=0;for(let J of this.starts)if(X=J(Z),X!==0)break;if(X===0)break;this.noteOverflow(Q,X),Z=this.tip,z=X===2}if(!z)this.advanceNextNonspace();return Z}noteOverflow($,Z){if(Z===1&&this.limit>=0&&this.overflow<0&&this.stack.length-1>this.limit)this.overflow=$}addText($){if($.kind==="code")this.hiddenIn=$.fence?"code fence":"indented code";else if($.kind==="html")this.addHtmlLine($);else if(!rW($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=QP[$.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),g$(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?G4(GP,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&&g$(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??=KP(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),g$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!G4(WP,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:G4(UP,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=zP[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!=="-"||!G4(VP,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||g$(Q)))return null;if(Z&&!qP.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"?G4(YP,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&&g$(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,g$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!BP(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),HP($.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 m2="<!-- faf:start -->",c2="<!-- faf:end -->",oW="\uFEFF";function s6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var W2=($)=>$.replace(/\r?\n$|\r$/,""),ZU=($)=>W2($).replace(/^\uFEFF/,"").trimEnd();function*X9($){let Z=0;for(let z of s6($)){let Q=W2(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 LP($,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 J9($,Z,z){let[Q,X]=[new R2(!0),new R2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of X9($)){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)LP(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 aW=($)=>(Z)=>Z===$;function q4($,Z=m2,z=c2){return J9($,aW(Z),aW(z))}function tW($,Z){let z=[];for(let Q of[!0,!1]){let X=new R2(Q);for(let J of s6($))X.line(W2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var NP=16;function OP($){let Z=new R2(!0);return $.map((z)=>{let Q=Z.overflowAt(W2(z),NP),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(W2(X)),X})}function DP($,Z,z){let X=OP(s6($).map((Y)=>{let W=ZU(Y);return W===Z||W===z?` ${Y}`:Y})).join(""),J=tW(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
249
- ${J[0]}`,W=tW(Y,z);if(W.length>=J.length)break;X=Y,J=W}return X}function IP($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=s6(Q).map((J)=>W2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
243
+ `).replace(/<[^>]+>/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").trim()}function i6($){return $.replace(/\s+/g," ").replace(/[#*`>]/g,"").trim().slice(0,280)}function VF($){if(!$)return 0;return($.match(/\[[^\]]*\]\([^)]*\)/g)??[]).join("").length/$.length}function k$($,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||VF(Q[2])>0.4)return null;return{body:i6(Q[2]),heading:Q[1].trim()}}function HF($){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 V4($,Z,z=30){for(let Q of Z){let X=$.match(Q);if(X&&X[1]&&X[1].trim().length>=z)return i6(X[1])}return null}function KF($,Z){if($?.description&&$.description.length>20)return v0(i6($.description),"package.json:description",0.95);let z=k$(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("#")&&!HF(J));if(Q)return v0(i6(Q),"README:first-paragraph",0.5);let X=V4(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 qF($){let Z=k$($,"Audience|Who|Who is this for|Who it.s for");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=V4($,[/\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 BF($){let Z=k$($,"Why|Mission|Motivation|Rationale|Vision");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=V4($,[/(?: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 MF($,Z){let z=typeof $?.repository==="string"?$.repository:$?.repository?.url;if(z)return v0(i6(z.replace(/^git\+/,"").replace(/\.git$/,"")),"package.json:repository",0.95);if($?.homepage)return v0(i6($.homepage),"package.json:homepage",0.9);let Q=V4(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 LF($){let Z=k$($,"Timeline|Status|Release|Roadmap");if(Z)return v0(Z.body,`README:## ${Z.heading}`,0.8);let z=V4($,[/\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 NF($,Z){let z=$?.scripts?Object.keys($.scripts):[],Q=["start","dev","build"].filter((Y)=>z.includes(Y));if(Q.length)return v0(i6(Q.map((Y)=>`npm run ${Y}`).join(", ")),"package.json:scripts",0.9);let X=k$(Z,"Usage|Getting Started|Install|Installation|Quick Start");if(X)return v0(X.body,`README:## ${X.heading}`,0.8);let J=k$(Z,"Architecture|Approach|How it works|Methodology|How");return J?v0(J.body,`README:## ${J.heading}`,0.7):null}function b$($){let Z=yW($),z=e3($),Q={};if(z.stack)Q.stack=z.stack;if(z.commands)Q.commands=z.commands;if(z.security)Q.security=z.security;let X={};if(z.project)X.project=z.project;if(z.human_context)X.human_context=z.human_context;let J=M6(M6(Q,Z),X);FF(J);let W=(Z._meta?.found??[]).some((G)=>G.startsWith("polyglot:")),U=M6(J,Z9($));return M6(U,{human_context:z9($,{toolingRoot:W})})}function hW($,Z){let z=RF(n1(Z,"updateExistingFaf: the existing .faf")),{data:Q,facts:X}=i3($),J=Q,Y=M6(z,e3($)),W=M6(Y,J),U=M6(W,Z9($)),G=IF(M6(U,{human_context:z9($)}),z),V=TF(OF(Z,z,J)?AF(gW(G,z),z,X):gW(G,z),z);return nY(dY(Z,V))}function OF($,Z,z){if(!G0(l0(Z,"project.type"))){let X=Z4($)?.text;return X===void 0||!g3(X)}return!(z._meta?.found??[]).includes(S$)}function Q9($){return $.canonical?[$.path,$.canonical]:[$.path]}function l0($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)?X[Q]:void 0}function n6($,Z,z){let[Q,X]=Z.split("."),J=$[Q];if(!$0(J))return;if(z===void 0?!(X in J):J[X]===z)return;let Y={...J};if(z===void 0)delete Y[X];else Y[X]=z;$[Q]=Y}var r6=($)=>typeof $==="string"&&$.trim()===s1;function DF($,Z){let z=Z.map((Q)=>l0($,Q));return z.some(r6)&&z.every((Q)=>G0(Q)||r6(Q))}function gW($,Z){let z={...$};for(let Q of J0){let X=Q9(Q);if(!DF(Z,X))continue;for(let J of X){let Y=l0(Z,J);if(l0(z,J)!==Y)n6(z,J,Y)}}return z}function s6($,Z){let[z,Q]=Z.split("."),X=$[z];return $0(X)&&Object.prototype.hasOwnProperty.call(X,Q)}function IF($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!s6(Z,Q.canonical)||s6(Z,Q.path))continue;let X=l0(z,Q.path);n6(z,Q.path,void 0);let J=l0(z,Q.canonical);if(d5(X)&&G0(J))n6(z,Q.canonical,X)}return z}function TF($,Z){let z={...$};for(let Q of J0){if(!Q.canonical||!s6(Z,Q.canonical)||s6(Z,Q.path))continue;let X=l0(z,Q.canonical);if(d5(X)||r6(X))n6(z,Q.path,X)}return z}function AF($,Z,z={}){let Q=$.project,X=$0(Q)?Q.type:void 0,J={...$};for(let Y of J0){if(Y.category==="human"||Y.category==="project")continue;let W=m6(X,Y);if(W===null)return $;if(W)CF(J,Z,Y,Y.path.startsWith("stack.")?z[Y.path.slice(6)]:void 0);else _F(J,Y)}return J}function CF($,Z,z,Q){let X=Q9(z);for(let Y of X)if(r6(l0($,Y))&&!r6(l0(Z,Y)))n6($,Y,s6(Z,Y)?l0(Z,Y):"");if(!d5(Q))return;let J=X.filter((Y)=>s6($,Y));if(J.some((Y)=>!G0(l0($,Y))))return;for(let Y of J.length>0?J:[z.path])n6($,Y,Q)}function _F($,Z){let z=Q9(Z).filter((X)=>s6($,X)),Q=(X)=>!G0(l0($,X))&&!r6(l0($,X));if(z.some(Q))return;for(let X of z.length>0?z:[Z.path])if(G0(l0($,X)))n6($,X,s1)}function RF($){let Z=$.project;if(Z===null||Z===void 0||$0(Z)||Array.isArray(Z))return $;return{...$,project:{name:String(Z)}}}function FF($){let Z=$.project?.type??"library",z=u6[Z]||u6.library;for(let Q of J0){if(z.includes(Q.category))continue;let[X,J]=Q.path.split(".");if(X==="stack"&&$.stack)$.stack[J]="slotignored";if(X==="monorepo"&&$.monorepo)$.monorepo[J]="slotignored"}}function M6($,Z){return fW($,Z,"")}function PF($){let Z=H6.get($);return Z!==void 0&&Z.category!=="human"}function d5($){if(typeof $==="number"||typeof $==="boolean")return!0;return typeof $==="string"&&$.trim()!==""&&!G0($)&&!r6($)}function SF($,Z){return PF($)&&d5(Z)}function fW($,Z,z){let Q={...$};for(let[X,J]of Object.entries(Z)){let Y=Q[X],W=z?`${z}.${X}`:X;if(W==="_meta"&&Y!==void 0)continue;if(P$(Y)){if(SF(W,J))Q[X]=J;continue}if(G0(Y))Q[X]=J;else if($0(J)&&$0(Y))Q[X]=fW(Y,J,W)}return Q}import{existsSync as uW,lstatSync as EF}from"fs";import{join as jF,basename as wF}from"path";import{createHash as xF}from"crypto";var W2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($),R2=($)=>typeof $==="number"&&Number.isFinite($),_2=($)=>typeof $==="string",yF=/^v?\d+\.\d+\.\d+$/,kF=new Set(["birth","doubled","peak","current"]);function dW($){return W2($)&&_2($.version)&&yF.test($.version)&&R2($.score)}var bF=($)=>R2($.birthDNA)?$.birthDNA:R2($.birthWeight)?$.birthWeight:null,vF=($)=>W2($)&&R2($.birthDNA)&&_2($.born),mW=($)=>W2($)&&_2($.born)&&R2($.birthDNA)&&R2($.lastScore)&&_2($.endedAt),gF=($)=>Array.isArray($)&&$.length>0&&$.every(dW),hF=($)=>W2($)&&R2($.score)&&_2($.version),fF=($)=>W2($)&&Array.isArray($.milestones)&&$.milestones.every(W2);function cW($){return W2($)&&vF($.birthCertificate)&&gF($.versions)&&hF($.current)&&fF($.growth)}function X9($){try{return EF($),!0}catch{return!1}}var J9=($)=>`${JSON.stringify($,null,2)}
244
+ `,uF=new Set(["version","score","lastSync"]),mF=new Set(["type","score","date","version","label","emoji"]),pW=($,Z)=>Object.keys($).every((z)=>Z.has(z)),Y9={birth:{label:"Birth",emoji:"\uD83D\uDC23"},doubled:{label:"Doubled",emoji:"2️⃣"},peak:{label:"Peak",emoji:"\uD83C\uDFD4️"},current:{label:"Current",emoji:"\uD83D\uDCCD"}},iW=($)=>$.growth.milestones.filter((Z)=>Z.type==="peak"||Z.type==="current"),nW=($)=>pW($.current,uF)&&iW($).every((Z)=>pW(Z,mF)),cF=($)=>iW($).every((Z)=>Z.label===Y9[Z.type].label&&Z.emoji===Y9[Z.type].emoji);function pF($){return nW($)&&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)=>W2(Z)&&_2(Z.type)&&kF.has(Z.type)&&R2(Z.score))}var o6=($,Z="")=>_2($)?$:Z;function oF($,Z){if(!Array.isArray($))return[];return $.filter(dW).map((z)=>({version:z.version,timestamp:o6(z.timestamp),score:z.score,changes:Array.isArray(z.changes)?z.changes.filter(_2):[],growth:R2(z.growth)?z.growth:z.score-Z}))}function aF($,Z,z,Q){return{version:o6($.version,Z?.version??"v1.0.0"),score:R2($.score)?$.score:Z?.score??z,lastSync:o6($.lastSync,Q)}}function lW($){if(!W2($)||!W2($.birthCertificate))return null;let Z=$.birthCertificate,z=bF(Z);if(z===null)return null;let Q=o6(Z.born),X=oF($.versions,z),J=aF(W2($.current)?$.current:{},X[X.length-1],z,Q),Y=W2($.growth)?$.growth:{};return{birthCertificate:{born:Q,birthDNA:z,birthDNASource:Z.birthDNASource==="legacy"||Z.birthWeightSource==="legacy"?"legacy":"init",projectDNA:o6(Z.projectDNA),certificate:o6(Z.certificate)},versions:X,current:J,growth:{totalGrowth:J.score-z,daysActive:R2(Y.daysActive)?Y.daysActive:0,milestones:sF(Array.isArray(Y.milestones)?Y.milestones:$.milestones)},lastModified:o6($.lastModified,Q),format:"faf-dna-v1",...Array.isArray($.priorLineage)&&$.priorLineage.some(mW)?{priorLineage:$.priorLineage.filter(mW)}:{}}}class c2{projectPath;dnaPath;dna=null;own=!1;text;reason=null;sawNoFile=!1;constructor($){this.projectPath=$,this.dnaPath=jF($,".faf-dna")}exists(){let $=uW(this.dnaPath);if(!$&&!X9(this.dnaPath))this.sawNoFile=!0;return $}endingLineage(){let Z=this.dna??(()=>{let Q=this.read();return Q===null?null:lW(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(!X9(this.dnaPath))this.sawNoFile=!0;let z=new Date().toISOString();return this.own=!0,this.dna={birthCertificate:{born:z,birthDNA:$,birthDNASource:"init",projectDNA:this.generateProjectDNA(),certificate:this.generateCertificate()},versions:[{version:"v1.0.0",timestamp:z,score:$,changes:["Birth — initial context"],growth:0}],current:{version:"v1.0.0",score:$,lastSync:z},growth:{totalGrowth:0,daysActive:0,milestones:[{type:"birth",score:$,date:z,version:"v1.0.0",label:"Birth",emoji:"\uD83D\uDC23"}]},lastModified:z,format:"faf-dna-v1",...Z.length>0?{priorLineage:Z}:{}},this.save(),this.dna}isFafShape(){return this.load()!==null&&this.own}readOnlyReason(){return this.load(),this.own?null:this.reason}recordGrowth($,Z){if(!this.dna&&!this.load())return null;if(!this.own)return null;let z=this.dna;if($===z.current.score)return z;let Q=new Date().toISOString(),X=z.birthCertificate.birthDNA,J=$-X,Y=this.incrementVersion(z.versions[z.versions.length-1].version);return z.versions.push({version:Y,timestamp:Q,score:$,changes:Z,growth:J}),z.current={version:Y,score:$,lastSync:Q},z.growth.totalGrowth=J,z.growth.daysActive=this.daysSince(z.birthCertificate.born),this.updateMilestones($,Y,Q),this.save(),z}getJourney(){if(!this.dna&&!this.load())return"";let $=this.dna,Z=$.birthCertificate.birthDNA,z=$.growth.milestones.find((J)=>J.type==="peak"),Q=$.current.score,X=`${Z}%`;if(z&&z.score!==Z){if(X+=` → ${z.score}%`,Q<z.score)X+=` ← ${Q}%`}else if(Q!==Z)X+=` → ${Q}%`;return X}getBirthDNADisplay(){if(!this.dna&&!this.load())return null;let $=this.dna;return{current:$.current.score,birthDNA:$.birthCertificate.birthDNA,growth:$.current.score-$.birthCertificate.birthDNA,born:_2($.birthCertificate.born)?$.birthCertificate.born:""}}getLog(){if(!this.dna&&!this.load())return[];return this.dna.versions.map(($)=>{let Z=$.growth>50?"\uD83D\uDE80":$.growth>20?"\uD83D\uDCC8":"\uD83D\uDCCA",z=_2($.timestamp)?$.timestamp.split("T")[0]:"",Q=Array.isArray($.changes)?$.changes.filter(_2).join(", "):"";return`${$.version} — ${$.score}% ${Z} (${z}) ${Q}`})}load(){if(this.dna)return this.dna;if(!uW(this.dnaPath)){if(!X9(this.dnaPath))this.sawNoFile=!0;return null}let $=this.read();if($===null)return null;let{text:Z,raw:z}=$;if(cW(z)&&J9(z)===Z&&pF(z))this.own=!0,this.reason=null,this.dna=z;else this.own=!1,this.dna=lW(z),this.reason=!this.dna?rF:!cW(z)?lF:J9(z)!==Z?dF:nW(z)?nF:iF;return this.text=Z,this.dna}read(){let $;try{$=Q0(l(this.projectPath,".faf-dna"))}catch(Z){return this.reason=Z instanceof Error?Z.message:String(Z),null}try{return{text:$,raw:JSON.parse($)}}catch{return this.reason=".faf-dna is not JSON: faf leaves it as it is.",null}}save(){if(!this.dna)return;this.dna.lastModified=new Date().toISOString();let $=J9(this.dna),Z=this.text??(this.sawNoFile?null:k0(l(this.projectPath,".faf-dna")));a(this.dnaPath,$,{root:this.projectPath,expect:Z}),this.text=$,this.sawNoFile=!1}generateProjectDNA(){return xF("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=wF(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,...Y9[U]});if($>=this.dna.birthCertificate.birthDNA*2&&$>0&&!X("doubled"))J("doubled");let Y=Q.find((U)=>U.type==="peak");if(!Y||$>Y.score){if(Y)Q.splice(Q.indexOf(Y),1);J("peak")}let W=Q.findIndex((U)=>U.type==="current");if(W>=0)Q.splice(W,1);J("current")}}i();i();import{statSync as rW}from"fs";import{homedir as tF}from"os";import{parse as eF,resolve as sW}from"path";function oW($,Z){try{let z=rW($,{bigint:!0}),Q=rW(Z,{bigint:!0});return z.isDirectory()&&z.ino!==0n&&z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function $P($){let Z=sW($),z=sW(tF()),Q=eF(Z).root;if(Z===z)return"home";if(Z===Q||Z==="/"||/^[A-Za-z]:[\\/]?$/.test(Z))return"root";if(oW(Z,z))return"home";if(oW(Z,Q))return"root";return null}function v$($=process.cwd(),Z="faf"){let z=$P($);if(z===null)return;let Q=z==="home"?"your home directory (~)":"the filesystem root";console.error(`${T("faf")}: ${Q} is not a project.`),console.error(""),console.error(` ${C("cd")} into a real repo (or any folder you mean to own), then run again:`),console.error(M(" cd /path/to/your-project")),console.error(M(` ${Z}`)),console.error(""),console.error(M(" Home will never be a git repo for this. project.faf belongs with the code.")),process.exit(1)}import{statSync as ZP}from"fs";import{dirname as zP,resolve as aW}from"path";function QP($,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 g$($){return $ instanceof b||$ instanceof u2}function L6($,Z){return $ instanceof b?`faf: ${$.message}${QP($,Z)}`:`faf: ${$.message}`}function U2($){if($===void 0)return;let Z=zP(aW($)),z;try{z=ZP(Z).isDirectory()?null:"is not a folder"}catch(Q){let X=Q?.code;if(X!=="ENOENT"&&X!=="ENOTDIR")throw Q;z="does not exist"}if(z!==null)throw new u2(aW($),`${Z} ${z} — nothing written`)}function W9($={}){v$(process.cwd(),"faf init");let Z=process.cwd(),z=$.output?$.output.endsWith(".faf")?$.output:tW(Z,$.output):tW(Z,"project.faf");if(XP(z)&&!$.force)console.error(`project.faf already exists. Use ${C("--force")} to overwrite.`),process.exit(1);U2($.output);let Q=b$(Z);M0(z,Q,{replace:$.force===!0});let X=p(z),J=r(z,()=>O0(X)),Y=new c2(Z);if(!Y.exists()||$.force)Y.birth(J.score);if(console.log(`${T("created")} ${z}`),S0(J,z),console.log(M(` \uD83E\uDDEC Birth DNA ${J.score}% — your journey starts here (faf dna)`)),J.score<100)console.log(M(`
245
+ run ${C("'faf go'")} to fill empty slots`))}i();function i5($){let Z=$.readOnlyReason();if(Z)console.error(`faf: ${Z}`)}function eW(){let $=new c2(process.cwd());if(!$.load()){let W=$.readOnlyReason();console.error(W?`${C("×")} ${W}`:`${C("×")} No FAF DNA found. Run ${C("'faf init'")} to start your journey.`),process.exit(1)}let Z=$.getJourney(),z=$.getBirthDNADisplay(),Q=z.born.split("T")[0]||"unknown";console.log(),console.log(F0(C("\uD83E\uDDEC YOUR FAF DNA"))),console.log(),console.log(` ${T(C(Z))}`),console.log(),console.log(M(` Birth DNA ${z.birthDNA}% (born ${Q}) · current ${z.current}% · growth ${z.growth>=0?"+":""}${z.growth}%`));let X=$.readOnlyReason();if(X)console.log(M(` ${X} ${C("'faf init --force'")} starts a fresh lineage and keeps this one.`));let J=$.getLog();if(J.length>1){console.log(),console.log(M(" history:"));for(let W of J)console.log(M(` ${W}`))}let Y=$.load()?.priorLineage??[];if(Y.length>0){console.log(),console.log(M(` earlier ${Y.length===1?"life":"lives"}:`));for(let W of Y){let U=W.lastScore===W.birthDNA?`${W.birthDNA}%`:`${W.birthDNA}% → ${W.lastScore}%`;console.log(M(` ${U} born ${W.born.slice(0,10)}, reset ${W.endedAt.slice(0,10)} ${W.certificate}`))}}console.log()}import{existsSync as JP}from"fs";import{join as YP}from"path";i();function n5(){v$(process.cwd(),"faf auto");let $=process.cwd(),Z=YP($,"project.faf");if(JP(Z)){let J=s(Z);r(Z,()=>P0(p(Z)));let Y=[],W=M0(Z,hW($,J),{onAliasKept:(U)=>Y.push(p0(U))});console.log(`${W?T("updated"):M("unchanged")} ${Z}`);for(let U of Y)console.log(M(` ${U}`))}else M0(Z,b$($)),console.log(`${T("created")} ${Z}`);let z=p(Z),Q=r(Z,()=>b0(P0(z))),X=new c2($);if(X.exists())X.recordGrowth(Q.score,["faf auto"]),i5(X);if(S0(Q,Z,!1,w5(z,Q,{outOfType:!1})),Q.score<100)console.log(M(`
246
+ run ${C("'faf go'")} to reach ✪ Trophy`))}import{existsSync as BP}from"fs";import{join as MP}from"path";var h$="(terse — 3-4 words)",WP=[{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? ${h$}`,header:"Who",type:"text",required:!0},{path:"human_context.what",question:`What are they building? ${h$}`,header:"What",type:"text",required:!0},{path:"human_context.why",question:`Why does it exist? ${h$}`,header:"Why",type:"text",required:!0},{path:"human_context.where",question:`Where does it run or ship? ${h$}`,header:"Where",type:"text",required:!0},{path:"human_context.when",question:`When — timeline or stage? ${h$}`,header:"When",type:"text",required:!0},{path:"human_context.how",question:`How is it built or used? ${h$}`,header:"How",type:"text",required:!0}],UP=[{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}],r5=[...WP,...UP],GP=new Map(r5.map(($)=>[$.path,$])),ih=Object.fromEntries(r5.map(($)=>[$.path,$]));function s5($){let Z=GP.get($);if(Z)return Z.question;let z=H6.get($)??J0.find((Q)=>Q.canonical===$);return z?`${z.description}?`.replace(/\?\?$/,"?"):`${$}?`}function G9($){if($===null||$===void 0)return!0;if(typeof $==="string"){let Z=$.trim();return Z===""||G0(Z)}return!1}function VP($,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 HP($){if($==="project.goal")return!0;return H6.get($)?.category==="human"}function KP($,Z=G9){let z=[],Q=[];for(let X of r5){let J=VP($,X.path);if(J==="slotignored")continue;if(!Z(J))continue;(HP(X.path)?z:Q).push(X.path)}return{human:z,sourceable:Q}}function qP($,Z,z=G9){let Q=KP(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"?U9(Q):[];return{status:X,score:$,gaps:Q,ask:J}}function U9($){return $.human.map((Z)=>({path:Z,question:s5(Z)}))}function $U($,Z={}){let z=Math.max(1,Z.maxRounds??5),Q=Z.isEmpty??G9,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=qP(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:U9(V.gaps)}:{status:"stuck",score:G,rounds:J,history:X,ask:[]};if(J>=z)return{status:"capped",score:G,rounds:J,history:X,ask:U9(V.gaps)};$.runAuto(),J++}return{status:"capped",score:X[X.length-1]??0,rounds:J,history:X,ask:[]}}i();function ZU($={}){let Z=process.cwd(),z=MP(Z,"project.faf"),Q=$.rounds?Math.max(1,parseInt($.rounds,10)||5):5;LP($U({read:()=>BP(z)?{data:s(z),yaml:p(z)}:{data:{},yaml:""},score:(J)=>J?r(z,()=>b0(P0(J))).score:0,runAuto:()=>n5()},{maxRounds:Q}))}function LP($){if($.history.length>1)console.log(M(`
247
+ climb: ${$.history.join("% → ")}%`));switch(console.log(""),$.status){case"done":console.log(`${T("done")} — ✪ 100% AI-readiness. The .faf is complete.`);break;case"needs-human":{let Z=$.ask.length;console.log(`${C("Sourced everything detection can.")} ${Z} question${Z===1?"":"s"} only you can answer:`);for(let z of $.ask)console.log(` ${M("•")} ${z.question}`);console.log(M(`
248
+ Answer with ${C("'faf go'")}, or fill them in project.faf directly.`));break}case"stuck":console.log(`${C(`Stopped at ${$.score}%.`)} The remaining gaps need evidence detection couldn't find, and there's nothing only you can answer. Add the missing manifests/README, then re-run.`);break;case"capped":console.log(`${C(`Stopped at ${$.score}% after ${$.rounds} rounds (the cap).`)} Re-run ${C("'faf loop'")} to continue, or raise ${M("--rounds")}.`);break;case"no-faf":console.log(`No project.faf, and none could be created here. Run ${C("'faf init'")} first.`);break}}import{existsSync as YS}from"fs";import{join as _U,dirname as WS}from"path";import{existsSync as cP,statSync as qf}from"fs";import{join as HU}from"path";import{dirname as WU,resolve as UU}from"path";var QU=100;var NP="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",OP=[/^<(script|pre|style|textarea)(?=\s|>|$)/i,/^<!--/,/^<\?/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp(`^</?(?:${NP})(?=\\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")],DP=[/<\/(?:script|pre|style|textarea)>/i,/-->/,/\?>/,/>/,/\]\]>/],IP=["","-->","?>",">","]]>"],TP=/[#`~*+_=<>0-9-]/,AP=/(\d{1,9})([.)])/y,CP=/#{1,6}(?:[ \t]+|$)/y,_P=/`{3,}(?!.*`)|~{3,}/y,RP=/(?:`{3,}|~{3,})(?=[ \t]*$)/y,FP=/(?:=+|-+)[ \t]*$/y,PP=/[^ \t\f\v\r\n]/;function H4($,Z,z){return $.lastIndex=z,$.exec(Z)}var SP=($)=>$==="quote"||$==="list"||$==="item";function EP($){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 f$=($)=>$===" "||$==="\t";function jP($,Z){if($==="document"||$==="quote"||$==="item")return Z!=="item";return $==="list"&&Z==="item"}var zU=($)=>$==="paragraph"||$==="code"||$==="html";function wP($){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(wP),$.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}>`:IP[$.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"&&zU(Z.kind);while(!z&&!this.deep){this.findNextNonspace();let Q=this.nextNonspace;if(!this.indented&&!TP.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(!zU($.kind)&&this.offset<this.ln.length&&!this.blank)this.addChild({kind:"paragraph"})}addHtmlLine($){if($.type>5)return;let Z=DP[$.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),f$(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?H4(RP,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&&f$(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??=EP(this.ln),this.breaks[this.nextNonspace]===1}startQuote(){if(!this.containers||this.indented||this.ch!==">")return 0;if(this.advanceNextNonspace(),this.advanceOffset(1,!1),f$(this.ln[this.offset]))this.advanceOffset(1,!0);return this.closeUnmatched(),this.addChild({kind:"quote"}),1}startHeading(){if(this.indented||this.ch!=="#"||!H4(CP,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:H4(_P,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=OP[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!=="-"||!H4(FP,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||f$(Q)))return null;if(Z&&!PP.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"?H4(AP,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&&f$(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,f$(this.ln[this.offset]))this.advanceOffset(1,!0);return $+1}addChild($){while(!jP(this.tip.kind,$.kind))this.stack.pop();if(this.tip.hasChild=!0,this.stack.push($),SP($.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 -->",XU="\uFEFF";function a6($){return $.match(/[^\r\n]*(?:\r\n|\r|\n|$)/g)?.filter((Z,z,Q)=>Z!==""||z<Q.length-1)??[]}var G2=($)=>$.replace(/\r?\n$|\r$/,""),GU=($)=>G2($).replace(/^\uFEFF/,"").trimEnd();function*V9($){let Z=0;for(let z of a6($)){let Q=G2(z),X=Z===0&&Q.charCodeAt(0)===65279?1:0;yield{offset:Z,from:Z+X,to:Z+Q.length,content:Q.slice(X)},Z+=z.length}}function xP($,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 H9($,Z,z){let[Q,X]=[new F2(!0),new F2(!1)].map((J)=>({reader:J,start:-1,found:null}));for(let J of V9($)){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)xP(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 JU=($)=>(Z)=>Z===$;function q4($,Z=p2,z=l2){return H9($,JU(Z),JU(z))}function YU($,Z){let z=[];for(let Q of[!0,!1]){let X=new F2(Q);for(let J of a6($))X.line(G2(J));if(X.clone().line(Z)!==null)z.push(X.closer())}return z}var yP=16;function kP($){let Z=new F2(!0);return $.map((z)=>{let Q=Z.overflowAt(G2(z),yP),X=z;if(Q>=0){let J=/^\d{1,9}(?=[.)])/.exec(z.slice(Q)),Y=J?Q+J[0].length:Q;X=`${z.slice(0,Y)}\\${z.slice(Y)}`}return Z.line(G2(X)),X})}function bP($,Z,z){let X=kP(a6($).map((Y)=>{let W=GU(Y);return W===Z||W===z?` ${Y}`:Y})).join(""),J=YU(X,z);while(J.length>0&&J[0]!==null){let Y=`${X}
249
+ ${J[0]}`,W=YU(Y,z);if(W.length>=J.length)break;X=Y,J=W}return X}function vP($,Z,z){let Q=$.slice(Z.length+1,$.length-z.length-1),X=a6(Q).map((J)=>G2(J)===""?`>${J}`:`> ${J}`).join("");return`${Z}
250
250
  ${X}
251
- ${z}`}function V4($,Z,z,Q=m2,X=c2,J="the file"){let Y=(U)=>{let G=`${$}${U}${z}`,V=q4(G,Q,X);return V&&V.start===$.length&&V.end===$.length+U.length?G:null},W=Y(Z)??Y(IP(Z,Q,X));if(W===null)throw new b("unplaceable",J,`${J}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return W}function Y9($,Z=m2,z=c2){return`${Z}
252
- ${DP($.trim(),Z,z)}
253
- ${z}`}function r5($,Z,z=m2,Q=c2,X){if($===null)return V4("",Z,`
254
- `,z,Q,X);let J=q4($,z,Q);if(J)return V4($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(oW)?oW:"";return V4(Y,Z,`
251
+ ${z}`}function K4($,Z,z,Q=p2,X=l2,J="the file"){let Y=(U)=>{let G=`${$}${U}${z}`,V=q4(G,Q,X);return V&&V.start===$.length&&V.end===$.length+U.length?G:null},W=Y(Z)??Y(vP(Z,Q,X));if(W===null)throw new b("unplaceable",J,`${J}: faf could not place its block where the next run finds it again — faf left it unchanged`,{onWrite:!0});return W}function K9($,Z=p2,z=l2){return`${Z}
252
+ ${bP($.trim(),Z,z)}
253
+ ${z}`}function o5($,Z,z=p2,Q=l2,X){if($===null)return K4("",Z,`
254
+ `,z,Q,X);let J=q4($,z,Q);if(J)return K4($.slice(0,J.start),Z,$.slice(J.end),z,Q,X);let Y=$.startsWith(XU)?XU:"";return K4(Y,Z,`
255
255
 
256
- ${$.slice(Y.length)}`,z,Q,X)}function M6($){try{return z0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function U2($,Z,z=m2,Q=c2,X={}){let J=Y9(Z,z,Q),Y=$U($),W=X.root??eW(Y),U=l(W,Y),G=M6(U);a(U,r5(G,J,z,Q,Y),{root:W,expect:G})}var TP="<!-- faf:";function AP($){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 CP($,Z){let z=[new R2(!0),new R2(!1)],Q=!1;for(let{content:X}of X9($)){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 _P($,Z,z){let Q=[new R2(!0),new R2(!1)];for(let{content:X}of X9($)){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 W9($,Z,z=m2,Q=c2){if(Z===null||q4(Z,z,Q))return null;let X=ZU(s6(Z)[0]??"");if(X.startsWith(TP)&&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=CP(Z,z);if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${sW} 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 ${AP(J)} and is left as you had it — delete it by hand if you no longer want it.`;if(_P(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 s5($,Z,z=m2,Q=c2,X={}){try{let J=$U($);return W9(Z,M6(l(X.root??eW(J),J)),z,Q)}catch{return null}}var RP=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 U9($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return RP.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function G0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function g0($){let Z=G6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return U9(z)}var G9=x0.claude,PP="STATUS: SYNC ACTIVE";function XU($){let Z=QU($,G9);if(!FP(Z))return null;return z0(l($,G9))}function JU($,Z){U2(QU($,G9),Z)}function p2($,Z={}){let z=String($.project?.name??"").trim(),Q=String($.project?.main_language??"").trim(),X=String($.project?.type??"").trim(),J=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[z,Q,X,J].join(" | ")} -->`,W=[];if(Z.doc)W.push(`doc=${Z.doc}`);else W.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")W.push(`score=${Z.score}`);if(W.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)W.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${W.join(" | ")} -->`;return`${Y}
257
- ${U}`}function YU($){let Z=[],z=$.project?.name??"Project",Q=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(p2($)),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(`**${g0(`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])=>`- **${g0(`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(`*${PP} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
258
- `)}function zU($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function o5($){let Z={project:{}},z=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(z)Z.project.name=zU(z[1].trim());if(!Z.project.name){let J=$.match(/\*\*Name:\*\*\s*(.+)/);if(J)Z.project.name=zU(J[1].trim())}let Q=$.match(/## What This Is\s*\n\s*\n(.+)/);if(Q)Z.project.goal=Q[1].trim();if(!Z.project.goal){let J=$.match(/\*\*What Building:\*\*\s*(.+)/);if(J)Z.project.goal=J[1].trim()}let X=$.match(/\*\*Language:\*\*\s*(.+)/);if(X)Z.project.main_language=X[1].trim();if(!Z.project.main_language){let J=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim()}return Z}import{existsSync as kh,lstatSync as KU,readFileSync as t5,realpathSync as V9,statSync as SP}from"fs";import{homedir as EP}from"os";import{basename as jP,dirname as q9,join as l2,resolve as a6}from"path";function o6($){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 L6($){return o6($).cmd}var WU=200,UU=200,GU=12,wP="# Project Context (from project.faf)",xP="*This section is managed by tri-sync.";function yP($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function kP($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=WU)return Z;return`${Z.slice(0,WU)}-${Math.abs(yP($)).toString(36)}`}function BU($){try{let Z=KU($);if(Z.isSymbolicLink()){let z=SP($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function VU($){try{return KU($).isFile()}catch{return!1}}function bP($){let Z=$;for(;;){if(BU(l2(Z,".git")))return Z;let z=q9(Z);if(z===Z)return null;Z=z}}function vP($){let Z;try{Z=t5(l2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=a6($,Z.slice(7).trim()),Q=l2(z,"commondir");if(!VU(Q))return $;let X=a6(z,t5(Q,"utf-8").trim());if(a6(q9(z))!==l2(X,"worktrees"))return $;let J=l2(z,"gitdir");if(!VU(J))return $;let Y=t5(J,"utf-8").trim();if(V9(a6(z,Y))!==l2(V9($),".git"))return $;if(jP(X)!==".git")return BU(l2(X,".git"))?$:X;return q9(X)}catch{return $}}function gP($){let Z=a6($);try{Z=V9.native(Z)}catch{}let z=bP(Z);return(z?vP(z):Z).normalize("NFC")}function hP($,Z={}){if(Z.memoryDir)return a6(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||l2(EP(),".claude");return l2(a6(z),"projects",kP(gP($)),"memory").normalize("NFC")}var fP=new Set(["target_user","core_problem","mission_purpose"]),uP=["who","what","why","where","when","how"];function mP($){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:** ${G0(Z.name)?Z.name:"Project"}`,...z.filter(([,Y])=>G0(Y)).map(([Y,W])=>`- **${Y}:** ${W}`),...a5("Stack",Object.entries($.stack??{}).filter(([Y,W])=>!fP.has(Y)&&G0(W)).map(([Y,W])=>`- **${g0(`stack.${Y}`)}:** ${W}`)),...a5("Context",uP.filter((Y)=>G0(Q[Y])).map((Y)=>`- **${g0(`human_context.${Y}`)}:** ${Q[Y]}`)),...a5("Commands",Object.entries($.commands??{}).filter(([,Y])=>G0(Y)).slice(0,GU).map(([Y,W])=>`- ${Y}: \`${L6(W)}\``)),...a5("Key files",X.filter(G0).slice(0,GU).map((Y)=>`- ${Y}`)),"","*faf keeps this block in step with project.faf. Everything outside it is Claude's own and is kept as written.*"].join(`
259
- `)}function a5($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function cP($){return J9($,(Z)=>Z.trimEnd()===wP,(Z)=>Z.startsWith(xP))}function qU($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function pP($,Z,z){if($===null)return{text:r5(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=q4($),X=Q??cP($);if(X){let Y=$.slice(0,X.start),W=$.slice(X.end);return{text:V4(Y,Z,W,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:W}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:r5($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function HU($){return $>UU?[`MEMORY.md is ${$} lines. Claude Code loads the first ${UU}; lines after that are kept in the file but not loaded.`]:[]}function MU($,Z,z={}){let Q=hP($,z);j0(Q);let X=l(Q,x0.memory),J=M6(X),Y=pP(J,Y9(mP(Z)),X);if(Y.text===J){let H=qU(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:H,warnings:HU(H)}}let W=a(X,Y.text,{root:Q,expect:J}),U=t5(W,"utf-8"),G=U===Y.text&&U.startsWith(Y.head)&&U.endsWith(Y.tail),V=qU(U),q=Y.action==="added"?W9(x0.memory,J):null;return{path:W,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...q?[q]:[],...HU(V)]}}i();function H4(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function H9($={}){let Z=process.cwd(),z=m(Z);if(!z)console.error(`Error: project.faf not found
256
+ ${$.slice(Y.length)}`,z,Q,X)}function N6($){try{return Q0($)}catch(Z){if(Z.code==="ENOENT")return null;throw Z}}function V2($,Z,z=p2,Q=l2,X={}){let J=K9(Z,z,Q),Y=UU($),W=X.root??WU(Y),U=l(W,Y),G=N6(U);a(U,o5(G,J,z,Q,Y),{root:W,expect:G})}var gP="<!-- faf:";function hP($){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 fP($,Z){let z=[new F2(!0),new F2(!1)],Q=!1;for(let{content:X}of V9($)){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 uP($,Z,z){let Q=[new F2(!0),new F2(!1)];for(let{content:X}of V9($)){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 q9($,Z,z=p2,Q=l2){if(Z===null||q4(Z,z,Q))return null;let X=GU(a6(Z)[0]??"");if(X.startsWith(gP)&&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=fP(Z,z);if(J==="too deep")return`${$}: faf's block is now on top; the file nests more than ${QU} 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 ${hP(J)} and is left as you had it — delete it by hand if you no longer want it.`;if(uP(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 a5($,Z,z=p2,Q=l2,X={}){try{let J=UU($);return q9(Z,N6(l(X.root??WU(J),J)),z,Q)}catch{return null}}var mP=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 B9($){return $.split("_").map((Z)=>{if(!Z)return Z;let z=Z.toUpperCase();return mP.has(z)?z:Z.charAt(0).toUpperCase()+Z.slice(1)}).join(" ")}function V0($){return typeof $==="string"&&$.trim()!==""&&$.trim()!=="slotignored"}function h0($){let Z=H6.get($);if(Z?.label)return Z.label;let z=$.includes(".")?$.slice($.lastIndexOf(".")+1):$;return B9(z)}var M9=y0.claude,pP="STATUS: SYNC ACTIVE";function KU($){let Z=HU($,M9);if(!cP(Z))return null;return Q0(l($,M9))}function qU($,Z){V2(HU($,M9),Z)}function d2($,Z={}){let z=String($.project?.name??"").trim(),Q=String($.project?.main_language??"").trim(),X=String($.project?.type??"").trim(),J=String($.project?.goal??"").trim(),Y=`<!-- faf: ${[z,Q,X,J].join(" | ")} -->`,W=[];if(Z.doc)W.push(`doc=${Z.doc}`);else W.push(`claim=${Z.claim??"project.faf"}`);if(typeof Z.score==="number")W.push(`score=${Z.score}`);if(W.push(`family=${Z.family??"FAF"}`),Z.siblings&&Z.siblings.length>0)W.push(`siblings=${Z.siblings.join(",")}`);let U=`<!-- faf: ${W.join(" | ")} -->`;return`${Y}
257
+ ${U}`}function BU($){let Z=[],z=$.project?.name??"Project",Q=$.project?.main_language??"",X=$.project?.goal??"";if(Z.push(d2($)),Z.push(""),Z.push(`# CLAUDE.md — ${z}`),Z.push(""),X)Z.push("## What This Is"),Z.push(""),Z.push(X),Z.push("");let J=$.stack??{},Y=[];if(Q)Y.push(`**Language:** ${Q}`);for(let[G,V]of Object.entries(J))if(V&&V!=="slotignored"&&String(V).trim())Y.push(`**${h0(`stack.${G}`)}:** ${V}`);if(Y.length>0){Z.push("## Stack"),Z.push("");for(let G of Y)Z.push(`- ${G}`);Z.push("")}let W=$.human_context??{},U=[["who",W.who],["what",W.what],["why",W.why],["where",W.where],["when",W.when],["how",W.how]].filter(([,G])=>G&&String(G).trim()).map(([G,V])=>`- **${h0(`human_context.${G}`)}:** ${V}`);if(U.length>0)Z.push("## Context"),Z.push(""),Z.push(...U),Z.push("");return Z.push("---"),Z.push(""),Z.push(`*${pP} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
258
+ `)}function VU($){return $.replace(/\s+v\d+(?:\.\d+)*\s*$/i,"").trim()}function t5($){let Z={project:{}},z=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(z)Z.project.name=VU(z[1].trim());if(!Z.project.name){let J=$.match(/\*\*Name:\*\*\s*(.+)/);if(J)Z.project.name=VU(J[1].trim())}let Q=$.match(/## What This Is\s*\n\s*\n(.+)/);if(Q)Z.project.goal=Q[1].trim();if(!Z.project.goal){let J=$.match(/\*\*What Building:\*\*\s*(.+)/);if(J)Z.project.goal=J[1].trim()}let X=$.match(/\*\*Language:\*\*\s*(.+)/);if(X)Z.project.main_language=X[1].trim();if(!Z.project.main_language){let J=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim()}return Z}import{existsSync as Tf,lstatSync as TU,readFileSync as $Z,realpathSync as L9,statSync as lP}from"fs";import{homedir as dP}from"os";import{basename as iP,dirname as N9,join as i2,resolve as e6}from"path";function t6($){let Z=String($??"").trim(),z=Z.indexOf(" — ");if(z<=0)return{cmd:Z,note:null};let Q=Z.slice(0,z).trim(),X=Z.slice(z+3).trim();if(!Q||!X)return{cmd:Z,note:null};return{cmd:Q,note:X}}function O6($){return t6($).cmd}var MU=200,LU=200,NU=12,nP="# Project Context (from project.faf)",rP="*This section is managed by tri-sync.";function sP($){let Z=0;for(let z=0;z<$.length;z++)Z=(Z<<5)-Z+$.charCodeAt(z)|0;return Z}function oP($){let Z=$.replace(/[^a-zA-Z0-9]/g,"-");if(Z.length<=MU)return Z;return`${Z.slice(0,MU)}-${Math.abs(sP($)).toString(36)}`}function AU($){try{let Z=TU($);if(Z.isSymbolicLink()){let z=lP($);return z.isDirectory()||z.isFile()}return Z.isDirectory()||Z.isFile()}catch{return!1}}function OU($){try{return TU($).isFile()}catch{return!1}}function aP($){let Z=$;for(;;){if(AU(i2(Z,".git")))return Z;let z=N9(Z);if(z===Z)return null;Z=z}}function tP($){let Z;try{Z=$Z(i2($,".git"),"utf-8").trim()}catch{return $}try{if(!Z.startsWith("gitdir:"))return $;let z=e6($,Z.slice(7).trim()),Q=i2(z,"commondir");if(!OU(Q))return $;let X=e6(z,$Z(Q,"utf-8").trim());if(e6(N9(z))!==i2(X,"worktrees"))return $;let J=i2(z,"gitdir");if(!OU(J))return $;let Y=$Z(J,"utf-8").trim();if(L9(e6(z,Y))!==i2(L9($),".git"))return $;if(iP(X)!==".git")return AU(i2(X,".git"))?$:X;return N9(X)}catch{return $}}function eP($){let Z=e6($);try{Z=L9.native(Z)}catch{}let z=aP(Z);return(z?tP(z):Z).normalize("NFC")}function $S($,Z={}){if(Z.memoryDir)return e6(Z.memoryDir);let z=Z.configDir||process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR||process.env.CLAUDE_CONFIG_DIR||i2(dP(),".claude");return i2(e6(z),"projects",oP(eP($)),"memory").normalize("NFC")}var ZS=new Set(["target_user","core_problem","mission_purpose"]),zS=["who","what","why","where","when","how"];function QS($){let Z=$.project??{},z=[["Goal",Z.goal],["Language",Z.main_language],["Type",Z.type]],Q=$.human_context??{},X=Array.isArray($.key_files)?$.key_files:[];return["## Project context — from project.faf","",`- **Name:** ${V0(Z.name)?Z.name:"Project"}`,...z.filter(([,Y])=>V0(Y)).map(([Y,W])=>`- **${Y}:** ${W}`),...e5("Stack",Object.entries($.stack??{}).filter(([Y,W])=>!ZS.has(Y)&&V0(W)).map(([Y,W])=>`- **${h0(`stack.${Y}`)}:** ${W}`)),...e5("Context",zS.filter((Y)=>V0(Q[Y])).map((Y)=>`- **${h0(`human_context.${Y}`)}:** ${Q[Y]}`)),...e5("Commands",Object.entries($.commands??{}).filter(([,Y])=>V0(Y)).slice(0,NU).map(([Y,W])=>`- ${Y}: \`${O6(W)}\``)),...e5("Key files",X.filter(V0).slice(0,NU).map((Y)=>`- ${Y}`)),"","*faf keeps this block in step with project.faf. Everything outside it is Claude's own and is kept as written.*"].join(`
259
+ `)}function e5($,Z){return Z.length>0?["",`### ${$}`,...Z]:[]}function XS($){return H9($,(Z)=>Z.trimEnd()===nP,(Z)=>Z.startsWith(rP))}function DU($){if($==="")return 0;let Z=$.match(/\r\n|\r|\n/g)?.length??0;return/(\r\n|\r|\n)$/.test($)?Z:Z+1}function JS($,Z,z){if($===null)return{text:o5(null,Z,void 0,void 0,z),action:"created",head:"",tail:""};let Q=q4($),X=Q??XS($);if(X){let Y=$.slice(0,X.start),W=$.slice(X.end);return{text:K4(Y,Z,W,void 0,void 0,z),action:Q?"updated":"migrated",head:Y,tail:W}}let J=$.startsWith("\uFEFF")?"\uFEFF":"";return{text:o5($,Z,void 0,void 0,z),action:"added",head:J,tail:$.slice(J.length)}}function IU($){return $>LU?[`MEMORY.md is ${$} lines. Claude Code loads the first ${LU}; lines after that are kept in the file but not loaded.`]:[]}function CU($,Z,z={}){let Q=$S($,z);w0(Q);let X=l(Q,y0.memory),J=N6(X),Y=JS(J,K9(QS(Z)),X);if(Y.text===J){let K=DU(J);return{path:X,action:"unchanged",written:!1,preserved:!0,lines:K,warnings:IU(K)}}let W=a(X,Y.text,{root:Q,expect:J}),U=$Z(W,"utf-8"),G=U===Y.text&&U.startsWith(Y.head)&&U.endsWith(Y.tail),V=DU(U),H=Y.action==="added"?q9(y0.memory,J):null;return{path:W,action:Y.action,written:!0,preserved:G,lines:V,warnings:[...H?[H]:[],...IU(V)]}}i();function B4(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function O9($={}){let Z=process.cwd(),z=f(Z);if(!z)console.error(`Error: project.faf not found
260
260
 
261
- Run 'faf init' to create one.`),process.exit(2);let Q=LU(Z,"CLAUDE.md"),X=$.direction??"auto";if(X==="auto")NU(z,Q,Z);else if(X==="push")OU(z,Z);else if(X==="pull")iP(z,Q);if(H4())DU(z,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),rP(z,Q,Z)}function NU($,Z,z){OU($,z)}function OU($,Z){let z=r($),Q=YU(z),X=s5(LU(Z,"CLAUDE.md"),"CLAUDE.md");if(JU(Z,Q),console.log(`${I("◆")} sync .faf → CLAUDE.md`),X)console.log(M(` ${X}`));let J=n($,()=>k0(F0(p($))));P0(J,$)}function iP($,Z){let z=r($),Q=n($,()=>k0(F0(p($))));if(Q.tier.name!=="TROPHY")console.error(`${C("×")} sync --pull blocked: requires ✪ Trophy (currently ${Q.score}%)`),console.error(M(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let X=XU(dP(Z));if(!X){console.error("CLAUDE.md not found.");return}let J=o5(X);if(J.project?.name)z.project={...z.project,name:J.project.name};if(J.project?.goal)z.project={...z.project,goal:J.project.goal};if(J.project?.main_language)z.project={...z.project,main_language:J.project.main_language};B0($,z,{onAliasKept:(W)=>console.log(M(` ${c0(W)}`))}),console.log(`${I("◆")} sync CLAUDE.md → .faf ${M("(Trophy-gated)")}`);let Y=n($,()=>k0(F0(p($))));P0(Y,$)}var nP={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 DU($,Z){try{let z=MU(Z,r($));console.log(`${I("◆")} sync .faf → MEMORY.md ${M(`${nP[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 rP($,Z,z){let{watch:Q}=i0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(M("change detected...")),NU($,Z,z),H4())DU($,z)},200)};if(Q($,J),lP(Z))Q(Z,J)}import{statSync as IU}from"fs";import{dirname as TU,resolve as K4}from"path";i();function K9($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var B9="FAFB header (a .fafb faf compiled)";function M9($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function L9($,Z){if(K4($)===K4(Z))return!0;try{let z=IU($),Q=IU(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function AU($,Z={}){let z=$??m();if(!z)console.error(`Error: project.faf not found
261
+ Run 'faf init' to create one.`),process.exit(2);let Q=_U(Z,"CLAUDE.md"),X=$.direction??"auto";if(X==="auto")RU(z,Q,Z);else if(X==="push")FU(z,Z);else if(X==="pull")US(z,Q);if(B4())PU(z,Z);if($.watch)console.log(M("watching for changes... (Ctrl+C to stop)")),VS(z,Q,Z)}function RU($,Z,z){FU($,z)}function FU($,Z){let z=s($),Q=BU(z),X=a5(_U(Z,"CLAUDE.md"),"CLAUDE.md");if(qU(Z,Q),console.log(`${T("◆")} sync .faf → CLAUDE.md`),X)console.log(M(` ${X}`));let J=r($,()=>b0(P0(p($))));S0(J,$)}function US($,Z){let z=s($),Q=r($,()=>b0(P0(p($))));if(Q.tier.name!=="TROPHY")console.error(`${C("×")} sync --pull blocked: requires ✪ Trophy (currently ${Q.score}%)`),console.error(M(" MD → .faf backfill only runs at 100%. Reach Trophy with 'faf go', then retry.")),process.exit(1);let X=KU(WS(Z));if(!X){console.error("CLAUDE.md not found.");return}let J=t5(X);if(J.project?.name)z.project={...z.project,name:J.project.name};if(J.project?.goal)z.project={...z.project,goal:J.project.goal};if(J.project?.main_language)z.project={...z.project,main_language:J.project.main_language};M0($,z,{onAliasKept:(W)=>console.log(M(` ${p0(W)}`))}),console.log(`${T("◆")} sync CLAUDE.md → .faf ${M("(Trophy-gated)")}`);let Y=r($,()=>b0(P0(p($))));S0(Y,$)}var GS={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 PU($,Z){try{let z=CU(Z,s($));console.log(`${T("◆")} sync .faf → MEMORY.md ${M(`${GS[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 VS($,Z,z){let{watch:Q}=n0("fs"),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{if(console.log(M("change detected...")),RU($,Z,z),B4())PU($,z)},200)};if(Q($,J),YS(Z))Q(Z,J)}import{statSync as SU}from"fs";import{dirname as EU,resolve as M4}from"path";i();function D9($){return $.length>=4&&$[0]===70&&$[1]===65&&$[2]===70&&$[3]===66}var I9="FAFB header (a .fafb faf compiled)";function T9($){return/\.faf$/i.test($)?$.replace(/\.faf$/i,".fafb"):`${$}.fafb`}function A9($,Z){if(M4($)===M4(Z))return!0;try{let z=SU($),Q=SU(Z);return z.dev===Q.dev&&z.ino===Q.ino}catch{return!1}}function jU($,Z={}){let z=$??f();if(!z)console.error(`Error: project.faf not found
262
262
 
263
- Run 'faf init' to create one.`),process.exit(2);let Q=p(z);Q2(Q,z);let X=n(z,()=>S5(Q)),J=Z.output??M9(z);if(L9(J,z))console.error(`faf: ${K4(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);Y2(Z.output);let Y=Z.output?TU(K4(J)):TU(K4(z));j2(J,X,{root:Y,owns:K9,mark:B9,force:Z.force}),console.log(`${I("compiled")} ${J} ${M(`(${X.length} bytes)`)}`)}import{readFileSync as KS}from"fs";import{dirname as BS,resolve as xU}from"path";import{createHash as eP}from"crypto";import{resolve as $S}from"path";class h0 extends Error{constructor($){super($);this.name="JsonEditError"}}var sP=new Set([" ","\t",`
264
- `,"\r"]);class D9{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 h0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&sP.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 N9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function O9($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>O9(z,Z[Q]));if(N9($)&&N9(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&O9($[Q],Z[Q]))}return!1}class I9{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
263
+ Run 'faf init' to create one.`),process.exit(2);let Q=p(z);X2(Q,z);let X=r(z,()=>j5(Q)),J=Z.output??T9(z);if(A9(J,z))console.error(`faf: ${M4(J)} is the file being compiled — faf does not write the .fafb over its source, and left it unchanged. Name another output with --output.`),process.exit(1);U2(Z.output);let Y=Z.output?EU(M4(J)):EU(M4(z));w2(J,X,{root:Y,owns:D9,mark:I9,force:Z.force}),console.log(`${T("compiled")} ${J} ${M(`(${X.length} bytes)`)}`)}import{readFileSync as ES}from"fs";import{dirname as jS,resolve as uU}from"path";import{createHash as MS}from"crypto";import{resolve as LS}from"path";class f0 extends Error{constructor($){super($);this.name="JsonEditError"}}var HS=new Set([" ","\t",`
264
+ `,"\r"]);class R9{s;i=0;constructor($){this.s=$}parse(){if(this.s.startsWith("\uFEFF"))this.i=1;let $=this.value();if(this.ws(),this.i!==this.s.length)this.fail("text after the end of the JSON value");return $}fail($){throw new f0(`not valid JSON (${$} at offset ${this.i})`)}ws(){while(this.i<this.s.length&&HS.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 C9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function _9($,Z){if(Object.is($,Z))return!0;if(Array.isArray($)&&Array.isArray(Z))return $.length===Z.length&&$.every((z,Q)=>_9(z,Z[Q]));if(C9($)&&C9(Z)){let z=Object.keys($);return z.length===Object.keys(Z).length&&z.every((Q)=>(Q in Z)&&_9($[Q],Z[Q]))}return!1}class F9{s;style;after;edits=[];constructor($,Z,z){this.s=$;this.style=Z;this.after=z}startsLine($){let Z=this.s.lastIndexOf(`
265
265
  `,$-1);return Z>=0&&/^[ \t]*$/.test(this.s.slice(Z+1,$))}indentOf($){return this.startsLine($)?this.s.slice(this.s.lastIndexOf(`
266
266
  `,$-1)+1,$):""}render($,Z,z){if(!z)return JSON.stringify($);return JSON.stringify($,null,this.style.unit).split(`
267
- `).join(this.style.eol+Z)}apply($,Z,z,Q){let X={};for(let[J,Y]of Object.entries(Z)){if(Y===void 0)continue;let W=z?`${z}.${J}`:J,U=$.members.filter((H)=>H.key===J);if(U.length>1)throw new h0(`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(N9(Y)){if(G.value.kind!=="object")throw new h0(`"${W}" is not an object, so faf cannot add its keys to it`);this.apply(G.value,Y,W,V||this.s.slice(G.value.start,G.value.end).includes(`
268
- `));continue}let q=JSON.parse(this.s.slice(G.value.start,G.value.end));if(O9(q,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new h0(`"${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((q)=>X.find((H)=>H.key===q)).find((q)=>q!==void 0);if(this.startsLine(X[0].keyStart)){let q=W&&W!==J?X[X.indexOf(W)+1]:J,H=this.indentOf(q.keyStart),K=this.s.slice(q.keyEnd,q.value.start),L=this.s.lastIndexOf(`
269
- `,q.keyStart-1),B=L>0&&this.s[L-1]==="\r"?L-1:L,N=`${this.style.eol}${H}${JSON.stringify(Z)}${K}${this.render(z,H,!0)},`;this.edits.push({start:B,end:B,text:N});return}let U=W??J,G=this.s.slice(U.keyEnd,U.value.start),V=X.length>1?this.s.slice(X[0].value.end,X[1].keyStart):", ";this.edits.push({start:U.value.end,end:U.value.end,text:`${V}${JSON.stringify(Z)}${G}${this.render(z,"",!1)}`})}append($,Z,z,Q){if(Z.length===0)return;if($.items.length===0){this.edits.push({start:$.start,end:$.end,text:this.render(Z,this.indentOf(z),Q)});return}let X=$.items[$.items.length-1];if(this.startsLine($.items[0].start)){let Y=this.indentOf($.items[0].start),W=Z.map((U)=>`,${this.style.eol}${Y}${this.render(U,Y,!0)}`).join("");this.edits.push({start:X.end,end:X.end,text:W});return}let J=$.items.length>1?this.s.slice($.items[0].end,$.items[1].start):", ";this.edits.push({start:X.end,end:X.end,text:Z.map((Y)=>`${J}${this.render(Y,"",!1)}`).join("")})}lineLead($){let Z=this.s.lastIndexOf(`
270
- `,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function CU($,Z){let z=$.includes(`\r
267
+ `).join(this.style.eol+Z)}apply($,Z,z,Q){let X={};for(let[J,Y]of Object.entries(Z)){if(Y===void 0)continue;let W=z?`${z}.${J}`:J,U=$.members.filter((K)=>K.key===J);if(U.length>1)throw new f0(`the key "${W}" is there more than once`);let G=U[0];if(!G){if($.members.length===0)X[J]=Y;else this.insert($,J,Y,z);continue}let V=this.startsLine(G.keyStart);if(C9(Y)){if(G.value.kind!=="object")throw new f0(`"${W}" is not an object, so faf cannot add its keys to it`);this.apply(G.value,Y,W,V||this.s.slice(G.value.start,G.value.end).includes(`
268
+ `));continue}let H=JSON.parse(this.s.slice(G.value.start,G.value.end));if(_9(H,Y))continue;if(G.value.kind==="object"||G.value.kind==="array")throw new f0(`"${W}" is ${G.value.kind==="object"?"an object":"an array"}, so faf will not replace it with a value`);this.edits.push({start:G.value.start,end:G.value.end,text:this.render(Y,this.indentOf(G.keyStart),V)})}if(Object.keys(X).length>0)this.fillEmpty($,X,Q)}fillEmpty($,Z,z){let Q=this.indentOf(this.lineLead($.start)),X=z?this.render(Z,Q,!0):JSON.stringify(Z);this.edits.push({start:$.start,end:$.end,text:X})}insert($,Z,z,Q){let X=$.members,J=X[X.length-1],W=(this.after[Q]?.[Z]??[]).map((H)=>X.find((K)=>K.key===H)).find((H)=>H!==void 0);if(this.startsLine(X[0].keyStart)){let H=W&&W!==J?X[X.indexOf(W)+1]:J,K=this.indentOf(H.keyStart),q=this.s.slice(H.keyEnd,H.value.start),L=this.s.lastIndexOf(`
269
+ `,H.keyStart-1),B=L>0&&this.s[L-1]==="\r"?L-1:L,N=`${this.style.eol}${K}${JSON.stringify(Z)}${q}${this.render(z,K,!0)},`;this.edits.push({start:B,end:B,text:N});return}let U=W??J,G=this.s.slice(U.keyEnd,U.value.start),V=X.length>1?this.s.slice(X[0].value.end,X[1].keyStart):", ";this.edits.push({start:U.value.end,end:U.value.end,text:`${V}${JSON.stringify(Z)}${G}${this.render(z,"",!1)}`})}append($,Z,z,Q){if(Z.length===0)return;if($.items.length===0){this.edits.push({start:$.start,end:$.end,text:this.render(Z,this.indentOf(z),Q)});return}let X=$.items[$.items.length-1];if(this.startsLine($.items[0].start)){let Y=this.indentOf($.items[0].start),W=Z.map((U)=>`,${this.style.eol}${Y}${this.render(U,Y,!0)}`).join("");this.edits.push({start:X.end,end:X.end,text:W});return}let J=$.items.length>1?this.s.slice($.items[0].end,$.items[1].start):", ";this.edits.push({start:X.end,end:X.end,text:Z.map((Y)=>`${J}${this.render(Y,"",!1)}`).join("")})}lineLead($){let Z=this.s.lastIndexOf(`
270
+ `,$-1)+1;while(Z<$&&(this.s[Z]===" "||this.s[Z]==="\t"))Z++;return Z}}function wU($,Z){let z=$.includes(`\r
271
271
  `)?`\r
272
272
  `:`
273
273
  `,Q=Z.members[0],X=Q?$.lastIndexOf(`
274
- `,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function h$($,Z,z={}){let Q=new D9($).parse();if(Q.kind!=="object")throw new h0("the JSON is not an object");let X=new I9($,CU($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
275
- `)),e5($,X.edits)}function e5($,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 _U($){let Z=new D9($).parse();if(Z.kind!=="object")throw new h0("the JSON is not an object");return Z}function oP($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new h0(`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 RU($,Z,z,Q){let X=_U($),J=new I9($,CU($,X),{}),Y=$.slice(X.start,X.end).includes(`
276
- `),W=X.members.filter((q)=>q.key===Z);if(W.length>1)throw new h0(`the key "${Z}" is there more than once`);if(W.length===0)return J.apply(X,{[Z]:z},"",Y),e5($,J.edits);let U=W[0],G=U.value;if(G.kind!=="array")throw new h0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let q of z){let H=q[Q.id],K=G.items.filter((N,T)=>N.kind==="object"&&oP($,N,Q.id,`${Z}[${T}]`)===H);if(K.length>1)throw new h0(`the ${Z} row ${JSON.stringify(H)} is there more than once`);if(K.length===0){V.push(q);continue}let L=K[0],B=Object.fromEntries(Q.update.map((N)=>[N,q[N]]));J.apply(L,B,`${Z}[${G.items.indexOf(L)}]`,$.slice(L.start,L.end).includes(`
277
- `))}return J.append(G,V,U.keyStart,Y),e5($,J.edits)}function aP($,Z){let z=$.lastIndexOf(`
278
- `,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function tP($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(aP($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
279
- `,z.keyStart-1);return{start:X>0&&$[X-1]==="\r"?X-1:X,end:z.value.end+1,text:""}}if(Q>0)return{start:Z.members[Q-1].value.end,end:z.value.end,text:""};return{start:z.keyStart,end:Z.members[1].keyStart,text:""}}function FU($,Z){let z=[],Q=_U($);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 PU($,Z){let{count:z,chain:Q}=FU($,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 T9($,Z,z={}){let{count:Q,chain:X}=FU($,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 e5($,[tP($,J.obj,J.member)]).text}var EU="one.faf/render";function C9($){return`sha256:${eP("sha256").update($,"utf8").digest("hex")}`}var ZS=/^sha256:[0-9a-f]{64}$/,zS=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,QS='<meta name="faf-render"',XS='<meta name="description" content="Visual render of project.faf.';function JS($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(XS));return Z.splice(z+1,0,`<meta name="faf-render" content="${C9($)}">
280
- `),Z.join("")}function jU($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),W=zS.exec(Y);if(W)z.push({at:J,hash:W[1]});else if(Y.startsWith(QS))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 A9=["_meta",EU];function YS($){return h$($,{_meta:{[EU]:C9($)}}).text}function WS($){try{return T9($,A9,{dropEmptyParent:!0})??$}catch{return $}}function US($){let Z;try{Z=PU($,A9)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!ZS.test(Z.value))return"many";let z=T9($,A9,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function wU($,Z){return $==="html"?JS(Z):YS(Z)}function GS($,Z){if($==="json")return WS(Z);let z=jU(Z);return z===null||z==="many"?Z:z.canonical}function SU($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?jU(z):US(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===C9(Q.canonical)&&wU(Z,Q.canonical)===z?"match":"mismatch"}function VS($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
274
+ `,Q.keyStart-1):-1,J=Q&&X>=0?$.slice(X+1,Q.keyStart):"";return{eol:z,unit:/^[ \t]+$/.test(J)?J:" "}}function u$($,Z,z={}){let Q=new R9($).parse();if(Q.kind!=="object")throw new f0("the JSON is not an object");let X=new F9($,wU($,Q),z);return X.apply(Q,Z,"",$.slice(Q.start,Q.end).includes(`
275
+ `)),ZZ($,X.edits)}function ZZ($,Z){if(Z.length===0)return{text:$,changed:!1};let z=Z.map((X,J)=>({e:X,i:J})).sort((X,J)=>J.e.start-X.e.start||J.i-X.i),Q=$;for(let{e:X}of z)Q=Q.slice(0,X.start)+X.text+Q.slice(X.end);return{text:Q,changed:Q!==$}}function xU($){let Z=new R9($).parse();if(Z.kind!=="object")throw new f0("the JSON is not an object");return Z}function KS($,Z,z,Q){let X=Z.members.filter((Y)=>Y.key===z);if(X.length>1)throw new f0(`the key "${Q}.${z}" is there more than once`);let J=X[0]?.value;return J?.kind==="string"?JSON.parse($.slice(J.start,J.end)):void 0}function yU($,Z,z,Q){let X=xU($),J=new F9($,wU($,X),{}),Y=$.slice(X.start,X.end).includes(`
276
+ `),W=X.members.filter((H)=>H.key===Z);if(W.length>1)throw new f0(`the key "${Z}" is there more than once`);if(W.length===0)return J.apply(X,{[Z]:z},"",Y),ZZ($,J.edits);let U=W[0],G=U.value;if(G.kind!=="array")throw new f0(`"${Z}" is not an array, so faf cannot add its rows to it`);let V=[];for(let H of z){let K=H[Q.id],q=G.items.filter((N,I)=>N.kind==="object"&&KS($,N,Q.id,`${Z}[${I}]`)===K);if(q.length>1)throw new f0(`the ${Z} row ${JSON.stringify(K)} is there more than once`);if(q.length===0){V.push(H);continue}let L=q[0],B=Object.fromEntries(Q.update.map((N)=>[N,H[N]]));J.apply(L,B,`${Z}[${G.items.indexOf(L)}]`,$.slice(L.start,L.end).includes(`
277
+ `))}return J.append(G,V,U.keyStart,Y),ZZ($,J.edits)}function qS($,Z){let z=$.lastIndexOf(`
278
+ `,Z-1);return z>=0&&/^[ \t]*$/.test($.slice(z+1,Z))}function BS($,Z,z){if(Z.members.length===1)return{start:Z.start,end:Z.end,text:"{}"};let Q=Z.members.indexOf(z);if(qS($,z.keyStart)&&$[z.value.end]===","){let X=$.lastIndexOf(`
279
+ `,z.keyStart-1);return{start:X>0&&$[X-1]==="\r"?X-1:X,end:z.value.end+1,text:""}}if(Q>0)return{start:Z.members[Q-1].value.end,end:z.value.end,text:""};return{start:z.keyStart,end:Z.members[1].keyStart,text:""}}function kU($,Z){let z=[],Q=xU($);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 bU($,Z){let{count:z,chain:Q}=kU($,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 P9($,Z,z={}){let{count:Q,chain:X}=kU($,Z);if(Q!==1||X.length===0)return null;let J=X[X.length-1];if(z.dropEmptyParent&&X.length>1&&J.obj.members.length===1)J=X[X.length-2];return ZZ($,[BS($,J.obj,J.member)]).text}var gU="one.faf/render";function E9($){return`sha256:${MS("sha256").update($,"utf8").digest("hex")}`}var NS=/^sha256:[0-9a-f]{64}$/,OS=/^<meta name="faf-render" content="(sha256:[0-9a-f]{64})">$/,DS='<meta name="faf-render"',IS='<meta name="description" content="Visual render of project.faf.';function TS($){let Z=$.split(/(?<=\n)/),z=Z.findIndex((Q)=>Q.startsWith(IS));return Z.splice(z+1,0,`<meta name="faf-render" content="${E9($)}">
280
+ `),Z.join("")}function hU($){let Z=$.split(/(?<=\n)/),z=[],Q=!1;if(Z.forEach((X,J)=>{let Y=X.replace(/\r?\n$/,""),W=OS.exec(Y);if(W)z.push({at:J,hash:W[1]});else if(Y.startsWith(DS))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 S9=["_meta",gU];function AS($){return u$($,{_meta:{[gU]:E9($)}}).text}function CS($){try{return P9($,S9,{dropEmptyParent:!0})??$}catch{return $}}function _S($){let Z;try{Z=bU($,S9)}catch{return null}if(Z.count===0)return null;if(Z.count>1||typeof Z.value!=="string"||!NS.test(Z.value))return"many";let z=P9($,S9,{dropEmptyParent:!0});return z===null?"many":{hash:Z.value,canonical:z}}function fU($,Z){return $==="html"?TS(Z):AS(Z)}function RS($,Z){if($==="json")return CS(Z);let z=hU(Z);return z===null||z==="many"?Z:z.canonical}function vU($,Z){let z=new TextDecoder().decode($),Q=Z==="html"?hU(z):_S(z);if(Q===null)return"none";if(Q==="many")return"mismatch";return Buffer.from(z,"utf-8").equals(Buffer.from($))&&Q.hash===E9(Q.canonical)&&fU(Z,Q.canonical)===z?"match":"mismatch"}function FS($){let Z=new TextDecoder().decode($);if(!Z.includes(`\r
281
281
  `)||/(?:^|[^\r])\n/.test(Z)||!Buffer.from(Z,"utf-8").equals($))return null;return Buffer.from(Z.replace(/\r\n/g,`
282
- `),"utf-8")}function qS($,Z,z){let Q=SU($,z);return Q!=="match"&&Z!==null&&SU(Z,z)==="match"?"match":Q}function G2($,Z,z){let Q=$S($),X=l(z.root,Q),J=GS(z.format,Z),Y=wU(z.format,J),W=y0(X);if(W===null)return a(X,Y,{root:z.root,expect:null}),{path:X,result:"created"};if(W.equals(Buffer.from(Y,"utf-8")))return{path:X,result:"unchanged"};let U=VS(W),G=U===null?Y:Y.replace(/\r?\n/g,`\r
283
- `);if(U!==null&&W.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!HS(Q,W,U,J,z))return{path:X,result:"unchanged"};return a(X,G,{root:z.root,expect:W}),{path:X,result:"updated"}}function HS($,Z,z,Q,X){let J=qS(Z,z,X.format);if(J==="match")return!0;if(J==="mismatch")throw new b("not-owned",$,`${$} was edited since faf wrote it — faf left it unchanged. Use --force to replace it.`,{onWrite:!0});if(!X.hasMark(Z))throw new b("not-owned",$,`${$} has no ${X.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});let Y=Buffer.from(Q,"utf-8");if(Z.equals(Y)||z!==null&&z.equals(Y))return!1;throw new b("not-owned",$,`${$} has no faf render hash (written before 7.13), so faf cannot tell whether it was edited — faf left it unchanged. Use --force once to replace it; after that faf recognises its own output.`,{onWrite:!0})}i();function yU($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array(KS($));if(String.fromCharCode(z[0],z[1],z[2],z[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let Q=n($,()=>rY(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(L9(Z.output,$))console.error(`faf: ${xU(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);Y2(Z.output);let{result:J}=G2(Z.output,`${X}
284
- `,{root:BS(xU(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${I("decompiled")} ${Z.output}${J==="unchanged"?` ${M("(unchanged)")}`:""}`)}function kU($){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(!aY(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!oY.test(z.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${z.about.represents})`);if(z.about.source_score!==void 0){let Q=z.about.source_score;if(typeof Q!=="number"||Q<0||Q>100)Z.push(`about.source_score must be a number 0-100 (got: ${Q})`)}}return{valid:Z.length===0,errors:Z}}i();function _9($,Z={}){let z=$??m();if(!z)console.error(`Error: project.faf not found
282
+ `),"utf-8")}function PS($,Z,z){let Q=vU($,z);return Q!=="match"&&Z!==null&&vU(Z,z)==="match"?"match":Q}function H2($,Z,z){let Q=LS($),X=l(z.root,Q),J=RS(z.format,Z),Y=fU(z.format,J),W=k0(X);if(W===null)return a(X,Y,{root:z.root,expect:null}),{path:X,result:"created"};if(W.equals(Buffer.from(Y,"utf-8")))return{path:X,result:"unchanged"};let U=FS(W),G=U===null?Y:Y.replace(/\r?\n/g,`\r
283
+ `);if(U!==null&&W.equals(Buffer.from(G,"utf-8")))return{path:X,result:"unchanged"};if(z.force!==!0&&!SS(Q,W,U,J,z))return{path:X,result:"unchanged"};return a(X,G,{root:z.root,expect:W}),{path:X,result:"updated"}}function SS($,Z,z,Q,X){let J=PS(Z,z,X.format);if(J==="match")return!0;if(J==="mismatch")throw new b("not-owned",$,`${$} was edited since faf wrote it — faf left it unchanged. Use --force to replace it.`,{onWrite:!0});if(!X.hasMark(Z))throw new b("not-owned",$,`${$} has no ${X.mark}, so faf did not write it — faf left it unchanged.`,{onWrite:!0});let Y=Buffer.from(Q,"utf-8");if(Z.equals(Y)||z!==null&&z.equals(Y))return!1;throw new b("not-owned",$,`${$} has no faf render hash (written before 7.13), so faf cannot tell whether it was edited — faf left it unchanged. Use --force once to replace it; after that faf recognises its own output.`,{onWrite:!0})}i();function mU($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let z=new Uint8Array(ES($));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=r($,()=>zW(z)),X=JSON.stringify(Q,null,2);if(!Z.output){console.log(X);return}if(A9(Z.output,$))console.error(`faf: ${uU(Z.output)} is the file being decompiled — faf does not write the JSON over it, and left it unchanged. Name another output with --output.`),process.exit(1);U2(Z.output);let{result:J}=H2(Z.output,`${X}
284
+ `,{root:jS(uU(Z.output)),format:"json",hasMark:()=>!1,mark:'faf render hash (`_meta["one.faf/render"]`)',force:Z.force});console.log(`${T("decompiled")} ${Z.output}${J==="unchanged"?` ${M("(unchanged)")}`:""}`)}function cU($){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(!JW(z)||typeof z.about.represents!=="string")Z.push("about.represents is required (owner/repo of the source codebase)");else if(!XW.test(z.about.represents))Z.push(`about.represents must be "owner/repo" format (got: ${z.about.represents})`);if(z.about.source_score!==void 0){let Q=z.about.source_score;if(typeof Q!=="number"||Q<0||Q>100)Z.push(`about.source_score must be a number 0-100 (got: ${Q})`)}}return{valid:Z.length===0,errors:Z}}i();function j9($,Z={}){let z=$??f();if(!z)console.error(`Error: project.faf not found
285
285
 
286
- Run 'faf init' to create one.`),process.exit(2);let Q=Q2(p(z),z),X=kU(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(!nY(J))console.log(`${C("invalid yaml")} ${z}`),process.exit(3);console.log(`${I("valid")} ${z}`);let Y=n(z,()=>N0(J));if(P0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
287
- --strict requires 100%`)),process.exit(1)}import{join as eS,resolve as $E}from"path";import{join as MS}from"path";var r0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),bU=($)=>Array.isArray($)?$.join(", "):String($),LS=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),NS=new Set(["target_user","core_problem","mission_purpose"]);function OS($){let Z=[],z=(k="")=>Z.push(k),Q=$.ai_instructions,X=$.preferences,J=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??J?.key_files,G=r0($.project?.default_branch)?String($.project?.default_branch):"main",V=W?Object.entries(W).filter(([,k])=>r0(k)):[],q=V.filter(([k])=>/test/i.test(k)),H=V.filter(([k])=>/lint|check/i.test(k)&&!/test/i.test(k)),K=V.filter(([k])=>!/test|lint|check/i.test(k)),L=(k)=>{let g=k.toLowerCase();if(/install|deps/.test(g))return 0;if(/^build$|build/.test(g)&&!/rebuild/.test(g))return 1;if(/^dev$|develop/.test(g))return 2;if(/^start$|run/.test(g))return 3;return 4},B=[...K].sort((k,g)=>L(k[0])-L(g[0])||k[0].localeCompare(g[0])),N=[...q,...H],T=B.find(([k])=>/build/i.test(k)),_=q[0]?L6(q[0][1]):void 0,y=T?L6(T[1]):void 0;z(p2($)),z(),z(`# AGENTS.md — ${$.project?.name??"Project"}`),z();let E=[];if($.project?.main_language)E.push(String($.project.main_language));if(r0($.project?.type))E.push(`type: ${String($.project?.type)}`);if(r0($.project?.version))E.push(`v${String($.project?.version)}`);let w=$.project?.goal?String($.project.goal).trim():"";if(E.length)w+=(w?" — ":"")+E.join(" · ");if(w)z(w),z();if(z("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand-written content outside the managed block is preserved."),z(),B.length){z("## Setup & build"),z(),z("```bash");for(let[k,g]of B){let{cmd:M0,note:H2}=o6(g);z(`${M0} # ${H2??k}`)}z("```"),z()}if(N.length){z("## Run the tests"),z(),z("```bash");for(let[,k]of N){let{cmd:g,note:M0}=o6(k);z(M0?`${g} # ${M0}`:g)}z("```"),z()}if(U&&U.length){z("## Where things live"),z();let k=U.map((g)=>{let M0=String(g),H2=M0.indexOf(" — ");return H2>0?{path:M0.slice(0,H2),role:M0.slice(H2+3)}:{path:M0,role:""}});if(k.some((g)=>g.role)){z("| Path | Role |"),z("|------|------|");for(let g of k)z(`| \`${g.path}\` | ${g.role} |`)}else for(let g of k)z(`- \`${g.path}\``);z()}let j=new Map,f=(k)=>{if(!k)return;for(let[g,M0]of Object.entries(k)){if(LS.has(g)||!r0(M0))continue;let H2=U9(g);if(!j.has(H2))j.set(H2,bU(M0))}};f(Q?.working_style),f(X);let S=$.conventions??[];if(j.size||S.length){z("## Conventions"),z();for(let[k,g]of j)z(`- **${k}:** ${g}`);for(let k of S)if(r0(k))z(`- ${k}`);z()}let d=(Q?.warnings??[]).filter((k)=>r0(k)),I0=["read the tree"];if(_)I0.push(`run the tests (\`${_}\`)`);if(y)I0.push("build the project");for(let[,k]of H.slice(0,1))I0.push(`\`${L6(k)}\``);z("## Guardrails"),z();for(let k of d)z(`- ${k}`);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 E0=[];for(let[,k]of H)E0.push(`\`${L6(k)}\` exits 0`);for(let[,k]of q)E0.push(`\`${L6(k)}\` passes`);if(E0.push("changes committed with a conventional message"),z("## Definition of Done"),z(),z(`Done when: ${[...new Set(E0)].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&&(r0(Y.secrets)||(Y.never??[]).length)){if(z("## Security & secrets"),z(),r0(Y.secrets)){let k=r0(Y.example)?` (see \`${Y.example}\`)`:"";z(`- Secrets live in \`${Y.secrets}\`${k}. Never read or commit them.`)}for(let k of Y.never??[])if(r0(k))z(`- Never read or commit \`${k}\`.`);z()}if(z("## Commit & PR"),z(),X&&r0(X.commit_style))z(`- Commit style: ${bU(X.commit_style)}`);else z("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(z(`- Branch off \`${G}\` and open a PR — never commit to \`${G}\` directly.`),z("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),z(),$.stack){let k=[];for(let[g,M0]of Object.entries($.stack)){if(NS.has(g))continue;if(G0(M0))k.push(`- **${g0(`stack.${g}`)}:** ${M0.trim()}`)}if(k.length){z("## Stack"),z();for(let g of k)z(g);z()}}let $0=$.generated;if(r0($0))z(`*Context authored: ${String($0)}*`);return Z.join(`
288
- `)}function vU($,Z){U2(MS($,x0.agents),OS(Z))}function DS($,Z){let z=[],Q=(U)=>A($,U),X=(U)=>u($,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 R9($,Z){let z={...Z},Q=null,X=u($,"package.json");if(X!==null)try{Q=JSON.parse(X)}catch{Q=null}let J=c5($,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=m5($);if(W.length)z.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>A($,G));if(U){let G=[".env.example",".env.sample",".env.template"].find((V)=>A($,V));z.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=DS($,Q);if(W.length)z.conventions=W}return z}import{join as IS}from"path";function TS($){let Z=[];if(Z.push(p2($)),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(G0(Q))Z.push(`# ${g0(`stack.${z}`)}: ${Q.trim()}`)}return Z.push(""),Z.join(`
289
- `)}function gU($,Z){U2(IS($,x0.cursorrules),TS(Z),"# faf:start","# faf:end")}import{join as AS}from"path";var CS=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),_S=new Set(["target_user","core_problem","mission_purpose"]);function RS($){let Z=[],z=$.instant_context,Q=$.commands,X=$.key_files??z?.key_files,J=Q?Object.entries(Q).filter(([,H])=>CS(H)):[],Y=J.filter(([H])=>/test/i.test(H)),W=J.filter(([H])=>/lint|check/i.test(H)&&!/test/i.test(H)),U=J.filter(([H])=>!/test|lint|check/i.test(H)),G=(H)=>{let K=H.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((H,K)=>G(H[0])-G(K[0])||H[0].localeCompare(K[0])),q=[...Y,...W];if(Z.push(p2($)),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[H,K]of V){let{cmd:L,note:B}=o6(K);Z.push(`${L} # ${B??H}`)}Z.push("```")}if(q.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,H]of q){let{cmd:K,note:L}=o6(H);Z.push(L?`${K} # ${L}`:K)}Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let H of X)Z.push(`- \`${H}\``)}if($.stack){let H=[];for(let[K,L]of Object.entries($.stack)){if(_S.has(K))continue;if(G0(L))H.push(`- ${g0(`stack.${K}`)}: ${L.trim()}`)}if(H.length){Z.push(""),Z.push("## Stack");for(let K of H)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(`
290
- `)}function hU($,Z){U2(AS($,x0.gemini),RS(Z))}import{join as FS}from"path";var fU=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],PS=new Set([...fU.map(([$])=>$),"cicd"]);function SS($){let Z=[],z=$.project?.name??"Project";if(Z.push(p2($)),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(""),G0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let Q=$.stack??{},X=[];if(G0($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,V]of Object.entries(Q)){if(PS.has(G))continue;if(G0(V))X.push(`- **${g0(`stack.${G}`)}:** ${V.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let J=[];for(let[G,V]of fU){let q=Q[G];if(G0(q))J.push(`- ${V} \`${q.trim()}\`.`)}if(G0(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])=>G0(G)).map(([G,V])=>`- **${g0(`human_context.${G}`)}:** ${V.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
291
- `)}function uU($,Z){j0($,".github"),U2(FS($,".github",x0.copilot),SS(Z),m2,c2,{root:$})}import{existsSync as ES}from"fs";import{join as jS}from"path";var wS="https://mcpaas.live/grok/mcp/v1",mU="mcp_servers.grok-faf-mcp";function xS($){return[`[${mU}]`,`url = "${wS}"`,""].join(`
292
- `)}function cU($,Z){let z=xS(Z);j0($,".grok");let Q=l($,jS(".grok","config.toml"));if(!ES(Q))return a(Q,`# grok-faf-mcp — wired by FAF from project.faf
286
+ Run 'faf init' to create one.`),process.exit(2);let Q=X2(p(z),z),X=cU(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(!ZW(J))console.log(`${C("invalid yaml")} ${z}`),process.exit(3);console.log(`${T("valid")} ${z}`);let Y=r(z,()=>O0(J));if(S0(Y,z,Z.verbose),Z.strict&&Y.score<100)console.log(M(`
287
+ --strict requires 100%`)),process.exit(1)}import{join as _E,resolve as RE}from"path";import{join as wS}from"path";var s0=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),pU=($)=>Array.isArray($)?$.join(", "):String($),xS=new Set(["commit_style","communication","response_style","explanation_level","explanations","documentation","code_first"]),yS=new Set(["target_user","core_problem","mission_purpose"]);function kS($){let Z=[],z=(k="")=>Z.push(k),Q=$.ai_instructions,X=$.preferences,J=$.instant_context,Y=$.security,W=$.commands,U=$.key_files??J?.key_files,G=s0($.project?.default_branch)?String($.project?.default_branch):"main",V=W?Object.entries(W).filter(([,k])=>s0(k)):[],H=V.filter(([k])=>/test/i.test(k)),K=V.filter(([k])=>/lint|check/i.test(k)&&!/test/i.test(k)),q=V.filter(([k])=>!/test|lint|check/i.test(k)),L=(k)=>{let h=k.toLowerCase();if(/install|deps/.test(h))return 0;if(/^build$|build/.test(h)&&!/rebuild/.test(h))return 1;if(/^dev$|develop/.test(h))return 2;if(/^start$|run/.test(h))return 3;return 4},B=[...q].sort((k,h)=>L(k[0])-L(h[0])||k[0].localeCompare(h[0])),N=[...H,...K],I=B.find(([k])=>/build/i.test(k)),_=H[0]?O6(H[0][1]):void 0,y=I?O6(I[1]):void 0;z(d2($)),z(),z(`# AGENTS.md — ${$.project?.name??"Project"}`),z();let E=[];if($.project?.main_language)E.push(String($.project.main_language));if(s0($.project?.type))E.push(`type: ${String($.project?.type)}`);if(s0($.project?.version))E.push(`v${String($.project?.version)}`);let w=$.project?.goal?String($.project.goal).trim():"";if(E.length)w+=(w?" — ":"")+E.join(" · ");if(w)z(w),z();if(z("> Authored by faf — do not edit the managed block; refresh with `faf export --agents`. Hand-written content outside the managed block is preserved."),z(),B.length){z("## Setup & build"),z(),z("```bash");for(let[k,h]of B){let{cmd:L0,note:B2}=t6(h);z(`${L0} # ${B2??k}`)}z("```"),z()}if(N.length){z("## Run the tests"),z(),z("```bash");for(let[,k]of N){let{cmd:h,note:L0}=t6(k);z(L0?`${h} # ${L0}`:h)}z("```"),z()}if(U&&U.length){z("## Where things live"),z();let k=U.map((h)=>{let L0=String(h),B2=L0.indexOf(" — ");return B2>0?{path:L0.slice(0,B2),role:L0.slice(B2+3)}:{path:L0,role:""}});if(k.some((h)=>h.role)){z("| Path | Role |"),z("|------|------|");for(let h of k)z(`| \`${h.path}\` | ${h.role} |`)}else for(let h of k)z(`- \`${h.path}\``);z()}let j=new Map,u=(k)=>{if(!k)return;for(let[h,L0]of Object.entries(k)){if(xS.has(h)||!s0(L0))continue;let B2=B9(h);if(!j.has(B2))j.set(B2,pU(L0))}};u(Q?.working_style),u(X);let S=$.conventions??[];if(j.size||S.length){z("## Conventions"),z();for(let[k,h]of j)z(`- **${k}:** ${h}`);for(let k of S)if(s0(k))z(`- ${k}`);z()}let d=(Q?.warnings??[]).filter((k)=>s0(k)),T0=["read the tree"];if(_)T0.push(`run the tests (\`${_}\`)`);if(y)T0.push("build the project");for(let[,k]of K.slice(0,1))T0.push(`\`${O6(k)}\``);z("## Guardrails"),z();for(let k of d)z(`- ${k}`);z(`- **Always OK:** ${[...new Set(T0)].join(" · ")}.`),z("- **Ask first:** dependency installs, deletions, migrations, schema changes, publish/release."),z(`- **Never:** force-push · push straight to \`${G}\` (branch and open a PR) · commit secrets.`),z();let j0=[];for(let[,k]of K)j0.push(`\`${O6(k)}\` exits 0`);for(let[,k]of H)j0.push(`\`${O6(k)}\` passes`);if(j0.push("changes committed with a conventional message"),z("## Definition of Done"),z(),z(`Done when: ${[...new Set(j0)].join(" · ")}.`),z(),z("## When stuck"),z(),z(`Ask a clarifying question, propose a short plan, or open a draft PR with notes — do not push large speculative changes to \`${G}\`.`),z(),Y&&(s0(Y.secrets)||(Y.never??[]).length)){if(z("## Security & secrets"),z(),s0(Y.secrets)){let k=s0(Y.example)?` (see \`${Y.example}\`)`:"";z(`- Secrets live in \`${Y.secrets}\`${k}. Never read or commit them.`)}for(let k of Y.never??[])if(s0(k))z(`- Never read or commit \`${k}\`.`);z()}if(z("## Commit & PR"),z(),X&&s0(X.commit_style))z(`- Commit style: ${pU(X.commit_style)}`);else z("- Conventional Commits preferred (`feat:`, `fix:`, `chore:`, …).");if(z(`- Branch off \`${G}\` and open a PR — never commit to \`${G}\` directly.`),z("- If build/test scripts or layout change, refresh this file in the **same PR** (`faf export --agents`)."),z(),$.stack){let k=[];for(let[h,L0]of Object.entries($.stack)){if(yS.has(h))continue;if(V0(L0))k.push(`- **${h0(`stack.${h}`)}:** ${L0.trim()}`)}if(k.length){z("## Stack"),z();for(let h of k)z(h);z()}}let Z0=$.generated;if(s0(Z0))z(`*Context authored: ${String(Z0)}*`);return Z.join(`
288
+ `)}function lU($,Z){V2(wS($,y0.agents),kS(Z))}function bS($,Z){let z=[],Q=(U)=>A($,U),X=(U)=>m($,U)??"";if(Q("tsconfig.json")&&/"strict"\s*:\s*true/.test(X("tsconfig.json")))z.push("TypeScript strict mode (tsconfig.json)");if(Z?.type==="module")z.push("ESM modules (`type: module`)");let J=[],Y=Z?.devDependencies??{};if(Q(".eslintrc")||Q(".eslintrc.json")||Q(".eslintrc.cjs")||Q("eslint.config.js")||Q("eslint.config.mjs")||"eslint"in Y)J.push("ESLint");if(Q(".prettierrc")||Q(".prettierrc.json")||Q("prettier.config.js")||"prettier"in Y)J.push("Prettier");let W=Q("pyproject.toml")?X("pyproject.toml"):"";if(/\[tool\.black\]/.test(W))J.push("black");if(/\[tool\.ruff\]/.test(W))J.push("ruff");if(/\[tool\.mypy\]/.test(W))J.push("mypy");if(Q("rustfmt.toml")||Q(".rustfmt.toml"))J.push("rustfmt");if(J.length)z.push(`Style enforced by ${J.join(" · ")} — obey the configs`);return z}function w9($,Z){let z={...Z},Q=null,X=m($,"package.json");if(X!==null)try{Q=JSON.parse(X)}catch{Q=null}let J=l5($,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=p5($);if(W.length)z.key_files=W}if(!Z.security){let U=[".env",".env.local",".env.development"].find((G)=>A($,G));if(U){let G=[".env.example",".env.sample",".env.template"].find((V)=>A($,V));z.security={secrets:U,...G?{example:G}:{}}}}if(!Z.conventions){let W=bS($,Q);if(W.length)z.conventions=W}return z}import{join as vS}from"path";function gS($){let Z=[];if(Z.push(d2($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Authored from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[z,Q]of Object.entries($.stack))if(V0(Q))Z.push(`# ${h0(`stack.${z}`)}: ${Q.trim()}`)}return Z.push(""),Z.join(`
289
+ `)}function dU($,Z){V2(vS($,y0.cursorrules),gS(Z),"# faf:start","# faf:end")}import{join as hS}from"path";var fS=($)=>$!==null&&$!==void 0&&$!==""&&$!=="slotignored"&&!(Array.isArray($)&&$.length===0),uS=new Set(["target_user","core_problem","mission_purpose"]);function mS($){let Z=[],z=$.instant_context,Q=$.commands,X=$.key_files??z?.key_files,J=Q?Object.entries(Q).filter(([,K])=>fS(K)):[],Y=J.filter(([K])=>/test/i.test(K)),W=J.filter(([K])=>/lint|check/i.test(K)&&!/test/i.test(K)),U=J.filter(([K])=>!/test|lint|check/i.test(K)),G=(K)=>{let q=K.toLowerCase();if(/install|deps/.test(q))return 0;if(/^build$|build/.test(q)&&!/rebuild/.test(q))return 1;if(/^dev$|develop/.test(q))return 2;if(/^start$|run/.test(q))return 3;return 4},V=[...U].sort((K,q)=>G(K[0])-G(q[0])||K[0].localeCompare(q[0])),H=[...Y,...W];if(Z.push(d2($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Authored from project.faf — refresh with `faf export --gemini`."),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if(V.length){Z.push(""),Z.push("## Setup & build"),Z.push(""),Z.push("```bash");for(let[K,q]of V){let{cmd:L,note:B}=t6(q);Z.push(`${L} # ${B??K}`)}Z.push("```")}if(H.length){Z.push(""),Z.push("## Test & verify"),Z.push(""),Z.push("```bash");for(let[,K]of H){let{cmd:q,note:L}=t6(K);Z.push(L?`${q} # ${L}`:q)}Z.push("```")}if(X&&X.length){Z.push(""),Z.push("## Where things live"),Z.push("");for(let K of X)Z.push(`- \`${K}\``)}if($.stack){let K=[];for(let[q,L]of Object.entries($.stack)){if(uS.has(q))continue;if(V0(L))K.push(`- ${h0(`stack.${q}`)}: ${L.trim()}`)}if(K.length){Z.push(""),Z.push("## Stack");for(let q of K)Z.push(q)}}return Z.push(""),Z.push("## Before changing things"),Z.push(""),Z.push("- Ask first: dependency installs, deletions, migrations, schema changes, publish/release."),Z.push("- Never: force-push · push straight to `main` · commit secrets."),Z.push(""),Z.join(`
290
+ `)}function iU($,Z){V2(hS($,y0.gemini),mS(Z))}import{join as cS}from"path";var nU=[["install","Install with"],["build","Build with"],["test","Test with"],["lint","Lint with"],["run","Run with"],["start","Start with"],["dev","Run the dev server with"]],pS=new Set([...nU.map(([$])=>$),"cicd"]);function lS($){let Z=[],z=$.project?.name??"Project";if(Z.push(d2($)),Z.push(""),Z.push(`# GitHub Copilot Instructions — ${z}`),Z.push(""),Z.push("> Authored from project.faf by FAF. Copilot reads these instructions on every request in this repository — keep them short and broadly applicable."),Z.push(""),V0($.project?.goal))Z.push($.project.goal.trim()),Z.push("");let Q=$.stack??{},X=[];if(V0($.project?.main_language))X.push(`- **Language:** ${$.project.main_language.trim()}`);for(let[G,V]of Object.entries(Q)){if(pS.has(G))continue;if(V0(V))X.push(`- **${h0(`stack.${G}`)}:** ${V.trim()}`)}if(X.length>0)Z.push("## Tech stack","",...X,"");let J=[];for(let[G,V]of nU){let H=Q[G];if(V0(H))J.push(`- ${V} \`${H.trim()}\`.`)}if(V0(Q.cicd))J.push(`- CI runs on ${Q.cicd.trim()}.`);if(J.length>0)Z.push("## Build & run","",...J,"");let Y=$.human_context??{},U=[["who",Y.who],["what",Y.what],["why",Y.why],["where",Y.where],["when",Y.when],["how",Y.how]].filter(([,G])=>V0(G)).map(([G,V])=>`- **${h0(`human_context.${G}`)}:** ${V.trim()}`);if(U.length>0)Z.push("## Project context","",...U,"");return Z.join(`
291
+ `)}function rU($,Z){w0($,".github"),V2(cS($,".github",y0.copilot),lS(Z),p2,l2,{root:$})}import{existsSync as dS}from"fs";import{join as iS}from"path";var nS="https://mcpaas.live/grok/mcp/v1",sU="mcp_servers.grok-faf-mcp";function rS($){return[`[${sU}]`,`url = "${nS}"`,""].join(`
292
+ `)}function oU($,Z){let z=rS(Z);w0($,".grok");let Q=l($,iS(".grok","config.toml"));if(!dS(Q))return a(Q,`# grok-faf-mcp — wired by FAF from project.faf
293
293
 
294
- `+z,{root:$,expect:null}),"created";let X=z0(Q);if(X.includes(`[${mU}]`))return"unchanged";let J=X.endsWith(`
294
+ `+z,{root:$,expect:null}),"created";let X=Q0(Q);if(X.includes(`[${sU}]`))return"unchanged";let J=X.endsWith(`
295
295
 
296
296
  `)?"":X.endsWith(`
297
297
  `)?`
298
298
  `:`
299
299
 
300
- `;return a(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as yS}from"path";var kS=[{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 P9($){if(!G0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function F9($,Z){if(!$)return null;return P9($[Z])}function bS($){let Z=[],z=P9($.project?.name)??"Project",Q=P9($.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 kS){let U=F9(X,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let J=F9($.project,"homepage")??F9($.project,"url");if(J&&/^(https?:)?\/\//i.test(J))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${J})`),Z.push("");return`${Z.join(`
300
+ `;return a(Q,X+J+z,{root:$,expect:X}),"merged"}import{join as sS}from"path";var oS=[{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 y9($){if(!V0($))return null;let Z=$.trim();if(/^(none|n\/a)$/i.test(Z))return null;return Z}function x9($,Z){if(!$)return null;return y9($[Z])}function aS($){let Z=[],z=y9($.project?.name)??"Project",Q=y9($.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 oS){let U=x9(X,Y);if(!U)continue;Z.push(`## ${W}`),Z.push(""),Z.push(U),Z.push("")}let J=x9($.project,"homepage")??x9($.project,"url");if(J&&/^(https?:)?\/\//i.test(J))Z.push("## Links"),Z.push(""),Z.push(`- [Homepage](${J})`),Z.push("");return`${Z.join(`
301
301
  `).trimEnd()}
302
- `}function pU($,Z){U2(yS($,x0.llms),bS(Z))}i();import{join as vS}from"path";import{deprecate as gS}from"node:util";var lU=$4.orange,hS=$4.cyan,fS=$4.cyanDeep,uS="#FF9500",mS="#FF3B30",cS="#E6EDF3",pS="#6E7681",dU={TROPHY:{glyph:"✪",color:lU},GOLD:{glyph:"★",color:lU},SILVER:{glyph:"◆",color:hS},BRONZE:{glyph:"◇",color:fS},GREEN:{glyph:"●",color:cS},YELLOW:{glyph:"●",color:uS},RED:{glyph:"○",color:mS},WHITE:{glyph:"♡",color:pS}};function f$($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var iU=["who","what","why","where","when","how"];function $Z($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${f$(Z)}</div><div class="v">${f$(z)}</div></div>`).join(`
303
- `)}function nU($,Z,z="project.faf"){let Q=f$($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=dU[X]??dU.WHITE,Y=Z.inherited?Z.represents?`inherited from ${f$(Z.represents)}`:"inherited":`${Z.score}%`,W=X==="TROPHY"&&!Z.inherited,U=$.human_context??{},G=iU.map((B)=>[B,U[B]]),V=Object.entries(U).filter(([B])=>!iU.includes(B)),q=[["goal",$.project?.goal],["main_language",$.project?.main_language],["type",$.project?.type],["framework",$.project?.framework],["faf_version",$.faf_version]],H=Object.entries($.stack??{}),K=H.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=H.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
302
+ `}function aU($,Z){V2(sS($,y0.llms),aS(Z))}i();import{join as tS}from"path";import{deprecate as eS}from"node:util";var tU=z4.orange,$E=z4.cyan,ZE=z4.cyanDeep,zE="#FF9500",QE="#FF3B30",XE="#E6EDF3",JE="#6E7681",eU={TROPHY:{glyph:"✪",color:tU},GOLD:{glyph:"★",color:tU},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 m$($){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 zZ($){return $.filter(([,Z])=>Z!==void 0&&Z!==null&&String(Z).trim()!=="").map(([Z,z])=>`<div class="row"><div class="k">${m$(Z)}</div><div class="v">${m$(z)}</div></div>`).join(`
303
+ `)}function ZG($,Z,z="project.faf"){let Q=m$($.project?.name??"Project"),X=Z.tier?.name??"WHITE",J=eU[X]??eU.WHITE,Y=Z.inherited?Z.represents?`inherited from ${m$(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]],K=Object.entries($.stack??{}),q=K.filter(([,B])=>B&&B!=="slotignored"&&String(B).trim()!==""),L=K.filter(([,B])=>B==="slotignored").length;return`<!DOCTYPE html>
304
304
  <html lang="en">
305
305
  <head>
306
306
  <meta charset="UTF-8">
@@ -341,7 +341,7 @@ footer strong{color:#e6edf3}
341
341
  <div class="eyebrow">project.faf · visual render</div>
342
342
  <header>
343
343
  <h1>${Q}</h1>
344
- <span class="badge">${J.glyph} ${f$(X)}</span>
344
+ <span class="badge">${J.glyph} ${m$(X)}</span>
345
345
  <span class="score">${Y}</span>
346
346
  </header>
347
347
  <div class="meter"><span></span></div>
@@ -349,103 +349,105 @@ ${W?'<p class="award statline"><span class="awd-pre">✅ All Required slots fill
349
349
 
350
350
  <section>
351
351
  <h2>The 6 W's</h2>
352
- ${$Z(G)||'<p class="muted">No human_context yet.</p>'}
353
- ${V.length?$Z(V):""}
352
+ ${zZ(G)||'<p class="muted">No human_context yet.</p>'}
353
+ ${V.length?zZ(V):""}
354
354
  </section>
355
355
 
356
356
  <section>
357
357
  <h2>Project</h2>
358
- ${$Z(q)||'<p class="muted">—</p>'}
358
+ ${zZ(H)||'<p class="muted">—</p>'}
359
359
  </section>
360
360
 
361
361
  <section>
362
362
  <h2>Stack</h2>
363
- ${K.length?$Z(K):'<p class="muted">No active stack slots.</p>'}
363
+ ${q.length?zZ(q):'<p class="muted">No active stack slots.</p>'}
364
364
  </section>
365
365
 
366
366
  <footer>
367
- Rendered on-demand from your current <strong>${f$(z)}</strong><br>
367
+ Rendered on-demand from your current <strong>${m$(z)}</strong><br>
368
368
  <strong>Humans like visuals. <span style="color:#00D4D4">We gave them one.</span></strong>
369
369
  </footer>
370
370
  </div>
371
371
  </body>
372
372
  </html>
373
- `}var lS='<meta name="description" content="Visual render of project.faf.';function dS($){return new TextDecoder().decode($).split(/\r?\n/).some((Z)=>Z.trim().startsWith(lS)&&Z.includes(" by faf"))}function ZZ($,Z,z,Q="project.faf",X={}){G2(vS($,"project.html"),nU(Z,z,Q),{root:$,format:"html",hasMark:dS,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var Ou=gS(nU,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as rS}from"path";import{deprecate as sS}from"node:util";var sU="JSONRPC",B4="1.0",M4=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],oU="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";function aU($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function u$($,Z={}){let z=aU($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:B4}];return[]}function iS($){let Z=new Set;for(let z of $.capabilities??[])if(z.cites_spec&&M4.includes(z.cites_spec))Z.add(z.cites_spec);return["text/plain",...Z]}function tU($,Z={}){let z=$.agent??{},Q=u$($,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((q)=>{let H=String(q.name??"").trim();if(!H)throw Error("A2A skill missing capabilities[].name");let K=Array.isArray(q.tags)?q.tags.map(String):[],L=q.cites_spec&&M4.includes(q.cites_spec)?[q.cites_spec,"text/plain"]:void 0;return{id:H,name:H,description:String(q.description??"").trim()||H,tags:K,...L?{inputModes:L}:{}}});return{name:X,description:J,supportedInterfaces:Q.map((q)=>({url:String(q.location),protocolBinding:sU,protocolVersion:String(q.version??B4)})),...G?{provider:G}:{},version:Y,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...Z.extensions??[]]},defaultInputModes:iS($),defaultOutputModes:["text/plain","application/json"],skills:V}}function N6($){return String($??"").trim()}function rU($){return Array.isArray($)?$.map(N6).filter(Boolean):[]}function L4($){let Z=N6($.agent?.id),z=/^urn:air:([^:]+):/.exec(Z);if(z)return z[1];let Q=N6($.metadata?.cards?.domain);if(Q)return Q;try{return new URL(N6($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function eU($){return nS($)}function nS($){let Z=N6($.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 $G($){let Z=$.agent??{},z=N6(Z.vendor)||N6(Z.displayName)||N6(Z.name);if(!z)return;let Q;try{Q=L4($)}catch{Q=void 0}return{displayName:z,...Q?{identifier:Q}:{}}}function ZG($){let Z=$.metadata?.cards??{},z=rU(Z.keywords),Q=rU(Z.examples);return{...z.length?{tags:z}:{},...Q.length?{representativeQueries:Q}:{}}}var zG="application/vnd.faf+yaml",oS=oU,aS=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function XG($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&aS.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 tS($){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 N4($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:zG,iana:`https://www.iana.org/assignments/media-types/${zG}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function zZ($,Z={}){let z={$schema:oS,name:XG($),version:String($.project?.version??"0.1.0"),description:tS($)},Q=S9($)??$.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":N4($,Z)},z}var m$="io.modelcontextprotocol.registry/publisher-provided",QG=4096;function JG($,Z={}){let z={"one.faf/context":N4($,Z)},Q=new TextEncoder().encode(JSON.stringify(z)).length;if(Q>QG)throw Error(`publisher-provided _meta is ${Q}B — exceeds the registry ${QG}B cap`);return{[m$]:z}}function YG($){return XG($)}function S9($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function WG($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var t6=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function O4($){let Z=WG($);return t6(Z)&&t6(Z._meta)&&t6(Z._meta["one.faf/context"])}function QZ($){let Z=WG($),z=t6(Z)&&t6(Z._meta)?Z._meta[m$]:void 0;return t6(z)&&t6(z["one.faf/context"])}function UG($,Z,z={},Q={}){let X=zZ(Z,z),J=rS($,"server-card");return G2(J,`${JSON.stringify(X,null,2)}
374
- `,{root:$,format:"json",hasMark:O4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function XZ($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return h$($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var Pu=sS(zZ,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");i();function D4($,Z,z,Q){let X=s5(eS($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(M(` ${X}`))}function ZE($){try{return $(),!0}catch(Z){if(!b$(Z))throw Z;return console.error(B6(Z,!0)),!1}}function e6($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
373
+ `}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 QZ($,Z,z,Q="project.faf",X={}){H2(tS($,"project.html"),ZG(Z,z,Q),{root:$,format:"html",hasMark:WE,mark:"faf mark (the `Visual render of project.faf` description line)",force:X.force})}var Jm=eS(ZG,"faf-cli: generateProjectHtml is deprecated, use renderProjectHtml","FAF0001");import{join as DE}from"path";import{deprecate as IE}from"node:util";var zG="JSONRPC",L4="1.0",N4=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],QG="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";var UE="1.0";function XG($){return($.endpoints??[]).filter((Z)=>String(Z.protocol??"").toLowerCase()==="a2a"&&Z.location)}function $$($,Z={}){let z=XG($);if(z.length>0)return z;let Q=Z.doorUrl?.trim();if(Q)return[{protocol:"a2a",location:Q,version:L4}];return[]}function GE($){let Z=new Set;for(let z of $.capabilities??[])if(z.cites_spec&&N4.includes(z.cites_spec))Z.add(z.cites_spec);return["text/plain",...Z]}function k9($,Z={}){let z=$.agent??{},Q=$$($,Z);if(Q.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let X=String(z.displayName??$.metadata?.persona??z.name??"").trim(),J=String(z.description??"").trim(),Y=String(z.version??"").trim();if(!X||!J||!Y)throw Error("A2A card needs agent.displayName|name, description, version in .fafa");let W=String(z.vendor??"").trim(),U=String(z.homepage??"").trim(),G=W&&U?{organization:W,url:U}:void 0,V=($.capabilities??[]).map((H)=>{let K=String(H.name??"").trim();if(!K)throw Error("A2A skill missing capabilities[].name");let q=Array.isArray(H.tags)?H.tags.map(String):[],L=H.cites_spec&&N4.includes(H.cites_spec)?[H.cites_spec,"text/plain"]:void 0;return{id:K,name:K,description:String(H.description??"").trim()||K,tags:q,...L?{inputModes:L}:{}}});return{name:X,description:J,supportedInterfaces:Q.map((H)=>({url:String(H.location),protocolBinding:zG,protocolVersion:String(H.version??L4)})),...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 VE=/^[a-z0-9][a-z0-9._-]*$/,HE=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function o($){return String($??"").trim()}function XZ($){return Array.isArray($)?$.map(o).filter(Boolean):[]}function KE($){return o($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function qE($,Z,z){let Q=["display_name","description","version"].filter((X)=>!o($[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(!HE.test(z))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function BE($,Z){return($.skills??[]).filter((z)=>o(z.name)).map((z)=>({name:o(z.name),type:o(z.type)||"tool",description:o(z.description)||o(z.name),tags:Z.length?Z:[o(z.name).toLowerCase()]}))}function ME($){return($.packages??[]).filter((Z)=>o(Z.registryType)&&o(Z.identifier)).map((Z)=>({registryType:o(Z.registryType),identifier:o(Z.identifier),...o(Z.version)?{version:o(Z.version)}:{}}))}function LE($,Z){let z=[...($.endpoints??[]).filter((Q)=>o(Q.url)).map((Q)=>({protocol:o(Q.protocol).toLowerCase(),transport:"http",location:o(Q.url)})),...Z.map((Q)=>({protocol:"mcp",transport:"stdio",location:Q.identifier}))];if(z.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return z}function NE($,Z,z,Q){let X={domain:Z},J=[["repository",o($.repository)],["icon",o($.icon)],["organizationUrl",o($.organization_url)]];for(let[W,U]of J)if(U)X[W]=U;if(z.length)X.keywords=z;let Y=XZ($.example_requests);if(Y.length)X.examples=Y;if(Q.length)X.packages=Q;return X}function JG($){let Z=o($.handle).toLowerCase(),z=KE($.domain);qE($,Z,z);let Q=XZ($.tags),X=ME($),J={name:Z,displayName:o($.display_name),id:`urn:air:${z}:agent:${Z}`,...o($.organization)?{vendor:o($.organization)}:{},version:o($.version),description:o($.description),homepage:o($.homepage)||`https://${z}`,...o($.license)?{license:o($.license)}:{}};return{version:UE,agent:J,capabilities:BE($,Q),endpoints:LE($,X),metadata:{cards:NE($,z,Q,X)}}}function YG($){return g6($,{lineWidth:0})}function O4($){let Z=o($.agent?.id),z=/^urn:air:([^:]+):/.exec(Z);if(z)return z[1];let Q=o($.metadata?.cards?.domain);if(Q)return Q;try{return new URL(o($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function WG($){return OE($)}function OE($){let Z=o($.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 UG($){let Z=$.agent??{},z=o(Z.vendor)||o(Z.displayName)||o(Z.name);if(!z)return;let Q;try{Q=O4($)}catch{Q=void 0}return{displayName:z,...Q?{identifier:Q}:{}}}function GG($){let Z=$.metadata?.cards??{},z=XZ(Z.keywords),Q=XZ(Z.examples);return{...z.length?{tags:z}:{},...Q.length?{representativeQueries:Q}:{}}}var VG="application/vnd.faf+yaml",TE=QG,AE=/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;function KG($){let Z=String($.project?.name??"project").trim();if(Z.includes("/")&&AE.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 CE($){let Z=String($.project?.goal??$.context??$.project?.name??"MCP server").replace(/\s+/g," ").trim();if(!Z)return"MCP server";return Z.length<=100?Z:`${Z.slice(0,97).trimEnd()}...`}function D4($,Z={}){return{faf:Z.fafPointer??"./project.faf",mediaType:VG,iana:`https://www.iana.org/assignments/media-types/${VG}`,deterministic:!0,...Z.scoreEndpoint?{scoreEndpoint:Z.scoreEndpoint}:{},generated:$.generated??Z.now??new Date().toISOString()}}function JZ($,Z={}){let z={$schema:TE,name:KG($),version:String($.project?.version??"0.1.0"),description:CE($)},Q=b9($)??$.project?.name;if(Q&&Q.length<=100)z.title=Q;let X=$.project?.homepage??$.project?.website??$.project?.url;if(X)z.websiteUrl=X;if(Z.remoteUrl)z.remotes=[{type:"streamable-http",url:Z.remoteUrl}];return z._meta={"one.faf/context":D4($,Z)},z}var c$="io.modelcontextprotocol.registry/publisher-provided",HG=4096;function qG($,Z={}){let z={"one.faf/context":D4($,Z)},Q=new TextEncoder().encode(JSON.stringify(z)).length;if(Q>HG)throw Error(`publisher-provided _meta is ${Q}B — exceeds the registry ${HG}B cap`);return{[c$]:z}}function BG($){return KG($)}function b9($){let Z=$.project?.title;if(typeof Z==="string"){let z=Z.trim();if(z&&z.length<=100)return z}return}function MG($){try{return JSON.parse(new TextDecoder().decode($).replace(/^\uFEFF/,""))}catch{return}}var Z$=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function I4($){let Z=MG($);return Z$(Z)&&Z$(Z._meta)&&Z$(Z._meta["one.faf/context"])}function YZ($){let Z=MG($),z=Z$(Z)&&Z$(Z._meta)?Z._meta[c$]:void 0;return Z$(z)&&Z$(z["one.faf/context"])}function LG($,Z,z={},Q={}){let X=JZ(Z,z),J=DE($,"server-card");return H2(J,`${JSON.stringify(X,null,2)}
374
+ `,{root:$,format:"json",hasMark:I4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:Q.force}),J}function WZ($,Z){let z={name:Z.name,title:Z.title,version:Z.version,_meta:Z.meta};return u$($,z,{"":{name:["$schema"],title:["name"],version:["description","title","name"]}})}var Bm=IE(JZ,"faf-cli: generateServerCard is deprecated, use buildServerCard","FAF0002");i();function T4($,Z,z,Q){let X=a5(_E($,Z),Z,Q?.[0],Q?.[1],{root:$});if(z(),console.log(` ${Z}`),X)console.log(M(` ${X}`))}function FE($){try{return $(),!0}catch(Z){if(!g$(Z))throw Z;return console.error(L6(Z,!0)),!1}}function z$($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
375
375
 
376
- Run 'faf init' to create one.`),process.exit(2);let z=$.output?$E(process.cwd(),$.output):process.cwd();if($.output)j0(z);let Q=r(Z),X=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,J=0,Y=(U)=>{if(!ZE(U))J++};if(X||$.agents)Y(()=>D4(z,"AGENTS.md",()=>vU(z,R9(z,Q))));if(X||$.cursor)Y(()=>D4(z,".cursorrules",()=>gU(z,Q),["# faf:start","# faf:end"]));if(X||$.gemini)Y(()=>D4(z,"GEMINI.md",()=>hU(z,R9(z,Q))));if(X||$.copilot)Y(()=>D4(z,".github/copilot-instructions.md",()=>uU(z,Q)));if($.grok)Y(()=>{let U=cU(z,Q);console.log(` .grok/config.toml (${U})`)});if($.llms)Y(()=>D4(z,"llms.txt",()=>pU(z,Q)));if(X||$.html)Y(()=>{let U=n(Z,()=>N0(p(Z)));ZZ(z,Q,U,Z,{force:$.force}),console.log(" project.html")});let W=Q.app_type==="server-card"||Q.project?.type==="server-card";if($.card||X&&W)Y(()=>{let U=UG(z,Q,{},{force:$.force});console.log(` ${U.replace(`${z}/`,"")}`)});if(console.log(`${I("exported")} ${M(`from ${Z}`)}`),J>0)process.exit(1)}import{existsSync as HE,lstatSync as KE}from"fs";import{dirname as MG,resolve as y9}from"path";import{existsSync as GG}from"fs";import{basename as zE,dirname as I4,join as VG}from"path";import{deprecate as QE}from"node:util";var T4="https://faf.one/ext/context/v1",E9=["a2a","mcp","registry","catalog","ard"];function qG($){return n0(z0(l(I4($),zE($))))}function HG($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=VG($,Q);if(GG(X))return X}let z=I4($);if(z!==$)for(let Q of Z){let X=VG(z,Q);if(GG(X))return X}return null}function XE($,Z,z){let Q=N4(Z,z),X=$.agent??{},J={fafaSpecVersion:String($.version??B4),mediaTypes:[...M4],provenance:{faf:Q.faf,mediaType:Q.mediaType},generated:Q.generated};if(X.id)J.agentId=X.id;let Y=JE($);if(Y)J.passport=Y;return J}function JE($){try{return`https://${L4($)}/.well-known/fafa`}catch{return}}function KG($,Z,z={}){if(u$($,z).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");return tU($,{doorUrl:z.doorUrl,extensions:[{uri:T4,description:"FAF passport and project DNA as typed parts",required:!1,params:XE($,Z,z)}]})}var Zm=QE(KG,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function YE($,Z){return Z.a2aCardUrl??`https://${L4($)}/.well-known/agent-card.json`}function WE($,Z,z={}){let Q=L4($),X=eU($),J=$.agent??{},Y=z.now??Z.generated??new Date().toISOString(),W=[];if(u$($,z).length>0)W.push({identifier:`urn:air:${Q}:a2a:${X}`,displayName:String(J.displayName??J.name??"A2A Agent Card"),type:"application/a2a-agent-card+json",description:"A2A v1.0 Agent Card. Projected from .fafa.",url:YE($,z),updatedAt:Y});return W.push({identifier:`urn:air:${Q}:agent:${X}`,displayName:String(J.displayName??J.name??".fafa"),type:"application/vnd.fafa+yaml",description:"FAF agent passport (.fafa).",url:`https://${Q}/.well-known/fafa`,updatedAt:Y}),W}var UE=["url","type","updatedAt"];function j9($,Z,z){if($===null){let J={specVersion:"1.0",...z?{host:z}:{},entries:Z};return{text:`${JSON.stringify(J,null,2)}
377
- `,changed:!0}}let Q=RU($,"entries",Z,{id:"identifier",update:UE});if(!z||GE(Q.text))return Q;let X=h$(Q.text,{host:z},{"":{host:["specVersion"]}});return{text:X.text,changed:Q.changed||X.changed}}function GE($){try{let Z=JSON.parse($);return Object.prototype.hasOwnProperty.call(Z,"host")}catch{return!0}}function JZ($){let Z=$.opts??{},z=new Set($.targets?.length?$.targets:E9),X={block:N4($.faf,Z)};if(z.has("mcp"))X.mcp=zZ($.faf,Z);if(z.has("registry")){let J=S9($.faf);X.registry={name:YG($.faf),...J?{title:J}:{},_meta:JG($.faf,Z)}}if(z.has("a2a")||z.has("catalog")||z.has("ard")){if(!$.fafa){if($.targets?.some((J)=>J==="a2a"||J==="catalog"||J==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(z.has("a2a")&&$.fafa)if(u$($.fafa,Z).length===0){if($.targets?.includes("a2a"))throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.")}else X.a2a=KG($.fafa,$.faf,Z);if((z.has("catalog")||z.has("ard"))&&$.fafa){let J=WE($.fafa,$.faf,Z);if(z.has("catalog"))X.catalog=J;if(z.has("ard")){let W=ZG($.fafa);X.ard=J.map((U)=>({...U,...W}))}let Y=$G($.fafa);if(Y)X.catalogHost=Y}return VE(X),X}function VE($){let Z=JSON.stringify($.block),z=[];if($.mcp){let Q=$.mcp._meta;z.push(JSON.stringify(Q["one.faf/context"]))}if($.registry){let Q=$.registry._meta["io.modelcontextprotocol.registry/publisher-provided"];z.push(JSON.stringify(Q["one.faf/context"]))}for(let Q of z)if(Q!==Z)throw Error("context block drifted across card targets — one projector, one block");if($.a2a){let Q=$.a2a.capabilities.extensions[0].params,X=$.block;if(Q.provenance?.faf!==X.faf||Q.provenance?.mediaType!==X.mediaType)throw Error("A2A extension provenance drifted from the context block — one context, every door")}}function w9($){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===T4)}function qE($){return O4($)||QZ($)||w9($)}function x9($,Z,z,Q={}){return j0(z??I4($),I4($)),G2($,`${JSON.stringify(Z,null,2)}
378
- `,{root:z??I4($),format:"json",hasMark:Q.owns??qE,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function BG($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!E9.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${E9.join(",")})`);return Z}i();function BE($){try{return KE($),!0}catch{return!1}}function ME($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[m$]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function LG($={}){let Z=$.faf?y9($.faf):m();if(!Z||!HE(Z))console.error(`Error: project.faf not found
376
+ Run 'faf init' to create one.`),process.exit(2);let z=$.output?RE(process.cwd(),$.output):process.cwd();if($.output)w0(z);let Q=s(Z),X=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.copilot&&!$.grok&&!$.llms&&!$.conductor&&!$.html&&!$.card,J=0,Y=(U)=>{if(!FE(U))J++};if(X||$.agents)Y(()=>T4(z,"AGENTS.md",()=>lU(z,w9(z,Q))));if(X||$.cursor)Y(()=>T4(z,".cursorrules",()=>dU(z,Q),["# faf:start","# faf:end"]));if(X||$.gemini)Y(()=>T4(z,"GEMINI.md",()=>iU(z,w9(z,Q))));if(X||$.copilot)Y(()=>T4(z,".github/copilot-instructions.md",()=>rU(z,Q)));if($.grok)Y(()=>{let U=oU(z,Q);console.log(` .grok/config.toml (${U})`)});if($.llms)Y(()=>T4(z,"llms.txt",()=>aU(z,Q)));if(X||$.html)Y(()=>{let U=r(Z,()=>O0(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=LG(z,Q,{},{force:$.force});console.log(` ${U.replace(`${z}/`,"")}`)});if(console.log(`${T("exported")} ${M(`from ${Z}`)}`),J>0)process.exit(1)}import{existsSync as gE,lstatSync as hE}from"fs";import{dirname as AG,resolve as m9}from"path";import{existsSync as NG}from"fs";import{basename as PE,dirname as A4,join as OG}from"path";import{deprecate as SE}from"node:util";var p$="https://faf.one/ext/context/v1",v9=["a2a","mcp","registry","catalog","ard"];function UZ($){return r0(Q0(l(A4($),PE($))))}function DG($=process.cwd()){let Z=["agent.fafa",".fafa"];for(let Q of Z){let X=OG($,Q);if(NG(X))return X}let z=A4($);if(z!==$)for(let Q of Z){let X=OG(z,Q);if(NG(X))return X}return null}function EE($,Z,z){let Q=D4(Z,z),X=$.agent??{},J={fafaSpecVersion:String($.version??L4),mediaTypes:[...N4],provenance:{faf:Q.faf,mediaType:Q.mediaType},generated:Q.generated};if(X.id)J.agentId=X.id;let Y=jE($);if(Y)J.passport=Y;return J}function jE($){try{return`https://${O4($)}/.well-known/fafa`}catch{return}}function IG($,Z,z={}){if($$($,z).length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");if(!Z)return k9($,{doorUrl:z.doorUrl});return k9($,{doorUrl:z.doorUrl,extensions:[{uri:p$,description:"FAF passport and project DNA as typed parts",required:!1,params:EE($,Z,z)}]})}var cm=SE(IG,"faf-cli: generateA2ACard is deprecated, use buildA2ACard","FAF0003");function wE($,Z){return Z.a2aCardUrl??`https://${O4($)}/.well-known/agent-card.json`}function xE($,Z={},z={}){let Q=O4($),X=WG($),J=$.agent??{},Y=z.now??Z.generated??new Date().toISOString(),W=[];if($$($,z).length>0)W.push({identifier:`urn:air:${Q}:a2a:${X}`,displayName:String(J.displayName??J.name??"A2A Agent Card"),type:"application/a2a-agent-card+json",description:"A2A v1.0 Agent Card. Projected from .fafa.",url:wE($,z),updatedAt:Y});return W.push({identifier:`urn:air:${Q}:agent:${X}`,displayName:String(J.displayName??J.name??".fafa"),type:"application/vnd.fafa+yaml",description:"FAF agent passport (.fafa).",url:`https://${Q}/.well-known/fafa`,updatedAt:Y}),W}var yE=["url","type","updatedAt"];function g9($,Z,z){if($===null){let J={specVersion:"1.0",...z?{host:z}:{},entries:Z};return{text:`${JSON.stringify(J,null,2)}
377
+ `,changed:!0}}let Q=yU($,"entries",Z,{id:"identifier",update:yE});if(!z||kE(Q.text))return Q;let X=u$(Q.text,{host:z},{"":{host:["specVersion"]}});return{text:X.text,changed:Q.changed||X.changed}}function kE($){try{let Z=JSON.parse($);return Object.prototype.hasOwnProperty.call(Z,"host")}catch{return!0}}function C4($,Z={}){return $$($,Z).length>0?["a2a","catalog","ard"]:["catalog","ard"]}var h9=["mcp","registry"];function GZ($){let Z=$.opts??{},z=$.faf,Q=z?v9:$.fafa?C4($.fafa,Z):[],X=new Set($.targets?.length?$.targets:Q),J={};if(z)J.block=D4(z,Z);if(!z&&h9.some((Y)=>X.has(Y)))throw Error("MCP and registry cards come from project.faf. Run 'faf init' to create one.");if(z&&X.has("mcp"))J.mcp=JZ(z,Z);if(z&&X.has("registry")){let Y=b9(z);J.registry={name:BG(z),...Y?{title:Y}:{},_meta:qG(z,Z)}}if(X.has("a2a")||X.has("catalog")||X.has("ard")){if(!$.fafa){if($.targets?.some((Y)=>Y==="a2a"||Y==="catalog"||Y==="ard"))throw Error("A2A/catalog/ARD require a .fafa (agent.fafa). Will not invent an agent.")}}if(X.has("a2a")&&$.fafa)if($$($.fafa,Z).length===0){if($.targets?.includes("a2a"))throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.")}else J.a2a=IG($.fafa,z,Z);if((X.has("catalog")||X.has("ard"))&&$.fafa){let Y=xE($.fafa,z,Z);if(X.has("catalog"))J.catalog=Y;if(X.has("ard")){let U=GG($.fafa);J.ard=Y.map((G)=>({...G,...U}))}let W=UG($.fafa);if(W)J.catalogHost=W}return bE(J),J}function bE($){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){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===p$);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 f9($){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===p$)}function vE($){return I4($)||YZ($)||f9($)}function u9($,Z,z,Q={}){return w0(z??A4($),A4($)),H2($,`${JSON.stringify(Z,null,2)}
378
+ `,{root:z??A4($),format:"json",hasMark:Q.owns??vE,mark:Q.mark??"FAF context-block (a faf card mark)",force:Q.force}).result}function TG($){if(!$)return;let Z=$.split(",").map((Q)=>Q.trim().toLowerCase()).filter(Boolean),z=Z.filter((Q)=>!v9.includes(Q));if(z.length)throw Error(`unknown card target: ${z.join(", ")} (use ${v9.join(",")})`);return Z}i();function fE($){try{return hE($),!0}catch{return!1}}function uE($){try{let z=JSON.parse($.replace(/^\uFEFF/,""))?._meta?.[c$]?.["one.faf/context"]?.generated;return typeof z==="string"?z:void 0}catch{return}}function CG($={}){let Z=$.faf?m9($.faf):f();if(!Z||!gE(Z))console.error(`Error: project.faf not found
379
379
 
380
- Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=y9($.in??"./server.json"),X=$.in?MG(Q):process.cwd();if(!BE(Q))console.error(`Error: ${Q} not found.
380
+ Run 'faf init' to create one.`),process.exit(2);let z=s(Z),Q=m9($.in??"./server.json"),X=$.in?AG(Q):process.cwd();if(!fE(Q))console.error(`Error: ${Q} not found.
381
381
 
382
382
  'faf server-card' patches the identity into an existing registry server.json;
383
- it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=l(X,Q),Y=z0(J),W=$.generated??ME(Y)??new Date().toISOString(),U=JZ({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),G=U.registry.name,V=U.registry.title,q;try{q=XZ(Y,{name:G,title:V,version:$.setVersion,meta:U.registry._meta})}catch(L){if(!(L instanceof h0))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(q.text);return}let H=y9($.out??Q),K=V??"(none in project.faf — the file's own kept)";if(H===Q){if(q.changed)a(J,q.text,{root:X,expect:Y})}else Y2(H),G2(H,q.text,{root:$.out?MG(H):process.cwd(),format:"json",hasMark:QZ,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${I("✓")} ${H} — name=${G} title=${K} ${M(q.changed||H!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as NG,lstatSync as LE}from"fs";import{dirname as OG,join as c$,resolve as k9}from"path";i();function YZ($){try{return LE($),!0}catch{return!1}}var d2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0,NE=[{target:"registry",file:["server.json"],stamp:($)=>d2(d2(d2($._meta)?.[m$])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>d2(d2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=d2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(d2).find((Q)=>Q?.uri===T4):void 0;return d2(z?.params)?.generated}}];function OE($,Z){for(let{target:z,file:Q,stamp:X}of NE){let J=c$($,...Q);if(Z?.length&&!Z.includes(z)||!YZ(J))continue;try{let Y=d2(JSON.parse(z0(l($,J)).replace(/^\uFEFF/,""))),W=Y?X(Y):void 0;if(typeof W==="string")return W}catch{}}return}function DG($={}){let Z=$.dir?k9($.dir):process.cwd(),z;try{z=BG($.target)}catch(H){console.error(`Error: ${H.message}`),process.exit(2)}let Q=$.faf?k9($.faf):m(Z);if(!Q||!NG(Q))console.error(`Error: project.faf not found
383
+ it does not create packages/icons. Seed a server.json first, then run this.`),process.exit(2);let J=l(X,Q),Y=Q0(J),W=$.generated??uE(Y)??new Date().toISOString(),U=GZ({faf:z,targets:["registry"],opts:{fafPointer:"./project.faf",now:W}}),G=U.registry.name,V=U.registry.title,H;try{H=WZ(Y,{name:G,title:V,version:$.setVersion,meta:U.registry._meta})}catch(L){if(!(L instanceof f0))throw L;console.error(`faf: ${Q}: ${L.message} — faf cannot change only its identity keys, so it left the file unchanged.`),process.exit(1)}if($.check){process.stdout.write(H.text);return}let K=m9($.out??Q),q=V??"(none in project.faf — the file's own kept)";if(K===Q){if(H.changed)a(J,H.text,{root:X,expect:Y})}else U2(K),H2(K,H.text,{root:$.out?AG(K):process.cwd(),format:"json",hasMark:YZ,mark:"faf identity (`_meta` publisher-provided `one.faf/context`)",force:$.force});console.error(`${T("✓")} ${K} — name=${G} title=${q} ${M(H.changed||K!==Q?"(identity emitted from faf-cli)":"(unchanged)")}`)}import{existsSync as _G,lstatSync as mE}from"fs";import{dirname as RG,join as l$,resolve as c9}from"path";i();function VZ($){try{return mE($),!0}catch{return!1}}var y2=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)?$:void 0;function FG($){return(Array.isArray($.entries)?$.entries.map(y2):[]).find((z)=>z?.type==="application/vnd.fafa+yaml"&&/^urn:air:[^:]+:agent:/.test(String(z?.identifier)))?.updatedAt}var cE=[{target:"registry",file:["server.json"],stamp:($)=>y2(y2(y2($._meta)?.[c$])?.["one.faf/context"])?.generated},{target:"mcp",file:["server-card"],stamp:($)=>y2(y2($._meta)?.["one.faf/context"])?.generated},{target:"a2a",file:[".well-known","agent-card.json"],stamp:($)=>{let Z=y2($.capabilities)?.extensions,z=Array.isArray(Z)?Z.map(y2).find((Q)=>Q?.uri===p$):void 0;return y2(z?.params)?.generated}},{target:"catalog",file:[".well-known","ai-catalog.json"],stamp:FG},{target:"ard",file:[".well-known","ard.json"],stamp:FG}];function pE($,Z){for(let{target:z,file:Q,stamp:X}of cE){let J=l$($,...Q);if(Z?.length&&!Z.includes(z)||!VZ(J))continue;try{let Y=y2(JSON.parse(Q0(l($,J)).replace(/^\uFEFF/,""))),W=Y?X(Y):void 0;if(typeof W==="string")return W}catch{}}return}function HZ($={}){let Z=$.dir?c9($.dir):process.cwd(),z;try{z=TG($.target)}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}let Q=$.fafa?c9($.fafa):DG(Z),X=Q&&_G(Q)?UZ(Q):void 0,J=$.faf?c9($.faf):f(Z),Y=Boolean(J&&_G(J));if(!Y){let q=z?.filter((L)=>h9.includes(L))??[];if(!X||q.length>0){let L=X?`
384
+ With only an agent.fafa: faf cards --target ${C4(X,{doorUrl:$.doorUrl}).join(",")}`:"";console.error(`Error: project.faf not found
384
385
 
385
- Run 'faf init' to create one.`),process.exit(2);let X=r(Q),J=$.fafa?k9($.fafa):HG(Z),Y=J&&NG(J)?qG(J):void 0,W;try{W=JZ({faf:X,fafa:Y,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:OE(Z,z)??new Date().toISOString()}})}catch(H){console.error(`Error: ${H.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(W,null,2)}
386
- `);return}let U=[],G=$.force===!0,V=0,q=(H,K,L="its own keys")=>{try{U.push({out:H,changed:K()})}catch(B){if(B instanceof h0)console.error(`faf: ${H}: ${B.message} — faf cannot change only ${L}, so it left the file unchanged.`);else if(b$(B))console.error(B6(B,!0));else throw B;V++}};if(W.a2a){let H=c$(Z,".well-known","agent-card.json");q(H,()=>x9(H,W.a2a,Z,{owns:w9,mark:`FAF context extension (${T4})`,force:G})!=="unchanged")}if(W.mcp){let H=c$(Z,"server-card");q(H,()=>x9(H,W.mcp,Z,{owns:O4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:G})!=="unchanged")}if(W.catalog){let H=c$(Z,".well-known","ai-catalog.json"),K=W.catalog;q(H,()=>{j0(Z,OG(H));let L=l(Z,H),B=YZ(H)?z0(L):null,N=j9(B,K,W.catalogHost);if(N.changed)a(L,N.text,{root:Z,expect:B});return N.changed},"its own rows")}if(W.ard){let H=c$(Z,".well-known","ard.json"),K=W.ard;if(q(H,()=>{j0(Z,OG(H));let L=l(Z,H),B=YZ(H)?z0(L):null,N=j9(B,K,W.catalogHost);if(N.changed)a(L,N.text,{root:Z,expect:B});return N.changed},"its own rows"),!K.some((L)=>L.representativeQueries?.length))console.error(`${M("note")} ${H}: 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(W.registry){let H=c$(Z,"server.json");if(YZ(H)){let K=W.registry;q(H,()=>{let L=l(Z,H),B=z0(L),N=XZ(B,{name:K.name,title:K.title,meta:K._meta});if(N.changed)a(L,N.text,{root:Z,expect:B});return N.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${H} not found.
386
+ Run 'faf init' to create one.${L}`),process.exit(2)}}let W=Y?s(J):void 0,U;try{U=GZ({faf:W,fafa:X,targets:z,opts:{a2aCardUrl:$.a2aUrl,doorUrl:$.doorUrl,fafPointer:$.fafPointer,now:pE(Z,z)??new Date().toISOString()}})}catch(q){console.error(`Error: ${q.message}`),process.exit(2)}if($.check){process.stdout.write(`${JSON.stringify(U,null,2)}
387
+ `);return}let G=[],V=$.force===!0,H=0,K=(q,L,B="its own keys")=>{try{G.push({out:q,changed:L()})}catch(N){if(N instanceof f0)console.error(`faf: ${q}: ${N.message} — faf cannot change only ${B}, so it left the file unchanged.`);else if(g$(N))console.error(L6(N,!0));else throw N;H++}};if(U.a2a){let q=l$(Z,".well-known","agent-card.json");K(q,()=>u9(q,U.a2a,Z,{owns:f9,mark:`faf render hash or FAF context extension (${p$})`,force:V})!=="unchanged")}if(U.mcp){let q=l$(Z,"server-card");K(q,()=>u9(q,U.mcp,Z,{owns:I4,mark:'FAF context-block (`_meta["one.faf/context"]`)',force:V})!=="unchanged")}if(U.catalog){let q=l$(Z,".well-known","ai-catalog.json"),L=U.catalog;K(q,()=>{w0(Z,RG(q));let B=l(Z,q),N=VZ(q)?Q0(B):null,I=g9(N,L,U.catalogHost);if(I.changed)a(B,I.text,{root:Z,expect:N});return I.changed},"its own rows")}if(U.ard){let q=l$(Z,".well-known","ard.json"),L=U.ard;if(K(q,()=>{w0(Z,RG(q));let B=l(Z,q),N=VZ(q)?Q0(B):null,I=g9(N,L,U.catalogHost);if(I.changed)a(B,I.text,{root:Z,expect:N});return I.changed},"its own rows"),!L.some((B)=>B.representativeQueries?.length))console.error(`${M("note")} ${q}: no representativeQueries — registries build their search index from these, so the entries are a valid catalog but will not be found. Add 2-5 to the .fafa as metadata.cards.examples.`)}if(U.registry){let q=l$(Z,"server.json");if(VZ(q)){let L=U.registry;K(q,()=>{let B=l(Z,q),N=Q0(B),I=WZ(N,{name:L.name,title:L.title,meta:L._meta});if(I.changed)a(B,I.text,{root:Z,expect:N});return I.changed},"its identity keys")}else if(z?.includes("registry"))console.error(`Error: ${q} not found.
387
388
 
388
- Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(U.length===0&&V===0){console.error(`${I("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog; server.json for registry")}`);return}for(let{out:H,changed:K}of U)console.error(`${I("✓")} ${H}${K?"":` ${M("(unchanged)")}`}`);if(V>0)process.exit(1)}import{join as DE}from"path";import IE from"open";i();function TE($){if(process.env.CI)return!1;try{return IE($).catch(()=>{return}),!0}catch{return!1}}function IG($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
389
+ Registry target patches an existing server.json. Seed one first.`),process.exit(2)}if(G.length===0&&H===0){console.error(`${T("faf cards")} ${M("nothing to write — need .fafa for A2A/catalog/ARD; server.json for registry")}`);return}for(let{out:q,changed:L}of G)console.error(`${T("✓")} ${q}${L?"":` ${M("(unchanged)")}`}`);if(!Y)console.error(M("BETTER: cards from your agent.fafa. BEST: add your project.faf (faf init) for the FAF context, MCP and registry cards."));if(H>0)process.exit(1)}import{existsSync as lE,readFileSync as dE}from"fs";import{join as iE,resolve as PG}from"path";import{createInterface as nE}from"readline";i();var rE=["a2a","mcp"],sE={a2a:"A2A card",mcp:"MCP Server Card",registry:"registry server.json",catalog:"AI Catalog",ard:"ARD"};function SG($){return $.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^[^a-z0-9]+/,"").replace(/-+$/,"")}function oE($){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 aE($){try{let Z=JSON.parse(dE(iE($,"package.json"),"utf-8")).version;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}catch{return}}function EG($,Z,z){if(/^https?:\/\//i.test(Z))$.endpoints=[{protocol:z,url:Z}];else $.packages=[{registryType:"npm",identifier:Z}]}function n2($){return($??"").trim()}function tE($){let Z=n2($.name),z={display_name:Z,handle:n2($.shortName)||SG(Z),domain:n2($.domain),description:n2($.description),version:n2($.setVersion),skills:($.skill??[]).map(oE).filter((Q)=>Q.name),example_requests:($.example??[]).map(n2).filter(Boolean)};if($.url)EG(z,n2($.url),n2($.protocol).toLowerCase()||"a2a");if($.package)z.packages=[{registryType:"npm",identifier:n2($.package)}];return z}function jG($){return async(Z,z)=>(await $(z?`${Z} ${M(`(${z})`)}: `:`${Z}: `)).trim()||z||""}async function wG($,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 eE($,Z){let z=jG(Z),Q=await z("Where it runs — a URL people call, or an npm package");if(!Q)return;let X="a2a";if(/^https?:\/\//i.test(Q)){let J=(await z("Protocol at that URL — a2a or mcp","a2a")).toLowerCase();X=rE.includes(J)?J:"a2a"}EG($,Q,X)}async function $j($){let Z=[];for(;;){let[z]=await wG($,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 Zj($,Z,z){let Q={...$},X=jG(Z);if(Q.display_name||=await X("Name — what people see, e.g. Weather Agent"),Q.handle||=await X("Short name — lowercase, no spaces",SG(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",aE(z)??"0.1.0"),!Q.endpoints?.length&&!Q.packages?.length)await eE(Q,Z);if(!Q.skills?.length)Q.skills=await $j(Z);if(!Q.example_requests?.length)Q.example_requests=await wG(Z,"A question people ask it — search finds it by these (2-5)","Another (Enter to finish)",5);return Q}function zj($){if(!$.skills?.length)throw Error("Missing answer: what it can do (at least one capability)");return YG(JG($))}function Qj($){return Boolean($.name&&$.domain&&$.description&&$.setVersion&&($.url||$.package)&&$.skill?.length)}function Xj($){if($)return{ask:$,close:()=>{}};if(!process.stdin.isTTY)return{close:()=>{}};let Z=nE({input:process.stdin,output:process.stdout});return{ask:(z)=>new Promise((Q)=>Z.question(z,Q)),close:()=>Z.close()}}async function xG($={},Z){let z=PG($.dir??process.cwd()),Q=PG(z,$.out??"agent.fafa");if(lE(Q)&&!$.force)console.error(`Error: ${Q} already exists — edit it, or use --force to replace it.`),process.exit(2);let X=Qj($)?{close:()=>{}}:Xj(Z);try{let J=tE($);if(X.ask){if(!Z)console.log(`${T("card init")} ${M("— seven answers, one agent.fafa")}
390
+ `);J=await Zj(J,X.ask,z)}let Y;try{Y=zj(J)}catch(G){console.error(`Error: ${G.message}`),process.exit(2)}if(a(Q,Y,{root:z}),console.log(`${T("✓")} ${Q}`),(J.example_requests??[]).length<2)console.error(`${M("note")} add 2-5 questions people ask it (metadata.cards.examples) — search finds it by these.`);let W=C4(UZ(Q)),U=W.map((G)=>sE[G]).join(", ");if(X.ask){let G=(await X.ask(`Write your ${U} now? ${M("(Y/n)")} `)).trim().toLowerCase();if(G===""||G.startsWith("y")){HZ({dir:z,fafa:Q,target:W.join(",")});return}}if(console.log(M(` next: faf cards --target ${W.join(",")}`)),!f(z))console.log(M(" BEST: add your project.faf (faf init) for the FAF context, MCP and registry cards."))}finally{X.close()}}import{join as Jj}from"path";import Yj from"open";i();function Wj($){if(process.env.CI)return!1;try{return Yj($).catch(()=>{return}),!0}catch{return!1}}function yG($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
389
391
 
390
- Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=r(Z),X=n(Z,()=>N0(p(Z)));ZZ(z,Q,X,Z,{force:$.force});let J=DE(z,"project.html"),Y=TE(J);console.log(" project.html"),console.log(Y?`${I("opened")} ${M("in your browser")}`:`${I("rendered")} ${M(`file://${J}`)}`)}import{existsSync as AE}from"fs";import{join as b9,resolve as CE}from"path";import{execFileSync as _G}from"child_process";function TG($){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 AG($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function CG($,Z={}){let z=y$($);if(Z.repoUrl&&z.project&&!T2($)?.name&&z.project.name===$.split("/").pop())z.project.name=AG(Z.repoUrl);return z}i();function _E($){let Z;try{Z=_G("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=b9($,Q.slice(X+1)),Y=y0(J);if(Y===null)continue;try{if(L5(J,{root:$,expect:Y}))z++}catch{}}return z}function RE($,Z,z){return["clone","-c","core.symlinks=false","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function FE($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?CE(Z,$.output):b9(Z,"project.faf");if(AE(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
391
- `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function RG($,Z={},z=process.cwd()){let Q;try{Q=TG($)}catch(W){console.error(`Error: ${W.message}
392
+ Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=s(Z),X=r(Z,()=>O0(p(Z)));QZ(z,Q,X,Z,{force:$.force});let J=Jj(z,"project.html"),Y=Wj(J);console.log(" project.html"),console.log(Y?`${T("opened")} ${M("in your browser")}`:`${T("rendered")} ${M(`file://${J}`)}`)}import{existsSync as Uj}from"fs";import{join as p9,resolve as Gj}from"path";import{execFileSync as gG}from"child_process";function kG($){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 bG($){return $.replace(/\.git$/i,"").replace(/\/+$/,"").split("/").pop()||"project"}function vG($,Z={}){let z=b$($);if(Z.repoUrl&&z.project&&!Y2($)?.name&&z.project.name===$.split("/").pop())z.project.name=bG(Z.repoUrl);return z}i();function Vj($){let Z;try{Z=gG("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=p9($,Q.slice(X+1)),Y=k0(J);if(Y===null)continue;try{if(O5(J,{root:$,expect:Y}))z++}catch{}}return z}function Hj($,Z,z){return["clone","-c","core.symlinks=false","--depth","1",...z?["--branch",z]:[],"--",$,Z]}function Kj($,Z=process.cwd()){if($.stdout)return{outputPath:null};let z=$.output?Gj(Z,$.output):p9(Z,"project.faf");if(Uj(z)&&!$.force)throw Error(`${z} already exists — refusing to overwrite your context.
393
+ `+" Use --force to replace it, --output <path> to write elsewhere, or --stdout to just view it.");return{outputPath:z}}function hG($,Z={},z=process.cwd()){let Q;try{Q=kG($)}catch(W){console.error(`Error: ${W.message}
392
394
 
393
- Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=FE(Z,z)}catch(W){console.error(`Error: ${W.message}`),process.exit(1);return}Y2(X.outputPath===null?void 0:Z.output);let J=N5("faf-git-"),Y=b9(J,"repo");try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{_G("git",RE(Q,Y,Z.ref),{stdio:"pipe"})}catch(V){let H=(V?.stderr?.toString()??"").trim().split(`
394
- `).slice(-2).join(" ").trim()||"git clone failed",K=Z.ref?`
395
+ Usage: faf git <url> [--ref <branch|tag>] [--output <path>] [--force] [--stdout]`),process.exit(1)}let X;try{X=Kj(Z,z)}catch(W){console.error(`Error: ${W.message}`),process.exit(1);return}U2(X.outputPath===null?void 0:Z.output);let J=D5("faf-git-"),Y=p9(J,"repo");try{console.error(M(`cloning ${$}${Z.ref?` @ ${Z.ref}`:""}...`));try{gG("git",Hj(Q,Y,Z.ref),{stdio:"pipe"})}catch(V){let K=(V?.stderr?.toString()??"").trim().split(`
396
+ `).slice(-2).join(" ").trim()||"git clone failed",q=Z.ref?`
395
397
 
396
398
  (does the branch/tag '${Z.ref}' exist?)`:"";console.error(`Error: could not clone ${$}
397
399
 
398
- ${H}${K}`),process.exit(1)}_E(Y);let W=CG(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(P3(W));return}B0(X.outputPath,W,{replace:Z.force===!0}),console.log(`${I("created")} ${X.outputPath}`);let U=p(X.outputPath),G=n(X.outputPath,()=>k0(F0(U)));P0(G,X.outputPath)}finally{O5(J)}}import{execFileSync as x2}from"child_process";import{readFileSync as PE,existsSync as SE}from"fs";import{dirname as EE,resolve as jE}from"path";var p$=($)=>String($).trim(),wE="slotignored",FG=($)=>U0($)||typeof $==="string"&&$.trim().toLowerCase()===wE;function xE($,Z){let z=[],Q=0,X=0;for(let J of X0){let Y=i1($,J),W=i1(Z,J),U=!FG(Y),G=!FG(W);if(U)Q++;if(G)X++;let V=J.label??J.path.split(".").pop()??J.path,q={path:J.path,label:V,category:String(J.category)};if(!U&&G)z.push({...q,kind:"added",to:p$(W)});else if(U&&!G)z.push({...q,kind:"removed",from:p$(Y)});else if(U&&G&&p$(Y)!==p$(W))z.push({...q,kind:"changed",from:p$(Y),to:p$(W)})}return{changes:z,filledBase:Q,filledTarget:X}}function PG($){if(!$.trim())return 0;try{return N0($).score??0}catch{return 0}}function SG($){if(!$.trim())return{};try{return Q2($)??{}}catch{return{}}}function GZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=xE(SG($),SG(Z)),J=PG($),Y=PG(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var yE={added:"+",removed:"-",changed:"~"},EG=($)=>$>0?`+${$}`:`${$}`,WZ=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function wG($,Z,z){let Q=[],X=D2(q6($.scoreBase)),J=D2(q6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${EG($.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=yE[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")Q.push(` ${U} ${G} ${WZ(W.from)} → ${WZ(W.to)}`);else if(W.kind==="added")Q.push(` ${U} ${G} ${WZ(W.to)} (added)`);else Q.push(` ${U} ${G} ${WZ(W.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${EG($.filledTarget-$.filledBase)})`),Q.join(`
399
- `)}function kE($,Z){try{return x2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function A4($,Z){if(!kE($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function l$($,Z,z){try{return x2("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function xG($){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"&&SE(J)?PE(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=GZ(z($[1]),z($[4]));console.log(wG(X,Q($[1],$[2]),Q($[4],$[5])))}catch(z){console.log(`${Z} — faf diff unavailable (${z instanceof Error?z.message:"error"})`)}}var UZ="*.faf diff=faf";function v9($){let[Z,...z]=$.trim().split(/\s+/);try{return x2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function yG($){try{return x2("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 s0="faf-cli diff-driver";function kG($,Z,z){try{return x2("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(`
400
- `)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function g9($,Z=!1){return kG($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function bE($){let z=kG($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
401
- `)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var bG=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function vE($){let Z=l($,".gitattributes"),z=M6(Z),Q=z??"";if(Q.split(`
402
- `).some((Y)=>Y.trim()===UZ)){console.log(`• .gitattributes already opts in (${UZ})`);return}let X=Q.includes(`\r
400
+ ${K}${q}`),process.exit(1)}Vj(Y);let W=vG(Y,{repoUrl:Q});if(X.outputPath===null){process.stdout.write(x3(W));return}M0(X.outputPath,W,{replace:Z.force===!0}),console.log(`${T("created")} ${X.outputPath}`);let U=p(X.outputPath),G=r(X.outputPath,()=>b0(P0(U)));S0(G,X.outputPath)}finally{I5(J)}}import{execFileSync as k2}from"child_process";import{readFileSync as qj,existsSync as Bj}from"fs";import{dirname as Mj,resolve as Lj}from"path";var d$=($)=>String($).trim(),Nj="slotignored",fG=($)=>G0($)||typeof $==="string"&&$.trim().toLowerCase()===Nj;function Oj($,Z){let z=[],Q=0,X=0;for(let J of J0){let Y=r1($,J),W=r1(Z,J),U=!fG(Y),G=!fG(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:d$(W)});else if(U&&!G)z.push({...H,kind:"removed",from:d$(Y)});else if(U&&G&&d$(Y)!==d$(W))z.push({...H,kind:"changed",from:d$(Y),to:d$(W)})}return{changes:z,filledBase:Q,filledTarget:X}}function uG($){if(!$.trim())return 0;try{return O0($).score??0}catch{return 0}}function mG($){if(!$.trim())return{};try{return X2($)??{}}catch{return{}}}function BZ($,Z){let{changes:z,filledBase:Q,filledTarget:X}=Oj(mG($),mG(Z)),J=uG($),Y=uG(Z);return{changes:z,scoreBase:J,scoreTarget:Y,scoreDelta:Y-J,filledBase:Q,filledTarget:X}}var Dj={added:"+",removed:"-",changed:"~"},cG=($)=>$>0?`+${$}`:`${$}`,KZ=($,Z=64)=>$.length>Z?`${$.slice(0,Z-1)}…`:$;function lG($,Z,z){let Q=[],X=T2(q6($.scoreBase)),J=T2(q6($.scoreTarget));if(Q.push(`project.faf ${Z} → ${z}`),Q.push(`Score: ${$.scoreBase}% ${X} → ${$.scoreTarget}% ${J} (${cG($.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=Dj[W.kind],G=W.label.padEnd(16);if(W.kind==="changed")Q.push(` ${U} ${G} ${KZ(W.from)} → ${KZ(W.to)}`);else if(W.kind==="added")Q.push(` ${U} ${G} ${KZ(W.to)} (added)`);else Q.push(` ${U} ${G} ${KZ(W.from)} (removed)`)}}return Q.push(""),Q.push(`Slots filled: ${$.filledBase} → ${$.filledTarget} (${cG($.filledTarget-$.filledBase)})`),Q.join(`
401
+ `)}function Ij($,Z){try{return k2("git",["rev-parse","--verify","--quiet",`${$}^{commit}`],{cwd:Z,stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function _4($,Z){if(!Ij($,Z))console.error(`Error: unknown git ref '${$}' — use a branch, tag, or commit that exists.`),process.exit(2)}function i$($,Z,z){try{return k2("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function dG($){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"&&Bj(J)?qj(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=BZ(z($[1]),z($[4]));console.log(lG(X,Q($[1],$[2]),Q($[4],$[5])))}catch(z){console.log(`${Z} — faf diff unavailable (${z instanceof Error?z.message:"error"})`)}}var qZ="*.faf diff=faf";function l9($){let[Z,...z]=$.trim().split(/\s+/);try{return k2(Z,z,{stdio:["pipe","pipe","pipe"]}),!0}catch{return!1}}function iG($){try{return k2("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}catch{throw console.error("Error: not a git repository."),process.exit(2),Error("unreachable")}}var o0="faf-cli diff-driver";function nG($,Z,z){try{return k2("git",["config","--null",...Z],{cwd:$,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch(Q){if(Q.status===1)return"";let X=String(Q.stderr??"").trim().split(`
402
+ `)[0]||"git config failed";throw Error(`git cannot read ${z} (${X})`,{cause:Q})}}function d9($,Z=!1){return nG($,[...Z?["--local"]:[],"--get-all","diff.faf.command"],"diff.faf.command").split("\x00").slice(0,-1)}function Tj($){let z=nG($,["--get-regexp","^diff\\.faf\\."],"the diff.faf settings").split("\x00").slice(0,-1).map((Q)=>Q.split(`
403
+ `)[0]);return[...new Set(z.filter((Q)=>Q!=="diff.faf.command"))]}var rG=($)=>$.map((Z)=>JSON.stringify(Z)).join(", ");function Aj($){let Z=l($,".gitattributes"),z=N6(Z),Q=z??"";if(Q.split(`
404
+ `).some((Y)=>Y.trim()===qZ)){console.log(`• .gitattributes already opts in (${qZ})`);return}let X=Q.includes(`\r
403
405
  `)?`\r
404
406
  `:`
405
407
  `,J=`${Q}${Q&&!Q.endsWith(`
406
- `)?X:""}${UZ}${X}`;a(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${UZ}`)}function gE($){let Z=yG($),z;try{z=g9($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===s0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${bG(z)}, not faf's driver (${s0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=bE($)}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(vE(Z),Q)console.log(`• git config already set (diff.faf.command = ${s0})`);else x2("git",["config","diff.faf.command",s0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${s0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!v9(s0))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 hE='[diff "faf"]',fE=` command = ${s0}`,vG=($)=>/\r(?!\n)/.test($),uE=($)=>(/\\+$/.exec(W2($))?.[0].length??0)%2===1;function mE($){if(vG($))return null;let Z=s6($),z=Z.map((V,q)=>q>0&&uE(Z[q-1])),Q=Z.map((V,q)=>!z[q]&&W2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,q)=>{if(Q[q])J=W2(V)===hE?q:-1;else if(J>=0&&!z[q]&&W2(V)===fE)X.push({at:q,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,q)=>W+1+q!==Y&&W2(V).trim()!==""))return null;return Z.filter((V,q)=>q!==W&&q!==Y).join("")}function jG($,Z){try{return x2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function cE($,Z,z){let Q=jG($,Z),X=jG($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
407
- ${s0}`,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 pE($){let Z=g9($,!0);if(Z.length!==1||Z[0]!==s0)return`diff.faf.command = ${s0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=jE($,x2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=EE(z);try{let X=l(Q,z,{allowGitConfig:!0}),J=z0(X);if(vG(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=mE(J);if(Y===null||!cE($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${s0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return a(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof b||X instanceof h2)return X.message;throw X}}function lE($){yG($);let Z;try{Z=g9($)}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]!==s0)return console.error(`faf: diff.faf.command is ${bG(Z)}, not faf's driver (${s0}) — faf left your git config unchanged.`),!1;let z;try{z=pE($)}catch(Q){z=`${Q.message.split(`
408
- `)[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 gG($,Z={},z=process.cwd()){if(Z.installDriver){if(!gE(z))process.exit(1);return}if(Z.uninstallDriver){if(!lE(z))process.exit(1);return}let Q=m(z);if(!Q)console.error(`Error: project.faf not found
408
+ `)?X:""}${qZ}${X}`;a(Z,J,{root:$,expect:z}),console.log(`✅ .gitattributes ${qZ}`)}function Cj($){let Z=iG($),z;try{z=d9($)}catch(J){return console.error(`faf: ${J.message} — faf left your git config unchanged.`),!1}let Q=z.length===1&&z[0]===o0;if(z.length>0&&!Q)return console.error(`faf: diff.faf.command is already set to ${rG(z)}, not faf's driver (${o0}) — faf left your git config and .gitattributes unchanged.`),!1;let X;try{X=Tj($)}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(Aj(Z),Q)console.log(`• git config already set (diff.faf.command = ${o0})`);else k2("git",["config","diff.faf.command",o0],{cwd:$}),console.log(`✅ git config diff.faf.command = ${o0}`);if(console.log("\n→ `git diff`, `git log -p`, `git show` now render the .faf score + slot delta."),!l9(o0))console.log("\n⚠ the `faf-cli` on your PATH does not support `diff-driver` yet (needs faf-cli ≥ 7.0)."),console.log(" `git diff` on .faf files falls back to the raw text diff until you upgrade.");return!0}var _j='[diff "faf"]',Rj=` command = ${o0}`,sG=($)=>/\r(?!\n)/.test($),Fj=($)=>(/\\+$/.exec(G2($))?.[0].length??0)%2===1;function Pj($){if(sG($))return null;let Z=a6($),z=Z.map((V,H)=>H>0&&Fj(Z[H-1])),Q=Z.map((V,H)=>!z[H]&&G2(V).trimStart().startsWith("[")),X=[],J=-1;if(Z.forEach((V,H)=>{if(Q[H])J=G2(V)===_j?H:-1;else if(J>=0&&!z[H]&&G2(V)===Rj)X.push({at:H,head:J})}),X.length!==1)return null;let{at:Y,head:W}=X[0],U=Y+1;while(U<Z.length&&!Q[U])U++;if(Z.slice(W+1,U).some((V,H)=>W+1+H!==Y&&G2(V).trim()!==""))return null;return Z.filter((V,H)=>H!==W&&H!==Y).join("")}function pG($,Z){try{return k2("git",["config","--file","-","--null","--list"],{cwd:$,input:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).split("\x00").slice(0,-1)}catch{return null}}function Sj($,Z,z){let Q=pG($,Z),X=pG($,z);if(Q===null||X===null)return!1;let J=`diff.faf.command
409
+ ${o0}`,Y=Q.indexOf(J);if(Y<0||Q.lastIndexOf(J)!==Y)return!1;let W=[...Q.slice(0,Y),...Q.slice(Y+1)];return W.length===X.length&&W.every((U,G)=>U===X[G])}function Ej($){let Z=d9($,!0);if(Z.length!==1||Z[0]!==o0)return`diff.faf.command = ${o0} is set outside this repo's own config (your global or system git config) — faf left it unchanged.`;let z=Lj($,k2("git",["rev-parse","--git-path","config"],{cwd:$,encoding:"utf-8"}).trim()),Q=Mj(z);try{let X=l(Q,z,{allowGitConfig:!0}),J=Q0(X);if(sG(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=Pj(J);if(Y===null||!Sj($,J,Y))return`diff.faf.command in ${X} is not in the section faf writes (a [diff "faf"] line and a tab-indented "command = ${o0}" line, with nothing else in the section or on either line) — faf left your git config unchanged.`;return a(X,Y,{root:Q,allowGitConfig:!0,expect:J}),null}catch(X){if(X instanceof b||X instanceof u2)return X.message;throw X}}function jj($){iG($);let Z;try{Z=d9($)}catch(Q){return console.error(`faf: ${Q.message} — faf left your git config unchanged.`),!1}if(Z.length===0)return console.log("• diff.faf.command is not set — nothing to remove (the .gitattributes line, if any, is left for you to keep or delete)."),!0;if(Z.length!==1||Z[0]!==o0)return console.error(`faf: diff.faf.command is ${rG(Z)}, not faf's driver (${o0}) — faf left your git config unchanged.`),!1;let z;try{z=Ej($)}catch(Q){z=`${Q.message.split(`
410
+ `)[0]} — faf left your git config unchanged.`}if(z!==null)return console.error(`faf: ${z}`),!1;return console.log("✅ removed diff.faf.command (the .gitattributes line is left for you to keep or delete)."),!0}function oG($,Z={},z=process.cwd()){if(Z.installDriver){if(!Cj(z))process.exit(1);return}if(Z.uninstallDriver){if(!jj(z))process.exit(1);return}let Q=f(z);if(!Q)console.error(`Error: project.faf not found
409
411
 
410
- Run 'faf init' to create one.`),process.exit(2);let X;try{X=x2("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=S$(Q,z),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=l$("HEAD",J,z),G=p(Q);else if($.includes("...")){let[q,H]=$.split("...");A4(q,z),A4(H,z);let K;try{K=x2("git",["merge-base",q,H],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${q}' and '${H}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=K.slice(0,7),W=H,U=l$(K,J,z),G=l$(H,J,z)}else if($.includes("..")){let[q,H]=$.split("..");A4(q,z),A4(H,z),Y=q,W=H,U=l$(q,J,z),G=l$(H,J,z)}else A4($,z),Y=$,W="(working tree)",U=l$($,J,z),G=p(Q);let V=GZ(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...V},null,2));else console.log(wG(V,Y,W))}import{execFileSync as h9}from"child_process";function dE($){if(!$.trim())return 0;try{return N0($).score??0}catch{return 0}}var iE=($)=>$>0?`+${$}`:`${$}`;function nE($){let Z=$.map((z)=>({...z,score:dE(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 rE($,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?" ·":iE(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${D2(q6(Q.score))} ${Q.subject}`)}return z.join(`
411
- `)}function sE($,Z,z){try{return h9("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function hG($={},Z=process.cwd()){let z=m(Z);if(!z)console.error(`Error: project.faf not found
412
+ Run 'faf init' to create one.`),process.exit(2);let X;try{X=k2("git",["rev-parse","--show-toplevel"],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error("Error: not a git repository — faf diff compares .faf versions across git history."),process.exit(2);return}let J=j$(Q,z),Y,W,U,G;if(!$)Y="HEAD",W="(working tree)",U=i$("HEAD",J,z),G=p(Q);else if($.includes("...")){let[H,K]=$.split("...");_4(H,z),_4(K,z);let q;try{q=k2("git",["merge-base",H,K],{cwd:z,encoding:"utf-8"}).trim()}catch{console.error(`Error: '${H}' and '${K}' have no common ancestor — can't compute a merge-base diff.`),process.exit(2);return}Y=q.slice(0,7),W=K,U=i$(q,J,z),G=i$(K,J,z)}else if($.includes("..")){let[H,K]=$.split("..");_4(H,z),_4(K,z),Y=H,W=K,U=i$(H,J,z),G=i$(K,J,z)}else _4($,z),Y=$,W="(working tree)",U=i$($,J,z),G=p(Q);let V=BZ(U,G);if(Z.json)console.log(JSON.stringify({base:Y,target:W,...V},null,2));else console.log(lG(V,Y,W))}import{execFileSync as i9}from"child_process";function wj($){if(!$.trim())return 0;try{return O0($).score??0}catch{return 0}}var xj=($)=>$>0?`+${$}`:`${$}`;function yj($){let Z=$.map((z)=>({...z,score:wj(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 kj($,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?" ·":xj(Q.delta).padStart(4);z.push(` ${X} ${J} ${Q.date} ${Q.hex} ${T2(q6(Q.score))} ${Q.subject}`)}return z.join(`
413
+ `)}function bj($,Z,z){try{return i9("git",["show",`${$}:${Z}`],{cwd:z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return""}}function aG($={},Z=process.cwd()){let z=f(Z);if(!z)console.error(`Error: project.faf not found
412
414
 
413
- Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=h9("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=S$(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=h9("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
414
- `).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:sE(K.hex,X,Z)})),V=nE(G),q=J>0?V.slice(0,J):V;if($.reverse)q=[...q].reverse();let H=W.length;if($.json)console.log(JSON.stringify({file:X,total:H,count:q.length,entries:q},null,2));else{let K=rE(q,X.split("/").pop()??"project.faf");if(J>0&&H>q.length)K+=`
415
+ Run 'faf init' to create one.`),process.exit(2);let Q;try{Q=i9("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=j$(z,Z),J=$.all?0:Math.max(0,parseInt($.limit??"20",10)||20),Y="";try{Y=i9("git",["log","--follow","--format=%h%x1f%ad%x1f%s","--date=short","--",X],{cwd:Z,encoding:"utf-8"})}catch{Y=""}let W=Y.split(`
416
+ `).filter(Boolean).map((q)=>{let[L,B,N]=q.split("\x1F");return{hex:L,date:B,subject:N??""}}),U=J>0?Math.min(W.length,J+1):W.length,G=W.slice(0,U).map((q)=>({...q,raw:bj(q.hex,X,Z)})),V=yj(G),H=J>0?V.slice(0,J):V;if($.reverse)H=[...H].reverse();let K=W.length;if($.json)console.log(JSON.stringify({file:X,total:K,count:H.length,entries:H},null,2));else{let q=kj(H,X.split("/").pop()??"project.faf");if(J>0&&K>H.length)q+=`
415
417
 
416
- … showing ${q.length} of ${H} commits — \`faf log --all\` for the full timeline.`;console.log(K)}}import{execFileSync as C4}from"child_process";import{existsSync as u9,readFileSync as oE,realpathSync as fG,statSync as cG}from"fs";import{resolve as pG,dirname as m9,relative as aE,isAbsolute as tE,sep as eE}from"path";var c9="# >>> faf >>>",lG="# <<< faf <<<",f9=`#!/bin/sh
417
- `,uG="faf-cli hooks-run",$j=($)=>$>0?`+${$}`:`${$}`;function dG($){return C4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function mG($,Z){try{return C4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function iG($,Z){try{return C4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function p9($){let Z=C4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return pG($,Z)}function Zj($,Z){let z=C4("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=fG.native(pG($,z)),X=fG.native(Z),J=aE(Q,X);return{out:J===".."||J.startsWith(`..${eE}`)||tE(J),real:X}}function nG($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===c9)Z.push(Q);if(J===lG)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 zj($,Z){if(!Z)return 493;let z=cG($).mode&511;return z|(z&292)>>2}function rG($){try{let Z=l(m9($),$,{allowGitHooks:!0});return{real:Z,text:M6(Z)}}catch(Z){if(Z instanceof b)return`${Z.message} faf left the hook as it is.`;throw Z}}function sG($,Z,z,Q){try{return a($,Z,{root:m9($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof b||X instanceof h2)return X.message;throw X}}var oG="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 aG($={},Z=process.cwd()){try{let z;try{z=dG(Z)}catch{return}let Q=m(Z);if(!Q)return;let X=S$(Q,Z),J=mG(`:${X}`,Z);if(J===null)return;let Y=mG(`HEAD:${X}`,Z)??"",W=GZ(Y,J),U=`${W.scoreBase}% → ${W.scoreTarget}% (${$j(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 Qj($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[c9,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",lG,""].join(`
418
- `)}function Xj($,Z={}){let z;try{z=dG($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=iG("core.hooksPath",$);if(Q){let L=Z.runnerCmd??uG;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=p9($),J=Z.runnerCmd??uG;if(!v9(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=Qj(J,!!Z.strict),W=m9(X);if(!u9(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=rG(X);if(typeof U==="string")return console.error(`Error: ${U}`),!1;let{real:G,text:V}=U,q=V===null?null:nG(V);if(q==="broken")return console.error(`Error: ${X} ${oG}`),!1;let H;if(V===null)H=`${f9}${Y}`;else if(q)H=V.slice(0,q.start)+Y+V.slice(q.end);else{let L=Zj($,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()==="")H=`${f9}${Y}${V}`;else H=V.endsWith(`
418
+ … showing ${H.length} of ${K} commits — \`faf log --all\` for the full timeline.`;console.log(q)}}import{execFileSync as R4}from"child_process";import{existsSync as r9,readFileSync as vj,realpathSync as tG,statSync as ZV}from"fs";import{resolve as zV,dirname as s9,relative as gj,isAbsolute as hj,sep as fj}from"path";var o9="# >>> faf >>>",QV="# <<< faf <<<",n9=`#!/bin/sh
419
+ `,eG="faf-cli hooks-run",uj=($)=>$>0?`+${$}`:`${$}`;function XV($){return R4("git",["rev-parse","--show-toplevel"],{cwd:$,encoding:"utf-8"}).trim()}function $V($,Z){try{return R4("git",["show",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]})}catch{return null}}function JV($,Z){try{return R4("git",["config","--get",$],{cwd:Z,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()||null}catch{return null}}function a9($){let Z=R4("git",["rev-parse","--git-path","hooks/pre-commit"],{cwd:$,encoding:"utf-8"}).trim();return zV($,Z)}function mj($,Z){let z=R4("git",["rev-parse","--git-common-dir"],{cwd:$,encoding:"utf-8"}).trim(),Q=tG.native(zV($,z)),X=tG.native(Z),J=gj(Q,X);return{out:J===".."||J.startsWith(`..${fj}`)||hj(J),real:X}}function YV($){let Z=[],z=[],Q=0;for(let X of $.split(/(?<=\n)/)){let J=X.replace(/\n$/,"").replace(/\r$/,"");if(J===o9)Z.push(Q);if(J===QV)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 cj($,Z){if(!Z)return 493;let z=ZV($).mode&511;return z|(z&292)>>2}function WV($){try{let Z=l(s9($),$,{allowGitHooks:!0});return{real:Z,text:N6(Z)}}catch(Z){if(Z instanceof b)return`${Z.message} faf left the hook as it is.`;throw Z}}function UV($,Z,z,Q){try{return a($,Z,{root:s9($),allowGitHooks:!0,expect:z,mode:Q}),null}catch(X){if(X instanceof b||X instanceof u2)return X.message;throw X}}var GV="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 VV($={},Z=process.cwd()){try{let z;try{z=XV(Z)}catch{return}let Q=f(Z);if(!Q)return;let X=j$(Q,Z),J=$V(`:${X}`,Z);if(J===null)return;let Y=$V(`HEAD:${X}`,Z)??"",W=BZ(Y,J),U=`${W.scoreBase}% → ${W.scoreTarget}% (${uj(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 pj($,Z){let z=$.trim().split(/\s+/)[0],Q=Z?`${$} --strict || exit 1`:`${$} || true`;return[o9,`if command -v ${z} >/dev/null 2>&1 && git diff --cached --name-only 2>/dev/null | grep -qE '\\.faf$'; then`,` ${Q}`,"fi",QV,""].join(`
420
+ `)}function lj($,Z={}){let z;try{z=XV($)}catch{return console.error("Error: not a git repository — run `git init` first."),!1}let Q=JV("core.hooksPath",$);if(Q){let L=Z.runnerCmd??eG;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=a9($),J=Z.runnerCmd??eG;if(!l9(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=pj(J,!!Z.strict),W=s9(X);if(!r9(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=WV(X);if(typeof U==="string")return console.error(`Error: ${U}`),!1;let{real:G,text:V}=U,H=V===null?null:YV(V);if(H==="broken")return console.error(`Error: ${X} ${GV}`),!1;let K;if(V===null)K=`${n9}${Y}`;else if(H)K=V.slice(0,H.start)+Y+V.slice(H.end);else{let L=mj($,W);if(L.out)return console.error(`Error: ${X} is in a hooks folder outside this repo (${L.real}) and faf did not write it — faf left it as it is. Add \`${J}${Z.strict?" --strict":""}\` to it yourself.`),!1;if(V.trim()==="")K=`${n9}${Y}${V}`;else K=V.endsWith(`
419
421
  `)?`${V}
420
422
  ${Y}`:`${V}
421
423
 
422
- ${Y}`}let K=sG(X,H,V,zj(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 Jj($,Z){if($===f9&&Z.trim()==="")return"";return $.endsWith(`
424
+ ${Y}`}let q=UV(X,K,V,cj(G,V!==null));if(q)return console.error(`Error: ${q}`),!1;return console.log(`✅ pre-commit context guard installed — ${Z.strict?"STRICT (blocks on score regression)":"warn (informs only)"}`),console.log(" Skips when no .faf is staged · respects `git commit --no-verify` · fails open."),!0}function dj($,Z){if($===n9&&Z.trim()==="")return"";return $.endsWith(`
423
425
 
424
- `)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function Yj($){let Z;try{Z=p9($)}catch{return console.error("Error: not a git repository."),!1}if(!u9(Z))return console.log("• no pre-commit hook to clean."),!0;let z=rG(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:nG(X);if(J==="broken")return console.error(`Error: ${Z} ${oG}`),!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=sG(Z,Jj(X.slice(0,J.start),Y)+Y,X,cG(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 Wj($){let Z;try{Z=p9($)}catch{console.error("Error: not a git repository.");return}let z=iG("core.hooksPath",$),Q=u9(Z)?oE(Z,"utf-8"):"",X=Q.includes(c9),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 tG($={}){let Z=process.cwd();if($.install){if(!Xj(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!Yj(Z))process.exit(2);return}Wj(Z)}i();function eG($={}){if($.version||Object.keys($).length===0)Gj()}function Gj(){let $=l9();console.log(`${I(C("faf"))} v${$.version}`),console.log(M(`kernel ${sY()} IANA application/vnd.faf+yaml`))}var _4=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"systems"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"},{name:"FAFm",extensions:[".fafm"],category:"faf"}];i();function $V(){console.log(`${I("formats")} ${M("— supported file types")}
425
- `);let $=new Map;for(let Z of _4){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(` ${_4.length} formats across ${$.size} categories`))}i();function ZV(){let $=0;try{$=VY("faf-git-")}catch{}if($>0)console.log(`${I("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function zV($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
426
+ `)&&$.slice(0,-1).trim()!==""?$.slice(0,-1):$}function ij($){let Z;try{Z=a9($)}catch{return console.error("Error: not a git repository."),!1}if(!r9(Z))return console.log("• no pre-commit hook to clean."),!0;let z=WV(Z);if(typeof z==="string")return console.error(`Error: ${z}`),!1;let{real:Q,text:X}=z,J=X===null?null:YV(X);if(J==="broken")return console.error(`Error: ${Z} ${GV}`),!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=UV(Z,dj(X.slice(0,J.start),Y)+Y,X,ZV(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 nj($){let Z;try{Z=a9($)}catch{console.error("Error: not a git repository.");return}let z=JV("core.hooksPath",$),Q=r9(Z)?vj(Z,"utf-8"):"",X=Q.includes(o9),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 HV($={}){let Z=process.cwd();if($.install){if(!lj(Z,{strict:$.strict}))process.exit(2);return}if($.uninstall){if(!ij(Z))process.exit(2);return}nj(Z)}i();function KV($={}){if($.version||Object.keys($).length===0)sj()}function sj(){let $=t9();console.log(`${T(C("faf"))} v${$.version}`),console.log(M(`kernel ${QW()} IANA application/vnd.faf+yaml`))}var F4=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"systems"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"},{name:"FAFm",extensions:[".fafm"],category:"faf"}];i();function qV(){console.log(`${T("formats")} ${M("— supported file types")}
427
+ `);let $=new Map;for(let Z of F4){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(` ${F4.length} formats across ${$.size} categories`))}i();function BV(){let $=0;try{$=OY("faf-git-")}catch{}if($>0)console.log(`${T("cleared")} ${$} cached director${$===1?"y":"ies"}`);else console.log(M("nothing to clear"))}function MV($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
426
428
 
427
- Run 'faf init' to create one.`),process.exit(2);if($.json){let z=r(Z);console.log(JSON.stringify(z,null,2))}else{let z=p(Z);console.log(z)}}i();function QV(){let $=m();if(!$)console.error(`Error: project.faf not found
429
+ Run 'faf init' to create one.`),process.exit(2);if($.json){let z=s(Z);console.log(JSON.stringify(z,null,2))}else{let z=p(Z);console.log(z)}}i();function LV(){let $=f();if(!$)console.error(`Error: project.faf not found
428
430
 
429
- Run 'faf init' to create one.`),process.exit(2);let Z=r($),z=[];for(let Q of X0){let[X,J]=Q.path.split("."),W=Z[X]?.[J];if(U0(W)||W==="slotignored")continue;z.push(`${Q.path}: ${W}`)}if(z.length===0){console.log(M("no populated slots"));return}console.log(z.join(`
430
- `))}import{existsSync as Vj,statSync as XV}from"fs";import{dirname as qj,join as Hj}from"path";var Kj=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],Bj=1000;function JV($,Z=qj($)){let z=XV($).mtimeMs,Q=Kj.map((X)=>{let J=Hj(Z,X);if(!Vj(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=XV(J).mtimeMs,W=Y-z,U;if(Math.abs(W)<Bj)U="in-sync";else if(W>0)U="newer";else U="older";return{file:X,exists:!0,mtime_ms:Y,status:U,delta_ms:W}});return{source:$,source_mtime_ms:z,targets:Q,drifted:Q.filter((X)=>X.status==="newer"||X.status==="older").length,in_sync:Q.filter((X)=>X.status==="in-sync").length,missing:Q.filter((X)=>X.status==="missing").length}}i();function WV($={}){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
431
+ Run 'faf init' to create one.`),process.exit(2);let Z=s($),z=[];for(let Q of J0){let[X,J]=Q.path.split("."),W=Z[X]?.[J];if(G0(W)||W==="slotignored")continue;z.push(`${Q.path}: ${W}`)}if(z.length===0){console.log(M("no populated slots"));return}console.log(z.join(`
432
+ `))}import{existsSync as oj,statSync as NV}from"fs";import{dirname as aj,join as tj}from"path";var ej=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"],$w=1000;function OV($,Z=aj($)){let z=NV($).mtimeMs,Q=ej.map((X)=>{let J=tj(Z,X);if(!oj(J))return{file:X,exists:!1,mtime_ms:null,status:"missing",delta_ms:null};let Y=NV(J).mtimeMs,W=Y-z,U;if(Math.abs(W)<$w)U="in-sync";else if(W>0)U="newer";else U="older";return{file:X,exists:!0,mtime_ms:Y,status:U,delta_ms:W}});return{source:$,source_mtime_ms:z,targets:Q,drifted:Q.filter((X)=>X.status==="newer"||X.status==="older").length,in_sync:Q.filter((X)=>X.status==="in-sync").length,missing:Q.filter((X)=>X.status==="missing").length}}i();function IV($={}){let Z=f();if(!Z){if($.json)console.log(JSON.stringify({error:"project.faf not found",hint:"run 'faf init' to create one"},null,2));else console.error(`Error: project.faf not found
431
433
 
432
- Run 'faf init' to create one.`);process.exit(2)}let z=JV(Z,process.cwd());if($.json){let Q=r(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}Mj(z)}function Mj($){console.log(`${I("drift")} ${M("— context file sync status")}
433
- `),console.log(` ${C(".faf")} ${M(YV($.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(YV(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${I("●")} ${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(`
434
- run ${C("'faf sync'")} to resolve drift`))}function YV($){let Z=Date.now()-$,z=Math.floor(Z/1000);if(z<60)return`${z}s ago`;let Q=Math.floor(z/60);if(Q<60)return`${Q}m ago`;let X=Math.floor(Q/60);if(X<24)return`${X}h ago`;return`${Math.floor(X/24)}d ago`}function d9($,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 R4($,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(!e(J))return{at:z.slice(0,X+1).join("."),value:J};Q=J}return null}function F4($,Z){return`cannot set ${$}: ${Z.at} is ${g6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function VZ($,Z,z){let Q=R4($,Z);if(Q)throw Error(F4(Z,Q));let X=Z.split("."),J=$;for(let Y=0;Y<X.length-1;Y++){if(J[X[Y]]===null||J[X[Y]]===void 0)J[X[Y]]={};J=J[X[Y]]}J[X[X.length-1]]=z}i();function UV($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
434
+ Run 'faf init' to create one.`);process.exit(2)}let z=OV(Z,process.cwd());if($.json){let Q=s(Z),X={faf_version:Q.faf_version??"unknown",project:Q.project?.name??"unknown",...z};console.log(JSON.stringify(X,null,2));return}Zw(z)}function Zw($){console.log(`${T("drift")} ${M("— context file sync status")}
435
+ `),console.log(` ${C(".faf")} ${M(DV($.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(DV(Z.mtime_ms));if(Z.status==="in-sync")console.log(` ${T("●")} ${Z.file} ${M("in sync")}`);else if(Z.status==="newer")console.log(` ${C("!")} ${Z.file} ${C("newer")} ${z}`);else console.log(` ${M("○")} ${Z.file} ${M("older")} ${z}`)}if($.drifted>0)console.log(M(`
436
+ run ${C("'faf sync'")} to resolve drift`))}function DV($){let Z=Date.now()-$,z=Math.floor(Z/1000);if(z<60)return`${z}s ago`;let Q=Math.floor(z/60);if(Q<60)return`${Q}m ago`;let X=Math.floor(Q/60);if(X<24)return`${X}h ago`;return`${Math.floor(X/24)}d ago`}function e9($,Z){let z=Z.split("."),Q=$;for(let X of z){if(Q===null||Q===void 0||typeof Q!=="object")return;Q=Q[X]}return Q}function P4($,Z){let z=Z.split("."),Q=$;for(let X=0;X<z.length-1;X++){let J=Q[z[X]];if(J===null||J===void 0)return null;if(!$0(J))return{at:z.slice(0,X+1).join("."),value:J};Q=J}return null}function S4($,Z){return`cannot set ${$}: ${Z.at} is ${f6(Z.value)}, not a mapping. `+`faf will not replace it — make ${Z.at} a mapping in project.faf by hand, then run again.`}function MZ($,Z,z){let Q=P4($,Z);if(Q)throw Error(S4(Z,Q));let X=Z.split("."),J=$;for(let Y=0;Y<X.length-1;Y++){if(J[X[Y]]===null||J[X[Y]]===void 0)J[X[Y]]={};J=J[X[Y]]}J[X[X.length-1]]=z}i();function TV($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
435
437
 
436
- Example: faf edit project.name "My Project"`),process.exit(1);let z=m();if(!z)console.error(`Error: project.faf not found
438
+ Example: faf edit project.name "My Project"`),process.exit(1);let z=f();if(!z)console.error(`Error: project.faf not found
437
439
 
438
- Run 'faf init' to create one.`),process.exit(2);let Q=r(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=R4(Q,$);if(J)console.error(`Error: ${F4($,J)}`),process.exit(1);VZ(Q,$,Z);let Y=[];if(B0(z,Q,{onAliasKept:(W)=>Y.push(c0(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(`${I("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as Lj,lstatSync as Nj}from"fs";import{join as n9}from"path";i();function Oj($){try{return Nj($),!0}catch{return!1}}function i9($,Z,z){if(!Oj(n9($,Z)))return null;try{return z0(l($,Z,{read:!0}))}catch(Q){if(!(Q instanceof b))throw Q;return console.error(B6(Q,!1)),z.push(Z),null}}function GV(){let $=process.cwd(),Z=[],z=[],Q={faf_version:H6,project:{}},X=i9($,"CLAUDE.md",z);if(X!==null){let G=o5(X);if(G.project?.name)Q.project.name=G.project.name;if(G.project?.goal)Q.project.goal=G.project.goal;if(G.project?.main_language)Q.project.main_language=G.project.main_language;Z.push("CLAUDE.md")}let J=i9($,"AGENTS.md",z);if(J!==null){if(!Q.project.name){let G=J.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("AGENTS.md")}let Y=i9($,"GEMINI.md",z);if(Y!==null){if(!Q.project.name){let G=Y.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("GEMINI.md")}let W=n9($,".cursorrules");if(Lj(W))Z.push(".cursorrules");if(Z.length===0){if(z.length>0)console.error(`Nothing to recover from: ${z.join(", ")} ${z.length===1?"was":"were"} refused (above), and no other context file is there. Nothing was written.`),process.exit(1);console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2)}let U=m($);if(U){let G=r(U);if(!G.project)G.project={};if(Q.project.name&&!G.project.name)G.project.name=Q.project.name;if(Q.project.goal&&!G.project.goal)G.project.goal=Q.project.goal;if(Q.project.main_language&&!G.project.main_language)G.project.main_language=Q.project.main_language;B0(U,G,{onAliasKept:(V)=>console.log(M(` ${c0(V)}`))}),console.log(`${I("◆")} recover merged into ${U}`)}else{let G=n9($,"project.faf");B0(G,Q),console.log(`${I("◆")} recover created ${G}`)}console.log(M(` sources: ${Z.join(", ")}`))}i();var P4=H6;function VV($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
440
+ Run 'faf init' to create one.`),process.exit(2);let Q=s(z);if($.split(".").length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let J=P4(Q,$);if(J)console.error(`Error: ${S4($,J)}`),process.exit(1);MZ(Q,$,Z);let Y=[];if(M0(z,Q,{onAliasKept:(W)=>Y.push(p0(W))}),Y.length>0){for(let W of Y)console.error(`Error: ${W}. Change the value its anchor holds, or replace the alias by hand.`);process.exit(1)}console.log(`${T("updated")} ${$} ${M("→")} ${Z}`)}import{existsSync as zw,lstatSync as Qw}from"fs";import{join as Zz}from"path";i();function Xw($){try{return Qw($),!0}catch{return!1}}function $z($,Z,z){if(!Xw(Zz($,Z)))return null;try{return Q0(l($,Z,{read:!0}))}catch(Q){if(!(Q instanceof b))throw Q;return console.error(L6(Q,!1)),z.push(Z),null}}function AV(){let $=process.cwd(),Z=[],z=[],Q={faf_version:B6,project:{}},X=$z($,"CLAUDE.md",z);if(X!==null){let G=t5(X);if(G.project?.name)Q.project.name=G.project.name;if(G.project?.goal)Q.project.goal=G.project.goal;if(G.project?.main_language)Q.project.main_language=G.project.main_language;Z.push("CLAUDE.md")}let J=$z($,"AGENTS.md",z);if(J!==null){if(!Q.project.name){let G=J.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("AGENTS.md")}let Y=$z($,"GEMINI.md",z);if(Y!==null){if(!Q.project.name){let G=Y.match(/^#\s+(.+)/m);if(G)Q.project.name=G[1].trim()}Z.push("GEMINI.md")}let W=Zz($,".cursorrules");if(zw(W))Z.push(".cursorrules");if(Z.length===0){if(z.length>0)console.error(`Nothing to recover from: ${z.join(", ")} ${z.length===1?"was":"were"} refused (above), and no other context file is there. Nothing was written.`),process.exit(1);console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2)}let U=f($);if(U){let G=s(U);if(!G.project)G.project={};if(Q.project.name&&!G.project.name)G.project.name=Q.project.name;if(Q.project.goal&&!G.project.goal)G.project.goal=Q.project.goal;if(Q.project.main_language&&!G.project.main_language)G.project.main_language=Q.project.main_language;M0(U,G,{onAliasKept:(V)=>console.log(M(` ${p0(V)}`))}),console.log(`${T("◆")} recover merged into ${U}`)}else{let G=Zz($,"project.faf");M0(G,Q),console.log(`${T("◆")} recover created ${G}`)}console.log(M(` sources: ${Z.join(", ")}`))}i();var E4=B6;function CV($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
439
441
 
440
- Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=z.faf_version??"unknown";if(Q===P4){console.log(`${I("◆")} migrate already at v${P4}`);return}if(z.faf_version=P4,!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(`${I("◆")} migrate ${M("(dry run)")} v${Q} → v${P4}`),console.log(M(` would update ${Z}`));return}B0(Z,z,{onAliasKept:(X)=>console.log(M(` ${c0(X)}`))}),console.log(`${I("◆")} migrate v${Q} → v${P4}`),console.log(M(` updated ${Z}`))}i();function qV($){if($==="features")Ij();else if($==="activate")Tj();else Dj()}function Dj(){let $=H4();if(console.log(`${I("pro")} ${M("— FAF Pro status")}
441
- `),console.log(` Status: ${$?R0(C("PRO")):C("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function Ij(){console.log(`${I("pro")} ${M("— Pro features")}
442
- `);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(` ${I("◆")} ${C(Z)} ${M("—")} ${z}`);console.log("")}function Tj(){console.log(`${I("pro")} ${M("— activate")}
443
- `),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 Aj}from"zlib";i();function HV($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
442
+ Run 'faf init' to create one.`),process.exit(2);let z=s(Z),Q=z.faf_version??"unknown";if(Q===E4){console.log(`${T("◆")} migrate already at v${E4}`);return}if(z.faf_version=E4,!z.project)z.project={};if(!z.stack)z.stack={};if(!z.human_context)z.human_context={};if(!z.monorepo)z.monorepo={};if($.dryRun){console.log(`${T("◆")} migrate ${M("(dry run)")} v${Q} → v${E4}`),console.log(M(` would update ${Z}`));return}M0(Z,z,{onAliasKept:(X)=>console.log(M(` ${p0(X)}`))}),console.log(`${T("◆")} migrate v${Q} → v${E4}`),console.log(M(` updated ${Z}`))}i();function _V($){if($==="features")Yw();else if($==="activate")Ww();else Jw()}function Jw(){let $=B4();if(console.log(`${T("pro")} ${M("— FAF Pro status")}
443
+ `),console.log(` Status: ${$?F0(C("PRO")):C("Free")}`),console.log(""),!$)console.log(M(" Upgrade: faf pro activate"))}function Yw(){console.log(`${T("pro")} ${M("— Pro features")}
444
+ `);let $=[["tri-sync",".faf → CLAUDE.md + Claude Code's MEMORY.md (faf's block only)"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,z]of $)console.log(` ${T("◆")} ${C(Z)} ${M("—")} ${z}`);console.log("")}function Ww(){console.log(`${T("pro")} ${M("— activate")}
445
+ `),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(M(" export FAF_PRO=1")),console.log(""),console.log(M(" Visit: https://faf.one/pro")),import("open").then(({default:$})=>$("https://faf.one/pro")).catch(()=>{})}import{gzipSync as Uw}from"zlib";i();function RV($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
444
446
 
445
- Run 'faf init' to create one.`),process.exit(2);let z=p(Z),X=Aj(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${I("◆")} share ${M(Z)}
446
- `),console.log(` ${J}`),$.copy)try{let{execSync:Y}=i0("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(`
447
+ Run 'faf init' to create one.`),process.exit(2);let z=p(Z),X=Uw(Buffer.from(z)).toString("base64url");if($.raw){console.log(X);return}let J=`https://faf.one/share?d=${X}`;if(console.log(`${T("◆")} share ${M(Z)}
448
+ `),console.log(` ${J}`),$.copy)try{let{execSync:Y}=n0("child_process"),W=process.platform;if(W==="darwin")Y("pbcopy",{input:J});else if(W==="linux")Y("xclip -selection clipboard",{input:J});console.log(M(`
447
449
  copied to clipboard`))}catch{console.log(M(`
448
- copy failed — install xclip or pbcopy`))}}import{join as Cj}from"path";i();function KV(){let $=N5("faf-demo-");console.log(`${I("demo")} ${M("— FAF in action")}
450
+ copy failed — install xclip or pbcopy`))}}import{join as Gw}from"path";i();function FV(){let $=D5("faf-demo-");console.log(`${T("demo")} ${M("— FAF in action")}
449
451
  `);let Z=`faf_version: 2.5.0
450
452
  project:
451
453
  name: acme-app
@@ -484,18 +486,18 @@ human_context:
484
486
  where: Cloud (Vercel + AWS)
485
487
  when: "2026"
486
488
  how: Agile sprints with CI/CD
487
- `,z=Cj($,"project.faf");a(z,Z,{root:$,expect:null}),console.log(` ${C("1.")} Created sample project.faf`),console.log(M(` ${z}
488
- `)),console.log(` ${C("2.")} Scoring...`);let Q=n(z,()=>k0(F0(p(z))));console.log(""),P0(Q,"project.faf",!0),O5($),console.log(`
489
- ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}i();function BV($,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=X0.filter((Y)=>Y.path.toLowerCase().includes(z)||Y.description.toLowerCase().includes(z)||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${I("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
490
- `);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=_4.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(`${I("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
491
- `);for(let Y of J)console.log(` ${C(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(M(` No results for "${$}"`))}import{existsSync as _j}from"fs";import{dirname as Rj,join as MV,resolve as Fj}from"path";i();function Pj($){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 Sj="Wolfe-Jam/faf-taf-git@v2.2.0";function LV($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){xj(Z);return}yj(Z)}function Ej($){if(A($,"bun.lockb")||A($,"bun.lock"))return"bun";if(A($,"pnpm-lock.yaml"))return"pnpm";if(A($,"yarn.lock"))return"yarn";return"npm"}var jj={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
489
+ `,z=Gw($,"project.faf");a(z,Z,{root:$,expect:null}),console.log(` ${C("1.")} Created sample project.faf`),console.log(M(` ${z}
490
+ `)),console.log(` ${C("2.")} Scoring...`);let Q=r(z,()=>b0(P0(p(z))));console.log(""),S0(Q,"project.faf",!0),I5($),console.log(`
491
+ ${M(' Demo complete. Run "faf init" in your project to get started.')}`)}i();function PV($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let z=$.toLowerCase(),Q=!Z.slots&&!Z.formats,X=0;if(Q||Z.slots){let J=J0.filter((Y)=>Y.path.toLowerCase().includes(z)||Y.description.toLowerCase().includes(z)||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${T("slots")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
492
+ `);for(let Y of J)console.log(` ${C(`#${Y.index}`)} ${Y.path} ${M("—")} ${Y.description} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(Q||Z.formats){let J=F4.filter((Y)=>Y.name.toLowerCase().includes(z)||Y.extensions.some((W)=>W.toLowerCase().includes(z))||Y.category.toLowerCase().includes(z));if(J.length>0){console.log(`${T("formats")} ${M(`— ${J.length} match${J.length===1?"":"es"}`)}
493
+ `);for(let Y of J)console.log(` ${C(Y.name)} ${M(Y.extensions.join(", "))} ${M(`[${Y.category}]`)}`);console.log(""),X+=J.length}}if(X===0)console.log(M(` No results for "${$}"`))}import{existsSync as Vw}from"fs";import{dirname as Hw,join as SV,resolve as Kw}from"path";i();function qw($){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 Bw="Wolfe-Jam/faf-taf-git@v2.2.0";function EV($,Z={}){if($&&typeof $==="object")Z=$,$=void 0;if($==="setup"){Ow(Z);return}Dw(Z)}function Mw($){if(A($,"bun.lockb")||A($,"bun.lock"))return"bun";if(A($,"pnpm-lock.yaml"))return"pnpm";if(A($,"yarn.lock"))return"yarn";return"npm"}var Lw={bun:{setup:" - uses: oven-sh/setup-bun@v2",install:"bun install --frozen-lockfile",test:"bun run test"},pnpm:{setup:` - uses: pnpm/action-setup@v4
492
494
  - uses: actions/setup-node@v4
493
495
  with:
494
496
  node-version: 20`,install:"pnpm install --frozen-lockfile",test:"pnpm test"},yarn:{setup:` - uses: actions/setup-node@v4
495
497
  with:
496
498
  node-version: 20`,install:"yarn install --frozen-lockfile",test:"yarn test"},npm:{setup:` - uses: actions/setup-node@v4
497
499
  with:
498
- node-version: 20`,install:"npm ci",test:"npm test"}};function wj($){let Z=`name: TAF Receipts
500
+ node-version: 20`,install:"npm ci",test:"npm test"}};function Nw($){let Z=`name: TAF Receipts
499
501
  `+`# Prints a Test Receipt (.taf) on every push — proof over time, cannot be gamed.
500
502
  `+`# Written by \`faf taf setup\`. Docs: https://github.com/Wolfe-Jam/faf-taf-git
501
503
  on:
@@ -507,7 +509,7 @@ jobs:
507
509
  runs-on: ubuntu-latest
508
510
  steps:
509
511
  - uses: actions/checkout@v4
510
- `,z;if(A($,"package.json")){let X=jj[Ej($)];z=`${X.setup}
512
+ `,z;if(A($,"package.json")){let X=Lw[Mw($)];z=`${X.setup}
511
513
  - run: ${X.install}
512
514
  - name: Run tests
513
515
  run: ${X.test} 2>&1 | tee test-output.txt
@@ -518,71 +520,71 @@ jobs:
518
520
  echo "TODO: your test command" 2>&1 | tee test-output.txt
519
521
  `;let Q=` - name: Print TAF receipt
520
522
  if: github.event_name == 'push'
521
- uses: ${Sj}
523
+ uses: ${Bw}
522
524
  with:
523
525
  test-output-file: test-output.txt
524
526
  auto-commit: 'true'
525
527
  commit-message: 'chore(taf): update .taf receipt [skip ci]'
526
528
  target-branch: taf-receipts
527
- `;return Z+z+Q}function xj($){let Z=process.cwd(),z=wj(Z),Q=MV(Z,".github","workflows","taf.yml");if($.write){if(_j(Q)){console.error(`${C("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(M(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run."));return}j0(Z,MV(".github","workflows")),a(Q,z,{root:Z,expect:null}),console.log(`${I("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${I("TAF setup")} ${M("— Test Receipt Printer: proof over time, cannot be gamed")}
528
- `),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(z),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function yj($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=m();if(!Z)console.error(`Error: project.faf not found
529
+ `;return Z+z+Q}function Ow($){let Z=process.cwd(),z=Nw(Z),Q=SV(Z,".github","workflows","taf.yml");if($.write){if(Vw(Q)){console.error(`${C("×")} .github/workflows/taf.yml already exists — not overwriting.`),console.error(M(" Add the faf-taf-git step to your existing workflow, or remove taf.yml and re-run."));return}w0(Z,SV(".github","workflows")),a(Q,z,{root:Z,expect:null}),console.log(`${T("◆")} taf wrote .github/workflows/taf.yml`),console.log(M(" commit + push → your first Test Receipt prints to the taf-receipts branch."));return}console.log(`${T("TAF setup")} ${M("— Test Receipt Printer: proof over time, cannot be gamed")}
530
+ `),console.log(M("Run `faf taf setup --write` to create this, or paste it into a workflow:\n")),console.log(z),console.log(M("Then commit + push. One receipt appends to .taf (taf-receipts branch) per CI run."))}function Dw($){console.error(M("note: `faf taf` (score snapshot) is deprecated — use `faf score --json`. (`faf taf setup` wires the Receipt Printer.)"));let Z=f();if(!Z)console.error(`Error: project.faf not found
529
531
 
530
- Run 'faf init' to create one.`),process.exit(2);let z=r(Z),Q=p(Z),X=n(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)Y2($.output),G2($.output,Y,{root:Rj(Fj($.output)),format:"json",hasMark:Pj,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${I("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as kj}from"readline";import{join as NV}from"path";i();var qZ=".faf-session.json";function r9($){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 OV($){try{return y0(l($,qZ))}catch(Z){if(!(Z instanceof b))throw Z;return console.error(M(` ${qZ}: ${Z.message}`)),null}}function bj($,Z){try{return j2(NV($,qZ),JSON.stringify(Z),{root:$,owns:(z)=>r9(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 vj($){let Z=OV($);if(r9(Z)===null||Z===null)return;try{L5(NV($,qZ),{root:$,expect:Z})}catch(z){if(!(z instanceof b))throw z}}function gj($,Z){let z=new Map;for(let X of Z){let J=R4($,X);if(J&&!z.has(J.at))z.set(J.at,F4(X,J))}if(z.size===0)return;console.error(`${C("×")} go project.faf has a section faf cannot write under — nothing was changed:`);for(let X of z.values())console.error(` ${X}`);let Q=$.project;if(Q!==null&&Q!==void 0&&typeof Q!=="object")console.error(M(" 'faf auto' moves a bare `project: <name>` to `project.name` for you."));process.exit(1)}function hj($,Z){let z=R$(Z)?` ${M(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${C(`#${$.index}`)} ${n5($.path)} ${M(`(${$.path})`)}${z}: `}async function DV($={}){k$(process.cwd(),"faf go");let Z=m();if(!Z)console.error(`Error: project.faf not found
532
+ Run 'faf init' to create one.`),process.exit(2);let z=s(Z),Q=p(Z),X=r(Z,()=>O0(Q)),J={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:z.project?.name??"unknown",faf_version:z.faf_version??"unknown",score:X.score,tier:X.tier.name,populated:X.populated,active:X.active,total:X.total,slots:X.slots},Y=JSON.stringify(J,null,2);if($.output)U2($.output),H2($.output,Y,{root:Hw(Kw($.output)),format:"json",hasMark:qw,mark:"TAF snapshot (`taf_version`)",force:$.force}),console.log(`${T("◆")} taf receipt written to ${$.output}`);else console.log(Y)}import{createInterface as Iw}from"readline";import{join as jV}from"path";i();var LZ=".faf-session.json";function zz($){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 wV($){try{return k0(l($,LZ))}catch(Z){if(!(Z instanceof b))throw Z;return console.error(M(` ${LZ}: ${Z.message}`)),null}}function Tw($,Z){try{return w2(jV($,LZ),JSON.stringify(Z),{root:$,owns:(z)=>zz(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 Aw($){let Z=wV($);if(zz(Z)===null||Z===null)return;try{O5(jV($,LZ),{root:$,expect:Z})}catch(z){if(!(z instanceof b))throw z}}function Cw($,Z){let z=new Map;for(let X of Z){let J=P4($,X);if(J&&!z.has(J.at))z.set(J.at,S4(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 _w($,Z){let z=P$(Z)?` ${M(`now '${String(Z).trim()}' — Enter keeps it`)}`:"";return` ${C(`#${$.index}`)} ${s5($.path)} ${M(`(${$.path})`)}${z}: `}async function xV($={}){v$(process.cwd(),"faf go");let Z=f();if(!Z)console.error(`Error: project.faf not found
531
533
 
532
- Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let L=r9(OV(z));if(L)Q=L.slotIndex,console.log(M(` resuming from slot #${Q+1}`))}let X=r(Z),J=n(Z,()=>k0(F0(p(Z)))),Y=X0.filter((L)=>{let B=d9(X,L.path);return U0(B)&&B!==n1});if(gj(X,Y.map((L)=>L.path)),Y.length===0){console.log(`${I("◆")} go all slots populated — ✪ Trophy`),P0(J,Z);return}console.log(`${I("go")} ${M("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(M(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
533
- `));let U=kj({input:process.stdin,output:process.stdout}),G=(L)=>new Promise((B)=>U.question(L,B)),V=0,q=!1,H=Y.slice(Q);for(let L=0;L<H.length;L++){let B=H[L],N=await G(hj(B,d9(X,B.path)));if(N.toLowerCase()==="quit"){if(q=!0,bj(z,{slotIndex:Q+L,fafPath:Z}))console.log(M(`
534
- session saved. Resume with: faf go --resume`));break}if(N.toLowerCase()==="skip"||N.trim()==="")continue;VZ(X,B.path,N.trim()),V++}if(U.close(),V>0)B0(Z,X,{onAliasKept:(L)=>console.log(M(` ${c0(L)}`))}),console.log(`
535
- ${I("◆")} go filled ${V} slot${V===1?"":"s"}`);let K=n(Z,()=>k0(F0(p(Z))));if(P0(K,Z),!q)vj(z)}i();var bw="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 Dq($){if($==="analyze")await gw();else if($==="enhance")console.error(bw),process.exit(1);else console.log(`${I("ai")} ${M("— ask Claude for suggestions about project.faf")}
536
- `),console.log(` ${C("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function vw(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
534
+ Run 'faf init' to create one.`),process.exit(2);let z=process.cwd(),Q=0;if($.resume){let L=zz(wV(z));if(L)Q=L.slotIndex,console.log(M(` resuming from slot #${Q+1}`))}let X=s(Z),J=r(Z,()=>b0(P0(p(Z)))),Y=J0.filter((L)=>{let B=e9(X,L.path);return G0(B)&&B!==s1});if(Cw(X,Y.map((L)=>L.path)),Y.length===0){console.log(`${T("◆")} go all slots populated — ✪ Trophy`),S0(J,Z);return}console.log(`${T("go")} ${M("— guided interview to ✪ Trophy")}`);let W=Y.length===1?"slot":"slots";console.log(M(` ${Y.length} ${W} from Trophy. Enter a value, "skip" to skip, or "quit" to stop.
535
+ `));let U=Iw({input:process.stdin,output:process.stdout}),G=(L)=>new Promise((B)=>U.question(L,B)),V=0,H=!1,K=Y.slice(Q);for(let L=0;L<K.length;L++){let B=K[L],N=await G(_w(B,e9(X,B.path)));if(N.toLowerCase()==="quit"){if(H=!0,Tw(z,{slotIndex:Q+L,fafPath:Z}))console.log(M(`
536
+ session saved. Resume with: faf go --resume`));break}if(N.toLowerCase()==="skip"||N.trim()==="")continue;MZ(X,B.path,N.trim()),V++}if(U.close(),V>0)M0(Z,X,{onAliasKept:(L)=>console.log(M(` ${p0(L)}`))}),console.log(`
537
+ ${T("◆")} go filled ${V} slot${V===1?"":"s"}`);let q=r(Z,()=>b0(P0(p(Z))));if(S0(q,Z),!H)Aw(z)}i();var Tx="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 xH($){if($==="analyze")await Cx();else if($==="enhance")console.error(Tx),process.exit(1);else console.log(`${T("ai")} ${M("— ask Claude for suggestions about project.faf")}
538
+ `),console.log(` ${C("faf ai analyze")} ${M("— get improvement suggestions")}`),console.log(""),console.log(M(" Requires ANTHROPIC_API_KEY environment variable."))}async function Ax(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
537
539
 
538
- export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (Oq(),Nq));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
540
+ export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (wH(),jH));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
539
541
 
540
- npm install @anthropic-ai/sdk`),process.exit(2)}}async function gw(){let $=m();if(!$)console.error(`Error: project.faf not found
542
+ npm install @anthropic-ai/sdk`),process.exit(2)}}async function Cx(){let $=f();if(!$)console.error(`Error: project.faf not found
541
543
 
542
- Run 'faf init' to create one.`),process.exit(2);let Z=p($);console.log(`${I("ai")} analyze ${M("getting suggestions...")}`);let Q=await(await vw()).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.
544
+ Run 'faf init' to create one.`),process.exit(2);let Z=p($);console.log(`${T("ai")} analyze ${M("getting suggestions...")}`);let Q=await(await Ax()).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.
543
545
 
544
546
  ${Z}
545
547
 
546
- Be concise. One line per suggestion.`}]});console.log(""),console.log(Q.content[0].text)}import{existsSync as GQ,readFileSync as VQ,readdirSync as hw}from"fs";import{join as Iq}from"path";i();function Tq($,Z){if($==="import")fw(Z);else if($==="export")uw();else console.log(`${I("conductor")} ${M("— conductor integration")}
547
- `),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 fw($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!GQ($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:H6,project:{}};if(GQ($)&&$.endsWith(".json")){let X=JSON.parse(VQ($,"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(GQ($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let X=n0(VQ($,"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=hw($);for(let J of X){let Y=Iq($,J);if(J.endsWith(".json"))try{let W=JSON.parse(VQ(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=r(Q);if(!X.project)X.project={};if(Z.project.name&&!X.project.name)X.project.name=Z.project.name;if(Z.project.goal&&!X.project.goal)X.project.goal=Z.project.goal;if(Z.project.main_language&&!X.project.main_language)X.project.main_language=Z.project.main_language;B0(Q,X,{onAliasKept:(J)=>console.log(M(` ${c0(J)}`))}),console.log(`${I("◆")} conductor import merged into ${Q}`)}else{let X=Iq(z,"project.faf");B0(X,Z),console.log(`${I("◆")} conductor import created ${X}`)}}function uw(){let $=m();if(!$)console.error(`Error: project.faf not found
548
+ Be concise. One line per suggestion.`}]});console.log(""),console.log(Q.content[0].text)}import{existsSync as NQ,readFileSync as OQ,readdirSync as _x}from"fs";import{join as yH}from"path";i();function kH($,Z){if($==="import")Rx(Z);else if($==="export")Fx();else console.log(`${T("conductor")} ${M("— conductor integration")}
549
+ `),console.log(` ${C("faf conductor import <path>")} ${M("— import conductor config into .faf")}`),console.log(` ${C("faf conductor export")} ${M("— author conductor config from .faf")}`)}function Rx($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!NQ($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:B6,project:{}};if(NQ($)&&$.endsWith(".json")){let X=JSON.parse(OQ($,"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(NQ($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let X=r0(OQ($,"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=_x($);for(let J of X){let Y=yH($,J);if(J.endsWith(".json"))try{let W=JSON.parse(OQ(Y,"utf-8"));if(W.name&&!Z.project.name)Z.project.name=W.name;if(W.description&&!Z.project.goal)Z.project.goal=W.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let z=process.cwd(),Q=f(z);if(Q){let X=s(Q);if(!X.project)X.project={};if(Z.project.name&&!X.project.name)X.project.name=Z.project.name;if(Z.project.goal&&!X.project.goal)X.project.goal=Z.project.goal;if(Z.project.main_language&&!X.project.main_language)X.project.main_language=Z.project.main_language;M0(Q,X,{onAliasKept:(J)=>console.log(M(` ${p0(J)}`))}),console.log(`${T("◆")} conductor import merged into ${Q}`)}else{let X=yH(z,"project.faf");M0(X,Z),console.log(`${T("◆")} conductor import created ${X}`)}}function Fx(){let $=f();if(!$)console.error(`Error: project.faf not found
548
550
 
549
- Run 'faf init' to create one.`),process.exit(2);let Z=r($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}i();import{readdirSync as mw,readFileSync as cw,existsSync as pw}from"fs";import{join as lw}from"path";var dw=["BRAKE","ENGINE","AERO","TYRE","PIT"],iw=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function nw($){let Z=$.match(iw);if(!Z)return null;return Z[1].toUpperCase()}function rw($){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 sw($,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 H=X[G];if(H.type==="describe")U=H.name;else{let K=Y.map((B)=>B.name),L=K.length>0?`${K.join(" > ")} > ${H.name}`:H.name;z.push(L)}G++}let q=$[V];if(q==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(q==="}"){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 ow=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function Aq($,Z=[]){let z;try{z=mw($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(ow.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=lw($,Q.name);if(Q.isDirectory())Aq(X,Z);else if(Q.isFile())Z.push(X)}return Z}function aw($){let Z=[];if(!pw($))return Z;let z=Aq($);for(let Q of z){let X=Q.split("/").pop()??"",J=rw(X);if(!J.ok||!J.lang)continue;let Y;try{Y=cw(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=sw(Y,J.lang),U=Q.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:J.lang,testName:G,tier:nw(G)})}return Z}function tw($){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 ew($){if(console.log(`${I(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 dw){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?R0("●"):Z==="ENGINE"?I("●"):Z==="AERO"?M("●"):Z==="TYRE"?I("◐"):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 Cq($={}){let Z=$.path??"tests",z=aw(Z),Q=tw(z);if($.json)console.log(JSON.stringify(Q,null,2));else ew(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as Fq}from"crypto";import{readFileSync as $x,existsSync as Zx}from"fs";import{join as zx,dirname as Qx}from"path";i();var _q="faf-bench/1",Xx={"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 Jx($,Z){return Xx[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var Yx=[["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"]],L8=new Map;Yx.forEach(($,Z)=>$.forEach((z)=>L8.set(z,Z)));var Wx=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function qQ($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function Rq($){return qQ($).split(" ").filter((Z)=>Z&&!Wx.has(Z))}function Ux($,Z){let z=qQ($),Q=qQ(Z);if(!z||!Q)return!1;if(z===Q)return!0;let X=L8.get(z);if(X!==void 0&&L8.get(Q)===X)return!0;let J=Rq($);if(J.length===0)return!1;let Y=new Set(Rq(Z));return J.every((W)=>{if(Y.has(W))return!0;let U=L8.get(W);return U!==void 0&&[...Y].some((G)=>L8.get(G)===U)})}function Gx($){let Z=N0($),z=n0($),Q=[],X={},J=0;for(let U of X0){if(Z.slots[U.path]!=="populated")continue;let G=i1(z,U);if(typeof G!=="string")continue;let V=G.trim();if(!V||B3.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:U.path,question:Jx(U.path,U.description)}),X[J]=V}let Y=JSON.stringify({v:_q,q:Q.map((U)=>[U.path,U.question])}),W=Fq("sha256").update(Y).digest("hex").slice(0,12);return{version:_q,qsetHash:W,questions:Q,answers:X}}function Vx($,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()!==""&&Ux($.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 Pq=".faf-bench.json";function Sq($){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)}
550
- `===Z}catch{return!1}}function qx($){let Z=y0(l($,Pq));if(Z===null||!Sq(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function Hx($,Z,z){j2(zx($,Pq),`${JSON.stringify(Z,null,2)}
551
- `,{root:$,owns:Sq,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function HQ($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:Fq("sha256").update(z).digest("hex")}}var uZ=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function Kx($,Z){let{cold:z,faf:Q}=$;console.log(`
551
+ Run 'faf init' to create one.`),process.exit(2);let Z=s($),z={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(z,null,2))}i();import{readdirSync as Px,readFileSync as Sx,existsSync as Ex}from"fs";import{join as jx}from"path";var wx=["BRAKE","ENGINE","AERO","TYRE","PIT"],xx=/(?:^|[^A-Za-z])(BRAKE|ENGINE|AERO|TYRE|PIT)(?:[^A-Za-z]|$)/i;function yx($){let Z=$.match(xx);if(!Z)return null;return Z[1].toUpperCase()}function kx($){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 bx($,Z){let z=[];switch(Z){case"typescript":{let Q=/\b(describe|test|it)\s*\(\s*(['"`])((?:\\.|(?!\2).)*)\2/g,X=[],J;while((J=Q.exec($))!==null)X.push({idx:J.index,type:J[1]==="describe"?"describe":"test",name:J[3]});let Y=[],W=0,U=null,G=0;for(let V=0;V<$.length;V++){while(G<X.length&&X[G].idx===V){let K=X[G];if(K.type==="describe")U=K.name;else{let q=Y.map((B)=>B.name),L=q.length>0?`${q.join(" > ")} > ${K.name}`:K.name;z.push(L)}G++}let H=$[V];if(H==="{"){if(W++,U!==null)Y.push({name:U,openDepth:W}),U=null}else if(H==="}"){W--;while(Y.length>0&&W<Y[Y.length-1].openDepth)Y.pop()}}break}case"rust":{let Q=/#\[test\]\s*(?:\r?\n)\s*(?:pub\s+)?fn\s+([a-zA-Z_][a-zA-Z_0-9]*)/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"python":{let Q=/^\s*def\s+(test_[a-zA-Z_0-9]+)\s*\(/gm,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"zig":{let Q=/\btest\s+"((?:\\.|[^"\\])+)"/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}case"go":{let Q=/\bfunc\s+(Test[A-Z][a-zA-Z_0-9]*)\s*\(/g,X;while((X=Q.exec($))!==null)z.push(X[1]);break}}return z}var vx=new Set(["node_modules",".git","target","dist","build",".next",".nuxt","coverage"]);function bH($,Z=[]){let z;try{z=Px($,{withFileTypes:!0})}catch{return Z}for(let Q of z){if(vx.has(Q.name))continue;if(Q.name.startsWith(".")&&Q.name!==".")continue;let X=jx($,Q.name);if(Q.isDirectory())bH(X,Z);else if(Q.isFile())Z.push(X)}return Z}function gx($){let Z=[];if(!Ex($))return Z;let z=bH($);for(let Q of z){let X=Q.split("/").pop()??"",J=kx(X);if(!J.ok||!J.lang)continue;let Y;try{Y=Sx(Q,"utf-8")}catch{continue}if(J.lang==="rust"&&!/#\[test\]/.test(Y))continue;if(J.lang==="zig"&&!/\btest\s+"/.test(Y))continue;let W=bx(Y,J.lang),U=Q.replace(`${$}/`,"");for(let G of W)Z.push({file:U,language:J.lang,testName:G,tier:yx(G)})}return Z}function hx($){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 fx($){if(console.log(`${T(C("faf wjttc"))} ${M("— vendor-neutral test audit")}`),console.log(""),console.log(` Files scanned: ${C(String($.filesScanned))}`),console.log(` Tests found: ${C(String($.totalTests))}`),console.log(""),$.totalTests===0){console.log(M(" no tests found"));return}console.log(M(" Tiers:"));for(let Z of wx){let z=$.byTier[Z],Q=(z/$.totalTests*100).toFixed(0),X=Z==="BRAKE"?F0("●"):Z==="ENGINE"?T("●"):Z==="AERO"?M("●"):Z==="TYRE"?T("◐"):M("○");console.log(` ${X} ${Z.padEnd(7)} ${C(String(z).padStart(4))} ${M(`(${Q}%)`)}`)}if($.untiered>0){let Z=($.untiered/$.totalTests*100).toFixed(0);console.log(` ${M("○")} ${"untiered".padEnd(7)} ${C(String($.untiered).padStart(4))} ${M(`(${Z}%)`)}`)}if($.untiered>0&&$.untieredExamples.length>0){console.log(""),console.log(M(` Untiered examples (first ${$.untieredExamples.length}):`));for(let Z of $.untieredExamples)console.log(` ${M("·")} ${Z}`)}if(Object.keys($.byLanguage).length>1){console.log(""),console.log(M(" Languages:"));for(let[Z,z]of Object.entries($.byLanguage))console.log(` ${M("·")} ${Z.padEnd(12)} ${C(String(z))}`)}if($.byTier.BRAKE===0&&$.totalTests>0)console.log(""),console.log(F0(" ⚠ no BRAKE-tier tests — no safety canaries"))}function vH($={}){let Z=$.path??"tests",z=gx(Z),Q=hx(z);if($.json)console.log(JSON.stringify(Q,null,2));else fx(Q);if($.strict&&Q.untiered>0)process.exit(1)}import{createHash as fH}from"crypto";import{readFileSync as ux,existsSync as mx}from"fs";import{join as cx,dirname as px}from"path";i();var gH="faf-bench/1",lx={"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 dx($,Z){return lx[$]??`What is the project's ${Z.replace(/\s*\(.*\)$/,"").toLowerCase()}?`}var ix=[["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"]],O8=new Map;ix.forEach(($,Z)=>$.forEach((z)=>O8.set(z,Z)));var nx=new Set(["a","an","the","and","or","of","for","to","in","on","with","is","it","its","their","your","via","by","using","use","used"]);function DQ($){return $.toLowerCase().replace(/[^a-z0-9\s.+#-]/g," ").replace(/\.(?=\s|$)/g," ").replace(/\s+/g," ").trim()}function hH($){return DQ($).split(" ").filter((Z)=>Z&&!nx.has(Z))}function rx($,Z){let z=DQ($),Q=DQ(Z);if(!z||!Q)return!1;if(z===Q)return!0;let X=O8.get(z);if(X!==void 0&&O8.get(Q)===X)return!0;let J=hH($);if(J.length===0)return!1;let Y=new Set(hH(Z));return J.every((W)=>{if(Y.has(W))return!0;let U=O8.get(W);return U!==void 0&&[...Y].some((G)=>O8.get(G)===U)})}function sx($){let Z=O0($),z=r0($),Q=[],X={},J=0;for(let U of J0){if(Z.slots[U.path]!=="populated")continue;let G=r1(z,U);if(typeof G!=="string")continue;let V=G.trim();if(!V||D3.has(V.toLowerCase()))continue;J+=1,Q.push({n:J,path:U.path,question:dx(U.path,U.description)}),X[J]=V}let Y=JSON.stringify({v:gH,q:Q.map((U)=>[U.path,U.question])}),W=fH("sha256").update(Y).digest("hex").slice(0,12);return{version:gH,qsetHash:W,questions:Q,answers:X}}function ox($,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()!==""&&rx($.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 uH=".faf-bench.json";function mH($){let Z=new TextDecoder().decode($);try{let z=JSON.parse(Z);return typeof z==="object"&&z!==null&&typeof z.version==="string"&&typeof z.qsetHash==="string"&&z.protocol==="in-session"&&`${JSON.stringify(z,null,2)}
552
+ `===Z}catch{return!1}}function ax($){let Z=k0(l($,uH));if(Z===null||!mH(Z))return{state:null,bytes:Z};return{state:JSON.parse(Z.toString("utf-8")),bytes:Z}}function tx($,Z,z){w2(cx($,uH),`${JSON.stringify(Z,null,2)}
553
+ `,{root:$,owns:mH,mark:"faf bench state (2-space JSON with version, qsetHash and protocol)",expect:z})}function IQ($,Z){let z=JSON.stringify({v:$.version,repo:Z??null,qset:$.qsetHash,protocol:$.protocol,cold:$.cold??null,faf:$.faf??null});return{projection:z,hash:fH("sha256").update(z).digest("hex")}}var dZ=($)=>$===void 0?"—":`~${$.toLocaleString()}`;function ex($,Z){let{cold:z,faf:Q}=$;console.log(`
552
554
  ${C(`faf bench — ${Z}`)}
553
- `),console.log(` ${M("without context")} ${I("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${C(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${uZ(z.tokens)} ${uZ(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
554
- ${M(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let J=HQ($,Z);console.log(`
555
- ${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 Bx($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
556
- ${C(`faf bench — ${Z}`)} ${R0("Trouble ahead, expensive trouble.")}
557
- `),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 ${uZ(z.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
555
+ `),console.log(` ${M("without context")} ${T("with .faf")}`),console.log(`answers ${z.score}/${z.total} ${C(`${Q.score}/${Q.total}`)}`),console.log(`tokens ${dZ(z.tokens)} ${dZ(Q.tokens)}`);let X=z.total-z.score;if(X>0)console.log(`
556
+ ${M(`The ${X} missing answer${X===1?"":"s"} were already in your repo — unstructured.`)}`),console.log(M("Structured context closes the gap."));let J=IQ($,Z);console.log(`
557
+ ${F0("✪ BENCH RECEIPT")}`),console.log(M(` qset: ${$.qsetHash} protocol: ${$.protocol} model: ${Q.model??z.model??"unreported"}`)),console.log(M(` cold ${z.score}/${z.total} · faf ${Q.score}/${Q.total} · sha256: ${J.hash.slice(0,16)}…`))}function $y($,Z){let z=$.cold,Q=z.total-z.score;if(console.log(`
558
+ ${C(`faf bench — ${Z}`)} ${F0("Trouble ahead, expensive trouble.")}
559
+ `),console.log(` ${M("without context")}`),console.log(`answers ${z.score}/${z.total} ${M("— the AI is guessing at what you are building")}`),z.tokens!==void 0)console.log(`tokens ${dZ(z.tokens)} ${M("— re-derivation burn, paid again EVERY session")}`);if(Q>0)console.log(`
558
560
  ${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(`
559
- ${I("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var Mx="https://mcpaas.live/bench/submit";async function Lx($,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 Eq($,Z,z={}){let Q=z.file??m();if(!Q)console.error(`Error: project.faf not found
561
+ ${T("→ faf init && faf bench")} ${M("(close the gap, get the receipt)")}`)}var Zy="https://mcpaas.live/bench/submit";async function zy($,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 cH($,Z,z={}){let Q=z.file??f();if(!Q)console.error(`Error: project.faf not found
560
562
 
561
- Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=p(Q);Q2(X,Q);let J=n(Q,()=>Gx(X)),Y=Qx(Q),W=n0(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(`
563
+ Run 'faf init' to create one — bench needs the answer key.`),process.exit(2);let X=p(Q);X2(X,Q);let J=r(Q,()=>sx(X)),Y=px(Q),W=r0(X)?.project?.name??Y.split("/").pop();if(J.questions.length===0)console.error("Error: no populated slots to derive questions from.\n\n Run `faf go` to fill the .faf first."),process.exit(2);if($==="questions"){if(z.json){console.log(JSON.stringify({version:J.version,qsetHash:J.qsetHash,questions:J.questions.map(({n:U,question:G})=>({n:U,question:G}))},null,2));return}console.log(`
562
564
  ${C(`faf bench — ${J.questions.length} questions`)} ${M(`qset ${J.qsetHash}`)}
563
565
  `);for(let U of J.questions)console.log(` ${String(U.n).padStart(2)}. ${U.question}`);console.log(`
564
- ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!Zx(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse($x(Z,"utf-8")),G=U.answers??U,V=Vx(J,G),q={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:H,bytes:K}=qx(Y),L=H&&H.qsetHash===J.qsetHash?H:{version:J.version,qsetHash:J.qsetHash,protocol:"in-session"};if(z.cold)L.cold=q;else if(z.faf)L.faf=q;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(Hx(Y,L,K),z.json){let B=HQ(L,W);console.log(JSON.stringify({...L,receipt:B.hash,perQuestion:V.perQuestion},null,2));return}if(L.cold&&L.faf)Kx(L,W);if(z.submit&&L.cold&&L.faf){let{cold:B,faf:N}=L,T=HQ(L,W);Lx({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:T.hash.slice(0,16)},z.endpoint??Mx)}else if(L.cold)Bx(L,W);else console.log(`
565
- ${C(`faf bench — ${W}`)} ${I("with .faf")}: ${C(`${q.score}/${q.total}`)} ${M(`tokens ${uZ(q.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
566
+ ${M('Answer terse — the value, not a sentence. Save as JSON: {"1": "...", "2": "..."}')}`);return}if($==="grade"){if(!Z||!mx(Z))console.error("Error: faf bench grade <answers.json> — file not found."),process.exit(2);let U=JSON.parse(ux(Z,"utf-8")),G=U.answers??U,V=ox(J,G),H={score:V.correct,total:V.total,...z.tokens?{tokens:parseInt(z.tokens,10)}:{},...z.model?{model:z.model}:{}},{state:K,bytes:q}=ax(Y),L=K&&K.qsetHash===J.qsetHash?K:{version:J.version,qsetHash:J.qsetHash,protocol:"in-session"};if(z.cold)L.cold=H;else if(z.faf)L.faf=H;else console.error("Error: specify the run mode — --cold (no context) or --faf (after reading project.faf)."),process.exit(2);if(tx(Y,L,q),z.json){let B=IQ(L,W);console.log(JSON.stringify({...L,receipt:B.hash,perQuestion:V.perQuestion},null,2));return}if(L.cold&&L.faf)ex(L,W);if(z.submit&&L.cold&&L.faf){let{cold:B,faf:N}=L,I=IQ(L,W);zy({date:new Date().toISOString().slice(0,10),model:N.model??B.model??z.model??"unreported",repo:W,qset:L.qsetHash,cold:`${B.score}/${B.total}`,faf:`${N.score}/${N.total}`,sha256:I.hash.slice(0,16)},z.endpoint??Zy)}else if(L.cold)$y(L,W);else console.log(`
567
+ ${C(`faf bench — ${W}`)} ${T("with .faf")}: ${C(`${H.score}/${H.total}`)} ${M(`tokens ${dZ(H.tokens)}`)}`),console.log(M("Run the cold phase too for the full pair: faf bench (protocol)."));return}console.log(`
566
568
  ${C("faf bench — agent-native protocol")} ${M(`qset ${J.qsetHash} · ${J.questions.length} questions`)}
567
- `),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. ${I("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${I("faf bench grade cold.json --cold --tokens <used> --model <name>")}
568
- `),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. ${I("faf bench grade faf.json --faf --tokens <used> --model <name>")}
569
- `),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 Nx}from"fs";import{dirname as Ox,resolve as Dx}from"path";i();function Ix($){try{return Nx($),!0}catch{return!1}}function Tx($,Z,z,Q){let X=n(Q,()=>S5(Z));try{return j2($,X,{root:z,owns:K9,mark:B9}),{bytes:X.length,left:null}}catch(J){if(J instanceof b)return{bytes:null,left:J.message};throw J}}function Ax({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${I("refresh")} ${M("— re-grounding on the live .faf")}
570
- `),!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: ${D2($.tier)} ${C(`${$.score}%`)}`)}function jq($={}){let Z=m();if(!Z)console.error(`Error: project.faf not found
569
+ `),console.log(`${C("COLD phase")} ${M("(fresh AI session, repo access)")}`),console.log(' 1. Instruct: "Answer these questions from the repository.'),console.log(' Do NOT read project.faf, CLAUDE.md, AGENTS.md, or any *.faf file."'),console.log(` 2. ${T("faf bench questions")} — hand them over; answers terse, saved as cold.json`),console.log(` 3. ${T("faf bench grade cold.json --cold --tokens <used> --model <name>")}
570
+ `),console.log(`${C("FAF phase")} ${M("(same questions, context first)")}`),console.log(' 4. Instruct: "Read project.faf, then answer the same questions." → faf.json'),console.log(` 5. ${T("faf bench grade faf.json --faf --tokens <used> --model <name>")}
571
+ `),console.log(M("Grading is mechanical against your own project.faf — the .faf IS the answer key.")),console.log(M(`Receipts carry protocol: in-session (honor-system cold). qset ${J.qsetHash}.`))}import{lstatSync as Qy}from"fs";import{dirname as Xy,resolve as Jy}from"path";i();function Yy($){try{return Qy($),!0}catch{return!1}}function Wy($,Z,z,Q){let X=r(Q,()=>j5(Z));try{return w2($,X,{root:z,owns:D9,mark:I9}),{bytes:X.length,left:null}}catch(J){if(J instanceof b)return{bytes:null,left:J.message};throw J}}function Uy({result:$,known:Z,drifted:z,delta:Q,prevScore:X,fafbBytes:J,fafbLeft:Y}){if(console.log(`${T("refresh")} ${M("— re-grounding on the live .faf")}
572
+ `),!Z)console.log(` score unknown ${M("— about-repo with no about.source_score; the DNA journey is left as it is")}`);else if(z){let W=Q>0?"↑":"↓";console.log(` drift: ${M(`${X}%`)} ${W} ${C(`${$.score}%`)} ${M(`(${Q>0?"+":""}${Q})`)}`)}else if(X!==null&&X!==void 0)console.log(` no drift ${M(`— steady at ${$.score}%`)}`);else console.log(` baseline set ${M(`— ${$.score}%`)}`);if(J!==null)console.log(` .fafb re-compiled ${M(`(${J} bytes — fast tier current)`)}`);if(Y!==null)console.log(` .fafb left as it is ${M(`— ${Y}`)}`);if(Z)console.log(` re-grounded: ${T2($.tier)} ${C(`${$.score}%`)}`)}function pH($={}){let Z=f();if(!Z)console.error(`Error: project.faf not found
571
573
 
572
- Run 'faf init' to create one.`),process.exit(2);let z=p(Z);Q2(z,Z);let Q=n(Z,()=>N0(z)),X=new u2(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=M9(Z),q=null,H=null;if(Ix(V))({bytes:q,left:H}=Tx(V,z,Ox(Dx(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:q!==null&&q!==void 0?{reCompiled:!0,bytes:q}:{reCompiled:!1,...H!==null?{left:H}:{}},journey:X.getJourney()||null},null,2));else Ax({result:Q,known:W,drifted:G,delta:U,prevScore:Y,fafbBytes:q,fafbLeft:H});if(!W)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),l5(X);else X.birth(Q.score)}i();import{existsSync as lq,lstatSync as fx}from"fs";import{resolve as O8}from"path";var wq=["ephemeral","standard","high","critical"],U$=Object.fromEntries(wq.map(($,Z)=>[$,Z])),KQ=new Set(["user","feedback","project","reference"]),BQ=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),MQ=new Set(["facts","sessions","preferences","custom"]),LQ={low:"ephemeral",medium:"standard"};import{existsSync as Cx}from"fs";import{dirname as gq,resolve as hq}from"path";function L1(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function q0($){return $===null||$===void 0}function _x($){if(Array.isArray($))return`a list (${$.length} item${$.length===1?"":"s"})`;if(q0($))return"empty";if(typeof $==="string")return`a string (${JSON.stringify($.length>40?`${$.slice(0,40)}…`:$)})`;return`a ${typeof $}`}var M1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function Rx($){let Z=hq($),z=l(gq(Z),Z,{read:!0});return{real:z,text:z0(z)}}function xq($,Z,z,Q){let X=hq($),J=l(gq(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 b("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let U=Y?z.text:Q?W:null;return a($,Z,U===void 0?{}:{expect:U})}function N8($){if(q0($))return"standard";if(LQ[$])return LQ[$];if($ in U$)return $;return"standard"}var Fx=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(!Fx.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:N8(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 B1($){if(q0($.id)&&q0($.type)&&$.tags.length===0&&$.links.length===0&&q0($.timestamp)&&q0($.source)&&Object.keys($.extra).length===0&&$.priority==="standard")return $.text;let z={text:$.text};if(!q0($.id))z.id=$.id;if(!q0($.type))z.type=$.type;if(z.priority=$.priority,$.tags.length)z.tags=$.tags;if($.links.length)z.links=$.links;if(!q0($.timestamp))z.timestamp=$.timestamp;if(!q0($.source))z.source=$.source;return Object.assign(z,$.extra),z}function yq($){let Z=$;return M1($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&M1(Z.extra)&&typeof Z.priority==="string"?Z:NQ($)}function Px($){if(typeof $==="string"||M1($)&&"text"in $)return NQ($);return null}var kq=["profile","namepoint","created","last_etched","retention"];class f0{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??L1(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(yq):[],this._byId=new Map,this._facts.forEach((z,Q)=>{if(!q0(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||K0(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(!Cx($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=Rx($);return f0.fromText(z,$,Z)}static fromText($,Z,z){let Q=D3($,Z).toJS();if(!M1(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${_x(Q)}`);let X=new fq,J=X.pick("memory",Q.memory,e)??{},Y=new f0(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=Px(W);if(G)Y.adopt(G,U)}),Y.last_etched=String(Q.last_etched??Y.created),Y._version=q0(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($),!q0($.id))this._byId.set($.id,this._facts.length-1);this._factAt.set($,Z)}static fromFile($){return f0.load($)}toDoc(){let $={facts:this._facts.map(B1),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[z,Q]of Object.entries(this._memoryExtra))if(!MQ.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(!BQ.has(z))Z[z]=structuredClone(Q);return Z}toYaml(){return T$(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")&&K0(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&&K0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let U=this.toYaml(),G=xq($,U,void 0,Q);return this.settle($,U,new Map(this._facts.map((V,q)=>[V,q])),G),$}let J=new Map,{text:Y}=T5(X.text,(U)=>{J=this.applyTo(U,X,z)},$),W=xq($,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(B1(Z)))}return{top:Object.fromEntries(kq.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 kq)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!K0(Q.index,X.index)){if(Z.residual.has("index")&&!z)f0.refuse(Z,"index","replace it");C5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of vq(Q.extra,X.extra))C5($,[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],...vq(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,W]of X){if(K0(Y,W))continue;if(Z.residual.has("memory"))f0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))f0.refuse(Z,`memory.${J}`,"replace it");C5($,["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])=>!K0(Z.base.facts.get(V),B1(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))f0.refuse(Z,G,"add facts to it");let U=kY($,["memory","facts"],Z.path);for(let[G,V]of Y)U.items[V]=Ex($,U.items[V],Z.base.facts.get(V),B1(G));for(let G of J)U.items.splice(G,1);for(let[G,V]of z)W.set(G,V-J.filter((q)=>q<V).length);for(let G of Q)W.set(G,U.items.length),U.items.push($.createNode(B1(G)));return W}add($){let Z=yq($);if(!q0(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),!q0(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=q0(Z.id)?null:this.getFact(Z.id);if(z)return this.add(Sx(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:N8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:L1(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=M1($)?{...$,...Z}:Z,Q=M1($)?$.query:$,X=U$[N8(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((q)=>(G.tags??[]).includes(q)))return;if(!q0(z.type)&&G.type!==z.type)return;if((U$[G.priority]??1)<X)return;W.push([V,G])}),W.sort((G,V)=>{let q=U$[G[1].priority]??1,H=U$[V[1].priority]??1;if(H!==q)return H-q;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(!q0(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(!q0(z.id))this._byId.set(z.id,Q)}),!0}}function Sx($,Z,z){let Q=(X,J)=>q0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:q0(z.priority)?$.priority:N8(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:L1(),extra:{...$.extra}}}class fq{residual=new Map;pick($,Z,z){if(q0(Z))return;if(z(Z))return Z;this.residual.set($,g6(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,e)??{}),custom:structuredClone(this.pick("memory.custom",Z.custom,e)??{}),extra:bq($,BQ),memoryExtra:bq(Z,MQ)}}}function bq($,Z){let z={};for(let[Q,X]of Object.entries($))if(!Z.has(Q))z[Q]=structuredClone(X);return z}function vq($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function Ex($,Z,z,Q){if(!H0(Z))return t1($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return t1($,Z,X(z),X(Q))}import{readdirSync as jx,readFileSync as wx,statSync as uq,existsSync as xx}from"fs";import{join as yx,basename as mq,resolve as kx}from"path";var cq=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),bx=/\[\[([^\]]+)\]\]/g;function vx($){let Z=uq($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function gx($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=n0(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 hx($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!KQ.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(bx)].map((V)=>V[1]))].sort();return{text:W,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:vx($),source:`claude-code memory: ${mq($)}`,extra:U}}function OQ($,Z={}){let z=kx($);if(!xx(z))throw Error(`Claude memory directory not found: ${z}`);if(!uq(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??cq,X=Z.namepoint??`@claude-code:${mq(z)}`,J=[],Y=jx(z).filter((q)=>q.endsWith(".md")).sort();for(let q of Y){if(Q.has(q))continue;let H=yx(z,q),K;try{K=wx(H,"utf-8")}catch{continue}let{fm:L,body:B}=gx(K);if(!L)continue;let N=hx(H,B,L);if(N)J.push(N)}let W=J.map((q)=>q.timestamp).filter(Boolean),U=W.length?W.reduce((q,H)=>q<H?q:H):L1(),G=W.length?W.reduce((q,H)=>q>H?q:H):U,V=new f0(X,{profile:"knowledge",facts:J,created:U});return V.last_etched=G,V.rebuildIndex(),V}function ux($){try{return fx($),!0}catch{return!1}}function DQ(){return O8(process.cwd(),"soul.fafm")}function IQ($){let Z=O8($??DQ());if(!lq(Z))console.error(`Error: soul file not found: ${Z}
574
+ Run 'faf init' to create one.`),process.exit(2);let z=p(Z);X2(z,Z);let Q=r(Z,()=>O0(z)),X=new c2(process.cwd()),J=X.load()?X.getBirthDNADisplay():null,Y=J?J.current:null,W=!Q.unknown,U=W&&Y!==null&&Y!==void 0?Q.score-Y:0,G=W&&Y!==null&&Y!==void 0&&U!==0,V=T9(Z),H=null,K=null;if(Yy(V))({bytes:H,left:K}=Wy(V,z,Xy(Jy(Z)),Z));if($.json)console.log(JSON.stringify({reGrounded:W,score:Q.score,...W?{}:{unknown:!0},tier:Q.tier,baseline:Y,delta:U,drifted:G,fafb:H!==null&&H!==void 0?{reCompiled:!0,bytes:H}:{reCompiled:!1,...K!==null?{left:K}:{}},journey:X.getJourney()||null},null,2));else Uy({result:Q,known:W,drifted:G,delta:U,prevScore:Y,fafbBytes:H,fafbLeft:K});if(!W)return;if(X.exists())X.recordGrowth(Q.score,["refresh — re-grounded"]),i5(X);else X.birth(Q.score)}i();import{existsSync as QK,lstatSync as Ry}from"fs";import{resolve as I8}from"path";var lH=["ephemeral","standard","high","critical"],H$=Object.fromEntries(lH.map(($,Z)=>[$,Z])),TQ=new Set(["user","feedback","project","reference"]),AQ=new Set(["version","profile","namepoint","created","last_etched","retention","index","memory"]),CQ=new Set(["facts","sessions","preferences","custom"]),_Q={low:"ephemeral",medium:"standard"};import{existsSync as Gy}from"fs";import{dirname as oH,resolve as aH}from"path";function O1(){return new Date().toISOString().replace(/\.\d{3}Z$/,"Z")}function K0($){return $===null||$===void 0}function Vy($){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 N1=($)=>typeof $==="object"&&$!==null&&!Array.isArray($);function Hy($){let Z=aH($),z=l(oH(Z),Z,{read:!0});return{real:z,text:Q0(z)}}function dH($,Z,z,Q){let X=aH($),J=l(oH(X),X),Y=z!==void 0&&z.real===J;if(Y&&z.text===Z)return J;let W;try{W=k0(J)}catch{W=void 0}if(W&&W.equals(Buffer.from(Z,"utf-8")))return J;if(!Y&&!Q&&W)throw new b("changed",X,`${X} already exists — not written; pass { replace: true } (faf memory convert --force) to replace it`,{onWrite:!0});let U=Y?z.text:Q?W:null;return a($,Z,U===void 0?{}:{expect:U})}function D8($){if(K0($))return"standard";if(_Q[$])return _Q[$];if($ in H$)return $;return"standard"}var Ky=new Set(["text","id","type","priority","tags","links","timestamp","source"]);function RQ($){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(!Ky.has(Q))z[Q]=X;return{text:String(Z.text),id:Z.id??null,type:Z.type??null,priority:D8(Z.priority),tags:Array.isArray(Z.tags)?Z.tags.slice():[],links:Array.isArray(Z.links)?Z.links.slice():[],timestamp:Z.timestamp??null,source:Z.source??null,extra:z}}function L1($){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 iH($){let Z=$;return N1($)&&typeof Z.text==="string"&&Array.isArray(Z.tags)&&Array.isArray(Z.links)&&N1(Z.extra)&&typeof Z.priority==="string"?Z:RQ($)}function qy($){if(typeof $==="string"||N1($)&&"text"in $)return RQ($);return null}var nH=["profile","namepoint","created","last_etched","retention"];class u0{namepoint;profile;retention;created;last_etched;_facts;_byId;_index;_sessions;_preferences;_custom;_extra;_memoryExtra;_version;_origin;_factAt=new WeakMap;_indexDerived=!0;_indexAtRecord=[];constructor($,Z={}){this.namepoint=$,this.profile=Z.profile??"knowledge",this.retention=Z.retention??"forever",this.created=Z.created??O1(),this.last_etched=this.created,this._facts=Z.facts?Z.facts.map(iH):[],this._byId=new Map,this._facts.forEach((z,Q)=>{if(!K0(z.id))this._byId.set(z.id,Q)}),this._index=Z.index?Z.index.slice():[],this._sessions=Z.sessions?structuredClone(Z.sessions):[],this._preferences=Z.preferences?{...Z.preferences}:{},this._custom=Z.custom?{...Z.custom}:{},this._extra=Z.extra?{...Z.extra}:{},this._memoryExtra=Z.memoryExtra?{...Z.memoryExtra}:{},this._indexDerived=Z.index===void 0||B0(this._index,this.derivedIndex()),this._indexAtRecord=this._index.slice()}get facts(){return this._facts}get index(){return this._index}get sessions(){return this._sessions}get preferences(){return this._preferences}get custom(){return this._custom}get extra(){return this._extra}get memoryExtra(){return this._memoryExtra}static load($){if(!Gy($))throw Error(`soul file not found: ${$}`);let{real:Z,text:z}=Hy($);return u0.fromText(z,$,Z)}static fromText($,Z,z){let Q=_3($,Z).toJS();if(!N1(Q))throw Error(`soul is not a YAML mapping: ${Z} is ${Vy(Q)}`);let X=new tH,J=X.pick("memory",Q.memory,$0)??{},Y=new u0(String(Q.namepoint??Z.replace(/.*\//,"").replace(/\.fafm$/,"")),{profile:String(Q.profile??"voice"),retention:String(Q.retention??"forever"),created:Q.created??null,...X.modelled(Q,J)});return(X.pick("memory.facts",J.facts,Array.isArray)??[]).forEach((W,U)=>{let G=qy(W);if(G)Y.adopt(G,U)}),Y.last_etched=String(Q.last_etched??Y.created),Y._version=K0(Q.version)?void 0:String(Q.version),Y._origin={path:Z,real:z,text:$,base:Y.state(),residual:X.residual},Y.recordIndex(),Y}recordIndex(){this._indexDerived=this.indexIsDerived(),this._indexAtRecord=this._index.slice()}adopt($,Z){if(this._facts.push($),!K0($.id))this._byId.set($.id,this._facts.length-1);this._factAt.set($,Z)}static fromFile($){return u0.load($)}toDoc(){let $={facts:this._facts.map(L1),sessions:structuredClone(this._sessions),preferences:structuredClone(this._preferences),custom:structuredClone(this._custom)};for(let[z,Q]of Object.entries(this._memoryExtra))if(!CQ.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(!AQ.has(z))Z[z]=structuredClone(Q);return Z}toYaml(){return g6(this.toDoc(),{lineWidth:100})}derivedIndex($=80){return this._facts.map((Z)=>`${Z.id??"?"} — ${String(Z.text).slice(0,$)}`)}indexIsDerived($=80){return!this._origin?.residual.has("index")&&B0(this._index,this.derivedIndex($))}rebuildIndex($=80){return this._index=this.derivedIndex($),this._indexDerived=!0,this._indexAtRecord=this._index.slice(),this._index}save($,Z={}){let z=Z.reindex??(this._indexDerived&&B0(this._index,this._indexAtRecord));if(z)this.rebuildIndex();let Q=Z.replace===!0,X=this._origin;if(!X){let U=this.toYaml(),G=dH($,U,void 0,Q);return this.settle($,U,new Map(this._facts.map((V,H)=>[V,H])),G),$}let J=new Map,{text:Y}=C5(X.text,(U)=>{J=this.applyTo(U,X,z)},$),W=dH($,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(L1(Z)))}return{top:Object.fromEntries(nH.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 nH)if(Q.top[Y]!==X.top[Y])$.set(Y,X.top[Y]);if(!B0(Q.index,X.index)){if(Z.residual.has("index")&&!z)u0.refuse(Z,"index","replace it");R5($,["index"],Z.residual.has("index")?void 0:Q.index,X.index,J)}for(let Y of sH(Q.extra,X.extra))R5($,[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],...sH(z.memoryExtra,Q.memoryExtra).map((J)=>[J,z.memoryExtra[J],Q.memoryExtra[J]])];for(let[J,Y,W]of X){if(B0(Y,W))continue;if(Z.residual.has("memory"))u0.refuse(Z,"memory",`change memory.${J}`);if(Z.residual.has(`memory.${J}`))u0.refuse(Z,`memory.${J}`,"replace it");R5($,["memory",J],Y,W,Z.path)}}sortFacts($){let Z=[],z=[];for(let Q of this._facts){let X=this._factAt.get(Q);if(X===void 0){z.push(Q);continue}if(z.length>0||Z.length>0&&X<=Z[Z.length-1][1])throw Error(`${$.path}: the facts were reordered — faf keeps the order soul.fafm has. Nothing written.`);Z.push([Q,X])}return{kept:Z,added:z}}applyFacts($,Z){let{kept:z,added:Q}=this.sortFacts(Z),X=new Set(z.map(([,G])=>G)),J=[...Z.base.facts.keys()].filter((G)=>!X.has(G)).sort((G,V)=>V-G),Y=z.filter(([G,V])=>!B0(Z.base.facts.get(V),L1(G))),W=new Map(z);if(Q.length===0&&J.length===0&&Y.length===0)return W;for(let G of["memory","memory.facts"])if(Z.residual.has(G))u0.refuse(Z,G,"add facts to it");let U=cY($,["memory","facts"],Z.path);for(let[G,V]of Y)U.items[V]=My($,U.items[V],Z.base.facts.get(V),L1(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(L1(G)));return W}add($){let Z=iH($);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(By(z,$,Z));return this.add({text:$,id:Z.id??null,type:Z.type??null,priority:D8(Z.priority),tags:Z.tags?Z.tags.slice():[],links:Z.links?Z.links.slice():[],timestamp:O1(),source:Z.source??null,extra:{}})}recall($,Z={}){let z=N1($)?{...$,...Z}:Z,Q=N1($)?$.query:$,X=H$[D8(z.minPriority??"ephemeral")]??0,J=typeof Q==="string"?Q.toLowerCase():"",Y=new Set(z.tags??[]),W=[];this._facts.forEach((G,V)=>{if(J&&!String(G.text??"").toLowerCase().includes(J))return;if(Y.size>0&&![...Y].some((H)=>(G.tags??[]).includes(H)))return;if(!K0(z.type)&&G.type!==z.type)return;if((H$[G.priority]??1)<X)return;W.push([V,G])}),W.sort((G,V)=>{let H=H$[G[1].priority]??1,K=H$[V[1].priority]??1;if(K!==H)return K-H;let q=G[1].timestamp??"",L=V[1].timestamp??"";if(L!==q)return L<q?-1:L>q?1:0;return V[0]-G[0]});let U=W.map(([,G])=>G);if(!K0(z.limit))return U.slice(0,z.limit);return U}getFact($){let Z=this._byId.get($);return Z===void 0?null:this._facts[Z]}deleteFact($){let Z=this._byId.get($);if(Z===void 0)return!1;return this._facts.splice(Z,1),this._byId.clear(),this._facts.forEach((z,Q)=>{if(!K0(z.id))this._byId.set(z.id,Q)}),!0}}function By($,Z,z){let Q=(X,J)=>K0(X)?J:X;return{...$,text:Z,type:Q(z.type,$.type),priority:K0(z.priority)?$.priority:D8(z.priority),tags:Q(z.tags,$.tags).slice(),links:Q(z.links,$.links).slice(),source:Q(z.source,$.source),timestamp:O1(),extra:{...$.extra}}}class tH{residual=new Map;pick($,Z,z){if(K0(Z))return;if(z(Z))return Z;this.residual.set($,f6(Z));return}modelled($,Z){return{index:(this.pick("index",$.index,Array.isArray)??[]).map(String),sessions:this.pick("memory.sessions",Z.sessions,Array.isArray)??[],preferences:structuredClone(this.pick("memory.preferences",Z.preferences,$0)??{}),custom:structuredClone(this.pick("memory.custom",Z.custom,$0)??{}),extra:rH($,AQ),memoryExtra:rH(Z,CQ)}}}function rH($,Z){let z={};for(let[Q,X]of Object.entries($))if(!Z.has(Q))z[Q]=structuredClone(X);return z}function sH($,Z){return[...new Set([...Object.keys($),...Object.keys(Z)])]}function My($,Z,z,Q){if(!q0(Z))return $4($,Z,z,Q);let X=(J)=>typeof J==="string"?{text:J}:J;return $4($,Z,X(z),X(Q))}import{readdirSync as Ly,readFileSync as Ny,statSync as eH,existsSync as Oy}from"fs";import{join as Dy,basename as $K,resolve as Iy}from"path";var ZK=new Set(["MEMORY.md","MEMORY-FULL.md","README.md"]),Ty=/\[\[([^\]]+)\]\]/g;function Ay($){let Z=eH($).mtimeMs;return new Date(Z).toISOString().replace(/\.\d{3}Z$/,"Z")}function Cy($){if(!$.startsWith("---"))return{fm:null,body:$};let Z=$.split("---");if(Z.length<3)return{fm:null,body:$};try{let z=r0(Z[1]);if(!z||typeof z!=="object")return{fm:null,body:Z.slice(2).join("---").trim()};return{fm:z,body:Z.slice(2).join("---").trim()}}catch{return{fm:null,body:$}}}function _y($,Z,z){if(!z.name)return null;let Q=z.metadata&&typeof z.metadata==="object"?z.metadata:{},X=Q.type;if(typeof X!=="string"||!TQ.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(Ty)].map((V)=>V[1]))].sort();return{text:W,id:J,type:X,priority:"standard",tags:[],links:G,timestamp:Ay($),source:`claude-code memory: ${$K($)}`,extra:U}}function FQ($,Z={}){let z=Iy($);if(!Oy(z))throw Error(`Claude memory directory not found: ${z}`);if(!eH(z).isDirectory())throw Error(`Claude memory path is not a directory: ${z}`);let Q=Z.skip??ZK,X=Z.namepoint??`@claude-code:${$K(z)}`,J=[],Y=Ly(z).filter((H)=>H.endsWith(".md")).sort();for(let H of Y){if(Q.has(H))continue;let K=Dy(z,H),q;try{q=Ny(K,"utf-8")}catch{continue}let{fm:L,body:B}=Cy(q);if(!L)continue;let N=_y(K,B,L);if(N)J.push(N)}let W=J.map((H)=>H.timestamp).filter(Boolean),U=W.length?W.reduce((H,K)=>H<K?H:K):O1(),G=W.length?W.reduce((H,K)=>H>K?H:K):U,V=new u0(X,{profile:"knowledge",facts:J,created:U});return V.last_etched=G,V.rebuildIndex(),V}function Fy($){try{return Ry($),!0}catch{return!1}}function PQ(){return I8(process.cwd(),"soul.fafm")}function SQ($){let Z=I8($??PQ());if(!QK(Z))console.error(`Error: soul file not found: ${Z}
573
575
 
574
- Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return f0.load(Z)}function mx($,Z){if(!$)console.error(`Error: directory required
576
+ Run 'faf memory convert <dir>' or 'faf memory etch …' first.`),process.exit(2);return u0.load(Z)}function Py($,Z){if(!$)console.error(`Error: directory required
575
577
 
576
- faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=O8($),Q=O8(Z.output??DQ());if(ux(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${C("--force")} to overwrite.`),process.exit(1);try{let X=OQ(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${I("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 cx($){let Z=IQ($.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(`${I("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
577
- `);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 px($,Z){let z=IQ(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(`${I("memory recall")} ${M(`— ${J.length} hit(s)`)}${$?M(` for "${$}"`):""}
578
- `);for(let Y of J)console.log(` ${Y.id?C(Y.id):M("?")} ${Y.text}`)}function lx($,Z){if(!$)console.error(`Error: text required
578
+ faf memory convert <claude-memory-dir> [-o soul.fafm]`),process.exit(2);let z=I8($),Q=I8(Z.output??PQ());if(Fy(Q)&&!Z.force)console.error(`${Z.output??"soul.fafm"} already exists. Use ${C("--force")} to overwrite.`),process.exit(1);try{let X=FQ(z,{namepoint:Z.namepoint});X.toFile(Q,{replace:Z.force===!0}),console.log(`${T("memory convert")} ${M("—")} ${X.facts.length} facts → ${Q}`),console.log(M(` namepoint ${X.namepoint} profile ${X.profile} index ${X.index.length}`))}catch(X){console.error(`Error: ${X instanceof Error?X.message:X}`),process.exit(1)}}function Sy($){let Z=SQ($.file);if($.json){console.log(JSON.stringify(Z.facts.map((z)=>({id:z.id,text:z.text,type:z.type,priority:z.priority,tags:z.tags})),null,2));return}console.log(`${T("memory ls")} ${M(`— ${Z.namepoint} (${Z.facts.length} facts)`)}
579
+ `);for(let z of Z.recall()){let Q=z.id?C(z.id):M("(no-id)"),X=[z.type,z.priority].filter(Boolean).join(" · ");if(console.log(` ${Q} ${z.text.slice(0,80)}`),X)console.log(M(` ${X}`))}}function Ey($,Z){let z=SQ(Z.file),Q=Z.tag?Z.tag.split(",").map((Y)=>Y.trim()):void 0,X=Z.limit!==void 0&&Z.limit!==null?parseInt(Z.limit,10):void 0,J=z.recall($??null,{tags:Q,type:Z.type,minPriority:Z.priority,limit:Number.isFinite(X)?X:null});if(Z.json){console.log(JSON.stringify(J.map((Y)=>({id:Y.id,text:Y.text,priority:Y.priority})),null,2));return}console.log(`${T("memory recall")} ${M(`— ${J.length} hit(s)`)}${$?M(` for "${$}"`):""}
580
+ `);for(let Y of J)console.log(` ${Y.id?C(Y.id):M("?")} ${Y.text}`)}function jy($,Z){if(!$)console.error(`Error: text required
579
581
 
580
- faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=O8(Z.file??DQ()),Q=lq(z)?f0.load(z):new f0(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(`${I("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${z}`)}function dx($){let Z=IQ($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${I("memory show")} ${M(`— ${Z.namepoint}`)}
582
+ faf memory etch "a durable fact" [--id slug]`),process.exit(2);let z=I8(Z.file??PQ()),Q=QK(z)?u0.load(z):new u0(Z.namepoint??"@local",{profile:"knowledge"}),X=Q.indexIsDerived(),J=Q.etch($,{id:Z.id,type:Z.type,priority:Z.priority});Q.toFile(z,{reindex:X}),console.log(`${T("memory etch")} ${M("—")} ${J.id??"(no-id)"} → ${z}`)}function wy($){let Z=SQ($.file);if($.json){console.log(JSON.stringify(Z.toDoc(),null,2));return}if(console.log(`${T("memory show")} ${M(`— ${Z.namepoint}`)}
581
583
  `),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(`
582
- ${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 dq($,Z,z={}){if(Z&&typeof Z==="object")z=Z,Z=void 0;switch($){case"convert":mx(Z,z);break;case"ls":case"list":cx(z);break;case"recall":px(Z,z);break;case"etch":lx(Z,z);break;case"show":dx(z);break;case void 0:case"help":pq();break;default:console.error(`Unknown memory subcommand: ${$}`),pq(),process.exit(2)}}function pq(){console.log(`${I("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
584
+ ${C("index")}`);for(let z of Z.index.slice(0,20))console.log(M(` ${z}`));if(Z.index.length>20)console.log(M(` … +${Z.index.length-20} more`))}}function XK($,Z,z={}){if(Z&&typeof Z==="object")z=Z,Z=void 0;switch($){case"convert":Py(Z,z);break;case"ls":case"list":Sy(z);break;case"recall":Ey(Z,z);break;case"etch":jy(Z,z);break;case"show":wy(z);break;case void 0:case"help":zK();break;default:console.error(`Unknown memory subcommand: ${$}`),zK(),process.exit(2)}}function zK(){console.log(`${T("faf memory")} ${M("— .fafm soul ops (knowledge profile)")}
583
585
  `),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
584
- `),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json · --force")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:iq}=l9(),h=new uQ;h.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(iq,"-v, --version");h.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>Z9($));h.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>dW());h.command("auto").description("Fill every tech slot from the repo, then score").action(()=>d5());h.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>nW($));h.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>DV($));h.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>j5($,Z));h.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger").option("--endpoint <url>","Override the submit endpoint").action(($,Z,z)=>Eq($,Z,z));h.command("show").description("Render project.faf → project.html and open it").option("--force","Replace a project.html faf cannot prove it rendered (edited since, or not faf's)").action(($)=>IG($));h.command("sync").description(".faf → CLAUDE.md (--direction pull: Trophy-gated backfill into .faf)").option("--watch","Watch for changes").option("--direction <dir>","auto|push write CLAUDE.md from .faf; pull backfills .faf at ✪ Trophy","auto").action(($)=>H9($));h.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").option("--force","Replace an output file that is not a .fafb faf compiled").action(($,Z)=>AU($,Z));h.command("decompile <file>").description("Decompile .fafb to JSON").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)=>yU($,Z));h.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>RG($,Z));h.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>gG($,Z));h.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>xG($??[]));h.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>hG($));h.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>tG($));h.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>aG($));h.command("export").description("Export context files from .faf").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml").option("--llms","Author llms.txt (llmstxt.org view of authored 6Ws — opt-in)").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (./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(($)=>e6($));h.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").option("--force","With --out: replace a file faf cannot prove it wrote (edited since, or no faf identity)").action(($)=>LG($));h.command("cards").description("Project .faf + .fafa onto A2A / MCP / registry / catalog cards — one context block, every door").option("--target <list>","Comma list: a2a,mcp,registry,catalog,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(($)=>DG($));h.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").option("--verbose","Show slot breakdown").action(($,Z)=>_9($,Z));h.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>eG($));h.command("formats").description("Show supported formats").action(()=>$V());h.command("clear").description("Clear cached data").action(()=>ZV());h.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>zV($));h.command("context").description("Author context output").action(()=>QV());h.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>jq($));h.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>WV($));h.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>UV($,Z));h.command("recover").description("Recover .faf from context files").action(()=>GV());h.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>VV($));h.command("pro [subcommand]").description("Pro features & licensing").action(($)=>qV($));h.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>HV($));h.command("demo").description("Demo walkthrough").action(()=>KV());h.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>BV($,Z));h.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` wires the CI receipt printer; bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a TAF snapshot)").action(($,Z)=>LV($,Z));h.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze)").action(($)=>Dq($));h.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>Tq($,Z));h.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>Cq($));h.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").option("--force","Overwrite an existing soul.fafm (convert)").action(($,Z,z)=>dq($,Z,z));h.command("bi-sync",{hidden:!0}).action(()=>H9());h.command("status",{hidden:!0}).action(()=>j5(void 0,{status:!0}));h.command("agents",{hidden:!0}).action(()=>e6({agents:!0}));h.command("cursor",{hidden:!0}).action(()=>e6({cursor:!0}));h.command("gemini",{hidden:!0}).action(()=>e6({gemini:!0}));h.command("grok",{hidden:!0}).action(()=>e6({grok:!0}));h.command("llms",{hidden:!0}).action(()=>e6({llms:!0}));h.command("validate",{hidden:!0}).action(($)=>_9($));h.command("yolo",{hidden:!0}).action(()=>Z9({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z}=await Promise.resolve().then(() => (i(),iY)),Q=process.cwd().replace(process.env.HOME??"","~"),X="\x1B[38;2;150;150;150m",J="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${z($("faf"))} ${Z(`v${iq}`)}`);let G="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${G}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${Q}`)}`),console.log("");try{await j5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else h.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',""].join(`
585
- `)),h.parseAsync(process.argv).catch(($)=>{if(!b$($))throw $;console.error(B6($,ix())),process.exit(1)});function ix(){let $=process.argv[2];return h.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
586
+ `),console.log(M(" Options: --file · --output · --namepoint · --id · --type · --tag · --priority · --limit · --json · --force")),console.log(M(" INTEROP: claude-fafm-sdk 1.0 · application/vnd.fafm+yaml v1.1"))}var{version:YK}=t9(),g=new rQ;g.name("faf").description("Foundational AI context + memory — .faf and .fafm for any AI").version(YK,"-v, --version");g.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>W9($));g.command("dna").description("\uD83E\uDDEC Show your FAF DNA journey (birth → growth)").action(()=>eW());g.command("auto").description("Fill every tech slot from the repo, then score").action(()=>n5());g.command("loop").description("Drive to 100% — source what we can, then ask only the human").option("-r, --rounds <n>","max auto rounds before stopping","5").action(($)=>ZU($));g.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>xV($));g.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>x5($,Z));g.command("bench [action] [answersFile]").description("AI-grounding benchmark — cold vs with-faf (the .faf is the answer key; grade saves .faf-bench.json)").option("--json","Output as JSON").option("--cold","Grade as the without-context run").option("--faf","Grade as the with-context run").option("--tokens <n>","Tokens used in the run (reported by the agent)").option("--model <name>","Model that answered (reported)").option("--file <path>","Path to project.faf (default: discovered)").option("--submit","Submit the full-pair receipt to the public bench ledger (mcpaas.live; --endpoint to change)").option("--endpoint <url>","Override the submit endpoint").action(($,Z,z)=>cH($,Z,z));g.command("show").description("Render project.faf → project.html and open it").option("--force","Replace a project.html faf cannot prove it rendered (edited since, or not faf's)").action(($)=>yG($));g.command("sync").description(".faf → CLAUDE.md — writes faf's block only; Pro also updates Claude Code's MEMORY.md (--direction pull: Trophy-gated backfill into .faf)").option("--watch","Watch for changes").option("--direction <dir>","auto|push write CLAUDE.md from .faf; pull backfills .faf at ✪ Trophy","auto").action(($)=>O9($));g.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").option("--force","Replace an output file that is not a .fafb faf compiled").action(($,Z)=>jU($,Z));g.command("decompile <file>").description("Decompile .fafb to JSON (prints; --output writes a file)").option("--output <path>","Output path").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a faf decompile)").action(($,Z)=>mU($,Z));g.command("git <url>").description("Instant scored context from any GitHub repo (any branch/tag with --ref) — shallow-clones to a temp dir, writes ./project.faf (--stdout to print)").option("--ref <ref>","Clone at a specific branch or tag (versioned context)").option("--output <path>","Write to a custom path (default: ./project.faf)").option("--force","Overwrite an existing project.faf").option("--stdout","Print the .faf to stdout instead of writing a file").action(($,Z)=>hG($,Z));g.command("diff [range]").description("Semantic context diff between two .faf versions (slot deltas + score). git ranges: <ref>, A..B, A...B").option("--json","Emit the delta as structured JSON").option("--install-driver","Wire faf diff into native git — `git diff` renders .faf score+slot deltas").option("--uninstall-driver","Remove the native-git diff driver").action(($,Z)=>oG($,Z));g.command("diff-driver [args...]",{hidden:!0}).description("Internal: GIT_EXTERNAL_DIFF handler invoked by git for diff=faf files").action(($)=>dG($??[]));g.command("log").description("Score timeline across git history — the .faf score at every commit that touched it").option("-n, --limit <n>","Max commits to show (default 20)").option("--all","Show every commit, no cap").option("--reverse","Oldest-first instead of newest-first").option("--json","Emit the timeline as structured JSON").action(($)=>aG($));g.command("hooks").description("Pre-commit context guard — scores staged .faf vs HEAD, warns (or --strict blocks) on regression").option("--install","Install the pre-commit hook").option("--uninstall","Remove the faf hook block (preserves other hooks)").option("--strict","With --install: block the commit on a score regression (default: warn only)").action(($)=>HV($));g.command("hooks-run",{hidden:!0}).description("Internal: the pre-commit context guard the git hook invokes").option("--strict","Exit non-zero on a score regression").action(($)=>VV($));g.command("export").description("Write agent files from .faf — bare: AGENTS.md, .cursorrules, GEMINI.md, Copilot instructions, project.html").option("--agents","Author AGENTS.md").option("--cursor","Author .cursorrules").option("--gemini","Author GEMINI.md").option("--copilot","Author .github/copilot-instructions.md (GitHub Copilot)").option("--grok","Wire grok-faf-mcp into .grok/config.toml (opt-in; never on --all)").option("--llms","Author llms.txt (llmstxt.org view of authored 6Ws — opt-in)").option("--conductor","Author conductor config").option("--html","Author project.html (visual render of project.faf)").option("--card","Author MCP Server Card (./server-card) with the FAF context-block").option("--all","Author all formats").option("--output <path>","Write exported files to this directory instead of the current one").option("--force","Replace a project.html or Server Card faf cannot prove it wrote (edited since, or not faf's)").action(($)=>z$($));g.command("server-card").description("Emit the registry server.json identity (name + title + _meta) from project.faf — the cross-language server-card emitter; patches an existing file").option("--in <path>","Existing server.json to patch (default: ./server.json)").option("--out <path>","Output path (default: same as --in)").option("--faf <path>","project.faf path (default: auto-discover)").option("--set-version <version>","Set the version field (default: preserve existing). NOTE: not --version, which is the global CLI-version flag").option("--generated <iso>","Override the _meta generated stamp (default: preserve existing)").option("--check","Print to stdout, do not write (diff/verify — the idempotency-test hook)").option("--force","With --out: replace a file faf cannot prove it wrote (edited since, or no faf identity)").action(($)=>CG($));g.command("cards").description("Write the cards your files allow. BETTER: an agent.fafa → A2A card, AI Catalog, ARD. BEST: + project.faf → FAF context, MCP and registry cards (--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(($)=>HZ($));var JK=($,Z=[])=>[...Z,$],xy=g.command("card").description("One card at a time");xy.command("init").description("Write an agent.fafa from seven answers: name, short name, domain, what it does, version, where it runs, what it can do").option("--name <name>",'Name people see, e.g. "Weather Agent"').option("--short-name <handle>","Short name, lowercase (default: from --name)").option("--domain <domain>","Domain it is published under, e.g. example.com").option("--description <text>","What it does, one sentence").option("--set-version <version>","Its version. NOTE: not --version, which is the global CLI-version flag").option("--url <url>","Where it runs: a URL people call").option("--protocol <protocol>","Protocol at --url: a2a or mcp (default: a2a)").option("--package <name>","Where it runs: an npm package people install").option("--skill <skill>",'What it can do, "Name: description" (repeatable)',JK).option("--example <question>","A question people ask it; search finds it by these (repeatable, 2-5)",JK).option("--dir <path>","Working directory (default: cwd)").option("--out <path>","Output path (default: ./agent.fafa)").option("--force","Replace an existing agent.fafa").action(($)=>xG($));g.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").option("--verbose","Show slot breakdown").action(($,Z)=>j9($,Z));g.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>KV($));g.command("formats").description("Show supported formats").action(()=>qV());g.command("clear").description("Delete faf's cached clones (faf-git-* temp dirs)").action(()=>BV());g.command("convert").description("Print .faf as YAML or JSON (writes nothing)").option("--json","Output as JSON").action(($)=>MV($));g.command("context").description("Author context output").action(()=>LV());g.command("refresh").description("Re-ground on the live .faf — re-score, measure drift vs the DNA baseline, keep .fafb current").option("--json","Output as JSON").action(($)=>pH($));g.command("drift").description("Check context drift").option("--json","Emit the drift report as structured JSON").action(($)=>IV($));g.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>TV($,Z));g.command("recover").description("Recover .faf from context files").action(()=>AV());g.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>CV($));g.command("pro [subcommand]").description("Pro features & licensing (activate opens faf.one/pro)").action(($)=>_V($));g.command("share").description("Print a faf.one share link for .faf (built locally — nothing is sent)").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>RV($));g.command("demo").description("Demo walkthrough").action(()=>FV());g.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>PV($,Z));g.command("taf [subcommand]").description("TAF Receipts — `faf taf setup` prints the CI receipt workflow (--write creates it); bare snapshot deprecated → faf score --json").option("--output <path>","Write score snapshot to file").option("--write","taf setup: create .github/workflows/taf.yml").option("--force","With --output: replace a file faf cannot prove it wrote (edited since, or not a TAF snapshot)").action(($,Z)=>EV($,Z));g.command("ai [subcommand]").description("Ask Claude for suggestions about project.faf (analyze) — sends it to the Anthropic API, writes nothing").action(($)=>xH($));g.command("conductor [subcommand] [path]").description("Conductor config — import <path> merges into .faf; export prints it").action(($,Z)=>kH($,Z));g.command("wjttc").description("Audit test suite for WJTTC tier coverage (vendor-neutral)").option("--path <path>","Test directory (default: tests)").option("--strict","Exit non-zero if any tests are untiered").option("--json","Output as JSON for CI consumption").action(($)=>vH($));g.command("memory [subcommand] [arg]").description(".fafm soul ops — convert Claude memory, etch, recall, ls, show (etch and convert write soul.fafm)").option("-f, --file <path>","Soul file (default: ./soul.fafm)").option("-o, --output <path>","Output path (convert)").option("--namepoint <handle>","Namepoint for new/converted soul").option("--id <id>","Fact id (etch)").option("--type <type>","Fact type filter / etch type").option("--tag <tags>","Comma-separated tags (recall)").option("--priority <level>","Min priority floor (recall) or etch priority").option("--limit <n>","Max recall hits").option("--json","JSON output").option("--force","Overwrite an existing soul.fafm (convert)").action(($,Z,z)=>XK($,Z,z));g.command("bi-sync",{hidden:!0}).action(()=>O9());g.command("status",{hidden:!0}).action(()=>x5(void 0,{status:!0}));g.command("agents",{hidden:!0}).action(()=>z$({agents:!0}));g.command("cursor",{hidden:!0}).action(()=>z$({cursor:!0}));g.command("gemini",{hidden:!0}).action(()=>z$({gemini:!0}));g.command("grok",{hidden:!0}).action(()=>z$({grok:!0}));g.command("llms",{hidden:!0}).action(()=>z$({llms:!0}));g.command("validate [file]",{hidden:!0}).action(($)=>j9($));g.command("yolo",{hidden:!0}).action(()=>W9({yolo:!0}));if(process.argv.length<=2)(async()=>{let{bold:$,dim:Z,fafCyan:z}=await Promise.resolve().then(() => (i(),$W)),Q=process.cwd().replace(process.env.HOME??"","~"),X="\x1B[38;2;150;150;150m",J="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",W="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[38;2;29;29;29m"}█${"\x1B[38;2;150;150;150m"}███████${"\x1B[0m"} ${z($("faf"))} ${Z(`v${YK}`)}`);let G="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▀${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"} \x1B[0m ${Z("Nelly Never Forgets")}`),console.log(`${G}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${Q}`)}`),console.log("");try{await x5(void 0,{status:!0})}catch{}console.log(""),console.log(` ${Z("Run")} ${z("faf --help")} ${Z("for commands")}`)})();else g.addHelpText("after",["","Git-native (The GIT Version):"," faf diff [range] semantic context diff + score delta (A..B, A...B)"," faf diff --install-driver make native `git diff` render .faf deltas"," faf log score timeline across history (Proof-Over-Time)"," faf hooks --install pre-commit guard against context regression"," faf git <url> [--ref] instant scored context from any repo, any branch/tag","",' "FAF is to Context what Git is to Versions."',"","What touches what:"," read-only score check dna context drift log convert search share, diff (no --install-driver)"," sends data ai analyze (Anthropic API) · bench --submit (mcpaas.live)"," every command https://docs.faf.one/side-effects",""].join(`
587
+ `)),g.parseAsync(process.argv).catch(($)=>{if(!g$($))throw $;console.error(L6($,yy())),process.exit(1)});function yy(){let $=process.argv[2];return g.commands.find((z)=>z.name()===$||z.aliases().includes($))?.options.some((z)=>z.long==="--force")??!1}
586
588
 
587
- //# debugId=3C00384F29ABC54464756E2164756E21
589
+ //# debugId=59F5CE109EA9B35B64756E2164756E21
588
590
  //# sourceMappingURL=cli.js.map